1 2002-04-28 Miguel de Icaza <miguel@ximian.com>
3 * statement.cs (Statement.Warning_DeadCodeFound): Factorize code.
4 (While): Report dead code here too.
6 (Statement): Added Resolve virtual method to allow
7 for resolution split from the emit code.
9 2002-04-26 Miguel de Icaza <miguel@ximian.com>
11 * statement.cs (EmitBoolExpression): No longer try to resolve the
13 (MakeBoolean): New utility function that resolve, implicitly
14 converts to boolean and tags the expression.
17 (If, Do): Implement dead code elimination.
18 (While): Implement loop inversion
20 (Do, While, For, If): Resolve the expression prior to calling our
23 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
26 - added method Report28 (warning: program has more than one entry point)
27 - added method IsEntryPoint, implements paragraph 10.1 of the spec
28 - modified method Method.Define, the part at the end of the method
30 * rootcontext.cs: added static public Location EntryPointLocation;
32 * ../errors/cs0028.cs : Add test case for the above warning.
35 - modified method CSharpName to allow arrays of primitive type to
36 be printed nicely (e.g. instead of System.Int32[][] it now prints
38 - added method CSharpSignature: returns the signature of a method
39 in string format to be used in reporting errors, warnings, etc.
41 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
44 2002-04-26 Ravi Pratap <ravi@ximian.com>
46 * delegate.cs (Define): Fix extremely silly bug where I was
47 setting the type of the 'object' parameter of the BeginInvoke
48 method to System.IAsyncResult instead of System.Object ;-)
50 2002-04-26 Miguel de Icaza <miguel@ximian.com>
52 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
55 (Constructor.Emit): return if we fail to initialize the
56 constructor. Another door closed!
58 * expression.cs (New.DoResolve): Improve error message (from -6 to
59 1501). Use DeclaredOnly lookup to find the exact constructor.
61 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
64 * cs-parser.jay: Adjust the default parameters so that destructors
65 have the proper signature.
67 2002-04-26 Martin Baulig <martin@gnome.org>
69 * driver.cs (LoadAssembly): If `assembly' contains any characters
70 which are only valid in path names and not in assembly names
71 (currently slash, backslash and point), use Assembly.LoadFrom ()
72 instead of Assembly.Load () on the `assembly' (before iteration
75 2002-04-26 Martin Baulig <martin@gnome.org>
77 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
79 2002-04-25 Miguel de Icaza <miguel@ximian.com>
81 * class.cs (Property): use the new typemanager.MemberLookup
83 (TypeContainer.MemberLookup): Implement using the
84 TypeManager.MemberLookup now.
86 * typemanager.cs: Make MemberLookup a function of the TypeManager,
87 and return MemberInfos, so that these can be used without an
88 EmitContext (what we had before).
90 2002-04-24 Miguel de Icaza <miguel@ximian.com>
92 * expression.cs: Fix the case where the argument to params if the
93 type of the params. I omitted handling this before. Fixed
95 2002-04-22 Miguel de Icaza <miguel@ximian.com>
97 * driver.cs: Call BootCorlib_PopulateCoreType
99 * class.cs (Property.CheckBase): Check for properties only, not
102 * interface.cs: Temporary hack: try/catch around the
103 CustomAttributeBuilder, because I am getting an exception that I
106 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
107 types whose definitions are required to be there (attributes are
108 defined before standard types).
110 Compute definitions as we boot the various types, as they are used
111 immediately (value_type class will need object_type, but if we do
112 not initialize object_type, we will pass a null, which will let
113 the runtime pick the System.Object from the existing corlib, which
114 is not what we want).
116 2002-04-22 Patrik Torstensson <totte@labs2.com>
118 * cs-tokenizer.cs: fixed a number of trim() issues.
120 2002-04-22 Ravi Pratap <ravi@ximian.com>
122 * expression.cs (Argument.Type): Ensure that we return the correct
123 type when we have out or ref parameters [in which case we
126 2002-04-22 Miguel de Icaza <miguel@ximian.com>
128 * class.cs (Property, Indexer): Allow extern modifier in there.
130 * typemanager.cs (InitBaseTypes): Initializes object_type and
131 value_type, since those will be used early on during the bootstrap
132 process to compile corlib.
134 (InitCoreTypes): Move code from here to InitBaseTypes.
136 2002-04-21 Miguel de Icaza <miguel@ximian.com>
138 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
139 single-dimension arrays as using the ldlen opcode.
141 Daniel Lewis discovered this optimization.
143 * typemanager.cs: Add signature for System.Array::get_Length
145 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
147 * statement.cs: report the error when the foreach does not apply to an
148 array nor a collection.
150 2002-04-19 Miguel de Icaza <miguel@ximian.com>
152 * expression.cs: Add implicit conversions to the operator ~.
154 * constant.cs (DecimalConstant.Emit): Emit decimal value.
156 * typemanager.cs: Locate the decimal constructor.
158 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
160 * attribute.cs: use the new property of TypeOf.
161 * expression.cs: added 'get' property around typearg.
163 These changes fix a build breaker reported by NickD. Is this the
164 correct way to fix? If not, please, revert my changes and make it
167 2002-04-17 Miguel de Icaza <miguel@ximian.com>
169 * attribute.cs: Add support for typeof in attribute invocations.
170 I am not sure that this is right though.
172 2002-04-14 Duncan Mak <duncan@ximian.com>
174 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
175 Binary.Operator.Division case.
177 2002-04-13 Ravi Pratap <ravi@ximian.com>
179 * class.cs (DefineType): Ensure that we do a proper check on
180 attribute types and also register it with the TypeManager.
182 (TypeContainer.Targets): The default for attribute types is
183 AttributeTargets.All.
185 * attribute.cs (ApplyAttributes): Registering the attribute type
186 is done elsewhere, not when we discover we have a Usage attribute.
188 2002-04-12 Ravi Pratap <ravi@ximian.com>
190 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
191 and get rid of is_delegate parameter.
193 * everywhere : update.
195 2002-04-12 Ravi Pratap <ravi@ximian.com>
197 * cs-parser.jay (compilation_unit): Revamp completely to use
198 some new ideas that I got from Rhys' grammar to solve the problems
199 with assembly level attributes.
201 (outer_declaration): New grammar production.
203 (attribute_sections): Add.
205 (opt_attributes): Base on attribute_sections
207 (namespace_declaration): Allow opt_attributes to tackle the case
208 when we have assembly level attributes - we are clever in this
211 * attribute.cs (ApplyAttributes): Do not worry about assembly
212 attributes in the non-global context.
214 * rootcontext.cs (AddGlobalAttributes): Go back to using this
215 instead of SetGlobalAttributes.
217 * class.cs, rootcontext.cs : Ensure we define and generate
218 attribute types before anything else.
220 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
221 and flag the new error -20 for the case when the attribute type
222 does not have valid targets specified. csc does not catch this.
224 * ../errors/errors.txt : update for error # -20
226 2002-04-11 Ravi Pratap <ravi@ximian.com>
228 * support.cs (InternalParameters.ParameterModifier): Do some null
229 checking and return sane values.
231 * class.cs (Method.Define): If we are a PInvoke method, ensure
232 that we are static and extern. Report error # 601
234 * ../errors/cs0601.cs : Add test case for the above error.
236 2002-04-07 Ravi Pratap <ravi@ximian.com>
238 * rootcontext.cs (attribute_types): We need to keep type of
239 all attribute types separately and emit code for them first.
241 (RegisterAttribute) : Implement.
243 * class.cs (DefineType): Check if the current Type is a custom
244 attribute type and register it accordingly.
246 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
247 adding the first attribute twice and rename to
249 (SetGlobalAttributes): this.
251 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
254 * attribute.cs (ApplyAttributes): Take an additional argument telling us
255 if we are processing global arguments. Hmm, I am unsure of this.
257 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
259 * expression.cs: added static array of strings to avoid calling
260 Enum.ToString () for Operator in Binary. Significant recover of
263 2002-04-10 Miguel de Icaza <miguel@ximian.com>
265 * class.cs (FindMembers): Allow the Builders of the various
266 members to be null. If they are skip them. This only happens
267 during the PInvoke declaration.
269 2002-04-09 Miguel de Icaza <miguel@ximian.com>
271 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
272 failure, so we do not keep going afterwards.
274 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
275 wanted to pass `false' as the `is_delegate' argument. If this is
276 the case, why not use delegate_type == null to mean `is_delegate =
277 false' and anything else as is_delegate = true.
279 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
281 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
282 code for the section, not the beginning of the tests.
284 2002-04-08 Miguel de Icaza <miguel@ximian.com>
286 * cfold.cs: Handle operator + (Enum x, Underlying x)
288 * expression.cs (Binary): same. Warn about errors where we have
289 Enum/Enum in operator + as well.
291 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
294 - added support for switch(bool)
295 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
296 - add TableSwitchEmit() to handle table-based switch statements
298 2002-04-05 Ravi Pratap <ravi@ximian.com>
300 * expression.cs (Invocation.OverloadResolve): Factor out code which
301 does parameter compatibility checking with arguments so that we can
302 re-use the code even from Delegate.VerifyApplicability
304 (VerifyArgumentsCompat): Move above code here.
306 * delegate.cs (VerifyApplicability): Get rid of duplicate code
307 and instead make a call to the above method.
309 2002-03-31 Ravi Pratap <ravi@ximian.com>
311 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
312 We use it to keep track of classes which are attribute types.
314 2002-04-02 Miguel de Icaza <miguel@ximian.com>
316 * delegate.cs (Delegate.Define): Correctly define the types in the
317 presence of fixed and array parameters.
319 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
322 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
323 include NonPublic after the first iteration.
325 * class.cs (Indexer.CheckBase): Only check if both parents are
328 * cs-parser.jay (accessor_body): If empty, set to null.
330 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
331 same code path here to resolve constants names that we did have in
332 MemberAccess.DoResolve. There is too much code duplicated here.
334 2002-04-01 Miguel de Icaza <miguel@ximian.com>
336 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
338 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
341 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
342 tokens, numbers and strings.
344 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
347 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
348 asyncronous parameters and the regular parameters.
350 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
351 specify the target directory.
353 * expression.cs: (This.DoResolve): Simplify
354 (As.Emit): Optimize, do not generate IsInst if the expression is
355 always of the given type.
357 (Is.DoResolve): Bug fix, we were reporting both always/never for
360 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
361 creating too many unnecessary arrays.
363 2002-03-31 Miguel de Icaza <miguel@ximian.com>
365 * class.cs (EmitFieldInitializer): Use Assign expression to assign
366 fields instead of rolling our own initializer. Takes care of all
367 implicit conversions, and drops unnecessary static checks/argument.
369 2002-03-31 Dick Porter <dick@ximian.com>
371 * driver.cs: use the GetDirectories() return values properly, and
372 use "/" as path separator.
374 2002-03-30 Miguel de Icaza <miguel@ximian.com>
376 * expression.cs (Unary): Optimize - - expr into expr.
377 (Binary): Optimize a + (-b) into a -b.
379 * codegen.cs (CodeGen): Made all methods static.
381 2002-03-29 Miguel de Icaza <miguel@ximian.com>
385 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
386 TypeBuilder property.
388 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
391 * tree.cs: Removed the various RecordXXXX, and replaced with a
392 single RecordDecl. Removed all the accessor methods, and just
393 left a single access point Type
395 * enum.cs: Rename DefineEnum to DefineType.
397 * decl.cs: New abstract method `DefineType' used to unify the
398 Defines for Enumerations, Interfaces, TypeContainers and
401 (FindType): Moved LookupInterfaceOrClass here. Moved the
402 LookupBaseClasses method that used to live in class.cs and
403 interface.cs here, and renamed to FindType.
405 * delegate.cs: Implement DefineType. Take advantage of the
406 refactored pattern for locating the parent builder without taking
407 the parent_builder argument (which we know does not work if we are
408 nested, and triggering a toplevel definition).
410 2002-03-28 Miguel de Icaza <miguel@ximian.com>
412 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
413 accessibility of a member has changed during override and report
416 * class.cs (Method.Define, Property.Define): Only complain on
417 overrides if the method is private, any other accessibility is
418 fine (and since we just checked the permission is the same, we are
421 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
422 and elif are processed always. The other pre-processing
423 directives are only processed if we are "taking" the path
425 2002-03-29 Martin Baulig <martin@gnome.org>
427 * class.cs (Method.Emit): Only emit symbolic debugging info if the
428 current location is not Null.
430 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
431 a separate method so we can profile it.
433 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
434 `span.Seconds' are just seconds, but no minutes or hours.
435 (MainDriver): Profile the CodeGen.SaveSymbols calls.
437 2002-03-28 Miguel de Icaza <miguel@ximian.com>
439 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
440 Remove the gratuitous set of Final:
442 // If an interface implementation, then we can set Final.
443 if (((flags & MethodAttributes.Abstract) == 0) &&
444 implementing.DeclaringType.IsInterface)
445 flags |= MethodAttributes.Final;
447 I do not know what I was smoking when I used that.
450 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
451 step into fixing the name resolution issues for delegates and
452 unifying the toplevel name resolution.
454 2002-03-28 Martin Baulig <martin@gnome.org>
456 * class.cs (Method.Emit): If we have a symbol writer, call its
457 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
458 tell it about the current method.
460 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
461 writer that we're going to emit the first byte of IL code for a new
462 statement (a new source line).
463 (EmitContext.EmitTopBlock): If we have a symbol writer, call
464 EmitContext.Mark() before emitting any code.
466 * location.cs (SymbolDocument): Return null when we're Null.
468 * statement.cs (Statement): Moved the `Location loc' variable here.
469 (Statement.EmitBoolExpression): If we have a symbol writer, call
470 ec.Mark() before emitting any code to tell it that we're at the
471 beginning of a new statement.
472 (StatementExpression): Added `Location' argument to the constructor.
473 (Block): Added public readonly variable `StartLocation' and public
474 variable `EndLocation'. The latter is to be set using SetEndLocation().
475 (Block): Added constructor which takes a start and end location.
476 (Block.SetEndLocation): New method. This sets the end location.
477 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
478 local variables we create.
479 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
480 each statement and do also mark the begin and end of the block.
482 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
483 tell it the current lexer.Location, use Location.Null for the end of the
485 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
486 current block, set its end location using SetEndLocation().
487 (statement_expression): StatementExpression constructor now takes the
488 lexer.Location as additional argument.
489 (for_statement, declare_local_variables): Likewise.
490 (declare_local_variables): When creating a new implicit block, use the
491 new Block constructor and pass it the lexer.Location.
493 2002-03-28 Miguel de Icaza <miguel@ximian.com>
495 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
496 members also on the parent interfaces recursively.
498 2002-03-27 Miguel de Icaza <miguel@ximian.com>
500 * report.cs: Use new formats, since Gonzalo finished the missing
503 * expression.cs (Binary.ResolveOperator): added missing operator|
504 operator& and operator^ for bool/bool.
506 * cs-parser.jay: CheckDef now takes a Location argument that is
507 used to report errors more precisly (instead of reporting the end
508 of a definition, we try to track something which is a lot closer
509 to the source of the problem).
511 * cs-tokenizer.cs: Track global token use, so we can properly flag
512 the use of #define/#undef after the first token has been seen.
514 Also, rename the reportXXXX to Error_DescriptiveName
516 * decl.cs (DeclSpace.IsTopLevel): Move property here from
517 TypeContainer, so that Enum and Interface can use this too.
519 * class.cs (TypeContainer.LookupInterfaceOrClass,
520 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
521 `builder' argument. Typically this was used to pass the parent
522 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
525 The problem is that a nested class could trigger the definition of
526 a toplevel class, and the builder would be obviously wrong in that
529 So we drop this argument, and we compute dynamically the
530 TypeBuilder/ModuleBuilder (the correct information was available
531 to us anyways from DeclSpace.Parent)
533 * interface.cs (Interface.DefineInterface): Drop builder
534 parameter cleanup like class.cs
536 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
539 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
542 (Try.Emit): Propagate the returns value from the statement.
544 (Return.Emit): Even if we are leavning
546 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
548 * modifiers.cs: Fix the computation of MethodAttributes flags.
550 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
552 * driver.cs: allow compilation of files that start with '/'.
553 Add a default case when checking the argument of --target.
555 2002-03-25 Miguel de Icaza <miguel@ximian.com>
557 * interface.cs: Implement the same search algorithm for types in
560 * delegate.cs: Do not allow multiple definition.
562 * Recovered ChangeLog that got accidentally amputated
564 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
566 * rootcontext.cs: Load manually enum to allow core classes to
567 contain enumerations.
569 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
570 Update to new static methods in TypeManager.
572 * typemanager.cs (GetMethod, GetConstructor): Use our
573 implementation of FindMembers to find the members, since during
574 corlib compilation, the types are TypeBuilders and GetMethod and
575 GetConstructor do not work.
577 Make all methods in TypeManager static.
579 (InitCodeHelpers): Split the functionality from
580 the InitCodeTypes function.
582 * driver.cs: Call InitCodeHelpers after we have populated the
585 * cs-parser.jay (delegate_declaration): we did not used to compute
586 the delegate name correctly for void delegates.
588 2002-03-24 Miguel de Icaza <miguel@ximian.com>
590 * rootcontext.cs (RootContext): Init the interface_resolve_order
591 and type_container_resolve_order always.
593 (ResolveCore, BootstrapCorlib_ResolveClass,
594 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
595 compiler when compiling with --nostdlib
597 * class.cs (TypeContainer.DefineType): Check that our parent is
598 not null. This test is most important when we are bootstraping
601 * codegen.cs: Split out the symbol writing code.
603 2002-03-25 Martin Baulig <martin@gnome.org>
605 * driver.cs (-g): Made -g an alias for --debug.
607 2002-03-24 Martin Baulig <martin@gnome.org>
609 * codegen.cs (SymbolWriter): New public variable. Returns the
610 current symbol writer.
611 (CodeGen): Added `bool want_debugging_support' argument to the
612 constructor. If true, tell the ModuleBuild that we want debugging
613 support and ask it for the ISymbolWriter.
614 (Save): If we have a symbol writer, call it's Close() method after
617 * driver.c (--debug): New command line argument to create a
618 debugger information file.
620 * location.cs (SymbolDocument): New public property. Returns an
621 ISymbolDocumentWriter object for the current source file or null
622 if we don't have a symbol writer.
624 2002-03-21 Miguel de Icaza <miguel@ximian.com>
626 * driver.cs (LoadAssembly): Correctly return when all the paths
627 have been tried and not before.
629 * statement.cs (Switch.Emit): return the actual coverage for this
630 statement (returns/not-returns)
632 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
633 switch of the statement if we are the last switch section. That
634 kills two problems: try/catch problems (we used to emit an empty
635 nop at the end) and switch statements where all branches would
638 2002-03-19 Miguel de Icaza <miguel@ximian.com>
640 * driver.cs: Add default assemblies (the equivalent to the
641 Microsoft CSC.RSP file)
643 * cs-tokenizer.cs: When updating `cols and setting it to zero,
644 also update tokens_seen and set it to false.
646 * driver.cs: Implement --recurse for Mike.
648 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
649 correctly splitting out the paths.
651 2002-03-18 Miguel de Icaza <miguel@ximian.com>
653 * interface.cs (Interface.PopulateProperty): Instead of using
654 `parent' as the declaration space for the set parameters, use
657 * support.cs (InternalParameters): InternalParameters constructor
658 takes a DeclSpace instead of a TypeContainer.
660 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
661 types are being initialized, load the address of it before calling
664 (New): Provide a mechanism to disable the generation of local
665 value type temporaries when the caller will be providing us with
666 an address to store it.
668 (ArrayCreation.EmitDynamicInitializers): Use it.
670 2002-03-17 Miguel de Icaza <miguel@ximian.com>
672 * expression.cs (Invocation.EmitArguments): Only probe for array
673 property if there is more than one argument. Sorry about that.
675 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
678 * class.cs (Method.LabelParameters): Fix incorrect code path that
679 prevented the `ParamArrayAttribute' from being applied to the
682 2002-03-16 Miguel de Icaza <miguel@ximian.com>
684 * support.cs (ReflectionParameters): Correctly compute whether the
685 last argument is a params array. Fixes the problem with
688 * typemanager.cs: Make the assemblies array always be non-null
689 (empty, but non-null)
691 * tree.cs (RecordDecl): New function that abstracts the recording
692 of names. This reports error 101, and provides a pointer to the
693 previous declaration. Fixes a crash in the compiler.
695 * cs-parser.jay (constructor_declaration): Update to new grammar,
696 and provide a constructor_body that can be empty.
698 2002-03-15 Miguel de Icaza <miguel@ximian.com>
700 * driver.cs: Add support for --resources.
702 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
703 Make all types for the various array helper methods be integer.
705 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
706 CheckState to ConvCast.
708 (ConvCast): Now it takes a `checked' state argument, to avoid
709 depending on the emit context for the conversion, and just using
710 the resolve time setting.
712 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
713 instead of Invocation.EmitArguments. We do not emit the original
714 arguments, instead we emit those which have been converted to
715 unsigned int expressions.
717 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
721 * expression.cs (LocalVariableReference): Drop the use of the
722 Store function that depended on the variable index.
724 * statement.cs (VariableInfo): Drop the `Idx' property from this
725 class, as this is not taking into account the indexes for
726 temporaries tat we generate during the execution, getting the
729 * class.cs: First emit class initializers, then call the parent
732 * expression.cs (Binary): Fix opcode emision.
733 (UnaryMutator.EmitCode): Support checked code generation
735 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
736 matches for events for both the Static and Instance scans,
737 pointing to the same element. Fix that.
739 2002-03-14 Miguel de Icaza <miguel@ximian.com>
741 * rootcontext.cs (ResolveTree): Always set the
742 interface_resolve_order, because nested interfaces will be calling
745 * class.cs (GetInterfaceOrClass): Track the same resolution
746 process used by TypeManager.LookupType. This fixes the nested
747 type lookups in class declarations (separate path from
750 (TypeContainer.DefineType): Also define nested interfaces.
751 (TypeContainer.RegisterOrder): New public function used to
752 register the order in which child interfaces need to be closed.
754 Nested interfaces need to be closed after their parents have been
757 * interface.cs (InterfaceAttr): Put all the logic for computing
758 the interface attribute here.
760 (DefineInterface): Register our interface order with the
761 RootContext or with the TypeContainer depending on the case.
763 2002-03-12 Miguel de Icaza <miguel@ximian.com>
765 * cs-parser.jay: rework foreach statement to work with the new
766 changes to the policy on SimpleNames.
768 * report.cs: support Stacktrace on warnings as well.
770 * makefile: drop --unsafe and /unsafe from the compile.
772 2002-03-13 Ravi Pratap <ravi@ximian.com>
774 * ecore.cs (StandardConversionExists): Modify to take an Expression
775 as the first parameter. Ensure we do null -> reference type conversion
778 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
779 temporary Expression objects.
781 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
783 * interface.cs: workaround bug in method overloading resolution
784 (there is already a bugzilla bug for it).
786 2002-03-12 Miguel de Icaza <miguel@ximian.com>
788 We could also solve this problem by having a separate path for
789 performing type lookups, instead of DoResolve, we could have a
790 ResolveType entry point, and only participating pieces of the
791 production (simplename, deref, array) would implement this.
793 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
794 signal SimpleName to only resolve type names and not attempt to
795 resolve anything else.
797 * expression.cs (Cast): Set the flag.
799 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
801 * class.cs: Only report 108 if there is no `new' modifier.
803 * cs-parser.jay: rework foreach statement to work with the new
804 changes to the policy on SimpleNames.
806 * report.cs: support Stacktrace on warnings as well.
808 * makefile: drop --unsafe and /unsafe from the compile.
810 2002-03-11 Miguel de Icaza <miguel@ximian.com>
812 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
813 lookups here, instead of doing that at parse time. This means
814 that our grammar will not introduce `LocalVariableReferences' as
815 expressions at this point. That solves the problem of code like
823 This is only half the fix. The full fix requires parameters to
824 also be handled in this way.
826 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
827 makes the use more obvious of the DeclSpace. The
828 ec.TypeContainer.TypeBuilder is now only used to pull the
831 My theory is that I can get rid of the TypeBuilder completely from
832 the EmitContext, and have typecasts where it is used (from
833 DeclSpace to where it matters).
835 The only pending problem is that the code that implements Aliases
836 is on TypeContainer, and probably should go in DeclSpace.
838 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
839 lookups here, instead of doing that at parse time. This means
840 that our grammar will not introduce `LocalVariableReferences' as
841 expressions at this point. That solves the problem of code like
849 This is only half the fix. The full fix requires parameters to
850 also be handled in this way.
852 * class.cs (Property.DefineMethod): When implementing an interface
853 method, set newslot, when implementing an abstract method, do not
854 set the flag (before we tried never setting it, or always setting
855 it, which is the difference).
856 (Indexer.DefineMethod): same.
857 (Method.DefineMethod): same.
859 * ecore.cs: Only set the status used flag if we get back a Field.
861 * attribute.cs: Temporary hack, so Paolo can keep working.
863 2002-03-08 Ravi Pratap <ravi@ximian.com>
865 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
866 the unmanaged type in the case we have a MarshalAs attribute.
868 (Resolve): Handle the case when we are parsing the special MarshalAs
869 attribute [we need to store the unmanaged type to use later]
871 * typemanager.cs (marshal_as_attr_type): Built in type for the
874 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
875 on parameters and accordingly set the marshalling info.
877 2002-03-09 Miguel de Icaza <miguel@ximian.com>
879 * class.cs: Optimizing slightly by removing redundant code after
880 we switched to the `NoTypes' return value.
881 (Property.DefineMethod): use NoTypes here too.
883 This fixes the bug I introduced in my last batch of changes.
885 2002-03-05 Ravi Pratap <ravi@ximian.com>
887 * tree.cs (RecordEnum): Add. We now keep track of enums too.
889 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
890 Enums since those are types too.
892 * cs-parser.jay (enum_declaration): Record enums as we parse them.
894 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
895 thanks to a call during the lookup process.
897 2002-03-07 Miguel de Icaza <miguel@ximian.com>
899 * statement.cs (Foreach): Lots of work to accomodate a particular
900 kind of foreach statement that I had not kept in mind. It is
901 possible to have foreachs on classes that provide a GetEnumerator
902 method that return objects that implement the "pattern" for using
903 a foreach, there is no need to support GetEnumerator
906 This is needed to compile nant.
908 * decl.cs: Only report 114 if the member is not `Finalize' and if
909 the warning level is at least 2.
911 * class.cs: Moved the compare function from Method to
914 (MethodSignature.InheritableMemberSignatureCompare): Add new
915 filter function that is used to extract inheritable methods from a
918 (Method.Define): Use the new `inheritable_method_signature_filter'
921 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
924 2002-03-06 Miguel de Icaza <miguel@ximian.com>
926 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
928 * cs-parser.jay: Add opt_semicolon to the interface declaration.
930 * expression.cs: Pass location information to
931 ConvertImplicitStandard.
933 * class.cs: Added debugging code to track return values from
936 2002-03-05 Miguel de Icaza <miguel@ximian.com>
938 * expression.cs (Is.DoResolve): If either side of the `is' is an
939 interface, do not flag the warning.
941 * ecore.cs (ImplicitReferenceConversion): We need a separate test
944 * report.cs: Allow for --fatal to be used with --probe.
946 * typemanager.cs (NoTypes): Move the definition for the empty Type
949 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
951 (TypeContainer.DefineProxy): New function used to proxy to parent
952 implementations when implementing interfaces.
953 (TypeContainer.ParentImplements): used to lookup if our parent
954 implements a public function that is required by an interface.
955 (TypeContainer.VerifyPendingMethods): Hook this up.
957 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
958 `modules' and `assemblies' arraylists into arrays. We only grow
959 these are the very early start up of the program, so this improves
960 the speedof LookupType (nicely measured).
962 * expression.cs (MakeByteBlob): Replaced unsafe code with
963 BitConverter, as suggested by Paolo.
965 * cfold.cs (ConstantFold.Binary): Special case: perform constant
966 folding of string concatenation, but if either side is a string,
967 and the other is not, then return null, and let the runtime use
968 the concatenation on the string plus the object (using
971 2002-03-04 Miguel de Icaza <miguel@ximian.com>
973 Constant Folding has been implemented now.
975 * expression.cs (Unary.Reduce): Do not throw an exception, catch
976 the error instead on types that are not supported in one's
979 * constant.cs (Constant and all children): New set of functions to
980 perform implict and explicit conversions.
982 * ecore.cs (EnumConstant): Implement the new functions to perform
983 conversion by proxying to the child expression.
985 * codegen.cs: (ConstantCheckState): Constant evaluation has its
986 own separate setting that can not be turned off from the command
987 line using --unchecked or --checked and is only controlled using
988 the checked/unchecked statements and expressions. This setting is
989 used by the constant folder to flag errors.
991 * expression.cs (CheckedExpr, UncheckedExpr): Set the
992 ConstantCheckState as well.
994 During Resolve, they also have to flag the state, because the
995 constant folder runs completely in the Resolve phase.
997 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
1000 2002-03-01 Miguel de Icaza <miguel@ximian.com>
1002 * cfold.cs: New file, this file contains the constant folder.
1004 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
1005 argument to track whether we are using the resulting address to
1006 load or store a value and provide better error messages.
1008 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
1009 new AddressOf arguments.
1011 * statement.cs (Foreach.EmitCollectionForeach): Update
1013 * expression.cs (Argument.Emit): Call AddressOf with proper
1014 arguments to track usage.
1016 (New.DoEmit): Call AddressOf with new arguments.
1018 (Unary.Emit): Adjust AddressOf call.
1020 2002-03-01 Ravi Pratap <ravi@ximian.com>
1022 * cs-parser.jay (member_access): Change the case for pre-defined types
1023 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
1026 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
1029 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
1030 essentially like methods and apply attributes like MethodImplOptions to them too.
1032 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
1035 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
1036 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
1039 * Update code everywhere accordingly.
1041 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
1043 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
1045 2002-02-28 Ravi Pratap <ravi@ximian.com>
1047 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
1048 try performing lookups against those instead of jumping straight into using
1049 the 'using' clauses.
1051 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
1053 (LookupType): Perform lookups in implicit parents too.
1055 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
1056 sequence as RootContext.LookupType.
1058 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
1059 the various cases of namespace lookups into this method.
1061 2002-03-01 Miguel de Icaza <miguel@ximian.com>
1063 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
1064 in positional arguments)
1066 * class.cs (Operator): Update the AllowedModifiers to contain
1069 * cs-parser.jay: Update operator declaration to allow for the
1070 operator body to be empty.
1072 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
1075 2002-02-27 Miguel de Icaza <miguel@ximian.com>
1077 * class.cs (Method.Emit): Label parameters.
1079 * driver.cs: Return 1 or 0 as the program exit code.
1081 2002-02-26 Miguel de Icaza <miguel@ximian.com>
1083 * expression.cs: Special case the `null' object when trying to
1084 auto-compute the type, as anything can be explicitly converted to
1087 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
1088 spotting this Paolo.
1090 (Expression.ImplicitNumericConversion): Perform comparissions of
1091 the type using the underlying type in the case of an enumeration
1092 rather than using the enumeration type for the compare.
1094 Cope with the underlying == type case, which is not possible to
1097 (Expression.ConvertNumericExplicit): Perform comparissions of
1098 the type using the underlying type in the case of an enumeration
1099 rather than using the enumeration type for the compare.
1101 * driver.cs: If the user does not supply an extension, assume .exe
1103 * cs-parser.jay (if_statement): Rewrote so that we can track the
1104 location for the if statement.
1106 * expression.cs (Binary.ConstantFold): Only concat strings when
1107 the operation is "+", not everything ;-)
1109 * statement.cs (Statement.EmitBoolExpression): Take a location
1111 (If, While, Do): Track location.
1113 * expression.cs (Binary.ResolveOperator): In the object + string
1114 case, I was missing a call to ConvertImplicit
1116 2002-02-25 Ravi Pratap <ravi@ximian.com>
1118 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
1119 Location arguments. Ensure we use RootContext.LookupType to do our work
1120 and not try to do a direct Type.GetType and ModuleBuilder.GetType
1122 * interface.cs (PopulateMethod): Handle the type of the parameter being
1125 * expression.cs (Invocation.BetterFunction): Handle the case when we
1126 have a params method with no fixed arguments and a call is made with no
1129 2002-02-25 Miguel de Icaza <miguel@ximian.com>
1131 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
1132 the verbatim-string-literal
1134 * support.cs (InternalParameters.ParameterModifier): handle null
1136 (InternalParameters.ParameterType): ditto.
1138 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
1139 duplicating the name of the variable parameter.
1140 (GetParameterByName): Fix bug where we were not looking up array
1141 paramters if they were the only present (thanks Paolo!).
1142 (GetParameterInfo): We only have an empty set of types if both
1143 fixed and array are set to null.
1144 (GetParameterInfo-idx): Handle FixedParameter == null
1146 * cs-parser.jay: Handle the case where there is no catch
1147 statements (missing null test).
1149 2002-02-22 Miguel de Icaza <miguel@ximian.com>
1151 * driver.cs (MainDriver): Be conservative on our command line
1154 Catch DirectoryNotFoundException when calling GetFiles.
1156 (SplitPathAndPattern): Used to split the input specification into
1157 a path and a pattern that we can feed to Directory.GetFiles.
1159 2002-02-21 Miguel de Icaza <miguel@ximian.com>
1161 * statement.cs (Fixed): Implement the last case of the Fixed
1162 statement (string handling).
1164 * expression.cs (StringPtr): New class used to return a char * to
1165 a string; Used by the Fixed statement.
1167 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
1169 * expression.cs (Binary.ResolveOperator): Remove redundant
1170 MemberLookup pn parent type.
1171 Optimize union call, we do not need a union if the types are the same.
1172 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
1175 Specialize the use of MemberLookup everywhere, instead of using
1176 the default settings.
1178 (StackAlloc): Implement stackalloc keyword.
1180 * cs-parser.jay: Add rule to parse stackalloc.
1182 * driver.cs: Handle /h, /help, /?
1184 * expression.cs (MakeByteBlob): Removed the hacks we had in place
1185 before we supported unsafe code.
1187 * makefile: add --unsafe to the self compilation of mcs.
1189 2002-02-20 Miguel de Icaza <miguel@ximian.com>
1191 * expression.cs (PointerArithmetic): New class that is used to
1192 perform pointer arithmetic.
1193 (Binary.Resolve): Handle pointer arithmetic
1194 Handle pointer comparission.
1195 (ArrayPtr): Utility expression class that is used to take the
1196 address of an array.
1198 (ElementAccess): Implement array access for pointers
1200 * statement.cs (Fixed): Implement fixed statement for arrays, we
1201 are missing one more case before we are done.
1203 * expression.cs (Indirection): Implement EmitAssign and set the
1204 ExprClass to Variable. This allows pointer dereferences to be
1205 treated as variables, and to have values assigned to them.
1207 * ecore.cs (Expression.StoreFromPtr): New utility function to
1208 store values dereferencing.
1210 2002-02-20 Ravi Pratap <ravi@ximian.com>
1212 * expression.cs (Binary.ResolveOperator): Ensure that we are
1213 not trying to operate on a void type - this fixes the reported
1216 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
1217 the parent implementation is sealed.
1219 * ../errors/cs0239.cs : Add.
1221 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
1223 * typemanager.cs (unverifiable_code_type): Corresponds to
1224 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
1225 which have unsafe code in them.
1227 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
1230 2002-02-19 Miguel de Icaza <miguel@ximian.com>
1232 * cs-tokenizer.cs: Add support for @"litreal strings"
1234 Make tokenizer accept pre-processor directives
1235 on any column (remove the old C-like limitation).
1237 * rootcontext.cs (EmitCode): Emit any global attributes.
1238 (AddGlobalAttributes): Used to keep track of assembly attributes.
1240 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
1242 * cs-parser.jay: Add support for global attributes.
1244 2002-02-17 Miguel de Icaza <miguel@ximian.com>
1246 * expression.cs (Indirection): New helper class. Unary will
1247 create Indirection classes to be able to implement the
1248 IMemoryLocation interface on it.
1250 2002-02-16 Miguel de Icaza <miguel@ximian.com>
1252 * cs-parser.jay (fixed_statement): reference the right statement.
1254 * statement.cs (Fixed.Emit): Finish implementing the fixed
1255 statement for the &x case.
1257 2002-02-14 Miguel de Icaza <miguel@ximian.com>
1259 * class.cs (Property.Define, Method.Define): Remove newslot when
1262 * modifiers.cs: My use of NewSlot when `Abstract' was set was
1263 wrong. NewSlot should only be used if the `new' keyword is present.
1265 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
1266 locating our system dir. Sorry about this.
1268 2002-02-13 Miguel de Icaza <miguel@ximian.com>
1270 * driver.cs (GetSystemDir): Compute correctly the location of our
1271 system assemblies. I was using the compiler directory instead of
1272 the library directory.
1274 2002-02-13 Ravi Pratap <ravi@ximian.com>
1276 * expression.cs (BetterFunction): Put back in what Miguel commented out
1277 since it is the correct fix. The problem is elsewhere ;-)
1279 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
1280 parameters of the parms method are themselves compatible or not !
1282 (StandardConversionExists): Fix very dangerous bug where we were forgetting
1283 to check that a class implements an interface before saying that an implicit
1284 conversion was allowed. Use ImplementsInterface to do the checking.
1286 2002-02-13 Miguel de Icaza <miguel@ximian.com>
1288 * class.cs (Method.Define): Track whether we are an explicit
1289 implementation or not. And only call DefineMethodOverride if we
1290 are an explicit implementation.
1292 (Property.DefineMethod): Ditto.
1294 2002-02-11 Ravi Pratap <ravi@ximian.com>
1296 * expression.cs (BetterFunction): Catch hideous bug which was
1297 preventing us from detecting ambiguous calls due to implicit casts i.e
1300 2002-01-29 Miguel de Icaza <miguel@ximian.com>
1302 * support.cs (Pair): Remove un-needed method. I figured why I was
1303 getting the error in cs-parser.jay, the variable in a foreach loop
1304 is readonly, and the compiler does not really treat this as a variable.
1306 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
1307 instead of EQUALS in grammar.
1309 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
1311 * expression.cs (Unary.DoResolve): Check whether the argument is
1314 2002-01-28 Miguel de Icaza <miguel@ximian.com>
1316 * support.cs: Api for Pair to set a value. Despite the fact that
1317 the variables are public the MS C# compiler refuses to compile
1318 code that accesses the field if the variable is part of a foreach
1321 * statement.cs (Fixed): Begin implementation of the fixed
1324 (Block.AddVariable): Return the VariableInfo on success and null
1325 on failure instead of true/false.
1327 * cs-parser.jay (foreach): Catch errors on variables already
1328 defined (we were ignoring this value before) and properly unwind
1331 (fixed_statement): grammar for the fixed statement.
1333 2002-01-25 Miguel de Icaza <miguel@ximian.com>
1335 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
1336 pointer types to be incretemented.
1338 (SizeOf): Implement.
1340 * cs-parser.jay (pointer_member_access): Implement
1341 expr->IDENTIFIER production.
1343 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
1344 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
1347 (Unary): Implement indirection.
1349 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
1350 use in non-unsafe context).
1352 (SimpleName.DoResolve): Check for pointers in field access on safe
1355 (Expression.LoadFromPtr): Factor the load-indirect code in this
1356 function. This was duplicated in UnboxCast and ParameterReference
1358 2002-01-24 Miguel de Icaza <miguel@ximian.com>
1360 * expression.cs (ComposedCast): report an error if a pointer cast
1361 is used in a safe region.
1363 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
1364 pointer type casts in unsafe context.
1366 * codegen.cs (EmitContext): Set up IsUnsafe.
1368 * cs-parser.jay (non_expression_type): Add productions for pointer
1371 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
1372 code. We should not use force into static mode if the method is
1373 not virtual. Fixes bug in MIS
1375 * statement.cs (Do.Emit, While.Emit, For.Emit,
1376 Statement.EmitBoolExpression): Add support to Do and While to
1377 propagate infinite loop as `I do return' semantics.
1379 Improve the For case to also test for boolean constants.
1381 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
1382 to the list of attributes we can add.
1384 Remove `EmitContext' argument.
1386 * class.cs (Method.Define): Apply parameter attributes.
1387 (Constructor.Define): Apply parameter attributes.
1388 (MethodCore.LabelParameters): Move here the core of labeling
1391 * support.cs (ReflectionParameters.ParameterModifier,
1392 InternalParameters.ParameterModifier): Use IsByRef on the type and
1393 only return the OUT bit for these parameters instead of in/out/ref
1396 This is because I miss-understood things. The ParameterInfo.IsIn
1397 and IsOut represent whether the parameter has the [In] and [Out]
1400 2002-01-22 Miguel de Icaza <miguel@ximian.com>
1402 * ecore.cs (FieldExpr.Emit): Release temporaries.
1404 * assign.cs (LocalTemporary.Release): new function.
1406 * codegen.cs (EmitContext.GetTemporaryStorage,
1407 EmitContext.FreeTemporaryStorage): Rework the way we deal with
1408 temporary storage. Now we can "put back" localbuilders when we
1411 2002-01-21 Miguel de Icaza <miguel@ximian.com>
1413 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
1414 need to make a copy of the variable to generate verifiable code.
1416 2002-01-19 Miguel de Icaza <miguel@ximian.com>
1418 * driver.cs: Compute dynamically the system directory.
1420 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
1421 Slower, but more generally useful. Used by the abstract
1422 registering implementation.
1424 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
1425 the rules for the special rule on Type/instances. First check if
1426 we have the same name, and if so, try that special static path
1427 rather than the instance path.
1429 2002-01-18 Miguel de Icaza <miguel@ximian.com>
1431 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
1434 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
1435 Enum, ValueType, Delegate or Array for non-corlib compiles.
1437 * cs-tokenizer.cs: Catch long identifiers (645)
1439 * typemanager.cs (IndexerPropetyName): Ravi never tested this
1442 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
1443 fix, we were returning too early, so we were not registering
1444 pending methods from abstract classes.
1446 Do not register pending methods if the class is abstract.
1448 * expression.cs (Conditional.DoResolve): Report circular implicit
1449 conversions when we neecd to compute it for conditional
1452 (Is.DoResolve): If the expression is always of the provided type,
1453 flag warning 183. If the expression can not ever be of the
1454 provided type flag warning 184.
1456 * class.cs: Catch 169 as well.
1458 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
1461 2002-01-18 Nick Drochak <ndrochak@gol.com>
1463 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
1465 2002-01-17 Miguel de Icaza <miguel@ximian.com>
1467 * interface.cs: (PopulateMethod): Check for pointers being defined
1468 only if the unsafe context is active.
1469 (PopulateProperty): ditto.
1470 (PopulateIndexer): ditto.
1472 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
1473 specified. If pointers are present, make sure that they are
1474 present in an unsafe context.
1475 (Constructor, Constructor.Define): ditto.
1476 (Field, Field.Define): ditto.
1477 (Property, Property.Define): ditto.
1478 (Event, Event.Define): ditto.
1480 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
1481 hashtable if there are classes or structs defined.
1483 * expression.cs (LocalVariableReference.DoResolve): Simplify this
1484 code, as the constant resolution moved.
1486 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
1487 the metadata, so we can flag error 133.
1489 * decl.cs (MemberCore.UnsafeOK): New function to test that a
1490 pointer is being declared in an unsafe context.
1492 2002-01-16 Miguel de Icaza <miguel@ximian.com>
1494 * modifiers.cs (Modifiers.Check): Require a Location argument.
1495 Report error 227 for Unsafe use.
1497 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
1499 * statement.cs (For.Emit): If the test is null, then report that
1500 we do `return', as we wont reach anything afterwards.
1502 (Switch.SwitchGoverningType): Track the expression that matched
1505 * driver.cs: Allow negative numbers as an error code to flag.
1507 * cs-parser.jay: Handle 1551.
1509 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
1511 2002-01-15 Miguel de Icaza <miguel@ximian.com>
1513 * cs-parser.jay: Report 1518 (type declaration can only contain
1514 class, struct, interface, enum or delegate)
1516 (switch_label): Report 1523 (keywords `case' or `default' must
1519 (opt_switch_sections): Report 1522 (empty switch)
1521 * driver.cs: Report 1515 (response file specified multiple times)
1522 Report 1516 (Source file specified multiple times).
1524 * expression.cs (Argument.Resolve): Signal 1510
1526 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
1527 access not allowed in static code)
1529 2002-01-11 Ravi Pratap <ravi@ximian.com>
1531 * typemanager.cs (IsPointerType): Utility method which we are going
1534 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
1535 the object type, so we take care of that.
1537 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
1539 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
1540 added to non-params parameters :-)
1542 * typemanager.cs (CSharpName): Include 'void' type too.
1544 (void_ptr_type): Include in the set of core types.
1546 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
1549 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
1552 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
1553 completely forgotten about it.
1555 2002-01-10 Ravi Pratap <ravi@ximian.com>
1557 * cs-parser.jay (pointer_type): Add. This begins our implementation
1558 of parsing rules for unsafe code.
1560 (unsafe_statement): Implement.
1562 (embedded_statement): Modify to include the above.
1564 * statement.cs (Unsafe): Implement new class for unsafe blocks.
1566 * codegen.cs (EmitContext.InUnsafe): Add. This determines
1567 if the current context is an unsafe one.
1569 * cs-parser.jay (local_variable_pointer_type): Since local variable types
1570 are handled differently, we need separate rules for them.
1572 (local_variable_declaration): Update to use local_variable_pointer_type
1573 to allow variable declarations of unmanaged pointer types.
1575 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
1578 * ../errors/cs0214.cs : Add.
1580 2002-01-16 Nick Drochak <ndrochak@gol.com>
1582 * makefile: remove 'response' file when cleaning.
1584 2002-01-15 Miguel de Icaza <miguel@ximian.com>
1586 * cs-parser.jay: Report 1524.
1588 2002-01-14 Miguel de Icaza <miguel@ximian.com>
1590 * typemanager.cs (RegisterMethod): drop checking if we have
1591 registered this from here
1593 2002-01-12 Miguel de Icaza <miguel@ximian.com>
1595 * class.cs (Method.EmitDestructor): Implement calling our base
1598 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
1601 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
1602 this routine and will wrap the call in a try/catch block. Deal
1605 2002-01-11 Miguel de Icaza <miguel@ximian.com>
1607 * ecore.cs (Expression.MemberLookup): instead of taking a
1608 parameter `same_type' that was used to tell whether we could
1609 access private members we compute our containing type from the
1612 (FieldExpr): Added partial support for volatile fields. This does
1613 not work for volatile fields exposed from assemblies, as I can not
1614 figure out how to extract the modreq from it.
1616 Updated all the source files to use this.
1618 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
1619 because it is referenced by MemberLookup very often.
1621 2002-01-09 Ravi Pratap <ravi@ximian.com>
1623 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
1624 TypeBuilder.GetCustomAttributes to retrieve what we need.
1626 Get rid of redundant default_member_attr_type as this is the same as
1627 default_member_type which already exists.
1629 * interface.cs, attribute.cs : Update accordingly.
1631 2002-01-08 Miguel de Icaza <miguel@ximian.com>
1633 * typemanager.cs: Enable IndexerPropertyName again. It does not
1634 work for TYpeBuilders though. Ravi, can you please fix this?
1636 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
1638 * expression.cs (Argument.Emit): Handle the case of ref objects
1639 being passed to ref functions;
1641 (ParameterReference.EmitLoad): Loads the content of the pointer
1642 without dereferencing.
1644 2002-01-07 Miguel de Icaza <miguel@ximian.com>
1646 * cs-tokenizer.cs: Implemented the pre-processing expressions.
1648 2002-01-08 Ravi Pratap <ravi@ximian.com>
1650 * class.cs (Indexer.DefineMethod): Incorporate the interface
1651 type in the name of the method if we are doing explicit interface
1654 * expression.cs (ConversionExists): Remove as it is completely obsolete.
1656 (BetterConversion): Fix extremely trivial bug where we were referring to
1657 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
1660 * ../errors/bug16.cs : Add although we have fixed it.
1662 2002-01-07 Miguel de Icaza <miguel@ximian.com>
1664 * expression.cs (BaseIndexer): Begin implementation.
1666 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
1668 * cs-parser.jay (indexer_declarator): Use qualified_identifier
1669 production directly to remove a shift/reduce, and implement
1670 explicit interface implementation.
1672 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
1673 after a floating point suffix.
1675 * expression.cs (DoNumericPromotions): Improved the conversion for
1676 uint/uint. If we have a constant, we avoid doing a typecast to a
1679 * class.cs (Indexer): Implement explicit interface implementation
1682 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
1684 * class.cs: make the default instance constructor public and hidebysig.
1686 2001-01-03 Ravi Pratap <ravi@ximian.com>
1688 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
1689 so we can call it from elsewhere.
1691 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
1692 we emit it internally if the class has a defined indexer; otherwise the user
1693 emits it by decorating the class definition with the DefaultMemberAttribute.
1695 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
1696 attribute is not used on a type which defines an indexer.
1698 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
1699 character when we skip whitespace.
1701 * ../errors/cs0646.cs : Add.
1703 2002-01-03 Miguel de Icaza <miguel@ximian.com>
1705 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
1708 * makefile: Add practical target `mcs3.exe' which builds the third
1709 generation compiler.
1711 * expression.cs (New): Fix structures constructor calling.
1713 * class.cs (Property, Method, Indexer): Emit Final flag on the
1714 method if we are an interface implementation and we are not
1717 * ecore.cs (PropertyExpr): New public field `IsBase', tells
1718 whether this property is referencing a `base' method.
1720 * expression.cs (Invocation.EmitCall): take an extra argument:
1721 is_base, this is used to determine whether the `call' or
1722 `callvirt' opcode should be used.
1725 * delegate.cs: update EmitCall.
1727 * class.cs (Method.Define): Set NewSlot for the cases where we are
1728 not implementing an interface method.
1730 (Property.Define): ditto.
1732 2002-01-02 Miguel de Icaza <miguel@ximian.com>
1734 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
1735 'r'. Allows mcs to parse itself fully.
1737 2002-01-02 Ravi Pratap <ravi@ximian.com>
1739 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
1740 of the number of initializers that require the InitializeArray method.
1742 (CheckIndices): Store the Expression in all cases - not the plain value. Also
1743 update the above field where necessary.
1745 (MakeByteBlob): Update accordingly.
1747 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
1750 (EmitDynamicInitializers): Update in accordance with the new optimization.
1752 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
1753 same OpCode applies.
1755 * cs-parser.jay : Fix some glaring errors I introduced.
1757 2002-01-01 Ravi Pratap <ravi@ximian.com>
1759 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
1760 so that we can check for name clashes there too.
1762 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
1763 for interface indexers.
1765 * interfaces.cs (Define): Emit the default member attribute.
1767 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
1768 variable was being referred to while setting the value ;-)
1770 2002-01-01 Miguel de Icaza <miguel@ximian.com>
1772 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
1773 byte-by-byte information when we know the data is zero.
1775 Make the block always a multiple of 4, because
1776 DefineInitializedData has a bug.
1778 * assign.cs: Fix, we should assign from the temporary, not from
1781 * expression.cs (MakeByteBlob): Fix my incorrect code.
1783 2001-12-31 Miguel de Icaza <miguel@ximian.com>
1785 * typemanager.cs (EnumToUnderlying): This function is used to get
1786 the underlying type from an enumeration, because it does not
1789 * constant.cs: Use the I4_S form for values between -128 and 127.
1791 * statement.cs (Block.LookupLabel): Looks up a label.
1792 (Block): Drop support for labeled blocks.
1794 (LabeledStatement): New kind of statement that represents a label
1797 (Goto): Finally implement this bad boy.
1799 * cs-parser.jay: Update to reflect new mechanism to implement
1802 2001-12-30 Miguel de Icaza <miguel@ximian.com>
1804 * codegen.cs (EmitContext.This): a codegen property that keeps the
1805 a single instance of this instead of creating many different this
1808 * delegate.cs (Delegate.DoResolve): Update to use the property;
1810 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
1812 * expression.cs (BaseAccess.DoResolve): Ditto.
1814 2001-12-29 Ravi Pratap <ravi@ximian.com>
1816 * typemanager.cs (methodimpl_attr_type): Add to hold the type
1817 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
1819 (InitCoreTypes): Update accordingly.
1821 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
1822 so we can quickly store the state.
1824 (ApplyAttributes): Set the correct implementation flags
1825 for InternalCall methods.
1827 2001-12-29 Miguel de Icaza <miguel@ximian.com>
1829 * expression.cs (EmitCall): if a method is not virtual, then do
1830 not use callvirt on it.
1832 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
1833 user defined stuff) requires the use of stobj, which takes an
1834 address on the stack instead of an array and an index. So emit
1835 the Ldelema operation for it.
1837 (EmitStoreOpcode): Use stobj for valuetypes.
1839 (UnaryMutator.EmitCode): Use the right 1 value depending on
1840 whether we are dealing with int64/uint64, float or doubles.
1842 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
1843 constructors that I implemented last night.
1845 (Constructor.IsDefault): Fix to work properly for static
1848 * cs-parser.jay (CheckDef): report method signature errors.
1849 Update error number 103 to be 132.
1851 * decl.cs: New AdditionResult enumeration value: MethodExists.
1852 Although we do this check for methods later on in the semantic
1853 analysis, catching repeated default constructors is so easy that
1854 we catch these here.
1856 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
1859 (ParameterReference.EmitAssign, Emit): handle
1862 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
1863 (ArrayAccess.EmitStoreOpcode): ditto.
1865 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
1867 * expression.cs (MakeByteBlob): Complete all the missing types
1868 (uint, short, ushort, byte, sbyte)
1870 * class.cs: Only init instance field initializers on instance
1873 Rename `constructors' to instance_constructors.
1875 (TypeContainer.AddConstructor): Only add constructors to the list
1876 if it is not static.
1878 Make sure that we handle default_static_constructor independently
1879 everywhere where we handle instance_constructors
1881 2001-12-28 Miguel de Icaza <miguel@ximian.com>
1883 * class.cs: Do not lookup or create a base initializer for a
1886 (ConstructorInitializer.Resolve): use the proper type to lookup
1889 * cs-parser.jay: Report error 1585 (modifiers between type and name).
1891 * enum.cs, interface.cs: Remove CloseType, this is taken care by
1894 * decl.cs: CloseType is now an virtual method, the default
1895 implementation just closes this type.
1897 2001-12-28 Ravi Pratap <ravi@ximian.com>
1899 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
1900 to PreserveSig by default. Also emit HideBySig on such methods.
1902 Basically, set the defaults to standard values.
1904 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
1905 argument, if candidate is better, it can't be worse than the best !
1907 (Invocation): Re-write bits to differentiate between methods being
1908 applicable in their expanded form and their normal form - for params
1911 Get rid of use_standard everywhere as only standard conversions are allowed
1912 in overload resolution.
1914 More spec conformance.
1916 2001-12-27 Miguel de Icaza <miguel@ximian.com>
1918 * driver.cs: Add --timestamp, to see where the compiler spends
1921 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
1922 `this' in static code.
1924 (SimpleName.DoResolve): Implement in terms of a helper function
1925 that allows static-references to be passed upstream to
1928 (Expression.ResolveWithSimpleName): Resolve specially simple
1929 names when called by MemberAccess to implement the special
1932 (Expression.ImplicitReferenceConversion): Handle conversions from
1933 Null to reference types before others, as Null's type is
1936 * expression.cs (Invocation.EmitCall): Handle the special case of
1937 calling methods declared on a reference type from a ValueType
1938 (Base classes System.Object and System.Enum)
1940 (MemberAccess.Resolve): Only perform lookups on Enumerations if
1941 the left hand side is a TypeExpr, not on every enumeration.
1943 (Binary.Resolve): If types are reference types, then do a cast to
1944 object on operators != and == of both arguments.
1946 * typemanager.cs (FindMembers): Extract instance and static
1947 members if requested.
1949 * interface.cs (PopulateProperty): Use void_type instead of null
1950 as the return type for the setter method.
1952 (PopulateIndexer): ditto.
1954 2001-12-27 Ravi Pratap <ravi@ximian.com>
1956 * support.cs (ReflectionParameters): Fix minor bug where we
1957 were examining the wrong parameter for the ParamArray attribute.
1959 Cope with requests for the type of the parameter at position
1960 greater than the params parameter's. We now return the element
1961 type of the params array as that makes more sense.
1963 * expression.cs (Invocation.IsParamsMethodApplicable): Update
1964 accordingly as we no longer have to extract the element type
1967 (Invocation.OverloadResolve): Update.
1969 2001-12-27 Miguel de Icaza <miguel@ximian.com>
1971 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
1972 against IEnumerator, test whether the return value is a descendant
1973 of the IEnumerator interface.
1975 * class.cs (Indexer.Define): Use an auxiliary method to implement
1976 the other bits of the method definition. Begin support for
1977 explicit interface implementation.
1979 (Property.DefineMethod): Use TypeManager.void_type instead of null
1980 for an empty return value.
1982 2001-12-26 Miguel de Icaza <miguel@ximian.com>
1984 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
1985 dealing with a FieldExpr which is composed of a FieldBuilder, in
1986 the code path we did extract the constant, but we should have
1987 obtained the underlying value to be able to cast it (otherwise we
1988 end up in an infinite loop, this is what Ravi was running into).
1990 (ArrayCreation.UpdateIndices): Arrays might be empty.
1992 (MemberAccess.ResolveMemberAccess): Add support for section
1993 14.5.4.1 that deals with the special case of E.I when E is a type
1994 and something else, that I can be a reference to a static member.
1996 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
1997 handle a particular array type to create byte blobs, it is just
1998 something we dont generate byteblobs for.
2000 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
2003 * location.cs (Push): remove the key from the hashtable that we
2004 are about to add. This happens for empty files.
2006 * driver.cs: Dispose files after we have parsed them.
2008 (tokenize): new function that only runs the tokenizer on its
2009 input, for speed testing.
2011 2001-12-26 Ravi Pratap <ravi@ximian.com>
2013 * class.cs (Event.Define): Define the private field only if there
2014 are no accessors defined.
2016 * expression.cs (ResolveMemberAccess): If there is no associated
2017 field with the event, that means we have an event defined with its
2018 own accessors and we should flag error cs0070 since transforming
2019 ourselves into a field is not valid in that case.
2021 * ecore.cs (SimpleName.DoResolve): Same as above.
2023 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
2024 and charset to sane values.
2026 2001-12-25 Ravi Pratap <ravi@ximian.com>
2028 * assign.cs (DoResolve): Perform check on events only if they
2029 are being accessed outside the declaring type.
2031 * cs-parser.jay (event_declarations): Update rules to correctly
2032 set the type of the implicit parameter etc.
2034 (add_accessor, remove_accessor): Set current local parameters.
2036 * expression.cs (Binary): For delegate addition and subtraction,
2037 cast the return value from the method into the appropriate delegate
2040 2001-12-24 Ravi Pratap <ravi@ximian.com>
2042 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
2043 of these as the workaround is unnecessary.
2045 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
2046 delegate data - none of that is needed at all.
2048 Re-write bits to extract the instance expression and the delegate method
2051 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
2054 * attribute.cs (ApplyAttributes): New method to take care of common tasks
2055 of attaching attributes instead of duplicating code everywhere.
2057 * everywhere : Update code to do attribute emission using the above method.
2059 2001-12-23 Miguel de Icaza <miguel@ximian.com>
2061 * expression.cs (IsParamsMethodApplicable): if there are not
2062 parameters, return immediately.
2064 * ecore.cs: The 0 literal can be implicity converted to an enum
2067 (SimpleName.DoResolve): First lookup the type, then lookup the
2070 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
2071 want to get its address. If the InstanceExpression is not
2072 addressable, store the result in a temporary variable, then get
2075 * codegen.cs: Only display 219 errors on warning level or above.
2077 * expression.cs (ArrayAccess): Make it implement the
2078 IMemoryLocation interface.
2080 (Binary.DoResolve): handle the operator == (object a, object b)
2081 and operator != (object a, object b) without incurring into a
2082 BoxedCast (because 5 != o should never be performed).
2084 Handle binary enumerator operators.
2086 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
2087 value type, otherwise use Ldelem_ref.
2089 Use precomputed names;
2091 (AddressOf): Implement address of
2093 * cs-parser.jay (labeled_statement): Fix recursive block
2094 addition by reworking the production.
2096 * expression.cs (New.DoEmit): New has a special case:
2098 If we are dealing with a ValueType, we have a few
2099 situations to deal with:
2101 * The target of New is a ValueType variable, that is
2102 easy, we just pass this as the variable reference
2104 * The target of New is being passed as an argument,
2105 to a boxing operation or a function that takes a
2108 In this case, we need to create a temporary variable
2109 that is the argument of New.
2112 2001-12-23 Ravi Pratap <ravi@ximian.com>
2114 * rootcontext.cs (LookupType): Check that current_type is not null before
2115 going about looking at nested types.
2117 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
2118 not implement the IAssignMethod interface any more.
2120 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
2121 where we tranform them into FieldExprs if they are being resolved from within
2124 * ecore.cs (SimpleName.DoResolve): Do the same here.
2126 * assign.cs (DoResolve, Emit): Clean up code considerably.
2128 * ../errors/bug10.cs : Add.
2130 * ../errors/cs0070.cs : Add.
2132 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
2134 * assign.cs : Get rid of EventIsLocal everywhere.
2136 2001-12-23 Miguel de Icaza <miguel@ximian.com>
2138 * ecore.cs (ConvertIntLiteral): finished the implementation.
2140 * statement.cs (SwitchLabel): Convert the value we are using as a
2141 key before looking up the table.
2143 2001-12-22 Miguel de Icaza <miguel@ximian.com>
2145 * codegen.cs (EmitTopBlock): Require a Location argument now.
2147 * cs-parser.jay (constructor_declarator): We need to setup
2148 current_local_parameters before we parse the
2149 opt_constructor_initializer, to allow the variables to be bound
2150 to the constructor arguments.
2152 * rootcontext.cs (LookupType): First lookup nested classes in our
2153 class and our parents before we go looking outside our class.
2155 * expression.cs (ConstantFold): Extract/debox the values at the
2158 * rootcontext.cs (EmitCode): Resolve the constants first before we
2159 resolve the types. This is not really needed, but it helps debugging.
2161 * statement.cs: report location.
2163 * cs-parser.jay: pass location to throw statement.
2165 * driver.cs: Small bug fix.
2167 * report.cs: Updated format to be 4-zero filled digits.
2169 2001-12-22 Ravi Pratap <ravi@ximian.com>
2171 * expression.cs (CheckIndices): Fix minor bug where the wrong
2172 variable was being referred to ;-)
2174 (DoEmit): Do not call EmitStaticInitializers when the
2175 underlying type is System.Object.
2177 2001-12-21 Ravi Pratap <ravi@ximian.com>
2179 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
2180 and do the usual workaround for SRE.
2182 * class.cs (MyEventBuilder.EventType): New member to get at the type
2183 of the event, quickly.
2185 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
2187 * assign.cs (Assign.DoResolve): Handle the case when the target
2188 is an EventExpr and perform the necessary checks.
2190 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
2193 (SimpleName.MemberStaticCheck): Include check for EventExpr.
2195 (EventExpr): Set the type in the constructor itself since we
2196 are meant to be born fully resolved.
2198 (EventExpr.Define): Revert code I wrote earlier.
2200 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
2201 instance expression is null. The instance expression is a This in that case
2202 or a null, depending on whether it is a static method or not.
2204 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
2205 refers to more than one method.
2207 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
2208 and accordingly flag errors.
2210 2001-12-21 Miguel de Icaza <miguel@ximian.com>
2212 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
2214 2001-12-22 Miguel de Icaza <miguel@ximian.com>
2216 * location.cs (ToString): Provide useful rutine.
2218 2001-12-21 Miguel de Icaza <miguel@ximian.com>
2220 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
2221 objects, return the actual integral boxed.
2223 * statement.cs (SwitchLabel): define an ILLabel for each
2226 (Switch.CheckSwitch): If the value is a Literal, extract
2227 the underlying literal.
2229 Also in the unused hashtable we had, add the SwitchLabel so we can
2230 quickly look this value up.
2232 * constant.cs: Implement a bunch of new constants. Rewrite
2233 Literal based on this. Made changes everywhere to adapt to this.
2235 * expression.cs (Expression.MakeByteBlob): Optimize routine by
2236 dereferencing array only once, and also copes with enumrations.
2238 bytes are two bytes wide, not one.
2240 (Cast): Perform constant conversions.
2242 * ecore.cs (TryImplicitIntConversion): Return literals instead of
2243 wrappers to the literals here.
2245 * expression.cs (DoNumericPromotions): long literals can converted
2246 to ulong implicity (this is taken care of elsewhere, but I was
2249 * ecore.cs (Expression.Literalize): Make the return type Literal,
2250 to improve type checking.
2252 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
2254 2001-12-20 Miguel de Icaza <miguel@ximian.com>
2256 * literal.cs: Revert code from ravi that checked the bounds. The
2257 bounds are sane by the definition of the type itself.
2259 * typemanager.cs: Fix implementation of ImplementsInterface. We
2260 need to actually look up in our parent hierarchy for interfaces
2263 * const.cs: Use the underlying type for enumerations
2265 * delegate.cs: Compute the basename for the delegate creation,
2266 that should fix the delegate test case, and restore the correct
2267 Type Lookup semantics in rootcontext
2269 * rootcontext.cs: Revert Ravi's last patch. The correct way of
2270 referencing a nested type with the Reflection API is using the "+"
2273 * cs-parser.jay: Do not require EOF token at the end.
2275 2001-12-20 Ravi Pratap <ravi@ximian.com>
2277 * rootcontext.cs (LookupType): Concatenate type names with
2278 a '.' instead of a '+' The test suite passes again.
2280 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
2281 field of the enumeration.
2283 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
2284 the case when the member is an EventExpr.
2286 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
2287 static has an associated instance expression.
2289 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
2291 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
2293 * class.cs (Event.Define): Register event and perform appropriate checks
2296 We define the Add and Remove methods even if the use provides none because
2297 in that case, we provide default implementations ourselves.
2299 Define a private field of the type of the event. This is done by the CSC compiler
2300 and we should be doing it too ;-)
2302 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
2303 More methods we use in code we generate.
2305 (multicast_delegate_type, delegate_type): Two separate types since the distinction
2308 (InitCoreTypes): Update accordingly for the above.
2310 * class.cs (Event.Emit): Generate code for default accessors that we provide
2312 (EmitDefaultMethod): Do the job in the above.
2314 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
2317 2001-12-20 Miguel de Icaza <miguel@ximian.com>
2319 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
2320 builders even if we were missing one.
2322 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
2323 pass the Basename as our class name instead of the Name. The
2324 basename will be correctly composed for us.
2326 * parameter.cs (Paramters): Now takes a Location argument.
2328 * decl.cs (DeclSpace.LookupType): Removed convenience function and
2329 make all the code call directly LookupType in RootContext and take
2330 this chance to pass the Location information everywhere.
2332 * Everywhere: pass Location information.
2334 2001-12-19 Miguel de Icaza <miguel@ximian.com>
2336 * class.cs (Constructor.Define): Updated way of detecting the
2337 length of the parameters.
2339 (TypeContainer.DefineType): Use basename as the type name for
2342 (TypeContainer.Define): Do not recursively define types here, as
2343 definition is taken care in order by the RootContext.
2345 * tree.cs: Keep track of namespaces in a per-file basis.
2347 * parameter.cs (Parameter.ComputeSignature): Update to use
2350 (Parameters.GetSignature): ditto.
2352 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
2353 instead of a TypeContainer.
2355 (Interface.SemanticAnalysis): Use `this' instead of our parent to
2356 resolve names. Because we need to be resolve in our context, not
2359 * driver.cs: Implement response files.
2361 * class.cs (TypeContainer.DefineType): If we are defined, do not
2364 (Event.Emit): Emit the code for add/remove handlers.
2365 (Event.Define): Save the MethodBuilders for add/remove.
2367 * typemanager.cs: Use pair here too.
2369 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
2370 DictionaryEntry requires the first argument to be non-null.
2372 (enum_declaration): Compute full name for registering the
2375 (delegate_declaration): Instead of using
2376 formal_parameter_list, use opt_formal_parameter_list as the list
2379 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
2380 (EventParsing): New property that controls whether `add' and
2381 `remove' are returned as tokens or identifiers (for events);
2383 2001-12-19 Ravi Pratap <ravi@ximian.com>
2385 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
2386 use MyEventBuilder only and let it wrap the real builder for us.
2388 (MyEventBuilder): Revamp constructor etc.
2390 Implement all operations that we perform on EventBuilder in precisely the same
2393 (FindMembers): Update to use the EventBuilder member.
2395 (Event.Emit): Update accordingly.
2397 2001-12-18 Ravi Pratap <ravi@ximian.com>
2399 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
2400 by calling the appropriate methods.
2402 (GetCustomAttributes): Make stubs as they cannot possibly do anything
2405 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
2407 2001-12-17 Ravi Pratap <ravi@ximian.com>
2409 * delegate.cs (Delegate.Populate): Check that the return type
2410 and various parameters types are indeed accessible.
2412 * class.cs (Constructor.Define): Same here.
2414 (Field.Define): Ditto.
2416 (Event.Define): Ditto.
2418 (Operator.Define): Check that the underlying Method defined itself
2419 correctly - so it's MethodBuilder should not be null.
2421 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
2422 expression happens to be null.
2424 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
2425 members but as of now we don't seem to be able to do anything really useful with it.
2427 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
2428 not the EventBuilder.
2430 2001-12-18 Miguel de Icaza <miguel@ximian.com>
2432 * cs-tokenizer.cs: Add support for defines.
2433 Add support for #if, #elif, #else, #endif
2435 (eval_var): evaluates a variable.
2436 (eval): stubbed for evaluating functions.
2438 * cs-parser.jay: Pass the defines information
2440 * driver.cs: Add --define command line option.
2442 * decl.cs: Move MemberCore here.
2444 Make it the base class for DeclSpace. This allows us to catch and
2445 report 108 and 109 for everything now.
2447 * class.cs (TypeContainer.Define): Extract all the members
2448 before populating and emit the warning 108 (new keyword required
2449 to override) instead of having each member implement this.
2451 (MemberCore.Define): New abstract method, we will be using this in
2452 the warning reporting engine in Populate.
2454 (Operator.Define): Adjust to new MemberCore protocol.
2456 * const.cs (Const): This does not derive from Expression, it is a
2457 temporary object we use to create fields, it is a MemberCore.
2459 * class.cs (Method.Define): Allow the entry point to be in a
2462 * driver.cs: Rewrite the argument handler to clean it up a bit.
2464 * rootcontext.cs: Made it just an auxiliary namespace feature by
2465 making everything static.
2467 * driver.cs: Adapt code to use RootContext type name instead of
2470 * delegate.cs: Remove RootContext argument.
2472 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
2475 * class.cs (Event.Define): The lookup can fail.
2477 * cs-tokenizer.cs: Begin implementation of pre-procesor.
2479 * expression.cs: Resolve the this instance before invoking the code.
2481 2001-12-17 Miguel de Icaza <miguel@ximian.com>
2483 * cs-parser.jay: Add a production in element_access that allows
2484 the thing to become a "type" reference. This way we can parse
2485 things like "(string [])" as a type.
2487 Note that this still does not handle the more complex rules of
2491 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
2493 * ecore.cs: (CopyNewMethods): new utility function used to
2494 assemble the list of methods from running FindMembers.
2496 (MemberLookup): Rework FindMembers so that
2498 2001-12-16 Miguel de Icaza <miguel@ximian.com>
2500 * class.cs (TypeContainer): Remove Delegates who fail to be
2503 * delegate.cs (Populate): Verify that we dont get null return
2504 values. TODO: Check for AsAccessible.
2506 * cs-parser.jay: Use basename to emit error 574 (destructor should
2507 have the same name as container class), not the full name.
2509 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
2510 possible representation.
2512 Also implements integer type suffixes U and L.
2514 2001-12-15 Miguel de Icaza <miguel@ximian.com>
2516 * expression.cs (ArrayCreation.DoResolve): We need to do the
2517 argument resolution *always*.
2519 * decl.cs: Make this hold the namespace. Hold the root context as
2521 (LookupType): Move here.
2523 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
2525 * location.cs (Row, Name): Fixed the code, it was always returning
2526 references to the first file.
2528 * interface.cs: Register properties defined through interfaces.
2530 * driver.cs: Add support for globbing on the command line
2532 * class.cs (Field): Make it derive from MemberCore as well.
2535 2001-12-15 Ravi Pratap <ravi@ximian.com>
2537 * class.cs (Event::Define): Check that the type of the event is a delegate
2538 type else flag error #66.
2540 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
2543 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
2544 values of EntryPoint, CharSet etc etc.
2546 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
2548 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
2549 be null and we should ignore this. I am not sure if this is really clean. Apparently,
2550 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
2551 which needs this to do its work.
2553 * ../errors/cs0066.cs : Add.
2555 2001-12-14 Miguel de Icaza <miguel@ximian.com>
2557 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
2560 * class.cs: (MethodSignature.MethodSignature): Removed hack that
2561 clears out the parameters field.
2562 (MemberSignatureCompare): Cleanup
2564 (MemberCore): New base class used to share code between MethodCore
2567 (RegisterRequiredImplementations) BindingFlags.Public requires
2568 either BindingFlags.Instace or Static. Use instance here.
2570 (Property): Refactored code to cope better with the full spec.
2572 * parameter.cs (GetParameterInfo): Return an empty array instead
2575 * class.cs (Property): Abstract or extern properties have no bodies.
2577 * parameter.cs (GetParameterInfo): return a zero-sized array.
2579 * class.cs (TypeContainer.MethodModifiersValid): Move all the
2580 method modifier validation to the typecontainer so we can reuse
2583 (MethodCore.ParameterTypes): return an empty sized array of types.
2585 (Property.Define): Test property modifier validity.
2587 Add tests for sealed/override too.
2589 (Method.Emit): abstract or extern methods have no bodies.
2591 2001-12-14 Ravi Pratap <ravi@ximian.com>
2593 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
2596 (Method::Define, ::Emit): Modify accordingly.
2598 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
2600 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
2602 * makefile: Pass in /unsafe.
2604 2001-12-13 Miguel de Icaza <miguel@ximian.com>
2606 * class.cs (MakeKey): Kill routine.
2608 * class.cs (TypeContainer.Define): Correctly define explicit
2609 method implementations (they require the full interface name plus
2612 * typemanager.cs: Deply the PtrHashtable here and stop using the
2613 lame keys. Things work so much better.
2615 This of course broke everyone who depended on `RegisterMethod' to
2616 do the `test for existance' test. This has to be done elsewhere.
2618 * support.cs (PtrHashtable): A hashtable that avoid comparing with
2619 the object stupid Equals method (because, that like fails all over
2620 the place). We still do not use it.
2622 * class.cs (TypeContainer.SetRequiredInterface,
2623 TypeContainer.RequireMethods): Killed these two routines and moved
2624 all the functionality to RegisterRequiredImplementations.
2626 (TypeContainer.RegisterRequiredImplementations): This routine now
2627 registers all the implementations required in an array for the
2628 interfaces and abstract methods. We use an array of structures
2629 which can be computed ahead of time to reduce memory usage and we
2630 also assume that lookups are cheap as most classes will not
2631 implement too many interfaces.
2633 We also avoid creating too many MethodSignatures.
2635 (TypeContainer.IsInterfaceMethod): Update and optionally does not
2636 clear the "pending" bit if we find that there are problems with
2639 (TypeContainer.VerifyPendingMethods): Update to report errors of
2640 methods that look like implementations but are not.
2642 (TypeContainer.Define): Add support for explicit interface method
2645 2001-12-12 Miguel de Icaza <miguel@ximian.com>
2647 * typemanager.cs: Keep track of the parameters here instead of
2648 being a feature of the TypeContainer.
2650 * class.cs: Drop the registration of parameters here, as
2651 InterfaceMethods are also interface declarations.
2653 * delegate.cs: Register methods with the TypeManager not only with
2654 the TypeContainer. This code was buggy.
2656 * interface.cs: Full registation here.
2658 2001-12-11 Miguel de Icaza <miguel@ximian.com>
2660 * expression.cs: Remove reducer for binary expressions, it can not
2663 * const.cs: Put here the code that used to go into constant.cs
2665 * constant.cs: Put here the code for constants, this is a new base
2668 * literal.cs: Make Literal derive from Constant.
2670 2001-12-09 Miguel de Icaza <miguel@ximian.com>
2672 * statement.cs (Return.Emit): Report error 157 if the user
2673 attempts to return from a finally block.
2675 (Return.Emit): Instead of emitting a return, jump to the end of
2678 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
2679 LocalBuilder to store the result of the function. ReturnLabel is
2680 the target where we jump.
2683 2001-12-09 Radek Doulik <rodo@ximian.com>
2685 * cs-parser.jay: remember alias in current namespace
2687 * ecore.cs (SimpleName::DoResolve): use aliases for types or
2690 * class.cs (LookupAlias): lookup alias in my_namespace
2692 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
2694 (LookupAlias): lookup alias in this and if needed in parent
2697 2001-12-08 Miguel de Icaza <miguel@ximian.com>
2701 * rootcontext.cs: (ModuleBuilder) Made static, first step into
2702 making things static. I need this to avoid passing the
2703 TypeContainer when calling ParameterType.
2705 * support.cs (InternalParameters.ParameterType): Remove ugly hack
2706 that did string manipulation to compute the type and then call
2707 GetType. Use Parameter.ParameterType instead.
2709 * cs-tokenizer.cs: Consume the suffix for floating values.
2711 * expression.cs (ParameterReference): figure out whether this is a
2712 reference parameter or not. Kill an extra variable by computing
2713 the arg_idx during emission.
2715 * parameter.cs (Parameters.GetParameterInfo): New overloaded
2716 function that returns whether a parameter is an out/ref value or not.
2718 (Parameter.ParameterType): The type of the parameter (base,
2719 without ref/out applied).
2721 (Parameter.Resolve): Perform resolution here.
2722 (Parameter.ExternalType): The full type (with ref/out applied).
2724 * statement.cs (Using.Emit, Using.EmitExpression): Implement
2725 support for expressions on the using statement.
2727 2001-12-07 Miguel de Icaza <miguel@ximian.com>
2729 * statement.cs (Using.EmitLocalVariableDecls): Split the
2730 localvariable handling of the using statement.
2732 (Block.EmitMeta): Keep track of variable count across blocks. We
2733 were reusing slots on separate branches of blocks.
2735 (Try.Emit): Emit the general code block, we were not emitting it.
2737 Check the type of the declaration to be an IDisposable or
2738 something that can be implicity converted to it.
2740 Emit conversions if required.
2742 * ecore.cs (EmptyExpression): New utility class.
2743 (Expression.ImplicitConversionExists): New utility function.
2745 2001-12-06 Miguel de Icaza <miguel@ximian.com>
2747 * statement.cs (Using): Implement.
2749 * expression.cs (LocalVariableReference): Support read only variables.
2751 * statement.cs: Remove the explicit emit for the Leave opcode.
2752 (VariableInfo): Add a readonly field.
2754 2001-12-05 Miguel de Icaza <miguel@ximian.com>
2756 * ecore.cs (ConvCast): new class used to encapsulate the various
2757 explicit integer conversions that works in both checked and
2760 (Expression.ConvertNumericExplicit): Use new ConvCast class to
2761 properly generate the overflow opcodes.
2763 2001-12-04 Miguel de Icaza <miguel@ximian.com>
2765 * statement.cs: The correct type for the EmptyExpression is the
2766 element_type, not the variable type. Ravi pointed this out.
2768 2001-12-04 Ravi Pratap <ravi@ximian.com>
2770 * class.cs (Method::Define): Handle PInvoke methods specially
2771 by using DefinePInvokeMethod instead of the usual one.
2773 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
2774 above to do the task of extracting information and defining the method.
2776 2001-12-04 Ravi Pratap <ravi@ximian.com>
2778 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
2779 of the condition for string type.
2781 (Emit): Move that here.
2783 (ArrayCreation::CheckIndices): Keep string literals in their expression
2786 (EmitDynamicInitializers): Handle strings appropriately.
2788 2001-12-04 Miguel de Icaza <miguel@ximian.com>
2790 * codegen.cs (EmitContext): Replace multiple variables with a
2791 single pointer to the current Switch statement.
2793 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
2796 2001-12-03 Miguel de Icaza <miguel@ximian.com>
2800 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
2803 (Foreach.Emit): Foreach on arrays was not setting
2804 up the loop variables (for break/continue).
2806 (GotoCase): Semi-implented.
2808 2001-12-03 Ravi Pratap <ravi@ximian.com>
2810 * attribute.cs (CheckAttribute): Handle system attributes by using
2811 Attribute.GetAttributes to examine information we need.
2813 (GetValidPlaces): Same here.
2815 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
2817 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
2819 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
2821 (Method::Define): Set appropriate flags if we have a DllImport attribute.
2823 (Method::Emit): Handle the case when we are a PInvoke method.
2825 2001-12-03 Miguel de Icaza <miguel@ximian.com>
2827 * expression.cs: Use ResolveWithSimpleName on compound names.
2829 2001-12-02 Ravi Pratap <ravi@ximian.com>
2831 * constant.cs (EmitConstant): Make sure we resolve the associated expression
2832 before trying to reduce it.
2834 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
2836 * constant.cs (LookupConstantValue): Implement.
2838 (EmitConstant): Use the above in emitting the constant.
2840 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
2841 that are user-defined by doing a LookupConstantValue on them.
2843 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
2846 2001-11-29 Miguel de Icaza <miguel@ximian.com>
2848 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
2850 (BaseAccess.DoResolve): Implement.
2852 (MemberAccess.DoResolve): Split this routine into a
2853 ResolveMemberAccess routine that can be used independently
2855 2001-11-28 Miguel de Icaza <miguel@ximian.com>
2857 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
2858 As that share bits of the implementation. Is returns a boolean,
2859 while As returns the Type that is being probed.
2861 2001-12-01 Ravi Pratap <ravi@ximian.com>
2863 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
2864 instead of a Literal - much easier.
2866 (EnumInTransit): Remove - utterly useless :-)
2868 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
2870 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
2872 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
2873 chain when we have no associated expression.
2875 2001-11-30 Ravi Pratap <ravi@ximian.com>
2877 * constant.cs (Define): Use Location while reporting the errror.
2879 Also emit a warning when 'new' is used and there is no inherited
2882 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
2885 (LookupEnumValue): Implement to lookup an enum member's value and define it
2888 (Populate): Re-write accordingly to use the above routine.
2890 2001-11-27 Miguel de Icaza <miguel@ximian.com>
2892 * expression.cs (This): Fix prototype for DoResolveLValue to
2893 override the base class DoResolveLValue.
2895 * cs-parser.cs: Report errors cs574 and cs575 (destructor
2898 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
2899 (we need to load the address of the field here). This fixes
2902 (FieldExpr.DoResolveLValue): Call the DoResolve
2903 function to initialize the Instance expression.
2905 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
2906 correctly the GetEnumerator operation on a value type.
2908 * cs-parser.jay: Add more simple parsing error catches.
2910 * statement.cs (Switch): Add support for string switches.
2911 Handle null specially.
2913 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
2915 2001-11-28 Ravi Pratap <ravi@ximian.com>
2917 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
2919 (declare_local_constant): New helper function.
2921 * statement.cs (AddConstant): Keep a separate record of constants
2923 (IsConstant): Implement to determine if a variable is a constant.
2925 (GetConstantExpression): Implement.
2927 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
2929 * statement.cs (IsVariableDefined): Re-write.
2931 2001-11-27 Ravi Pratap <ravi@ximian.com>
2933 * class.cs (TypeContainer::FindMembers): Look for constants
2934 in the case when we are looking for MemberTypes.Field
2936 * expression.cs (MemberAccess::DoResolve): Check that in the
2937 case we are a FieldExpr and a Literal, we are not being accessed
2938 by an instance reference.
2940 * cs-parser.jay (local_constant_declaration): Implement.
2942 (declaration_statement): Implement for constant declarations.
2944 2001-11-26 Miguel de Icaza <miguel@ximian.com>
2946 * statement.cs (Switch): Catch double defaults.
2948 (Switch): More work on the switch() statement
2949 implementation. It works for integral values now, need to finish
2953 2001-11-24 Miguel de Icaza <miguel@ximian.com>
2955 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
2956 integer literals into other integer literals. To be used by
2959 2001-11-24 Ravi Pratap <ravi@ximian.com>
2961 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
2964 (EmitDynamicInitializers): Cope with the above since we extract data
2965 directly from ArrayData now.
2967 (ExpectInitializers): Keep track of whether initializers are mandatory
2970 (Bounds): Make it a hashtable to prevent the same dimension being
2971 recorded for every element in that dimension.
2973 (EmitDynamicInitializers): Fix bug which prevented the Set array method
2976 Also fix bug which was causing the indices to be emitted in the reverse
2979 2001-11-24 Miguel de Icaza <miguel@ximian.com>
2981 * expression.cs (ArrayCreation): Implement the bits that Ravi left
2982 unfinished. They do not work, because the underlying code is
2985 2001-11-22 Miguel de Icaza <miguel@ximian.com>
2987 * cs-parser.jay: Remove bogus fixme.
2989 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
2990 on Switch statement.
2992 2001-11-23 Ravi Pratap <ravi@ximian.com>
2994 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
2997 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
2998 parameter. Apparently, any expression is allowed.
3000 (ValidateInitializers): Update accordingly.
3002 (CheckIndices): Fix some tricky bugs thanks to recursion.
3004 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
3005 I was being completely brain-dead.
3007 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
3008 and re-write acordingly.
3010 (DelegateInvocation): Re-write accordingly.
3012 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
3014 (MakeByteBlob): Handle types more correctly.
3016 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
3017 initialization from expressions but it is incomplete because I am a complete
3020 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3022 * statement.cs (If.Emit): Fix a bug that generated incorrect code
3023 on If. Basically, we have to return `true' (ie, we do return to
3024 our caller) only if both branches of the if return.
3026 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
3027 short-circuit operators, handle them as short circuit operators.
3029 (Cast.DoResolve): Resolve type.
3030 (Cast.Cast): Take an expression as the target type.
3032 * cs-parser.jay (cast_expression): Remove old hack that only
3033 allowed a limited set of types to be handled. Now we take a
3034 unary_expression and we resolve to a type during semantic
3037 Use the grammar productions from Rhys to handle casts (this is
3038 not complete like Rhys syntax yet, we fail to handle that corner
3039 case that C# has regarding (-x), but we will get there.
3041 2001-11-22 Ravi Pratap <ravi@ximian.com>
3043 * class.cs (EmitFieldInitializer): Take care of the case when we have a
3044 field which is an array type.
3046 * cs-parser.jay (declare_local_variables): Support array initialization too.
3048 * typemanager.cs (MakeKey): Implement.
3050 (everywhere): Use the above appropriately.
3052 * cs-parser.jay (for_statement): Update for array initialization while
3053 declaring variables.
3055 * ecore.cs : The error message was correct, it's the variable's names that
3056 were misleading ;-) Make the code more readable.
3058 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
3059 the correct type etc.
3061 (ConvertExplicit): Handle Enum types by examining the underlying type.
3063 2001-11-21 Ravi Pratap <ravi@ximian.com>
3065 * parameter.cs (GetCallingConvention): Always return
3066 CallingConventions.Standard for now.
3068 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3070 * expression.cs (Binary.ResolveOperator): Update the values of `l'
3071 and `r' after calling DoNumericPromotions.
3073 * ecore.cs: Fix error message (the types were in the wrong order).
3075 * statement.cs (Foreach.ProbeCollectionType): Need to pass
3076 BindingFlags.Instance as well
3078 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
3079 implicit int literal conversion in an empty cast so that we
3080 propagate the right type upstream.
3082 (UnboxCast): new class used to unbox value types.
3083 (Expression.ConvertExplicit): Add explicit type conversions done
3086 (Expression.ImplicitNumericConversion): Oops, forgot to test for
3087 the target type before applying the implicit LongLiterals to ULong
3090 2001-11-21 Miguel de Icaza <miguel@ximian.com>
3092 * cs-parser.jay (for_statement): Reworked the way For works: now
3093 we declare manually any variables that are introduced in
3094 for_initializer to solve the problem of having out-of-band code
3095 emition (that is what got for broken).
3097 (declaration_statement): Perform the actual variable declaration
3098 that used to be done in local_variable_declaration here.
3100 (local_variable_declaration): Do not declare anything, just pass
3101 the information on a DictionaryEntry
3103 2001-11-20 Ravi Pratap <ravi@ximian.com>
3105 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
3106 re-write of the logic to now make it recursive.
3108 (UpdateIndices): Re-write accordingly.
3110 Store element data in a separate ArrayData list in the above methods.
3112 (MakeByteBlob): Implement to dump the array data into a byte array.
3114 2001-11-19 Ravi Pratap <ravi@ximian.com>
3116 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
3119 * constant.cs (Define): Implement.
3121 (EmitConstant): Re-write fully.
3123 Pass in location info.
3125 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
3128 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
3129 DictionaryEntry since we need location info too.
3131 (constant_declaration): Update accordingly.
3133 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
3134 code into another method : UpdateIndices.
3136 2001-11-18 Ravi Pratap <ravi@ximian.com>
3138 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
3139 some type checking etc.
3141 2001-11-17 Ravi Pratap <ravi@ximian.com>
3143 * expression.cs (ArrayCreation::ValidateInitializers): Implement
3144 bits to provide dimension info if the user skips doing that.
3146 Update second constructor to store the rank correctly.
3148 2001-11-16 Ravi Pratap <ravi@ximian.com>
3150 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
3151 and try to implement.
3153 * ../errors/cs0150.cs : Add.
3155 * ../errors/cs0178.cs : Add.
3157 2001-11-16 Miguel de Icaza <miguel@ximian.com>
3159 * statement.cs: Implement foreach on multi-dimensional arrays.
3161 * parameter.cs (Parameters.GetParameterByName): Also lookup the
3162 name of the params argument.
3164 * expression.cs: Use EmitStoreOpcode to get the right opcode while
3165 initializing the array.
3167 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
3168 we can use this elsewhere.
3170 * statement.cs: Finish implementation of foreach for single
3173 * cs-parser.jay: Use an out-of-band stack to pass information
3174 around, I wonder why I need this.
3176 foreach_block: Make the new foreach_block the current_block.
3178 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
3179 function used to return a static Parameters structure. Used for
3180 empty parameters, as those are created very frequently.
3182 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
3184 2001-11-15 Ravi Pratap <ravi@ximian.com>
3186 * interface.cs : Default modifier is private, not public. The
3187 make verify test passes again.
3189 2001-11-15 Ravi Pratap <ravi@ximian.com>
3191 * support.cs (ReflectionParameters): Fix logic to determine
3192 whether the last parameter is a params one. Test 9 passes again.
3194 * delegate.cs (Populate): Register the builders we define with
3195 RegisterParameterForBuilder. Test 19 passes again.
3197 * cs-parser.jay (property_declaration): Reference $6 instead
3198 of $$ to get at the location.
3200 (indexer_declaration): Similar stuff.
3204 * class.cs (Property): Register parameters for the Get and Set methods
3205 if they exist. Test 23 passes again.
3207 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
3208 call to EmitArguments as we are sure there aren't any params arguments.
3209 Test 32 passes again.
3211 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
3212 IndexOutOfRangeException.
3214 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
3215 Test 33 now passes again.
3217 2001-11-15 Miguel de Icaza <miguel@ximian.com>
3219 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
3220 broke a bunch of things. Will have to come up with a better way
3221 of tracking locations.
3223 * statement.cs: Implemented foreach for single dimension arrays.
3225 2001-11-09 Miguel de Icaza <miguel@ximian.com>
3227 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
3228 an error. This removes the lookup from the critical path.
3230 * cs-parser.jay: Removed use of temporary_loc, which is completely
3233 2001-11-14 Miguel de Icaza <miguel@ximian.com>
3235 * support.cs (ReflectionParameters.ParameterModifier): Report
3236 whether the argument is a PARAMS argument or not.
3238 * class.cs: Set the attribute `ParamArrayAttribute' on the
3241 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
3242 and cons_param_array_attribute (ConstructorInfo for
3243 ParamArrayAttribute).,
3245 * codegen.cs: Emit the return using the `Return' statement, that
3246 way we can report the error correctly for missing return values.
3248 * class.cs (Method.Emit): Clean up.
3250 * expression.cs (Argument.Resolve): Take another argument: the
3251 location where this argument is used. Notice that this is not
3252 part of the "Argument" class as to reduce the size of the
3253 structure (we know the approximate location anyways).
3255 Test if the argument is a variable-reference, if not, then
3256 complain with a 206.
3258 (Argument.Emit): Emit addresses of variables.
3260 (Argument.FullDesc): Simplify.
3262 (Invocation.DoResolve): Update for Argument.Resolve.
3264 (ElementAccess.DoResolve): ditto.
3266 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
3267 method should be virtual, as this method is always virtual.
3269 (NewDelegate.DoResolve): Update for Argument.Resolve.
3271 * class.cs (ConstructorInitializer.DoResolve): ditto.
3273 * attribute.cs (Attribute.Resolve): ditto.
3275 2001-11-13 Miguel de Icaza <miguel@ximian.com>
3277 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
3279 * expression.cs (ParameterReference): Drop IStackStorage and implement
3280 IAssignMethod instead.
3282 (LocalVariableReference): ditto.
3284 * ecore.cs (FieldExpr): Drop IStackStorage and implement
3285 IAssignMethod instead.
3287 2001-11-13 Miguel de Icaza <miguel@ximian.com>
3289 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
3290 enumerations that are used in heavily used structures derive from
3291 byte in a laughable and pathetic attempt to reduce memory usage.
3292 This is the kind of pre-optimzations that you should not do at
3293 home without adult supervision.
3295 * expression.cs (UnaryMutator): New class, used to handle ++ and
3296 -- separatedly from the other unary operators. Cleans up the
3297 code, and kills the ExpressionStatement dependency in Unary.
3299 (Unary): Removed `method' and `Arguments' from this class, making
3300 it smaller, and moving it all to SimpleCall, so I can reuse this
3301 code in other locations and avoid creating a lot of transient data
3302 strucutres when not required.
3304 * cs-parser.jay: Adjust for new changes.
3306 2001-11-11 Miguel de Icaza <miguel@ximian.com>
3308 * enum.cs (Enum.Populate): If there is a failure during
3311 * cs-parser.jay (opt_enum_base): we used to catch type errors
3312 here, but this is really incorrect. The type error should be
3313 catched during semantic analysis.
3315 2001-12-11 Ravi Pratap <ravi@ximian.com>
3317 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
3318 current_local_parameters as expected since I, in my stupidity, had forgotten
3321 * attribute.cs (GetValidPlaces): Fix stupid bug.
3323 * class.cs (Method::Emit): Perform check on applicability of attributes.
3325 (Constructor::Emit): Ditto.
3327 (Field::Emit): Ditto.
3329 (Field.Location): Store location information.
3331 (Property, Event, Indexer, Operator): Ditto.
3333 * cs-parser.jay (field_declaration): Pass in location for each field.
3335 * ../errors/cs0592.cs : Add.
3337 2001-11-12 Ravi Pratap <ravi@ximian.com>
3339 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
3341 (InitCoreTypes): Update accordingly.
3343 (RegisterAttrType, LookupAttr): Implement.
3345 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
3346 info about the same.
3348 (Resolve): Update to populate the above as necessary.
3352 (GetValidPlaces): Helper to the above.
3354 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
3356 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
3358 2001-11-12 Ravi Pratap <ravi@ximian.com>
3360 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
3362 * ../errors/cs0617.cs : Add.
3364 2001-11-11 Ravi Pratap <ravi@ximian.com>
3366 * enum.cs (Emit): Rename to Populate to be more consistent with what
3367 we expect it to do and when exactly it is called.
3369 * class.cs, rootcontext.cs : Update accordingly.
3371 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
3372 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
3374 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
3376 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
3377 of a fieldinfo using the above, when dealing with a FieldBuilder.
3379 2001-11-10 Ravi Pratap <ravi@ximian.com>
3381 * ../errors/cs0031.cs : Add.
3383 * ../errors/cs1008.cs : Add.
3385 * ../errrors/cs0543.cs : Add.
3387 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
3390 (FindMembers): Implement.
3392 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
3393 enums and delegates too.
3395 (enum_types): Rename to builder_to_enum.
3397 (delegate_types): Rename to builder_to_delegate.
3399 * delegate.cs (FindMembers): Implement.
3401 2001-11-09 Ravi Pratap <ravi@ximian.com>
3403 * typemanager.cs (IsEnumType): Implement.
3405 * enum.cs (Emit): Re-write parts to account for the underlying type
3406 better and perform checking etc.
3408 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
3409 of the underlying type.
3411 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
3414 * enum.cs (error31): Helper to report error #31.
3416 * cs-parser.jay (enum_declaration): Store location of each member too.
3418 * enum.cs (member_to_location): New hashtable.
3420 (AddEnumMember): Update location hashtable.
3422 (Emit): Use the location of each member while reporting errors.
3424 2001-11-09 Miguel de Icaza <miguel@ximian.com>
3426 * cs-parser.jay: A for_initializer if is a
3427 local_variable_declaration really ammount to have an implicit
3428 block with the variable declaration and no initializer for for.
3430 * statement.cs (For.Emit): Cope with null initializers.
3432 This fixes the infinite loop on for initializers.
3434 2001-11-08 Miguel de Icaza <miguel@ximian.com>
3436 * enum.cs: More cleanup.
3438 * ecore.cs: Remove dead code.
3440 * class.cs (Property.Emit): More simplification.
3441 (Event.Emit): ditto.
3443 Reworked to have less levels of indentation.
3445 2001-11-08 Ravi Pratap <ravi@ximian.com>
3447 * class.cs (Property): Emit attributes.
3457 * enum.cs (Emit): Ditto.
3459 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
3462 * class.cs (Field, Event, etc.): Move attribute generation into the
3463 Emit method everywhere.
3465 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
3466 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
3467 as we had no way of defining nested enums !
3469 * rootcontext.cs : Adjust code accordingly.
3471 * typemanager.cs (AddEnumType): To keep track of enum types separately.
3473 2001-11-07 Ravi Pratap <ravi@ximian.com>
3475 * expression.cs (EvalConstantExpression): Move into ecore.cs
3477 * enum.cs (Enum): Rename some members and make them public and readonly
3478 according to our convention.
3480 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
3483 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
3485 (Enum::Emit): Write a simple version for now which doesn't try to compute
3486 expressions. I shall modify this to be more robust in just a while.
3488 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
3490 (TypeContainer::CloseType): Create the Enum types too.
3492 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
3494 * expression.cs (EvalConstantExpression): Get rid of completely.
3496 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
3497 user-defined values and other cases.
3499 (IsValidEnumLiteral): Helper function.
3501 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
3502 out there in the case we had a literal FieldExpr.
3504 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
3506 (Literalize): Revamp a bit to take two arguments.
3508 (EnumLiteral): New class which derives from Literal to wrap enum literals.
3510 2001-11-06 Ravi Pratap <ravi@ximian.com>
3512 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
3514 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
3516 (Resolve): Use the above to ensure we have proper initializers.
3518 2001-11-05 Ravi Pratap <ravi@ximian.com>
3520 * expression.cs (Expression::EvalConstantExpression): New method to
3521 evaluate constant expressions.
3523 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
3525 2001-11-07 Miguel de Icaza <miguel@ximian.com>
3527 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
3530 (Binary.ResolveOperator): Handle operator != (object a, object b)
3531 and operator == (object a, object b);
3533 (Binary.DoNumericPromotions): Indicate whether the numeric
3534 promotion was possible.
3536 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
3539 Made the ArrayAccess implement interface IAssignMethod instead of
3540 IStackStore as the order in which arguments are passed reflects
3543 * assign.cs: Instead of using expr.ExprClass to select the way of
3544 assinging, probe for the IStackStore/IAssignMethod interfaces.
3546 * typemanager.cs: Load InitializeArray definition.
3548 * rootcontext.cs (RootContext.MakeStaticData): Used to define
3549 static data that can be used to initialize arrays.
3551 2001-11-05 Miguel de Icaza <miguel@ximian.com>
3553 * expression.cs: Handle operator== and operator!= for booleans.
3555 (Conditioal.Reduce): Implement reducer for the ?: operator.
3557 (Conditional.Resolve): Implement dead code elimination.
3559 (Binary.Resolve): Catch string literals and return a new
3560 concatenated string.
3562 (Unary.Reduce): Implement reduction of unary expressions.
3564 * ecore.cs: Split out the expression core handling here.
3566 (Expression.Reduce): New method used to perform constant folding
3567 and CSE. This is needed to support constant-expressions.
3569 * statement.cs (Statement.EmitBoolExpression): Pass true and false
3570 targets, and optimize for !x.
3572 2001-11-04 Ravi Pratap <ravi@ximian.com>
3574 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
3575 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
3576 set custom atttributes.
3578 * literal.cs (Literal::GetValue): New abstract method to return the actual
3579 value of the literal, cast as an object.
3581 (*Literal): Implement GetValue method.
3583 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
3584 expressions to the arraylist but objects of type Argument.
3586 * class.cs (TypeContainer::Emit): Emit our attributes too.
3588 (Method::Emit, Constructor::Emit): Ditto.
3590 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
3591 to be ignoring earlier.
3593 2001-11-03 Ravi Pratap <ravi@ximian.com>
3595 * attribute.cs (AttributeSection::Define): Implement to do the business
3596 of constructing a CustomAttributeBuilder.
3598 (Attribute): New trivial class. Increases readability of code.
3600 * cs-parser.jay : Update accordingly.
3602 (positional_argument_list, named_argument_list, named_argument): New rules
3604 (attribute_arguments): Use the above so that we are more correct.
3606 2001-11-02 Ravi Pratap <ravi@ximian.com>
3608 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
3609 to perform all checks for a method with a params parameter.
3611 (Invocation::OverloadResolve): Update to use the above method and therefore
3612 cope correctly with params method invocations.
3614 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
3617 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
3618 constructors in our parent too because we can't afford to miss out on
3621 * attribute.cs (AttributeSection): New name for the class Attribute
3623 Other trivial changes to improve readability.
3625 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
3626 use the new class names.
3628 2001-11-01 Ravi Pratap <ravi@ximian.com>
3630 * class.cs (Method::Define): Complete definition for params types too
3632 (Indexer::Define): Ditto.
3634 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
3635 Cope everywhere with a request for info about the array parameter.
3637 2001-11-01 Ravi Pratap <ravi@ximian.com>
3639 * tree.cs (RecordNamespace): Fix up to check for the correct key.
3641 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
3642 local_variable_type to extract the string corresponding to the type.
3644 (local_variable_type): Fixup the action to use the new helper method.
3646 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
3649 * expression.cs : Clean out code which uses the above.
3651 2001-10-31 Ravi Pratap <ravi@ximian.com>
3653 * typemanager.cs (RegisterMethod): Check if we already have an existing key
3654 and bale out if necessary by returning a false.
3656 (RegisterProperty): Ditto.
3658 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
3659 and print out appropriate error messages.
3661 * interface.cs (everywhere): Ditto.
3663 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
3664 location to constructor.
3666 * class.cs (Property, Event, Indexer): Update accordingly.
3668 * ../errors/cs111.cs : Added.
3670 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
3671 of a method, as laid down by the spec.
3673 (Invocation::OverloadResolve): Use the above method.
3675 2001-10-31 Ravi Pratap <ravi@ximian.com>
3677 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
3678 now take a TypeContainer and a Parameters object.
3680 (ParameterData): Modify return type of ParameterModifier method to be
3681 Parameter.Modifier and not a string.
3683 (ReflectionParameters, InternalParameters): Update accordingly.
3685 * expression.cs (Argument::GetParameterModifier): Same here.
3687 * support.cs (InternalParameters::ParameterType): Find a better way of determining
3688 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
3689 symbol in it at all so maybe this is only for now.
3691 2001-10-30 Ravi Pratap <ravi@ximian.com>
3693 * support.cs (InternalParameters): Constructor now takes an extra argument
3694 which is the actual Parameters class.
3696 (ParameterDesc): Update to provide info on ref/out modifiers.
3698 * class.cs (everywhere): Update call to InternalParameters to pass in
3699 the second argument too.
3701 * support.cs (ParameterData): Add ParameterModifier, which is a method
3702 to return the modifier info [ref/out etc]
3704 (InternalParameters, ReflectionParameters): Implement the above.
3706 * expression.cs (Argument::ParameterModifier): Similar function to return
3707 info about the argument's modifiers.
3709 (Invocation::OverloadResolve): Update to take into account matching modifiers
3712 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
3713 a new SetFormalParameters object which we pass to InternalParameters.
3715 2001-10-30 Ravi Pratap <ravi@ximian.com>
3717 * expression.cs (NewArray): Merge into the ArrayCreation class.
3719 2001-10-29 Ravi Pratap <ravi@ximian.com>
3721 * expression.cs (NewArray): Merge classes NewBuiltinArray and
3722 NewUserdefinedArray into one as there wasn't much of a use in having
3725 * expression.cs (Argument): Change field's name to ArgType from Type.
3727 (Type): New readonly property which returns the proper type, taking into
3728 account ref/out modifiers.
3730 (everywhere): Adjust code accordingly for the above.
3732 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
3733 whether we are emitting for a ref or out parameter.
3735 * expression.cs (Argument::Emit): Use the above field to set the state.
3737 (LocalVariableReference::Emit): Update to honour the flag and emit the
3740 * parameter.cs (Attributes): Set the correct flags for ref parameters.
3742 * expression.cs (Argument::FullDesc): New function to provide a full desc.
3744 * support.cs (ParameterData): Add method ParameterDesc to the interface.
3746 (ReflectionParameters, InternalParameters): Implement the above method.
3748 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
3751 (Invocation::FullMethodDesc): Ditto.
3753 2001-10-29 Miguel de Icaza <miguel@ximian.com>
3755 * cs-parser.jay: Add extra production for the second form of array
3758 * expression.cs (ArrayCreation): Update to reflect the above
3761 * Small changes to prepare for Array initialization.
3763 2001-10-28 Miguel de Icaza <miguel@ximian.com>
3765 * typemanager.cs (ImplementsInterface): interface might be null;
3766 Deal with this problem;
3768 Also, we do store negative hits on the cache (null values), so use
3769 this instead of calling t.GetInterfaces on the type everytime.
3771 2001-10-28 Ravi Pratap <ravi@ximian.com>
3773 * typemanager.cs (IsBuiltinType): New method to help determine the same.
3775 * expression.cs (New::DoResolve): Get rid of array creation code and instead
3776 split functionality out into different classes.
3778 (New::FormArrayType): Move into NewBuiltinArray.
3780 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
3783 (NewBuiltinArray): New class to handle creation of built-in arrays.
3785 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
3786 account creation of one-dimensional arrays.
3788 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
3790 (NewUserdefinedArray::DoResolve): Implement.
3792 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
3794 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
3795 we maintain inside the TypeManager. This is necessary to perform lookups on the
3798 (LookupType): Update to perform GetType on the module builders too.
3800 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
3802 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
3804 2001-10-23 Ravi Pratap <ravi@ximian.com>
3806 * expression.cs (New::DoResolve): Implement guts of array creation.
3808 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
3810 2001-10-27 Miguel de Icaza <miguel@ximian.com>
3812 * expression.cs: Fix bug I introduced lsat night that broke
3815 (Expression.Resolve): Report a 246 error (can not resolve name)
3816 if we find a SimpleName in the stream.
3818 (Expression.ResolveLValue): Ditto.
3820 (Expression.ResolveWithSimpleName): This function is a variant of
3821 ResolveName, this one allows SimpleNames to be returned without a
3822 warning. The only consumer of SimpleNames is MemberAccess
3824 2001-10-26 Miguel de Icaza <miguel@ximian.com>
3826 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
3827 might arrive here. I have my doubts that this is correct.
3829 * statement.cs (Lock): Implement lock statement.
3831 * cs-parser.jay: Small fixes to support `lock' and `using'
3833 * cs-tokenizer.cs: Remove extra space
3835 * driver.cs: New flag --checked, allows to turn on integer math
3838 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
3839 Threading.Monitor.Exit
3841 2001-10-23 Miguel de Icaza <miguel@ximian.com>
3843 * expression.cs (IndexerAccess::DoResolveLValue): Set the
3844 Expression Class to be IndexerAccess.
3846 Notice that Indexer::DoResolve sets the eclass to Value.
3848 2001-10-22 Miguel de Icaza <miguel@ximian.com>
3850 * class.cs (TypeContainer::Emit): Emit code for indexers.
3852 * assign.cs (IAssignMethod): New interface implemented by Indexers
3853 and Properties for handling assignment.
3855 (Assign::Emit): Simplify and reuse code.
3857 * expression.cs (IndexerAccess, PropertyExpr): Implement
3858 IAssignMethod, clean up old code.
3860 2001-10-22 Ravi Pratap <ravi@ximian.com>
3862 * typemanager.cs (ImplementsInterface): New method to determine if a type
3863 implements a given interface. Provides a nice cache too.
3865 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
3868 (ConvertReferenceExplicit): Ditto.
3870 * delegate.cs (Delegate::Populate): Update to define the parameters on the
3871 various methods, with correct names etc.
3873 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
3874 Operator.UnaryNegation.
3876 * cs-parser.jay (operator_declarator): Be a little clever in the case where
3877 we have a unary plus or minus operator.
3879 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
3882 * everywhere : update accordingly.
3884 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
3887 * class.cs (Method::Define): For the case where we are implementing a method
3888 inherited from an interface, we need to set the MethodAttributes.Final flag too.
3889 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
3891 2001-10-21 Ravi Pratap <ravi@ximian.com>
3893 * interface.cs (FindMembers): Implement to work around S.R.E
3896 * typemanager.cs (IsInterfaceType): Implement.
3898 (FindMembers): Update to handle interface types too.
3900 * expression.cs (ImplicitReferenceConversion): Re-write bits which
3901 use IsAssignableFrom as that is not correct - it doesn't work.
3903 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
3904 and accordingly override EmitStatement.
3906 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
3907 using the correct logic :-)
3909 2001-10-19 Ravi Pratap <ravi@ximian.com>
3911 * ../errors/cs-11.cs : Add to demonstrate error -11
3913 2001-10-17 Miguel de Icaza <miguel@ximian.com>
3915 * assign.cs (Assign::Resolve): Resolve right hand side first, and
3916 then pass this as a hint to ResolveLValue.
3918 * expression.cs (FieldExpr): Add Location information
3920 (FieldExpr::LValueResolve): Report assignment to readonly
3923 (Expression::ExprClassFromMemberInfo): Pass location information.
3925 (Expression::ResolveLValue): Add new method that resolves an
3928 (Expression::DoResolveLValue): Default invocation calls
3931 (Indexers): New class used to keep track of indexers in a given
3934 (IStackStore): Renamed from LValue, as it did not really describe
3935 what this did. Also ResolveLValue is gone from this interface and
3936 now is part of Expression.
3938 (ElementAccess): Depending on the element access type
3940 * typemanager.cs: Add `indexer_name_type' as a Core type
3941 (System.Runtime.CompilerServices.IndexerNameAttribute)
3943 * statement.cs (Goto): Take a location.
3945 2001-10-18 Ravi Pratap <ravi@ximian.com>
3947 * delegate.cs (Delegate::VerifyDelegate): New method to verify
3948 if two delegates are compatible.
3950 (NewDelegate::DoResolve): Update to take care of the case when
3951 we instantiate a delegate from another delegate.
3953 * typemanager.cs (FindMembers): Don't even try to look up members
3954 of Delegate types for now.
3956 2001-10-18 Ravi Pratap <ravi@ximian.com>
3958 * delegate.cs (NewDelegate): New class to take care of delegate
3961 * expression.cs (New): Split the delegate related code out into
3962 the NewDelegate class.
3964 * delegate.cs (DelegateInvocation): New class to handle delegate
3967 * expression.cs (Invocation): Split out delegate related code into
3968 the DelegateInvocation class.
3970 2001-10-17 Ravi Pratap <ravi@ximian.com>
3972 * expression.cs (New::DoResolve): Implement delegate creation fully
3973 and according to the spec.
3975 (New::DoEmit): Update to handle delegates differently.
3977 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
3978 because of which we were printing out arguments in reverse order !
3980 * delegate.cs (VerifyMethod): Implement to check if the given method
3981 matches the delegate.
3983 (FullDelegateDesc): Implement.
3985 (VerifyApplicability): Implement.
3987 * expression.cs (Invocation::DoResolve): Update to accordingly handle
3988 delegate invocations too.
3990 (Invocation::Emit): Ditto.
3992 * ../errors/cs1593.cs : Added.
3994 * ../errors/cs1594.cs : Added.
3996 * delegate.cs (InstanceExpression, TargetMethod): New properties.
3998 2001-10-16 Ravi Pratap <ravi@ximian.com>
4000 * typemanager.cs (intptr_type): Core type for System.IntPtr
4002 (InitCoreTypes): Update for the same.
4004 (iasyncresult_type, asynccallback_type): Ditto.
4006 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
4009 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
4012 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
4013 the builders for the 4 members of a delegate type :-)
4015 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
4018 * expression.cs (New::DoResolve): Implement guts for delegate creation.
4020 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
4022 2001-10-15 Miguel de Icaza <miguel@ximian.com>
4024 * statement.cs (Break::Emit): Implement.
4025 (Continue::Emit): Implement.
4027 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
4028 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
4029 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
4030 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
4033 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
4034 properties that track the label for the current loop (begin of the
4035 loop and end of the loop).
4037 2001-10-15 Ravi Pratap <ravi@ximian.com>
4039 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
4040 use of emitting anything at all.
4042 * class.cs, rootcontext.cs : Get rid of calls to the same.
4044 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
4046 (Populate): Define the constructor correctly and set the implementation
4049 * typemanager.cs (delegate_types): New hashtable to hold delegates that
4052 (AddDelegateType): Implement.
4054 (IsDelegateType): Implement helper method.
4056 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
4058 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
4059 and accordingly handle it.
4061 * delegate.cs (Populate): Take TypeContainer argument.
4062 Implement bits to define the Invoke method. However, I still haven't figured out
4063 how to take care of the native int bit :-(
4065 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
4066 Qualify the name of the delegate, not its return type !
4068 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
4071 (StandardConversionExists): Checking for array types turns out to be recursive.
4073 (ConvertReferenceExplicit): Implement array conversion.
4075 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
4077 2001-10-12 Ravi Pratap <ravi@ximian.com>
4079 * cs-parser.jay (delegate_declaration): Store the fully qualified
4080 name as it is a type declaration.
4082 * delegate.cs (ReturnType, Name): Rename members to these. Make them
4085 (DefineDelegate): Renamed from Define. Does the same thing essentially,
4086 as TypeContainer::DefineType.
4088 (Populate): Method in which all the definition of the various methods (Invoke)
4091 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
4094 (CloseDelegate): Finally creates the delegate.
4096 * class.cs (TypeContainer::DefineType): Update to define delegates.
4097 (Populate, Emit and CloseType): Do the same thing here too.
4099 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
4100 delegates in all these operations.
4102 2001-10-14 Miguel de Icaza <miguel@ximian.com>
4104 * expression.cs: LocalTemporary: a new expression used to
4105 reference a temporary that has been created.
4107 * assign.cs: Handle PropertyAccess back here, so that we can
4108 provide the proper semantic access to properties.
4110 * expression.cs (Expression::ConvertReferenceExplicit): Implement
4111 a few more explicit conversions.
4113 * modifiers.cs: `NEW' modifier maps to HideBySig.
4115 * expression.cs (PropertyExpr): Make this into an
4116 ExpressionStatement, and support the EmitStatement code path.
4118 Perform get/set error checking, clean up the interface.
4120 * assign.cs: recognize PropertyExprs as targets, and if so, turn
4121 them into toplevel access objects.
4123 2001-10-12 Miguel de Icaza <miguel@ximian.com>
4125 * expression.cs: PropertyExpr::PropertyExpr: use work around the
4128 * typemanager.cs: Keep track here of our PropertyBuilders again to
4129 work around lameness in SRE.
4131 2001-10-11 Miguel de Icaza <miguel@ximian.com>
4133 * expression.cs (LValue::LValueResolve): New method in the
4134 interface, used to perform a second resolution pass for LValues.
4136 (This::DoResolve): Catch the use of this in static methods.
4138 (This::LValueResolve): Implement.
4140 (This::Store): Remove warning, assigning to `this' in structures
4143 (Invocation::Emit): Deal with invocation of
4144 methods on value types. We need to pass the address to structure
4145 methods rather than the object itself. (The equivalent code to
4146 emit "this" for structures leaves the entire structure on the
4147 stack instead of a pointer to it).
4149 (ParameterReference::DoResolve): Compute the real index for the
4150 argument based on whether the method takes or not a `this' pointer
4151 (ie, the method is static).
4153 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
4154 value types returned from functions when we need to invoke a
4155 method on the sturcture.
4158 2001-10-11 Ravi Pratap <ravi@ximian.com>
4160 * class.cs (TypeContainer::DefineType): Method to actually do the business of
4161 defining the type in the Modulebuilder or Typebuilder. This is to take
4162 care of nested types which need to be defined on the TypeBuilder using
4165 (TypeContainer::GetClassBases): Implement. Essentially the code from the
4166 methods in RootContext, only ported to be part of TypeContainer.
4168 (TypeContainer::GetInterfaceOrClass): Ditto.
4170 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
4172 * interface.cs (Interface::DefineInterface): New method. Does exactly
4173 what RootContext.CreateInterface did earlier, only it takes care of nested types
4176 (Interface::GetInterfaces): Move from RootContext here and port.
4178 (Interface::GetInterfaceByName): Same here.
4180 * rootcontext.cs (ResolveTree): Re-write.
4182 (PopulateTypes): Re-write.
4184 * class.cs (TypeContainer::Populate): Populate nested types too.
4185 (TypeContainer::Emit): Emit nested members too.
4187 * typemanager.cs (AddUserType): Do not make use of the FullName property,
4188 instead just use the name argument passed in as it is already fully
4191 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
4192 to TypeContainer mapping to see if a type is user-defined.
4194 * class.cs (TypeContainer::CloseType): Implement.
4196 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
4197 the default constructor.
4199 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
4202 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
4204 * interface.cs (CloseType): Create the type here.
4206 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
4209 Remove all the methods which are now in TypeContainer.
4211 2001-10-10 Ravi Pratap <ravi@ximian.com>
4213 * delegate.cs (Define): Re-write bits to define the delegate
4216 2001-10-10 Miguel de Icaza <miguel@ximian.com>
4218 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
4220 * expression.cs (ImplicitReferenceConversion): handle null as well
4221 as a source to convert to any reference type.
4223 * statement.cs (Return): Perform any implicit conversions to
4224 expected return type.
4226 Validate use of return statement.
4228 * codegen.cs (EmitContext): Pass the expected return type here.
4230 * class.cs (Method, Constructor, Property): Pass expected return
4231 type to EmitContext.
4233 2001-10-09 Miguel de Icaza <miguel@ximian.com>
4235 * expression.cs: Make DoResolve take an EmitContext instead of a
4238 Replaced `l' and `location' for `loc', for consistency.
4240 (Error, Warning): Remove unneeded Tc argument.
4242 * assign.cs, literal.cs, constant.cs: Update to new calling
4245 * codegen.cs: EmitContext now contains a flag indicating whether
4246 code is being generated in a static method or not.
4248 * cs-parser.jay: DecomposeQI, new function that replaces the old
4249 QualifiedIdentifier. Now we always decompose the assembled
4250 strings from qualified_identifier productions into a group of
4253 2001-10-08 Miguel de Icaza <miguel@ximian.com>
4255 * rootcontext.cs: Deal with field-less struct types correctly now
4256 by passing the size option to Define Type.
4258 * class.cs: Removed hack that created one static field.
4260 2001-10-07 Miguel de Icaza <miguel@ximian.com>
4262 * statement.cs: Moved most of the code generation here.
4264 2001-10-09 Ravi Pratap <ravi@ximian.com>
4266 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
4269 (ElementAccess): Remove useless bits for now - keep checks as the spec
4272 2001-10-08 Ravi Pratap <ravi@ximian.com>
4274 * expression.cs (ElementAccess::DoResolve): Remove my crap code
4275 and start performing checks according to the spec.
4277 2001-10-07 Ravi Pratap <ravi@ximian.com>
4279 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
4280 rank_specifiers instead.
4282 (rank_specifiers): Change the order in which the rank specifiers are stored
4284 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
4286 * expression.cs (ElementAccess): Implement the LValue interface too.
4288 2001-10-06 Ravi Pratap <ravi@ximian.com>
4290 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
4291 except that user defined conversions are not included.
4293 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
4294 perform the conversion of the return type, if necessary.
4296 (New::DoResolve): Check whether we are creating an array or an object
4297 and accordingly do the needful.
4299 (New::Emit): Same here.
4301 (New::DoResolve): Implement guts of array creation.
4303 (New::FormLookupType): Helper function.
4305 2001-10-07 Miguel de Icaza <miguel@ximian.com>
4307 * codegen.cs: Removed most of the code generation here, and move the
4308 corresponding code generation bits to the statement classes.
4310 Added support for try/catch/finalize and throw.
4312 * cs-parser.jay: Added support for try/catch/finalize.
4314 * class.cs: Catch static methods having the flags override,
4315 virtual or abstract.
4317 * expression.cs (UserCast): This user cast was not really doing
4318 what it was supposed to do. Which is to be born in fully resolved
4319 state. Parts of the resolution were being performed at Emit time!
4323 2001-10-05 Miguel de Icaza <miguel@ximian.com>
4325 * expression.cs: Implicity convert the result from UserCast.
4327 2001-10-05 Ravi Pratap <ravi@ximian.com>
4329 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
4330 prevented it from working correctly.
4332 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
4333 merely ConvertImplicit.
4335 2001-10-05 Miguel de Icaza <miguel@ximian.com>
4337 * typemanager.cs: Make the LookupTypeContainer function static,
4338 and not per-instance.
4340 * class.cs: Make static FindMembers (the one that takes a Type
4343 * codegen.cs: Add EmitForeach here.
4345 * cs-parser.jay: Make foreach a toplevel object instead of the
4346 inline expansion, as we need to perform semantic analysis on it.
4348 2001-10-05 Ravi Pratap <ravi@ximian.com>
4350 * expression.cs (Expression::ImplicitUserConversion): Rename to
4351 UserDefinedConversion.
4353 (Expression::UserDefinedConversion): Take an extra argument specifying
4354 whether we look for explicit user conversions too.
4356 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
4358 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
4360 (ExplicitUserConversion): Make it a call to UserDefinedConversion
4361 with the appropriate arguments.
4363 * cs-parser.jay (cast_expression): Record location too.
4365 * expression.cs (Cast): Record location info.
4367 (Expression::ConvertExplicit): Take location argument.
4369 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
4370 to determine if we are doing explicit conversions.
4372 (UserCast::Emit): Update accordingly.
4374 (Expression::ConvertExplicit): Report an error if everything fails.
4376 * ../errors/cs0030.cs : Add.
4378 2001-10-04 Miguel de Icaza <miguel@ximian.com>
4380 * modifiers.cs: If the ABSTRACT keyword is present, also set the
4381 virtual and newslot bits.
4383 * class.cs (TypeContainer::RegisterRequiredImplementations):
4384 Record methods we need.
4386 (TypeContainer::MakeKey): Helper function to make keys for
4387 MethodBases, since the Methodbase key is useless.
4389 (TypeContainer::Populate): Call RegisterRequiredImplementations
4390 before defining the methods.
4392 Create a mapping for method_builders_to_methods ahead of time
4393 instead of inside a tight loop.
4395 (::RequireMethods): Accept an object as the data to set into the
4396 hashtable so we can report interface vs abstract method mismatch.
4398 2001-10-03 Miguel de Icaza <miguel@ximian.com>
4400 * report.cs: Make all of it static.
4402 * rootcontext.cs: Drop object_type and value_type computations, as
4403 we have those in the TypeManager anyways.
4405 Drop report instance variable too, now it is a global.
4407 * driver.cs: Use try/catch on command line handling.
4409 Add --probe option to debug the error reporting system with a test
4412 * report.cs: Add support for exiting program when a probe
4413 condition is reached.
4415 2001-10-03 Ravi Pratap <ravi@ximian.com>
4417 * expression.cs (Binary::DoNumericPromotions): Fix the case when
4418 we do a forcible conversion regardless of type, to check if
4419 ForceConversion returns a null.
4421 (Binary::error19): Use location to report error.
4423 (Unary::error23): Use location here too.
4425 * ../errors/cs0019.cs : Check in.
4427 * ../errors/cs0023.cs : Check in.
4429 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
4430 case of a non-null MethodInfo object with a length of 0 !
4432 (Binary::ResolveOperator): Flag error if overload resolution fails to find
4433 an applicable member - according to the spec :-)
4434 Also fix logic to find members in base types.
4436 (Unary::ResolveOperator): Same here.
4438 (Unary::report23): Change name to error23 and make first argument a TypeContainer
4439 as I was getting thoroughly confused between this and error19 :-)
4441 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
4442 (::FindMostEncompassedType): Implement.
4443 (::FindMostEncompassingType): Implement.
4444 (::StandardConversionExists): Implement.
4446 (UserImplicitCast): Re-vamp. We now need info about most specific
4447 source and target types so that we can do the necessary conversions.
4449 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
4450 mathematical union with no duplicates.
4452 2001-10-03 Miguel de Icaza <miguel@ximian.com>
4454 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
4455 in order from base classes to child classes, so that we can in
4456 child classes look up in our parent for method names and
4457 attributes (required for handling abstract, virtual, new, override
4458 constructs: we need to instrospect our base class, and if we dont
4459 populate the classes in order, the introspection might be
4460 incorrect. For example, a method could query its parent before
4461 the parent has any methods and would determine that the parent has
4462 no abstract methods (while it could have had them)).
4464 (RootContext::CreateType): Record the order in which we define the
4467 2001-10-02 Miguel de Icaza <miguel@ximian.com>
4469 * class.cs (TypeContainer::Populate): Also method definitions can
4470 fail now, keep track of this.
4472 (TypeContainer::FindMembers): Implement support for
4473 DeclaredOnly/noDeclaredOnly flag.
4475 (Constructor::Emit) Return the ConstructorBuilder.
4477 (Method::Emit) Return the MethodBuilder.
4478 Check for abstract or virtual methods to be public.
4480 * rootcontext.cs (RootContext::CreateType): Register all the
4481 abstract methods required for the class to be complete and the
4482 interface methods that must be implemented.
4484 * cs-parser.jay: Report error 501 (method requires body if it is
4485 not marked abstract or extern).
4487 * expression.cs (TypeOf::Emit): Implement.
4489 * typemanager.cs: runtime_handle_type, new global type.
4491 * class.cs (Property::Emit): Generate code for properties.
4493 2001-10-02 Ravi Pratap <ravi@ximian.com>
4495 * expression.cs (Unary::ResolveOperator): Find operators on base type
4496 too - we now conform exactly to the spec.
4498 (Binary::ResolveOperator): Same here.
4500 * class.cs (Operator::Define): Fix minor quirk in the tests.
4502 * ../errors/cs0215.cs : Added.
4504 * ../errors/cs0556.cs : Added.
4506 * ../errors/cs0555.cs : Added.
4508 2001-10-01 Miguel de Icaza <miguel@ximian.com>
4510 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
4511 single integer which is really efficient
4513 2001-10-01 Ravi Pratap <ravi@ximian.com>
4515 * expression.cs (Expression::ImplicitUserConversion): Use location
4516 even in the case when we are examining True operators.
4518 * class.cs (Operator::Define): Perform extensive checks to conform
4519 with the rules for operator overloading in the spec.
4521 * expression.cs (Expression::ImplicitReferenceConversion): Implement
4522 some of the other conversions mentioned in the spec.
4524 * typemanager.cs (array_type): New static member for the System.Array built-in
4527 (cloneable_interface): For System.ICloneable interface.
4529 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
4530 we start resolving the tree and populating types.
4532 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
4534 2001-10-01 Miguel de Icaza <miguel@ximian.com>
4536 * expression.cs (Expression::ExprClassFromMemberInfo,
4537 Expression::Literalize): Create literal expressions from
4538 FieldInfos which are literals.
4540 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
4541 type casts, because they were wrong. The test suite in tests
4544 (ImplicitNumericConversion): ushort to ulong requires a widening
4547 Int32 constant to long requires widening cast as well.
4549 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
4550 for integers because the type on the stack is not i4.
4552 2001-09-30 Miguel de Icaza <miguel@ximian.com>
4554 * expression.cs (report118): require location argument.
4556 * parameter.cs: Do not dereference potential null value.
4558 * class.cs: Catch methods that lack the `new' keyword when
4559 overriding a name. Report warnings when `new' is used without
4560 anything being there to override.
4562 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
4564 * class.cs: Only add constructor to hashtable if it is non-null
4565 (as now constructors can fail on define).
4567 (TypeManager, Class, Struct): Take location arguments.
4569 Catch field instance initialization in structs as errors.
4571 accepting_filter: a new filter for FindMembers that is static so
4572 that we dont create an instance per invocation.
4574 (Constructor::Define): Catch errors where a struct constructor is
4577 * cs-parser.jay: Pass location information for various new
4580 * delegate.cs (Delegate): take a location argument.
4582 * driver.cs: Do not call EmitCode if there were problesm in the
4583 Definition of the types, as many Builders wont be there.
4585 * decl.cs (Decl::Decl): Require a location argument.
4587 * cs-tokenizer.cs: Handle properly hex constants that can not fit
4588 into integers, and find the most appropiate integer for it.
4590 * literal.cs: Implement ULongLiteral.
4592 * rootcontext.cs: Provide better information about the location of
4593 failure when CreateType fails.
4595 2001-09-29 Miguel de Icaza <miguel@ximian.com>
4597 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
4600 * expression.cs (Binary::CheckShiftArguments): Add missing type
4602 (Binary::ResolveOperator): Add type to the logical and and logical
4603 or, Bitwise And/Or and Exclusive Or code paths, it was missing
4606 (Binary::DoNumericPromotions): In the case where either argument
4607 is ulong (and most signed types combined with ulong cause an
4608 error) perform implicit integer constant conversions as well.
4610 2001-09-28 Miguel de Icaza <miguel@ximian.com>
4612 * expression.cs (UserImplicitCast): Method should always be
4614 (Invocation::BetterConversion): Simplified test for IntLiteral.
4616 (Expression::ImplicitNumericConversion): Split this routine out.
4617 Put the code that performs implicit constant integer conversions
4620 (Expression::Resolve): Become a wrapper around DoResolve so we can
4621 check eclass and type being set after resolve.
4623 (Invocation::Badness): Remove this dead function
4625 (Binary::ResolveOperator): Do not compute the expensive argumnets
4626 unless we have a union for it.
4628 (Probe::Emit): Is needs to do an isinst and then
4629 compare against null.
4631 (::CanConvert): Added Location argument. If the Location argument
4632 is null (Location.Null), then we do not report errors. This is
4633 used by the `probe' mechanism of the Explicit conversion. We do
4634 not want to generate an error for something that the user
4635 explicitly requested to be casted. But the pipeline for an
4636 explicit cast first tests for potential implicit casts.
4638 So for now, if the Location is null, it means `Probe only' to
4639 avoid adding another argument. Might have to revise this
4642 (ClassCast): New class used to type cast objects into arbitrary
4643 classes (used in Explicit Reference Conversions).
4645 Implement `as' as well.
4647 Reverted all the patches from Ravi below: they were broken:
4649 * The use of `level' as a mechanism to stop recursive
4650 invocations is wrong. That was there just to catch the
4651 bug with a strack trace but not as a way of addressing
4654 To fix the problem we have to *understand* what is going
4655 on and the interactions and come up with a plan, not
4656 just get things going.
4658 * The use of the type conversion cache that I proposed
4659 last night had an open topic: How does this work across
4660 protection domains. A user defined conversion might not
4661 be public in the location where we are applying the
4662 conversion, a different conversion might be selected
4663 (ie, private A->B (better) but public B->A (worse),
4664 inside A, A->B applies, but outside it, B->A will
4667 * On top of that (ie, even if the above is solved),
4668 conversions in a cache need to be abstract. Ie, `To
4669 convert from an Int to a Short use an OpcodeCast', not
4670 `To convert from an Int to a Short use the OpcodeCast on
4671 the variable 5' (which is what this patch was doing).
4673 2001-09-28 Ravi Pratap <ravi@ximian.com>
4675 * expression.cs (Invocation::ConversionExists): Re-write to use
4676 the conversion cache
4678 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
4679 cache all conversions done, not just user-defined ones.
4681 (Invocation::BetterConversion): The real culprit. Use ConversionExists
4682 to determine if a conversion exists instead of acutually trying to
4683 perform the conversion. It's faster too.
4685 (Expression::ConvertExplicit): Modify to use ConversionExists to check
4686 and only then attempt the implicit conversion.
4688 2001-09-28 Ravi Pratap <ravi@ximian.com>
4690 * expression.cs (ConvertImplicit): Use a cache for conversions
4691 already found. Check level of recursion and bail out if necessary.
4693 2001-09-28 Miguel de Icaza <miguel@ximian.com>
4695 * typemanager.cs (string_concat_string_string, string_concat_object_object):
4696 Export standard methods that we expect for string operations.
4698 * statement.cs (Block::UsageWarning): Track usage of variables and
4699 report the errors for not used variables.
4701 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
4704 2001-09-27 Miguel de Icaza <miguel@ximian.com>
4706 * codegen.cs: remove unnneded code
4708 * expression.cs: Removed BuiltinTypeAccess class
4710 Fix the order in which implicit conversions are
4713 The previous fixed dropped support for boxed conversions (adding a
4714 test to the test suite now)
4716 (UserImplicitCast::CanConvert): Remove test for source being null,
4717 that code is broken. We should not feed a null to begin with, if
4718 we do, then we should track the bug where the problem originates
4719 and not try to cover it up here.
4721 Return a resolved expression of type UserImplicitCast on success
4722 rather than true/false. Ravi: this is what I was talking about,
4723 the pattern is to use a static method as a "constructor" for
4726 Also, do not create arguments until the very last minute,
4727 otherwise we always create the arguments even for lookups that
4728 will never be performed.
4730 (UserImplicitCast::Resolve): Eliminate, objects of type
4731 UserImplicitCast are born in a fully resolved state.
4733 * typemanager.cs (InitCoreTypes): Init also value_type
4736 * expression.cs (Cast::Resolve): First resolve the child expression.
4738 (LValue): Add new method AddressOf to be used by
4741 Change the argument of Store to take an EmitContext instead of an
4742 ILGenerator, because things like FieldExpr need to be able to call
4743 their children expression to generate the instance code.
4745 (Expression::Error, Expression::Warning): Sugar functions for
4748 (Expression::MemberLookup): Accept a TypeContainer instead of a
4749 Report as the first argument.
4751 (Expression::ResolvePrimary): Killed. I still want to improve
4752 this as currently the code is just not right.
4754 (Expression::ResolveMemberAccess): Simplify, but it is still
4757 (Unary::Resolve): Catch errors in AddressOf operators.
4759 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
4760 index to a byte for the short-version, or the compiler will choose
4761 the wrong Emit call, which generates the wrong data.
4763 (ParameterReference::Emit, ::Store): same.
4765 (FieldExpr::AddressOf): Implement.
4767 * typemanager.cs: TypeManager: made public variable instead of
4770 * driver.cs: document --fatal.
4772 * report.cs (ErrorMessage, WarningMessage): new names for the old
4773 Error and Warning classes.
4775 * cs-parser.jay (member_access): Turn built-in access to types
4776 into a normal simplename
4778 2001-09-27 Ravi Pratap <ravi@ximian.com>
4780 * expression.cs (Invocation::BetterConversion): Fix to cope
4781 with q being null, since this was introducing a bug.
4783 * expression.cs (ConvertImplicit): Do built-in conversions first.
4785 2001-09-27 Ravi Pratap <ravi@ximian.com>
4787 * expression.cs (UserImplicitCast::Resolve): Fix bug.
4789 2001-09-27 Ravi Pratap <ravi@ximian.com>
4791 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
4792 I had introduced long ago (what's new ?).
4794 * expression.cs (UserImplicitCast::CanConvert): Static method to do
4795 the work of all the checking.
4796 (ConvertImplicit): Call CanConvert and only then create object if necessary.
4797 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
4799 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
4800 that is the right way.
4802 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
4803 overloading resolution. Use everywhere instead of cutting and pasting code.
4805 (Binary::ResolveOperator): Use MakeUnionSet.
4807 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
4808 we have to convert to bool types. Not complete yet.
4810 2001-09-27 Miguel de Icaza <miguel@ximian.com>
4812 * typemanager.cs (TypeManager::CSharpName): support ushort.
4814 * expression.cs (Expression::TryImplicitIntConversion): Attempts
4815 to provide an expression that performsn an implicit constant int
4816 conversion (section 6.1.6).
4817 (Expression::ConvertImplicitRequired): Reworked to include
4818 implicit constant expression conversions.
4820 (Expression::ConvertNumericExplicit): Finished.
4822 (Invocation::Emit): If InstanceExpression is null, then it means
4823 that we perform a call on this.
4825 2001-09-26 Miguel de Icaza <miguel@ximian.com>
4827 * expression.cs (Unary::Emit): Remove some dead code.
4828 (Probe): Implement Resolve and Emit for `is'.
4829 (Expression::ConvertImplicitRequired): Attempt to do constant
4830 expression conversions here. Maybe should be moved to
4831 ConvertImplicit, but I am not sure.
4832 (Expression::ImplicitLongConstantConversionPossible,
4833 Expression::ImplicitIntConstantConversionPossible): New functions
4834 that tell whether is it possible to apply an implicit constant
4835 expression conversion.
4837 (ConvertNumericExplicit): Started work on explicit numeric
4840 * cs-parser.jay: Update operator constants.
4842 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
4843 (Parameters::GetSignature): Hook up VerifyArgs here.
4844 (Parameters::VerifyArgs): Verifies that no two arguments have the
4847 * class.cs (Operator): Update the operator names to reflect the
4848 ones that the spec expects (as we are just stringizing the
4851 * expression.cs (Unary::ResolveOperator): Fix bug: Use
4852 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
4853 previous usage did only work for our methods.
4854 (Expression::ConvertImplicit): Handle decimal implicit numeric
4855 conversions as well.
4856 (Expression::InternalTypeConstructor): Used to invoke constructors
4857 on internal types for default promotions.
4859 (Unary::Emit): Implement special handling for the pre/post
4860 increment/decrement for overloaded operators, as they need to have
4861 the same semantics as the other operators.
4863 (Binary::ResolveOperator): ditto.
4864 (Invocation::ConversionExists): ditto.
4865 (UserImplicitCast::Resolve): ditto.
4867 2001-09-26 Ravi Pratap <ravi@ximian.com>
4869 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
4870 operator, return after emitting body. Regression tests pass again !
4872 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
4873 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
4874 (Invocation::OverloadResolve): Ditto.
4875 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
4877 * everywhere : update calls to the above methods accordingly.
4879 2001-09-26 Miguel de Icaza <miguel@ximian.com>
4881 * assign.cs (Assign): Make it inherit from ExpressionStatement.
4883 * expression.cs (ExpressionStatement): New base class used for
4884 expressions that can appear in statements, so that we can provide
4885 an alternate path to generate expression that do not leave a value
4888 (Expression::Emit, and all the derivatives): We no longer return
4889 whether a value is left on the stack or not. Every expression
4890 after being emitted leaves a single value on the stack.
4892 * codegen.cs (EmitContext::EmitStatementExpression): Use the
4893 facilties of ExpressionStatement if possible.
4895 * cs-parser.jay: Update statement_expression.
4897 2001-09-25 Miguel de Icaza <miguel@ximian.com>
4899 * driver.cs: Change the wording of message
4901 2001-09-25 Ravi Pratap <ravi@ximian.com>
4903 * expression.cs (Binary::ResolveOperator): Had forgottten to set
4904 the type of the expression to the return type of the method if
4905 we have an overloaded operator match ! The regression tests pass again !
4906 (Unary::ResolveOperator): Ditto.
4908 * expression.cs (Invocation::ConversionExists): Correct the member lookup
4909 to find "op_Implicit", not "implicit" ;-)
4910 (UserImplicitCast): New class to take care of user-defined implicit conversions.
4911 (ConvertImplicit, ForceConversion): Take TypeContainer argument
4913 * everywhere : Correct calls to the above accordingly.
4915 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
4916 (ConvertImplicit): Do user-defined conversion if it exists.
4918 2001-09-24 Miguel de Icaza <miguel@ximian.com>
4920 * assign.cs: track location.
4921 (Resolve): Use implicit conversions on assignment.
4923 * literal.cs: Oops. Not good, Emit of short access values should
4924 pass (Bytes) or the wrong argument will be selected.
4926 * expression.cs (Unary::Emit): Emit code for -expr.
4928 (Unary::ResolveOperator): Handle `Substract' for non-constants
4929 (substract from zero from the non-constants).
4930 Deal with Doubles as well.
4932 (Expression::ConvertImplicitRequired): New routine that reports an
4933 error if no implicit conversion exists.
4935 (Invocation::OverloadResolve): Store the converted implicit
4936 expressions if we make them
4938 2001-09-24 Ravi Pratap <ravi@ximian.com>
4940 * class.cs (ConstructorInitializer): Take a Location argument.
4941 (ConstructorBaseInitializer): Same here.
4942 (ConstructorThisInitializer): Same here.
4944 * cs-parser.jay : Update all calls accordingly.
4946 * expression.cs (Unary, Binary, New): Take location argument.
4947 Update accordingly everywhere.
4949 * cs-parser.jay : Update all calls to the above to take a location
4954 2001-09-24 Ravi Pratap <ravi@ximian.com>
4956 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
4957 (Invocation::BetterConversion): Same here
4958 (Invocation::ConversionExists): Ditto.
4960 (Invocation::ConversionExists): Implement.
4962 2001-09-22 Ravi Pratap <ravi@ximian.com>
4964 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
4965 Also take an additional TypeContainer argument.
4967 * All over : Pass in TypeContainer as argument to OverloadResolve.
4969 * typemanager.cs (CSharpName): Update to check for the string type and return
4972 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
4975 2001-09-21 Ravi Pratap <ravi@ximian.com>
4977 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
4978 (Invocation::BetterFunction): Implement.
4979 (Invocation::BetterConversion): Implement.
4980 (Invocation::ConversionExists): Skeleton, no implementation yet.
4982 Okay, things work fine !
4984 2001-09-21 Miguel de Icaza <miguel@ximian.com>
4986 * typemanager.cs: declare and load enum_type, delegate_type and
4989 * expression.cs (Expression::Emit): Now emit returns a value that
4990 tells whether a value is left on the stack or not. This strategy
4991 might be reveted tomorrow with a mechanism that would address
4992 multiple assignments.
4993 (Expression::report118): Utility routine to report mismatches on
4996 (Unary::Report23): Report impossible type/operator combination
4999 (Unary::IsIncrementableNumber): Whether the type can be
5000 incremented or decremented with add.
5001 (Unary::ResolveOperator): Also allow enumerations to be bitwise
5003 (Unary::ResolveOperator): Implement ++, !, ~,
5005 (Invocation::Emit): Deal with new Emit convetion.
5007 * All Expression derivatives: Updated their Emit method to return
5008 whether they leave values on the stack or not.
5010 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
5011 stack for expressions that are statements.
5013 2001-09-20 Miguel de Icaza <miguel@ximian.com>
5015 * expression.cs (LValue): New interface. Must be implemented by
5017 (LocalVariableReference, ParameterReference, FieldExpr): Implement
5020 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
5021 interface for generating code, simplifies the code.
5023 2001-09-20 Ravi Pratap <ravi@ximian.com>
5025 * expression.cs (everywhere): Comment out return statements in ::Resolve
5026 methods to avoid the warnings.
5028 2001-09-20 Miguel de Icaza <miguel@ximian.com>
5030 * driver.cs (parse): Report error 2001 if we can not open the
5033 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
5036 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
5039 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
5040 otherwise nested blocks end up with the same index.
5042 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
5044 * expression.cs: Instead of having FIXMEs in the Resolve
5045 functions, throw exceptions so it is obvious that we are facing a
5048 * cs-parser.jay (invocation_expression): Pass Location information.
5050 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
5051 Use a basename for those routines because .NET does not like paths
5054 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
5057 2001-09-19 Miguel de Icaza <miguel@ximian.com>
5059 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
5060 are loading the correct data types (throws an exception if not).
5061 (TypeManager::InitCoreTypes): Use CoreLookupType
5063 * expression.cs (Unary::ResolveOperator): return the child
5064 expression for expressions which are just +expr.
5065 (Unary::ResolveOperator): Return negative literals for -LITERAL
5066 expressions (otherwise they are Unary {Literal}).
5067 (Invocation::Badness): Take into account `Implicit constant
5068 expression conversions'.
5070 * literal.cs (LongLiteral): Implement long literal class.
5071 (IntLiteral): export the `Value' of the intliteral.
5073 2001-09-19 Ravi Pratap <ravi@ximian.com>
5075 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
5077 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
5078 instead of 'Operator'
5080 * expression.cs (Binary::ResolveOperator): Update accordingly.
5081 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
5084 * cs-parser.jay (unary_expression): Update to use the new names.
5086 * gen-treedump.cs (GetUnary): Same here.
5088 * expression.cs (Unary::Resolve): Implement.
5089 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
5090 operators are found instead of making noise ;-)
5091 (Unary::ResolveOperator): New method to do precisely the same thing which
5092 Binary::ResolveOperator does for Binary expressions.
5093 (Unary.method, .Arguments): Add.
5094 (Unary::OperName): Implement.
5095 (Unary::ForceConversion): Copy and Paste !
5097 * class.cs (Operator::Define): Fix a small bug for the case when we have
5100 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
5101 for the inbuilt operators. Only overloading works for now ;-)
5103 2001-09-18 Miguel de Icaza <miguel@ximian.com>
5105 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
5106 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
5108 * expression.cs (This::Emit): Implement.
5109 (This::Resolve): Implement.
5110 (TypeOf:Resolve): Implement.
5111 (Expression::ResolveSimpleName): Add an implicit this to instance
5113 (MemberAccess::Resolve): Deal with Parameters and Fields.
5114 Bind instance variable to Field expressions.
5115 (FieldExpr::Instance): New field used to track the expression that
5116 represents the object instance.
5117 (FieldExpr::Resolve): Track potential errors from MemberLookup not
5119 (FieldExpr::Emit): Implement.
5121 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
5122 the last instruction contains a return opcode to avoid generating
5123 the last `ret' instruction (this generates correct code, and it is
5124 nice to pass the peverify output).
5126 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
5127 initializer for static and instance variables.
5128 (Constructor::Emit): Allow initializer to be null in the case of
5129 static constructors. Only emit initializer for instance
5132 (TypeContainer::FindMembers): Return a null array if there are no
5135 Also fix the code for the MemberTypes.Method branch, as it was not
5136 scanning that for operators (or tried to access null variables before).
5138 * assign.cs (Assign::Emit): Handle instance and static fields.
5142 * driver.cs: Stop compilation if there are parse errors.
5144 * cs-parser.jay (constructor_declaration): Provide default base
5145 initializer for non-static constructors.
5146 (constructor_declarator): Do not provide a default base
5147 initializers if none was specified.
5148 Catch the fact that constructors should not have parameters.
5150 * class.cs: Do not emit parent class initializers for static
5151 constructors, that should be flagged as an error.
5153 2001-09-18 Ravi Pratap <ravi@ximian.com>
5155 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
5156 Move back code into TypeContainer::Populate.
5158 2001-09-18 Ravi Pratap <ravi@ximian.com>
5160 * class.cs (TypeContainer::AddConstructor): Fix the check to
5161 compare against Name, not Basename.
5162 (Operator::OpType): Change Plus and Minus to Add and Subtract.
5164 * cs-parser.jay : Update accordingly.
5166 * class.cs (TypeContainer::FindMembers): For the case where we are searching
5167 for methods, don't forget to look into the operators too.
5168 (RegisterMethodBuilder): Helper method to take care of this for
5169 methods, constructors and operators.
5170 (Operator::Define): Completely revamp.
5171 (Operator.OperatorMethod, MethodName): New fields.
5172 (TypeContainer::Populate): Move the registering of builders into
5173 RegisterMethodBuilder.
5174 (Operator::Emit): Re-write.
5176 * expression.cs (Binary::Emit): Comment out code path to emit method
5177 invocation stuff for the case when we have a user defined operator. I am
5178 just not able to get it right !
5180 2001-09-17 Miguel de Icaza <miguel@ximian.com>
5182 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
5185 (Expression::MemberLookup): Provide a version that allows to
5186 specify the MemberTypes and BindingFlags.
5188 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
5189 so it was not fetching variable information from outer blocks.
5191 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
5192 Beforefieldinit as it was buggy.
5194 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
5197 * class.cs (Constructor::Emit): Only emit if block is not null.
5198 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
5199 deal with this by semantically definining it as if the user had
5202 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
5203 constructors as we now "emit" them at a higher level.
5205 (TypeContainer::DefineDefaultConstructor): Used to define the
5206 default constructors if none was provided.
5208 (ConstructorInitializer): Add methods Resolve and Emit.
5210 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
5212 2001-09-17 Ravi Pratap <ravi@ximian.com>
5214 * class.cs (TypeContainer::EmitDefaultConstructor): Register
5215 the default constructor builder with our hashtable for methodbuilders
5218 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
5219 and argument_count is 0 in which case we have a match.
5220 (Binary::ResolveOperator): More null checking and miscellaneous coding
5223 2001-09-17 Ravi Pratap <ravi@ximian.com>
5225 * rootcontext.cs (IsNameSpace): Compare against null.
5227 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
5229 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
5230 and Unary::Operator.
5232 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
5235 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
5236 we have overloaded operators.
5237 (Binary::ResolveOperator): Implement the part which does the operator overload
5240 * class.cs (Operator::Emit): Implement.
5241 (TypeContainer::Emit): Emit the operators we have too.
5243 * expression.cs (Binary::Emit): Update to emit the appropriate code for
5244 the case when we have a user-defined operator.
5246 2001-09-17 Miguel de Icaza <miguel@ximian.com>
5248 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
5250 2001-09-16 Ravi Pratap <ravi@ximian.com>
5252 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
5253 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
5254 (Constructor::Emit): Implement.
5255 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
5256 if we have no work to do.
5257 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
5260 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
5261 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
5263 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
5266 2001-09-15 Ravi Pratap <ravi@ximian.com>
5268 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
5270 (Tree::RecordNamespace): Method to do what the name says ;-)
5271 (Tree::Namespaces): Property to get at the namespaces hashtable.
5273 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
5276 * rootcontext.cs (IsNamespace): Fixed it :-)
5278 2001-09-14 Miguel de Icaza <miguel@ximian.com>
5280 * class.cs (TypeContainer::FindMembers): Add support for
5282 (MethodCore): New class that encapsulates both the shared aspects
5283 of a Constructor and a Method.
5284 (Method, Constructor): Factored pieces into MethodCore.
5286 * driver.cs: Added --fatal which makes errors throw exceptions.
5287 Load System assembly as well as part of the standard library.
5289 * report.cs: Allow throwing exceptions on errors for debugging.
5291 * modifiers.cs: Do not use `parent', instead use the real type
5292 container to evaluate permission settings.
5294 * class.cs: Put Ravi's patch back in. He is right, and we will
5295 have to cope with the
5297 2001-09-14 Ravi Pratap <ravi@ximian.com>
5299 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
5300 FamORAssem, not FamANDAssem.
5302 2001-09-14 Miguel de Icaza <miguel@ximian.com>
5304 * driver.cs: Added --parse option that only parses its input files
5307 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
5308 incorrect. IsTopLevel is not used to tell whether an object is
5309 root_types or not (that can be achieved by testing this ==
5310 root_types). But to see if this is a top-level *class* (not
5311 necessarly our "toplevel" container).
5313 2001-09-14 Ravi Pratap <ravi@ximian.com>
5315 * enum.cs (Enum::Define): Modify to call the Lookup method on the
5316 parent instead of a direct call to GetType.
5318 2001-09-14 Ravi Pratap <ravi@ximian.com>
5320 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
5321 Modifiers.TypeAttr. This should just be a call to that method.
5323 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
5324 object so that we can determine if we are top-level or not.
5326 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
5329 * enum.cs (Enum::Define): Ditto.
5331 * modifiers.cs (FieldAttr): Re-write.
5333 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
5334 (TypeContainer::HaveStaticConstructor): New property to provide access
5335 to precisely that info.
5337 * modifiers.cs (MethodAttr): Re-write.
5338 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
5340 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
5341 of top-level types as claimed.
5343 2001-09-13 Miguel de Icaza <miguel@ximian.com>
5345 * expression.cs (MemberLookup): Fruitless attempt to lookup
5346 constructors. Maybe I need to emit default constructors? That
5347 might be it (currently .NET emits this for me automatically).
5348 (Invocation::OverloadResolve): Cope with Arguments == null.
5349 (Invocation::EmitArguments): new function, shared by the new
5351 (Invocation::Emit): Handle static and instance methods. Emit
5352 proper call instruction for virtual or non-virtual invocations.
5353 (New::Emit): Implement.
5354 (New::Resolve): Implement.
5355 (MemberAccess:Resolve): Implement.
5356 (MethodGroupExpr::InstanceExpression): used conforming to the spec
5358 (FieldExpr::Resolve): Set type.
5360 * support.cs: Handle empty arguments.
5362 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
5363 SimpleLookup): Auxiliary routines to help parse a qualifier
5366 Update qualifier_identifier rule.
5368 * codegen.cs: Removed debugging messages.
5370 * class.cs: Make this a global thing, this acts just as a "key" to
5371 objects that we might have around.
5373 (Populate): Only initialize method_builders_to_methods once.
5375 * expression.cs (PropertyExpr): Initialize type from the
5378 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
5379 Resolve pattern. Attempt to implicitly convert value to boolean.
5382 * expression.cs: Set the type for the int32/int32 argument case.
5383 (Binary::ResolveOperator): Set the return type to boolean for
5384 comparission operators
5386 * typemanager.cs: Remove debugging print code.
5388 (Invocation::Resolve): resolve type.
5390 * class.cs: Allocate a MemberInfo of the correct size, as the code
5391 elsewhere depends on the test to reflect the correct contents.
5393 (Method::) Keep track of parameters, due to System.Reflection holes
5395 (TypeContainer::Populate): Keep track of MethodBuilders to Method
5398 (TypeContainer::FindMembers): Use ArrayList and then copy an array
5399 of the exact size and return that.
5401 (Class::LookupMethodByBuilder): New function that maps
5402 MethodBuilders to its methods. Required to locate the information
5403 on methods because System.Reflection bit us again.
5405 * support.cs: New file, contains an interface ParameterData and
5406 two implementations: ReflectionParameters and InternalParameters
5407 used to access Parameter information. We will need to grow this
5410 * expression.cs (Invocation::GetParameterData): implement a cache
5411 and a wrapper around the ParameterData creation for methods.
5412 (Invocation::OverloadResolve): Use new code.
5414 2001-09-13 Ravi Pratap <ravi@ximian.com>
5416 * class.cs (TypeContainer::EmitField): Remove and move into
5417 (Field::Define): here and modify accordingly.
5418 (Field.FieldBuilder): New member.
5419 (TypeContainer::Populate): Update accordingly.
5420 (TypeContainer::FindMembers): Implement.
5422 2001-09-13 Miguel de Icaza <miguel@ximian.com>
5424 * statement.cs: (VariableInfo::VariableType): New field to be
5425 initialized with the full type once it is resolved.
5427 2001-09-12 Miguel de Icaza <miguel@ximian.com>
5429 * parameter.cs (GetParameterInfo): Use a type cache to compute
5430 things only once, and to reuse this information
5432 * expression.cs (LocalVariableReference::Emit): Implement.
5433 (OpcodeCast::Emit): fix.
5435 (ParameterReference::Resolve): Implement.
5436 (ParameterReference::Emit): Implement.
5438 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
5439 that are expressions need to stay as Expressions.
5441 * typemanager.cs (CSharpName): Returns the C# name of a type if
5444 * expression.cs (Expression::ConvertImplicit): New function that
5445 implements implicit type conversions.
5447 (Expression::ImplicitReferenceConversion): Implements implicit
5448 reference conversions.
5450 (EmptyCast): New type for transparent casts.
5452 (OpcodeCast): New type for casts of types that are performed with
5453 a sequence of bytecodes.
5455 (BoxedCast): New type used for casting value types into reference
5456 types. Emits a box opcode.
5458 (Binary::DoNumericPromotions): Implements numeric promotions of
5459 and computation of the Binary::Type.
5461 (Binary::EmitBranchable): Optimization.
5463 (Binary::Emit): Implement code emission for expressions.
5465 * typemanager.cs (TypeManager): Added two new core types: sbyte
5468 2001-09-12 Ravi Pratap <ravi@ximian.com>
5470 * class.cs (TypeContainer::FindMembers): Method which does exactly
5471 what Type.FindMembers does, only we don't have to use reflection. No
5474 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
5475 typecontainer objects as we need to get at them.
5476 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
5478 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
5479 typecontainer object.
5481 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
5482 of just a Report object.
5484 2001-09-11 Ravi Pratap <ravi@ximian.com>
5486 * class.cs (Event::Define): Go back to using the prefixes "add_" and
5488 (TypeContainer::Populate): Now define the delegates of the type too.
5489 (TypeContainer.Delegates): Property to access the list of delegates defined
5492 * delegates.cs (Delegate::Define): Implement partially.
5494 * modifiers.cs (TypeAttr): Handle more flags.
5496 2001-09-11 Ravi Pratap <ravi@ximian.com>
5498 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
5500 (Operator::Define): Re-write logic to get types by using the LookupType method
5501 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
5502 (Indexer::Define): Ditto.
5503 (Event::Define): Ditto.
5504 (Property::Define): Ditto.
5506 2001-09-10 Ravi Pratap <ravi@ximian.com>
5508 * class.cs (TypeContainer::Populate): Now define operators too.
5509 (TypeContainer.Operators): New property to access the list of operators
5511 (Operator.OperatorMethodBuilder): New member to hold the method builder
5512 for the operator we are defining.
5513 (Operator::Define): Implement.
5515 2001-09-10 Ravi Pratap <ravi@ximian.com>
5517 * class.cs (Event::Define): Make the prefixes of the accessor methods
5518 addOn_ and removeOn_
5520 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
5521 of the location being passed in too. Ideally, this should go later since all
5522 error reporting should be done through the Report object.
5524 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
5525 (Populate): Iterate thru the indexers we have and define them too.
5526 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
5527 for the get and set accessors.
5528 (Indexer::Define): Implement.
5530 2001-09-09 Miguel de Icaza <miguel@ximian.com>
5532 * expression.cs (Binary::Resolve): Beginning of it. I scratched
5533 my previous implementation, did not work.
5535 * typemanager.cs: Add a couple of missing types (the longs).
5537 * literal.cs: Use TypeManager.bool_type instead of getting it.
5539 * expression.cs (EventExpr): New kind of expressions.
5540 (Expressio::ExprClassFromMemberInfo): finish
5542 2001-09-08 Miguel de Icaza <miguel@ximian.com>
5544 * assign.cs: Emit stores to static fields differently.
5546 2001-09-08 Ravi Pratap <ravi@ximian.com>
5548 * Merge in changes and adjust code to tackle conflicts. Backed out my
5549 code in Assign::Resolve ;-)
5551 2001-09-08 Ravi Pratap <ravi@ximian.com>
5553 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
5554 instead Report.Error and also pass in the location.
5555 (CSharpParser::Lexer): New readonly property to return the reference
5556 to the Tokenizer object.
5557 (declare_local_variables): Use Report.Error with location instead of plain
5561 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
5562 (Operator.CheckBinaryOperator): Ditto.
5564 * cs-parser.jay (operator_declarator): Update accordingly.
5566 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
5567 (CheckBinaryOperator): Same here.
5569 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
5570 on the name without any prefixes of namespace names etc. This is because we
5571 already might have something already fully qualified like
5572 'System.Console.WriteLine'
5574 * assign.cs (Resolve): Begin implementation. Stuck ;-)
5576 2001-09-07 Ravi Pratap <ravi@ximian.com>
5578 * cs-tokenizer.cs (location): Return a string which also contains
5581 * expression.cs (ElementAccess): New class for expressions of the
5582 type 'element access.'
5583 (BaseAccess): New class for expressions of the type 'base access.'
5584 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
5587 * cs-parser.jay (element_access): Implement action.
5588 (base_access): Implement actions.
5589 (checked_expression, unchecked_expression): Implement.
5591 * cs-parser.jay (local_variable_type): Correct and implement.
5592 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
5594 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
5596 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
5597 name and the specifiers.
5599 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
5601 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
5602 making them all public ;-)
5604 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
5607 2001-09-07 Miguel de Icaza <miguel@ximian.com>
5609 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
5611 (FieldExpr, PropertyExprs): New resolved expressions.
5612 (SimpleName::MemberStaticCheck): Perform static checks for access
5613 to non-static fields on static methods. Maybe this should be
5614 generalized for MemberAccesses.
5615 (SimpleName::ResolveSimpleName): More work on simple name
5618 * cs-parser.jay (primary_expression/qualified_identifier): track
5619 the parameter index.
5621 * codegen.cs (CodeGen::Save): Catch save exception, report error.
5622 (EmitContext::EmitBoolExpression): Chain to expression generation
5623 instead of temporary hack.
5624 (::EmitStatementExpression): Put generic expression code generation.
5626 * assign.cs (Assign::Emit): Implement variable assignments to
5627 local variables, parameters and fields.
5629 2001-09-06 Miguel de Icaza <miguel@ximian.com>
5631 * statement.cs (Block::GetVariableInfo): New method, returns the
5632 VariableInfo for a variable name in a block.
5633 (Block::GetVariableType): Implement in terms of GetVariableInfo
5635 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
5636 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
5638 2001-09-06 Ravi Pratap <ravi@ximian.com>
5640 * cs-parser.jay (operator_declaration): Continue on my quest : update
5641 to take attributes argument.
5642 (event_declaration): Ditto.
5643 (enum_declaration): Ditto.
5644 (indexer_declaration): Ditto.
5646 * class.cs (Operator::Operator): Update constructor accordingly.
5647 (Event::Event): Ditto.
5649 * delegate.cs (Delegate::Delegate): Same here.
5651 * enum.cs (Enum::Enum): Same here.
5653 2001-09-05 Ravi Pratap <ravi@ximian.com>
5655 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
5657 * ../tests/cs0658.cs : New file to demonstrate error 0658.
5659 * attribute.cs (Attributes): New class to encapsulate all attributes which were
5660 being passed around as an arraylist.
5661 (Attributes::AddAttribute): Method to add attribute sections.
5663 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
5664 (struct_declaration): Update accordingly.
5665 (constant_declaration): Update.
5666 (field_declaration): Update.
5667 (method_header): Update.
5668 (fixed_parameter): Update.
5669 (parameter_array): Ditto.
5670 (property_declaration): Ditto.
5671 (destructor_declaration): Ditto.
5673 * class.cs (Struct::Struct): Update constructors accordingly.
5674 (Class::Class): Ditto.
5675 (Field::Field): Ditto.
5676 (Method::Method): Ditto.
5677 (Property::Property): Ditto.
5678 (TypeContainer::OptAttribute): update property's return type.
5680 * interface.cs (Interface.opt_attributes): New member.
5681 (Interface::Interface): Update to take the extra Attributes argument.
5683 * parameter.cs (Parameter::Parameter): Ditto.
5685 * constant.cs (Constant::Constant): Ditto.
5687 * interface.cs (InterfaceMemberBase): New OptAttributes field.
5688 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
5689 the attributes as a parameter.
5690 (InterfaceProperty): Update constructor call.
5691 (InterfaceEvent): Ditto.
5692 (InterfaceMethod): Ditto.
5693 (InterfaceIndexer): Ditto.
5695 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
5696 pass the attributes too.
5697 (interface_event_declaration): Ditto.
5698 (interface_property_declaration): Ditto.
5699 (interface_method_declaration): Ditto.
5700 (interface_declaration): Ditto.
5702 2001-09-05 Miguel de Icaza <miguel@ximian.com>
5704 * class.cs (Method::Define): Track the "static Main" definition to
5705 create an entry point.
5707 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
5708 EntryPoint if we find it.
5710 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
5711 (EmitContext::ig): Make this variable public.
5713 * driver.cs: Make the default output file be the first file name
5714 with the .exe extension.
5716 Detect empty compilations
5718 Handle various kinds of output targets. Handle --target and
5719 rename -t to --dumper.
5721 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
5722 methods inherited from Expression return now an Expression. This
5723 will is used during the tree rewriting as we resolve them during
5726 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
5727 the spec. Missing entirely is the information about
5728 accessability of elements of it.
5730 (Expression::ExprClassFromMemberInfo): New constructor for
5731 Expressions that creates a fully initialized Expression based on
5732 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
5735 (Invocation::Resolve): Begin implementing resolution of invocations.
5737 * literal.cs (StringLiteral): Implement Emit.
5739 2001-09-05 Ravi Pratap <ravi@ximian.com>
5741 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
5744 2001-09-04 Ravi Pratap <ravi@ximian.com>
5746 * cs-parser.jay (attribute_arguments): Implement actions.
5747 (attribute): Fix bug in production. Implement action.
5748 (attribute_list): Implement.
5749 (attribute_target): Implement.
5750 (attribute_target_specifier, opt_target_specifier): Implement
5751 (CheckAttributeTarget): New method to check if the attribute target
5753 (attribute_section): Implement.
5754 (opt_attributes): Implement.
5756 * attribute.cs : New file to handle attributes.
5757 (Attribute): Class to hold attribute info.
5759 * cs-parser.jay (opt_attribute_target_specifier): Remove production
5760 (attribute_section): Modify production to use 2 different rules to
5761 achieve the same thing. 1 s/r conflict down !
5762 Clean out commented, useless, non-reducing dimension_separator rules.
5764 * class.cs (TypeContainer.attributes): New member to hold list
5765 of attributes for a type.
5766 (Struct::Struct): Modify to take one more argument, the attribute list.
5767 (Class::Class): Ditto.
5768 (Field::Field): Ditto.
5769 (Method::Method): Ditto.
5770 (Property::Property): Ditto.
5772 * cs-parser.jay (struct_declaration): Update constructor call to
5773 pass in the attributes too.
5774 (class_declaration): Ditto.
5775 (constant_declaration): Ditto.
5776 (field_declaration): Ditto.
5777 (method_header): Ditto.
5778 (fixed_parameter): Ditto.
5779 (parameter_array): Ditto.
5780 (property_declaration): Ditto.
5782 * constant.cs (Constant::Constant): Update constructor similarly.
5783 Use System.Collections.
5785 * parameter.cs (Parameter::Parameter): Update as above.
5787 2001-09-02 Ravi Pratap <ravi@ximian.com>
5789 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
5790 (TypeContainer.delegates): New member to hold list of delegates.
5792 * cs-parser.jay (delegate_declaration): Implement the action correctly
5793 this time as I seem to be on crack ;-)
5795 2001-09-02 Miguel de Icaza <miguel@ximian.com>
5797 * rootcontext.cs (RootContext::IsNamespace): new function, used to
5798 tell whether an identifier represents a namespace.
5800 * expression.cs (NamespaceExpr): A namespace expression, used only
5801 temporarly during expression resolution.
5802 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
5803 utility functions to resolve names on expressions.
5805 2001-09-01 Miguel de Icaza <miguel@ximian.com>
5807 * codegen.cs: Add hook for StatementExpressions.
5809 * class.cs: Fix inverted test for static flag in methods.
5811 2001-09-02 Ravi Pratap <ravi@ximian.com>
5813 * class.cs (Operator::CheckUnaryOperator): Correct error number used
5814 to make it coincide with MS' number.
5815 (Operator::CheckBinaryOperator): Ditto.
5817 * ../errors/errors.txt : Remove error numbers added earlier.
5819 * ../errors/cs1019.cs : Test case for error # 1019
5821 * ../errros/cs1020.cs : Test case for error # 1020
5823 * cs-parser.jay : Clean out commented cruft.
5824 (dimension_separators, dimension_separator): Comment out. Ostensibly not
5825 used anywhere - non-reducing rule.
5826 (namespace_declarations): Non-reducing rule - comment out.
5828 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
5829 with TypeContainer::AddEnum.
5831 * delegate.cs : New file for delegate handling classes.
5832 (Delegate): Class for declaring delegates.
5834 * makefile : Update.
5836 * cs-parser.jay (delegate_declaration): Implement.
5838 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
5840 * class.cs (Event::Define): Implement.
5841 (Event.EventBuilder): New member.
5843 * class.cs (TypeContainer::Populate): Update to define all enums and events
5845 (Events): New property for the events arraylist we hold. Shouldn't we move to using
5846 readonly fields for all these cases ?
5848 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
5850 * class.cs (Property): Revamp to use the convention of making fields readonly.
5851 Accordingly modify code elsewhere.
5853 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
5854 the Define method of the Property class.
5856 * class.cs : Clean up applied patch and update references to variables etc. Fix
5858 (TypeContainer::Populate): Update to define all the properties we have. Also
5859 define all enumerations.
5861 * enum.cs (Define): Implement.
5863 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
5865 * cs-parser.jay (overloadable_operator): The semantic value is an
5866 enum of the Operator class.
5867 (operator_declarator): Implement actions.
5868 (operator_declaration): Implement.
5870 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
5871 validity of definitions.
5872 (Operator::CheckBinaryOperator): Static method to check for binary operators
5873 (TypeContainer::AddOperator): New method to add an operator to a type.
5875 * cs-parser.jay (indexer_declaration): Added line to actually call the
5876 AddIndexer method so it gets added ;-)
5878 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
5879 already taken care of by the MS compiler ?
5881 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
5883 * class.cs (Operator): New class for operator declarations.
5884 (Operator::OpType): Enum for the various operators.
5886 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
5888 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
5889 ostensibly handle this in semantic analysis.
5891 * cs-parser.jay (general_catch_clause): Comment out
5892 (specific_catch_clauses, specific_catch_clause): Ditto.
5893 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
5894 (catch_args, opt_catch_args): New productions.
5895 (catch_clause): Rewrite to use the new productions above
5896 (catch_clauses): Modify accordingly.
5897 (opt_catch_clauses): New production to use in try_statement
5898 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
5899 and re-write the code in the actions to extract the specific and
5900 general catch clauses by being a little smart ;-)
5902 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
5903 Hooray, try and catch statements parse fine !
5905 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
5907 * statement.cs (Block::GetVariableType): Fix logic to extract the type
5908 string from the hashtable of variables.
5910 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
5911 I end up making that mistake ;-)
5912 (catch_clauses): Fixed gross error which made Key and Value of the
5913 DictionaryEntry the same : $1 !!
5915 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
5917 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
5919 * cs-parser.jay (event_declaration): Correct to remove the semicolon
5920 when the add and remove accessors are specified.
5922 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
5924 * cs-parser.jay (IndexerDeclaration): New helper class to hold
5925 information about indexer_declarator.
5926 (indexer_declarator): Implement actions.
5927 (parsing_indexer): New local boolean used to keep track of whether
5928 we are parsing indexers or properties. This is necessary because
5929 implicit_parameters come into picture even for the get accessor in the
5931 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
5933 * class.cs (Indexer): New class for indexer declarations.
5934 (TypeContainer::AddIndexer): New method to add an indexer to a type.
5935 (TypeContainer::indexers): New member to hold list of indexers for the
5938 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
5940 * cs-parser.jay (add_accessor_declaration): Implement action.
5941 (remove_accessor_declaration): Implement action.
5942 (event_accessors_declaration): Implement
5943 (variable_declarators): swap statements for first rule - trivial.
5945 * class.cs (Event): New class to hold information about event
5947 (TypeContainer::AddEvent): New method to add an event to a type
5948 (TypeContainer::events): New member to hold list of events.
5950 * cs-parser.jay (event_declaration): Implement actions.
5952 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
5954 * cs-parser.jay (dim_separators): Implement. Make it a string
5955 concatenating all the commas together, just as they appear.
5956 (opt_dim_separators): Modify accordingly
5957 (rank_specifiers): Update accordingly. Basically do the same
5958 thing - instead, collect the brackets here.
5959 (opt_rank_sepcifiers): Modify accordingly.
5960 (array_type): Modify to actually return the complete type string
5961 instead of ignoring the rank_specifiers.
5962 (expression_list): Implement to collect the expressions
5963 (variable_initializer): Implement. We make it a list of expressions
5964 essentially so that we can handle the array_initializer case neatly too.
5965 (variable_initializer_list): Implement.
5966 (array_initializer): Make it a list of variable_initializers
5967 (opt_array_initializer): Modify accordingly.
5969 * expression.cs (New::NType): Add enumeration to help us
5970 keep track of whether we have an object/delegate creation
5971 or an array creation.
5972 (New:NewType, New::Rank, New::Indices, New::Initializers): New
5973 members to hold data about array creation.
5974 (New:New): Modify to update NewType
5975 (New:New): New Overloaded contructor for the array creation
5978 * cs-parser.jay (array_creation_expression): Implement to call
5979 the overloaded New constructor.
5981 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
5983 * class.cs (TypeContainer::Constructors): Return member
5984 constructors instead of returning null.
5986 2001-08-26 Miguel de Icaza <miguel@ximian.com>
5988 * typemanager.cs (InitCoreTypes): Initialize the various core
5989 types after we have populated the type manager with the user
5990 defined types (this distinction will be important later while
5991 compiling corlib.dll)
5993 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
5994 on Expression Classification. Now all expressions have a method
5995 `Resolve' and a method `Emit'.
5997 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
5998 generation from working. Also add some temporary debugging
6001 2001-08-24 Miguel de Icaza <miguel@ximian.com>
6003 * codegen.cs: Lots of code generation pieces. This is only the
6004 beginning, will continue tomorrow with more touches of polish. We
6005 handle the fundamentals of if, while, do, for, return. Others are
6006 trickier and I need to start working on invocations soon.
6008 * gen-treedump.cs: Bug fix, use s.Increment here instead of
6011 * codegen.cs (EmitContext): New struct, used during code
6012 emission to keep a context. Most of the code generation will be
6015 * cs-parser.jay: Add embedded blocks to the list of statements of
6016 this block. So code generation proceeds in a top down fashion.
6018 2001-08-23 Miguel de Icaza <miguel@ximian.com>
6020 * statement.cs: Add support for multiple child blocks.
6022 2001-08-22 Miguel de Icaza <miguel@ximian.com>
6024 * codegen.cs (EmitCode): New function, will emit the code for a
6025 Block of code given a TypeContainer and its ILGenerator.
6027 * statement.cs (Block): Standard public readonly optimization.
6028 (Block::Block constructors): Link children.
6029 (Block::Child): Child Linker.
6030 (Block::EmitVariables): Emits IL variable declarations.
6032 * class.cs: Drop support for MethodGroups here, delay until
6034 (Method::): Applied the same simplification that I did before, and
6035 move from Properties to public readonly fields.
6036 (Method::ParameterTypes): Returns the parameter types for the
6037 function, and implements a cache that will be useful later when I
6038 do error checking and the semantic analysis on the methods is
6040 (Constructor::GetCallingConvention): Renamed from CallingConvetion
6041 and made a method, optional argument tells whether this is a class
6042 or a structure to apply the `has-this' bit.
6043 (Method::GetCallingConvention): Implement, returns the calling
6045 (Method::Define): Defines the type, a second pass is performed
6046 later to populate the methods.
6048 (Constructor::ParameterTypes): implement a cache similar to the
6049 one on Method::ParameterTypes, useful later when we do semantic
6052 (TypeContainer::EmitMethod): New method. Emits methods.
6054 * expression.cs: Removed MethodGroup class from here.
6056 * parameter.cs (Parameters::GetCallingConvention): new method.
6058 2001-08-21 Miguel de Icaza <miguel@ximian.com>
6060 * class.cs (TypeContainer::Populate): Drop RootContext from the
6063 (Constructor::CallingConvention): Returns the calling convention.
6064 (Constructor::ParameterTypes): Returns the constructor parameter
6067 (TypeContainer::AddConstructor): Keep track of default constructor
6068 and the default static constructor.
6070 (Constructor::) Another class that starts using `public readonly'
6071 instead of properties.
6073 (Constructor::IsDefault): Whether this is a default constructor.
6075 (Field::) use readonly public fields instead of properties also.
6077 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
6078 track of static constructors; If none is used, turn on
6079 BeforeFieldInit in the TypeAttributes.
6081 * cs-parser.jay (opt_argument_list): now the return can be null
6082 for the cases where there are no arguments.
6084 (constructor_declarator): If there is no implicit `base' or
6085 `this', then invoke the default parent constructor.
6087 * modifiers.cs (MethodAttr): New static function maps a set of
6088 modifiers flags into a MethodAttributes enum
6089 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
6090 MethodAttr, TypeAttr to represent the various mappings where the
6092 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
6094 2001-08-19 Miguel de Icaza <miguel@ximian.com>
6096 * parameter.cs (GetParameterInfo): Fix bug where there would be no
6099 * interface.cs (PopulateIndexer): Implemented the code generator
6100 for interface indexers.
6102 2001-08-17 Miguel de Icaza <miguel@ximian.com>
6104 * interface.cs (InterfaceMemberBase): Now we track the new status
6107 (PopulateProperty): Implement property population. Woohoo! Got
6108 Methods and Properties going today.
6110 Removed all the properties for interfaces, and replaced them with
6111 `public readonly' fields.
6113 2001-08-16 Miguel de Icaza <miguel@ximian.com>
6115 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
6116 initialize their hashtables/arraylists only when they are needed
6117 instead of doing this always.
6119 * parameter.cs: Handle refs and out parameters.
6121 * cs-parser.jay: Use an ArrayList to construct the arguments
6122 instead of the ParameterCollection, and then cast that to a
6125 * parameter.cs: Drop the use of ParameterCollection and use
6126 instead arrays of Parameters.
6128 (GetParameterInfo): Use the Type, not the Name when resolving
6131 2001-08-13 Miguel de Icaza <miguel@ximian.com>
6133 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
6134 and instead use public readonly fields.
6136 * class.cs: Put back walking code for type containers.
6138 2001-08-11 Miguel de Icaza <miguel@ximian.com>
6140 * class.cs (MakeConstant): Code to define constants.
6142 * rootcontext.cs (LookupType): New function. Used to locate types
6145 2001-08-08 Miguel de Icaza <miguel@ximian.com>
6147 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
6148 this System.Reflection code is. Kudos to Microsoft
6150 * typemanager.cs: Implement a type cache and avoid loading all
6151 types at boot time. Wrap in LookupType the internals. This made
6152 the compiler so much faster. Wow. I rule!
6154 * driver.cs: Make sure we always load mscorlib first (for
6155 debugging purposes, nothing really important).
6157 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
6158 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
6160 * rootcontext.cs: Lookup types on their namespace; Lookup types
6161 on namespaces that have been imported using the `using' keyword.
6163 * class.cs (TypeContainer::TypeAttr): Virtualize.
6164 (Class::TypeAttr): Return attributes suitable for this bad boy.
6165 (Struct::TypeAttr): ditto.
6166 Handle nested classes.
6167 (TypeContainer::) Remove all the type visiting code, it is now
6168 replaced with the rootcontext.cs code
6170 * rootcontext.cs (GetClassBases): Added support for structs.
6172 2001-08-06 Miguel de Icaza <miguel@ximian.com>
6174 * interface.cs, statement.cs, class.cs, parameter.cs,
6175 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
6176 Drop use of TypeRefs, and use strings instead.
6178 2001-08-04 Miguel de Icaza <miguel@ximian.com>
6182 * class.cs (Struct::Struct): set the SEALED flags after
6183 checking the modifiers.
6184 (TypeContainer::TypeAttr): new property, returns the
6185 TypeAttributes for a class.
6187 * cs-parser.jay (type_list): Oops, list production was creating a
6188 new list of base types.
6190 * rootcontext.cs (StdLib): New property.
6191 (GetInterfaceTypeByName): returns an interface by type name, and
6192 encapsulates error handling here.
6193 (GetInterfaces): simplified.
6194 (ResolveTree): Encapsulated all the tree resolution here.
6195 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
6198 * driver.cs: Add support for --nostdlib, to avoid loading the
6200 (Main): Do not put tree resolution here.
6202 * rootcontext.cs: Beginning of the class resolution.
6204 2001-08-03 Miguel de Icaza <miguel@ximian.com>
6206 * rootcontext.cs: Provide better error reporting.
6208 * cs-parser.jay (interface_base): set our $$ to be interfaces.
6210 * rootcontext.cs (CreateInterface): Handle the case where there
6211 are no parent interfaces.
6213 (CloseTypes): Routine to flush types at the end.
6214 (CreateInterface): Track types.
6215 (GetInterfaces): Returns an array of Types from the list of
6218 * typemanager.c (AddUserType): Mechanism to track user types (puts
6219 the type on the global type hash, and allows us to close it at the
6222 2001-08-02 Miguel de Icaza <miguel@ximian.com>
6224 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
6225 RecordInterface instead.
6227 * cs-parser.jay: Updated to reflect changes above.
6229 * decl.cs (Definition): Keep track of the TypeBuilder type that
6230 represents this type here. Not sure we will use it in the long
6231 run, but wont hurt for now.
6233 * driver.cs: Smaller changes to accomodate the new code.
6235 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
6238 * rootcontext.cs (CreateInterface): New method, used to create
6239 the System.TypeBuilder type for interfaces.
6240 (ResolveInterfaces): new entry point to resolve the interface
6242 (CodeGen): Property, used to keep track of the code generator.
6244 2001-07-26 Miguel de Icaza <miguel@ximian.com>
6246 * cs-parser.jay: Add a second production for delegate_declaration
6249 (enum_body): Put an opt_comma here instead of putting it on
6250 enum_body or enum_member_declarations so we can handle trailing
6251 commas on enumeration members. Gets rid of a shift/reduce.
6253 (type_list): Need a COMMA in the middle.
6255 (indexer_declaration): Tell tokenizer to recognize get/set
6257 * Remove old targets.
6259 * Re-add the parser target.
6261 2001-07-13 Simon Cozens <simon@simon-cozens.org>
6263 * cs-parser.jay: Add precendence rules for a number of operators
6264 ot reduce the number of shift/reduce conflicts in the grammar.
6266 2001-07-17 Miguel de Icaza <miguel@ximian.com>
6268 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
6271 Get rid of old crufty code.
6273 * rootcontext.cs: Use this to keep track of the parsed
6274 representation and the defined types available to the program.
6276 * gen-treedump.cs: adjust for new convention.
6278 * type.cs: Split out the type manager, and the assembly builder
6281 * typemanager.cs: the type manager will live here now.
6283 * cil-codegen.cs: And the code generator here.
6285 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
6287 * makefile: Fixed up for easy making.
6289 2001-07-13 Simon Cozens <simon@simon-cozens.org>
6291 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
6294 (unary_expression): Expand pre_increment_expression and
6295 post_decrement_expression to reduce a shift/reduce.
6297 2001-07-11 Simon Cozens
6299 * cs-tokenizer.cs: Hex numbers should begin with a 0.
6301 Improve allow_keyword_as_indent name.
6303 2001-06-19 Miguel de Icaza <miguel@ximian.com>
6305 * Adjustments for Beta2.
6307 2001-06-13 Miguel de Icaza <miguel@ximian.com>
6309 * decl.cs: Added `Define' abstract method.
6310 (InTransit): new property, used to catch recursive definitions.
6312 * interface.cs: Implement `Define'.
6314 * modifiers.cs: Map Modifiers.constants to
6315 System.Reflection.TypeAttribute flags.
6317 * class.cs: Keep track of types and user-defined types.
6318 (BuilderInit): New method for creating an assembly
6319 (ResolveType): New function to launch the resolution process, only
6320 used by interfaces for now.
6322 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
6323 that are inserted into the name space.
6325 2001-06-08 Miguel de Icaza <miguel@ximian.com>
6327 * ARGH. I have screwed up my tree so many times due to the use of
6328 rsync rather than using CVS. Going to fix this at once.
6330 * driver.cs: Objetify driver. Load assemblies, use assemblies to
6333 2001-06-07 Miguel de Icaza <miguel@ximian.com>
6335 * Experiment successful: Use System.Type rather that our own
6338 2001-05-25 Miguel de Icaza <miguel@ximian.com>
6340 * cs-parser.jay: Removed nsAliases from here.
6342 Use new namespaces, handle `using XXX;'
6344 * namespace.cs: Reimplemented namespace handling, use a recursive
6345 definition of the class. Now we can keep track of using clauses
6346 and catch invalid using clauses.
6348 2001-05-24 Miguel de Icaza <miguel@ximian.com>
6350 * gen-treedump.cs: Adapted for all the renaming.
6352 * expression.cs (Expression): this class now has a Type property
6353 which returns an expression Type.
6355 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
6356 `Type', as this has a different meaning now in the base
6358 2001-05-22 Miguel de Icaza <miguel@ximian.com>
6360 * interface.cs, class.cs: Removed from all the sources the
6361 references to signature computation, as we can not do method
6362 signature computation during the parsing time, as we are not
6363 trying to solve at that point distinguishing:
6367 void a (NS.Blah x) {}
6370 Which depending on the context might be valid or not, as we do not
6371 know if Blah is the same thing as NS.Blah at that point.
6373 * Redid everything so the code uses TypeRefs now instead of
6374 Types. TypeRefs are just temporary type placeholders, that need
6375 to be resolved. They initially have a pointer to a string and the
6376 current scope in which they are used. This is used later by the
6377 compiler to resolve the reference to an actual Type.
6379 * DeclSpace is no longer a CIR.Type, and neither are
6380 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
6381 are all DeclSpaces, but no Types.
6383 * type.cs (TypeRefManager): This implements the TypeRef manager,
6384 which keeps track of all the types that need to be resolved after
6385 the parsing has finished.
6387 2001-05-13 Miguel de Icaza <miguel@ximian.com>
6389 * ARGH. We are going to have to store `foreach' as a class rather
6390 than resolving it, as we need to verify error 1579 after name
6391 resolution. *OR* we could keep a flag that says `This request to
6392 IEnumerator comes from a foreach statement' which we can then use
6393 to generate the error.
6395 2001-05-10 Miguel de Icaza <miguel@ximian.com>
6397 * class.cs (TypeContainer.AddMethod): we now add methods to the
6398 MethodGroup instead of the method hashtable.
6400 * expression.cs: Add MethodGroup abstraction, which gets us one
6401 step closer to the specification in the way we handle method
6404 * cs-parser.jay (primary_expression): qualified_identifier now
6405 tried to match up an identifier to a local variable reference or
6406 to a parameter reference.
6408 current_local_parameters is now a parser global variable that
6409 points to the current parameters for the block, used during name
6412 (property_declaration): Now creates an implicit `value' argument to
6415 2001-05-09 Miguel de Icaza <miguel@ximian.com>
6417 * parameter.cs: Do not use `param' arguments as part of the
6418 signature, per the spec.
6420 2001-05-08 Miguel de Icaza <miguel@ximian.com>
6422 * decl.cs: Base class for classes, structs and interfaces. This
6423 is the "Declaration Space"
6425 * cs-parser.jay: Use CheckDef for checking declaration errors
6426 instead of having one on each function.
6428 * class.cs: Factor out some code for handling error handling in
6429 accordance to the "Declarations" section in the "Basic Concepts"
6430 chapter in the ECMA C# spec.
6432 * interface.cs: Make all interface member classes derive from
6433 InterfaceMemberBase.
6435 2001-05-07 Miguel de Icaza <miguel@ximian.com>
6437 * Many things: all interfaces are parsed and generated in
6438 gen-treedump. Support for member variables, constructors,
6439 destructors, properties, constants is there.
6441 Beginning of the IL backend, but very little done, just there for
6444 2001-04-29 Miguel de Icaza <miguel@ximian.com>
6446 * cs-parser.jay: Fix labeled statement.
6448 * cs-tokenizer.cs (escape): Escape " and ' always.
6449 ref_line, ref_name: keep track of the line/filename as instructed
6450 by #line by the compiler.
6453 2001-04-27 Miguel de Icaza <miguel@ximian.com>
6455 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
6456 to match the values in System.CodeDOM.
6458 Divid renamed to Divide.
6460 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
6462 (Statements.set): remove.
6464 * System.CodeDOM/CodeCatchClause.cs: always have a valid
6467 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
6468 falseStatements always have valid values.
6470 * cs-parser.jay: Use System.CodeDOM now.