1 2002-05-04 Miguel de Icaza <miguel@ximian.com>
3 * delegate.cs: If we are a toplevel delegate, use our full name.
4 If we are a nested delegate, then only use our tail name.
6 2002-05-02 Ravi Pratap <ravi@ximian.com>
8 * expression.cs (IsApplicable): Ensure that we add the "&" to
9 ref/out types before comparing it with the type of the argument.
11 (IsParamsMethodApplicable): Ditto.
13 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
16 * delegate.cs : Handle the case when we have more than one applicable
17 method. Flag an error only when we finish checking all.
19 2002-05-02 Miguel de Icaza <miguel@ximian.com>
21 * expression.cs: Add support for boolean static initializers.
23 2002-05-01 Miguel de Icaza <miguel@ximian.com>
25 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
27 * parameter.cs (ComputeParameterTypes,
28 ComputeAndDefineParameterTypes): Better error handling: now we
29 clear the `types' cache if we fail during any of the type lookups.
30 We also return the status code correctly to our caller
32 * delegate.cs: If we fail to define a delegate, abort the extra
35 * expression.cs (Binary.ResolveOperator): for
36 operator==(object,object) and operator !=(object, object) we also
37 have to verify that there is an implicit conversion from one to
40 (ArrayAccess.DoResolve): Array Access can operate on
43 2002-04-30 Miguel de Icaza <miguel@ximian.com>
45 * assign.cs (CompoundAssign): A new class used as a "flag" that
46 the assignment actually is happening as part of a compound
49 During compound assignment, a few new rules exist to enable things
56 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
57 to the type of x) if y is implicitly convertible to the type of x,
58 and the operator is a builtin operator and the return type of the
59 operator is explicitly convertible to the type of x.
61 * rootcontext.cs: Reset warning level to 2. 4 catches various
62 "interesting" features in mcs, we must clean this up at some
63 point, but currently am trying to kill other bugs ;-)
65 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
66 in container classes as well.
68 * expression.cs (Binary.ResolveOperator): Handle string case
69 before anything else (as operator overloading does emit an error
70 before doing anything else).
72 This code could go away when we move to a table driven model, but
73 i could not come up with a good plan last night.
75 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
77 * typemanager.cs (CSharpName): reimplementation using regex.
78 * class.cs: added null check for fields in Emit
79 * rootcontext.cs: set warninglevel to 4
81 2002-04-29 Miguel de Icaza <miguel@ximian.com>
83 * typemanager.cs (CSharpName): reimplemented with Lupus
86 2002-04-28 Miguel de Icaza <miguel@ximian.com>
88 * statement.cs (If): correclty implement Resolve, because we were
89 not catching sem errors in there. The same process is needed
91 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
94 (Statement.Warning_DeadCodeFound): Factorize code.
95 (While): Report dead code here too.
97 (Statement): Added Resolve virtual method to allow
98 for resolution split from the emit code.
100 2002-04-26 Miguel de Icaza <miguel@ximian.com>
102 * statement.cs (EmitBoolExpression): No longer try to resolve the
104 (MakeBoolean): New utility function that resolve, implicitly
105 converts to boolean and tags the expression.
108 (If, Do): Implement dead code elimination.
109 (While): Implement loop inversion
111 (Do, While, For, If): Resolve the expression prior to calling our
114 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
117 - added method Report28 (warning: program has more than one entry point)
118 - added method IsEntryPoint, implements paragraph 10.1 of the spec
119 - modified method Method.Define, the part at the end of the method
121 * rootcontext.cs: added static public Location EntryPointLocation;
123 * ../errors/cs0028.cs : Add test case for the above warning.
126 - modified method CSharpName to allow arrays of primitive type to
127 be printed nicely (e.g. instead of System.Int32[][] it now prints
129 - added method CSharpSignature: returns the signature of a method
130 in string format to be used in reporting errors, warnings, etc.
132 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
135 2002-04-26 Ravi Pratap <ravi@ximian.com>
137 * delegate.cs (Define): Fix extremely silly bug where I was
138 setting the type of the 'object' parameter of the BeginInvoke
139 method to System.IAsyncResult instead of System.Object ;-)
141 2002-04-26 Miguel de Icaza <miguel@ximian.com>
143 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
146 (Constructor.Emit): return if we fail to initialize the
147 constructor. Another door closed!
149 * expression.cs (New.DoResolve): Improve error message (from -6 to
150 1501). Use DeclaredOnly lookup to find the exact constructor.
152 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
153 loop. This is useful.
155 * cs-parser.jay: Adjust the default parameters so that destructors
156 have the proper signature.
158 2002-04-26 Martin Baulig <martin@gnome.org>
160 * driver.cs (LoadAssembly): If `assembly' contains any characters
161 which are only valid in path names and not in assembly names
162 (currently slash, backslash and point), use Assembly.LoadFrom ()
163 instead of Assembly.Load () on the `assembly' (before iteration
164 over the link_paths).
166 2002-04-26 Martin Baulig <martin@gnome.org>
168 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
170 2002-04-25 Miguel de Icaza <miguel@ximian.com>
172 * class.cs (Property): use the new typemanager.MemberLookup
174 (TypeContainer.MemberLookup): Implement using the
175 TypeManager.MemberLookup now.
177 * typemanager.cs: Make MemberLookup a function of the TypeManager,
178 and return MemberInfos, so that these can be used without an
179 EmitContext (what we had before).
181 2002-04-24 Miguel de Icaza <miguel@ximian.com>
183 * expression.cs: Fix the case where the argument to params if the
184 type of the params. I omitted handling this before. Fixed
186 2002-04-22 Miguel de Icaza <miguel@ximian.com>
188 * driver.cs: Call BootCorlib_PopulateCoreType
190 * class.cs (Property.CheckBase): Check for properties only, not
193 * interface.cs: Temporary hack: try/catch around the
194 CustomAttributeBuilder, because I am getting an exception that I
197 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
198 types whose definitions are required to be there (attributes are
199 defined before standard types).
201 Compute definitions as we boot the various types, as they are used
202 immediately (value_type class will need object_type, but if we do
203 not initialize object_type, we will pass a null, which will let
204 the runtime pick the System.Object from the existing corlib, which
205 is not what we want).
207 2002-04-22 Patrik Torstensson <totte@labs2.com>
209 * cs-tokenizer.cs: fixed a number of trim() issues.
211 2002-04-22 Ravi Pratap <ravi@ximian.com>
213 * expression.cs (Argument.Type): Ensure that we return the correct
214 type when we have out or ref parameters [in which case we
217 2002-04-22 Miguel de Icaza <miguel@ximian.com>
219 * class.cs (Property, Indexer): Allow extern modifier in there.
221 * typemanager.cs (InitBaseTypes): Initializes object_type and
222 value_type, since those will be used early on during the bootstrap
223 process to compile corlib.
225 (InitCoreTypes): Move code from here to InitBaseTypes.
227 2002-04-21 Miguel de Icaza <miguel@ximian.com>
229 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
230 single-dimension arrays as using the ldlen opcode.
232 Daniel Lewis discovered this optimization.
234 * typemanager.cs: Add signature for System.Array::get_Length
236 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
238 * statement.cs: report the error when the foreach does not apply to an
239 array nor a collection.
241 2002-04-19 Miguel de Icaza <miguel@ximian.com>
243 * expression.cs: Add implicit conversions to the operator ~.
245 * constant.cs (DecimalConstant.Emit): Emit decimal value.
247 * typemanager.cs: Locate the decimal constructor.
249 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
251 * attribute.cs: use the new property of TypeOf.
252 * expression.cs: added 'get' property around typearg.
254 These changes fix a build breaker reported by NickD. Is this the
255 correct way to fix? If not, please, revert my changes and make it
258 2002-04-17 Miguel de Icaza <miguel@ximian.com>
260 * attribute.cs: Add support for typeof in attribute invocations.
261 I am not sure that this is right though.
263 2002-04-14 Duncan Mak <duncan@ximian.com>
265 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
266 Binary.Operator.Division case.
268 2002-04-13 Ravi Pratap <ravi@ximian.com>
270 * class.cs (DefineType): Ensure that we do a proper check on
271 attribute types and also register it with the TypeManager.
273 (TypeContainer.Targets): The default for attribute types is
274 AttributeTargets.All.
276 * attribute.cs (ApplyAttributes): Registering the attribute type
277 is done elsewhere, not when we discover we have a Usage attribute.
279 2002-04-12 Ravi Pratap <ravi@ximian.com>
281 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
282 and get rid of is_delegate parameter.
284 * everywhere : update.
286 2002-04-12 Ravi Pratap <ravi@ximian.com>
288 * cs-parser.jay (compilation_unit): Revamp completely to use
289 some new ideas that I got from Rhys' grammar to solve the problems
290 with assembly level attributes.
292 (outer_declaration): New grammar production.
294 (attribute_sections): Add.
296 (opt_attributes): Base on attribute_sections
298 (namespace_declaration): Allow opt_attributes to tackle the case
299 when we have assembly level attributes - we are clever in this
302 * attribute.cs (ApplyAttributes): Do not worry about assembly
303 attributes in the non-global context.
305 * rootcontext.cs (AddGlobalAttributes): Go back to using this
306 instead of SetGlobalAttributes.
308 * class.cs, rootcontext.cs : Ensure we define and generate
309 attribute types before anything else.
311 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
312 and flag the new error -20 for the case when the attribute type
313 does not have valid targets specified. csc does not catch this.
315 * ../errors/errors.txt : update for error # -20
317 2002-04-11 Ravi Pratap <ravi@ximian.com>
319 * support.cs (InternalParameters.ParameterModifier): Do some null
320 checking and return sane values.
322 * class.cs (Method.Define): If we are a PInvoke method, ensure
323 that we are static and extern. Report error # 601
325 * ../errors/cs0601.cs : Add test case for the above error.
327 2002-04-07 Ravi Pratap <ravi@ximian.com>
329 * rootcontext.cs (attribute_types): We need to keep type of
330 all attribute types separately and emit code for them first.
332 (RegisterAttribute) : Implement.
334 * class.cs (DefineType): Check if the current Type is a custom
335 attribute type and register it accordingly.
337 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
338 adding the first attribute twice and rename to
340 (SetGlobalAttributes): this.
342 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
345 * attribute.cs (ApplyAttributes): Take an additional argument telling us
346 if we are processing global arguments. Hmm, I am unsure of this.
348 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
350 * expression.cs: added static array of strings to avoid calling
351 Enum.ToString () for Operator in Binary. Significant recover of
354 2002-04-10 Miguel de Icaza <miguel@ximian.com>
356 * class.cs (FindMembers): Allow the Builders of the various
357 members to be null. If they are skip them. This only happens
358 during the PInvoke declaration.
360 2002-04-09 Miguel de Icaza <miguel@ximian.com>
362 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
363 failure, so we do not keep going afterwards.
365 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
366 wanted to pass `false' as the `is_delegate' argument. If this is
367 the case, why not use delegate_type == null to mean `is_delegate =
368 false' and anything else as is_delegate = true.
370 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
372 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
373 code for the section, not the beginning of the tests.
375 2002-04-08 Miguel de Icaza <miguel@ximian.com>
377 * cfold.cs: Handle operator + (Enum x, Underlying x)
379 * expression.cs (Binary): same. Warn about errors where we have
380 Enum/Enum in operator + as well.
382 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
385 - added support for switch(bool)
386 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
387 - add TableSwitchEmit() to handle table-based switch statements
389 2002-04-05 Ravi Pratap <ravi@ximian.com>
391 * expression.cs (Invocation.OverloadResolve): Factor out code which
392 does parameter compatibility checking with arguments so that we can
393 re-use the code even from Delegate.VerifyApplicability
395 (VerifyArgumentsCompat): Move above code here.
397 * delegate.cs (VerifyApplicability): Get rid of duplicate code
398 and instead make a call to the above method.
400 2002-03-31 Ravi Pratap <ravi@ximian.com>
402 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
403 We use it to keep track of classes which are attribute types.
405 2002-04-02 Miguel de Icaza <miguel@ximian.com>
407 * delegate.cs (Delegate.Define): Correctly define the types in the
408 presence of fixed and array parameters.
410 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
413 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
414 include NonPublic after the first iteration.
416 * class.cs (Indexer.CheckBase): Only check if both parents are
419 * cs-parser.jay (accessor_body): If empty, set to null.
421 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
422 same code path here to resolve constants names that we did have in
423 MemberAccess.DoResolve. There is too much code duplicated here.
425 2002-04-01 Miguel de Icaza <miguel@ximian.com>
427 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
429 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
432 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
433 tokens, numbers and strings.
435 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
438 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
439 asyncronous parameters and the regular parameters.
441 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
442 specify the target directory.
444 * expression.cs: (This.DoResolve): Simplify
445 (As.Emit): Optimize, do not generate IsInst if the expression is
446 always of the given type.
448 (Is.DoResolve): Bug fix, we were reporting both always/never for
451 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
452 creating too many unnecessary arrays.
454 2002-03-31 Miguel de Icaza <miguel@ximian.com>
456 * class.cs (EmitFieldInitializer): Use Assign expression to assign
457 fields instead of rolling our own initializer. Takes care of all
458 implicit conversions, and drops unnecessary static checks/argument.
460 2002-03-31 Dick Porter <dick@ximian.com>
462 * driver.cs: use the GetDirectories() return values properly, and
463 use "/" as path separator.
465 2002-03-30 Miguel de Icaza <miguel@ximian.com>
467 * expression.cs (Unary): Optimize - - expr into expr.
468 (Binary): Optimize a + (-b) into a -b.
470 * codegen.cs (CodeGen): Made all methods static.
472 2002-03-29 Miguel de Icaza <miguel@ximian.com>
476 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
477 TypeBuilder property.
479 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
482 * tree.cs: Removed the various RecordXXXX, and replaced with a
483 single RecordDecl. Removed all the accessor methods, and just
484 left a single access point Type
486 * enum.cs: Rename DefineEnum to DefineType.
488 * decl.cs: New abstract method `DefineType' used to unify the
489 Defines for Enumerations, Interfaces, TypeContainers and
492 (FindType): Moved LookupInterfaceOrClass here. Moved the
493 LookupBaseClasses method that used to live in class.cs and
494 interface.cs here, and renamed to FindType.
496 * delegate.cs: Implement DefineType. Take advantage of the
497 refactored pattern for locating the parent builder without taking
498 the parent_builder argument (which we know does not work if we are
499 nested, and triggering a toplevel definition).
501 2002-03-28 Miguel de Icaza <miguel@ximian.com>
503 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
504 accessibility of a member has changed during override and report
507 * class.cs (Method.Define, Property.Define): Only complain on
508 overrides if the method is private, any other accessibility is
509 fine (and since we just checked the permission is the same, we are
512 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
513 and elif are processed always. The other pre-processing
514 directives are only processed if we are "taking" the path
516 2002-03-29 Martin Baulig <martin@gnome.org>
518 * class.cs (Method.Emit): Only emit symbolic debugging info if the
519 current location is not Null.
521 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
522 a separate method so we can profile it.
524 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
525 `span.Seconds' are just seconds, but no minutes or hours.
526 (MainDriver): Profile the CodeGen.SaveSymbols calls.
528 2002-03-28 Miguel de Icaza <miguel@ximian.com>
530 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
531 Remove the gratuitous set of Final:
533 // If an interface implementation, then we can set Final.
534 if (((flags & MethodAttributes.Abstract) == 0) &&
535 implementing.DeclaringType.IsInterface)
536 flags |= MethodAttributes.Final;
538 I do not know what I was smoking when I used that.
541 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
542 step into fixing the name resolution issues for delegates and
543 unifying the toplevel name resolution.
545 2002-03-28 Martin Baulig <martin@gnome.org>
547 * class.cs (Method.Emit): If we have a symbol writer, call its
548 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
549 tell it about the current method.
551 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
552 writer that we're going to emit the first byte of IL code for a new
553 statement (a new source line).
554 (EmitContext.EmitTopBlock): If we have a symbol writer, call
555 EmitContext.Mark() before emitting any code.
557 * location.cs (SymbolDocument): Return null when we're Null.
559 * statement.cs (Statement): Moved the `Location loc' variable here.
560 (Statement.EmitBoolExpression): If we have a symbol writer, call
561 ec.Mark() before emitting any code to tell it that we're at the
562 beginning of a new statement.
563 (StatementExpression): Added `Location' argument to the constructor.
564 (Block): Added public readonly variable `StartLocation' and public
565 variable `EndLocation'. The latter is to be set using SetEndLocation().
566 (Block): Added constructor which takes a start and end location.
567 (Block.SetEndLocation): New method. This sets the end location.
568 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
569 local variables we create.
570 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
571 each statement and do also mark the begin and end of the block.
573 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
574 tell it the current lexer.Location, use Location.Null for the end of the
576 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
577 current block, set its end location using SetEndLocation().
578 (statement_expression): StatementExpression constructor now takes the
579 lexer.Location as additional argument.
580 (for_statement, declare_local_variables): Likewise.
581 (declare_local_variables): When creating a new implicit block, use the
582 new Block constructor and pass it the lexer.Location.
584 2002-03-28 Miguel de Icaza <miguel@ximian.com>
586 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
587 members also on the parent interfaces recursively.
589 2002-03-27 Miguel de Icaza <miguel@ximian.com>
591 * report.cs: Use new formats, since Gonzalo finished the missing
594 * expression.cs (Binary.ResolveOperator): added missing operator|
595 operator& and operator^ for bool/bool.
597 * cs-parser.jay: CheckDef now takes a Location argument that is
598 used to report errors more precisly (instead of reporting the end
599 of a definition, we try to track something which is a lot closer
600 to the source of the problem).
602 * cs-tokenizer.cs: Track global token use, so we can properly flag
603 the use of #define/#undef after the first token has been seen.
605 Also, rename the reportXXXX to Error_DescriptiveName
607 * decl.cs (DeclSpace.IsTopLevel): Move property here from
608 TypeContainer, so that Enum and Interface can use this too.
610 * class.cs (TypeContainer.LookupInterfaceOrClass,
611 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
612 `builder' argument. Typically this was used to pass the parent
613 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
616 The problem is that a nested class could trigger the definition of
617 a toplevel class, and the builder would be obviously wrong in that
620 So we drop this argument, and we compute dynamically the
621 TypeBuilder/ModuleBuilder (the correct information was available
622 to us anyways from DeclSpace.Parent)
624 * interface.cs (Interface.DefineInterface): Drop builder
625 parameter cleanup like class.cs
627 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
630 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
633 (Try.Emit): Propagate the returns value from the statement.
635 (Return.Emit): Even if we are leavning
637 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
639 * modifiers.cs: Fix the computation of MethodAttributes flags.
641 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
643 * driver.cs: allow compilation of files that start with '/'.
644 Add a default case when checking the argument of --target.
646 2002-03-25 Miguel de Icaza <miguel@ximian.com>
648 * interface.cs: Implement the same search algorithm for types in
651 * delegate.cs: Do not allow multiple definition.
653 * Recovered ChangeLog that got accidentally amputated
655 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
657 * rootcontext.cs: Load manually enum to allow core classes to
658 contain enumerations.
660 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
661 Update to new static methods in TypeManager.
663 * typemanager.cs (GetMethod, GetConstructor): Use our
664 implementation of FindMembers to find the members, since during
665 corlib compilation, the types are TypeBuilders and GetMethod and
666 GetConstructor do not work.
668 Make all methods in TypeManager static.
670 (InitCodeHelpers): Split the functionality from
671 the InitCodeTypes function.
673 * driver.cs: Call InitCodeHelpers after we have populated the
676 * cs-parser.jay (delegate_declaration): we did not used to compute
677 the delegate name correctly for void delegates.
679 2002-03-24 Miguel de Icaza <miguel@ximian.com>
681 * rootcontext.cs (RootContext): Init the interface_resolve_order
682 and type_container_resolve_order always.
684 (ResolveCore, BootstrapCorlib_ResolveClass,
685 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
686 compiler when compiling with --nostdlib
688 * class.cs (TypeContainer.DefineType): Check that our parent is
689 not null. This test is most important when we are bootstraping
692 * codegen.cs: Split out the symbol writing code.
694 2002-03-25 Martin Baulig <martin@gnome.org>
696 * driver.cs (-g): Made -g an alias for --debug.
698 2002-03-24 Martin Baulig <martin@gnome.org>
700 * codegen.cs (SymbolWriter): New public variable. Returns the
701 current symbol writer.
702 (CodeGen): Added `bool want_debugging_support' argument to the
703 constructor. If true, tell the ModuleBuild that we want debugging
704 support and ask it for the ISymbolWriter.
705 (Save): If we have a symbol writer, call it's Close() method after
708 * driver.c (--debug): New command line argument to create a
709 debugger information file.
711 * location.cs (SymbolDocument): New public property. Returns an
712 ISymbolDocumentWriter object for the current source file or null
713 if we don't have a symbol writer.
715 2002-03-21 Miguel de Icaza <miguel@ximian.com>
717 * driver.cs (LoadAssembly): Correctly return when all the paths
718 have been tried and not before.
720 * statement.cs (Switch.Emit): return the actual coverage for this
721 statement (returns/not-returns)
723 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
724 switch of the statement if we are the last switch section. That
725 kills two problems: try/catch problems (we used to emit an empty
726 nop at the end) and switch statements where all branches would
729 2002-03-19 Miguel de Icaza <miguel@ximian.com>
731 * driver.cs: Add default assemblies (the equivalent to the
732 Microsoft CSC.RSP file)
734 * cs-tokenizer.cs: When updating `cols and setting it to zero,
735 also update tokens_seen and set it to false.
737 * driver.cs: Implement --recurse for Mike.
739 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
740 correctly splitting out the paths.
742 2002-03-18 Miguel de Icaza <miguel@ximian.com>
744 * interface.cs (Interface.PopulateProperty): Instead of using
745 `parent' as the declaration space for the set parameters, use
748 * support.cs (InternalParameters): InternalParameters constructor
749 takes a DeclSpace instead of a TypeContainer.
751 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
752 types are being initialized, load the address of it before calling
755 (New): Provide a mechanism to disable the generation of local
756 value type temporaries when the caller will be providing us with
757 an address to store it.
759 (ArrayCreation.EmitDynamicInitializers): Use it.
761 2002-03-17 Miguel de Icaza <miguel@ximian.com>
763 * expression.cs (Invocation.EmitArguments): Only probe for array
764 property if there is more than one argument. Sorry about that.
766 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
769 * class.cs (Method.LabelParameters): Fix incorrect code path that
770 prevented the `ParamArrayAttribute' from being applied to the
773 2002-03-16 Miguel de Icaza <miguel@ximian.com>
775 * support.cs (ReflectionParameters): Correctly compute whether the
776 last argument is a params array. Fixes the problem with
779 * typemanager.cs: Make the assemblies array always be non-null
780 (empty, but non-null)
782 * tree.cs (RecordDecl): New function that abstracts the recording
783 of names. This reports error 101, and provides a pointer to the
784 previous declaration. Fixes a crash in the compiler.
786 * cs-parser.jay (constructor_declaration): Update to new grammar,
787 and provide a constructor_body that can be empty.
789 2002-03-15 Miguel de Icaza <miguel@ximian.com>
791 * driver.cs: Add support for --resources.
793 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
794 Make all types for the various array helper methods be integer.
796 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
797 CheckState to ConvCast.
799 (ConvCast): Now it takes a `checked' state argument, to avoid
800 depending on the emit context for the conversion, and just using
801 the resolve time setting.
803 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
804 instead of Invocation.EmitArguments. We do not emit the original
805 arguments, instead we emit those which have been converted to
806 unsigned int expressions.
808 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
812 * expression.cs (LocalVariableReference): Drop the use of the
813 Store function that depended on the variable index.
815 * statement.cs (VariableInfo): Drop the `Idx' property from this
816 class, as this is not taking into account the indexes for
817 temporaries tat we generate during the execution, getting the
820 * class.cs: First emit class initializers, then call the parent
823 * expression.cs (Binary): Fix opcode emision.
824 (UnaryMutator.EmitCode): Support checked code generation
826 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
827 matches for events for both the Static and Instance scans,
828 pointing to the same element. Fix that.
830 2002-03-14 Miguel de Icaza <miguel@ximian.com>
832 * rootcontext.cs (ResolveTree): Always set the
833 interface_resolve_order, because nested interfaces will be calling
836 * class.cs (GetInterfaceOrClass): Track the same resolution
837 process used by TypeManager.LookupType. This fixes the nested
838 type lookups in class declarations (separate path from
841 (TypeContainer.DefineType): Also define nested interfaces.
842 (TypeContainer.RegisterOrder): New public function used to
843 register the order in which child interfaces need to be closed.
845 Nested interfaces need to be closed after their parents have been
848 * interface.cs (InterfaceAttr): Put all the logic for computing
849 the interface attribute here.
851 (DefineInterface): Register our interface order with the
852 RootContext or with the TypeContainer depending on the case.
854 2002-03-12 Miguel de Icaza <miguel@ximian.com>
856 * cs-parser.jay: rework foreach statement to work with the new
857 changes to the policy on SimpleNames.
859 * report.cs: support Stacktrace on warnings as well.
861 * makefile: drop --unsafe and /unsafe from the compile.
863 2002-03-13 Ravi Pratap <ravi@ximian.com>
865 * ecore.cs (StandardConversionExists): Modify to take an Expression
866 as the first parameter. Ensure we do null -> reference type conversion
869 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
870 temporary Expression objects.
872 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
874 * interface.cs: workaround bug in method overloading resolution
875 (there is already a bugzilla bug for it).
877 2002-03-12 Miguel de Icaza <miguel@ximian.com>
879 We could also solve this problem by having a separate path for
880 performing type lookups, instead of DoResolve, we could have a
881 ResolveType entry point, and only participating pieces of the
882 production (simplename, deref, array) would implement this.
884 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
885 signal SimpleName to only resolve type names and not attempt to
886 resolve anything else.
888 * expression.cs (Cast): Set the flag.
890 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
892 * class.cs: Only report 108 if there is no `new' modifier.
894 * cs-parser.jay: rework foreach statement to work with the new
895 changes to the policy on SimpleNames.
897 * report.cs: support Stacktrace on warnings as well.
899 * makefile: drop --unsafe and /unsafe from the compile.
901 2002-03-11 Miguel de Icaza <miguel@ximian.com>
903 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
904 lookups here, instead of doing that at parse time. This means
905 that our grammar will not introduce `LocalVariableReferences' as
906 expressions at this point. That solves the problem of code like
914 This is only half the fix. The full fix requires parameters to
915 also be handled in this way.
917 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
918 makes the use more obvious of the DeclSpace. The
919 ec.TypeContainer.TypeBuilder is now only used to pull the
922 My theory is that I can get rid of the TypeBuilder completely from
923 the EmitContext, and have typecasts where it is used (from
924 DeclSpace to where it matters).
926 The only pending problem is that the code that implements Aliases
927 is on TypeContainer, and probably should go in DeclSpace.
929 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
930 lookups here, instead of doing that at parse time. This means
931 that our grammar will not introduce `LocalVariableReferences' as
932 expressions at this point. That solves the problem of code like
940 This is only half the fix. The full fix requires parameters to
941 also be handled in this way.
943 * class.cs (Property.DefineMethod): When implementing an interface
944 method, set newslot, when implementing an abstract method, do not
945 set the flag (before we tried never setting it, or always setting
946 it, which is the difference).
947 (Indexer.DefineMethod): same.
948 (Method.DefineMethod): same.
950 * ecore.cs: Only set the status used flag if we get back a Field.
952 * attribute.cs: Temporary hack, so Paolo can keep working.
954 2002-03-08 Ravi Pratap <ravi@ximian.com>
956 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
957 the unmanaged type in the case we have a MarshalAs attribute.
959 (Resolve): Handle the case when we are parsing the special MarshalAs
960 attribute [we need to store the unmanaged type to use later]
962 * typemanager.cs (marshal_as_attr_type): Built in type for the
965 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
966 on parameters and accordingly set the marshalling info.
968 2002-03-09 Miguel de Icaza <miguel@ximian.com>
970 * class.cs: Optimizing slightly by removing redundant code after
971 we switched to the `NoTypes' return value.
972 (Property.DefineMethod): use NoTypes here too.
974 This fixes the bug I introduced in my last batch of changes.
976 2002-03-05 Ravi Pratap <ravi@ximian.com>
978 * tree.cs (RecordEnum): Add. We now keep track of enums too.
980 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
981 Enums since those are types too.
983 * cs-parser.jay (enum_declaration): Record enums as we parse them.
985 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
986 thanks to a call during the lookup process.
988 2002-03-07 Miguel de Icaza <miguel@ximian.com>
990 * statement.cs (Foreach): Lots of work to accomodate a particular
991 kind of foreach statement that I had not kept in mind. It is
992 possible to have foreachs on classes that provide a GetEnumerator
993 method that return objects that implement the "pattern" for using
994 a foreach, there is no need to support GetEnumerator
997 This is needed to compile nant.
999 * decl.cs: Only report 114 if the member is not `Finalize' and if
1000 the warning level is at least 2.
1002 * class.cs: Moved the compare function from Method to
1005 (MethodSignature.InheritableMemberSignatureCompare): Add new
1006 filter function that is used to extract inheritable methods from a
1009 (Method.Define): Use the new `inheritable_method_signature_filter'
1012 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
1015 2002-03-06 Miguel de Icaza <miguel@ximian.com>
1017 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
1019 * cs-parser.jay: Add opt_semicolon to the interface declaration.
1021 * expression.cs: Pass location information to
1022 ConvertImplicitStandard.
1024 * class.cs: Added debugging code to track return values from
1027 2002-03-05 Miguel de Icaza <miguel@ximian.com>
1029 * expression.cs (Is.DoResolve): If either side of the `is' is an
1030 interface, do not flag the warning.
1032 * ecore.cs (ImplicitReferenceConversion): We need a separate test
1035 * report.cs: Allow for --fatal to be used with --probe.
1037 * typemanager.cs (NoTypes): Move the definition for the empty Type
1040 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
1042 (TypeContainer.DefineProxy): New function used to proxy to parent
1043 implementations when implementing interfaces.
1044 (TypeContainer.ParentImplements): used to lookup if our parent
1045 implements a public function that is required by an interface.
1046 (TypeContainer.VerifyPendingMethods): Hook this up.
1048 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
1049 `modules' and `assemblies' arraylists into arrays. We only grow
1050 these are the very early start up of the program, so this improves
1051 the speedof LookupType (nicely measured).
1053 * expression.cs (MakeByteBlob): Replaced unsafe code with
1054 BitConverter, as suggested by Paolo.
1056 * cfold.cs (ConstantFold.Binary): Special case: perform constant
1057 folding of string concatenation, but if either side is a string,
1058 and the other is not, then return null, and let the runtime use
1059 the concatenation on the string plus the object (using
1062 2002-03-04 Miguel de Icaza <miguel@ximian.com>
1064 Constant Folding has been implemented now.
1066 * expression.cs (Unary.Reduce): Do not throw an exception, catch
1067 the error instead on types that are not supported in one's
1070 * constant.cs (Constant and all children): New set of functions to
1071 perform implict and explicit conversions.
1073 * ecore.cs (EnumConstant): Implement the new functions to perform
1074 conversion by proxying to the child expression.
1076 * codegen.cs: (ConstantCheckState): Constant evaluation has its
1077 own separate setting that can not be turned off from the command
1078 line using --unchecked or --checked and is only controlled using
1079 the checked/unchecked statements and expressions. This setting is
1080 used by the constant folder to flag errors.
1082 * expression.cs (CheckedExpr, UncheckedExpr): Set the
1083 ConstantCheckState as well.
1085 During Resolve, they also have to flag the state, because the
1086 constant folder runs completely in the Resolve phase.
1088 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
1091 2002-03-01 Miguel de Icaza <miguel@ximian.com>
1093 * cfold.cs: New file, this file contains the constant folder.
1095 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
1096 argument to track whether we are using the resulting address to
1097 load or store a value and provide better error messages.
1099 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
1100 new AddressOf arguments.
1102 * statement.cs (Foreach.EmitCollectionForeach): Update
1104 * expression.cs (Argument.Emit): Call AddressOf with proper
1105 arguments to track usage.
1107 (New.DoEmit): Call AddressOf with new arguments.
1109 (Unary.Emit): Adjust AddressOf call.
1111 2002-03-01 Ravi Pratap <ravi@ximian.com>
1113 * cs-parser.jay (member_access): Change the case for pre-defined types
1114 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
1117 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
1120 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
1121 essentially like methods and apply attributes like MethodImplOptions to them too.
1123 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
1126 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
1127 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
1130 * Update code everywhere accordingly.
1132 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
1134 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
1136 2002-02-28 Ravi Pratap <ravi@ximian.com>
1138 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
1139 try performing lookups against those instead of jumping straight into using
1140 the 'using' clauses.
1142 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
1144 (LookupType): Perform lookups in implicit parents too.
1146 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
1147 sequence as RootContext.LookupType.
1149 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
1150 the various cases of namespace lookups into this method.
1152 2002-03-01 Miguel de Icaza <miguel@ximian.com>
1154 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
1155 in positional arguments)
1157 * class.cs (Operator): Update the AllowedModifiers to contain
1160 * cs-parser.jay: Update operator declaration to allow for the
1161 operator body to be empty.
1163 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
1166 2002-02-27 Miguel de Icaza <miguel@ximian.com>
1168 * class.cs (Method.Emit): Label parameters.
1170 * driver.cs: Return 1 or 0 as the program exit code.
1172 2002-02-26 Miguel de Icaza <miguel@ximian.com>
1174 * expression.cs: Special case the `null' object when trying to
1175 auto-compute the type, as anything can be explicitly converted to
1178 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
1179 spotting this Paolo.
1181 (Expression.ImplicitNumericConversion): Perform comparissions of
1182 the type using the underlying type in the case of an enumeration
1183 rather than using the enumeration type for the compare.
1185 Cope with the underlying == type case, which is not possible to
1188 (Expression.ConvertNumericExplicit): Perform comparissions of
1189 the type using the underlying type in the case of an enumeration
1190 rather than using the enumeration type for the compare.
1192 * driver.cs: If the user does not supply an extension, assume .exe
1194 * cs-parser.jay (if_statement): Rewrote so that we can track the
1195 location for the if statement.
1197 * expression.cs (Binary.ConstantFold): Only concat strings when
1198 the operation is "+", not everything ;-)
1200 * statement.cs (Statement.EmitBoolExpression): Take a location
1202 (If, While, Do): Track location.
1204 * expression.cs (Binary.ResolveOperator): In the object + string
1205 case, I was missing a call to ConvertImplicit
1207 2002-02-25 Ravi Pratap <ravi@ximian.com>
1209 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
1210 Location arguments. Ensure we use RootContext.LookupType to do our work
1211 and not try to do a direct Type.GetType and ModuleBuilder.GetType
1213 * interface.cs (PopulateMethod): Handle the type of the parameter being
1216 * expression.cs (Invocation.BetterFunction): Handle the case when we
1217 have a params method with no fixed arguments and a call is made with no
1220 2002-02-25 Miguel de Icaza <miguel@ximian.com>
1222 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
1223 the verbatim-string-literal
1225 * support.cs (InternalParameters.ParameterModifier): handle null
1227 (InternalParameters.ParameterType): ditto.
1229 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
1230 duplicating the name of the variable parameter.
1231 (GetParameterByName): Fix bug where we were not looking up array
1232 paramters if they were the only present (thanks Paolo!).
1233 (GetParameterInfo): We only have an empty set of types if both
1234 fixed and array are set to null.
1235 (GetParameterInfo-idx): Handle FixedParameter == null
1237 * cs-parser.jay: Handle the case where there is no catch
1238 statements (missing null test).
1240 2002-02-22 Miguel de Icaza <miguel@ximian.com>
1242 * driver.cs (MainDriver): Be conservative on our command line
1245 Catch DirectoryNotFoundException when calling GetFiles.
1247 (SplitPathAndPattern): Used to split the input specification into
1248 a path and a pattern that we can feed to Directory.GetFiles.
1250 2002-02-21 Miguel de Icaza <miguel@ximian.com>
1252 * statement.cs (Fixed): Implement the last case of the Fixed
1253 statement (string handling).
1255 * expression.cs (StringPtr): New class used to return a char * to
1256 a string; Used by the Fixed statement.
1258 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
1260 * expression.cs (Binary.ResolveOperator): Remove redundant
1261 MemberLookup pn parent type.
1262 Optimize union call, we do not need a union if the types are the same.
1263 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
1266 Specialize the use of MemberLookup everywhere, instead of using
1267 the default settings.
1269 (StackAlloc): Implement stackalloc keyword.
1271 * cs-parser.jay: Add rule to parse stackalloc.
1273 * driver.cs: Handle /h, /help, /?
1275 * expression.cs (MakeByteBlob): Removed the hacks we had in place
1276 before we supported unsafe code.
1278 * makefile: add --unsafe to the self compilation of mcs.
1280 2002-02-20 Miguel de Icaza <miguel@ximian.com>
1282 * expression.cs (PointerArithmetic): New class that is used to
1283 perform pointer arithmetic.
1284 (Binary.Resolve): Handle pointer arithmetic
1285 Handle pointer comparission.
1286 (ArrayPtr): Utility expression class that is used to take the
1287 address of an array.
1289 (ElementAccess): Implement array access for pointers
1291 * statement.cs (Fixed): Implement fixed statement for arrays, we
1292 are missing one more case before we are done.
1294 * expression.cs (Indirection): Implement EmitAssign and set the
1295 ExprClass to Variable. This allows pointer dereferences to be
1296 treated as variables, and to have values assigned to them.
1298 * ecore.cs (Expression.StoreFromPtr): New utility function to
1299 store values dereferencing.
1301 2002-02-20 Ravi Pratap <ravi@ximian.com>
1303 * expression.cs (Binary.ResolveOperator): Ensure that we are
1304 not trying to operate on a void type - this fixes the reported
1307 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
1308 the parent implementation is sealed.
1310 * ../errors/cs0239.cs : Add.
1312 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
1314 * typemanager.cs (unverifiable_code_type): Corresponds to
1315 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
1316 which have unsafe code in them.
1318 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
1321 2002-02-19 Miguel de Icaza <miguel@ximian.com>
1323 * cs-tokenizer.cs: Add support for @"litreal strings"
1325 Make tokenizer accept pre-processor directives
1326 on any column (remove the old C-like limitation).
1328 * rootcontext.cs (EmitCode): Emit any global attributes.
1329 (AddGlobalAttributes): Used to keep track of assembly attributes.
1331 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
1333 * cs-parser.jay: Add support for global attributes.
1335 2002-02-17 Miguel de Icaza <miguel@ximian.com>
1337 * expression.cs (Indirection): New helper class. Unary will
1338 create Indirection classes to be able to implement the
1339 IMemoryLocation interface on it.
1341 2002-02-16 Miguel de Icaza <miguel@ximian.com>
1343 * cs-parser.jay (fixed_statement): reference the right statement.
1345 * statement.cs (Fixed.Emit): Finish implementing the fixed
1346 statement for the &x case.
1348 2002-02-14 Miguel de Icaza <miguel@ximian.com>
1350 * class.cs (Property.Define, Method.Define): Remove newslot when
1353 * modifiers.cs: My use of NewSlot when `Abstract' was set was
1354 wrong. NewSlot should only be used if the `new' keyword is present.
1356 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
1357 locating our system dir. Sorry about this.
1359 2002-02-13 Miguel de Icaza <miguel@ximian.com>
1361 * driver.cs (GetSystemDir): Compute correctly the location of our
1362 system assemblies. I was using the compiler directory instead of
1363 the library directory.
1365 2002-02-13 Ravi Pratap <ravi@ximian.com>
1367 * expression.cs (BetterFunction): Put back in what Miguel commented out
1368 since it is the correct fix. The problem is elsewhere ;-)
1370 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
1371 parameters of the parms method are themselves compatible or not !
1373 (StandardConversionExists): Fix very dangerous bug where we were forgetting
1374 to check that a class implements an interface before saying that an implicit
1375 conversion was allowed. Use ImplementsInterface to do the checking.
1377 2002-02-13 Miguel de Icaza <miguel@ximian.com>
1379 * class.cs (Method.Define): Track whether we are an explicit
1380 implementation or not. And only call DefineMethodOverride if we
1381 are an explicit implementation.
1383 (Property.DefineMethod): Ditto.
1385 2002-02-11 Ravi Pratap <ravi@ximian.com>
1387 * expression.cs (BetterFunction): Catch hideous bug which was
1388 preventing us from detecting ambiguous calls due to implicit casts i.e
1391 2002-01-29 Miguel de Icaza <miguel@ximian.com>
1393 * support.cs (Pair): Remove un-needed method. I figured why I was
1394 getting the error in cs-parser.jay, the variable in a foreach loop
1395 is readonly, and the compiler does not really treat this as a variable.
1397 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
1398 instead of EQUALS in grammar.
1400 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
1402 * expression.cs (Unary.DoResolve): Check whether the argument is
1405 2002-01-28 Miguel de Icaza <miguel@ximian.com>
1407 * support.cs: Api for Pair to set a value. Despite the fact that
1408 the variables are public the MS C# compiler refuses to compile
1409 code that accesses the field if the variable is part of a foreach
1412 * statement.cs (Fixed): Begin implementation of the fixed
1415 (Block.AddVariable): Return the VariableInfo on success and null
1416 on failure instead of true/false.
1418 * cs-parser.jay (foreach): Catch errors on variables already
1419 defined (we were ignoring this value before) and properly unwind
1422 (fixed_statement): grammar for the fixed statement.
1424 2002-01-25 Miguel de Icaza <miguel@ximian.com>
1426 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
1427 pointer types to be incretemented.
1429 (SizeOf): Implement.
1431 * cs-parser.jay (pointer_member_access): Implement
1432 expr->IDENTIFIER production.
1434 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
1435 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
1438 (Unary): Implement indirection.
1440 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
1441 use in non-unsafe context).
1443 (SimpleName.DoResolve): Check for pointers in field access on safe
1446 (Expression.LoadFromPtr): Factor the load-indirect code in this
1447 function. This was duplicated in UnboxCast and ParameterReference
1449 2002-01-24 Miguel de Icaza <miguel@ximian.com>
1451 * expression.cs (ComposedCast): report an error if a pointer cast
1452 is used in a safe region.
1454 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
1455 pointer type casts in unsafe context.
1457 * codegen.cs (EmitContext): Set up IsUnsafe.
1459 * cs-parser.jay (non_expression_type): Add productions for pointer
1462 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
1463 code. We should not use force into static mode if the method is
1464 not virtual. Fixes bug in MIS
1466 * statement.cs (Do.Emit, While.Emit, For.Emit,
1467 Statement.EmitBoolExpression): Add support to Do and While to
1468 propagate infinite loop as `I do return' semantics.
1470 Improve the For case to also test for boolean constants.
1472 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
1473 to the list of attributes we can add.
1475 Remove `EmitContext' argument.
1477 * class.cs (Method.Define): Apply parameter attributes.
1478 (Constructor.Define): Apply parameter attributes.
1479 (MethodCore.LabelParameters): Move here the core of labeling
1482 * support.cs (ReflectionParameters.ParameterModifier,
1483 InternalParameters.ParameterModifier): Use IsByRef on the type and
1484 only return the OUT bit for these parameters instead of in/out/ref
1487 This is because I miss-understood things. The ParameterInfo.IsIn
1488 and IsOut represent whether the parameter has the [In] and [Out]
1491 2002-01-22 Miguel de Icaza <miguel@ximian.com>
1493 * ecore.cs (FieldExpr.Emit): Release temporaries.
1495 * assign.cs (LocalTemporary.Release): new function.
1497 * codegen.cs (EmitContext.GetTemporaryStorage,
1498 EmitContext.FreeTemporaryStorage): Rework the way we deal with
1499 temporary storage. Now we can "put back" localbuilders when we
1502 2002-01-21 Miguel de Icaza <miguel@ximian.com>
1504 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
1505 need to make a copy of the variable to generate verifiable code.
1507 2002-01-19 Miguel de Icaza <miguel@ximian.com>
1509 * driver.cs: Compute dynamically the system directory.
1511 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
1512 Slower, but more generally useful. Used by the abstract
1513 registering implementation.
1515 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
1516 the rules for the special rule on Type/instances. First check if
1517 we have the same name, and if so, try that special static path
1518 rather than the instance path.
1520 2002-01-18 Miguel de Icaza <miguel@ximian.com>
1522 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
1525 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
1526 Enum, ValueType, Delegate or Array for non-corlib compiles.
1528 * cs-tokenizer.cs: Catch long identifiers (645)
1530 * typemanager.cs (IndexerPropetyName): Ravi never tested this
1533 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
1534 fix, we were returning too early, so we were not registering
1535 pending methods from abstract classes.
1537 Do not register pending methods if the class is abstract.
1539 * expression.cs (Conditional.DoResolve): Report circular implicit
1540 conversions when we neecd to compute it for conditional
1543 (Is.DoResolve): If the expression is always of the provided type,
1544 flag warning 183. If the expression can not ever be of the
1545 provided type flag warning 184.
1547 * class.cs: Catch 169 as well.
1549 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
1552 2002-01-18 Nick Drochak <ndrochak@gol.com>
1554 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
1556 2002-01-17 Miguel de Icaza <miguel@ximian.com>
1558 * interface.cs: (PopulateMethod): Check for pointers being defined
1559 only if the unsafe context is active.
1560 (PopulateProperty): ditto.
1561 (PopulateIndexer): ditto.
1563 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
1564 specified. If pointers are present, make sure that they are
1565 present in an unsafe context.
1566 (Constructor, Constructor.Define): ditto.
1567 (Field, Field.Define): ditto.
1568 (Property, Property.Define): ditto.
1569 (Event, Event.Define): ditto.
1571 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
1572 hashtable if there are classes or structs defined.
1574 * expression.cs (LocalVariableReference.DoResolve): Simplify this
1575 code, as the constant resolution moved.
1577 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
1578 the metadata, so we can flag error 133.
1580 * decl.cs (MemberCore.UnsafeOK): New function to test that a
1581 pointer is being declared in an unsafe context.
1583 2002-01-16 Miguel de Icaza <miguel@ximian.com>
1585 * modifiers.cs (Modifiers.Check): Require a Location argument.
1586 Report error 227 for Unsafe use.
1588 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
1590 * statement.cs (For.Emit): If the test is null, then report that
1591 we do `return', as we wont reach anything afterwards.
1593 (Switch.SwitchGoverningType): Track the expression that matched
1596 * driver.cs: Allow negative numbers as an error code to flag.
1598 * cs-parser.jay: Handle 1551.
1600 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
1602 2002-01-15 Miguel de Icaza <miguel@ximian.com>
1604 * cs-parser.jay: Report 1518 (type declaration can only contain
1605 class, struct, interface, enum or delegate)
1607 (switch_label): Report 1523 (keywords `case' or `default' must
1610 (opt_switch_sections): Report 1522 (empty switch)
1612 * driver.cs: Report 1515 (response file specified multiple times)
1613 Report 1516 (Source file specified multiple times).
1615 * expression.cs (Argument.Resolve): Signal 1510
1617 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
1618 access not allowed in static code)
1620 2002-01-11 Ravi Pratap <ravi@ximian.com>
1622 * typemanager.cs (IsPointerType): Utility method which we are going
1625 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
1626 the object type, so we take care of that.
1628 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
1630 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
1631 added to non-params parameters :-)
1633 * typemanager.cs (CSharpName): Include 'void' type too.
1635 (void_ptr_type): Include in the set of core types.
1637 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
1640 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
1643 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
1644 completely forgotten about it.
1646 2002-01-10 Ravi Pratap <ravi@ximian.com>
1648 * cs-parser.jay (pointer_type): Add. This begins our implementation
1649 of parsing rules for unsafe code.
1651 (unsafe_statement): Implement.
1653 (embedded_statement): Modify to include the above.
1655 * statement.cs (Unsafe): Implement new class for unsafe blocks.
1657 * codegen.cs (EmitContext.InUnsafe): Add. This determines
1658 if the current context is an unsafe one.
1660 * cs-parser.jay (local_variable_pointer_type): Since local variable types
1661 are handled differently, we need separate rules for them.
1663 (local_variable_declaration): Update to use local_variable_pointer_type
1664 to allow variable declarations of unmanaged pointer types.
1666 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
1669 * ../errors/cs0214.cs : Add.
1671 2002-01-16 Nick Drochak <ndrochak@gol.com>
1673 * makefile: remove 'response' file when cleaning.
1675 2002-01-15 Miguel de Icaza <miguel@ximian.com>
1677 * cs-parser.jay: Report 1524.
1679 2002-01-14 Miguel de Icaza <miguel@ximian.com>
1681 * typemanager.cs (RegisterMethod): drop checking if we have
1682 registered this from here
1684 2002-01-12 Miguel de Icaza <miguel@ximian.com>
1686 * class.cs (Method.EmitDestructor): Implement calling our base
1689 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
1692 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
1693 this routine and will wrap the call in a try/catch block. Deal
1696 2002-01-11 Miguel de Icaza <miguel@ximian.com>
1698 * ecore.cs (Expression.MemberLookup): instead of taking a
1699 parameter `same_type' that was used to tell whether we could
1700 access private members we compute our containing type from the
1703 (FieldExpr): Added partial support for volatile fields. This does
1704 not work for volatile fields exposed from assemblies, as I can not
1705 figure out how to extract the modreq from it.
1707 Updated all the source files to use this.
1709 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
1710 because it is referenced by MemberLookup very often.
1712 2002-01-09 Ravi Pratap <ravi@ximian.com>
1714 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
1715 TypeBuilder.GetCustomAttributes to retrieve what we need.
1717 Get rid of redundant default_member_attr_type as this is the same as
1718 default_member_type which already exists.
1720 * interface.cs, attribute.cs : Update accordingly.
1722 2002-01-08 Miguel de Icaza <miguel@ximian.com>
1724 * typemanager.cs: Enable IndexerPropertyName again. It does not
1725 work for TYpeBuilders though. Ravi, can you please fix this?
1727 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
1729 * expression.cs (Argument.Emit): Handle the case of ref objects
1730 being passed to ref functions;
1732 (ParameterReference.EmitLoad): Loads the content of the pointer
1733 without dereferencing.
1735 2002-01-07 Miguel de Icaza <miguel@ximian.com>
1737 * cs-tokenizer.cs: Implemented the pre-processing expressions.
1739 2002-01-08 Ravi Pratap <ravi@ximian.com>
1741 * class.cs (Indexer.DefineMethod): Incorporate the interface
1742 type in the name of the method if we are doing explicit interface
1745 * expression.cs (ConversionExists): Remove as it is completely obsolete.
1747 (BetterConversion): Fix extremely trivial bug where we were referring to
1748 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
1751 * ../errors/bug16.cs : Add although we have fixed it.
1753 2002-01-07 Miguel de Icaza <miguel@ximian.com>
1755 * expression.cs (BaseIndexer): Begin implementation.
1757 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
1759 * cs-parser.jay (indexer_declarator): Use qualified_identifier
1760 production directly to remove a shift/reduce, and implement
1761 explicit interface implementation.
1763 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
1764 after a floating point suffix.
1766 * expression.cs (DoNumericPromotions): Improved the conversion for
1767 uint/uint. If we have a constant, we avoid doing a typecast to a
1770 * class.cs (Indexer): Implement explicit interface implementation
1773 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
1775 * class.cs: make the default instance constructor public and hidebysig.
1777 2001-01-03 Ravi Pratap <ravi@ximian.com>
1779 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
1780 so we can call it from elsewhere.
1782 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
1783 we emit it internally if the class has a defined indexer; otherwise the user
1784 emits it by decorating the class definition with the DefaultMemberAttribute.
1786 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
1787 attribute is not used on a type which defines an indexer.
1789 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
1790 character when we skip whitespace.
1792 * ../errors/cs0646.cs : Add.
1794 2002-01-03 Miguel de Icaza <miguel@ximian.com>
1796 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
1799 * makefile: Add practical target `mcs3.exe' which builds the third
1800 generation compiler.
1802 * expression.cs (New): Fix structures constructor calling.
1804 * class.cs (Property, Method, Indexer): Emit Final flag on the
1805 method if we are an interface implementation and we are not
1808 * ecore.cs (PropertyExpr): New public field `IsBase', tells
1809 whether this property is referencing a `base' method.
1811 * expression.cs (Invocation.EmitCall): take an extra argument:
1812 is_base, this is used to determine whether the `call' or
1813 `callvirt' opcode should be used.
1816 * delegate.cs: update EmitCall.
1818 * class.cs (Method.Define): Set NewSlot for the cases where we are
1819 not implementing an interface method.
1821 (Property.Define): ditto.
1823 2002-01-02 Miguel de Icaza <miguel@ximian.com>
1825 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
1826 'r'. Allows mcs to parse itself fully.
1828 2002-01-02 Ravi Pratap <ravi@ximian.com>
1830 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
1831 of the number of initializers that require the InitializeArray method.
1833 (CheckIndices): Store the Expression in all cases - not the plain value. Also
1834 update the above field where necessary.
1836 (MakeByteBlob): Update accordingly.
1838 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
1841 (EmitDynamicInitializers): Update in accordance with the new optimization.
1843 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
1844 same OpCode applies.
1846 * cs-parser.jay : Fix some glaring errors I introduced.
1848 2002-01-01 Ravi Pratap <ravi@ximian.com>
1850 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
1851 so that we can check for name clashes there too.
1853 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
1854 for interface indexers.
1856 * interfaces.cs (Define): Emit the default member attribute.
1858 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
1859 variable was being referred to while setting the value ;-)
1861 2002-01-01 Miguel de Icaza <miguel@ximian.com>
1863 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
1864 byte-by-byte information when we know the data is zero.
1866 Make the block always a multiple of 4, because
1867 DefineInitializedData has a bug.
1869 * assign.cs: Fix, we should assign from the temporary, not from
1872 * expression.cs (MakeByteBlob): Fix my incorrect code.
1874 2001-12-31 Miguel de Icaza <miguel@ximian.com>
1876 * typemanager.cs (EnumToUnderlying): This function is used to get
1877 the underlying type from an enumeration, because it does not
1880 * constant.cs: Use the I4_S form for values between -128 and 127.
1882 * statement.cs (Block.LookupLabel): Looks up a label.
1883 (Block): Drop support for labeled blocks.
1885 (LabeledStatement): New kind of statement that represents a label
1888 (Goto): Finally implement this bad boy.
1890 * cs-parser.jay: Update to reflect new mechanism to implement
1893 2001-12-30 Miguel de Icaza <miguel@ximian.com>
1895 * codegen.cs (EmitContext.This): a codegen property that keeps the
1896 a single instance of this instead of creating many different this
1899 * delegate.cs (Delegate.DoResolve): Update to use the property;
1901 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
1903 * expression.cs (BaseAccess.DoResolve): Ditto.
1905 2001-12-29 Ravi Pratap <ravi@ximian.com>
1907 * typemanager.cs (methodimpl_attr_type): Add to hold the type
1908 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
1910 (InitCoreTypes): Update accordingly.
1912 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
1913 so we can quickly store the state.
1915 (ApplyAttributes): Set the correct implementation flags
1916 for InternalCall methods.
1918 2001-12-29 Miguel de Icaza <miguel@ximian.com>
1920 * expression.cs (EmitCall): if a method is not virtual, then do
1921 not use callvirt on it.
1923 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
1924 user defined stuff) requires the use of stobj, which takes an
1925 address on the stack instead of an array and an index. So emit
1926 the Ldelema operation for it.
1928 (EmitStoreOpcode): Use stobj for valuetypes.
1930 (UnaryMutator.EmitCode): Use the right 1 value depending on
1931 whether we are dealing with int64/uint64, float or doubles.
1933 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
1934 constructors that I implemented last night.
1936 (Constructor.IsDefault): Fix to work properly for static
1939 * cs-parser.jay (CheckDef): report method signature errors.
1940 Update error number 103 to be 132.
1942 * decl.cs: New AdditionResult enumeration value: MethodExists.
1943 Although we do this check for methods later on in the semantic
1944 analysis, catching repeated default constructors is so easy that
1945 we catch these here.
1947 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
1950 (ParameterReference.EmitAssign, Emit): handle
1953 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
1954 (ArrayAccess.EmitStoreOpcode): ditto.
1956 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
1958 * expression.cs (MakeByteBlob): Complete all the missing types
1959 (uint, short, ushort, byte, sbyte)
1961 * class.cs: Only init instance field initializers on instance
1964 Rename `constructors' to instance_constructors.
1966 (TypeContainer.AddConstructor): Only add constructors to the list
1967 if it is not static.
1969 Make sure that we handle default_static_constructor independently
1970 everywhere where we handle instance_constructors
1972 2001-12-28 Miguel de Icaza <miguel@ximian.com>
1974 * class.cs: Do not lookup or create a base initializer for a
1977 (ConstructorInitializer.Resolve): use the proper type to lookup
1980 * cs-parser.jay: Report error 1585 (modifiers between type and name).
1982 * enum.cs, interface.cs: Remove CloseType, this is taken care by
1985 * decl.cs: CloseType is now an virtual method, the default
1986 implementation just closes this type.
1988 2001-12-28 Ravi Pratap <ravi@ximian.com>
1990 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
1991 to PreserveSig by default. Also emit HideBySig on such methods.
1993 Basically, set the defaults to standard values.
1995 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
1996 argument, if candidate is better, it can't be worse than the best !
1998 (Invocation): Re-write bits to differentiate between methods being
1999 applicable in their expanded form and their normal form - for params
2002 Get rid of use_standard everywhere as only standard conversions are allowed
2003 in overload resolution.
2005 More spec conformance.
2007 2001-12-27 Miguel de Icaza <miguel@ximian.com>
2009 * driver.cs: Add --timestamp, to see where the compiler spends
2012 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
2013 `this' in static code.
2015 (SimpleName.DoResolve): Implement in terms of a helper function
2016 that allows static-references to be passed upstream to
2019 (Expression.ResolveWithSimpleName): Resolve specially simple
2020 names when called by MemberAccess to implement the special
2023 (Expression.ImplicitReferenceConversion): Handle conversions from
2024 Null to reference types before others, as Null's type is
2027 * expression.cs (Invocation.EmitCall): Handle the special case of
2028 calling methods declared on a reference type from a ValueType
2029 (Base classes System.Object and System.Enum)
2031 (MemberAccess.Resolve): Only perform lookups on Enumerations if
2032 the left hand side is a TypeExpr, not on every enumeration.
2034 (Binary.Resolve): If types are reference types, then do a cast to
2035 object on operators != and == of both arguments.
2037 * typemanager.cs (FindMembers): Extract instance and static
2038 members if requested.
2040 * interface.cs (PopulateProperty): Use void_type instead of null
2041 as the return type for the setter method.
2043 (PopulateIndexer): ditto.
2045 2001-12-27 Ravi Pratap <ravi@ximian.com>
2047 * support.cs (ReflectionParameters): Fix minor bug where we
2048 were examining the wrong parameter for the ParamArray attribute.
2050 Cope with requests for the type of the parameter at position
2051 greater than the params parameter's. We now return the element
2052 type of the params array as that makes more sense.
2054 * expression.cs (Invocation.IsParamsMethodApplicable): Update
2055 accordingly as we no longer have to extract the element type
2058 (Invocation.OverloadResolve): Update.
2060 2001-12-27 Miguel de Icaza <miguel@ximian.com>
2062 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
2063 against IEnumerator, test whether the return value is a descendant
2064 of the IEnumerator interface.
2066 * class.cs (Indexer.Define): Use an auxiliary method to implement
2067 the other bits of the method definition. Begin support for
2068 explicit interface implementation.
2070 (Property.DefineMethod): Use TypeManager.void_type instead of null
2071 for an empty return value.
2073 2001-12-26 Miguel de Icaza <miguel@ximian.com>
2075 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
2076 dealing with a FieldExpr which is composed of a FieldBuilder, in
2077 the code path we did extract the constant, but we should have
2078 obtained the underlying value to be able to cast it (otherwise we
2079 end up in an infinite loop, this is what Ravi was running into).
2081 (ArrayCreation.UpdateIndices): Arrays might be empty.
2083 (MemberAccess.ResolveMemberAccess): Add support for section
2084 14.5.4.1 that deals with the special case of E.I when E is a type
2085 and something else, that I can be a reference to a static member.
2087 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
2088 handle a particular array type to create byte blobs, it is just
2089 something we dont generate byteblobs for.
2091 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
2094 * location.cs (Push): remove the key from the hashtable that we
2095 are about to add. This happens for empty files.
2097 * driver.cs: Dispose files after we have parsed them.
2099 (tokenize): new function that only runs the tokenizer on its
2100 input, for speed testing.
2102 2001-12-26 Ravi Pratap <ravi@ximian.com>
2104 * class.cs (Event.Define): Define the private field only if there
2105 are no accessors defined.
2107 * expression.cs (ResolveMemberAccess): If there is no associated
2108 field with the event, that means we have an event defined with its
2109 own accessors and we should flag error cs0070 since transforming
2110 ourselves into a field is not valid in that case.
2112 * ecore.cs (SimpleName.DoResolve): Same as above.
2114 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
2115 and charset to sane values.
2117 2001-12-25 Ravi Pratap <ravi@ximian.com>
2119 * assign.cs (DoResolve): Perform check on events only if they
2120 are being accessed outside the declaring type.
2122 * cs-parser.jay (event_declarations): Update rules to correctly
2123 set the type of the implicit parameter etc.
2125 (add_accessor, remove_accessor): Set current local parameters.
2127 * expression.cs (Binary): For delegate addition and subtraction,
2128 cast the return value from the method into the appropriate delegate
2131 2001-12-24 Ravi Pratap <ravi@ximian.com>
2133 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
2134 of these as the workaround is unnecessary.
2136 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
2137 delegate data - none of that is needed at all.
2139 Re-write bits to extract the instance expression and the delegate method
2142 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
2145 * attribute.cs (ApplyAttributes): New method to take care of common tasks
2146 of attaching attributes instead of duplicating code everywhere.
2148 * everywhere : Update code to do attribute emission using the above method.
2150 2001-12-23 Miguel de Icaza <miguel@ximian.com>
2152 * expression.cs (IsParamsMethodApplicable): if there are not
2153 parameters, return immediately.
2155 * ecore.cs: The 0 literal can be implicity converted to an enum
2158 (SimpleName.DoResolve): First lookup the type, then lookup the
2161 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
2162 want to get its address. If the InstanceExpression is not
2163 addressable, store the result in a temporary variable, then get
2166 * codegen.cs: Only display 219 errors on warning level or above.
2168 * expression.cs (ArrayAccess): Make it implement the
2169 IMemoryLocation interface.
2171 (Binary.DoResolve): handle the operator == (object a, object b)
2172 and operator != (object a, object b) without incurring into a
2173 BoxedCast (because 5 != o should never be performed).
2175 Handle binary enumerator operators.
2177 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
2178 value type, otherwise use Ldelem_ref.
2180 Use precomputed names;
2182 (AddressOf): Implement address of
2184 * cs-parser.jay (labeled_statement): Fix recursive block
2185 addition by reworking the production.
2187 * expression.cs (New.DoEmit): New has a special case:
2189 If we are dealing with a ValueType, we have a few
2190 situations to deal with:
2192 * The target of New is a ValueType variable, that is
2193 easy, we just pass this as the variable reference
2195 * The target of New is being passed as an argument,
2196 to a boxing operation or a function that takes a
2199 In this case, we need to create a temporary variable
2200 that is the argument of New.
2203 2001-12-23 Ravi Pratap <ravi@ximian.com>
2205 * rootcontext.cs (LookupType): Check that current_type is not null before
2206 going about looking at nested types.
2208 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
2209 not implement the IAssignMethod interface any more.
2211 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
2212 where we tranform them into FieldExprs if they are being resolved from within
2215 * ecore.cs (SimpleName.DoResolve): Do the same here.
2217 * assign.cs (DoResolve, Emit): Clean up code considerably.
2219 * ../errors/bug10.cs : Add.
2221 * ../errors/cs0070.cs : Add.
2223 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
2225 * assign.cs : Get rid of EventIsLocal everywhere.
2227 2001-12-23 Miguel de Icaza <miguel@ximian.com>
2229 * ecore.cs (ConvertIntLiteral): finished the implementation.
2231 * statement.cs (SwitchLabel): Convert the value we are using as a
2232 key before looking up the table.
2234 2001-12-22 Miguel de Icaza <miguel@ximian.com>
2236 * codegen.cs (EmitTopBlock): Require a Location argument now.
2238 * cs-parser.jay (constructor_declarator): We need to setup
2239 current_local_parameters before we parse the
2240 opt_constructor_initializer, to allow the variables to be bound
2241 to the constructor arguments.
2243 * rootcontext.cs (LookupType): First lookup nested classes in our
2244 class and our parents before we go looking outside our class.
2246 * expression.cs (ConstantFold): Extract/debox the values at the
2249 * rootcontext.cs (EmitCode): Resolve the constants first before we
2250 resolve the types. This is not really needed, but it helps debugging.
2252 * statement.cs: report location.
2254 * cs-parser.jay: pass location to throw statement.
2256 * driver.cs: Small bug fix.
2258 * report.cs: Updated format to be 4-zero filled digits.
2260 2001-12-22 Ravi Pratap <ravi@ximian.com>
2262 * expression.cs (CheckIndices): Fix minor bug where the wrong
2263 variable was being referred to ;-)
2265 (DoEmit): Do not call EmitStaticInitializers when the
2266 underlying type is System.Object.
2268 2001-12-21 Ravi Pratap <ravi@ximian.com>
2270 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
2271 and do the usual workaround for SRE.
2273 * class.cs (MyEventBuilder.EventType): New member to get at the type
2274 of the event, quickly.
2276 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
2278 * assign.cs (Assign.DoResolve): Handle the case when the target
2279 is an EventExpr and perform the necessary checks.
2281 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
2284 (SimpleName.MemberStaticCheck): Include check for EventExpr.
2286 (EventExpr): Set the type in the constructor itself since we
2287 are meant to be born fully resolved.
2289 (EventExpr.Define): Revert code I wrote earlier.
2291 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
2292 instance expression is null. The instance expression is a This in that case
2293 or a null, depending on whether it is a static method or not.
2295 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
2296 refers to more than one method.
2298 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
2299 and accordingly flag errors.
2301 2001-12-21 Miguel de Icaza <miguel@ximian.com>
2303 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
2305 2001-12-22 Miguel de Icaza <miguel@ximian.com>
2307 * location.cs (ToString): Provide useful rutine.
2309 2001-12-21 Miguel de Icaza <miguel@ximian.com>
2311 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
2312 objects, return the actual integral boxed.
2314 * statement.cs (SwitchLabel): define an ILLabel for each
2317 (Switch.CheckSwitch): If the value is a Literal, extract
2318 the underlying literal.
2320 Also in the unused hashtable we had, add the SwitchLabel so we can
2321 quickly look this value up.
2323 * constant.cs: Implement a bunch of new constants. Rewrite
2324 Literal based on this. Made changes everywhere to adapt to this.
2326 * expression.cs (Expression.MakeByteBlob): Optimize routine by
2327 dereferencing array only once, and also copes with enumrations.
2329 bytes are two bytes wide, not one.
2331 (Cast): Perform constant conversions.
2333 * ecore.cs (TryImplicitIntConversion): Return literals instead of
2334 wrappers to the literals here.
2336 * expression.cs (DoNumericPromotions): long literals can converted
2337 to ulong implicity (this is taken care of elsewhere, but I was
2340 * ecore.cs (Expression.Literalize): Make the return type Literal,
2341 to improve type checking.
2343 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
2345 2001-12-20 Miguel de Icaza <miguel@ximian.com>
2347 * literal.cs: Revert code from ravi that checked the bounds. The
2348 bounds are sane by the definition of the type itself.
2350 * typemanager.cs: Fix implementation of ImplementsInterface. We
2351 need to actually look up in our parent hierarchy for interfaces
2354 * const.cs: Use the underlying type for enumerations
2356 * delegate.cs: Compute the basename for the delegate creation,
2357 that should fix the delegate test case, and restore the correct
2358 Type Lookup semantics in rootcontext
2360 * rootcontext.cs: Revert Ravi's last patch. The correct way of
2361 referencing a nested type with the Reflection API is using the "+"
2364 * cs-parser.jay: Do not require EOF token at the end.
2366 2001-12-20 Ravi Pratap <ravi@ximian.com>
2368 * rootcontext.cs (LookupType): Concatenate type names with
2369 a '.' instead of a '+' The test suite passes again.
2371 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
2372 field of the enumeration.
2374 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
2375 the case when the member is an EventExpr.
2377 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
2378 static has an associated instance expression.
2380 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
2382 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
2384 * class.cs (Event.Define): Register event and perform appropriate checks
2387 We define the Add and Remove methods even if the use provides none because
2388 in that case, we provide default implementations ourselves.
2390 Define a private field of the type of the event. This is done by the CSC compiler
2391 and we should be doing it too ;-)
2393 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
2394 More methods we use in code we generate.
2396 (multicast_delegate_type, delegate_type): Two separate types since the distinction
2399 (InitCoreTypes): Update accordingly for the above.
2401 * class.cs (Event.Emit): Generate code for default accessors that we provide
2403 (EmitDefaultMethod): Do the job in the above.
2405 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
2408 2001-12-20 Miguel de Icaza <miguel@ximian.com>
2410 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
2411 builders even if we were missing one.
2413 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
2414 pass the Basename as our class name instead of the Name. The
2415 basename will be correctly composed for us.
2417 * parameter.cs (Paramters): Now takes a Location argument.
2419 * decl.cs (DeclSpace.LookupType): Removed convenience function and
2420 make all the code call directly LookupType in RootContext and take
2421 this chance to pass the Location information everywhere.
2423 * Everywhere: pass Location information.
2425 2001-12-19 Miguel de Icaza <miguel@ximian.com>
2427 * class.cs (Constructor.Define): Updated way of detecting the
2428 length of the parameters.
2430 (TypeContainer.DefineType): Use basename as the type name for
2433 (TypeContainer.Define): Do not recursively define types here, as
2434 definition is taken care in order by the RootContext.
2436 * tree.cs: Keep track of namespaces in a per-file basis.
2438 * parameter.cs (Parameter.ComputeSignature): Update to use
2441 (Parameters.GetSignature): ditto.
2443 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
2444 instead of a TypeContainer.
2446 (Interface.SemanticAnalysis): Use `this' instead of our parent to
2447 resolve names. Because we need to be resolve in our context, not
2450 * driver.cs: Implement response files.
2452 * class.cs (TypeContainer.DefineType): If we are defined, do not
2455 (Event.Emit): Emit the code for add/remove handlers.
2456 (Event.Define): Save the MethodBuilders for add/remove.
2458 * typemanager.cs: Use pair here too.
2460 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
2461 DictionaryEntry requires the first argument to be non-null.
2463 (enum_declaration): Compute full name for registering the
2466 (delegate_declaration): Instead of using
2467 formal_parameter_list, use opt_formal_parameter_list as the list
2470 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
2471 (EventParsing): New property that controls whether `add' and
2472 `remove' are returned as tokens or identifiers (for events);
2474 2001-12-19 Ravi Pratap <ravi@ximian.com>
2476 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
2477 use MyEventBuilder only and let it wrap the real builder for us.
2479 (MyEventBuilder): Revamp constructor etc.
2481 Implement all operations that we perform on EventBuilder in precisely the same
2484 (FindMembers): Update to use the EventBuilder member.
2486 (Event.Emit): Update accordingly.
2488 2001-12-18 Ravi Pratap <ravi@ximian.com>
2490 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
2491 by calling the appropriate methods.
2493 (GetCustomAttributes): Make stubs as they cannot possibly do anything
2496 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
2498 2001-12-17 Ravi Pratap <ravi@ximian.com>
2500 * delegate.cs (Delegate.Populate): Check that the return type
2501 and various parameters types are indeed accessible.
2503 * class.cs (Constructor.Define): Same here.
2505 (Field.Define): Ditto.
2507 (Event.Define): Ditto.
2509 (Operator.Define): Check that the underlying Method defined itself
2510 correctly - so it's MethodBuilder should not be null.
2512 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
2513 expression happens to be null.
2515 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
2516 members but as of now we don't seem to be able to do anything really useful with it.
2518 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
2519 not the EventBuilder.
2521 2001-12-18 Miguel de Icaza <miguel@ximian.com>
2523 * cs-tokenizer.cs: Add support for defines.
2524 Add support for #if, #elif, #else, #endif
2526 (eval_var): evaluates a variable.
2527 (eval): stubbed for evaluating functions.
2529 * cs-parser.jay: Pass the defines information
2531 * driver.cs: Add --define command line option.
2533 * decl.cs: Move MemberCore here.
2535 Make it the base class for DeclSpace. This allows us to catch and
2536 report 108 and 109 for everything now.
2538 * class.cs (TypeContainer.Define): Extract all the members
2539 before populating and emit the warning 108 (new keyword required
2540 to override) instead of having each member implement this.
2542 (MemberCore.Define): New abstract method, we will be using this in
2543 the warning reporting engine in Populate.
2545 (Operator.Define): Adjust to new MemberCore protocol.
2547 * const.cs (Const): This does not derive from Expression, it is a
2548 temporary object we use to create fields, it is a MemberCore.
2550 * class.cs (Method.Define): Allow the entry point to be in a
2553 * driver.cs: Rewrite the argument handler to clean it up a bit.
2555 * rootcontext.cs: Made it just an auxiliary namespace feature by
2556 making everything static.
2558 * driver.cs: Adapt code to use RootContext type name instead of
2561 * delegate.cs: Remove RootContext argument.
2563 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
2566 * class.cs (Event.Define): The lookup can fail.
2568 * cs-tokenizer.cs: Begin implementation of pre-procesor.
2570 * expression.cs: Resolve the this instance before invoking the code.
2572 2001-12-17 Miguel de Icaza <miguel@ximian.com>
2574 * cs-parser.jay: Add a production in element_access that allows
2575 the thing to become a "type" reference. This way we can parse
2576 things like "(string [])" as a type.
2578 Note that this still does not handle the more complex rules of
2582 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
2584 * ecore.cs: (CopyNewMethods): new utility function used to
2585 assemble the list of methods from running FindMembers.
2587 (MemberLookup): Rework FindMembers so that
2589 2001-12-16 Miguel de Icaza <miguel@ximian.com>
2591 * class.cs (TypeContainer): Remove Delegates who fail to be
2594 * delegate.cs (Populate): Verify that we dont get null return
2595 values. TODO: Check for AsAccessible.
2597 * cs-parser.jay: Use basename to emit error 574 (destructor should
2598 have the same name as container class), not the full name.
2600 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
2601 possible representation.
2603 Also implements integer type suffixes U and L.
2605 2001-12-15 Miguel de Icaza <miguel@ximian.com>
2607 * expression.cs (ArrayCreation.DoResolve): We need to do the
2608 argument resolution *always*.
2610 * decl.cs: Make this hold the namespace. Hold the root context as
2612 (LookupType): Move here.
2614 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
2616 * location.cs (Row, Name): Fixed the code, it was always returning
2617 references to the first file.
2619 * interface.cs: Register properties defined through interfaces.
2621 * driver.cs: Add support for globbing on the command line
2623 * class.cs (Field): Make it derive from MemberCore as well.
2626 2001-12-15 Ravi Pratap <ravi@ximian.com>
2628 * class.cs (Event::Define): Check that the type of the event is a delegate
2629 type else flag error #66.
2631 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
2634 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
2635 values of EntryPoint, CharSet etc etc.
2637 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
2639 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
2640 be null and we should ignore this. I am not sure if this is really clean. Apparently,
2641 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
2642 which needs this to do its work.
2644 * ../errors/cs0066.cs : Add.
2646 2001-12-14 Miguel de Icaza <miguel@ximian.com>
2648 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
2651 * class.cs: (MethodSignature.MethodSignature): Removed hack that
2652 clears out the parameters field.
2653 (MemberSignatureCompare): Cleanup
2655 (MemberCore): New base class used to share code between MethodCore
2658 (RegisterRequiredImplementations) BindingFlags.Public requires
2659 either BindingFlags.Instace or Static. Use instance here.
2661 (Property): Refactored code to cope better with the full spec.
2663 * parameter.cs (GetParameterInfo): Return an empty array instead
2666 * class.cs (Property): Abstract or extern properties have no bodies.
2668 * parameter.cs (GetParameterInfo): return a zero-sized array.
2670 * class.cs (TypeContainer.MethodModifiersValid): Move all the
2671 method modifier validation to the typecontainer so we can reuse
2674 (MethodCore.ParameterTypes): return an empty sized array of types.
2676 (Property.Define): Test property modifier validity.
2678 Add tests for sealed/override too.
2680 (Method.Emit): abstract or extern methods have no bodies.
2682 2001-12-14 Ravi Pratap <ravi@ximian.com>
2684 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
2687 (Method::Define, ::Emit): Modify accordingly.
2689 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
2691 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
2693 * makefile: Pass in /unsafe.
2695 2001-12-13 Miguel de Icaza <miguel@ximian.com>
2697 * class.cs (MakeKey): Kill routine.
2699 * class.cs (TypeContainer.Define): Correctly define explicit
2700 method implementations (they require the full interface name plus
2703 * typemanager.cs: Deply the PtrHashtable here and stop using the
2704 lame keys. Things work so much better.
2706 This of course broke everyone who depended on `RegisterMethod' to
2707 do the `test for existance' test. This has to be done elsewhere.
2709 * support.cs (PtrHashtable): A hashtable that avoid comparing with
2710 the object stupid Equals method (because, that like fails all over
2711 the place). We still do not use it.
2713 * class.cs (TypeContainer.SetRequiredInterface,
2714 TypeContainer.RequireMethods): Killed these two routines and moved
2715 all the functionality to RegisterRequiredImplementations.
2717 (TypeContainer.RegisterRequiredImplementations): This routine now
2718 registers all the implementations required in an array for the
2719 interfaces and abstract methods. We use an array of structures
2720 which can be computed ahead of time to reduce memory usage and we
2721 also assume that lookups are cheap as most classes will not
2722 implement too many interfaces.
2724 We also avoid creating too many MethodSignatures.
2726 (TypeContainer.IsInterfaceMethod): Update and optionally does not
2727 clear the "pending" bit if we find that there are problems with
2730 (TypeContainer.VerifyPendingMethods): Update to report errors of
2731 methods that look like implementations but are not.
2733 (TypeContainer.Define): Add support for explicit interface method
2736 2001-12-12 Miguel de Icaza <miguel@ximian.com>
2738 * typemanager.cs: Keep track of the parameters here instead of
2739 being a feature of the TypeContainer.
2741 * class.cs: Drop the registration of parameters here, as
2742 InterfaceMethods are also interface declarations.
2744 * delegate.cs: Register methods with the TypeManager not only with
2745 the TypeContainer. This code was buggy.
2747 * interface.cs: Full registation here.
2749 2001-12-11 Miguel de Icaza <miguel@ximian.com>
2751 * expression.cs: Remove reducer for binary expressions, it can not
2754 * const.cs: Put here the code that used to go into constant.cs
2756 * constant.cs: Put here the code for constants, this is a new base
2759 * literal.cs: Make Literal derive from Constant.
2761 2001-12-09 Miguel de Icaza <miguel@ximian.com>
2763 * statement.cs (Return.Emit): Report error 157 if the user
2764 attempts to return from a finally block.
2766 (Return.Emit): Instead of emitting a return, jump to the end of
2769 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
2770 LocalBuilder to store the result of the function. ReturnLabel is
2771 the target where we jump.
2774 2001-12-09 Radek Doulik <rodo@ximian.com>
2776 * cs-parser.jay: remember alias in current namespace
2778 * ecore.cs (SimpleName::DoResolve): use aliases for types or
2781 * class.cs (LookupAlias): lookup alias in my_namespace
2783 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
2785 (LookupAlias): lookup alias in this and if needed in parent
2788 2001-12-08 Miguel de Icaza <miguel@ximian.com>
2792 * rootcontext.cs: (ModuleBuilder) Made static, first step into
2793 making things static. I need this to avoid passing the
2794 TypeContainer when calling ParameterType.
2796 * support.cs (InternalParameters.ParameterType): Remove ugly hack
2797 that did string manipulation to compute the type and then call
2798 GetType. Use Parameter.ParameterType instead.
2800 * cs-tokenizer.cs: Consume the suffix for floating values.
2802 * expression.cs (ParameterReference): figure out whether this is a
2803 reference parameter or not. Kill an extra variable by computing
2804 the arg_idx during emission.
2806 * parameter.cs (Parameters.GetParameterInfo): New overloaded
2807 function that returns whether a parameter is an out/ref value or not.
2809 (Parameter.ParameterType): The type of the parameter (base,
2810 without ref/out applied).
2812 (Parameter.Resolve): Perform resolution here.
2813 (Parameter.ExternalType): The full type (with ref/out applied).
2815 * statement.cs (Using.Emit, Using.EmitExpression): Implement
2816 support for expressions on the using statement.
2818 2001-12-07 Miguel de Icaza <miguel@ximian.com>
2820 * statement.cs (Using.EmitLocalVariableDecls): Split the
2821 localvariable handling of the using statement.
2823 (Block.EmitMeta): Keep track of variable count across blocks. We
2824 were reusing slots on separate branches of blocks.
2826 (Try.Emit): Emit the general code block, we were not emitting it.
2828 Check the type of the declaration to be an IDisposable or
2829 something that can be implicity converted to it.
2831 Emit conversions if required.
2833 * ecore.cs (EmptyExpression): New utility class.
2834 (Expression.ImplicitConversionExists): New utility function.
2836 2001-12-06 Miguel de Icaza <miguel@ximian.com>
2838 * statement.cs (Using): Implement.
2840 * expression.cs (LocalVariableReference): Support read only variables.
2842 * statement.cs: Remove the explicit emit for the Leave opcode.
2843 (VariableInfo): Add a readonly field.
2845 2001-12-05 Miguel de Icaza <miguel@ximian.com>
2847 * ecore.cs (ConvCast): new class used to encapsulate the various
2848 explicit integer conversions that works in both checked and
2851 (Expression.ConvertNumericExplicit): Use new ConvCast class to
2852 properly generate the overflow opcodes.
2854 2001-12-04 Miguel de Icaza <miguel@ximian.com>
2856 * statement.cs: The correct type for the EmptyExpression is the
2857 element_type, not the variable type. Ravi pointed this out.
2859 2001-12-04 Ravi Pratap <ravi@ximian.com>
2861 * class.cs (Method::Define): Handle PInvoke methods specially
2862 by using DefinePInvokeMethod instead of the usual one.
2864 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
2865 above to do the task of extracting information and defining the method.
2867 2001-12-04 Ravi Pratap <ravi@ximian.com>
2869 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
2870 of the condition for string type.
2872 (Emit): Move that here.
2874 (ArrayCreation::CheckIndices): Keep string literals in their expression
2877 (EmitDynamicInitializers): Handle strings appropriately.
2879 2001-12-04 Miguel de Icaza <miguel@ximian.com>
2881 * codegen.cs (EmitContext): Replace multiple variables with a
2882 single pointer to the current Switch statement.
2884 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
2887 2001-12-03 Miguel de Icaza <miguel@ximian.com>
2891 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
2894 (Foreach.Emit): Foreach on arrays was not setting
2895 up the loop variables (for break/continue).
2897 (GotoCase): Semi-implented.
2899 2001-12-03 Ravi Pratap <ravi@ximian.com>
2901 * attribute.cs (CheckAttribute): Handle system attributes by using
2902 Attribute.GetAttributes to examine information we need.
2904 (GetValidPlaces): Same here.
2906 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
2908 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
2910 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
2912 (Method::Define): Set appropriate flags if we have a DllImport attribute.
2914 (Method::Emit): Handle the case when we are a PInvoke method.
2916 2001-12-03 Miguel de Icaza <miguel@ximian.com>
2918 * expression.cs: Use ResolveWithSimpleName on compound names.
2920 2001-12-02 Ravi Pratap <ravi@ximian.com>
2922 * constant.cs (EmitConstant): Make sure we resolve the associated expression
2923 before trying to reduce it.
2925 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
2927 * constant.cs (LookupConstantValue): Implement.
2929 (EmitConstant): Use the above in emitting the constant.
2931 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
2932 that are user-defined by doing a LookupConstantValue on them.
2934 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
2937 2001-11-29 Miguel de Icaza <miguel@ximian.com>
2939 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
2941 (BaseAccess.DoResolve): Implement.
2943 (MemberAccess.DoResolve): Split this routine into a
2944 ResolveMemberAccess routine that can be used independently
2946 2001-11-28 Miguel de Icaza <miguel@ximian.com>
2948 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
2949 As that share bits of the implementation. Is returns a boolean,
2950 while As returns the Type that is being probed.
2952 2001-12-01 Ravi Pratap <ravi@ximian.com>
2954 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
2955 instead of a Literal - much easier.
2957 (EnumInTransit): Remove - utterly useless :-)
2959 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
2961 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
2963 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
2964 chain when we have no associated expression.
2966 2001-11-30 Ravi Pratap <ravi@ximian.com>
2968 * constant.cs (Define): Use Location while reporting the errror.
2970 Also emit a warning when 'new' is used and there is no inherited
2973 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
2976 (LookupEnumValue): Implement to lookup an enum member's value and define it
2979 (Populate): Re-write accordingly to use the above routine.
2981 2001-11-27 Miguel de Icaza <miguel@ximian.com>
2983 * expression.cs (This): Fix prototype for DoResolveLValue to
2984 override the base class DoResolveLValue.
2986 * cs-parser.cs: Report errors cs574 and cs575 (destructor
2989 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
2990 (we need to load the address of the field here). This fixes
2993 (FieldExpr.DoResolveLValue): Call the DoResolve
2994 function to initialize the Instance expression.
2996 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
2997 correctly the GetEnumerator operation on a value type.
2999 * cs-parser.jay: Add more simple parsing error catches.
3001 * statement.cs (Switch): Add support for string switches.
3002 Handle null specially.
3004 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
3006 2001-11-28 Ravi Pratap <ravi@ximian.com>
3008 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
3010 (declare_local_constant): New helper function.
3012 * statement.cs (AddConstant): Keep a separate record of constants
3014 (IsConstant): Implement to determine if a variable is a constant.
3016 (GetConstantExpression): Implement.
3018 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
3020 * statement.cs (IsVariableDefined): Re-write.
3022 2001-11-27 Ravi Pratap <ravi@ximian.com>
3024 * class.cs (TypeContainer::FindMembers): Look for constants
3025 in the case when we are looking for MemberTypes.Field
3027 * expression.cs (MemberAccess::DoResolve): Check that in the
3028 case we are a FieldExpr and a Literal, we are not being accessed
3029 by an instance reference.
3031 * cs-parser.jay (local_constant_declaration): Implement.
3033 (declaration_statement): Implement for constant declarations.
3035 2001-11-26 Miguel de Icaza <miguel@ximian.com>
3037 * statement.cs (Switch): Catch double defaults.
3039 (Switch): More work on the switch() statement
3040 implementation. It works for integral values now, need to finish
3044 2001-11-24 Miguel de Icaza <miguel@ximian.com>
3046 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
3047 integer literals into other integer literals. To be used by
3050 2001-11-24 Ravi Pratap <ravi@ximian.com>
3052 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
3055 (EmitDynamicInitializers): Cope with the above since we extract data
3056 directly from ArrayData now.
3058 (ExpectInitializers): Keep track of whether initializers are mandatory
3061 (Bounds): Make it a hashtable to prevent the same dimension being
3062 recorded for every element in that dimension.
3064 (EmitDynamicInitializers): Fix bug which prevented the Set array method
3067 Also fix bug which was causing the indices to be emitted in the reverse
3070 2001-11-24 Miguel de Icaza <miguel@ximian.com>
3072 * expression.cs (ArrayCreation): Implement the bits that Ravi left
3073 unfinished. They do not work, because the underlying code is
3076 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3078 * cs-parser.jay: Remove bogus fixme.
3080 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
3081 on Switch statement.
3083 2001-11-23 Ravi Pratap <ravi@ximian.com>
3085 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
3088 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
3089 parameter. Apparently, any expression is allowed.
3091 (ValidateInitializers): Update accordingly.
3093 (CheckIndices): Fix some tricky bugs thanks to recursion.
3095 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
3096 I was being completely brain-dead.
3098 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
3099 and re-write acordingly.
3101 (DelegateInvocation): Re-write accordingly.
3103 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
3105 (MakeByteBlob): Handle types more correctly.
3107 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
3108 initialization from expressions but it is incomplete because I am a complete
3111 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3113 * statement.cs (If.Emit): Fix a bug that generated incorrect code
3114 on If. Basically, we have to return `true' (ie, we do return to
3115 our caller) only if both branches of the if return.
3117 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
3118 short-circuit operators, handle them as short circuit operators.
3120 (Cast.DoResolve): Resolve type.
3121 (Cast.Cast): Take an expression as the target type.
3123 * cs-parser.jay (cast_expression): Remove old hack that only
3124 allowed a limited set of types to be handled. Now we take a
3125 unary_expression and we resolve to a type during semantic
3128 Use the grammar productions from Rhys to handle casts (this is
3129 not complete like Rhys syntax yet, we fail to handle that corner
3130 case that C# has regarding (-x), but we will get there.
3132 2001-11-22 Ravi Pratap <ravi@ximian.com>
3134 * class.cs (EmitFieldInitializer): Take care of the case when we have a
3135 field which is an array type.
3137 * cs-parser.jay (declare_local_variables): Support array initialization too.
3139 * typemanager.cs (MakeKey): Implement.
3141 (everywhere): Use the above appropriately.
3143 * cs-parser.jay (for_statement): Update for array initialization while
3144 declaring variables.
3146 * ecore.cs : The error message was correct, it's the variable's names that
3147 were misleading ;-) Make the code more readable.
3149 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
3150 the correct type etc.
3152 (ConvertExplicit): Handle Enum types by examining the underlying type.
3154 2001-11-21 Ravi Pratap <ravi@ximian.com>
3156 * parameter.cs (GetCallingConvention): Always return
3157 CallingConventions.Standard for now.
3159 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3161 * expression.cs (Binary.ResolveOperator): Update the values of `l'
3162 and `r' after calling DoNumericPromotions.
3164 * ecore.cs: Fix error message (the types were in the wrong order).
3166 * statement.cs (Foreach.ProbeCollectionType): Need to pass
3167 BindingFlags.Instance as well
3169 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
3170 implicit int literal conversion in an empty cast so that we
3171 propagate the right type upstream.
3173 (UnboxCast): new class used to unbox value types.
3174 (Expression.ConvertExplicit): Add explicit type conversions done
3177 (Expression.ImplicitNumericConversion): Oops, forgot to test for
3178 the target type before applying the implicit LongLiterals to ULong
3181 2001-11-21 Miguel de Icaza <miguel@ximian.com>
3183 * cs-parser.jay (for_statement): Reworked the way For works: now
3184 we declare manually any variables that are introduced in
3185 for_initializer to solve the problem of having out-of-band code
3186 emition (that is what got for broken).
3188 (declaration_statement): Perform the actual variable declaration
3189 that used to be done in local_variable_declaration here.
3191 (local_variable_declaration): Do not declare anything, just pass
3192 the information on a DictionaryEntry
3194 2001-11-20 Ravi Pratap <ravi@ximian.com>
3196 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
3197 re-write of the logic to now make it recursive.
3199 (UpdateIndices): Re-write accordingly.
3201 Store element data in a separate ArrayData list in the above methods.
3203 (MakeByteBlob): Implement to dump the array data into a byte array.
3205 2001-11-19 Ravi Pratap <ravi@ximian.com>
3207 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
3210 * constant.cs (Define): Implement.
3212 (EmitConstant): Re-write fully.
3214 Pass in location info.
3216 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
3219 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
3220 DictionaryEntry since we need location info too.
3222 (constant_declaration): Update accordingly.
3224 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
3225 code into another method : UpdateIndices.
3227 2001-11-18 Ravi Pratap <ravi@ximian.com>
3229 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
3230 some type checking etc.
3232 2001-11-17 Ravi Pratap <ravi@ximian.com>
3234 * expression.cs (ArrayCreation::ValidateInitializers): Implement
3235 bits to provide dimension info if the user skips doing that.
3237 Update second constructor to store the rank correctly.
3239 2001-11-16 Ravi Pratap <ravi@ximian.com>
3241 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
3242 and try to implement.
3244 * ../errors/cs0150.cs : Add.
3246 * ../errors/cs0178.cs : Add.
3248 2001-11-16 Miguel de Icaza <miguel@ximian.com>
3250 * statement.cs: Implement foreach on multi-dimensional arrays.
3252 * parameter.cs (Parameters.GetParameterByName): Also lookup the
3253 name of the params argument.
3255 * expression.cs: Use EmitStoreOpcode to get the right opcode while
3256 initializing the array.
3258 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
3259 we can use this elsewhere.
3261 * statement.cs: Finish implementation of foreach for single
3264 * cs-parser.jay: Use an out-of-band stack to pass information
3265 around, I wonder why I need this.
3267 foreach_block: Make the new foreach_block the current_block.
3269 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
3270 function used to return a static Parameters structure. Used for
3271 empty parameters, as those are created very frequently.
3273 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
3275 2001-11-15 Ravi Pratap <ravi@ximian.com>
3277 * interface.cs : Default modifier is private, not public. The
3278 make verify test passes again.
3280 2001-11-15 Ravi Pratap <ravi@ximian.com>
3282 * support.cs (ReflectionParameters): Fix logic to determine
3283 whether the last parameter is a params one. Test 9 passes again.
3285 * delegate.cs (Populate): Register the builders we define with
3286 RegisterParameterForBuilder. Test 19 passes again.
3288 * cs-parser.jay (property_declaration): Reference $6 instead
3289 of $$ to get at the location.
3291 (indexer_declaration): Similar stuff.
3295 * class.cs (Property): Register parameters for the Get and Set methods
3296 if they exist. Test 23 passes again.
3298 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
3299 call to EmitArguments as we are sure there aren't any params arguments.
3300 Test 32 passes again.
3302 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
3303 IndexOutOfRangeException.
3305 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
3306 Test 33 now passes again.
3308 2001-11-15 Miguel de Icaza <miguel@ximian.com>
3310 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
3311 broke a bunch of things. Will have to come up with a better way
3312 of tracking locations.
3314 * statement.cs: Implemented foreach for single dimension arrays.
3316 2001-11-09 Miguel de Icaza <miguel@ximian.com>
3318 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
3319 an error. This removes the lookup from the critical path.
3321 * cs-parser.jay: Removed use of temporary_loc, which is completely
3324 2001-11-14 Miguel de Icaza <miguel@ximian.com>
3326 * support.cs (ReflectionParameters.ParameterModifier): Report
3327 whether the argument is a PARAMS argument or not.
3329 * class.cs: Set the attribute `ParamArrayAttribute' on the
3332 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
3333 and cons_param_array_attribute (ConstructorInfo for
3334 ParamArrayAttribute).,
3336 * codegen.cs: Emit the return using the `Return' statement, that
3337 way we can report the error correctly for missing return values.
3339 * class.cs (Method.Emit): Clean up.
3341 * expression.cs (Argument.Resolve): Take another argument: the
3342 location where this argument is used. Notice that this is not
3343 part of the "Argument" class as to reduce the size of the
3344 structure (we know the approximate location anyways).
3346 Test if the argument is a variable-reference, if not, then
3347 complain with a 206.
3349 (Argument.Emit): Emit addresses of variables.
3351 (Argument.FullDesc): Simplify.
3353 (Invocation.DoResolve): Update for Argument.Resolve.
3355 (ElementAccess.DoResolve): ditto.
3357 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
3358 method should be virtual, as this method is always virtual.
3360 (NewDelegate.DoResolve): Update for Argument.Resolve.
3362 * class.cs (ConstructorInitializer.DoResolve): ditto.
3364 * attribute.cs (Attribute.Resolve): ditto.
3366 2001-11-13 Miguel de Icaza <miguel@ximian.com>
3368 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
3370 * expression.cs (ParameterReference): Drop IStackStorage and implement
3371 IAssignMethod instead.
3373 (LocalVariableReference): ditto.
3375 * ecore.cs (FieldExpr): Drop IStackStorage and implement
3376 IAssignMethod instead.
3378 2001-11-13 Miguel de Icaza <miguel@ximian.com>
3380 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
3381 enumerations that are used in heavily used structures derive from
3382 byte in a laughable and pathetic attempt to reduce memory usage.
3383 This is the kind of pre-optimzations that you should not do at
3384 home without adult supervision.
3386 * expression.cs (UnaryMutator): New class, used to handle ++ and
3387 -- separatedly from the other unary operators. Cleans up the
3388 code, and kills the ExpressionStatement dependency in Unary.
3390 (Unary): Removed `method' and `Arguments' from this class, making
3391 it smaller, and moving it all to SimpleCall, so I can reuse this
3392 code in other locations and avoid creating a lot of transient data
3393 strucutres when not required.
3395 * cs-parser.jay: Adjust for new changes.
3397 2001-11-11 Miguel de Icaza <miguel@ximian.com>
3399 * enum.cs (Enum.Populate): If there is a failure during
3402 * cs-parser.jay (opt_enum_base): we used to catch type errors
3403 here, but this is really incorrect. The type error should be
3404 catched during semantic analysis.
3406 2001-12-11 Ravi Pratap <ravi@ximian.com>
3408 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
3409 current_local_parameters as expected since I, in my stupidity, had forgotten
3412 * attribute.cs (GetValidPlaces): Fix stupid bug.
3414 * class.cs (Method::Emit): Perform check on applicability of attributes.
3416 (Constructor::Emit): Ditto.
3418 (Field::Emit): Ditto.
3420 (Field.Location): Store location information.
3422 (Property, Event, Indexer, Operator): Ditto.
3424 * cs-parser.jay (field_declaration): Pass in location for each field.
3426 * ../errors/cs0592.cs : Add.
3428 2001-11-12 Ravi Pratap <ravi@ximian.com>
3430 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
3432 (InitCoreTypes): Update accordingly.
3434 (RegisterAttrType, LookupAttr): Implement.
3436 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
3437 info about the same.
3439 (Resolve): Update to populate the above as necessary.
3443 (GetValidPlaces): Helper to the above.
3445 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
3447 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
3449 2001-11-12 Ravi Pratap <ravi@ximian.com>
3451 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
3453 * ../errors/cs0617.cs : Add.
3455 2001-11-11 Ravi Pratap <ravi@ximian.com>
3457 * enum.cs (Emit): Rename to Populate to be more consistent with what
3458 we expect it to do and when exactly it is called.
3460 * class.cs, rootcontext.cs : Update accordingly.
3462 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
3463 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
3465 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
3467 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
3468 of a fieldinfo using the above, when dealing with a FieldBuilder.
3470 2001-11-10 Ravi Pratap <ravi@ximian.com>
3472 * ../errors/cs0031.cs : Add.
3474 * ../errors/cs1008.cs : Add.
3476 * ../errrors/cs0543.cs : Add.
3478 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
3481 (FindMembers): Implement.
3483 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
3484 enums and delegates too.
3486 (enum_types): Rename to builder_to_enum.
3488 (delegate_types): Rename to builder_to_delegate.
3490 * delegate.cs (FindMembers): Implement.
3492 2001-11-09 Ravi Pratap <ravi@ximian.com>
3494 * typemanager.cs (IsEnumType): Implement.
3496 * enum.cs (Emit): Re-write parts to account for the underlying type
3497 better and perform checking etc.
3499 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
3500 of the underlying type.
3502 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
3505 * enum.cs (error31): Helper to report error #31.
3507 * cs-parser.jay (enum_declaration): Store location of each member too.
3509 * enum.cs (member_to_location): New hashtable.
3511 (AddEnumMember): Update location hashtable.
3513 (Emit): Use the location of each member while reporting errors.
3515 2001-11-09 Miguel de Icaza <miguel@ximian.com>
3517 * cs-parser.jay: A for_initializer if is a
3518 local_variable_declaration really ammount to have an implicit
3519 block with the variable declaration and no initializer for for.
3521 * statement.cs (For.Emit): Cope with null initializers.
3523 This fixes the infinite loop on for initializers.
3525 2001-11-08 Miguel de Icaza <miguel@ximian.com>
3527 * enum.cs: More cleanup.
3529 * ecore.cs: Remove dead code.
3531 * class.cs (Property.Emit): More simplification.
3532 (Event.Emit): ditto.
3534 Reworked to have less levels of indentation.
3536 2001-11-08 Ravi Pratap <ravi@ximian.com>
3538 * class.cs (Property): Emit attributes.
3548 * enum.cs (Emit): Ditto.
3550 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
3553 * class.cs (Field, Event, etc.): Move attribute generation into the
3554 Emit method everywhere.
3556 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
3557 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
3558 as we had no way of defining nested enums !
3560 * rootcontext.cs : Adjust code accordingly.
3562 * typemanager.cs (AddEnumType): To keep track of enum types separately.
3564 2001-11-07 Ravi Pratap <ravi@ximian.com>
3566 * expression.cs (EvalConstantExpression): Move into ecore.cs
3568 * enum.cs (Enum): Rename some members and make them public and readonly
3569 according to our convention.
3571 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
3574 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
3576 (Enum::Emit): Write a simple version for now which doesn't try to compute
3577 expressions. I shall modify this to be more robust in just a while.
3579 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
3581 (TypeContainer::CloseType): Create the Enum types too.
3583 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
3585 * expression.cs (EvalConstantExpression): Get rid of completely.
3587 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
3588 user-defined values and other cases.
3590 (IsValidEnumLiteral): Helper function.
3592 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
3593 out there in the case we had a literal FieldExpr.
3595 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
3597 (Literalize): Revamp a bit to take two arguments.
3599 (EnumLiteral): New class which derives from Literal to wrap enum literals.
3601 2001-11-06 Ravi Pratap <ravi@ximian.com>
3603 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
3605 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
3607 (Resolve): Use the above to ensure we have proper initializers.
3609 2001-11-05 Ravi Pratap <ravi@ximian.com>
3611 * expression.cs (Expression::EvalConstantExpression): New method to
3612 evaluate constant expressions.
3614 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
3616 2001-11-07 Miguel de Icaza <miguel@ximian.com>
3618 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
3621 (Binary.ResolveOperator): Handle operator != (object a, object b)
3622 and operator == (object a, object b);
3624 (Binary.DoNumericPromotions): Indicate whether the numeric
3625 promotion was possible.
3627 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
3630 Made the ArrayAccess implement interface IAssignMethod instead of
3631 IStackStore as the order in which arguments are passed reflects
3634 * assign.cs: Instead of using expr.ExprClass to select the way of
3635 assinging, probe for the IStackStore/IAssignMethod interfaces.
3637 * typemanager.cs: Load InitializeArray definition.
3639 * rootcontext.cs (RootContext.MakeStaticData): Used to define
3640 static data that can be used to initialize arrays.
3642 2001-11-05 Miguel de Icaza <miguel@ximian.com>
3644 * expression.cs: Handle operator== and operator!= for booleans.
3646 (Conditioal.Reduce): Implement reducer for the ?: operator.
3648 (Conditional.Resolve): Implement dead code elimination.
3650 (Binary.Resolve): Catch string literals and return a new
3651 concatenated string.
3653 (Unary.Reduce): Implement reduction of unary expressions.
3655 * ecore.cs: Split out the expression core handling here.
3657 (Expression.Reduce): New method used to perform constant folding
3658 and CSE. This is needed to support constant-expressions.
3660 * statement.cs (Statement.EmitBoolExpression): Pass true and false
3661 targets, and optimize for !x.
3663 2001-11-04 Ravi Pratap <ravi@ximian.com>
3665 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
3666 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
3667 set custom atttributes.
3669 * literal.cs (Literal::GetValue): New abstract method to return the actual
3670 value of the literal, cast as an object.
3672 (*Literal): Implement GetValue method.
3674 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
3675 expressions to the arraylist but objects of type Argument.
3677 * class.cs (TypeContainer::Emit): Emit our attributes too.
3679 (Method::Emit, Constructor::Emit): Ditto.
3681 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
3682 to be ignoring earlier.
3684 2001-11-03 Ravi Pratap <ravi@ximian.com>
3686 * attribute.cs (AttributeSection::Define): Implement to do the business
3687 of constructing a CustomAttributeBuilder.
3689 (Attribute): New trivial class. Increases readability of code.
3691 * cs-parser.jay : Update accordingly.
3693 (positional_argument_list, named_argument_list, named_argument): New rules
3695 (attribute_arguments): Use the above so that we are more correct.
3697 2001-11-02 Ravi Pratap <ravi@ximian.com>
3699 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
3700 to perform all checks for a method with a params parameter.
3702 (Invocation::OverloadResolve): Update to use the above method and therefore
3703 cope correctly with params method invocations.
3705 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
3708 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
3709 constructors in our parent too because we can't afford to miss out on
3712 * attribute.cs (AttributeSection): New name for the class Attribute
3714 Other trivial changes to improve readability.
3716 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
3717 use the new class names.
3719 2001-11-01 Ravi Pratap <ravi@ximian.com>
3721 * class.cs (Method::Define): Complete definition for params types too
3723 (Indexer::Define): Ditto.
3725 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
3726 Cope everywhere with a request for info about the array parameter.
3728 2001-11-01 Ravi Pratap <ravi@ximian.com>
3730 * tree.cs (RecordNamespace): Fix up to check for the correct key.
3732 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
3733 local_variable_type to extract the string corresponding to the type.
3735 (local_variable_type): Fixup the action to use the new helper method.
3737 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
3740 * expression.cs : Clean out code which uses the above.
3742 2001-10-31 Ravi Pratap <ravi@ximian.com>
3744 * typemanager.cs (RegisterMethod): Check if we already have an existing key
3745 and bale out if necessary by returning a false.
3747 (RegisterProperty): Ditto.
3749 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
3750 and print out appropriate error messages.
3752 * interface.cs (everywhere): Ditto.
3754 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
3755 location to constructor.
3757 * class.cs (Property, Event, Indexer): Update accordingly.
3759 * ../errors/cs111.cs : Added.
3761 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
3762 of a method, as laid down by the spec.
3764 (Invocation::OverloadResolve): Use the above method.
3766 2001-10-31 Ravi Pratap <ravi@ximian.com>
3768 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
3769 now take a TypeContainer and a Parameters object.
3771 (ParameterData): Modify return type of ParameterModifier method to be
3772 Parameter.Modifier and not a string.
3774 (ReflectionParameters, InternalParameters): Update accordingly.
3776 * expression.cs (Argument::GetParameterModifier): Same here.
3778 * support.cs (InternalParameters::ParameterType): Find a better way of determining
3779 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
3780 symbol in it at all so maybe this is only for now.
3782 2001-10-30 Ravi Pratap <ravi@ximian.com>
3784 * support.cs (InternalParameters): Constructor now takes an extra argument
3785 which is the actual Parameters class.
3787 (ParameterDesc): Update to provide info on ref/out modifiers.
3789 * class.cs (everywhere): Update call to InternalParameters to pass in
3790 the second argument too.
3792 * support.cs (ParameterData): Add ParameterModifier, which is a method
3793 to return the modifier info [ref/out etc]
3795 (InternalParameters, ReflectionParameters): Implement the above.
3797 * expression.cs (Argument::ParameterModifier): Similar function to return
3798 info about the argument's modifiers.
3800 (Invocation::OverloadResolve): Update to take into account matching modifiers
3803 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
3804 a new SetFormalParameters object which we pass to InternalParameters.
3806 2001-10-30 Ravi Pratap <ravi@ximian.com>
3808 * expression.cs (NewArray): Merge into the ArrayCreation class.
3810 2001-10-29 Ravi Pratap <ravi@ximian.com>
3812 * expression.cs (NewArray): Merge classes NewBuiltinArray and
3813 NewUserdefinedArray into one as there wasn't much of a use in having
3816 * expression.cs (Argument): Change field's name to ArgType from Type.
3818 (Type): New readonly property which returns the proper type, taking into
3819 account ref/out modifiers.
3821 (everywhere): Adjust code accordingly for the above.
3823 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
3824 whether we are emitting for a ref or out parameter.
3826 * expression.cs (Argument::Emit): Use the above field to set the state.
3828 (LocalVariableReference::Emit): Update to honour the flag and emit the
3831 * parameter.cs (Attributes): Set the correct flags for ref parameters.
3833 * expression.cs (Argument::FullDesc): New function to provide a full desc.
3835 * support.cs (ParameterData): Add method ParameterDesc to the interface.
3837 (ReflectionParameters, InternalParameters): Implement the above method.
3839 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
3842 (Invocation::FullMethodDesc): Ditto.
3844 2001-10-29 Miguel de Icaza <miguel@ximian.com>
3846 * cs-parser.jay: Add extra production for the second form of array
3849 * expression.cs (ArrayCreation): Update to reflect the above
3852 * Small changes to prepare for Array initialization.
3854 2001-10-28 Miguel de Icaza <miguel@ximian.com>
3856 * typemanager.cs (ImplementsInterface): interface might be null;
3857 Deal with this problem;
3859 Also, we do store negative hits on the cache (null values), so use
3860 this instead of calling t.GetInterfaces on the type everytime.
3862 2001-10-28 Ravi Pratap <ravi@ximian.com>
3864 * typemanager.cs (IsBuiltinType): New method to help determine the same.
3866 * expression.cs (New::DoResolve): Get rid of array creation code and instead
3867 split functionality out into different classes.
3869 (New::FormArrayType): Move into NewBuiltinArray.
3871 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
3874 (NewBuiltinArray): New class to handle creation of built-in arrays.
3876 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
3877 account creation of one-dimensional arrays.
3879 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
3881 (NewUserdefinedArray::DoResolve): Implement.
3883 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
3885 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
3886 we maintain inside the TypeManager. This is necessary to perform lookups on the
3889 (LookupType): Update to perform GetType on the module builders too.
3891 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
3893 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
3895 2001-10-23 Ravi Pratap <ravi@ximian.com>
3897 * expression.cs (New::DoResolve): Implement guts of array creation.
3899 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
3901 2001-10-27 Miguel de Icaza <miguel@ximian.com>
3903 * expression.cs: Fix bug I introduced lsat night that broke
3906 (Expression.Resolve): Report a 246 error (can not resolve name)
3907 if we find a SimpleName in the stream.
3909 (Expression.ResolveLValue): Ditto.
3911 (Expression.ResolveWithSimpleName): This function is a variant of
3912 ResolveName, this one allows SimpleNames to be returned without a
3913 warning. The only consumer of SimpleNames is MemberAccess
3915 2001-10-26 Miguel de Icaza <miguel@ximian.com>
3917 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
3918 might arrive here. I have my doubts that this is correct.
3920 * statement.cs (Lock): Implement lock statement.
3922 * cs-parser.jay: Small fixes to support `lock' and `using'
3924 * cs-tokenizer.cs: Remove extra space
3926 * driver.cs: New flag --checked, allows to turn on integer math
3929 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
3930 Threading.Monitor.Exit
3932 2001-10-23 Miguel de Icaza <miguel@ximian.com>
3934 * expression.cs (IndexerAccess::DoResolveLValue): Set the
3935 Expression Class to be IndexerAccess.
3937 Notice that Indexer::DoResolve sets the eclass to Value.
3939 2001-10-22 Miguel de Icaza <miguel@ximian.com>
3941 * class.cs (TypeContainer::Emit): Emit code for indexers.
3943 * assign.cs (IAssignMethod): New interface implemented by Indexers
3944 and Properties for handling assignment.
3946 (Assign::Emit): Simplify and reuse code.
3948 * expression.cs (IndexerAccess, PropertyExpr): Implement
3949 IAssignMethod, clean up old code.
3951 2001-10-22 Ravi Pratap <ravi@ximian.com>
3953 * typemanager.cs (ImplementsInterface): New method to determine if a type
3954 implements a given interface. Provides a nice cache too.
3956 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
3959 (ConvertReferenceExplicit): Ditto.
3961 * delegate.cs (Delegate::Populate): Update to define the parameters on the
3962 various methods, with correct names etc.
3964 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
3965 Operator.UnaryNegation.
3967 * cs-parser.jay (operator_declarator): Be a little clever in the case where
3968 we have a unary plus or minus operator.
3970 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
3973 * everywhere : update accordingly.
3975 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
3978 * class.cs (Method::Define): For the case where we are implementing a method
3979 inherited from an interface, we need to set the MethodAttributes.Final flag too.
3980 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
3982 2001-10-21 Ravi Pratap <ravi@ximian.com>
3984 * interface.cs (FindMembers): Implement to work around S.R.E
3987 * typemanager.cs (IsInterfaceType): Implement.
3989 (FindMembers): Update to handle interface types too.
3991 * expression.cs (ImplicitReferenceConversion): Re-write bits which
3992 use IsAssignableFrom as that is not correct - it doesn't work.
3994 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
3995 and accordingly override EmitStatement.
3997 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
3998 using the correct logic :-)
4000 2001-10-19 Ravi Pratap <ravi@ximian.com>
4002 * ../errors/cs-11.cs : Add to demonstrate error -11
4004 2001-10-17 Miguel de Icaza <miguel@ximian.com>
4006 * assign.cs (Assign::Resolve): Resolve right hand side first, and
4007 then pass this as a hint to ResolveLValue.
4009 * expression.cs (FieldExpr): Add Location information
4011 (FieldExpr::LValueResolve): Report assignment to readonly
4014 (Expression::ExprClassFromMemberInfo): Pass location information.
4016 (Expression::ResolveLValue): Add new method that resolves an
4019 (Expression::DoResolveLValue): Default invocation calls
4022 (Indexers): New class used to keep track of indexers in a given
4025 (IStackStore): Renamed from LValue, as it did not really describe
4026 what this did. Also ResolveLValue is gone from this interface and
4027 now is part of Expression.
4029 (ElementAccess): Depending on the element access type
4031 * typemanager.cs: Add `indexer_name_type' as a Core type
4032 (System.Runtime.CompilerServices.IndexerNameAttribute)
4034 * statement.cs (Goto): Take a location.
4036 2001-10-18 Ravi Pratap <ravi@ximian.com>
4038 * delegate.cs (Delegate::VerifyDelegate): New method to verify
4039 if two delegates are compatible.
4041 (NewDelegate::DoResolve): Update to take care of the case when
4042 we instantiate a delegate from another delegate.
4044 * typemanager.cs (FindMembers): Don't even try to look up members
4045 of Delegate types for now.
4047 2001-10-18 Ravi Pratap <ravi@ximian.com>
4049 * delegate.cs (NewDelegate): New class to take care of delegate
4052 * expression.cs (New): Split the delegate related code out into
4053 the NewDelegate class.
4055 * delegate.cs (DelegateInvocation): New class to handle delegate
4058 * expression.cs (Invocation): Split out delegate related code into
4059 the DelegateInvocation class.
4061 2001-10-17 Ravi Pratap <ravi@ximian.com>
4063 * expression.cs (New::DoResolve): Implement delegate creation fully
4064 and according to the spec.
4066 (New::DoEmit): Update to handle delegates differently.
4068 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
4069 because of which we were printing out arguments in reverse order !
4071 * delegate.cs (VerifyMethod): Implement to check if the given method
4072 matches the delegate.
4074 (FullDelegateDesc): Implement.
4076 (VerifyApplicability): Implement.
4078 * expression.cs (Invocation::DoResolve): Update to accordingly handle
4079 delegate invocations too.
4081 (Invocation::Emit): Ditto.
4083 * ../errors/cs1593.cs : Added.
4085 * ../errors/cs1594.cs : Added.
4087 * delegate.cs (InstanceExpression, TargetMethod): New properties.
4089 2001-10-16 Ravi Pratap <ravi@ximian.com>
4091 * typemanager.cs (intptr_type): Core type for System.IntPtr
4093 (InitCoreTypes): Update for the same.
4095 (iasyncresult_type, asynccallback_type): Ditto.
4097 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
4100 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
4103 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
4104 the builders for the 4 members of a delegate type :-)
4106 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
4109 * expression.cs (New::DoResolve): Implement guts for delegate creation.
4111 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
4113 2001-10-15 Miguel de Icaza <miguel@ximian.com>
4115 * statement.cs (Break::Emit): Implement.
4116 (Continue::Emit): Implement.
4118 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
4119 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
4120 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
4121 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
4124 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
4125 properties that track the label for the current loop (begin of the
4126 loop and end of the loop).
4128 2001-10-15 Ravi Pratap <ravi@ximian.com>
4130 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
4131 use of emitting anything at all.
4133 * class.cs, rootcontext.cs : Get rid of calls to the same.
4135 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
4137 (Populate): Define the constructor correctly and set the implementation
4140 * typemanager.cs (delegate_types): New hashtable to hold delegates that
4143 (AddDelegateType): Implement.
4145 (IsDelegateType): Implement helper method.
4147 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
4149 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
4150 and accordingly handle it.
4152 * delegate.cs (Populate): Take TypeContainer argument.
4153 Implement bits to define the Invoke method. However, I still haven't figured out
4154 how to take care of the native int bit :-(
4156 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
4157 Qualify the name of the delegate, not its return type !
4159 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
4162 (StandardConversionExists): Checking for array types turns out to be recursive.
4164 (ConvertReferenceExplicit): Implement array conversion.
4166 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
4168 2001-10-12 Ravi Pratap <ravi@ximian.com>
4170 * cs-parser.jay (delegate_declaration): Store the fully qualified
4171 name as it is a type declaration.
4173 * delegate.cs (ReturnType, Name): Rename members to these. Make them
4176 (DefineDelegate): Renamed from Define. Does the same thing essentially,
4177 as TypeContainer::DefineType.
4179 (Populate): Method in which all the definition of the various methods (Invoke)
4182 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
4185 (CloseDelegate): Finally creates the delegate.
4187 * class.cs (TypeContainer::DefineType): Update to define delegates.
4188 (Populate, Emit and CloseType): Do the same thing here too.
4190 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
4191 delegates in all these operations.
4193 2001-10-14 Miguel de Icaza <miguel@ximian.com>
4195 * expression.cs: LocalTemporary: a new expression used to
4196 reference a temporary that has been created.
4198 * assign.cs: Handle PropertyAccess back here, so that we can
4199 provide the proper semantic access to properties.
4201 * expression.cs (Expression::ConvertReferenceExplicit): Implement
4202 a few more explicit conversions.
4204 * modifiers.cs: `NEW' modifier maps to HideBySig.
4206 * expression.cs (PropertyExpr): Make this into an
4207 ExpressionStatement, and support the EmitStatement code path.
4209 Perform get/set error checking, clean up the interface.
4211 * assign.cs: recognize PropertyExprs as targets, and if so, turn
4212 them into toplevel access objects.
4214 2001-10-12 Miguel de Icaza <miguel@ximian.com>
4216 * expression.cs: PropertyExpr::PropertyExpr: use work around the
4219 * typemanager.cs: Keep track here of our PropertyBuilders again to
4220 work around lameness in SRE.
4222 2001-10-11 Miguel de Icaza <miguel@ximian.com>
4224 * expression.cs (LValue::LValueResolve): New method in the
4225 interface, used to perform a second resolution pass for LValues.
4227 (This::DoResolve): Catch the use of this in static methods.
4229 (This::LValueResolve): Implement.
4231 (This::Store): Remove warning, assigning to `this' in structures
4234 (Invocation::Emit): Deal with invocation of
4235 methods on value types. We need to pass the address to structure
4236 methods rather than the object itself. (The equivalent code to
4237 emit "this" for structures leaves the entire structure on the
4238 stack instead of a pointer to it).
4240 (ParameterReference::DoResolve): Compute the real index for the
4241 argument based on whether the method takes or not a `this' pointer
4242 (ie, the method is static).
4244 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
4245 value types returned from functions when we need to invoke a
4246 method on the sturcture.
4249 2001-10-11 Ravi Pratap <ravi@ximian.com>
4251 * class.cs (TypeContainer::DefineType): Method to actually do the business of
4252 defining the type in the Modulebuilder or Typebuilder. This is to take
4253 care of nested types which need to be defined on the TypeBuilder using
4256 (TypeContainer::GetClassBases): Implement. Essentially the code from the
4257 methods in RootContext, only ported to be part of TypeContainer.
4259 (TypeContainer::GetInterfaceOrClass): Ditto.
4261 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
4263 * interface.cs (Interface::DefineInterface): New method. Does exactly
4264 what RootContext.CreateInterface did earlier, only it takes care of nested types
4267 (Interface::GetInterfaces): Move from RootContext here and port.
4269 (Interface::GetInterfaceByName): Same here.
4271 * rootcontext.cs (ResolveTree): Re-write.
4273 (PopulateTypes): Re-write.
4275 * class.cs (TypeContainer::Populate): Populate nested types too.
4276 (TypeContainer::Emit): Emit nested members too.
4278 * typemanager.cs (AddUserType): Do not make use of the FullName property,
4279 instead just use the name argument passed in as it is already fully
4282 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
4283 to TypeContainer mapping to see if a type is user-defined.
4285 * class.cs (TypeContainer::CloseType): Implement.
4287 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
4288 the default constructor.
4290 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
4293 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
4295 * interface.cs (CloseType): Create the type here.
4297 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
4300 Remove all the methods which are now in TypeContainer.
4302 2001-10-10 Ravi Pratap <ravi@ximian.com>
4304 * delegate.cs (Define): Re-write bits to define the delegate
4307 2001-10-10 Miguel de Icaza <miguel@ximian.com>
4309 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
4311 * expression.cs (ImplicitReferenceConversion): handle null as well
4312 as a source to convert to any reference type.
4314 * statement.cs (Return): Perform any implicit conversions to
4315 expected return type.
4317 Validate use of return statement.
4319 * codegen.cs (EmitContext): Pass the expected return type here.
4321 * class.cs (Method, Constructor, Property): Pass expected return
4322 type to EmitContext.
4324 2001-10-09 Miguel de Icaza <miguel@ximian.com>
4326 * expression.cs: Make DoResolve take an EmitContext instead of a
4329 Replaced `l' and `location' for `loc', for consistency.
4331 (Error, Warning): Remove unneeded Tc argument.
4333 * assign.cs, literal.cs, constant.cs: Update to new calling
4336 * codegen.cs: EmitContext now contains a flag indicating whether
4337 code is being generated in a static method or not.
4339 * cs-parser.jay: DecomposeQI, new function that replaces the old
4340 QualifiedIdentifier. Now we always decompose the assembled
4341 strings from qualified_identifier productions into a group of
4344 2001-10-08 Miguel de Icaza <miguel@ximian.com>
4346 * rootcontext.cs: Deal with field-less struct types correctly now
4347 by passing the size option to Define Type.
4349 * class.cs: Removed hack that created one static field.
4351 2001-10-07 Miguel de Icaza <miguel@ximian.com>
4353 * statement.cs: Moved most of the code generation here.
4355 2001-10-09 Ravi Pratap <ravi@ximian.com>
4357 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
4360 (ElementAccess): Remove useless bits for now - keep checks as the spec
4363 2001-10-08 Ravi Pratap <ravi@ximian.com>
4365 * expression.cs (ElementAccess::DoResolve): Remove my crap code
4366 and start performing checks according to the spec.
4368 2001-10-07 Ravi Pratap <ravi@ximian.com>
4370 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
4371 rank_specifiers instead.
4373 (rank_specifiers): Change the order in which the rank specifiers are stored
4375 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
4377 * expression.cs (ElementAccess): Implement the LValue interface too.
4379 2001-10-06 Ravi Pratap <ravi@ximian.com>
4381 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
4382 except that user defined conversions are not included.
4384 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
4385 perform the conversion of the return type, if necessary.
4387 (New::DoResolve): Check whether we are creating an array or an object
4388 and accordingly do the needful.
4390 (New::Emit): Same here.
4392 (New::DoResolve): Implement guts of array creation.
4394 (New::FormLookupType): Helper function.
4396 2001-10-07 Miguel de Icaza <miguel@ximian.com>
4398 * codegen.cs: Removed most of the code generation here, and move the
4399 corresponding code generation bits to the statement classes.
4401 Added support for try/catch/finalize and throw.
4403 * cs-parser.jay: Added support for try/catch/finalize.
4405 * class.cs: Catch static methods having the flags override,
4406 virtual or abstract.
4408 * expression.cs (UserCast): This user cast was not really doing
4409 what it was supposed to do. Which is to be born in fully resolved
4410 state. Parts of the resolution were being performed at Emit time!
4414 2001-10-05 Miguel de Icaza <miguel@ximian.com>
4416 * expression.cs: Implicity convert the result from UserCast.
4418 2001-10-05 Ravi Pratap <ravi@ximian.com>
4420 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
4421 prevented it from working correctly.
4423 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
4424 merely ConvertImplicit.
4426 2001-10-05 Miguel de Icaza <miguel@ximian.com>
4428 * typemanager.cs: Make the LookupTypeContainer function static,
4429 and not per-instance.
4431 * class.cs: Make static FindMembers (the one that takes a Type
4434 * codegen.cs: Add EmitForeach here.
4436 * cs-parser.jay: Make foreach a toplevel object instead of the
4437 inline expansion, as we need to perform semantic analysis on it.
4439 2001-10-05 Ravi Pratap <ravi@ximian.com>
4441 * expression.cs (Expression::ImplicitUserConversion): Rename to
4442 UserDefinedConversion.
4444 (Expression::UserDefinedConversion): Take an extra argument specifying
4445 whether we look for explicit user conversions too.
4447 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
4449 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
4451 (ExplicitUserConversion): Make it a call to UserDefinedConversion
4452 with the appropriate arguments.
4454 * cs-parser.jay (cast_expression): Record location too.
4456 * expression.cs (Cast): Record location info.
4458 (Expression::ConvertExplicit): Take location argument.
4460 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
4461 to determine if we are doing explicit conversions.
4463 (UserCast::Emit): Update accordingly.
4465 (Expression::ConvertExplicit): Report an error if everything fails.
4467 * ../errors/cs0030.cs : Add.
4469 2001-10-04 Miguel de Icaza <miguel@ximian.com>
4471 * modifiers.cs: If the ABSTRACT keyword is present, also set the
4472 virtual and newslot bits.
4474 * class.cs (TypeContainer::RegisterRequiredImplementations):
4475 Record methods we need.
4477 (TypeContainer::MakeKey): Helper function to make keys for
4478 MethodBases, since the Methodbase key is useless.
4480 (TypeContainer::Populate): Call RegisterRequiredImplementations
4481 before defining the methods.
4483 Create a mapping for method_builders_to_methods ahead of time
4484 instead of inside a tight loop.
4486 (::RequireMethods): Accept an object as the data to set into the
4487 hashtable so we can report interface vs abstract method mismatch.
4489 2001-10-03 Miguel de Icaza <miguel@ximian.com>
4491 * report.cs: Make all of it static.
4493 * rootcontext.cs: Drop object_type and value_type computations, as
4494 we have those in the TypeManager anyways.
4496 Drop report instance variable too, now it is a global.
4498 * driver.cs: Use try/catch on command line handling.
4500 Add --probe option to debug the error reporting system with a test
4503 * report.cs: Add support for exiting program when a probe
4504 condition is reached.
4506 2001-10-03 Ravi Pratap <ravi@ximian.com>
4508 * expression.cs (Binary::DoNumericPromotions): Fix the case when
4509 we do a forcible conversion regardless of type, to check if
4510 ForceConversion returns a null.
4512 (Binary::error19): Use location to report error.
4514 (Unary::error23): Use location here too.
4516 * ../errors/cs0019.cs : Check in.
4518 * ../errors/cs0023.cs : Check in.
4520 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
4521 case of a non-null MethodInfo object with a length of 0 !
4523 (Binary::ResolveOperator): Flag error if overload resolution fails to find
4524 an applicable member - according to the spec :-)
4525 Also fix logic to find members in base types.
4527 (Unary::ResolveOperator): Same here.
4529 (Unary::report23): Change name to error23 and make first argument a TypeContainer
4530 as I was getting thoroughly confused between this and error19 :-)
4532 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
4533 (::FindMostEncompassedType): Implement.
4534 (::FindMostEncompassingType): Implement.
4535 (::StandardConversionExists): Implement.
4537 (UserImplicitCast): Re-vamp. We now need info about most specific
4538 source and target types so that we can do the necessary conversions.
4540 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
4541 mathematical union with no duplicates.
4543 2001-10-03 Miguel de Icaza <miguel@ximian.com>
4545 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
4546 in order from base classes to child classes, so that we can in
4547 child classes look up in our parent for method names and
4548 attributes (required for handling abstract, virtual, new, override
4549 constructs: we need to instrospect our base class, and if we dont
4550 populate the classes in order, the introspection might be
4551 incorrect. For example, a method could query its parent before
4552 the parent has any methods and would determine that the parent has
4553 no abstract methods (while it could have had them)).
4555 (RootContext::CreateType): Record the order in which we define the
4558 2001-10-02 Miguel de Icaza <miguel@ximian.com>
4560 * class.cs (TypeContainer::Populate): Also method definitions can
4561 fail now, keep track of this.
4563 (TypeContainer::FindMembers): Implement support for
4564 DeclaredOnly/noDeclaredOnly flag.
4566 (Constructor::Emit) Return the ConstructorBuilder.
4568 (Method::Emit) Return the MethodBuilder.
4569 Check for abstract or virtual methods to be public.
4571 * rootcontext.cs (RootContext::CreateType): Register all the
4572 abstract methods required for the class to be complete and the
4573 interface methods that must be implemented.
4575 * cs-parser.jay: Report error 501 (method requires body if it is
4576 not marked abstract or extern).
4578 * expression.cs (TypeOf::Emit): Implement.
4580 * typemanager.cs: runtime_handle_type, new global type.
4582 * class.cs (Property::Emit): Generate code for properties.
4584 2001-10-02 Ravi Pratap <ravi@ximian.com>
4586 * expression.cs (Unary::ResolveOperator): Find operators on base type
4587 too - we now conform exactly to the spec.
4589 (Binary::ResolveOperator): Same here.
4591 * class.cs (Operator::Define): Fix minor quirk in the tests.
4593 * ../errors/cs0215.cs : Added.
4595 * ../errors/cs0556.cs : Added.
4597 * ../errors/cs0555.cs : Added.
4599 2001-10-01 Miguel de Icaza <miguel@ximian.com>
4601 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
4602 single integer which is really efficient
4604 2001-10-01 Ravi Pratap <ravi@ximian.com>
4606 * expression.cs (Expression::ImplicitUserConversion): Use location
4607 even in the case when we are examining True operators.
4609 * class.cs (Operator::Define): Perform extensive checks to conform
4610 with the rules for operator overloading in the spec.
4612 * expression.cs (Expression::ImplicitReferenceConversion): Implement
4613 some of the other conversions mentioned in the spec.
4615 * typemanager.cs (array_type): New static member for the System.Array built-in
4618 (cloneable_interface): For System.ICloneable interface.
4620 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
4621 we start resolving the tree and populating types.
4623 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
4625 2001-10-01 Miguel de Icaza <miguel@ximian.com>
4627 * expression.cs (Expression::ExprClassFromMemberInfo,
4628 Expression::Literalize): Create literal expressions from
4629 FieldInfos which are literals.
4631 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
4632 type casts, because they were wrong. The test suite in tests
4635 (ImplicitNumericConversion): ushort to ulong requires a widening
4638 Int32 constant to long requires widening cast as well.
4640 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
4641 for integers because the type on the stack is not i4.
4643 2001-09-30 Miguel de Icaza <miguel@ximian.com>
4645 * expression.cs (report118): require location argument.
4647 * parameter.cs: Do not dereference potential null value.
4649 * class.cs: Catch methods that lack the `new' keyword when
4650 overriding a name. Report warnings when `new' is used without
4651 anything being there to override.
4653 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
4655 * class.cs: Only add constructor to hashtable if it is non-null
4656 (as now constructors can fail on define).
4658 (TypeManager, Class, Struct): Take location arguments.
4660 Catch field instance initialization in structs as errors.
4662 accepting_filter: a new filter for FindMembers that is static so
4663 that we dont create an instance per invocation.
4665 (Constructor::Define): Catch errors where a struct constructor is
4668 * cs-parser.jay: Pass location information for various new
4671 * delegate.cs (Delegate): take a location argument.
4673 * driver.cs: Do not call EmitCode if there were problesm in the
4674 Definition of the types, as many Builders wont be there.
4676 * decl.cs (Decl::Decl): Require a location argument.
4678 * cs-tokenizer.cs: Handle properly hex constants that can not fit
4679 into integers, and find the most appropiate integer for it.
4681 * literal.cs: Implement ULongLiteral.
4683 * rootcontext.cs: Provide better information about the location of
4684 failure when CreateType fails.
4686 2001-09-29 Miguel de Icaza <miguel@ximian.com>
4688 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
4691 * expression.cs (Binary::CheckShiftArguments): Add missing type
4693 (Binary::ResolveOperator): Add type to the logical and and logical
4694 or, Bitwise And/Or and Exclusive Or code paths, it was missing
4697 (Binary::DoNumericPromotions): In the case where either argument
4698 is ulong (and most signed types combined with ulong cause an
4699 error) perform implicit integer constant conversions as well.
4701 2001-09-28 Miguel de Icaza <miguel@ximian.com>
4703 * expression.cs (UserImplicitCast): Method should always be
4705 (Invocation::BetterConversion): Simplified test for IntLiteral.
4707 (Expression::ImplicitNumericConversion): Split this routine out.
4708 Put the code that performs implicit constant integer conversions
4711 (Expression::Resolve): Become a wrapper around DoResolve so we can
4712 check eclass and type being set after resolve.
4714 (Invocation::Badness): Remove this dead function
4716 (Binary::ResolveOperator): Do not compute the expensive argumnets
4717 unless we have a union for it.
4719 (Probe::Emit): Is needs to do an isinst and then
4720 compare against null.
4722 (::CanConvert): Added Location argument. If the Location argument
4723 is null (Location.Null), then we do not report errors. This is
4724 used by the `probe' mechanism of the Explicit conversion. We do
4725 not want to generate an error for something that the user
4726 explicitly requested to be casted. But the pipeline for an
4727 explicit cast first tests for potential implicit casts.
4729 So for now, if the Location is null, it means `Probe only' to
4730 avoid adding another argument. Might have to revise this
4733 (ClassCast): New class used to type cast objects into arbitrary
4734 classes (used in Explicit Reference Conversions).
4736 Implement `as' as well.
4738 Reverted all the patches from Ravi below: they were broken:
4740 * The use of `level' as a mechanism to stop recursive
4741 invocations is wrong. That was there just to catch the
4742 bug with a strack trace but not as a way of addressing
4745 To fix the problem we have to *understand* what is going
4746 on and the interactions and come up with a plan, not
4747 just get things going.
4749 * The use of the type conversion cache that I proposed
4750 last night had an open topic: How does this work across
4751 protection domains. A user defined conversion might not
4752 be public in the location where we are applying the
4753 conversion, a different conversion might be selected
4754 (ie, private A->B (better) but public B->A (worse),
4755 inside A, A->B applies, but outside it, B->A will
4758 * On top of that (ie, even if the above is solved),
4759 conversions in a cache need to be abstract. Ie, `To
4760 convert from an Int to a Short use an OpcodeCast', not
4761 `To convert from an Int to a Short use the OpcodeCast on
4762 the variable 5' (which is what this patch was doing).
4764 2001-09-28 Ravi Pratap <ravi@ximian.com>
4766 * expression.cs (Invocation::ConversionExists): Re-write to use
4767 the conversion cache
4769 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
4770 cache all conversions done, not just user-defined ones.
4772 (Invocation::BetterConversion): The real culprit. Use ConversionExists
4773 to determine if a conversion exists instead of acutually trying to
4774 perform the conversion. It's faster too.
4776 (Expression::ConvertExplicit): Modify to use ConversionExists to check
4777 and only then attempt the implicit conversion.
4779 2001-09-28 Ravi Pratap <ravi@ximian.com>
4781 * expression.cs (ConvertImplicit): Use a cache for conversions
4782 already found. Check level of recursion and bail out if necessary.
4784 2001-09-28 Miguel de Icaza <miguel@ximian.com>
4786 * typemanager.cs (string_concat_string_string, string_concat_object_object):
4787 Export standard methods that we expect for string operations.
4789 * statement.cs (Block::UsageWarning): Track usage of variables and
4790 report the errors for not used variables.
4792 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
4795 2001-09-27 Miguel de Icaza <miguel@ximian.com>
4797 * codegen.cs: remove unnneded code
4799 * expression.cs: Removed BuiltinTypeAccess class
4801 Fix the order in which implicit conversions are
4804 The previous fixed dropped support for boxed conversions (adding a
4805 test to the test suite now)
4807 (UserImplicitCast::CanConvert): Remove test for source being null,
4808 that code is broken. We should not feed a null to begin with, if
4809 we do, then we should track the bug where the problem originates
4810 and not try to cover it up here.
4812 Return a resolved expression of type UserImplicitCast on success
4813 rather than true/false. Ravi: this is what I was talking about,
4814 the pattern is to use a static method as a "constructor" for
4817 Also, do not create arguments until the very last minute,
4818 otherwise we always create the arguments even for lookups that
4819 will never be performed.
4821 (UserImplicitCast::Resolve): Eliminate, objects of type
4822 UserImplicitCast are born in a fully resolved state.
4824 * typemanager.cs (InitCoreTypes): Init also value_type
4827 * expression.cs (Cast::Resolve): First resolve the child expression.
4829 (LValue): Add new method AddressOf to be used by
4832 Change the argument of Store to take an EmitContext instead of an
4833 ILGenerator, because things like FieldExpr need to be able to call
4834 their children expression to generate the instance code.
4836 (Expression::Error, Expression::Warning): Sugar functions for
4839 (Expression::MemberLookup): Accept a TypeContainer instead of a
4840 Report as the first argument.
4842 (Expression::ResolvePrimary): Killed. I still want to improve
4843 this as currently the code is just not right.
4845 (Expression::ResolveMemberAccess): Simplify, but it is still
4848 (Unary::Resolve): Catch errors in AddressOf operators.
4850 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
4851 index to a byte for the short-version, or the compiler will choose
4852 the wrong Emit call, which generates the wrong data.
4854 (ParameterReference::Emit, ::Store): same.
4856 (FieldExpr::AddressOf): Implement.
4858 * typemanager.cs: TypeManager: made public variable instead of
4861 * driver.cs: document --fatal.
4863 * report.cs (ErrorMessage, WarningMessage): new names for the old
4864 Error and Warning classes.
4866 * cs-parser.jay (member_access): Turn built-in access to types
4867 into a normal simplename
4869 2001-09-27 Ravi Pratap <ravi@ximian.com>
4871 * expression.cs (Invocation::BetterConversion): Fix to cope
4872 with q being null, since this was introducing a bug.
4874 * expression.cs (ConvertImplicit): Do built-in conversions first.
4876 2001-09-27 Ravi Pratap <ravi@ximian.com>
4878 * expression.cs (UserImplicitCast::Resolve): Fix bug.
4880 2001-09-27 Ravi Pratap <ravi@ximian.com>
4882 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
4883 I had introduced long ago (what's new ?).
4885 * expression.cs (UserImplicitCast::CanConvert): Static method to do
4886 the work of all the checking.
4887 (ConvertImplicit): Call CanConvert and only then create object if necessary.
4888 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
4890 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
4891 that is the right way.
4893 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
4894 overloading resolution. Use everywhere instead of cutting and pasting code.
4896 (Binary::ResolveOperator): Use MakeUnionSet.
4898 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
4899 we have to convert to bool types. Not complete yet.
4901 2001-09-27 Miguel de Icaza <miguel@ximian.com>
4903 * typemanager.cs (TypeManager::CSharpName): support ushort.
4905 * expression.cs (Expression::TryImplicitIntConversion): Attempts
4906 to provide an expression that performsn an implicit constant int
4907 conversion (section 6.1.6).
4908 (Expression::ConvertImplicitRequired): Reworked to include
4909 implicit constant expression conversions.
4911 (Expression::ConvertNumericExplicit): Finished.
4913 (Invocation::Emit): If InstanceExpression is null, then it means
4914 that we perform a call on this.
4916 2001-09-26 Miguel de Icaza <miguel@ximian.com>
4918 * expression.cs (Unary::Emit): Remove some dead code.
4919 (Probe): Implement Resolve and Emit for `is'.
4920 (Expression::ConvertImplicitRequired): Attempt to do constant
4921 expression conversions here. Maybe should be moved to
4922 ConvertImplicit, but I am not sure.
4923 (Expression::ImplicitLongConstantConversionPossible,
4924 Expression::ImplicitIntConstantConversionPossible): New functions
4925 that tell whether is it possible to apply an implicit constant
4926 expression conversion.
4928 (ConvertNumericExplicit): Started work on explicit numeric
4931 * cs-parser.jay: Update operator constants.
4933 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
4934 (Parameters::GetSignature): Hook up VerifyArgs here.
4935 (Parameters::VerifyArgs): Verifies that no two arguments have the
4938 * class.cs (Operator): Update the operator names to reflect the
4939 ones that the spec expects (as we are just stringizing the
4942 * expression.cs (Unary::ResolveOperator): Fix bug: Use
4943 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
4944 previous usage did only work for our methods.
4945 (Expression::ConvertImplicit): Handle decimal implicit numeric
4946 conversions as well.
4947 (Expression::InternalTypeConstructor): Used to invoke constructors
4948 on internal types for default promotions.
4950 (Unary::Emit): Implement special handling for the pre/post
4951 increment/decrement for overloaded operators, as they need to have
4952 the same semantics as the other operators.
4954 (Binary::ResolveOperator): ditto.
4955 (Invocation::ConversionExists): ditto.
4956 (UserImplicitCast::Resolve): ditto.
4958 2001-09-26 Ravi Pratap <ravi@ximian.com>
4960 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
4961 operator, return after emitting body. Regression tests pass again !
4963 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
4964 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
4965 (Invocation::OverloadResolve): Ditto.
4966 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
4968 * everywhere : update calls to the above methods accordingly.
4970 2001-09-26 Miguel de Icaza <miguel@ximian.com>
4972 * assign.cs (Assign): Make it inherit from ExpressionStatement.
4974 * expression.cs (ExpressionStatement): New base class used for
4975 expressions that can appear in statements, so that we can provide
4976 an alternate path to generate expression that do not leave a value
4979 (Expression::Emit, and all the derivatives): We no longer return
4980 whether a value is left on the stack or not. Every expression
4981 after being emitted leaves a single value on the stack.
4983 * codegen.cs (EmitContext::EmitStatementExpression): Use the
4984 facilties of ExpressionStatement if possible.
4986 * cs-parser.jay: Update statement_expression.
4988 2001-09-25 Miguel de Icaza <miguel@ximian.com>
4990 * driver.cs: Change the wording of message
4992 2001-09-25 Ravi Pratap <ravi@ximian.com>
4994 * expression.cs (Binary::ResolveOperator): Had forgottten to set
4995 the type of the expression to the return type of the method if
4996 we have an overloaded operator match ! The regression tests pass again !
4997 (Unary::ResolveOperator): Ditto.
4999 * expression.cs (Invocation::ConversionExists): Correct the member lookup
5000 to find "op_Implicit", not "implicit" ;-)
5001 (UserImplicitCast): New class to take care of user-defined implicit conversions.
5002 (ConvertImplicit, ForceConversion): Take TypeContainer argument
5004 * everywhere : Correct calls to the above accordingly.
5006 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
5007 (ConvertImplicit): Do user-defined conversion if it exists.
5009 2001-09-24 Miguel de Icaza <miguel@ximian.com>
5011 * assign.cs: track location.
5012 (Resolve): Use implicit conversions on assignment.
5014 * literal.cs: Oops. Not good, Emit of short access values should
5015 pass (Bytes) or the wrong argument will be selected.
5017 * expression.cs (Unary::Emit): Emit code for -expr.
5019 (Unary::ResolveOperator): Handle `Substract' for non-constants
5020 (substract from zero from the non-constants).
5021 Deal with Doubles as well.
5023 (Expression::ConvertImplicitRequired): New routine that reports an
5024 error if no implicit conversion exists.
5026 (Invocation::OverloadResolve): Store the converted implicit
5027 expressions if we make them
5029 2001-09-24 Ravi Pratap <ravi@ximian.com>
5031 * class.cs (ConstructorInitializer): Take a Location argument.
5032 (ConstructorBaseInitializer): Same here.
5033 (ConstructorThisInitializer): Same here.
5035 * cs-parser.jay : Update all calls accordingly.
5037 * expression.cs (Unary, Binary, New): Take location argument.
5038 Update accordingly everywhere.
5040 * cs-parser.jay : Update all calls to the above to take a location
5045 2001-09-24 Ravi Pratap <ravi@ximian.com>
5047 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
5048 (Invocation::BetterConversion): Same here
5049 (Invocation::ConversionExists): Ditto.
5051 (Invocation::ConversionExists): Implement.
5053 2001-09-22 Ravi Pratap <ravi@ximian.com>
5055 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
5056 Also take an additional TypeContainer argument.
5058 * All over : Pass in TypeContainer as argument to OverloadResolve.
5060 * typemanager.cs (CSharpName): Update to check for the string type and return
5063 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
5066 2001-09-21 Ravi Pratap <ravi@ximian.com>
5068 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
5069 (Invocation::BetterFunction): Implement.
5070 (Invocation::BetterConversion): Implement.
5071 (Invocation::ConversionExists): Skeleton, no implementation yet.
5073 Okay, things work fine !
5075 2001-09-21 Miguel de Icaza <miguel@ximian.com>
5077 * typemanager.cs: declare and load enum_type, delegate_type and
5080 * expression.cs (Expression::Emit): Now emit returns a value that
5081 tells whether a value is left on the stack or not. This strategy
5082 might be reveted tomorrow with a mechanism that would address
5083 multiple assignments.
5084 (Expression::report118): Utility routine to report mismatches on
5087 (Unary::Report23): Report impossible type/operator combination
5090 (Unary::IsIncrementableNumber): Whether the type can be
5091 incremented or decremented with add.
5092 (Unary::ResolveOperator): Also allow enumerations to be bitwise
5094 (Unary::ResolveOperator): Implement ++, !, ~,
5096 (Invocation::Emit): Deal with new Emit convetion.
5098 * All Expression derivatives: Updated their Emit method to return
5099 whether they leave values on the stack or not.
5101 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
5102 stack for expressions that are statements.
5104 2001-09-20 Miguel de Icaza <miguel@ximian.com>
5106 * expression.cs (LValue): New interface. Must be implemented by
5108 (LocalVariableReference, ParameterReference, FieldExpr): Implement
5111 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
5112 interface for generating code, simplifies the code.
5114 2001-09-20 Ravi Pratap <ravi@ximian.com>
5116 * expression.cs (everywhere): Comment out return statements in ::Resolve
5117 methods to avoid the warnings.
5119 2001-09-20 Miguel de Icaza <miguel@ximian.com>
5121 * driver.cs (parse): Report error 2001 if we can not open the
5124 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
5127 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
5130 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
5131 otherwise nested blocks end up with the same index.
5133 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
5135 * expression.cs: Instead of having FIXMEs in the Resolve
5136 functions, throw exceptions so it is obvious that we are facing a
5139 * cs-parser.jay (invocation_expression): Pass Location information.
5141 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
5142 Use a basename for those routines because .NET does not like paths
5145 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
5148 2001-09-19 Miguel de Icaza <miguel@ximian.com>
5150 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
5151 are loading the correct data types (throws an exception if not).
5152 (TypeManager::InitCoreTypes): Use CoreLookupType
5154 * expression.cs (Unary::ResolveOperator): return the child
5155 expression for expressions which are just +expr.
5156 (Unary::ResolveOperator): Return negative literals for -LITERAL
5157 expressions (otherwise they are Unary {Literal}).
5158 (Invocation::Badness): Take into account `Implicit constant
5159 expression conversions'.
5161 * literal.cs (LongLiteral): Implement long literal class.
5162 (IntLiteral): export the `Value' of the intliteral.
5164 2001-09-19 Ravi Pratap <ravi@ximian.com>
5166 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
5168 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
5169 instead of 'Operator'
5171 * expression.cs (Binary::ResolveOperator): Update accordingly.
5172 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
5175 * cs-parser.jay (unary_expression): Update to use the new names.
5177 * gen-treedump.cs (GetUnary): Same here.
5179 * expression.cs (Unary::Resolve): Implement.
5180 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
5181 operators are found instead of making noise ;-)
5182 (Unary::ResolveOperator): New method to do precisely the same thing which
5183 Binary::ResolveOperator does for Binary expressions.
5184 (Unary.method, .Arguments): Add.
5185 (Unary::OperName): Implement.
5186 (Unary::ForceConversion): Copy and Paste !
5188 * class.cs (Operator::Define): Fix a small bug for the case when we have
5191 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
5192 for the inbuilt operators. Only overloading works for now ;-)
5194 2001-09-18 Miguel de Icaza <miguel@ximian.com>
5196 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
5197 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
5199 * expression.cs (This::Emit): Implement.
5200 (This::Resolve): Implement.
5201 (TypeOf:Resolve): Implement.
5202 (Expression::ResolveSimpleName): Add an implicit this to instance
5204 (MemberAccess::Resolve): Deal with Parameters and Fields.
5205 Bind instance variable to Field expressions.
5206 (FieldExpr::Instance): New field used to track the expression that
5207 represents the object instance.
5208 (FieldExpr::Resolve): Track potential errors from MemberLookup not
5210 (FieldExpr::Emit): Implement.
5212 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
5213 the last instruction contains a return opcode to avoid generating
5214 the last `ret' instruction (this generates correct code, and it is
5215 nice to pass the peverify output).
5217 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
5218 initializer for static and instance variables.
5219 (Constructor::Emit): Allow initializer to be null in the case of
5220 static constructors. Only emit initializer for instance
5223 (TypeContainer::FindMembers): Return a null array if there are no
5226 Also fix the code for the MemberTypes.Method branch, as it was not
5227 scanning that for operators (or tried to access null variables before).
5229 * assign.cs (Assign::Emit): Handle instance and static fields.
5233 * driver.cs: Stop compilation if there are parse errors.
5235 * cs-parser.jay (constructor_declaration): Provide default base
5236 initializer for non-static constructors.
5237 (constructor_declarator): Do not provide a default base
5238 initializers if none was specified.
5239 Catch the fact that constructors should not have parameters.
5241 * class.cs: Do not emit parent class initializers for static
5242 constructors, that should be flagged as an error.
5244 2001-09-18 Ravi Pratap <ravi@ximian.com>
5246 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
5247 Move back code into TypeContainer::Populate.
5249 2001-09-18 Ravi Pratap <ravi@ximian.com>
5251 * class.cs (TypeContainer::AddConstructor): Fix the check to
5252 compare against Name, not Basename.
5253 (Operator::OpType): Change Plus and Minus to Add and Subtract.
5255 * cs-parser.jay : Update accordingly.
5257 * class.cs (TypeContainer::FindMembers): For the case where we are searching
5258 for methods, don't forget to look into the operators too.
5259 (RegisterMethodBuilder): Helper method to take care of this for
5260 methods, constructors and operators.
5261 (Operator::Define): Completely revamp.
5262 (Operator.OperatorMethod, MethodName): New fields.
5263 (TypeContainer::Populate): Move the registering of builders into
5264 RegisterMethodBuilder.
5265 (Operator::Emit): Re-write.
5267 * expression.cs (Binary::Emit): Comment out code path to emit method
5268 invocation stuff for the case when we have a user defined operator. I am
5269 just not able to get it right !
5271 2001-09-17 Miguel de Icaza <miguel@ximian.com>
5273 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
5276 (Expression::MemberLookup): Provide a version that allows to
5277 specify the MemberTypes and BindingFlags.
5279 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
5280 so it was not fetching variable information from outer blocks.
5282 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
5283 Beforefieldinit as it was buggy.
5285 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
5288 * class.cs (Constructor::Emit): Only emit if block is not null.
5289 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
5290 deal with this by semantically definining it as if the user had
5293 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
5294 constructors as we now "emit" them at a higher level.
5296 (TypeContainer::DefineDefaultConstructor): Used to define the
5297 default constructors if none was provided.
5299 (ConstructorInitializer): Add methods Resolve and Emit.
5301 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
5303 2001-09-17 Ravi Pratap <ravi@ximian.com>
5305 * class.cs (TypeContainer::EmitDefaultConstructor): Register
5306 the default constructor builder with our hashtable for methodbuilders
5309 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
5310 and argument_count is 0 in which case we have a match.
5311 (Binary::ResolveOperator): More null checking and miscellaneous coding
5314 2001-09-17 Ravi Pratap <ravi@ximian.com>
5316 * rootcontext.cs (IsNameSpace): Compare against null.
5318 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
5320 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
5321 and Unary::Operator.
5323 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
5326 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
5327 we have overloaded operators.
5328 (Binary::ResolveOperator): Implement the part which does the operator overload
5331 * class.cs (Operator::Emit): Implement.
5332 (TypeContainer::Emit): Emit the operators we have too.
5334 * expression.cs (Binary::Emit): Update to emit the appropriate code for
5335 the case when we have a user-defined operator.
5337 2001-09-17 Miguel de Icaza <miguel@ximian.com>
5339 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
5341 2001-09-16 Ravi Pratap <ravi@ximian.com>
5343 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
5344 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
5345 (Constructor::Emit): Implement.
5346 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
5347 if we have no work to do.
5348 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
5351 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
5352 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
5354 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
5357 2001-09-15 Ravi Pratap <ravi@ximian.com>
5359 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
5361 (Tree::RecordNamespace): Method to do what the name says ;-)
5362 (Tree::Namespaces): Property to get at the namespaces hashtable.
5364 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
5367 * rootcontext.cs (IsNamespace): Fixed it :-)
5369 2001-09-14 Miguel de Icaza <miguel@ximian.com>
5371 * class.cs (TypeContainer::FindMembers): Add support for
5373 (MethodCore): New class that encapsulates both the shared aspects
5374 of a Constructor and a Method.
5375 (Method, Constructor): Factored pieces into MethodCore.
5377 * driver.cs: Added --fatal which makes errors throw exceptions.
5378 Load System assembly as well as part of the standard library.
5380 * report.cs: Allow throwing exceptions on errors for debugging.
5382 * modifiers.cs: Do not use `parent', instead use the real type
5383 container to evaluate permission settings.
5385 * class.cs: Put Ravi's patch back in. He is right, and we will
5386 have to cope with the
5388 2001-09-14 Ravi Pratap <ravi@ximian.com>
5390 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
5391 FamORAssem, not FamANDAssem.
5393 2001-09-14 Miguel de Icaza <miguel@ximian.com>
5395 * driver.cs: Added --parse option that only parses its input files
5398 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
5399 incorrect. IsTopLevel is not used to tell whether an object is
5400 root_types or not (that can be achieved by testing this ==
5401 root_types). But to see if this is a top-level *class* (not
5402 necessarly our "toplevel" container).
5404 2001-09-14 Ravi Pratap <ravi@ximian.com>
5406 * enum.cs (Enum::Define): Modify to call the Lookup method on the
5407 parent instead of a direct call to GetType.
5409 2001-09-14 Ravi Pratap <ravi@ximian.com>
5411 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
5412 Modifiers.TypeAttr. This should just be a call to that method.
5414 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
5415 object so that we can determine if we are top-level or not.
5417 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
5420 * enum.cs (Enum::Define): Ditto.
5422 * modifiers.cs (FieldAttr): Re-write.
5424 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
5425 (TypeContainer::HaveStaticConstructor): New property to provide access
5426 to precisely that info.
5428 * modifiers.cs (MethodAttr): Re-write.
5429 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
5431 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
5432 of top-level types as claimed.
5434 2001-09-13 Miguel de Icaza <miguel@ximian.com>
5436 * expression.cs (MemberLookup): Fruitless attempt to lookup
5437 constructors. Maybe I need to emit default constructors? That
5438 might be it (currently .NET emits this for me automatically).
5439 (Invocation::OverloadResolve): Cope with Arguments == null.
5440 (Invocation::EmitArguments): new function, shared by the new
5442 (Invocation::Emit): Handle static and instance methods. Emit
5443 proper call instruction for virtual or non-virtual invocations.
5444 (New::Emit): Implement.
5445 (New::Resolve): Implement.
5446 (MemberAccess:Resolve): Implement.
5447 (MethodGroupExpr::InstanceExpression): used conforming to the spec
5449 (FieldExpr::Resolve): Set type.
5451 * support.cs: Handle empty arguments.
5453 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
5454 SimpleLookup): Auxiliary routines to help parse a qualifier
5457 Update qualifier_identifier rule.
5459 * codegen.cs: Removed debugging messages.
5461 * class.cs: Make this a global thing, this acts just as a "key" to
5462 objects that we might have around.
5464 (Populate): Only initialize method_builders_to_methods once.
5466 * expression.cs (PropertyExpr): Initialize type from the
5469 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
5470 Resolve pattern. Attempt to implicitly convert value to boolean.
5473 * expression.cs: Set the type for the int32/int32 argument case.
5474 (Binary::ResolveOperator): Set the return type to boolean for
5475 comparission operators
5477 * typemanager.cs: Remove debugging print code.
5479 (Invocation::Resolve): resolve type.
5481 * class.cs: Allocate a MemberInfo of the correct size, as the code
5482 elsewhere depends on the test to reflect the correct contents.
5484 (Method::) Keep track of parameters, due to System.Reflection holes
5486 (TypeContainer::Populate): Keep track of MethodBuilders to Method
5489 (TypeContainer::FindMembers): Use ArrayList and then copy an array
5490 of the exact size and return that.
5492 (Class::LookupMethodByBuilder): New function that maps
5493 MethodBuilders to its methods. Required to locate the information
5494 on methods because System.Reflection bit us again.
5496 * support.cs: New file, contains an interface ParameterData and
5497 two implementations: ReflectionParameters and InternalParameters
5498 used to access Parameter information. We will need to grow this
5501 * expression.cs (Invocation::GetParameterData): implement a cache
5502 and a wrapper around the ParameterData creation for methods.
5503 (Invocation::OverloadResolve): Use new code.
5505 2001-09-13 Ravi Pratap <ravi@ximian.com>
5507 * class.cs (TypeContainer::EmitField): Remove and move into
5508 (Field::Define): here and modify accordingly.
5509 (Field.FieldBuilder): New member.
5510 (TypeContainer::Populate): Update accordingly.
5511 (TypeContainer::FindMembers): Implement.
5513 2001-09-13 Miguel de Icaza <miguel@ximian.com>
5515 * statement.cs: (VariableInfo::VariableType): New field to be
5516 initialized with the full type once it is resolved.
5518 2001-09-12 Miguel de Icaza <miguel@ximian.com>
5520 * parameter.cs (GetParameterInfo): Use a type cache to compute
5521 things only once, and to reuse this information
5523 * expression.cs (LocalVariableReference::Emit): Implement.
5524 (OpcodeCast::Emit): fix.
5526 (ParameterReference::Resolve): Implement.
5527 (ParameterReference::Emit): Implement.
5529 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
5530 that are expressions need to stay as Expressions.
5532 * typemanager.cs (CSharpName): Returns the C# name of a type if
5535 * expression.cs (Expression::ConvertImplicit): New function that
5536 implements implicit type conversions.
5538 (Expression::ImplicitReferenceConversion): Implements implicit
5539 reference conversions.
5541 (EmptyCast): New type for transparent casts.
5543 (OpcodeCast): New type for casts of types that are performed with
5544 a sequence of bytecodes.
5546 (BoxedCast): New type used for casting value types into reference
5547 types. Emits a box opcode.
5549 (Binary::DoNumericPromotions): Implements numeric promotions of
5550 and computation of the Binary::Type.
5552 (Binary::EmitBranchable): Optimization.
5554 (Binary::Emit): Implement code emission for expressions.
5556 * typemanager.cs (TypeManager): Added two new core types: sbyte
5559 2001-09-12 Ravi Pratap <ravi@ximian.com>
5561 * class.cs (TypeContainer::FindMembers): Method which does exactly
5562 what Type.FindMembers does, only we don't have to use reflection. No
5565 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
5566 typecontainer objects as we need to get at them.
5567 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
5569 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
5570 typecontainer object.
5572 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
5573 of just a Report object.
5575 2001-09-11 Ravi Pratap <ravi@ximian.com>
5577 * class.cs (Event::Define): Go back to using the prefixes "add_" and
5579 (TypeContainer::Populate): Now define the delegates of the type too.
5580 (TypeContainer.Delegates): Property to access the list of delegates defined
5583 * delegates.cs (Delegate::Define): Implement partially.
5585 * modifiers.cs (TypeAttr): Handle more flags.
5587 2001-09-11 Ravi Pratap <ravi@ximian.com>
5589 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
5591 (Operator::Define): Re-write logic to get types by using the LookupType method
5592 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
5593 (Indexer::Define): Ditto.
5594 (Event::Define): Ditto.
5595 (Property::Define): Ditto.
5597 2001-09-10 Ravi Pratap <ravi@ximian.com>
5599 * class.cs (TypeContainer::Populate): Now define operators too.
5600 (TypeContainer.Operators): New property to access the list of operators
5602 (Operator.OperatorMethodBuilder): New member to hold the method builder
5603 for the operator we are defining.
5604 (Operator::Define): Implement.
5606 2001-09-10 Ravi Pratap <ravi@ximian.com>
5608 * class.cs (Event::Define): Make the prefixes of the accessor methods
5609 addOn_ and removeOn_
5611 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
5612 of the location being passed in too. Ideally, this should go later since all
5613 error reporting should be done through the Report object.
5615 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
5616 (Populate): Iterate thru the indexers we have and define them too.
5617 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
5618 for the get and set accessors.
5619 (Indexer::Define): Implement.
5621 2001-09-09 Miguel de Icaza <miguel@ximian.com>
5623 * expression.cs (Binary::Resolve): Beginning of it. I scratched
5624 my previous implementation, did not work.
5626 * typemanager.cs: Add a couple of missing types (the longs).
5628 * literal.cs: Use TypeManager.bool_type instead of getting it.
5630 * expression.cs (EventExpr): New kind of expressions.
5631 (Expressio::ExprClassFromMemberInfo): finish
5633 2001-09-08 Miguel de Icaza <miguel@ximian.com>
5635 * assign.cs: Emit stores to static fields differently.
5637 2001-09-08 Ravi Pratap <ravi@ximian.com>
5639 * Merge in changes and adjust code to tackle conflicts. Backed out my
5640 code in Assign::Resolve ;-)
5642 2001-09-08 Ravi Pratap <ravi@ximian.com>
5644 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
5645 instead Report.Error and also pass in the location.
5646 (CSharpParser::Lexer): New readonly property to return the reference
5647 to the Tokenizer object.
5648 (declare_local_variables): Use Report.Error with location instead of plain
5652 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
5653 (Operator.CheckBinaryOperator): Ditto.
5655 * cs-parser.jay (operator_declarator): Update accordingly.
5657 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
5658 (CheckBinaryOperator): Same here.
5660 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
5661 on the name without any prefixes of namespace names etc. This is because we
5662 already might have something already fully qualified like
5663 'System.Console.WriteLine'
5665 * assign.cs (Resolve): Begin implementation. Stuck ;-)
5667 2001-09-07 Ravi Pratap <ravi@ximian.com>
5669 * cs-tokenizer.cs (location): Return a string which also contains
5672 * expression.cs (ElementAccess): New class for expressions of the
5673 type 'element access.'
5674 (BaseAccess): New class for expressions of the type 'base access.'
5675 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
5678 * cs-parser.jay (element_access): Implement action.
5679 (base_access): Implement actions.
5680 (checked_expression, unchecked_expression): Implement.
5682 * cs-parser.jay (local_variable_type): Correct and implement.
5683 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
5685 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
5687 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
5688 name and the specifiers.
5690 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
5692 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
5693 making them all public ;-)
5695 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
5698 2001-09-07 Miguel de Icaza <miguel@ximian.com>
5700 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
5702 (FieldExpr, PropertyExprs): New resolved expressions.
5703 (SimpleName::MemberStaticCheck): Perform static checks for access
5704 to non-static fields on static methods. Maybe this should be
5705 generalized for MemberAccesses.
5706 (SimpleName::ResolveSimpleName): More work on simple name
5709 * cs-parser.jay (primary_expression/qualified_identifier): track
5710 the parameter index.
5712 * codegen.cs (CodeGen::Save): Catch save exception, report error.
5713 (EmitContext::EmitBoolExpression): Chain to expression generation
5714 instead of temporary hack.
5715 (::EmitStatementExpression): Put generic expression code generation.
5717 * assign.cs (Assign::Emit): Implement variable assignments to
5718 local variables, parameters and fields.
5720 2001-09-06 Miguel de Icaza <miguel@ximian.com>
5722 * statement.cs (Block::GetVariableInfo): New method, returns the
5723 VariableInfo for a variable name in a block.
5724 (Block::GetVariableType): Implement in terms of GetVariableInfo
5726 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
5727 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
5729 2001-09-06 Ravi Pratap <ravi@ximian.com>
5731 * cs-parser.jay (operator_declaration): Continue on my quest : update
5732 to take attributes argument.
5733 (event_declaration): Ditto.
5734 (enum_declaration): Ditto.
5735 (indexer_declaration): Ditto.
5737 * class.cs (Operator::Operator): Update constructor accordingly.
5738 (Event::Event): Ditto.
5740 * delegate.cs (Delegate::Delegate): Same here.
5742 * enum.cs (Enum::Enum): Same here.
5744 2001-09-05 Ravi Pratap <ravi@ximian.com>
5746 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
5748 * ../tests/cs0658.cs : New file to demonstrate error 0658.
5750 * attribute.cs (Attributes): New class to encapsulate all attributes which were
5751 being passed around as an arraylist.
5752 (Attributes::AddAttribute): Method to add attribute sections.
5754 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
5755 (struct_declaration): Update accordingly.
5756 (constant_declaration): Update.
5757 (field_declaration): Update.
5758 (method_header): Update.
5759 (fixed_parameter): Update.
5760 (parameter_array): Ditto.
5761 (property_declaration): Ditto.
5762 (destructor_declaration): Ditto.
5764 * class.cs (Struct::Struct): Update constructors accordingly.
5765 (Class::Class): Ditto.
5766 (Field::Field): Ditto.
5767 (Method::Method): Ditto.
5768 (Property::Property): Ditto.
5769 (TypeContainer::OptAttribute): update property's return type.
5771 * interface.cs (Interface.opt_attributes): New member.
5772 (Interface::Interface): Update to take the extra Attributes argument.
5774 * parameter.cs (Parameter::Parameter): Ditto.
5776 * constant.cs (Constant::Constant): Ditto.
5778 * interface.cs (InterfaceMemberBase): New OptAttributes field.
5779 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
5780 the attributes as a parameter.
5781 (InterfaceProperty): Update constructor call.
5782 (InterfaceEvent): Ditto.
5783 (InterfaceMethod): Ditto.
5784 (InterfaceIndexer): Ditto.
5786 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
5787 pass the attributes too.
5788 (interface_event_declaration): Ditto.
5789 (interface_property_declaration): Ditto.
5790 (interface_method_declaration): Ditto.
5791 (interface_declaration): Ditto.
5793 2001-09-05 Miguel de Icaza <miguel@ximian.com>
5795 * class.cs (Method::Define): Track the "static Main" definition to
5796 create an entry point.
5798 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
5799 EntryPoint if we find it.
5801 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
5802 (EmitContext::ig): Make this variable public.
5804 * driver.cs: Make the default output file be the first file name
5805 with the .exe extension.
5807 Detect empty compilations
5809 Handle various kinds of output targets. Handle --target and
5810 rename -t to --dumper.
5812 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
5813 methods inherited from Expression return now an Expression. This
5814 will is used during the tree rewriting as we resolve them during
5817 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
5818 the spec. Missing entirely is the information about
5819 accessability of elements of it.
5821 (Expression::ExprClassFromMemberInfo): New constructor for
5822 Expressions that creates a fully initialized Expression based on
5823 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
5826 (Invocation::Resolve): Begin implementing resolution of invocations.
5828 * literal.cs (StringLiteral): Implement Emit.
5830 2001-09-05 Ravi Pratap <ravi@ximian.com>
5832 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
5835 2001-09-04 Ravi Pratap <ravi@ximian.com>
5837 * cs-parser.jay (attribute_arguments): Implement actions.
5838 (attribute): Fix bug in production. Implement action.
5839 (attribute_list): Implement.
5840 (attribute_target): Implement.
5841 (attribute_target_specifier, opt_target_specifier): Implement
5842 (CheckAttributeTarget): New method to check if the attribute target
5844 (attribute_section): Implement.
5845 (opt_attributes): Implement.
5847 * attribute.cs : New file to handle attributes.
5848 (Attribute): Class to hold attribute info.
5850 * cs-parser.jay (opt_attribute_target_specifier): Remove production
5851 (attribute_section): Modify production to use 2 different rules to
5852 achieve the same thing. 1 s/r conflict down !
5853 Clean out commented, useless, non-reducing dimension_separator rules.
5855 * class.cs (TypeContainer.attributes): New member to hold list
5856 of attributes for a type.
5857 (Struct::Struct): Modify to take one more argument, the attribute list.
5858 (Class::Class): Ditto.
5859 (Field::Field): Ditto.
5860 (Method::Method): Ditto.
5861 (Property::Property): Ditto.
5863 * cs-parser.jay (struct_declaration): Update constructor call to
5864 pass in the attributes too.
5865 (class_declaration): Ditto.
5866 (constant_declaration): Ditto.
5867 (field_declaration): Ditto.
5868 (method_header): Ditto.
5869 (fixed_parameter): Ditto.
5870 (parameter_array): Ditto.
5871 (property_declaration): Ditto.
5873 * constant.cs (Constant::Constant): Update constructor similarly.
5874 Use System.Collections.
5876 * parameter.cs (Parameter::Parameter): Update as above.
5878 2001-09-02 Ravi Pratap <ravi@ximian.com>
5880 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
5881 (TypeContainer.delegates): New member to hold list of delegates.
5883 * cs-parser.jay (delegate_declaration): Implement the action correctly
5884 this time as I seem to be on crack ;-)
5886 2001-09-02 Miguel de Icaza <miguel@ximian.com>
5888 * rootcontext.cs (RootContext::IsNamespace): new function, used to
5889 tell whether an identifier represents a namespace.
5891 * expression.cs (NamespaceExpr): A namespace expression, used only
5892 temporarly during expression resolution.
5893 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
5894 utility functions to resolve names on expressions.
5896 2001-09-01 Miguel de Icaza <miguel@ximian.com>
5898 * codegen.cs: Add hook for StatementExpressions.
5900 * class.cs: Fix inverted test for static flag in methods.
5902 2001-09-02 Ravi Pratap <ravi@ximian.com>
5904 * class.cs (Operator::CheckUnaryOperator): Correct error number used
5905 to make it coincide with MS' number.
5906 (Operator::CheckBinaryOperator): Ditto.
5908 * ../errors/errors.txt : Remove error numbers added earlier.
5910 * ../errors/cs1019.cs : Test case for error # 1019
5912 * ../errros/cs1020.cs : Test case for error # 1020
5914 * cs-parser.jay : Clean out commented cruft.
5915 (dimension_separators, dimension_separator): Comment out. Ostensibly not
5916 used anywhere - non-reducing rule.
5917 (namespace_declarations): Non-reducing rule - comment out.
5919 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
5920 with TypeContainer::AddEnum.
5922 * delegate.cs : New file for delegate handling classes.
5923 (Delegate): Class for declaring delegates.
5925 * makefile : Update.
5927 * cs-parser.jay (delegate_declaration): Implement.
5929 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
5931 * class.cs (Event::Define): Implement.
5932 (Event.EventBuilder): New member.
5934 * class.cs (TypeContainer::Populate): Update to define all enums and events
5936 (Events): New property for the events arraylist we hold. Shouldn't we move to using
5937 readonly fields for all these cases ?
5939 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
5941 * class.cs (Property): Revamp to use the convention of making fields readonly.
5942 Accordingly modify code elsewhere.
5944 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
5945 the Define method of the Property class.
5947 * class.cs : Clean up applied patch and update references to variables etc. Fix
5949 (TypeContainer::Populate): Update to define all the properties we have. Also
5950 define all enumerations.
5952 * enum.cs (Define): Implement.
5954 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
5956 * cs-parser.jay (overloadable_operator): The semantic value is an
5957 enum of the Operator class.
5958 (operator_declarator): Implement actions.
5959 (operator_declaration): Implement.
5961 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
5962 validity of definitions.
5963 (Operator::CheckBinaryOperator): Static method to check for binary operators
5964 (TypeContainer::AddOperator): New method to add an operator to a type.
5966 * cs-parser.jay (indexer_declaration): Added line to actually call the
5967 AddIndexer method so it gets added ;-)
5969 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
5970 already taken care of by the MS compiler ?
5972 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
5974 * class.cs (Operator): New class for operator declarations.
5975 (Operator::OpType): Enum for the various operators.
5977 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
5979 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
5980 ostensibly handle this in semantic analysis.
5982 * cs-parser.jay (general_catch_clause): Comment out
5983 (specific_catch_clauses, specific_catch_clause): Ditto.
5984 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
5985 (catch_args, opt_catch_args): New productions.
5986 (catch_clause): Rewrite to use the new productions above
5987 (catch_clauses): Modify accordingly.
5988 (opt_catch_clauses): New production to use in try_statement
5989 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
5990 and re-write the code in the actions to extract the specific and
5991 general catch clauses by being a little smart ;-)
5993 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
5994 Hooray, try and catch statements parse fine !
5996 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
5998 * statement.cs (Block::GetVariableType): Fix logic to extract the type
5999 string from the hashtable of variables.
6001 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
6002 I end up making that mistake ;-)
6003 (catch_clauses): Fixed gross error which made Key and Value of the
6004 DictionaryEntry the same : $1 !!
6006 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
6008 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
6010 * cs-parser.jay (event_declaration): Correct to remove the semicolon
6011 when the add and remove accessors are specified.
6013 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
6015 * cs-parser.jay (IndexerDeclaration): New helper class to hold
6016 information about indexer_declarator.
6017 (indexer_declarator): Implement actions.
6018 (parsing_indexer): New local boolean used to keep track of whether
6019 we are parsing indexers or properties. This is necessary because
6020 implicit_parameters come into picture even for the get accessor in the
6022 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
6024 * class.cs (Indexer): New class for indexer declarations.
6025 (TypeContainer::AddIndexer): New method to add an indexer to a type.
6026 (TypeContainer::indexers): New member to hold list of indexers for the
6029 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
6031 * cs-parser.jay (add_accessor_declaration): Implement action.
6032 (remove_accessor_declaration): Implement action.
6033 (event_accessors_declaration): Implement
6034 (variable_declarators): swap statements for first rule - trivial.
6036 * class.cs (Event): New class to hold information about event
6038 (TypeContainer::AddEvent): New method to add an event to a type
6039 (TypeContainer::events): New member to hold list of events.
6041 * cs-parser.jay (event_declaration): Implement actions.
6043 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
6045 * cs-parser.jay (dim_separators): Implement. Make it a string
6046 concatenating all the commas together, just as they appear.
6047 (opt_dim_separators): Modify accordingly
6048 (rank_specifiers): Update accordingly. Basically do the same
6049 thing - instead, collect the brackets here.
6050 (opt_rank_sepcifiers): Modify accordingly.
6051 (array_type): Modify to actually return the complete type string
6052 instead of ignoring the rank_specifiers.
6053 (expression_list): Implement to collect the expressions
6054 (variable_initializer): Implement. We make it a list of expressions
6055 essentially so that we can handle the array_initializer case neatly too.
6056 (variable_initializer_list): Implement.
6057 (array_initializer): Make it a list of variable_initializers
6058 (opt_array_initializer): Modify accordingly.
6060 * expression.cs (New::NType): Add enumeration to help us
6061 keep track of whether we have an object/delegate creation
6062 or an array creation.
6063 (New:NewType, New::Rank, New::Indices, New::Initializers): New
6064 members to hold data about array creation.
6065 (New:New): Modify to update NewType
6066 (New:New): New Overloaded contructor for the array creation
6069 * cs-parser.jay (array_creation_expression): Implement to call
6070 the overloaded New constructor.
6072 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
6074 * class.cs (TypeContainer::Constructors): Return member
6075 constructors instead of returning null.
6077 2001-08-26 Miguel de Icaza <miguel@ximian.com>
6079 * typemanager.cs (InitCoreTypes): Initialize the various core
6080 types after we have populated the type manager with the user
6081 defined types (this distinction will be important later while
6082 compiling corlib.dll)
6084 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
6085 on Expression Classification. Now all expressions have a method
6086 `Resolve' and a method `Emit'.
6088 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
6089 generation from working. Also add some temporary debugging
6092 2001-08-24 Miguel de Icaza <miguel@ximian.com>
6094 * codegen.cs: Lots of code generation pieces. This is only the
6095 beginning, will continue tomorrow with more touches of polish. We
6096 handle the fundamentals of if, while, do, for, return. Others are
6097 trickier and I need to start working on invocations soon.
6099 * gen-treedump.cs: Bug fix, use s.Increment here instead of
6102 * codegen.cs (EmitContext): New struct, used during code
6103 emission to keep a context. Most of the code generation will be
6106 * cs-parser.jay: Add embedded blocks to the list of statements of
6107 this block. So code generation proceeds in a top down fashion.
6109 2001-08-23 Miguel de Icaza <miguel@ximian.com>
6111 * statement.cs: Add support for multiple child blocks.
6113 2001-08-22 Miguel de Icaza <miguel@ximian.com>
6115 * codegen.cs (EmitCode): New function, will emit the code for a
6116 Block of code given a TypeContainer and its ILGenerator.
6118 * statement.cs (Block): Standard public readonly optimization.
6119 (Block::Block constructors): Link children.
6120 (Block::Child): Child Linker.
6121 (Block::EmitVariables): Emits IL variable declarations.
6123 * class.cs: Drop support for MethodGroups here, delay until
6125 (Method::): Applied the same simplification that I did before, and
6126 move from Properties to public readonly fields.
6127 (Method::ParameterTypes): Returns the parameter types for the
6128 function, and implements a cache that will be useful later when I
6129 do error checking and the semantic analysis on the methods is
6131 (Constructor::GetCallingConvention): Renamed from CallingConvetion
6132 and made a method, optional argument tells whether this is a class
6133 or a structure to apply the `has-this' bit.
6134 (Method::GetCallingConvention): Implement, returns the calling
6136 (Method::Define): Defines the type, a second pass is performed
6137 later to populate the methods.
6139 (Constructor::ParameterTypes): implement a cache similar to the
6140 one on Method::ParameterTypes, useful later when we do semantic
6143 (TypeContainer::EmitMethod): New method. Emits methods.
6145 * expression.cs: Removed MethodGroup class from here.
6147 * parameter.cs (Parameters::GetCallingConvention): new method.
6149 2001-08-21 Miguel de Icaza <miguel@ximian.com>
6151 * class.cs (TypeContainer::Populate): Drop RootContext from the
6154 (Constructor::CallingConvention): Returns the calling convention.
6155 (Constructor::ParameterTypes): Returns the constructor parameter
6158 (TypeContainer::AddConstructor): Keep track of default constructor
6159 and the default static constructor.
6161 (Constructor::) Another class that starts using `public readonly'
6162 instead of properties.
6164 (Constructor::IsDefault): Whether this is a default constructor.
6166 (Field::) use readonly public fields instead of properties also.
6168 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
6169 track of static constructors; If none is used, turn on
6170 BeforeFieldInit in the TypeAttributes.
6172 * cs-parser.jay (opt_argument_list): now the return can be null
6173 for the cases where there are no arguments.
6175 (constructor_declarator): If there is no implicit `base' or
6176 `this', then invoke the default parent constructor.
6178 * modifiers.cs (MethodAttr): New static function maps a set of
6179 modifiers flags into a MethodAttributes enum
6180 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
6181 MethodAttr, TypeAttr to represent the various mappings where the
6183 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
6185 2001-08-19 Miguel de Icaza <miguel@ximian.com>
6187 * parameter.cs (GetParameterInfo): Fix bug where there would be no
6190 * interface.cs (PopulateIndexer): Implemented the code generator
6191 for interface indexers.
6193 2001-08-17 Miguel de Icaza <miguel@ximian.com>
6195 * interface.cs (InterfaceMemberBase): Now we track the new status
6198 (PopulateProperty): Implement property population. Woohoo! Got
6199 Methods and Properties going today.
6201 Removed all the properties for interfaces, and replaced them with
6202 `public readonly' fields.
6204 2001-08-16 Miguel de Icaza <miguel@ximian.com>
6206 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
6207 initialize their hashtables/arraylists only when they are needed
6208 instead of doing this always.
6210 * parameter.cs: Handle refs and out parameters.
6212 * cs-parser.jay: Use an ArrayList to construct the arguments
6213 instead of the ParameterCollection, and then cast that to a
6216 * parameter.cs: Drop the use of ParameterCollection and use
6217 instead arrays of Parameters.
6219 (GetParameterInfo): Use the Type, not the Name when resolving
6222 2001-08-13 Miguel de Icaza <miguel@ximian.com>
6224 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
6225 and instead use public readonly fields.
6227 * class.cs: Put back walking code for type containers.
6229 2001-08-11 Miguel de Icaza <miguel@ximian.com>
6231 * class.cs (MakeConstant): Code to define constants.
6233 * rootcontext.cs (LookupType): New function. Used to locate types
6236 2001-08-08 Miguel de Icaza <miguel@ximian.com>
6238 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
6239 this System.Reflection code is. Kudos to Microsoft
6241 * typemanager.cs: Implement a type cache and avoid loading all
6242 types at boot time. Wrap in LookupType the internals. This made
6243 the compiler so much faster. Wow. I rule!
6245 * driver.cs: Make sure we always load mscorlib first (for
6246 debugging purposes, nothing really important).
6248 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
6249 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
6251 * rootcontext.cs: Lookup types on their namespace; Lookup types
6252 on namespaces that have been imported using the `using' keyword.
6254 * class.cs (TypeContainer::TypeAttr): Virtualize.
6255 (Class::TypeAttr): Return attributes suitable for this bad boy.
6256 (Struct::TypeAttr): ditto.
6257 Handle nested classes.
6258 (TypeContainer::) Remove all the type visiting code, it is now
6259 replaced with the rootcontext.cs code
6261 * rootcontext.cs (GetClassBases): Added support for structs.
6263 2001-08-06 Miguel de Icaza <miguel@ximian.com>
6265 * interface.cs, statement.cs, class.cs, parameter.cs,
6266 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
6267 Drop use of TypeRefs, and use strings instead.
6269 2001-08-04 Miguel de Icaza <miguel@ximian.com>
6273 * class.cs (Struct::Struct): set the SEALED flags after
6274 checking the modifiers.
6275 (TypeContainer::TypeAttr): new property, returns the
6276 TypeAttributes for a class.
6278 * cs-parser.jay (type_list): Oops, list production was creating a
6279 new list of base types.
6281 * rootcontext.cs (StdLib): New property.
6282 (GetInterfaceTypeByName): returns an interface by type name, and
6283 encapsulates error handling here.
6284 (GetInterfaces): simplified.
6285 (ResolveTree): Encapsulated all the tree resolution here.
6286 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
6289 * driver.cs: Add support for --nostdlib, to avoid loading the
6291 (Main): Do not put tree resolution here.
6293 * rootcontext.cs: Beginning of the class resolution.
6295 2001-08-03 Miguel de Icaza <miguel@ximian.com>
6297 * rootcontext.cs: Provide better error reporting.
6299 * cs-parser.jay (interface_base): set our $$ to be interfaces.
6301 * rootcontext.cs (CreateInterface): Handle the case where there
6302 are no parent interfaces.
6304 (CloseTypes): Routine to flush types at the end.
6305 (CreateInterface): Track types.
6306 (GetInterfaces): Returns an array of Types from the list of
6309 * typemanager.c (AddUserType): Mechanism to track user types (puts
6310 the type on the global type hash, and allows us to close it at the
6313 2001-08-02 Miguel de Icaza <miguel@ximian.com>
6315 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
6316 RecordInterface instead.
6318 * cs-parser.jay: Updated to reflect changes above.
6320 * decl.cs (Definition): Keep track of the TypeBuilder type that
6321 represents this type here. Not sure we will use it in the long
6322 run, but wont hurt for now.
6324 * driver.cs: Smaller changes to accomodate the new code.
6326 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
6329 * rootcontext.cs (CreateInterface): New method, used to create
6330 the System.TypeBuilder type for interfaces.
6331 (ResolveInterfaces): new entry point to resolve the interface
6333 (CodeGen): Property, used to keep track of the code generator.
6335 2001-07-26 Miguel de Icaza <miguel@ximian.com>
6337 * cs-parser.jay: Add a second production for delegate_declaration
6340 (enum_body): Put an opt_comma here instead of putting it on
6341 enum_body or enum_member_declarations so we can handle trailing
6342 commas on enumeration members. Gets rid of a shift/reduce.
6344 (type_list): Need a COMMA in the middle.
6346 (indexer_declaration): Tell tokenizer to recognize get/set
6348 * Remove old targets.
6350 * Re-add the parser target.
6352 2001-07-13 Simon Cozens <simon@simon-cozens.org>
6354 * cs-parser.jay: Add precendence rules for a number of operators
6355 ot reduce the number of shift/reduce conflicts in the grammar.
6357 2001-07-17 Miguel de Icaza <miguel@ximian.com>
6359 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
6362 Get rid of old crufty code.
6364 * rootcontext.cs: Use this to keep track of the parsed
6365 representation and the defined types available to the program.
6367 * gen-treedump.cs: adjust for new convention.
6369 * type.cs: Split out the type manager, and the assembly builder
6372 * typemanager.cs: the type manager will live here now.
6374 * cil-codegen.cs: And the code generator here.
6376 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
6378 * makefile: Fixed up for easy making.
6380 2001-07-13 Simon Cozens <simon@simon-cozens.org>
6382 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
6385 (unary_expression): Expand pre_increment_expression and
6386 post_decrement_expression to reduce a shift/reduce.
6388 2001-07-11 Simon Cozens
6390 * cs-tokenizer.cs: Hex numbers should begin with a 0.
6392 Improve allow_keyword_as_indent name.
6394 2001-06-19 Miguel de Icaza <miguel@ximian.com>
6396 * Adjustments for Beta2.
6398 2001-06-13 Miguel de Icaza <miguel@ximian.com>
6400 * decl.cs: Added `Define' abstract method.
6401 (InTransit): new property, used to catch recursive definitions.
6403 * interface.cs: Implement `Define'.
6405 * modifiers.cs: Map Modifiers.constants to
6406 System.Reflection.TypeAttribute flags.
6408 * class.cs: Keep track of types and user-defined types.
6409 (BuilderInit): New method for creating an assembly
6410 (ResolveType): New function to launch the resolution process, only
6411 used by interfaces for now.
6413 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
6414 that are inserted into the name space.
6416 2001-06-08 Miguel de Icaza <miguel@ximian.com>
6418 * ARGH. I have screwed up my tree so many times due to the use of
6419 rsync rather than using CVS. Going to fix this at once.
6421 * driver.cs: Objetify driver. Load assemblies, use assemblies to
6424 2001-06-07 Miguel de Icaza <miguel@ximian.com>
6426 * Experiment successful: Use System.Type rather that our own
6429 2001-05-25 Miguel de Icaza <miguel@ximian.com>
6431 * cs-parser.jay: Removed nsAliases from here.
6433 Use new namespaces, handle `using XXX;'
6435 * namespace.cs: Reimplemented namespace handling, use a recursive
6436 definition of the class. Now we can keep track of using clauses
6437 and catch invalid using clauses.
6439 2001-05-24 Miguel de Icaza <miguel@ximian.com>
6441 * gen-treedump.cs: Adapted for all the renaming.
6443 * expression.cs (Expression): this class now has a Type property
6444 which returns an expression Type.
6446 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
6447 `Type', as this has a different meaning now in the base
6449 2001-05-22 Miguel de Icaza <miguel@ximian.com>
6451 * interface.cs, class.cs: Removed from all the sources the
6452 references to signature computation, as we can not do method
6453 signature computation during the parsing time, as we are not
6454 trying to solve at that point distinguishing:
6458 void a (NS.Blah x) {}
6461 Which depending on the context might be valid or not, as we do not
6462 know if Blah is the same thing as NS.Blah at that point.
6464 * Redid everything so the code uses TypeRefs now instead of
6465 Types. TypeRefs are just temporary type placeholders, that need
6466 to be resolved. They initially have a pointer to a string and the
6467 current scope in which they are used. This is used later by the
6468 compiler to resolve the reference to an actual Type.
6470 * DeclSpace is no longer a CIR.Type, and neither are
6471 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
6472 are all DeclSpaces, but no Types.
6474 * type.cs (TypeRefManager): This implements the TypeRef manager,
6475 which keeps track of all the types that need to be resolved after
6476 the parsing has finished.
6478 2001-05-13 Miguel de Icaza <miguel@ximian.com>
6480 * ARGH. We are going to have to store `foreach' as a class rather
6481 than resolving it, as we need to verify error 1579 after name
6482 resolution. *OR* we could keep a flag that says `This request to
6483 IEnumerator comes from a foreach statement' which we can then use
6484 to generate the error.
6486 2001-05-10 Miguel de Icaza <miguel@ximian.com>
6488 * class.cs (TypeContainer.AddMethod): we now add methods to the
6489 MethodGroup instead of the method hashtable.
6491 * expression.cs: Add MethodGroup abstraction, which gets us one
6492 step closer to the specification in the way we handle method
6495 * cs-parser.jay (primary_expression): qualified_identifier now
6496 tried to match up an identifier to a local variable reference or
6497 to a parameter reference.
6499 current_local_parameters is now a parser global variable that
6500 points to the current parameters for the block, used during name
6503 (property_declaration): Now creates an implicit `value' argument to
6506 2001-05-09 Miguel de Icaza <miguel@ximian.com>
6508 * parameter.cs: Do not use `param' arguments as part of the
6509 signature, per the spec.
6511 2001-05-08 Miguel de Icaza <miguel@ximian.com>
6513 * decl.cs: Base class for classes, structs and interfaces. This
6514 is the "Declaration Space"
6516 * cs-parser.jay: Use CheckDef for checking declaration errors
6517 instead of having one on each function.
6519 * class.cs: Factor out some code for handling error handling in
6520 accordance to the "Declarations" section in the "Basic Concepts"
6521 chapter in the ECMA C# spec.
6523 * interface.cs: Make all interface member classes derive from
6524 InterfaceMemberBase.
6526 2001-05-07 Miguel de Icaza <miguel@ximian.com>
6528 * Many things: all interfaces are parsed and generated in
6529 gen-treedump. Support for member variables, constructors,
6530 destructors, properties, constants is there.
6532 Beginning of the IL backend, but very little done, just there for
6535 2001-04-29 Miguel de Icaza <miguel@ximian.com>
6537 * cs-parser.jay: Fix labeled statement.
6539 * cs-tokenizer.cs (escape): Escape " and ' always.
6540 ref_line, ref_name: keep track of the line/filename as instructed
6541 by #line by the compiler.
6544 2001-04-27 Miguel de Icaza <miguel@ximian.com>
6546 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
6547 to match the values in System.CodeDOM.
6549 Divid renamed to Divide.
6551 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
6553 (Statements.set): remove.
6555 * System.CodeDOM/CodeCatchClause.cs: always have a valid
6558 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
6559 falseStatements always have valid values.
6561 * cs-parser.jay: Use System.CodeDOM now.