1 2002-04-09 Miguel de Icaza <miguel@ximian.com>
3 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
4 wanted to pass `false' as the `is_delegate' argument. If this is
5 the case, why not use delegate_type == null to mean `is_delegate =
6 false' and anything else as is_delegate = true.
8 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
10 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
11 code for the section, not the beginning of the tests.
13 2002-04-08 Miguel de Icaza <miguel@ximian.com>
15 * cfold.cs: Handle operator + (Enum x, Underlying x)
17 * expression.cs (Binary): same. Warn about errors where we have
18 Enum/Enum in operator + as well.
20 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
23 - added support for switch(bool)
24 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
25 - add TableSwitchEmit() to handle table-based switch statements
27 2002-04-05 Ravi Pratap <ravi@ximian.com>
29 * expression.cs (Invocation.OverloadResolve): Factor out code which
30 does parameter compatibility checking with arguments so that we can
31 re-use the code even from Delegate.VerifyApplicability
33 (VerifyArgumentsCompat): Move above code here.
35 * delegate.cs (VerifyApplicability): Get rid of duplicate code
36 and instead make a call to the above method.
38 2002-03-31 Ravi Pratap <ravi@ximian.com>
40 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
41 We use it to keep track of classes which are attribute types.
43 2002-04-02 Miguel de Icaza <miguel@ximian.com>
45 * delegate.cs (Delegate.Define): Correctly define the types in the
46 presence of fixed and array parameters.
48 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
51 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
52 include NonPublic after the first iteration.
54 * class.cs (Indexer.CheckBase): Only check if both parents are
57 * cs-parser.jay (accessor_body): If empty, set to null.
59 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
60 same code path here to resolve constants names that we did have in
61 MemberAccess.DoResolve. There is too much code duplicated here.
63 2002-04-01 Miguel de Icaza <miguel@ximian.com>
65 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
67 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
70 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
71 tokens, numbers and strings.
73 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
76 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
77 asyncronous parameters and the regular parameters.
79 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
80 specify the target directory.
82 * expression.cs: (This.DoResolve): Simplify
83 (As.Emit): Optimize, do not generate IsInst if the expression is
84 always of the given type.
86 (Is.DoResolve): Bug fix, we were reporting both always/never for
89 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
90 creating too many unnecessary arrays.
92 2002-03-31 Miguel de Icaza <miguel@ximian.com>
94 * class.cs (EmitFieldInitializer): Use Assign expression to assign
95 fields instead of rolling our own initializer. Takes care of all
96 implicit conversions, and drops unnecessary static checks/argument.
98 2002-03-31 Dick Porter <dick@ximian.com>
100 * driver.cs: use the GetDirectories() return values properly, and
101 use "/" as path separator.
103 2002-03-30 Miguel de Icaza <miguel@ximian.com>
105 * expression.cs (Unary): Optimize - - expr into expr.
106 (Binary): Optimize a + (-b) into a -b.
108 * codegen.cs (CodeGen): Made all methods static.
110 2002-03-29 Miguel de Icaza <miguel@ximian.com>
114 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
115 TypeBuilder property.
117 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
120 * tree.cs: Removed the various RecordXXXX, and replaced with a
121 single RecordDecl. Removed all the accessor methods, and just
122 left a single access point Type
124 * enum.cs: Rename DefineEnum to DefineType.
126 * decl.cs: New abstract method `DefineType' used to unify the
127 Defines for Enumerations, Interfaces, TypeContainers and
130 (FindType): Moved LookupInterfaceOrClass here. Moved the
131 LookupBaseClasses method that used to live in class.cs and
132 interface.cs here, and renamed to FindType.
134 * delegate.cs: Implement DefineType. Take advantage of the
135 refactored pattern for locating the parent builder without taking
136 the parent_builder argument (which we know does not work if we are
137 nested, and triggering a toplevel definition).
139 2002-03-28 Miguel de Icaza <miguel@ximian.com>
141 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
142 accessibility of a member has changed during override and report
145 * class.cs (Method.Define, Property.Define): Only complain on
146 overrides if the method is private, any other accessibility is
147 fine (and since we just checked the permission is the same, we are
150 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
151 and elif are processed always. The other pre-processing
152 directives are only processed if we are "taking" the path
154 2002-03-29 Martin Baulig <martin@gnome.org>
156 * class.cs (Method.Emit): Only emit symbolic debugging info if the
157 current location is not Null.
159 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
160 a separate method so we can profile it.
162 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
163 `span.Seconds' are just seconds, but no minutes or hours.
164 (MainDriver): Profile the CodeGen.SaveSymbols calls.
166 2002-03-28 Miguel de Icaza <miguel@ximian.com>
168 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
169 Remove the gratuitous set of Final:
171 // If an interface implementation, then we can set Final.
172 if (((flags & MethodAttributes.Abstract) == 0) &&
173 implementing.DeclaringType.IsInterface)
174 flags |= MethodAttributes.Final;
176 I do not know what I was smoking when I used that.
179 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
180 step into fixing the name resolution issues for delegates and
181 unifying the toplevel name resolution.
183 2002-03-28 Martin Baulig <martin@gnome.org>
185 * class.cs (Method.Emit): If we have a symbol writer, call its
186 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
187 tell it about the current method.
189 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
190 writer that we're going to emit the first byte of IL code for a new
191 statement (a new source line).
192 (EmitContext.EmitTopBlock): If we have a symbol writer, call
193 EmitContext.Mark() before emitting any code.
195 * location.cs (SymbolDocument): Return null when we're Null.
197 * statement.cs (Statement): Moved the `Location loc' variable here.
198 (Statement.EmitBoolExpression): If we have a symbol writer, call
199 ec.Mark() before emitting any code to tell it that we're at the
200 beginning of a new statement.
201 (StatementExpression): Added `Location' argument to the constructor.
202 (Block): Added public readonly variable `StartLocation' and public
203 variable `EndLocation'. The latter is to be set using SetEndLocation().
204 (Block): Added constructor which takes a start and end location.
205 (Block.SetEndLocation): New method. This sets the end location.
206 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
207 local variables we create.
208 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
209 each statement and do also mark the begin and end of the block.
211 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
212 tell it the current lexer.Location, use Location.Null for the end of the
214 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
215 current block, set its end location using SetEndLocation().
216 (statement_expression): StatementExpression constructor now takes the
217 lexer.Location as additional argument.
218 (for_statement, declare_local_variables): Likewise.
219 (declare_local_variables): When creating a new implicit block, use the
220 new Block constructor and pass it the lexer.Location.
222 2002-03-28 Miguel de Icaza <miguel@ximian.com>
224 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
225 members also on the parent interfaces recursively.
227 2002-03-27 Miguel de Icaza <miguel@ximian.com>
229 * report.cs: Use new formats, since Gonzalo finished the missing
232 * expression.cs (Binary.ResolveOperator): added missing operator|
233 operator& and operator^ for bool/bool.
235 * cs-parser.jay: CheckDef now takes a Location argument that is
236 used to report errors more precisly (instead of reporting the end
237 of a definition, we try to track something which is a lot closer
238 to the source of the problem).
240 * cs-tokenizer.cs: Track global token use, so we can properly flag
241 the use of #define/#undef after the first token has been seen.
243 Also, rename the reportXXXX to Error_DescriptiveName
245 * decl.cs (DeclSpace.IsTopLevel): Move property here from
246 TypeContainer, so that Enum and Interface can use this too.
248 * class.cs (TypeContainer.LookupInterfaceOrClass,
249 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
250 `builder' argument. Typically this was used to pass the parent
251 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
254 The problem is that a nested class could trigger the definition of
255 a toplevel class, and the builder would be obviously wrong in that
258 So we drop this argument, and we compute dynamically the
259 TypeBuilder/ModuleBuilder (the correct information was available
260 to us anyways from DeclSpace.Parent)
262 * interface.cs (Interface.DefineInterface): Drop builder
263 parameter cleanup like class.cs
265 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
268 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
271 (Try.Emit): Propagate the returns value from the statement.
273 (Return.Emit): Even if we are leavning
275 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
277 * modifiers.cs: Fix the computation of MethodAttributes flags.
279 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
281 * driver.cs: allow compilation of files that start with '/'.
282 Add a default case when checking the argument of --target.
284 2002-03-25 Miguel de Icaza <miguel@ximian.com>
286 * interface.cs: Implement the same search algorithm for types in
289 * delegate.cs: Do not allow multiple definition.
291 * Recovered ChangeLog that got accidentally amputated
293 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
295 * rootcontext.cs: Load manually enum to allow core classes to
296 contain enumerations.
298 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
299 Update to new static methods in TypeManager.
301 * typemanager.cs (GetMethod, GetConstructor): Use our
302 implementation of FindMembers to find the members, since during
303 corlib compilation, the types are TypeBuilders and GetMethod and
304 GetConstructor do not work.
306 Make all methods in TypeManager static.
308 (InitCodeHelpers): Split the functionality from
309 the InitCodeTypes function.
311 * driver.cs: Call InitCodeHelpers after we have populated the
314 * cs-parser.jay (delegate_declaration): we did not used to compute
315 the delegate name correctly for void delegates.
317 2002-03-24 Miguel de Icaza <miguel@ximian.com>
319 * rootcontext.cs (RootContext): Init the interface_resolve_order
320 and type_container_resolve_order always.
322 (ResolveCore, BootstrapCorlib_ResolveClass,
323 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
324 compiler when compiling with --nostdlib
326 * class.cs (TypeContainer.DefineType): Check that our parent is
327 not null. This test is most important when we are bootstraping
330 * codegen.cs: Split out the symbol writing code.
332 2002-03-25 Martin Baulig <martin@gnome.org>
334 * driver.cs (-g): Made -g an alias for --debug.
336 2002-03-24 Martin Baulig <martin@gnome.org>
338 * codegen.cs (SymbolWriter): New public variable. Returns the
339 current symbol writer.
340 (CodeGen): Added `bool want_debugging_support' argument to the
341 constructor. If true, tell the ModuleBuild that we want debugging
342 support and ask it for the ISymbolWriter.
343 (Save): If we have a symbol writer, call it's Close() method after
346 * driver.c (--debug): New command line argument to create a
347 debugger information file.
349 * location.cs (SymbolDocument): New public property. Returns an
350 ISymbolDocumentWriter object for the current source file or null
351 if we don't have a symbol writer.
353 2002-03-21 Miguel de Icaza <miguel@ximian.com>
355 * driver.cs (LoadAssembly): Correctly return when all the paths
356 have been tried and not before.
358 * statement.cs (Switch.Emit): return the actual coverage for this
359 statement (returns/not-returns)
361 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
362 switch of the statement if we are the last switch section. That
363 kills two problems: try/catch problems (we used to emit an empty
364 nop at the end) and switch statements where all branches would
367 2002-03-19 Miguel de Icaza <miguel@ximian.com>
369 * driver.cs: Add default assemblies (the equivalent to the
370 Microsoft CSC.RSP file)
372 * cs-tokenizer.cs: When updating `cols and setting it to zero,
373 also update tokens_seen and set it to false.
375 * driver.cs: Implement --recurse for Mike.
377 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
378 correctly splitting out the paths.
380 2002-03-18 Miguel de Icaza <miguel@ximian.com>
382 * interface.cs (Interface.PopulateProperty): Instead of using
383 `parent' as the declaration space for the set parameters, use
386 * support.cs (InternalParameters): InternalParameters constructor
387 takes a DeclSpace instead of a TypeContainer.
389 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
390 types are being initialized, load the address of it before calling
393 (New): Provide a mechanism to disable the generation of local
394 value type temporaries when the caller will be providing us with
395 an address to store it.
397 (ArrayCreation.EmitDynamicInitializers): Use it.
399 2002-03-17 Miguel de Icaza <miguel@ximian.com>
401 * expression.cs (Invocation.EmitArguments): Only probe for array
402 property if there is more than one argument. Sorry about that.
404 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
407 * class.cs (Method.LabelParameters): Fix incorrect code path that
408 prevented the `ParamArrayAttribute' from being applied to the
411 2002-03-16 Miguel de Icaza <miguel@ximian.com>
413 * support.cs (ReflectionParameters): Correctly compute whether the
414 last argument is a params array. Fixes the problem with
417 * typemanager.cs: Make the assemblies array always be non-null
418 (empty, but non-null)
420 * tree.cs (RecordDecl): New function that abstracts the recording
421 of names. This reports error 101, and provides a pointer to the
422 previous declaration. Fixes a crash in the compiler.
424 * cs-parser.jay (constructor_declaration): Update to new grammar,
425 and provide a constructor_body that can be empty.
427 2002-03-15 Miguel de Icaza <miguel@ximian.com>
429 * driver.cs: Add support for --resources.
431 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
432 Make all types for the various array helper methods be integer.
434 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
435 CheckState to ConvCast.
437 (ConvCast): Now it takes a `checked' state argument, to avoid
438 depending on the emit context for the conversion, and just using
439 the resolve time setting.
441 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
442 instead of Invocation.EmitArguments. We do not emit the original
443 arguments, instead we emit those which have been converted to
444 unsigned int expressions.
446 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
450 * expression.cs (LocalVariableReference): Drop the use of the
451 Store function that depended on the variable index.
453 * statement.cs (VariableInfo): Drop the `Idx' property from this
454 class, as this is not taking into account the indexes for
455 temporaries tat we generate during the execution, getting the
458 * class.cs: First emit class initializers, then call the parent
461 * expression.cs (Binary): Fix opcode emision.
462 (UnaryMutator.EmitCode): Support checked code generation
464 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
465 matches for events for both the Static and Instance scans,
466 pointing to the same element. Fix that.
468 2002-03-14 Miguel de Icaza <miguel@ximian.com>
470 * rootcontext.cs (ResolveTree): Always set the
471 interface_resolve_order, because nested interfaces will be calling
474 * class.cs (GetInterfaceOrClass): Track the same resolution
475 process used by TypeManager.LookupType. This fixes the nested
476 type lookups in class declarations (separate path from
479 (TypeContainer.DefineType): Also define nested interfaces.
480 (TypeContainer.RegisterOrder): New public function used to
481 register the order in which child interfaces need to be closed.
483 Nested interfaces need to be closed after their parents have been
486 * interface.cs (InterfaceAttr): Put all the logic for computing
487 the interface attribute here.
489 (DefineInterface): Register our interface order with the
490 RootContext or with the TypeContainer depending on the case.
492 2002-03-12 Miguel de Icaza <miguel@ximian.com>
494 * cs-parser.jay: rework foreach statement to work with the new
495 changes to the policy on SimpleNames.
497 * report.cs: support Stacktrace on warnings as well.
499 * makefile: drop --unsafe and /unsafe from the compile.
501 2002-03-13 Ravi Pratap <ravi@ximian.com>
503 * ecore.cs (StandardConversionExists): Modify to take an Expression
504 as the first parameter. Ensure we do null -> reference type conversion
507 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
508 temporary Expression objects.
510 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
512 * interface.cs: workaround bug in method overloading resolution
513 (there is already a bugzilla bug for it).
515 2002-03-12 Miguel de Icaza <miguel@ximian.com>
517 We could also solve this problem by having a separate path for
518 performing type lookups, instead of DoResolve, we could have a
519 ResolveType entry point, and only participating pieces of the
520 production (simplename, deref, array) would implement this.
522 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
523 signal SimpleName to only resolve type names and not attempt to
524 resolve anything else.
526 * expression.cs (Cast): Set the flag.
528 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
530 * class.cs: Only report 108 if there is no `new' modifier.
532 * cs-parser.jay: rework foreach statement to work with the new
533 changes to the policy on SimpleNames.
535 * report.cs: support Stacktrace on warnings as well.
537 * makefile: drop --unsafe and /unsafe from the compile.
539 2002-03-11 Miguel de Icaza <miguel@ximian.com>
541 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
542 lookups here, instead of doing that at parse time. This means
543 that our grammar will not introduce `LocalVariableReferences' as
544 expressions at this point. That solves the problem of code like
552 This is only half the fix. The full fix requires parameters to
553 also be handled in this way.
555 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
556 makes the use more obvious of the DeclSpace. The
557 ec.TypeContainer.TypeBuilder is now only used to pull the
560 My theory is that I can get rid of the TypeBuilder completely from
561 the EmitContext, and have typecasts where it is used (from
562 DeclSpace to where it matters).
564 The only pending problem is that the code that implements Aliases
565 is on TypeContainer, and probably should go in DeclSpace.
567 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
568 lookups here, instead of doing that at parse time. This means
569 that our grammar will not introduce `LocalVariableReferences' as
570 expressions at this point. That solves the problem of code like
578 This is only half the fix. The full fix requires parameters to
579 also be handled in this way.
581 * class.cs (Property.DefineMethod): When implementing an interface
582 method, set newslot, when implementing an abstract method, do not
583 set the flag (before we tried never setting it, or always setting
584 it, which is the difference).
585 (Indexer.DefineMethod): same.
586 (Method.DefineMethod): same.
588 * ecore.cs: Only set the status used flag if we get back a Field.
590 * attribute.cs: Temporary hack, so Paolo can keep working.
592 2002-03-08 Ravi Pratap <ravi@ximian.com>
594 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
595 the unmanaged type in the case we have a MarshalAs attribute.
597 (Resolve): Handle the case when we are parsing the special MarshalAs
598 attribute [we need to store the unmanaged type to use later]
600 * typemanager.cs (marshal_as_attr_type): Built in type for the
603 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
604 on parameters and accordingly set the marshalling info.
606 2002-03-09 Miguel de Icaza <miguel@ximian.com>
608 * class.cs: Optimizing slightly by removing redundant code after
609 we switched to the `NoTypes' return value.
610 (Property.DefineMethod): use NoTypes here too.
612 This fixes the bug I introduced in my last batch of changes.
614 2002-03-05 Ravi Pratap <ravi@ximian.com>
616 * tree.cs (RecordEnum): Add. We now keep track of enums too.
618 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
619 Enums since those are types too.
621 * cs-parser.jay (enum_declaration): Record enums as we parse them.
623 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
624 thanks to a call during the lookup process.
626 2002-03-07 Miguel de Icaza <miguel@ximian.com>
628 * statement.cs (Foreach): Lots of work to accomodate a particular
629 kind of foreach statement that I had not kept in mind. It is
630 possible to have foreachs on classes that provide a GetEnumerator
631 method that return objects that implement the "pattern" for using
632 a foreach, there is no need to support GetEnumerator
635 This is needed to compile nant.
637 * decl.cs: Only report 114 if the member is not `Finalize' and if
638 the warning level is at least 2.
640 * class.cs: Moved the compare function from Method to
643 (MethodSignature.InheritableMemberSignatureCompare): Add new
644 filter function that is used to extract inheritable methods from a
647 (Method.Define): Use the new `inheritable_method_signature_filter'
650 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
653 2002-03-06 Miguel de Icaza <miguel@ximian.com>
655 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
657 * cs-parser.jay: Add opt_semicolon to the interface declaration.
659 * expression.cs: Pass location information to
660 ConvertImplicitStandard.
662 * class.cs: Added debugging code to track return values from
665 2002-03-05 Miguel de Icaza <miguel@ximian.com>
667 * expression.cs (Is.DoResolve): If either side of the `is' is an
668 interface, do not flag the warning.
670 * ecore.cs (ImplicitReferenceConversion): We need a separate test
673 * report.cs: Allow for --fatal to be used with --probe.
675 * typemanager.cs (NoTypes): Move the definition for the empty Type
678 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
680 (TypeContainer.DefineProxy): New function used to proxy to parent
681 implementations when implementing interfaces.
682 (TypeContainer.ParentImplements): used to lookup if our parent
683 implements a public function that is required by an interface.
684 (TypeContainer.VerifyPendingMethods): Hook this up.
686 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
687 `modules' and `assemblies' arraylists into arrays. We only grow
688 these are the very early start up of the program, so this improves
689 the speedof LookupType (nicely measured).
691 * expression.cs (MakeByteBlob): Replaced unsafe code with
692 BitConverter, as suggested by Paolo.
694 * cfold.cs (ConstantFold.Binary): Special case: perform constant
695 folding of string concatenation, but if either side is a string,
696 and the other is not, then return null, and let the runtime use
697 the concatenation on the string plus the object (using
700 2002-03-04 Miguel de Icaza <miguel@ximian.com>
702 Constant Folding has been implemented now.
704 * expression.cs (Unary.Reduce): Do not throw an exception, catch
705 the error instead on types that are not supported in one's
708 * constant.cs (Constant and all children): New set of functions to
709 perform implict and explicit conversions.
711 * ecore.cs (EnumConstant): Implement the new functions to perform
712 conversion by proxying to the child expression.
714 * codegen.cs: (ConstantCheckState): Constant evaluation has its
715 own separate setting that can not be turned off from the command
716 line using --unchecked or --checked and is only controlled using
717 the checked/unchecked statements and expressions. This setting is
718 used by the constant folder to flag errors.
720 * expression.cs (CheckedExpr, UncheckedExpr): Set the
721 ConstantCheckState as well.
723 During Resolve, they also have to flag the state, because the
724 constant folder runs completely in the Resolve phase.
726 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
729 2002-03-01 Miguel de Icaza <miguel@ximian.com>
731 * cfold.cs: New file, this file contains the constant folder.
733 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
734 argument to track whether we are using the resulting address to
735 load or store a value and provide better error messages.
737 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
738 new AddressOf arguments.
740 * statement.cs (Foreach.EmitCollectionForeach): Update
742 * expression.cs (Argument.Emit): Call AddressOf with proper
743 arguments to track usage.
745 (New.DoEmit): Call AddressOf with new arguments.
747 (Unary.Emit): Adjust AddressOf call.
749 2002-03-01 Ravi Pratap <ravi@ximian.com>
751 * cs-parser.jay (member_access): Change the case for pre-defined types
752 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
755 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
758 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
759 essentially like methods and apply attributes like MethodImplOptions to them too.
761 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
764 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
765 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
768 * Update code everywhere accordingly.
770 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
772 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
774 2002-02-28 Ravi Pratap <ravi@ximian.com>
776 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
777 try performing lookups against those instead of jumping straight into using
780 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
782 (LookupType): Perform lookups in implicit parents too.
784 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
785 sequence as RootContext.LookupType.
787 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
788 the various cases of namespace lookups into this method.
790 2002-03-01 Miguel de Icaza <miguel@ximian.com>
792 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
793 in positional arguments)
795 * class.cs (Operator): Update the AllowedModifiers to contain
798 * cs-parser.jay: Update operator declaration to allow for the
799 operator body to be empty.
801 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
804 2002-02-27 Miguel de Icaza <miguel@ximian.com>
806 * class.cs (Method.Emit): Label parameters.
808 * driver.cs: Return 1 or 0 as the program exit code.
810 2002-02-26 Miguel de Icaza <miguel@ximian.com>
812 * expression.cs: Special case the `null' object when trying to
813 auto-compute the type, as anything can be explicitly converted to
816 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
819 (Expression.ImplicitNumericConversion): Perform comparissions of
820 the type using the underlying type in the case of an enumeration
821 rather than using the enumeration type for the compare.
823 Cope with the underlying == type case, which is not possible to
826 (Expression.ConvertNumericExplicit): Perform comparissions of
827 the type using the underlying type in the case of an enumeration
828 rather than using the enumeration type for the compare.
830 * driver.cs: If the user does not supply an extension, assume .exe
832 * cs-parser.jay (if_statement): Rewrote so that we can track the
833 location for the if statement.
835 * expression.cs (Binary.ConstantFold): Only concat strings when
836 the operation is "+", not everything ;-)
838 * statement.cs (Statement.EmitBoolExpression): Take a location
840 (If, While, Do): Track location.
842 * expression.cs (Binary.ResolveOperator): In the object + string
843 case, I was missing a call to ConvertImplicit
845 2002-02-25 Ravi Pratap <ravi@ximian.com>
847 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
848 Location arguments. Ensure we use RootContext.LookupType to do our work
849 and not try to do a direct Type.GetType and ModuleBuilder.GetType
851 * interface.cs (PopulateMethod): Handle the type of the parameter being
854 * expression.cs (Invocation.BetterFunction): Handle the case when we
855 have a params method with no fixed arguments and a call is made with no
858 2002-02-25 Miguel de Icaza <miguel@ximian.com>
860 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
861 the verbatim-string-literal
863 * support.cs (InternalParameters.ParameterModifier): handle null
865 (InternalParameters.ParameterType): ditto.
867 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
868 duplicating the name of the variable parameter.
869 (GetParameterByName): Fix bug where we were not looking up array
870 paramters if they were the only present (thanks Paolo!).
871 (GetParameterInfo): We only have an empty set of types if both
872 fixed and array are set to null.
873 (GetParameterInfo-idx): Handle FixedParameter == null
875 * cs-parser.jay: Handle the case where there is no catch
876 statements (missing null test).
878 2002-02-22 Miguel de Icaza <miguel@ximian.com>
880 * driver.cs (MainDriver): Be conservative on our command line
883 Catch DirectoryNotFoundException when calling GetFiles.
885 (SplitPathAndPattern): Used to split the input specification into
886 a path and a pattern that we can feed to Directory.GetFiles.
888 2002-02-21 Miguel de Icaza <miguel@ximian.com>
890 * statement.cs (Fixed): Implement the last case of the Fixed
891 statement (string handling).
893 * expression.cs (StringPtr): New class used to return a char * to
894 a string; Used by the Fixed statement.
896 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
898 * expression.cs (Binary.ResolveOperator): Remove redundant
899 MemberLookup pn parent type.
900 Optimize union call, we do not need a union if the types are the same.
901 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
904 Specialize the use of MemberLookup everywhere, instead of using
905 the default settings.
907 (StackAlloc): Implement stackalloc keyword.
909 * cs-parser.jay: Add rule to parse stackalloc.
911 * driver.cs: Handle /h, /help, /?
913 * expression.cs (MakeByteBlob): Removed the hacks we had in place
914 before we supported unsafe code.
916 * makefile: add --unsafe to the self compilation of mcs.
918 2002-02-20 Miguel de Icaza <miguel@ximian.com>
920 * expression.cs (PointerArithmetic): New class that is used to
921 perform pointer arithmetic.
922 (Binary.Resolve): Handle pointer arithmetic
923 Handle pointer comparission.
924 (ArrayPtr): Utility expression class that is used to take the
927 (ElementAccess): Implement array access for pointers
929 * statement.cs (Fixed): Implement fixed statement for arrays, we
930 are missing one more case before we are done.
932 * expression.cs (Indirection): Implement EmitAssign and set the
933 ExprClass to Variable. This allows pointer dereferences to be
934 treated as variables, and to have values assigned to them.
936 * ecore.cs (Expression.StoreFromPtr): New utility function to
937 store values dereferencing.
939 2002-02-20 Ravi Pratap <ravi@ximian.com>
941 * expression.cs (Binary.ResolveOperator): Ensure that we are
942 not trying to operate on a void type - this fixes the reported
945 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
946 the parent implementation is sealed.
948 * ../errors/cs0239.cs : Add.
950 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
952 * typemanager.cs (unverifiable_code_type): Corresponds to
953 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
954 which have unsafe code in them.
956 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
959 2002-02-19 Miguel de Icaza <miguel@ximian.com>
961 * cs-tokenizer.cs: Add support for @"litreal strings"
963 Make tokenizer accept pre-processor directives
964 on any column (remove the old C-like limitation).
966 * rootcontext.cs (EmitCode): Emit any global attributes.
967 (AddGlobalAttributes): Used to keep track of assembly attributes.
969 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
971 * cs-parser.jay: Add support for global attributes.
973 2002-02-17 Miguel de Icaza <miguel@ximian.com>
975 * expression.cs (Indirection): New helper class. Unary will
976 create Indirection classes to be able to implement the
977 IMemoryLocation interface on it.
979 2002-02-16 Miguel de Icaza <miguel@ximian.com>
981 * cs-parser.jay (fixed_statement): reference the right statement.
983 * statement.cs (Fixed.Emit): Finish implementing the fixed
984 statement for the &x case.
986 2002-02-14 Miguel de Icaza <miguel@ximian.com>
988 * class.cs (Property.Define, Method.Define): Remove newslot when
991 * modifiers.cs: My use of NewSlot when `Abstract' was set was
992 wrong. NewSlot should only be used if the `new' keyword is present.
994 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
995 locating our system dir. Sorry about this.
997 2002-02-13 Miguel de Icaza <miguel@ximian.com>
999 * driver.cs (GetSystemDir): Compute correctly the location of our
1000 system assemblies. I was using the compiler directory instead of
1001 the library directory.
1003 2002-02-13 Ravi Pratap <ravi@ximian.com>
1005 * expression.cs (BetterFunction): Put back in what Miguel commented out
1006 since it is the correct fix. The problem is elsewhere ;-)
1008 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
1009 parameters of the parms method are themselves compatible or not !
1011 (StandardConversionExists): Fix very dangerous bug where we were forgetting
1012 to check that a class implements an interface before saying that an implicit
1013 conversion was allowed. Use ImplementsInterface to do the checking.
1015 2002-02-13 Miguel de Icaza <miguel@ximian.com>
1017 * class.cs (Method.Define): Track whether we are an explicit
1018 implementation or not. And only call DefineMethodOverride if we
1019 are an explicit implementation.
1021 (Property.DefineMethod): Ditto.
1023 2002-02-11 Ravi Pratap <ravi@ximian.com>
1025 * expression.cs (BetterFunction): Catch hideous bug which was
1026 preventing us from detecting ambiguous calls due to implicit casts i.e
1029 2002-01-29 Miguel de Icaza <miguel@ximian.com>
1031 * support.cs (Pair): Remove un-needed method. I figured why I was
1032 getting the error in cs-parser.jay, the variable in a foreach loop
1033 is readonly, and the compiler does not really treat this as a variable.
1035 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
1036 instead of EQUALS in grammar.
1038 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
1040 * expression.cs (Unary.DoResolve): Check whether the argument is
1043 2002-01-28 Miguel de Icaza <miguel@ximian.com>
1045 * support.cs: Api for Pair to set a value. Despite the fact that
1046 the variables are public the MS C# compiler refuses to compile
1047 code that accesses the field if the variable is part of a foreach
1050 * statement.cs (Fixed): Begin implementation of the fixed
1053 (Block.AddVariable): Return the VariableInfo on success and null
1054 on failure instead of true/false.
1056 * cs-parser.jay (foreach): Catch errors on variables already
1057 defined (we were ignoring this value before) and properly unwind
1060 (fixed_statement): grammar for the fixed statement.
1062 2002-01-25 Miguel de Icaza <miguel@ximian.com>
1064 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
1065 pointer types to be incretemented.
1067 (SizeOf): Implement.
1069 * cs-parser.jay (pointer_member_access): Implement
1070 expr->IDENTIFIER production.
1072 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
1073 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
1076 (Unary): Implement indirection.
1078 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
1079 use in non-unsafe context).
1081 (SimpleName.DoResolve): Check for pointers in field access on safe
1084 (Expression.LoadFromPtr): Factor the load-indirect code in this
1085 function. This was duplicated in UnboxCast and ParameterReference
1087 2002-01-24 Miguel de Icaza <miguel@ximian.com>
1089 * expression.cs (ComposedCast): report an error if a pointer cast
1090 is used in a safe region.
1092 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
1093 pointer type casts in unsafe context.
1095 * codegen.cs (EmitContext): Set up IsUnsafe.
1097 * cs-parser.jay (non_expression_type): Add productions for pointer
1100 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
1101 code. We should not use force into static mode if the method is
1102 not virtual. Fixes bug in MIS
1104 * statement.cs (Do.Emit, While.Emit, For.Emit,
1105 Statement.EmitBoolExpression): Add support to Do and While to
1106 propagate infinite loop as `I do return' semantics.
1108 Improve the For case to also test for boolean constants.
1110 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
1111 to the list of attributes we can add.
1113 Remove `EmitContext' argument.
1115 * class.cs (Method.Define): Apply parameter attributes.
1116 (Constructor.Define): Apply parameter attributes.
1117 (MethodCore.LabelParameters): Move here the core of labeling
1120 * support.cs (ReflectionParameters.ParameterModifier,
1121 InternalParameters.ParameterModifier): Use IsByRef on the type and
1122 only return the OUT bit for these parameters instead of in/out/ref
1125 This is because I miss-understood things. The ParameterInfo.IsIn
1126 and IsOut represent whether the parameter has the [In] and [Out]
1129 2002-01-22 Miguel de Icaza <miguel@ximian.com>
1131 * ecore.cs (FieldExpr.Emit): Release temporaries.
1133 * assign.cs (LocalTemporary.Release): new function.
1135 * codegen.cs (EmitContext.GetTemporaryStorage,
1136 EmitContext.FreeTemporaryStorage): Rework the way we deal with
1137 temporary storage. Now we can "put back" localbuilders when we
1140 2002-01-21 Miguel de Icaza <miguel@ximian.com>
1142 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
1143 need to make a copy of the variable to generate verifiable code.
1145 2002-01-19 Miguel de Icaza <miguel@ximian.com>
1147 * driver.cs: Compute dynamically the system directory.
1149 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
1150 Slower, but more generally useful. Used by the abstract
1151 registering implementation.
1153 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
1154 the rules for the special rule on Type/instances. First check if
1155 we have the same name, and if so, try that special static path
1156 rather than the instance path.
1158 2002-01-18 Miguel de Icaza <miguel@ximian.com>
1160 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
1163 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
1164 Enum, ValueType, Delegate or Array for non-corlib compiles.
1166 * cs-tokenizer.cs: Catch long identifiers (645)
1168 * typemanager.cs (IndexerPropetyName): Ravi never tested this
1171 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
1172 fix, we were returning too early, so we were not registering
1173 pending methods from abstract classes.
1175 Do not register pending methods if the class is abstract.
1177 * expression.cs (Conditional.DoResolve): Report circular implicit
1178 conversions when we neecd to compute it for conditional
1181 (Is.DoResolve): If the expression is always of the provided type,
1182 flag warning 183. If the expression can not ever be of the
1183 provided type flag warning 184.
1185 * class.cs: Catch 169 as well.
1187 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
1190 2002-01-18 Nick Drochak <ndrochak@gol.com>
1192 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
1194 2002-01-17 Miguel de Icaza <miguel@ximian.com>
1196 * interface.cs: (PopulateMethod): Check for pointers being defined
1197 only if the unsafe context is active.
1198 (PopulateProperty): ditto.
1199 (PopulateIndexer): ditto.
1201 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
1202 specified. If pointers are present, make sure that they are
1203 present in an unsafe context.
1204 (Constructor, Constructor.Define): ditto.
1205 (Field, Field.Define): ditto.
1206 (Property, Property.Define): ditto.
1207 (Event, Event.Define): ditto.
1209 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
1210 hashtable if there are classes or structs defined.
1212 * expression.cs (LocalVariableReference.DoResolve): Simplify this
1213 code, as the constant resolution moved.
1215 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
1216 the metadata, so we can flag error 133.
1218 * decl.cs (MemberCore.UnsafeOK): New function to test that a
1219 pointer is being declared in an unsafe context.
1221 2002-01-16 Miguel de Icaza <miguel@ximian.com>
1223 * modifiers.cs (Modifiers.Check): Require a Location argument.
1224 Report error 227 for Unsafe use.
1226 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
1228 * statement.cs (For.Emit): If the test is null, then report that
1229 we do `return', as we wont reach anything afterwards.
1231 (Switch.SwitchGoverningType): Track the expression that matched
1234 * driver.cs: Allow negative numbers as an error code to flag.
1236 * cs-parser.jay: Handle 1551.
1238 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
1240 2002-01-15 Miguel de Icaza <miguel@ximian.com>
1242 * cs-parser.jay: Report 1518 (type declaration can only contain
1243 class, struct, interface, enum or delegate)
1245 (switch_label): Report 1523 (keywords `case' or `default' must
1248 (opt_switch_sections): Report 1522 (empty switch)
1250 * driver.cs: Report 1515 (response file specified multiple times)
1251 Report 1516 (Source file specified multiple times).
1253 * expression.cs (Argument.Resolve): Signal 1510
1255 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
1256 access not allowed in static code)
1258 2002-01-11 Ravi Pratap <ravi@ximian.com>
1260 * typemanager.cs (IsPointerType): Utility method which we are going
1263 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
1264 the object type, so we take care of that.
1266 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
1268 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
1269 added to non-params parameters :-)
1271 * typemanager.cs (CSharpName): Include 'void' type too.
1273 (void_ptr_type): Include in the set of core types.
1275 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
1278 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
1281 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
1282 completely forgotten about it.
1284 2002-01-10 Ravi Pratap <ravi@ximian.com>
1286 * cs-parser.jay (pointer_type): Add. This begins our implementation
1287 of parsing rules for unsafe code.
1289 (unsafe_statement): Implement.
1291 (embedded_statement): Modify to include the above.
1293 * statement.cs (Unsafe): Implement new class for unsafe blocks.
1295 * codegen.cs (EmitContext.InUnsafe): Add. This determines
1296 if the current context is an unsafe one.
1298 * cs-parser.jay (local_variable_pointer_type): Since local variable types
1299 are handled differently, we need separate rules for them.
1301 (local_variable_declaration): Update to use local_variable_pointer_type
1302 to allow variable declarations of unmanaged pointer types.
1304 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
1307 * ../errors/cs0214.cs : Add.
1309 2002-01-16 Nick Drochak <ndrochak@gol.com>
1311 * makefile: remove 'response' file when cleaning.
1313 2002-01-15 Miguel de Icaza <miguel@ximian.com>
1315 * cs-parser.jay: Report 1524.
1317 2002-01-14 Miguel de Icaza <miguel@ximian.com>
1319 * typemanager.cs (RegisterMethod): drop checking if we have
1320 registered this from here
1322 2002-01-12 Miguel de Icaza <miguel@ximian.com>
1324 * class.cs (Method.EmitDestructor): Implement calling our base
1327 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
1330 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
1331 this routine and will wrap the call in a try/catch block. Deal
1334 2002-01-11 Miguel de Icaza <miguel@ximian.com>
1336 * ecore.cs (Expression.MemberLookup): instead of taking a
1337 parameter `same_type' that was used to tell whether we could
1338 access private members we compute our containing type from the
1341 (FieldExpr): Added partial support for volatile fields. This does
1342 not work for volatile fields exposed from assemblies, as I can not
1343 figure out how to extract the modreq from it.
1345 Updated all the source files to use this.
1347 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
1348 because it is referenced by MemberLookup very often.
1350 2002-01-09 Ravi Pratap <ravi@ximian.com>
1352 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
1353 TypeBuilder.GetCustomAttributes to retrieve what we need.
1355 Get rid of redundant default_member_attr_type as this is the same as
1356 default_member_type which already exists.
1358 * interface.cs, attribute.cs : Update accordingly.
1360 2002-01-08 Miguel de Icaza <miguel@ximian.com>
1362 * typemanager.cs: Enable IndexerPropertyName again. It does not
1363 work for TYpeBuilders though. Ravi, can you please fix this?
1365 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
1367 * expression.cs (Argument.Emit): Handle the case of ref objects
1368 being passed to ref functions;
1370 (ParameterReference.EmitLoad): Loads the content of the pointer
1371 without dereferencing.
1373 2002-01-07 Miguel de Icaza <miguel@ximian.com>
1375 * cs-tokenizer.cs: Implemented the pre-processing expressions.
1377 2002-01-08 Ravi Pratap <ravi@ximian.com>
1379 * class.cs (Indexer.DefineMethod): Incorporate the interface
1380 type in the name of the method if we are doing explicit interface
1383 * expression.cs (ConversionExists): Remove as it is completely obsolete.
1385 (BetterConversion): Fix extremely trivial bug where we were referring to
1386 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
1389 * ../errors/bug16.cs : Add although we have fixed it.
1391 2002-01-07 Miguel de Icaza <miguel@ximian.com>
1393 * expression.cs (BaseIndexer): Begin implementation.
1395 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
1397 * cs-parser.jay (indexer_declarator): Use qualified_identifier
1398 production directly to remove a shift/reduce, and implement
1399 explicit interface implementation.
1401 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
1402 after a floating point suffix.
1404 * expression.cs (DoNumericPromotions): Improved the conversion for
1405 uint/uint. If we have a constant, we avoid doing a typecast to a
1408 * class.cs (Indexer): Implement explicit interface implementation
1411 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
1413 * class.cs: make the default instance constructor public and hidebysig.
1415 2001-01-03 Ravi Pratap <ravi@ximian.com>
1417 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
1418 so we can call it from elsewhere.
1420 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
1421 we emit it internally if the class has a defined indexer; otherwise the user
1422 emits it by decorating the class definition with the DefaultMemberAttribute.
1424 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
1425 attribute is not used on a type which defines an indexer.
1427 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
1428 character when we skip whitespace.
1430 * ../errors/cs0646.cs : Add.
1432 2002-01-03 Miguel de Icaza <miguel@ximian.com>
1434 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
1437 * makefile: Add practical target `mcs3.exe' which builds the third
1438 generation compiler.
1440 * expression.cs (New): Fix structures constructor calling.
1442 * class.cs (Property, Method, Indexer): Emit Final flag on the
1443 method if we are an interface implementation and we are not
1446 * ecore.cs (PropertyExpr): New public field `IsBase', tells
1447 whether this property is referencing a `base' method.
1449 * expression.cs (Invocation.EmitCall): take an extra argument:
1450 is_base, this is used to determine whether the `call' or
1451 `callvirt' opcode should be used.
1454 * delegate.cs: update EmitCall.
1456 * class.cs (Method.Define): Set NewSlot for the cases where we are
1457 not implementing an interface method.
1459 (Property.Define): ditto.
1461 2002-01-02 Miguel de Icaza <miguel@ximian.com>
1463 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
1464 'r'. Allows mcs to parse itself fully.
1466 2002-01-02 Ravi Pratap <ravi@ximian.com>
1468 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
1469 of the number of initializers that require the InitializeArray method.
1471 (CheckIndices): Store the Expression in all cases - not the plain value. Also
1472 update the above field where necessary.
1474 (MakeByteBlob): Update accordingly.
1476 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
1479 (EmitDynamicInitializers): Update in accordance with the new optimization.
1481 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
1482 same OpCode applies.
1484 * cs-parser.jay : Fix some glaring errors I introduced.
1486 2002-01-01 Ravi Pratap <ravi@ximian.com>
1488 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
1489 so that we can check for name clashes there too.
1491 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
1492 for interface indexers.
1494 * interfaces.cs (Define): Emit the default member attribute.
1496 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
1497 variable was being referred to while setting the value ;-)
1499 2002-01-01 Miguel de Icaza <miguel@ximian.com>
1501 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
1502 byte-by-byte information when we know the data is zero.
1504 Make the block always a multiple of 4, because
1505 DefineInitializedData has a bug.
1507 * assign.cs: Fix, we should assign from the temporary, not from
1510 * expression.cs (MakeByteBlob): Fix my incorrect code.
1512 2001-12-31 Miguel de Icaza <miguel@ximian.com>
1514 * typemanager.cs (EnumToUnderlying): This function is used to get
1515 the underlying type from an enumeration, because it does not
1518 * constant.cs: Use the I4_S form for values between -128 and 127.
1520 * statement.cs (Block.LookupLabel): Looks up a label.
1521 (Block): Drop support for labeled blocks.
1523 (LabeledStatement): New kind of statement that represents a label
1526 (Goto): Finally implement this bad boy.
1528 * cs-parser.jay: Update to reflect new mechanism to implement
1531 2001-12-30 Miguel de Icaza <miguel@ximian.com>
1533 * codegen.cs (EmitContext.This): a codegen property that keeps the
1534 a single instance of this instead of creating many different this
1537 * delegate.cs (Delegate.DoResolve): Update to use the property;
1539 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
1541 * expression.cs (BaseAccess.DoResolve): Ditto.
1543 2001-12-29 Ravi Pratap <ravi@ximian.com>
1545 * typemanager.cs (methodimpl_attr_type): Add to hold the type
1546 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
1548 (InitCoreTypes): Update accordingly.
1550 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
1551 so we can quickly store the state.
1553 (ApplyAttributes): Set the correct implementation flags
1554 for InternalCall methods.
1556 2001-12-29 Miguel de Icaza <miguel@ximian.com>
1558 * expression.cs (EmitCall): if a method is not virtual, then do
1559 not use callvirt on it.
1561 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
1562 user defined stuff) requires the use of stobj, which takes an
1563 address on the stack instead of an array and an index. So emit
1564 the Ldelema operation for it.
1566 (EmitStoreOpcode): Use stobj for valuetypes.
1568 (UnaryMutator.EmitCode): Use the right 1 value depending on
1569 whether we are dealing with int64/uint64, float or doubles.
1571 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
1572 constructors that I implemented last night.
1574 (Constructor.IsDefault): Fix to work properly for static
1577 * cs-parser.jay (CheckDef): report method signature errors.
1578 Update error number 103 to be 132.
1580 * decl.cs: New AdditionResult enumeration value: MethodExists.
1581 Although we do this check for methods later on in the semantic
1582 analysis, catching repeated default constructors is so easy that
1583 we catch these here.
1585 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
1588 (ParameterReference.EmitAssign, Emit): handle
1591 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
1592 (ArrayAccess.EmitStoreOpcode): ditto.
1594 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
1596 * expression.cs (MakeByteBlob): Complete all the missing types
1597 (uint, short, ushort, byte, sbyte)
1599 * class.cs: Only init instance field initializers on instance
1602 Rename `constructors' to instance_constructors.
1604 (TypeContainer.AddConstructor): Only add constructors to the list
1605 if it is not static.
1607 Make sure that we handle default_static_constructor independently
1608 everywhere where we handle instance_constructors
1610 2001-12-28 Miguel de Icaza <miguel@ximian.com>
1612 * class.cs: Do not lookup or create a base initializer for a
1615 (ConstructorInitializer.Resolve): use the proper type to lookup
1618 * cs-parser.jay: Report error 1585 (modifiers between type and name).
1620 * enum.cs, interface.cs: Remove CloseType, this is taken care by
1623 * decl.cs: CloseType is now an virtual method, the default
1624 implementation just closes this type.
1626 2001-12-28 Ravi Pratap <ravi@ximian.com>
1628 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
1629 to PreserveSig by default. Also emit HideBySig on such methods.
1631 Basically, set the defaults to standard values.
1633 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
1634 argument, if candidate is better, it can't be worse than the best !
1636 (Invocation): Re-write bits to differentiate between methods being
1637 applicable in their expanded form and their normal form - for params
1640 Get rid of use_standard everywhere as only standard conversions are allowed
1641 in overload resolution.
1643 More spec conformance.
1645 2001-12-27 Miguel de Icaza <miguel@ximian.com>
1647 * driver.cs: Add --timestamp, to see where the compiler spends
1650 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
1651 `this' in static code.
1653 (SimpleName.DoResolve): Implement in terms of a helper function
1654 that allows static-references to be passed upstream to
1657 (Expression.ResolveWithSimpleName): Resolve specially simple
1658 names when called by MemberAccess to implement the special
1661 (Expression.ImplicitReferenceConversion): Handle conversions from
1662 Null to reference types before others, as Null's type is
1665 * expression.cs (Invocation.EmitCall): Handle the special case of
1666 calling methods declared on a reference type from a ValueType
1667 (Base classes System.Object and System.Enum)
1669 (MemberAccess.Resolve): Only perform lookups on Enumerations if
1670 the left hand side is a TypeExpr, not on every enumeration.
1672 (Binary.Resolve): If types are reference types, then do a cast to
1673 object on operators != and == of both arguments.
1675 * typemanager.cs (FindMembers): Extract instance and static
1676 members if requested.
1678 * interface.cs (PopulateProperty): Use void_type instead of null
1679 as the return type for the setter method.
1681 (PopulateIndexer): ditto.
1683 2001-12-27 Ravi Pratap <ravi@ximian.com>
1685 * support.cs (ReflectionParameters): Fix minor bug where we
1686 were examining the wrong parameter for the ParamArray attribute.
1688 Cope with requests for the type of the parameter at position
1689 greater than the params parameter's. We now return the element
1690 type of the params array as that makes more sense.
1692 * expression.cs (Invocation.IsParamsMethodApplicable): Update
1693 accordingly as we no longer have to extract the element type
1696 (Invocation.OverloadResolve): Update.
1698 2001-12-27 Miguel de Icaza <miguel@ximian.com>
1700 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
1701 against IEnumerator, test whether the return value is a descendant
1702 of the IEnumerator interface.
1704 * class.cs (Indexer.Define): Use an auxiliary method to implement
1705 the other bits of the method definition. Begin support for
1706 explicit interface implementation.
1708 (Property.DefineMethod): Use TypeManager.void_type instead of null
1709 for an empty return value.
1711 2001-12-26 Miguel de Icaza <miguel@ximian.com>
1713 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
1714 dealing with a FieldExpr which is composed of a FieldBuilder, in
1715 the code path we did extract the constant, but we should have
1716 obtained the underlying value to be able to cast it (otherwise we
1717 end up in an infinite loop, this is what Ravi was running into).
1719 (ArrayCreation.UpdateIndices): Arrays might be empty.
1721 (MemberAccess.ResolveMemberAccess): Add support for section
1722 14.5.4.1 that deals with the special case of E.I when E is a type
1723 and something else, that I can be a reference to a static member.
1725 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
1726 handle a particular array type to create byte blobs, it is just
1727 something we dont generate byteblobs for.
1729 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
1732 * location.cs (Push): remove the key from the hashtable that we
1733 are about to add. This happens for empty files.
1735 * driver.cs: Dispose files after we have parsed them.
1737 (tokenize): new function that only runs the tokenizer on its
1738 input, for speed testing.
1740 2001-12-26 Ravi Pratap <ravi@ximian.com>
1742 * class.cs (Event.Define): Define the private field only if there
1743 are no accessors defined.
1745 * expression.cs (ResolveMemberAccess): If there is no associated
1746 field with the event, that means we have an event defined with its
1747 own accessors and we should flag error cs0070 since transforming
1748 ourselves into a field is not valid in that case.
1750 * ecore.cs (SimpleName.DoResolve): Same as above.
1752 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
1753 and charset to sane values.
1755 2001-12-25 Ravi Pratap <ravi@ximian.com>
1757 * assign.cs (DoResolve): Perform check on events only if they
1758 are being accessed outside the declaring type.
1760 * cs-parser.jay (event_declarations): Update rules to correctly
1761 set the type of the implicit parameter etc.
1763 (add_accessor, remove_accessor): Set current local parameters.
1765 * expression.cs (Binary): For delegate addition and subtraction,
1766 cast the return value from the method into the appropriate delegate
1769 2001-12-24 Ravi Pratap <ravi@ximian.com>
1771 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
1772 of these as the workaround is unnecessary.
1774 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
1775 delegate data - none of that is needed at all.
1777 Re-write bits to extract the instance expression and the delegate method
1780 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
1783 * attribute.cs (ApplyAttributes): New method to take care of common tasks
1784 of attaching attributes instead of duplicating code everywhere.
1786 * everywhere : Update code to do attribute emission using the above method.
1788 2001-12-23 Miguel de Icaza <miguel@ximian.com>
1790 * expression.cs (IsParamsMethodApplicable): if there are not
1791 parameters, return immediately.
1793 * ecore.cs: The 0 literal can be implicity converted to an enum
1796 (SimpleName.DoResolve): First lookup the type, then lookup the
1799 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
1800 want to get its address. If the InstanceExpression is not
1801 addressable, store the result in a temporary variable, then get
1804 * codegen.cs: Only display 219 errors on warning level or above.
1806 * expression.cs (ArrayAccess): Make it implement the
1807 IMemoryLocation interface.
1809 (Binary.DoResolve): handle the operator == (object a, object b)
1810 and operator != (object a, object b) without incurring into a
1811 BoxedCast (because 5 != o should never be performed).
1813 Handle binary enumerator operators.
1815 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
1816 value type, otherwise use Ldelem_ref.
1818 Use precomputed names;
1820 (AddressOf): Implement address of
1822 * cs-parser.jay (labeled_statement): Fix recursive block
1823 addition by reworking the production.
1825 * expression.cs (New.DoEmit): New has a special case:
1827 If we are dealing with a ValueType, we have a few
1828 situations to deal with:
1830 * The target of New is a ValueType variable, that is
1831 easy, we just pass this as the variable reference
1833 * The target of New is being passed as an argument,
1834 to a boxing operation or a function that takes a
1837 In this case, we need to create a temporary variable
1838 that is the argument of New.
1841 2001-12-23 Ravi Pratap <ravi@ximian.com>
1843 * rootcontext.cs (LookupType): Check that current_type is not null before
1844 going about looking at nested types.
1846 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
1847 not implement the IAssignMethod interface any more.
1849 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
1850 where we tranform them into FieldExprs if they are being resolved from within
1853 * ecore.cs (SimpleName.DoResolve): Do the same here.
1855 * assign.cs (DoResolve, Emit): Clean up code considerably.
1857 * ../errors/bug10.cs : Add.
1859 * ../errors/cs0070.cs : Add.
1861 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
1863 * assign.cs : Get rid of EventIsLocal everywhere.
1865 2001-12-23 Miguel de Icaza <miguel@ximian.com>
1867 * ecore.cs (ConvertIntLiteral): finished the implementation.
1869 * statement.cs (SwitchLabel): Convert the value we are using as a
1870 key before looking up the table.
1872 2001-12-22 Miguel de Icaza <miguel@ximian.com>
1874 * codegen.cs (EmitTopBlock): Require a Location argument now.
1876 * cs-parser.jay (constructor_declarator): We need to setup
1877 current_local_parameters before we parse the
1878 opt_constructor_initializer, to allow the variables to be bound
1879 to the constructor arguments.
1881 * rootcontext.cs (LookupType): First lookup nested classes in our
1882 class and our parents before we go looking outside our class.
1884 * expression.cs (ConstantFold): Extract/debox the values at the
1887 * rootcontext.cs (EmitCode): Resolve the constants first before we
1888 resolve the types. This is not really needed, but it helps debugging.
1890 * statement.cs: report location.
1892 * cs-parser.jay: pass location to throw statement.
1894 * driver.cs: Small bug fix.
1896 * report.cs: Updated format to be 4-zero filled digits.
1898 2001-12-22 Ravi Pratap <ravi@ximian.com>
1900 * expression.cs (CheckIndices): Fix minor bug where the wrong
1901 variable was being referred to ;-)
1903 (DoEmit): Do not call EmitStaticInitializers when the
1904 underlying type is System.Object.
1906 2001-12-21 Ravi Pratap <ravi@ximian.com>
1908 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
1909 and do the usual workaround for SRE.
1911 * class.cs (MyEventBuilder.EventType): New member to get at the type
1912 of the event, quickly.
1914 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
1916 * assign.cs (Assign.DoResolve): Handle the case when the target
1917 is an EventExpr and perform the necessary checks.
1919 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
1922 (SimpleName.MemberStaticCheck): Include check for EventExpr.
1924 (EventExpr): Set the type in the constructor itself since we
1925 are meant to be born fully resolved.
1927 (EventExpr.Define): Revert code I wrote earlier.
1929 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
1930 instance expression is null. The instance expression is a This in that case
1931 or a null, depending on whether it is a static method or not.
1933 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
1934 refers to more than one method.
1936 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
1937 and accordingly flag errors.
1939 2001-12-21 Miguel de Icaza <miguel@ximian.com>
1941 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
1943 2001-12-22 Miguel de Icaza <miguel@ximian.com>
1945 * location.cs (ToString): Provide useful rutine.
1947 2001-12-21 Miguel de Icaza <miguel@ximian.com>
1949 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
1950 objects, return the actual integral boxed.
1952 * statement.cs (SwitchLabel): define an ILLabel for each
1955 (Switch.CheckSwitch): If the value is a Literal, extract
1956 the underlying literal.
1958 Also in the unused hashtable we had, add the SwitchLabel so we can
1959 quickly look this value up.
1961 * constant.cs: Implement a bunch of new constants. Rewrite
1962 Literal based on this. Made changes everywhere to adapt to this.
1964 * expression.cs (Expression.MakeByteBlob): Optimize routine by
1965 dereferencing array only once, and also copes with enumrations.
1967 bytes are two bytes wide, not one.
1969 (Cast): Perform constant conversions.
1971 * ecore.cs (TryImplicitIntConversion): Return literals instead of
1972 wrappers to the literals here.
1974 * expression.cs (DoNumericPromotions): long literals can converted
1975 to ulong implicity (this is taken care of elsewhere, but I was
1978 * ecore.cs (Expression.Literalize): Make the return type Literal,
1979 to improve type checking.
1981 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
1983 2001-12-20 Miguel de Icaza <miguel@ximian.com>
1985 * literal.cs: Revert code from ravi that checked the bounds. The
1986 bounds are sane by the definition of the type itself.
1988 * typemanager.cs: Fix implementation of ImplementsInterface. We
1989 need to actually look up in our parent hierarchy for interfaces
1992 * const.cs: Use the underlying type for enumerations
1994 * delegate.cs: Compute the basename for the delegate creation,
1995 that should fix the delegate test case, and restore the correct
1996 Type Lookup semantics in rootcontext
1998 * rootcontext.cs: Revert Ravi's last patch. The correct way of
1999 referencing a nested type with the Reflection API is using the "+"
2002 * cs-parser.jay: Do not require EOF token at the end.
2004 2001-12-20 Ravi Pratap <ravi@ximian.com>
2006 * rootcontext.cs (LookupType): Concatenate type names with
2007 a '.' instead of a '+' The test suite passes again.
2009 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
2010 field of the enumeration.
2012 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
2013 the case when the member is an EventExpr.
2015 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
2016 static has an associated instance expression.
2018 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
2020 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
2022 * class.cs (Event.Define): Register event and perform appropriate checks
2025 We define the Add and Remove methods even if the use provides none because
2026 in that case, we provide default implementations ourselves.
2028 Define a private field of the type of the event. This is done by the CSC compiler
2029 and we should be doing it too ;-)
2031 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
2032 More methods we use in code we generate.
2034 (multicast_delegate_type, delegate_type): Two separate types since the distinction
2037 (InitCoreTypes): Update accordingly for the above.
2039 * class.cs (Event.Emit): Generate code for default accessors that we provide
2041 (EmitDefaultMethod): Do the job in the above.
2043 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
2046 2001-12-20 Miguel de Icaza <miguel@ximian.com>
2048 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
2049 builders even if we were missing one.
2051 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
2052 pass the Basename as our class name instead of the Name. The
2053 basename will be correctly composed for us.
2055 * parameter.cs (Paramters): Now takes a Location argument.
2057 * decl.cs (DeclSpace.LookupType): Removed convenience function and
2058 make all the code call directly LookupType in RootContext and take
2059 this chance to pass the Location information everywhere.
2061 * Everywhere: pass Location information.
2063 2001-12-19 Miguel de Icaza <miguel@ximian.com>
2065 * class.cs (Constructor.Define): Updated way of detecting the
2066 length of the parameters.
2068 (TypeContainer.DefineType): Use basename as the type name for
2071 (TypeContainer.Define): Do not recursively define types here, as
2072 definition is taken care in order by the RootContext.
2074 * tree.cs: Keep track of namespaces in a per-file basis.
2076 * parameter.cs (Parameter.ComputeSignature): Update to use
2079 (Parameters.GetSignature): ditto.
2081 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
2082 instead of a TypeContainer.
2084 (Interface.SemanticAnalysis): Use `this' instead of our parent to
2085 resolve names. Because we need to be resolve in our context, not
2088 * driver.cs: Implement response files.
2090 * class.cs (TypeContainer.DefineType): If we are defined, do not
2093 (Event.Emit): Emit the code for add/remove handlers.
2094 (Event.Define): Save the MethodBuilders for add/remove.
2096 * typemanager.cs: Use pair here too.
2098 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
2099 DictionaryEntry requires the first argument to be non-null.
2101 (enum_declaration): Compute full name for registering the
2104 (delegate_declaration): Instead of using
2105 formal_parameter_list, use opt_formal_parameter_list as the list
2108 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
2109 (EventParsing): New property that controls whether `add' and
2110 `remove' are returned as tokens or identifiers (for events);
2112 2001-12-19 Ravi Pratap <ravi@ximian.com>
2114 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
2115 use MyEventBuilder only and let it wrap the real builder for us.
2117 (MyEventBuilder): Revamp constructor etc.
2119 Implement all operations that we perform on EventBuilder in precisely the same
2122 (FindMembers): Update to use the EventBuilder member.
2124 (Event.Emit): Update accordingly.
2126 2001-12-18 Ravi Pratap <ravi@ximian.com>
2128 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
2129 by calling the appropriate methods.
2131 (GetCustomAttributes): Make stubs as they cannot possibly do anything
2134 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
2136 2001-12-17 Ravi Pratap <ravi@ximian.com>
2138 * delegate.cs (Delegate.Populate): Check that the return type
2139 and various parameters types are indeed accessible.
2141 * class.cs (Constructor.Define): Same here.
2143 (Field.Define): Ditto.
2145 (Event.Define): Ditto.
2147 (Operator.Define): Check that the underlying Method defined itself
2148 correctly - so it's MethodBuilder should not be null.
2150 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
2151 expression happens to be null.
2153 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
2154 members but as of now we don't seem to be able to do anything really useful with it.
2156 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
2157 not the EventBuilder.
2159 2001-12-18 Miguel de Icaza <miguel@ximian.com>
2161 * cs-tokenizer.cs: Add support for defines.
2162 Add support for #if, #elif, #else, #endif
2164 (eval_var): evaluates a variable.
2165 (eval): stubbed for evaluating functions.
2167 * cs-parser.jay: Pass the defines information
2169 * driver.cs: Add --define command line option.
2171 * decl.cs: Move MemberCore here.
2173 Make it the base class for DeclSpace. This allows us to catch and
2174 report 108 and 109 for everything now.
2176 * class.cs (TypeContainer.Define): Extract all the members
2177 before populating and emit the warning 108 (new keyword required
2178 to override) instead of having each member implement this.
2180 (MemberCore.Define): New abstract method, we will be using this in
2181 the warning reporting engine in Populate.
2183 (Operator.Define): Adjust to new MemberCore protocol.
2185 * const.cs (Const): This does not derive from Expression, it is a
2186 temporary object we use to create fields, it is a MemberCore.
2188 * class.cs (Method.Define): Allow the entry point to be in a
2191 * driver.cs: Rewrite the argument handler to clean it up a bit.
2193 * rootcontext.cs: Made it just an auxiliary namespace feature by
2194 making everything static.
2196 * driver.cs: Adapt code to use RootContext type name instead of
2199 * delegate.cs: Remove RootContext argument.
2201 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
2204 * class.cs (Event.Define): The lookup can fail.
2206 * cs-tokenizer.cs: Begin implementation of pre-procesor.
2208 * expression.cs: Resolve the this instance before invoking the code.
2210 2001-12-17 Miguel de Icaza <miguel@ximian.com>
2212 * cs-parser.jay: Add a production in element_access that allows
2213 the thing to become a "type" reference. This way we can parse
2214 things like "(string [])" as a type.
2216 Note that this still does not handle the more complex rules of
2220 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
2222 * ecore.cs: (CopyNewMethods): new utility function used to
2223 assemble the list of methods from running FindMembers.
2225 (MemberLookup): Rework FindMembers so that
2227 2001-12-16 Miguel de Icaza <miguel@ximian.com>
2229 * class.cs (TypeContainer): Remove Delegates who fail to be
2232 * delegate.cs (Populate): Verify that we dont get null return
2233 values. TODO: Check for AsAccessible.
2235 * cs-parser.jay: Use basename to emit error 574 (destructor should
2236 have the same name as container class), not the full name.
2238 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
2239 possible representation.
2241 Also implements integer type suffixes U and L.
2243 2001-12-15 Miguel de Icaza <miguel@ximian.com>
2245 * expression.cs (ArrayCreation.DoResolve): We need to do the
2246 argument resolution *always*.
2248 * decl.cs: Make this hold the namespace. Hold the root context as
2250 (LookupType): Move here.
2252 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
2254 * location.cs (Row, Name): Fixed the code, it was always returning
2255 references to the first file.
2257 * interface.cs: Register properties defined through interfaces.
2259 * driver.cs: Add support for globbing on the command line
2261 * class.cs (Field): Make it derive from MemberCore as well.
2264 2001-12-15 Ravi Pratap <ravi@ximian.com>
2266 * class.cs (Event::Define): Check that the type of the event is a delegate
2267 type else flag error #66.
2269 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
2272 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
2273 values of EntryPoint, CharSet etc etc.
2275 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
2277 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
2278 be null and we should ignore this. I am not sure if this is really clean. Apparently,
2279 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
2280 which needs this to do its work.
2282 * ../errors/cs0066.cs : Add.
2284 2001-12-14 Miguel de Icaza <miguel@ximian.com>
2286 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
2289 * class.cs: (MethodSignature.MethodSignature): Removed hack that
2290 clears out the parameters field.
2291 (MemberSignatureCompare): Cleanup
2293 (MemberCore): New base class used to share code between MethodCore
2296 (RegisterRequiredImplementations) BindingFlags.Public requires
2297 either BindingFlags.Instace or Static. Use instance here.
2299 (Property): Refactored code to cope better with the full spec.
2301 * parameter.cs (GetParameterInfo): Return an empty array instead
2304 * class.cs (Property): Abstract or extern properties have no bodies.
2306 * parameter.cs (GetParameterInfo): return a zero-sized array.
2308 * class.cs (TypeContainer.MethodModifiersValid): Move all the
2309 method modifier validation to the typecontainer so we can reuse
2312 (MethodCore.ParameterTypes): return an empty sized array of types.
2314 (Property.Define): Test property modifier validity.
2316 Add tests for sealed/override too.
2318 (Method.Emit): abstract or extern methods have no bodies.
2320 2001-12-14 Ravi Pratap <ravi@ximian.com>
2322 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
2325 (Method::Define, ::Emit): Modify accordingly.
2327 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
2329 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
2331 * makefile: Pass in /unsafe.
2333 2001-12-13 Miguel de Icaza <miguel@ximian.com>
2335 * class.cs (MakeKey): Kill routine.
2337 * class.cs (TypeContainer.Define): Correctly define explicit
2338 method implementations (they require the full interface name plus
2341 * typemanager.cs: Deply the PtrHashtable here and stop using the
2342 lame keys. Things work so much better.
2344 This of course broke everyone who depended on `RegisterMethod' to
2345 do the `test for existance' test. This has to be done elsewhere.
2347 * support.cs (PtrHashtable): A hashtable that avoid comparing with
2348 the object stupid Equals method (because, that like fails all over
2349 the place). We still do not use it.
2351 * class.cs (TypeContainer.SetRequiredInterface,
2352 TypeContainer.RequireMethods): Killed these two routines and moved
2353 all the functionality to RegisterRequiredImplementations.
2355 (TypeContainer.RegisterRequiredImplementations): This routine now
2356 registers all the implementations required in an array for the
2357 interfaces and abstract methods. We use an array of structures
2358 which can be computed ahead of time to reduce memory usage and we
2359 also assume that lookups are cheap as most classes will not
2360 implement too many interfaces.
2362 We also avoid creating too many MethodSignatures.
2364 (TypeContainer.IsInterfaceMethod): Update and optionally does not
2365 clear the "pending" bit if we find that there are problems with
2368 (TypeContainer.VerifyPendingMethods): Update to report errors of
2369 methods that look like implementations but are not.
2371 (TypeContainer.Define): Add support for explicit interface method
2374 2001-12-12 Miguel de Icaza <miguel@ximian.com>
2376 * typemanager.cs: Keep track of the parameters here instead of
2377 being a feature of the TypeContainer.
2379 * class.cs: Drop the registration of parameters here, as
2380 InterfaceMethods are also interface declarations.
2382 * delegate.cs: Register methods with the TypeManager not only with
2383 the TypeContainer. This code was buggy.
2385 * interface.cs: Full registation here.
2387 2001-12-11 Miguel de Icaza <miguel@ximian.com>
2389 * expression.cs: Remove reducer for binary expressions, it can not
2392 * const.cs: Put here the code that used to go into constant.cs
2394 * constant.cs: Put here the code for constants, this is a new base
2397 * literal.cs: Make Literal derive from Constant.
2399 2001-12-09 Miguel de Icaza <miguel@ximian.com>
2401 * statement.cs (Return.Emit): Report error 157 if the user
2402 attempts to return from a finally block.
2404 (Return.Emit): Instead of emitting a return, jump to the end of
2407 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
2408 LocalBuilder to store the result of the function. ReturnLabel is
2409 the target where we jump.
2412 2001-12-09 Radek Doulik <rodo@ximian.com>
2414 * cs-parser.jay: remember alias in current namespace
2416 * ecore.cs (SimpleName::DoResolve): use aliases for types or
2419 * class.cs (LookupAlias): lookup alias in my_namespace
2421 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
2423 (LookupAlias): lookup alias in this and if needed in parent
2426 2001-12-08 Miguel de Icaza <miguel@ximian.com>
2430 * rootcontext.cs: (ModuleBuilder) Made static, first step into
2431 making things static. I need this to avoid passing the
2432 TypeContainer when calling ParameterType.
2434 * support.cs (InternalParameters.ParameterType): Remove ugly hack
2435 that did string manipulation to compute the type and then call
2436 GetType. Use Parameter.ParameterType instead.
2438 * cs-tokenizer.cs: Consume the suffix for floating values.
2440 * expression.cs (ParameterReference): figure out whether this is a
2441 reference parameter or not. Kill an extra variable by computing
2442 the arg_idx during emission.
2444 * parameter.cs (Parameters.GetParameterInfo): New overloaded
2445 function that returns whether a parameter is an out/ref value or not.
2447 (Parameter.ParameterType): The type of the parameter (base,
2448 without ref/out applied).
2450 (Parameter.Resolve): Perform resolution here.
2451 (Parameter.ExternalType): The full type (with ref/out applied).
2453 * statement.cs (Using.Emit, Using.EmitExpression): Implement
2454 support for expressions on the using statement.
2456 2001-12-07 Miguel de Icaza <miguel@ximian.com>
2458 * statement.cs (Using.EmitLocalVariableDecls): Split the
2459 localvariable handling of the using statement.
2461 (Block.EmitMeta): Keep track of variable count across blocks. We
2462 were reusing slots on separate branches of blocks.
2464 (Try.Emit): Emit the general code block, we were not emitting it.
2466 Check the type of the declaration to be an IDisposable or
2467 something that can be implicity converted to it.
2469 Emit conversions if required.
2471 * ecore.cs (EmptyExpression): New utility class.
2472 (Expression.ImplicitConversionExists): New utility function.
2474 2001-12-06 Miguel de Icaza <miguel@ximian.com>
2476 * statement.cs (Using): Implement.
2478 * expression.cs (LocalVariableReference): Support read only variables.
2480 * statement.cs: Remove the explicit emit for the Leave opcode.
2481 (VariableInfo): Add a readonly field.
2483 2001-12-05 Miguel de Icaza <miguel@ximian.com>
2485 * ecore.cs (ConvCast): new class used to encapsulate the various
2486 explicit integer conversions that works in both checked and
2489 (Expression.ConvertNumericExplicit): Use new ConvCast class to
2490 properly generate the overflow opcodes.
2492 2001-12-04 Miguel de Icaza <miguel@ximian.com>
2494 * statement.cs: The correct type for the EmptyExpression is the
2495 element_type, not the variable type. Ravi pointed this out.
2497 2001-12-04 Ravi Pratap <ravi@ximian.com>
2499 * class.cs (Method::Define): Handle PInvoke methods specially
2500 by using DefinePInvokeMethod instead of the usual one.
2502 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
2503 above to do the task of extracting information and defining the method.
2505 2001-12-04 Ravi Pratap <ravi@ximian.com>
2507 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
2508 of the condition for string type.
2510 (Emit): Move that here.
2512 (ArrayCreation::CheckIndices): Keep string literals in their expression
2515 (EmitDynamicInitializers): Handle strings appropriately.
2517 2001-12-04 Miguel de Icaza <miguel@ximian.com>
2519 * codegen.cs (EmitContext): Replace multiple variables with a
2520 single pointer to the current Switch statement.
2522 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
2525 2001-12-03 Miguel de Icaza <miguel@ximian.com>
2529 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
2532 (Foreach.Emit): Foreach on arrays was not setting
2533 up the loop variables (for break/continue).
2535 (GotoCase): Semi-implented.
2537 2001-12-03 Ravi Pratap <ravi@ximian.com>
2539 * attribute.cs (CheckAttribute): Handle system attributes by using
2540 Attribute.GetAttributes to examine information we need.
2542 (GetValidPlaces): Same here.
2544 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
2546 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
2548 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
2550 (Method::Define): Set appropriate flags if we have a DllImport attribute.
2552 (Method::Emit): Handle the case when we are a PInvoke method.
2554 2001-12-03 Miguel de Icaza <miguel@ximian.com>
2556 * expression.cs: Use ResolveWithSimpleName on compound names.
2558 2001-12-02 Ravi Pratap <ravi@ximian.com>
2560 * constant.cs (EmitConstant): Make sure we resolve the associated expression
2561 before trying to reduce it.
2563 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
2565 * constant.cs (LookupConstantValue): Implement.
2567 (EmitConstant): Use the above in emitting the constant.
2569 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
2570 that are user-defined by doing a LookupConstantValue on them.
2572 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
2575 2001-11-29 Miguel de Icaza <miguel@ximian.com>
2577 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
2579 (BaseAccess.DoResolve): Implement.
2581 (MemberAccess.DoResolve): Split this routine into a
2582 ResolveMemberAccess routine that can be used independently
2584 2001-11-28 Miguel de Icaza <miguel@ximian.com>
2586 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
2587 As that share bits of the implementation. Is returns a boolean,
2588 while As returns the Type that is being probed.
2590 2001-12-01 Ravi Pratap <ravi@ximian.com>
2592 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
2593 instead of a Literal - much easier.
2595 (EnumInTransit): Remove - utterly useless :-)
2597 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
2599 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
2601 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
2602 chain when we have no associated expression.
2604 2001-11-30 Ravi Pratap <ravi@ximian.com>
2606 * constant.cs (Define): Use Location while reporting the errror.
2608 Also emit a warning when 'new' is used and there is no inherited
2611 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
2614 (LookupEnumValue): Implement to lookup an enum member's value and define it
2617 (Populate): Re-write accordingly to use the above routine.
2619 2001-11-27 Miguel de Icaza <miguel@ximian.com>
2621 * expression.cs (This): Fix prototype for DoResolveLValue to
2622 override the base class DoResolveLValue.
2624 * cs-parser.cs: Report errors cs574 and cs575 (destructor
2627 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
2628 (we need to load the address of the field here). This fixes
2631 (FieldExpr.DoResolveLValue): Call the DoResolve
2632 function to initialize the Instance expression.
2634 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
2635 correctly the GetEnumerator operation on a value type.
2637 * cs-parser.jay: Add more simple parsing error catches.
2639 * statement.cs (Switch): Add support for string switches.
2640 Handle null specially.
2642 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
2644 2001-11-28 Ravi Pratap <ravi@ximian.com>
2646 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
2648 (declare_local_constant): New helper function.
2650 * statement.cs (AddConstant): Keep a separate record of constants
2652 (IsConstant): Implement to determine if a variable is a constant.
2654 (GetConstantExpression): Implement.
2656 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
2658 * statement.cs (IsVariableDefined): Re-write.
2660 2001-11-27 Ravi Pratap <ravi@ximian.com>
2662 * class.cs (TypeContainer::FindMembers): Look for constants
2663 in the case when we are looking for MemberTypes.Field
2665 * expression.cs (MemberAccess::DoResolve): Check that in the
2666 case we are a FieldExpr and a Literal, we are not being accessed
2667 by an instance reference.
2669 * cs-parser.jay (local_constant_declaration): Implement.
2671 (declaration_statement): Implement for constant declarations.
2673 2001-11-26 Miguel de Icaza <miguel@ximian.com>
2675 * statement.cs (Switch): Catch double defaults.
2677 (Switch): More work on the switch() statement
2678 implementation. It works for integral values now, need to finish
2682 2001-11-24 Miguel de Icaza <miguel@ximian.com>
2684 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
2685 integer literals into other integer literals. To be used by
2688 2001-11-24 Ravi Pratap <ravi@ximian.com>
2690 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
2693 (EmitDynamicInitializers): Cope with the above since we extract data
2694 directly from ArrayData now.
2696 (ExpectInitializers): Keep track of whether initializers are mandatory
2699 (Bounds): Make it a hashtable to prevent the same dimension being
2700 recorded for every element in that dimension.
2702 (EmitDynamicInitializers): Fix bug which prevented the Set array method
2705 Also fix bug which was causing the indices to be emitted in the reverse
2708 2001-11-24 Miguel de Icaza <miguel@ximian.com>
2710 * expression.cs (ArrayCreation): Implement the bits that Ravi left
2711 unfinished. They do not work, because the underlying code is
2714 2001-11-22 Miguel de Icaza <miguel@ximian.com>
2716 * cs-parser.jay: Remove bogus fixme.
2718 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
2719 on Switch statement.
2721 2001-11-23 Ravi Pratap <ravi@ximian.com>
2723 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
2726 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
2727 parameter. Apparently, any expression is allowed.
2729 (ValidateInitializers): Update accordingly.
2731 (CheckIndices): Fix some tricky bugs thanks to recursion.
2733 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
2734 I was being completely brain-dead.
2736 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
2737 and re-write acordingly.
2739 (DelegateInvocation): Re-write accordingly.
2741 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
2743 (MakeByteBlob): Handle types more correctly.
2745 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
2746 initialization from expressions but it is incomplete because I am a complete
2749 2001-11-22 Miguel de Icaza <miguel@ximian.com>
2751 * statement.cs (If.Emit): Fix a bug that generated incorrect code
2752 on If. Basically, we have to return `true' (ie, we do return to
2753 our caller) only if both branches of the if return.
2755 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
2756 short-circuit operators, handle them as short circuit operators.
2758 (Cast.DoResolve): Resolve type.
2759 (Cast.Cast): Take an expression as the target type.
2761 * cs-parser.jay (cast_expression): Remove old hack that only
2762 allowed a limited set of types to be handled. Now we take a
2763 unary_expression and we resolve to a type during semantic
2766 Use the grammar productions from Rhys to handle casts (this is
2767 not complete like Rhys syntax yet, we fail to handle that corner
2768 case that C# has regarding (-x), but we will get there.
2770 2001-11-22 Ravi Pratap <ravi@ximian.com>
2772 * class.cs (EmitFieldInitializer): Take care of the case when we have a
2773 field which is an array type.
2775 * cs-parser.jay (declare_local_variables): Support array initialization too.
2777 * typemanager.cs (MakeKey): Implement.
2779 (everywhere): Use the above appropriately.
2781 * cs-parser.jay (for_statement): Update for array initialization while
2782 declaring variables.
2784 * ecore.cs : The error message was correct, it's the variable's names that
2785 were misleading ;-) Make the code more readable.
2787 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
2788 the correct type etc.
2790 (ConvertExplicit): Handle Enum types by examining the underlying type.
2792 2001-11-21 Ravi Pratap <ravi@ximian.com>
2794 * parameter.cs (GetCallingConvention): Always return
2795 CallingConventions.Standard for now.
2797 2001-11-22 Miguel de Icaza <miguel@ximian.com>
2799 * expression.cs (Binary.ResolveOperator): Update the values of `l'
2800 and `r' after calling DoNumericPromotions.
2802 * ecore.cs: Fix error message (the types were in the wrong order).
2804 * statement.cs (Foreach.ProbeCollectionType): Need to pass
2805 BindingFlags.Instance as well
2807 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
2808 implicit int literal conversion in an empty cast so that we
2809 propagate the right type upstream.
2811 (UnboxCast): new class used to unbox value types.
2812 (Expression.ConvertExplicit): Add explicit type conversions done
2815 (Expression.ImplicitNumericConversion): Oops, forgot to test for
2816 the target type before applying the implicit LongLiterals to ULong
2819 2001-11-21 Miguel de Icaza <miguel@ximian.com>
2821 * cs-parser.jay (for_statement): Reworked the way For works: now
2822 we declare manually any variables that are introduced in
2823 for_initializer to solve the problem of having out-of-band code
2824 emition (that is what got for broken).
2826 (declaration_statement): Perform the actual variable declaration
2827 that used to be done in local_variable_declaration here.
2829 (local_variable_declaration): Do not declare anything, just pass
2830 the information on a DictionaryEntry
2832 2001-11-20 Ravi Pratap <ravi@ximian.com>
2834 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
2835 re-write of the logic to now make it recursive.
2837 (UpdateIndices): Re-write accordingly.
2839 Store element data in a separate ArrayData list in the above methods.
2841 (MakeByteBlob): Implement to dump the array data into a byte array.
2843 2001-11-19 Ravi Pratap <ravi@ximian.com>
2845 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
2848 * constant.cs (Define): Implement.
2850 (EmitConstant): Re-write fully.
2852 Pass in location info.
2854 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
2857 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
2858 DictionaryEntry since we need location info too.
2860 (constant_declaration): Update accordingly.
2862 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
2863 code into another method : UpdateIndices.
2865 2001-11-18 Ravi Pratap <ravi@ximian.com>
2867 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
2868 some type checking etc.
2870 2001-11-17 Ravi Pratap <ravi@ximian.com>
2872 * expression.cs (ArrayCreation::ValidateInitializers): Implement
2873 bits to provide dimension info if the user skips doing that.
2875 Update second constructor to store the rank correctly.
2877 2001-11-16 Ravi Pratap <ravi@ximian.com>
2879 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
2880 and try to implement.
2882 * ../errors/cs0150.cs : Add.
2884 * ../errors/cs0178.cs : Add.
2886 2001-11-16 Miguel de Icaza <miguel@ximian.com>
2888 * statement.cs: Implement foreach on multi-dimensional arrays.
2890 * parameter.cs (Parameters.GetParameterByName): Also lookup the
2891 name of the params argument.
2893 * expression.cs: Use EmitStoreOpcode to get the right opcode while
2894 initializing the array.
2896 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
2897 we can use this elsewhere.
2899 * statement.cs: Finish implementation of foreach for single
2902 * cs-parser.jay: Use an out-of-band stack to pass information
2903 around, I wonder why I need this.
2905 foreach_block: Make the new foreach_block the current_block.
2907 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
2908 function used to return a static Parameters structure. Used for
2909 empty parameters, as those are created very frequently.
2911 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
2913 2001-11-15 Ravi Pratap <ravi@ximian.com>
2915 * interface.cs : Default modifier is private, not public. The
2916 make verify test passes again.
2918 2001-11-15 Ravi Pratap <ravi@ximian.com>
2920 * support.cs (ReflectionParameters): Fix logic to determine
2921 whether the last parameter is a params one. Test 9 passes again.
2923 * delegate.cs (Populate): Register the builders we define with
2924 RegisterParameterForBuilder. Test 19 passes again.
2926 * cs-parser.jay (property_declaration): Reference $6 instead
2927 of $$ to get at the location.
2929 (indexer_declaration): Similar stuff.
2933 * class.cs (Property): Register parameters for the Get and Set methods
2934 if they exist. Test 23 passes again.
2936 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
2937 call to EmitArguments as we are sure there aren't any params arguments.
2938 Test 32 passes again.
2940 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
2941 IndexOutOfRangeException.
2943 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
2944 Test 33 now passes again.
2946 2001-11-15 Miguel de Icaza <miguel@ximian.com>
2948 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
2949 broke a bunch of things. Will have to come up with a better way
2950 of tracking locations.
2952 * statement.cs: Implemented foreach for single dimension arrays.
2954 2001-11-09 Miguel de Icaza <miguel@ximian.com>
2956 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
2957 an error. This removes the lookup from the critical path.
2959 * cs-parser.jay: Removed use of temporary_loc, which is completely
2962 2001-11-14 Miguel de Icaza <miguel@ximian.com>
2964 * support.cs (ReflectionParameters.ParameterModifier): Report
2965 whether the argument is a PARAMS argument or not.
2967 * class.cs: Set the attribute `ParamArrayAttribute' on the
2970 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
2971 and cons_param_array_attribute (ConstructorInfo for
2972 ParamArrayAttribute).,
2974 * codegen.cs: Emit the return using the `Return' statement, that
2975 way we can report the error correctly for missing return values.
2977 * class.cs (Method.Emit): Clean up.
2979 * expression.cs (Argument.Resolve): Take another argument: the
2980 location where this argument is used. Notice that this is not
2981 part of the "Argument" class as to reduce the size of the
2982 structure (we know the approximate location anyways).
2984 Test if the argument is a variable-reference, if not, then
2985 complain with a 206.
2987 (Argument.Emit): Emit addresses of variables.
2989 (Argument.FullDesc): Simplify.
2991 (Invocation.DoResolve): Update for Argument.Resolve.
2993 (ElementAccess.DoResolve): ditto.
2995 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
2996 method should be virtual, as this method is always virtual.
2998 (NewDelegate.DoResolve): Update for Argument.Resolve.
3000 * class.cs (ConstructorInitializer.DoResolve): ditto.
3002 * attribute.cs (Attribute.Resolve): ditto.
3004 2001-11-13 Miguel de Icaza <miguel@ximian.com>
3006 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
3008 * expression.cs (ParameterReference): Drop IStackStorage and implement
3009 IAssignMethod instead.
3011 (LocalVariableReference): ditto.
3013 * ecore.cs (FieldExpr): Drop IStackStorage and implement
3014 IAssignMethod instead.
3016 2001-11-13 Miguel de Icaza <miguel@ximian.com>
3018 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
3019 enumerations that are used in heavily used structures derive from
3020 byte in a laughable and pathetic attempt to reduce memory usage.
3021 This is the kind of pre-optimzations that you should not do at
3022 home without adult supervision.
3024 * expression.cs (UnaryMutator): New class, used to handle ++ and
3025 -- separatedly from the other unary operators. Cleans up the
3026 code, and kills the ExpressionStatement dependency in Unary.
3028 (Unary): Removed `method' and `Arguments' from this class, making
3029 it smaller, and moving it all to SimpleCall, so I can reuse this
3030 code in other locations and avoid creating a lot of transient data
3031 strucutres when not required.
3033 * cs-parser.jay: Adjust for new changes.
3035 2001-11-11 Miguel de Icaza <miguel@ximian.com>
3037 * enum.cs (Enum.Populate): If there is a failure during
3040 * cs-parser.jay (opt_enum_base): we used to catch type errors
3041 here, but this is really incorrect. The type error should be
3042 catched during semantic analysis.
3044 2001-12-11 Ravi Pratap <ravi@ximian.com>
3046 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
3047 current_local_parameters as expected since I, in my stupidity, had forgotten
3050 * attribute.cs (GetValidPlaces): Fix stupid bug.
3052 * class.cs (Method::Emit): Perform check on applicability of attributes.
3054 (Constructor::Emit): Ditto.
3056 (Field::Emit): Ditto.
3058 (Field.Location): Store location information.
3060 (Property, Event, Indexer, Operator): Ditto.
3062 * cs-parser.jay (field_declaration): Pass in location for each field.
3064 * ../errors/cs0592.cs : Add.
3066 2001-11-12 Ravi Pratap <ravi@ximian.com>
3068 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
3070 (InitCoreTypes): Update accordingly.
3072 (RegisterAttrType, LookupAttr): Implement.
3074 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
3075 info about the same.
3077 (Resolve): Update to populate the above as necessary.
3081 (GetValidPlaces): Helper to the above.
3083 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
3085 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
3087 2001-11-12 Ravi Pratap <ravi@ximian.com>
3089 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
3091 * ../errors/cs0617.cs : Add.
3093 2001-11-11 Ravi Pratap <ravi@ximian.com>
3095 * enum.cs (Emit): Rename to Populate to be more consistent with what
3096 we expect it to do and when exactly it is called.
3098 * class.cs, rootcontext.cs : Update accordingly.
3100 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
3101 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
3103 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
3105 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
3106 of a fieldinfo using the above, when dealing with a FieldBuilder.
3108 2001-11-10 Ravi Pratap <ravi@ximian.com>
3110 * ../errors/cs0031.cs : Add.
3112 * ../errors/cs1008.cs : Add.
3114 * ../errrors/cs0543.cs : Add.
3116 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
3119 (FindMembers): Implement.
3121 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
3122 enums and delegates too.
3124 (enum_types): Rename to builder_to_enum.
3126 (delegate_types): Rename to builder_to_delegate.
3128 * delegate.cs (FindMembers): Implement.
3130 2001-11-09 Ravi Pratap <ravi@ximian.com>
3132 * typemanager.cs (IsEnumType): Implement.
3134 * enum.cs (Emit): Re-write parts to account for the underlying type
3135 better and perform checking etc.
3137 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
3138 of the underlying type.
3140 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
3143 * enum.cs (error31): Helper to report error #31.
3145 * cs-parser.jay (enum_declaration): Store location of each member too.
3147 * enum.cs (member_to_location): New hashtable.
3149 (AddEnumMember): Update location hashtable.
3151 (Emit): Use the location of each member while reporting errors.
3153 2001-11-09 Miguel de Icaza <miguel@ximian.com>
3155 * cs-parser.jay: A for_initializer if is a
3156 local_variable_declaration really ammount to have an implicit
3157 block with the variable declaration and no initializer for for.
3159 * statement.cs (For.Emit): Cope with null initializers.
3161 This fixes the infinite loop on for initializers.
3163 2001-11-08 Miguel de Icaza <miguel@ximian.com>
3165 * enum.cs: More cleanup.
3167 * ecore.cs: Remove dead code.
3169 * class.cs (Property.Emit): More simplification.
3170 (Event.Emit): ditto.
3172 Reworked to have less levels of indentation.
3174 2001-11-08 Ravi Pratap <ravi@ximian.com>
3176 * class.cs (Property): Emit attributes.
3186 * enum.cs (Emit): Ditto.
3188 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
3191 * class.cs (Field, Event, etc.): Move attribute generation into the
3192 Emit method everywhere.
3194 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
3195 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
3196 as we had no way of defining nested enums !
3198 * rootcontext.cs : Adjust code accordingly.
3200 * typemanager.cs (AddEnumType): To keep track of enum types separately.
3202 2001-11-07 Ravi Pratap <ravi@ximian.com>
3204 * expression.cs (EvalConstantExpression): Move into ecore.cs
3206 * enum.cs (Enum): Rename some members and make them public and readonly
3207 according to our convention.
3209 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
3212 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
3214 (Enum::Emit): Write a simple version for now which doesn't try to compute
3215 expressions. I shall modify this to be more robust in just a while.
3217 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
3219 (TypeContainer::CloseType): Create the Enum types too.
3221 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
3223 * expression.cs (EvalConstantExpression): Get rid of completely.
3225 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
3226 user-defined values and other cases.
3228 (IsValidEnumLiteral): Helper function.
3230 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
3231 out there in the case we had a literal FieldExpr.
3233 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
3235 (Literalize): Revamp a bit to take two arguments.
3237 (EnumLiteral): New class which derives from Literal to wrap enum literals.
3239 2001-11-06 Ravi Pratap <ravi@ximian.com>
3241 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
3243 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
3245 (Resolve): Use the above to ensure we have proper initializers.
3247 2001-11-05 Ravi Pratap <ravi@ximian.com>
3249 * expression.cs (Expression::EvalConstantExpression): New method to
3250 evaluate constant expressions.
3252 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
3254 2001-11-07 Miguel de Icaza <miguel@ximian.com>
3256 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
3259 (Binary.ResolveOperator): Handle operator != (object a, object b)
3260 and operator == (object a, object b);
3262 (Binary.DoNumericPromotions): Indicate whether the numeric
3263 promotion was possible.
3265 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
3268 Made the ArrayAccess implement interface IAssignMethod instead of
3269 IStackStore as the order in which arguments are passed reflects
3272 * assign.cs: Instead of using expr.ExprClass to select the way of
3273 assinging, probe for the IStackStore/IAssignMethod interfaces.
3275 * typemanager.cs: Load InitializeArray definition.
3277 * rootcontext.cs (RootContext.MakeStaticData): Used to define
3278 static data that can be used to initialize arrays.
3280 2001-11-05 Miguel de Icaza <miguel@ximian.com>
3282 * expression.cs: Handle operator== and operator!= for booleans.
3284 (Conditioal.Reduce): Implement reducer for the ?: operator.
3286 (Conditional.Resolve): Implement dead code elimination.
3288 (Binary.Resolve): Catch string literals and return a new
3289 concatenated string.
3291 (Unary.Reduce): Implement reduction of unary expressions.
3293 * ecore.cs: Split out the expression core handling here.
3295 (Expression.Reduce): New method used to perform constant folding
3296 and CSE. This is needed to support constant-expressions.
3298 * statement.cs (Statement.EmitBoolExpression): Pass true and false
3299 targets, and optimize for !x.
3301 2001-11-04 Ravi Pratap <ravi@ximian.com>
3303 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
3304 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
3305 set custom atttributes.
3307 * literal.cs (Literal::GetValue): New abstract method to return the actual
3308 value of the literal, cast as an object.
3310 (*Literal): Implement GetValue method.
3312 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
3313 expressions to the arraylist but objects of type Argument.
3315 * class.cs (TypeContainer::Emit): Emit our attributes too.
3317 (Method::Emit, Constructor::Emit): Ditto.
3319 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
3320 to be ignoring earlier.
3322 2001-11-03 Ravi Pratap <ravi@ximian.com>
3324 * attribute.cs (AttributeSection::Define): Implement to do the business
3325 of constructing a CustomAttributeBuilder.
3327 (Attribute): New trivial class. Increases readability of code.
3329 * cs-parser.jay : Update accordingly.
3331 (positional_argument_list, named_argument_list, named_argument): New rules
3333 (attribute_arguments): Use the above so that we are more correct.
3335 2001-11-02 Ravi Pratap <ravi@ximian.com>
3337 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
3338 to perform all checks for a method with a params parameter.
3340 (Invocation::OverloadResolve): Update to use the above method and therefore
3341 cope correctly with params method invocations.
3343 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
3346 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
3347 constructors in our parent too because we can't afford to miss out on
3350 * attribute.cs (AttributeSection): New name for the class Attribute
3352 Other trivial changes to improve readability.
3354 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
3355 use the new class names.
3357 2001-11-01 Ravi Pratap <ravi@ximian.com>
3359 * class.cs (Method::Define): Complete definition for params types too
3361 (Indexer::Define): Ditto.
3363 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
3364 Cope everywhere with a request for info about the array parameter.
3366 2001-11-01 Ravi Pratap <ravi@ximian.com>
3368 * tree.cs (RecordNamespace): Fix up to check for the correct key.
3370 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
3371 local_variable_type to extract the string corresponding to the type.
3373 (local_variable_type): Fixup the action to use the new helper method.
3375 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
3378 * expression.cs : Clean out code which uses the above.
3380 2001-10-31 Ravi Pratap <ravi@ximian.com>
3382 * typemanager.cs (RegisterMethod): Check if we already have an existing key
3383 and bale out if necessary by returning a false.
3385 (RegisterProperty): Ditto.
3387 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
3388 and print out appropriate error messages.
3390 * interface.cs (everywhere): Ditto.
3392 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
3393 location to constructor.
3395 * class.cs (Property, Event, Indexer): Update accordingly.
3397 * ../errors/cs111.cs : Added.
3399 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
3400 of a method, as laid down by the spec.
3402 (Invocation::OverloadResolve): Use the above method.
3404 2001-10-31 Ravi Pratap <ravi@ximian.com>
3406 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
3407 now take a TypeContainer and a Parameters object.
3409 (ParameterData): Modify return type of ParameterModifier method to be
3410 Parameter.Modifier and not a string.
3412 (ReflectionParameters, InternalParameters): Update accordingly.
3414 * expression.cs (Argument::GetParameterModifier): Same here.
3416 * support.cs (InternalParameters::ParameterType): Find a better way of determining
3417 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
3418 symbol in it at all so maybe this is only for now.
3420 2001-10-30 Ravi Pratap <ravi@ximian.com>
3422 * support.cs (InternalParameters): Constructor now takes an extra argument
3423 which is the actual Parameters class.
3425 (ParameterDesc): Update to provide info on ref/out modifiers.
3427 * class.cs (everywhere): Update call to InternalParameters to pass in
3428 the second argument too.
3430 * support.cs (ParameterData): Add ParameterModifier, which is a method
3431 to return the modifier info [ref/out etc]
3433 (InternalParameters, ReflectionParameters): Implement the above.
3435 * expression.cs (Argument::ParameterModifier): Similar function to return
3436 info about the argument's modifiers.
3438 (Invocation::OverloadResolve): Update to take into account matching modifiers
3441 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
3442 a new SetFormalParameters object which we pass to InternalParameters.
3444 2001-10-30 Ravi Pratap <ravi@ximian.com>
3446 * expression.cs (NewArray): Merge into the ArrayCreation class.
3448 2001-10-29 Ravi Pratap <ravi@ximian.com>
3450 * expression.cs (NewArray): Merge classes NewBuiltinArray and
3451 NewUserdefinedArray into one as there wasn't much of a use in having
3454 * expression.cs (Argument): Change field's name to ArgType from Type.
3456 (Type): New readonly property which returns the proper type, taking into
3457 account ref/out modifiers.
3459 (everywhere): Adjust code accordingly for the above.
3461 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
3462 whether we are emitting for a ref or out parameter.
3464 * expression.cs (Argument::Emit): Use the above field to set the state.
3466 (LocalVariableReference::Emit): Update to honour the flag and emit the
3469 * parameter.cs (Attributes): Set the correct flags for ref parameters.
3471 * expression.cs (Argument::FullDesc): New function to provide a full desc.
3473 * support.cs (ParameterData): Add method ParameterDesc to the interface.
3475 (ReflectionParameters, InternalParameters): Implement the above method.
3477 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
3480 (Invocation::FullMethodDesc): Ditto.
3482 2001-10-29 Miguel de Icaza <miguel@ximian.com>
3484 * cs-parser.jay: Add extra production for the second form of array
3487 * expression.cs (ArrayCreation): Update to reflect the above
3490 * Small changes to prepare for Array initialization.
3492 2001-10-28 Miguel de Icaza <miguel@ximian.com>
3494 * typemanager.cs (ImplementsInterface): interface might be null;
3495 Deal with this problem;
3497 Also, we do store negative hits on the cache (null values), so use
3498 this instead of calling t.GetInterfaces on the type everytime.
3500 2001-10-28 Ravi Pratap <ravi@ximian.com>
3502 * typemanager.cs (IsBuiltinType): New method to help determine the same.
3504 * expression.cs (New::DoResolve): Get rid of array creation code and instead
3505 split functionality out into different classes.
3507 (New::FormArrayType): Move into NewBuiltinArray.
3509 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
3512 (NewBuiltinArray): New class to handle creation of built-in arrays.
3514 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
3515 account creation of one-dimensional arrays.
3517 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
3519 (NewUserdefinedArray::DoResolve): Implement.
3521 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
3523 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
3524 we maintain inside the TypeManager. This is necessary to perform lookups on the
3527 (LookupType): Update to perform GetType on the module builders too.
3529 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
3531 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
3533 2001-10-23 Ravi Pratap <ravi@ximian.com>
3535 * expression.cs (New::DoResolve): Implement guts of array creation.
3537 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
3539 2001-10-27 Miguel de Icaza <miguel@ximian.com>
3541 * expression.cs: Fix bug I introduced lsat night that broke
3544 (Expression.Resolve): Report a 246 error (can not resolve name)
3545 if we find a SimpleName in the stream.
3547 (Expression.ResolveLValue): Ditto.
3549 (Expression.ResolveWithSimpleName): This function is a variant of
3550 ResolveName, this one allows SimpleNames to be returned without a
3551 warning. The only consumer of SimpleNames is MemberAccess
3553 2001-10-26 Miguel de Icaza <miguel@ximian.com>
3555 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
3556 might arrive here. I have my doubts that this is correct.
3558 * statement.cs (Lock): Implement lock statement.
3560 * cs-parser.jay: Small fixes to support `lock' and `using'
3562 * cs-tokenizer.cs: Remove extra space
3564 * driver.cs: New flag --checked, allows to turn on integer math
3567 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
3568 Threading.Monitor.Exit
3570 2001-10-23 Miguel de Icaza <miguel@ximian.com>
3572 * expression.cs (IndexerAccess::DoResolveLValue): Set the
3573 Expression Class to be IndexerAccess.
3575 Notice that Indexer::DoResolve sets the eclass to Value.
3577 2001-10-22 Miguel de Icaza <miguel@ximian.com>
3579 * class.cs (TypeContainer::Emit): Emit code for indexers.
3581 * assign.cs (IAssignMethod): New interface implemented by Indexers
3582 and Properties for handling assignment.
3584 (Assign::Emit): Simplify and reuse code.
3586 * expression.cs (IndexerAccess, PropertyExpr): Implement
3587 IAssignMethod, clean up old code.
3589 2001-10-22 Ravi Pratap <ravi@ximian.com>
3591 * typemanager.cs (ImplementsInterface): New method to determine if a type
3592 implements a given interface. Provides a nice cache too.
3594 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
3597 (ConvertReferenceExplicit): Ditto.
3599 * delegate.cs (Delegate::Populate): Update to define the parameters on the
3600 various methods, with correct names etc.
3602 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
3603 Operator.UnaryNegation.
3605 * cs-parser.jay (operator_declarator): Be a little clever in the case where
3606 we have a unary plus or minus operator.
3608 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
3611 * everywhere : update accordingly.
3613 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
3616 * class.cs (Method::Define): For the case where we are implementing a method
3617 inherited from an interface, we need to set the MethodAttributes.Final flag too.
3618 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
3620 2001-10-21 Ravi Pratap <ravi@ximian.com>
3622 * interface.cs (FindMembers): Implement to work around S.R.E
3625 * typemanager.cs (IsInterfaceType): Implement.
3627 (FindMembers): Update to handle interface types too.
3629 * expression.cs (ImplicitReferenceConversion): Re-write bits which
3630 use IsAssignableFrom as that is not correct - it doesn't work.
3632 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
3633 and accordingly override EmitStatement.
3635 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
3636 using the correct logic :-)
3638 2001-10-19 Ravi Pratap <ravi@ximian.com>
3640 * ../errors/cs-11.cs : Add to demonstrate error -11
3642 2001-10-17 Miguel de Icaza <miguel@ximian.com>
3644 * assign.cs (Assign::Resolve): Resolve right hand side first, and
3645 then pass this as a hint to ResolveLValue.
3647 * expression.cs (FieldExpr): Add Location information
3649 (FieldExpr::LValueResolve): Report assignment to readonly
3652 (Expression::ExprClassFromMemberInfo): Pass location information.
3654 (Expression::ResolveLValue): Add new method that resolves an
3657 (Expression::DoResolveLValue): Default invocation calls
3660 (Indexers): New class used to keep track of indexers in a given
3663 (IStackStore): Renamed from LValue, as it did not really describe
3664 what this did. Also ResolveLValue is gone from this interface and
3665 now is part of Expression.
3667 (ElementAccess): Depending on the element access type
3669 * typemanager.cs: Add `indexer_name_type' as a Core type
3670 (System.Runtime.CompilerServices.IndexerNameAttribute)
3672 * statement.cs (Goto): Take a location.
3674 2001-10-18 Ravi Pratap <ravi@ximian.com>
3676 * delegate.cs (Delegate::VerifyDelegate): New method to verify
3677 if two delegates are compatible.
3679 (NewDelegate::DoResolve): Update to take care of the case when
3680 we instantiate a delegate from another delegate.
3682 * typemanager.cs (FindMembers): Don't even try to look up members
3683 of Delegate types for now.
3685 2001-10-18 Ravi Pratap <ravi@ximian.com>
3687 * delegate.cs (NewDelegate): New class to take care of delegate
3690 * expression.cs (New): Split the delegate related code out into
3691 the NewDelegate class.
3693 * delegate.cs (DelegateInvocation): New class to handle delegate
3696 * expression.cs (Invocation): Split out delegate related code into
3697 the DelegateInvocation class.
3699 2001-10-17 Ravi Pratap <ravi@ximian.com>
3701 * expression.cs (New::DoResolve): Implement delegate creation fully
3702 and according to the spec.
3704 (New::DoEmit): Update to handle delegates differently.
3706 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
3707 because of which we were printing out arguments in reverse order !
3709 * delegate.cs (VerifyMethod): Implement to check if the given method
3710 matches the delegate.
3712 (FullDelegateDesc): Implement.
3714 (VerifyApplicability): Implement.
3716 * expression.cs (Invocation::DoResolve): Update to accordingly handle
3717 delegate invocations too.
3719 (Invocation::Emit): Ditto.
3721 * ../errors/cs1593.cs : Added.
3723 * ../errors/cs1594.cs : Added.
3725 * delegate.cs (InstanceExpression, TargetMethod): New properties.
3727 2001-10-16 Ravi Pratap <ravi@ximian.com>
3729 * typemanager.cs (intptr_type): Core type for System.IntPtr
3731 (InitCoreTypes): Update for the same.
3733 (iasyncresult_type, asynccallback_type): Ditto.
3735 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
3738 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
3741 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
3742 the builders for the 4 members of a delegate type :-)
3744 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
3747 * expression.cs (New::DoResolve): Implement guts for delegate creation.
3749 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
3751 2001-10-15 Miguel de Icaza <miguel@ximian.com>
3753 * statement.cs (Break::Emit): Implement.
3754 (Continue::Emit): Implement.
3756 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
3757 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
3758 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
3759 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
3762 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
3763 properties that track the label for the current loop (begin of the
3764 loop and end of the loop).
3766 2001-10-15 Ravi Pratap <ravi@ximian.com>
3768 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
3769 use of emitting anything at all.
3771 * class.cs, rootcontext.cs : Get rid of calls to the same.
3773 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
3775 (Populate): Define the constructor correctly and set the implementation
3778 * typemanager.cs (delegate_types): New hashtable to hold delegates that
3781 (AddDelegateType): Implement.
3783 (IsDelegateType): Implement helper method.
3785 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
3787 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
3788 and accordingly handle it.
3790 * delegate.cs (Populate): Take TypeContainer argument.
3791 Implement bits to define the Invoke method. However, I still haven't figured out
3792 how to take care of the native int bit :-(
3794 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
3795 Qualify the name of the delegate, not its return type !
3797 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
3800 (StandardConversionExists): Checking for array types turns out to be recursive.
3802 (ConvertReferenceExplicit): Implement array conversion.
3804 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
3806 2001-10-12 Ravi Pratap <ravi@ximian.com>
3808 * cs-parser.jay (delegate_declaration): Store the fully qualified
3809 name as it is a type declaration.
3811 * delegate.cs (ReturnType, Name): Rename members to these. Make them
3814 (DefineDelegate): Renamed from Define. Does the same thing essentially,
3815 as TypeContainer::DefineType.
3817 (Populate): Method in which all the definition of the various methods (Invoke)
3820 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
3823 (CloseDelegate): Finally creates the delegate.
3825 * class.cs (TypeContainer::DefineType): Update to define delegates.
3826 (Populate, Emit and CloseType): Do the same thing here too.
3828 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
3829 delegates in all these operations.
3831 2001-10-14 Miguel de Icaza <miguel@ximian.com>
3833 * expression.cs: LocalTemporary: a new expression used to
3834 reference a temporary that has been created.
3836 * assign.cs: Handle PropertyAccess back here, so that we can
3837 provide the proper semantic access to properties.
3839 * expression.cs (Expression::ConvertReferenceExplicit): Implement
3840 a few more explicit conversions.
3842 * modifiers.cs: `NEW' modifier maps to HideBySig.
3844 * expression.cs (PropertyExpr): Make this into an
3845 ExpressionStatement, and support the EmitStatement code path.
3847 Perform get/set error checking, clean up the interface.
3849 * assign.cs: recognize PropertyExprs as targets, and if so, turn
3850 them into toplevel access objects.
3852 2001-10-12 Miguel de Icaza <miguel@ximian.com>
3854 * expression.cs: PropertyExpr::PropertyExpr: use work around the
3857 * typemanager.cs: Keep track here of our PropertyBuilders again to
3858 work around lameness in SRE.
3860 2001-10-11 Miguel de Icaza <miguel@ximian.com>
3862 * expression.cs (LValue::LValueResolve): New method in the
3863 interface, used to perform a second resolution pass for LValues.
3865 (This::DoResolve): Catch the use of this in static methods.
3867 (This::LValueResolve): Implement.
3869 (This::Store): Remove warning, assigning to `this' in structures
3872 (Invocation::Emit): Deal with invocation of
3873 methods on value types. We need to pass the address to structure
3874 methods rather than the object itself. (The equivalent code to
3875 emit "this" for structures leaves the entire structure on the
3876 stack instead of a pointer to it).
3878 (ParameterReference::DoResolve): Compute the real index for the
3879 argument based on whether the method takes or not a `this' pointer
3880 (ie, the method is static).
3882 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
3883 value types returned from functions when we need to invoke a
3884 method on the sturcture.
3887 2001-10-11 Ravi Pratap <ravi@ximian.com>
3889 * class.cs (TypeContainer::DefineType): Method to actually do the business of
3890 defining the type in the Modulebuilder or Typebuilder. This is to take
3891 care of nested types which need to be defined on the TypeBuilder using
3894 (TypeContainer::GetClassBases): Implement. Essentially the code from the
3895 methods in RootContext, only ported to be part of TypeContainer.
3897 (TypeContainer::GetInterfaceOrClass): Ditto.
3899 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
3901 * interface.cs (Interface::DefineInterface): New method. Does exactly
3902 what RootContext.CreateInterface did earlier, only it takes care of nested types
3905 (Interface::GetInterfaces): Move from RootContext here and port.
3907 (Interface::GetInterfaceByName): Same here.
3909 * rootcontext.cs (ResolveTree): Re-write.
3911 (PopulateTypes): Re-write.
3913 * class.cs (TypeContainer::Populate): Populate nested types too.
3914 (TypeContainer::Emit): Emit nested members too.
3916 * typemanager.cs (AddUserType): Do not make use of the FullName property,
3917 instead just use the name argument passed in as it is already fully
3920 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
3921 to TypeContainer mapping to see if a type is user-defined.
3923 * class.cs (TypeContainer::CloseType): Implement.
3925 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
3926 the default constructor.
3928 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
3931 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
3933 * interface.cs (CloseType): Create the type here.
3935 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
3938 Remove all the methods which are now in TypeContainer.
3940 2001-10-10 Ravi Pratap <ravi@ximian.com>
3942 * delegate.cs (Define): Re-write bits to define the delegate
3945 2001-10-10 Miguel de Icaza <miguel@ximian.com>
3947 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
3949 * expression.cs (ImplicitReferenceConversion): handle null as well
3950 as a source to convert to any reference type.
3952 * statement.cs (Return): Perform any implicit conversions to
3953 expected return type.
3955 Validate use of return statement.
3957 * codegen.cs (EmitContext): Pass the expected return type here.
3959 * class.cs (Method, Constructor, Property): Pass expected return
3960 type to EmitContext.
3962 2001-10-09 Miguel de Icaza <miguel@ximian.com>
3964 * expression.cs: Make DoResolve take an EmitContext instead of a
3967 Replaced `l' and `location' for `loc', for consistency.
3969 (Error, Warning): Remove unneeded Tc argument.
3971 * assign.cs, literal.cs, constant.cs: Update to new calling
3974 * codegen.cs: EmitContext now contains a flag indicating whether
3975 code is being generated in a static method or not.
3977 * cs-parser.jay: DecomposeQI, new function that replaces the old
3978 QualifiedIdentifier. Now we always decompose the assembled
3979 strings from qualified_identifier productions into a group of
3982 2001-10-08 Miguel de Icaza <miguel@ximian.com>
3984 * rootcontext.cs: Deal with field-less struct types correctly now
3985 by passing the size option to Define Type.
3987 * class.cs: Removed hack that created one static field.
3989 2001-10-07 Miguel de Icaza <miguel@ximian.com>
3991 * statement.cs: Moved most of the code generation here.
3993 2001-10-09 Ravi Pratap <ravi@ximian.com>
3995 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
3998 (ElementAccess): Remove useless bits for now - keep checks as the spec
4001 2001-10-08 Ravi Pratap <ravi@ximian.com>
4003 * expression.cs (ElementAccess::DoResolve): Remove my crap code
4004 and start performing checks according to the spec.
4006 2001-10-07 Ravi Pratap <ravi@ximian.com>
4008 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
4009 rank_specifiers instead.
4011 (rank_specifiers): Change the order in which the rank specifiers are stored
4013 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
4015 * expression.cs (ElementAccess): Implement the LValue interface too.
4017 2001-10-06 Ravi Pratap <ravi@ximian.com>
4019 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
4020 except that user defined conversions are not included.
4022 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
4023 perform the conversion of the return type, if necessary.
4025 (New::DoResolve): Check whether we are creating an array or an object
4026 and accordingly do the needful.
4028 (New::Emit): Same here.
4030 (New::DoResolve): Implement guts of array creation.
4032 (New::FormLookupType): Helper function.
4034 2001-10-07 Miguel de Icaza <miguel@ximian.com>
4036 * codegen.cs: Removed most of the code generation here, and move the
4037 corresponding code generation bits to the statement classes.
4039 Added support for try/catch/finalize and throw.
4041 * cs-parser.jay: Added support for try/catch/finalize.
4043 * class.cs: Catch static methods having the flags override,
4044 virtual or abstract.
4046 * expression.cs (UserCast): This user cast was not really doing
4047 what it was supposed to do. Which is to be born in fully resolved
4048 state. Parts of the resolution were being performed at Emit time!
4052 2001-10-05 Miguel de Icaza <miguel@ximian.com>
4054 * expression.cs: Implicity convert the result from UserCast.
4056 2001-10-05 Ravi Pratap <ravi@ximian.com>
4058 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
4059 prevented it from working correctly.
4061 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
4062 merely ConvertImplicit.
4064 2001-10-05 Miguel de Icaza <miguel@ximian.com>
4066 * typemanager.cs: Make the LookupTypeContainer function static,
4067 and not per-instance.
4069 * class.cs: Make static FindMembers (the one that takes a Type
4072 * codegen.cs: Add EmitForeach here.
4074 * cs-parser.jay: Make foreach a toplevel object instead of the
4075 inline expansion, as we need to perform semantic analysis on it.
4077 2001-10-05 Ravi Pratap <ravi@ximian.com>
4079 * expression.cs (Expression::ImplicitUserConversion): Rename to
4080 UserDefinedConversion.
4082 (Expression::UserDefinedConversion): Take an extra argument specifying
4083 whether we look for explicit user conversions too.
4085 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
4087 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
4089 (ExplicitUserConversion): Make it a call to UserDefinedConversion
4090 with the appropriate arguments.
4092 * cs-parser.jay (cast_expression): Record location too.
4094 * expression.cs (Cast): Record location info.
4096 (Expression::ConvertExplicit): Take location argument.
4098 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
4099 to determine if we are doing explicit conversions.
4101 (UserCast::Emit): Update accordingly.
4103 (Expression::ConvertExplicit): Report an error if everything fails.
4105 * ../errors/cs0030.cs : Add.
4107 2001-10-04 Miguel de Icaza <miguel@ximian.com>
4109 * modifiers.cs: If the ABSTRACT keyword is present, also set the
4110 virtual and newslot bits.
4112 * class.cs (TypeContainer::RegisterRequiredImplementations):
4113 Record methods we need.
4115 (TypeContainer::MakeKey): Helper function to make keys for
4116 MethodBases, since the Methodbase key is useless.
4118 (TypeContainer::Populate): Call RegisterRequiredImplementations
4119 before defining the methods.
4121 Create a mapping for method_builders_to_methods ahead of time
4122 instead of inside a tight loop.
4124 (::RequireMethods): Accept an object as the data to set into the
4125 hashtable so we can report interface vs abstract method mismatch.
4127 2001-10-03 Miguel de Icaza <miguel@ximian.com>
4129 * report.cs: Make all of it static.
4131 * rootcontext.cs: Drop object_type and value_type computations, as
4132 we have those in the TypeManager anyways.
4134 Drop report instance variable too, now it is a global.
4136 * driver.cs: Use try/catch on command line handling.
4138 Add --probe option to debug the error reporting system with a test
4141 * report.cs: Add support for exiting program when a probe
4142 condition is reached.
4144 2001-10-03 Ravi Pratap <ravi@ximian.com>
4146 * expression.cs (Binary::DoNumericPromotions): Fix the case when
4147 we do a forcible conversion regardless of type, to check if
4148 ForceConversion returns a null.
4150 (Binary::error19): Use location to report error.
4152 (Unary::error23): Use location here too.
4154 * ../errors/cs0019.cs : Check in.
4156 * ../errors/cs0023.cs : Check in.
4158 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
4159 case of a non-null MethodInfo object with a length of 0 !
4161 (Binary::ResolveOperator): Flag error if overload resolution fails to find
4162 an applicable member - according to the spec :-)
4163 Also fix logic to find members in base types.
4165 (Unary::ResolveOperator): Same here.
4167 (Unary::report23): Change name to error23 and make first argument a TypeContainer
4168 as I was getting thoroughly confused between this and error19 :-)
4170 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
4171 (::FindMostEncompassedType): Implement.
4172 (::FindMostEncompassingType): Implement.
4173 (::StandardConversionExists): Implement.
4175 (UserImplicitCast): Re-vamp. We now need info about most specific
4176 source and target types so that we can do the necessary conversions.
4178 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
4179 mathematical union with no duplicates.
4181 2001-10-03 Miguel de Icaza <miguel@ximian.com>
4183 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
4184 in order from base classes to child classes, so that we can in
4185 child classes look up in our parent for method names and
4186 attributes (required for handling abstract, virtual, new, override
4187 constructs: we need to instrospect our base class, and if we dont
4188 populate the classes in order, the introspection might be
4189 incorrect. For example, a method could query its parent before
4190 the parent has any methods and would determine that the parent has
4191 no abstract methods (while it could have had them)).
4193 (RootContext::CreateType): Record the order in which we define the
4196 2001-10-02 Miguel de Icaza <miguel@ximian.com>
4198 * class.cs (TypeContainer::Populate): Also method definitions can
4199 fail now, keep track of this.
4201 (TypeContainer::FindMembers): Implement support for
4202 DeclaredOnly/noDeclaredOnly flag.
4204 (Constructor::Emit) Return the ConstructorBuilder.
4206 (Method::Emit) Return the MethodBuilder.
4207 Check for abstract or virtual methods to be public.
4209 * rootcontext.cs (RootContext::CreateType): Register all the
4210 abstract methods required for the class to be complete and the
4211 interface methods that must be implemented.
4213 * cs-parser.jay: Report error 501 (method requires body if it is
4214 not marked abstract or extern).
4216 * expression.cs (TypeOf::Emit): Implement.
4218 * typemanager.cs: runtime_handle_type, new global type.
4220 * class.cs (Property::Emit): Generate code for properties.
4222 2001-10-02 Ravi Pratap <ravi@ximian.com>
4224 * expression.cs (Unary::ResolveOperator): Find operators on base type
4225 too - we now conform exactly to the spec.
4227 (Binary::ResolveOperator): Same here.
4229 * class.cs (Operator::Define): Fix minor quirk in the tests.
4231 * ../errors/cs0215.cs : Added.
4233 * ../errors/cs0556.cs : Added.
4235 * ../errors/cs0555.cs : Added.
4237 2001-10-01 Miguel de Icaza <miguel@ximian.com>
4239 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
4240 single integer which is really efficient
4242 2001-10-01 Ravi Pratap <ravi@ximian.com>
4244 * expression.cs (Expression::ImplicitUserConversion): Use location
4245 even in the case when we are examining True operators.
4247 * class.cs (Operator::Define): Perform extensive checks to conform
4248 with the rules for operator overloading in the spec.
4250 * expression.cs (Expression::ImplicitReferenceConversion): Implement
4251 some of the other conversions mentioned in the spec.
4253 * typemanager.cs (array_type): New static member for the System.Array built-in
4256 (cloneable_interface): For System.ICloneable interface.
4258 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
4259 we start resolving the tree and populating types.
4261 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
4263 2001-10-01 Miguel de Icaza <miguel@ximian.com>
4265 * expression.cs (Expression::ExprClassFromMemberInfo,
4266 Expression::Literalize): Create literal expressions from
4267 FieldInfos which are literals.
4269 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
4270 type casts, because they were wrong. The test suite in tests
4273 (ImplicitNumericConversion): ushort to ulong requires a widening
4276 Int32 constant to long requires widening cast as well.
4278 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
4279 for integers because the type on the stack is not i4.
4281 2001-09-30 Miguel de Icaza <miguel@ximian.com>
4283 * expression.cs (report118): require location argument.
4285 * parameter.cs: Do not dereference potential null value.
4287 * class.cs: Catch methods that lack the `new' keyword when
4288 overriding a name. Report warnings when `new' is used without
4289 anything being there to override.
4291 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
4293 * class.cs: Only add constructor to hashtable if it is non-null
4294 (as now constructors can fail on define).
4296 (TypeManager, Class, Struct): Take location arguments.
4298 Catch field instance initialization in structs as errors.
4300 accepting_filter: a new filter for FindMembers that is static so
4301 that we dont create an instance per invocation.
4303 (Constructor::Define): Catch errors where a struct constructor is
4306 * cs-parser.jay: Pass location information for various new
4309 * delegate.cs (Delegate): take a location argument.
4311 * driver.cs: Do not call EmitCode if there were problesm in the
4312 Definition of the types, as many Builders wont be there.
4314 * decl.cs (Decl::Decl): Require a location argument.
4316 * cs-tokenizer.cs: Handle properly hex constants that can not fit
4317 into integers, and find the most appropiate integer for it.
4319 * literal.cs: Implement ULongLiteral.
4321 * rootcontext.cs: Provide better information about the location of
4322 failure when CreateType fails.
4324 2001-09-29 Miguel de Icaza <miguel@ximian.com>
4326 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
4329 * expression.cs (Binary::CheckShiftArguments): Add missing type
4331 (Binary::ResolveOperator): Add type to the logical and and logical
4332 or, Bitwise And/Or and Exclusive Or code paths, it was missing
4335 (Binary::DoNumericPromotions): In the case where either argument
4336 is ulong (and most signed types combined with ulong cause an
4337 error) perform implicit integer constant conversions as well.
4339 2001-09-28 Miguel de Icaza <miguel@ximian.com>
4341 * expression.cs (UserImplicitCast): Method should always be
4343 (Invocation::BetterConversion): Simplified test for IntLiteral.
4345 (Expression::ImplicitNumericConversion): Split this routine out.
4346 Put the code that performs implicit constant integer conversions
4349 (Expression::Resolve): Become a wrapper around DoResolve so we can
4350 check eclass and type being set after resolve.
4352 (Invocation::Badness): Remove this dead function
4354 (Binary::ResolveOperator): Do not compute the expensive argumnets
4355 unless we have a union for it.
4357 (Probe::Emit): Is needs to do an isinst and then
4358 compare against null.
4360 (::CanConvert): Added Location argument. If the Location argument
4361 is null (Location.Null), then we do not report errors. This is
4362 used by the `probe' mechanism of the Explicit conversion. We do
4363 not want to generate an error for something that the user
4364 explicitly requested to be casted. But the pipeline for an
4365 explicit cast first tests for potential implicit casts.
4367 So for now, if the Location is null, it means `Probe only' to
4368 avoid adding another argument. Might have to revise this
4371 (ClassCast): New class used to type cast objects into arbitrary
4372 classes (used in Explicit Reference Conversions).
4374 Implement `as' as well.
4376 Reverted all the patches from Ravi below: they were broken:
4378 * The use of `level' as a mechanism to stop recursive
4379 invocations is wrong. That was there just to catch the
4380 bug with a strack trace but not as a way of addressing
4383 To fix the problem we have to *understand* what is going
4384 on and the interactions and come up with a plan, not
4385 just get things going.
4387 * The use of the type conversion cache that I proposed
4388 last night had an open topic: How does this work across
4389 protection domains. A user defined conversion might not
4390 be public in the location where we are applying the
4391 conversion, a different conversion might be selected
4392 (ie, private A->B (better) but public B->A (worse),
4393 inside A, A->B applies, but outside it, B->A will
4396 * On top of that (ie, even if the above is solved),
4397 conversions in a cache need to be abstract. Ie, `To
4398 convert from an Int to a Short use an OpcodeCast', not
4399 `To convert from an Int to a Short use the OpcodeCast on
4400 the variable 5' (which is what this patch was doing).
4402 2001-09-28 Ravi Pratap <ravi@ximian.com>
4404 * expression.cs (Invocation::ConversionExists): Re-write to use
4405 the conversion cache
4407 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
4408 cache all conversions done, not just user-defined ones.
4410 (Invocation::BetterConversion): The real culprit. Use ConversionExists
4411 to determine if a conversion exists instead of acutually trying to
4412 perform the conversion. It's faster too.
4414 (Expression::ConvertExplicit): Modify to use ConversionExists to check
4415 and only then attempt the implicit conversion.
4417 2001-09-28 Ravi Pratap <ravi@ximian.com>
4419 * expression.cs (ConvertImplicit): Use a cache for conversions
4420 already found. Check level of recursion and bail out if necessary.
4422 2001-09-28 Miguel de Icaza <miguel@ximian.com>
4424 * typemanager.cs (string_concat_string_string, string_concat_object_object):
4425 Export standard methods that we expect for string operations.
4427 * statement.cs (Block::UsageWarning): Track usage of variables and
4428 report the errors for not used variables.
4430 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
4433 2001-09-27 Miguel de Icaza <miguel@ximian.com>
4435 * codegen.cs: remove unnneded code
4437 * expression.cs: Removed BuiltinTypeAccess class
4439 Fix the order in which implicit conversions are
4442 The previous fixed dropped support for boxed conversions (adding a
4443 test to the test suite now)
4445 (UserImplicitCast::CanConvert): Remove test for source being null,
4446 that code is broken. We should not feed a null to begin with, if
4447 we do, then we should track the bug where the problem originates
4448 and not try to cover it up here.
4450 Return a resolved expression of type UserImplicitCast on success
4451 rather than true/false. Ravi: this is what I was talking about,
4452 the pattern is to use a static method as a "constructor" for
4455 Also, do not create arguments until the very last minute,
4456 otherwise we always create the arguments even for lookups that
4457 will never be performed.
4459 (UserImplicitCast::Resolve): Eliminate, objects of type
4460 UserImplicitCast are born in a fully resolved state.
4462 * typemanager.cs (InitCoreTypes): Init also value_type
4465 * expression.cs (Cast::Resolve): First resolve the child expression.
4467 (LValue): Add new method AddressOf to be used by
4470 Change the argument of Store to take an EmitContext instead of an
4471 ILGenerator, because things like FieldExpr need to be able to call
4472 their children expression to generate the instance code.
4474 (Expression::Error, Expression::Warning): Sugar functions for
4477 (Expression::MemberLookup): Accept a TypeContainer instead of a
4478 Report as the first argument.
4480 (Expression::ResolvePrimary): Killed. I still want to improve
4481 this as currently the code is just not right.
4483 (Expression::ResolveMemberAccess): Simplify, but it is still
4486 (Unary::Resolve): Catch errors in AddressOf operators.
4488 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
4489 index to a byte for the short-version, or the compiler will choose
4490 the wrong Emit call, which generates the wrong data.
4492 (ParameterReference::Emit, ::Store): same.
4494 (FieldExpr::AddressOf): Implement.
4496 * typemanager.cs: TypeManager: made public variable instead of
4499 * driver.cs: document --fatal.
4501 * report.cs (ErrorMessage, WarningMessage): new names for the old
4502 Error and Warning classes.
4504 * cs-parser.jay (member_access): Turn built-in access to types
4505 into a normal simplename
4507 2001-09-27 Ravi Pratap <ravi@ximian.com>
4509 * expression.cs (Invocation::BetterConversion): Fix to cope
4510 with q being null, since this was introducing a bug.
4512 * expression.cs (ConvertImplicit): Do built-in conversions first.
4514 2001-09-27 Ravi Pratap <ravi@ximian.com>
4516 * expression.cs (UserImplicitCast::Resolve): Fix bug.
4518 2001-09-27 Ravi Pratap <ravi@ximian.com>
4520 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
4521 I had introduced long ago (what's new ?).
4523 * expression.cs (UserImplicitCast::CanConvert): Static method to do
4524 the work of all the checking.
4525 (ConvertImplicit): Call CanConvert and only then create object if necessary.
4526 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
4528 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
4529 that is the right way.
4531 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
4532 overloading resolution. Use everywhere instead of cutting and pasting code.
4534 (Binary::ResolveOperator): Use MakeUnionSet.
4536 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
4537 we have to convert to bool types. Not complete yet.
4539 2001-09-27 Miguel de Icaza <miguel@ximian.com>
4541 * typemanager.cs (TypeManager::CSharpName): support ushort.
4543 * expression.cs (Expression::TryImplicitIntConversion): Attempts
4544 to provide an expression that performsn an implicit constant int
4545 conversion (section 6.1.6).
4546 (Expression::ConvertImplicitRequired): Reworked to include
4547 implicit constant expression conversions.
4549 (Expression::ConvertNumericExplicit): Finished.
4551 (Invocation::Emit): If InstanceExpression is null, then it means
4552 that we perform a call on this.
4554 2001-09-26 Miguel de Icaza <miguel@ximian.com>
4556 * expression.cs (Unary::Emit): Remove some dead code.
4557 (Probe): Implement Resolve and Emit for `is'.
4558 (Expression::ConvertImplicitRequired): Attempt to do constant
4559 expression conversions here. Maybe should be moved to
4560 ConvertImplicit, but I am not sure.
4561 (Expression::ImplicitLongConstantConversionPossible,
4562 Expression::ImplicitIntConstantConversionPossible): New functions
4563 that tell whether is it possible to apply an implicit constant
4564 expression conversion.
4566 (ConvertNumericExplicit): Started work on explicit numeric
4569 * cs-parser.jay: Update operator constants.
4571 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
4572 (Parameters::GetSignature): Hook up VerifyArgs here.
4573 (Parameters::VerifyArgs): Verifies that no two arguments have the
4576 * class.cs (Operator): Update the operator names to reflect the
4577 ones that the spec expects (as we are just stringizing the
4580 * expression.cs (Unary::ResolveOperator): Fix bug: Use
4581 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
4582 previous usage did only work for our methods.
4583 (Expression::ConvertImplicit): Handle decimal implicit numeric
4584 conversions as well.
4585 (Expression::InternalTypeConstructor): Used to invoke constructors
4586 on internal types for default promotions.
4588 (Unary::Emit): Implement special handling for the pre/post
4589 increment/decrement for overloaded operators, as they need to have
4590 the same semantics as the other operators.
4592 (Binary::ResolveOperator): ditto.
4593 (Invocation::ConversionExists): ditto.
4594 (UserImplicitCast::Resolve): ditto.
4596 2001-09-26 Ravi Pratap <ravi@ximian.com>
4598 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
4599 operator, return after emitting body. Regression tests pass again !
4601 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
4602 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
4603 (Invocation::OverloadResolve): Ditto.
4604 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
4606 * everywhere : update calls to the above methods accordingly.
4608 2001-09-26 Miguel de Icaza <miguel@ximian.com>
4610 * assign.cs (Assign): Make it inherit from ExpressionStatement.
4612 * expression.cs (ExpressionStatement): New base class used for
4613 expressions that can appear in statements, so that we can provide
4614 an alternate path to generate expression that do not leave a value
4617 (Expression::Emit, and all the derivatives): We no longer return
4618 whether a value is left on the stack or not. Every expression
4619 after being emitted leaves a single value on the stack.
4621 * codegen.cs (EmitContext::EmitStatementExpression): Use the
4622 facilties of ExpressionStatement if possible.
4624 * cs-parser.jay: Update statement_expression.
4626 2001-09-25 Miguel de Icaza <miguel@ximian.com>
4628 * driver.cs: Change the wording of message
4630 2001-09-25 Ravi Pratap <ravi@ximian.com>
4632 * expression.cs (Binary::ResolveOperator): Had forgottten to set
4633 the type of the expression to the return type of the method if
4634 we have an overloaded operator match ! The regression tests pass again !
4635 (Unary::ResolveOperator): Ditto.
4637 * expression.cs (Invocation::ConversionExists): Correct the member lookup
4638 to find "op_Implicit", not "implicit" ;-)
4639 (UserImplicitCast): New class to take care of user-defined implicit conversions.
4640 (ConvertImplicit, ForceConversion): Take TypeContainer argument
4642 * everywhere : Correct calls to the above accordingly.
4644 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
4645 (ConvertImplicit): Do user-defined conversion if it exists.
4647 2001-09-24 Miguel de Icaza <miguel@ximian.com>
4649 * assign.cs: track location.
4650 (Resolve): Use implicit conversions on assignment.
4652 * literal.cs: Oops. Not good, Emit of short access values should
4653 pass (Bytes) or the wrong argument will be selected.
4655 * expression.cs (Unary::Emit): Emit code for -expr.
4657 (Unary::ResolveOperator): Handle `Substract' for non-constants
4658 (substract from zero from the non-constants).
4659 Deal with Doubles as well.
4661 (Expression::ConvertImplicitRequired): New routine that reports an
4662 error if no implicit conversion exists.
4664 (Invocation::OverloadResolve): Store the converted implicit
4665 expressions if we make them
4667 2001-09-24 Ravi Pratap <ravi@ximian.com>
4669 * class.cs (ConstructorInitializer): Take a Location argument.
4670 (ConstructorBaseInitializer): Same here.
4671 (ConstructorThisInitializer): Same here.
4673 * cs-parser.jay : Update all calls accordingly.
4675 * expression.cs (Unary, Binary, New): Take location argument.
4676 Update accordingly everywhere.
4678 * cs-parser.jay : Update all calls to the above to take a location
4683 2001-09-24 Ravi Pratap <ravi@ximian.com>
4685 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
4686 (Invocation::BetterConversion): Same here
4687 (Invocation::ConversionExists): Ditto.
4689 (Invocation::ConversionExists): Implement.
4691 2001-09-22 Ravi Pratap <ravi@ximian.com>
4693 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
4694 Also take an additional TypeContainer argument.
4696 * All over : Pass in TypeContainer as argument to OverloadResolve.
4698 * typemanager.cs (CSharpName): Update to check for the string type and return
4701 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
4704 2001-09-21 Ravi Pratap <ravi@ximian.com>
4706 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
4707 (Invocation::BetterFunction): Implement.
4708 (Invocation::BetterConversion): Implement.
4709 (Invocation::ConversionExists): Skeleton, no implementation yet.
4711 Okay, things work fine !
4713 2001-09-21 Miguel de Icaza <miguel@ximian.com>
4715 * typemanager.cs: declare and load enum_type, delegate_type and
4718 * expression.cs (Expression::Emit): Now emit returns a value that
4719 tells whether a value is left on the stack or not. This strategy
4720 might be reveted tomorrow with a mechanism that would address
4721 multiple assignments.
4722 (Expression::report118): Utility routine to report mismatches on
4725 (Unary::Report23): Report impossible type/operator combination
4728 (Unary::IsIncrementableNumber): Whether the type can be
4729 incremented or decremented with add.
4730 (Unary::ResolveOperator): Also allow enumerations to be bitwise
4732 (Unary::ResolveOperator): Implement ++, !, ~,
4734 (Invocation::Emit): Deal with new Emit convetion.
4736 * All Expression derivatives: Updated their Emit method to return
4737 whether they leave values on the stack or not.
4739 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
4740 stack for expressions that are statements.
4742 2001-09-20 Miguel de Icaza <miguel@ximian.com>
4744 * expression.cs (LValue): New interface. Must be implemented by
4746 (LocalVariableReference, ParameterReference, FieldExpr): Implement
4749 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
4750 interface for generating code, simplifies the code.
4752 2001-09-20 Ravi Pratap <ravi@ximian.com>
4754 * expression.cs (everywhere): Comment out return statements in ::Resolve
4755 methods to avoid the warnings.
4757 2001-09-20 Miguel de Icaza <miguel@ximian.com>
4759 * driver.cs (parse): Report error 2001 if we can not open the
4762 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
4765 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
4768 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
4769 otherwise nested blocks end up with the same index.
4771 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
4773 * expression.cs: Instead of having FIXMEs in the Resolve
4774 functions, throw exceptions so it is obvious that we are facing a
4777 * cs-parser.jay (invocation_expression): Pass Location information.
4779 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
4780 Use a basename for those routines because .NET does not like paths
4783 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
4786 2001-09-19 Miguel de Icaza <miguel@ximian.com>
4788 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
4789 are loading the correct data types (throws an exception if not).
4790 (TypeManager::InitCoreTypes): Use CoreLookupType
4792 * expression.cs (Unary::ResolveOperator): return the child
4793 expression for expressions which are just +expr.
4794 (Unary::ResolveOperator): Return negative literals for -LITERAL
4795 expressions (otherwise they are Unary {Literal}).
4796 (Invocation::Badness): Take into account `Implicit constant
4797 expression conversions'.
4799 * literal.cs (LongLiteral): Implement long literal class.
4800 (IntLiteral): export the `Value' of the intliteral.
4802 2001-09-19 Ravi Pratap <ravi@ximian.com>
4804 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
4806 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
4807 instead of 'Operator'
4809 * expression.cs (Binary::ResolveOperator): Update accordingly.
4810 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
4813 * cs-parser.jay (unary_expression): Update to use the new names.
4815 * gen-treedump.cs (GetUnary): Same here.
4817 * expression.cs (Unary::Resolve): Implement.
4818 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
4819 operators are found instead of making noise ;-)
4820 (Unary::ResolveOperator): New method to do precisely the same thing which
4821 Binary::ResolveOperator does for Binary expressions.
4822 (Unary.method, .Arguments): Add.
4823 (Unary::OperName): Implement.
4824 (Unary::ForceConversion): Copy and Paste !
4826 * class.cs (Operator::Define): Fix a small bug for the case when we have
4829 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
4830 for the inbuilt operators. Only overloading works for now ;-)
4832 2001-09-18 Miguel de Icaza <miguel@ximian.com>
4834 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
4835 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
4837 * expression.cs (This::Emit): Implement.
4838 (This::Resolve): Implement.
4839 (TypeOf:Resolve): Implement.
4840 (Expression::ResolveSimpleName): Add an implicit this to instance
4842 (MemberAccess::Resolve): Deal with Parameters and Fields.
4843 Bind instance variable to Field expressions.
4844 (FieldExpr::Instance): New field used to track the expression that
4845 represents the object instance.
4846 (FieldExpr::Resolve): Track potential errors from MemberLookup not
4848 (FieldExpr::Emit): Implement.
4850 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
4851 the last instruction contains a return opcode to avoid generating
4852 the last `ret' instruction (this generates correct code, and it is
4853 nice to pass the peverify output).
4855 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
4856 initializer for static and instance variables.
4857 (Constructor::Emit): Allow initializer to be null in the case of
4858 static constructors. Only emit initializer for instance
4861 (TypeContainer::FindMembers): Return a null array if there are no
4864 Also fix the code for the MemberTypes.Method branch, as it was not
4865 scanning that for operators (or tried to access null variables before).
4867 * assign.cs (Assign::Emit): Handle instance and static fields.
4871 * driver.cs: Stop compilation if there are parse errors.
4873 * cs-parser.jay (constructor_declaration): Provide default base
4874 initializer for non-static constructors.
4875 (constructor_declarator): Do not provide a default base
4876 initializers if none was specified.
4877 Catch the fact that constructors should not have parameters.
4879 * class.cs: Do not emit parent class initializers for static
4880 constructors, that should be flagged as an error.
4882 2001-09-18 Ravi Pratap <ravi@ximian.com>
4884 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
4885 Move back code into TypeContainer::Populate.
4887 2001-09-18 Ravi Pratap <ravi@ximian.com>
4889 * class.cs (TypeContainer::AddConstructor): Fix the check to
4890 compare against Name, not Basename.
4891 (Operator::OpType): Change Plus and Minus to Add and Subtract.
4893 * cs-parser.jay : Update accordingly.
4895 * class.cs (TypeContainer::FindMembers): For the case where we are searching
4896 for methods, don't forget to look into the operators too.
4897 (RegisterMethodBuilder): Helper method to take care of this for
4898 methods, constructors and operators.
4899 (Operator::Define): Completely revamp.
4900 (Operator.OperatorMethod, MethodName): New fields.
4901 (TypeContainer::Populate): Move the registering of builders into
4902 RegisterMethodBuilder.
4903 (Operator::Emit): Re-write.
4905 * expression.cs (Binary::Emit): Comment out code path to emit method
4906 invocation stuff for the case when we have a user defined operator. I am
4907 just not able to get it right !
4909 2001-09-17 Miguel de Icaza <miguel@ximian.com>
4911 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
4914 (Expression::MemberLookup): Provide a version that allows to
4915 specify the MemberTypes and BindingFlags.
4917 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
4918 so it was not fetching variable information from outer blocks.
4920 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
4921 Beforefieldinit as it was buggy.
4923 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
4926 * class.cs (Constructor::Emit): Only emit if block is not null.
4927 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
4928 deal with this by semantically definining it as if the user had
4931 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
4932 constructors as we now "emit" them at a higher level.
4934 (TypeContainer::DefineDefaultConstructor): Used to define the
4935 default constructors if none was provided.
4937 (ConstructorInitializer): Add methods Resolve and Emit.
4939 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
4941 2001-09-17 Ravi Pratap <ravi@ximian.com>
4943 * class.cs (TypeContainer::EmitDefaultConstructor): Register
4944 the default constructor builder with our hashtable for methodbuilders
4947 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
4948 and argument_count is 0 in which case we have a match.
4949 (Binary::ResolveOperator): More null checking and miscellaneous coding
4952 2001-09-17 Ravi Pratap <ravi@ximian.com>
4954 * rootcontext.cs (IsNameSpace): Compare against null.
4956 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
4958 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
4959 and Unary::Operator.
4961 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
4964 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
4965 we have overloaded operators.
4966 (Binary::ResolveOperator): Implement the part which does the operator overload
4969 * class.cs (Operator::Emit): Implement.
4970 (TypeContainer::Emit): Emit the operators we have too.
4972 * expression.cs (Binary::Emit): Update to emit the appropriate code for
4973 the case when we have a user-defined operator.
4975 2001-09-17 Miguel de Icaza <miguel@ximian.com>
4977 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
4979 2001-09-16 Ravi Pratap <ravi@ximian.com>
4981 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
4982 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
4983 (Constructor::Emit): Implement.
4984 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
4985 if we have no work to do.
4986 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
4989 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
4990 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
4992 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
4995 2001-09-15 Ravi Pratap <ravi@ximian.com>
4997 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
4999 (Tree::RecordNamespace): Method to do what the name says ;-)
5000 (Tree::Namespaces): Property to get at the namespaces hashtable.
5002 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
5005 * rootcontext.cs (IsNamespace): Fixed it :-)
5007 2001-09-14 Miguel de Icaza <miguel@ximian.com>
5009 * class.cs (TypeContainer::FindMembers): Add support for
5011 (MethodCore): New class that encapsulates both the shared aspects
5012 of a Constructor and a Method.
5013 (Method, Constructor): Factored pieces into MethodCore.
5015 * driver.cs: Added --fatal which makes errors throw exceptions.
5016 Load System assembly as well as part of the standard library.
5018 * report.cs: Allow throwing exceptions on errors for debugging.
5020 * modifiers.cs: Do not use `parent', instead use the real type
5021 container to evaluate permission settings.
5023 * class.cs: Put Ravi's patch back in. He is right, and we will
5024 have to cope with the
5026 2001-09-14 Ravi Pratap <ravi@ximian.com>
5028 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
5029 FamORAssem, not FamANDAssem.
5031 2001-09-14 Miguel de Icaza <miguel@ximian.com>
5033 * driver.cs: Added --parse option that only parses its input files
5036 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
5037 incorrect. IsTopLevel is not used to tell whether an object is
5038 root_types or not (that can be achieved by testing this ==
5039 root_types). But to see if this is a top-level *class* (not
5040 necessarly our "toplevel" container).
5042 2001-09-14 Ravi Pratap <ravi@ximian.com>
5044 * enum.cs (Enum::Define): Modify to call the Lookup method on the
5045 parent instead of a direct call to GetType.
5047 2001-09-14 Ravi Pratap <ravi@ximian.com>
5049 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
5050 Modifiers.TypeAttr. This should just be a call to that method.
5052 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
5053 object so that we can determine if we are top-level or not.
5055 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
5058 * enum.cs (Enum::Define): Ditto.
5060 * modifiers.cs (FieldAttr): Re-write.
5062 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
5063 (TypeContainer::HaveStaticConstructor): New property to provide access
5064 to precisely that info.
5066 * modifiers.cs (MethodAttr): Re-write.
5067 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
5069 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
5070 of top-level types as claimed.
5072 2001-09-13 Miguel de Icaza <miguel@ximian.com>
5074 * expression.cs (MemberLookup): Fruitless attempt to lookup
5075 constructors. Maybe I need to emit default constructors? That
5076 might be it (currently .NET emits this for me automatically).
5077 (Invocation::OverloadResolve): Cope with Arguments == null.
5078 (Invocation::EmitArguments): new function, shared by the new
5080 (Invocation::Emit): Handle static and instance methods. Emit
5081 proper call instruction for virtual or non-virtual invocations.
5082 (New::Emit): Implement.
5083 (New::Resolve): Implement.
5084 (MemberAccess:Resolve): Implement.
5085 (MethodGroupExpr::InstanceExpression): used conforming to the spec
5087 (FieldExpr::Resolve): Set type.
5089 * support.cs: Handle empty arguments.
5091 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
5092 SimpleLookup): Auxiliary routines to help parse a qualifier
5095 Update qualifier_identifier rule.
5097 * codegen.cs: Removed debugging messages.
5099 * class.cs: Make this a global thing, this acts just as a "key" to
5100 objects that we might have around.
5102 (Populate): Only initialize method_builders_to_methods once.
5104 * expression.cs (PropertyExpr): Initialize type from the
5107 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
5108 Resolve pattern. Attempt to implicitly convert value to boolean.
5111 * expression.cs: Set the type for the int32/int32 argument case.
5112 (Binary::ResolveOperator): Set the return type to boolean for
5113 comparission operators
5115 * typemanager.cs: Remove debugging print code.
5117 (Invocation::Resolve): resolve type.
5119 * class.cs: Allocate a MemberInfo of the correct size, as the code
5120 elsewhere depends on the test to reflect the correct contents.
5122 (Method::) Keep track of parameters, due to System.Reflection holes
5124 (TypeContainer::Populate): Keep track of MethodBuilders to Method
5127 (TypeContainer::FindMembers): Use ArrayList and then copy an array
5128 of the exact size and return that.
5130 (Class::LookupMethodByBuilder): New function that maps
5131 MethodBuilders to its methods. Required to locate the information
5132 on methods because System.Reflection bit us again.
5134 * support.cs: New file, contains an interface ParameterData and
5135 two implementations: ReflectionParameters and InternalParameters
5136 used to access Parameter information. We will need to grow this
5139 * expression.cs (Invocation::GetParameterData): implement a cache
5140 and a wrapper around the ParameterData creation for methods.
5141 (Invocation::OverloadResolve): Use new code.
5143 2001-09-13 Ravi Pratap <ravi@ximian.com>
5145 * class.cs (TypeContainer::EmitField): Remove and move into
5146 (Field::Define): here and modify accordingly.
5147 (Field.FieldBuilder): New member.
5148 (TypeContainer::Populate): Update accordingly.
5149 (TypeContainer::FindMembers): Implement.
5151 2001-09-13 Miguel de Icaza <miguel@ximian.com>
5153 * statement.cs: (VariableInfo::VariableType): New field to be
5154 initialized with the full type once it is resolved.
5156 2001-09-12 Miguel de Icaza <miguel@ximian.com>
5158 * parameter.cs (GetParameterInfo): Use a type cache to compute
5159 things only once, and to reuse this information
5161 * expression.cs (LocalVariableReference::Emit): Implement.
5162 (OpcodeCast::Emit): fix.
5164 (ParameterReference::Resolve): Implement.
5165 (ParameterReference::Emit): Implement.
5167 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
5168 that are expressions need to stay as Expressions.
5170 * typemanager.cs (CSharpName): Returns the C# name of a type if
5173 * expression.cs (Expression::ConvertImplicit): New function that
5174 implements implicit type conversions.
5176 (Expression::ImplicitReferenceConversion): Implements implicit
5177 reference conversions.
5179 (EmptyCast): New type for transparent casts.
5181 (OpcodeCast): New type for casts of types that are performed with
5182 a sequence of bytecodes.
5184 (BoxedCast): New type used for casting value types into reference
5185 types. Emits a box opcode.
5187 (Binary::DoNumericPromotions): Implements numeric promotions of
5188 and computation of the Binary::Type.
5190 (Binary::EmitBranchable): Optimization.
5192 (Binary::Emit): Implement code emission for expressions.
5194 * typemanager.cs (TypeManager): Added two new core types: sbyte
5197 2001-09-12 Ravi Pratap <ravi@ximian.com>
5199 * class.cs (TypeContainer::FindMembers): Method which does exactly
5200 what Type.FindMembers does, only we don't have to use reflection. No
5203 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
5204 typecontainer objects as we need to get at them.
5205 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
5207 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
5208 typecontainer object.
5210 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
5211 of just a Report object.
5213 2001-09-11 Ravi Pratap <ravi@ximian.com>
5215 * class.cs (Event::Define): Go back to using the prefixes "add_" and
5217 (TypeContainer::Populate): Now define the delegates of the type too.
5218 (TypeContainer.Delegates): Property to access the list of delegates defined
5221 * delegates.cs (Delegate::Define): Implement partially.
5223 * modifiers.cs (TypeAttr): Handle more flags.
5225 2001-09-11 Ravi Pratap <ravi@ximian.com>
5227 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
5229 (Operator::Define): Re-write logic to get types by using the LookupType method
5230 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
5231 (Indexer::Define): Ditto.
5232 (Event::Define): Ditto.
5233 (Property::Define): Ditto.
5235 2001-09-10 Ravi Pratap <ravi@ximian.com>
5237 * class.cs (TypeContainer::Populate): Now define operators too.
5238 (TypeContainer.Operators): New property to access the list of operators
5240 (Operator.OperatorMethodBuilder): New member to hold the method builder
5241 for the operator we are defining.
5242 (Operator::Define): Implement.
5244 2001-09-10 Ravi Pratap <ravi@ximian.com>
5246 * class.cs (Event::Define): Make the prefixes of the accessor methods
5247 addOn_ and removeOn_
5249 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
5250 of the location being passed in too. Ideally, this should go later since all
5251 error reporting should be done through the Report object.
5253 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
5254 (Populate): Iterate thru the indexers we have and define them too.
5255 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
5256 for the get and set accessors.
5257 (Indexer::Define): Implement.
5259 2001-09-09 Miguel de Icaza <miguel@ximian.com>
5261 * expression.cs (Binary::Resolve): Beginning of it. I scratched
5262 my previous implementation, did not work.
5264 * typemanager.cs: Add a couple of missing types (the longs).
5266 * literal.cs: Use TypeManager.bool_type instead of getting it.
5268 * expression.cs (EventExpr): New kind of expressions.
5269 (Expressio::ExprClassFromMemberInfo): finish
5271 2001-09-08 Miguel de Icaza <miguel@ximian.com>
5273 * assign.cs: Emit stores to static fields differently.
5275 2001-09-08 Ravi Pratap <ravi@ximian.com>
5277 * Merge in changes and adjust code to tackle conflicts. Backed out my
5278 code in Assign::Resolve ;-)
5280 2001-09-08 Ravi Pratap <ravi@ximian.com>
5282 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
5283 instead Report.Error and also pass in the location.
5284 (CSharpParser::Lexer): New readonly property to return the reference
5285 to the Tokenizer object.
5286 (declare_local_variables): Use Report.Error with location instead of plain
5290 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
5291 (Operator.CheckBinaryOperator): Ditto.
5293 * cs-parser.jay (operator_declarator): Update accordingly.
5295 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
5296 (CheckBinaryOperator): Same here.
5298 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
5299 on the name without any prefixes of namespace names etc. This is because we
5300 already might have something already fully qualified like
5301 'System.Console.WriteLine'
5303 * assign.cs (Resolve): Begin implementation. Stuck ;-)
5305 2001-09-07 Ravi Pratap <ravi@ximian.com>
5307 * cs-tokenizer.cs (location): Return a string which also contains
5310 * expression.cs (ElementAccess): New class for expressions of the
5311 type 'element access.'
5312 (BaseAccess): New class for expressions of the type 'base access.'
5313 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
5316 * cs-parser.jay (element_access): Implement action.
5317 (base_access): Implement actions.
5318 (checked_expression, unchecked_expression): Implement.
5320 * cs-parser.jay (local_variable_type): Correct and implement.
5321 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
5323 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
5325 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
5326 name and the specifiers.
5328 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
5330 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
5331 making them all public ;-)
5333 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
5336 2001-09-07 Miguel de Icaza <miguel@ximian.com>
5338 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
5340 (FieldExpr, PropertyExprs): New resolved expressions.
5341 (SimpleName::MemberStaticCheck): Perform static checks for access
5342 to non-static fields on static methods. Maybe this should be
5343 generalized for MemberAccesses.
5344 (SimpleName::ResolveSimpleName): More work on simple name
5347 * cs-parser.jay (primary_expression/qualified_identifier): track
5348 the parameter index.
5350 * codegen.cs (CodeGen::Save): Catch save exception, report error.
5351 (EmitContext::EmitBoolExpression): Chain to expression generation
5352 instead of temporary hack.
5353 (::EmitStatementExpression): Put generic expression code generation.
5355 * assign.cs (Assign::Emit): Implement variable assignments to
5356 local variables, parameters and fields.
5358 2001-09-06 Miguel de Icaza <miguel@ximian.com>
5360 * statement.cs (Block::GetVariableInfo): New method, returns the
5361 VariableInfo for a variable name in a block.
5362 (Block::GetVariableType): Implement in terms of GetVariableInfo
5364 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
5365 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
5367 2001-09-06 Ravi Pratap <ravi@ximian.com>
5369 * cs-parser.jay (operator_declaration): Continue on my quest : update
5370 to take attributes argument.
5371 (event_declaration): Ditto.
5372 (enum_declaration): Ditto.
5373 (indexer_declaration): Ditto.
5375 * class.cs (Operator::Operator): Update constructor accordingly.
5376 (Event::Event): Ditto.
5378 * delegate.cs (Delegate::Delegate): Same here.
5380 * enum.cs (Enum::Enum): Same here.
5382 2001-09-05 Ravi Pratap <ravi@ximian.com>
5384 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
5386 * ../tests/cs0658.cs : New file to demonstrate error 0658.
5388 * attribute.cs (Attributes): New class to encapsulate all attributes which were
5389 being passed around as an arraylist.
5390 (Attributes::AddAttribute): Method to add attribute sections.
5392 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
5393 (struct_declaration): Update accordingly.
5394 (constant_declaration): Update.
5395 (field_declaration): Update.
5396 (method_header): Update.
5397 (fixed_parameter): Update.
5398 (parameter_array): Ditto.
5399 (property_declaration): Ditto.
5400 (destructor_declaration): Ditto.
5402 * class.cs (Struct::Struct): Update constructors accordingly.
5403 (Class::Class): Ditto.
5404 (Field::Field): Ditto.
5405 (Method::Method): Ditto.
5406 (Property::Property): Ditto.
5407 (TypeContainer::OptAttribute): update property's return type.
5409 * interface.cs (Interface.opt_attributes): New member.
5410 (Interface::Interface): Update to take the extra Attributes argument.
5412 * parameter.cs (Parameter::Parameter): Ditto.
5414 * constant.cs (Constant::Constant): Ditto.
5416 * interface.cs (InterfaceMemberBase): New OptAttributes field.
5417 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
5418 the attributes as a parameter.
5419 (InterfaceProperty): Update constructor call.
5420 (InterfaceEvent): Ditto.
5421 (InterfaceMethod): Ditto.
5422 (InterfaceIndexer): Ditto.
5424 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
5425 pass the attributes too.
5426 (interface_event_declaration): Ditto.
5427 (interface_property_declaration): Ditto.
5428 (interface_method_declaration): Ditto.
5429 (interface_declaration): Ditto.
5431 2001-09-05 Miguel de Icaza <miguel@ximian.com>
5433 * class.cs (Method::Define): Track the "static Main" definition to
5434 create an entry point.
5436 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
5437 EntryPoint if we find it.
5439 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
5440 (EmitContext::ig): Make this variable public.
5442 * driver.cs: Make the default output file be the first file name
5443 with the .exe extension.
5445 Detect empty compilations
5447 Handle various kinds of output targets. Handle --target and
5448 rename -t to --dumper.
5450 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
5451 methods inherited from Expression return now an Expression. This
5452 will is used during the tree rewriting as we resolve them during
5455 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
5456 the spec. Missing entirely is the information about
5457 accessability of elements of it.
5459 (Expression::ExprClassFromMemberInfo): New constructor for
5460 Expressions that creates a fully initialized Expression based on
5461 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
5464 (Invocation::Resolve): Begin implementing resolution of invocations.
5466 * literal.cs (StringLiteral): Implement Emit.
5468 2001-09-05 Ravi Pratap <ravi@ximian.com>
5470 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
5473 2001-09-04 Ravi Pratap <ravi@ximian.com>
5475 * cs-parser.jay (attribute_arguments): Implement actions.
5476 (attribute): Fix bug in production. Implement action.
5477 (attribute_list): Implement.
5478 (attribute_target): Implement.
5479 (attribute_target_specifier, opt_target_specifier): Implement
5480 (CheckAttributeTarget): New method to check if the attribute target
5482 (attribute_section): Implement.
5483 (opt_attributes): Implement.
5485 * attribute.cs : New file to handle attributes.
5486 (Attribute): Class to hold attribute info.
5488 * cs-parser.jay (opt_attribute_target_specifier): Remove production
5489 (attribute_section): Modify production to use 2 different rules to
5490 achieve the same thing. 1 s/r conflict down !
5491 Clean out commented, useless, non-reducing dimension_separator rules.
5493 * class.cs (TypeContainer.attributes): New member to hold list
5494 of attributes for a type.
5495 (Struct::Struct): Modify to take one more argument, the attribute list.
5496 (Class::Class): Ditto.
5497 (Field::Field): Ditto.
5498 (Method::Method): Ditto.
5499 (Property::Property): Ditto.
5501 * cs-parser.jay (struct_declaration): Update constructor call to
5502 pass in the attributes too.
5503 (class_declaration): Ditto.
5504 (constant_declaration): Ditto.
5505 (field_declaration): Ditto.
5506 (method_header): Ditto.
5507 (fixed_parameter): Ditto.
5508 (parameter_array): Ditto.
5509 (property_declaration): Ditto.
5511 * constant.cs (Constant::Constant): Update constructor similarly.
5512 Use System.Collections.
5514 * parameter.cs (Parameter::Parameter): Update as above.
5516 2001-09-02 Ravi Pratap <ravi@ximian.com>
5518 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
5519 (TypeContainer.delegates): New member to hold list of delegates.
5521 * cs-parser.jay (delegate_declaration): Implement the action correctly
5522 this time as I seem to be on crack ;-)
5524 2001-09-02 Miguel de Icaza <miguel@ximian.com>
5526 * rootcontext.cs (RootContext::IsNamespace): new function, used to
5527 tell whether an identifier represents a namespace.
5529 * expression.cs (NamespaceExpr): A namespace expression, used only
5530 temporarly during expression resolution.
5531 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
5532 utility functions to resolve names on expressions.
5534 2001-09-01 Miguel de Icaza <miguel@ximian.com>
5536 * codegen.cs: Add hook for StatementExpressions.
5538 * class.cs: Fix inverted test for static flag in methods.
5540 2001-09-02 Ravi Pratap <ravi@ximian.com>
5542 * class.cs (Operator::CheckUnaryOperator): Correct error number used
5543 to make it coincide with MS' number.
5544 (Operator::CheckBinaryOperator): Ditto.
5546 * ../errors/errors.txt : Remove error numbers added earlier.
5548 * ../errors/cs1019.cs : Test case for error # 1019
5550 * ../errros/cs1020.cs : Test case for error # 1020
5552 * cs-parser.jay : Clean out commented cruft.
5553 (dimension_separators, dimension_separator): Comment out. Ostensibly not
5554 used anywhere - non-reducing rule.
5555 (namespace_declarations): Non-reducing rule - comment out.
5557 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
5558 with TypeContainer::AddEnum.
5560 * delegate.cs : New file for delegate handling classes.
5561 (Delegate): Class for declaring delegates.
5563 * makefile : Update.
5565 * cs-parser.jay (delegate_declaration): Implement.
5567 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
5569 * class.cs (Event::Define): Implement.
5570 (Event.EventBuilder): New member.
5572 * class.cs (TypeContainer::Populate): Update to define all enums and events
5574 (Events): New property for the events arraylist we hold. Shouldn't we move to using
5575 readonly fields for all these cases ?
5577 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
5579 * class.cs (Property): Revamp to use the convention of making fields readonly.
5580 Accordingly modify code elsewhere.
5582 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
5583 the Define method of the Property class.
5585 * class.cs : Clean up applied patch and update references to variables etc. Fix
5587 (TypeContainer::Populate): Update to define all the properties we have. Also
5588 define all enumerations.
5590 * enum.cs (Define): Implement.
5592 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
5594 * cs-parser.jay (overloadable_operator): The semantic value is an
5595 enum of the Operator class.
5596 (operator_declarator): Implement actions.
5597 (operator_declaration): Implement.
5599 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
5600 validity of definitions.
5601 (Operator::CheckBinaryOperator): Static method to check for binary operators
5602 (TypeContainer::AddOperator): New method to add an operator to a type.
5604 * cs-parser.jay (indexer_declaration): Added line to actually call the
5605 AddIndexer method so it gets added ;-)
5607 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
5608 already taken care of by the MS compiler ?
5610 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
5612 * class.cs (Operator): New class for operator declarations.
5613 (Operator::OpType): Enum for the various operators.
5615 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
5617 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
5618 ostensibly handle this in semantic analysis.
5620 * cs-parser.jay (general_catch_clause): Comment out
5621 (specific_catch_clauses, specific_catch_clause): Ditto.
5622 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
5623 (catch_args, opt_catch_args): New productions.
5624 (catch_clause): Rewrite to use the new productions above
5625 (catch_clauses): Modify accordingly.
5626 (opt_catch_clauses): New production to use in try_statement
5627 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
5628 and re-write the code in the actions to extract the specific and
5629 general catch clauses by being a little smart ;-)
5631 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
5632 Hooray, try and catch statements parse fine !
5634 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
5636 * statement.cs (Block::GetVariableType): Fix logic to extract the type
5637 string from the hashtable of variables.
5639 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
5640 I end up making that mistake ;-)
5641 (catch_clauses): Fixed gross error which made Key and Value of the
5642 DictionaryEntry the same : $1 !!
5644 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
5646 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
5648 * cs-parser.jay (event_declaration): Correct to remove the semicolon
5649 when the add and remove accessors are specified.
5651 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
5653 * cs-parser.jay (IndexerDeclaration): New helper class to hold
5654 information about indexer_declarator.
5655 (indexer_declarator): Implement actions.
5656 (parsing_indexer): New local boolean used to keep track of whether
5657 we are parsing indexers or properties. This is necessary because
5658 implicit_parameters come into picture even for the get accessor in the
5660 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
5662 * class.cs (Indexer): New class for indexer declarations.
5663 (TypeContainer::AddIndexer): New method to add an indexer to a type.
5664 (TypeContainer::indexers): New member to hold list of indexers for the
5667 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
5669 * cs-parser.jay (add_accessor_declaration): Implement action.
5670 (remove_accessor_declaration): Implement action.
5671 (event_accessors_declaration): Implement
5672 (variable_declarators): swap statements for first rule - trivial.
5674 * class.cs (Event): New class to hold information about event
5676 (TypeContainer::AddEvent): New method to add an event to a type
5677 (TypeContainer::events): New member to hold list of events.
5679 * cs-parser.jay (event_declaration): Implement actions.
5681 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
5683 * cs-parser.jay (dim_separators): Implement. Make it a string
5684 concatenating all the commas together, just as they appear.
5685 (opt_dim_separators): Modify accordingly
5686 (rank_specifiers): Update accordingly. Basically do the same
5687 thing - instead, collect the brackets here.
5688 (opt_rank_sepcifiers): Modify accordingly.
5689 (array_type): Modify to actually return the complete type string
5690 instead of ignoring the rank_specifiers.
5691 (expression_list): Implement to collect the expressions
5692 (variable_initializer): Implement. We make it a list of expressions
5693 essentially so that we can handle the array_initializer case neatly too.
5694 (variable_initializer_list): Implement.
5695 (array_initializer): Make it a list of variable_initializers
5696 (opt_array_initializer): Modify accordingly.
5698 * expression.cs (New::NType): Add enumeration to help us
5699 keep track of whether we have an object/delegate creation
5700 or an array creation.
5701 (New:NewType, New::Rank, New::Indices, New::Initializers): New
5702 members to hold data about array creation.
5703 (New:New): Modify to update NewType
5704 (New:New): New Overloaded contructor for the array creation
5707 * cs-parser.jay (array_creation_expression): Implement to call
5708 the overloaded New constructor.
5710 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
5712 * class.cs (TypeContainer::Constructors): Return member
5713 constructors instead of returning null.
5715 2001-08-26 Miguel de Icaza <miguel@ximian.com>
5717 * typemanager.cs (InitCoreTypes): Initialize the various core
5718 types after we have populated the type manager with the user
5719 defined types (this distinction will be important later while
5720 compiling corlib.dll)
5722 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
5723 on Expression Classification. Now all expressions have a method
5724 `Resolve' and a method `Emit'.
5726 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
5727 generation from working. Also add some temporary debugging
5730 2001-08-24 Miguel de Icaza <miguel@ximian.com>
5732 * codegen.cs: Lots of code generation pieces. This is only the
5733 beginning, will continue tomorrow with more touches of polish. We
5734 handle the fundamentals of if, while, do, for, return. Others are
5735 trickier and I need to start working on invocations soon.
5737 * gen-treedump.cs: Bug fix, use s.Increment here instead of
5740 * codegen.cs (EmitContext): New struct, used during code
5741 emission to keep a context. Most of the code generation will be
5744 * cs-parser.jay: Add embedded blocks to the list of statements of
5745 this block. So code generation proceeds in a top down fashion.
5747 2001-08-23 Miguel de Icaza <miguel@ximian.com>
5749 * statement.cs: Add support for multiple child blocks.
5751 2001-08-22 Miguel de Icaza <miguel@ximian.com>
5753 * codegen.cs (EmitCode): New function, will emit the code for a
5754 Block of code given a TypeContainer and its ILGenerator.
5756 * statement.cs (Block): Standard public readonly optimization.
5757 (Block::Block constructors): Link children.
5758 (Block::Child): Child Linker.
5759 (Block::EmitVariables): Emits IL variable declarations.
5761 * class.cs: Drop support for MethodGroups here, delay until
5763 (Method::): Applied the same simplification that I did before, and
5764 move from Properties to public readonly fields.
5765 (Method::ParameterTypes): Returns the parameter types for the
5766 function, and implements a cache that will be useful later when I
5767 do error checking and the semantic analysis on the methods is
5769 (Constructor::GetCallingConvention): Renamed from CallingConvetion
5770 and made a method, optional argument tells whether this is a class
5771 or a structure to apply the `has-this' bit.
5772 (Method::GetCallingConvention): Implement, returns the calling
5774 (Method::Define): Defines the type, a second pass is performed
5775 later to populate the methods.
5777 (Constructor::ParameterTypes): implement a cache similar to the
5778 one on Method::ParameterTypes, useful later when we do semantic
5781 (TypeContainer::EmitMethod): New method. Emits methods.
5783 * expression.cs: Removed MethodGroup class from here.
5785 * parameter.cs (Parameters::GetCallingConvention): new method.
5787 2001-08-21 Miguel de Icaza <miguel@ximian.com>
5789 * class.cs (TypeContainer::Populate): Drop RootContext from the
5792 (Constructor::CallingConvention): Returns the calling convention.
5793 (Constructor::ParameterTypes): Returns the constructor parameter
5796 (TypeContainer::AddConstructor): Keep track of default constructor
5797 and the default static constructor.
5799 (Constructor::) Another class that starts using `public readonly'
5800 instead of properties.
5802 (Constructor::IsDefault): Whether this is a default constructor.
5804 (Field::) use readonly public fields instead of properties also.
5806 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
5807 track of static constructors; If none is used, turn on
5808 BeforeFieldInit in the TypeAttributes.
5810 * cs-parser.jay (opt_argument_list): now the return can be null
5811 for the cases where there are no arguments.
5813 (constructor_declarator): If there is no implicit `base' or
5814 `this', then invoke the default parent constructor.
5816 * modifiers.cs (MethodAttr): New static function maps a set of
5817 modifiers flags into a MethodAttributes enum
5818 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
5819 MethodAttr, TypeAttr to represent the various mappings where the
5821 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
5823 2001-08-19 Miguel de Icaza <miguel@ximian.com>
5825 * parameter.cs (GetParameterInfo): Fix bug where there would be no
5828 * interface.cs (PopulateIndexer): Implemented the code generator
5829 for interface indexers.
5831 2001-08-17 Miguel de Icaza <miguel@ximian.com>
5833 * interface.cs (InterfaceMemberBase): Now we track the new status
5836 (PopulateProperty): Implement property population. Woohoo! Got
5837 Methods and Properties going today.
5839 Removed all the properties for interfaces, and replaced them with
5840 `public readonly' fields.
5842 2001-08-16 Miguel de Icaza <miguel@ximian.com>
5844 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
5845 initialize their hashtables/arraylists only when they are needed
5846 instead of doing this always.
5848 * parameter.cs: Handle refs and out parameters.
5850 * cs-parser.jay: Use an ArrayList to construct the arguments
5851 instead of the ParameterCollection, and then cast that to a
5854 * parameter.cs: Drop the use of ParameterCollection and use
5855 instead arrays of Parameters.
5857 (GetParameterInfo): Use the Type, not the Name when resolving
5860 2001-08-13 Miguel de Icaza <miguel@ximian.com>
5862 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
5863 and instead use public readonly fields.
5865 * class.cs: Put back walking code for type containers.
5867 2001-08-11 Miguel de Icaza <miguel@ximian.com>
5869 * class.cs (MakeConstant): Code to define constants.
5871 * rootcontext.cs (LookupType): New function. Used to locate types
5874 2001-08-08 Miguel de Icaza <miguel@ximian.com>
5876 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
5877 this System.Reflection code is. Kudos to Microsoft
5879 * typemanager.cs: Implement a type cache and avoid loading all
5880 types at boot time. Wrap in LookupType the internals. This made
5881 the compiler so much faster. Wow. I rule!
5883 * driver.cs: Make sure we always load mscorlib first (for
5884 debugging purposes, nothing really important).
5886 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
5887 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
5889 * rootcontext.cs: Lookup types on their namespace; Lookup types
5890 on namespaces that have been imported using the `using' keyword.
5892 * class.cs (TypeContainer::TypeAttr): Virtualize.
5893 (Class::TypeAttr): Return attributes suitable for this bad boy.
5894 (Struct::TypeAttr): ditto.
5895 Handle nested classes.
5896 (TypeContainer::) Remove all the type visiting code, it is now
5897 replaced with the rootcontext.cs code
5899 * rootcontext.cs (GetClassBases): Added support for structs.
5901 2001-08-06 Miguel de Icaza <miguel@ximian.com>
5903 * interface.cs, statement.cs, class.cs, parameter.cs,
5904 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
5905 Drop use of TypeRefs, and use strings instead.
5907 2001-08-04 Miguel de Icaza <miguel@ximian.com>
5911 * class.cs (Struct::Struct): set the SEALED flags after
5912 checking the modifiers.
5913 (TypeContainer::TypeAttr): new property, returns the
5914 TypeAttributes for a class.
5916 * cs-parser.jay (type_list): Oops, list production was creating a
5917 new list of base types.
5919 * rootcontext.cs (StdLib): New property.
5920 (GetInterfaceTypeByName): returns an interface by type name, and
5921 encapsulates error handling here.
5922 (GetInterfaces): simplified.
5923 (ResolveTree): Encapsulated all the tree resolution here.
5924 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
5927 * driver.cs: Add support for --nostdlib, to avoid loading the
5929 (Main): Do not put tree resolution here.
5931 * rootcontext.cs: Beginning of the class resolution.
5933 2001-08-03 Miguel de Icaza <miguel@ximian.com>
5935 * rootcontext.cs: Provide better error reporting.
5937 * cs-parser.jay (interface_base): set our $$ to be interfaces.
5939 * rootcontext.cs (CreateInterface): Handle the case where there
5940 are no parent interfaces.
5942 (CloseTypes): Routine to flush types at the end.
5943 (CreateInterface): Track types.
5944 (GetInterfaces): Returns an array of Types from the list of
5947 * typemanager.c (AddUserType): Mechanism to track user types (puts
5948 the type on the global type hash, and allows us to close it at the
5951 2001-08-02 Miguel de Icaza <miguel@ximian.com>
5953 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
5954 RecordInterface instead.
5956 * cs-parser.jay: Updated to reflect changes above.
5958 * decl.cs (Definition): Keep track of the TypeBuilder type that
5959 represents this type here. Not sure we will use it in the long
5960 run, but wont hurt for now.
5962 * driver.cs: Smaller changes to accomodate the new code.
5964 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
5967 * rootcontext.cs (CreateInterface): New method, used to create
5968 the System.TypeBuilder type for interfaces.
5969 (ResolveInterfaces): new entry point to resolve the interface
5971 (CodeGen): Property, used to keep track of the code generator.
5973 2001-07-26 Miguel de Icaza <miguel@ximian.com>
5975 * cs-parser.jay: Add a second production for delegate_declaration
5978 (enum_body): Put an opt_comma here instead of putting it on
5979 enum_body or enum_member_declarations so we can handle trailing
5980 commas on enumeration members. Gets rid of a shift/reduce.
5982 (type_list): Need a COMMA in the middle.
5984 (indexer_declaration): Tell tokenizer to recognize get/set
5986 * Remove old targets.
5988 * Re-add the parser target.
5990 2001-07-13 Simon Cozens <simon@simon-cozens.org>
5992 * cs-parser.jay: Add precendence rules for a number of operators
5993 ot reduce the number of shift/reduce conflicts in the grammar.
5995 2001-07-17 Miguel de Icaza <miguel@ximian.com>
5997 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
6000 Get rid of old crufty code.
6002 * rootcontext.cs: Use this to keep track of the parsed
6003 representation and the defined types available to the program.
6005 * gen-treedump.cs: adjust for new convention.
6007 * type.cs: Split out the type manager, and the assembly builder
6010 * typemanager.cs: the type manager will live here now.
6012 * cil-codegen.cs: And the code generator here.
6014 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
6016 * makefile: Fixed up for easy making.
6018 2001-07-13 Simon Cozens <simon@simon-cozens.org>
6020 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
6023 (unary_expression): Expand pre_increment_expression and
6024 post_decrement_expression to reduce a shift/reduce.
6026 2001-07-11 Simon Cozens
6028 * cs-tokenizer.cs: Hex numbers should begin with a 0.
6030 Improve allow_keyword_as_indent name.
6032 2001-06-19 Miguel de Icaza <miguel@ximian.com>
6034 * Adjustments for Beta2.
6036 2001-06-13 Miguel de Icaza <miguel@ximian.com>
6038 * decl.cs: Added `Define' abstract method.
6039 (InTransit): new property, used to catch recursive definitions.
6041 * interface.cs: Implement `Define'.
6043 * modifiers.cs: Map Modifiers.constants to
6044 System.Reflection.TypeAttribute flags.
6046 * class.cs: Keep track of types and user-defined types.
6047 (BuilderInit): New method for creating an assembly
6048 (ResolveType): New function to launch the resolution process, only
6049 used by interfaces for now.
6051 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
6052 that are inserted into the name space.
6054 2001-06-08 Miguel de Icaza <miguel@ximian.com>
6056 * ARGH. I have screwed up my tree so many times due to the use of
6057 rsync rather than using CVS. Going to fix this at once.
6059 * driver.cs: Objetify driver. Load assemblies, use assemblies to
6062 2001-06-07 Miguel de Icaza <miguel@ximian.com>
6064 * Experiment successful: Use System.Type rather that our own
6067 2001-05-25 Miguel de Icaza <miguel@ximian.com>
6069 * cs-parser.jay: Removed nsAliases from here.
6071 Use new namespaces, handle `using XXX;'
6073 * namespace.cs: Reimplemented namespace handling, use a recursive
6074 definition of the class. Now we can keep track of using clauses
6075 and catch invalid using clauses.
6077 2001-05-24 Miguel de Icaza <miguel@ximian.com>
6079 * gen-treedump.cs: Adapted for all the renaming.
6081 * expression.cs (Expression): this class now has a Type property
6082 which returns an expression Type.
6084 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
6085 `Type', as this has a different meaning now in the base
6087 2001-05-22 Miguel de Icaza <miguel@ximian.com>
6089 * interface.cs, class.cs: Removed from all the sources the
6090 references to signature computation, as we can not do method
6091 signature computation during the parsing time, as we are not
6092 trying to solve at that point distinguishing:
6096 void a (NS.Blah x) {}
6099 Which depending on the context might be valid or not, as we do not
6100 know if Blah is the same thing as NS.Blah at that point.
6102 * Redid everything so the code uses TypeRefs now instead of
6103 Types. TypeRefs are just temporary type placeholders, that need
6104 to be resolved. They initially have a pointer to a string and the
6105 current scope in which they are used. This is used later by the
6106 compiler to resolve the reference to an actual Type.
6108 * DeclSpace is no longer a CIR.Type, and neither are
6109 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
6110 are all DeclSpaces, but no Types.
6112 * type.cs (TypeRefManager): This implements the TypeRef manager,
6113 which keeps track of all the types that need to be resolved after
6114 the parsing has finished.
6116 2001-05-13 Miguel de Icaza <miguel@ximian.com>
6118 * ARGH. We are going to have to store `foreach' as a class rather
6119 than resolving it, as we need to verify error 1579 after name
6120 resolution. *OR* we could keep a flag that says `This request to
6121 IEnumerator comes from a foreach statement' which we can then use
6122 to generate the error.
6124 2001-05-10 Miguel de Icaza <miguel@ximian.com>
6126 * class.cs (TypeContainer.AddMethod): we now add methods to the
6127 MethodGroup instead of the method hashtable.
6129 * expression.cs: Add MethodGroup abstraction, which gets us one
6130 step closer to the specification in the way we handle method
6133 * cs-parser.jay (primary_expression): qualified_identifier now
6134 tried to match up an identifier to a local variable reference or
6135 to a parameter reference.
6137 current_local_parameters is now a parser global variable that
6138 points to the current parameters for the block, used during name
6141 (property_declaration): Now creates an implicit `value' argument to
6144 2001-05-09 Miguel de Icaza <miguel@ximian.com>
6146 * parameter.cs: Do not use `param' arguments as part of the
6147 signature, per the spec.
6149 2001-05-08 Miguel de Icaza <miguel@ximian.com>
6151 * decl.cs: Base class for classes, structs and interfaces. This
6152 is the "Declaration Space"
6154 * cs-parser.jay: Use CheckDef for checking declaration errors
6155 instead of having one on each function.
6157 * class.cs: Factor out some code for handling error handling in
6158 accordance to the "Declarations" section in the "Basic Concepts"
6159 chapter in the ECMA C# spec.
6161 * interface.cs: Make all interface member classes derive from
6162 InterfaceMemberBase.
6164 2001-05-07 Miguel de Icaza <miguel@ximian.com>
6166 * Many things: all interfaces are parsed and generated in
6167 gen-treedump. Support for member variables, constructors,
6168 destructors, properties, constants is there.
6170 Beginning of the IL backend, but very little done, just there for
6173 2001-04-29 Miguel de Icaza <miguel@ximian.com>
6175 * cs-parser.jay: Fix labeled statement.
6177 * cs-tokenizer.cs (escape): Escape " and ' always.
6178 ref_line, ref_name: keep track of the line/filename as instructed
6179 by #line by the compiler.
6182 2001-04-27 Miguel de Icaza <miguel@ximian.com>
6184 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
6185 to match the values in System.CodeDOM.
6187 Divid renamed to Divide.
6189 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
6191 (Statements.set): remove.
6193 * System.CodeDOM/CodeCatchClause.cs: always have a valid
6196 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
6197 falseStatements always have valid values.
6199 * cs-parser.jay: Use System.CodeDOM now.