1 2003-04-17 Miguel de Icaza <miguel@ximian.com>
3 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
4 class/struct location definition Location for the implicit
7 (Operator.Define): Use the location of the operator for the
8 implicit Method definition.
10 (Constructor.Emit): use the constructor location for the implicit
11 base initializer constructor.
13 * ecore.cs: Remove ITypeExpression. This interface is now gone,
14 and the Expression class now contains two new methods:
16 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
17 isolate type lookup from the rest of the resolution process.
19 Since we use Expressions to hold type definitions due to the way
20 we parse the input we have historically overloaded Resolve to
21 perform the Type lookups if a special flag is passed. Now this is
22 eliminated and two methods take their place.
24 The differences in the two methods between xStep and xTerminal is
25 that xStep is involved in our current lookup system that uses
26 SimpleNames to compose a name, while xTerminal is used just to
27 catch the case where the simplename lookup failed.
29 2003-04-16 Miguel de Icaza <miguel@ximian.com>
31 * expression.cs (ResolveMemberAccess): Remove redundant code.
32 TypeExpr expressions are always born fully resolved.
34 * interface.cs (PopulateMethod): Do not lookup the types twice.
35 We were doing it once during SemanticAnalysis and once during
38 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
39 in local variable type definitions, were being returned as a
40 SimpleName (we decomposed everything into a string), that is
41 because primary_expression was being used instead of a type in the
42 grammar (reduce/reduce conflicts).
44 The part that was wrong is that we converted the expression into a
45 string (an oversimplification in one hand, compounded with primary
46 expressions doing string concatenation).
52 Would return "A.B.C[]" as a SimpleName. This stopped things like
53 using clauses from working on this particular context. And a type
54 was being matched directly against "A.B.C[]".
56 We now use the correct approach, and allow for ComposedCast to be
57 part of the unary expression. So the "A.B.C []" become a composed
58 cast of "A.B.C" (as a nested group of MemberAccess with a
59 SimpleName at the end) plus the rank composition "[]".
63 2003-04-10 Miguel de Icaza <miguel@ximian.com>
65 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
66 for the access level checking.
68 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
69 `TypeContainer container', because I kept getting confused when I
70 was debugging this code.
72 * expression.cs (Indexers): Instead of tracking getters/setters,
73 we now track them in parallel. We create one arraylist less, but
74 most importantly it is possible now for the LValue code to find a
75 matching get for a set.
77 (IndexerAccess.DoResolveLValue): Update the code.
78 GetIndexersForType has been modified already to extract all the
79 indexers from a type. The code assumed it did not.
81 Also make the code set the correct return type for the indexer.
82 This was fixed a long time ago for properties, but was missing for
83 indexers. It used to be void_type.
85 (Binary.Emit): Test first for doubles instead of
86 floats, as they are more common.
88 (Binary.EmitBranchable): Use the .un version of the branch opcodes
89 when dealing with floats and the <=, >= operators. This fixes bug
92 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
93 to load the array value by emitting a load on the foreach variable
94 type. This was incorrect.
96 We now emit the code to load an element using the the array
97 variable type, and then we emit the conversion operator.
101 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
103 * attribute.cs: Avoid allocation of ArrayLists in the common case.
105 2003-04-09 Miguel de Icaza <miguel@ximian.com>
107 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
108 test for protection before we test for signatures.
110 (MethodSignature.ToString): implement.
112 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
113 to the case where we reduced into a LongConstant.
115 * decl.cs (CheckAccessLevel): If the type is an array, we can not
116 depend on whether the information is acurrate, because the
117 Microsoft runtime will always claim that the array type is public,
118 regardless of the real state.
120 If the type is a pointer, another problem happens: the type is
121 reported as non-public in Microsoft.
123 In both cases we have to call CheckAccessLevel recursively with
124 the underlying type as the argument to be tested.
126 2003-04-08 Miguel de Icaza <miguel@ximian.com>
128 * assign.cs (Assign.Emit): If we are dealing with a compound
129 assignment expression, we should use the code path that stores the
130 intermediate result in a temporary value. This fixes #40903.
132 *expression.cs (Indirection.ToString): Provide ToString method for
135 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
137 * class.cs: Null out fields holding references to Block objects so
138 they can be garbage collected.
140 * expression.cs (OverloadResolve): Remove unused local.
142 2003-04-07 Martin Baulig <martin@ximian.com>
144 * codegen.cs (EmitContext.CurrentFile): New public field.
145 (EmitContext.Mark): Use the CurrentFile to check whether the
146 location is in the correct file.
147 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
149 2003-04-07 Martin Baulig <martin@ximian.com>
151 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
153 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
154 location. [FIXME: The location argument which gets passed to this
155 method is sometimes wrong!]
157 2003-04-07 Nick Drochak <ndrochak@gol.com>
159 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
161 2003-04-07 Miguel de Icaza <miguel@ximian.com>
163 * expression.cs (Indirection.EmitAssign): We were using the
164 temporary, but returning immediately instead of continuing the
167 2003-04-06 Martin Baulig <martin@ximian.com>
169 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
170 if it's a nested child, but also deriving from the outer class.
173 * typemanager.cs (IsNestedChildOf): Make this work if it's a
174 nested child, but also deriving from the outer class. See
176 (FilterWithClosure): We may access private members of the outer
177 class if we're a nested child and deriving from the outer class.
178 (RealMemberLookup): Only set `closure_private_ok' if the
179 `original_bf' contained BindingFlags.NonPublic.
181 2003-04-05 Martin Baulig <martin@ximian.com>
183 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
185 2003-04-02 Miguel de Icaza <miguel@ximian.com>
187 * class.cs (Event.Define): Do not allow abstract events to have
190 2003-04-01 Miguel de Icaza <miguel@ximian.com>
192 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
193 block in event declarations.
195 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
196 value type, get its address.
198 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
199 leaving a class on the stack instead of a boolean value (int
200 0/1). Change the code so we compare against null, and then the
203 * class.cs (TypeContainer.GetClassBases): We were checking for the
204 parent class being sealed too late.
206 * expression.cs (Binary.Emit): For <= and >= when dealing with
207 floating point values, use cgt.un and clt.un instead of cgt and
210 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
212 * statement.cs: Apply the same optimization as MS: skip the
213 GetEnumerator returning an IEnumerator, and use the one returning a
214 CharEnumerator instead. This allows us to avoid the try-finally block
217 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
219 * cs-parser.jay: Attributes cannot be applied to
220 namespaces. Fixes #40473
222 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
225 (Add*): check if the name is valid using the full name for constants,
226 fields, properties and events.
228 2003-03-28 Miguel de Icaza <miguel@ximian.com>
230 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
231 char constants to be part of the enumeration.
233 * expression.cs (Conditional.DoResolve): Add support for operator
234 true. Implements the missing functionality from 14.12
236 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
237 operator true/false as required by the spec.
239 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
240 implicit conversion to boolean.
242 * statement.cs (Statement.ResolveBoolean): A boolean expression is
243 also one where the type implements `operator true'.
245 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
246 get an expression that will invoke operator true based on an
249 (GetConversionOperators): Removed the hack that called op_True
252 (Expression.ResolveBoolean): Move this from Statement.
254 2003-03-17 Miguel de Icaza <miguel@ximian.com>
256 * ecore.cs (FieldExpr): do not allow initialization of initonly
257 fields on derived classes
259 2003-03-13 Martin Baulig <martin@ximian.com>
261 * statement.cs (Block.Emit): Call ig.BeginScope() and
262 ig.EndScope() when compiling with debugging info; call
263 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
265 2003-03-08 Miguel de Icaza <miguel@ximian.com>
267 * expression.cs (Indexers): Do not construct immediately, allow
268 for new members to be appended as we go. Fixes 38143
270 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
272 * expression.cs: save/restore context when resolving an unchecked
275 2003-03-05 Miguel de Icaza <miguel@ximian.com>
277 * cfold.cs: Catch division by zero in modulus operator during
280 2003-03-03 Miguel de Icaza <miguel@ximian.com>
282 * interface.cs (Interface.DefineMembers): Avoid defining members
285 2003-02-27 Miguel de Icaza <miguel@ximian.com>
287 * driver.cs: handle the +/- options for -noconfig
289 * statement.cs (Unckeched.Resolve): Also track the state of
290 unchecked in the Resolve phase.
292 2003-02-27 Martin Baulig <martin@ximian.com>
294 * ecore.cs (Expression.MemberLookup): Don't create a
295 MethodGroupExpr for something which is not a method. Fixes #38291.
297 2003-02-25 Miguel de Icaza <miguel@ximian.com>
299 * class.cs (MemberBase.CheckParameters): Also check that the type
300 is unmanaged if it is a pointer.
302 * expression.cs (SizeOf.Resolve): Add location information.
304 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
305 a managed type is declared.
307 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
308 parameter modifiers as well. Fixes bug 38606
310 * class.cs: Very sad. Am backing out the speed up changes
311 introduced by the ArrayList -> Array in the TypeContainer, as they
312 were not actually that much faster, and introduced a bug (no error
313 reports on duplicated methods).
315 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
316 source first, this will guarantee that we have a valid expression
317 before calling in lower levels functions that will require a
318 resolved object. Then use this original_source in the
319 target.ResolveLValue instead of the original source that was
322 Another change. Use target.Resolve instead of LValueResolve.
323 Although we are resolving for LValues, we will let the Assign code
324 take care of that (it will be called again from Resolve). This
325 basically allows code like this:
327 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
328 class Y { void A (X x) { x [0] += o; }
330 The problem was that the indexer was trying to resolve for
331 set_Item (idx, object o) and never finding one. The real set_Item
332 was set_Item (idx, X). By delaying the process we get the right
337 2003-02-23 Martin Baulig <martin@ximian.com>
339 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
340 while calling DoEmit ().
342 * codegen.cs (EmitContext.Mark): Don't mark locations in other
343 source files; if you use the #line directive inside a method, the
344 compiler stops emitting line numbers for the debugger until it
345 reaches the end of the method or another #line directive which
346 restores the original file.
348 2003-02-23 Martin Baulig <martin@ximian.com>
350 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
352 2003-02-23 Martin Baulig <martin@ximian.com>
354 * statement.cs (Block.AddChildVariableNames): We need to call this
355 recursively, not just for our immediate children.
357 2003-02-23 Martin Baulig <martin@ximian.com>
359 * class.cs (Event.Define): Always make the field private, like csc does.
361 * typemanager.cs (TypeManager.RealMemberLookup): Make events
362 actually work, fixes bug #37521.
364 2003-02-23 Miguel de Icaza <miguel@ximian.com>
366 * delegate.cs: When creating the various temporary "Parameters"
367 classes, make sure that we call the ComputeAndDefineParameterTypes
368 on those new parameters (just like we do with the formal ones), to
369 allow them to be resolved in the context of the DeclSpace.
371 This fixes the bug that Dick observed in Bugzilla #38530.
373 2003-02-22 Miguel de Icaza <miguel@ximian.com>
375 * expression.cs (ResolveMemberAccess): When resolving a constant,
376 do not attempt to pull a constant if the value was not able to
377 generate a valid constant.
379 * const.cs (LookupConstantValue): Do not report more errors than required.
381 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
383 * expression.cs: fixes bug #38328.
385 2003-02-18 Miguel de Icaza <miguel@ximian.com>
387 * class.cs: Changed all the various members that can be part of a
388 class from being an ArrayList to be an Array of the right type.
389 During the DefineType type_list, interface_list, delegate_list and
390 enum_list are turned into types, interfaces, delegates and enums
393 And during the member population, indexer_list, event_list,
394 constant_list, field_list, instance_constructor_list, method_list,
395 operator_list and property_list are turned into their real arrays.
397 Although we could probably perform this operation earlier, for
398 good error reporting we need to keep the lists and remove the
399 lists for longer than required.
401 This optimization was triggered by Paolo profiling the compiler
402 speed on the output of `gen-sample-program.pl' perl script.
404 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
405 not crash in methods like MemberLookupFailed that use this field.
407 This problem arises when the compiler fails to resolve a type
408 during interface type definition for example.
410 2003-02-18 Miguel de Icaza <miguel@ximian.com>
412 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
413 inherit from System.Object, so we have to stop at null, not only
414 when reaching System.Object.
416 2003-02-17 Miguel de Icaza <miguel@ximian.com>
418 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
419 DeclaredOnly because the parent indexer might have had a different
420 name, but did not loop until the top of the hierarchy was reached.
422 The problem this one fixes is 35492: when a class implemented an
423 indexer from an interface, we were getting the interface method
424 (which was abstract) and we were flagging an error (can not invoke
427 This also keeps bug 33089 functioning, and test-148 functioning.
429 * typemanager.cs (IsSpecialMethod): The correct way of figuring
430 out if a method is special is to see if it is declared in a
431 property or event, or whether it is one of the predefined operator
432 names. This should fix correctly #36804.
434 2003-02-15 Miguel de Icaza <miguel@ximian.com>
436 The goal here is to remove the dependency on EmptyCast.Peel ().
437 Killing it completely.
439 The problem is that currently in a number of places where
440 constants are expected, we have to "probe" for an EmptyCast, and
441 Peel, which is not the correct thing to do, as this will be
442 repetitive and will likely lead to errors.
444 The idea is to remove any EmptyCasts that are used in casts that
445 can be reduced to constants, so we only have to cope with
448 This bug hunt was triggered by Bug 37363 and the desire to remove
449 the duplicate pattern where we were "peeling" emptycasts to check
450 whether they were constants. Now constants will always be
453 * ecore.cs: Use an enumconstant here instead of wrapping with
456 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
457 throwing me off. By handling this we can get rid of a few hacks.
459 * statement.cs (Switch): Removed Peel() code.
461 2003-02-14 Miguel de Icaza <miguel@ximian.com>
463 * class.cs: Location information for error 508
465 * expression.cs (New.DoResolve): Add a guard against double
466 resolution of an expression.
468 The New DoResolve might be called twice when initializing field
469 expressions (see EmitFieldInitializers, the call to
470 GetInitializerExpression will perform a resolve on the expression,
471 and later the assign will trigger another resolution
473 This leads to bugs (#37014)
475 * delegate.cs: The signature for EndInvoke should contain any ref
476 or out parameters as well. We were not doing this in the past.
478 * class.cs (Field.Define): Do not overwrite the type definition
479 inside the `volatile' group. Turns out that volatile enumerations
480 were changing the type here to perform a validity test, which
483 2003-02-12 Miguel de Icaza <miguel@ximian.com>
485 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
486 and structs, we do not want to load the instance variable
488 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
489 enum_type has to be handled like an object reference (implicit
490 conversions exists from this to object), but the regular IsClass
491 and IsValueType tests will never return true for this one.
493 Also we use TypeManager.IsValueType instead of type.IsValueType,
494 just for consistency with the rest of the code (this is only
495 needed if we ever use the construct exposed by test-180.cs inside
496 corlib, which we dont today).
498 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
500 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
503 2003-02-09 Martin Baulig <martin@ximian.com>
505 * namespace.cs (Namespace..ctor): Added SourceFile argument.
506 (Namespace.DefineNamespaces): New static public method; this is
507 called when we're compiling with debugging to add all namespaces
510 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
511 pass it to the Namespace's .ctor.
513 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
514 and MethodBase arguments; pass the namespace ID to the symwriter;
515 pass the MethodBase instead of the token to the symwriter.
516 (SymbolWriter.DefineNamespace): New method to add a namespace to
519 2003-02-09 Martin Baulig <martin@ximian.com>
521 * symbolwriter.cs: New file. This is a wrapper around
522 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
523 methods here in near future.
525 2003-02-09 Martin Baulig <martin@ximian.com>
527 * codegen.cs (EmitContext.Mark): Just pass the arguments to
528 ILGenerator.MarkSequencePoint() which are actually used by the
531 2003-02-09 Martin Baulig <martin@ximian.com>
533 * location.cs (SourceFile): New public sealed class. This
534 contains the name and an index which is used in the location's token.
535 (Location): Reserve an appropriate number of bits in the token for
536 the source file instead of walking over that list, this gives us a
537 really huge performance improvement when compiling with debugging.
539 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
540 `SourceFile' argument instead of a string.
541 (Driver.ProcessFile): Add all the files via Location.AddFile(),
542 but don't parse/tokenize here, we need to generate the list of all
543 source files before we do that.
544 (Driver.ProcessFiles): New static function. Parses/tokenizes all
547 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
550 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
553 2003-02-09 Martin Baulig <martin@ximian.com>
555 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
556 filename on `#line default'.
558 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
560 * statement.cs: don't clear the pinned var when the fixed statement
561 returns from the method (fixes bug#37752).
563 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
565 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
568 2003-02-07 Martin Baulig <martin@ximian.com>
570 * driver.cs: Removed the `--debug-args' command line argument.
572 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
573 automatically by the AsssemblyBuilder.
574 (CodeGen.InitializeSymbolWriter): We don't need to call any
575 initialization function on the symbol writer anymore. This method
576 doesn't take any arguments.
578 2003-02-03 Miguel de Icaza <miguel@ximian.com>
580 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
581 from referenced assemblies as well.
583 2003-02-02 Martin Baulig <martin@ximian.com>
585 * class.cs (MethodData.Emit): Generate debugging info for external methods.
587 2003-02-02 Martin Baulig <martin@ximian.com>
589 * class.cs (Constructor.Emit): Open the symbol writer before
590 emitting the constructor initializer.
591 (ConstructorInitializer.Emit): Call ec.Mark() to allow
592 single-stepping through constructor initializers.
594 2003-01-30 Miguel de Icaza <miguel@ximian.com>
596 * class.cs: Handle error 549: do not allow virtual methods in
599 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
601 * decl.cs: Check access levels when resolving types
603 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
605 * statement.cs: Add parameters and locals set in catch blocks that might
608 2003-01-29 Miguel de Icaza <miguel@ximian.com>
610 * class.cs (Operator): Set the SpecialName flags for operators.
612 * expression.cs (Invocation.DoResolve): Only block calls to
613 accessors and operators on SpecialName methods.
615 (Cast.TryReduce): Handle conversions from char constants.
618 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
620 * statement.cs: small memory and time optimization in FlowBranching.
622 2003-01-28 Pedro Mart <yoros@wanadoo.es>
624 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
625 problem that the last fix but in the other sid (Set).
627 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
628 access when there is no indexer in the hierarchy.
630 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
632 * class.cs: Combine some if statements.
634 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
636 * driver.cs: fixed bug #37187.
638 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
640 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
641 any indexer, it's needed to build a list with all the indexers in the
642 hierarchy (AllGetters), else we have problems. Fixes #35653.
644 2003-01-23 Miguel de Icaza <miguel@ximian.com>
646 * class.cs (MethodData.Define): It is wrong for an interface
647 implementation to be static in both cases: explicit and implicit.
648 We were only handling this in one case.
650 Improve the if situation there to not have negations.
652 * class.cs (Field.Define): Turns out that we do not need to check
653 the unsafe bit on field definition, only on usage. Remove the test.
655 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
657 * driver.cs: use assembly.Location instead of Codebase (the latest
658 patch made mcs fail when using MS assemblies).
660 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
662 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
663 get the path to *corlib.dll.
665 2003-01-21 Nick Drochak <ndrochak@gol.com>
669 * typemanager.cs: Remove compiler warnings
671 2003-01-20 Duncan Mak <duncan@ximian.com>
673 * AssemblyInfo.cs: Bump the version number to 0.19.
675 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
677 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
679 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
681 * class.cs (Constructor::Emit): Emit debugging info for constructors.
683 2003-01-17 Miguel de Icaza <miguel@ximian.com>
685 * cs-parser.jay: Small fix: we were not comparing the constructor
686 name correctly. Thanks to Zoltan for the initial pointer.
688 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
690 * cs-tokenizer.cs: Set file name when specified with #line
692 2003-01-15 Miguel de Icaza <miguel@ximian.com>
694 * cs-parser.jay: Only perform the constructor checks here if we
695 are named like the class; This will help provider a better
696 error. The constructor path is taken when a type definition is
697 not found, but most likely the user forgot to add the type, so
698 report that rather than the constructor error.
700 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
702 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
705 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
707 * cs-parser.jay: Add cleanup call.
709 2003-01-13 Duncan Mak <duncan@ximian.com>
711 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
712 consistent with other methods.
714 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
716 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
718 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
720 * attribute.cs: only set GuidAttr to true when we have a
723 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
727 * typemanager.cs: fixes to allow mcs compile corlib with the new
728 Type.IsSubclassOf fix.
730 2003-01-08 Miguel de Icaza <miguel@ximian.com>
732 * expression.cs (LocalVariableReference.DoResolve): Classify a
733 constant as a value, not as a variable. Also, set the type for
736 * cs-parser.jay (fixed_statement): take a type instead of a
737 pointer_type, so we can produce a better error message later.
739 * statement.cs (Fixed.Resolve): Flag types that are not pointers
742 (For.DoEmit): Make inifinite loops have a
743 non-conditional branch back.
745 (Fixed.DoEmit): First populate the pinned variables, then emit the
746 statement, then clear the variables. Before I was emitting the
747 code once for each fixed piece.
750 2003-01-08 Martin Baulig <martin@ximian.com>
752 * statement.cs (FlowBranching.MergeChild): A break in a
753 SWITCH_SECTION does not leave a loop. Fixes #36155.
755 2003-01-08 Martin Baulig <martin@ximian.com>
757 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
758 lives in the same number space than `param_map'. Fixes #36154.
760 2003-01-07 Miguel de Icaza <miguel@ximian.com>
762 * cs-parser.jay (constructor_declaration): Set the
763 Constructor.ModFlags before probing for it. This makes the
764 compiler report 514, 515 and 132 (the code was there, but got
767 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
768 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
769 (GotoCase.Resolve): Set `Returns' to ALWAYS.
771 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
773 * enum.cs: create the enum static fields using the enum type.
775 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
777 * class.cs: don't try to create the ParamBuilder for the return
778 type if it's not needed (and handle it breaking for the ms runtime
781 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
783 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
785 2002-12-29 Miguel de Icaza <miguel@ximian.com>
787 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
788 the command. This showed up while compiling the JANET source
789 code, which used \r as its only newline separator.
791 2002-12-28 Miguel de Icaza <miguel@ximian.com>
793 * class.cs (Method.Define): If we are an operator (because it
794 reuses our code), then set the SpecialName and HideBySig. #36128
796 2002-12-22 Miguel de Icaza <miguel@ximian.com>
798 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
799 exception, report error 120 `object reference required'.
801 * driver.cs: Add --pause option, used during to measure the size
802 of the process as it goes with --timestamp.
804 * expression.cs (Invocation.DoResolve): Do not allow methods with
805 SpecialName to be invoked.
807 2002-12-21 Miguel de Icaza <miguel@ximian.com>
809 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
810 number before adding it.
812 2002-12-21 Ravi Pratap <ravi@ximian.com>
814 * ecore.cs (StandardImplicitConversion): When in an unsafe
815 context, we allow conversion between void * to any other pointer
816 type. This fixes bug #35973.
818 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
820 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
821 is not thrown when extensionless outputs are used
823 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
825 * rootcontext.cs: fixed compilation of corlib.
827 2002-12-19 Miguel de Icaza <miguel@ximian.com>
829 * attribute.cs (Attributes.Contains): Add new method.
831 * class.cs (MethodCore.LabelParameters): if the parameter is an
832 `out' parameter, check that no attribute `[In]' has been passed.
834 * enum.cs: Handle the `value__' name in an enumeration.
836 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
838 * decl.cs: Added special case to allow overrides on "protected
841 2002-12-18 Ravi Pratap <ravi@ximian.com>
843 * attribute.cs (Attributes.AddAttributeSection): Rename to this
844 since it makes much more sense.
846 (Attributes.ctor): Don't require a Location parameter.
848 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
850 * attribute.cs (ApplyAttributes): Remove extra Location parameters
851 since we already have that information per attribute.
853 * everywhere : make appropriate changes.
855 * class.cs (LabelParameters): Write the code which actually
856 applies attributes to the return type. We can't do this on the MS
857 .NET runtime so we flag a warning in the case an exception is
860 2002-12-18 Miguel de Icaza <miguel@ximian.com>
862 * const.cs: Handle implicit null conversions here too.
864 2002-12-17 Ravi Pratap <ravi@ximian.com>
866 * class.cs (MethodCore.LabelParameters): Remove the extra
867 Type [] parameter since it is completely unnecessary. Instead
868 pass in the method's attributes so that we can extract
869 the "return" attribute.
871 2002-12-17 Miguel de Icaza <miguel@ximian.com>
873 * cs-parser.jay (parse): Use Report.Error to flag errors instead
874 of ignoring it and letting the compile continue.
876 * typemanager.cs (ChangeType): use an extra argument to return an
877 error condition instead of throwing an exception.
879 2002-12-15 Miguel de Icaza <miguel@ximian.com>
881 * expression.cs (Unary.TryReduce): mimic the code for the regular
882 code path. Perform an implicit cast in the cases where we can
883 implicitly convert to one of the integral types, and then reduce
884 based on that constant. This fixes bug #35483.
886 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
888 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
890 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
892 * namespace.cs: fixed bug #35489.
894 2002-12-12 Miguel de Icaza <miguel@ximian.com>
896 * class.cs: Remove some dead code.
898 * cs-parser.jay: Estimate the number of methods needed
899 (RootContext.MethodCount);
901 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
902 numbers instead of StringBuilders.
904 * support.cs (PtrHashtable): Add constructor with initial size;
905 We can now reduce reallocations of the method table.
907 2002-12-10 Ravi Pratap <ravi@ximian.com>
909 * attribute.cs (ApplyAttributes): Keep track of the emitted
910 attributes on a per-target basis. This fixes bug #35413.
912 2002-12-10 Miguel de Icaza <miguel@ximian.com>
914 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
915 default to the Windows 1252 encoding.
917 (UnixParseOption): Support version, thanks to Alp for the missing
920 * AssemblyInfo.cs: Add nice assembly information.
922 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
925 * cs-parser.jay: Allow a trailing comma before the close bracked
926 in the attribute_section production.
928 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
929 address of the instance was being taken, I will take this out,
930 because we take the address of the object immediately here.
932 2002-12-09 Ravi Pratap <ravi@ximian.com>
934 * typemanager.cs (AreMultipleAllowed): Take care of the most
935 obvious case where attribute type is not in the current assembly -
938 2002-12-08 Miguel de Icaza <miguel@ximian.com>
940 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
941 definitions, instead of doing that afterwards.
943 Also we use a nice little hack, depending on the constructor, we
944 know if we are a "composed" name or a simple name. Hence, we
945 avoid the IndexOf test, and we avoid
947 * codegen.cs: Add code to assist in a bug reporter to track down
948 the source of a compiler crash.
950 2002-12-07 Ravi Pratap <ravi@ximian.com>
952 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
953 types have been emitted for a given element and flag an error
954 if something which does not have AllowMultiple set is used more
957 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
958 attribute types and their corresponding AllowMultiple properties
960 (AreMultipleAllowed): Check the property for a given type.
962 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
963 property in the case we have a TypeContainer.
965 (Attributes.AddAttribute): Detect duplicates and just skip on
966 adding them. This trivial fix catches a pretty gross error in our
967 attribute emission - global attributes were being emitted twice!
969 Bugzilla bug #33187 is now fixed.
971 2002-12-06 Miguel de Icaza <miguel@ximian.com>
973 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
976 * expression.cs (Binary.ResolveOperator): I can only use the
977 Concat (string, string, string) and Concat (string, string,
978 string, string) if the child is actually a concatenation of
981 2002-12-04 Miguel de Icaza <miguel@ximian.com>
983 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
984 context where we need a 2-character lookahead.
986 * pending.cs (PendingImplementation): Rework so we can keep track
987 of interface types all the time, and flag those which were
988 implemented by parents as optional.
990 2002-12-03 Miguel de Icaza <miguel@ximian.com>
992 * expression.cs (Binary.ResolveOperator): Use
993 String.Concat(string,string,string) or
994 String.Concat(string,string,string,string) when possible.
996 * typemanager: More helper methods.
999 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
1001 * pending.cs: remove the bogus return from GetMissingInterfaces()
1002 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
1004 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1006 * namespace.cs: avoid duplicated 'using xxx' being added to
1007 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
1008 when we get more than one 'using' statement for the same namespace.
1009 Report a CS0105 warning for it.
1011 2002-11-30 Miguel de Icaza <miguel@ximian.com>
1013 * cs-tokenizer.cs (consume_identifier): use read directly, instead
1014 of calling getChar/putback, uses internal knowledge of it.
1016 (xtoken): Reorder tokenizer so most common patterns are checked
1017 first. This reduces the compilation time in another 5% (from 8.11s
1018 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
1020 The parsing time is 22% of the compilation in mcs, and from that
1021 64% is spent on the tokenization process.
1023 I tried using a binary search for keywords, but this is slower
1024 than the hashtable. Another option would be to do a couple of
1027 * Not use a StringBuilder, instead use an array of chars,
1028 with a set value. Notice that this way we could catch
1029 the 645 error without having to do it *afterwards*.
1031 * We could write a hand-parser to avoid the hashtable
1032 compares altogether.
1034 The identifier consumption process takes 37% of the tokenization
1035 time. Another 15% is spent on is_number. 56% of the time spent
1036 on is_number is spent on Int64.Parse:
1038 * We could probably choose based on the string length to
1039 use Int32.Parse or Int64.Parse and avoid all the 64-bit
1042 Another 3% is spend on wrapping `xtoken' in the `token' function.
1044 Handle 0xa0 as whitespace (#34752)
1046 2002-11-26 Miguel de Icaza <miguel@ximian.com>
1048 * typemanager.cs (IsCLRType): New routine to tell whether a type
1049 is one of the builtin types.
1051 Maybe it needs to use TypeCodes to be faster. Maybe we could use
1052 typecode in more places instead of doing pointer comparissions.
1053 We could leverage some knowledge about the way the typecodes are
1056 New code to cache namespaces in assemblies, it is currently not
1057 invoked, to be used soon.
1059 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
1061 * expression.cs (Binary.ResolveOperator): specially handle
1062 strings, and do not perform user-defined operator overloading for
1065 2002-11-24 Miguel de Icaza <miguel@ximian.com>
1067 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
1068 internalcall as it is a pretty simple operation; Avoid whenever
1069 possible to call Char.IsLetter.
1071 (consume_identifier): Cut by half the number of
1072 hashtable calls by merging the is_keyword and GetKeyword behavior.
1074 Do not short-circuit, because if we do, we
1075 report errors (ie, #if false && true would produce an invalid
1079 2002-11-24 Martin Baulig <martin@ximian.com>
1081 * expression.cs (Cast.TryReduce): If we're in checked syntax,
1082 check constant ranges and report a CS0221. Fixes #33186.
1084 2002-11-24 Martin Baulig <martin@ximian.com>
1086 * cs-parser.jay: Make this work for uninitialized variable
1087 declarations in the `for' initializer. Fixes #32416.
1089 2002-11-24 Martin Baulig <martin@ximian.com>
1091 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
1092 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
1094 2002-11-24 Martin Baulig <martin@ximian.com>
1096 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
1097 argument; if true, we also check for user-defined conversions.
1098 This is only needed if both arguments are of a user-defined type.
1099 Fixes #30443, added test-175.cs.
1100 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
1102 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
1104 2002-11-24 Martin Baulig <martin@ximian.com>
1106 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
1107 function to get the store opcode.
1108 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
1109 only emit the Ldelema if the store opcode is Stobj. You must run
1110 both test-34 and test-167 to test this. Fixes #34529.
1112 2002-11-23 Martin Baulig <martin@ximian.com>
1114 * ecore.cs (Expression.MemberLookup): Added additional
1115 `qualifier_type' argument which is used when we're being called
1116 from MemberAccess.DoResolve() and null if we're called from a
1118 (Expression.MemberLookupFailed): New method to report errors; this
1119 does the CS1540 check and reports the correct error message.
1121 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
1122 argument for the CS1540 check and redone the way how we're dealing
1123 with private members. See the comment in the source code for details.
1124 (FilterWithClosure): Reverted this back to revision 1.197; renamed
1125 `closure_start_type' to `closure_qualifier_type' and check whether
1126 it's not null. It was not this filter being broken, it was just
1127 being called with the wrong arguments.
1129 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
1130 and pass it the correct `qualifier_type'; this also does the error
1133 2002-11-22 Miguel de Icaza <miguel@ximian.com>
1135 * expression.cs (Invocation.EmitParams): If the we are dealing
1136 with a non-built-in value type, load its address as well.
1138 (ArrayCreation): Use a a pretty constant instead
1139 of the hardcoded value 2. Use 6 instead of 2 for the number of
1140 static initializers.
1142 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
1143 because they are not really value types, just glorified integers.
1145 * driver.cs: Do not append .exe, the CSC compiler does not do it.
1147 * ecore.cs: Remove redundant code for enumerations, make them use
1148 the same code path as everything else, fixes the casting issue
1149 with enumerations in Windows.Forms.
1151 * attribute.cs: Do only cast to string if it is a string, the
1152 validation happens later.
1154 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
1155 people upgrade their corlibs.
1157 * ecore.cs: Oops, enumerations were not following the entire code path
1159 2002-11-21 Miguel de Icaza <miguel@ximian.com>
1161 * typemanager.cs (FilterWithClosure): Commented out the test for
1162 1540 in typemanager.cs, as it has problems when accessing
1163 protected methods from a parent class (see test-174.cs).
1165 * attribute.cs (Attribute.ValidateGuid): new method.
1166 (Attribute.Resolve): Use above.
1168 2002-11-19 Miguel de Icaza <miguel@ximian.com>
1170 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
1172 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
1173 handling for enumerations, as we only needed the TypeContainer
1174 functionality to begin with (this is required for the fix below to
1175 work for enums that reference constants in a container class for
1178 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
1180 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
1181 a valid TypeBuilder to perform lookups on.o
1183 * class.cs (InheritableMemberSignatureCompare): Use true in the
1184 call to GetGetMethod and GetSetMethod, because we are comparing
1185 the signature, and we need to get the methods *even* if they are
1188 (PropertyBase.CheckBase): ditto.
1190 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
1191 GotoCase.Resolve): Use Peel on EmpytCasts.
1193 * ecore.cs (EmptyCast): drop child, add Peel method.
1195 2002-11-17 Martin Baulig <martin@ximian.com>
1197 * ecore.cs (EmptyCast.Child): New public property.
1199 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
1200 label resolved to an EmptyCast. Fixes #34162.
1201 (GotoCase.Resolve): Likewise.
1202 (Block.EmitMeta): Likewise.
1204 2002-11-17 Martin Baulig <martin@ximian.com>
1206 * expression.cs (Invocation.BetterConversion): Prefer int over
1207 uint; short over ushort; long over ulong for integer literals.
1208 Use ImplicitConversionExists instead of StandardConversionExists
1209 since we also need to check for user-defined implicit conversions.
1210 Fixes #34165. Added test-173.cs.
1212 2002-11-16 Martin Baulig <martin@ximian.com>
1214 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
1215 with the `true' and `false' literals. Fixes #33151.
1217 2002-11-16 Martin Baulig <martin@ximian.com>
1219 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
1220 October 22nd; don't do the cs1540 check for static members.
1222 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
1223 now using our own filter here and doing the cs1540 check again.
1225 2002-11-16 Martin Baulig <martin@ximian.com>
1227 * support.cs (InternalParameters): Don't crash if we don't have
1228 any fixed parameters. Fixes #33532.
1230 2002-11-16 Martin Baulig <martin@ximian.com>
1232 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
1233 when looking up static methods to make this work on Windows.
1236 2002-11-16 Martin Baulig <martin@ximian.com>
1238 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
1239 a setter rather than using PropertyInfo.CanWrite.
1241 2002-11-15 Nick Drochak <ndrochak@gol.com>
1243 * class.cs: Allow acces to block member by subclasses. Fixes build
1246 2002-11-14 Martin Baulig <martin@ximian.com>
1248 * class.cs (Constructor.Emit): Added the extern/block check.
1251 2002-11-14 Martin Baulig <martin@ximian.com>
1253 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
1254 iteration while looking for indexers, this is needed because the
1255 indexer may have a different name in our base classes. Fixed the
1256 error reporting (no indexers at all, not get accessor, no
1257 overloaded match). Fixes bug #33089.
1258 (IndexerAccess.DoResolveLValue): Likewise.
1260 2002-11-14 Martin Baulig <martin@ximian.com>
1262 * class.cs (PropertyBase.CheckBase): Make this work for multiple
1263 indexers. Fixes the first part of bug #33089.
1264 (MethodSignature.InheritableMemberSignatureCompare): Added support
1267 2002-11-13 Ravi Pratap <ravi@ximian.com>
1269 * attribute.cs (Attribute.Resolve): Catch the
1270 NullReferenceException and report it since it isn't supposed to
1273 2002-11-12 Miguel de Icaza <miguel@ximian.com>
1275 * expression.cs (Binary.EmitBranchable): Also handle the cases for
1276 LogicalOr and LogicalAnd that can benefit from recursively
1277 handling EmitBranchable. The code now should be nice for Paolo.
1279 2002-11-08 Miguel de Icaza <miguel@ximian.com>
1281 * typemanager.cs (LookupType): Added a negative-hit hashtable for
1282 the Type lookups, as we perform quite a number of lookups on
1283 non-Types. This can be removed once we can deterministically tell
1284 whether we have a type or a namespace in advance.
1286 But this might require special hacks from our corlib.
1290 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
1291 and double which avoids a conversion from an integer to a double.
1293 * expression.cs: tiny optimization, avoid calling IsConstant,
1294 because it effectively performs the lookup twice.
1296 2002-11-06 Miguel de Icaza <miguel@ximian.com>
1298 But a bogus return here to keep the semantics of the old code
1299 until the Mono runtime is fixed.
1301 * pending.cs (GetMissingInterfaces): New method used to remove all
1302 the interfaces that are already implemented by our parent
1303 classes from the list of pending methods.
1305 * interface.cs: Add checks for calls after ResolveTypeExpr.
1307 2002-11-05 Miguel de Icaza <miguel@ximian.com>
1309 * class.cs (Class.Emit): Report warning 67: event not used if the
1310 warning level is beyond 3.
1312 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
1313 being a NullLiteral.
1315 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
1318 * class.cs (TypeContainer.GetClassBases): Cover a missing code
1319 path that might fail if a type can not be resolved.
1321 * expression.cs (Binary.Emit): Emit unsigned versions of the
1324 * driver.cs: use error 5.
1326 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
1328 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
1330 2002-11-01 Miguel de Icaza <miguel@ximian.com>
1332 * cs-parser.jay (switch_section): A beautiful patch from Martin
1333 Baulig that fixed 33094.
1335 2002-10-31 Miguel de Icaza <miguel@ximian.com>
1337 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
1338 Check whether the base is abstract and report an error if so.
1340 * expression.cs (IndexerAccess.DoResolveLValue,
1341 IndexerAccess.DoResolve): ditto.
1343 (Invocation.DoResolve): ditto.
1345 (Invocation.FullMethodDesc): Improve the report string.
1347 * statement.cs (Block): Eliminate IsVariableDefined as it is
1348 basically just a wrapper for GetVariableInfo.
1350 * ecore.cs (SimpleName): Use new
1352 * support.cs (ReflectionParamter.ParameterType): We unwrap the
1353 type, as we return the actual parameter ref/unref state on a
1356 2002-10-30 Miguel de Icaza <miguel@ximian.com>
1358 * support.cs: Return proper flags REF/OUT fixing the previous
1361 * expression.cs: Reverted last patch, that was wrong. Is_ref is
1362 not used to mean `ref' but `ref or out' in ParameterReference
1364 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
1365 full type signature instead of calling TypeManger.CSharpName
1368 * support.cs (InternalParameters.ParameterDesc): Do not compare
1369 directly to the modflags, because REF/OUT will actually be bitsets
1372 * delegate.cs (VerifyMethod): Check also the modifiers.
1374 * cs-tokenizer.cs: Fix bug where floating point values with an
1375 exponent where a sign was missing was ignored.
1377 * driver.cs: Allow multiple assemblies to be specified in a single
1380 2002-10-28 Miguel de Icaza <miguel@ximian.com>
1382 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
1383 because identifiers after a parenthesis would end up in this kind
1384 of production, and we needed to desamiguate it for having casts
1387 (UserDefinedType *) xxx
1389 2002-10-24 Miguel de Icaza <miguel@ximian.com>
1391 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
1392 we should set on the Bindingflags.NonPublic, but not turn on
1393 private_ok. private_ok controls whether a Private member is
1394 returned (this is chekced on the filter routine), while the
1395 BindingFlags.NonPublic just controls whether private/protected
1396 will be allowed. This fixes the problem part of the problem of
1397 private properties being allowed to be used in derived classes.
1399 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
1400 so we can call the children DoResolveLValue method (this will
1401 properly signal errors on lvalue assignments to base properties)
1403 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
1404 getter are null, and we have a property info, we know that this
1405 happened because the lookup failed, so we report an error 122 for
1406 protection level violation.
1408 We also silently return if setter and getter are null in the
1409 resolve functions, this condition only happens if we have flagged
1410 the error before. This is the other half of the problem.
1412 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
1413 not have accessibility information, that is why we were returning
1414 true in the filter function in typemanager.cs.
1416 To properly report 122 (property is inaccessible because of its
1417 protection level) correctly, we report this error in ResolveAccess
1418 by failing if both the setter and the getter are lacking (ie, the
1421 DoResolve and DoLResolve have been modified to check for both
1422 setter/getter being null and returning silently, the reason being
1423 that I did not want to put the knowledge about this error in upper
1426 int old = Report.Errors;
1427 x = new PropertyExpr (...);
1428 if (old != Report.Errors)
1433 So the property expr is returned, but it is invalid, so the error
1434 will be flagged during the resolve process.
1436 * class.cs: Remove InheritablePropertySignatureCompare from the
1437 class, as we no longer depend on the property signature to compute
1438 whether it is possible to implement a method or not.
1440 The reason is that calling PropertyInfo.GetGetMethod will return
1441 null (in .NET, in Mono it works, and we should change this), in
1442 cases where the Get Method does not exist in that particular
1447 class X { public virtual int A { get { return 1; } } }
1449 class Z : Y { public override int A { get { return 2; } } }
1451 Would fail in Z because the parent (Y) would not have the property
1452 defined. So we avoid this completely now (because the alternative
1453 fix was ugly and slow), and we now depend exclusively on the
1456 (PropertyBase.CheckBase): Use a method-base mechanism to find our
1457 reference method, instead of using the property.
1459 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
1460 routines are gone now.
1462 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
1463 names, they were incorrectly named.
1465 * cs-tokenizer.cs: Return are more gentle token on failure.
1467 * pending.cs (PendingImplementation.InterfaceMethod): This routine
1468 had an out-of-sync index variable, which caused it to remove from
1469 the list of pending methods the wrong method sometimes.
1471 2002-10-22 Miguel de Icaza <miguel@ximian.com>
1473 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
1474 CanWrite, because those refer to this particular instance of the
1475 property, and do not take into account the fact that we can
1476 override single members of a property.
1478 Constructor requires an EmitContext. The resolution process does
1479 not happen here, but we need to compute the accessors before,
1480 because the resolution does not always happen for properties.
1482 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
1483 subclass, before we did not update this flag, but we did update
1486 (GetAccessors): Drop this routine, as it did not work in the
1487 presence of partially overwritten set/get methods.
1489 Notice that this broke the cs1540 detection, but that will require
1492 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1496 * driver.cs: issue a warning instead of an error if we don't support
1497 debugging for the platform. Also ignore a couple of errors that may
1498 arise when trying to write the symbols. Undo my previous patch.
1500 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1502 * driver.cs: ignore /debug switch except for Unix platforms.
1504 2002-10-23 Nick Drochak <ndrochak@gol.com>
1506 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
1508 2002-10-21 Miguel de Icaza <miguel@ximian.com>
1510 * driver.cs: Do not make mcs-debug conditional, so we do not break
1513 * statement.cs (UsageVector.MergeChildren): I would like Martin to
1514 review this patch. But basically after all the children variables
1515 have been merged, the value of "Breaks" was not being set to
1516 new_breaks for Switch blocks. I think that it should be set after
1517 it has executed. Currently I set this to the value of new_breaks,
1518 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
1519 conservative, but I do not understand this code very well.
1521 I did not break anything in the build, so that is good ;-)
1523 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
1525 2002-10-20 Mark Crichton <crichton@gimp.org>
1527 * cfold.cs: Fixed compile blocker. Really fixed it this time.
1529 2002-10-20 Nick Drochak <ndrochak@gol.com>
1531 * cfold.cs: Fixed compile blocker.
1533 2002-10-20 Miguel de Icaza <miguel@ximian.com>
1535 * driver.cs: I was chekcing the key, not the file.
1537 2002-10-19 Ravi Pratap <ravi@ximian.com>
1539 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
1540 message that we were generating - we just need to silently return
1543 2002-10-19 Miguel de Icaza <miguel@ximian.com>
1545 * class.cs (Event.Define): Change my previous commit, as this
1546 breaks the debugger. This is a temporary hack, as it seems like
1547 the compiler is generating events incorrectly to begin with.
1549 * expression.cs (Binary.ResolveOperator): Added support for
1550 "U operator - (E x, E y)"
1552 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
1555 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
1556 init-only variables, but this path did not take into account that
1557 there might be also instance readonly variables. Correct this
1560 This fixes bug 32253
1562 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
1565 * driver.cs: Change the extension for modules to `netmodule'
1567 * cs-parser.jay: Improved slightly the location tracking for
1568 the debugger symbols.
1570 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
1571 modifiers that were specified instead of the hardcoded value
1572 (FamAndAssem). This was basically ignoring the static modifier,
1573 and others. Fixes 32429.
1575 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
1576 fixed a bug in the process (32476)
1578 * expression.cs (ArrayAccess.EmitAssign): Patch from
1579 hwang_rob@yahoo.ca that fixes bug 31834.3
1581 2002-10-18 Miguel de Icaza <miguel@ximian.com>
1583 * driver.cs: Make the module extension .netmodule.
1585 2002-10-16 Miguel de Icaza <miguel@ximian.com>
1587 * driver.cs: Report an error if the resource file is not found
1588 instead of crashing.
1590 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
1591 false, like Emit does.
1593 2002-10-16 Nick Drochak <ndrochak@gol.com>
1595 * typemanager.cs: Remove unused private member. Also reported mcs
1596 bug to report this as a warning like csc.
1598 2002-10-15 Martin Baulig <martin@gnome.org>
1600 * statement.cs (Statement.Emit): Made this a virtual method; emits
1601 the line number info and calls DoEmit().
1602 (Statement.DoEmit): New protected abstract method, formerly knows
1603 as Statement.Emit().
1605 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
1607 2002-10-11 Miguel de Icaza <miguel@ximian.com>
1609 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
1610 have fixed a remaining problem: not every AddXXXX was adding a
1611 fully qualified name.
1613 Now everyone registers a fully qualified name in the DeclSpace as
1614 being defined instead of the partial name.
1616 Downsides: we are slower than we need to be due to the excess
1617 copies and the names being registered this way.
1619 The reason for this is that we currently depend (on the corlib
1620 bootstrap for instance) that types are fully qualified, because
1621 we dump all the types in the namespace, and we should really have
1622 types inserted into the proper namespace, so we can only store the
1623 basenames in the defined_names array.
1625 2002-10-10 Martin Baulig <martin@gnome.org>
1627 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
1628 from bug #31834, see the bug report for a testcase which is
1631 2002-10-10 Martin Baulig <martin@gnome.org>
1633 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
1634 flow analysis code for this.
1636 * statement.cs (Do, While, For): Tell the flow analysis code about
1638 (FlowBranching.UsageVector): Added support for infinite loops.
1639 (Block.Resolve): Moved the dead code elimination here and use flow
1642 2002-10-09 Miguel de Icaza <miguel@ximian.com>
1644 * class.cs (Field.Define): Catch cycles on struct type
1647 * typemanager.cs (IsUnmanagedtype): Do not recursively check
1648 fields if the fields are static. We only need to check instance
1651 * expression.cs (As.DoResolve): Test for reference type.
1653 * statement.cs (Using.ResolveExpression): Use
1654 ConvertImplicitRequired, not ConvertImplicit which reports an
1656 (Using.ResolveLocalVariableDecls): ditto.
1658 * expression.cs (Binary.ResolveOperator): Report errors in a few
1659 places where we had to.
1661 * typemanager.cs (IsUnmanagedtype): Finish implementation.
1663 2002-10-08 Miguel de Icaza <miguel@ximian.com>
1665 * expression.cs: Use StoreFromPtr instead of extracting the type
1666 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
1668 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
1669 an enumeration value to a System.Enum, but System.Enum is not a
1670 value type, but an class type, so we need to box.
1672 (Expression.ConvertExplicit): One codepath could return
1673 errors but not flag them. Fix this. Fixes #31853
1675 * parameter.cs (Resolve): Do not allow void as a parameter type.
1677 2002-10-06 Martin Baulig <martin@gnome.org>
1679 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
1680 if it's a class type and not a struct. Fixes #31815.
1682 2002-10-06 Martin Baulig <martin@gnome.org>
1684 * statement.cs: Reworked the flow analysis code a bit to make it
1685 usable for dead code elimination.
1687 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1689 * cs-parser.jay: allow empty source files. Fixes bug #31781.
1691 2002-10-04 Miguel de Icaza <miguel@ximian.com>
1693 * expression.cs (ComposedCast.DoResolveType): A quick workaround
1694 to fix the test 165, will investigate deeper.
1696 2002-10-04 Martin Baulig <martin@gnome.org>
1698 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
1699 finally blocks actually work.
1700 (Try.Resolve): We don't need to create a sibling for `finally' if
1701 there is no finally block.
1703 2002-10-04 Martin Baulig <martin@gnome.org>
1705 * class.cs (Constructor.Define): The default accessibility for a
1706 non-default constructor is private, not public.
1708 2002-10-04 Miguel de Icaza <miguel@ximian.com>
1710 * class.cs (Constructor): Make AllowedModifiers public, add
1713 * cs-parser.jay: Perform the modifiers test here, as the
1714 constructor for the Constructor class usually receives a zero
1715 because of the way we create it (first we create, later we
1716 customize, and we were never checking the modifiers).
1718 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
1719 is a version of LookupTypeReflection that includes the type-name
1720 cache. This can be used as a fast path for functions that know
1721 the fully qualified name and are only calling into *.GetType() to
1722 obtain a composed type.
1724 This is also used by TypeManager.LookupType during its type
1727 (LookupType): We now also track the real type name, as sometimes
1728 we can get a quey for the real type name from things like
1729 ComposedCast. This fixes bug 31422.
1731 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
1732 complete type fullname, it does not have to go through the type
1733 resolution system to obtain the composed version of the type (for
1734 obtaining arrays or pointers).
1736 (Conditional.Emit): Use the EmitBoolExpression to
1737 generate nicer code, as requested by Paolo.
1739 (ArrayCreation.CheckIndices): Use the patch from
1740 hwang_rob@yahoo.ca to validate the array initializers.
1742 2002-10-03 Miguel de Icaza <miguel@ximian.com>
1744 * class.cs (ConstructorInitializer.Emit): simplify code by using
1745 Invocation.EmitCall, and at the same time, fix the bugs in calling
1746 parent constructors that took variable arguments.
1748 * ecore.cs (Expression.ConvertNumericExplicit,
1749 Expression.ImplicitNumericConversion): Remove the code that
1750 manually wrapped decimal (InternalTypeConstructor call is now gone
1753 * expression.cs (Cast.TryReduce): Also handle decimal types when
1754 trying to perform a constant fold on the type.
1756 * typemanager.cs (IsUnmanagedtype): Partially implemented.
1758 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
1759 that only turned off an error report, and did nothing else.
1761 2002-10-02 Miguel de Icaza <miguel@ximian.com>
1763 * driver.cs: Handle and ignore /fullpaths
1765 2002-10-01 Miguel de Icaza <miguel@ximian.com>
1767 * expression.cs (Binary.ResolveOperator): Catch the case where
1768 DoNumericPromotions returns true,
1770 (Binary.DoNumericPromotions): Simplify the code, and the tests.
1772 2002-09-27 Miguel de Icaza <miguel@ximian.com>
1774 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
1777 2002-09-26 Miguel de Icaza <miguel@ximian.com>
1779 * ecore.cs (ConvertNumericExplicit): It is not enough that the
1780 conversion exists, but it is also required that the conversion be
1781 performed. This manifested in "(Type64Enum) 2".
1783 * class.cs (TypeManager.AddMethod): The fix is not to change
1784 AddEnum, because that one was using a fully qualified name (every
1785 DeclSpace derivative does), but to change the AddMethod routine
1786 that was using an un-namespaced name. This now correctly reports
1787 the duplicated name.
1789 Revert patch until I can properly fix it. The issue
1790 is that we have a shared Type space across all namespaces
1791 currently, which is wrong.
1793 Options include making the Namespace a DeclSpace, and merge
1794 current_namespace/current_container in the parser.
1796 2002-09-25 Miguel de Icaza <miguel@ximian.com>
1798 * cs-parser.jay: Improve error reporting when we get a different
1799 kind of expression in local_variable_type and
1800 local_variable_pointer_type.
1802 Propagate this to avoid missleading errors being reported.
1804 * ecore.cs (ImplicitReferenceConversion): treat
1805 TypeManager.value_type as a target just like object_type. As
1810 Is valid, and needs to result in the int 1 being boxed before it
1811 is assigned to the value type v.
1813 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
1814 to validate the enumeration name.
1816 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
1817 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
1818 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
1820 * ecore.cs (TryImplicitIntConversion): When doing an
1821 implicit-enumeration-conversion, check if the type is 64-bits and
1822 perform a conversion before passing to EnumConstant.
1824 2002-09-23 Miguel de Icaza <miguel@ximian.com>
1826 * decl.cs (Error_AmbiguousTypeReference); New routine used to
1827 report ambiguous type references. Unlike the MS version, we
1828 report what the ambiguity is. Innovation at work ;-)
1830 (DeclSpace.FindType): Require a location argument to
1831 display when we display an ambiguous error.
1833 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
1835 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
1837 * expression.cs (EmitDynamicInitializers): Apply patch from
1838 hwang_rob@yahoo.ca that fixes the order in which we emit our
1841 2002-09-21 Martin Baulig <martin@gnome.org>
1843 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
1844 delegate takes no arguments.
1846 2002-09-20 Miguel de Icaza <miguel@ximian.com>
1848 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
1851 * expression.cs: Extract the underlying type.
1853 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
1855 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
1857 2002-09-19 Miguel de Icaza <miguel@ximian.com>
1859 * class.cs (TypeContainer.DefineType): We can not use the nice
1860 PackingSize with the size set to 1 DefineType method, because it
1861 will not allow us to define the interfaces that the struct
1864 This completes the fixing of bug 27287
1866 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
1867 means also structs. This fixes part of the problem.
1868 (Expresion.ImplicitReferenceConversionExists): ditto.
1870 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
1871 error if there were no errors reported during the type lookup
1872 process, to avoid duplicates or redundant errors. Without this
1873 you would get an ambiguous errors plus a type not found. We have
1874 beaten the user enough with the first error.
1876 (DeclSparce.FindType): Emit a warning if we have an ambiguous
1879 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
1880 during the resolution process, stop the lookup, this avoids
1881 repeated error reports (same error twice).
1883 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
1885 * typemanager.cs (LookupType): Redo the type lookup code to match
1886 the needs of System.Reflection.
1888 The issue is that System.Reflection requires references to nested
1889 types to begin with a "+" sign instead of a dot. So toplevel
1890 types look like: "NameSpace.TopLevelClass", and nested ones look
1891 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
1894 2002-09-19 Martin Baulig <martin@gnome.org>
1896 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
1897 says that a method always returns or always throws an exception,
1898 don't report the CS0161.
1900 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
1901 set `Returns = new_returns'.
1903 2002-09-19 Martin Baulig <martin@gnome.org>
1905 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
1906 to an enum constant, check for a CS0176.
1908 2002-09-18 Miguel de Icaza <miguel@ximian.com>
1910 * class.cs (TypeContainer.CheckPairedOperators): Now we check
1911 for operators that must be in pairs and report errors.
1913 * ecore.cs (SimpleName.DoResolveType): During the initial type
1914 resolution process, when we define types recursively, we must
1915 check first for types in our current scope before we perform
1916 lookups in the enclosing scopes.
1918 * expression.cs (MakeByteBlob): Handle Decimal blobs.
1920 (Invocation.VerifyArgumentsCompat): Call
1921 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
1922 I thought we were supposed to always call this, but there are a
1923 few places in the code where we dont do it.
1925 2002-09-17 Miguel de Icaza <miguel@ximian.com>
1927 * driver.cs: Add support in -linkres and -resource to specify the
1928 name of the identifier.
1930 2002-09-16 Miguel de Icaza <miguel@ximian.com>
1932 * ecore.cs (StandardConversionExists): Sync with the conversion
1933 code: allow anything-* to void* conversions.
1935 (FindMostSpecificSource): Use an Expression argument
1936 instead of a Type, because we might be handed over a Literal which
1937 gets a few more implicit conversions that plain types do not. So
1938 this information was being lost.
1940 Also, we drop the temporary type-holder expression when not
1943 2002-09-17 Martin Baulig <martin@gnome.org>
1945 * class.cs (PropertyBase.CheckBase): Don't check the base class if
1946 this is an explicit interface implementation.
1948 2002-09-17 Martin Baulig <martin@gnome.org>
1950 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
1951 different `IndexerName' attributes.
1953 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
1954 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
1955 virtual CommonResolve().
1957 2002-09-16 Miguel de Icaza <miguel@ximian.com>
1959 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
1960 and convert that to the UnderlyingType.
1962 * statement.cs (Foreach.Resolve): Indexers are just like variables
1963 or PropertyAccesses.
1965 * cs-tokenizer.cs (consume_string): Track line numbers and columns
1966 inside quoted strings, we were not doing this before.
1968 2002-09-16 Martin Baulig <martin@gnome.org>
1970 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
1971 resolve it. This is needed for the definite assignment check of the
1972 instance expression, fixes bug #29846.
1973 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
1975 2002-09-16 Nick Drochak <ndrochak@gol.com>
1977 * parameter.cs: Fix compile error. Cannot reference static member
1978 from an instance object. Is this an mcs bug?
1980 2002-09-14 Martin Baulig <martin@gnome.org>
1982 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
1983 multiple times. Fixes bug #30295, added test-166.cs.
1985 2002-09-14 Martin Baulig <martin@gnome.org>
1987 * statement.cs (Block.Emit): Don't emit unreachable code.
1988 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
1990 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
1992 2002-09-14 Martin Baulig <martin@gnome.org>
1994 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
1997 2002-09-14 Martin Baulig <martin@gnome.org>
1999 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
2000 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
2001 be false on the ms runtime.
2003 2002-09-13 Martin Baulig <martin@gnome.org>
2005 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
2006 the CS0038 error message.
2008 2002-09-12 Miguel de Icaza <miguel@ximian.com>
2010 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
2011 constant inside, return it.
2013 2002-09-12 Martin Baulig <martin@gnome.org>
2015 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
2016 implicit conversion can be done between enum types.
2018 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
2019 check whether an implicit conversion to the current enum's UnderlyingType
2020 exists and report an error if not.
2022 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
2023 without debugging support.
2025 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
2026 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
2028 2002-09-12 Martin Baulig <martin@gnome.org>
2030 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
2032 * ecore.cs (IMemberExpr.DeclaringType): New property.
2033 (SimpleName.SimpleNameResolve): Check whether we're accessing a
2034 nonstatic member of an outer type (CS0038).
2036 2002-09-11 Miguel de Icaza <miguel@ximian.com>
2038 * driver.cs: Activate the using-error detector at warning level
2039 4 (at least for MS-compatible APIs).
2041 * namespace.cs (VerifyUsing): Small buglett fix.
2043 * pending.cs (PendingImplementation): pass the container pointer.
2045 * interface.cs (GetMethods): Allow for recursive definition. Long
2046 term, I would like to move every type to support recursive
2047 definitions, not the current ordering mechanism that we have right
2050 The situation is this: Attributes are handled before interfaces,
2051 so we can apply attributes to interfaces. But some attributes
2052 implement interfaces, we will now handle the simple cases
2053 (recursive definitions will just get an error).
2055 * parameter.cs: Only invalidate types at the end if we fail to
2058 2002-09-09 Martin Baulig <martin@gnome.org>
2060 * ecore.cs (PropertyExpr.Emit): Also check for
2061 TypeManager.system_int_array_get_length so this'll also work when
2062 compiling corlib. Fixes #30003.
2064 2002-09-09 Martin Baulig <martin@gnome.org>
2066 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
2067 and throw an exception if we can't get the type's size. Fixed #30040,
2070 2002-09-09 Martin Baulig <martin@gnome.org>
2072 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
2074 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
2075 context. Fixes bug #30027.
2077 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
2078 virtual functions. Fixes bug #30043, added test-164.cs.
2080 2002-09-08 Ravi Pratap <ravi@ximian.com>
2082 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
2084 2002-09-08 Nick Drochak <ndrochak@gol.com>
2086 * driver.cs: Use an object to get the windows codepage since it's not a
2089 2002-09-08 Miguel de Icaza <miguel@ximian.com>
2091 * statement.cs (For.Emit): for infinite loops (test == null)
2092 return whether there is a break inside, not always "true".
2094 * namespace.cs (UsingEntry): New struct to hold the name of the
2095 using definition, the location where it is defined, and whether it
2096 has been used in a successful type lookup.
2098 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
2103 2002-09-06 Ravi Pratap <ravi@ximian.com>
2105 * attribute.cs : Fix incorrect code which relied on catching
2106 a NullReferenceException to detect a null being passed in
2107 where an object was expected.
2109 2002-09-06 Miguel de Icaza <miguel@ximian.com>
2111 * statement.cs (Try): flag the catch variable as assigned
2113 * expression.cs (Cast): Simplified by using ResolveType instead of
2116 * statement.cs (Catch): Fix bug by using ResolveType.
2118 2002-09-06 Ravi Pratap <ravi@ximian.com>
2120 * expression.cs (BetterConversion): Special case for when we have
2121 a NullLiteral as the argument and we have to choose between string
2122 and object types - we choose string the way csc does.
2124 * attribute.cs (Attribute.Resolve): Catch the
2125 NullReferenceException and report error #182 since the Mono
2126 runtime no more has the bug and having this exception raised means
2127 we tried to select a constructor which takes an object and is
2130 2002-09-05 Ravi Pratap <ravi@ximian.com>
2132 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
2133 message (1502, 1503) when we can't locate a method after overload
2134 resolution. This is much more informative and closes the bug
2137 * interface.cs (PopulateMethod): Return if there are no argument
2138 types. Fixes a NullReferenceException bug.
2140 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
2141 expressions too. Previously we were checking only in one place for
2142 positional arguments leaving out named arguments.
2144 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
2145 type to the enum type is not allowed. Remove code corresponding to
2148 (ConvertNumericExplicit): Allow explicit conversions from
2149 the underlying type to enum type. This precisely follows the spec
2150 and closes a bug filed by Gonzalo.
2152 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2155 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
2157 2002-09-03 Miguel de Icaza <miguel@ximian.com>
2159 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
2160 it was important that we stored the right value after the
2161 reduction in `converted'.
2163 2002-09-04 Martin Baulig <martin@gnome.org>
2165 * location.cs (Location.SymbolDocument): Use full pathnames for the
2168 2002-08-30 Miguel de Icaza <miguel@ximian.com>
2170 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
2171 of the expression resolve mechanism, because that will catch the
2172 SimpleName error failures.
2174 (Conditional): If we can not resolve the
2175 expression, return, do not crash.
2177 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2180 (location): display token name instead of its number.
2182 2002-08-28 Martin Baulig <martin@gnome.org>
2184 * expression.cs (Binary.ResolveOperator): Don't silently return
2185 but return an error if an operator cannot be applied between two
2188 2002-08-28 Martin Baulig <martin@gnome.org>
2190 * class.cs (Constructor.Define): Set the permission attributes
2191 correctly instead of making all constructors public.
2193 2002-08-28 Martin Baulig <martin@gnome.org>
2195 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
2196 for private members before reporting a CS0103; if we find anything,
2199 2002-08-28 Martin Baulig <martin@gnome.org>
2201 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
2202 to check whether `closure_start_type == closure_invocation_type',
2203 we also need to check whether `m.DeclaringType == closure_invocation_type'
2204 before bypassing the permission checks. We might be accessing
2205 protected/private members from the base class.
2206 (TypeManager.RealMemberLookup): Only set private_ok if private
2207 members were requested via BindingFlags.NonPublic.
2209 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
2211 * expression.cs (MemberAccess.ResolveMemberAccess): Set
2212 MethodGroupExpr.IsExplicitImpl if appropriate.
2213 (Invocation.DoResolve): Don't report the CS0120 for explicit
2214 interface implementations.
2216 2002-08-27 Martin Baulig <martin@gnome.org>
2218 * expression.cs (Invocation.DoResolve): If this is a static
2219 method and we don't have an InstanceExpression, we must report
2222 2002-08-25 Martin Baulig <martin@gnome.org>
2224 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
2225 `==' between a valuetype and an object.
2227 2002-08-25 Miguel de Icaza <miguel@ximian.com>
2229 * ecore.cs (TypeExpr): Provide a ToString method.
2231 2002-08-24 Martin Baulig <martin@gnome.org>
2233 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
2234 now called proggie.dbg and it's a binary file.
2236 2002-08-23 Martin Baulig <martin@gnome.org>
2238 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
2240 2002-08-23 Martin Baulig <martin@gnome.org>
2242 * struct.cs (MyStructInfo.ctor): Make this work with empty
2243 structs; it's not allowed to use foreach() on null.
2245 2002-08-23 Martin Baulig <martin@gnome.org>
2247 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
2248 writer the full pathname of the generated assembly.
2250 2002-08-23 Martin Baulig <martin@gnome.org>
2252 * statements.cs (FlowBranching.UsageVector.MergeChildren):
2253 A `finally' block never returns or breaks; improved handling of
2256 2002-08-23 Martin Baulig <martin@gnome.org>
2258 * statement.cs (Throw.Resolve): Allow `throw null'.
2260 2002-08-23 Martin Baulig <martin@gnome.org>
2262 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
2263 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
2264 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
2265 MemberLookup would return a wrong event if this is an explicit
2266 interface implementation and the class has an event with the same
2269 2002-08-23 Martin Baulig <martin@gnome.org>
2271 * statement.cs (Block.AddChildVariableNames): New public method.
2272 (Block.AddChildVariableName): Likewise.
2273 (Block.IsVariableNameUsedInChildBlock): Likewise.
2274 (Block.AddVariable): Check whether a variable name has already
2275 been used in a child block.
2277 * cs-parser.jay (declare_local_variables): Mark all variable names
2278 from the current block as being used in a child block in the
2281 2002-08-23 Martin Baulig <martin@gnome.org>
2283 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
2284 find the symbol writer.
2286 * driver.cs: csc also allows the arguments to /define being
2287 separated by commas, not only by semicolons.
2289 2002-08-23 Martin Baulig <martin@gnome.org>
2291 * interface.cs (Interface.GetMembers): Added static check for events.
2293 2002-08-15 Martin Baulig <martin@gnome.org>
2295 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
2296 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
2298 * ecore.cs (Expression.MemberLookup): Added documentation and explained
2299 why the MethodData.EmitDestructor() change was necessary.
2301 2002-08-20 Martin Baulig <martin@gnome.org>
2303 * class.cs (TypeContainer.FindMembers): Added static check for events.
2305 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
2307 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
2308 use Type.GetEvents(), not Type.FindMembers().
2310 2002-08-20 Martin Baulig <martin@gnome.org>
2312 * decl.cs (MemberCache): Added a special method cache which will
2313 be used for method-only searched. This ensures that a method
2314 search will return a MethodInfo with the correct ReflectedType for
2317 2002-08-20 Martin Baulig <martin@gnome.org>
2319 * decl.cs (DeclSpace.FindMembers): Made this public.
2321 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2323 * delegate.cs: fixed build on windows.
2324 [FIXME: Filed as bug #29150: MCS must report these errors.]
2326 2002-08-19 Ravi Pratap <ravi@ximian.com>
2328 * ecore.cs (StandardConversionExists): Return a false
2329 if we are trying to convert the void type to anything else
2330 since that is not allowed.
2332 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
2333 we flag error 70 in the event an event is trying to be accessed
2334 directly from outside the declaring type.
2336 2002-08-20 Martin Baulig <martin@gnome.org>
2338 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
2339 MemberCache from typemanager.cs to decl.cs.
2341 2002-08-19 Martin Baulig <martin@gnome.org>
2343 * class.cs (TypeContainer): Implement IMemberContainer.
2344 (TypeContainer.DefineMembers): Create the MemberCache.
2345 (TypeContainer.FindMembers): Do better BindingFlags checking; only
2346 return public members if BindingFlags.Public was given, check
2347 whether members are static.
2349 2002-08-16 Martin Baulig <martin@gnome.org>
2351 * decl.cs (DeclSpace.Define): Splitted this in Define and
2352 DefineMembers. DefineMembers is called first and initializes the
2355 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
2356 DefineMembers() on all our DeclSpaces.
2358 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
2359 but call DefineMembers() on all nested interfaces. We call their
2360 Define() in our new Define() function.
2362 * interface.cs (Interface): Implement IMemberContainer.
2363 (Interface.Define): Moved all code except the attribute stuf to
2365 (Interface.DefineMembers): Initialize the member cache.
2367 * typemanager.cs (IMemberFinder): Removed this interface, we don't
2368 need this anymore since we can use MemberCache.FindMembers directly.
2370 2002-08-19 Martin Baulig <martin@gnome.org>
2372 * typemanager.cs (MemberCache): When creating the cache for an
2373 interface type, add all inherited members.
2374 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
2375 to `out bool used_cache' and documented it.
2376 (TypeManager.MemberLookup): If we already used the cache in the first
2377 iteration, we don't need to do the interfaces check.
2379 2002-08-19 Martin Baulig <martin@gnome.org>
2381 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
2382 here from IMemberFinder and don't implement this interface anymore.
2383 (DeclSpace.MemberCache): Moved here from IMemberFinder.
2385 * typemanager.cs (IMemberFinder): This interface is now only used by
2386 classes which actually support the member cache.
2387 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
2388 since we only put DeclSpaces into this Hashtable.
2389 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
2390 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
2392 2002-08-16 Martin Baulig <martin@gnome.org>
2394 * typemanager.cs (ICachingMemberFinder): Removed.
2395 (IMemberFinder.MemberCache): New property.
2396 (TypeManager.FindMembers): Merged this with RealFindMembers().
2397 This function will never be called from TypeManager.MemberLookup()
2398 so we can't use the cache here, just the IMemberFinder.
2399 (TypeManager.MemberLookup_FindMembers): Check whether the
2400 IMemberFinder has a MemberCache and call the cache's FindMembers
2402 (MemberCache): Rewrote larger parts of this yet another time and
2403 cleaned it up a bit.
2405 2002-08-15 Miguel de Icaza <miguel@ximian.com>
2407 * driver.cs (LoadArgs): Support quoting.
2409 (Usage): Show the CSC-like command line arguments.
2411 Improved a few error messages.
2413 2002-08-15 Martin Baulig <martin@gnome.org>
2415 * typemanager.cs (IMemberContainer.Type): New property.
2416 (IMemberContainer.IsInterface): New property.
2418 The following changes are conditional to BROKEN_RUNTIME, which is
2419 defined at the top of the file.
2421 * typemanager.cs (MemberCache.MemberCache): Don't add the base
2422 class'es members, but add all members from TypeHandle.ObjectType
2423 if we're an interface.
2424 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
2425 is the current type.
2426 (MemberCache.CacheEntry.Container): Removed this field.
2427 (TypeHandle.GetMembers): Include inherited members.
2429 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2431 * typemanager.cs: fixed compilation and added a comment on a field that
2434 2002-08-15 Martin Baulig <martin@gnome.org>
2436 * class.cs (ConstructorInitializer.Resolve): In the
2437 Expression.MemberLookup call, use the queried_type as
2440 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
2441 declared' attribute, it's always true.
2442 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
2443 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
2444 temporary wrapper for FindMembers which tells MemberLookup whether
2445 members from the base classes are included in the return value.
2446 This will go away soon.
2447 (TypeManager.MemberLookup): Use this temporary hack here; once the
2448 new MemberCache is completed, we don't need to do the DeclaredOnly
2449 looping here anymore since the MemberCache will take care of this.
2450 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
2451 (MemberCache): When creating the MemberCache for a class, get
2452 members from the current class and all its base classes.
2453 (MemberCache.CacheEntry.Container): New field. This is a
2454 temporary hack until the Mono runtime is fixed to distinguish
2455 between ReflectedType and DeclaringType. It allows us to use MCS
2456 with both the MS runtime and the unfixed Mono runtime without
2457 problems and without accecting performance.
2458 (MemberCache.SearchMembers): The DeclaredOnly looping from
2459 TypeManager.MemberLookup is now done here.
2461 2002-08-14 Martin Baulig <martin@gnome.org>
2463 * statement.cs (MyStructInfo.MyStructInfo): Don't call
2464 Type.GetFields on dynamic types but get the fields from the
2465 corresponding TypeContainer.
2466 (MyStructInfo.GetStructInfo): Added check for enum types.
2468 * typemanager.cs (MemberList.IsSynchronized): Implemented.
2469 (MemberList.SyncRoot): Implemented.
2470 (TypeManager.FilterWithClosure): No need to check permissions if
2471 closure_start_type == closure_invocation_type, don't crash if
2472 closure_invocation_type is null.
2474 2002-08-13 Martin Baulig <martin@gnome.org>
2476 Rewrote TypeContainer.FindMembers to use a member cache. This
2477 gives us a speed increase of about 35% for the self-hosting MCS
2478 build and of about 15-20% for the class libs (both on GNU/Linux).
2480 * report.cs (Timer): New class to get enhanced profiling. This
2481 whole class is "TIMER" conditional since it remarkably slows down
2484 * class.cs (MemberList): New class. This is an IList wrapper
2485 which we're now using instead of passing MemberInfo[]'s around to
2486 avoid copying this array unnecessarily.
2487 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
2488 (ICachingMemberFinder, IMemberContainer): New interface.
2489 (TypeManager.FilterWithClosure): If `criteria' is null, the name
2490 has already been checked, otherwise use it for the name comparision.
2491 (TypeManager.FindMembers): Renamed to RealMemberFinder and
2492 provided wrapper which tries to use ICachingMemberFinder.FindMembers
2493 if possible. Returns a MemberList, not a MemberInfo [].
2494 (TypeHandle): New class, implements IMemberContainer. We create
2495 one instance of this class per type, it contains a MemberCache
2496 which is used to do the member lookups.
2497 (MemberCache): New class. Each instance of this class contains
2498 all members of a type and a name-based hash table.
2499 (MemberCache.FindMembers): This is our new member lookup
2500 function. First, it looks up all members of the requested name in
2501 the hash table. Then, it walks this list and sorts out all
2502 applicable members and returns them.
2504 2002-08-13 Martin Baulig <martin@gnome.org>
2506 In addition to a nice code cleanup, this gives us a performance
2507 increase of about 1.4% on GNU/Linux - not much, but it's already
2508 half a second for the self-hosting MCS compilation.
2510 * typemanager.cs (IMemberFinder): New interface. It is used by
2511 TypeManager.FindMembers to call FindMembers on a TypeContainer,
2512 Enum, Delegate or Interface.
2513 (TypeManager.finder_to_member_finder): New PtrHashtable.
2514 (TypeManager.finder_to_container): Removed.
2515 (TypeManager.finder_to_delegate): Removed.
2516 (TypeManager.finder_to_interface): Removed.
2517 (TypeManager.finder_to_enum): Removed.
2519 * interface.cs (Interface): Implement IMemberFinder.
2521 * delegate.cs (Delegate): Implement IMemberFinder.
2523 * enum.cs (Enum): Implement IMemberFinder.
2525 * class.cs (TypeContainer): Implement IMemberFinder.
2527 2002-08-12 Martin Baulig <martin@gnome.org>
2529 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
2531 2002-08-12 Martin Baulig <martin@gnome.org>
2533 * ecore.cs (ITypeExpression): New interface for expressions which
2535 (TypeExpression): Renamed to TypeLookupExpression.
2536 (Expression.DoResolve): If we're doing a types-only lookup, the
2537 expression must implement the ITypeExpression interface and we
2538 call DoResolveType() on it.
2539 (SimpleName): Implement the new ITypeExpression interface.
2540 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
2541 hack, the situation that we're only looking up types can't happen
2542 anymore when this method is called. Moved the type lookup code to
2543 DoResolveType() and call it.
2544 (SimpleName.DoResolveType): This ITypeExpression interface method
2545 is now doing the types-only lookup.
2546 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
2547 (ResolveFlags): Added MaskExprClass.
2549 * expression.cs (MemberAccess): Implement the ITypeExpression
2551 (MemberAccess.DoResolve): Added support for a types-only lookup
2552 when we're called via ITypeExpression.DoResolveType().
2553 (ComposedCast): Implement the ITypeExpression interface.
2555 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
2556 Expression.Resolve() with ResolveFlags.Type instead.
2558 2002-08-12 Martin Baulig <martin@gnome.org>
2560 * interface.cs (Interface.Define): Apply attributes.
2562 * attribute.cs (Attribute.ApplyAttributes): Added support for
2563 interface attributes.
2565 2002-08-11 Martin Baulig <martin@gnome.org>
2567 * statement.cs (Block.Emit): Only check the "this" variable if we
2568 do not always throw an exception.
2570 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
2571 whether the property has a set accessor.
2573 2002-08-11 Martin Baulig <martin@gnome.org>
2575 Added control flow analysis support for structs.
2577 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
2578 with control flow analysis turned off.
2579 (IVariable): New interface.
2580 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
2581 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
2582 (FieldExpr.DoResolve): Resolve the instance expression with flow
2583 analysis turned off and do the definite assignment check after the
2584 resolving when we know what the expression will resolve to.
2586 * expression.cs (LocalVariableReference, ParameterReference):
2587 Implement the new IVariable interface, only call the flow analysis
2588 code if ec.DoFlowAnalysis is true.
2589 (This): Added constructor which takes a Block argument. Implement
2590 the new IVariable interface.
2591 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
2592 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
2593 This does the definite assignment checks for struct members.
2595 * class.cs (Constructor.Emit): If this is a non-static `struct'
2596 constructor which doesn't have any initializer, call
2597 Block.AddThisVariable() to tell the flow analysis code that all
2598 struct elements must be initialized before control returns from
2601 * statement.cs (MyStructInfo): New public class.
2602 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
2603 argument to this indexer. If non-zero, check an individual struct
2604 member, not the whole struct.
2605 (FlowBranching.CheckOutParameters): Check struct members.
2606 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
2607 overloaded versions of these methods which take an additional
2608 `int field_idx' argument to check struct members.
2609 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
2610 overloaded versions of these methods which take an additional
2611 `string field_name' argument to check struct member.s
2612 (VariableInfo): Implement the IVariable interface.
2613 (VariableInfo.StructInfo): New public property. Returns the
2614 MyStructInfo instance of the variable if it's a struct or null.
2615 (Block.AddThisVariable): New public method. This is called from
2616 Constructor.Emit() for non-static `struct' constructor which do
2617 not have any initializer. It creates a special variable for the
2618 "this" instance variable which will be checked by the flow
2619 analysis code to ensure that all of the struct's fields are
2620 initialized before control returns from the constructor.
2621 (UsageVector): Added support for struct members. If a
2622 variable/parameter is a struct with N members, we reserve a slot
2623 in the usage vector for each member. A struct is considered fully
2624 initialized if either the struct itself (slot 0) or all its
2625 members are initialized.
2627 2002-08-08 Martin Baulig <martin@gnome.org>
2629 * driver.cs (Driver.MainDriver): Only report an error CS5001
2630 if there were no compilation errors.
2632 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
2633 `UnsafeContext' property to determine whether the parent is in
2634 unsafe context rather than checking the parent's ModFlags:
2635 classes nested in an unsafe class are unsafe as well.
2637 2002-08-08 Martin Baulig <martin@gnome.org>
2639 * statement.cs (UsageVector.MergeChildren): Distinguish between
2640 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
2641 we return. Added test17() and test18() to test-154.cs.
2643 2002-08-08 Martin Baulig <martin@gnome.org>
2645 * typemanager.cs (TypeManager.FilterWithClosure): If we have
2646 Family access, make sure the invoking type isn't a subclass of the
2647 queried type (that'd be a CS1540).
2649 * ecore.cs (Expression.MemberLookup): Added overloaded version of
2650 this method which takes an additional `Type invocation_type'.
2652 * expression.cs (BaseAccess.DoResolve): Use the base type as
2653 invocation and query type.
2654 (MemberAccess.DoResolve): If the lookup failed and we're about to
2655 report a CS0122, try a lookup with the ec.ContainerType - if this
2656 succeeds, we must report a CS1540.
2658 2002-08-08 Martin Baulig <martin@gnome.org>
2660 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
2661 (MethodGroupExpr): Implement the IMemberExpr interface.
2663 * expression (MemberAccess.ResolveMemberAccess): No need to have
2664 any special code for MethodGroupExprs anymore, they're now
2667 2002-08-08 Martin Baulig <martin@gnome.org>
2669 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
2670 Family, FamANDAssem and FamORAssem permissions.
2671 (TypeManager.IsSubclassOrNestedChildOf): New public method.
2673 2002-08-08 Martin Baulig <martin@gnome.org>
2675 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
2676 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
2679 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
2681 * driver.cs: implemented /resource option to embed managed resources.
2683 2002-08-07 Martin Baulig <martin@gnome.org>
2685 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
2686 (FieldBase.HasFieldInitializer): New public property.
2687 (FieldBase.GetInitializerExpression): New public method. Resolves and
2688 returns the field initializer and makes sure it is only resolved once.
2689 (TypeContainer.EmitFieldInitializers): Call
2690 FieldBase.GetInitializerExpression to get the initializer, this ensures
2691 that it isn't resolved multiple times.
2693 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
2694 the resolving process (SimpleName/MemberLookup) that we're currently
2695 emitting a field initializer (which must not access any instance members,
2696 this is an error CS0236).
2698 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
2699 argument, if the `IsFieldInitializer' flag is set, we must report and
2700 error CS0236 and not an error CS0120.
2702 2002-08-07 Martin Baulig <martin@gnome.org>
2704 * ecore.cs (IMemberExpr): New public interface.
2705 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
2706 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
2707 if the expression is an IMemberExpr.
2709 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
2710 to be null, implicitly default to `this' if we're non-static in
2711 this case. Simplified the code a lot by using the new IMemberExpr
2712 interface. Also fixed bug #28176 here.
2714 2002-08-06 Martin Baulig <martin@gnome.org>
2716 * cs-parser.jay (SimpleLookup): Removed. We need to create
2717 ParameterReferences during semantic analysis so that we can do a
2718 type-only search when resolving Cast, TypeOf and SizeOf.
2719 (block): Pass the `current_local_parameters' to the Block's
2722 * class.cs (ConstructorInitializer): Added `Parameters parameters'
2723 argument to the constructor.
2724 (ConstructorInitializer.Resolve): Create a temporary implicit
2725 block with the parameters.
2727 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
2728 references here if we aren't doing a type-only search.
2730 * statement.cs (Block): Added constructor which takes a
2731 `Parameters parameters' argument.
2732 (Block.Parameters): New public property.
2734 * support.cs (InternalParameters.Parameters): Renamed `parameters'
2735 to `Parameters' and made it public readonly.
2737 2002-08-06 Martin Baulig <martin@gnome.org>
2739 * ecore.cs (Expression.Warning): Made this public as well.
2741 * report.cs (Report.Debug): Print the contents of collections.
2743 2002-08-06 Martin Baulig <martin@gnome.org>
2745 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
2746 used to tell Resolve() which kinds of expressions it may return.
2747 (Expression.Resolve): Added overloaded version of this method which
2748 takes a `ResolveFlags flags' argument. This can be used to tell
2749 Resolve() which kinds of expressions it may return. Reports a
2751 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
2752 ResolveFlags.SimpleName.
2753 (Expression.Error118): Added overloaded version of this method which
2754 takes a `ResolveFlags flags' argument. It uses the flags to determine
2755 which kinds of expressions are allowed.
2757 * expression.cs (Argument.ResolveMethodGroup): New public method.
2758 Resolves an argument, but allows a MethodGroup to be returned.
2759 This is used when invoking a delegate.
2761 * TODO: Updated a bit.
2763 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2765 Fixed compilation with csc.
2767 * ecore.cs: Expression.Error made public. Is this correct? Should
2768 Warning be made public too?
2770 * expression.cs: use ea.Location instead of ea.loc.
2771 [FIXME: Filed as bug #28607: MCS must report these errors.]
2773 2002-08-06 Martin Baulig <martin@gnome.org>
2775 * ecore.cs (Expression.loc): Moved the location here instead of
2776 duplicating it in all derived classes.
2777 (Expression.Location): New public property.
2778 (Expression.Error, Expression.Warning): Made them non-static and
2779 removed the location argument.
2780 (Expression.Warning): Added overloaded version which takes an
2781 `int level' argument.
2782 (Expression.Error118): Make this non-static and removed the
2783 expression and location arguments.
2784 (TypeExpr): Added location argument to the constructor.
2786 * expression.cs (StaticCallExpr): Added location argument to
2788 (Indirection, PointerArithmetic): Likewise.
2789 (CheckedExpr, UnCheckedExpr): Likewise.
2790 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
2791 (StringPtr): Likewise.
2794 2002-08-05 Martin Baulig <martin@gnome.org>
2796 * expression.cs (BaseAccess.DoResolve): Actually report errors.
2798 * assign.cs (Assign.DoResolve): Check whether the source
2799 expression is a value or variable.
2801 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
2802 while resolving the corresponding blocks.
2804 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
2805 an error, don't silently return null.
2807 * statement.cs (Block.AddVariable): Do the error reporting here
2808 and distinguish between CS0128 and CS0136.
2809 (Block.DoResolve): Report all unused labels (warning CS0164).
2810 (LabeledStatement): Pass the location to the constructor.
2811 (LabeledStatement.HasBeenReferenced): New property.
2812 (LabeledStatement.Resolve): Set it to true here.
2814 * statement.cs (Return.Emit): Return success even after reporting
2815 a type mismatch error (CS0126 or CS0127), this is what csc does and
2816 it avoids confusing the users with any consecutive errors.
2818 2002-08-05 Martin Baulig <martin@gnome.org>
2820 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
2822 * const.cs (Const.LookupConstantValue): Catch circular definitions.
2824 * expression.cs (MemberAccess.DoResolve): Silently return if an
2825 error has already been reported.
2827 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
2828 error has already been reported.
2830 2002-08-05 Martin Baulig <martin@gnome.org>
2832 * statement.cs (UsageVector): Only initialize the `parameters'
2833 vector if we actually have any "out" parameters.
2835 2002-08-05 Martin Baulig <martin@gnome.org>
2837 * expression.cs (Binary.ResolveOperator): When combining delegates,
2838 they must have the same type.
2840 2002-08-05 Martin Baulig <martin@gnome.org>
2842 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
2843 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
2844 work with the ms runtime and we also don't need it: if we're a
2845 PropertyBuilder and not in the `indexer_arguments' hash, then we
2846 are a property and not an indexer.
2848 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
2849 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
2850 since the latter one doesn't work with the ms runtime.
2852 2002-08-03 Martin Baulig <martin@gnome.org>
2854 Fixed bugs #27998 and #22735.
2856 * class.cs (Method.IsOperator): New public field.
2857 (Method.CheckBase): Report CS0111 if there's already a method
2858 with the same parameters in the current class. Report CS0508 when
2859 attempting to change the return type of an inherited method.
2860 (MethodData.Emit): Report CS0179 if a method doesn't have a body
2861 and it's not marked abstract or extern.
2862 (PropertyBase): New abstract base class for Property and Indexer.
2863 (PropertyBase.CheckBase): Moved here from Property and made it work
2865 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
2866 the same so we can reuse it there.
2867 (Property, Indexer): Derive from PropertyBase.
2868 (MethodSignature.inheritable_property_signature_filter): New delegate
2869 to find properties and indexers.
2871 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
2872 argument and improved error reporting.
2874 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
2875 EmptyReadOnlyParameters and made it a property.
2877 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
2878 version of this method which takes a `PropertyInfo indexer'.
2879 (TypeManager.RegisterIndexer): New method.
2881 * class.cs: Added myself as author of this file :-)
2883 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2885 * class.cs: fixed compilation on windoze.
2887 2002-08-03 Martin Baulig <martin@gnome.org>
2889 * interface.cs (Interface.GetInterfaceBases): Check whether all
2890 base interfaces are at least as accessible than the current one.
2892 * class.cs (TypeContainer.GetClassBases): Check whether base types
2893 are at least as accessible than the current type.
2894 (TypeContainer.AsAccessible): Implemented and made non-static.
2895 (MemberBase.CheckParameters): Report errors if the accessibility
2898 * delegate.cs (Delegate.Delegate): The default visibility is
2899 internal for top-level types and private for nested types.
2900 (Delegate.Define): Report errors if the accessibility checks fail.
2902 * enum.cs (Enum.Enum): The default visibility is internal for
2903 top-level types and private for nested types.
2904 (Enum.DefineType): Compute the correct visibility.
2906 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
2907 function which takes a `bool is_toplevel' instead of a TypeContainer.
2909 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
2912 2002-08-02 Martin Baulig <martin@gnome.org>
2914 * expression.cs (LocalVariableReferenc): Added constructor which
2915 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
2916 (LocalVariableReference.IsReadOnly): New property.
2917 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
2918 variable is readonly, use our own readonly flag to do this; you can
2919 use the new constructor to get a writable reference to a read-only
2922 * cs-parser.jay (foreach_statement, using_statement): Get a writable
2923 reference to the local variable.
2925 2002-08-01 Miguel de Icaza <miguel@ximian.com>
2927 * rootcontext.cs (ResolveCore): Also include System.Exception
2929 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
2930 we reach an EmptyStatement.
2932 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
2935 * expression.cs (Binary.ResolveOperator): Check error result in
2938 use brtrue/brfalse directly and avoid compares to null.
2940 2002-08-02 Martin Baulig <martin@gnome.org>
2942 * class.cs (TypeContainer.Define): Define all nested interfaces here.
2943 Fixes bug #28407, added test-155.cs.
2945 2002-08-01 Martin Baulig <martin@gnome.org>
2947 * class.cs (Event.EmitDefaultMethod): Make this work with static
2948 events. Fixes #28311, added verify-3.cs.
2950 2002-08-01 Martin Baulig <martin@gnome.org>
2952 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
2953 `is_disposable' fields.
2954 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
2955 `hm.is_disposable' if we're using the collection pattern.
2956 (Foreach.EmitCollectionForeach): Use the correct type for the
2957 enumerator's local variable, only emit the try/finally block if
2958 necessary (fixes #27713).
2960 2002-08-01 Martin Baulig <martin@gnome.org>
2962 * ecore.cs (Expression.report118): Renamed to Error118 and made
2965 * statement.cs (Throw.Resolve): Check whether the expression is of
2966 the correct type (CS0118) and whether the type derives from
2967 System.Exception (CS0155).
2968 (Catch.Resolve): New method. Do the type lookup here and check
2969 whether it derives from System.Exception (CS0155).
2970 (Catch.CatchType, Catch.IsGeneral): New public properties.
2972 * typemanager.cs (TypeManager.exception_type): Added.
2974 2002-07-31 Miguel de Icaza <miguel@ximian.com>
2976 * driver.cs: Updated About function.
2978 2002-07-31 Martin Baulig <martin@gnome.org>
2980 Implemented Control Flow Analysis.
2982 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
2983 (EmitContext.CurrentBranching): Added.
2984 (EmitContext.StartFlowBranching): Added.
2985 (EmitContext.EndFlowBranching): Added.
2986 (EmitContext.KillFlowBranching): Added.
2987 (EmitContext.IsVariableAssigned): Added.
2988 (EmitContext.SetVariableAssigned): Added.
2989 (EmitContext.IsParameterAssigned): Added.
2990 (EmitContext.SetParameterAssigned): Added.
2991 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
2992 Added control flow analysis stuff here.
2994 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
2995 resolve the expression as lvalue.
2996 (LocalVariableReference.DoResolve): Check whether the variable has
2997 already been assigned.
2998 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
2999 the parameter as assigned here.
3000 (ParameterReference.DoResolve): Check whether the parameter has already
3002 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
3003 expression as lvalue.
3005 * statement.cs (FlowBranching): New class for the flow analysis code.
3006 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
3007 (LabeledStatement.IsDefined): New public property.
3008 (LabeledStatement.AddUsageVector): New public method to tell flow
3009 analyis that the label may be reached via a forward jump.
3010 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
3012 (VariableInfo.Number): New public field. This is used by flow analysis
3013 to number all locals of a block.
3014 (Block.CountVariables): New public property. This is the number of
3015 local variables in this block (including the locals from all parent
3017 (Block.EmitMeta): Number all the variables.
3019 * statement.cs: Added flow analysis support to all classes.
3021 2002-07-31 Martin Baulig <martin@gnome.org>
3023 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
3024 To get debugging messages, compile mcs with /define:MCS_DEBUG and
3025 then use this argument.
3027 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
3029 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
3030 use this to specify /define options.
3032 2002-07-29 Martin Baulig <martin@gnome.org>
3034 * statement.cs (Fixed): Moved all code that does variable lookups
3035 and resolvings from Emit to Resolve.
3037 * statement.cs (For): Moved all code that does variable lookups
3038 and resolvings from Emit to Resolve.
3040 * statement.cs (Using): Moved all code that does variable lookups
3041 and resolvings from Emit to Resolve.
3043 2002-07-29 Martin Baulig <martin@gnome.org>
3045 * attribute.cs (Attribute.Resolve): Explicitly catch a
3046 System.NullReferenceException when creating the
3047 CustromAttributeBuilder and report a different warning message.
3049 2002-07-29 Martin Baulig <martin@gnome.org>
3051 * support.cs (ParameterData.ParameterName): Added method to
3052 get the name of a parameter.
3054 * typemanager.cs (TypeManager.IsValueType): New public method.
3056 2002-07-29 Martin Baulig <martin@gnome.org>
3058 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
3059 is a flag which specifies that it's either ref or out.
3060 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
3061 the out parameter to `out Parameter.Modifier mod', also set the
3062 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
3064 * support.cs (InternalParameters.ParameterModifier): Distinguish
3065 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
3066 Parameter.Modifier.ISBYREF flag if it's either ref or out.
3068 * expression.cs (Argument.GetParameterModifier): Distinguish
3069 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
3070 Parameter.Modifier.ISBYREF flag if it's either ref or out.
3072 2002-07-29 Martin Baulig <martin@gnome.org>
3074 * expression.cs (ParameterReference.ParameterReference): Added
3075 `Location loc' argument to the constructor.
3077 * cs-parser.jay: Pass location to ParameterReference.
3079 2002-07-28 Miguel de Icaza <miguel@ximian.com>
3081 * statement.cs (Try): Initialize the location.
3083 * cs-parser.jay: pass location to Try.
3085 * expression.cs (Unary.Reduce): Change the prototype to return
3086 whether a constant fold could be performed or not. The result is
3087 returned in an out parameters. In the case of Indirection and
3088 AddressOf, we want to perform the full tests.
3090 2002-07-26 Miguel de Icaza <miguel@ximian.com>
3092 * statement.cs (Statement.Emit): Flag dead code.
3094 2002-07-27 Andrew Birkett <andy@nobugs.org>
3096 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
3098 2002-07-27 Martin Baulig <martin@gnome.org>
3100 * class.cs (MethodData.Define): Put back call to
3101 TypeManager.AddMethod(), accidentally commented this out.
3103 * report.cs (Debug): New public method to print debugging information,
3104 this is `[Conditional ("DEBUG")]'.
3106 2002-07-26 Martin Baulig <martin@gnome.org>
3108 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
3109 (switch_statement): Push the current_block to the switch_stack and
3110 pop it again when we're done with the switch.
3111 (switch_section): The new block is a child of the current_block.
3112 Fixes bug #24007, added test-152.cs.
3114 2002-07-27 Martin Baulig <martin@gnome.org>
3116 * expression.cs (Invocation.EmitArguments): When calling a varargs
3117 function with only its fixed arguments, we need to pass an empty
3120 2002-07-27 Martin Baulig <martin@gnome.org>
3122 Mono 0.13 has been released.
3124 2002-07-25 Miguel de Icaza <miguel@ximian.com>
3126 * driver.cs: Rename --resource to --linkres, because that is what
3127 we do currently, we dont support --resource yet.
3129 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
3131 2002-07-25 Martin Baulig <martin@gnome.org>
3133 * class.cs (MethodData): New public class. This is a `method builder'
3134 class for a method or one accessor of a Property/Indexer/Event.
3135 (MethodData.GetMethodFlags): Moved here from MemberBase.
3136 (MethodData.ApplyAttributes): Likewise.
3137 (MethodData.ApplyObsoleteAttribute): Likewise.
3138 (MethodData.ApplyConditionalAttribute): Likewise.
3139 (MethodData.ApplyDllImportAttribute): Likewise.
3140 (MethodData.CheckAbstractAndExternal): Likewise.
3141 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
3142 (MethodData.Emit): Formerly known as Method.Emit().
3143 (MemberBase): Moved everything which was specific to a single
3144 accessor/method to MethodData.
3145 (Method): Create a new MethodData and call Define() and Emit() on it.
3146 (Property, Indexer, Event): Create a new MethodData objects for each
3147 accessor and call Define() and Emit() on them.
3149 2002-07-25 Martin Baulig <martin@gnome.org>
3151 Made MethodCore derive from MemberBase to reuse the code from there.
3152 MemberBase now also checks for attributes.
3154 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
3155 (MemberBase.GetMethodFlags): Moved here from class Method and marked
3157 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
3158 `CallingConventions cc' and `Attributes opt_attrs' arguments.
3159 (MemberBase.ApplyAttributes): New virtual method; applies the
3160 attributes to a method or accessor.
3161 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
3162 (MemberBase.ApplyConditionalAttribute): Likewise.
3163 (MemberBase.ApplyDllImportAttribute): Likewise.
3164 (MemberBase.CheckAbstractAndExternal): Likewise.
3165 (MethodCore.ParameterTypes): This is now a property instead of a
3166 method, it's initialized from DoDefineParameters().
3167 (MethodCore.ParameterInfo): Removed the set accessor.
3168 (MethodCore.DoDefineParameters): New protected virtual method to
3169 initialize ParameterTypes and ParameterInfo.
3170 (Method.GetReturnType): We can now simply return the MemberType.
3171 (Method.GetMethodFlags): Override the MemberBase version and add
3172 the conditional flags.
3173 (Method.CheckBase): Moved some code from Define() here, call
3174 DoDefineParameters() here.
3175 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
3176 here to avoid some larger code duplication.
3177 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
3178 ensure that abstract and external accessors don't declare a body.
3180 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
3181 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
3182 lookup in the attribute's parent classes, so we need to abort as soon
3183 as we found the first match.
3184 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
3185 the attribute has no arguments.
3187 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
3190 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3192 * cs-parser.jay: reverted previous patch.
3194 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3196 * cs-parser.jay: fixed bug #22119.
3198 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3200 * attribute.cs: fixed compilation. The error was:
3201 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
3202 be assigned to before control leaves the current method."
3203 [FIXME: Filed as bug #28186: MCS must report this error.]
3205 2002-07-25 Martin Baulig <martin@gnome.org>
3207 * attribute.cs (Attribute.Conditional_GetConditionName): New static
3208 method to pull the condition name ouf of a Conditional attribute.
3209 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
3210 the obsolete message and error flag out of an Obsolete attribute.
3212 * class.cs (Method.GetMethodFlags): New public method to get the
3213 TypeManager.MethodFlags for this method.
3214 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
3216 (Method.Define): Get and apply the Obsolete and Conditional attributes;
3217 if we're overriding a virtual function, set the new private variable
3218 `parent_method'; call the new TypeManager.AddMethod().
3220 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
3221 the MethodBuilder and the Method in a PtrHashtable.
3222 (TypeManager.builder_to_method): Added for this purpose.
3223 (TypeManager.MethodFlags): Added IsObsoleteError.
3224 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
3225 Obsolete and Conditional arguments in MethodBuilders. If we discover
3226 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
3227 the message from the attribute.
3229 2002-07-24 Martin Baulig <martin@gnome.org>
3231 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
3232 preprocessor directives, ensure that the argument to #define/#undef is
3233 exactly one identifier and that it's actually an identifier.
3235 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
3238 2002-07-24 Martin Baulig <martin@gnome.org>
3240 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
3241 initialize it to TypeManager.object_type in the constructor.
3242 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
3243 of the `hm.get_current' method if we're using the collection pattern.
3244 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
3245 for the explicit conversion to make it work when we're using the collection
3246 pattern and the `Current' property has a different return type than `object'.
3249 2002-07-24 Martin Baulig <martin@gnome.org>
3251 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
3252 does not match, but don't report any errors. This method is called in
3253 order for all methods in a MethodGroupExpr until a matching method is
3254 found, so we don't want to bail out if the first method doesn't match.
3255 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
3256 matches, report the 123. Fixes #28070.
3258 2002-07-24 Martin Baulig <martin@gnome.org>
3260 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
3261 TypeManager.TypeToCoreType() to the top of the method so the
3262 following equality checks will work. Fixes #28107.
3264 2002-07-24 Martin Baulig <martin@gnome.org>
3266 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
3267 operand is of type uint, and the other operand is of type sbyte,
3268 short or int, the operands are converted to type long." -
3269 Actually do what this comment already told us. Fixes bug #28106,
3272 2002-07-24 Martin Baulig <martin@gnome.org>
3274 * class.cs (MethodBase): New abstract class. This is now a base
3275 class for Property, Indexer and Event to avoid some code duplication
3276 in their Define() and DefineMethods() methods.
3277 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
3278 generic methods for Define() and DefineMethods().
3279 (FieldBase): Derive from MemberBase, not MemberCore.
3280 (Property): Derive from MemberBase, not MemberCore.
3281 (Property.DefineMethod): Moved all the code from this method to the
3282 new MethodBase.DefineAccessor(), just call it with appropriate
3284 (Property.Define): Call the new Property.DoDefine(), this does some
3285 sanity checks and we don't need to duplicate the code everywhere.
3286 (Event): Derive from MemberBase, not MemberCore.
3287 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
3288 accessors, this will also make them work with interface events.
3289 (Indexer): Derive from MemberBase, not MemberCore.
3290 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
3291 (Indexer.Define): Use the new MethodBase functions.
3293 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
3294 argument to the constructor.
3295 (Interface.FindMembers): Added support for interface events.
3296 (Interface.PopluateEvent): Implemented.
3298 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
3300 2002-07-22 Miguel de Icaza <miguel@ximian.com>
3302 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
3303 but this is required to check for a method name being the same as
3304 the containing class.
3308 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3310 * interface.cs: initialize variable.
3312 2002-07-23 Martin Baulig <martin@gnome.org>
3314 Implemented the IndexerName attribute in interfaces.
3316 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
3317 name if this is an explicit interface implementation.
3318 (Indexer.InterfaceIndexerName): New public variable. If we're
3319 implementing an interface indexer, this is the IndexerName in that
3320 interface. Otherwise, it's the IndexerName.
3321 (Indexer.DefineMethod): If we're implementing interface indexer,
3322 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
3323 and Pending.ImplementIndexer methods.
3324 (Indexer.Define): Also define the PropertyBuilder if we're
3325 implementing an interface indexer and this is neither an explicit
3326 interface implementation nor do the IndexerName match the one in
3329 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
3330 If a method is defined here, then we always need to create a proxy
3331 for it. This is used when implementing interface indexers.
3332 (Pending.IsInterfaceIndexer): New public method.
3333 (Pending.ImplementIndexer): New public method.
3334 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
3335 This is used when implementing interface indexers to define a proxy
3337 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
3338 define a proxy if necessary.
3340 * interface.cs (Interface.IndexerName): New public variable.
3341 (Interface.PopulateIndexer): Set the IndexerName.
3342 (Interface.DefineIndexers): New private method. Populate all the
3343 indexers and make sure their IndexerNames match.
3345 * typemanager.cs (IndexerPropertyName): Added support for interface
3348 2002-07-22 Martin Baulig <martin@gnome.org>
3350 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
3351 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
3352 ret if HasReturnLabel.
3353 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
3356 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
3357 and set the ec.LoopBeginTryCatchLevel.
3358 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
3359 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
3360 the current ec.TryCatchLevel, the branch goes out of an exception
3361 block. In this case, we need to use Leave and not Br.
3363 2002-07-22 Martin Baulig <martin@gnome.org>
3365 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
3366 block unless the block does not always return or it is contained in
3367 another try { ... } catch { ... } block. Fixes bug #26506.
3368 Added verify-1.cs to the test suite.
3370 2002-07-22 Martin Baulig <martin@gnome.org>
3372 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
3373 then we do not always return. Fixes bug #24985.
3375 2002-07-22 Martin Baulig <martin@gnome.org>
3377 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
3378 lookup on a per-class level; ie. walk up the class hierarchy until we
3379 found at least one applicable method, then choose the best among them.
3380 Fixes bug #24463 and test-29.cs.
3382 2002-07-22 Martin Baulig <martin@gnome.org>
3384 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
3385 return types of the methods. The return type is not part of the
3386 signature and we must not check it to make the `new' modifier work.
3387 Fixes bug #27999, also added test-147.cs.
3388 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
3390 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
3391 on the method's return type.
3393 2002-07-21 Martin Baulig <martin@gnome.org>
3395 * assign.cs: Make this work if the rightmost source is a constant and
3396 we need to do an implicit type conversion. Also adding a few more tests
3397 to test-38.cs which should have caught this.
3399 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
3400 target in the makefile for this. The makefile.gnu is primarily intended
3401 for end-users who don't want to debug the compiler.
3403 2002-07-21 Martin Baulig <martin@gnome.org>
3405 * assign.cs: Improved the Assign class so it can now handle embedded
3406 assignments (X = Y = Z = something). As a side-effect this'll now also
3407 consume less local variables. test-38.cs now passes with MCS, added
3408 a few new test cases to that test.
3410 2002-07-20 Martin Baulig <martin@gnome.org>
3412 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
3413 instructions. Fixes bug #27977, also added test-146.cs.
3415 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3417 * cs-tokenizer.cs: fixed getHex ().
3419 2002-07-19 Martin Baulig <martin@gnome.org>
3421 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
3422 not Type.GetType() to lookup the array type. This is needed when
3423 we're constructing an array of a user-defined type.
3424 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
3425 single-dimensional arrays, but also for single-dimensial arrays of
3428 2002-07-19 Martin Baulig <martin@gnome.org>
3430 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
3431 this function is called, it's not allowed to share LocalBuilders
3434 2002-07-19 Martin Baulig <martin@gnome.org>
3436 * expression.cs (Argument.Resolve): Report an error 118 when trying
3437 to pass a type as argument.
3439 2002-07-18 Martin Baulig <martin@gnome.org>
3441 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
3442 Conv_R_Un for the signed `long' type.
3444 2002-07-15 Miguel de Icaza <miguel@ximian.com>
3446 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
3447 `expr' for the temporary result, as that will fail if we do
3448 multiple resolves on the same expression.
3450 2002-07-05 Miguel de Icaza <miguel@ximian.com>
3452 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
3453 ec.TypeContainer for looking up aliases.
3455 * class.cs (TypeContainer): Remove LookupAlias from here.
3457 * decl.cs (DeclSpace); Move here.
3459 2002-07-01 Miguel de Icaza <miguel@ximian.com>
3461 * class.cs (FindMembers): Only call filter if the constructor
3462 bulider is not null.
3464 Also handle delegates in `NestedTypes' now. Now we will perform
3465 type lookups using the standard resolution process. This also
3468 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
3469 This uses Expressions (the limited kind that can be parsed by the
3470 tree) instead of strings.
3472 * expression.cs (ComposedCast.ToString): Implement, used to flag
3473 errors since now we have to render expressions.
3475 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
3478 * ecore.cs (SimpleName.ToString): ditto.
3480 * cs-parser.jay: Instead of using strings to assemble types, use
3481 Expressions to assemble the type (using SimpleName, ComposedCast,
3482 MemberAccess). This should fix the type lookups in declarations,
3483 because we were using a different code path for this.
3485 * statement.cs (Block.Resolve): Continue processing statements
3486 even when there is an error.
3488 2002-07-17 Miguel de Icaza <miguel@ximian.com>
3490 * class.cs (Event.Define): Also remove the `remove' method from
3491 the list of pending items.
3493 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
3494 generate more compact code.
3496 2002-07-17 Martin Baulig <martin@gnome.org>
3498 * const.cs (Const.LookupConstantValue): Add support for constant
3499 `unchecked' and `checked' expressions.
3500 Also adding test case test-140.cs for this.
3502 2002-07-17 Martin Baulig <martin@gnome.org>
3504 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
3505 check whether mi.ReturnType implements the IEnumerator interface; the
3506 `==' and the IsAssignableFrom() will fail in this situation.
3508 2002-07-16 Ravi Pratap <ravi@ximian.com>
3510 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
3513 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3515 * expression.cs: fixed bug #27811.
3517 2002-07-14 Miguel de Icaza <miguel@ximian.com>
3519 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
3520 Molaro: when we are a ref, the value already contains a pointer
3521 value, do not take the address of it.
3523 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
3524 * removed mb-parser.jay and mb-tokenizer.cs
3526 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
3528 * expression.cs: check against the building corlib void type.
3530 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
3532 * ecore.cs: fix for valuetype static readonly fields: when
3533 initializing them, we need their address, not the address of a copy.
3535 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
3537 * typemanager.cs: register also enum_type in corlib.
3539 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
3541 * class.cs: allow calling this (but not base) initializers in structs.
3543 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
3545 * ecore.cs: make sure we compare against the building base types
3548 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
3550 * typemanager.cs: fix TypeToCoreType() to handle void and object
3551 (corlib gets no more typerefs after this change).
3553 2002-07-12 Miguel de Icaza <miguel@ximian.com>
3555 * expression.cs (ArrayCreation.EmitArrayArguments): use
3556 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
3558 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
3559 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
3560 array indexes, the runtime actually forbids them.
3562 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
3563 for array arguments here.
3565 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
3566 instead of the default for ValueTypes.
3568 (New.DoEmit): Use IsValueType instead of
3569 IsSubclassOf (value_type)
3570 (New.DoResolve): ditto.
3571 (Invocation.EmitCall): ditto.
3573 * assign.cs (Assign): ditto.
3575 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
3576 Statements *are* currently doing part of their resolution during
3579 Expressions do always resolve during resolve, but statements are
3580 only required to propagate resolution to their children.
3582 2002-07-11 Miguel de Icaza <miguel@ximian.com>
3584 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
3586 (LoadAssembly): Do not add the dll if it is already specified
3588 (MainDriver): Add the System directory to the link path at the end,
3589 after all the other -L arguments.
3591 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
3592 wrong opcode for loading bytes and bools (ldelem.i1 instead of
3593 ldelem.u1) and using the opposite for sbytes.
3595 This fixes Digger, and we can finally run it.
3597 * driver.cs (UnixParseOption): Move the option parsing here.
3598 (CSCParseOption): Implement CSC-like parsing of options.
3600 We now support both modes of operation, the old Unix way, and the
3601 new CSC-like way. This should help those who wanted to make cross
3604 The only thing broken is that /r:, /reference: and /lib: are not
3605 implemented, because I want to make those have the same semantics
3606 as the CSC compiler has, and kill once and for all the confussion
3607 around this. Will be doing this tomorrow.
3609 * statement.cs (Unsafe.Resolve): The state is checked during
3610 resolve, not emit, so we have to set the flags for IsUnsfe here.
3612 2002-07-10 Miguel de Icaza <miguel@ximian.com>
3614 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
3615 not catch the Error_ObjectRefRequired in SimpleName (as it is
3616 possible to have a class/instance variable name that later gets
3617 deambiguated), we have to check this here.
3619 2002-07-10 Ravi Pratap <ravi@ximian.com>
3621 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
3622 make static and put into Expression.
3624 (Event.Define): Register the private field of the event with the
3625 TypeManager so that GetFieldFromEvent can get at it.
3627 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
3628 keep track of the private field associated with an event which
3631 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
3634 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
3636 2002-07-10 Miguel de Icaza <miguel@ximian.com>
3638 * expression.cs (Binary.EmitBranchable): this routine emits the
3639 Binary expression in a branchable context. This basically means:
3640 we need to branch somewhere, not just get the value on the stack.
3642 This works together with Statement.EmitBoolExpression.
3644 * statement.cs (Statement.EmitBoolExpression): Use
3647 2002-07-09 Miguel de Icaza <miguel@ximian.com>
3649 * statement.cs (For): Reduce the number of jumps in loops.
3651 (For): Implement loop inversion for the For statement.
3653 (Break): We can be breaking out of a Try/Catch controlled section
3654 (foreach might have an implicit try/catch clause), so we need to
3655 use Leave instead of Br.
3657 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
3658 now). If the instace expression supports IMemoryLocation, we use
3659 the AddressOf method from the IMemoryLocation to extract the
3660 address instead of emitting the instance.
3662 This showed up with `This', as we were emitting the instance
3663 always (Emit) instead of the Address of This. Particularly
3664 interesting when This is a value type, as we dont want the Emit
3665 effect (which was to load the object).
3667 2002-07-08 Miguel de Icaza <miguel@ximian.com>
3669 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
3671 * statement.cs (Checked): Set the CheckedState during the resolve
3672 process too, as the ConvCast operations track the checked state on
3673 the resolve process, and not emit.
3675 * cs-parser.jay (namespace_member_declaration): Flag that we have
3676 found a declaration when we do. This is used to flag error 1529
3678 * driver.cs: Report ok when we display the help only.
3680 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
3682 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
3684 2002-07-04 Miguel de Icaza <miguel@ximian.com>
3686 * cs-tokenizer.cs (define): We also have to track locally the
3687 defines. AllDefines is just used for the Conditional Attribute,
3688 but we also need the local defines for the current source code.
3690 2002-07-03 Miguel de Icaza <miguel@ximian.com>
3692 * statement.cs (While, For, Do): These loops can exit through a
3693 Break statement, use this information to tell whether the
3694 statement is the last piece of code.
3696 (Break): Flag that we break.
3698 * codegen.cs (EmitContexts): New `Breaks' state variable.
3700 2002-07-03 Martin Baulig <martin@gnome.org>
3702 * class.cs (TypeContainer.MethodModifiersValid): Allow override
3703 modifiers in method declarations in structs. Otherwise, you won't
3704 be able to override things like Object.Equals().
3706 2002-07-02 Miguel de Icaza <miguel@ximian.com>
3708 * class.cs (Method, Property, Indexer): Do not allow the public
3709 modifier to be used in explicit interface implementations.
3711 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
3712 override modifiers in method declarations in structs
3714 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
3716 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
3717 integer or real overflow, report an error
3719 2002-07-02 Martin Baulig <martin@gnome.org>
3721 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
3722 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
3723 to tell the runtime about our newly created System.Object and
3724 System.ValueType types.
3726 2002-07-02 Miguel de Icaza <miguel@ximian.com>
3728 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
3729 struct instead of Ldarg/Starg.
3731 2002-07-02 Martin Baulig <martin@gnome.org>
3733 * expression.cs (Indirection.Indirection): Call
3734 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
3736 2002-07-02 Martin Baulig <martin@gnome.org>
3738 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
3739 ValueType, call TypeManager.TypeToCoreType() on it.
3740 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
3741 the OpCodes.Newarr argument.
3743 2002-07-02 Martin Baulig <martin@gnome.org>
3745 * expression.cs (Invocation.EmitCall): When compiling corlib,
3746 replace all calls to the system's System.Array type to calls to
3747 the newly created one.
3749 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
3750 System.Array methods.
3751 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
3752 from the system's System.Array type which must be replaced.
3754 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
3756 * typemanager.cs: load unverifiable_code_ctor so we can build
3757 corlib using the correct type. Avoid using GetTypeCode() with
3759 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
3760 TypeManager.object_type to allow building corlib.
3762 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
3764 * ecore.cs: handle System.Enum separately in LoadFromPtr().
3766 2002-07-01 Martin Baulig <martin@gnome.org>
3768 * class.cs: Make the last change actually work, we need to check
3769 whether `ifaces != null' to avoid a crash.
3771 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
3773 * class.cs: when we build structs without fields that implement
3774 interfaces, we need to add the interfaces separately, since there is
3775 no API to both set the size and add the interfaces at type creation
3778 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
3780 * expression.cs: the dimension arguments to the array constructors
3781 need to be converted if they are a long.
3783 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
3785 * class.cs: don't emit ldarg.0 if there is no parent constructor
3786 (fixes showstopper for corlib).
3788 2002-06-29 Martin Baulig <martin@gnome.org>
3790 MCS now compiles corlib on GNU/Linux :-)
3792 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
3793 ie. check for MethodImplOptions.InternalCall.
3795 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
3796 and TypeManager.attribute_type are null, so we must explicitly check
3797 whether parent is not null to find out whether it's an attribute type.
3798 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
3799 and SetBuilder, not only if the property is neither abstract nor external.
3800 This is necessary to set the MethodImplOptions on the accessor methods.
3801 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
3802 SetBuilder, see Property.Emit().
3804 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
3805 populate "System.Object", "System.ValueType" and "System.Attribute" since
3806 they've already been populated from BootCorlib_PopulateCoreTypes().
3808 2002-06-29 Martin Baulig <martin@gnome.org>
3810 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
3811 is the NullLiteral, we also need to make sure that target_type is not
3814 2002-06-29 Martin Baulig <martin@gnome.org>
3816 * rootcontext.cs (RootContext.ResolveCore): We must initialize
3817 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
3818 before calling BootstrapCorlib_ResolveDelegate ().
3820 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3822 * statement.cs: fixed build-breaker. All tests passed ok.
3824 2002-06-27 Martin Baulig <martin@gnome.org>
3826 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
3827 for System.Decimal when compiling corlib.
3829 2002-06-27 Martin Baulig <martin@gnome.org>
3831 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
3832 switch blocks which contain nothing but a default clause.
3834 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
3836 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
3838 2002-06-27 Martin Baulig <martin@gnome.org>
3840 * ecore.cs (PropertyExpr.PropertyExpr): Call
3841 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
3843 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
3844 is already a TypeBuilder.
3846 2002-06-27 Martin Baulig <martin@gnome.org>
3848 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
3849 `target_type == TypeManager.array_type', not IsAssignableFrom() in
3850 the "from an array-type to System.Array" case. This makes it work
3851 when compiling corlib.
3853 2002-06-27 Martin Baulig <martin@gnome.org>
3855 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
3856 non-static PropertyExpr, set its InstanceExpression. This makes
3857 the `ICollection.Count' property work in System/Array.cs.
3859 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
3861 * driver.cs: Made error handling more consistent. Errors now
3862 tracked by Report class, so many methods which used to return int
3863 now return void. Main() now prints success/failure and
3864 errors/warnings message.
3866 Renamed '--probe' compiler argument to '--expect-error'. Removed
3867 the magic number return values (123 and 124). Now, if the
3868 expected error occurs, the compiler exits with success (exit value
3869 0). If the compilation completes without seeing that particular
3870 error, the compiler exits with failure (exit value 1). The
3871 makefile in mcs/errors has been changed to handle the new behaviour.
3873 * report.cs: Made 'expected error' number a property and renamed
3874 it from 'Probe' to 'ExpectedError'.
3876 * genericparser.cs: Removed error handling support, since it is
3877 now all done by Report class.
3879 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
3880 class, so parse() no longer returns an int.
3882 * namespace.cs: Use Report.Error instead of GenericParser.error
3884 2002-06-22 Miguel de Icaza <miguel@ximian.com>
3886 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
3887 TypeContainer.AddOperator): At the front of the list put the
3888 explicit implementations, so they get resolved/defined first.
3890 2002-06-21 Miguel de Icaza <miguel@ximian.com>
3892 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
3893 interface type is implemented by this TypeContainer. Used during
3894 explicit interface implementation.
3896 (Property.Define, Indexer.Define, Method.Define): Validate that
3897 the given interface in the explicit implementation is one of the
3898 base classes for the containing type.
3900 Also if we are explicitly implementing an interface, but there is
3901 no match in the pending implementation table, report an error.
3903 (Property.Define): Only define the property if we are
3904 not explicitly implementing a property from an interface. Use the
3905 correct name also for those properties (the same CSC uses,
3906 although that is really not needed).
3908 (Property.Emit): Do not emit attributes for explicitly implemented
3909 properties, as there is no TypeBuilder.
3911 (Indexer.Emit): ditto.
3913 Hiding then means that we do not really *implement* a pending
3914 implementation, which makes code fail.
3916 2002-06-22 Martin Baulig <martin@gnome.org>
3918 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
3919 the return value of Object.GetType(). [FIXME: we need to do this whenever
3920 we get a type back from the reflection library].
3922 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
3924 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
3926 2002-06-20 Miguel de Icaza <miguel@ximian.com>
3928 * attribute.cs: Return null if we can not look up the type.
3930 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
3931 the interface types found.
3933 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
3934 interface types found.
3936 * typemanager.cs (GetInterfaces): Make this routine returns alll
3937 the interfaces and work around the lame differences between
3938 System.Type and System.Reflection.Emit.TypeBuilder in the results
3939 result for GetInterfaces.
3941 (ExpandInterfaces): Given an array of interface types, expand and
3942 eliminate repeated ocurrences of an interface. This expands in
3943 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
3946 2002-06-21 Martin Baulig <martin@gnome.org>
3948 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
3951 2002-06-21 Martin Baulig <martin@gnome.org>
3953 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
3954 and called with one of the core types, return the corresponding typebuilder for
3957 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
3960 2002-06-21 Martin Baulig <martin@gnome.org>
3962 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
3963 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
3964 (Expression.ConvertReferenceExplicit): Likewise.
3966 * expression.cs (ElementAccess.DoResolve): Likewise.
3967 (ElementAccess.DoResolveLValue): Likewise.
3969 2002-06-10 Martin Baulig <martin@gnome.org>
3971 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
3972 add the "value" parameter to the parameter list.
3974 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
3977 2002-06-19 Miguel de Icaza <miguel@ximian.com>
3979 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
3980 the argument to an int, uint, long or ulong, per the spec. Also
3981 catch negative constants in array creation.
3983 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
3985 * class.cs: do not allow the same interface to appear twice in
3986 the definition list.
3988 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
3990 * ecore.cs: don't use ldlen with System.Array.
3992 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
3994 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
3996 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
3998 * modifiers.cs: produce correct field attributes for protected
3999 internal. Easy fix so miguel can work on ther harder stuff:-)
4001 2002-06-18 Miguel de Icaza <miguel@ximian.com>
4003 * pending.cs: New file. Move the code from class.cs here.
4004 Support clearning the pending flag for all methods (when not doing
4005 explicit interface implementation).
4007 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
4009 * rootcontext.cs: added a couple more types needed to bootstrap.
4011 2002-06-17 Miguel de Icaza <miguel@ximian.com>
4013 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
4014 constructor in the type, instead of any constructor in the type
4015 hierarchy. Thanks to Paolo for finding this bug (it showed up as
4016 a bug in the Mono runtime when applying the params attribute).
4018 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
4019 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
4021 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
4023 * expression.cs (Unary.ResolveOperator): Use TypeManager
4024 to resolve the type.
4026 2002-06-13 Ravi Pratap <ravi@ximian.com>
4028 * cs-parser.jay (enum_member_declaration): Pass in the attributes
4031 * enum.cs (AddEnumMember): Add support to store the attributes associated
4032 with each member too.
4034 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
4035 field builders too - this takes care of the enum member case.
4037 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
4039 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
4040 address-of operator on both value types and pointers.
4042 2002-06-10 Martin Baulig <martin@gnome.org>
4044 * interface.cs (Interface.PopulateIndexer): Add the indexer's
4045 PropertyBuilder to the `property_builders' list.
4047 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
4048 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
4049 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
4050 find any indexers which are inherited from an interface.
4052 2002-06-09 Martin Baulig <martin@gnome.org>
4054 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
4055 the same type as the constant if necessary. There's also a test-130.cs
4058 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
4060 * typemanager.cs (TypeManager.ChangeType): Previously known as
4061 Enum.ChangeEnumType().
4063 2002-06-09 Martin Baulig <martin@gnome.org>
4065 * expression.cs (Cast.TryReduce): Added support for consts.
4067 2002-06-08 Ravi Pratap <ravi@ximian.com>
4069 * class.cs (Accessor): Hold attributes information so we can pass
4072 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
4073 Modify to pass in attributes attached to the methods.
4075 (add_accessor_declaration, remove_accessor_declaration): Ditto.
4077 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
4078 to handle the Accessor kind :-)
4080 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
4082 2002-06-08 Martin Baulig <martin@gnome.org>
4084 * expression.cs (Unary.TryReduceNegative): Added support for
4087 2002-06-08 Martin Baulig <martin@gnome.org>
4089 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
4090 name can't be found in the `defined_names' - the caller will do a
4091 MemberLookup in this case and thus find methods in System.Enum
4092 such as Enum.IsDefined().
4094 2002-06-08 Martin Baulig <martin@gnome.org>
4096 * enum.cs (Enum.ChangeEnumType): This is a custom version of
4097 Convert.ChangeType() which works with TypeBuilder created types.
4098 (Enum.LookupEnumValue, Enum.Define): Use it here.
4100 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
4101 `TypeBuilder.BaseType != null' check.
4102 (TypeContainer.FindMembers): Only lookup parent members if we
4103 actually have a parent.
4104 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
4105 (ConstructorInitializer.Resolve): Likewise.
4107 * interface.cs (Interface.FindMembers): Added
4108 `TypeBuilder.BaseType != null' check.
4110 * rootcontext.cs (RootContext.ResolveCore): Added
4111 "System.Runtime.CompilerServices.IndexerNameAttribute" to
4112 classes_second_stage.
4114 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
4115 debug_type and trace_type when compiling with --nostdlib.
4117 2002-06-07 Martin Baulig <martin@gnome.org>
4119 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
4120 (AddField): Set it to true when adding a non-static field.
4121 (DefineType): Use `have_nonstatic_fields' to find out whether we
4122 have non-static fields, not `Fields != null'.
4124 2002-06-02 Miguel de Icaza <miguel@ximian.com>
4126 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
4127 dereferencing a null on the static-field code path)
4129 2002-05-30 Martin Baulig <martin@gnome.org>
4131 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
4132 to take command line arguments. Use reflection to call the new
4133 custom `Initialize' function on the symbol writer and pass it the
4134 command line arguments.
4136 * driver.cs (--debug-args): New command line argument to pass command
4137 line arguments to the symbol writer.
4139 2002-05-28 Miguel de Icaza <miguel@ximian.com>
4141 * assign.cs (DoResolve): Forgot to do the implicit conversion to
4142 the target type for indexers and properties. Thanks to Joe for
4145 2002-05-27 Miguel de Icaza <miguel@ximian.com>
4147 * typemanager.cs (MethodFlags): returns the method flags
4148 (Obsolete/ShouldIgnore) that control warning emission and whether
4149 the invocation should be made, or ignored.
4151 * expression.cs (Invocation.Emit): Remove previous hack, we should
4152 not do this on matching a base type, we should do this based on an attribute
4154 Only emit calls to System.Diagnostics.Debug and
4155 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
4156 on the command line.
4158 * rootcontext.cs: Global settings for tracing and debugging.
4160 * cs-tokenizer.cs (define): New utility function to track
4161 defines. Set the global settings for TRACE and DEBUG if found.
4163 2002-05-25 Ravi Pratap <ravi@ximian.com>
4165 * interface.cs (Populate*): Pass in the TypeContainer as well as
4166 the DeclSpace as parameters so that we can create EmitContexts and
4167 then use that to apply attributes etc.
4169 (PopulateMethod, PopulateEvent, PopulateProperty)
4170 (PopulateIndexer): Apply attributes everywhere.
4172 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
4175 (ApplyAttributes): Update accordingly.
4177 We now apply interface attributes for all members too.
4179 2002-05-26 Miguel de Icaza <miguel@ximian.com>
4181 * class.cs (Indexer.Define); Correctly check if we are explicit
4182 implementation (instead of checking the Name for a ".", we
4183 directly look up if the InterfaceType was specified).
4185 Delay the creation of the PropertyBuilder.
4187 Only create the PropertyBuilder if we are not an explicit
4188 interface implementation. This means that explicit interface
4189 implementation members do not participate in regular function
4190 lookups, and hence fixes another major ambiguity problem in
4191 overload resolution (that was the visible effect).
4193 (DefineMethod): Return whether we are doing an interface
4196 * typemanager.cs: Temporary hack until we get attributes in
4197 interfaces (Ravi is working on that) and we get IndexerName
4198 support in interfaces.
4200 * interface.cs: Register the indexers as properties.
4202 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
4203 warning, I have verified that this is a bug in the .NET runtime
4204 (JavaScript suffers of the same problem).
4206 * typemanager.cs (MemberLookup): When looking up members for
4207 interfaces, the parent of an interface is the implicit
4208 System.Object (so we succeed in searches of Object methods in an
4209 interface method invocation. Example: IEnumerable x; x.ToString
4212 2002-05-25 Miguel de Icaza <miguel@ximian.com>
4214 * class.cs (Event): Events should also register if they do
4215 implement the methods that an interface requires.
4217 * typemanager.cs (MemberLookup); use the new GetInterfaces
4220 (GetInterfaces): The code used to lookup interfaces for a type is
4221 used in more than one place, factor it here.
4223 * driver.cs: Track the errors at the bottom of the file, we kept
4226 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
4227 instance if the method we are calling is static!
4229 2002-05-24 Miguel de Icaza <miguel@ximian.com>
4231 * attribute.cs (ApplyAttributes): Make this function filter out
4232 the IndexerName attribute (as that attribute in reality is never
4233 applied) and return the string constant for the IndexerName
4236 * class.cs (TypeContainer.Emit): Validate that all the indexers
4237 have the same IndexerName attribute, and if so, set the
4238 DefaultName attribute on the class.
4240 * typemanager.cs: The return value might contain other stuff (not
4241 only methods). For instance, consider a method with an "Item"
4242 property and an Item method.
4244 * class.cs: If there is a problem with the parameter types,
4247 2002-05-24 Ravi Pratap <ravi@ximian.com>
4249 * ecore.cs (ImplicitConversionExists): Wrapper function which also
4250 looks at user defined conversion after making a call to
4251 StandardConversionExists - we need this for overload resolution.
4253 * expression.cs : Update accordingly the various method calls.
4255 This fixes 2 bugs filed against implicit user defined conversions
4257 2002-05-22 Miguel de Icaza <miguel@ximian.com>
4259 * statement.cs: Track the result of the assignment.
4261 2002-05-21 Miguel de Icaza <miguel@ximian.com>
4263 * expression.cs (MemberAccess): Improved error reporting for
4264 inaccessible members.
4266 2002-05-22 Martin Baulig <martin@gnome.org>
4268 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
4269 itself with debugging support.
4271 2002-05-22 Martin Baulig <martin@gnome.org>
4273 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
4274 Removed, this isn't needed anymore.
4276 2002-05-20 Martin Baulig <martin@gnome.org>
4278 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
4279 be underlying type for an enum.
4281 2002-05-20 Miguel de Icaza <miguel@ximian.com>
4283 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
4284 that splits out the loading of just the core types.
4286 * rootcontext.cs (ResolveCore): Split the struct resolution in
4287 two, so we can load the enumeration underlying types before any
4290 * expression.cs (Is): Bandaid until we fix properly Switch (see
4291 bug #24985 for details).
4293 * typemanager.cs (ImplementsInterface): The hashtable will contain
4294 a null if there are no interfaces implemented.
4296 2002-05-18 Miguel de Icaza <miguel@ximian.com>
4298 * cs-parser.jay (indexer_declarator): It is fine to have array
4301 2002-05-17 Miguel de Icaza <miguel@ximian.com>
4303 * typemanager.cs: (RegisterBuilder): New function used to register
4304 TypeBuilders that implement interfaces. Since
4305 TypeBuilder.GetInterfaces (as usual) does not work with lame
4307 (AddUserType): register interfaces.
4309 (ImplementsInterface): Use the builder_to_ifaces hash if we are
4310 dealing with TypeBuilder. Also, arrays are showing up as
4311 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
4312 methods can not be invoked on them!
4314 * ecore.cs (ExplicitReferenceConversionExists): Made public.
4315 (ImplicitReferenceConversionExists): Split out from
4316 StandardConversionExists.
4318 * expression.cs (As): We were only implementing one of the three
4319 cases for the as operator. We now implement them all.
4320 (Is): Implement the various other cases for Is as well.
4322 * typemanager.cs (CACHE): New define used to control if we want or
4323 not the FindMembers cache. Seems to have a negative impact on
4324 performance currently
4326 (MemberLookup): Nested types have full acess to
4327 enclosing type members
4329 Remove code that coped with instance/static returns for events, we
4330 now catch this in RealFindMembers.
4332 (RealFindMembers): only perform static lookup if the instance
4333 lookup did not return a type or an event.
4335 2002-05-17 Miguel de Icaza <miguel@ximian.com>
4337 * assign.cs (CompoundAssign): We pass more semantic information
4338 now to Compound Assignments than we did before: now we have all
4339 the information at hand, and now we resolve the target *before* we
4340 do the expression expansion, which allows the "CacheValue" method
4341 to have the effect we intended (before, a [x] += 1 would generate
4342 two differen ArrayAccess expressions from the ElementAccess,
4343 during the resolution process).
4345 (CompoundAssign.DoResolve): Resolve target and original_source here.
4347 2002-05-16 Miguel de Icaza <miguel@ximian.com>
4349 * expression.cs (ArrayAccess): dropped debugging information.
4351 * typemanager.cs: Small bug fix: I was always returning i_members,
4352 instead of one of i_members or s_members (depending on which had
4355 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
4356 method is invoked before any code generation takes place, and it
4357 is a mechanism to inform that the expression will be invoked more
4358 than once, and that the method should use temporary values to
4359 avoid having side effects
4361 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
4363 * ecore.cs (Expression.CacheTemporaries): Provide empty default
4366 * expression.cs (Indirection, ArrayAccess): Add support for
4367 CacheTemporaries in these two bad boys.
4369 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
4371 (StoreFromPtr): Handle stobj as well.
4373 * expression.cs (UnaryMutator): Share more code.
4375 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
4376 down: I was not tracking the Filter function as well, which
4377 was affecting the results of the cache.
4379 2002-05-15 Miguel de Icaza <miguel@ximian.com>
4381 * attribute.cs: Remove the hack to handle the CharSet property on
4384 2002-05-14 Miguel de Icaza <miguel@ximian.com>
4386 * attribute.cs (DoResolve): More uglyness, we now only try to
4387 resolve the attribute partially, to extract the CharSet
4388 information (only if we are a StructLayout attribute). Otherwise
4390 (GetExtraTypeInfo): Add some code to conditionally kill in the
4391 future this. I am more and more convinced that the .NET
4392 framework has special code to handle the attribute setting on
4395 * expression.cs (IsParamsMethodApplicable): Revert my previous
4396 foreach change here, it was wrong.
4398 2002-05-13 Miguel de Icaza <miguel@ximian.com>
4400 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
4401 (pp_expr): do not abort on unknown input, just return.
4402 (eval): abort if there are pending chars.
4404 * attribute.cs (Attribute.Resolve): Positional parameters are
4405 optional. Deal with that case.
4407 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
4408 the Ansi/Unicode/Auto information for the type.
4410 (TypeContainer.DefineType): instantiate the EmitContext here, as
4411 we will be using it during the type definition (to resolve
4412 attributes) and during the emit phase.
4414 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
4415 to pull type information out of the attributes
4417 (Attribute.Resolve): track the constructor builder, and allow for
4418 multiple invocations (structs and classes will use this).
4420 * ecore.cs (MemberLookupFinal): new version with all the
4421 parameters customizable.
4423 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
4424 constructors. Return if the result value is null (as the error
4425 would have been flagged already by MemberLookupFinal)
4427 Do not allow instances of abstract classes or interfaces to be
4430 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
4431 We have to compare the assembly property here when dealing with
4432 FamANDAssem and Assembly access modifiers, because we might be
4433 creating an assembly from *modules* (that means that we are not
4434 getting TypeBuilders for types defined in other modules that are
4435 part of this assembly).
4437 (Method.Emit): If the method is marked abstract and has a body,
4440 (TypeContainer.DefineMembers): If both the defined member and the
4441 parent name match are methods, then do not emit any warnings: let
4442 the Method.Define routine take care of flagging warnings. But if
4443 there is a mismatch (method overrides something else, or method is
4444 overriwritten by something, then emit warning).
4446 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
4447 set to null, this means `do not check for the return type on the
4450 (Method.Define): set the return type for the method signature to
4451 null, so that we get methods with the same name and parameters and
4452 different return types. This is used to flag warning 114 (you are
4453 hiding a method, and you probably want to use the new/override
4456 * typemanager.cs (MemberLookup): Implemented proper access
4457 control, closing a long standing set of bug reports. The problem
4458 was that the Framework only has two bits: Public and NonPublic,
4459 and NonPublic includes private and protected methods, but we need
4460 to enforce the FamANDAssem, FamOrAssem and Family.
4462 2002-05-11 Miguel de Icaza <miguel@ximian.com>
4464 * statement.cs (GotoCase): Return true: Ammounts to giving up
4465 knowledge on whether we return or not, and letting the other case
4466 be responsible for it.
4468 2002-05-10 Miguel de Icaza <miguel@ximian.com>
4470 * driver.cs: Do not load directories for each file processed, only
4471 do it if there is a pattern.
4473 * ecore.cs: Report readonly assigns here as well, as we might have
4474 been resolved only by MemberAccess.
4476 (SimpleName.SimpleNameResolve): Also be useful for LValue
4477 resolution. We need this to propagate assign to local readonly variables
4479 * typemanager.cs: Use a ptrhashtable for the criteria, because we
4480 do not want to reuse potential criteria memory.
4482 * class.cs (MyEventBuilder): Set reflected_type;
4484 * ecore.cs (Constantify): Added support for constifying bools.
4486 (RootContext.LookupType): Added a cache for values looked up in
4487 the declaration space.
4489 * typemanager.cs (FindMembers): Now is a front-end to
4490 RealFindMembers, and provides a two-level hashtable-based cache to
4493 15% performance improvement: from 22.5 to 19.2 seconds.
4495 * expression.cs (IsParamsMethodApplicable): use foreach.
4496 (Invocation.DoResolve): ditto.
4497 (New.DoResolve): ditto.
4498 (ArrayCreation.DoResolve): ditto.
4500 * ecore.cs (FindMostEncompassingType): use foreach.
4502 * delegate.cs (NewDelegate.DoResolve): Use foreach
4504 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
4505 (RemoveMethods): use foreach.
4507 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
4508 nested foreach statements instead of for, and also break out of
4509 the inner loop once a match is found.
4511 (Invocation.OverloadResolve): Use foreach, simplify the code.
4513 2002-05-08 Miguel de Icaza <miguel@ximian.com>
4515 * cfold.cs (BinaryFold): During an enumeration evaluation context,
4516 we actually unwrap the expression to allow for extra information
4519 * expression.cs: Use Shr_Un on unsigned operations.
4521 2002-05-08 Ravi Pratap <ravi@ximian.com>
4523 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
4524 applicable operators was not being considered correctly. This closes
4525 the bug Miguel reported.
4527 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
4529 * attribute.cs: check that the type derives from System.Attribute
4530 and report the correct error in that case (moved the duplicate code to
4531 its own method, too).
4533 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
4535 * attribute.cs: lookup attribute type name as the spec says: first the
4536 bare attribute name and then name + "Attribute" (nant compiles with
4537 mcs after this fix).
4539 2002-05-07 Miguel de Icaza <miguel@ximian.com>
4541 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
4542 Because of the way we parse things, we should try to see if a
4543 UIntConstant can fit in an integer.
4545 2002-05-07 Ravi Pratap <ravi@ximian.com>
4547 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
4548 when we are in an explicit context.
4550 (ConvertReferenceExplicit): When converting from Iface type S to Class
4551 T make sure the rules are implemented as an OR.
4553 * parameter.cs (ParameterType): Make it a property for now although the
4554 purpose really isn't anything immediate.
4556 * expression.cs (Is*Applicable): Do better checking on the parameter type
4557 of a ref/out parameter. The ones from the system assemblies are already
4558 marked with the correct type so we don't need to do any correction.
4560 * ecore.cs (StandardConversionExists): Conversion from Interface types to
4561 the object type is standard too so include that.
4563 2002-05-06 Miguel de Icaza <miguel@ximian.com>
4565 * ecore.cs (StandardConversionExists): Augment with missing code:
4566 deal with IntConstant, LongConstants and Enumerations.
4568 * assign.cs: Report the error, instead of failing silently
4570 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
4571 typecontainer that they are declared, because the
4572 typecontainer/namespace will have the list of using clauses that
4575 Assembly Attributes were escaping the normal registration
4578 (EmitCode): Apply attributes within an EmitContext that represents
4579 the container they were declared on.
4581 * cs-parser.jay: Track bases for structs. How did I get this wrong?
4583 2002-05-06 Ravi Pratap <ravi@ximian.com>
4585 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
4586 Revamp completely - make much cleaner as we now operate only
4589 (FindMostSpecificSource, FindMostSpecificTarget): New methods
4590 to implement the logic detailed in the spec more correctly.
4592 (UserDefinedConversion): Update accordingly.
4594 2002-05-06 Miguel de Icaza <miguel@ximian.com>
4596 * statement.cs: Return flow analysis information up.
4598 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
4601 (token): Do not consume an extra character before calling
4604 2002-05-06 Piers Haken <piersh@friskit.com>
4606 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
4608 2002-05-06 Miguel de Icaza <miguel@ximian.com>
4610 * class.cs (Constructor.Emit): Set the IsStatic flag in the
4611 EmitContext during the instance constructor initializer
4612 resolution, to stop access to instance variables.
4614 This is mandated by the spec, last paragraph of the `constructor
4615 initializers' section.
4617 2002-05-05 Miguel de Icaza <miguel@ximian.com>
4619 * cs-parser.jay, class.cs (Accessor): new class used to represent
4620 an accessor (get or set). In the past we used `null' to represent
4621 a missing accessor. But this is ambiguous because there was no
4622 way to tell in abstract indexers/properties if one of them was
4625 Now there is a way of addressing that.
4627 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
4628 instead of FindMembers.
4630 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
4631 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
4633 * attribute.cs: Treat indexers and properties as the same in terms
4634 of applying attributes
4636 * ecore.cs (FindMostEncompassedType): Use statically initialized
4637 EmptyExpressions()s like we do elsewhere to avoid creating useless
4638 objects (and we take this out of the tight loop).
4640 (GetConversionOperators): Move the code to extract the actual
4641 operators to a separate routine to clean things up.
4643 2002-05-04 Miguel de Icaza <miguel@ximian.com>
4645 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
4646 events are always registered FieldBuilders.
4648 * class.cs (FieldBase): New class shared by Fields
4650 * delegate.cs: If we are a toplevel delegate, use our full name.
4651 If we are a nested delegate, then only use our tail name.
4653 2002-05-02 Ravi Pratap <ravi@ximian.com>
4655 * expression.cs (IsApplicable): Ensure that we add the "&" to
4656 ref/out types before comparing it with the type of the argument.
4658 (IsParamsMethodApplicable): Ditto.
4660 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
4663 * delegate.cs : Handle the case when we have more than one applicable
4664 method. Flag an error only when we finish checking all.
4666 2002-05-02 Miguel de Icaza <miguel@ximian.com>
4668 * expression.cs: Add support for boolean static initializers.
4670 2002-05-01 Miguel de Icaza <miguel@ximian.com>
4672 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
4674 * parameter.cs (ComputeParameterTypes,
4675 ComputeAndDefineParameterTypes): Better error handling: now we
4676 clear the `types' cache if we fail during any of the type lookups.
4677 We also return the status code correctly to our caller
4679 * delegate.cs: If we fail to define a delegate, abort the extra
4682 * expression.cs (Binary.ResolveOperator): for
4683 operator==(object,object) and operator !=(object, object) we also
4684 have to verify that there is an implicit conversion from one to
4687 (ArrayAccess.DoResolve): Array Access can operate on
4690 2002-04-30 Miguel de Icaza <miguel@ximian.com>
4692 * assign.cs (CompoundAssign): A new class used as a "flag" that
4693 the assignment actually is happening as part of a compound
4694 assignment operator.
4696 During compound assignment, a few new rules exist to enable things
4703 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
4704 to the type of x) if y is implicitly convertible to the type of x,
4705 and the operator is a builtin operator and the return type of the
4706 operator is explicitly convertible to the type of x.
4708 * rootcontext.cs: Reset warning level to 2. 4 catches various
4709 "interesting" features in mcs, we must clean this up at some
4710 point, but currently am trying to kill other bugs ;-)
4712 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
4713 in container classes as well.
4715 * expression.cs (Binary.ResolveOperator): Handle string case
4716 before anything else (as operator overloading does emit an error
4717 before doing anything else).
4719 This code could go away when we move to a table driven model, but
4720 i could not come up with a good plan last night.
4722 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
4724 * typemanager.cs (CSharpName): reimplementation using regex.
4725 * class.cs: added null check for fields in Emit
4726 * rootcontext.cs: set warninglevel to 4
4728 2002-04-29 Miguel de Icaza <miguel@ximian.com>
4730 * typemanager.cs (CSharpName): reimplemented with Lupus
4733 2002-04-28 Miguel de Icaza <miguel@ximian.com>
4735 * statement.cs (If): correclty implement Resolve, because we were
4736 not catching sem errors in there. The same process is needed
4738 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
4741 (Statement.Warning_DeadCodeFound): Factorize code.
4742 (While): Report dead code here too.
4744 (Statement): Added Resolve virtual method to allow
4745 for resolution split from the emit code.
4747 2002-04-26 Miguel de Icaza <miguel@ximian.com>
4749 * statement.cs (EmitBoolExpression): No longer try to resolve the
4751 (MakeBoolean): New utility function that resolve, implicitly
4752 converts to boolean and tags the expression.
4755 (If, Do): Implement dead code elimination.
4756 (While): Implement loop inversion
4758 (Do, While, For, If): Resolve the expression prior to calling our
4761 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
4764 - added method Report28 (warning: program has more than one entry point)
4765 - added method IsEntryPoint, implements paragraph 10.1 of the spec
4766 - modified method Method.Define, the part at the end of the method
4768 * rootcontext.cs: added static public Location EntryPointLocation;
4770 * ../errors/cs0028.cs : Add test case for the above warning.
4773 - modified method CSharpName to allow arrays of primitive type to
4774 be printed nicely (e.g. instead of System.Int32[][] it now prints
4776 - added method CSharpSignature: returns the signature of a method
4777 in string format to be used in reporting errors, warnings, etc.
4779 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
4782 2002-04-26 Ravi Pratap <ravi@ximian.com>
4784 * delegate.cs (Define): Fix extremely silly bug where I was
4785 setting the type of the 'object' parameter of the BeginInvoke
4786 method to System.IAsyncResult instead of System.Object ;-)
4788 2002-04-26 Miguel de Icaza <miguel@ximian.com>
4790 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
4793 (Constructor.Emit): return if we fail to initialize the
4794 constructor. Another door closed!
4796 * expression.cs (New.DoResolve): Improve error message (from -6 to
4797 1501). Use DeclaredOnly lookup to find the exact constructor.
4799 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
4800 loop. This is useful.
4802 * cs-parser.jay: Adjust the default parameters so that destructors
4803 have the proper signature.
4805 2002-04-26 Martin Baulig <martin@gnome.org>
4807 * driver.cs (LoadAssembly): If `assembly' contains any characters
4808 which are only valid in path names and not in assembly names
4809 (currently slash, backslash and point), use Assembly.LoadFrom ()
4810 instead of Assembly.Load () on the `assembly' (before iteration
4811 over the link_paths).
4813 2002-04-26 Martin Baulig <martin@gnome.org>
4815 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
4817 2002-04-25 Miguel de Icaza <miguel@ximian.com>
4819 * class.cs (Property): use the new typemanager.MemberLookup
4821 (TypeContainer.MemberLookup): Implement using the
4822 TypeManager.MemberLookup now.
4824 * typemanager.cs: Make MemberLookup a function of the TypeManager,
4825 and return MemberInfos, so that these can be used without an
4826 EmitContext (what we had before).
4828 2002-04-24 Miguel de Icaza <miguel@ximian.com>
4830 * expression.cs: Fix the case where the argument to params if the
4831 type of the params. I omitted handling this before. Fixed
4833 2002-04-22 Miguel de Icaza <miguel@ximian.com>
4835 * driver.cs: Call BootCorlib_PopulateCoreType
4837 * class.cs (Property.CheckBase): Check for properties only, not
4840 * interface.cs: Temporary hack: try/catch around the
4841 CustomAttributeBuilder, because I am getting an exception that I
4844 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
4845 types whose definitions are required to be there (attributes are
4846 defined before standard types).
4848 Compute definitions as we boot the various types, as they are used
4849 immediately (value_type class will need object_type, but if we do
4850 not initialize object_type, we will pass a null, which will let
4851 the runtime pick the System.Object from the existing corlib, which
4852 is not what we want).
4854 2002-04-22 Patrik Torstensson <totte@labs2.com>
4856 * cs-tokenizer.cs: fixed a number of trim() issues.
4858 2002-04-22 Ravi Pratap <ravi@ximian.com>
4860 * expression.cs (Argument.Type): Ensure that we return the correct
4861 type when we have out or ref parameters [in which case we
4864 2002-04-22 Miguel de Icaza <miguel@ximian.com>
4866 * class.cs (Property, Indexer): Allow extern modifier in there.
4868 * typemanager.cs (InitBaseTypes): Initializes object_type and
4869 value_type, since those will be used early on during the bootstrap
4870 process to compile corlib.
4872 (InitCoreTypes): Move code from here to InitBaseTypes.
4874 2002-04-21 Miguel de Icaza <miguel@ximian.com>
4876 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
4877 single-dimension arrays as using the ldlen opcode.
4879 Daniel Lewis discovered this optimization.
4881 * typemanager.cs: Add signature for System.Array::get_Length
4883 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4885 * statement.cs: report the error when the foreach does not apply to an
4886 array nor a collection.
4888 2002-04-19 Miguel de Icaza <miguel@ximian.com>
4890 * expression.cs: Add implicit conversions to the operator ~.
4892 * constant.cs (DecimalConstant.Emit): Emit decimal value.
4894 * typemanager.cs: Locate the decimal constructor.
4896 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4898 * attribute.cs: use the new property of TypeOf.
4899 * expression.cs: added 'get' property around typearg.
4901 These changes fix a build breaker reported by NickD. Is this the
4902 correct way to fix? If not, please, revert my changes and make it
4905 2002-04-17 Miguel de Icaza <miguel@ximian.com>
4907 * attribute.cs: Add support for typeof in attribute invocations.
4908 I am not sure that this is right though.
4910 2002-04-14 Duncan Mak <duncan@ximian.com>
4912 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
4913 Binary.Operator.Division case.
4915 2002-04-13 Ravi Pratap <ravi@ximian.com>
4917 * class.cs (DefineType): Ensure that we do a proper check on
4918 attribute types and also register it with the TypeManager.
4920 (TypeContainer.Targets): The default for attribute types is
4921 AttributeTargets.All.
4923 * attribute.cs (ApplyAttributes): Registering the attribute type
4924 is done elsewhere, not when we discover we have a Usage attribute.
4926 2002-04-12 Ravi Pratap <ravi@ximian.com>
4928 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
4929 and get rid of is_delegate parameter.
4931 * everywhere : update.
4933 2002-04-12 Ravi Pratap <ravi@ximian.com>
4935 * cs-parser.jay (compilation_unit): Revamp completely to use
4936 some new ideas that I got from Rhys' grammar to solve the problems
4937 with assembly level attributes.
4939 (outer_declaration): New grammar production.
4941 (attribute_sections): Add.
4943 (opt_attributes): Base on attribute_sections
4945 (namespace_declaration): Allow opt_attributes to tackle the case
4946 when we have assembly level attributes - we are clever in this
4949 * attribute.cs (ApplyAttributes): Do not worry about assembly
4950 attributes in the non-global context.
4952 * rootcontext.cs (AddGlobalAttributes): Go back to using this
4953 instead of SetGlobalAttributes.
4955 * class.cs, rootcontext.cs : Ensure we define and generate
4956 attribute types before anything else.
4958 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
4959 and flag the new error -20 for the case when the attribute type
4960 does not have valid targets specified. csc does not catch this.
4962 * ../errors/errors.txt : update for error # -20
4964 2002-04-11 Ravi Pratap <ravi@ximian.com>
4966 * support.cs (InternalParameters.ParameterModifier): Do some null
4967 checking and return sane values.
4969 * class.cs (Method.Define): If we are a PInvoke method, ensure
4970 that we are static and extern. Report error # 601
4972 * ../errors/cs0601.cs : Add test case for the above error.
4974 2002-04-07 Ravi Pratap <ravi@ximian.com>
4976 * rootcontext.cs (attribute_types): We need to keep type of
4977 all attribute types separately and emit code for them first.
4979 (RegisterAttribute) : Implement.
4981 * class.cs (DefineType): Check if the current Type is a custom
4982 attribute type and register it accordingly.
4984 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
4985 adding the first attribute twice and rename to
4987 (SetGlobalAttributes): this.
4989 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
4992 * attribute.cs (ApplyAttributes): Take an additional argument telling us
4993 if we are processing global arguments. Hmm, I am unsure of this.
4995 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4997 * expression.cs: added static array of strings to avoid calling
4998 Enum.ToString () for Operator in Binary. Significant recover of
5001 2002-04-10 Miguel de Icaza <miguel@ximian.com>
5003 * class.cs (FindMembers): Allow the Builders of the various
5004 members to be null. If they are skip them. This only happens
5005 during the PInvoke declaration.
5007 2002-04-09 Miguel de Icaza <miguel@ximian.com>
5009 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
5010 failure, so we do not keep going afterwards.
5012 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
5013 wanted to pass `false' as the `is_delegate' argument. If this is
5014 the case, why not use delegate_type == null to mean `is_delegate =
5015 false' and anything else as is_delegate = true.
5017 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
5019 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
5020 code for the section, not the beginning of the tests.
5022 2002-04-08 Miguel de Icaza <miguel@ximian.com>
5024 * cfold.cs: Handle operator + (Enum x, Underlying x)
5026 * expression.cs (Binary): same. Warn about errors where we have
5027 Enum/Enum in operator + as well.
5029 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
5032 - added support for switch(bool)
5033 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
5034 - add TableSwitchEmit() to handle table-based switch statements
5036 2002-04-05 Ravi Pratap <ravi@ximian.com>
5038 * expression.cs (Invocation.OverloadResolve): Factor out code which
5039 does parameter compatibility checking with arguments so that we can
5040 re-use the code even from Delegate.VerifyApplicability
5042 (VerifyArgumentsCompat): Move above code here.
5044 * delegate.cs (VerifyApplicability): Get rid of duplicate code
5045 and instead make a call to the above method.
5047 2002-03-31 Ravi Pratap <ravi@ximian.com>
5049 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
5050 We use it to keep track of classes which are attribute types.
5052 2002-04-02 Miguel de Icaza <miguel@ximian.com>
5054 * delegate.cs (Delegate.Define): Correctly define the types in the
5055 presence of fixed and array parameters.
5057 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
5060 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
5061 include NonPublic after the first iteration.
5063 * class.cs (Indexer.CheckBase): Only check if both parents are
5066 * cs-parser.jay (accessor_body): If empty, set to null.
5068 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
5069 same code path here to resolve constants names that we did have in
5070 MemberAccess.DoResolve. There is too much code duplicated here.
5072 2002-04-01 Miguel de Icaza <miguel@ximian.com>
5074 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
5076 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
5079 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
5080 tokens, numbers and strings.
5082 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
5085 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
5086 asyncronous parameters and the regular parameters.
5088 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
5089 specify the target directory.
5091 * expression.cs: (This.DoResolve): Simplify
5092 (As.Emit): Optimize, do not generate IsInst if the expression is
5093 always of the given type.
5095 (Is.DoResolve): Bug fix, we were reporting both always/never for
5098 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
5099 creating too many unnecessary arrays.
5101 2002-03-31 Miguel de Icaza <miguel@ximian.com>
5103 * class.cs (EmitFieldInitializer): Use Assign expression to assign
5104 fields instead of rolling our own initializer. Takes care of all
5105 implicit conversions, and drops unnecessary static checks/argument.
5107 2002-03-31 Dick Porter <dick@ximian.com>
5109 * driver.cs: use the GetDirectories() return values properly, and
5110 use "/" as path separator.
5112 2002-03-30 Miguel de Icaza <miguel@ximian.com>
5114 * expression.cs (Unary): Optimize - - expr into expr.
5115 (Binary): Optimize a + (-b) into a -b.
5117 * codegen.cs (CodeGen): Made all methods static.
5119 2002-03-29 Miguel de Icaza <miguel@ximian.com>
5123 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
5124 TypeBuilder property.
5126 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
5129 * tree.cs: Removed the various RecordXXXX, and replaced with a
5130 single RecordDecl. Removed all the accessor methods, and just
5131 left a single access point Type
5133 * enum.cs: Rename DefineEnum to DefineType.
5135 * decl.cs: New abstract method `DefineType' used to unify the
5136 Defines for Enumerations, Interfaces, TypeContainers and
5139 (FindType): Moved LookupInterfaceOrClass here. Moved the
5140 LookupBaseClasses method that used to live in class.cs and
5141 interface.cs here, and renamed to FindType.
5143 * delegate.cs: Implement DefineType. Take advantage of the
5144 refactored pattern for locating the parent builder without taking
5145 the parent_builder argument (which we know does not work if we are
5146 nested, and triggering a toplevel definition).
5148 2002-03-28 Miguel de Icaza <miguel@ximian.com>
5150 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
5151 accessibility of a member has changed during override and report
5154 * class.cs (Method.Define, Property.Define): Only complain on
5155 overrides if the method is private, any other accessibility is
5156 fine (and since we just checked the permission is the same, we are
5159 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
5160 and elif are processed always. The other pre-processing
5161 directives are only processed if we are "taking" the path
5163 2002-03-29 Martin Baulig <martin@gnome.org>
5165 * class.cs (Method.Emit): Only emit symbolic debugging info if the
5166 current location is not Null.
5168 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
5169 a separate method so we can profile it.
5171 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
5172 `span.Seconds' are just seconds, but no minutes or hours.
5173 (MainDriver): Profile the CodeGen.SaveSymbols calls.
5175 2002-03-28 Miguel de Icaza <miguel@ximian.com>
5177 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
5178 Remove the gratuitous set of Final:
5180 // If an interface implementation, then we can set Final.
5181 if (((flags & MethodAttributes.Abstract) == 0) &&
5182 implementing.DeclaringType.IsInterface)
5183 flags |= MethodAttributes.Final;
5185 I do not know what I was smoking when I used that.
5188 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
5189 step into fixing the name resolution issues for delegates and
5190 unifying the toplevel name resolution.
5192 2002-03-28 Martin Baulig <martin@gnome.org>
5194 * class.cs (Method.Emit): If we have a symbol writer, call its
5195 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
5196 tell it about the current method.
5198 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
5199 writer that we're going to emit the first byte of IL code for a new
5200 statement (a new source line).
5201 (EmitContext.EmitTopBlock): If we have a symbol writer, call
5202 EmitContext.Mark() before emitting any code.
5204 * location.cs (SymbolDocument): Return null when we're Null.
5206 * statement.cs (Statement): Moved the `Location loc' variable here.
5207 (Statement.EmitBoolExpression): If we have a symbol writer, call
5208 ec.Mark() before emitting any code to tell it that we're at the
5209 beginning of a new statement.
5210 (StatementExpression): Added `Location' argument to the constructor.
5211 (Block): Added public readonly variable `StartLocation' and public
5212 variable `EndLocation'. The latter is to be set using SetEndLocation().
5213 (Block): Added constructor which takes a start and end location.
5214 (Block.SetEndLocation): New method. This sets the end location.
5215 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
5216 local variables we create.
5217 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
5218 each statement and do also mark the begin and end of the block.
5220 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
5221 tell it the current lexer.Location, use Location.Null for the end of the
5223 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
5224 current block, set its end location using SetEndLocation().
5225 (statement_expression): StatementExpression constructor now takes the
5226 lexer.Location as additional argument.
5227 (for_statement, declare_local_variables): Likewise.
5228 (declare_local_variables): When creating a new implicit block, use the
5229 new Block constructor and pass it the lexer.Location.
5231 2002-03-28 Miguel de Icaza <miguel@ximian.com>
5233 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
5234 members also on the parent interfaces recursively.
5236 2002-03-27 Miguel de Icaza <miguel@ximian.com>
5238 * report.cs: Use new formats, since Gonzalo finished the missing
5241 * expression.cs (Binary.ResolveOperator): added missing operator|
5242 operator& and operator^ for bool/bool.
5244 * cs-parser.jay: CheckDef now takes a Location argument that is
5245 used to report errors more precisly (instead of reporting the end
5246 of a definition, we try to track something which is a lot closer
5247 to the source of the problem).
5249 * cs-tokenizer.cs: Track global token use, so we can properly flag
5250 the use of #define/#undef after the first token has been seen.
5252 Also, rename the reportXXXX to Error_DescriptiveName
5254 * decl.cs (DeclSpace.IsTopLevel): Move property here from
5255 TypeContainer, so that Enum and Interface can use this too.
5257 * class.cs (TypeContainer.LookupInterfaceOrClass,
5258 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
5259 `builder' argument. Typically this was used to pass the parent
5260 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
5263 The problem is that a nested class could trigger the definition of
5264 a toplevel class, and the builder would be obviously wrong in that
5267 So we drop this argument, and we compute dynamically the
5268 TypeBuilder/ModuleBuilder (the correct information was available
5269 to us anyways from DeclSpace.Parent)
5271 * interface.cs (Interface.DefineInterface): Drop builder
5272 parameter cleanup like class.cs
5274 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
5277 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
5280 (Try.Emit): Propagate the returns value from the statement.
5282 (Return.Emit): Even if we are leavning
5284 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
5286 * modifiers.cs: Fix the computation of MethodAttributes flags.
5288 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
5290 * driver.cs: allow compilation of files that start with '/'.
5291 Add a default case when checking the argument of --target.
5293 2002-03-25 Miguel de Icaza <miguel@ximian.com>
5295 * interface.cs: Implement the same search algorithm for types in
5298 * delegate.cs: Do not allow multiple definition.
5300 * Recovered ChangeLog that got accidentally amputated
5302 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
5304 * rootcontext.cs: Load manually enum to allow core classes to
5305 contain enumerations.
5307 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
5308 Update to new static methods in TypeManager.
5310 * typemanager.cs (GetMethod, GetConstructor): Use our
5311 implementation of FindMembers to find the members, since during
5312 corlib compilation, the types are TypeBuilders and GetMethod and
5313 GetConstructor do not work.
5315 Make all methods in TypeManager static.
5317 (InitCodeHelpers): Split the functionality from
5318 the InitCodeTypes function.
5320 * driver.cs: Call InitCodeHelpers after we have populated the
5323 * cs-parser.jay (delegate_declaration): we did not used to compute
5324 the delegate name correctly for void delegates.
5326 2002-03-24 Miguel de Icaza <miguel@ximian.com>
5328 * rootcontext.cs (RootContext): Init the interface_resolve_order
5329 and type_container_resolve_order always.
5331 (ResolveCore, BootstrapCorlib_ResolveClass,
5332 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
5333 compiler when compiling with --nostdlib
5335 * class.cs (TypeContainer.DefineType): Check that our parent is
5336 not null. This test is most important when we are bootstraping
5339 * codegen.cs: Split out the symbol writing code.
5341 2002-03-25 Martin Baulig <martin@gnome.org>
5343 * driver.cs (-g): Made -g an alias for --debug.
5345 2002-03-24 Martin Baulig <martin@gnome.org>
5347 * codegen.cs (SymbolWriter): New public variable. Returns the
5348 current symbol writer.
5349 (CodeGen): Added `bool want_debugging_support' argument to the
5350 constructor. If true, tell the ModuleBuild that we want debugging
5351 support and ask it for the ISymbolWriter.
5352 (Save): If we have a symbol writer, call it's Close() method after
5353 saving the assembly.
5355 * driver.c (--debug): New command line argument to create a
5356 debugger information file.
5358 * location.cs (SymbolDocument): New public property. Returns an
5359 ISymbolDocumentWriter object for the current source file or null
5360 if we don't have a symbol writer.
5362 2002-03-21 Miguel de Icaza <miguel@ximian.com>
5364 * driver.cs (LoadAssembly): Correctly return when all the paths
5365 have been tried and not before.
5367 * statement.cs (Switch.Emit): return the actual coverage for this
5368 statement (returns/not-returns)
5370 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
5371 switch of the statement if we are the last switch section. That
5372 kills two problems: try/catch problems (we used to emit an empty
5373 nop at the end) and switch statements where all branches would
5376 2002-03-19 Miguel de Icaza <miguel@ximian.com>
5378 * driver.cs: Add default assemblies (the equivalent to the
5379 Microsoft CSC.RSP file)
5381 * cs-tokenizer.cs: When updating `cols and setting it to zero,
5382 also update tokens_seen and set it to false.
5384 * driver.cs: Implement --recurse for Mike.
5386 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
5387 correctly splitting out the paths.
5389 2002-03-18 Miguel de Icaza <miguel@ximian.com>
5391 * interface.cs (Interface.PopulateProperty): Instead of using
5392 `parent' as the declaration space for the set parameters, use
5395 * support.cs (InternalParameters): InternalParameters constructor
5396 takes a DeclSpace instead of a TypeContainer.
5398 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
5399 types are being initialized, load the address of it before calling
5402 (New): Provide a mechanism to disable the generation of local
5403 value type temporaries when the caller will be providing us with
5404 an address to store it.
5406 (ArrayCreation.EmitDynamicInitializers): Use it.
5408 2002-03-17 Miguel de Icaza <miguel@ximian.com>
5410 * expression.cs (Invocation.EmitArguments): Only probe for array
5411 property if there is more than one argument. Sorry about that.
5413 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
5416 * class.cs (Method.LabelParameters): Fix incorrect code path that
5417 prevented the `ParamArrayAttribute' from being applied to the
5420 2002-03-16 Miguel de Icaza <miguel@ximian.com>
5422 * support.cs (ReflectionParameters): Correctly compute whether the
5423 last argument is a params array. Fixes the problem with
5426 * typemanager.cs: Make the assemblies array always be non-null
5427 (empty, but non-null)
5429 * tree.cs (RecordDecl): New function that abstracts the recording
5430 of names. This reports error 101, and provides a pointer to the
5431 previous declaration. Fixes a crash in the compiler.
5433 * cs-parser.jay (constructor_declaration): Update to new grammar,
5434 and provide a constructor_body that can be empty.
5436 2002-03-15 Miguel de Icaza <miguel@ximian.com>
5438 * driver.cs: Add support for --resources.
5440 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
5441 Make all types for the various array helper methods be integer.
5443 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
5444 CheckState to ConvCast.
5446 (ConvCast): Now it takes a `checked' state argument, to avoid
5447 depending on the emit context for the conversion, and just using
5448 the resolve time setting.
5450 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
5451 instead of Invocation.EmitArguments. We do not emit the original
5452 arguments, instead we emit those which have been converted to
5453 unsigned int expressions.
5455 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
5457 * codegen.cs: ditto.
5459 * expression.cs (LocalVariableReference): Drop the use of the
5460 Store function that depended on the variable index.
5462 * statement.cs (VariableInfo): Drop the `Idx' property from this
5463 class, as this is not taking into account the indexes for
5464 temporaries tat we generate during the execution, getting the
5467 * class.cs: First emit class initializers, then call the parent
5470 * expression.cs (Binary): Fix opcode emision.
5471 (UnaryMutator.EmitCode): Support checked code generation
5473 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
5474 matches for events for both the Static and Instance scans,
5475 pointing to the same element. Fix that.
5477 2002-03-14 Miguel de Icaza <miguel@ximian.com>
5479 * rootcontext.cs (ResolveTree): Always set the
5480 interface_resolve_order, because nested interfaces will be calling
5483 * class.cs (GetInterfaceOrClass): Track the same resolution
5484 process used by TypeManager.LookupType. This fixes the nested
5485 type lookups in class declarations (separate path from
5488 (TypeContainer.DefineType): Also define nested interfaces.
5489 (TypeContainer.RegisterOrder): New public function used to
5490 register the order in which child interfaces need to be closed.
5492 Nested interfaces need to be closed after their parents have been
5495 * interface.cs (InterfaceAttr): Put all the logic for computing
5496 the interface attribute here.
5498 (DefineInterface): Register our interface order with the
5499 RootContext or with the TypeContainer depending on the case.
5501 2002-03-12 Miguel de Icaza <miguel@ximian.com>
5503 * cs-parser.jay: rework foreach statement to work with the new
5504 changes to the policy on SimpleNames.
5506 * report.cs: support Stacktrace on warnings as well.
5508 * makefile: drop --unsafe and /unsafe from the compile.
5510 2002-03-13 Ravi Pratap <ravi@ximian.com>
5512 * ecore.cs (StandardConversionExists): Modify to take an Expression
5513 as the first parameter. Ensure we do null -> reference type conversion
5516 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
5517 temporary Expression objects.
5519 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
5521 * interface.cs: workaround bug in method overloading resolution
5522 (there is already a bugzilla bug for it).
5524 2002-03-12 Miguel de Icaza <miguel@ximian.com>
5526 We could also solve this problem by having a separate path for
5527 performing type lookups, instead of DoResolve, we could have a
5528 ResolveType entry point, and only participating pieces of the
5529 production (simplename, deref, array) would implement this.
5531 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
5532 signal SimpleName to only resolve type names and not attempt to
5533 resolve anything else.
5535 * expression.cs (Cast): Set the flag.
5537 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
5539 * class.cs: Only report 108 if there is no `new' modifier.
5541 * cs-parser.jay: rework foreach statement to work with the new
5542 changes to the policy on SimpleNames.
5544 * report.cs: support Stacktrace on warnings as well.
5546 * makefile: drop --unsafe and /unsafe from the compile.
5548 2002-03-11 Miguel de Icaza <miguel@ximian.com>
5550 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
5551 lookups here, instead of doing that at parse time. This means
5552 that our grammar will not introduce `LocalVariableReferences' as
5553 expressions at this point. That solves the problem of code like
5561 This is only half the fix. The full fix requires parameters to
5562 also be handled in this way.
5564 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
5565 makes the use more obvious of the DeclSpace. The
5566 ec.TypeContainer.TypeBuilder is now only used to pull the
5569 My theory is that I can get rid of the TypeBuilder completely from
5570 the EmitContext, and have typecasts where it is used (from
5571 DeclSpace to where it matters).
5573 The only pending problem is that the code that implements Aliases
5574 is on TypeContainer, and probably should go in DeclSpace.
5576 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
5577 lookups here, instead of doing that at parse time. This means
5578 that our grammar will not introduce `LocalVariableReferences' as
5579 expressions at this point. That solves the problem of code like
5587 This is only half the fix. The full fix requires parameters to
5588 also be handled in this way.
5590 * class.cs (Property.DefineMethod): When implementing an interface
5591 method, set newslot, when implementing an abstract method, do not
5592 set the flag (before we tried never setting it, or always setting
5593 it, which is the difference).
5594 (Indexer.DefineMethod): same.
5595 (Method.DefineMethod): same.
5597 * ecore.cs: Only set the status used flag if we get back a Field.
5599 * attribute.cs: Temporary hack, so Paolo can keep working.
5601 2002-03-08 Ravi Pratap <ravi@ximian.com>
5603 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
5604 the unmanaged type in the case we have a MarshalAs attribute.
5606 (Resolve): Handle the case when we are parsing the special MarshalAs
5607 attribute [we need to store the unmanaged type to use later]
5609 * typemanager.cs (marshal_as_attr_type): Built in type for the
5610 MarshalAs Attribute.
5612 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
5613 on parameters and accordingly set the marshalling info.
5615 2002-03-09 Miguel de Icaza <miguel@ximian.com>
5617 * class.cs: Optimizing slightly by removing redundant code after
5618 we switched to the `NoTypes' return value.
5619 (Property.DefineMethod): use NoTypes here too.
5621 This fixes the bug I introduced in my last batch of changes.
5623 2002-03-05 Ravi Pratap <ravi@ximian.com>
5625 * tree.cs (RecordEnum): Add. We now keep track of enums too.
5627 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
5628 Enums since those are types too.
5630 * cs-parser.jay (enum_declaration): Record enums as we parse them.
5632 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
5633 thanks to a call during the lookup process.
5635 2002-03-07 Miguel de Icaza <miguel@ximian.com>
5637 * statement.cs (Foreach): Lots of work to accomodate a particular
5638 kind of foreach statement that I had not kept in mind. It is
5639 possible to have foreachs on classes that provide a GetEnumerator
5640 method that return objects that implement the "pattern" for using
5641 a foreach, there is no need to support GetEnumerator
5644 This is needed to compile nant.
5646 * decl.cs: Only report 114 if the member is not `Finalize' and if
5647 the warning level is at least 2.
5649 * class.cs: Moved the compare function from Method to
5652 (MethodSignature.InheritableMemberSignatureCompare): Add new
5653 filter function that is used to extract inheritable methods from a
5656 (Method.Define): Use the new `inheritable_method_signature_filter'
5659 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
5662 2002-03-06 Miguel de Icaza <miguel@ximian.com>
5664 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
5666 * cs-parser.jay: Add opt_semicolon to the interface declaration.
5668 * expression.cs: Pass location information to
5669 ConvertImplicitStandard.
5671 * class.cs: Added debugging code to track return values from
5674 2002-03-05 Miguel de Icaza <miguel@ximian.com>
5676 * expression.cs (Is.DoResolve): If either side of the `is' is an
5677 interface, do not flag the warning.
5679 * ecore.cs (ImplicitReferenceConversion): We need a separate test
5682 * report.cs: Allow for --fatal to be used with --probe.
5684 * typemanager.cs (NoTypes): Move the definition for the empty Type
5687 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
5689 (TypeContainer.DefineProxy): New function used to proxy to parent
5690 implementations when implementing interfaces.
5691 (TypeContainer.ParentImplements): used to lookup if our parent
5692 implements a public function that is required by an interface.
5693 (TypeContainer.VerifyPendingMethods): Hook this up.
5695 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
5696 `modules' and `assemblies' arraylists into arrays. We only grow
5697 these are the very early start up of the program, so this improves
5698 the speedof LookupType (nicely measured).
5700 * expression.cs (MakeByteBlob): Replaced unsafe code with
5701 BitConverter, as suggested by Paolo.
5703 * cfold.cs (ConstantFold.Binary): Special case: perform constant
5704 folding of string concatenation, but if either side is a string,
5705 and the other is not, then return null, and let the runtime use
5706 the concatenation on the string plus the object (using
5709 2002-03-04 Miguel de Icaza <miguel@ximian.com>
5711 Constant Folding has been implemented now.
5713 * expression.cs (Unary.Reduce): Do not throw an exception, catch
5714 the error instead on types that are not supported in one's
5717 * constant.cs (Constant and all children): New set of functions to
5718 perform implict and explicit conversions.
5720 * ecore.cs (EnumConstant): Implement the new functions to perform
5721 conversion by proxying to the child expression.
5723 * codegen.cs: (ConstantCheckState): Constant evaluation has its
5724 own separate setting that can not be turned off from the command
5725 line using --unchecked or --checked and is only controlled using
5726 the checked/unchecked statements and expressions. This setting is
5727 used by the constant folder to flag errors.
5729 * expression.cs (CheckedExpr, UncheckedExpr): Set the
5730 ConstantCheckState as well.
5732 During Resolve, they also have to flag the state, because the
5733 constant folder runs completely in the Resolve phase.
5735 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
5738 2002-03-01 Miguel de Icaza <miguel@ximian.com>
5740 * cfold.cs: New file, this file contains the constant folder.
5742 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
5743 argument to track whether we are using the resulting address to
5744 load or store a value and provide better error messages.
5746 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
5747 new AddressOf arguments.
5749 * statement.cs (Foreach.EmitCollectionForeach): Update
5751 * expression.cs (Argument.Emit): Call AddressOf with proper
5752 arguments to track usage.
5754 (New.DoEmit): Call AddressOf with new arguments.
5756 (Unary.Emit): Adjust AddressOf call.
5758 2002-03-01 Ravi Pratap <ravi@ximian.com>
5760 * cs-parser.jay (member_access): Change the case for pre-defined types
5761 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
5764 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
5767 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
5768 essentially like methods and apply attributes like MethodImplOptions to them too.
5770 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
5773 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
5774 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
5777 * Update code everywhere accordingly.
5779 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
5781 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
5783 2002-02-28 Ravi Pratap <ravi@ximian.com>
5785 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
5786 try performing lookups against those instead of jumping straight into using
5787 the 'using' clauses.
5789 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
5791 (LookupType): Perform lookups in implicit parents too.
5793 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
5794 sequence as RootContext.LookupType.
5796 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
5797 the various cases of namespace lookups into this method.
5799 2002-03-01 Miguel de Icaza <miguel@ximian.com>
5801 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
5802 in positional arguments)
5804 * class.cs (Operator): Update the AllowedModifiers to contain
5807 * cs-parser.jay: Update operator declaration to allow for the
5808 operator body to be empty.
5810 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
5813 2002-02-27 Miguel de Icaza <miguel@ximian.com>
5815 * class.cs (Method.Emit): Label parameters.
5817 * driver.cs: Return 1 or 0 as the program exit code.
5819 2002-02-26 Miguel de Icaza <miguel@ximian.com>
5821 * expression.cs: Special case the `null' object when trying to
5822 auto-compute the type, as anything can be explicitly converted to
5825 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
5826 spotting this Paolo.
5828 (Expression.ImplicitNumericConversion): Perform comparissions of
5829 the type using the underlying type in the case of an enumeration
5830 rather than using the enumeration type for the compare.
5832 Cope with the underlying == type case, which is not possible to
5835 (Expression.ConvertNumericExplicit): Perform comparissions of
5836 the type using the underlying type in the case of an enumeration
5837 rather than using the enumeration type for the compare.
5839 * driver.cs: If the user does not supply an extension, assume .exe
5841 * cs-parser.jay (if_statement): Rewrote so that we can track the
5842 location for the if statement.
5844 * expression.cs (Binary.ConstantFold): Only concat strings when
5845 the operation is "+", not everything ;-)
5847 * statement.cs (Statement.EmitBoolExpression): Take a location
5849 (If, While, Do): Track location.
5851 * expression.cs (Binary.ResolveOperator): In the object + string
5852 case, I was missing a call to ConvertImplicit
5854 2002-02-25 Ravi Pratap <ravi@ximian.com>
5856 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
5857 Location arguments. Ensure we use RootContext.LookupType to do our work
5858 and not try to do a direct Type.GetType and ModuleBuilder.GetType
5860 * interface.cs (PopulateMethod): Handle the type of the parameter being
5863 * expression.cs (Invocation.BetterFunction): Handle the case when we
5864 have a params method with no fixed arguments and a call is made with no
5867 2002-02-25 Miguel de Icaza <miguel@ximian.com>
5869 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
5870 the verbatim-string-literal
5872 * support.cs (InternalParameters.ParameterModifier): handle null
5874 (InternalParameters.ParameterType): ditto.
5876 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
5877 duplicating the name of the variable parameter.
5878 (GetParameterByName): Fix bug where we were not looking up array
5879 paramters if they were the only present (thanks Paolo!).
5880 (GetParameterInfo): We only have an empty set of types if both
5881 fixed and array are set to null.
5882 (GetParameterInfo-idx): Handle FixedParameter == null
5884 * cs-parser.jay: Handle the case where there is no catch
5885 statements (missing null test).
5887 2002-02-22 Miguel de Icaza <miguel@ximian.com>
5889 * driver.cs (MainDriver): Be conservative on our command line
5892 Catch DirectoryNotFoundException when calling GetFiles.
5894 (SplitPathAndPattern): Used to split the input specification into
5895 a path and a pattern that we can feed to Directory.GetFiles.
5897 2002-02-21 Miguel de Icaza <miguel@ximian.com>
5899 * statement.cs (Fixed): Implement the last case of the Fixed
5900 statement (string handling).
5902 * expression.cs (StringPtr): New class used to return a char * to
5903 a string; Used by the Fixed statement.
5905 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
5907 * expression.cs (Binary.ResolveOperator): Remove redundant
5908 MemberLookup pn parent type.
5909 Optimize union call, we do not need a union if the types are the same.
5910 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
5913 Specialize the use of MemberLookup everywhere, instead of using
5914 the default settings.
5916 (StackAlloc): Implement stackalloc keyword.
5918 * cs-parser.jay: Add rule to parse stackalloc.
5920 * driver.cs: Handle /h, /help, /?
5922 * expression.cs (MakeByteBlob): Removed the hacks we had in place
5923 before we supported unsafe code.
5925 * makefile: add --unsafe to the self compilation of mcs.
5927 2002-02-20 Miguel de Icaza <miguel@ximian.com>
5929 * expression.cs (PointerArithmetic): New class that is used to
5930 perform pointer arithmetic.
5931 (Binary.Resolve): Handle pointer arithmetic
5932 Handle pointer comparission.
5933 (ArrayPtr): Utility expression class that is used to take the
5934 address of an array.
5936 (ElementAccess): Implement array access for pointers
5938 * statement.cs (Fixed): Implement fixed statement for arrays, we
5939 are missing one more case before we are done.
5941 * expression.cs (Indirection): Implement EmitAssign and set the
5942 ExprClass to Variable. This allows pointer dereferences to be
5943 treated as variables, and to have values assigned to them.
5945 * ecore.cs (Expression.StoreFromPtr): New utility function to
5946 store values dereferencing.
5948 2002-02-20 Ravi Pratap <ravi@ximian.com>
5950 * expression.cs (Binary.ResolveOperator): Ensure that we are
5951 not trying to operate on a void type - this fixes the reported
5954 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
5955 the parent implementation is sealed.
5957 * ../errors/cs0239.cs : Add.
5959 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
5961 * typemanager.cs (unverifiable_code_type): Corresponds to
5962 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
5963 which have unsafe code in them.
5965 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
5968 2002-02-19 Miguel de Icaza <miguel@ximian.com>
5970 * cs-tokenizer.cs: Add support for @"litreal strings"
5972 Make tokenizer accept pre-processor directives
5973 on any column (remove the old C-like limitation).
5975 * rootcontext.cs (EmitCode): Emit any global attributes.
5976 (AddGlobalAttributes): Used to keep track of assembly attributes.
5978 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
5980 * cs-parser.jay: Add support for global attributes.
5982 2002-02-17 Miguel de Icaza <miguel@ximian.com>
5984 * expression.cs (Indirection): New helper class. Unary will
5985 create Indirection classes to be able to implement the
5986 IMemoryLocation interface on it.
5988 2002-02-16 Miguel de Icaza <miguel@ximian.com>
5990 * cs-parser.jay (fixed_statement): reference the right statement.
5992 * statement.cs (Fixed.Emit): Finish implementing the fixed
5993 statement for the &x case.
5995 2002-02-14 Miguel de Icaza <miguel@ximian.com>
5997 * class.cs (Property.Define, Method.Define): Remove newslot when
6000 * modifiers.cs: My use of NewSlot when `Abstract' was set was
6001 wrong. NewSlot should only be used if the `new' keyword is present.
6003 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
6004 locating our system dir. Sorry about this.
6006 2002-02-13 Miguel de Icaza <miguel@ximian.com>
6008 * driver.cs (GetSystemDir): Compute correctly the location of our
6009 system assemblies. I was using the compiler directory instead of
6010 the library directory.
6012 2002-02-13 Ravi Pratap <ravi@ximian.com>
6014 * expression.cs (BetterFunction): Put back in what Miguel commented out
6015 since it is the correct fix. The problem is elsewhere ;-)
6017 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
6018 parameters of the parms method are themselves compatible or not !
6020 (StandardConversionExists): Fix very dangerous bug where we were forgetting
6021 to check that a class implements an interface before saying that an implicit
6022 conversion was allowed. Use ImplementsInterface to do the checking.
6024 2002-02-13 Miguel de Icaza <miguel@ximian.com>
6026 * class.cs (Method.Define): Track whether we are an explicit
6027 implementation or not. And only call DefineMethodOverride if we
6028 are an explicit implementation.
6030 (Property.DefineMethod): Ditto.
6032 2002-02-11 Ravi Pratap <ravi@ximian.com>
6034 * expression.cs (BetterFunction): Catch hideous bug which was
6035 preventing us from detecting ambiguous calls due to implicit casts i.e
6038 2002-01-29 Miguel de Icaza <miguel@ximian.com>
6040 * support.cs (Pair): Remove un-needed method. I figured why I was
6041 getting the error in cs-parser.jay, the variable in a foreach loop
6042 is readonly, and the compiler does not really treat this as a variable.
6044 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
6045 instead of EQUALS in grammar.
6047 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
6049 * expression.cs (Unary.DoResolve): Check whether the argument is
6052 2002-01-28 Miguel de Icaza <miguel@ximian.com>
6054 * support.cs: Api for Pair to set a value. Despite the fact that
6055 the variables are public the MS C# compiler refuses to compile
6056 code that accesses the field if the variable is part of a foreach
6059 * statement.cs (Fixed): Begin implementation of the fixed
6062 (Block.AddVariable): Return the VariableInfo on success and null
6063 on failure instead of true/false.
6065 * cs-parser.jay (foreach): Catch errors on variables already
6066 defined (we were ignoring this value before) and properly unwind
6069 (fixed_statement): grammar for the fixed statement.
6071 2002-01-25 Miguel de Icaza <miguel@ximian.com>
6073 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
6074 pointer types to be incretemented.
6076 (SizeOf): Implement.
6078 * cs-parser.jay (pointer_member_access): Implement
6079 expr->IDENTIFIER production.
6081 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
6082 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
6085 (Unary): Implement indirection.
6087 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
6088 use in non-unsafe context).
6090 (SimpleName.DoResolve): Check for pointers in field access on safe
6093 (Expression.LoadFromPtr): Factor the load-indirect code in this
6094 function. This was duplicated in UnboxCast and ParameterReference
6096 2002-01-24 Miguel de Icaza <miguel@ximian.com>
6098 * expression.cs (ComposedCast): report an error if a pointer cast
6099 is used in a safe region.
6101 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
6102 pointer type casts in unsafe context.
6104 * codegen.cs (EmitContext): Set up IsUnsafe.
6106 * cs-parser.jay (non_expression_type): Add productions for pointer
6109 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
6110 code. We should not use force into static mode if the method is
6111 not virtual. Fixes bug in MIS
6113 * statement.cs (Do.Emit, While.Emit, For.Emit,
6114 Statement.EmitBoolExpression): Add support to Do and While to
6115 propagate infinite loop as `I do return' semantics.
6117 Improve the For case to also test for boolean constants.
6119 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
6120 to the list of attributes we can add.
6122 Remove `EmitContext' argument.
6124 * class.cs (Method.Define): Apply parameter attributes.
6125 (Constructor.Define): Apply parameter attributes.
6126 (MethodCore.LabelParameters): Move here the core of labeling
6129 * support.cs (ReflectionParameters.ParameterModifier,
6130 InternalParameters.ParameterModifier): Use IsByRef on the type and
6131 only return the OUT bit for these parameters instead of in/out/ref
6134 This is because I miss-understood things. The ParameterInfo.IsIn
6135 and IsOut represent whether the parameter has the [In] and [Out]
6138 2002-01-22 Miguel de Icaza <miguel@ximian.com>
6140 * ecore.cs (FieldExpr.Emit): Release temporaries.
6142 * assign.cs (LocalTemporary.Release): new function.
6144 * codegen.cs (EmitContext.GetTemporaryStorage,
6145 EmitContext.FreeTemporaryStorage): Rework the way we deal with
6146 temporary storage. Now we can "put back" localbuilders when we
6149 2002-01-21 Miguel de Icaza <miguel@ximian.com>
6151 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
6152 need to make a copy of the variable to generate verifiable code.
6154 2002-01-19 Miguel de Icaza <miguel@ximian.com>
6156 * driver.cs: Compute dynamically the system directory.
6158 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
6159 Slower, but more generally useful. Used by the abstract
6160 registering implementation.
6162 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
6163 the rules for the special rule on Type/instances. First check if
6164 we have the same name, and if so, try that special static path
6165 rather than the instance path.
6167 2002-01-18 Miguel de Icaza <miguel@ximian.com>
6169 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
6172 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
6173 Enum, ValueType, Delegate or Array for non-corlib compiles.
6175 * cs-tokenizer.cs: Catch long identifiers (645)
6177 * typemanager.cs (IndexerPropetyName): Ravi never tested this
6180 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
6181 fix, we were returning too early, so we were not registering
6182 pending methods from abstract classes.
6184 Do not register pending methods if the class is abstract.
6186 * expression.cs (Conditional.DoResolve): Report circular implicit
6187 conversions when we neecd to compute it for conditional
6190 (Is.DoResolve): If the expression is always of the provided type,
6191 flag warning 183. If the expression can not ever be of the
6192 provided type flag warning 184.
6194 * class.cs: Catch 169 as well.
6196 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
6199 2002-01-18 Nick Drochak <ndrochak@gol.com>
6201 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
6203 2002-01-17 Miguel de Icaza <miguel@ximian.com>
6205 * interface.cs: (PopulateMethod): Check for pointers being defined
6206 only if the unsafe context is active.
6207 (PopulateProperty): ditto.
6208 (PopulateIndexer): ditto.
6210 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
6211 specified. If pointers are present, make sure that they are
6212 present in an unsafe context.
6213 (Constructor, Constructor.Define): ditto.
6214 (Field, Field.Define): ditto.
6215 (Property, Property.Define): ditto.
6216 (Event, Event.Define): ditto.
6218 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
6219 hashtable if there are classes or structs defined.
6221 * expression.cs (LocalVariableReference.DoResolve): Simplify this
6222 code, as the constant resolution moved.
6224 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
6225 the metadata, so we can flag error 133.
6227 * decl.cs (MemberCore.UnsafeOK): New function to test that a
6228 pointer is being declared in an unsafe context.
6230 2002-01-16 Miguel de Icaza <miguel@ximian.com>
6232 * modifiers.cs (Modifiers.Check): Require a Location argument.
6233 Report error 227 for Unsafe use.
6235 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
6237 * statement.cs (For.Emit): If the test is null, then report that
6238 we do `return', as we wont reach anything afterwards.
6240 (Switch.SwitchGoverningType): Track the expression that matched
6243 * driver.cs: Allow negative numbers as an error code to flag.
6245 * cs-parser.jay: Handle 1551.
6247 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
6249 2002-01-15 Miguel de Icaza <miguel@ximian.com>
6251 * cs-parser.jay: Report 1518 (type declaration can only contain
6252 class, struct, interface, enum or delegate)
6254 (switch_label): Report 1523 (keywords `case' or `default' must
6257 (opt_switch_sections): Report 1522 (empty switch)
6259 * driver.cs: Report 1515 (response file specified multiple times)
6260 Report 1516 (Source file specified multiple times).
6262 * expression.cs (Argument.Resolve): Signal 1510
6264 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
6265 access not allowed in static code)
6267 2002-01-11 Ravi Pratap <ravi@ximian.com>
6269 * typemanager.cs (IsPointerType): Utility method which we are going
6272 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
6273 the object type, so we take care of that.
6275 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
6277 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
6278 added to non-params parameters :-)
6280 * typemanager.cs (CSharpName): Include 'void' type too.
6282 (void_ptr_type): Include in the set of core types.
6284 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
6287 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
6290 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
6291 completely forgotten about it.
6293 2002-01-10 Ravi Pratap <ravi@ximian.com>
6295 * cs-parser.jay (pointer_type): Add. This begins our implementation
6296 of parsing rules for unsafe code.
6298 (unsafe_statement): Implement.
6300 (embedded_statement): Modify to include the above.
6302 * statement.cs (Unsafe): Implement new class for unsafe blocks.
6304 * codegen.cs (EmitContext.InUnsafe): Add. This determines
6305 if the current context is an unsafe one.
6307 * cs-parser.jay (local_variable_pointer_type): Since local variable types
6308 are handled differently, we need separate rules for them.
6310 (local_variable_declaration): Update to use local_variable_pointer_type
6311 to allow variable declarations of unmanaged pointer types.
6313 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
6316 * ../errors/cs0214.cs : Add.
6318 2002-01-16 Nick Drochak <ndrochak@gol.com>
6320 * makefile: remove 'response' file when cleaning.
6322 2002-01-15 Miguel de Icaza <miguel@ximian.com>
6324 * cs-parser.jay: Report 1524.
6326 2002-01-14 Miguel de Icaza <miguel@ximian.com>
6328 * typemanager.cs (RegisterMethod): drop checking if we have
6329 registered this from here
6331 2002-01-12 Miguel de Icaza <miguel@ximian.com>
6333 * class.cs (Method.EmitDestructor): Implement calling our base
6336 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
6339 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
6340 this routine and will wrap the call in a try/catch block. Deal
6343 2002-01-11 Miguel de Icaza <miguel@ximian.com>
6345 * ecore.cs (Expression.MemberLookup): instead of taking a
6346 parameter `same_type' that was used to tell whether we could
6347 access private members we compute our containing type from the
6350 (FieldExpr): Added partial support for volatile fields. This does
6351 not work for volatile fields exposed from assemblies, as I can not
6352 figure out how to extract the modreq from it.
6354 Updated all the source files to use this.
6356 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
6357 because it is referenced by MemberLookup very often.
6359 2002-01-09 Ravi Pratap <ravi@ximian.com>
6361 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
6362 TypeBuilder.GetCustomAttributes to retrieve what we need.
6364 Get rid of redundant default_member_attr_type as this is the same as
6365 default_member_type which already exists.
6367 * interface.cs, attribute.cs : Update accordingly.
6369 2002-01-08 Miguel de Icaza <miguel@ximian.com>
6371 * typemanager.cs: Enable IndexerPropertyName again. It does not
6372 work for TYpeBuilders though. Ravi, can you please fix this?
6374 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
6376 * expression.cs (Argument.Emit): Handle the case of ref objects
6377 being passed to ref functions;
6379 (ParameterReference.EmitLoad): Loads the content of the pointer
6380 without dereferencing.
6382 2002-01-07 Miguel de Icaza <miguel@ximian.com>
6384 * cs-tokenizer.cs: Implemented the pre-processing expressions.
6386 2002-01-08 Ravi Pratap <ravi@ximian.com>
6388 * class.cs (Indexer.DefineMethod): Incorporate the interface
6389 type in the name of the method if we are doing explicit interface
6392 * expression.cs (ConversionExists): Remove as it is completely obsolete.
6394 (BetterConversion): Fix extremely trivial bug where we were referring to
6395 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
6398 * ../errors/bug16.cs : Add although we have fixed it.
6400 2002-01-07 Miguel de Icaza <miguel@ximian.com>
6402 * expression.cs (BaseIndexer): Begin implementation.
6404 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
6406 * cs-parser.jay (indexer_declarator): Use qualified_identifier
6407 production directly to remove a shift/reduce, and implement
6408 explicit interface implementation.
6410 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
6411 after a floating point suffix.
6413 * expression.cs (DoNumericPromotions): Improved the conversion for
6414 uint/uint. If we have a constant, we avoid doing a typecast to a
6417 * class.cs (Indexer): Implement explicit interface implementation
6420 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
6422 * class.cs: make the default instance constructor public and hidebysig.
6424 2001-01-03 Ravi Pratap <ravi@ximian.com>
6426 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
6427 so we can call it from elsewhere.
6429 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
6430 we emit it internally if the class has a defined indexer; otherwise the user
6431 emits it by decorating the class definition with the DefaultMemberAttribute.
6433 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
6434 attribute is not used on a type which defines an indexer.
6436 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
6437 character when we skip whitespace.
6439 * ../errors/cs0646.cs : Add.
6441 2002-01-03 Miguel de Icaza <miguel@ximian.com>
6443 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
6446 * makefile: Add practical target `mcs3.exe' which builds the third
6447 generation compiler.
6449 * expression.cs (New): Fix structures constructor calling.
6451 * class.cs (Property, Method, Indexer): Emit Final flag on the
6452 method if we are an interface implementation and we are not
6455 * ecore.cs (PropertyExpr): New public field `IsBase', tells
6456 whether this property is referencing a `base' method.
6458 * expression.cs (Invocation.EmitCall): take an extra argument:
6459 is_base, this is used to determine whether the `call' or
6460 `callvirt' opcode should be used.
6463 * delegate.cs: update EmitCall.
6465 * class.cs (Method.Define): Set NewSlot for the cases where we are
6466 not implementing an interface method.
6468 (Property.Define): ditto.
6470 2002-01-02 Miguel de Icaza <miguel@ximian.com>
6472 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
6473 'r'. Allows mcs to parse itself fully.
6475 2002-01-02 Ravi Pratap <ravi@ximian.com>
6477 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
6478 of the number of initializers that require the InitializeArray method.
6480 (CheckIndices): Store the Expression in all cases - not the plain value. Also
6481 update the above field where necessary.
6483 (MakeByteBlob): Update accordingly.
6485 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
6488 (EmitDynamicInitializers): Update in accordance with the new optimization.
6490 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
6491 same OpCode applies.
6493 * cs-parser.jay : Fix some glaring errors I introduced.
6495 2002-01-01 Ravi Pratap <ravi@ximian.com>
6497 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
6498 so that we can check for name clashes there too.
6500 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
6501 for interface indexers.
6503 * interfaces.cs (Define): Emit the default member attribute.
6505 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
6506 variable was being referred to while setting the value ;-)
6508 2002-01-01 Miguel de Icaza <miguel@ximian.com>
6510 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
6511 byte-by-byte information when we know the data is zero.
6513 Make the block always a multiple of 4, because
6514 DefineInitializedData has a bug.
6516 * assign.cs: Fix, we should assign from the temporary, not from
6519 * expression.cs (MakeByteBlob): Fix my incorrect code.
6521 2001-12-31 Miguel de Icaza <miguel@ximian.com>
6523 * typemanager.cs (EnumToUnderlying): This function is used to get
6524 the underlying type from an enumeration, because it does not
6527 * constant.cs: Use the I4_S form for values between -128 and 127.
6529 * statement.cs (Block.LookupLabel): Looks up a label.
6530 (Block): Drop support for labeled blocks.
6532 (LabeledStatement): New kind of statement that represents a label
6535 (Goto): Finally implement this bad boy.
6537 * cs-parser.jay: Update to reflect new mechanism to implement
6540 2001-12-30 Miguel de Icaza <miguel@ximian.com>
6542 * codegen.cs (EmitContext.This): a codegen property that keeps the
6543 a single instance of this instead of creating many different this
6546 * delegate.cs (Delegate.DoResolve): Update to use the property;
6548 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
6550 * expression.cs (BaseAccess.DoResolve): Ditto.
6552 2001-12-29 Ravi Pratap <ravi@ximian.com>
6554 * typemanager.cs (methodimpl_attr_type): Add to hold the type
6555 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
6557 (InitCoreTypes): Update accordingly.
6559 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
6560 so we can quickly store the state.
6562 (ApplyAttributes): Set the correct implementation flags
6563 for InternalCall methods.
6565 2001-12-29 Miguel de Icaza <miguel@ximian.com>
6567 * expression.cs (EmitCall): if a method is not virtual, then do
6568 not use callvirt on it.
6570 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
6571 user defined stuff) requires the use of stobj, which takes an
6572 address on the stack instead of an array and an index. So emit
6573 the Ldelema operation for it.
6575 (EmitStoreOpcode): Use stobj for valuetypes.
6577 (UnaryMutator.EmitCode): Use the right 1 value depending on
6578 whether we are dealing with int64/uint64, float or doubles.
6580 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
6581 constructors that I implemented last night.
6583 (Constructor.IsDefault): Fix to work properly for static
6586 * cs-parser.jay (CheckDef): report method signature errors.
6587 Update error number 103 to be 132.
6589 * decl.cs: New AdditionResult enumeration value: MethodExists.
6590 Although we do this check for methods later on in the semantic
6591 analysis, catching repeated default constructors is so easy that
6592 we catch these here.
6594 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
6597 (ParameterReference.EmitAssign, Emit): handle
6600 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
6601 (ArrayAccess.EmitStoreOpcode): ditto.
6603 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
6605 * expression.cs (MakeByteBlob): Complete all the missing types
6606 (uint, short, ushort, byte, sbyte)
6608 * class.cs: Only init instance field initializers on instance
6611 Rename `constructors' to instance_constructors.
6613 (TypeContainer.AddConstructor): Only add constructors to the list
6614 if it is not static.
6616 Make sure that we handle default_static_constructor independently
6617 everywhere where we handle instance_constructors
6619 2001-12-28 Miguel de Icaza <miguel@ximian.com>
6621 * class.cs: Do not lookup or create a base initializer for a
6624 (ConstructorInitializer.Resolve): use the proper type to lookup
6627 * cs-parser.jay: Report error 1585 (modifiers between type and name).
6629 * enum.cs, interface.cs: Remove CloseType, this is taken care by
6632 * decl.cs: CloseType is now an virtual method, the default
6633 implementation just closes this type.
6635 2001-12-28 Ravi Pratap <ravi@ximian.com>
6637 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
6638 to PreserveSig by default. Also emit HideBySig on such methods.
6640 Basically, set the defaults to standard values.
6642 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
6643 argument, if candidate is better, it can't be worse than the best !
6645 (Invocation): Re-write bits to differentiate between methods being
6646 applicable in their expanded form and their normal form - for params
6649 Get rid of use_standard everywhere as only standard conversions are allowed
6650 in overload resolution.
6652 More spec conformance.
6654 2001-12-27 Miguel de Icaza <miguel@ximian.com>
6656 * driver.cs: Add --timestamp, to see where the compiler spends
6659 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
6660 `this' in static code.
6662 (SimpleName.DoResolve): Implement in terms of a helper function
6663 that allows static-references to be passed upstream to
6666 (Expression.ResolveWithSimpleName): Resolve specially simple
6667 names when called by MemberAccess to implement the special
6670 (Expression.ImplicitReferenceConversion): Handle conversions from
6671 Null to reference types before others, as Null's type is
6674 * expression.cs (Invocation.EmitCall): Handle the special case of
6675 calling methods declared on a reference type from a ValueType
6676 (Base classes System.Object and System.Enum)
6678 (MemberAccess.Resolve): Only perform lookups on Enumerations if
6679 the left hand side is a TypeExpr, not on every enumeration.
6681 (Binary.Resolve): If types are reference types, then do a cast to
6682 object on operators != and == of both arguments.
6684 * typemanager.cs (FindMembers): Extract instance and static
6685 members if requested.
6687 * interface.cs (PopulateProperty): Use void_type instead of null
6688 as the return type for the setter method.
6690 (PopulateIndexer): ditto.
6692 2001-12-27 Ravi Pratap <ravi@ximian.com>
6694 * support.cs (ReflectionParameters): Fix minor bug where we
6695 were examining the wrong parameter for the ParamArray attribute.
6697 Cope with requests for the type of the parameter at position
6698 greater than the params parameter's. We now return the element
6699 type of the params array as that makes more sense.
6701 * expression.cs (Invocation.IsParamsMethodApplicable): Update
6702 accordingly as we no longer have to extract the element type
6705 (Invocation.OverloadResolve): Update.
6707 2001-12-27 Miguel de Icaza <miguel@ximian.com>
6709 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
6710 against IEnumerator, test whether the return value is a descendant
6711 of the IEnumerator interface.
6713 * class.cs (Indexer.Define): Use an auxiliary method to implement
6714 the other bits of the method definition. Begin support for
6715 explicit interface implementation.
6717 (Property.DefineMethod): Use TypeManager.void_type instead of null
6718 for an empty return value.
6720 2001-12-26 Miguel de Icaza <miguel@ximian.com>
6722 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
6723 dealing with a FieldExpr which is composed of a FieldBuilder, in
6724 the code path we did extract the constant, but we should have
6725 obtained the underlying value to be able to cast it (otherwise we
6726 end up in an infinite loop, this is what Ravi was running into).
6728 (ArrayCreation.UpdateIndices): Arrays might be empty.
6730 (MemberAccess.ResolveMemberAccess): Add support for section
6731 14.5.4.1 that deals with the special case of E.I when E is a type
6732 and something else, that I can be a reference to a static member.
6734 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
6735 handle a particular array type to create byte blobs, it is just
6736 something we dont generate byteblobs for.
6738 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
6741 * location.cs (Push): remove the key from the hashtable that we
6742 are about to add. This happens for empty files.
6744 * driver.cs: Dispose files after we have parsed them.
6746 (tokenize): new function that only runs the tokenizer on its
6747 input, for speed testing.
6749 2001-12-26 Ravi Pratap <ravi@ximian.com>
6751 * class.cs (Event.Define): Define the private field only if there
6752 are no accessors defined.
6754 * expression.cs (ResolveMemberAccess): If there is no associated
6755 field with the event, that means we have an event defined with its
6756 own accessors and we should flag error cs0070 since transforming
6757 ourselves into a field is not valid in that case.
6759 * ecore.cs (SimpleName.DoResolve): Same as above.
6761 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
6762 and charset to sane values.
6764 2001-12-25 Ravi Pratap <ravi@ximian.com>
6766 * assign.cs (DoResolve): Perform check on events only if they
6767 are being accessed outside the declaring type.
6769 * cs-parser.jay (event_declarations): Update rules to correctly
6770 set the type of the implicit parameter etc.
6772 (add_accessor, remove_accessor): Set current local parameters.
6774 * expression.cs (Binary): For delegate addition and subtraction,
6775 cast the return value from the method into the appropriate delegate
6778 2001-12-24 Ravi Pratap <ravi@ximian.com>
6780 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
6781 of these as the workaround is unnecessary.
6783 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
6784 delegate data - none of that is needed at all.
6786 Re-write bits to extract the instance expression and the delegate method
6789 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
6792 * attribute.cs (ApplyAttributes): New method to take care of common tasks
6793 of attaching attributes instead of duplicating code everywhere.
6795 * everywhere : Update code to do attribute emission using the above method.
6797 2001-12-23 Miguel de Icaza <miguel@ximian.com>
6799 * expression.cs (IsParamsMethodApplicable): if there are not
6800 parameters, return immediately.
6802 * ecore.cs: The 0 literal can be implicity converted to an enum
6805 (SimpleName.DoResolve): First lookup the type, then lookup the
6808 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
6809 want to get its address. If the InstanceExpression is not
6810 addressable, store the result in a temporary variable, then get
6813 * codegen.cs: Only display 219 errors on warning level or above.
6815 * expression.cs (ArrayAccess): Make it implement the
6816 IMemoryLocation interface.
6818 (Binary.DoResolve): handle the operator == (object a, object b)
6819 and operator != (object a, object b) without incurring into a
6820 BoxedCast (because 5 != o should never be performed).
6822 Handle binary enumerator operators.
6824 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
6825 value type, otherwise use Ldelem_ref.
6827 Use precomputed names;
6829 (AddressOf): Implement address of
6831 * cs-parser.jay (labeled_statement): Fix recursive block
6832 addition by reworking the production.
6834 * expression.cs (New.DoEmit): New has a special case:
6836 If we are dealing with a ValueType, we have a few
6837 situations to deal with:
6839 * The target of New is a ValueType variable, that is
6840 easy, we just pass this as the variable reference
6842 * The target of New is being passed as an argument,
6843 to a boxing operation or a function that takes a
6846 In this case, we need to create a temporary variable
6847 that is the argument of New.
6850 2001-12-23 Ravi Pratap <ravi@ximian.com>
6852 * rootcontext.cs (LookupType): Check that current_type is not null before
6853 going about looking at nested types.
6855 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
6856 not implement the IAssignMethod interface any more.
6858 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
6859 where we tranform them into FieldExprs if they are being resolved from within
6862 * ecore.cs (SimpleName.DoResolve): Do the same here.
6864 * assign.cs (DoResolve, Emit): Clean up code considerably.
6866 * ../errors/bug10.cs : Add.
6868 * ../errors/cs0070.cs : Add.
6870 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
6872 * assign.cs : Get rid of EventIsLocal everywhere.
6874 2001-12-23 Miguel de Icaza <miguel@ximian.com>
6876 * ecore.cs (ConvertIntLiteral): finished the implementation.
6878 * statement.cs (SwitchLabel): Convert the value we are using as a
6879 key before looking up the table.
6881 2001-12-22 Miguel de Icaza <miguel@ximian.com>
6883 * codegen.cs (EmitTopBlock): Require a Location argument now.
6885 * cs-parser.jay (constructor_declarator): We need to setup
6886 current_local_parameters before we parse the
6887 opt_constructor_initializer, to allow the variables to be bound
6888 to the constructor arguments.
6890 * rootcontext.cs (LookupType): First lookup nested classes in our
6891 class and our parents before we go looking outside our class.
6893 * expression.cs (ConstantFold): Extract/debox the values at the
6896 * rootcontext.cs (EmitCode): Resolve the constants first before we
6897 resolve the types. This is not really needed, but it helps debugging.
6899 * statement.cs: report location.
6901 * cs-parser.jay: pass location to throw statement.
6903 * driver.cs: Small bug fix.
6905 * report.cs: Updated format to be 4-zero filled digits.
6907 2001-12-22 Ravi Pratap <ravi@ximian.com>
6909 * expression.cs (CheckIndices): Fix minor bug where the wrong
6910 variable was being referred to ;-)
6912 (DoEmit): Do not call EmitStaticInitializers when the
6913 underlying type is System.Object.
6915 2001-12-21 Ravi Pratap <ravi@ximian.com>
6917 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
6918 and do the usual workaround for SRE.
6920 * class.cs (MyEventBuilder.EventType): New member to get at the type
6921 of the event, quickly.
6923 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
6925 * assign.cs (Assign.DoResolve): Handle the case when the target
6926 is an EventExpr and perform the necessary checks.
6928 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
6931 (SimpleName.MemberStaticCheck): Include check for EventExpr.
6933 (EventExpr): Set the type in the constructor itself since we
6934 are meant to be born fully resolved.
6936 (EventExpr.Define): Revert code I wrote earlier.
6938 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
6939 instance expression is null. The instance expression is a This in that case
6940 or a null, depending on whether it is a static method or not.
6942 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
6943 refers to more than one method.
6945 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
6946 and accordingly flag errors.
6948 2001-12-21 Miguel de Icaza <miguel@ximian.com>
6950 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
6952 2001-12-22 Miguel de Icaza <miguel@ximian.com>
6954 * location.cs (ToString): Provide useful rutine.
6956 2001-12-21 Miguel de Icaza <miguel@ximian.com>
6958 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
6959 objects, return the actual integral boxed.
6961 * statement.cs (SwitchLabel): define an ILLabel for each
6964 (Switch.CheckSwitch): If the value is a Literal, extract
6965 the underlying literal.
6967 Also in the unused hashtable we had, add the SwitchLabel so we can
6968 quickly look this value up.
6970 * constant.cs: Implement a bunch of new constants. Rewrite
6971 Literal based on this. Made changes everywhere to adapt to this.
6973 * expression.cs (Expression.MakeByteBlob): Optimize routine by
6974 dereferencing array only once, and also copes with enumrations.
6976 bytes are two bytes wide, not one.
6978 (Cast): Perform constant conversions.
6980 * ecore.cs (TryImplicitIntConversion): Return literals instead of
6981 wrappers to the literals here.
6983 * expression.cs (DoNumericPromotions): long literals can converted
6984 to ulong implicity (this is taken care of elsewhere, but I was
6987 * ecore.cs (Expression.Literalize): Make the return type Literal,
6988 to improve type checking.
6990 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
6992 2001-12-20 Miguel de Icaza <miguel@ximian.com>
6994 * literal.cs: Revert code from ravi that checked the bounds. The
6995 bounds are sane by the definition of the type itself.
6997 * typemanager.cs: Fix implementation of ImplementsInterface. We
6998 need to actually look up in our parent hierarchy for interfaces
7001 * const.cs: Use the underlying type for enumerations
7003 * delegate.cs: Compute the basename for the delegate creation,
7004 that should fix the delegate test case, and restore the correct
7005 Type Lookup semantics in rootcontext
7007 * rootcontext.cs: Revert Ravi's last patch. The correct way of
7008 referencing a nested type with the Reflection API is using the "+"
7011 * cs-parser.jay: Do not require EOF token at the end.
7013 2001-12-20 Ravi Pratap <ravi@ximian.com>
7015 * rootcontext.cs (LookupType): Concatenate type names with
7016 a '.' instead of a '+' The test suite passes again.
7018 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
7019 field of the enumeration.
7021 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
7022 the case when the member is an EventExpr.
7024 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
7025 static has an associated instance expression.
7027 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
7029 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
7031 * class.cs (Event.Define): Register event and perform appropriate checks
7034 We define the Add and Remove methods even if the use provides none because
7035 in that case, we provide default implementations ourselves.
7037 Define a private field of the type of the event. This is done by the CSC compiler
7038 and we should be doing it too ;-)
7040 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
7041 More methods we use in code we generate.
7043 (multicast_delegate_type, delegate_type): Two separate types since the distinction
7046 (InitCoreTypes): Update accordingly for the above.
7048 * class.cs (Event.Emit): Generate code for default accessors that we provide
7050 (EmitDefaultMethod): Do the job in the above.
7052 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
7055 2001-12-20 Miguel de Icaza <miguel@ximian.com>
7057 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
7058 builders even if we were missing one.
7060 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
7061 pass the Basename as our class name instead of the Name. The
7062 basename will be correctly composed for us.
7064 * parameter.cs (Paramters): Now takes a Location argument.
7066 * decl.cs (DeclSpace.LookupType): Removed convenience function and
7067 make all the code call directly LookupType in RootContext and take
7068 this chance to pass the Location information everywhere.
7070 * Everywhere: pass Location information.
7072 2001-12-19 Miguel de Icaza <miguel@ximian.com>
7074 * class.cs (Constructor.Define): Updated way of detecting the
7075 length of the parameters.
7077 (TypeContainer.DefineType): Use basename as the type name for
7080 (TypeContainer.Define): Do not recursively define types here, as
7081 definition is taken care in order by the RootContext.
7083 * tree.cs: Keep track of namespaces in a per-file basis.
7085 * parameter.cs (Parameter.ComputeSignature): Update to use
7088 (Parameters.GetSignature): ditto.
7090 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
7091 instead of a TypeContainer.
7093 (Interface.SemanticAnalysis): Use `this' instead of our parent to
7094 resolve names. Because we need to be resolve in our context, not
7097 * driver.cs: Implement response files.
7099 * class.cs (TypeContainer.DefineType): If we are defined, do not
7102 (Event.Emit): Emit the code for add/remove handlers.
7103 (Event.Define): Save the MethodBuilders for add/remove.
7105 * typemanager.cs: Use pair here too.
7107 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
7108 DictionaryEntry requires the first argument to be non-null.
7110 (enum_declaration): Compute full name for registering the
7113 (delegate_declaration): Instead of using
7114 formal_parameter_list, use opt_formal_parameter_list as the list
7117 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
7118 (EventParsing): New property that controls whether `add' and
7119 `remove' are returned as tokens or identifiers (for events);
7121 2001-12-19 Ravi Pratap <ravi@ximian.com>
7123 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
7124 use MyEventBuilder only and let it wrap the real builder for us.
7126 (MyEventBuilder): Revamp constructor etc.
7128 Implement all operations that we perform on EventBuilder in precisely the same
7131 (FindMembers): Update to use the EventBuilder member.
7133 (Event.Emit): Update accordingly.
7135 2001-12-18 Ravi Pratap <ravi@ximian.com>
7137 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
7138 by calling the appropriate methods.
7140 (GetCustomAttributes): Make stubs as they cannot possibly do anything
7143 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
7145 2001-12-17 Ravi Pratap <ravi@ximian.com>
7147 * delegate.cs (Delegate.Populate): Check that the return type
7148 and various parameters types are indeed accessible.
7150 * class.cs (Constructor.Define): Same here.
7152 (Field.Define): Ditto.
7154 (Event.Define): Ditto.
7156 (Operator.Define): Check that the underlying Method defined itself
7157 correctly - so it's MethodBuilder should not be null.
7159 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
7160 expression happens to be null.
7162 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
7163 members but as of now we don't seem to be able to do anything really useful with it.
7165 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
7166 not the EventBuilder.
7168 2001-12-18 Miguel de Icaza <miguel@ximian.com>
7170 * cs-tokenizer.cs: Add support for defines.
7171 Add support for #if, #elif, #else, #endif
7173 (eval_var): evaluates a variable.
7174 (eval): stubbed for evaluating functions.
7176 * cs-parser.jay: Pass the defines information
7178 * driver.cs: Add --define command line option.
7180 * decl.cs: Move MemberCore here.
7182 Make it the base class for DeclSpace. This allows us to catch and
7183 report 108 and 109 for everything now.
7185 * class.cs (TypeContainer.Define): Extract all the members
7186 before populating and emit the warning 108 (new keyword required
7187 to override) instead of having each member implement this.
7189 (MemberCore.Define): New abstract method, we will be using this in
7190 the warning reporting engine in Populate.
7192 (Operator.Define): Adjust to new MemberCore protocol.
7194 * const.cs (Const): This does not derive from Expression, it is a
7195 temporary object we use to create fields, it is a MemberCore.
7197 * class.cs (Method.Define): Allow the entry point to be in a
7200 * driver.cs: Rewrite the argument handler to clean it up a bit.
7202 * rootcontext.cs: Made it just an auxiliary namespace feature by
7203 making everything static.
7205 * driver.cs: Adapt code to use RootContext type name instead of
7208 * delegate.cs: Remove RootContext argument.
7210 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
7213 * class.cs (Event.Define): The lookup can fail.
7215 * cs-tokenizer.cs: Begin implementation of pre-procesor.
7217 * expression.cs: Resolve the this instance before invoking the code.
7219 2001-12-17 Miguel de Icaza <miguel@ximian.com>
7221 * cs-parser.jay: Add a production in element_access that allows
7222 the thing to become a "type" reference. This way we can parse
7223 things like "(string [])" as a type.
7225 Note that this still does not handle the more complex rules of
7229 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
7231 * ecore.cs: (CopyNewMethods): new utility function used to
7232 assemble the list of methods from running FindMembers.
7234 (MemberLookup): Rework FindMembers so that
7236 2001-12-16 Miguel de Icaza <miguel@ximian.com>
7238 * class.cs (TypeContainer): Remove Delegates who fail to be
7241 * delegate.cs (Populate): Verify that we dont get null return
7242 values. TODO: Check for AsAccessible.
7244 * cs-parser.jay: Use basename to emit error 574 (destructor should
7245 have the same name as container class), not the full name.
7247 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
7248 possible representation.
7250 Also implements integer type suffixes U and L.
7252 2001-12-15 Miguel de Icaza <miguel@ximian.com>
7254 * expression.cs (ArrayCreation.DoResolve): We need to do the
7255 argument resolution *always*.
7257 * decl.cs: Make this hold the namespace. Hold the root context as
7259 (LookupType): Move here.
7261 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
7263 * location.cs (Row, Name): Fixed the code, it was always returning
7264 references to the first file.
7266 * interface.cs: Register properties defined through interfaces.
7268 * driver.cs: Add support for globbing on the command line
7270 * class.cs (Field): Make it derive from MemberCore as well.
7273 2001-12-15 Ravi Pratap <ravi@ximian.com>
7275 * class.cs (Event::Define): Check that the type of the event is a delegate
7276 type else flag error #66.
7278 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
7281 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
7282 values of EntryPoint, CharSet etc etc.
7284 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
7286 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
7287 be null and we should ignore this. I am not sure if this is really clean. Apparently,
7288 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
7289 which needs this to do its work.
7291 * ../errors/cs0066.cs : Add.
7293 2001-12-14 Miguel de Icaza <miguel@ximian.com>
7295 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
7298 * class.cs: (MethodSignature.MethodSignature): Removed hack that
7299 clears out the parameters field.
7300 (MemberSignatureCompare): Cleanup
7302 (MemberCore): New base class used to share code between MethodCore
7305 (RegisterRequiredImplementations) BindingFlags.Public requires
7306 either BindingFlags.Instace or Static. Use instance here.
7308 (Property): Refactored code to cope better with the full spec.
7310 * parameter.cs (GetParameterInfo): Return an empty array instead
7313 * class.cs (Property): Abstract or extern properties have no bodies.
7315 * parameter.cs (GetParameterInfo): return a zero-sized array.
7317 * class.cs (TypeContainer.MethodModifiersValid): Move all the
7318 method modifier validation to the typecontainer so we can reuse
7321 (MethodCore.ParameterTypes): return an empty sized array of types.
7323 (Property.Define): Test property modifier validity.
7325 Add tests for sealed/override too.
7327 (Method.Emit): abstract or extern methods have no bodies.
7329 2001-12-14 Ravi Pratap <ravi@ximian.com>
7331 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
7334 (Method::Define, ::Emit): Modify accordingly.
7336 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
7338 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
7340 * makefile: Pass in /unsafe.
7342 2001-12-13 Miguel de Icaza <miguel@ximian.com>
7344 * class.cs (MakeKey): Kill routine.
7346 * class.cs (TypeContainer.Define): Correctly define explicit
7347 method implementations (they require the full interface name plus
7350 * typemanager.cs: Deply the PtrHashtable here and stop using the
7351 lame keys. Things work so much better.
7353 This of course broke everyone who depended on `RegisterMethod' to
7354 do the `test for existance' test. This has to be done elsewhere.
7356 * support.cs (PtrHashtable): A hashtable that avoid comparing with
7357 the object stupid Equals method (because, that like fails all over
7358 the place). We still do not use it.
7360 * class.cs (TypeContainer.SetRequiredInterface,
7361 TypeContainer.RequireMethods): Killed these two routines and moved
7362 all the functionality to RegisterRequiredImplementations.
7364 (TypeContainer.RegisterRequiredImplementations): This routine now
7365 registers all the implementations required in an array for the
7366 interfaces and abstract methods. We use an array of structures
7367 which can be computed ahead of time to reduce memory usage and we
7368 also assume that lookups are cheap as most classes will not
7369 implement too many interfaces.
7371 We also avoid creating too many MethodSignatures.
7373 (TypeContainer.IsInterfaceMethod): Update and optionally does not
7374 clear the "pending" bit if we find that there are problems with
7377 (TypeContainer.VerifyPendingMethods): Update to report errors of
7378 methods that look like implementations but are not.
7380 (TypeContainer.Define): Add support for explicit interface method
7383 2001-12-12 Miguel de Icaza <miguel@ximian.com>
7385 * typemanager.cs: Keep track of the parameters here instead of
7386 being a feature of the TypeContainer.
7388 * class.cs: Drop the registration of parameters here, as
7389 InterfaceMethods are also interface declarations.
7391 * delegate.cs: Register methods with the TypeManager not only with
7392 the TypeContainer. This code was buggy.
7394 * interface.cs: Full registation here.
7396 2001-12-11 Miguel de Icaza <miguel@ximian.com>
7398 * expression.cs: Remove reducer for binary expressions, it can not
7401 * const.cs: Put here the code that used to go into constant.cs
7403 * constant.cs: Put here the code for constants, this is a new base
7406 * literal.cs: Make Literal derive from Constant.
7408 2001-12-09 Miguel de Icaza <miguel@ximian.com>
7410 * statement.cs (Return.Emit): Report error 157 if the user
7411 attempts to return from a finally block.
7413 (Return.Emit): Instead of emitting a return, jump to the end of
7416 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
7417 LocalBuilder to store the result of the function. ReturnLabel is
7418 the target where we jump.
7421 2001-12-09 Radek Doulik <rodo@ximian.com>
7423 * cs-parser.jay: remember alias in current namespace
7425 * ecore.cs (SimpleName::DoResolve): use aliases for types or
7428 * class.cs (LookupAlias): lookup alias in my_namespace
7430 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
7432 (LookupAlias): lookup alias in this and if needed in parent
7435 2001-12-08 Miguel de Icaza <miguel@ximian.com>
7439 * rootcontext.cs: (ModuleBuilder) Made static, first step into
7440 making things static. I need this to avoid passing the
7441 TypeContainer when calling ParameterType.
7443 * support.cs (InternalParameters.ParameterType): Remove ugly hack
7444 that did string manipulation to compute the type and then call
7445 GetType. Use Parameter.ParameterType instead.
7447 * cs-tokenizer.cs: Consume the suffix for floating values.
7449 * expression.cs (ParameterReference): figure out whether this is a
7450 reference parameter or not. Kill an extra variable by computing
7451 the arg_idx during emission.
7453 * parameter.cs (Parameters.GetParameterInfo): New overloaded
7454 function that returns whether a parameter is an out/ref value or not.
7456 (Parameter.ParameterType): The type of the parameter (base,
7457 without ref/out applied).
7459 (Parameter.Resolve): Perform resolution here.
7460 (Parameter.ExternalType): The full type (with ref/out applied).
7462 * statement.cs (Using.Emit, Using.EmitExpression): Implement
7463 support for expressions on the using statement.
7465 2001-12-07 Miguel de Icaza <miguel@ximian.com>
7467 * statement.cs (Using.EmitLocalVariableDecls): Split the
7468 localvariable handling of the using statement.
7470 (Block.EmitMeta): Keep track of variable count across blocks. We
7471 were reusing slots on separate branches of blocks.
7473 (Try.Emit): Emit the general code block, we were not emitting it.
7475 Check the type of the declaration to be an IDisposable or
7476 something that can be implicity converted to it.
7478 Emit conversions if required.
7480 * ecore.cs (EmptyExpression): New utility class.
7481 (Expression.ImplicitConversionExists): New utility function.
7483 2001-12-06 Miguel de Icaza <miguel@ximian.com>
7485 * statement.cs (Using): Implement.
7487 * expression.cs (LocalVariableReference): Support read only variables.
7489 * statement.cs: Remove the explicit emit for the Leave opcode.
7490 (VariableInfo): Add a readonly field.
7492 2001-12-05 Miguel de Icaza <miguel@ximian.com>
7494 * ecore.cs (ConvCast): new class used to encapsulate the various
7495 explicit integer conversions that works in both checked and
7498 (Expression.ConvertNumericExplicit): Use new ConvCast class to
7499 properly generate the overflow opcodes.
7501 2001-12-04 Miguel de Icaza <miguel@ximian.com>
7503 * statement.cs: The correct type for the EmptyExpression is the
7504 element_type, not the variable type. Ravi pointed this out.
7506 2001-12-04 Ravi Pratap <ravi@ximian.com>
7508 * class.cs (Method::Define): Handle PInvoke methods specially
7509 by using DefinePInvokeMethod instead of the usual one.
7511 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
7512 above to do the task of extracting information and defining the method.
7514 2001-12-04 Ravi Pratap <ravi@ximian.com>
7516 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
7517 of the condition for string type.
7519 (Emit): Move that here.
7521 (ArrayCreation::CheckIndices): Keep string literals in their expression
7524 (EmitDynamicInitializers): Handle strings appropriately.
7526 2001-12-04 Miguel de Icaza <miguel@ximian.com>
7528 * codegen.cs (EmitContext): Replace multiple variables with a
7529 single pointer to the current Switch statement.
7531 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
7534 2001-12-03 Miguel de Icaza <miguel@ximian.com>
7538 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
7541 (Foreach.Emit): Foreach on arrays was not setting
7542 up the loop variables (for break/continue).
7544 (GotoCase): Semi-implented.
7546 2001-12-03 Ravi Pratap <ravi@ximian.com>
7548 * attribute.cs (CheckAttribute): Handle system attributes by using
7549 Attribute.GetAttributes to examine information we need.
7551 (GetValidPlaces): Same here.
7553 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
7555 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
7557 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
7559 (Method::Define): Set appropriate flags if we have a DllImport attribute.
7561 (Method::Emit): Handle the case when we are a PInvoke method.
7563 2001-12-03 Miguel de Icaza <miguel@ximian.com>
7565 * expression.cs: Use ResolveWithSimpleName on compound names.
7567 2001-12-02 Ravi Pratap <ravi@ximian.com>
7569 * constant.cs (EmitConstant): Make sure we resolve the associated expression
7570 before trying to reduce it.
7572 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
7574 * constant.cs (LookupConstantValue): Implement.
7576 (EmitConstant): Use the above in emitting the constant.
7578 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
7579 that are user-defined by doing a LookupConstantValue on them.
7581 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
7584 2001-11-29 Miguel de Icaza <miguel@ximian.com>
7586 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
7588 (BaseAccess.DoResolve): Implement.
7590 (MemberAccess.DoResolve): Split this routine into a
7591 ResolveMemberAccess routine that can be used independently
7593 2001-11-28 Miguel de Icaza <miguel@ximian.com>
7595 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
7596 As that share bits of the implementation. Is returns a boolean,
7597 while As returns the Type that is being probed.
7599 2001-12-01 Ravi Pratap <ravi@ximian.com>
7601 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
7602 instead of a Literal - much easier.
7604 (EnumInTransit): Remove - utterly useless :-)
7606 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
7608 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
7610 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
7611 chain when we have no associated expression.
7613 2001-11-30 Ravi Pratap <ravi@ximian.com>
7615 * constant.cs (Define): Use Location while reporting the errror.
7617 Also emit a warning when 'new' is used and there is no inherited
7620 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
7623 (LookupEnumValue): Implement to lookup an enum member's value and define it
7626 (Populate): Re-write accordingly to use the above routine.
7628 2001-11-27 Miguel de Icaza <miguel@ximian.com>
7630 * expression.cs (This): Fix prototype for DoResolveLValue to
7631 override the base class DoResolveLValue.
7633 * cs-parser.cs: Report errors cs574 and cs575 (destructor
7636 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
7637 (we need to load the address of the field here). This fixes
7640 (FieldExpr.DoResolveLValue): Call the DoResolve
7641 function to initialize the Instance expression.
7643 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
7644 correctly the GetEnumerator operation on a value type.
7646 * cs-parser.jay: Add more simple parsing error catches.
7648 * statement.cs (Switch): Add support for string switches.
7649 Handle null specially.
7651 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
7653 2001-11-28 Ravi Pratap <ravi@ximian.com>
7655 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
7657 (declare_local_constant): New helper function.
7659 * statement.cs (AddConstant): Keep a separate record of constants
7661 (IsConstant): Implement to determine if a variable is a constant.
7663 (GetConstantExpression): Implement.
7665 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
7667 * statement.cs (IsVariableDefined): Re-write.
7669 2001-11-27 Ravi Pratap <ravi@ximian.com>
7671 * class.cs (TypeContainer::FindMembers): Look for constants
7672 in the case when we are looking for MemberTypes.Field
7674 * expression.cs (MemberAccess::DoResolve): Check that in the
7675 case we are a FieldExpr and a Literal, we are not being accessed
7676 by an instance reference.
7678 * cs-parser.jay (local_constant_declaration): Implement.
7680 (declaration_statement): Implement for constant declarations.
7682 2001-11-26 Miguel de Icaza <miguel@ximian.com>
7684 * statement.cs (Switch): Catch double defaults.
7686 (Switch): More work on the switch() statement
7687 implementation. It works for integral values now, need to finish
7691 2001-11-24 Miguel de Icaza <miguel@ximian.com>
7693 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
7694 integer literals into other integer literals. To be used by
7697 2001-11-24 Ravi Pratap <ravi@ximian.com>
7699 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
7702 (EmitDynamicInitializers): Cope with the above since we extract data
7703 directly from ArrayData now.
7705 (ExpectInitializers): Keep track of whether initializers are mandatory
7708 (Bounds): Make it a hashtable to prevent the same dimension being
7709 recorded for every element in that dimension.
7711 (EmitDynamicInitializers): Fix bug which prevented the Set array method
7714 Also fix bug which was causing the indices to be emitted in the reverse
7717 2001-11-24 Miguel de Icaza <miguel@ximian.com>
7719 * expression.cs (ArrayCreation): Implement the bits that Ravi left
7720 unfinished. They do not work, because the underlying code is
7723 2001-11-22 Miguel de Icaza <miguel@ximian.com>
7725 * cs-parser.jay: Remove bogus fixme.
7727 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
7728 on Switch statement.
7730 2001-11-23 Ravi Pratap <ravi@ximian.com>
7732 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
7735 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
7736 parameter. Apparently, any expression is allowed.
7738 (ValidateInitializers): Update accordingly.
7740 (CheckIndices): Fix some tricky bugs thanks to recursion.
7742 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
7743 I was being completely brain-dead.
7745 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
7746 and re-write acordingly.
7748 (DelegateInvocation): Re-write accordingly.
7750 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
7752 (MakeByteBlob): Handle types more correctly.
7754 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
7755 initialization from expressions but it is incomplete because I am a complete
7758 2001-11-22 Miguel de Icaza <miguel@ximian.com>
7760 * statement.cs (If.Emit): Fix a bug that generated incorrect code
7761 on If. Basically, we have to return `true' (ie, we do return to
7762 our caller) only if both branches of the if return.
7764 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
7765 short-circuit operators, handle them as short circuit operators.
7767 (Cast.DoResolve): Resolve type.
7768 (Cast.Cast): Take an expression as the target type.
7770 * cs-parser.jay (cast_expression): Remove old hack that only
7771 allowed a limited set of types to be handled. Now we take a
7772 unary_expression and we resolve to a type during semantic
7775 Use the grammar productions from Rhys to handle casts (this is
7776 not complete like Rhys syntax yet, we fail to handle that corner
7777 case that C# has regarding (-x), but we will get there.
7779 2001-11-22 Ravi Pratap <ravi@ximian.com>
7781 * class.cs (EmitFieldInitializer): Take care of the case when we have a
7782 field which is an array type.
7784 * cs-parser.jay (declare_local_variables): Support array initialization too.
7786 * typemanager.cs (MakeKey): Implement.
7788 (everywhere): Use the above appropriately.
7790 * cs-parser.jay (for_statement): Update for array initialization while
7791 declaring variables.
7793 * ecore.cs : The error message was correct, it's the variable's names that
7794 were misleading ;-) Make the code more readable.
7796 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
7797 the correct type etc.
7799 (ConvertExplicit): Handle Enum types by examining the underlying type.
7801 2001-11-21 Ravi Pratap <ravi@ximian.com>
7803 * parameter.cs (GetCallingConvention): Always return
7804 CallingConventions.Standard for now.
7806 2001-11-22 Miguel de Icaza <miguel@ximian.com>
7808 * expression.cs (Binary.ResolveOperator): Update the values of `l'
7809 and `r' after calling DoNumericPromotions.
7811 * ecore.cs: Fix error message (the types were in the wrong order).
7813 * statement.cs (Foreach.ProbeCollectionType): Need to pass
7814 BindingFlags.Instance as well
7816 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
7817 implicit int literal conversion in an empty cast so that we
7818 propagate the right type upstream.
7820 (UnboxCast): new class used to unbox value types.
7821 (Expression.ConvertExplicit): Add explicit type conversions done
7824 (Expression.ImplicitNumericConversion): Oops, forgot to test for
7825 the target type before applying the implicit LongLiterals to ULong
7828 2001-11-21 Miguel de Icaza <miguel@ximian.com>
7830 * cs-parser.jay (for_statement): Reworked the way For works: now
7831 we declare manually any variables that are introduced in
7832 for_initializer to solve the problem of having out-of-band code
7833 emition (that is what got for broken).
7835 (declaration_statement): Perform the actual variable declaration
7836 that used to be done in local_variable_declaration here.
7838 (local_variable_declaration): Do not declare anything, just pass
7839 the information on a DictionaryEntry
7841 2001-11-20 Ravi Pratap <ravi@ximian.com>
7843 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
7844 re-write of the logic to now make it recursive.
7846 (UpdateIndices): Re-write accordingly.
7848 Store element data in a separate ArrayData list in the above methods.
7850 (MakeByteBlob): Implement to dump the array data into a byte array.
7852 2001-11-19 Ravi Pratap <ravi@ximian.com>
7854 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
7857 * constant.cs (Define): Implement.
7859 (EmitConstant): Re-write fully.
7861 Pass in location info.
7863 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
7866 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
7867 DictionaryEntry since we need location info too.
7869 (constant_declaration): Update accordingly.
7871 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
7872 code into another method : UpdateIndices.
7874 2001-11-18 Ravi Pratap <ravi@ximian.com>
7876 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
7877 some type checking etc.
7879 2001-11-17 Ravi Pratap <ravi@ximian.com>
7881 * expression.cs (ArrayCreation::ValidateInitializers): Implement
7882 bits to provide dimension info if the user skips doing that.
7884 Update second constructor to store the rank correctly.
7886 2001-11-16 Ravi Pratap <ravi@ximian.com>
7888 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
7889 and try to implement.
7891 * ../errors/cs0150.cs : Add.
7893 * ../errors/cs0178.cs : Add.
7895 2001-11-16 Miguel de Icaza <miguel@ximian.com>
7897 * statement.cs: Implement foreach on multi-dimensional arrays.
7899 * parameter.cs (Parameters.GetParameterByName): Also lookup the
7900 name of the params argument.
7902 * expression.cs: Use EmitStoreOpcode to get the right opcode while
7903 initializing the array.
7905 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
7906 we can use this elsewhere.
7908 * statement.cs: Finish implementation of foreach for single
7911 * cs-parser.jay: Use an out-of-band stack to pass information
7912 around, I wonder why I need this.
7914 foreach_block: Make the new foreach_block the current_block.
7916 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
7917 function used to return a static Parameters structure. Used for
7918 empty parameters, as those are created very frequently.
7920 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
7922 2001-11-15 Ravi Pratap <ravi@ximian.com>
7924 * interface.cs : Default modifier is private, not public. The
7925 make verify test passes again.
7927 2001-11-15 Ravi Pratap <ravi@ximian.com>
7929 * support.cs (ReflectionParameters): Fix logic to determine
7930 whether the last parameter is a params one. Test 9 passes again.
7932 * delegate.cs (Populate): Register the builders we define with
7933 RegisterParameterForBuilder. Test 19 passes again.
7935 * cs-parser.jay (property_declaration): Reference $6 instead
7936 of $$ to get at the location.
7938 (indexer_declaration): Similar stuff.
7942 * class.cs (Property): Register parameters for the Get and Set methods
7943 if they exist. Test 23 passes again.
7945 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
7946 call to EmitArguments as we are sure there aren't any params arguments.
7947 Test 32 passes again.
7949 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
7950 IndexOutOfRangeException.
7952 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
7953 Test 33 now passes again.
7955 2001-11-15 Miguel de Icaza <miguel@ximian.com>
7957 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
7958 broke a bunch of things. Will have to come up with a better way
7959 of tracking locations.
7961 * statement.cs: Implemented foreach for single dimension arrays.
7963 2001-11-09 Miguel de Icaza <miguel@ximian.com>
7965 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
7966 an error. This removes the lookup from the critical path.
7968 * cs-parser.jay: Removed use of temporary_loc, which is completely
7971 2001-11-14 Miguel de Icaza <miguel@ximian.com>
7973 * support.cs (ReflectionParameters.ParameterModifier): Report
7974 whether the argument is a PARAMS argument or not.
7976 * class.cs: Set the attribute `ParamArrayAttribute' on the
7979 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
7980 and cons_param_array_attribute (ConstructorInfo for
7981 ParamArrayAttribute).,
7983 * codegen.cs: Emit the return using the `Return' statement, that
7984 way we can report the error correctly for missing return values.
7986 * class.cs (Method.Emit): Clean up.
7988 * expression.cs (Argument.Resolve): Take another argument: the
7989 location where this argument is used. Notice that this is not
7990 part of the "Argument" class as to reduce the size of the
7991 structure (we know the approximate location anyways).
7993 Test if the argument is a variable-reference, if not, then
7994 complain with a 206.
7996 (Argument.Emit): Emit addresses of variables.
7998 (Argument.FullDesc): Simplify.
8000 (Invocation.DoResolve): Update for Argument.Resolve.
8002 (ElementAccess.DoResolve): ditto.
8004 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
8005 method should be virtual, as this method is always virtual.
8007 (NewDelegate.DoResolve): Update for Argument.Resolve.
8009 * class.cs (ConstructorInitializer.DoResolve): ditto.
8011 * attribute.cs (Attribute.Resolve): ditto.
8013 2001-11-13 Miguel de Icaza <miguel@ximian.com>
8015 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
8017 * expression.cs (ParameterReference): Drop IStackStorage and implement
8018 IAssignMethod instead.
8020 (LocalVariableReference): ditto.
8022 * ecore.cs (FieldExpr): Drop IStackStorage and implement
8023 IAssignMethod instead.
8025 2001-11-13 Miguel de Icaza <miguel@ximian.com>
8027 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
8028 enumerations that are used in heavily used structures derive from
8029 byte in a laughable and pathetic attempt to reduce memory usage.
8030 This is the kind of pre-optimzations that you should not do at
8031 home without adult supervision.
8033 * expression.cs (UnaryMutator): New class, used to handle ++ and
8034 -- separatedly from the other unary operators. Cleans up the
8035 code, and kills the ExpressionStatement dependency in Unary.
8037 (Unary): Removed `method' and `Arguments' from this class, making
8038 it smaller, and moving it all to SimpleCall, so I can reuse this
8039 code in other locations and avoid creating a lot of transient data
8040 strucutres when not required.
8042 * cs-parser.jay: Adjust for new changes.
8044 2001-11-11 Miguel de Icaza <miguel@ximian.com>
8046 * enum.cs (Enum.Populate): If there is a failure during
8049 * cs-parser.jay (opt_enum_base): we used to catch type errors
8050 here, but this is really incorrect. The type error should be
8051 catched during semantic analysis.
8053 2001-12-11 Ravi Pratap <ravi@ximian.com>
8055 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
8056 current_local_parameters as expected since I, in my stupidity, had forgotten
8059 * attribute.cs (GetValidPlaces): Fix stupid bug.
8061 * class.cs (Method::Emit): Perform check on applicability of attributes.
8063 (Constructor::Emit): Ditto.
8065 (Field::Emit): Ditto.
8067 (Field.Location): Store location information.
8069 (Property, Event, Indexer, Operator): Ditto.
8071 * cs-parser.jay (field_declaration): Pass in location for each field.
8073 * ../errors/cs0592.cs : Add.
8075 2001-11-12 Ravi Pratap <ravi@ximian.com>
8077 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
8079 (InitCoreTypes): Update accordingly.
8081 (RegisterAttrType, LookupAttr): Implement.
8083 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
8084 info about the same.
8086 (Resolve): Update to populate the above as necessary.
8090 (GetValidPlaces): Helper to the above.
8092 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
8094 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
8096 2001-11-12 Ravi Pratap <ravi@ximian.com>
8098 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
8100 * ../errors/cs0617.cs : Add.
8102 2001-11-11 Ravi Pratap <ravi@ximian.com>
8104 * enum.cs (Emit): Rename to Populate to be more consistent with what
8105 we expect it to do and when exactly it is called.
8107 * class.cs, rootcontext.cs : Update accordingly.
8109 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
8110 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
8112 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
8114 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
8115 of a fieldinfo using the above, when dealing with a FieldBuilder.
8117 2001-11-10 Ravi Pratap <ravi@ximian.com>
8119 * ../errors/cs0031.cs : Add.
8121 * ../errors/cs1008.cs : Add.
8123 * ../errrors/cs0543.cs : Add.
8125 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
8128 (FindMembers): Implement.
8130 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
8131 enums and delegates too.
8133 (enum_types): Rename to builder_to_enum.
8135 (delegate_types): Rename to builder_to_delegate.
8137 * delegate.cs (FindMembers): Implement.
8139 2001-11-09 Ravi Pratap <ravi@ximian.com>
8141 * typemanager.cs (IsEnumType): Implement.
8143 * enum.cs (Emit): Re-write parts to account for the underlying type
8144 better and perform checking etc.
8146 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
8147 of the underlying type.
8149 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
8152 * enum.cs (error31): Helper to report error #31.
8154 * cs-parser.jay (enum_declaration): Store location of each member too.
8156 * enum.cs (member_to_location): New hashtable.
8158 (AddEnumMember): Update location hashtable.
8160 (Emit): Use the location of each member while reporting errors.
8162 2001-11-09 Miguel de Icaza <miguel@ximian.com>
8164 * cs-parser.jay: A for_initializer if is a
8165 local_variable_declaration really ammount to have an implicit
8166 block with the variable declaration and no initializer for for.
8168 * statement.cs (For.Emit): Cope with null initializers.
8170 This fixes the infinite loop on for initializers.
8172 2001-11-08 Miguel de Icaza <miguel@ximian.com>
8174 * enum.cs: More cleanup.
8176 * ecore.cs: Remove dead code.
8178 * class.cs (Property.Emit): More simplification.
8179 (Event.Emit): ditto.
8181 Reworked to have less levels of indentation.
8183 2001-11-08 Ravi Pratap <ravi@ximian.com>
8185 * class.cs (Property): Emit attributes.
8195 * enum.cs (Emit): Ditto.
8197 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
8200 * class.cs (Field, Event, etc.): Move attribute generation into the
8201 Emit method everywhere.
8203 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
8204 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
8205 as we had no way of defining nested enums !
8207 * rootcontext.cs : Adjust code accordingly.
8209 * typemanager.cs (AddEnumType): To keep track of enum types separately.
8211 2001-11-07 Ravi Pratap <ravi@ximian.com>
8213 * expression.cs (EvalConstantExpression): Move into ecore.cs
8215 * enum.cs (Enum): Rename some members and make them public and readonly
8216 according to our convention.
8218 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
8221 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
8223 (Enum::Emit): Write a simple version for now which doesn't try to compute
8224 expressions. I shall modify this to be more robust in just a while.
8226 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
8228 (TypeContainer::CloseType): Create the Enum types too.
8230 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
8232 * expression.cs (EvalConstantExpression): Get rid of completely.
8234 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
8235 user-defined values and other cases.
8237 (IsValidEnumLiteral): Helper function.
8239 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
8240 out there in the case we had a literal FieldExpr.
8242 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
8244 (Literalize): Revamp a bit to take two arguments.
8246 (EnumLiteral): New class which derives from Literal to wrap enum literals.
8248 2001-11-06 Ravi Pratap <ravi@ximian.com>
8250 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
8252 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
8254 (Resolve): Use the above to ensure we have proper initializers.
8256 2001-11-05 Ravi Pratap <ravi@ximian.com>
8258 * expression.cs (Expression::EvalConstantExpression): New method to
8259 evaluate constant expressions.
8261 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
8263 2001-11-07 Miguel de Icaza <miguel@ximian.com>
8265 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
8268 (Binary.ResolveOperator): Handle operator != (object a, object b)
8269 and operator == (object a, object b);
8271 (Binary.DoNumericPromotions): Indicate whether the numeric
8272 promotion was possible.
8274 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
8277 Made the ArrayAccess implement interface IAssignMethod instead of
8278 IStackStore as the order in which arguments are passed reflects
8281 * assign.cs: Instead of using expr.ExprClass to select the way of
8282 assinging, probe for the IStackStore/IAssignMethod interfaces.
8284 * typemanager.cs: Load InitializeArray definition.
8286 * rootcontext.cs (RootContext.MakeStaticData): Used to define
8287 static data that can be used to initialize arrays.
8289 2001-11-05 Miguel de Icaza <miguel@ximian.com>
8291 * expression.cs: Handle operator== and operator!= for booleans.
8293 (Conditioal.Reduce): Implement reducer for the ?: operator.
8295 (Conditional.Resolve): Implement dead code elimination.
8297 (Binary.Resolve): Catch string literals and return a new
8298 concatenated string.
8300 (Unary.Reduce): Implement reduction of unary expressions.
8302 * ecore.cs: Split out the expression core handling here.
8304 (Expression.Reduce): New method used to perform constant folding
8305 and CSE. This is needed to support constant-expressions.
8307 * statement.cs (Statement.EmitBoolExpression): Pass true and false
8308 targets, and optimize for !x.
8310 2001-11-04 Ravi Pratap <ravi@ximian.com>
8312 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
8313 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
8314 set custom atttributes.
8316 * literal.cs (Literal::GetValue): New abstract method to return the actual
8317 value of the literal, cast as an object.
8319 (*Literal): Implement GetValue method.
8321 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
8322 expressions to the arraylist but objects of type Argument.
8324 * class.cs (TypeContainer::Emit): Emit our attributes too.
8326 (Method::Emit, Constructor::Emit): Ditto.
8328 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
8329 to be ignoring earlier.
8331 2001-11-03 Ravi Pratap <ravi@ximian.com>
8333 * attribute.cs (AttributeSection::Define): Implement to do the business
8334 of constructing a CustomAttributeBuilder.
8336 (Attribute): New trivial class. Increases readability of code.
8338 * cs-parser.jay : Update accordingly.
8340 (positional_argument_list, named_argument_list, named_argument): New rules
8342 (attribute_arguments): Use the above so that we are more correct.
8344 2001-11-02 Ravi Pratap <ravi@ximian.com>
8346 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
8347 to perform all checks for a method with a params parameter.
8349 (Invocation::OverloadResolve): Update to use the above method and therefore
8350 cope correctly with params method invocations.
8352 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
8355 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
8356 constructors in our parent too because we can't afford to miss out on
8359 * attribute.cs (AttributeSection): New name for the class Attribute
8361 Other trivial changes to improve readability.
8363 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
8364 use the new class names.
8366 2001-11-01 Ravi Pratap <ravi@ximian.com>
8368 * class.cs (Method::Define): Complete definition for params types too
8370 (Indexer::Define): Ditto.
8372 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
8373 Cope everywhere with a request for info about the array parameter.
8375 2001-11-01 Ravi Pratap <ravi@ximian.com>
8377 * tree.cs (RecordNamespace): Fix up to check for the correct key.
8379 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
8380 local_variable_type to extract the string corresponding to the type.
8382 (local_variable_type): Fixup the action to use the new helper method.
8384 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
8387 * expression.cs : Clean out code which uses the above.
8389 2001-10-31 Ravi Pratap <ravi@ximian.com>
8391 * typemanager.cs (RegisterMethod): Check if we already have an existing key
8392 and bale out if necessary by returning a false.
8394 (RegisterProperty): Ditto.
8396 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
8397 and print out appropriate error messages.
8399 * interface.cs (everywhere): Ditto.
8401 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
8402 location to constructor.
8404 * class.cs (Property, Event, Indexer): Update accordingly.
8406 * ../errors/cs111.cs : Added.
8408 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
8409 of a method, as laid down by the spec.
8411 (Invocation::OverloadResolve): Use the above method.
8413 2001-10-31 Ravi Pratap <ravi@ximian.com>
8415 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
8416 now take a TypeContainer and a Parameters object.
8418 (ParameterData): Modify return type of ParameterModifier method to be
8419 Parameter.Modifier and not a string.
8421 (ReflectionParameters, InternalParameters): Update accordingly.
8423 * expression.cs (Argument::GetParameterModifier): Same here.
8425 * support.cs (InternalParameters::ParameterType): Find a better way of determining
8426 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
8427 symbol in it at all so maybe this is only for now.
8429 2001-10-30 Ravi Pratap <ravi@ximian.com>
8431 * support.cs (InternalParameters): Constructor now takes an extra argument
8432 which is the actual Parameters class.
8434 (ParameterDesc): Update to provide info on ref/out modifiers.
8436 * class.cs (everywhere): Update call to InternalParameters to pass in
8437 the second argument too.
8439 * support.cs (ParameterData): Add ParameterModifier, which is a method
8440 to return the modifier info [ref/out etc]
8442 (InternalParameters, ReflectionParameters): Implement the above.
8444 * expression.cs (Argument::ParameterModifier): Similar function to return
8445 info about the argument's modifiers.
8447 (Invocation::OverloadResolve): Update to take into account matching modifiers
8450 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
8451 a new SetFormalParameters object which we pass to InternalParameters.
8453 2001-10-30 Ravi Pratap <ravi@ximian.com>
8455 * expression.cs (NewArray): Merge into the ArrayCreation class.
8457 2001-10-29 Ravi Pratap <ravi@ximian.com>
8459 * expression.cs (NewArray): Merge classes NewBuiltinArray and
8460 NewUserdefinedArray into one as there wasn't much of a use in having
8463 * expression.cs (Argument): Change field's name to ArgType from Type.
8465 (Type): New readonly property which returns the proper type, taking into
8466 account ref/out modifiers.
8468 (everywhere): Adjust code accordingly for the above.
8470 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
8471 whether we are emitting for a ref or out parameter.
8473 * expression.cs (Argument::Emit): Use the above field to set the state.
8475 (LocalVariableReference::Emit): Update to honour the flag and emit the
8478 * parameter.cs (Attributes): Set the correct flags for ref parameters.
8480 * expression.cs (Argument::FullDesc): New function to provide a full desc.
8482 * support.cs (ParameterData): Add method ParameterDesc to the interface.
8484 (ReflectionParameters, InternalParameters): Implement the above method.
8486 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
8489 (Invocation::FullMethodDesc): Ditto.
8491 2001-10-29 Miguel de Icaza <miguel@ximian.com>
8493 * cs-parser.jay: Add extra production for the second form of array
8496 * expression.cs (ArrayCreation): Update to reflect the above
8499 * Small changes to prepare for Array initialization.
8501 2001-10-28 Miguel de Icaza <miguel@ximian.com>
8503 * typemanager.cs (ImplementsInterface): interface might be null;
8504 Deal with this problem;
8506 Also, we do store negative hits on the cache (null values), so use
8507 this instead of calling t.GetInterfaces on the type everytime.
8509 2001-10-28 Ravi Pratap <ravi@ximian.com>
8511 * typemanager.cs (IsBuiltinType): New method to help determine the same.
8513 * expression.cs (New::DoResolve): Get rid of array creation code and instead
8514 split functionality out into different classes.
8516 (New::FormArrayType): Move into NewBuiltinArray.
8518 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
8521 (NewBuiltinArray): New class to handle creation of built-in arrays.
8523 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
8524 account creation of one-dimensional arrays.
8526 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
8528 (NewUserdefinedArray::DoResolve): Implement.
8530 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
8532 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
8533 we maintain inside the TypeManager. This is necessary to perform lookups on the
8536 (LookupType): Update to perform GetType on the module builders too.
8538 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
8540 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
8542 2001-10-23 Ravi Pratap <ravi@ximian.com>
8544 * expression.cs (New::DoResolve): Implement guts of array creation.
8546 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
8548 2001-10-27 Miguel de Icaza <miguel@ximian.com>
8550 * expression.cs: Fix bug I introduced lsat night that broke
8553 (Expression.Resolve): Report a 246 error (can not resolve name)
8554 if we find a SimpleName in the stream.
8556 (Expression.ResolveLValue): Ditto.
8558 (Expression.ResolveWithSimpleName): This function is a variant of
8559 ResolveName, this one allows SimpleNames to be returned without a
8560 warning. The only consumer of SimpleNames is MemberAccess
8562 2001-10-26 Miguel de Icaza <miguel@ximian.com>
8564 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
8565 might arrive here. I have my doubts that this is correct.
8567 * statement.cs (Lock): Implement lock statement.
8569 * cs-parser.jay: Small fixes to support `lock' and `using'
8571 * cs-tokenizer.cs: Remove extra space
8573 * driver.cs: New flag --checked, allows to turn on integer math
8576 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
8577 Threading.Monitor.Exit
8579 2001-10-23 Miguel de Icaza <miguel@ximian.com>
8581 * expression.cs (IndexerAccess::DoResolveLValue): Set the
8582 Expression Class to be IndexerAccess.
8584 Notice that Indexer::DoResolve sets the eclass to Value.
8586 2001-10-22 Miguel de Icaza <miguel@ximian.com>
8588 * class.cs (TypeContainer::Emit): Emit code for indexers.
8590 * assign.cs (IAssignMethod): New interface implemented by Indexers
8591 and Properties for handling assignment.
8593 (Assign::Emit): Simplify and reuse code.
8595 * expression.cs (IndexerAccess, PropertyExpr): Implement
8596 IAssignMethod, clean up old code.
8598 2001-10-22 Ravi Pratap <ravi@ximian.com>
8600 * typemanager.cs (ImplementsInterface): New method to determine if a type
8601 implements a given interface. Provides a nice cache too.
8603 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
8606 (ConvertReferenceExplicit): Ditto.
8608 * delegate.cs (Delegate::Populate): Update to define the parameters on the
8609 various methods, with correct names etc.
8611 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
8612 Operator.UnaryNegation.
8614 * cs-parser.jay (operator_declarator): Be a little clever in the case where
8615 we have a unary plus or minus operator.
8617 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
8620 * everywhere : update accordingly.
8622 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
8625 * class.cs (Method::Define): For the case where we are implementing a method
8626 inherited from an interface, we need to set the MethodAttributes.Final flag too.
8627 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
8629 2001-10-21 Ravi Pratap <ravi@ximian.com>
8631 * interface.cs (FindMembers): Implement to work around S.R.E
8634 * typemanager.cs (IsInterfaceType): Implement.
8636 (FindMembers): Update to handle interface types too.
8638 * expression.cs (ImplicitReferenceConversion): Re-write bits which
8639 use IsAssignableFrom as that is not correct - it doesn't work.
8641 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
8642 and accordingly override EmitStatement.
8644 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
8645 using the correct logic :-)
8647 2001-10-19 Ravi Pratap <ravi@ximian.com>
8649 * ../errors/cs-11.cs : Add to demonstrate error -11
8651 2001-10-17 Miguel de Icaza <miguel@ximian.com>
8653 * assign.cs (Assign::Resolve): Resolve right hand side first, and
8654 then pass this as a hint to ResolveLValue.
8656 * expression.cs (FieldExpr): Add Location information
8658 (FieldExpr::LValueResolve): Report assignment to readonly
8661 (Expression::ExprClassFromMemberInfo): Pass location information.
8663 (Expression::ResolveLValue): Add new method that resolves an
8666 (Expression::DoResolveLValue): Default invocation calls
8669 (Indexers): New class used to keep track of indexers in a given
8672 (IStackStore): Renamed from LValue, as it did not really describe
8673 what this did. Also ResolveLValue is gone from this interface and
8674 now is part of Expression.
8676 (ElementAccess): Depending on the element access type
8678 * typemanager.cs: Add `indexer_name_type' as a Core type
8679 (System.Runtime.CompilerServices.IndexerNameAttribute)
8681 * statement.cs (Goto): Take a location.
8683 2001-10-18 Ravi Pratap <ravi@ximian.com>
8685 * delegate.cs (Delegate::VerifyDelegate): New method to verify
8686 if two delegates are compatible.
8688 (NewDelegate::DoResolve): Update to take care of the case when
8689 we instantiate a delegate from another delegate.
8691 * typemanager.cs (FindMembers): Don't even try to look up members
8692 of Delegate types for now.
8694 2001-10-18 Ravi Pratap <ravi@ximian.com>
8696 * delegate.cs (NewDelegate): New class to take care of delegate
8699 * expression.cs (New): Split the delegate related code out into
8700 the NewDelegate class.
8702 * delegate.cs (DelegateInvocation): New class to handle delegate
8705 * expression.cs (Invocation): Split out delegate related code into
8706 the DelegateInvocation class.
8708 2001-10-17 Ravi Pratap <ravi@ximian.com>
8710 * expression.cs (New::DoResolve): Implement delegate creation fully
8711 and according to the spec.
8713 (New::DoEmit): Update to handle delegates differently.
8715 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
8716 because of which we were printing out arguments in reverse order !
8718 * delegate.cs (VerifyMethod): Implement to check if the given method
8719 matches the delegate.
8721 (FullDelegateDesc): Implement.
8723 (VerifyApplicability): Implement.
8725 * expression.cs (Invocation::DoResolve): Update to accordingly handle
8726 delegate invocations too.
8728 (Invocation::Emit): Ditto.
8730 * ../errors/cs1593.cs : Added.
8732 * ../errors/cs1594.cs : Added.
8734 * delegate.cs (InstanceExpression, TargetMethod): New properties.
8736 2001-10-16 Ravi Pratap <ravi@ximian.com>
8738 * typemanager.cs (intptr_type): Core type for System.IntPtr
8740 (InitCoreTypes): Update for the same.
8742 (iasyncresult_type, asynccallback_type): Ditto.
8744 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
8747 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
8750 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
8751 the builders for the 4 members of a delegate type :-)
8753 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
8756 * expression.cs (New::DoResolve): Implement guts for delegate creation.
8758 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
8760 2001-10-15 Miguel de Icaza <miguel@ximian.com>
8762 * statement.cs (Break::Emit): Implement.
8763 (Continue::Emit): Implement.
8765 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
8766 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
8767 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
8768 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
8771 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
8772 properties that track the label for the current loop (begin of the
8773 loop and end of the loop).
8775 2001-10-15 Ravi Pratap <ravi@ximian.com>
8777 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
8778 use of emitting anything at all.
8780 * class.cs, rootcontext.cs : Get rid of calls to the same.
8782 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
8784 (Populate): Define the constructor correctly and set the implementation
8787 * typemanager.cs (delegate_types): New hashtable to hold delegates that
8790 (AddDelegateType): Implement.
8792 (IsDelegateType): Implement helper method.
8794 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
8796 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
8797 and accordingly handle it.
8799 * delegate.cs (Populate): Take TypeContainer argument.
8800 Implement bits to define the Invoke method. However, I still haven't figured out
8801 how to take care of the native int bit :-(
8803 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
8804 Qualify the name of the delegate, not its return type !
8806 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
8809 (StandardConversionExists): Checking for array types turns out to be recursive.
8811 (ConvertReferenceExplicit): Implement array conversion.
8813 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
8815 2001-10-12 Ravi Pratap <ravi@ximian.com>
8817 * cs-parser.jay (delegate_declaration): Store the fully qualified
8818 name as it is a type declaration.
8820 * delegate.cs (ReturnType, Name): Rename members to these. Make them
8823 (DefineDelegate): Renamed from Define. Does the same thing essentially,
8824 as TypeContainer::DefineType.
8826 (Populate): Method in which all the definition of the various methods (Invoke)
8829 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
8832 (CloseDelegate): Finally creates the delegate.
8834 * class.cs (TypeContainer::DefineType): Update to define delegates.
8835 (Populate, Emit and CloseType): Do the same thing here too.
8837 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
8838 delegates in all these operations.
8840 2001-10-14 Miguel de Icaza <miguel@ximian.com>
8842 * expression.cs: LocalTemporary: a new expression used to
8843 reference a temporary that has been created.
8845 * assign.cs: Handle PropertyAccess back here, so that we can
8846 provide the proper semantic access to properties.
8848 * expression.cs (Expression::ConvertReferenceExplicit): Implement
8849 a few more explicit conversions.
8851 * modifiers.cs: `NEW' modifier maps to HideBySig.
8853 * expression.cs (PropertyExpr): Make this into an
8854 ExpressionStatement, and support the EmitStatement code path.
8856 Perform get/set error checking, clean up the interface.
8858 * assign.cs: recognize PropertyExprs as targets, and if so, turn
8859 them into toplevel access objects.
8861 2001-10-12 Miguel de Icaza <miguel@ximian.com>
8863 * expression.cs: PropertyExpr::PropertyExpr: use work around the
8866 * typemanager.cs: Keep track here of our PropertyBuilders again to
8867 work around lameness in SRE.
8869 2001-10-11 Miguel de Icaza <miguel@ximian.com>
8871 * expression.cs (LValue::LValueResolve): New method in the
8872 interface, used to perform a second resolution pass for LValues.
8874 (This::DoResolve): Catch the use of this in static methods.
8876 (This::LValueResolve): Implement.
8878 (This::Store): Remove warning, assigning to `this' in structures
8881 (Invocation::Emit): Deal with invocation of
8882 methods on value types. We need to pass the address to structure
8883 methods rather than the object itself. (The equivalent code to
8884 emit "this" for structures leaves the entire structure on the
8885 stack instead of a pointer to it).
8887 (ParameterReference::DoResolve): Compute the real index for the
8888 argument based on whether the method takes or not a `this' pointer
8889 (ie, the method is static).
8891 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
8892 value types returned from functions when we need to invoke a
8893 method on the sturcture.
8896 2001-10-11 Ravi Pratap <ravi@ximian.com>
8898 * class.cs (TypeContainer::DefineType): Method to actually do the business of
8899 defining the type in the Modulebuilder or Typebuilder. This is to take
8900 care of nested types which need to be defined on the TypeBuilder using
8903 (TypeContainer::GetClassBases): Implement. Essentially the code from the
8904 methods in RootContext, only ported to be part of TypeContainer.
8906 (TypeContainer::GetInterfaceOrClass): Ditto.
8908 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
8910 * interface.cs (Interface::DefineInterface): New method. Does exactly
8911 what RootContext.CreateInterface did earlier, only it takes care of nested types
8914 (Interface::GetInterfaces): Move from RootContext here and port.
8916 (Interface::GetInterfaceByName): Same here.
8918 * rootcontext.cs (ResolveTree): Re-write.
8920 (PopulateTypes): Re-write.
8922 * class.cs (TypeContainer::Populate): Populate nested types too.
8923 (TypeContainer::Emit): Emit nested members too.
8925 * typemanager.cs (AddUserType): Do not make use of the FullName property,
8926 instead just use the name argument passed in as it is already fully
8929 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
8930 to TypeContainer mapping to see if a type is user-defined.
8932 * class.cs (TypeContainer::CloseType): Implement.
8934 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
8935 the default constructor.
8937 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
8940 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
8942 * interface.cs (CloseType): Create the type here.
8944 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
8947 Remove all the methods which are now in TypeContainer.
8949 2001-10-10 Ravi Pratap <ravi@ximian.com>
8951 * delegate.cs (Define): Re-write bits to define the delegate
8954 2001-10-10 Miguel de Icaza <miguel@ximian.com>
8956 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
8958 * expression.cs (ImplicitReferenceConversion): handle null as well
8959 as a source to convert to any reference type.
8961 * statement.cs (Return): Perform any implicit conversions to
8962 expected return type.
8964 Validate use of return statement.
8966 * codegen.cs (EmitContext): Pass the expected return type here.
8968 * class.cs (Method, Constructor, Property): Pass expected return
8969 type to EmitContext.
8971 2001-10-09 Miguel de Icaza <miguel@ximian.com>
8973 * expression.cs: Make DoResolve take an EmitContext instead of a
8976 Replaced `l' and `location' for `loc', for consistency.
8978 (Error, Warning): Remove unneeded Tc argument.
8980 * assign.cs, literal.cs, constant.cs: Update to new calling
8983 * codegen.cs: EmitContext now contains a flag indicating whether
8984 code is being generated in a static method or not.
8986 * cs-parser.jay: DecomposeQI, new function that replaces the old
8987 QualifiedIdentifier. Now we always decompose the assembled
8988 strings from qualified_identifier productions into a group of
8991 2001-10-08 Miguel de Icaza <miguel@ximian.com>
8993 * rootcontext.cs: Deal with field-less struct types correctly now
8994 by passing the size option to Define Type.
8996 * class.cs: Removed hack that created one static field.
8998 2001-10-07 Miguel de Icaza <miguel@ximian.com>
9000 * statement.cs: Moved most of the code generation here.
9002 2001-10-09 Ravi Pratap <ravi@ximian.com>
9004 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
9007 (ElementAccess): Remove useless bits for now - keep checks as the spec
9010 2001-10-08 Ravi Pratap <ravi@ximian.com>
9012 * expression.cs (ElementAccess::DoResolve): Remove my crap code
9013 and start performing checks according to the spec.
9015 2001-10-07 Ravi Pratap <ravi@ximian.com>
9017 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
9018 rank_specifiers instead.
9020 (rank_specifiers): Change the order in which the rank specifiers are stored
9022 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
9024 * expression.cs (ElementAccess): Implement the LValue interface too.
9026 2001-10-06 Ravi Pratap <ravi@ximian.com>
9028 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
9029 except that user defined conversions are not included.
9031 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
9032 perform the conversion of the return type, if necessary.
9034 (New::DoResolve): Check whether we are creating an array or an object
9035 and accordingly do the needful.
9037 (New::Emit): Same here.
9039 (New::DoResolve): Implement guts of array creation.
9041 (New::FormLookupType): Helper function.
9043 2001-10-07 Miguel de Icaza <miguel@ximian.com>
9045 * codegen.cs: Removed most of the code generation here, and move the
9046 corresponding code generation bits to the statement classes.
9048 Added support for try/catch/finalize and throw.
9050 * cs-parser.jay: Added support for try/catch/finalize.
9052 * class.cs: Catch static methods having the flags override,
9053 virtual or abstract.
9055 * expression.cs (UserCast): This user cast was not really doing
9056 what it was supposed to do. Which is to be born in fully resolved
9057 state. Parts of the resolution were being performed at Emit time!
9061 2001-10-05 Miguel de Icaza <miguel@ximian.com>
9063 * expression.cs: Implicity convert the result from UserCast.
9065 2001-10-05 Ravi Pratap <ravi@ximian.com>
9067 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
9068 prevented it from working correctly.
9070 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
9071 merely ConvertImplicit.
9073 2001-10-05 Miguel de Icaza <miguel@ximian.com>
9075 * typemanager.cs: Make the LookupTypeContainer function static,
9076 and not per-instance.
9078 * class.cs: Make static FindMembers (the one that takes a Type
9081 * codegen.cs: Add EmitForeach here.
9083 * cs-parser.jay: Make foreach a toplevel object instead of the
9084 inline expansion, as we need to perform semantic analysis on it.
9086 2001-10-05 Ravi Pratap <ravi@ximian.com>
9088 * expression.cs (Expression::ImplicitUserConversion): Rename to
9089 UserDefinedConversion.
9091 (Expression::UserDefinedConversion): Take an extra argument specifying
9092 whether we look for explicit user conversions too.
9094 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
9096 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
9098 (ExplicitUserConversion): Make it a call to UserDefinedConversion
9099 with the appropriate arguments.
9101 * cs-parser.jay (cast_expression): Record location too.
9103 * expression.cs (Cast): Record location info.
9105 (Expression::ConvertExplicit): Take location argument.
9107 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
9108 to determine if we are doing explicit conversions.
9110 (UserCast::Emit): Update accordingly.
9112 (Expression::ConvertExplicit): Report an error if everything fails.
9114 * ../errors/cs0030.cs : Add.
9116 2001-10-04 Miguel de Icaza <miguel@ximian.com>
9118 * modifiers.cs: If the ABSTRACT keyword is present, also set the
9119 virtual and newslot bits.
9121 * class.cs (TypeContainer::RegisterRequiredImplementations):
9122 Record methods we need.
9124 (TypeContainer::MakeKey): Helper function to make keys for
9125 MethodBases, since the Methodbase key is useless.
9127 (TypeContainer::Populate): Call RegisterRequiredImplementations
9128 before defining the methods.
9130 Create a mapping for method_builders_to_methods ahead of time
9131 instead of inside a tight loop.
9133 (::RequireMethods): Accept an object as the data to set into the
9134 hashtable so we can report interface vs abstract method mismatch.
9136 2001-10-03 Miguel de Icaza <miguel@ximian.com>
9138 * report.cs: Make all of it static.
9140 * rootcontext.cs: Drop object_type and value_type computations, as
9141 we have those in the TypeManager anyways.
9143 Drop report instance variable too, now it is a global.
9145 * driver.cs: Use try/catch on command line handling.
9147 Add --probe option to debug the error reporting system with a test
9150 * report.cs: Add support for exiting program when a probe
9151 condition is reached.
9153 2001-10-03 Ravi Pratap <ravi@ximian.com>
9155 * expression.cs (Binary::DoNumericPromotions): Fix the case when
9156 we do a forcible conversion regardless of type, to check if
9157 ForceConversion returns a null.
9159 (Binary::error19): Use location to report error.
9161 (Unary::error23): Use location here too.
9163 * ../errors/cs0019.cs : Check in.
9165 * ../errors/cs0023.cs : Check in.
9167 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
9168 case of a non-null MethodInfo object with a length of 0 !
9170 (Binary::ResolveOperator): Flag error if overload resolution fails to find
9171 an applicable member - according to the spec :-)
9172 Also fix logic to find members in base types.
9174 (Unary::ResolveOperator): Same here.
9176 (Unary::report23): Change name to error23 and make first argument a TypeContainer
9177 as I was getting thoroughly confused between this and error19 :-)
9179 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
9180 (::FindMostEncompassedType): Implement.
9181 (::FindMostEncompassingType): Implement.
9182 (::StandardConversionExists): Implement.
9184 (UserImplicitCast): Re-vamp. We now need info about most specific
9185 source and target types so that we can do the necessary conversions.
9187 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
9188 mathematical union with no duplicates.
9190 2001-10-03 Miguel de Icaza <miguel@ximian.com>
9192 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
9193 in order from base classes to child classes, so that we can in
9194 child classes look up in our parent for method names and
9195 attributes (required for handling abstract, virtual, new, override
9196 constructs: we need to instrospect our base class, and if we dont
9197 populate the classes in order, the introspection might be
9198 incorrect. For example, a method could query its parent before
9199 the parent has any methods and would determine that the parent has
9200 no abstract methods (while it could have had them)).
9202 (RootContext::CreateType): Record the order in which we define the
9205 2001-10-02 Miguel de Icaza <miguel@ximian.com>
9207 * class.cs (TypeContainer::Populate): Also method definitions can
9208 fail now, keep track of this.
9210 (TypeContainer::FindMembers): Implement support for
9211 DeclaredOnly/noDeclaredOnly flag.
9213 (Constructor::Emit) Return the ConstructorBuilder.
9215 (Method::Emit) Return the MethodBuilder.
9216 Check for abstract or virtual methods to be public.
9218 * rootcontext.cs (RootContext::CreateType): Register all the
9219 abstract methods required for the class to be complete and the
9220 interface methods that must be implemented.
9222 * cs-parser.jay: Report error 501 (method requires body if it is
9223 not marked abstract or extern).
9225 * expression.cs (TypeOf::Emit): Implement.
9227 * typemanager.cs: runtime_handle_type, new global type.
9229 * class.cs (Property::Emit): Generate code for properties.
9231 2001-10-02 Ravi Pratap <ravi@ximian.com>
9233 * expression.cs (Unary::ResolveOperator): Find operators on base type
9234 too - we now conform exactly to the spec.
9236 (Binary::ResolveOperator): Same here.
9238 * class.cs (Operator::Define): Fix minor quirk in the tests.
9240 * ../errors/cs0215.cs : Added.
9242 * ../errors/cs0556.cs : Added.
9244 * ../errors/cs0555.cs : Added.
9246 2001-10-01 Miguel de Icaza <miguel@ximian.com>
9248 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
9249 single integer which is really efficient
9251 2001-10-01 Ravi Pratap <ravi@ximian.com>
9253 * expression.cs (Expression::ImplicitUserConversion): Use location
9254 even in the case when we are examining True operators.
9256 * class.cs (Operator::Define): Perform extensive checks to conform
9257 with the rules for operator overloading in the spec.
9259 * expression.cs (Expression::ImplicitReferenceConversion): Implement
9260 some of the other conversions mentioned in the spec.
9262 * typemanager.cs (array_type): New static member for the System.Array built-in
9265 (cloneable_interface): For System.ICloneable interface.
9267 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
9268 we start resolving the tree and populating types.
9270 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
9272 2001-10-01 Miguel de Icaza <miguel@ximian.com>
9274 * expression.cs (Expression::ExprClassFromMemberInfo,
9275 Expression::Literalize): Create literal expressions from
9276 FieldInfos which are literals.
9278 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
9279 type casts, because they were wrong. The test suite in tests
9282 (ImplicitNumericConversion): ushort to ulong requires a widening
9285 Int32 constant to long requires widening cast as well.
9287 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
9288 for integers because the type on the stack is not i4.
9290 2001-09-30 Miguel de Icaza <miguel@ximian.com>
9292 * expression.cs (report118): require location argument.
9294 * parameter.cs: Do not dereference potential null value.
9296 * class.cs: Catch methods that lack the `new' keyword when
9297 overriding a name. Report warnings when `new' is used without
9298 anything being there to override.
9300 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
9302 * class.cs: Only add constructor to hashtable if it is non-null
9303 (as now constructors can fail on define).
9305 (TypeManager, Class, Struct): Take location arguments.
9307 Catch field instance initialization in structs as errors.
9309 accepting_filter: a new filter for FindMembers that is static so
9310 that we dont create an instance per invocation.
9312 (Constructor::Define): Catch errors where a struct constructor is
9315 * cs-parser.jay: Pass location information for various new
9318 * delegate.cs (Delegate): take a location argument.
9320 * driver.cs: Do not call EmitCode if there were problesm in the
9321 Definition of the types, as many Builders wont be there.
9323 * decl.cs (Decl::Decl): Require a location argument.
9325 * cs-tokenizer.cs: Handle properly hex constants that can not fit
9326 into integers, and find the most appropiate integer for it.
9328 * literal.cs: Implement ULongLiteral.
9330 * rootcontext.cs: Provide better information about the location of
9331 failure when CreateType fails.
9333 2001-09-29 Miguel de Icaza <miguel@ximian.com>
9335 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
9338 * expression.cs (Binary::CheckShiftArguments): Add missing type
9340 (Binary::ResolveOperator): Add type to the logical and and logical
9341 or, Bitwise And/Or and Exclusive Or code paths, it was missing
9344 (Binary::DoNumericPromotions): In the case where either argument
9345 is ulong (and most signed types combined with ulong cause an
9346 error) perform implicit integer constant conversions as well.
9348 2001-09-28 Miguel de Icaza <miguel@ximian.com>
9350 * expression.cs (UserImplicitCast): Method should always be
9352 (Invocation::BetterConversion): Simplified test for IntLiteral.
9354 (Expression::ImplicitNumericConversion): Split this routine out.
9355 Put the code that performs implicit constant integer conversions
9358 (Expression::Resolve): Become a wrapper around DoResolve so we can
9359 check eclass and type being set after resolve.
9361 (Invocation::Badness): Remove this dead function
9363 (Binary::ResolveOperator): Do not compute the expensive argumnets
9364 unless we have a union for it.
9366 (Probe::Emit): Is needs to do an isinst and then
9367 compare against null.
9369 (::CanConvert): Added Location argument. If the Location argument
9370 is null (Location.Null), then we do not report errors. This is
9371 used by the `probe' mechanism of the Explicit conversion. We do
9372 not want to generate an error for something that the user
9373 explicitly requested to be casted. But the pipeline for an
9374 explicit cast first tests for potential implicit casts.
9376 So for now, if the Location is null, it means `Probe only' to
9377 avoid adding another argument. Might have to revise this
9380 (ClassCast): New class used to type cast objects into arbitrary
9381 classes (used in Explicit Reference Conversions).
9383 Implement `as' as well.
9385 Reverted all the patches from Ravi below: they were broken:
9387 * The use of `level' as a mechanism to stop recursive
9388 invocations is wrong. That was there just to catch the
9389 bug with a strack trace but not as a way of addressing
9392 To fix the problem we have to *understand* what is going
9393 on and the interactions and come up with a plan, not
9394 just get things going.
9396 * The use of the type conversion cache that I proposed
9397 last night had an open topic: How does this work across
9398 protection domains. A user defined conversion might not
9399 be public in the location where we are applying the
9400 conversion, a different conversion might be selected
9401 (ie, private A->B (better) but public B->A (worse),
9402 inside A, A->B applies, but outside it, B->A will
9405 * On top of that (ie, even if the above is solved),
9406 conversions in a cache need to be abstract. Ie, `To
9407 convert from an Int to a Short use an OpcodeCast', not
9408 `To convert from an Int to a Short use the OpcodeCast on
9409 the variable 5' (which is what this patch was doing).
9411 2001-09-28 Ravi Pratap <ravi@ximian.com>
9413 * expression.cs (Invocation::ConversionExists): Re-write to use
9414 the conversion cache
9416 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
9417 cache all conversions done, not just user-defined ones.
9419 (Invocation::BetterConversion): The real culprit. Use ConversionExists
9420 to determine if a conversion exists instead of acutually trying to
9421 perform the conversion. It's faster too.
9423 (Expression::ConvertExplicit): Modify to use ConversionExists to check
9424 and only then attempt the implicit conversion.
9426 2001-09-28 Ravi Pratap <ravi@ximian.com>
9428 * expression.cs (ConvertImplicit): Use a cache for conversions
9429 already found. Check level of recursion and bail out if necessary.
9431 2001-09-28 Miguel de Icaza <miguel@ximian.com>
9433 * typemanager.cs (string_concat_string_string, string_concat_object_object):
9434 Export standard methods that we expect for string operations.
9436 * statement.cs (Block::UsageWarning): Track usage of variables and
9437 report the errors for not used variables.
9439 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
9442 2001-09-27 Miguel de Icaza <miguel@ximian.com>
9444 * codegen.cs: remove unnneded code
9446 * expression.cs: Removed BuiltinTypeAccess class
9448 Fix the order in which implicit conversions are
9451 The previous fixed dropped support for boxed conversions (adding a
9452 test to the test suite now)
9454 (UserImplicitCast::CanConvert): Remove test for source being null,
9455 that code is broken. We should not feed a null to begin with, if
9456 we do, then we should track the bug where the problem originates
9457 and not try to cover it up here.
9459 Return a resolved expression of type UserImplicitCast on success
9460 rather than true/false. Ravi: this is what I was talking about,
9461 the pattern is to use a static method as a "constructor" for
9464 Also, do not create arguments until the very last minute,
9465 otherwise we always create the arguments even for lookups that
9466 will never be performed.
9468 (UserImplicitCast::Resolve): Eliminate, objects of type
9469 UserImplicitCast are born in a fully resolved state.
9471 * typemanager.cs (InitCoreTypes): Init also value_type
9474 * expression.cs (Cast::Resolve): First resolve the child expression.
9476 (LValue): Add new method AddressOf to be used by
9479 Change the argument of Store to take an EmitContext instead of an
9480 ILGenerator, because things like FieldExpr need to be able to call
9481 their children expression to generate the instance code.
9483 (Expression::Error, Expression::Warning): Sugar functions for
9486 (Expression::MemberLookup): Accept a TypeContainer instead of a
9487 Report as the first argument.
9489 (Expression::ResolvePrimary): Killed. I still want to improve
9490 this as currently the code is just not right.
9492 (Expression::ResolveMemberAccess): Simplify, but it is still
9495 (Unary::Resolve): Catch errors in AddressOf operators.
9497 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
9498 index to a byte for the short-version, or the compiler will choose
9499 the wrong Emit call, which generates the wrong data.
9501 (ParameterReference::Emit, ::Store): same.
9503 (FieldExpr::AddressOf): Implement.
9505 * typemanager.cs: TypeManager: made public variable instead of
9508 * driver.cs: document --fatal.
9510 * report.cs (ErrorMessage, WarningMessage): new names for the old
9511 Error and Warning classes.
9513 * cs-parser.jay (member_access): Turn built-in access to types
9514 into a normal simplename
9516 2001-09-27 Ravi Pratap <ravi@ximian.com>
9518 * expression.cs (Invocation::BetterConversion): Fix to cope
9519 with q being null, since this was introducing a bug.
9521 * expression.cs (ConvertImplicit): Do built-in conversions first.
9523 2001-09-27 Ravi Pratap <ravi@ximian.com>
9525 * expression.cs (UserImplicitCast::Resolve): Fix bug.
9527 2001-09-27 Ravi Pratap <ravi@ximian.com>
9529 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
9530 I had introduced long ago (what's new ?).
9532 * expression.cs (UserImplicitCast::CanConvert): Static method to do
9533 the work of all the checking.
9534 (ConvertImplicit): Call CanConvert and only then create object if necessary.
9535 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
9537 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
9538 that is the right way.
9540 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
9541 overloading resolution. Use everywhere instead of cutting and pasting code.
9543 (Binary::ResolveOperator): Use MakeUnionSet.
9545 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
9546 we have to convert to bool types. Not complete yet.
9548 2001-09-27 Miguel de Icaza <miguel@ximian.com>
9550 * typemanager.cs (TypeManager::CSharpName): support ushort.
9552 * expression.cs (Expression::TryImplicitIntConversion): Attempts
9553 to provide an expression that performsn an implicit constant int
9554 conversion (section 6.1.6).
9555 (Expression::ConvertImplicitRequired): Reworked to include
9556 implicit constant expression conversions.
9558 (Expression::ConvertNumericExplicit): Finished.
9560 (Invocation::Emit): If InstanceExpression is null, then it means
9561 that we perform a call on this.
9563 2001-09-26 Miguel de Icaza <miguel@ximian.com>
9565 * expression.cs (Unary::Emit): Remove some dead code.
9566 (Probe): Implement Resolve and Emit for `is'.
9567 (Expression::ConvertImplicitRequired): Attempt to do constant
9568 expression conversions here. Maybe should be moved to
9569 ConvertImplicit, but I am not sure.
9570 (Expression::ImplicitLongConstantConversionPossible,
9571 Expression::ImplicitIntConstantConversionPossible): New functions
9572 that tell whether is it possible to apply an implicit constant
9573 expression conversion.
9575 (ConvertNumericExplicit): Started work on explicit numeric
9578 * cs-parser.jay: Update operator constants.
9580 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
9581 (Parameters::GetSignature): Hook up VerifyArgs here.
9582 (Parameters::VerifyArgs): Verifies that no two arguments have the
9585 * class.cs (Operator): Update the operator names to reflect the
9586 ones that the spec expects (as we are just stringizing the
9589 * expression.cs (Unary::ResolveOperator): Fix bug: Use
9590 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
9591 previous usage did only work for our methods.
9592 (Expression::ConvertImplicit): Handle decimal implicit numeric
9593 conversions as well.
9594 (Expression::InternalTypeConstructor): Used to invoke constructors
9595 on internal types for default promotions.
9597 (Unary::Emit): Implement special handling for the pre/post
9598 increment/decrement for overloaded operators, as they need to have
9599 the same semantics as the other operators.
9601 (Binary::ResolveOperator): ditto.
9602 (Invocation::ConversionExists): ditto.
9603 (UserImplicitCast::Resolve): ditto.
9605 2001-09-26 Ravi Pratap <ravi@ximian.com>
9607 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
9608 operator, return after emitting body. Regression tests pass again !
9610 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
9611 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
9612 (Invocation::OverloadResolve): Ditto.
9613 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
9615 * everywhere : update calls to the above methods accordingly.
9617 2001-09-26 Miguel de Icaza <miguel@ximian.com>
9619 * assign.cs (Assign): Make it inherit from ExpressionStatement.
9621 * expression.cs (ExpressionStatement): New base class used for
9622 expressions that can appear in statements, so that we can provide
9623 an alternate path to generate expression that do not leave a value
9626 (Expression::Emit, and all the derivatives): We no longer return
9627 whether a value is left on the stack or not. Every expression
9628 after being emitted leaves a single value on the stack.
9630 * codegen.cs (EmitContext::EmitStatementExpression): Use the
9631 facilties of ExpressionStatement if possible.
9633 * cs-parser.jay: Update statement_expression.
9635 2001-09-25 Miguel de Icaza <miguel@ximian.com>
9637 * driver.cs: Change the wording of message
9639 2001-09-25 Ravi Pratap <ravi@ximian.com>
9641 * expression.cs (Binary::ResolveOperator): Had forgottten to set
9642 the type of the expression to the return type of the method if
9643 we have an overloaded operator match ! The regression tests pass again !
9644 (Unary::ResolveOperator): Ditto.
9646 * expression.cs (Invocation::ConversionExists): Correct the member lookup
9647 to find "op_Implicit", not "implicit" ;-)
9648 (UserImplicitCast): New class to take care of user-defined implicit conversions.
9649 (ConvertImplicit, ForceConversion): Take TypeContainer argument
9651 * everywhere : Correct calls to the above accordingly.
9653 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
9654 (ConvertImplicit): Do user-defined conversion if it exists.
9656 2001-09-24 Miguel de Icaza <miguel@ximian.com>
9658 * assign.cs: track location.
9659 (Resolve): Use implicit conversions on assignment.
9661 * literal.cs: Oops. Not good, Emit of short access values should
9662 pass (Bytes) or the wrong argument will be selected.
9664 * expression.cs (Unary::Emit): Emit code for -expr.
9666 (Unary::ResolveOperator): Handle `Substract' for non-constants
9667 (substract from zero from the non-constants).
9668 Deal with Doubles as well.
9670 (Expression::ConvertImplicitRequired): New routine that reports an
9671 error if no implicit conversion exists.
9673 (Invocation::OverloadResolve): Store the converted implicit
9674 expressions if we make them
9676 2001-09-24 Ravi Pratap <ravi@ximian.com>
9678 * class.cs (ConstructorInitializer): Take a Location argument.
9679 (ConstructorBaseInitializer): Same here.
9680 (ConstructorThisInitializer): Same here.
9682 * cs-parser.jay : Update all calls accordingly.
9684 * expression.cs (Unary, Binary, New): Take location argument.
9685 Update accordingly everywhere.
9687 * cs-parser.jay : Update all calls to the above to take a location
9692 2001-09-24 Ravi Pratap <ravi@ximian.com>
9694 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
9695 (Invocation::BetterConversion): Same here
9696 (Invocation::ConversionExists): Ditto.
9698 (Invocation::ConversionExists): Implement.
9700 2001-09-22 Ravi Pratap <ravi@ximian.com>
9702 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
9703 Also take an additional TypeContainer argument.
9705 * All over : Pass in TypeContainer as argument to OverloadResolve.
9707 * typemanager.cs (CSharpName): Update to check for the string type and return
9710 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
9713 2001-09-21 Ravi Pratap <ravi@ximian.com>
9715 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
9716 (Invocation::BetterFunction): Implement.
9717 (Invocation::BetterConversion): Implement.
9718 (Invocation::ConversionExists): Skeleton, no implementation yet.
9720 Okay, things work fine !
9722 2001-09-21 Miguel de Icaza <miguel@ximian.com>
9724 * typemanager.cs: declare and load enum_type, delegate_type and
9727 * expression.cs (Expression::Emit): Now emit returns a value that
9728 tells whether a value is left on the stack or not. This strategy
9729 might be reveted tomorrow with a mechanism that would address
9730 multiple assignments.
9731 (Expression::report118): Utility routine to report mismatches on
9734 (Unary::Report23): Report impossible type/operator combination
9737 (Unary::IsIncrementableNumber): Whether the type can be
9738 incremented or decremented with add.
9739 (Unary::ResolveOperator): Also allow enumerations to be bitwise
9741 (Unary::ResolveOperator): Implement ++, !, ~,
9743 (Invocation::Emit): Deal with new Emit convetion.
9745 * All Expression derivatives: Updated their Emit method to return
9746 whether they leave values on the stack or not.
9748 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
9749 stack for expressions that are statements.
9751 2001-09-20 Miguel de Icaza <miguel@ximian.com>
9753 * expression.cs (LValue): New interface. Must be implemented by
9755 (LocalVariableReference, ParameterReference, FieldExpr): Implement
9758 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
9759 interface for generating code, simplifies the code.
9761 2001-09-20 Ravi Pratap <ravi@ximian.com>
9763 * expression.cs (everywhere): Comment out return statements in ::Resolve
9764 methods to avoid the warnings.
9766 2001-09-20 Miguel de Icaza <miguel@ximian.com>
9768 * driver.cs (parse): Report error 2001 if we can not open the
9771 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
9774 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
9777 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
9778 otherwise nested blocks end up with the same index.
9780 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
9782 * expression.cs: Instead of having FIXMEs in the Resolve
9783 functions, throw exceptions so it is obvious that we are facing a
9786 * cs-parser.jay (invocation_expression): Pass Location information.
9788 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
9789 Use a basename for those routines because .NET does not like paths
9792 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
9795 2001-09-19 Miguel de Icaza <miguel@ximian.com>
9797 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
9798 are loading the correct data types (throws an exception if not).
9799 (TypeManager::InitCoreTypes): Use CoreLookupType
9801 * expression.cs (Unary::ResolveOperator): return the child
9802 expression for expressions which are just +expr.
9803 (Unary::ResolveOperator): Return negative literals for -LITERAL
9804 expressions (otherwise they are Unary {Literal}).
9805 (Invocation::Badness): Take into account `Implicit constant
9806 expression conversions'.
9808 * literal.cs (LongLiteral): Implement long literal class.
9809 (IntLiteral): export the `Value' of the intliteral.
9811 2001-09-19 Ravi Pratap <ravi@ximian.com>
9813 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
9815 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
9816 instead of 'Operator'
9818 * expression.cs (Binary::ResolveOperator): Update accordingly.
9819 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
9822 * cs-parser.jay (unary_expression): Update to use the new names.
9824 * gen-treedump.cs (GetUnary): Same here.
9826 * expression.cs (Unary::Resolve): Implement.
9827 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
9828 operators are found instead of making noise ;-)
9829 (Unary::ResolveOperator): New method to do precisely the same thing which
9830 Binary::ResolveOperator does for Binary expressions.
9831 (Unary.method, .Arguments): Add.
9832 (Unary::OperName): Implement.
9833 (Unary::ForceConversion): Copy and Paste !
9835 * class.cs (Operator::Define): Fix a small bug for the case when we have
9838 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
9839 for the inbuilt operators. Only overloading works for now ;-)
9841 2001-09-18 Miguel de Icaza <miguel@ximian.com>
9843 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
9844 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
9846 * expression.cs (This::Emit): Implement.
9847 (This::Resolve): Implement.
9848 (TypeOf:Resolve): Implement.
9849 (Expression::ResolveSimpleName): Add an implicit this to instance
9851 (MemberAccess::Resolve): Deal with Parameters and Fields.
9852 Bind instance variable to Field expressions.
9853 (FieldExpr::Instance): New field used to track the expression that
9854 represents the object instance.
9855 (FieldExpr::Resolve): Track potential errors from MemberLookup not
9857 (FieldExpr::Emit): Implement.
9859 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
9860 the last instruction contains a return opcode to avoid generating
9861 the last `ret' instruction (this generates correct code, and it is
9862 nice to pass the peverify output).
9864 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
9865 initializer for static and instance variables.
9866 (Constructor::Emit): Allow initializer to be null in the case of
9867 static constructors. Only emit initializer for instance
9870 (TypeContainer::FindMembers): Return a null array if there are no
9873 Also fix the code for the MemberTypes.Method branch, as it was not
9874 scanning that for operators (or tried to access null variables before).
9876 * assign.cs (Assign::Emit): Handle instance and static fields.
9880 * driver.cs: Stop compilation if there are parse errors.
9882 * cs-parser.jay (constructor_declaration): Provide default base
9883 initializer for non-static constructors.
9884 (constructor_declarator): Do not provide a default base
9885 initializers if none was specified.
9886 Catch the fact that constructors should not have parameters.
9888 * class.cs: Do not emit parent class initializers for static
9889 constructors, that should be flagged as an error.
9891 2001-09-18 Ravi Pratap <ravi@ximian.com>
9893 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
9894 Move back code into TypeContainer::Populate.
9896 2001-09-18 Ravi Pratap <ravi@ximian.com>
9898 * class.cs (TypeContainer::AddConstructor): Fix the check to
9899 compare against Name, not Basename.
9900 (Operator::OpType): Change Plus and Minus to Add and Subtract.
9902 * cs-parser.jay : Update accordingly.
9904 * class.cs (TypeContainer::FindMembers): For the case where we are searching
9905 for methods, don't forget to look into the operators too.
9906 (RegisterMethodBuilder): Helper method to take care of this for
9907 methods, constructors and operators.
9908 (Operator::Define): Completely revamp.
9909 (Operator.OperatorMethod, MethodName): New fields.
9910 (TypeContainer::Populate): Move the registering of builders into
9911 RegisterMethodBuilder.
9912 (Operator::Emit): Re-write.
9914 * expression.cs (Binary::Emit): Comment out code path to emit method
9915 invocation stuff for the case when we have a user defined operator. I am
9916 just not able to get it right !
9918 2001-09-17 Miguel de Icaza <miguel@ximian.com>
9920 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
9923 (Expression::MemberLookup): Provide a version that allows to
9924 specify the MemberTypes and BindingFlags.
9926 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
9927 so it was not fetching variable information from outer blocks.
9929 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
9930 Beforefieldinit as it was buggy.
9932 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
9935 * class.cs (Constructor::Emit): Only emit if block is not null.
9936 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
9937 deal with this by semantically definining it as if the user had
9940 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
9941 constructors as we now "emit" them at a higher level.
9943 (TypeContainer::DefineDefaultConstructor): Used to define the
9944 default constructors if none was provided.
9946 (ConstructorInitializer): Add methods Resolve and Emit.
9948 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
9950 2001-09-17 Ravi Pratap <ravi@ximian.com>
9952 * class.cs (TypeContainer::EmitDefaultConstructor): Register
9953 the default constructor builder with our hashtable for methodbuilders
9956 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
9957 and argument_count is 0 in which case we have a match.
9958 (Binary::ResolveOperator): More null checking and miscellaneous coding
9961 2001-09-17 Ravi Pratap <ravi@ximian.com>
9963 * rootcontext.cs (IsNameSpace): Compare against null.
9965 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
9967 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
9968 and Unary::Operator.
9970 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
9973 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
9974 we have overloaded operators.
9975 (Binary::ResolveOperator): Implement the part which does the operator overload
9978 * class.cs (Operator::Emit): Implement.
9979 (TypeContainer::Emit): Emit the operators we have too.
9981 * expression.cs (Binary::Emit): Update to emit the appropriate code for
9982 the case when we have a user-defined operator.
9984 2001-09-17 Miguel de Icaza <miguel@ximian.com>
9986 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
9988 2001-09-16 Ravi Pratap <ravi@ximian.com>
9990 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
9991 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
9992 (Constructor::Emit): Implement.
9993 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
9994 if we have no work to do.
9995 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
9998 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
9999 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
10001 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
10004 2001-09-15 Ravi Pratap <ravi@ximian.com>
10006 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
10008 (Tree::RecordNamespace): Method to do what the name says ;-)
10009 (Tree::Namespaces): Property to get at the namespaces hashtable.
10011 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
10014 * rootcontext.cs (IsNamespace): Fixed it :-)
10016 2001-09-14 Miguel de Icaza <miguel@ximian.com>
10018 * class.cs (TypeContainer::FindMembers): Add support for
10020 (MethodCore): New class that encapsulates both the shared aspects
10021 of a Constructor and a Method.
10022 (Method, Constructor): Factored pieces into MethodCore.
10024 * driver.cs: Added --fatal which makes errors throw exceptions.
10025 Load System assembly as well as part of the standard library.
10027 * report.cs: Allow throwing exceptions on errors for debugging.
10029 * modifiers.cs: Do not use `parent', instead use the real type
10030 container to evaluate permission settings.
10032 * class.cs: Put Ravi's patch back in. He is right, and we will
10033 have to cope with the
10035 2001-09-14 Ravi Pratap <ravi@ximian.com>
10037 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
10038 FamORAssem, not FamANDAssem.
10040 2001-09-14 Miguel de Icaza <miguel@ximian.com>
10042 * driver.cs: Added --parse option that only parses its input files
10045 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
10046 incorrect. IsTopLevel is not used to tell whether an object is
10047 root_types or not (that can be achieved by testing this ==
10048 root_types). But to see if this is a top-level *class* (not
10049 necessarly our "toplevel" container).
10051 2001-09-14 Ravi Pratap <ravi@ximian.com>
10053 * enum.cs (Enum::Define): Modify to call the Lookup method on the
10054 parent instead of a direct call to GetType.
10056 2001-09-14 Ravi Pratap <ravi@ximian.com>
10058 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
10059 Modifiers.TypeAttr. This should just be a call to that method.
10061 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
10062 object so that we can determine if we are top-level or not.
10064 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
10067 * enum.cs (Enum::Define): Ditto.
10069 * modifiers.cs (FieldAttr): Re-write.
10071 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
10072 (TypeContainer::HaveStaticConstructor): New property to provide access
10073 to precisely that info.
10075 * modifiers.cs (MethodAttr): Re-write.
10076 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
10078 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
10079 of top-level types as claimed.
10081 2001-09-13 Miguel de Icaza <miguel@ximian.com>
10083 * expression.cs (MemberLookup): Fruitless attempt to lookup
10084 constructors. Maybe I need to emit default constructors? That
10085 might be it (currently .NET emits this for me automatically).
10086 (Invocation::OverloadResolve): Cope with Arguments == null.
10087 (Invocation::EmitArguments): new function, shared by the new
10088 constructor and us.
10089 (Invocation::Emit): Handle static and instance methods. Emit
10090 proper call instruction for virtual or non-virtual invocations.
10091 (New::Emit): Implement.
10092 (New::Resolve): Implement.
10093 (MemberAccess:Resolve): Implement.
10094 (MethodGroupExpr::InstanceExpression): used conforming to the spec
10095 to track instances.
10096 (FieldExpr::Resolve): Set type.
10098 * support.cs: Handle empty arguments.
10100 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
10101 SimpleLookup): Auxiliary routines to help parse a qualifier
10104 Update qualifier_identifier rule.
10106 * codegen.cs: Removed debugging messages.
10108 * class.cs: Make this a global thing, this acts just as a "key" to
10109 objects that we might have around.
10111 (Populate): Only initialize method_builders_to_methods once.
10113 * expression.cs (PropertyExpr): Initialize type from the
10116 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
10117 Resolve pattern. Attempt to implicitly convert value to boolean.
10120 * expression.cs: Set the type for the int32/int32 argument case.
10121 (Binary::ResolveOperator): Set the return type to boolean for
10122 comparission operators
10124 * typemanager.cs: Remove debugging print code.
10126 (Invocation::Resolve): resolve type.
10128 * class.cs: Allocate a MemberInfo of the correct size, as the code
10129 elsewhere depends on the test to reflect the correct contents.
10131 (Method::) Keep track of parameters, due to System.Reflection holes
10133 (TypeContainer::Populate): Keep track of MethodBuilders to Method
10136 (TypeContainer::FindMembers): Use ArrayList and then copy an array
10137 of the exact size and return that.
10139 (Class::LookupMethodByBuilder): New function that maps
10140 MethodBuilders to its methods. Required to locate the information
10141 on methods because System.Reflection bit us again.
10143 * support.cs: New file, contains an interface ParameterData and
10144 two implementations: ReflectionParameters and InternalParameters
10145 used to access Parameter information. We will need to grow this
10148 * expression.cs (Invocation::GetParameterData): implement a cache
10149 and a wrapper around the ParameterData creation for methods.
10150 (Invocation::OverloadResolve): Use new code.
10152 2001-09-13 Ravi Pratap <ravi@ximian.com>
10154 * class.cs (TypeContainer::EmitField): Remove and move into
10155 (Field::Define): here and modify accordingly.
10156 (Field.FieldBuilder): New member.
10157 (TypeContainer::Populate): Update accordingly.
10158 (TypeContainer::FindMembers): Implement.
10160 2001-09-13 Miguel de Icaza <miguel@ximian.com>
10162 * statement.cs: (VariableInfo::VariableType): New field to be
10163 initialized with the full type once it is resolved.
10165 2001-09-12 Miguel de Icaza <miguel@ximian.com>
10167 * parameter.cs (GetParameterInfo): Use a type cache to compute
10168 things only once, and to reuse this information
10170 * expression.cs (LocalVariableReference::Emit): Implement.
10171 (OpcodeCast::Emit): fix.
10173 (ParameterReference::Resolve): Implement.
10174 (ParameterReference::Emit): Implement.
10176 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
10177 that are expressions need to stay as Expressions.
10179 * typemanager.cs (CSharpName): Returns the C# name of a type if
10182 * expression.cs (Expression::ConvertImplicit): New function that
10183 implements implicit type conversions.
10185 (Expression::ImplicitReferenceConversion): Implements implicit
10186 reference conversions.
10188 (EmptyCast): New type for transparent casts.
10190 (OpcodeCast): New type for casts of types that are performed with
10191 a sequence of bytecodes.
10193 (BoxedCast): New type used for casting value types into reference
10194 types. Emits a box opcode.
10196 (Binary::DoNumericPromotions): Implements numeric promotions of
10197 and computation of the Binary::Type.
10199 (Binary::EmitBranchable): Optimization.
10201 (Binary::Emit): Implement code emission for expressions.
10203 * typemanager.cs (TypeManager): Added two new core types: sbyte
10206 2001-09-12 Ravi Pratap <ravi@ximian.com>
10208 * class.cs (TypeContainer::FindMembers): Method which does exactly
10209 what Type.FindMembers does, only we don't have to use reflection. No
10210 implementation yet.
10212 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
10213 typecontainer objects as we need to get at them.
10214 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
10216 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
10217 typecontainer object.
10219 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
10220 of just a Report object.
10222 2001-09-11 Ravi Pratap <ravi@ximian.com>
10224 * class.cs (Event::Define): Go back to using the prefixes "add_" and
10226 (TypeContainer::Populate): Now define the delegates of the type too.
10227 (TypeContainer.Delegates): Property to access the list of delegates defined
10230 * delegates.cs (Delegate::Define): Implement partially.
10232 * modifiers.cs (TypeAttr): Handle more flags.
10234 2001-09-11 Ravi Pratap <ravi@ximian.com>
10236 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
10238 (Operator::Define): Re-write logic to get types by using the LookupType method
10239 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
10240 (Indexer::Define): Ditto.
10241 (Event::Define): Ditto.
10242 (Property::Define): Ditto.
10244 2001-09-10 Ravi Pratap <ravi@ximian.com>
10246 * class.cs (TypeContainer::Populate): Now define operators too.
10247 (TypeContainer.Operators): New property to access the list of operators
10249 (Operator.OperatorMethodBuilder): New member to hold the method builder
10250 for the operator we are defining.
10251 (Operator::Define): Implement.
10253 2001-09-10 Ravi Pratap <ravi@ximian.com>
10255 * class.cs (Event::Define): Make the prefixes of the accessor methods
10256 addOn_ and removeOn_
10258 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
10259 of the location being passed in too. Ideally, this should go later since all
10260 error reporting should be done through the Report object.
10262 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
10263 (Populate): Iterate thru the indexers we have and define them too.
10264 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
10265 for the get and set accessors.
10266 (Indexer::Define): Implement.
10268 2001-09-09 Miguel de Icaza <miguel@ximian.com>
10270 * expression.cs (Binary::Resolve): Beginning of it. I scratched
10271 my previous implementation, did not work.
10273 * typemanager.cs: Add a couple of missing types (the longs).
10275 * literal.cs: Use TypeManager.bool_type instead of getting it.
10277 * expression.cs (EventExpr): New kind of expressions.
10278 (Expressio::ExprClassFromMemberInfo): finish
10280 2001-09-08 Miguel de Icaza <miguel@ximian.com>
10282 * assign.cs: Emit stores to static fields differently.
10284 2001-09-08 Ravi Pratap <ravi@ximian.com>
10286 * Merge in changes and adjust code to tackle conflicts. Backed out my
10287 code in Assign::Resolve ;-)
10289 2001-09-08 Ravi Pratap <ravi@ximian.com>
10291 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
10292 instead Report.Error and also pass in the location.
10293 (CSharpParser::Lexer): New readonly property to return the reference
10294 to the Tokenizer object.
10295 (declare_local_variables): Use Report.Error with location instead of plain
10299 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
10300 (Operator.CheckBinaryOperator): Ditto.
10302 * cs-parser.jay (operator_declarator): Update accordingly.
10304 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
10305 (CheckBinaryOperator): Same here.
10307 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
10308 on the name without any prefixes of namespace names etc. This is because we
10309 already might have something already fully qualified like
10310 'System.Console.WriteLine'
10312 * assign.cs (Resolve): Begin implementation. Stuck ;-)
10314 2001-09-07 Ravi Pratap <ravi@ximian.com>
10316 * cs-tokenizer.cs (location): Return a string which also contains
10319 * expression.cs (ElementAccess): New class for expressions of the
10320 type 'element access.'
10321 (BaseAccess): New class for expressions of the type 'base access.'
10322 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
10325 * cs-parser.jay (element_access): Implement action.
10326 (base_access): Implement actions.
10327 (checked_expression, unchecked_expression): Implement.
10329 * cs-parser.jay (local_variable_type): Correct and implement.
10330 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
10332 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
10334 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
10335 name and the specifiers.
10337 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
10339 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
10340 making them all public ;-)
10342 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
10345 2001-09-07 Miguel de Icaza <miguel@ximian.com>
10347 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
10349 (FieldExpr, PropertyExprs): New resolved expressions.
10350 (SimpleName::MemberStaticCheck): Perform static checks for access
10351 to non-static fields on static methods. Maybe this should be
10352 generalized for MemberAccesses.
10353 (SimpleName::ResolveSimpleName): More work on simple name
10356 * cs-parser.jay (primary_expression/qualified_identifier): track
10357 the parameter index.
10359 * codegen.cs (CodeGen::Save): Catch save exception, report error.
10360 (EmitContext::EmitBoolExpression): Chain to expression generation
10361 instead of temporary hack.
10362 (::EmitStatementExpression): Put generic expression code generation.
10364 * assign.cs (Assign::Emit): Implement variable assignments to
10365 local variables, parameters and fields.
10367 2001-09-06 Miguel de Icaza <miguel@ximian.com>
10369 * statement.cs (Block::GetVariableInfo): New method, returns the
10370 VariableInfo for a variable name in a block.
10371 (Block::GetVariableType): Implement in terms of GetVariableInfo
10373 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
10374 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
10376 2001-09-06 Ravi Pratap <ravi@ximian.com>
10378 * cs-parser.jay (operator_declaration): Continue on my quest : update
10379 to take attributes argument.
10380 (event_declaration): Ditto.
10381 (enum_declaration): Ditto.
10382 (indexer_declaration): Ditto.
10384 * class.cs (Operator::Operator): Update constructor accordingly.
10385 (Event::Event): Ditto.
10387 * delegate.cs (Delegate::Delegate): Same here.
10389 * enum.cs (Enum::Enum): Same here.
10391 2001-09-05 Ravi Pratap <ravi@ximian.com>
10393 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
10395 * ../tests/cs0658.cs : New file to demonstrate error 0658.
10397 * attribute.cs (Attributes): New class to encapsulate all attributes which were
10398 being passed around as an arraylist.
10399 (Attributes::AddAttribute): Method to add attribute sections.
10401 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
10402 (struct_declaration): Update accordingly.
10403 (constant_declaration): Update.
10404 (field_declaration): Update.
10405 (method_header): Update.
10406 (fixed_parameter): Update.
10407 (parameter_array): Ditto.
10408 (property_declaration): Ditto.
10409 (destructor_declaration): Ditto.
10411 * class.cs (Struct::Struct): Update constructors accordingly.
10412 (Class::Class): Ditto.
10413 (Field::Field): Ditto.
10414 (Method::Method): Ditto.
10415 (Property::Property): Ditto.
10416 (TypeContainer::OptAttribute): update property's return type.
10418 * interface.cs (Interface.opt_attributes): New member.
10419 (Interface::Interface): Update to take the extra Attributes argument.
10421 * parameter.cs (Parameter::Parameter): Ditto.
10423 * constant.cs (Constant::Constant): Ditto.
10425 * interface.cs (InterfaceMemberBase): New OptAttributes field.
10426 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
10427 the attributes as a parameter.
10428 (InterfaceProperty): Update constructor call.
10429 (InterfaceEvent): Ditto.
10430 (InterfaceMethod): Ditto.
10431 (InterfaceIndexer): Ditto.
10433 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
10434 pass the attributes too.
10435 (interface_event_declaration): Ditto.
10436 (interface_property_declaration): Ditto.
10437 (interface_method_declaration): Ditto.
10438 (interface_declaration): Ditto.
10440 2001-09-05 Miguel de Icaza <miguel@ximian.com>
10442 * class.cs (Method::Define): Track the "static Main" definition to
10443 create an entry point.
10445 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
10446 EntryPoint if we find it.
10448 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
10449 (EmitContext::ig): Make this variable public.
10451 * driver.cs: Make the default output file be the first file name
10452 with the .exe extension.
10454 Detect empty compilations
10456 Handle various kinds of output targets. Handle --target and
10457 rename -t to --dumper.
10459 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
10460 methods inherited from Expression return now an Expression. This
10461 will is used during the tree rewriting as we resolve them during
10464 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
10465 the spec. Missing entirely is the information about
10466 accessability of elements of it.
10468 (Expression::ExprClassFromMemberInfo): New constructor for
10469 Expressions that creates a fully initialized Expression based on
10470 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
10473 (Invocation::Resolve): Begin implementing resolution of invocations.
10475 * literal.cs (StringLiteral): Implement Emit.
10477 2001-09-05 Ravi Pratap <ravi@ximian.com>
10479 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
10482 2001-09-04 Ravi Pratap <ravi@ximian.com>
10484 * cs-parser.jay (attribute_arguments): Implement actions.
10485 (attribute): Fix bug in production. Implement action.
10486 (attribute_list): Implement.
10487 (attribute_target): Implement.
10488 (attribute_target_specifier, opt_target_specifier): Implement
10489 (CheckAttributeTarget): New method to check if the attribute target
10491 (attribute_section): Implement.
10492 (opt_attributes): Implement.
10494 * attribute.cs : New file to handle attributes.
10495 (Attribute): Class to hold attribute info.
10497 * cs-parser.jay (opt_attribute_target_specifier): Remove production
10498 (attribute_section): Modify production to use 2 different rules to
10499 achieve the same thing. 1 s/r conflict down !
10500 Clean out commented, useless, non-reducing dimension_separator rules.
10502 * class.cs (TypeContainer.attributes): New member to hold list
10503 of attributes for a type.
10504 (Struct::Struct): Modify to take one more argument, the attribute list.
10505 (Class::Class): Ditto.
10506 (Field::Field): Ditto.
10507 (Method::Method): Ditto.
10508 (Property::Property): Ditto.
10510 * cs-parser.jay (struct_declaration): Update constructor call to
10511 pass in the attributes too.
10512 (class_declaration): Ditto.
10513 (constant_declaration): Ditto.
10514 (field_declaration): Ditto.
10515 (method_header): Ditto.
10516 (fixed_parameter): Ditto.
10517 (parameter_array): Ditto.
10518 (property_declaration): Ditto.
10520 * constant.cs (Constant::Constant): Update constructor similarly.
10521 Use System.Collections.
10523 * parameter.cs (Parameter::Parameter): Update as above.
10525 2001-09-02 Ravi Pratap <ravi@ximian.com>
10527 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
10528 (TypeContainer.delegates): New member to hold list of delegates.
10530 * cs-parser.jay (delegate_declaration): Implement the action correctly
10531 this time as I seem to be on crack ;-)
10533 2001-09-02 Miguel de Icaza <miguel@ximian.com>
10535 * rootcontext.cs (RootContext::IsNamespace): new function, used to
10536 tell whether an identifier represents a namespace.
10538 * expression.cs (NamespaceExpr): A namespace expression, used only
10539 temporarly during expression resolution.
10540 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
10541 utility functions to resolve names on expressions.
10543 2001-09-01 Miguel de Icaza <miguel@ximian.com>
10545 * codegen.cs: Add hook for StatementExpressions.
10547 * class.cs: Fix inverted test for static flag in methods.
10549 2001-09-02 Ravi Pratap <ravi@ximian.com>
10551 * class.cs (Operator::CheckUnaryOperator): Correct error number used
10552 to make it coincide with MS' number.
10553 (Operator::CheckBinaryOperator): Ditto.
10555 * ../errors/errors.txt : Remove error numbers added earlier.
10557 * ../errors/cs1019.cs : Test case for error # 1019
10559 * ../errros/cs1020.cs : Test case for error # 1020
10561 * cs-parser.jay : Clean out commented cruft.
10562 (dimension_separators, dimension_separator): Comment out. Ostensibly not
10563 used anywhere - non-reducing rule.
10564 (namespace_declarations): Non-reducing rule - comment out.
10566 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
10567 with TypeContainer::AddEnum.
10569 * delegate.cs : New file for delegate handling classes.
10570 (Delegate): Class for declaring delegates.
10572 * makefile : Update.
10574 * cs-parser.jay (delegate_declaration): Implement.
10576 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
10578 * class.cs (Event::Define): Implement.
10579 (Event.EventBuilder): New member.
10581 * class.cs (TypeContainer::Populate): Update to define all enums and events
10583 (Events): New property for the events arraylist we hold. Shouldn't we move to using
10584 readonly fields for all these cases ?
10586 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
10588 * class.cs (Property): Revamp to use the convention of making fields readonly.
10589 Accordingly modify code elsewhere.
10591 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
10592 the Define method of the Property class.
10594 * class.cs : Clean up applied patch and update references to variables etc. Fix
10596 (TypeContainer::Populate): Update to define all the properties we have. Also
10597 define all enumerations.
10599 * enum.cs (Define): Implement.
10601 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
10603 * cs-parser.jay (overloadable_operator): The semantic value is an
10604 enum of the Operator class.
10605 (operator_declarator): Implement actions.
10606 (operator_declaration): Implement.
10608 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
10609 validity of definitions.
10610 (Operator::CheckBinaryOperator): Static method to check for binary operators
10611 (TypeContainer::AddOperator): New method to add an operator to a type.
10613 * cs-parser.jay (indexer_declaration): Added line to actually call the
10614 AddIndexer method so it gets added ;-)
10616 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
10617 already taken care of by the MS compiler ?
10619 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
10621 * class.cs (Operator): New class for operator declarations.
10622 (Operator::OpType): Enum for the various operators.
10624 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
10626 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
10627 ostensibly handle this in semantic analysis.
10629 * cs-parser.jay (general_catch_clause): Comment out
10630 (specific_catch_clauses, specific_catch_clause): Ditto.
10631 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
10632 (catch_args, opt_catch_args): New productions.
10633 (catch_clause): Rewrite to use the new productions above
10634 (catch_clauses): Modify accordingly.
10635 (opt_catch_clauses): New production to use in try_statement
10636 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
10637 and re-write the code in the actions to extract the specific and
10638 general catch clauses by being a little smart ;-)
10640 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
10641 Hooray, try and catch statements parse fine !
10643 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
10645 * statement.cs (Block::GetVariableType): Fix logic to extract the type
10646 string from the hashtable of variables.
10648 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
10649 I end up making that mistake ;-)
10650 (catch_clauses): Fixed gross error which made Key and Value of the
10651 DictionaryEntry the same : $1 !!
10653 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
10655 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
10657 * cs-parser.jay (event_declaration): Correct to remove the semicolon
10658 when the add and remove accessors are specified.
10660 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
10662 * cs-parser.jay (IndexerDeclaration): New helper class to hold
10663 information about indexer_declarator.
10664 (indexer_declarator): Implement actions.
10665 (parsing_indexer): New local boolean used to keep track of whether
10666 we are parsing indexers or properties. This is necessary because
10667 implicit_parameters come into picture even for the get accessor in the
10668 case of an indexer.
10669 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
10671 * class.cs (Indexer): New class for indexer declarations.
10672 (TypeContainer::AddIndexer): New method to add an indexer to a type.
10673 (TypeContainer::indexers): New member to hold list of indexers for the
10676 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
10678 * cs-parser.jay (add_accessor_declaration): Implement action.
10679 (remove_accessor_declaration): Implement action.
10680 (event_accessors_declaration): Implement
10681 (variable_declarators): swap statements for first rule - trivial.
10683 * class.cs (Event): New class to hold information about event
10685 (TypeContainer::AddEvent): New method to add an event to a type
10686 (TypeContainer::events): New member to hold list of events.
10688 * cs-parser.jay (event_declaration): Implement actions.
10690 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
10692 * cs-parser.jay (dim_separators): Implement. Make it a string
10693 concatenating all the commas together, just as they appear.
10694 (opt_dim_separators): Modify accordingly
10695 (rank_specifiers): Update accordingly. Basically do the same
10696 thing - instead, collect the brackets here.
10697 (opt_rank_sepcifiers): Modify accordingly.
10698 (array_type): Modify to actually return the complete type string
10699 instead of ignoring the rank_specifiers.
10700 (expression_list): Implement to collect the expressions
10701 (variable_initializer): Implement. We make it a list of expressions
10702 essentially so that we can handle the array_initializer case neatly too.
10703 (variable_initializer_list): Implement.
10704 (array_initializer): Make it a list of variable_initializers
10705 (opt_array_initializer): Modify accordingly.
10707 * expression.cs (New::NType): Add enumeration to help us
10708 keep track of whether we have an object/delegate creation
10709 or an array creation.
10710 (New:NewType, New::Rank, New::Indices, New::Initializers): New
10711 members to hold data about array creation.
10712 (New:New): Modify to update NewType
10713 (New:New): New Overloaded contructor for the array creation
10716 * cs-parser.jay (array_creation_expression): Implement to call
10717 the overloaded New constructor.
10719 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
10721 * class.cs (TypeContainer::Constructors): Return member
10722 constructors instead of returning null.
10724 2001-08-26 Miguel de Icaza <miguel@ximian.com>
10726 * typemanager.cs (InitCoreTypes): Initialize the various core
10727 types after we have populated the type manager with the user
10728 defined types (this distinction will be important later while
10729 compiling corlib.dll)
10731 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
10732 on Expression Classification. Now all expressions have a method
10733 `Resolve' and a method `Emit'.
10735 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
10736 generation from working. Also add some temporary debugging
10739 2001-08-24 Miguel de Icaza <miguel@ximian.com>
10741 * codegen.cs: Lots of code generation pieces. This is only the
10742 beginning, will continue tomorrow with more touches of polish. We
10743 handle the fundamentals of if, while, do, for, return. Others are
10744 trickier and I need to start working on invocations soon.
10746 * gen-treedump.cs: Bug fix, use s.Increment here instead of
10749 * codegen.cs (EmitContext): New struct, used during code
10750 emission to keep a context. Most of the code generation will be
10753 * cs-parser.jay: Add embedded blocks to the list of statements of
10754 this block. So code generation proceeds in a top down fashion.
10756 2001-08-23 Miguel de Icaza <miguel@ximian.com>
10758 * statement.cs: Add support for multiple child blocks.
10760 2001-08-22 Miguel de Icaza <miguel@ximian.com>
10762 * codegen.cs (EmitCode): New function, will emit the code for a
10763 Block of code given a TypeContainer and its ILGenerator.
10765 * statement.cs (Block): Standard public readonly optimization.
10766 (Block::Block constructors): Link children.
10767 (Block::Child): Child Linker.
10768 (Block::EmitVariables): Emits IL variable declarations.
10770 * class.cs: Drop support for MethodGroups here, delay until
10772 (Method::): Applied the same simplification that I did before, and
10773 move from Properties to public readonly fields.
10774 (Method::ParameterTypes): Returns the parameter types for the
10775 function, and implements a cache that will be useful later when I
10776 do error checking and the semantic analysis on the methods is
10778 (Constructor::GetCallingConvention): Renamed from CallingConvetion
10779 and made a method, optional argument tells whether this is a class
10780 or a structure to apply the `has-this' bit.
10781 (Method::GetCallingConvention): Implement, returns the calling
10783 (Method::Define): Defines the type, a second pass is performed
10784 later to populate the methods.
10786 (Constructor::ParameterTypes): implement a cache similar to the
10787 one on Method::ParameterTypes, useful later when we do semantic
10790 (TypeContainer::EmitMethod): New method. Emits methods.
10792 * expression.cs: Removed MethodGroup class from here.
10794 * parameter.cs (Parameters::GetCallingConvention): new method.
10796 2001-08-21 Miguel de Icaza <miguel@ximian.com>
10798 * class.cs (TypeContainer::Populate): Drop RootContext from the
10801 (Constructor::CallingConvention): Returns the calling convention.
10802 (Constructor::ParameterTypes): Returns the constructor parameter
10805 (TypeContainer::AddConstructor): Keep track of default constructor
10806 and the default static constructor.
10808 (Constructor::) Another class that starts using `public readonly'
10809 instead of properties.
10811 (Constructor::IsDefault): Whether this is a default constructor.
10813 (Field::) use readonly public fields instead of properties also.
10815 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
10816 track of static constructors; If none is used, turn on
10817 BeforeFieldInit in the TypeAttributes.
10819 * cs-parser.jay (opt_argument_list): now the return can be null
10820 for the cases where there are no arguments.
10822 (constructor_declarator): If there is no implicit `base' or
10823 `this', then invoke the default parent constructor.
10825 * modifiers.cs (MethodAttr): New static function maps a set of
10826 modifiers flags into a MethodAttributes enum
10827 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
10828 MethodAttr, TypeAttr to represent the various mappings where the
10829 modifiers are used.
10830 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
10832 2001-08-19 Miguel de Icaza <miguel@ximian.com>
10834 * parameter.cs (GetParameterInfo): Fix bug where there would be no
10837 * interface.cs (PopulateIndexer): Implemented the code generator
10838 for interface indexers.
10840 2001-08-17 Miguel de Icaza <miguel@ximian.com>
10842 * interface.cs (InterfaceMemberBase): Now we track the new status
10845 (PopulateProperty): Implement property population. Woohoo! Got
10846 Methods and Properties going today.
10848 Removed all the properties for interfaces, and replaced them with
10849 `public readonly' fields.
10851 2001-08-16 Miguel de Icaza <miguel@ximian.com>
10853 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
10854 initialize their hashtables/arraylists only when they are needed
10855 instead of doing this always.
10857 * parameter.cs: Handle refs and out parameters.
10859 * cs-parser.jay: Use an ArrayList to construct the arguments
10860 instead of the ParameterCollection, and then cast that to a
10863 * parameter.cs: Drop the use of ParameterCollection and use
10864 instead arrays of Parameters.
10866 (GetParameterInfo): Use the Type, not the Name when resolving
10869 2001-08-13 Miguel de Icaza <miguel@ximian.com>
10871 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
10872 and instead use public readonly fields.
10874 * class.cs: Put back walking code for type containers.
10876 2001-08-11 Miguel de Icaza <miguel@ximian.com>
10878 * class.cs (MakeConstant): Code to define constants.
10880 * rootcontext.cs (LookupType): New function. Used to locate types
10883 2001-08-08 Miguel de Icaza <miguel@ximian.com>
10885 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
10886 this System.Reflection code is. Kudos to Microsoft
10888 * typemanager.cs: Implement a type cache and avoid loading all
10889 types at boot time. Wrap in LookupType the internals. This made
10890 the compiler so much faster. Wow. I rule!
10892 * driver.cs: Make sure we always load mscorlib first (for
10893 debugging purposes, nothing really important).
10895 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
10896 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
10898 * rootcontext.cs: Lookup types on their namespace; Lookup types
10899 on namespaces that have been imported using the `using' keyword.
10901 * class.cs (TypeContainer::TypeAttr): Virtualize.
10902 (Class::TypeAttr): Return attributes suitable for this bad boy.
10903 (Struct::TypeAttr): ditto.
10904 Handle nested classes.
10905 (TypeContainer::) Remove all the type visiting code, it is now
10906 replaced with the rootcontext.cs code
10908 * rootcontext.cs (GetClassBases): Added support for structs.
10910 2001-08-06 Miguel de Icaza <miguel@ximian.com>
10912 * interface.cs, statement.cs, class.cs, parameter.cs,
10913 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
10914 Drop use of TypeRefs, and use strings instead.
10916 2001-08-04 Miguel de Icaza <miguel@ximian.com>
10920 * class.cs (Struct::Struct): set the SEALED flags after
10921 checking the modifiers.
10922 (TypeContainer::TypeAttr): new property, returns the
10923 TypeAttributes for a class.
10925 * cs-parser.jay (type_list): Oops, list production was creating a
10926 new list of base types.
10928 * rootcontext.cs (StdLib): New property.
10929 (GetInterfaceTypeByName): returns an interface by type name, and
10930 encapsulates error handling here.
10931 (GetInterfaces): simplified.
10932 (ResolveTree): Encapsulated all the tree resolution here.
10933 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
10936 * driver.cs: Add support for --nostdlib, to avoid loading the
10937 default assemblies.
10938 (Main): Do not put tree resolution here.
10940 * rootcontext.cs: Beginning of the class resolution.
10942 2001-08-03 Miguel de Icaza <miguel@ximian.com>
10944 * rootcontext.cs: Provide better error reporting.
10946 * cs-parser.jay (interface_base): set our $$ to be interfaces.
10948 * rootcontext.cs (CreateInterface): Handle the case where there
10949 are no parent interfaces.
10951 (CloseTypes): Routine to flush types at the end.
10952 (CreateInterface): Track types.
10953 (GetInterfaces): Returns an array of Types from the list of
10954 defined interfaces.
10956 * typemanager.c (AddUserType): Mechanism to track user types (puts
10957 the type on the global type hash, and allows us to close it at the
10960 2001-08-02 Miguel de Icaza <miguel@ximian.com>
10962 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
10963 RecordInterface instead.
10965 * cs-parser.jay: Updated to reflect changes above.
10967 * decl.cs (Definition): Keep track of the TypeBuilder type that
10968 represents this type here. Not sure we will use it in the long
10969 run, but wont hurt for now.
10971 * driver.cs: Smaller changes to accomodate the new code.
10973 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
10976 * rootcontext.cs (CreateInterface): New method, used to create
10977 the System.TypeBuilder type for interfaces.
10978 (ResolveInterfaces): new entry point to resolve the interface
10980 (CodeGen): Property, used to keep track of the code generator.
10982 2001-07-26 Miguel de Icaza <miguel@ximian.com>
10984 * cs-parser.jay: Add a second production for delegate_declaration
10987 (enum_body): Put an opt_comma here instead of putting it on
10988 enum_body or enum_member_declarations so we can handle trailing
10989 commas on enumeration members. Gets rid of a shift/reduce.
10991 (type_list): Need a COMMA in the middle.
10993 (indexer_declaration): Tell tokenizer to recognize get/set
10995 * Remove old targets.
10997 * Re-add the parser target.
10999 2001-07-13 Simon Cozens <simon@simon-cozens.org>
11001 * cs-parser.jay: Add precendence rules for a number of operators
11002 ot reduce the number of shift/reduce conflicts in the grammar.
11004 2001-07-17 Miguel de Icaza <miguel@ximian.com>
11006 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
11009 Get rid of old crufty code.
11011 * rootcontext.cs: Use this to keep track of the parsed
11012 representation and the defined types available to the program.
11014 * gen-treedump.cs: adjust for new convention.
11016 * type.cs: Split out the type manager, and the assembly builder
11019 * typemanager.cs: the type manager will live here now.
11021 * cil-codegen.cs: And the code generator here.
11023 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
11025 * makefile: Fixed up for easy making.
11027 2001-07-13 Simon Cozens <simon@simon-cozens.org>
11029 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
11032 (unary_expression): Expand pre_increment_expression and
11033 post_decrement_expression to reduce a shift/reduce.
11035 2001-07-11 Simon Cozens
11037 * cs-tokenizer.cs: Hex numbers should begin with a 0.
11039 Improve allow_keyword_as_indent name.
11041 2001-06-19 Miguel de Icaza <miguel@ximian.com>
11043 * Adjustments for Beta2.
11045 2001-06-13 Miguel de Icaza <miguel@ximian.com>
11047 * decl.cs: Added `Define' abstract method.
11048 (InTransit): new property, used to catch recursive definitions.
11050 * interface.cs: Implement `Define'.
11052 * modifiers.cs: Map Modifiers.constants to
11053 System.Reflection.TypeAttribute flags.
11055 * class.cs: Keep track of types and user-defined types.
11056 (BuilderInit): New method for creating an assembly
11057 (ResolveType): New function to launch the resolution process, only
11058 used by interfaces for now.
11060 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
11061 that are inserted into the name space.
11063 2001-06-08 Miguel de Icaza <miguel@ximian.com>
11065 * ARGH. I have screwed up my tree so many times due to the use of
11066 rsync rather than using CVS. Going to fix this at once.
11068 * driver.cs: Objetify driver. Load assemblies, use assemblies to
11071 2001-06-07 Miguel de Icaza <miguel@ximian.com>
11073 * Experiment successful: Use System.Type rather that our own
11076 2001-05-25 Miguel de Icaza <miguel@ximian.com>
11078 * cs-parser.jay: Removed nsAliases from here.
11080 Use new namespaces, handle `using XXX;'
11082 * namespace.cs: Reimplemented namespace handling, use a recursive
11083 definition of the class. Now we can keep track of using clauses
11084 and catch invalid using clauses.
11086 2001-05-24 Miguel de Icaza <miguel@ximian.com>
11088 * gen-treedump.cs: Adapted for all the renaming.
11090 * expression.cs (Expression): this class now has a Type property
11091 which returns an expression Type.
11093 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
11094 `Type', as this has a different meaning now in the base
11096 2001-05-22 Miguel de Icaza <miguel@ximian.com>
11098 * interface.cs, class.cs: Removed from all the sources the
11099 references to signature computation, as we can not do method
11100 signature computation during the parsing time, as we are not
11101 trying to solve at that point distinguishing:
11105 void a (NS.Blah x) {}
11108 Which depending on the context might be valid or not, as we do not
11109 know if Blah is the same thing as NS.Blah at that point.
11111 * Redid everything so the code uses TypeRefs now instead of
11112 Types. TypeRefs are just temporary type placeholders, that need
11113 to be resolved. They initially have a pointer to a string and the
11114 current scope in which they are used. This is used later by the
11115 compiler to resolve the reference to an actual Type.
11117 * DeclSpace is no longer a CIR.Type, and neither are
11118 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
11119 are all DeclSpaces, but no Types.
11121 * type.cs (TypeRefManager): This implements the TypeRef manager,
11122 which keeps track of all the types that need to be resolved after
11123 the parsing has finished.
11125 2001-05-13 Miguel de Icaza <miguel@ximian.com>
11127 * ARGH. We are going to have to store `foreach' as a class rather
11128 than resolving it, as we need to verify error 1579 after name
11129 resolution. *OR* we could keep a flag that says `This request to
11130 IEnumerator comes from a foreach statement' which we can then use
11131 to generate the error.
11133 2001-05-10 Miguel de Icaza <miguel@ximian.com>
11135 * class.cs (TypeContainer.AddMethod): we now add methods to the
11136 MethodGroup instead of the method hashtable.
11138 * expression.cs: Add MethodGroup abstraction, which gets us one
11139 step closer to the specification in the way we handle method
11142 * cs-parser.jay (primary_expression): qualified_identifier now
11143 tried to match up an identifier to a local variable reference or
11144 to a parameter reference.
11146 current_local_parameters is now a parser global variable that
11147 points to the current parameters for the block, used during name
11150 (property_declaration): Now creates an implicit `value' argument to
11153 2001-05-09 Miguel de Icaza <miguel@ximian.com>
11155 * parameter.cs: Do not use `param' arguments as part of the
11156 signature, per the spec.
11158 2001-05-08 Miguel de Icaza <miguel@ximian.com>
11160 * decl.cs: Base class for classes, structs and interfaces. This
11161 is the "Declaration Space"
11163 * cs-parser.jay: Use CheckDef for checking declaration errors
11164 instead of having one on each function.
11166 * class.cs: Factor out some code for handling error handling in
11167 accordance to the "Declarations" section in the "Basic Concepts"
11168 chapter in the ECMA C# spec.
11170 * interface.cs: Make all interface member classes derive from
11171 InterfaceMemberBase.
11173 2001-05-07 Miguel de Icaza <miguel@ximian.com>
11175 * Many things: all interfaces are parsed and generated in
11176 gen-treedump. Support for member variables, constructors,
11177 destructors, properties, constants is there.
11179 Beginning of the IL backend, but very little done, just there for
11182 2001-04-29 Miguel de Icaza <miguel@ximian.com>
11184 * cs-parser.jay: Fix labeled statement.
11186 * cs-tokenizer.cs (escape): Escape " and ' always.
11187 ref_line, ref_name: keep track of the line/filename as instructed
11188 by #line by the compiler.
11191 2001-04-27 Miguel de Icaza <miguel@ximian.com>
11193 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
11194 to match the values in System.CodeDOM.
11196 Divid renamed to Divide.
11198 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
11200 (Statements.set): remove.
11202 * System.CodeDOM/CodeCatchClause.cs: always have a valid
11205 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
11206 falseStatements always have valid values.
11208 * cs-parser.jay: Use System.CodeDOM now.