1 2002-03-15 Miguel de Icaza <miguel@ximian.com>
3 * driver.cs: Add support for --resources.
5 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
6 Make all types for the various array helper methods be integer.
8 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
9 CheckState to ConvCast.
11 (ConvCast): Now it takes a `checked' state argument, to avoid
12 depending on the emit context for the conversion, and just using
13 the resolve time setting.
15 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
16 instead of Invocation.EmitArguments. We do not emit the original
17 arguments, instead we emit those which have been converted to
18 unsigned int expressions.
20 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
24 * expression.cs (LocalVariableReference): Drop the use of the
25 Store function that depended on the variable index.
27 * statement.cs (VariableInfo): Drop the `Idx' property from this
28 class, as this is not taking into account the indexes for
29 temporaries tat we generate during the execution, getting the
32 * class.cs: First emit class initializers, then call the parent
35 * expression.cs (Binary): Fix opcode emision.
36 (UnaryMutator.EmitCode): Support checked code generation
38 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
39 matches for events for both the Static and Instance scans,
40 pointing to the same element. Fix that.
42 2002-03-14 Miguel de Icaza <miguel@ximian.com>
44 * rootcontext.cs (ResolveTree): Always set the
45 interface_resolve_order, because nested interfaces will be calling
48 * class.cs (GetInterfaceOrClass): Track the same resolution
49 process used by TypeManager.LookupType. This fixes the nested
50 type lookups in class declarations (separate path from
53 (TypeContainer.DefineType): Also define nested interfaces.
54 (TypeContainer.RegisterOrder): New public function used to
55 register the order in which child interfaces need to be closed.
57 Nested interfaces need to be closed after their parents have been
60 * interface.cs (InterfaceAttr): Put all the logic for computing
61 the interface attribute here.
63 (DefineInterface): Register our interface order with the
64 RootContext or with the TypeContainer depending on the case.
66 2002-03-12 Miguel de Icaza <miguel@ximian.com>
68 * cs-parser.jay: rework foreach statement to work with the new
69 changes to the policy on SimpleNames.
71 * report.cs: support Stacktrace on warnings as well.
73 * makefile: drop --unsafe and /unsafe from the compile.
75 2002-03-13 Ravi Pratap <ravi@ximian.com>
77 * ecore.cs (StandardConversionExists): Modify to take an Expression
78 as the first parameter. Ensure we do null -> reference type conversion
81 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
82 temporary Expression objects.
84 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
86 * interface.cs: workaround bug in method overloading resolution
87 (there is already a bugzilla bug for it).
89 2002-03-12 Miguel de Icaza <miguel@ximian.com>
91 We could also solve this problem by having a separate path for
92 performing type lookups, instead of DoResolve, we could have a
93 ResolveType entry point, and only participating pieces of the
94 production (simplename, deref, array) would implement this.
96 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
97 signal SimpleName to only resolve type names and not attempt to
98 resolve anything else.
100 * expression.cs (Cast): Set the flag.
102 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
104 * class.cs: Only report 108 if there is no `new' modifier.
106 * cs-parser.jay: rework foreach statement to work with the new
107 changes to the policy on SimpleNames.
109 * report.cs: support Stacktrace on warnings as well.
111 * makefile: drop --unsafe and /unsafe from the compile.
113 2002-03-11 Miguel de Icaza <miguel@ximian.com>
115 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
116 lookups here, instead of doing that at parse time. This means
117 that our grammar will not introduce `LocalVariableReferences' as
118 expressions at this point. That solves the problem of code like
126 This is only half the fix. The full fix requires parameters to
127 also be handled in this way.
129 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
130 makes the use more obvious of the DeclSpace. The
131 ec.TypeContainer.TypeBuilder is now only used to pull the
134 My theory is that I can get rid of the TypeBuilder completely from
135 the EmitContext, and have typecasts where it is used (from
136 DeclSpace to where it matters).
138 The only pending problem is that the code that implements Aliases
139 is on TypeContainer, and probably should go in DeclSpace.
141 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
142 lookups here, instead of doing that at parse time. This means
143 that our grammar will not introduce `LocalVariableReferences' as
144 expressions at this point. That solves the problem of code like
152 This is only half the fix. The full fix requires parameters to
153 also be handled in this way.
155 * class.cs (Property.DefineMethod): When implementing an interface
156 method, set newslot, when implementing an abstract method, do not
157 set the flag (before we tried never setting it, or always setting
158 it, which is the difference).
159 (Indexer.DefineMethod): same.
160 (Method.DefineMethod): same.
162 * ecore.cs: Only set the status used flag if we get back a Field.
164 * attribute.cs: Temporary hack, so Paolo can keep working.
166 2002-03-08 Ravi Pratap <ravi@ximian.com>
168 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
169 the unmanaged type in the case we have a MarshalAs attribute.
171 (Resolve): Handle the case when we are parsing the special MarshalAs
172 attribute [we need to store the unmanaged type to use later]
174 * typemanager.cs (marshal_as_attr_type): Built in type for the
177 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
178 on parameters and accordingly set the marshalling info.
180 2002-03-09 Miguel de Icaza <miguel@ximian.com>
182 * class.cs: Optimizing slightly by removing redundant code after
183 we switched to the `NoTypes' return value.
184 (Property.DefineMethod): use NoTypes here too.
186 This fixes the bug I introduced in my last batch of changes.
188 2002-03-05 Ravi Pratap <ravi@ximian.com>
190 * tree.cs (RecordEnum): Add. We now keep track of enums too.
192 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
193 Enums since those are types too.
195 * cs-parser.jay (enum_declaration): Record enums as we parse them.
197 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
198 thanks to a call during the lookup process.
200 2002-03-07 Miguel de Icaza <miguel@ximian.com>
202 * statement.cs (Foreach): Lots of work to accomodate a particular
203 kind of foreach statement that I had not kept in mind. It is
204 possible to have foreachs on classes that provide a GetEnumerator
205 method that return objects that implement the "pattern" for using
206 a foreach, there is no need to support GetEnumerator
209 This is needed to compile nant.
211 * decl.cs: Only report 114 if the member is not `Finalize' and if
212 the warning level is at least 2.
214 * class.cs: Moved the compare function from Method to
217 (MethodSignature.InheritableMemberSignatureCompare): Add new
218 filter function that is used to extract inheritable methods from a
221 (Method.Define): Use the new `inheritable_method_signature_filter'
224 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
227 2002-03-06 Miguel de Icaza <miguel@ximian.com>
229 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
231 * cs-parser.jay: Add opt_semicolon to the interface declaration.
233 * expression.cs: Pass location information to
234 ConvertImplicitStandard.
236 * class.cs: Added debugging code to track return values from
239 2002-03-05 Miguel de Icaza <miguel@ximian.com>
241 * expression.cs (Is.DoResolve): If either side of the `is' is an
242 interface, do not flag the warning.
244 * ecore.cs (ImplicitReferenceConversion): We need a separate test
247 * report.cs: Allow for --fatal to be used with --probe.
249 * typemanager.cs (NoTypes): Move the definition for the empty Type
252 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
254 (TypeContainer.DefineProxy): New function used to proxy to parent
255 implementations when implementing interfaces.
256 (TypeContainer.ParentImplements): used to lookup if our parent
257 implements a public function that is required by an interface.
258 (TypeContainer.VerifyPendingMethods): Hook this up.
260 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
261 `modules' and `assemblies' arraylists into arrays. We only grow
262 these are the very early start up of the program, so this improves
263 the speedof LookupType (nicely measured).
265 * expression.cs (MakeByteBlob): Replaced unsafe code with
266 BitConverter, as suggested by Paolo.
268 * cfold.cs (ConstantFold.Binary): Special case: perform constant
269 folding of string concatenation, but if either side is a string,
270 and the other is not, then return null, and let the runtime use
271 the concatenation on the string plus the object (using
274 2002-03-04 Miguel de Icaza <miguel@ximian.com>
276 Constant Folding has been implemented now.
278 * expression.cs (Unary.Reduce): Do not throw an exception, catch
279 the error instead on types that are not supported in one's
282 * constant.cs (Constant and all children): New set of functions to
283 perform implict and explicit conversions.
285 * ecore.cs (EnumConstant): Implement the new functions to perform
286 conversion by proxying to the child expression.
288 * codegen.cs: (ConstantCheckState): Constant evaluation has its
289 own separate setting that can not be turned off from the command
290 line using --unchecked or --checked and is only controlled using
291 the checked/unchecked statements and expressions. This setting is
292 used by the constant folder to flag errors.
294 * expression.cs (CheckedExpr, UncheckedExpr): Set the
295 ConstantCheckState as well.
297 During Resolve, they also have to flag the state, because the
298 constant folder runs completely in the Resolve phase.
300 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
303 2002-03-01 Miguel de Icaza <miguel@ximian.com>
305 * cfold.cs: New file, this file contains the constant folder.
307 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
308 argument to track whether we are using the resulting address to
309 load or store a value and provide better error messages.
311 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
312 new AddressOf arguments.
314 * statement.cs (Foreach.EmitCollectionForeach): Update
316 * expression.cs (Argument.Emit): Call AddressOf with proper
317 arguments to track usage.
319 (New.DoEmit): Call AddressOf with new arguments.
321 (Unary.Emit): Adjust AddressOf call.
323 2002-03-01 Ravi Pratap <ravi@ximian.com>
325 * cs-parser.jay (member_access): Change the case for pre-defined types
326 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
329 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
332 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
333 essentially like methods and apply attributes like MethodImplOptions to them too.
335 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
338 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
339 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
342 * Update code everywhere accordingly.
344 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
346 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
348 2002-02-28 Ravi Pratap <ravi@ximian.com>
350 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
351 try performing lookups against those instead of jumping straight into using
354 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
356 (LookupType): Perform lookups in implicit parents too.
358 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
359 sequence as RootContext.LookupType.
361 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
362 the various cases of namespace lookups into this method.
364 2002-03-01 Miguel de Icaza <miguel@ximian.com>
366 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
367 in positional arguments)
369 * class.cs (Operator): Update the AllowedModifiers to contain
372 * cs-parser.jay: Update operator declaration to allow for the
373 operator body to be empty.
375 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
378 2002-02-27 Miguel de Icaza <miguel@ximian.com>
380 * class.cs (Method.Emit): Label parameters.
382 * driver.cs: Return 1 or 0 as the program exit code.
384 2002-02-26 Miguel de Icaza <miguel@ximian.com>
386 * expression.cs: Special case the `null' object when trying to
387 auto-compute the type, as anything can be explicitly converted to
390 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
393 (Expression.ImplicitNumericConversion): Perform comparissions of
394 the type using the underlying type in the case of an enumeration
395 rather than using the enumeration type for the compare.
397 Cope with the underlying == type case, which is not possible to
400 (Expression.ConvertNumericExplicit): Perform comparissions of
401 the type using the underlying type in the case of an enumeration
402 rather than using the enumeration type for the compare.
404 * driver.cs: If the user does not supply an extension, assume .exe
406 * cs-parser.jay (if_statement): Rewrote so that we can track the
407 location for the if statement.
409 * expression.cs (Binary.ConstantFold): Only concat strings when
410 the operation is "+", not everything ;-)
412 * statement.cs (Statement.EmitBoolExpression): Take a location
414 (If, While, Do): Track location.
416 * expression.cs (Binary.ResolveOperator): In the object + string
417 case, I was missing a call to ConvertImplicit
419 2002-02-25 Ravi Pratap <ravi@ximian.com>
421 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
422 Location arguments. Ensure we use RootContext.LookupType to do our work
423 and not try to do a direct Type.GetType and ModuleBuilder.GetType
425 * interface.cs (PopulateMethod): Handle the type of the parameter being
428 * expression.cs (Invocation.BetterFunction): Handle the case when we
429 have a params method with no fixed arguments and a call is made with no
432 2002-02-25 Miguel de Icaza <miguel@ximian.com>
434 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
435 the verbatim-string-literal
437 * support.cs (InternalParameters.ParameterModifier): handle null
439 (InternalParameters.ParameterType): ditto.
441 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
442 duplicating the name of the variable parameter.
443 (GetParameterByName): Fix bug where we were not looking up array
444 paramters if they were the only present (thanks Paolo!).
445 (GetParameterInfo): We only have an empty set of types if both
446 fixed and array are set to null.
447 (GetParameterInfo-idx): Handle FixedParameter == null
449 * cs-parser.jay: Handle the case where there is no catch
450 statements (missing null test).
452 2002-02-22 Miguel de Icaza <miguel@ximian.com>
454 * driver.cs (MainDriver): Be conservative on our command line
457 Catch DirectoryNotFoundException when calling GetFiles.
459 (SplitPathAndPattern): Used to split the input specification into
460 a path and a pattern that we can feed to Directory.GetFiles.
462 2002-02-21 Miguel de Icaza <miguel@ximian.com>
464 * statement.cs (Fixed): Implement the last case of the Fixed
465 statement (string handling).
467 * expression.cs (StringPtr): New class used to return a char * to
468 a string; Used by the Fixed statement.
470 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
472 * expression.cs (Binary.ResolveOperator): Remove redundant
473 MemberLookup pn parent type.
474 Optimize union call, we do not need a union if the types are the same.
475 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
478 Specialize the use of MemberLookup everywhere, instead of using
479 the default settings.
481 (StackAlloc): Implement stackalloc keyword.
483 * cs-parser.jay: Add rule to parse stackalloc.
485 * driver.cs: Handle /h, /help, /?
487 * expression.cs (MakeByteBlob): Removed the hacks we had in place
488 before we supported unsafe code.
490 * makefile: add --unsafe to the self compilation of mcs.
492 2002-02-20 Miguel de Icaza <miguel@ximian.com>
494 * expression.cs (PointerArithmetic): New class that is used to
495 perform pointer arithmetic.
496 (Binary.Resolve): Handle pointer arithmetic
497 Handle pointer comparission.
498 (ArrayPtr): Utility expression class that is used to take the
501 (ElementAccess): Implement array access for pointers
503 * statement.cs (Fixed): Implement fixed statement for arrays, we
504 are missing one more case before we are done.
506 * expression.cs (Indirection): Implement EmitAssign and set the
507 ExprClass to Variable. This allows pointer dereferences to be
508 treated as variables, and to have values assigned to them.
510 * ecore.cs (Expression.StoreFromPtr): New utility function to
511 store values dereferencing.
513 2002-02-20 Ravi Pratap <ravi@ximian.com>
515 * expression.cs (Binary.ResolveOperator): Ensure that we are
516 not trying to operate on a void type - this fixes the reported
519 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
520 the parent implementation is sealed.
522 * ../errors/cs0239.cs : Add.
524 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
526 * typemanager.cs (unverifiable_code_type): Corresponds to
527 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
528 which have unsafe code in them.
530 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
533 2002-02-19 Miguel de Icaza <miguel@ximian.com>
535 * cs-tokenizer.cs: Add support for @"litreal strings"
537 Make tokenizer accept pre-processor directives
538 on any column (remove the old C-like limitation).
540 * rootcontext.cs (EmitCode): Emit any global attributes.
541 (AddGlobalAttributes): Used to keep track of assembly attributes.
543 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
545 * cs-parser.jay: Add support for global attributes.
547 2002-02-17 Miguel de Icaza <miguel@ximian.com>
549 * expression.cs (Indirection): New helper class. Unary will
550 create Indirection classes to be able to implement the
551 IMemoryLocation interface on it.
553 2002-02-16 Miguel de Icaza <miguel@ximian.com>
555 * cs-parser.jay (fixed_statement): reference the right statement.
557 * statement.cs (Fixed.Emit): Finish implementing the fixed
558 statement for the &x case.
560 2002-02-14 Miguel de Icaza <miguel@ximian.com>
562 * class.cs (Property.Define, Method.Define): Remove newslot when
565 * modifiers.cs: My use of NewSlot when `Abstract' was set was
566 wrong. NewSlot should only be used if the `new' keyword is present.
568 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
569 locating our system dir. Sorry about this.
571 2002-02-13 Miguel de Icaza <miguel@ximian.com>
573 * driver.cs (GetSystemDir): Compute correctly the location of our
574 system assemblies. I was using the compiler directory instead of
575 the library directory.
577 2002-02-13 Ravi Pratap <ravi@ximian.com>
579 * expression.cs (BetterFunction): Put back in what Miguel commented out
580 since it is the correct fix. The problem is elsewhere ;-)
582 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
583 parameters of the parms method are themselves compatible or not !
585 (StandardConversionExists): Fix very dangerous bug where we were forgetting
586 to check that a class implements an interface before saying that an implicit
587 conversion was allowed. Use ImplementsInterface to do the checking.
589 2002-02-13 Miguel de Icaza <miguel@ximian.com>
591 * class.cs (Method.Define): Track whether we are an explicit
592 implementation or not. And only call DefineMethodOverride if we
593 are an explicit implementation.
595 (Property.DefineMethod): Ditto.
597 2002-02-11 Ravi Pratap <ravi@ximian.com>
599 * expression.cs (BetterFunction): Catch hideous bug which was
600 preventing us from detecting ambiguous calls due to implicit casts i.e
603 2002-01-29 Miguel de Icaza <miguel@ximian.com>
605 * support.cs (Pair): Remove un-needed method. I figured why I was
606 getting the error in cs-parser.jay, the variable in a foreach loop
607 is readonly, and the compiler does not really treat this as a variable.
609 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
610 instead of EQUALS in grammar.
612 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
614 * expression.cs (Unary.DoResolve): Check whether the argument is
617 2002-01-28 Miguel de Icaza <miguel@ximian.com>
619 * support.cs: Api for Pair to set a value. Despite the fact that
620 the variables are public the MS C# compiler refuses to compile
621 code that accesses the field if the variable is part of a foreach
624 * statement.cs (Fixed): Begin implementation of the fixed
627 (Block.AddVariable): Return the VariableInfo on success and null
628 on failure instead of true/false.
630 * cs-parser.jay (foreach): Catch errors on variables already
631 defined (we were ignoring this value before) and properly unwind
634 (fixed_statement): grammar for the fixed statement.
636 2002-01-25 Miguel de Icaza <miguel@ximian.com>
638 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
639 pointer types to be incretemented.
643 * cs-parser.jay (pointer_member_access): Implement
644 expr->IDENTIFIER production.
646 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
647 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
650 (Unary): Implement indirection.
652 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
653 use in non-unsafe context).
655 (SimpleName.DoResolve): Check for pointers in field access on safe
658 (Expression.LoadFromPtr): Factor the load-indirect code in this
659 function. This was duplicated in UnboxCast and ParameterReference
661 2002-01-24 Miguel de Icaza <miguel@ximian.com>
663 * expression.cs (ComposedCast): report an error if a pointer cast
664 is used in a safe region.
666 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
667 pointer type casts in unsafe context.
669 * codegen.cs (EmitContext): Set up IsUnsafe.
671 * cs-parser.jay (non_expression_type): Add productions for pointer
674 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
675 code. We should not use force into static mode if the method is
676 not virtual. Fixes bug in MIS
678 * statement.cs (Do.Emit, While.Emit, For.Emit,
679 Statement.EmitBoolExpression): Add support to Do and While to
680 propagate infinite loop as `I do return' semantics.
682 Improve the For case to also test for boolean constants.
684 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
685 to the list of attributes we can add.
687 Remove `EmitContext' argument.
689 * class.cs (Method.Define): Apply parameter attributes.
690 (Constructor.Define): Apply parameter attributes.
691 (MethodCore.LabelParameters): Move here the core of labeling
694 * support.cs (ReflectionParameters.ParameterModifier,
695 InternalParameters.ParameterModifier): Use IsByRef on the type and
696 only return the OUT bit for these parameters instead of in/out/ref
699 This is because I miss-understood things. The ParameterInfo.IsIn
700 and IsOut represent whether the parameter has the [In] and [Out]
703 2002-01-22 Miguel de Icaza <miguel@ximian.com>
705 * ecore.cs (FieldExpr.Emit): Release temporaries.
707 * assign.cs (LocalTemporary.Release): new function.
709 * codegen.cs (EmitContext.GetTemporaryStorage,
710 EmitContext.FreeTemporaryStorage): Rework the way we deal with
711 temporary storage. Now we can "put back" localbuilders when we
714 2002-01-21 Miguel de Icaza <miguel@ximian.com>
716 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
717 need to make a copy of the variable to generate verifiable code.
719 2002-01-19 Miguel de Icaza <miguel@ximian.com>
721 * driver.cs: Compute dynamically the system directory.
723 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
724 Slower, but more generally useful. Used by the abstract
725 registering implementation.
727 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
728 the rules for the special rule on Type/instances. First check if
729 we have the same name, and if so, try that special static path
730 rather than the instance path.
732 2002-01-18 Miguel de Icaza <miguel@ximian.com>
734 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
737 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
738 Enum, ValueType, Delegate or Array for non-corlib compiles.
740 * cs-tokenizer.cs: Catch long identifiers (645)
742 * typemanager.cs (IndexerPropetyName): Ravi never tested this
745 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
746 fix, we were returning too early, so we were not registering
747 pending methods from abstract classes.
749 Do not register pending methods if the class is abstract.
751 * expression.cs (Conditional.DoResolve): Report circular implicit
752 conversions when we neecd to compute it for conditional
755 (Is.DoResolve): If the expression is always of the provided type,
756 flag warning 183. If the expression can not ever be of the
757 provided type flag warning 184.
759 * class.cs: Catch 169 as well.
761 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
764 2002-01-18 Nick Drochak <ndrochak@gol.com>
766 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
768 2002-01-17 Miguel de Icaza <miguel@ximian.com>
770 * interface.cs: (PopulateMethod): Check for pointers being defined
771 only if the unsafe context is active.
772 (PopulateProperty): ditto.
773 (PopulateIndexer): ditto.
775 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
776 specified. If pointers are present, make sure that they are
777 present in an unsafe context.
778 (Constructor, Constructor.Define): ditto.
779 (Field, Field.Define): ditto.
780 (Property, Property.Define): ditto.
781 (Event, Event.Define): ditto.
783 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
784 hashtable if there are classes or structs defined.
786 * expression.cs (LocalVariableReference.DoResolve): Simplify this
787 code, as the constant resolution moved.
789 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
790 the metadata, so we can flag error 133.
792 * decl.cs (MemberCore.UnsafeOK): New function to test that a
793 pointer is being declared in an unsafe context.
795 2002-01-16 Miguel de Icaza <miguel@ximian.com>
797 * modifiers.cs (Modifiers.Check): Require a Location argument.
798 Report error 227 for Unsafe use.
800 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
802 * statement.cs (For.Emit): If the test is null, then report that
803 we do `return', as we wont reach anything afterwards.
805 (Switch.SwitchGoverningType): Track the expression that matched
808 * driver.cs: Allow negative numbers as an error code to flag.
810 * cs-parser.jay: Handle 1551.
812 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
814 2002-01-15 Miguel de Icaza <miguel@ximian.com>
816 * cs-parser.jay: Report 1518 (type declaration can only contain
817 class, struct, interface, enum or delegate)
819 (switch_label): Report 1523 (keywords `case' or `default' must
822 (opt_switch_sections): Report 1522 (empty switch)
824 * driver.cs: Report 1515 (response file specified multiple times)
825 Report 1516 (Source file specified multiple times).
827 * expression.cs (Argument.Resolve): Signal 1510
829 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
830 access not allowed in static code)
832 2002-01-11 Ravi Pratap <ravi@ximian.com>
834 * typemanager.cs (IsPointerType): Utility method which we are going
837 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
838 the object type, so we take care of that.
840 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
842 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
843 added to non-params parameters :-)
845 * typemanager.cs (CSharpName): Include 'void' type too.
847 (void_ptr_type): Include in the set of core types.
849 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
852 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
855 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
856 completely forgotten about it.
858 2002-01-10 Ravi Pratap <ravi@ximian.com>
860 * cs-parser.jay (pointer_type): Add. This begins our implementation
861 of parsing rules for unsafe code.
863 (unsafe_statement): Implement.
865 (embedded_statement): Modify to include the above.
867 * statement.cs (Unsafe): Implement new class for unsafe blocks.
869 * codegen.cs (EmitContext.InUnsafe): Add. This determines
870 if the current context is an unsafe one.
872 * cs-parser.jay (local_variable_pointer_type): Since local variable types
873 are handled differently, we need separate rules for them.
875 (local_variable_declaration): Update to use local_variable_pointer_type
876 to allow variable declarations of unmanaged pointer types.
878 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
881 * ../errors/cs0214.cs : Add.
883 2002-01-16 Nick Drochak <ndrochak@gol.com>
885 * makefile: remove 'response' file when cleaning.
887 2002-01-15 Miguel de Icaza <miguel@ximian.com>
889 * cs-parser.jay: Report 1524.
891 2002-01-14 Miguel de Icaza <miguel@ximian.com>
893 * typemanager.cs (RegisterMethod): drop checking if we have
894 registered this from here
896 2002-01-12 Miguel de Icaza <miguel@ximian.com>
898 * class.cs (Method.EmitDestructor): Implement calling our base
901 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
904 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
905 this routine and will wrap the call in a try/catch block. Deal
908 2002-01-11 Miguel de Icaza <miguel@ximian.com>
910 * ecore.cs (Expression.MemberLookup): instead of taking a
911 parameter `same_type' that was used to tell whether we could
912 access private members we compute our containing type from the
915 (FieldExpr): Added partial support for volatile fields. This does
916 not work for volatile fields exposed from assemblies, as I can not
917 figure out how to extract the modreq from it.
919 Updated all the source files to use this.
921 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
922 because it is referenced by MemberLookup very often.
924 2002-01-09 Ravi Pratap <ravi@ximian.com>
926 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
927 TypeBuilder.GetCustomAttributes to retrieve what we need.
929 Get rid of redundant default_member_attr_type as this is the same as
930 default_member_type which already exists.
932 * interface.cs, attribute.cs : Update accordingly.
934 2002-01-08 Miguel de Icaza <miguel@ximian.com>
936 * typemanager.cs: Enable IndexerPropertyName again. It does not
937 work for TYpeBuilders though. Ravi, can you please fix this?
939 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
941 * expression.cs (Argument.Emit): Handle the case of ref objects
942 being passed to ref functions;
944 (ParameterReference.EmitLoad): Loads the content of the pointer
945 without dereferencing.
947 2002-01-07 Miguel de Icaza <miguel@ximian.com>
949 * cs-tokenizer.cs: Implemented the pre-processing expressions.
951 2002-01-08 Ravi Pratap <ravi@ximian.com>
953 * class.cs (Indexer.DefineMethod): Incorporate the interface
954 type in the name of the method if we are doing explicit interface
957 * expression.cs (ConversionExists): Remove as it is completely obsolete.
959 (BetterConversion): Fix extremely trivial bug where we were referring to
960 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
963 * ../errors/bug16.cs : Add although we have fixed it.
965 2002-01-07 Miguel de Icaza <miguel@ximian.com>
967 * expression.cs (BaseIndexer): Begin implementation.
969 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
971 * cs-parser.jay (indexer_declarator): Use qualified_identifier
972 production directly to remove a shift/reduce, and implement
973 explicit interface implementation.
975 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
976 after a floating point suffix.
978 * expression.cs (DoNumericPromotions): Improved the conversion for
979 uint/uint. If we have a constant, we avoid doing a typecast to a
982 * class.cs (Indexer): Implement explicit interface implementation
985 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
987 * class.cs: make the default instance constructor public and hidebysig.
989 2001-01-03 Ravi Pratap <ravi@ximian.com>
991 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
992 so we can call it from elsewhere.
994 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
995 we emit it internally if the class has a defined indexer; otherwise the user
996 emits it by decorating the class definition with the DefaultMemberAttribute.
998 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
999 attribute is not used on a type which defines an indexer.
1001 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
1002 character when we skip whitespace.
1004 * ../errors/cs0646.cs : Add.
1006 2002-01-03 Miguel de Icaza <miguel@ximian.com>
1008 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
1011 * makefile: Add practical target `mcs3.exe' which builds the third
1012 generation compiler.
1014 * expression.cs (New): Fix structures constructor calling.
1016 * class.cs (Property, Method, Indexer): Emit Final flag on the
1017 method if we are an interface implementation and we are not
1020 * ecore.cs (PropertyExpr): New public field `IsBase', tells
1021 whether this property is referencing a `base' method.
1023 * expression.cs (Invocation.EmitCall): take an extra argument:
1024 is_base, this is used to determine whether the `call' or
1025 `callvirt' opcode should be used.
1028 * delegate.cs: update EmitCall.
1030 * class.cs (Method.Define): Set NewSlot for the cases where we are
1031 not implementing an interface method.
1033 (Property.Define): ditto.
1035 2002-01-02 Miguel de Icaza <miguel@ximian.com>
1037 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
1038 'r'. Allows mcs to parse itself fully.
1040 2002-01-02 Ravi Pratap <ravi@ximian.com>
1042 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
1043 of the number of initializers that require the InitializeArray method.
1045 (CheckIndices): Store the Expression in all cases - not the plain value. Also
1046 update the above field where necessary.
1048 (MakeByteBlob): Update accordingly.
1050 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
1053 (EmitDynamicInitializers): Update in accordance with the new optimization.
1055 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
1056 same OpCode applies.
1058 * cs-parser.jay : Fix some glaring errors I introduced.
1060 2002-01-01 Ravi Pratap <ravi@ximian.com>
1062 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
1063 so that we can check for name clashes there too.
1065 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
1066 for interface indexers.
1068 * interfaces.cs (Define): Emit the default member attribute.
1070 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
1071 variable was being referred to while setting the value ;-)
1073 2002-01-01 Miguel de Icaza <miguel@ximian.com>
1075 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
1076 byte-by-byte information when we know the data is zero.
1078 Make the block always a multiple of 4, because
1079 DefineInitializedData has a bug.
1081 * assign.cs: Fix, we should assign from the temporary, not from
1084 * expression.cs (MakeByteBlob): Fix my incorrect code.
1086 2001-12-31 Miguel de Icaza <miguel@ximian.com>
1088 * typemanager.cs (EnumToUnderlying): This function is used to get
1089 the underlying type from an enumeration, because it does not
1092 * constant.cs: Use the I4_S form for values between -128 and 127.
1094 * statement.cs (Block.LookupLabel): Looks up a label.
1095 (Block): Drop support for labeled blocks.
1097 (LabeledStatement): New kind of statement that represents a label
1100 (Goto): Finally implement this bad boy.
1102 * cs-parser.jay: Update to reflect new mechanism to implement
1105 2001-12-30 Miguel de Icaza <miguel@ximian.com>
1107 * codegen.cs (EmitContext.This): a codegen property that keeps the
1108 a single instance of this instead of creating many different this
1111 * delegate.cs (Delegate.DoResolve): Update to use the property;
1113 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
1115 * expression.cs (BaseAccess.DoResolve): Ditto.
1117 2001-12-29 Ravi Pratap <ravi@ximian.com>
1119 * typemanager.cs (methodimpl_attr_type): Add to hold the type
1120 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
1122 (InitCoreTypes): Update accordingly.
1124 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
1125 so we can quickly store the state.
1127 (ApplyAttributes): Set the correct implementation flags
1128 for InternalCall methods.
1130 2001-12-29 Miguel de Icaza <miguel@ximian.com>
1132 * expression.cs (EmitCall): if a method is not virtual, then do
1133 not use callvirt on it.
1135 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
1136 user defined stuff) requires the use of stobj, which takes an
1137 address on the stack instead of an array and an index. So emit
1138 the Ldelema operation for it.
1140 (EmitStoreOpcode): Use stobj for valuetypes.
1142 (UnaryMutator.EmitCode): Use the right 1 value depending on
1143 whether we are dealing with int64/uint64, float or doubles.
1145 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
1146 constructors that I implemented last night.
1148 (Constructor.IsDefault): Fix to work properly for static
1151 * cs-parser.jay (CheckDef): report method signature errors.
1152 Update error number 103 to be 132.
1154 * decl.cs: New AdditionResult enumeration value: MethodExists.
1155 Although we do this check for methods later on in the semantic
1156 analysis, catching repeated default constructors is so easy that
1157 we catch these here.
1159 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
1162 (ParameterReference.EmitAssign, Emit): handle
1165 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
1166 (ArrayAccess.EmitStoreOpcode): ditto.
1168 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
1170 * expression.cs (MakeByteBlob): Complete all the missing types
1171 (uint, short, ushort, byte, sbyte)
1173 * class.cs: Only init instance field initializers on instance
1176 Rename `constructors' to instance_constructors.
1178 (TypeContainer.AddConstructor): Only add constructors to the list
1179 if it is not static.
1181 Make sure that we handle default_static_constructor independently
1182 everywhere where we handle instance_constructors
1184 2001-12-28 Miguel de Icaza <miguel@ximian.com>
1186 * class.cs: Do not lookup or create a base initializer for a
1189 (ConstructorInitializer.Resolve): use the proper type to lookup
1192 * cs-parser.jay: Report error 1585 (modifiers between type and name).
1194 * enum.cs, interface.cs: Remove CloseType, this is taken care by
1197 * decl.cs: CloseType is now an virtual method, the default
1198 implementation just closes this type.
1200 2001-12-28 Ravi Pratap <ravi@ximian.com>
1202 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
1203 to PreserveSig by default. Also emit HideBySig on such methods.
1205 Basically, set the defaults to standard values.
1207 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
1208 argument, if candidate is better, it can't be worse than the best !
1210 (Invocation): Re-write bits to differentiate between methods being
1211 applicable in their expanded form and their normal form - for params
1214 Get rid of use_standard everywhere as only standard conversions are allowed
1215 in overload resolution.
1217 More spec conformance.
1219 2001-12-27 Miguel de Icaza <miguel@ximian.com>
1221 * driver.cs: Add --timestamp, to see where the compiler spends
1224 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
1225 `this' in static code.
1227 (SimpleName.DoResolve): Implement in terms of a helper function
1228 that allows static-references to be passed upstream to
1231 (Expression.ResolveWithSimpleName): Resolve specially simple
1232 names when called by MemberAccess to implement the special
1235 (Expression.ImplicitReferenceConversion): Handle conversions from
1236 Null to reference types before others, as Null's type is
1239 * expression.cs (Invocation.EmitCall): Handle the special case of
1240 calling methods declared on a reference type from a ValueType
1241 (Base classes System.Object and System.Enum)
1243 (MemberAccess.Resolve): Only perform lookups on Enumerations if
1244 the left hand side is a TypeExpr, not on every enumeration.
1246 (Binary.Resolve): If types are reference types, then do a cast to
1247 object on operators != and == of both arguments.
1249 * typemanager.cs (FindMembers): Extract instance and static
1250 members if requested.
1252 * interface.cs (PopulateProperty): Use void_type instead of null
1253 as the return type for the setter method.
1255 (PopulateIndexer): ditto.
1257 2001-12-27 Ravi Pratap <ravi@ximian.com>
1259 * support.cs (ReflectionParameters): Fix minor bug where we
1260 were examining the wrong parameter for the ParamArray attribute.
1262 Cope with requests for the type of the parameter at position
1263 greater than the params parameter's. We now return the element
1264 type of the params array as that makes more sense.
1266 * expression.cs (Invocation.IsParamsMethodApplicable): Update
1267 accordingly as we no longer have to extract the element type
1270 (Invocation.OverloadResolve): Update.
1272 2001-12-27 Miguel de Icaza <miguel@ximian.com>
1274 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
1275 against IEnumerator, test whether the return value is a descendant
1276 of the IEnumerator interface.
1278 * class.cs (Indexer.Define): Use an auxiliary method to implement
1279 the other bits of the method definition. Begin support for
1280 explicit interface implementation.
1282 (Property.DefineMethod): Use TypeManager.void_type instead of null
1283 for an empty return value.
1285 2001-12-26 Miguel de Icaza <miguel@ximian.com>
1287 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
1288 dealing with a FieldExpr which is composed of a FieldBuilder, in
1289 the code path we did extract the constant, but we should have
1290 obtained the underlying value to be able to cast it (otherwise we
1291 end up in an infinite loop, this is what Ravi was running into).
1293 (ArrayCreation.UpdateIndices): Arrays might be empty.
1295 (MemberAccess.ResolveMemberAccess): Add support for section
1296 14.5.4.1 that deals with the special case of E.I when E is a type
1297 and something else, that I can be a reference to a static member.
1299 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
1300 handle a particular array type to create byte blobs, it is just
1301 something we dont generate byteblobs for.
1303 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
1306 * location.cs (Push): remove the key from the hashtable that we
1307 are about to add. This happens for empty files.
1309 * driver.cs: Dispose files after we have parsed them.
1311 (tokenize): new function that only runs the tokenizer on its
1312 input, for speed testing.
1314 2001-12-26 Ravi Pratap <ravi@ximian.com>
1316 * class.cs (Event.Define): Define the private field only if there
1317 are no accessors defined.
1319 * expression.cs (ResolveMemberAccess): If there is no associated
1320 field with the event, that means we have an event defined with its
1321 own accessors and we should flag error cs0070 since transforming
1322 ourselves into a field is not valid in that case.
1324 * ecore.cs (SimpleName.DoResolve): Same as above.
1326 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
1327 and charset to sane values.
1329 2001-12-25 Ravi Pratap <ravi@ximian.com>
1331 * assign.cs (DoResolve): Perform check on events only if they
1332 are being accessed outside the declaring type.
1334 * cs-parser.jay (event_declarations): Update rules to correctly
1335 set the type of the implicit parameter etc.
1337 (add_accessor, remove_accessor): Set current local parameters.
1339 * expression.cs (Binary): For delegate addition and subtraction,
1340 cast the return value from the method into the appropriate delegate
1343 2001-12-24 Ravi Pratap <ravi@ximian.com>
1345 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
1346 of these as the workaround is unnecessary.
1348 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
1349 delegate data - none of that is needed at all.
1351 Re-write bits to extract the instance expression and the delegate method
1354 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
1357 * attribute.cs (ApplyAttributes): New method to take care of common tasks
1358 of attaching attributes instead of duplicating code everywhere.
1360 * everywhere : Update code to do attribute emission using the above method.
1362 2001-12-23 Miguel de Icaza <miguel@ximian.com>
1364 * expression.cs (IsParamsMethodApplicable): if there are not
1365 parameters, return immediately.
1367 * ecore.cs: The 0 literal can be implicity converted to an enum
1370 (SimpleName.DoResolve): First lookup the type, then lookup the
1373 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
1374 want to get its address. If the InstanceExpression is not
1375 addressable, store the result in a temporary variable, then get
1378 * codegen.cs: Only display 219 errors on warning level or above.
1380 * expression.cs (ArrayAccess): Make it implement the
1381 IMemoryLocation interface.
1383 (Binary.DoResolve): handle the operator == (object a, object b)
1384 and operator != (object a, object b) without incurring into a
1385 BoxedCast (because 5 != o should never be performed).
1387 Handle binary enumerator operators.
1389 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
1390 value type, otherwise use Ldelem_ref.
1392 Use precomputed names;
1394 (AddressOf): Implement address of
1396 * cs-parser.jay (labeled_statement): Fix recursive block
1397 addition by reworking the production.
1399 * expression.cs (New.DoEmit): New has a special case:
1401 If we are dealing with a ValueType, we have a few
1402 situations to deal with:
1404 * The target of New is a ValueType variable, that is
1405 easy, we just pass this as the variable reference
1407 * The target of New is being passed as an argument,
1408 to a boxing operation or a function that takes a
1411 In this case, we need to create a temporary variable
1412 that is the argument of New.
1415 2001-12-23 Ravi Pratap <ravi@ximian.com>
1417 * rootcontext.cs (LookupType): Check that current_type is not null before
1418 going about looking at nested types.
1420 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
1421 not implement the IAssignMethod interface any more.
1423 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
1424 where we tranform them into FieldExprs if they are being resolved from within
1427 * ecore.cs (SimpleName.DoResolve): Do the same here.
1429 * assign.cs (DoResolve, Emit): Clean up code considerably.
1431 * ../errors/bug10.cs : Add.
1433 * ../errors/cs0070.cs : Add.
1435 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
1437 * assign.cs : Get rid of EventIsLocal everywhere.
1439 2001-12-23 Miguel de Icaza <miguel@ximian.com>
1441 * ecore.cs (ConvertIntLiteral): finished the implementation.
1443 * statement.cs (SwitchLabel): Convert the value we are using as a
1444 key before looking up the table.
1446 2001-12-22 Miguel de Icaza <miguel@ximian.com>
1448 * codegen.cs (EmitTopBlock): Require a Location argument now.
1450 * cs-parser.jay (constructor_declarator): We need to setup
1451 current_local_parameters before we parse the
1452 opt_constructor_initializer, to allow the variables to be bound
1453 to the constructor arguments.
1455 * rootcontext.cs (LookupType): First lookup nested classes in our
1456 class and our parents before we go looking outside our class.
1458 * expression.cs (ConstantFold): Extract/debox the values at the
1461 * rootcontext.cs (EmitCode): Resolve the constants first before we
1462 resolve the types. This is not really needed, but it helps debugging.
1464 * statement.cs: report location.
1466 * cs-parser.jay: pass location to throw statement.
1468 * driver.cs: Small bug fix.
1470 * report.cs: Updated format to be 4-zero filled digits.
1472 2001-12-22 Ravi Pratap <ravi@ximian.com>
1474 * expression.cs (CheckIndices): Fix minor bug where the wrong
1475 variable was being referred to ;-)
1477 (DoEmit): Do not call EmitStaticInitializers when the
1478 underlying type is System.Object.
1480 2001-12-21 Ravi Pratap <ravi@ximian.com>
1482 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
1483 and do the usual workaround for SRE.
1485 * class.cs (MyEventBuilder.EventType): New member to get at the type
1486 of the event, quickly.
1488 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
1490 * assign.cs (Assign.DoResolve): Handle the case when the target
1491 is an EventExpr and perform the necessary checks.
1493 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
1496 (SimpleName.MemberStaticCheck): Include check for EventExpr.
1498 (EventExpr): Set the type in the constructor itself since we
1499 are meant to be born fully resolved.
1501 (EventExpr.Define): Revert code I wrote earlier.
1503 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
1504 instance expression is null. The instance expression is a This in that case
1505 or a null, depending on whether it is a static method or not.
1507 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
1508 refers to more than one method.
1510 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
1511 and accordingly flag errors.
1513 2001-12-21 Miguel de Icaza <miguel@ximian.com>
1515 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
1517 2001-12-22 Miguel de Icaza <miguel@ximian.com>
1519 * location.cs (ToString): Provide useful rutine.
1521 2001-12-21 Miguel de Icaza <miguel@ximian.com>
1523 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
1524 objects, return the actual integral boxed.
1526 * statement.cs (SwitchLabel): define an ILLabel for each
1529 (Switch.CheckSwitch): If the value is a Literal, extract
1530 the underlying literal.
1532 Also in the unused hashtable we had, add the SwitchLabel so we can
1533 quickly look this value up.
1535 * constant.cs: Implement a bunch of new constants. Rewrite
1536 Literal based on this. Made changes everywhere to adapt to this.
1538 * expression.cs (Expression.MakeByteBlob): Optimize routine by
1539 dereferencing array only once, and also copes with enumrations.
1541 bytes are two bytes wide, not one.
1543 (Cast): Perform constant conversions.
1545 * ecore.cs (TryImplicitIntConversion): Return literals instead of
1546 wrappers to the literals here.
1548 * expression.cs (DoNumericPromotions): long literals can converted
1549 to ulong implicity (this is taken care of elsewhere, but I was
1552 * ecore.cs (Expression.Literalize): Make the return type Literal,
1553 to improve type checking.
1555 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
1557 2001-12-20 Miguel de Icaza <miguel@ximian.com>
1559 * literal.cs: Revert code from ravi that checked the bounds. The
1560 bounds are sane by the definition of the type itself.
1562 * typemanager.cs: Fix implementation of ImplementsInterface. We
1563 need to actually look up in our parent hierarchy for interfaces
1566 * const.cs: Use the underlying type for enumerations
1568 * delegate.cs: Compute the basename for the delegate creation,
1569 that should fix the delegate test case, and restore the correct
1570 Type Lookup semantics in rootcontext
1572 * rootcontext.cs: Revert Ravi's last patch. The correct way of
1573 referencing a nested type with the Reflection API is using the "+"
1576 * cs-parser.jay: Do not require EOF token at the end.
1578 2001-12-20 Ravi Pratap <ravi@ximian.com>
1580 * rootcontext.cs (LookupType): Concatenate type names with
1581 a '.' instead of a '+' The test suite passes again.
1583 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
1584 field of the enumeration.
1586 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
1587 the case when the member is an EventExpr.
1589 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
1590 static has an associated instance expression.
1592 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
1594 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
1596 * class.cs (Event.Define): Register event and perform appropriate checks
1599 We define the Add and Remove methods even if the use provides none because
1600 in that case, we provide default implementations ourselves.
1602 Define a private field of the type of the event. This is done by the CSC compiler
1603 and we should be doing it too ;-)
1605 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
1606 More methods we use in code we generate.
1608 (multicast_delegate_type, delegate_type): Two separate types since the distinction
1611 (InitCoreTypes): Update accordingly for the above.
1613 * class.cs (Event.Emit): Generate code for default accessors that we provide
1615 (EmitDefaultMethod): Do the job in the above.
1617 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
1620 2001-12-20 Miguel de Icaza <miguel@ximian.com>
1622 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
1623 builders even if we were missing one.
1625 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
1626 pass the Basename as our class name instead of the Name. The
1627 basename will be correctly composed for us.
1629 * parameter.cs (Paramters): Now takes a Location argument.
1631 * decl.cs (DeclSpace.LookupType): Removed convenience function and
1632 make all the code call directly LookupType in RootContext and take
1633 this chance to pass the Location information everywhere.
1635 * Everywhere: pass Location information.
1637 2001-12-19 Miguel de Icaza <miguel@ximian.com>
1639 * class.cs (Constructor.Define): Updated way of detecting the
1640 length of the parameters.
1642 (TypeContainer.DefineType): Use basename as the type name for
1645 (TypeContainer.Define): Do not recursively define types here, as
1646 definition is taken care in order by the RootContext.
1648 * tree.cs: Keep track of namespaces in a per-file basis.
1650 * parameter.cs (Parameter.ComputeSignature): Update to use
1653 (Parameters.GetSignature): ditto.
1655 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
1656 instead of a TypeContainer.
1658 (Interface.SemanticAnalysis): Use `this' instead of our parent to
1659 resolve names. Because we need to be resolve in our context, not
1662 * driver.cs: Implement response files.
1664 * class.cs (TypeContainer.DefineType): If we are defined, do not
1667 (Event.Emit): Emit the code for add/remove handlers.
1668 (Event.Define): Save the MethodBuilders for add/remove.
1670 * typemanager.cs: Use pair here too.
1672 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
1673 DictionaryEntry requires the first argument to be non-null.
1675 (enum_declaration): Compute full name for registering the
1678 (delegate_declaration): Instead of using
1679 formal_parameter_list, use opt_formal_parameter_list as the list
1682 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
1683 (EventParsing): New property that controls whether `add' and
1684 `remove' are returned as tokens or identifiers (for events);
1686 2001-12-19 Ravi Pratap <ravi@ximian.com>
1688 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
1689 use MyEventBuilder only and let it wrap the real builder for us.
1691 (MyEventBuilder): Revamp constructor etc.
1693 Implement all operations that we perform on EventBuilder in precisely the same
1696 (FindMembers): Update to use the EventBuilder member.
1698 (Event.Emit): Update accordingly.
1700 2001-12-18 Ravi Pratap <ravi@ximian.com>
1702 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
1703 by calling the appropriate methods.
1705 (GetCustomAttributes): Make stubs as they cannot possibly do anything
1708 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
1710 2001-12-17 Ravi Pratap <ravi@ximian.com>
1712 * delegate.cs (Delegate.Populate): Check that the return type
1713 and various parameters types are indeed accessible.
1715 * class.cs (Constructor.Define): Same here.
1717 (Field.Define): Ditto.
1719 (Event.Define): Ditto.
1721 (Operator.Define): Check that the underlying Method defined itself
1722 correctly - so it's MethodBuilder should not be null.
1724 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
1725 expression happens to be null.
1727 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
1728 members but as of now we don't seem to be able to do anything really useful with it.
1730 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
1731 not the EventBuilder.
1733 2001-12-18 Miguel de Icaza <miguel@ximian.com>
1735 * cs-tokenizer.cs: Add support for defines.
1736 Add support for #if, #elif, #else, #endif
1738 (eval_var): evaluates a variable.
1739 (eval): stubbed for evaluating functions.
1741 * cs-parser.jay: Pass the defines information
1743 * driver.cs: Add --define command line option.
1745 * decl.cs: Move MemberCore here.
1747 Make it the base class for DeclSpace. This allows us to catch and
1748 report 108 and 109 for everything now.
1750 * class.cs (TypeContainer.Define): Extract all the members
1751 before populating and emit the warning 108 (new keyword required
1752 to override) instead of having each member implement this.
1754 (MemberCore.Define): New abstract method, we will be using this in
1755 the warning reporting engine in Populate.
1757 (Operator.Define): Adjust to new MemberCore protocol.
1759 * const.cs (Const): This does not derive from Expression, it is a
1760 temporary object we use to create fields, it is a MemberCore.
1762 * class.cs (Method.Define): Allow the entry point to be in a
1765 * driver.cs: Rewrite the argument handler to clean it up a bit.
1767 * rootcontext.cs: Made it just an auxiliary namespace feature by
1768 making everything static.
1770 * driver.cs: Adapt code to use RootContext type name instead of
1773 * delegate.cs: Remove RootContext argument.
1775 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
1778 * class.cs (Event.Define): The lookup can fail.
1780 * cs-tokenizer.cs: Begin implementation of pre-procesor.
1782 * expression.cs: Resolve the this instance before invoking the code.
1784 2001-12-17 Miguel de Icaza <miguel@ximian.com>
1786 * cs-parser.jay: Add a production in element_access that allows
1787 the thing to become a "type" reference. This way we can parse
1788 things like "(string [])" as a type.
1790 Note that this still does not handle the more complex rules of
1794 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
1796 * ecore.cs: (CopyNewMethods): new utility function used to
1797 assemble the list of methods from running FindMembers.
1799 (MemberLookup): Rework FindMembers so that
1801 2001-12-16 Miguel de Icaza <miguel@ximian.com>
1803 * class.cs (TypeContainer): Remove Delegates who fail to be
1806 * delegate.cs (Populate): Verify that we dont get null return
1807 values. TODO: Check for AsAccessible.
1809 * cs-parser.jay: Use basename to emit error 574 (destructor should
1810 have the same name as container class), not the full name.
1812 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
1813 possible representation.
1815 Also implements integer type suffixes U and L.
1817 2001-12-15 Miguel de Icaza <miguel@ximian.com>
1819 * expression.cs (ArrayCreation.DoResolve): We need to do the
1820 argument resolution *always*.
1822 * decl.cs: Make this hold the namespace. Hold the root context as
1824 (LookupType): Move here.
1826 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
1828 * location.cs (Row, Name): Fixed the code, it was always returning
1829 references to the first file.
1831 * interface.cs: Register properties defined through interfaces.
1833 * driver.cs: Add support for globbing on the command line
1835 * class.cs (Field): Make it derive from MemberCore as well.
1838 2001-12-15 Ravi Pratap <ravi@ximian.com>
1840 * class.cs (Event::Define): Check that the type of the event is a delegate
1841 type else flag error #66.
1843 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
1846 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
1847 values of EntryPoint, CharSet etc etc.
1849 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
1851 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
1852 be null and we should ignore this. I am not sure if this is really clean. Apparently,
1853 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
1854 which needs this to do its work.
1856 * ../errors/cs0066.cs : Add.
1858 2001-12-14 Miguel de Icaza <miguel@ximian.com>
1860 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
1863 * class.cs: (MethodSignature.MethodSignature): Removed hack that
1864 clears out the parameters field.
1865 (MemberSignatureCompare): Cleanup
1867 (MemberCore): New base class used to share code between MethodCore
1870 (RegisterRequiredImplementations) BindingFlags.Public requires
1871 either BindingFlags.Instace or Static. Use instance here.
1873 (Property): Refactored code to cope better with the full spec.
1875 * parameter.cs (GetParameterInfo): Return an empty array instead
1878 * class.cs (Property): Abstract or extern properties have no bodies.
1880 * parameter.cs (GetParameterInfo): return a zero-sized array.
1882 * class.cs (TypeContainer.MethodModifiersValid): Move all the
1883 method modifier validation to the typecontainer so we can reuse
1886 (MethodCore.ParameterTypes): return an empty sized array of types.
1888 (Property.Define): Test property modifier validity.
1890 Add tests for sealed/override too.
1892 (Method.Emit): abstract or extern methods have no bodies.
1894 2001-12-14 Ravi Pratap <ravi@ximian.com>
1896 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
1899 (Method::Define, ::Emit): Modify accordingly.
1901 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
1903 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
1905 * makefile: Pass in /unsafe.
1907 2001-12-13 Miguel de Icaza <miguel@ximian.com>
1909 * class.cs (MakeKey): Kill routine.
1911 * class.cs (TypeContainer.Define): Correctly define explicit
1912 method implementations (they require the full interface name plus
1915 * typemanager.cs: Deply the PtrHashtable here and stop using the
1916 lame keys. Things work so much better.
1918 This of course broke everyone who depended on `RegisterMethod' to
1919 do the `test for existance' test. This has to be done elsewhere.
1921 * support.cs (PtrHashtable): A hashtable that avoid comparing with
1922 the object stupid Equals method (because, that like fails all over
1923 the place). We still do not use it.
1925 * class.cs (TypeContainer.SetRequiredInterface,
1926 TypeContainer.RequireMethods): Killed these two routines and moved
1927 all the functionality to RegisterRequiredImplementations.
1929 (TypeContainer.RegisterRequiredImplementations): This routine now
1930 registers all the implementations required in an array for the
1931 interfaces and abstract methods. We use an array of structures
1932 which can be computed ahead of time to reduce memory usage and we
1933 also assume that lookups are cheap as most classes will not
1934 implement too many interfaces.
1936 We also avoid creating too many MethodSignatures.
1938 (TypeContainer.IsInterfaceMethod): Update and optionally does not
1939 clear the "pending" bit if we find that there are problems with
1942 (TypeContainer.VerifyPendingMethods): Update to report errors of
1943 methods that look like implementations but are not.
1945 (TypeContainer.Define): Add support for explicit interface method
1948 2001-12-12 Miguel de Icaza <miguel@ximian.com>
1950 * typemanager.cs: Keep track of the parameters here instead of
1951 being a feature of the TypeContainer.
1953 * class.cs: Drop the registration of parameters here, as
1954 InterfaceMethods are also interface declarations.
1956 * delegate.cs: Register methods with the TypeManager not only with
1957 the TypeContainer. This code was buggy.
1959 * interface.cs: Full registation here.
1961 2001-12-11 Miguel de Icaza <miguel@ximian.com>
1963 * expression.cs: Remove reducer for binary expressions, it can not
1966 * const.cs: Put here the code that used to go into constant.cs
1968 * constant.cs: Put here the code for constants, this is a new base
1971 * literal.cs: Make Literal derive from Constant.
1973 2001-12-09 Miguel de Icaza <miguel@ximian.com>
1975 * statement.cs (Return.Emit): Report error 157 if the user
1976 attempts to return from a finally block.
1978 (Return.Emit): Instead of emitting a return, jump to the end of
1981 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
1982 LocalBuilder to store the result of the function. ReturnLabel is
1983 the target where we jump.
1986 2001-12-09 Radek Doulik <rodo@ximian.com>
1988 * cs-parser.jay: remember alias in current namespace
1990 * ecore.cs (SimpleName::DoResolve): use aliases for types or
1993 * class.cs (LookupAlias): lookup alias in my_namespace
1995 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
1997 (LookupAlias): lookup alias in this and if needed in parent
2000 2001-12-08 Miguel de Icaza <miguel@ximian.com>
2004 * rootcontext.cs: (ModuleBuilder) Made static, first step into
2005 making things static. I need this to avoid passing the
2006 TypeContainer when calling ParameterType.
2008 * support.cs (InternalParameters.ParameterType): Remove ugly hack
2009 that did string manipulation to compute the type and then call
2010 GetType. Use Parameter.ParameterType instead.
2012 * cs-tokenizer.cs: Consume the suffix for floating values.
2014 * expression.cs (ParameterReference): figure out whether this is a
2015 reference parameter or not. Kill an extra variable by computing
2016 the arg_idx during emission.
2018 * parameter.cs (Parameters.GetParameterInfo): New overloaded
2019 function that returns whether a parameter is an out/ref value or not.
2021 (Parameter.ParameterType): The type of the parameter (base,
2022 without ref/out applied).
2024 (Parameter.Resolve): Perform resolution here.
2025 (Parameter.ExternalType): The full type (with ref/out applied).
2027 * statement.cs (Using.Emit, Using.EmitExpression): Implement
2028 support for expressions on the using statement.
2030 2001-12-07 Miguel de Icaza <miguel@ximian.com>
2032 * statement.cs (Using.EmitLocalVariableDecls): Split the
2033 localvariable handling of the using statement.
2035 (Block.EmitMeta): Keep track of variable count across blocks. We
2036 were reusing slots on separate branches of blocks.
2038 (Try.Emit): Emit the general code block, we were not emitting it.
2040 Check the type of the declaration to be an IDisposable or
2041 something that can be implicity converted to it.
2043 Emit conversions if required.
2045 * ecore.cs (EmptyExpression): New utility class.
2046 (Expression.ImplicitConversionExists): New utility function.
2048 2001-12-06 Miguel de Icaza <miguel@ximian.com>
2050 * statement.cs (Using): Implement.
2052 * expression.cs (LocalVariableReference): Support read only variables.
2054 * statement.cs: Remove the explicit emit for the Leave opcode.
2055 (VariableInfo): Add a readonly field.
2057 2001-12-05 Miguel de Icaza <miguel@ximian.com>
2059 * ecore.cs (ConvCast): new class used to encapsulate the various
2060 explicit integer conversions that works in both checked and
2063 (Expression.ConvertNumericExplicit): Use new ConvCast class to
2064 properly generate the overflow opcodes.
2066 2001-12-04 Miguel de Icaza <miguel@ximian.com>
2068 * statement.cs: The correct type for the EmptyExpression is the
2069 element_type, not the variable type. Ravi pointed this out.
2071 2001-12-04 Ravi Pratap <ravi@ximian.com>
2073 * class.cs (Method::Define): Handle PInvoke methods specially
2074 by using DefinePInvokeMethod instead of the usual one.
2076 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
2077 above to do the task of extracting information and defining the method.
2079 2001-12-04 Ravi Pratap <ravi@ximian.com>
2081 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
2082 of the condition for string type.
2084 (Emit): Move that here.
2086 (ArrayCreation::CheckIndices): Keep string literals in their expression
2089 (EmitDynamicInitializers): Handle strings appropriately.
2091 2001-12-04 Miguel de Icaza <miguel@ximian.com>
2093 * codegen.cs (EmitContext): Replace multiple variables with a
2094 single pointer to the current Switch statement.
2096 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
2099 2001-12-03 Miguel de Icaza <miguel@ximian.com>
2103 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
2106 (Foreach.Emit): Foreach on arrays was not setting
2107 up the loop variables (for break/continue).
2109 (GotoCase): Semi-implented.
2111 2001-12-03 Ravi Pratap <ravi@ximian.com>
2113 * attribute.cs (CheckAttribute): Handle system attributes by using
2114 Attribute.GetAttributes to examine information we need.
2116 (GetValidPlaces): Same here.
2118 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
2120 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
2122 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
2124 (Method::Define): Set appropriate flags if we have a DllImport attribute.
2126 (Method::Emit): Handle the case when we are a PInvoke method.
2128 2001-12-03 Miguel de Icaza <miguel@ximian.com>
2130 * expression.cs: Use ResolveWithSimpleName on compound names.
2132 2001-12-02 Ravi Pratap <ravi@ximian.com>
2134 * constant.cs (EmitConstant): Make sure we resolve the associated expression
2135 before trying to reduce it.
2137 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
2139 * constant.cs (LookupConstantValue): Implement.
2141 (EmitConstant): Use the above in emitting the constant.
2143 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
2144 that are user-defined by doing a LookupConstantValue on them.
2146 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
2149 2001-11-29 Miguel de Icaza <miguel@ximian.com>
2151 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
2153 (BaseAccess.DoResolve): Implement.
2155 (MemberAccess.DoResolve): Split this routine into a
2156 ResolveMemberAccess routine that can be used independently
2158 2001-11-28 Miguel de Icaza <miguel@ximian.com>
2160 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
2161 As that share bits of the implementation. Is returns a boolean,
2162 while As returns the Type that is being probed.
2164 2001-12-01 Ravi Pratap <ravi@ximian.com>
2166 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
2167 instead of a Literal - much easier.
2169 (EnumInTransit): Remove - utterly useless :-)
2171 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
2173 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
2175 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
2176 chain when we have no associated expression.
2178 2001-11-30 Ravi Pratap <ravi@ximian.com>
2180 * constant.cs (Define): Use Location while reporting the errror.
2182 Also emit a warning when 'new' is used and there is no inherited
2185 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
2188 (LookupEnumValue): Implement to lookup an enum member's value and define it
2191 (Populate): Re-write accordingly to use the above routine.
2193 2001-11-27 Miguel de Icaza <miguel@ximian.com>
2195 * expression.cs (This): Fix prototype for DoResolveLValue to
2196 override the base class DoResolveLValue.
2198 * cs-parser.cs: Report errors cs574 and cs575 (destructor
2201 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
2202 (we need to load the address of the field here). This fixes
2205 (FieldExpr.DoResolveLValue): Call the DoResolve
2206 function to initialize the Instance expression.
2208 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
2209 correctly the GetEnumerator operation on a value type.
2211 * cs-parser.jay: Add more simple parsing error catches.
2213 * statement.cs (Switch): Add support for string switches.
2214 Handle null specially.
2216 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
2218 2001-11-28 Ravi Pratap <ravi@ximian.com>
2220 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
2222 (declare_local_constant): New helper function.
2224 * statement.cs (AddConstant): Keep a separate record of constants
2226 (IsConstant): Implement to determine if a variable is a constant.
2228 (GetConstantExpression): Implement.
2230 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
2232 * statement.cs (IsVariableDefined): Re-write.
2234 2001-11-27 Ravi Pratap <ravi@ximian.com>
2236 * class.cs (TypeContainer::FindMembers): Look for constants
2237 in the case when we are looking for MemberTypes.Field
2239 * expression.cs (MemberAccess::DoResolve): Check that in the
2240 case we are a FieldExpr and a Literal, we are not being accessed
2241 by an instance reference.
2243 * cs-parser.jay (local_constant_declaration): Implement.
2245 (declaration_statement): Implement for constant declarations.
2247 2001-11-26 Miguel de Icaza <miguel@ximian.com>
2249 * statement.cs (Switch): Catch double defaults.
2251 (Switch): More work on the switch() statement
2252 implementation. It works for integral values now, need to finish
2256 2001-11-24 Miguel de Icaza <miguel@ximian.com>
2258 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
2259 integer literals into other integer literals. To be used by
2262 2001-11-24 Ravi Pratap <ravi@ximian.com>
2264 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
2267 (EmitDynamicInitializers): Cope with the above since we extract data
2268 directly from ArrayData now.
2270 (ExpectInitializers): Keep track of whether initializers are mandatory
2273 (Bounds): Make it a hashtable to prevent the same dimension being
2274 recorded for every element in that dimension.
2276 (EmitDynamicInitializers): Fix bug which prevented the Set array method
2279 Also fix bug which was causing the indices to be emitted in the reverse
2282 2001-11-24 Miguel de Icaza <miguel@ximian.com>
2284 * expression.cs (ArrayCreation): Implement the bits that Ravi left
2285 unfinished. They do not work, because the underlying code is
2288 2001-11-22 Miguel de Icaza <miguel@ximian.com>
2290 * cs-parser.jay: Remove bogus fixme.
2292 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
2293 on Switch statement.
2295 2001-11-23 Ravi Pratap <ravi@ximian.com>
2297 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
2300 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
2301 parameter. Apparently, any expression is allowed.
2303 (ValidateInitializers): Update accordingly.
2305 (CheckIndices): Fix some tricky bugs thanks to recursion.
2307 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
2308 I was being completely brain-dead.
2310 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
2311 and re-write acordingly.
2313 (DelegateInvocation): Re-write accordingly.
2315 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
2317 (MakeByteBlob): Handle types more correctly.
2319 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
2320 initialization from expressions but it is incomplete because I am a complete
2323 2001-11-22 Miguel de Icaza <miguel@ximian.com>
2325 * statement.cs (If.Emit): Fix a bug that generated incorrect code
2326 on If. Basically, we have to return `true' (ie, we do return to
2327 our caller) only if both branches of the if return.
2329 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
2330 short-circuit operators, handle them as short circuit operators.
2332 (Cast.DoResolve): Resolve type.
2333 (Cast.Cast): Take an expression as the target type.
2335 * cs-parser.jay (cast_expression): Remove old hack that only
2336 allowed a limited set of types to be handled. Now we take a
2337 unary_expression and we resolve to a type during semantic
2340 Use the grammar productions from Rhys to handle casts (this is
2341 not complete like Rhys syntax yet, we fail to handle that corner
2342 case that C# has regarding (-x), but we will get there.
2344 2001-11-22 Ravi Pratap <ravi@ximian.com>
2346 * class.cs (EmitFieldInitializer): Take care of the case when we have a
2347 field which is an array type.
2349 * cs-parser.jay (declare_local_variables): Support array initialization too.
2351 * typemanager.cs (MakeKey): Implement.
2353 (everywhere): Use the above appropriately.
2355 * cs-parser.jay (for_statement): Update for array initialization while
2356 declaring variables.
2358 * ecore.cs : The error message was correct, it's the variable's names that
2359 were misleading ;-) Make the code more readable.
2361 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
2362 the correct type etc.
2364 (ConvertExplicit): Handle Enum types by examining the underlying type.
2366 2001-11-21 Ravi Pratap <ravi@ximian.com>
2368 * parameter.cs (GetCallingConvention): Always return
2369 CallingConventions.Standard for now.
2371 2001-11-22 Miguel de Icaza <miguel@ximian.com>
2373 * expression.cs (Binary.ResolveOperator): Update the values of `l'
2374 and `r' after calling DoNumericPromotions.
2376 * ecore.cs: Fix error message (the types were in the wrong order).
2378 * statement.cs (Foreach.ProbeCollectionType): Need to pass
2379 BindingFlags.Instance as well
2381 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
2382 implicit int literal conversion in an empty cast so that we
2383 propagate the right type upstream.
2385 (UnboxCast): new class used to unbox value types.
2386 (Expression.ConvertExplicit): Add explicit type conversions done
2389 (Expression.ImplicitNumericConversion): Oops, forgot to test for
2390 the target type before applying the implicit LongLiterals to ULong
2393 2001-11-21 Miguel de Icaza <miguel@ximian.com>
2395 * cs-parser.jay (for_statement): Reworked the way For works: now
2396 we declare manually any variables that are introduced in
2397 for_initializer to solve the problem of having out-of-band code
2398 emition (that is what got for broken).
2400 (declaration_statement): Perform the actual variable declaration
2401 that used to be done in local_variable_declaration here.
2403 (local_variable_declaration): Do not declare anything, just pass
2404 the information on a DictionaryEntry
2406 2001-11-20 Ravi Pratap <ravi@ximian.com>
2408 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
2409 re-write of the logic to now make it recursive.
2411 (UpdateIndices): Re-write accordingly.
2413 Store element data in a separate ArrayData list in the above methods.
2415 (MakeByteBlob): Implement to dump the array data into a byte array.
2417 2001-11-19 Ravi Pratap <ravi@ximian.com>
2419 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
2422 * constant.cs (Define): Implement.
2424 (EmitConstant): Re-write fully.
2426 Pass in location info.
2428 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
2431 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
2432 DictionaryEntry since we need location info too.
2434 (constant_declaration): Update accordingly.
2436 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
2437 code into another method : UpdateIndices.
2439 2001-11-18 Ravi Pratap <ravi@ximian.com>
2441 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
2442 some type checking etc.
2444 2001-11-17 Ravi Pratap <ravi@ximian.com>
2446 * expression.cs (ArrayCreation::ValidateInitializers): Implement
2447 bits to provide dimension info if the user skips doing that.
2449 Update second constructor to store the rank correctly.
2451 2001-11-16 Ravi Pratap <ravi@ximian.com>
2453 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
2454 and try to implement.
2456 * ../errors/cs0150.cs : Add.
2458 * ../errors/cs0178.cs : Add.
2460 2001-11-16 Miguel de Icaza <miguel@ximian.com>
2462 * statement.cs: Implement foreach on multi-dimensional arrays.
2464 * parameter.cs (Parameters.GetParameterByName): Also lookup the
2465 name of the params argument.
2467 * expression.cs: Use EmitStoreOpcode to get the right opcode while
2468 initializing the array.
2470 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
2471 we can use this elsewhere.
2473 * statement.cs: Finish implementation of foreach for single
2476 * cs-parser.jay: Use an out-of-band stack to pass information
2477 around, I wonder why I need this.
2479 foreach_block: Make the new foreach_block the current_block.
2481 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
2482 function used to return a static Parameters structure. Used for
2483 empty parameters, as those are created very frequently.
2485 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
2487 2001-11-15 Ravi Pratap <ravi@ximian.com>
2489 * interface.cs : Default modifier is private, not public. The
2490 make verify test passes again.
2492 2001-11-15 Ravi Pratap <ravi@ximian.com>
2494 * support.cs (ReflectionParameters): Fix logic to determine
2495 whether the last parameter is a params one. Test 9 passes again.
2497 * delegate.cs (Populate): Register the builders we define with
2498 RegisterParameterForBuilder. Test 19 passes again.
2500 * cs-parser.jay (property_declaration): Reference $6 instead
2501 of $$ to get at the location.
2503 (indexer_declaration): Similar stuff.
2507 * class.cs (Property): Register parameters for the Get and Set methods
2508 if they exist. Test 23 passes again.
2510 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
2511 call to EmitArguments as we are sure there aren't any params arguments.
2512 Test 32 passes again.
2514 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
2515 IndexOutOfRangeException.
2517 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
2518 Test 33 now passes again.
2520 2001-11-15 Miguel de Icaza <miguel@ximian.com>
2522 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
2523 broke a bunch of things. Will have to come up with a better way
2524 of tracking locations.
2526 * statement.cs: Implemented foreach for single dimension arrays.
2528 2001-11-09 Miguel de Icaza <miguel@ximian.com>
2530 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
2531 an error. This removes the lookup from the critical path.
2533 * cs-parser.jay: Removed use of temporary_loc, which is completely
2536 2001-11-14 Miguel de Icaza <miguel@ximian.com>
2538 * support.cs (ReflectionParameters.ParameterModifier): Report
2539 whether the argument is a PARAMS argument or not.
2541 * class.cs: Set the attribute `ParamArrayAttribute' on the
2544 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
2545 and cons_param_array_attribute (ConstructorInfo for
2546 ParamArrayAttribute).,
2548 * codegen.cs: Emit the return using the `Return' statement, that
2549 way we can report the error correctly for missing return values.
2551 * class.cs (Method.Emit): Clean up.
2553 * expression.cs (Argument.Resolve): Take another argument: the
2554 location where this argument is used. Notice that this is not
2555 part of the "Argument" class as to reduce the size of the
2556 structure (we know the approximate location anyways).
2558 Test if the argument is a variable-reference, if not, then
2559 complain with a 206.
2561 (Argument.Emit): Emit addresses of variables.
2563 (Argument.FullDesc): Simplify.
2565 (Invocation.DoResolve): Update for Argument.Resolve.
2567 (ElementAccess.DoResolve): ditto.
2569 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
2570 method should be virtual, as this method is always virtual.
2572 (NewDelegate.DoResolve): Update for Argument.Resolve.
2574 * class.cs (ConstructorInitializer.DoResolve): ditto.
2576 * attribute.cs (Attribute.Resolve): ditto.
2578 2001-11-13 Miguel de Icaza <miguel@ximian.com>
2580 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
2582 * expression.cs (ParameterReference): Drop IStackStorage and implement
2583 IAssignMethod instead.
2585 (LocalVariableReference): ditto.
2587 * ecore.cs (FieldExpr): Drop IStackStorage and implement
2588 IAssignMethod instead.
2590 2001-11-13 Miguel de Icaza <miguel@ximian.com>
2592 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
2593 enumerations that are used in heavily used structures derive from
2594 byte in a laughable and pathetic attempt to reduce memory usage.
2595 This is the kind of pre-optimzations that you should not do at
2596 home without adult supervision.
2598 * expression.cs (UnaryMutator): New class, used to handle ++ and
2599 -- separatedly from the other unary operators. Cleans up the
2600 code, and kills the ExpressionStatement dependency in Unary.
2602 (Unary): Removed `method' and `Arguments' from this class, making
2603 it smaller, and moving it all to SimpleCall, so I can reuse this
2604 code in other locations and avoid creating a lot of transient data
2605 strucutres when not required.
2607 * cs-parser.jay: Adjust for new changes.
2609 2001-11-11 Miguel de Icaza <miguel@ximian.com>
2611 * enum.cs (Enum.Populate): If there is a failure during
2614 * cs-parser.jay (opt_enum_base): we used to catch type errors
2615 here, but this is really incorrect. The type error should be
2616 catched during semantic analysis.
2618 2001-12-11 Ravi Pratap <ravi@ximian.com>
2620 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
2621 current_local_parameters as expected since I, in my stupidity, had forgotten
2624 * attribute.cs (GetValidPlaces): Fix stupid bug.
2626 * class.cs (Method::Emit): Perform check on applicability of attributes.
2628 (Constructor::Emit): Ditto.
2630 (Field::Emit): Ditto.
2632 (Field.Location): Store location information.
2634 (Property, Event, Indexer, Operator): Ditto.
2636 * cs-parser.jay (field_declaration): Pass in location for each field.
2638 * ../errors/cs0592.cs : Add.
2640 2001-11-12 Ravi Pratap <ravi@ximian.com>
2642 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
2644 (InitCoreTypes): Update accordingly.
2646 (RegisterAttrType, LookupAttr): Implement.
2648 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
2649 info about the same.
2651 (Resolve): Update to populate the above as necessary.
2655 (GetValidPlaces): Helper to the above.
2657 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
2659 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
2661 2001-11-12 Ravi Pratap <ravi@ximian.com>
2663 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
2665 * ../errors/cs0617.cs : Add.
2667 2001-11-11 Ravi Pratap <ravi@ximian.com>
2669 * enum.cs (Emit): Rename to Populate to be more consistent with what
2670 we expect it to do and when exactly it is called.
2672 * class.cs, rootcontext.cs : Update accordingly.
2674 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
2675 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
2677 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
2679 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
2680 of a fieldinfo using the above, when dealing with a FieldBuilder.
2682 2001-11-10 Ravi Pratap <ravi@ximian.com>
2684 * ../errors/cs0031.cs : Add.
2686 * ../errors/cs1008.cs : Add.
2688 * ../errrors/cs0543.cs : Add.
2690 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
2693 (FindMembers): Implement.
2695 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
2696 enums and delegates too.
2698 (enum_types): Rename to builder_to_enum.
2700 (delegate_types): Rename to builder_to_delegate.
2702 * delegate.cs (FindMembers): Implement.
2704 2001-11-09 Ravi Pratap <ravi@ximian.com>
2706 * typemanager.cs (IsEnumType): Implement.
2708 * enum.cs (Emit): Re-write parts to account for the underlying type
2709 better and perform checking etc.
2711 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
2712 of the underlying type.
2714 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
2717 * enum.cs (error31): Helper to report error #31.
2719 * cs-parser.jay (enum_declaration): Store location of each member too.
2721 * enum.cs (member_to_location): New hashtable.
2723 (AddEnumMember): Update location hashtable.
2725 (Emit): Use the location of each member while reporting errors.
2727 2001-11-09 Miguel de Icaza <miguel@ximian.com>
2729 * cs-parser.jay: A for_initializer if is a
2730 local_variable_declaration really ammount to have an implicit
2731 block with the variable declaration and no initializer for for.
2733 * statement.cs (For.Emit): Cope with null initializers.
2735 This fixes the infinite loop on for initializers.
2737 2001-11-08 Miguel de Icaza <miguel@ximian.com>
2739 * enum.cs: More cleanup.
2741 * ecore.cs: Remove dead code.
2743 * class.cs (Property.Emit): More simplification.
2744 (Event.Emit): ditto.
2746 Reworked to have less levels of indentation.
2748 2001-11-08 Ravi Pratap <ravi@ximian.com>
2750 * class.cs (Property): Emit attributes.
2760 * enum.cs (Emit): Ditto.
2762 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
2765 * class.cs (Field, Event, etc.): Move attribute generation into the
2766 Emit method everywhere.
2768 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
2769 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
2770 as we had no way of defining nested enums !
2772 * rootcontext.cs : Adjust code accordingly.
2774 * typemanager.cs (AddEnumType): To keep track of enum types separately.
2776 2001-11-07 Ravi Pratap <ravi@ximian.com>
2778 * expression.cs (EvalConstantExpression): Move into ecore.cs
2780 * enum.cs (Enum): Rename some members and make them public and readonly
2781 according to our convention.
2783 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
2786 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
2788 (Enum::Emit): Write a simple version for now which doesn't try to compute
2789 expressions. I shall modify this to be more robust in just a while.
2791 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
2793 (TypeContainer::CloseType): Create the Enum types too.
2795 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
2797 * expression.cs (EvalConstantExpression): Get rid of completely.
2799 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
2800 user-defined values and other cases.
2802 (IsValidEnumLiteral): Helper function.
2804 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
2805 out there in the case we had a literal FieldExpr.
2807 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
2809 (Literalize): Revamp a bit to take two arguments.
2811 (EnumLiteral): New class which derives from Literal to wrap enum literals.
2813 2001-11-06 Ravi Pratap <ravi@ximian.com>
2815 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
2817 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
2819 (Resolve): Use the above to ensure we have proper initializers.
2821 2001-11-05 Ravi Pratap <ravi@ximian.com>
2823 * expression.cs (Expression::EvalConstantExpression): New method to
2824 evaluate constant expressions.
2826 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
2828 2001-11-07 Miguel de Icaza <miguel@ximian.com>
2830 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
2833 (Binary.ResolveOperator): Handle operator != (object a, object b)
2834 and operator == (object a, object b);
2836 (Binary.DoNumericPromotions): Indicate whether the numeric
2837 promotion was possible.
2839 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
2842 Made the ArrayAccess implement interface IAssignMethod instead of
2843 IStackStore as the order in which arguments are passed reflects
2846 * assign.cs: Instead of using expr.ExprClass to select the way of
2847 assinging, probe for the IStackStore/IAssignMethod interfaces.
2849 * typemanager.cs: Load InitializeArray definition.
2851 * rootcontext.cs (RootContext.MakeStaticData): Used to define
2852 static data that can be used to initialize arrays.
2854 2001-11-05 Miguel de Icaza <miguel@ximian.com>
2856 * expression.cs: Handle operator== and operator!= for booleans.
2858 (Conditioal.Reduce): Implement reducer for the ?: operator.
2860 (Conditional.Resolve): Implement dead code elimination.
2862 (Binary.Resolve): Catch string literals and return a new
2863 concatenated string.
2865 (Unary.Reduce): Implement reduction of unary expressions.
2867 * ecore.cs: Split out the expression core handling here.
2869 (Expression.Reduce): New method used to perform constant folding
2870 and CSE. This is needed to support constant-expressions.
2872 * statement.cs (Statement.EmitBoolExpression): Pass true and false
2873 targets, and optimize for !x.
2875 2001-11-04 Ravi Pratap <ravi@ximian.com>
2877 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
2878 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
2879 set custom atttributes.
2881 * literal.cs (Literal::GetValue): New abstract method to return the actual
2882 value of the literal, cast as an object.
2884 (*Literal): Implement GetValue method.
2886 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
2887 expressions to the arraylist but objects of type Argument.
2889 * class.cs (TypeContainer::Emit): Emit our attributes too.
2891 (Method::Emit, Constructor::Emit): Ditto.
2893 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
2894 to be ignoring earlier.
2896 2001-11-03 Ravi Pratap <ravi@ximian.com>
2898 * attribute.cs (AttributeSection::Define): Implement to do the business
2899 of constructing a CustomAttributeBuilder.
2901 (Attribute): New trivial class. Increases readability of code.
2903 * cs-parser.jay : Update accordingly.
2905 (positional_argument_list, named_argument_list, named_argument): New rules
2907 (attribute_arguments): Use the above so that we are more correct.
2909 2001-11-02 Ravi Pratap <ravi@ximian.com>
2911 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
2912 to perform all checks for a method with a params parameter.
2914 (Invocation::OverloadResolve): Update to use the above method and therefore
2915 cope correctly with params method invocations.
2917 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
2920 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
2921 constructors in our parent too because we can't afford to miss out on
2924 * attribute.cs (AttributeSection): New name for the class Attribute
2926 Other trivial changes to improve readability.
2928 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
2929 use the new class names.
2931 2001-11-01 Ravi Pratap <ravi@ximian.com>
2933 * class.cs (Method::Define): Complete definition for params types too
2935 (Indexer::Define): Ditto.
2937 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
2938 Cope everywhere with a request for info about the array parameter.
2940 2001-11-01 Ravi Pratap <ravi@ximian.com>
2942 * tree.cs (RecordNamespace): Fix up to check for the correct key.
2944 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
2945 local_variable_type to extract the string corresponding to the type.
2947 (local_variable_type): Fixup the action to use the new helper method.
2949 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
2952 * expression.cs : Clean out code which uses the above.
2954 2001-10-31 Ravi Pratap <ravi@ximian.com>
2956 * typemanager.cs (RegisterMethod): Check if we already have an existing key
2957 and bale out if necessary by returning a false.
2959 (RegisterProperty): Ditto.
2961 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
2962 and print out appropriate error messages.
2964 * interface.cs (everywhere): Ditto.
2966 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
2967 location to constructor.
2969 * class.cs (Property, Event, Indexer): Update accordingly.
2971 * ../errors/cs111.cs : Added.
2973 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
2974 of a method, as laid down by the spec.
2976 (Invocation::OverloadResolve): Use the above method.
2978 2001-10-31 Ravi Pratap <ravi@ximian.com>
2980 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
2981 now take a TypeContainer and a Parameters object.
2983 (ParameterData): Modify return type of ParameterModifier method to be
2984 Parameter.Modifier and not a string.
2986 (ReflectionParameters, InternalParameters): Update accordingly.
2988 * expression.cs (Argument::GetParameterModifier): Same here.
2990 * support.cs (InternalParameters::ParameterType): Find a better way of determining
2991 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
2992 symbol in it at all so maybe this is only for now.
2994 2001-10-30 Ravi Pratap <ravi@ximian.com>
2996 * support.cs (InternalParameters): Constructor now takes an extra argument
2997 which is the actual Parameters class.
2999 (ParameterDesc): Update to provide info on ref/out modifiers.
3001 * class.cs (everywhere): Update call to InternalParameters to pass in
3002 the second argument too.
3004 * support.cs (ParameterData): Add ParameterModifier, which is a method
3005 to return the modifier info [ref/out etc]
3007 (InternalParameters, ReflectionParameters): Implement the above.
3009 * expression.cs (Argument::ParameterModifier): Similar function to return
3010 info about the argument's modifiers.
3012 (Invocation::OverloadResolve): Update to take into account matching modifiers
3015 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
3016 a new SetFormalParameters object which we pass to InternalParameters.
3018 2001-10-30 Ravi Pratap <ravi@ximian.com>
3020 * expression.cs (NewArray): Merge into the ArrayCreation class.
3022 2001-10-29 Ravi Pratap <ravi@ximian.com>
3024 * expression.cs (NewArray): Merge classes NewBuiltinArray and
3025 NewUserdefinedArray into one as there wasn't much of a use in having
3028 * expression.cs (Argument): Change field's name to ArgType from Type.
3030 (Type): New readonly property which returns the proper type, taking into
3031 account ref/out modifiers.
3033 (everywhere): Adjust code accordingly for the above.
3035 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
3036 whether we are emitting for a ref or out parameter.
3038 * expression.cs (Argument::Emit): Use the above field to set the state.
3040 (LocalVariableReference::Emit): Update to honour the flag and emit the
3043 * parameter.cs (Attributes): Set the correct flags for ref parameters.
3045 * expression.cs (Argument::FullDesc): New function to provide a full desc.
3047 * support.cs (ParameterData): Add method ParameterDesc to the interface.
3049 (ReflectionParameters, InternalParameters): Implement the above method.
3051 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
3054 (Invocation::FullMethodDesc): Ditto.
3056 2001-10-29 Miguel de Icaza <miguel@ximian.com>
3058 * cs-parser.jay: Add extra production for the second form of array
3061 * expression.cs (ArrayCreation): Update to reflect the above
3064 * Small changes to prepare for Array initialization.
3066 2001-10-28 Miguel de Icaza <miguel@ximian.com>
3068 * typemanager.cs (ImplementsInterface): interface might be null;
3069 Deal with this problem;
3071 Also, we do store negative hits on the cache (null values), so use
3072 this instead of calling t.GetInterfaces on the type everytime.
3074 2001-10-28 Ravi Pratap <ravi@ximian.com>
3076 * typemanager.cs (IsBuiltinType): New method to help determine the same.
3078 * expression.cs (New::DoResolve): Get rid of array creation code and instead
3079 split functionality out into different classes.
3081 (New::FormArrayType): Move into NewBuiltinArray.
3083 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
3086 (NewBuiltinArray): New class to handle creation of built-in arrays.
3088 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
3089 account creation of one-dimensional arrays.
3091 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
3093 (NewUserdefinedArray::DoResolve): Implement.
3095 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
3097 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
3098 we maintain inside the TypeManager. This is necessary to perform lookups on the
3101 (LookupType): Update to perform GetType on the module builders too.
3103 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
3105 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
3107 2001-10-23 Ravi Pratap <ravi@ximian.com>
3109 * expression.cs (New::DoResolve): Implement guts of array creation.
3111 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
3113 2001-10-27 Miguel de Icaza <miguel@ximian.com>
3115 * expression.cs: Fix bug I introduced lsat night that broke
3118 (Expression.Resolve): Report a 246 error (can not resolve name)
3119 if we find a SimpleName in the stream.
3121 (Expression.ResolveLValue): Ditto.
3123 (Expression.ResolveWithSimpleName): This function is a variant of
3124 ResolveName, this one allows SimpleNames to be returned without a
3125 warning. The only consumer of SimpleNames is MemberAccess
3127 2001-10-26 Miguel de Icaza <miguel@ximian.com>
3129 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
3130 might arrive here. I have my doubts that this is correct.
3132 * statement.cs (Lock): Implement lock statement.
3134 * cs-parser.jay: Small fixes to support `lock' and `using'
3136 * cs-tokenizer.cs: Remove extra space
3138 * driver.cs: New flag --checked, allows to turn on integer math
3141 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
3142 Threading.Monitor.Exit
3144 2001-10-23 Miguel de Icaza <miguel@ximian.com>
3146 * expression.cs (IndexerAccess::DoResolveLValue): Set the
3147 Expression Class to be IndexerAccess.
3149 Notice that Indexer::DoResolve sets the eclass to Value.
3151 2001-10-22 Miguel de Icaza <miguel@ximian.com>
3153 * class.cs (TypeContainer::Emit): Emit code for indexers.
3155 * assign.cs (IAssignMethod): New interface implemented by Indexers
3156 and Properties for handling assignment.
3158 (Assign::Emit): Simplify and reuse code.
3160 * expression.cs (IndexerAccess, PropertyExpr): Implement
3161 IAssignMethod, clean up old code.
3163 2001-10-22 Ravi Pratap <ravi@ximian.com>
3165 * typemanager.cs (ImplementsInterface): New method to determine if a type
3166 implements a given interface. Provides a nice cache too.
3168 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
3171 (ConvertReferenceExplicit): Ditto.
3173 * delegate.cs (Delegate::Populate): Update to define the parameters on the
3174 various methods, with correct names etc.
3176 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
3177 Operator.UnaryNegation.
3179 * cs-parser.jay (operator_declarator): Be a little clever in the case where
3180 we have a unary plus or minus operator.
3182 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
3185 * everywhere : update accordingly.
3187 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
3190 * class.cs (Method::Define): For the case where we are implementing a method
3191 inherited from an interface, we need to set the MethodAttributes.Final flag too.
3192 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
3194 2001-10-21 Ravi Pratap <ravi@ximian.com>
3196 * interface.cs (FindMembers): Implement to work around S.R.E
3199 * typemanager.cs (IsInterfaceType): Implement.
3201 (FindMembers): Update to handle interface types too.
3203 * expression.cs (ImplicitReferenceConversion): Re-write bits which
3204 use IsAssignableFrom as that is not correct - it doesn't work.
3206 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
3207 and accordingly override EmitStatement.
3209 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
3210 using the correct logic :-)
3212 2001-10-19 Ravi Pratap <ravi@ximian.com>
3214 * ../errors/cs-11.cs : Add to demonstrate error -11
3216 2001-10-17 Miguel de Icaza <miguel@ximian.com>
3218 * assign.cs (Assign::Resolve): Resolve right hand side first, and
3219 then pass this as a hint to ResolveLValue.
3221 * expression.cs (FieldExpr): Add Location information
3223 (FieldExpr::LValueResolve): Report assignment to readonly
3226 (Expression::ExprClassFromMemberInfo): Pass location information.
3228 (Expression::ResolveLValue): Add new method that resolves an
3231 (Expression::DoResolveLValue): Default invocation calls
3234 (Indexers): New class used to keep track of indexers in a given
3237 (IStackStore): Renamed from LValue, as it did not really describe
3238 what this did. Also ResolveLValue is gone from this interface and
3239 now is part of Expression.
3241 (ElementAccess): Depending on the element access type
3243 * typemanager.cs: Add `indexer_name_type' as a Core type
3244 (System.Runtime.CompilerServices.IndexerNameAttribute)
3246 * statement.cs (Goto): Take a location.
3248 2001-10-18 Ravi Pratap <ravi@ximian.com>
3250 * delegate.cs (Delegate::VerifyDelegate): New method to verify
3251 if two delegates are compatible.
3253 (NewDelegate::DoResolve): Update to take care of the case when
3254 we instantiate a delegate from another delegate.
3256 * typemanager.cs (FindMembers): Don't even try to look up members
3257 of Delegate types for now.
3259 2001-10-18 Ravi Pratap <ravi@ximian.com>
3261 * delegate.cs (NewDelegate): New class to take care of delegate
3264 * expression.cs (New): Split the delegate related code out into
3265 the NewDelegate class.
3267 * delegate.cs (DelegateInvocation): New class to handle delegate
3270 * expression.cs (Invocation): Split out delegate related code into
3271 the DelegateInvocation class.
3273 2001-10-17 Ravi Pratap <ravi@ximian.com>
3275 * expression.cs (New::DoResolve): Implement delegate creation fully
3276 and according to the spec.
3278 (New::DoEmit): Update to handle delegates differently.
3280 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
3281 because of which we were printing out arguments in reverse order !
3283 * delegate.cs (VerifyMethod): Implement to check if the given method
3284 matches the delegate.
3286 (FullDelegateDesc): Implement.
3288 (VerifyApplicability): Implement.
3290 * expression.cs (Invocation::DoResolve): Update to accordingly handle
3291 delegate invocations too.
3293 (Invocation::Emit): Ditto.
3295 * ../errors/cs1593.cs : Added.
3297 * ../errors/cs1594.cs : Added.
3299 * delegate.cs (InstanceExpression, TargetMethod): New properties.
3301 2001-10-16 Ravi Pratap <ravi@ximian.com>
3303 * typemanager.cs (intptr_type): Core type for System.IntPtr
3305 (InitCoreTypes): Update for the same.
3307 (iasyncresult_type, asynccallback_type): Ditto.
3309 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
3312 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
3315 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
3316 the builders for the 4 members of a delegate type :-)
3318 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
3321 * expression.cs (New::DoResolve): Implement guts for delegate creation.
3323 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
3325 2001-10-15 Miguel de Icaza <miguel@ximian.com>
3327 * statement.cs (Break::Emit): Implement.
3328 (Continue::Emit): Implement.
3330 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
3331 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
3332 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
3333 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
3336 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
3337 properties that track the label for the current loop (begin of the
3338 loop and end of the loop).
3340 2001-10-15 Ravi Pratap <ravi@ximian.com>
3342 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
3343 use of emitting anything at all.
3345 * class.cs, rootcontext.cs : Get rid of calls to the same.
3347 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
3349 (Populate): Define the constructor correctly and set the implementation
3352 * typemanager.cs (delegate_types): New hashtable to hold delegates that
3355 (AddDelegateType): Implement.
3357 (IsDelegateType): Implement helper method.
3359 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
3361 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
3362 and accordingly handle it.
3364 * delegate.cs (Populate): Take TypeContainer argument.
3365 Implement bits to define the Invoke method. However, I still haven't figured out
3366 how to take care of the native int bit :-(
3368 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
3369 Qualify the name of the delegate, not its return type !
3371 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
3374 (StandardConversionExists): Checking for array types turns out to be recursive.
3376 (ConvertReferenceExplicit): Implement array conversion.
3378 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
3380 2001-10-12 Ravi Pratap <ravi@ximian.com>
3382 * cs-parser.jay (delegate_declaration): Store the fully qualified
3383 name as it is a type declaration.
3385 * delegate.cs (ReturnType, Name): Rename members to these. Make them
3388 (DefineDelegate): Renamed from Define. Does the same thing essentially,
3389 as TypeContainer::DefineType.
3391 (Populate): Method in which all the definition of the various methods (Invoke)
3394 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
3397 (CloseDelegate): Finally creates the delegate.
3399 * class.cs (TypeContainer::DefineType): Update to define delegates.
3400 (Populate, Emit and CloseType): Do the same thing here too.
3402 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
3403 delegates in all these operations.
3405 2001-10-14 Miguel de Icaza <miguel@ximian.com>
3407 * expression.cs: LocalTemporary: a new expression used to
3408 reference a temporary that has been created.
3410 * assign.cs: Handle PropertyAccess back here, so that we can
3411 provide the proper semantic access to properties.
3413 * expression.cs (Expression::ConvertReferenceExplicit): Implement
3414 a few more explicit conversions.
3416 * modifiers.cs: `NEW' modifier maps to HideBySig.
3418 * expression.cs (PropertyExpr): Make this into an
3419 ExpressionStatement, and support the EmitStatement code path.
3421 Perform get/set error checking, clean up the interface.
3423 * assign.cs: recognize PropertyExprs as targets, and if so, turn
3424 them into toplevel access objects.
3426 2001-10-12 Miguel de Icaza <miguel@ximian.com>
3428 * expression.cs: PropertyExpr::PropertyExpr: use work around the
3431 * typemanager.cs: Keep track here of our PropertyBuilders again to
3432 work around lameness in SRE.
3434 2001-10-11 Miguel de Icaza <miguel@ximian.com>
3436 * expression.cs (LValue::LValueResolve): New method in the
3437 interface, used to perform a second resolution pass for LValues.
3439 (This::DoResolve): Catch the use of this in static methods.
3441 (This::LValueResolve): Implement.
3443 (This::Store): Remove warning, assigning to `this' in structures
3446 (Invocation::Emit): Deal with invocation of
3447 methods on value types. We need to pass the address to structure
3448 methods rather than the object itself. (The equivalent code to
3449 emit "this" for structures leaves the entire structure on the
3450 stack instead of a pointer to it).
3452 (ParameterReference::DoResolve): Compute the real index for the
3453 argument based on whether the method takes or not a `this' pointer
3454 (ie, the method is static).
3456 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
3457 value types returned from functions when we need to invoke a
3458 method on the sturcture.
3461 2001-10-11 Ravi Pratap <ravi@ximian.com>
3463 * class.cs (TypeContainer::DefineType): Method to actually do the business of
3464 defining the type in the Modulebuilder or Typebuilder. This is to take
3465 care of nested types which need to be defined on the TypeBuilder using
3468 (TypeContainer::GetClassBases): Implement. Essentially the code from the
3469 methods in RootContext, only ported to be part of TypeContainer.
3471 (TypeContainer::GetInterfaceOrClass): Ditto.
3473 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
3475 * interface.cs (Interface::DefineInterface): New method. Does exactly
3476 what RootContext.CreateInterface did earlier, only it takes care of nested types
3479 (Interface::GetInterfaces): Move from RootContext here and port.
3481 (Interface::GetInterfaceByName): Same here.
3483 * rootcontext.cs (ResolveTree): Re-write.
3485 (PopulateTypes): Re-write.
3487 * class.cs (TypeContainer::Populate): Populate nested types too.
3488 (TypeContainer::Emit): Emit nested members too.
3490 * typemanager.cs (AddUserType): Do not make use of the FullName property,
3491 instead just use the name argument passed in as it is already fully
3494 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
3495 to TypeContainer mapping to see if a type is user-defined.
3497 * class.cs (TypeContainer::CloseType): Implement.
3499 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
3500 the default constructor.
3502 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
3505 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
3507 * interface.cs (CloseType): Create the type here.
3509 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
3512 Remove all the methods which are now in TypeContainer.
3514 2001-10-10 Ravi Pratap <ravi@ximian.com>
3516 * delegate.cs (Define): Re-write bits to define the delegate
3519 2001-10-10 Miguel de Icaza <miguel@ximian.com>
3521 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
3523 * expression.cs (ImplicitReferenceConversion): handle null as well
3524 as a source to convert to any reference type.
3526 * statement.cs (Return): Perform any implicit conversions to
3527 expected return type.
3529 Validate use of return statement.
3531 * codegen.cs (EmitContext): Pass the expected return type here.
3533 * class.cs (Method, Constructor, Property): Pass expected return
3534 type to EmitContext.
3536 2001-10-09 Miguel de Icaza <miguel@ximian.com>
3538 * expression.cs: Make DoResolve take an EmitContext instead of a
3541 Replaced `l' and `location' for `loc', for consistency.
3543 (Error, Warning): Remove unneeded Tc argument.
3545 * assign.cs, literal.cs, constant.cs: Update to new calling
3548 * codegen.cs: EmitContext now contains a flag indicating whether
3549 code is being generated in a static method or not.
3551 * cs-parser.jay: DecomposeQI, new function that replaces the old
3552 QualifiedIdentifier. Now we always decompose the assembled
3553 strings from qualified_identifier productions into a group of
3556 2001-10-08 Miguel de Icaza <miguel@ximian.com>
3558 * rootcontext.cs: Deal with field-less struct types correctly now
3559 by passing the size option to Define Type.
3561 * class.cs: Removed hack that created one static field.
3563 2001-10-07 Miguel de Icaza <miguel@ximian.com>
3565 * statement.cs: Moved most of the code generation here.
3567 2001-10-09 Ravi Pratap <ravi@ximian.com>
3569 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
3572 (ElementAccess): Remove useless bits for now - keep checks as the spec
3575 2001-10-08 Ravi Pratap <ravi@ximian.com>
3577 * expression.cs (ElementAccess::DoResolve): Remove my crap code
3578 and start performing checks according to the spec.
3580 2001-10-07 Ravi Pratap <ravi@ximian.com>
3582 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
3583 rank_specifiers instead.
3585 (rank_specifiers): Change the order in which the rank specifiers are stored
3587 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
3589 * expression.cs (ElementAccess): Implement the LValue interface too.
3591 2001-10-06 Ravi Pratap <ravi@ximian.com>
3593 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
3594 except that user defined conversions are not included.
3596 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
3597 perform the conversion of the return type, if necessary.
3599 (New::DoResolve): Check whether we are creating an array or an object
3600 and accordingly do the needful.
3602 (New::Emit): Same here.
3604 (New::DoResolve): Implement guts of array creation.
3606 (New::FormLookupType): Helper function.
3608 2001-10-07 Miguel de Icaza <miguel@ximian.com>
3610 * codegen.cs: Removed most of the code generation here, and move the
3611 corresponding code generation bits to the statement classes.
3613 Added support for try/catch/finalize and throw.
3615 * cs-parser.jay: Added support for try/catch/finalize.
3617 * class.cs: Catch static methods having the flags override,
3618 virtual or abstract.
3620 * expression.cs (UserCast): This user cast was not really doing
3621 what it was supposed to do. Which is to be born in fully resolved
3622 state. Parts of the resolution were being performed at Emit time!
3626 2001-10-05 Miguel de Icaza <miguel@ximian.com>
3628 * expression.cs: Implicity convert the result from UserCast.
3630 2001-10-05 Ravi Pratap <ravi@ximian.com>
3632 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
3633 prevented it from working correctly.
3635 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
3636 merely ConvertImplicit.
3638 2001-10-05 Miguel de Icaza <miguel@ximian.com>
3640 * typemanager.cs: Make the LookupTypeContainer function static,
3641 and not per-instance.
3643 * class.cs: Make static FindMembers (the one that takes a Type
3646 * codegen.cs: Add EmitForeach here.
3648 * cs-parser.jay: Make foreach a toplevel object instead of the
3649 inline expansion, as we need to perform semantic analysis on it.
3651 2001-10-05 Ravi Pratap <ravi@ximian.com>
3653 * expression.cs (Expression::ImplicitUserConversion): Rename to
3654 UserDefinedConversion.
3656 (Expression::UserDefinedConversion): Take an extra argument specifying
3657 whether we look for explicit user conversions too.
3659 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
3661 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
3663 (ExplicitUserConversion): Make it a call to UserDefinedConversion
3664 with the appropriate arguments.
3666 * cs-parser.jay (cast_expression): Record location too.
3668 * expression.cs (Cast): Record location info.
3670 (Expression::ConvertExplicit): Take location argument.
3672 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
3673 to determine if we are doing explicit conversions.
3675 (UserCast::Emit): Update accordingly.
3677 (Expression::ConvertExplicit): Report an error if everything fails.
3679 * ../errors/cs0030.cs : Add.
3681 2001-10-04 Miguel de Icaza <miguel@ximian.com>
3683 * modifiers.cs: If the ABSTRACT keyword is present, also set the
3684 virtual and newslot bits.
3686 * class.cs (TypeContainer::RegisterRequiredImplementations):
3687 Record methods we need.
3689 (TypeContainer::MakeKey): Helper function to make keys for
3690 MethodBases, since the Methodbase key is useless.
3692 (TypeContainer::Populate): Call RegisterRequiredImplementations
3693 before defining the methods.
3695 Create a mapping for method_builders_to_methods ahead of time
3696 instead of inside a tight loop.
3698 (::RequireMethods): Accept an object as the data to set into the
3699 hashtable so we can report interface vs abstract method mismatch.
3701 2001-10-03 Miguel de Icaza <miguel@ximian.com>
3703 * report.cs: Make all of it static.
3705 * rootcontext.cs: Drop object_type and value_type computations, as
3706 we have those in the TypeManager anyways.
3708 Drop report instance variable too, now it is a global.
3710 * driver.cs: Use try/catch on command line handling.
3712 Add --probe option to debug the error reporting system with a test
3715 * report.cs: Add support for exiting program when a probe
3716 condition is reached.
3718 2001-10-03 Ravi Pratap <ravi@ximian.com>
3720 * expression.cs (Binary::DoNumericPromotions): Fix the case when
3721 we do a forcible conversion regardless of type, to check if
3722 ForceConversion returns a null.
3724 (Binary::error19): Use location to report error.
3726 (Unary::error23): Use location here too.
3728 * ../errors/cs0019.cs : Check in.
3730 * ../errors/cs0023.cs : Check in.
3732 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
3733 case of a non-null MethodInfo object with a length of 0 !
3735 (Binary::ResolveOperator): Flag error if overload resolution fails to find
3736 an applicable member - according to the spec :-)
3737 Also fix logic to find members in base types.
3739 (Unary::ResolveOperator): Same here.
3741 (Unary::report23): Change name to error23 and make first argument a TypeContainer
3742 as I was getting thoroughly confused between this and error19 :-)
3744 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
3745 (::FindMostEncompassedType): Implement.
3746 (::FindMostEncompassingType): Implement.
3747 (::StandardConversionExists): Implement.
3749 (UserImplicitCast): Re-vamp. We now need info about most specific
3750 source and target types so that we can do the necessary conversions.
3752 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
3753 mathematical union with no duplicates.
3755 2001-10-03 Miguel de Icaza <miguel@ximian.com>
3757 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
3758 in order from base classes to child classes, so that we can in
3759 child classes look up in our parent for method names and
3760 attributes (required for handling abstract, virtual, new, override
3761 constructs: we need to instrospect our base class, and if we dont
3762 populate the classes in order, the introspection might be
3763 incorrect. For example, a method could query its parent before
3764 the parent has any methods and would determine that the parent has
3765 no abstract methods (while it could have had them)).
3767 (RootContext::CreateType): Record the order in which we define the
3770 2001-10-02 Miguel de Icaza <miguel@ximian.com>
3772 * class.cs (TypeContainer::Populate): Also method definitions can
3773 fail now, keep track of this.
3775 (TypeContainer::FindMembers): Implement support for
3776 DeclaredOnly/noDeclaredOnly flag.
3778 (Constructor::Emit) Return the ConstructorBuilder.
3780 (Method::Emit) Return the MethodBuilder.
3781 Check for abstract or virtual methods to be public.
3783 * rootcontext.cs (RootContext::CreateType): Register all the
3784 abstract methods required for the class to be complete and the
3785 interface methods that must be implemented.
3787 * cs-parser.jay: Report error 501 (method requires body if it is
3788 not marked abstract or extern).
3790 * expression.cs (TypeOf::Emit): Implement.
3792 * typemanager.cs: runtime_handle_type, new global type.
3794 * class.cs (Property::Emit): Generate code for properties.
3796 2001-10-02 Ravi Pratap <ravi@ximian.com>
3798 * expression.cs (Unary::ResolveOperator): Find operators on base type
3799 too - we now conform exactly to the spec.
3801 (Binary::ResolveOperator): Same here.
3803 * class.cs (Operator::Define): Fix minor quirk in the tests.
3805 * ../errors/cs0215.cs : Added.
3807 * ../errors/cs0556.cs : Added.
3809 * ../errors/cs0555.cs : Added.
3811 2001-10-01 Miguel de Icaza <miguel@ximian.com>
3813 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
3814 single integer which is really efficient
3816 2001-10-01 Ravi Pratap <ravi@ximian.com>
3818 * expression.cs (Expression::ImplicitUserConversion): Use location
3819 even in the case when we are examining True operators.
3821 * class.cs (Operator::Define): Perform extensive checks to conform
3822 with the rules for operator overloading in the spec.
3824 * expression.cs (Expression::ImplicitReferenceConversion): Implement
3825 some of the other conversions mentioned in the spec.
3827 * typemanager.cs (array_type): New static member for the System.Array built-in
3830 (cloneable_interface): For System.ICloneable interface.
3832 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
3833 we start resolving the tree and populating types.
3835 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
3837 2001-10-01 Miguel de Icaza <miguel@ximian.com>
3839 * expression.cs (Expression::ExprClassFromMemberInfo,
3840 Expression::Literalize): Create literal expressions from
3841 FieldInfos which are literals.
3843 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
3844 type casts, because they were wrong. The test suite in tests
3847 (ImplicitNumericConversion): ushort to ulong requires a widening
3850 Int32 constant to long requires widening cast as well.
3852 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
3853 for integers because the type on the stack is not i4.
3855 2001-09-30 Miguel de Icaza <miguel@ximian.com>
3857 * expression.cs (report118): require location argument.
3859 * parameter.cs: Do not dereference potential null value.
3861 * class.cs: Catch methods that lack the `new' keyword when
3862 overriding a name. Report warnings when `new' is used without
3863 anything being there to override.
3865 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
3867 * class.cs: Only add constructor to hashtable if it is non-null
3868 (as now constructors can fail on define).
3870 (TypeManager, Class, Struct): Take location arguments.
3872 Catch field instance initialization in structs as errors.
3874 accepting_filter: a new filter for FindMembers that is static so
3875 that we dont create an instance per invocation.
3877 (Constructor::Define): Catch errors where a struct constructor is
3880 * cs-parser.jay: Pass location information for various new
3883 * delegate.cs (Delegate): take a location argument.
3885 * driver.cs: Do not call EmitCode if there were problesm in the
3886 Definition of the types, as many Builders wont be there.
3888 * decl.cs (Decl::Decl): Require a location argument.
3890 * cs-tokenizer.cs: Handle properly hex constants that can not fit
3891 into integers, and find the most appropiate integer for it.
3893 * literal.cs: Implement ULongLiteral.
3895 * rootcontext.cs: Provide better information about the location of
3896 failure when CreateType fails.
3898 2001-09-29 Miguel de Icaza <miguel@ximian.com>
3900 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
3903 * expression.cs (Binary::CheckShiftArguments): Add missing type
3905 (Binary::ResolveOperator): Add type to the logical and and logical
3906 or, Bitwise And/Or and Exclusive Or code paths, it was missing
3909 (Binary::DoNumericPromotions): In the case where either argument
3910 is ulong (and most signed types combined with ulong cause an
3911 error) perform implicit integer constant conversions as well.
3913 2001-09-28 Miguel de Icaza <miguel@ximian.com>
3915 * expression.cs (UserImplicitCast): Method should always be
3917 (Invocation::BetterConversion): Simplified test for IntLiteral.
3919 (Expression::ImplicitNumericConversion): Split this routine out.
3920 Put the code that performs implicit constant integer conversions
3923 (Expression::Resolve): Become a wrapper around DoResolve so we can
3924 check eclass and type being set after resolve.
3926 (Invocation::Badness): Remove this dead function
3928 (Binary::ResolveOperator): Do not compute the expensive argumnets
3929 unless we have a union for it.
3931 (Probe::Emit): Is needs to do an isinst and then
3932 compare against null.
3934 (::CanConvert): Added Location argument. If the Location argument
3935 is null (Location.Null), then we do not report errors. This is
3936 used by the `probe' mechanism of the Explicit conversion. We do
3937 not want to generate an error for something that the user
3938 explicitly requested to be casted. But the pipeline for an
3939 explicit cast first tests for potential implicit casts.
3941 So for now, if the Location is null, it means `Probe only' to
3942 avoid adding another argument. Might have to revise this
3945 (ClassCast): New class used to type cast objects into arbitrary
3946 classes (used in Explicit Reference Conversions).
3948 Implement `as' as well.
3950 Reverted all the patches from Ravi below: they were broken:
3952 * The use of `level' as a mechanism to stop recursive
3953 invocations is wrong. That was there just to catch the
3954 bug with a strack trace but not as a way of addressing
3957 To fix the problem we have to *understand* what is going
3958 on and the interactions and come up with a plan, not
3959 just get things going.
3961 * The use of the type conversion cache that I proposed
3962 last night had an open topic: How does this work across
3963 protection domains. A user defined conversion might not
3964 be public in the location where we are applying the
3965 conversion, a different conversion might be selected
3966 (ie, private A->B (better) but public B->A (worse),
3967 inside A, A->B applies, but outside it, B->A will
3970 * On top of that (ie, even if the above is solved),
3971 conversions in a cache need to be abstract. Ie, `To
3972 convert from an Int to a Short use an OpcodeCast', not
3973 `To convert from an Int to a Short use the OpcodeCast on
3974 the variable 5' (which is what this patch was doing).
3976 2001-09-28 Ravi Pratap <ravi@ximian.com>
3978 * expression.cs (Invocation::ConversionExists): Re-write to use
3979 the conversion cache
3981 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
3982 cache all conversions done, not just user-defined ones.
3984 (Invocation::BetterConversion): The real culprit. Use ConversionExists
3985 to determine if a conversion exists instead of acutually trying to
3986 perform the conversion. It's faster too.
3988 (Expression::ConvertExplicit): Modify to use ConversionExists to check
3989 and only then attempt the implicit conversion.
3991 2001-09-28 Ravi Pratap <ravi@ximian.com>
3993 * expression.cs (ConvertImplicit): Use a cache for conversions
3994 already found. Check level of recursion and bail out if necessary.
3996 2001-09-28 Miguel de Icaza <miguel@ximian.com>
3998 * typemanager.cs (string_concat_string_string, string_concat_object_object):
3999 Export standard methods that we expect for string operations.
4001 * statement.cs (Block::UsageWarning): Track usage of variables and
4002 report the errors for not used variables.
4004 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
4007 2001-09-27 Miguel de Icaza <miguel@ximian.com>
4009 * codegen.cs: remove unnneded code
4011 * expression.cs: Removed BuiltinTypeAccess class
4013 Fix the order in which implicit conversions are
4016 The previous fixed dropped support for boxed conversions (adding a
4017 test to the test suite now)
4019 (UserImplicitCast::CanConvert): Remove test for source being null,
4020 that code is broken. We should not feed a null to begin with, if
4021 we do, then we should track the bug where the problem originates
4022 and not try to cover it up here.
4024 Return a resolved expression of type UserImplicitCast on success
4025 rather than true/false. Ravi: this is what I was talking about,
4026 the pattern is to use a static method as a "constructor" for
4029 Also, do not create arguments until the very last minute,
4030 otherwise we always create the arguments even for lookups that
4031 will never be performed.
4033 (UserImplicitCast::Resolve): Eliminate, objects of type
4034 UserImplicitCast are born in a fully resolved state.
4036 * typemanager.cs (InitCoreTypes): Init also value_type
4039 * expression.cs (Cast::Resolve): First resolve the child expression.
4041 (LValue): Add new method AddressOf to be used by
4044 Change the argument of Store to take an EmitContext instead of an
4045 ILGenerator, because things like FieldExpr need to be able to call
4046 their children expression to generate the instance code.
4048 (Expression::Error, Expression::Warning): Sugar functions for
4051 (Expression::MemberLookup): Accept a TypeContainer instead of a
4052 Report as the first argument.
4054 (Expression::ResolvePrimary): Killed. I still want to improve
4055 this as currently the code is just not right.
4057 (Expression::ResolveMemberAccess): Simplify, but it is still
4060 (Unary::Resolve): Catch errors in AddressOf operators.
4062 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
4063 index to a byte for the short-version, or the compiler will choose
4064 the wrong Emit call, which generates the wrong data.
4066 (ParameterReference::Emit, ::Store): same.
4068 (FieldExpr::AddressOf): Implement.
4070 * typemanager.cs: TypeManager: made public variable instead of
4073 * driver.cs: document --fatal.
4075 * report.cs (ErrorMessage, WarningMessage): new names for the old
4076 Error and Warning classes.
4078 * cs-parser.jay (member_access): Turn built-in access to types
4079 into a normal simplename
4081 2001-09-27 Ravi Pratap <ravi@ximian.com>
4083 * expression.cs (Invocation::BetterConversion): Fix to cope
4084 with q being null, since this was introducing a bug.
4086 * expression.cs (ConvertImplicit): Do built-in conversions first.
4088 2001-09-27 Ravi Pratap <ravi@ximian.com>
4090 * expression.cs (UserImplicitCast::Resolve): Fix bug.
4092 2001-09-27 Ravi Pratap <ravi@ximian.com>
4094 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
4095 I had introduced long ago (what's new ?).
4097 * expression.cs (UserImplicitCast::CanConvert): Static method to do
4098 the work of all the checking.
4099 (ConvertImplicit): Call CanConvert and only then create object if necessary.
4100 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
4102 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
4103 that is the right way.
4105 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
4106 overloading resolution. Use everywhere instead of cutting and pasting code.
4108 (Binary::ResolveOperator): Use MakeUnionSet.
4110 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
4111 we have to convert to bool types. Not complete yet.
4113 2001-09-27 Miguel de Icaza <miguel@ximian.com>
4115 * typemanager.cs (TypeManager::CSharpName): support ushort.
4117 * expression.cs (Expression::TryImplicitIntConversion): Attempts
4118 to provide an expression that performsn an implicit constant int
4119 conversion (section 6.1.6).
4120 (Expression::ConvertImplicitRequired): Reworked to include
4121 implicit constant expression conversions.
4123 (Expression::ConvertNumericExplicit): Finished.
4125 (Invocation::Emit): If InstanceExpression is null, then it means
4126 that we perform a call on this.
4128 2001-09-26 Miguel de Icaza <miguel@ximian.com>
4130 * expression.cs (Unary::Emit): Remove some dead code.
4131 (Probe): Implement Resolve and Emit for `is'.
4132 (Expression::ConvertImplicitRequired): Attempt to do constant
4133 expression conversions here. Maybe should be moved to
4134 ConvertImplicit, but I am not sure.
4135 (Expression::ImplicitLongConstantConversionPossible,
4136 Expression::ImplicitIntConstantConversionPossible): New functions
4137 that tell whether is it possible to apply an implicit constant
4138 expression conversion.
4140 (ConvertNumericExplicit): Started work on explicit numeric
4143 * cs-parser.jay: Update operator constants.
4145 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
4146 (Parameters::GetSignature): Hook up VerifyArgs here.
4147 (Parameters::VerifyArgs): Verifies that no two arguments have the
4150 * class.cs (Operator): Update the operator names to reflect the
4151 ones that the spec expects (as we are just stringizing the
4154 * expression.cs (Unary::ResolveOperator): Fix bug: Use
4155 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
4156 previous usage did only work for our methods.
4157 (Expression::ConvertImplicit): Handle decimal implicit numeric
4158 conversions as well.
4159 (Expression::InternalTypeConstructor): Used to invoke constructors
4160 on internal types for default promotions.
4162 (Unary::Emit): Implement special handling for the pre/post
4163 increment/decrement for overloaded operators, as they need to have
4164 the same semantics as the other operators.
4166 (Binary::ResolveOperator): ditto.
4167 (Invocation::ConversionExists): ditto.
4168 (UserImplicitCast::Resolve): ditto.
4170 2001-09-26 Ravi Pratap <ravi@ximian.com>
4172 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
4173 operator, return after emitting body. Regression tests pass again !
4175 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
4176 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
4177 (Invocation::OverloadResolve): Ditto.
4178 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
4180 * everywhere : update calls to the above methods accordingly.
4182 2001-09-26 Miguel de Icaza <miguel@ximian.com>
4184 * assign.cs (Assign): Make it inherit from ExpressionStatement.
4186 * expression.cs (ExpressionStatement): New base class used for
4187 expressions that can appear in statements, so that we can provide
4188 an alternate path to generate expression that do not leave a value
4191 (Expression::Emit, and all the derivatives): We no longer return
4192 whether a value is left on the stack or not. Every expression
4193 after being emitted leaves a single value on the stack.
4195 * codegen.cs (EmitContext::EmitStatementExpression): Use the
4196 facilties of ExpressionStatement if possible.
4198 * cs-parser.jay: Update statement_expression.
4200 2001-09-25 Miguel de Icaza <miguel@ximian.com>
4202 * driver.cs: Change the wording of message
4204 2001-09-25 Ravi Pratap <ravi@ximian.com>
4206 * expression.cs (Binary::ResolveOperator): Had forgottten to set
4207 the type of the expression to the return type of the method if
4208 we have an overloaded operator match ! The regression tests pass again !
4209 (Unary::ResolveOperator): Ditto.
4211 * expression.cs (Invocation::ConversionExists): Correct the member lookup
4212 to find "op_Implicit", not "implicit" ;-)
4213 (UserImplicitCast): New class to take care of user-defined implicit conversions.
4214 (ConvertImplicit, ForceConversion): Take TypeContainer argument
4216 * everywhere : Correct calls to the above accordingly.
4218 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
4219 (ConvertImplicit): Do user-defined conversion if it exists.
4221 2001-09-24 Miguel de Icaza <miguel@ximian.com>
4223 * assign.cs: track location.
4224 (Resolve): Use implicit conversions on assignment.
4226 * literal.cs: Oops. Not good, Emit of short access values should
4227 pass (Bytes) or the wrong argument will be selected.
4229 * expression.cs (Unary::Emit): Emit code for -expr.
4231 (Unary::ResolveOperator): Handle `Substract' for non-constants
4232 (substract from zero from the non-constants).
4233 Deal with Doubles as well.
4235 (Expression::ConvertImplicitRequired): New routine that reports an
4236 error if no implicit conversion exists.
4238 (Invocation::OverloadResolve): Store the converted implicit
4239 expressions if we make them
4241 2001-09-24 Ravi Pratap <ravi@ximian.com>
4243 * class.cs (ConstructorInitializer): Take a Location argument.
4244 (ConstructorBaseInitializer): Same here.
4245 (ConstructorThisInitializer): Same here.
4247 * cs-parser.jay : Update all calls accordingly.
4249 * expression.cs (Unary, Binary, New): Take location argument.
4250 Update accordingly everywhere.
4252 * cs-parser.jay : Update all calls to the above to take a location
4257 2001-09-24 Ravi Pratap <ravi@ximian.com>
4259 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
4260 (Invocation::BetterConversion): Same here
4261 (Invocation::ConversionExists): Ditto.
4263 (Invocation::ConversionExists): Implement.
4265 2001-09-22 Ravi Pratap <ravi@ximian.com>
4267 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
4268 Also take an additional TypeContainer argument.
4270 * All over : Pass in TypeContainer as argument to OverloadResolve.
4272 * typemanager.cs (CSharpName): Update to check for the string type and return
4275 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
4278 2001-09-21 Ravi Pratap <ravi@ximian.com>
4280 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
4281 (Invocation::BetterFunction): Implement.
4282 (Invocation::BetterConversion): Implement.
4283 (Invocation::ConversionExists): Skeleton, no implementation yet.
4285 Okay, things work fine !
4287 2001-09-21 Miguel de Icaza <miguel@ximian.com>
4289 * typemanager.cs: declare and load enum_type, delegate_type and
4292 * expression.cs (Expression::Emit): Now emit returns a value that
4293 tells whether a value is left on the stack or not. This strategy
4294 might be reveted tomorrow with a mechanism that would address
4295 multiple assignments.
4296 (Expression::report118): Utility routine to report mismatches on
4299 (Unary::Report23): Report impossible type/operator combination
4302 (Unary::IsIncrementableNumber): Whether the type can be
4303 incremented or decremented with add.
4304 (Unary::ResolveOperator): Also allow enumerations to be bitwise
4306 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
4308 (Invocation::Emit): Deal with new Emit convetion.
4310 * All Expression derivatives: Updated their Emit method to return
4311 whether they leave values on the stack or not.
4313 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
4314 stack for expressions that are statements.
4316 2001-09-20 Miguel de Icaza <miguel@ximian.com>
4318 * expression.cs (LValue): New interface. Must be implemented by
4320 (LocalVariableReference, ParameterReference, FieldExpr): Implement
4323 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
4324 interface for generating code, simplifies the code.
4326 2001-09-20 Ravi Pratap <ravi@ximian.com>
4328 * expression.cs (everywhere): Comment out return statements in ::Resolve
4329 methods to avoid the warnings.
4331 2001-09-20 Miguel de Icaza <miguel@ximian.com>
4333 * driver.cs (parse): Report error 2001 if we can not open the
4336 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
4339 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
4342 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
4343 otherwise nested blocks end up with the same index.
4345 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
4347 * expression.cs: Instead of having FIXMEs in the Resolve
4348 functions, throw exceptions so it is obvious that we are facing a
4351 * cs-parser.jay (invocation_expression): Pass Location information.
4353 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
4354 Use a basename for those routines because .NET does not like paths
4357 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
4360 2001-09-19 Miguel de Icaza <miguel@ximian.com>
4362 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
4363 are loading the correct data types (throws an exception if not).
4364 (TypeManager::InitCoreTypes): Use CoreLookupType
4366 * expression.cs (Unary::ResolveOperator): return the child
4367 expression for expressions which are just +expr.
4368 (Unary::ResolveOperator): Return negative literals for -LITERAL
4369 expressions (otherwise they are Unary {Literal}).
4370 (Invocation::Badness): Take into account `Implicit constant
4371 expression conversions'.
4373 * literal.cs (LongLiteral): Implement long literal class.
4374 (IntLiteral): export the `Value' of the intliteral.
4376 2001-09-19 Ravi Pratap <ravi@ximian.com>
4378 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
4380 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
4381 instead of 'Operator'
4383 * expression.cs (Binary::ResolveOperator): Update accordingly.
4384 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
4387 * cs-parser.jay (unary_expression): Update to use the new names.
4389 * gen-treedump.cs (GetUnary): Same here.
4391 * expression.cs (Unary::Resolve): Implement.
4392 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
4393 operators are found instead of making noise ;-)
4394 (Unary::ResolveOperator): New method to do precisely the same thing which
4395 Binary::ResolveOperator does for Binary expressions.
4396 (Unary.method, .Arguments): Add.
4397 (Unary::OperName): Implement.
4398 (Unary::ForceConversion): Copy and Paste !
4400 * class.cs (Operator::Define): Fix a small bug for the case when we have
4403 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
4404 for the inbuilt operators. Only overloading works for now ;-)
4406 2001-09-18 Miguel de Icaza <miguel@ximian.com>
4408 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
4409 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
4411 * expression.cs (This::Emit): Implement.
4412 (This::Resolve): Implement.
4413 (TypeOf:Resolve): Implement.
4414 (Expression::ResolveSimpleName): Add an implicit this to instance
4416 (MemberAccess::Resolve): Deal with Parameters and Fields.
4417 Bind instance variable to Field expressions.
4418 (FieldExpr::Instance): New field used to track the expression that
4419 represents the object instance.
4420 (FieldExpr::Resolve): Track potential errors from MemberLookup not
4422 (FieldExpr::Emit): Implement.
4424 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
4425 the last instruction contains a return opcode to avoid generating
4426 the last `ret' instruction (this generates correct code, and it is
4427 nice to pass the peverify output).
4429 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
4430 initializer for static and instance variables.
4431 (Constructor::Emit): Allow initializer to be null in the case of
4432 static constructors. Only emit initializer for instance
4435 (TypeContainer::FindMembers): Return a null array if there are no
4438 Also fix the code for the MemberTypes.Method branch, as it was not
4439 scanning that for operators (or tried to access null variables before).
4441 * assign.cs (Assign::Emit): Handle instance and static fields.
4445 * driver.cs: Stop compilation if there are parse errors.
4447 * cs-parser.jay (constructor_declaration): Provide default base
4448 initializer for non-static constructors.
4449 (constructor_declarator): Do not provide a default base
4450 initializers if none was specified.
4451 Catch the fact that constructors should not have parameters.
4453 * class.cs: Do not emit parent class initializers for static
4454 constructors, that should be flagged as an error.
4456 2001-09-18 Ravi Pratap <ravi@ximian.com>
4458 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
4459 Move back code into TypeContainer::Populate.
4461 2001-09-18 Ravi Pratap <ravi@ximian.com>
4463 * class.cs (TypeContainer::AddConstructor): Fix the check to
4464 compare against Name, not Basename.
4465 (Operator::OpType): Change Plus and Minus to Add and Subtract.
4467 * cs-parser.jay : Update accordingly.
4469 * class.cs (TypeContainer::FindMembers): For the case where we are searching
4470 for methods, don't forget to look into the operators too.
4471 (RegisterMethodBuilder): Helper method to take care of this for
4472 methods, constructors and operators.
4473 (Operator::Define): Completely revamp.
4474 (Operator.OperatorMethod, MethodName): New fields.
4475 (TypeContainer::Populate): Move the registering of builders into
4476 RegisterMethodBuilder.
4477 (Operator::Emit): Re-write.
4479 * expression.cs (Binary::Emit): Comment out code path to emit method
4480 invocation stuff for the case when we have a user defined operator. I am
4481 just not able to get it right !
4483 2001-09-17 Miguel de Icaza <miguel@ximian.com>
4485 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
4488 (Expression::MemberLookup): Provide a version that allows to
4489 specify the MemberTypes and BindingFlags.
4491 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
4492 so it was not fetching variable information from outer blocks.
4494 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
4495 Beforefieldinit as it was buggy.
4497 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
4500 * class.cs (Constructor::Emit): Only emit if block is not null.
4501 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
4502 deal with this by semantically definining it as if the user had
4505 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
4506 constructors as we now "emit" them at a higher level.
4508 (TypeContainer::DefineDefaultConstructor): Used to define the
4509 default constructors if none was provided.
4511 (ConstructorInitializer): Add methods Resolve and Emit.
4513 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
4515 2001-09-17 Ravi Pratap <ravi@ximian.com>
4517 * class.cs (TypeContainer::EmitDefaultConstructor): Register
4518 the default constructor builder with our hashtable for methodbuilders
4521 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
4522 and argument_count is 0 in which case we have a match.
4523 (Binary::ResolveOperator): More null checking and miscellaneous coding
4526 2001-09-17 Ravi Pratap <ravi@ximian.com>
4528 * rootcontext.cs (IsNameSpace): Compare against null.
4530 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
4532 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
4533 and Unary::Operator.
4535 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
4538 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
4539 we have overloaded operators.
4540 (Binary::ResolveOperator): Implement the part which does the operator overload
4543 * class.cs (Operator::Emit): Implement.
4544 (TypeContainer::Emit): Emit the operators we have too.
4546 * expression.cs (Binary::Emit): Update to emit the appropriate code for
4547 the case when we have a user-defined operator.
4549 2001-09-17 Miguel de Icaza <miguel@ximian.com>
4551 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
4553 2001-09-16 Ravi Pratap <ravi@ximian.com>
4555 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
4556 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
4557 (Constructor::Emit): Implement.
4558 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
4559 if we have no work to do.
4560 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
4563 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
4564 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
4566 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
4569 2001-09-15 Ravi Pratap <ravi@ximian.com>
4571 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
4573 (Tree::RecordNamespace): Method to do what the name says ;-)
4574 (Tree::Namespaces): Property to get at the namespaces hashtable.
4576 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
4579 * rootcontext.cs (IsNamespace): Fixed it :-)
4581 2001-09-14 Miguel de Icaza <miguel@ximian.com>
4583 * class.cs (TypeContainer::FindMembers): Add support for
4585 (MethodCore): New class that encapsulates both the shared aspects
4586 of a Constructor and a Method.
4587 (Method, Constructor): Factored pieces into MethodCore.
4589 * driver.cs: Added --fatal which makes errors throw exceptions.
4590 Load System assembly as well as part of the standard library.
4592 * report.cs: Allow throwing exceptions on errors for debugging.
4594 * modifiers.cs: Do not use `parent', instead use the real type
4595 container to evaluate permission settings.
4597 * class.cs: Put Ravi's patch back in. He is right, and we will
4598 have to cope with the
4600 2001-09-14 Ravi Pratap <ravi@ximian.com>
4602 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
4603 FamORAssem, not FamANDAssem.
4605 2001-09-14 Miguel de Icaza <miguel@ximian.com>
4607 * driver.cs: Added --parse option that only parses its input files
4610 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
4611 incorrect. IsTopLevel is not used to tell whether an object is
4612 root_types or not (that can be achieved by testing this ==
4613 root_types). But to see if this is a top-level *class* (not
4614 necessarly our "toplevel" container).
4616 2001-09-14 Ravi Pratap <ravi@ximian.com>
4618 * enum.cs (Enum::Define): Modify to call the Lookup method on the
4619 parent instead of a direct call to GetType.
4621 2001-09-14 Ravi Pratap <ravi@ximian.com>
4623 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
4624 Modifiers.TypeAttr. This should just be a call to that method.
4626 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
4627 object so that we can determine if we are top-level or not.
4629 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
4632 * enum.cs (Enum::Define): Ditto.
4634 * modifiers.cs (FieldAttr): Re-write.
4636 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
4637 (TypeContainer::HaveStaticConstructor): New property to provide access
4638 to precisely that info.
4640 * modifiers.cs (MethodAttr): Re-write.
4641 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
4643 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
4644 of top-level types as claimed.
4646 2001-09-13 Miguel de Icaza <miguel@ximian.com>
4648 * expression.cs (MemberLookup): Fruitless attempt to lookup
4649 constructors. Maybe I need to emit default constructors? That
4650 might be it (currently .NET emits this for me automatically).
4651 (Invocation::OverloadResolve): Cope with Arguments == null.
4652 (Invocation::EmitArguments): new function, shared by the new
4654 (Invocation::Emit): Handle static and instance methods. Emit
4655 proper call instruction for virtual or non-virtual invocations.
4656 (New::Emit): Implement.
4657 (New::Resolve): Implement.
4658 (MemberAccess:Resolve): Implement.
4659 (MethodGroupExpr::InstanceExpression): used conforming to the spec
4661 (FieldExpr::Resolve): Set type.
4663 * support.cs: Handle empty arguments.
4665 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
4666 SimpleLookup): Auxiliary routines to help parse a qualifier
4669 Update qualifier_identifier rule.
4671 * codegen.cs: Removed debugging messages.
4673 * class.cs: Make this a global thing, this acts just as a "key" to
4674 objects that we might have around.
4676 (Populate): Only initialize method_builders_to_methods once.
4678 * expression.cs (PropertyExpr): Initialize type from the
4681 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
4682 Resolve pattern. Attempt to implicitly convert value to boolean.
4685 * expression.cs: Set the type for the int32/int32 argument case.
4686 (Binary::ResolveOperator): Set the return type to boolean for
4687 comparission operators
4689 * typemanager.cs: Remove debugging print code.
4691 (Invocation::Resolve): resolve type.
4693 * class.cs: Allocate a MemberInfo of the correct size, as the code
4694 elsewhere depends on the test to reflect the correct contents.
4696 (Method::) Keep track of parameters, due to System.Reflection holes
4698 (TypeContainer::Populate): Keep track of MethodBuilders to Method
4701 (TypeContainer::FindMembers): Use ArrayList and then copy an array
4702 of the exact size and return that.
4704 (Class::LookupMethodByBuilder): New function that maps
4705 MethodBuilders to its methods. Required to locate the information
4706 on methods because System.Reflection bit us again.
4708 * support.cs: New file, contains an interface ParameterData and
4709 two implementations: ReflectionParameters and InternalParameters
4710 used to access Parameter information. We will need to grow this
4713 * expression.cs (Invocation::GetParameterData): implement a cache
4714 and a wrapper around the ParameterData creation for methods.
4715 (Invocation::OverloadResolve): Use new code.
4717 2001-09-13 Ravi Pratap <ravi@ximian.com>
4719 * class.cs (TypeContainer::EmitField): Remove and move into
4720 (Field::Define): here and modify accordingly.
4721 (Field.FieldBuilder): New member.
4722 (TypeContainer::Populate): Update accordingly.
4723 (TypeContainer::FindMembers): Implement.
4725 2001-09-13 Miguel de Icaza <miguel@ximian.com>
4727 * statement.cs: (VariableInfo::VariableType): New field to be
4728 initialized with the full type once it is resolved.
4730 2001-09-12 Miguel de Icaza <miguel@ximian.com>
4732 * parameter.cs (GetParameterInfo): Use a type cache to compute
4733 things only once, and to reuse this information
4735 * expression.cs (LocalVariableReference::Emit): Implement.
4736 (OpcodeCast::Emit): fix.
4738 (ParameterReference::Resolve): Implement.
4739 (ParameterReference::Emit): Implement.
4741 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
4742 that are expressions need to stay as Expressions.
4744 * typemanager.cs (CSharpName): Returns the C# name of a type if
4747 * expression.cs (Expression::ConvertImplicit): New function that
4748 implements implicit type conversions.
4750 (Expression::ImplicitReferenceConversion): Implements implicit
4751 reference conversions.
4753 (EmptyCast): New type for transparent casts.
4755 (OpcodeCast): New type for casts of types that are performed with
4756 a sequence of bytecodes.
4758 (BoxedCast): New type used for casting value types into reference
4759 types. Emits a box opcode.
4761 (Binary::DoNumericPromotions): Implements numeric promotions of
4762 and computation of the Binary::Type.
4764 (Binary::EmitBranchable): Optimization.
4766 (Binary::Emit): Implement code emission for expressions.
4768 * typemanager.cs (TypeManager): Added two new core types: sbyte
4771 2001-09-12 Ravi Pratap <ravi@ximian.com>
4773 * class.cs (TypeContainer::FindMembers): Method which does exactly
4774 what Type.FindMembers does, only we don't have to use reflection. No
4777 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
4778 typecontainer objects as we need to get at them.
4779 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
4781 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
4782 typecontainer object.
4784 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
4785 of just a Report object.
4787 2001-09-11 Ravi Pratap <ravi@ximian.com>
4789 * class.cs (Event::Define): Go back to using the prefixes "add_" and
4791 (TypeContainer::Populate): Now define the delegates of the type too.
4792 (TypeContainer.Delegates): Property to access the list of delegates defined
4795 * delegates.cs (Delegate::Define): Implement partially.
4797 * modifiers.cs (TypeAttr): Handle more flags.
4799 2001-09-11 Ravi Pratap <ravi@ximian.com>
4801 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
4803 (Operator::Define): Re-write logic to get types by using the LookupType method
4804 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
4805 (Indexer::Define): Ditto.
4806 (Event::Define): Ditto.
4807 (Property::Define): Ditto.
4809 2001-09-10 Ravi Pratap <ravi@ximian.com>
4811 * class.cs (TypeContainer::Populate): Now define operators too.
4812 (TypeContainer.Operators): New property to access the list of operators
4814 (Operator.OperatorMethodBuilder): New member to hold the method builder
4815 for the operator we are defining.
4816 (Operator::Define): Implement.
4818 2001-09-10 Ravi Pratap <ravi@ximian.com>
4820 * class.cs (Event::Define): Make the prefixes of the accessor methods
4821 addOn_ and removeOn_
4823 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
4824 of the location being passed in too. Ideally, this should go later since all
4825 error reporting should be done through the Report object.
4827 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
4828 (Populate): Iterate thru the indexers we have and define them too.
4829 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
4830 for the get and set accessors.
4831 (Indexer::Define): Implement.
4833 2001-09-09 Miguel de Icaza <miguel@ximian.com>
4835 * expression.cs (Binary::Resolve): Beginning of it. I scratched
4836 my previous implementation, did not work.
4838 * typemanager.cs: Add a couple of missing types (the longs).
4840 * literal.cs: Use TypeManager.bool_type instead of getting it.
4842 * expression.cs (EventExpr): New kind of expressions.
4843 (Expressio::ExprClassFromMemberInfo): finish
4845 2001-09-08 Miguel de Icaza <miguel@ximian.com>
4847 * assign.cs: Emit stores to static fields differently.
4849 2001-09-08 Ravi Pratap <ravi@ximian.com>
4851 * Merge in changes and adjust code to tackle conflicts. Backed out my
4852 code in Assign::Resolve ;-)
4854 2001-09-08 Ravi Pratap <ravi@ximian.com>
4856 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
4857 instead Report.Error and also pass in the location.
4858 (CSharpParser::Lexer): New readonly property to return the reference
4859 to the Tokenizer object.
4860 (declare_local_variables): Use Report.Error with location instead of plain
4864 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
4865 (Operator.CheckBinaryOperator): Ditto.
4867 * cs-parser.jay (operator_declarator): Update accordingly.
4869 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
4870 (CheckBinaryOperator): Same here.
4872 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
4873 on the name without any prefixes of namespace names etc. This is because we
4874 already might have something already fully qualified like
4875 'System.Console.WriteLine'
4877 * assign.cs (Resolve): Begin implementation. Stuck ;-)
4879 2001-09-07 Ravi Pratap <ravi@ximian.com>
4881 * cs-tokenizer.cs (location): Return a string which also contains
4884 * expression.cs (ElementAccess): New class for expressions of the
4885 type 'element access.'
4886 (BaseAccess): New class for expressions of the type 'base access.'
4887 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
4890 * cs-parser.jay (element_access): Implement action.
4891 (base_access): Implement actions.
4892 (checked_expression, unchecked_expression): Implement.
4894 * cs-parser.jay (local_variable_type): Correct and implement.
4895 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
4897 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
4899 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
4900 name and the specifiers.
4902 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
4904 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
4905 making them all public ;-)
4907 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
4910 2001-09-07 Miguel de Icaza <miguel@ximian.com>
4912 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
4914 (FieldExpr, PropertyExprs): New resolved expressions.
4915 (SimpleName::MemberStaticCheck): Perform static checks for access
4916 to non-static fields on static methods. Maybe this should be
4917 generalized for MemberAccesses.
4918 (SimpleName::ResolveSimpleName): More work on simple name
4921 * cs-parser.jay (primary_expression/qualified_identifier): track
4922 the parameter index.
4924 * codegen.cs (CodeGen::Save): Catch save exception, report error.
4925 (EmitContext::EmitBoolExpression): Chain to expression generation
4926 instead of temporary hack.
4927 (::EmitStatementExpression): Put generic expression code generation.
4929 * assign.cs (Assign::Emit): Implement variable assignments to
4930 local variables, parameters and fields.
4932 2001-09-06 Miguel de Icaza <miguel@ximian.com>
4934 * statement.cs (Block::GetVariableInfo): New method, returns the
4935 VariableInfo for a variable name in a block.
4936 (Block::GetVariableType): Implement in terms of GetVariableInfo
4938 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
4939 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
4941 2001-09-06 Ravi Pratap <ravi@ximian.com>
4943 * cs-parser.jay (operator_declaration): Continue on my quest : update
4944 to take attributes argument.
4945 (event_declaration): Ditto.
4946 (enum_declaration): Ditto.
4947 (indexer_declaration): Ditto.
4949 * class.cs (Operator::Operator): Update constructor accordingly.
4950 (Event::Event): Ditto.
4952 * delegate.cs (Delegate::Delegate): Same here.
4954 * enum.cs (Enum::Enum): Same here.
4956 2001-09-05 Ravi Pratap <ravi@ximian.com>
4958 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
4960 * ../tests/cs0658.cs : New file to demonstrate error 0658.
4962 * attribute.cs (Attributes): New class to encapsulate all attributes which were
4963 being passed around as an arraylist.
4964 (Attributes::AddAttribute): Method to add attribute sections.
4966 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
4967 (struct_declaration): Update accordingly.
4968 (constant_declaration): Update.
4969 (field_declaration): Update.
4970 (method_header): Update.
4971 (fixed_parameter): Update.
4972 (parameter_array): Ditto.
4973 (property_declaration): Ditto.
4974 (destructor_declaration): Ditto.
4976 * class.cs (Struct::Struct): Update constructors accordingly.
4977 (Class::Class): Ditto.
4978 (Field::Field): Ditto.
4979 (Method::Method): Ditto.
4980 (Property::Property): Ditto.
4981 (TypeContainer::OptAttribute): update property's return type.
4983 * interface.cs (Interface.opt_attributes): New member.
4984 (Interface::Interface): Update to take the extra Attributes argument.
4986 * parameter.cs (Parameter::Parameter): Ditto.
4988 * constant.cs (Constant::Constant): Ditto.
4990 * interface.cs (InterfaceMemberBase): New OptAttributes field.
4991 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
4992 the attributes as a parameter.
4993 (InterfaceProperty): Update constructor call.
4994 (InterfaceEvent): Ditto.
4995 (InterfaceMethod): Ditto.
4996 (InterfaceIndexer): Ditto.
4998 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
4999 pass the attributes too.
5000 (interface_event_declaration): Ditto.
5001 (interface_property_declaration): Ditto.
5002 (interface_method_declaration): Ditto.
5003 (interface_declaration): Ditto.
5005 2001-09-05 Miguel de Icaza <miguel@ximian.com>
5007 * class.cs (Method::Define): Track the "static Main" definition to
5008 create an entry point.
5010 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
5011 EntryPoint if we find it.
5013 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
5014 (EmitContext::ig): Make this variable public.
5016 * driver.cs: Make the default output file be the first file name
5017 with the .exe extension.
5019 Detect empty compilations
5021 Handle various kinds of output targets. Handle --target and
5022 rename -t to --dumper.
5024 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
5025 methods inherited from Expression return now an Expression. This
5026 will is used during the tree rewriting as we resolve them during
5029 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
5030 the spec. Missing entirely is the information about
5031 accessability of elements of it.
5033 (Expression::ExprClassFromMemberInfo): New constructor for
5034 Expressions that creates a fully initialized Expression based on
5035 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
5038 (Invocation::Resolve): Begin implementing resolution of invocations.
5040 * literal.cs (StringLiteral): Implement Emit.
5042 2001-09-05 Ravi Pratap <ravi@ximian.com>
5044 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
5047 2001-09-04 Ravi Pratap <ravi@ximian.com>
5049 * cs-parser.jay (attribute_arguments): Implement actions.
5050 (attribute): Fix bug in production. Implement action.
5051 (attribute_list): Implement.
5052 (attribute_target): Implement.
5053 (attribute_target_specifier, opt_target_specifier): Implement
5054 (CheckAttributeTarget): New method to check if the attribute target
5056 (attribute_section): Implement.
5057 (opt_attributes): Implement.
5059 * attribute.cs : New file to handle attributes.
5060 (Attribute): Class to hold attribute info.
5062 * cs-parser.jay (opt_attribute_target_specifier): Remove production
5063 (attribute_section): Modify production to use 2 different rules to
5064 achieve the same thing. 1 s/r conflict down !
5065 Clean out commented, useless, non-reducing dimension_separator rules.
5067 * class.cs (TypeContainer.attributes): New member to hold list
5068 of attributes for a type.
5069 (Struct::Struct): Modify to take one more argument, the attribute list.
5070 (Class::Class): Ditto.
5071 (Field::Field): Ditto.
5072 (Method::Method): Ditto.
5073 (Property::Property): Ditto.
5075 * cs-parser.jay (struct_declaration): Update constructor call to
5076 pass in the attributes too.
5077 (class_declaration): Ditto.
5078 (constant_declaration): Ditto.
5079 (field_declaration): Ditto.
5080 (method_header): Ditto.
5081 (fixed_parameter): Ditto.
5082 (parameter_array): Ditto.
5083 (property_declaration): Ditto.
5085 * constant.cs (Constant::Constant): Update constructor similarly.
5086 Use System.Collections.
5088 * parameter.cs (Parameter::Parameter): Update as above.
5090 2001-09-02 Ravi Pratap <ravi@ximian.com>
5092 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
5093 (TypeContainer.delegates): New member to hold list of delegates.
5095 * cs-parser.jay (delegate_declaration): Implement the action correctly
5096 this time as I seem to be on crack ;-)
5098 2001-09-02 Miguel de Icaza <miguel@ximian.com>
5100 * rootcontext.cs (RootContext::IsNamespace): new function, used to
5101 tell whether an identifier represents a namespace.
5103 * expression.cs (NamespaceExpr): A namespace expression, used only
5104 temporarly during expression resolution.
5105 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
5106 utility functions to resolve names on expressions.
5108 2001-09-01 Miguel de Icaza <miguel@ximian.com>
5110 * codegen.cs: Add hook for StatementExpressions.
5112 * class.cs: Fix inverted test for static flag in methods.
5114 2001-09-02 Ravi Pratap <ravi@ximian.com>
5116 * class.cs (Operator::CheckUnaryOperator): Correct error number used
5117 to make it coincide with MS' number.
5118 (Operator::CheckBinaryOperator): Ditto.
5120 * ../errors/errors.txt : Remove error numbers added earlier.
5122 * ../errors/cs1019.cs : Test case for error # 1019
5124 * ../errros/cs1020.cs : Test case for error # 1020
5126 * cs-parser.jay : Clean out commented cruft.
5127 (dimension_separators, dimension_separator): Comment out. Ostensibly not
5128 used anywhere - non-reducing rule.
5129 (namespace_declarations): Non-reducing rule - comment out.
5131 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
5132 with TypeContainer::AddEnum.
5134 * delegate.cs : New file for delegate handling classes.
5135 (Delegate): Class for declaring delegates.
5137 * makefile : Update.
5139 * cs-parser.jay (delegate_declaration): Implement.
5141 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
5143 * class.cs (Event::Define): Implement.
5144 (Event.EventBuilder): New member.
5146 * class.cs (TypeContainer::Populate): Update to define all enums and events
5148 (Events): New property for the events arraylist we hold. Shouldn't we move to using
5149 readonly fields for all these cases ?
5151 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
5153 * class.cs (Property): Revamp to use the convention of making fields readonly.
5154 Accordingly modify code elsewhere.
5156 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
5157 the Define method of the Property class.
5159 * class.cs : Clean up applied patch and update references to variables etc. Fix
5161 (TypeContainer::Populate): Update to define all the properties we have. Also
5162 define all enumerations.
5164 * enum.cs (Define): Implement.
5166 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
5168 * cs-parser.jay (overloadable_operator): The semantic value is an
5169 enum of the Operator class.
5170 (operator_declarator): Implement actions.
5171 (operator_declaration): Implement.
5173 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
5174 validity of definitions.
5175 (Operator::CheckBinaryOperator): Static method to check for binary operators
5176 (TypeContainer::AddOperator): New method to add an operator to a type.
5178 * cs-parser.jay (indexer_declaration): Added line to actually call the
5179 AddIndexer method so it gets added ;-)
5181 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
5182 already taken care of by the MS compiler ?
5184 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
5186 * class.cs (Operator): New class for operator declarations.
5187 (Operator::OpType): Enum for the various operators.
5189 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
5191 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
5192 ostensibly handle this in semantic analysis.
5194 * cs-parser.jay (general_catch_clause): Comment out
5195 (specific_catch_clauses, specific_catch_clause): Ditto.
5196 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
5197 (catch_args, opt_catch_args): New productions.
5198 (catch_clause): Rewrite to use the new productions above
5199 (catch_clauses): Modify accordingly.
5200 (opt_catch_clauses): New production to use in try_statement
5201 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
5202 and re-write the code in the actions to extract the specific and
5203 general catch clauses by being a little smart ;-)
5205 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
5206 Hooray, try and catch statements parse fine !
5208 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
5210 * statement.cs (Block::GetVariableType): Fix logic to extract the type
5211 string from the hashtable of variables.
5213 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
5214 I end up making that mistake ;-)
5215 (catch_clauses): Fixed gross error which made Key and Value of the
5216 DictionaryEntry the same : $1 !!
5218 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
5220 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
5222 * cs-parser.jay (event_declaration): Correct to remove the semicolon
5223 when the add and remove accessors are specified.
5225 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
5227 * cs-parser.jay (IndexerDeclaration): New helper class to hold
5228 information about indexer_declarator.
5229 (indexer_declarator): Implement actions.
5230 (parsing_indexer): New local boolean used to keep track of whether
5231 we are parsing indexers or properties. This is necessary because
5232 implicit_parameters come into picture even for the get accessor in the
5234 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
5236 * class.cs (Indexer): New class for indexer declarations.
5237 (TypeContainer::AddIndexer): New method to add an indexer to a type.
5238 (TypeContainer::indexers): New member to hold list of indexers for the
5241 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
5243 * cs-parser.jay (add_accessor_declaration): Implement action.
5244 (remove_accessor_declaration): Implement action.
5245 (event_accessors_declaration): Implement
5246 (variable_declarators): swap statements for first rule - trivial.
5248 * class.cs (Event): New class to hold information about event
5250 (TypeContainer::AddEvent): New method to add an event to a type
5251 (TypeContainer::events): New member to hold list of events.
5253 * cs-parser.jay (event_declaration): Implement actions.
5255 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
5257 * cs-parser.jay (dim_separators): Implement. Make it a string
5258 concatenating all the commas together, just as they appear.
5259 (opt_dim_separators): Modify accordingly
5260 (rank_specifiers): Update accordingly. Basically do the same
5261 thing - instead, collect the brackets here.
5262 (opt_rank_sepcifiers): Modify accordingly.
5263 (array_type): Modify to actually return the complete type string
5264 instead of ignoring the rank_specifiers.
5265 (expression_list): Implement to collect the expressions
5266 (variable_initializer): Implement. We make it a list of expressions
5267 essentially so that we can handle the array_initializer case neatly too.
5268 (variable_initializer_list): Implement.
5269 (array_initializer): Make it a list of variable_initializers
5270 (opt_array_initializer): Modify accordingly.
5272 * expression.cs (New::NType): Add enumeration to help us
5273 keep track of whether we have an object/delegate creation
5274 or an array creation.
5275 (New:NewType, New::Rank, New::Indices, New::Initializers): New
5276 members to hold data about array creation.
5277 (New:New): Modify to update NewType
5278 (New:New): New Overloaded contructor for the array creation
5281 * cs-parser.jay (array_creation_expression): Implement to call
5282 the overloaded New constructor.
5284 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
5286 * class.cs (TypeContainer::Constructors): Return member
5287 constructors instead of returning null.
5289 2001-08-26 Miguel de Icaza <miguel@ximian.com>
5291 * typemanager.cs (InitCoreTypes): Initialize the various core
5292 types after we have populated the type manager with the user
5293 defined types (this distinction will be important later while
5294 compiling corlib.dll)
5296 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
5297 on Expression Classification. Now all expressions have a method
5298 `Resolve' and a method `Emit'.
5300 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
5301 generation from working. Also add some temporary debugging
5304 2001-08-24 Miguel de Icaza <miguel@ximian.com>
5306 * codegen.cs: Lots of code generation pieces. This is only the
5307 beginning, will continue tomorrow with more touches of polish. We
5308 handle the fundamentals of if, while, do, for, return. Others are
5309 trickier and I need to start working on invocations soon.
5311 * gen-treedump.cs: Bug fix, use s.Increment here instead of
5314 * codegen.cs (EmitContext): New struct, used during code
5315 emission to keep a context. Most of the code generation will be
5318 * cs-parser.jay: Add embedded blocks to the list of statements of
5319 this block. So code generation proceeds in a top down fashion.
5321 2001-08-23 Miguel de Icaza <miguel@ximian.com>
5323 * statement.cs: Add support for multiple child blocks.
5325 2001-08-22 Miguel de Icaza <miguel@ximian.com>
5327 * codegen.cs (EmitCode): New function, will emit the code for a
5328 Block of code given a TypeContainer and its ILGenerator.
5330 * statement.cs (Block): Standard public readonly optimization.
5331 (Block::Block constructors): Link children.
5332 (Block::Child): Child Linker.
5333 (Block::EmitVariables): Emits IL variable declarations.
5335 * class.cs: Drop support for MethodGroups here, delay until
5337 (Method::): Applied the same simplification that I did before, and
5338 move from Properties to public readonly fields.
5339 (Method::ParameterTypes): Returns the parameter types for the
5340 function, and implements a cache that will be useful later when I
5341 do error checking and the semantic analysis on the methods is
5343 (Constructor::GetCallingConvention): Renamed from CallingConvetion
5344 and made a method, optional argument tells whether this is a class
5345 or a structure to apply the `has-this' bit.
5346 (Method::GetCallingConvention): Implement, returns the calling
5348 (Method::Define): Defines the type, a second pass is performed
5349 later to populate the methods.
5351 (Constructor::ParameterTypes): implement a cache similar to the
5352 one on Method::ParameterTypes, useful later when we do semantic
5355 (TypeContainer::EmitMethod): New method. Emits methods.
5357 * expression.cs: Removed MethodGroup class from here.
5359 * parameter.cs (Parameters::GetCallingConvention): new method.
5361 2001-08-21 Miguel de Icaza <miguel@ximian.com>
5363 * class.cs (TypeContainer::Populate): Drop RootContext from the
5366 (Constructor::CallingConvention): Returns the calling convention.
5367 (Constructor::ParameterTypes): Returns the constructor parameter
5370 (TypeContainer::AddConstructor): Keep track of default constructor
5371 and the default static constructor.
5373 (Constructor::) Another class that starts using `public readonly'
5374 instead of properties.
5376 (Constructor::IsDefault): Whether this is a default constructor.
5378 (Field::) use readonly public fields instead of properties also.
5380 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
5381 track of static constructors; If none is used, turn on
5382 BeforeFieldInit in the TypeAttributes.
5384 * cs-parser.jay (opt_argument_list): now the return can be null
5385 for the cases where there are no arguments.
5387 (constructor_declarator): If there is no implicit `base' or
5388 `this', then invoke the default parent constructor.
5390 * modifiers.cs (MethodAttr): New static function maps a set of
5391 modifiers flags into a MethodAttributes enum
5392 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
5393 MethodAttr, TypeAttr to represent the various mappings where the
5395 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
5397 2001-08-19 Miguel de Icaza <miguel@ximian.com>
5399 * parameter.cs (GetParameterInfo): Fix bug where there would be no
5402 * interface.cs (PopulateIndexer): Implemented the code generator
5403 for interface indexers.
5405 2001-08-17 Miguel de Icaza <miguel@ximian.com>
5407 * interface.cs (InterfaceMemberBase): Now we track the new status
5410 (PopulateProperty): Implement property population. Woohoo! Got
5411 Methods and Properties going today.
5413 Removed all the properties for interfaces, and replaced them with
5414 `public readonly' fields.
5416 2001-08-16 Miguel de Icaza <miguel@ximian.com>
5418 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
5419 initialize their hashtables/arraylists only when they are needed
5420 instead of doing this always.
5422 * parameter.cs: Handle refs and out parameters.
5424 * cs-parser.jay: Use an ArrayList to construct the arguments
5425 instead of the ParameterCollection, and then cast that to a
5428 * parameter.cs: Drop the use of ParameterCollection and use
5429 instead arrays of Parameters.
5431 (GetParameterInfo): Use the Type, not the Name when resolving
5434 2001-08-13 Miguel de Icaza <miguel@ximian.com>
5436 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
5437 and instead use public readonly fields.
5439 * class.cs: Put back walking code for type containers.
5441 2001-08-11 Miguel de Icaza <miguel@ximian.com>
5443 * class.cs (MakeConstant): Code to define constants.
5445 * rootcontext.cs (LookupType): New function. Used to locate types
5448 2001-08-08 Miguel de Icaza <miguel@ximian.com>
5450 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
5451 this System.Reflection code is. Kudos to Microsoft
5453 * typemanager.cs: Implement a type cache and avoid loading all
5454 types at boot time. Wrap in LookupType the internals. This made
5455 the compiler so much faster. Wow. I rule!
5457 * driver.cs: Make sure we always load mscorlib first (for
5458 debugging purposes, nothing really important).
5460 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
5461 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
5463 * rootcontext.cs: Lookup types on their namespace; Lookup types
5464 on namespaces that have been imported using the `using' keyword.
5466 * class.cs (TypeContainer::TypeAttr): Virtualize.
5467 (Class::TypeAttr): Return attributes suitable for this bad boy.
5468 (Struct::TypeAttr): ditto.
5469 Handle nested classes.
5470 (TypeContainer::) Remove all the type visiting code, it is now
5471 replaced with the rootcontext.cs code
5473 * rootcontext.cs (GetClassBases): Added support for structs.
5475 2001-08-06 Miguel de Icaza <miguel@ximian.com>
5477 * interface.cs, statement.cs, class.cs, parameter.cs,
5478 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
5479 Drop use of TypeRefs, and use strings instead.
5481 2001-08-04 Miguel de Icaza <miguel@ximian.com>
5485 * class.cs (Struct::Struct): set the SEALED flags after
5486 checking the modifiers.
5487 (TypeContainer::TypeAttr): new property, returns the
5488 TypeAttributes for a class.
5490 * cs-parser.jay (type_list): Oops, list production was creating a
5491 new list of base types.
5493 * rootcontext.cs (StdLib): New property.
5494 (GetInterfaceTypeByName): returns an interface by type name, and
5495 encapsulates error handling here.
5496 (GetInterfaces): simplified.
5497 (ResolveTree): Encapsulated all the tree resolution here.
5498 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
5501 * driver.cs: Add support for --nostdlib, to avoid loading the
5503 (Main): Do not put tree resolution here.
5505 * rootcontext.cs: Beginning of the class resolution.
5507 2001-08-03 Miguel de Icaza <miguel@ximian.com>
5509 * rootcontext.cs: Provide better error reporting.
5511 * cs-parser.jay (interface_base): set our $$ to be interfaces.
5513 * rootcontext.cs (CreateInterface): Handle the case where there
5514 are no parent interfaces.
5516 (CloseTypes): Routine to flush types at the end.
5517 (CreateInterface): Track types.
5518 (GetInterfaces): Returns an array of Types from the list of
5521 * typemanager.c (AddUserType): Mechanism to track user types (puts
5522 the type on the global type hash, and allows us to close it at the
5525 2001-08-02 Miguel de Icaza <miguel@ximian.com>
5527 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
5528 RecordInterface instead.
5530 * cs-parser.jay: Updated to reflect changes above.
5532 * decl.cs (Definition): Keep track of the TypeBuilder type that
5533 represents this type here. Not sure we will use it in the long
5534 run, but wont hurt for now.
5536 * driver.cs: Smaller changes to accomodate the new code.
5538 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
5541 * rootcontext.cs (CreateInterface): New method, used to create
5542 the System.TypeBuilder type for interfaces.
5543 (ResolveInterfaces): new entry point to resolve the interface
5545 (CodeGen): Property, used to keep track of the code generator.
5547 2001-07-26 Miguel de Icaza <miguel@ximian.com>
5549 * cs-parser.jay: Add a second production for delegate_declaration
5552 (enum_body): Put an opt_comma here instead of putting it on
5553 enum_body or enum_member_declarations so we can handle trailing
5554 commas on enumeration members. Gets rid of a shift/reduce.
5556 (type_list): Need a COMMA in the middle.
5558 (indexer_declaration): Tell tokenizer to recognize get/set
5560 * Remove old targets.
5562 * Re-add the parser target.
5564 2001-07-13 Simon Cozens <simon@simon-cozens.org>
5566 * cs-parser.jay: Add precendence rules for a number of operators
5567 ot reduce the number of shift/reduce conflicts in the grammar.
5569 2001-07-17 Miguel de Icaza <miguel@ximian.com>
5571 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
5574 Get rid of old crufty code.
5576 * rootcontext.cs: Use this to keep track of the parsed
5577 representation and the defined types available to the program.
5579 * gen-treedump.cs: adjust for new convention.
5581 * type.cs: Split out the type manager, and the assembly builder
5584 * typemanager.cs: the type manager will live here now.
5586 * cil-codegen.cs: And the code generator here.
5588 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
5590 * makefile: Fixed up for easy making.
5592 2001-07-13 Simon Cozens <simon@simon-cozens.org>
5594 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
5597 (unary_expression): Expand pre_increment_expression and
5598 post_decrement_expression to reduce a shift/reduce.
5600 2001-07-11 Simon Cozens
5602 * cs-tokenizer.cs: Hex numbers should begin with a 0.
5604 Improve allow_keyword_as_indent name.
5606 2001-06-19 Miguel de Icaza <miguel@ximian.com>
5608 * Adjustments for Beta2.
5610 2001-06-13 Miguel de Icaza <miguel@ximian.com>
5612 * decl.cs: Added `Define' abstract method.
5613 (InTransit): new property, used to catch recursive definitions.
5615 * interface.cs: Implement `Define'.
5617 * modifiers.cs: Map Modifiers.constants to
5618 System.Reflection.TypeAttribute flags.
5620 * class.cs: Keep track of types and user-defined types.
5621 (BuilderInit): New method for creating an assembly
5622 (ResolveType): New function to launch the resolution process, only
5623 used by interfaces for now.
5625 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
5626 that are inserted into the name space.
5628 2001-06-08 Miguel de Icaza <miguel@ximian.com>
5630 * ARGH. I have screwed up my tree so many times due to the use of
5631 rsync rather than using CVS. Going to fix this at once.
5633 * driver.cs: Objetify driver. Load assemblies, use assemblies to
5636 2001-06-07 Miguel de Icaza <miguel@ximian.com>
5638 * Experiment successful: Use System.Type rather that our own
5641 2001-05-25 Miguel de Icaza <miguel@ximian.com>
5643 * cs-parser.jay: Removed nsAliases from here.
5645 Use new namespaces, handle `using XXX;'
5647 * namespace.cs: Reimplemented namespace handling, use a recursive
5648 definition of the class. Now we can keep track of using clauses
5649 and catch invalid using clauses.
5651 2001-05-24 Miguel de Icaza <miguel@ximian.com>
5653 * gen-treedump.cs: Adapted for all the renaming.
5655 * expression.cs (Expression): this class now has a Type property
5656 which returns an expression Type.
5658 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
5659 `Type', as this has a different meaning now in the base
5661 2001-05-22 Miguel de Icaza <miguel@ximian.com>
5663 * interface.cs, class.cs: Removed from all the sources the
5664 references to signature computation, as we can not do method
5665 signature computation during the parsing time, as we are not
5666 trying to solve at that point distinguishing:
5670 void a (NS.Blah x) {}
5673 Which depending on the context might be valid or not, as we do not
5674 know if Blah is the same thing as NS.Blah at that point.
5676 * Redid everything so the code uses TypeRefs now instead of
5677 Types. TypeRefs are just temporary type placeholders, that need
5678 to be resolved. They initially have a pointer to a string and the
5679 current scope in which they are used. This is used later by the
5680 compiler to resolve the reference to an actual Type.
5682 * DeclSpace is no longer a CIR.Type, and neither are
5683 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
5684 are all DeclSpaces, but no Types.
5686 * type.cs (TypeRefManager): This implements the TypeRef manager,
5687 which keeps track of all the types that need to be resolved after
5688 the parsing has finished.
5690 2001-05-13 Miguel de Icaza <miguel@ximian.com>
5692 * ARGH. We are going to have to store `foreach' as a class rather
5693 than resolving it, as we need to verify error 1579 after name
5694 resolution. *OR* we could keep a flag that says `This request to
5695 IEnumerator comes from a foreach statement' which we can then use
5696 to generate the error.
5698 2001-05-10 Miguel de Icaza <miguel@ximian.com>
5700 * class.cs (TypeContainer.AddMethod): we now add methods to the
5701 MethodGroup instead of the method hashtable.
5703 * expression.cs: Add MethodGroup abstraction, which gets us one
5704 step closer to the specification in the way we handle method
5707 * cs-parser.jay (primary_expression): qualified_identifier now
5708 tried to match up an identifier to a local variable reference or
5709 to a parameter reference.
5711 current_local_parameters is now a parser global variable that
5712 points to the current parameters for the block, used during name
5715 (property_declaration): Now creates an implicit `value' argument to
5718 2001-05-09 Miguel de Icaza <miguel@ximian.com>
5720 * parameter.cs: Do not use `param' arguments as part of the
5721 signature, per the spec.
5723 2001-05-08 Miguel de Icaza <miguel@ximian.com>
5725 * decl.cs: Base class for classes, structs and interfaces. This
5726 is the "Declaration Space"
5728 * cs-parser.jay: Use CheckDef for checking declaration errors
5729 instead of having one on each function.
5731 * class.cs: Factor out some code for handling error handling in
5732 accordance to the "Declarations" section in the "Basic Concepts"
5733 chapter in the ECMA C# spec.
5735 * interface.cs: Make all interface member classes derive from
5736 InterfaceMemberBase.
5738 2001-05-07 Miguel de Icaza <miguel@ximian.com>
5740 * Many things: all interfaces are parsed and generated in
5741 gen-treedump. Support for member variables, constructors,
5742 destructors, properties, constants is there.
5744 Beginning of the IL backend, but very little done, just there for
5747 2001-04-29 Miguel de Icaza <miguel@ximian.com>
5749 * cs-parser.jay: Fix labeled statement.
5751 * cs-tokenizer.cs (escape): Escape " and ' always.
5752 ref_line, ref_name: keep track of the line/filename as instructed
5753 by #line by the compiler.
5756 2001-04-27 Miguel de Icaza <miguel@ximian.com>
5758 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
5759 to match the values in System.CodeDOM.
5761 Divid renamed to Divide.
5763 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
5765 (Statements.set): remove.
5767 * System.CodeDOM/CodeCatchClause.cs: always have a valid
5770 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
5771 falseStatements always have valid values.
5773 * cs-parser.jay: Use System.CodeDOM now.