1 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3 Fixed compilation with csc.
5 * ecore.cs: Expression.Error made public. Is this correct? Should
6 Warning be made public too?
8 * expression.cs: use ea.Location instead of ea.loc.
9 [FIXME: Filed as bug #28607: MCS must report these errors.]
11 2002-08-06 Martin Baulig <martin@gnome.org>
13 * ecore.cs (Expression.loc): Moved the location here instead of
14 duplicating it in all derived classes.
15 (Expression.Location): New public property.
16 (Expression.Error, Expression.Warning): Made them non-static and
17 removed the location argument.
18 (Expression.Warning): Added overloaded version which takes an
20 (Expression.Error118): Make this non-static and removed the
21 expression and location arguments.
22 (TypeExpr): Added location argument to the constructor.
24 * expression.cs (StaticCallExpr): Added location argument to
26 (Indirection, PointerArithmetic): Likewise.
27 (CheckedExpr, UnCheckedExpr): Likewise.
28 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
29 (StringPtr): Likewise.
32 2002-08-05 Martin Baulig <martin@gnome.org>
34 * expression.cs (BaseAccess.DoResolve): Actually report errors.
36 * assign.cs (Assign.DoResolve): Check whether the source
37 expression is a value or variable.
39 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
40 while resolving the corresponding blocks.
42 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
43 an error, don't silently return null.
45 * statement.cs (Block.AddVariable): Do the error reporting here
46 and distinguish between CS0128 and CS0136.
47 (Block.DoResolve): Report all unused labels (warning CS0164).
48 (LabeledStatement): Pass the location to the constructor.
49 (LabeledStatement.HasBeenReferenced): New property.
50 (LabeledStatement.Resolve): Set it to true here.
52 * statement.cs (Return.Emit): Return success even after reporting
53 a type mismatch error (CS0126 or CS0127), this is what csc does and
54 it avoids confusing the users with any consecutive errors.
56 2002-08-05 Martin Baulig <martin@gnome.org>
58 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
60 * const.cs (Const.LookupConstantValue): Catch circular definitions.
62 * expression.cs (MemberAccess.DoResolve): Silently return if an
63 error has already been reported.
65 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
66 error has already been reported.
68 2002-08-05 Martin Baulig <martin@gnome.org>
70 * statement.cs (UsageVector): Only initialize the `parameters'
71 vector if we actually have any "out" parameters.
73 2002-08-05 Martin Baulig <martin@gnome.org>
75 * expression.cs (Binary.ResolveOperator): When combining delegates,
76 they must have the same type.
78 2002-08-05 Martin Baulig <martin@gnome.org>
80 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
81 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
82 work with the ms runtime and we also don't need it: if we're a
83 PropertyBuilder and not in the `indexer_arguments' hash, then we
84 are a property and not an indexer.
86 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
87 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
88 since the latter one doesn't work with the ms runtime.
90 2002-08-03 Martin Baulig <martin@gnome.org>
92 Fixed bugs #27998 and #22735.
94 * class.cs (Method.IsOperator): New public field.
95 (Method.CheckBase): Report CS0111 if there's already a method
96 with the same parameters in the current class. Report CS0508 when
97 attempting to change the return type of an inherited method.
98 (MethodData.Emit): Report CS0179 if a method doesn't have a body
99 and it's not marked abstract or extern.
100 (PropertyBase): New abstract base class for Property and Indexer.
101 (PropertyBase.CheckBase): Moved here from Property and made it work
103 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
104 the same so we can reuse it there.
105 (Property, Indexer): Derive from PropertyBase.
106 (MethodSignature.inheritable_property_signature_filter): New delegate
107 to find properties and indexers.
109 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
110 argument and improved error reporting.
112 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
113 EmptyReadOnlyParameters and made it a property.
115 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
116 version of this method which takes a `PropertyInfo indexer'.
117 (TypeManager.RegisterIndexer): New method.
119 * class.cs: Added myself as author of this file :-)
121 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
123 * class.cs: fixed compilation on windoze.
125 2002-08-03 Martin Baulig <martin@gnome.org>
127 * interface.cs (Interface.GetInterfaceBases): Check whether all
128 base interfaces are at least as accessible than the current one.
130 * class.cs (TypeContainer.GetClassBases): Check whether base types
131 are at least as accessible than the current type.
132 (TypeContainer.AsAccessible): Implemented and made non-static.
133 (MemberBase.CheckParameters): Report errors if the accessibility
136 * delegate.cs (Delegate.Delegate): The default visibility is
137 internal for top-level types and private for nested types.
138 (Delegate.Define): Report errors if the accessibility checks fail.
140 * enum.cs (Enum.Enum): The default visibility is internal for
141 top-level types and private for nested types.
142 (Enum.DefineType): Compute the correct visibility.
144 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
145 function which takes a `bool is_toplevel' instead of a TypeContainer.
147 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
150 2002-08-02 Martin Baulig <martin@gnome.org>
152 * expression.cs (LocalVariableReferenc): Added constructor which
153 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
154 (LocalVariableReference.IsReadOnly): New property.
155 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
156 variable is readonly, use our own readonly flag to do this; you can
157 use the new constructor to get a writable reference to a read-only
160 * cs-parser.jay (foreach_statement, using_statement): Get a writable
161 reference to the local variable.
163 2002-08-01 Miguel de Icaza <miguel@ximian.com>
165 * rootcontext.cs (ResolveCore): Also include System.Exception
167 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
168 we reach an EmptyStatement.
170 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
173 * expression.cs (Binary.ResolveOperator): Check error result in
176 use brtrue/brfalse directly and avoid compares to null.
178 2002-08-02 Martin Baulig <martin@gnome.org>
180 * class.cs (TypeContainer.Define): Define all nested interfaces here.
181 Fixes bug #28407, added test-155.cs.
183 2002-08-01 Martin Baulig <martin@gnome.org>
185 * class.cs (Event.EmitDefaultMethod): Make this work with static
186 events. Fixes #28311, added verify-3.cs.
188 2002-08-01 Martin Baulig <martin@gnome.org>
190 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
191 `is_disposable' fields.
192 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
193 `hm.is_disposable' if we're using the collection pattern.
194 (Foreach.EmitCollectionForeach): Use the correct type for the
195 enumerator's local variable, only emit the try/finally block if
196 necessary (fixes #27713).
198 2002-08-01 Martin Baulig <martin@gnome.org>
200 * ecore.cs (Expression.report118): Renamed to Error118 and made
203 * statement.cs (Throw.Resolve): Check whether the expression is of
204 the correct type (CS0118) and whether the type derives from
205 System.Exception (CS0155).
206 (Catch.Resolve): New method. Do the type lookup here and check
207 whether it derives from System.Exception (CS0155).
208 (Catch.CatchType, Catch.IsGeneral): New public properties.
210 * typemanager.cs (TypeManager.exception_type): Added.
212 2002-07-31 Miguel de Icaza <miguel@ximian.com>
214 * driver.cs: Updated About function.
216 2002-07-31 Martin Baulig <martin@gnome.org>
218 Implemented Control Flow Analysis.
220 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
221 (EmitContext.CurrentBranching): Added.
222 (EmitContext.StartFlowBranching): Added.
223 (EmitContext.EndFlowBranching): Added.
224 (EmitContext.KillFlowBranching): Added.
225 (EmitContext.IsVariableAssigned): Added.
226 (EmitContext.SetVariableAssigned): Added.
227 (EmitContext.IsParameterAssigned): Added.
228 (EmitContext.SetParameterAssigned): Added.
229 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
230 Added control flow analysis stuff here.
232 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
233 resolve the expression as lvalue.
234 (LocalVariableReference.DoResolve): Check whether the variable has
235 already been assigned.
236 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
237 the parameter as assigned here.
238 (ParameterReference.DoResolve): Check whether the parameter has already
240 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
241 expression as lvalue.
243 * statement.cs (FlowBranching): New class for the flow analysis code.
244 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
245 (LabeledStatement.IsDefined): New public property.
246 (LabeledStatement.AddUsageVector): New public method to tell flow
247 analyis that the label may be reached via a forward jump.
248 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
250 (VariableInfo.Number): New public field. This is used by flow analysis
251 to number all locals of a block.
252 (Block.CountVariables): New public property. This is the number of
253 local variables in this block (including the locals from all parent
255 (Block.EmitMeta): Number all the variables.
257 * statement.cs: Added flow analysis support to all classes.
259 2002-07-31 Martin Baulig <martin@gnome.org>
261 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
262 To get debugging messages, compile mcs with /define:MCS_DEBUG and
263 then use this argument.
265 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
267 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
268 use this to specify /define options.
270 2002-07-29 Martin Baulig <martin@gnome.org>
272 * statement.cs (Fixed): Moved all code that does variable lookups
273 and resolvings from Emit to Resolve.
275 * statement.cs (For): Moved all code that does variable lookups
276 and resolvings from Emit to Resolve.
278 * statement.cs (Using): Moved all code that does variable lookups
279 and resolvings from Emit to Resolve.
281 2002-07-29 Martin Baulig <martin@gnome.org>
283 * attribute.cs (Attribute.Resolve): Explicitly catch a
284 System.NullReferenceException when creating the
285 CustromAttributeBuilder and report a different warning message.
287 2002-07-29 Martin Baulig <martin@gnome.org>
289 * support.cs (ParameterData.ParameterName): Added method to
290 get the name of a parameter.
292 * typemanager.cs (TypeManager.IsValueType): New public method.
294 2002-07-29 Martin Baulig <martin@gnome.org>
296 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
297 is a flag which specifies that it's either ref or out.
298 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
299 the out parameter to `out Parameter.Modifier mod', also set the
300 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
302 * support.cs (InternalParameters.ParameterModifier): Distinguish
303 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
304 Parameter.Modifier.ISBYREF flag if it's either ref or out.
306 * expression.cs (Argument.GetParameterModifier): Distinguish
307 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
308 Parameter.Modifier.ISBYREF flag if it's either ref or out.
310 2002-07-29 Martin Baulig <martin@gnome.org>
312 * expression.cs (ParameterReference.ParameterReference): Added
313 `Location loc' argument to the constructor.
315 * cs-parser.jay: Pass location to ParameterReference.
317 2002-07-28 Miguel de Icaza <miguel@ximian.com>
319 * statement.cs (Try): Initialize the location.
321 * cs-parser.jay: pass location to Try.
323 * expression.cs (Unary.Reduce): Change the prototype to return
324 whether a constant fold could be performed or not. The result is
325 returned in an out parameters. In the case of Indirection and
326 AddressOf, we want to perform the full tests.
328 2002-07-26 Miguel de Icaza <miguel@ximian.com>
330 * statement.cs (Statement.Emit): Flag dead code.
332 2002-07-27 Andrew Birkett <andy@nobugs.org>
334 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
336 2002-07-27 Martin Baulig <martin@gnome.org>
338 * class.cs (MethodData.Define): Put back call to
339 TypeManager.AddMethod(), accidentally commented this out.
341 * report.cs (Debug): New public method to print debugging information,
342 this is `[Conditional ("DEBUG")]'.
344 2002-07-26 Martin Baulig <martin@gnome.org>
346 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
347 (switch_statement): Push the current_block to the switch_stack and
348 pop it again when we're done with the switch.
349 (switch_section): The new block is a child of the current_block.
350 Fixes bug #24007, added test-152.cs.
352 2002-07-27 Martin Baulig <martin@gnome.org>
354 * expression.cs (Invocation.EmitArguments): When calling a varargs
355 function with only its fixed arguments, we need to pass an empty
358 2002-07-27 Martin Baulig <martin@gnome.org>
360 Mono 0.13 has been released.
362 2002-07-25 Miguel de Icaza <miguel@ximian.com>
364 * driver.cs: Rename --resource to --linkres, because that is what
365 we do currently, we dont support --resource yet.
367 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
369 2002-07-25 Martin Baulig <martin@gnome.org>
371 * class.cs (MethodData): New public class. This is a `method builder'
372 class for a method or one accessor of a Property/Indexer/Event.
373 (MethodData.GetMethodFlags): Moved here from MemberBase.
374 (MethodData.ApplyAttributes): Likewise.
375 (MethodData.ApplyObsoleteAttribute): Likewise.
376 (MethodData.ApplyConditionalAttribute): Likewise.
377 (MethodData.ApplyDllImportAttribute): Likewise.
378 (MethodData.CheckAbstractAndExternal): Likewise.
379 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
380 (MethodData.Emit): Formerly known as Method.Emit().
381 (MemberBase): Moved everything which was specific to a single
382 accessor/method to MethodData.
383 (Method): Create a new MethodData and call Define() and Emit() on it.
384 (Property, Indexer, Event): Create a new MethodData objects for each
385 accessor and call Define() and Emit() on them.
387 2002-07-25 Martin Baulig <martin@gnome.org>
389 Made MethodCore derive from MemberBase to reuse the code from there.
390 MemberBase now also checks for attributes.
392 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
393 (MemberBase.GetMethodFlags): Moved here from class Method and marked
395 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
396 `CallingConventions cc' and `Attributes opt_attrs' arguments.
397 (MemberBase.ApplyAttributes): New virtual method; applies the
398 attributes to a method or accessor.
399 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
400 (MemberBase.ApplyConditionalAttribute): Likewise.
401 (MemberBase.ApplyDllImportAttribute): Likewise.
402 (MemberBase.CheckAbstractAndExternal): Likewise.
403 (MethodCore.ParameterTypes): This is now a property instead of a
404 method, it's initialized from DoDefineParameters().
405 (MethodCore.ParameterInfo): Removed the set accessor.
406 (MethodCore.DoDefineParameters): New protected virtual method to
407 initialize ParameterTypes and ParameterInfo.
408 (Method.GetReturnType): We can now simply return the MemberType.
409 (Method.GetMethodFlags): Override the MemberBase version and add
410 the conditional flags.
411 (Method.CheckBase): Moved some code from Define() here, call
412 DoDefineParameters() here.
413 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
414 here to avoid some larger code duplication.
415 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
416 ensure that abstract and external accessors don't declare a body.
418 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
419 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
420 lookup in the attribute's parent classes, so we need to abort as soon
421 as we found the first match.
422 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
423 the attribute has no arguments.
425 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
428 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
430 * cs-parser.jay: reverted previous patch.
432 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
434 * cs-parser.jay: fixed bug #22119.
436 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
438 * attribute.cs: fixed compilation. The error was:
439 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
440 be assigned to before control leaves the current method."
441 [FIXME: Filed as bug #28186: MCS must report this error.]
443 2002-07-25 Martin Baulig <martin@gnome.org>
445 * attribute.cs (Attribute.Conditional_GetConditionName): New static
446 method to pull the condition name ouf of a Conditional attribute.
447 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
448 the obsolete message and error flag out of an Obsolete attribute.
450 * class.cs (Method.GetMethodFlags): New public method to get the
451 TypeManager.MethodFlags for this method.
452 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
454 (Method.Define): Get and apply the Obsolete and Conditional attributes;
455 if we're overriding a virtual function, set the new private variable
456 `parent_method'; call the new TypeManager.AddMethod().
458 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
459 the MethodBuilder and the Method in a PtrHashtable.
460 (TypeManager.builder_to_method): Added for this purpose.
461 (TypeManager.MethodFlags): Added IsObsoleteError.
462 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
463 Obsolete and Conditional arguments in MethodBuilders. If we discover
464 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
465 the message from the attribute.
467 2002-07-24 Martin Baulig <martin@gnome.org>
469 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
470 preprocessor directives, ensure that the argument to #define/#undef is
471 exactly one identifier and that it's actually an identifier.
473 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
476 2002-07-24 Martin Baulig <martin@gnome.org>
478 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
479 initialize it to TypeManager.object_type in the constructor.
480 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
481 of the `hm.get_current' method if we're using the collection pattern.
482 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
483 for the explicit conversion to make it work when we're using the collection
484 pattern and the `Current' property has a different return type than `object'.
487 2002-07-24 Martin Baulig <martin@gnome.org>
489 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
490 does not match, but don't report any errors. This method is called in
491 order for all methods in a MethodGroupExpr until a matching method is
492 found, so we don't want to bail out if the first method doesn't match.
493 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
494 matches, report the 123. Fixes #28070.
496 2002-07-24 Martin Baulig <martin@gnome.org>
498 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
499 TypeManager.TypeToCoreType() to the top of the method so the
500 following equality checks will work. Fixes #28107.
502 2002-07-24 Martin Baulig <martin@gnome.org>
504 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
505 operand is of type uint, and the other operand is of type sbyte,
506 short or int, the operands are converted to type long." -
507 Actually do what this comment already told us. Fixes bug #28106,
510 2002-07-24 Martin Baulig <martin@gnome.org>
512 * class.cs (MethodBase): New abstract class. This is now a base
513 class for Property, Indexer and Event to avoid some code duplication
514 in their Define() and DefineMethods() methods.
515 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
516 generic methods for Define() and DefineMethods().
517 (FieldBase): Derive from MemberBase, not MemberCore.
518 (Property): Derive from MemberBase, not MemberCore.
519 (Property.DefineMethod): Moved all the code from this method to the
520 new MethodBase.DefineAccessor(), just call it with appropriate
522 (Property.Define): Call the new Property.DoDefine(), this does some
523 sanity checks and we don't need to duplicate the code everywhere.
524 (Event): Derive from MemberBase, not MemberCore.
525 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
526 accessors, this will also make them work with interface events.
527 (Indexer): Derive from MemberBase, not MemberCore.
528 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
529 (Indexer.Define): Use the new MethodBase functions.
531 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
532 argument to the constructor.
533 (Interface.FindMembers): Added support for interface events.
534 (Interface.PopluateEvent): Implemented.
536 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
538 2002-07-22 Miguel de Icaza <miguel@ximian.com>
540 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
541 but this is required to check for a method name being the same as
542 the containing class.
546 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
548 * interface.cs: initialize variable.
550 2002-07-23 Martin Baulig <martin@gnome.org>
552 Implemented the IndexerName attribute in interfaces.
554 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
555 name if this is an explicit interface implementation.
556 (Indexer.InterfaceIndexerName): New public variable. If we're
557 implementing an interface indexer, this is the IndexerName in that
558 interface. Otherwise, it's the IndexerName.
559 (Indexer.DefineMethod): If we're implementing interface indexer,
560 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
561 and Pending.ImplementIndexer methods.
562 (Indexer.Define): Also define the PropertyBuilder if we're
563 implementing an interface indexer and this is neither an explicit
564 interface implementation nor do the IndexerName match the one in
567 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
568 If a method is defined here, then we always need to create a proxy
569 for it. This is used when implementing interface indexers.
570 (Pending.IsInterfaceIndexer): New public method.
571 (Pending.ImplementIndexer): New public method.
572 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
573 This is used when implementing interface indexers to define a proxy
575 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
576 define a proxy if necessary.
578 * interface.cs (Interface.IndexerName): New public variable.
579 (Interface.PopulateIndexer): Set the IndexerName.
580 (Interface.DefineIndexers): New private method. Populate all the
581 indexers and make sure their IndexerNames match.
583 * typemanager.cs (IndexerPropertyName): Added support for interface
586 2002-07-22 Martin Baulig <martin@gnome.org>
588 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
589 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
590 ret if HasReturnLabel.
591 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
594 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
595 and set the ec.LoopBeginTryCatchLevel.
596 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
597 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
598 the current ec.TryCatchLevel, the branch goes out of an exception
599 block. In this case, we need to use Leave and not Br.
601 2002-07-22 Martin Baulig <martin@gnome.org>
603 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
604 block unless the block does not always return or it is contained in
605 another try { ... } catch { ... } block. Fixes bug #26506.
606 Added verify-1.cs to the test suite.
608 2002-07-22 Martin Baulig <martin@gnome.org>
610 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
611 then we do not always return. Fixes bug #24985.
613 2002-07-22 Martin Baulig <martin@gnome.org>
615 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
616 lookup on a per-class level; ie. walk up the class hierarchy until we
617 found at least one applicable method, then choose the best among them.
618 Fixes bug #24463 and test-29.cs.
620 2002-07-22 Martin Baulig <martin@gnome.org>
622 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
623 return types of the methods. The return type is not part of the
624 signature and we must not check it to make the `new' modifier work.
625 Fixes bug #27999, also added test-147.cs.
626 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
628 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
629 on the method's return type.
631 2002-07-21 Martin Baulig <martin@gnome.org>
633 * assign.cs: Make this work if the rightmost source is a constant and
634 we need to do an implicit type conversion. Also adding a few more tests
635 to test-38.cs which should have caught this.
637 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
638 target in the makefile for this. The makefile.gnu is primarily intended
639 for end-users who don't want to debug the compiler.
641 2002-07-21 Martin Baulig <martin@gnome.org>
643 * assign.cs: Improved the Assign class so it can now handle embedded
644 assignments (X = Y = Z = something). As a side-effect this'll now also
645 consume less local variables. test-38.cs now passes with MCS, added
646 a few new test cases to that test.
648 2002-07-20 Martin Baulig <martin@gnome.org>
650 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
651 instructions. Fixes bug #27977, also added test-146.cs.
653 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
655 * cs-tokenizer.cs: fixed getHex ().
657 2002-07-19 Martin Baulig <martin@gnome.org>
659 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
660 not Type.GetType() to lookup the array type. This is needed when
661 we're constructing an array of a user-defined type.
662 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
663 single-dimensional arrays, but also for single-dimensial arrays of
666 2002-07-19 Martin Baulig <martin@gnome.org>
668 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
669 this function is called, it's not allowed to share LocalBuilders
672 2002-07-19 Martin Baulig <martin@gnome.org>
674 * expression.cs (Argument.Resolve): Report an error 118 when trying
675 to pass a type as argument.
677 2002-07-18 Martin Baulig <martin@gnome.org>
679 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
680 Conv_R_Un for the signed `long' type.
682 2002-07-15 Miguel de Icaza <miguel@ximian.com>
684 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
685 `expr' for the temporary result, as that will fail if we do
686 multiple resolves on the same expression.
688 2002-07-05 Miguel de Icaza <miguel@ximian.com>
690 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
691 ec.TypeContainer for looking up aliases.
693 * class.cs (TypeContainer): Remove LookupAlias from here.
695 * decl.cs (DeclSpace); Move here.
697 2002-07-01 Miguel de Icaza <miguel@ximian.com>
699 * class.cs (FindMembers): Only call filter if the constructor
702 Also handle delegates in `NestedTypes' now. Now we will perform
703 type lookups using the standard resolution process. This also
706 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
707 This uses Expressions (the limited kind that can be parsed by the
708 tree) instead of strings.
710 * expression.cs (ComposedCast.ToString): Implement, used to flag
711 errors since now we have to render expressions.
713 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
716 * ecore.cs (SimpleName.ToString): ditto.
718 * cs-parser.jay: Instead of using strings to assemble types, use
719 Expressions to assemble the type (using SimpleName, ComposedCast,
720 MemberAccess). This should fix the type lookups in declarations,
721 because we were using a different code path for this.
723 * statement.cs (Block.Resolve): Continue processing statements
724 even when there is an error.
726 2002-07-17 Miguel de Icaza <miguel@ximian.com>
728 * class.cs (Event.Define): Also remove the `remove' method from
729 the list of pending items.
731 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
732 generate more compact code.
734 2002-07-17 Martin Baulig <martin@gnome.org>
736 * const.cs (Const.LookupConstantValue): Add support for constant
737 `unchecked' and `checked' expressions.
738 Also adding test case test-140.cs for this.
740 2002-07-17 Martin Baulig <martin@gnome.org>
742 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
743 check whether mi.ReturnType implements the IEnumerator interface; the
744 `==' and the IsAssignableFrom() will fail in this situation.
746 2002-07-16 Ravi Pratap <ravi@ximian.com>
748 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
751 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
753 * expression.cs: fixed bug #27811.
755 2002-07-14 Miguel de Icaza <miguel@ximian.com>
757 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
758 Molaro: when we are a ref, the value already contains a pointer
759 value, do not take the address of it.
761 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
762 * removed mb-parser.jay and mb-tokenizer.cs
764 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
766 * expression.cs: check against the building corlib void type.
768 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
770 * ecore.cs: fix for valuetype static readonly fields: when
771 initializing them, we need their address, not the address of a copy.
773 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
775 * typemanager.cs: register also enum_type in corlib.
777 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
779 * class.cs: allow calling this (but not base) initializers in structs.
781 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
783 * ecore.cs: make sure we compare against the building base types
786 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
788 * typemanager.cs: fix TypeToCoreType() to handle void and object
789 (corlib gets no more typerefs after this change).
791 2002-07-12 Miguel de Icaza <miguel@ximian.com>
793 * expression.cs (ArrayCreation.EmitArrayArguments): use
794 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
796 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
797 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
798 array indexes, the runtime actually forbids them.
800 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
801 for array arguments here.
803 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
804 instead of the default for ValueTypes.
806 (New.DoEmit): Use IsValueType instead of
807 IsSubclassOf (value_type)
808 (New.DoResolve): ditto.
809 (Invocation.EmitCall): ditto.
811 * assign.cs (Assign): ditto.
813 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
814 Statements *are* currently doing part of their resolution during
817 Expressions do always resolve during resolve, but statements are
818 only required to propagate resolution to their children.
820 2002-07-11 Miguel de Icaza <miguel@ximian.com>
822 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
824 (LoadAssembly): Do not add the dll if it is already specified
826 (MainDriver): Add the System directory to the link path at the end,
827 after all the other -L arguments.
829 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
830 wrong opcode for loading bytes and bools (ldelem.i1 instead of
831 ldelem.u1) and using the opposite for sbytes.
833 This fixes Digger, and we can finally run it.
835 * driver.cs (UnixParseOption): Move the option parsing here.
836 (CSCParseOption): Implement CSC-like parsing of options.
838 We now support both modes of operation, the old Unix way, and the
839 new CSC-like way. This should help those who wanted to make cross
842 The only thing broken is that /r:, /reference: and /lib: are not
843 implemented, because I want to make those have the same semantics
844 as the CSC compiler has, and kill once and for all the confussion
845 around this. Will be doing this tomorrow.
847 * statement.cs (Unsafe.Resolve): The state is checked during
848 resolve, not emit, so we have to set the flags for IsUnsfe here.
850 2002-07-10 Miguel de Icaza <miguel@ximian.com>
852 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
853 not catch the Error_ObjectRefRequired in SimpleName (as it is
854 possible to have a class/instance variable name that later gets
855 deambiguated), we have to check this here.
857 2002-07-10 Ravi Pratap <ravi@ximian.com>
859 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
860 make static and put into Expression.
862 (Event.Define): Register the private field of the event with the
863 TypeManager so that GetFieldFromEvent can get at it.
865 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
866 keep track of the private field associated with an event which
869 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
872 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
874 2002-07-10 Miguel de Icaza <miguel@ximian.com>
876 * expression.cs (Binary.EmitBranchable): this routine emits the
877 Binary expression in a branchable context. This basically means:
878 we need to branch somewhere, not just get the value on the stack.
880 This works together with Statement.EmitBoolExpression.
882 * statement.cs (Statement.EmitBoolExpression): Use
885 2002-07-09 Miguel de Icaza <miguel@ximian.com>
887 * statement.cs (For): Reduce the number of jumps in loops.
889 (For): Implement loop inversion for the For statement.
891 (Break): We can be breaking out of a Try/Catch controlled section
892 (foreach might have an implicit try/catch clause), so we need to
893 use Leave instead of Br.
895 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
896 now). If the instace expression supports IMemoryLocation, we use
897 the AddressOf method from the IMemoryLocation to extract the
898 address instead of emitting the instance.
900 This showed up with `This', as we were emitting the instance
901 always (Emit) instead of the Address of This. Particularly
902 interesting when This is a value type, as we dont want the Emit
903 effect (which was to load the object).
905 2002-07-08 Miguel de Icaza <miguel@ximian.com>
907 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
909 * statement.cs (Checked): Set the CheckedState during the resolve
910 process too, as the ConvCast operations track the checked state on
911 the resolve process, and not emit.
913 * cs-parser.jay (namespace_member_declaration): Flag that we have
914 found a declaration when we do. This is used to flag error 1529
916 * driver.cs: Report ok when we display the help only.
918 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
920 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
922 2002-07-04 Miguel de Icaza <miguel@ximian.com>
924 * cs-tokenizer.cs (define): We also have to track locally the
925 defines. AllDefines is just used for the Conditional Attribute,
926 but we also need the local defines for the current source code.
928 2002-07-03 Miguel de Icaza <miguel@ximian.com>
930 * statement.cs (While, For, Do): These loops can exit through a
931 Break statement, use this information to tell whether the
932 statement is the last piece of code.
934 (Break): Flag that we break.
936 * codegen.cs (EmitContexts): New `Breaks' state variable.
938 2002-07-03 Martin Baulig <martin@gnome.org>
940 * class.cs (TypeContainer.MethodModifiersValid): Allow override
941 modifiers in method declarations in structs. Otherwise, you won't
942 be able to override things like Object.Equals().
944 2002-07-02 Miguel de Icaza <miguel@ximian.com>
946 * class.cs (Method, Property, Indexer): Do not allow the public
947 modifier to be used in explicit interface implementations.
949 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
950 override modifiers in method declarations in structs
952 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
954 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
955 integer or real overflow, report an error
957 2002-07-02 Martin Baulig <martin@gnome.org>
959 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
960 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
961 to tell the runtime about our newly created System.Object and
962 System.ValueType types.
964 2002-07-02 Miguel de Icaza <miguel@ximian.com>
966 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
967 struct instead of Ldarg/Starg.
969 2002-07-02 Martin Baulig <martin@gnome.org>
971 * expression.cs (Indirection.Indirection): Call
972 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
974 2002-07-02 Martin Baulig <martin@gnome.org>
976 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
977 ValueType, call TypeManager.TypeToCoreType() on it.
978 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
979 the OpCodes.Newarr argument.
981 2002-07-02 Martin Baulig <martin@gnome.org>
983 * expression.cs (Invocation.EmitCall): When compiling corlib,
984 replace all calls to the system's System.Array type to calls to
985 the newly created one.
987 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
988 System.Array methods.
989 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
990 from the system's System.Array type which must be replaced.
992 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
994 * typemanager.cs: load unverifiable_code_ctor so we can build
995 corlib using the correct type. Avoid using GetTypeCode() with
997 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
998 TypeManager.object_type to allow building corlib.
1000 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
1002 * ecore.cs: handle System.Enum separately in LoadFromPtr().
1004 2002-07-01 Martin Baulig <martin@gnome.org>
1006 * class.cs: Make the last change actually work, we need to check
1007 whether `ifaces != null' to avoid a crash.
1009 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
1011 * class.cs: when we build structs without fields that implement
1012 interfaces, we need to add the interfaces separately, since there is
1013 no API to both set the size and add the interfaces at type creation
1016 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
1018 * expression.cs: the dimension arguments to the array constructors
1019 need to be converted if they are a long.
1021 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
1023 * class.cs: don't emit ldarg.0 if there is no parent constructor
1024 (fixes showstopper for corlib).
1026 2002-06-29 Martin Baulig <martin@gnome.org>
1028 MCS now compiles corlib on GNU/Linux :-)
1030 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
1031 ie. check for MethodImplOptions.InternalCall.
1033 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
1034 and TypeManager.attribute_type are null, so we must explicitly check
1035 whether parent is not null to find out whether it's an attribute type.
1036 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
1037 and SetBuilder, not only if the property is neither abstract nor external.
1038 This is necessary to set the MethodImplOptions on the accessor methods.
1039 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
1040 SetBuilder, see Property.Emit().
1042 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
1043 populate "System.Object", "System.ValueType" and "System.Attribute" since
1044 they've already been populated from BootCorlib_PopulateCoreTypes().
1046 2002-06-29 Martin Baulig <martin@gnome.org>
1048 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
1049 is the NullLiteral, we also need to make sure that target_type is not
1052 2002-06-29 Martin Baulig <martin@gnome.org>
1054 * rootcontext.cs (RootContext.ResolveCore): We must initialize
1055 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
1056 before calling BootstrapCorlib_ResolveDelegate ().
1058 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1060 * statement.cs: fixed build-breaker. All tests passed ok.
1062 2002-06-27 Martin Baulig <martin@gnome.org>
1064 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
1065 for System.Decimal when compiling corlib.
1067 2002-06-27 Martin Baulig <martin@gnome.org>
1069 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
1070 switch blocks which contain nothing but a default clause.
1072 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
1074 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
1076 2002-06-27 Martin Baulig <martin@gnome.org>
1078 * ecore.cs (PropertyExpr.PropertyExpr): Call
1079 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
1081 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
1082 is already a TypeBuilder.
1084 2002-06-27 Martin Baulig <martin@gnome.org>
1086 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
1087 `target_type == TypeManager.array_type', not IsAssignableFrom() in
1088 the "from an array-type to System.Array" case. This makes it work
1089 when compiling corlib.
1091 2002-06-27 Martin Baulig <martin@gnome.org>
1093 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
1094 non-static PropertyExpr, set its InstanceExpression. This makes
1095 the `ICollection.Count' property work in System/Array.cs.
1097 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
1099 * driver.cs: Made error handling more consistent. Errors now
1100 tracked by Report class, so many methods which used to return int
1101 now return void. Main() now prints success/failure and
1102 errors/warnings message.
1104 Renamed '--probe' compiler argument to '--expect-error'. Removed
1105 the magic number return values (123 and 124). Now, if the
1106 expected error occurs, the compiler exits with success (exit value
1107 0). If the compilation completes without seeing that particular
1108 error, the compiler exits with failure (exit value 1). The
1109 makefile in mcs/errors has been changed to handle the new behaviour.
1111 * report.cs: Made 'expected error' number a property and renamed
1112 it from 'Probe' to 'ExpectedError'.
1114 * genericparser.cs: Removed error handling support, since it is
1115 now all done by Report class.
1117 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
1118 class, so parse() no longer returns an int.
1120 * namespace.cs: Use Report.Error instead of GenericParser.error
1122 2002-06-22 Miguel de Icaza <miguel@ximian.com>
1124 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
1125 TypeContainer.AddOperator): At the front of the list put the
1126 explicit implementations, so they get resolved/defined first.
1128 2002-06-21 Miguel de Icaza <miguel@ximian.com>
1130 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
1131 interface type is implemented by this TypeContainer. Used during
1132 explicit interface implementation.
1134 (Property.Define, Indexer.Define, Method.Define): Validate that
1135 the given interface in the explicit implementation is one of the
1136 base classes for the containing type.
1138 Also if we are explicitly implementing an interface, but there is
1139 no match in the pending implementation table, report an error.
1141 (Property.Define): Only define the property if we are
1142 not explicitly implementing a property from an interface. Use the
1143 correct name also for those properties (the same CSC uses,
1144 although that is really not needed).
1146 (Property.Emit): Do not emit attributes for explicitly implemented
1147 properties, as there is no TypeBuilder.
1149 (Indexer.Emit): ditto.
1151 Hiding then means that we do not really *implement* a pending
1152 implementation, which makes code fail.
1154 2002-06-22 Martin Baulig <martin@gnome.org>
1156 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
1157 the return value of Object.GetType(). [FIXME: we need to do this whenever
1158 we get a type back from the reflection library].
1160 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
1162 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
1164 2002-06-20 Miguel de Icaza <miguel@ximian.com>
1166 * attribute.cs: Return null if we can not look up the type.
1168 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
1169 the interface types found.
1171 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
1172 interface types found.
1174 * typemanager.cs (GetInterfaces): Make this routine returns alll
1175 the interfaces and work around the lame differences between
1176 System.Type and System.Reflection.Emit.TypeBuilder in the results
1177 result for GetInterfaces.
1179 (ExpandInterfaces): Given an array of interface types, expand and
1180 eliminate repeated ocurrences of an interface. This expands in
1181 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
1184 2002-06-21 Martin Baulig <martin@gnome.org>
1186 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
1189 2002-06-21 Martin Baulig <martin@gnome.org>
1191 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
1192 and called with one of the core types, return the corresponding typebuilder for
1195 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
1198 2002-06-21 Martin Baulig <martin@gnome.org>
1200 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
1201 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
1202 (Expression.ConvertReferenceExplicit): Likewise.
1204 * expression.cs (ElementAccess.DoResolve): Likewise.
1205 (ElementAccess.DoResolveLValue): Likewise.
1207 2002-06-10 Martin Baulig <martin@gnome.org>
1209 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
1210 add the "value" parameter to the parameter list.
1212 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
1215 2002-06-19 Miguel de Icaza <miguel@ximian.com>
1217 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
1218 the argument to an int, uint, long or ulong, per the spec. Also
1219 catch negative constants in array creation.
1221 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
1223 * class.cs: do not allow the same interface to appear twice in
1224 the definition list.
1226 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
1228 * ecore.cs: don't use ldlen with System.Array.
1230 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
1232 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
1234 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
1236 * modifiers.cs: produce correct field attributes for protected
1237 internal. Easy fix so miguel can work on ther harder stuff:-)
1239 2002-06-18 Miguel de Icaza <miguel@ximian.com>
1241 * pending.cs: New file. Move the code from class.cs here.
1242 Support clearning the pending flag for all methods (when not doing
1243 explicit interface implementation).
1245 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
1247 * rootcontext.cs: added a couple more types needed to bootstrap.
1249 2002-06-17 Miguel de Icaza <miguel@ximian.com>
1251 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
1252 constructor in the type, instead of any constructor in the type
1253 hierarchy. Thanks to Paolo for finding this bug (it showed up as
1254 a bug in the Mono runtime when applying the params attribute).
1256 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
1257 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
1259 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
1261 * expression.cs (Unary.ResolveOperator): Use TypeManager
1262 to resolve the type.
1264 2002-06-13 Ravi Pratap <ravi@ximian.com>
1266 * cs-parser.jay (enum_member_declaration): Pass in the attributes
1269 * enum.cs (AddEnumMember): Add support to store the attributes associated
1270 with each member too.
1272 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
1273 field builders too - this takes care of the enum member case.
1275 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
1277 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
1278 address-of operator on both value types and pointers.
1280 2002-06-10 Martin Baulig <martin@gnome.org>
1282 * interface.cs (Interface.PopulateIndexer): Add the indexer's
1283 PropertyBuilder to the `property_builders' list.
1285 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
1286 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
1287 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
1288 find any indexers which are inherited from an interface.
1290 2002-06-09 Martin Baulig <martin@gnome.org>
1292 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
1293 the same type as the constant if necessary. There's also a test-130.cs
1296 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
1298 * typemanager.cs (TypeManager.ChangeType): Previously known as
1299 Enum.ChangeEnumType().
1301 2002-06-09 Martin Baulig <martin@gnome.org>
1303 * expression.cs (Cast.TryReduce): Added support for consts.
1305 2002-06-08 Ravi Pratap <ravi@ximian.com>
1307 * class.cs (Accessor): Hold attributes information so we can pass
1310 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
1311 Modify to pass in attributes attached to the methods.
1313 (add_accessor_declaration, remove_accessor_declaration): Ditto.
1315 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
1316 to handle the Accessor kind :-)
1318 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
1320 2002-06-08 Martin Baulig <martin@gnome.org>
1322 * expression.cs (Unary.TryReduceNegative): Added support for
1325 2002-06-08 Martin Baulig <martin@gnome.org>
1327 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
1328 name can't be found in the `defined_names' - the caller will do a
1329 MemberLookup in this case and thus find methods in System.Enum
1330 such as Enum.IsDefined().
1332 2002-06-08 Martin Baulig <martin@gnome.org>
1334 * enum.cs (Enum.ChangeEnumType): This is a custom version of
1335 Convert.ChangeType() which works with TypeBuilder created types.
1336 (Enum.LookupEnumValue, Enum.Define): Use it here.
1338 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
1339 `TypeBuilder.BaseType != null' check.
1340 (TypeContainer.FindMembers): Only lookup parent members if we
1341 actually have a parent.
1342 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
1343 (ConstructorInitializer.Resolve): Likewise.
1345 * interface.cs (Interface.FindMembers): Added
1346 `TypeBuilder.BaseType != null' check.
1348 * rootcontext.cs (RootContext.ResolveCore): Added
1349 "System.Runtime.CompilerServices.IndexerNameAttribute" to
1350 classes_second_stage.
1352 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
1353 debug_type and trace_type when compiling with --nostdlib.
1355 2002-06-07 Martin Baulig <martin@gnome.org>
1357 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
1358 (AddField): Set it to true when adding a non-static field.
1359 (DefineType): Use `have_nonstatic_fields' to find out whether we
1360 have non-static fields, not `Fields != null'.
1362 2002-06-02 Miguel de Icaza <miguel@ximian.com>
1364 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
1365 dereferencing a null on the static-field code path)
1367 2002-05-30 Martin Baulig <martin@gnome.org>
1369 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
1370 to take command line arguments. Use reflection to call the new
1371 custom `Initialize' function on the symbol writer and pass it the
1372 command line arguments.
1374 * driver.cs (--debug-args): New command line argument to pass command
1375 line arguments to the symbol writer.
1377 2002-05-28 Miguel de Icaza <miguel@ximian.com>
1379 * assign.cs (DoResolve): Forgot to do the implicit conversion to
1380 the target type for indexers and properties. Thanks to Joe for
1383 2002-05-27 Miguel de Icaza <miguel@ximian.com>
1385 * typemanager.cs (MethodFlags): returns the method flags
1386 (Obsolete/ShouldIgnore) that control warning emission and whether
1387 the invocation should be made, or ignored.
1389 * expression.cs (Invocation.Emit): Remove previous hack, we should
1390 not do this on matching a base type, we should do this based on an attribute
1392 Only emit calls to System.Diagnostics.Debug and
1393 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
1394 on the command line.
1396 * rootcontext.cs: Global settings for tracing and debugging.
1398 * cs-tokenizer.cs (define): New utility function to track
1399 defines. Set the global settings for TRACE and DEBUG if found.
1401 2002-05-25 Ravi Pratap <ravi@ximian.com>
1403 * interface.cs (Populate*): Pass in the TypeContainer as well as
1404 the DeclSpace as parameters so that we can create EmitContexts and
1405 then use that to apply attributes etc.
1407 (PopulateMethod, PopulateEvent, PopulateProperty)
1408 (PopulateIndexer): Apply attributes everywhere.
1410 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
1413 (ApplyAttributes): Update accordingly.
1415 We now apply interface attributes for all members too.
1417 2002-05-26 Miguel de Icaza <miguel@ximian.com>
1419 * class.cs (Indexer.Define); Correctly check if we are explicit
1420 implementation (instead of checking the Name for a ".", we
1421 directly look up if the InterfaceType was specified).
1423 Delay the creation of the PropertyBuilder.
1425 Only create the PropertyBuilder if we are not an explicit
1426 interface implementation. This means that explicit interface
1427 implementation members do not participate in regular function
1428 lookups, and hence fixes another major ambiguity problem in
1429 overload resolution (that was the visible effect).
1431 (DefineMethod): Return whether we are doing an interface
1434 * typemanager.cs: Temporary hack until we get attributes in
1435 interfaces (Ravi is working on that) and we get IndexerName
1436 support in interfaces.
1438 * interface.cs: Register the indexers as properties.
1440 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
1441 warning, I have verified that this is a bug in the .NET runtime
1442 (JavaScript suffers of the same problem).
1444 * typemanager.cs (MemberLookup): When looking up members for
1445 interfaces, the parent of an interface is the implicit
1446 System.Object (so we succeed in searches of Object methods in an
1447 interface method invocation. Example: IEnumerable x; x.ToString
1450 2002-05-25 Miguel de Icaza <miguel@ximian.com>
1452 * class.cs (Event): Events should also register if they do
1453 implement the methods that an interface requires.
1455 * typemanager.cs (MemberLookup); use the new GetInterfaces
1458 (GetInterfaces): The code used to lookup interfaces for a type is
1459 used in more than one place, factor it here.
1461 * driver.cs: Track the errors at the bottom of the file, we kept
1464 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
1465 instance if the method we are calling is static!
1467 2002-05-24 Miguel de Icaza <miguel@ximian.com>
1469 * attribute.cs (ApplyAttributes): Make this function filter out
1470 the IndexerName attribute (as that attribute in reality is never
1471 applied) and return the string constant for the IndexerName
1474 * class.cs (TypeContainer.Emit): Validate that all the indexers
1475 have the same IndexerName attribute, and if so, set the
1476 DefaultName attribute on the class.
1478 * typemanager.cs: The return value might contain other stuff (not
1479 only methods). For instance, consider a method with an "Item"
1480 property and an Item method.
1482 * class.cs: If there is a problem with the parameter types,
1485 2002-05-24 Ravi Pratap <ravi@ximian.com>
1487 * ecore.cs (ImplicitConversionExists): Wrapper function which also
1488 looks at user defined conversion after making a call to
1489 StandardConversionExists - we need this for overload resolution.
1491 * expression.cs : Update accordingly the various method calls.
1493 This fixes 2 bugs filed against implicit user defined conversions
1495 2002-05-22 Miguel de Icaza <miguel@ximian.com>
1497 * statement.cs: Track the result of the assignment.
1499 2002-05-21 Miguel de Icaza <miguel@ximian.com>
1501 * expression.cs (MemberAccess): Improved error reporting for
1502 inaccessible members.
1504 2002-05-22 Martin Baulig <martin@gnome.org>
1506 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
1507 itself with debugging support.
1509 2002-05-22 Martin Baulig <martin@gnome.org>
1511 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
1512 Removed, this isn't needed anymore.
1514 2002-05-20 Martin Baulig <martin@gnome.org>
1516 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
1517 be underlying type for an enum.
1519 2002-05-20 Miguel de Icaza <miguel@ximian.com>
1521 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
1522 that splits out the loading of just the core types.
1524 * rootcontext.cs (ResolveCore): Split the struct resolution in
1525 two, so we can load the enumeration underlying types before any
1528 * expression.cs (Is): Bandaid until we fix properly Switch (see
1529 bug #24985 for details).
1531 * typemanager.cs (ImplementsInterface): The hashtable will contain
1532 a null if there are no interfaces implemented.
1534 2002-05-18 Miguel de Icaza <miguel@ximian.com>
1536 * cs-parser.jay (indexer_declarator): It is fine to have array
1539 2002-05-17 Miguel de Icaza <miguel@ximian.com>
1541 * typemanager.cs: (RegisterBuilder): New function used to register
1542 TypeBuilders that implement interfaces. Since
1543 TypeBuilder.GetInterfaces (as usual) does not work with lame
1545 (AddUserType): register interfaces.
1547 (ImplementsInterface): Use the builder_to_ifaces hash if we are
1548 dealing with TypeBuilder. Also, arrays are showing up as
1549 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
1550 methods can not be invoked on them!
1552 * ecore.cs (ExplicitReferenceConversionExists): Made public.
1553 (ImplicitReferenceConversionExists): Split out from
1554 StandardConversionExists.
1556 * expression.cs (As): We were only implementing one of the three
1557 cases for the as operator. We now implement them all.
1558 (Is): Implement the various other cases for Is as well.
1560 * typemanager.cs (CACHE): New define used to control if we want or
1561 not the FindMembers cache. Seems to have a negative impact on
1562 performance currently
1564 (MemberLookup): Nested types have full acess to
1565 enclosing type members
1567 Remove code that coped with instance/static returns for events, we
1568 now catch this in RealFindMembers.
1570 (RealFindMembers): only perform static lookup if the instance
1571 lookup did not return a type or an event.
1573 2002-05-17 Miguel de Icaza <miguel@ximian.com>
1575 * assign.cs (CompoundAssign): We pass more semantic information
1576 now to Compound Assignments than we did before: now we have all
1577 the information at hand, and now we resolve the target *before* we
1578 do the expression expansion, which allows the "CacheValue" method
1579 to have the effect we intended (before, a [x] += 1 would generate
1580 two differen ArrayAccess expressions from the ElementAccess,
1581 during the resolution process).
1583 (CompoundAssign.DoResolve): Resolve target and original_source here.
1585 2002-05-16 Miguel de Icaza <miguel@ximian.com>
1587 * expression.cs (ArrayAccess): dropped debugging information.
1589 * typemanager.cs: Small bug fix: I was always returning i_members,
1590 instead of one of i_members or s_members (depending on which had
1593 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
1594 method is invoked before any code generation takes place, and it
1595 is a mechanism to inform that the expression will be invoked more
1596 than once, and that the method should use temporary values to
1597 avoid having side effects
1599 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
1601 * ecore.cs (Expression.CacheTemporaries): Provide empty default
1604 * expression.cs (Indirection, ArrayAccess): Add support for
1605 CacheTemporaries in these two bad boys.
1607 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
1609 (StoreFromPtr): Handle stobj as well.
1611 * expression.cs (UnaryMutator): Share more code.
1613 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
1614 down: I was not tracking the Filter function as well, which
1615 was affecting the results of the cache.
1617 2002-05-15 Miguel de Icaza <miguel@ximian.com>
1619 * attribute.cs: Remove the hack to handle the CharSet property on
1622 2002-05-14 Miguel de Icaza <miguel@ximian.com>
1624 * attribute.cs (DoResolve): More uglyness, we now only try to
1625 resolve the attribute partially, to extract the CharSet
1626 information (only if we are a StructLayout attribute). Otherwise
1628 (GetExtraTypeInfo): Add some code to conditionally kill in the
1629 future this. I am more and more convinced that the .NET
1630 framework has special code to handle the attribute setting on
1633 * expression.cs (IsParamsMethodApplicable): Revert my previous
1634 foreach change here, it was wrong.
1636 2002-05-13 Miguel de Icaza <miguel@ximian.com>
1638 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
1639 (pp_expr): do not abort on unknown input, just return.
1640 (eval): abort if there are pending chars.
1642 * attribute.cs (Attribute.Resolve): Positional parameters are
1643 optional. Deal with that case.
1645 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
1646 the Ansi/Unicode/Auto information for the type.
1648 (TypeContainer.DefineType): instantiate the EmitContext here, as
1649 we will be using it during the type definition (to resolve
1650 attributes) and during the emit phase.
1652 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
1653 to pull type information out of the attributes
1655 (Attribute.Resolve): track the constructor builder, and allow for
1656 multiple invocations (structs and classes will use this).
1658 * ecore.cs (MemberLookupFinal): new version with all the
1659 parameters customizable.
1661 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
1662 constructors. Return if the result value is null (as the error
1663 would have been flagged already by MemberLookupFinal)
1665 Do not allow instances of abstract classes or interfaces to be
1668 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
1669 We have to compare the assembly property here when dealing with
1670 FamANDAssem and Assembly access modifiers, because we might be
1671 creating an assembly from *modules* (that means that we are not
1672 getting TypeBuilders for types defined in other modules that are
1673 part of this assembly).
1675 (Method.Emit): If the method is marked abstract and has a body,
1678 (TypeContainer.DefineMembers): If both the defined member and the
1679 parent name match are methods, then do not emit any warnings: let
1680 the Method.Define routine take care of flagging warnings. But if
1681 there is a mismatch (method overrides something else, or method is
1682 overriwritten by something, then emit warning).
1684 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
1685 set to null, this means `do not check for the return type on the
1688 (Method.Define): set the return type for the method signature to
1689 null, so that we get methods with the same name and parameters and
1690 different return types. This is used to flag warning 114 (you are
1691 hiding a method, and you probably want to use the new/override
1694 * typemanager.cs (MemberLookup): Implemented proper access
1695 control, closing a long standing set of bug reports. The problem
1696 was that the Framework only has two bits: Public and NonPublic,
1697 and NonPublic includes private and protected methods, but we need
1698 to enforce the FamANDAssem, FamOrAssem and Family.
1700 2002-05-11 Miguel de Icaza <miguel@ximian.com>
1702 * statement.cs (GotoCase): Return true: Ammounts to giving up
1703 knowledge on whether we return or not, and letting the other case
1704 be responsible for it.
1706 2002-05-10 Miguel de Icaza <miguel@ximian.com>
1708 * driver.cs: Do not load directories for each file processed, only
1709 do it if there is a pattern.
1711 * ecore.cs: Report readonly assigns here as well, as we might have
1712 been resolved only by MemberAccess.
1714 (SimpleName.SimpleNameResolve): Also be useful for LValue
1715 resolution. We need this to propagate assign to local readonly variables
1717 * typemanager.cs: Use a ptrhashtable for the criteria, because we
1718 do not want to reuse potential criteria memory.
1720 * class.cs (MyEventBuilder): Set reflected_type;
1722 * ecore.cs (Constantify): Added support for constifying bools.
1724 (RootContext.LookupType): Added a cache for values looked up in
1725 the declaration space.
1727 * typemanager.cs (FindMembers): Now is a front-end to
1728 RealFindMembers, and provides a two-level hashtable-based cache to
1731 15% performance improvement: from 22.5 to 19.2 seconds.
1733 * expression.cs (IsParamsMethodApplicable): use foreach.
1734 (Invocation.DoResolve): ditto.
1735 (New.DoResolve): ditto.
1736 (ArrayCreation.DoResolve): ditto.
1738 * ecore.cs (FindMostEncompassingType): use foreach.
1740 * delegate.cs (NewDelegate.DoResolve): Use foreach
1742 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
1743 (RemoveMethods): use foreach.
1745 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
1746 nested foreach statements instead of for, and also break out of
1747 the inner loop once a match is found.
1749 (Invocation.OverloadResolve): Use foreach, simplify the code.
1751 2002-05-08 Miguel de Icaza <miguel@ximian.com>
1753 * cfold.cs (BinaryFold): During an enumeration evaluation context,
1754 we actually unwrap the expression to allow for extra information
1757 * expression.cs: Use Shr_Un on unsigned operations.
1759 2002-05-08 Ravi Pratap <ravi@ximian.com>
1761 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
1762 applicable operators was not being considered correctly. This closes
1763 the bug Miguel reported.
1765 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
1767 * attribute.cs: check that the type derives from System.Attribute
1768 and report the correct error in that case (moved the duplicate code to
1769 its own method, too).
1771 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
1773 * attribute.cs: lookup attribute type name as the spec says: first the
1774 bare attribute name and then name + "Attribute" (nant compiles with
1775 mcs after this fix).
1777 2002-05-07 Miguel de Icaza <miguel@ximian.com>
1779 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
1780 Because of the way we parse things, we should try to see if a
1781 UIntConstant can fit in an integer.
1783 2002-05-07 Ravi Pratap <ravi@ximian.com>
1785 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
1786 when we are in an explicit context.
1788 (ConvertReferenceExplicit): When converting from Iface type S to Class
1789 T make sure the rules are implemented as an OR.
1791 * parameter.cs (ParameterType): Make it a property for now although the
1792 purpose really isn't anything immediate.
1794 * expression.cs (Is*Applicable): Do better checking on the parameter type
1795 of a ref/out parameter. The ones from the system assemblies are already
1796 marked with the correct type so we don't need to do any correction.
1798 * ecore.cs (StandardConversionExists): Conversion from Interface types to
1799 the object type is standard too so include that.
1801 2002-05-06 Miguel de Icaza <miguel@ximian.com>
1803 * ecore.cs (StandardConversionExists): Augment with missing code:
1804 deal with IntConstant, LongConstants and Enumerations.
1806 * assign.cs: Report the error, instead of failing silently
1808 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
1809 typecontainer that they are declared, because the
1810 typecontainer/namespace will have the list of using clauses that
1813 Assembly Attributes were escaping the normal registration
1816 (EmitCode): Apply attributes within an EmitContext that represents
1817 the container they were declared on.
1819 * cs-parser.jay: Track bases for structs. How did I get this wrong?
1821 2002-05-06 Ravi Pratap <ravi@ximian.com>
1823 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
1824 Revamp completely - make much cleaner as we now operate only
1827 (FindMostSpecificSource, FindMostSpecificTarget): New methods
1828 to implement the logic detailed in the spec more correctly.
1830 (UserDefinedConversion): Update accordingly.
1832 2002-05-06 Miguel de Icaza <miguel@ximian.com>
1834 * statement.cs: Return flow analysis information up.
1836 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
1839 (token): Do not consume an extra character before calling
1842 2002-05-06 Piers Haken <piersh@friskit.com>
1844 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
1846 2002-05-06 Miguel de Icaza <miguel@ximian.com>
1848 * class.cs (Constructor.Emit): Set the IsStatic flag in the
1849 EmitContext during the instance constructor initializer
1850 resolution, to stop access to instance variables.
1852 This is mandated by the spec, last paragraph of the `constructor
1853 initializers' section.
1855 2002-05-05 Miguel de Icaza <miguel@ximian.com>
1857 * cs-parser.jay, class.cs (Accessor): new class used to represent
1858 an accessor (get or set). In the past we used `null' to represent
1859 a missing accessor. But this is ambiguous because there was no
1860 way to tell in abstract indexers/properties if one of them was
1863 Now there is a way of addressing that.
1865 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
1866 instead of FindMembers.
1868 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
1869 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
1871 * attribute.cs: Treat indexers and properties as the same in terms
1872 of applying attributes
1874 * ecore.cs (FindMostEncompassedType): Use statically initialized
1875 EmptyExpressions()s like we do elsewhere to avoid creating useless
1876 objects (and we take this out of the tight loop).
1878 (GetConversionOperators): Move the code to extract the actual
1879 operators to a separate routine to clean things up.
1881 2002-05-04 Miguel de Icaza <miguel@ximian.com>
1883 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
1884 events are always registered FieldBuilders.
1886 * class.cs (FieldBase): New class shared by Fields
1888 * delegate.cs: If we are a toplevel delegate, use our full name.
1889 If we are a nested delegate, then only use our tail name.
1891 2002-05-02 Ravi Pratap <ravi@ximian.com>
1893 * expression.cs (IsApplicable): Ensure that we add the "&" to
1894 ref/out types before comparing it with the type of the argument.
1896 (IsParamsMethodApplicable): Ditto.
1898 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
1901 * delegate.cs : Handle the case when we have more than one applicable
1902 method. Flag an error only when we finish checking all.
1904 2002-05-02 Miguel de Icaza <miguel@ximian.com>
1906 * expression.cs: Add support for boolean static initializers.
1908 2002-05-01 Miguel de Icaza <miguel@ximian.com>
1910 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
1912 * parameter.cs (ComputeParameterTypes,
1913 ComputeAndDefineParameterTypes): Better error handling: now we
1914 clear the `types' cache if we fail during any of the type lookups.
1915 We also return the status code correctly to our caller
1917 * delegate.cs: If we fail to define a delegate, abort the extra
1920 * expression.cs (Binary.ResolveOperator): for
1921 operator==(object,object) and operator !=(object, object) we also
1922 have to verify that there is an implicit conversion from one to
1925 (ArrayAccess.DoResolve): Array Access can operate on
1928 2002-04-30 Miguel de Icaza <miguel@ximian.com>
1930 * assign.cs (CompoundAssign): A new class used as a "flag" that
1931 the assignment actually is happening as part of a compound
1932 assignment operator.
1934 During compound assignment, a few new rules exist to enable things
1941 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
1942 to the type of x) if y is implicitly convertible to the type of x,
1943 and the operator is a builtin operator and the return type of the
1944 operator is explicitly convertible to the type of x.
1946 * rootcontext.cs: Reset warning level to 2. 4 catches various
1947 "interesting" features in mcs, we must clean this up at some
1948 point, but currently am trying to kill other bugs ;-)
1950 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
1951 in container classes as well.
1953 * expression.cs (Binary.ResolveOperator): Handle string case
1954 before anything else (as operator overloading does emit an error
1955 before doing anything else).
1957 This code could go away when we move to a table driven model, but
1958 i could not come up with a good plan last night.
1960 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
1962 * typemanager.cs (CSharpName): reimplementation using regex.
1963 * class.cs: added null check for fields in Emit
1964 * rootcontext.cs: set warninglevel to 4
1966 2002-04-29 Miguel de Icaza <miguel@ximian.com>
1968 * typemanager.cs (CSharpName): reimplemented with Lupus
1971 2002-04-28 Miguel de Icaza <miguel@ximian.com>
1973 * statement.cs (If): correclty implement Resolve, because we were
1974 not catching sem errors in there. The same process is needed
1976 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
1979 (Statement.Warning_DeadCodeFound): Factorize code.
1980 (While): Report dead code here too.
1982 (Statement): Added Resolve virtual method to allow
1983 for resolution split from the emit code.
1985 2002-04-26 Miguel de Icaza <miguel@ximian.com>
1987 * statement.cs (EmitBoolExpression): No longer try to resolve the
1989 (MakeBoolean): New utility function that resolve, implicitly
1990 converts to boolean and tags the expression.
1993 (If, Do): Implement dead code elimination.
1994 (While): Implement loop inversion
1996 (Do, While, For, If): Resolve the expression prior to calling our
1999 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
2002 - added method Report28 (warning: program has more than one entry point)
2003 - added method IsEntryPoint, implements paragraph 10.1 of the spec
2004 - modified method Method.Define, the part at the end of the method
2006 * rootcontext.cs: added static public Location EntryPointLocation;
2008 * ../errors/cs0028.cs : Add test case for the above warning.
2011 - modified method CSharpName to allow arrays of primitive type to
2012 be printed nicely (e.g. instead of System.Int32[][] it now prints
2014 - added method CSharpSignature: returns the signature of a method
2015 in string format to be used in reporting errors, warnings, etc.
2017 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
2020 2002-04-26 Ravi Pratap <ravi@ximian.com>
2022 * delegate.cs (Define): Fix extremely silly bug where I was
2023 setting the type of the 'object' parameter of the BeginInvoke
2024 method to System.IAsyncResult instead of System.Object ;-)
2026 2002-04-26 Miguel de Icaza <miguel@ximian.com>
2028 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
2031 (Constructor.Emit): return if we fail to initialize the
2032 constructor. Another door closed!
2034 * expression.cs (New.DoResolve): Improve error message (from -6 to
2035 1501). Use DeclaredOnly lookup to find the exact constructor.
2037 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
2038 loop. This is useful.
2040 * cs-parser.jay: Adjust the default parameters so that destructors
2041 have the proper signature.
2043 2002-04-26 Martin Baulig <martin@gnome.org>
2045 * driver.cs (LoadAssembly): If `assembly' contains any characters
2046 which are only valid in path names and not in assembly names
2047 (currently slash, backslash and point), use Assembly.LoadFrom ()
2048 instead of Assembly.Load () on the `assembly' (before iteration
2049 over the link_paths).
2051 2002-04-26 Martin Baulig <martin@gnome.org>
2053 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
2055 2002-04-25 Miguel de Icaza <miguel@ximian.com>
2057 * class.cs (Property): use the new typemanager.MemberLookup
2059 (TypeContainer.MemberLookup): Implement using the
2060 TypeManager.MemberLookup now.
2062 * typemanager.cs: Make MemberLookup a function of the TypeManager,
2063 and return MemberInfos, so that these can be used without an
2064 EmitContext (what we had before).
2066 2002-04-24 Miguel de Icaza <miguel@ximian.com>
2068 * expression.cs: Fix the case where the argument to params if the
2069 type of the params. I omitted handling this before. Fixed
2071 2002-04-22 Miguel de Icaza <miguel@ximian.com>
2073 * driver.cs: Call BootCorlib_PopulateCoreType
2075 * class.cs (Property.CheckBase): Check for properties only, not
2078 * interface.cs: Temporary hack: try/catch around the
2079 CustomAttributeBuilder, because I am getting an exception that I
2082 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
2083 types whose definitions are required to be there (attributes are
2084 defined before standard types).
2086 Compute definitions as we boot the various types, as they are used
2087 immediately (value_type class will need object_type, but if we do
2088 not initialize object_type, we will pass a null, which will let
2089 the runtime pick the System.Object from the existing corlib, which
2090 is not what we want).
2092 2002-04-22 Patrik Torstensson <totte@labs2.com>
2094 * cs-tokenizer.cs: fixed a number of trim() issues.
2096 2002-04-22 Ravi Pratap <ravi@ximian.com>
2098 * expression.cs (Argument.Type): Ensure that we return the correct
2099 type when we have out or ref parameters [in which case we
2102 2002-04-22 Miguel de Icaza <miguel@ximian.com>
2104 * class.cs (Property, Indexer): Allow extern modifier in there.
2106 * typemanager.cs (InitBaseTypes): Initializes object_type and
2107 value_type, since those will be used early on during the bootstrap
2108 process to compile corlib.
2110 (InitCoreTypes): Move code from here to InitBaseTypes.
2112 2002-04-21 Miguel de Icaza <miguel@ximian.com>
2114 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
2115 single-dimension arrays as using the ldlen opcode.
2117 Daniel Lewis discovered this optimization.
2119 * typemanager.cs: Add signature for System.Array::get_Length
2121 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2123 * statement.cs: report the error when the foreach does not apply to an
2124 array nor a collection.
2126 2002-04-19 Miguel de Icaza <miguel@ximian.com>
2128 * expression.cs: Add implicit conversions to the operator ~.
2130 * constant.cs (DecimalConstant.Emit): Emit decimal value.
2132 * typemanager.cs: Locate the decimal constructor.
2134 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2136 * attribute.cs: use the new property of TypeOf.
2137 * expression.cs: added 'get' property around typearg.
2139 These changes fix a build breaker reported by NickD. Is this the
2140 correct way to fix? If not, please, revert my changes and make it
2143 2002-04-17 Miguel de Icaza <miguel@ximian.com>
2145 * attribute.cs: Add support for typeof in attribute invocations.
2146 I am not sure that this is right though.
2148 2002-04-14 Duncan Mak <duncan@ximian.com>
2150 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
2151 Binary.Operator.Division case.
2153 2002-04-13 Ravi Pratap <ravi@ximian.com>
2155 * class.cs (DefineType): Ensure that we do a proper check on
2156 attribute types and also register it with the TypeManager.
2158 (TypeContainer.Targets): The default for attribute types is
2159 AttributeTargets.All.
2161 * attribute.cs (ApplyAttributes): Registering the attribute type
2162 is done elsewhere, not when we discover we have a Usage attribute.
2164 2002-04-12 Ravi Pratap <ravi@ximian.com>
2166 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
2167 and get rid of is_delegate parameter.
2169 * everywhere : update.
2171 2002-04-12 Ravi Pratap <ravi@ximian.com>
2173 * cs-parser.jay (compilation_unit): Revamp completely to use
2174 some new ideas that I got from Rhys' grammar to solve the problems
2175 with assembly level attributes.
2177 (outer_declaration): New grammar production.
2179 (attribute_sections): Add.
2181 (opt_attributes): Base on attribute_sections
2183 (namespace_declaration): Allow opt_attributes to tackle the case
2184 when we have assembly level attributes - we are clever in this
2187 * attribute.cs (ApplyAttributes): Do not worry about assembly
2188 attributes in the non-global context.
2190 * rootcontext.cs (AddGlobalAttributes): Go back to using this
2191 instead of SetGlobalAttributes.
2193 * class.cs, rootcontext.cs : Ensure we define and generate
2194 attribute types before anything else.
2196 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
2197 and flag the new error -20 for the case when the attribute type
2198 does not have valid targets specified. csc does not catch this.
2200 * ../errors/errors.txt : update for error # -20
2202 2002-04-11 Ravi Pratap <ravi@ximian.com>
2204 * support.cs (InternalParameters.ParameterModifier): Do some null
2205 checking and return sane values.
2207 * class.cs (Method.Define): If we are a PInvoke method, ensure
2208 that we are static and extern. Report error # 601
2210 * ../errors/cs0601.cs : Add test case for the above error.
2212 2002-04-07 Ravi Pratap <ravi@ximian.com>
2214 * rootcontext.cs (attribute_types): We need to keep type of
2215 all attribute types separately and emit code for them first.
2217 (RegisterAttribute) : Implement.
2219 * class.cs (DefineType): Check if the current Type is a custom
2220 attribute type and register it accordingly.
2222 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
2223 adding the first attribute twice and rename to
2225 (SetGlobalAttributes): this.
2227 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
2230 * attribute.cs (ApplyAttributes): Take an additional argument telling us
2231 if we are processing global arguments. Hmm, I am unsure of this.
2233 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2235 * expression.cs: added static array of strings to avoid calling
2236 Enum.ToString () for Operator in Binary. Significant recover of
2239 2002-04-10 Miguel de Icaza <miguel@ximian.com>
2241 * class.cs (FindMembers): Allow the Builders of the various
2242 members to be null. If they are skip them. This only happens
2243 during the PInvoke declaration.
2245 2002-04-09 Miguel de Icaza <miguel@ximian.com>
2247 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
2248 failure, so we do not keep going afterwards.
2250 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
2251 wanted to pass `false' as the `is_delegate' argument. If this is
2252 the case, why not use delegate_type == null to mean `is_delegate =
2253 false' and anything else as is_delegate = true.
2255 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
2257 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
2258 code for the section, not the beginning of the tests.
2260 2002-04-08 Miguel de Icaza <miguel@ximian.com>
2262 * cfold.cs: Handle operator + (Enum x, Underlying x)
2264 * expression.cs (Binary): same. Warn about errors where we have
2265 Enum/Enum in operator + as well.
2267 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
2270 - added support for switch(bool)
2271 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
2272 - add TableSwitchEmit() to handle table-based switch statements
2274 2002-04-05 Ravi Pratap <ravi@ximian.com>
2276 * expression.cs (Invocation.OverloadResolve): Factor out code which
2277 does parameter compatibility checking with arguments so that we can
2278 re-use the code even from Delegate.VerifyApplicability
2280 (VerifyArgumentsCompat): Move above code here.
2282 * delegate.cs (VerifyApplicability): Get rid of duplicate code
2283 and instead make a call to the above method.
2285 2002-03-31 Ravi Pratap <ravi@ximian.com>
2287 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
2288 We use it to keep track of classes which are attribute types.
2290 2002-04-02 Miguel de Icaza <miguel@ximian.com>
2292 * delegate.cs (Delegate.Define): Correctly define the types in the
2293 presence of fixed and array parameters.
2295 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
2298 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
2299 include NonPublic after the first iteration.
2301 * class.cs (Indexer.CheckBase): Only check if both parents are
2304 * cs-parser.jay (accessor_body): If empty, set to null.
2306 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
2307 same code path here to resolve constants names that we did have in
2308 MemberAccess.DoResolve. There is too much code duplicated here.
2310 2002-04-01 Miguel de Icaza <miguel@ximian.com>
2312 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
2314 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
2317 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
2318 tokens, numbers and strings.
2320 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
2323 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
2324 asyncronous parameters and the regular parameters.
2326 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
2327 specify the target directory.
2329 * expression.cs: (This.DoResolve): Simplify
2330 (As.Emit): Optimize, do not generate IsInst if the expression is
2331 always of the given type.
2333 (Is.DoResolve): Bug fix, we were reporting both always/never for
2336 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
2337 creating too many unnecessary arrays.
2339 2002-03-31 Miguel de Icaza <miguel@ximian.com>
2341 * class.cs (EmitFieldInitializer): Use Assign expression to assign
2342 fields instead of rolling our own initializer. Takes care of all
2343 implicit conversions, and drops unnecessary static checks/argument.
2345 2002-03-31 Dick Porter <dick@ximian.com>
2347 * driver.cs: use the GetDirectories() return values properly, and
2348 use "/" as path separator.
2350 2002-03-30 Miguel de Icaza <miguel@ximian.com>
2352 * expression.cs (Unary): Optimize - - expr into expr.
2353 (Binary): Optimize a + (-b) into a -b.
2355 * codegen.cs (CodeGen): Made all methods static.
2357 2002-03-29 Miguel de Icaza <miguel@ximian.com>
2361 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
2362 TypeBuilder property.
2364 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
2367 * tree.cs: Removed the various RecordXXXX, and replaced with a
2368 single RecordDecl. Removed all the accessor methods, and just
2369 left a single access point Type
2371 * enum.cs: Rename DefineEnum to DefineType.
2373 * decl.cs: New abstract method `DefineType' used to unify the
2374 Defines for Enumerations, Interfaces, TypeContainers and
2377 (FindType): Moved LookupInterfaceOrClass here. Moved the
2378 LookupBaseClasses method that used to live in class.cs and
2379 interface.cs here, and renamed to FindType.
2381 * delegate.cs: Implement DefineType. Take advantage of the
2382 refactored pattern for locating the parent builder without taking
2383 the parent_builder argument (which we know does not work if we are
2384 nested, and triggering a toplevel definition).
2386 2002-03-28 Miguel de Icaza <miguel@ximian.com>
2388 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
2389 accessibility of a member has changed during override and report
2392 * class.cs (Method.Define, Property.Define): Only complain on
2393 overrides if the method is private, any other accessibility is
2394 fine (and since we just checked the permission is the same, we are
2397 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
2398 and elif are processed always. The other pre-processing
2399 directives are only processed if we are "taking" the path
2401 2002-03-29 Martin Baulig <martin@gnome.org>
2403 * class.cs (Method.Emit): Only emit symbolic debugging info if the
2404 current location is not Null.
2406 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
2407 a separate method so we can profile it.
2409 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
2410 `span.Seconds' are just seconds, but no minutes or hours.
2411 (MainDriver): Profile the CodeGen.SaveSymbols calls.
2413 2002-03-28 Miguel de Icaza <miguel@ximian.com>
2415 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
2416 Remove the gratuitous set of Final:
2418 // If an interface implementation, then we can set Final.
2419 if (((flags & MethodAttributes.Abstract) == 0) &&
2420 implementing.DeclaringType.IsInterface)
2421 flags |= MethodAttributes.Final;
2423 I do not know what I was smoking when I used that.
2426 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
2427 step into fixing the name resolution issues for delegates and
2428 unifying the toplevel name resolution.
2430 2002-03-28 Martin Baulig <martin@gnome.org>
2432 * class.cs (Method.Emit): If we have a symbol writer, call its
2433 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
2434 tell it about the current method.
2436 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
2437 writer that we're going to emit the first byte of IL code for a new
2438 statement (a new source line).
2439 (EmitContext.EmitTopBlock): If we have a symbol writer, call
2440 EmitContext.Mark() before emitting any code.
2442 * location.cs (SymbolDocument): Return null when we're Null.
2444 * statement.cs (Statement): Moved the `Location loc' variable here.
2445 (Statement.EmitBoolExpression): If we have a symbol writer, call
2446 ec.Mark() before emitting any code to tell it that we're at the
2447 beginning of a new statement.
2448 (StatementExpression): Added `Location' argument to the constructor.
2449 (Block): Added public readonly variable `StartLocation' and public
2450 variable `EndLocation'. The latter is to be set using SetEndLocation().
2451 (Block): Added constructor which takes a start and end location.
2452 (Block.SetEndLocation): New method. This sets the end location.
2453 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
2454 local variables we create.
2455 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
2456 each statement and do also mark the begin and end of the block.
2458 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
2459 tell it the current lexer.Location, use Location.Null for the end of the
2461 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
2462 current block, set its end location using SetEndLocation().
2463 (statement_expression): StatementExpression constructor now takes the
2464 lexer.Location as additional argument.
2465 (for_statement, declare_local_variables): Likewise.
2466 (declare_local_variables): When creating a new implicit block, use the
2467 new Block constructor and pass it the lexer.Location.
2469 2002-03-28 Miguel de Icaza <miguel@ximian.com>
2471 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
2472 members also on the parent interfaces recursively.
2474 2002-03-27 Miguel de Icaza <miguel@ximian.com>
2476 * report.cs: Use new formats, since Gonzalo finished the missing
2479 * expression.cs (Binary.ResolveOperator): added missing operator|
2480 operator& and operator^ for bool/bool.
2482 * cs-parser.jay: CheckDef now takes a Location argument that is
2483 used to report errors more precisly (instead of reporting the end
2484 of a definition, we try to track something which is a lot closer
2485 to the source of the problem).
2487 * cs-tokenizer.cs: Track global token use, so we can properly flag
2488 the use of #define/#undef after the first token has been seen.
2490 Also, rename the reportXXXX to Error_DescriptiveName
2492 * decl.cs (DeclSpace.IsTopLevel): Move property here from
2493 TypeContainer, so that Enum and Interface can use this too.
2495 * class.cs (TypeContainer.LookupInterfaceOrClass,
2496 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
2497 `builder' argument. Typically this was used to pass the parent
2498 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
2501 The problem is that a nested class could trigger the definition of
2502 a toplevel class, and the builder would be obviously wrong in that
2505 So we drop this argument, and we compute dynamically the
2506 TypeBuilder/ModuleBuilder (the correct information was available
2507 to us anyways from DeclSpace.Parent)
2509 * interface.cs (Interface.DefineInterface): Drop builder
2510 parameter cleanup like class.cs
2512 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
2515 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
2518 (Try.Emit): Propagate the returns value from the statement.
2520 (Return.Emit): Even if we are leavning
2522 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
2524 * modifiers.cs: Fix the computation of MethodAttributes flags.
2526 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
2528 * driver.cs: allow compilation of files that start with '/'.
2529 Add a default case when checking the argument of --target.
2531 2002-03-25 Miguel de Icaza <miguel@ximian.com>
2533 * interface.cs: Implement the same search algorithm for types in
2536 * delegate.cs: Do not allow multiple definition.
2538 * Recovered ChangeLog that got accidentally amputated
2540 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
2542 * rootcontext.cs: Load manually enum to allow core classes to
2543 contain enumerations.
2545 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
2546 Update to new static methods in TypeManager.
2548 * typemanager.cs (GetMethod, GetConstructor): Use our
2549 implementation of FindMembers to find the members, since during
2550 corlib compilation, the types are TypeBuilders and GetMethod and
2551 GetConstructor do not work.
2553 Make all methods in TypeManager static.
2555 (InitCodeHelpers): Split the functionality from
2556 the InitCodeTypes function.
2558 * driver.cs: Call InitCodeHelpers after we have populated the
2561 * cs-parser.jay (delegate_declaration): we did not used to compute
2562 the delegate name correctly for void delegates.
2564 2002-03-24 Miguel de Icaza <miguel@ximian.com>
2566 * rootcontext.cs (RootContext): Init the interface_resolve_order
2567 and type_container_resolve_order always.
2569 (ResolveCore, BootstrapCorlib_ResolveClass,
2570 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
2571 compiler when compiling with --nostdlib
2573 * class.cs (TypeContainer.DefineType): Check that our parent is
2574 not null. This test is most important when we are bootstraping
2577 * codegen.cs: Split out the symbol writing code.
2579 2002-03-25 Martin Baulig <martin@gnome.org>
2581 * driver.cs (-g): Made -g an alias for --debug.
2583 2002-03-24 Martin Baulig <martin@gnome.org>
2585 * codegen.cs (SymbolWriter): New public variable. Returns the
2586 current symbol writer.
2587 (CodeGen): Added `bool want_debugging_support' argument to the
2588 constructor. If true, tell the ModuleBuild that we want debugging
2589 support and ask it for the ISymbolWriter.
2590 (Save): If we have a symbol writer, call it's Close() method after
2591 saving the assembly.
2593 * driver.c (--debug): New command line argument to create a
2594 debugger information file.
2596 * location.cs (SymbolDocument): New public property. Returns an
2597 ISymbolDocumentWriter object for the current source file or null
2598 if we don't have a symbol writer.
2600 2002-03-21 Miguel de Icaza <miguel@ximian.com>
2602 * driver.cs (LoadAssembly): Correctly return when all the paths
2603 have been tried and not before.
2605 * statement.cs (Switch.Emit): return the actual coverage for this
2606 statement (returns/not-returns)
2608 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
2609 switch of the statement if we are the last switch section. That
2610 kills two problems: try/catch problems (we used to emit an empty
2611 nop at the end) and switch statements where all branches would
2614 2002-03-19 Miguel de Icaza <miguel@ximian.com>
2616 * driver.cs: Add default assemblies (the equivalent to the
2617 Microsoft CSC.RSP file)
2619 * cs-tokenizer.cs: When updating `cols and setting it to zero,
2620 also update tokens_seen and set it to false.
2622 * driver.cs: Implement --recurse for Mike.
2624 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
2625 correctly splitting out the paths.
2627 2002-03-18 Miguel de Icaza <miguel@ximian.com>
2629 * interface.cs (Interface.PopulateProperty): Instead of using
2630 `parent' as the declaration space for the set parameters, use
2633 * support.cs (InternalParameters): InternalParameters constructor
2634 takes a DeclSpace instead of a TypeContainer.
2636 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
2637 types are being initialized, load the address of it before calling
2640 (New): Provide a mechanism to disable the generation of local
2641 value type temporaries when the caller will be providing us with
2642 an address to store it.
2644 (ArrayCreation.EmitDynamicInitializers): Use it.
2646 2002-03-17 Miguel de Icaza <miguel@ximian.com>
2648 * expression.cs (Invocation.EmitArguments): Only probe for array
2649 property if there is more than one argument. Sorry about that.
2651 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
2654 * class.cs (Method.LabelParameters): Fix incorrect code path that
2655 prevented the `ParamArrayAttribute' from being applied to the
2658 2002-03-16 Miguel de Icaza <miguel@ximian.com>
2660 * support.cs (ReflectionParameters): Correctly compute whether the
2661 last argument is a params array. Fixes the problem with
2664 * typemanager.cs: Make the assemblies array always be non-null
2665 (empty, but non-null)
2667 * tree.cs (RecordDecl): New function that abstracts the recording
2668 of names. This reports error 101, and provides a pointer to the
2669 previous declaration. Fixes a crash in the compiler.
2671 * cs-parser.jay (constructor_declaration): Update to new grammar,
2672 and provide a constructor_body that can be empty.
2674 2002-03-15 Miguel de Icaza <miguel@ximian.com>
2676 * driver.cs: Add support for --resources.
2678 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
2679 Make all types for the various array helper methods be integer.
2681 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
2682 CheckState to ConvCast.
2684 (ConvCast): Now it takes a `checked' state argument, to avoid
2685 depending on the emit context for the conversion, and just using
2686 the resolve time setting.
2688 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
2689 instead of Invocation.EmitArguments. We do not emit the original
2690 arguments, instead we emit those which have been converted to
2691 unsigned int expressions.
2693 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
2695 * codegen.cs: ditto.
2697 * expression.cs (LocalVariableReference): Drop the use of the
2698 Store function that depended on the variable index.
2700 * statement.cs (VariableInfo): Drop the `Idx' property from this
2701 class, as this is not taking into account the indexes for
2702 temporaries tat we generate during the execution, getting the
2705 * class.cs: First emit class initializers, then call the parent
2708 * expression.cs (Binary): Fix opcode emision.
2709 (UnaryMutator.EmitCode): Support checked code generation
2711 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
2712 matches for events for both the Static and Instance scans,
2713 pointing to the same element. Fix that.
2715 2002-03-14 Miguel de Icaza <miguel@ximian.com>
2717 * rootcontext.cs (ResolveTree): Always set the
2718 interface_resolve_order, because nested interfaces will be calling
2721 * class.cs (GetInterfaceOrClass): Track the same resolution
2722 process used by TypeManager.LookupType. This fixes the nested
2723 type lookups in class declarations (separate path from
2726 (TypeContainer.DefineType): Also define nested interfaces.
2727 (TypeContainer.RegisterOrder): New public function used to
2728 register the order in which child interfaces need to be closed.
2730 Nested interfaces need to be closed after their parents have been
2733 * interface.cs (InterfaceAttr): Put all the logic for computing
2734 the interface attribute here.
2736 (DefineInterface): Register our interface order with the
2737 RootContext or with the TypeContainer depending on the case.
2739 2002-03-12 Miguel de Icaza <miguel@ximian.com>
2741 * cs-parser.jay: rework foreach statement to work with the new
2742 changes to the policy on SimpleNames.
2744 * report.cs: support Stacktrace on warnings as well.
2746 * makefile: drop --unsafe and /unsafe from the compile.
2748 2002-03-13 Ravi Pratap <ravi@ximian.com>
2750 * ecore.cs (StandardConversionExists): Modify to take an Expression
2751 as the first parameter. Ensure we do null -> reference type conversion
2754 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
2755 temporary Expression objects.
2757 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
2759 * interface.cs: workaround bug in method overloading resolution
2760 (there is already a bugzilla bug for it).
2762 2002-03-12 Miguel de Icaza <miguel@ximian.com>
2764 We could also solve this problem by having a separate path for
2765 performing type lookups, instead of DoResolve, we could have a
2766 ResolveType entry point, and only participating pieces of the
2767 production (simplename, deref, array) would implement this.
2769 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
2770 signal SimpleName to only resolve type names and not attempt to
2771 resolve anything else.
2773 * expression.cs (Cast): Set the flag.
2775 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
2777 * class.cs: Only report 108 if there is no `new' modifier.
2779 * cs-parser.jay: rework foreach statement to work with the new
2780 changes to the policy on SimpleNames.
2782 * report.cs: support Stacktrace on warnings as well.
2784 * makefile: drop --unsafe and /unsafe from the compile.
2786 2002-03-11 Miguel de Icaza <miguel@ximian.com>
2788 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
2789 lookups here, instead of doing that at parse time. This means
2790 that our grammar will not introduce `LocalVariableReferences' as
2791 expressions at this point. That solves the problem of code like
2799 This is only half the fix. The full fix requires parameters to
2800 also be handled in this way.
2802 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
2803 makes the use more obvious of the DeclSpace. The
2804 ec.TypeContainer.TypeBuilder is now only used to pull the
2807 My theory is that I can get rid of the TypeBuilder completely from
2808 the EmitContext, and have typecasts where it is used (from
2809 DeclSpace to where it matters).
2811 The only pending problem is that the code that implements Aliases
2812 is on TypeContainer, and probably should go in DeclSpace.
2814 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
2815 lookups here, instead of doing that at parse time. This means
2816 that our grammar will not introduce `LocalVariableReferences' as
2817 expressions at this point. That solves the problem of code like
2825 This is only half the fix. The full fix requires parameters to
2826 also be handled in this way.
2828 * class.cs (Property.DefineMethod): When implementing an interface
2829 method, set newslot, when implementing an abstract method, do not
2830 set the flag (before we tried never setting it, or always setting
2831 it, which is the difference).
2832 (Indexer.DefineMethod): same.
2833 (Method.DefineMethod): same.
2835 * ecore.cs: Only set the status used flag if we get back a Field.
2837 * attribute.cs: Temporary hack, so Paolo can keep working.
2839 2002-03-08 Ravi Pratap <ravi@ximian.com>
2841 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
2842 the unmanaged type in the case we have a MarshalAs attribute.
2844 (Resolve): Handle the case when we are parsing the special MarshalAs
2845 attribute [we need to store the unmanaged type to use later]
2847 * typemanager.cs (marshal_as_attr_type): Built in type for the
2848 MarshalAs Attribute.
2850 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
2851 on parameters and accordingly set the marshalling info.
2853 2002-03-09 Miguel de Icaza <miguel@ximian.com>
2855 * class.cs: Optimizing slightly by removing redundant code after
2856 we switched to the `NoTypes' return value.
2857 (Property.DefineMethod): use NoTypes here too.
2859 This fixes the bug I introduced in my last batch of changes.
2861 2002-03-05 Ravi Pratap <ravi@ximian.com>
2863 * tree.cs (RecordEnum): Add. We now keep track of enums too.
2865 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
2866 Enums since those are types too.
2868 * cs-parser.jay (enum_declaration): Record enums as we parse them.
2870 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
2871 thanks to a call during the lookup process.
2873 2002-03-07 Miguel de Icaza <miguel@ximian.com>
2875 * statement.cs (Foreach): Lots of work to accomodate a particular
2876 kind of foreach statement that I had not kept in mind. It is
2877 possible to have foreachs on classes that provide a GetEnumerator
2878 method that return objects that implement the "pattern" for using
2879 a foreach, there is no need to support GetEnumerator
2882 This is needed to compile nant.
2884 * decl.cs: Only report 114 if the member is not `Finalize' and if
2885 the warning level is at least 2.
2887 * class.cs: Moved the compare function from Method to
2890 (MethodSignature.InheritableMemberSignatureCompare): Add new
2891 filter function that is used to extract inheritable methods from a
2894 (Method.Define): Use the new `inheritable_method_signature_filter'
2897 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
2900 2002-03-06 Miguel de Icaza <miguel@ximian.com>
2902 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
2904 * cs-parser.jay: Add opt_semicolon to the interface declaration.
2906 * expression.cs: Pass location information to
2907 ConvertImplicitStandard.
2909 * class.cs: Added debugging code to track return values from
2912 2002-03-05 Miguel de Icaza <miguel@ximian.com>
2914 * expression.cs (Is.DoResolve): If either side of the `is' is an
2915 interface, do not flag the warning.
2917 * ecore.cs (ImplicitReferenceConversion): We need a separate test
2920 * report.cs: Allow for --fatal to be used with --probe.
2922 * typemanager.cs (NoTypes): Move the definition for the empty Type
2925 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
2927 (TypeContainer.DefineProxy): New function used to proxy to parent
2928 implementations when implementing interfaces.
2929 (TypeContainer.ParentImplements): used to lookup if our parent
2930 implements a public function that is required by an interface.
2931 (TypeContainer.VerifyPendingMethods): Hook this up.
2933 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
2934 `modules' and `assemblies' arraylists into arrays. We only grow
2935 these are the very early start up of the program, so this improves
2936 the speedof LookupType (nicely measured).
2938 * expression.cs (MakeByteBlob): Replaced unsafe code with
2939 BitConverter, as suggested by Paolo.
2941 * cfold.cs (ConstantFold.Binary): Special case: perform constant
2942 folding of string concatenation, but if either side is a string,
2943 and the other is not, then return null, and let the runtime use
2944 the concatenation on the string plus the object (using
2947 2002-03-04 Miguel de Icaza <miguel@ximian.com>
2949 Constant Folding has been implemented now.
2951 * expression.cs (Unary.Reduce): Do not throw an exception, catch
2952 the error instead on types that are not supported in one's
2955 * constant.cs (Constant and all children): New set of functions to
2956 perform implict and explicit conversions.
2958 * ecore.cs (EnumConstant): Implement the new functions to perform
2959 conversion by proxying to the child expression.
2961 * codegen.cs: (ConstantCheckState): Constant evaluation has its
2962 own separate setting that can not be turned off from the command
2963 line using --unchecked or --checked and is only controlled using
2964 the checked/unchecked statements and expressions. This setting is
2965 used by the constant folder to flag errors.
2967 * expression.cs (CheckedExpr, UncheckedExpr): Set the
2968 ConstantCheckState as well.
2970 During Resolve, they also have to flag the state, because the
2971 constant folder runs completely in the Resolve phase.
2973 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
2976 2002-03-01 Miguel de Icaza <miguel@ximian.com>
2978 * cfold.cs: New file, this file contains the constant folder.
2980 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
2981 argument to track whether we are using the resulting address to
2982 load or store a value and provide better error messages.
2984 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
2985 new AddressOf arguments.
2987 * statement.cs (Foreach.EmitCollectionForeach): Update
2989 * expression.cs (Argument.Emit): Call AddressOf with proper
2990 arguments to track usage.
2992 (New.DoEmit): Call AddressOf with new arguments.
2994 (Unary.Emit): Adjust AddressOf call.
2996 2002-03-01 Ravi Pratap <ravi@ximian.com>
2998 * cs-parser.jay (member_access): Change the case for pre-defined types
2999 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
3002 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
3005 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
3006 essentially like methods and apply attributes like MethodImplOptions to them too.
3008 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
3011 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
3012 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
3015 * Update code everywhere accordingly.
3017 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
3019 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
3021 2002-02-28 Ravi Pratap <ravi@ximian.com>
3023 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
3024 try performing lookups against those instead of jumping straight into using
3025 the 'using' clauses.
3027 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
3029 (LookupType): Perform lookups in implicit parents too.
3031 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
3032 sequence as RootContext.LookupType.
3034 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
3035 the various cases of namespace lookups into this method.
3037 2002-03-01 Miguel de Icaza <miguel@ximian.com>
3039 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
3040 in positional arguments)
3042 * class.cs (Operator): Update the AllowedModifiers to contain
3045 * cs-parser.jay: Update operator declaration to allow for the
3046 operator body to be empty.
3048 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
3051 2002-02-27 Miguel de Icaza <miguel@ximian.com>
3053 * class.cs (Method.Emit): Label parameters.
3055 * driver.cs: Return 1 or 0 as the program exit code.
3057 2002-02-26 Miguel de Icaza <miguel@ximian.com>
3059 * expression.cs: Special case the `null' object when trying to
3060 auto-compute the type, as anything can be explicitly converted to
3063 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
3064 spotting this Paolo.
3066 (Expression.ImplicitNumericConversion): Perform comparissions of
3067 the type using the underlying type in the case of an enumeration
3068 rather than using the enumeration type for the compare.
3070 Cope with the underlying == type case, which is not possible to
3073 (Expression.ConvertNumericExplicit): Perform comparissions of
3074 the type using the underlying type in the case of an enumeration
3075 rather than using the enumeration type for the compare.
3077 * driver.cs: If the user does not supply an extension, assume .exe
3079 * cs-parser.jay (if_statement): Rewrote so that we can track the
3080 location for the if statement.
3082 * expression.cs (Binary.ConstantFold): Only concat strings when
3083 the operation is "+", not everything ;-)
3085 * statement.cs (Statement.EmitBoolExpression): Take a location
3087 (If, While, Do): Track location.
3089 * expression.cs (Binary.ResolveOperator): In the object + string
3090 case, I was missing a call to ConvertImplicit
3092 2002-02-25 Ravi Pratap <ravi@ximian.com>
3094 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
3095 Location arguments. Ensure we use RootContext.LookupType to do our work
3096 and not try to do a direct Type.GetType and ModuleBuilder.GetType
3098 * interface.cs (PopulateMethod): Handle the type of the parameter being
3101 * expression.cs (Invocation.BetterFunction): Handle the case when we
3102 have a params method with no fixed arguments and a call is made with no
3105 2002-02-25 Miguel de Icaza <miguel@ximian.com>
3107 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
3108 the verbatim-string-literal
3110 * support.cs (InternalParameters.ParameterModifier): handle null
3112 (InternalParameters.ParameterType): ditto.
3114 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
3115 duplicating the name of the variable parameter.
3116 (GetParameterByName): Fix bug where we were not looking up array
3117 paramters if they were the only present (thanks Paolo!).
3118 (GetParameterInfo): We only have an empty set of types if both
3119 fixed and array are set to null.
3120 (GetParameterInfo-idx): Handle FixedParameter == null
3122 * cs-parser.jay: Handle the case where there is no catch
3123 statements (missing null test).
3125 2002-02-22 Miguel de Icaza <miguel@ximian.com>
3127 * driver.cs (MainDriver): Be conservative on our command line
3130 Catch DirectoryNotFoundException when calling GetFiles.
3132 (SplitPathAndPattern): Used to split the input specification into
3133 a path and a pattern that we can feed to Directory.GetFiles.
3135 2002-02-21 Miguel de Icaza <miguel@ximian.com>
3137 * statement.cs (Fixed): Implement the last case of the Fixed
3138 statement (string handling).
3140 * expression.cs (StringPtr): New class used to return a char * to
3141 a string; Used by the Fixed statement.
3143 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
3145 * expression.cs (Binary.ResolveOperator): Remove redundant
3146 MemberLookup pn parent type.
3147 Optimize union call, we do not need a union if the types are the same.
3148 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
3151 Specialize the use of MemberLookup everywhere, instead of using
3152 the default settings.
3154 (StackAlloc): Implement stackalloc keyword.
3156 * cs-parser.jay: Add rule to parse stackalloc.
3158 * driver.cs: Handle /h, /help, /?
3160 * expression.cs (MakeByteBlob): Removed the hacks we had in place
3161 before we supported unsafe code.
3163 * makefile: add --unsafe to the self compilation of mcs.
3165 2002-02-20 Miguel de Icaza <miguel@ximian.com>
3167 * expression.cs (PointerArithmetic): New class that is used to
3168 perform pointer arithmetic.
3169 (Binary.Resolve): Handle pointer arithmetic
3170 Handle pointer comparission.
3171 (ArrayPtr): Utility expression class that is used to take the
3172 address of an array.
3174 (ElementAccess): Implement array access for pointers
3176 * statement.cs (Fixed): Implement fixed statement for arrays, we
3177 are missing one more case before we are done.
3179 * expression.cs (Indirection): Implement EmitAssign and set the
3180 ExprClass to Variable. This allows pointer dereferences to be
3181 treated as variables, and to have values assigned to them.
3183 * ecore.cs (Expression.StoreFromPtr): New utility function to
3184 store values dereferencing.
3186 2002-02-20 Ravi Pratap <ravi@ximian.com>
3188 * expression.cs (Binary.ResolveOperator): Ensure that we are
3189 not trying to operate on a void type - this fixes the reported
3192 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
3193 the parent implementation is sealed.
3195 * ../errors/cs0239.cs : Add.
3197 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
3199 * typemanager.cs (unverifiable_code_type): Corresponds to
3200 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
3201 which have unsafe code in them.
3203 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
3206 2002-02-19 Miguel de Icaza <miguel@ximian.com>
3208 * cs-tokenizer.cs: Add support for @"litreal strings"
3210 Make tokenizer accept pre-processor directives
3211 on any column (remove the old C-like limitation).
3213 * rootcontext.cs (EmitCode): Emit any global attributes.
3214 (AddGlobalAttributes): Used to keep track of assembly attributes.
3216 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
3218 * cs-parser.jay: Add support for global attributes.
3220 2002-02-17 Miguel de Icaza <miguel@ximian.com>
3222 * expression.cs (Indirection): New helper class. Unary will
3223 create Indirection classes to be able to implement the
3224 IMemoryLocation interface on it.
3226 2002-02-16 Miguel de Icaza <miguel@ximian.com>
3228 * cs-parser.jay (fixed_statement): reference the right statement.
3230 * statement.cs (Fixed.Emit): Finish implementing the fixed
3231 statement for the &x case.
3233 2002-02-14 Miguel de Icaza <miguel@ximian.com>
3235 * class.cs (Property.Define, Method.Define): Remove newslot when
3238 * modifiers.cs: My use of NewSlot when `Abstract' was set was
3239 wrong. NewSlot should only be used if the `new' keyword is present.
3241 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
3242 locating our system dir. Sorry about this.
3244 2002-02-13 Miguel de Icaza <miguel@ximian.com>
3246 * driver.cs (GetSystemDir): Compute correctly the location of our
3247 system assemblies. I was using the compiler directory instead of
3248 the library directory.
3250 2002-02-13 Ravi Pratap <ravi@ximian.com>
3252 * expression.cs (BetterFunction): Put back in what Miguel commented out
3253 since it is the correct fix. The problem is elsewhere ;-)
3255 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
3256 parameters of the parms method are themselves compatible or not !
3258 (StandardConversionExists): Fix very dangerous bug where we were forgetting
3259 to check that a class implements an interface before saying that an implicit
3260 conversion was allowed. Use ImplementsInterface to do the checking.
3262 2002-02-13 Miguel de Icaza <miguel@ximian.com>
3264 * class.cs (Method.Define): Track whether we are an explicit
3265 implementation or not. And only call DefineMethodOverride if we
3266 are an explicit implementation.
3268 (Property.DefineMethod): Ditto.
3270 2002-02-11 Ravi Pratap <ravi@ximian.com>
3272 * expression.cs (BetterFunction): Catch hideous bug which was
3273 preventing us from detecting ambiguous calls due to implicit casts i.e
3276 2002-01-29 Miguel de Icaza <miguel@ximian.com>
3278 * support.cs (Pair): Remove un-needed method. I figured why I was
3279 getting the error in cs-parser.jay, the variable in a foreach loop
3280 is readonly, and the compiler does not really treat this as a variable.
3282 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
3283 instead of EQUALS in grammar.
3285 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
3287 * expression.cs (Unary.DoResolve): Check whether the argument is
3290 2002-01-28 Miguel de Icaza <miguel@ximian.com>
3292 * support.cs: Api for Pair to set a value. Despite the fact that
3293 the variables are public the MS C# compiler refuses to compile
3294 code that accesses the field if the variable is part of a foreach
3297 * statement.cs (Fixed): Begin implementation of the fixed
3300 (Block.AddVariable): Return the VariableInfo on success and null
3301 on failure instead of true/false.
3303 * cs-parser.jay (foreach): Catch errors on variables already
3304 defined (we were ignoring this value before) and properly unwind
3307 (fixed_statement): grammar for the fixed statement.
3309 2002-01-25 Miguel de Icaza <miguel@ximian.com>
3311 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
3312 pointer types to be incretemented.
3314 (SizeOf): Implement.
3316 * cs-parser.jay (pointer_member_access): Implement
3317 expr->IDENTIFIER production.
3319 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
3320 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
3323 (Unary): Implement indirection.
3325 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
3326 use in non-unsafe context).
3328 (SimpleName.DoResolve): Check for pointers in field access on safe
3331 (Expression.LoadFromPtr): Factor the load-indirect code in this
3332 function. This was duplicated in UnboxCast and ParameterReference
3334 2002-01-24 Miguel de Icaza <miguel@ximian.com>
3336 * expression.cs (ComposedCast): report an error if a pointer cast
3337 is used in a safe region.
3339 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
3340 pointer type casts in unsafe context.
3342 * codegen.cs (EmitContext): Set up IsUnsafe.
3344 * cs-parser.jay (non_expression_type): Add productions for pointer
3347 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
3348 code. We should not use force into static mode if the method is
3349 not virtual. Fixes bug in MIS
3351 * statement.cs (Do.Emit, While.Emit, For.Emit,
3352 Statement.EmitBoolExpression): Add support to Do and While to
3353 propagate infinite loop as `I do return' semantics.
3355 Improve the For case to also test for boolean constants.
3357 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
3358 to the list of attributes we can add.
3360 Remove `EmitContext' argument.
3362 * class.cs (Method.Define): Apply parameter attributes.
3363 (Constructor.Define): Apply parameter attributes.
3364 (MethodCore.LabelParameters): Move here the core of labeling
3367 * support.cs (ReflectionParameters.ParameterModifier,
3368 InternalParameters.ParameterModifier): Use IsByRef on the type and
3369 only return the OUT bit for these parameters instead of in/out/ref
3372 This is because I miss-understood things. The ParameterInfo.IsIn
3373 and IsOut represent whether the parameter has the [In] and [Out]
3376 2002-01-22 Miguel de Icaza <miguel@ximian.com>
3378 * ecore.cs (FieldExpr.Emit): Release temporaries.
3380 * assign.cs (LocalTemporary.Release): new function.
3382 * codegen.cs (EmitContext.GetTemporaryStorage,
3383 EmitContext.FreeTemporaryStorage): Rework the way we deal with
3384 temporary storage. Now we can "put back" localbuilders when we
3387 2002-01-21 Miguel de Icaza <miguel@ximian.com>
3389 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
3390 need to make a copy of the variable to generate verifiable code.
3392 2002-01-19 Miguel de Icaza <miguel@ximian.com>
3394 * driver.cs: Compute dynamically the system directory.
3396 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
3397 Slower, but more generally useful. Used by the abstract
3398 registering implementation.
3400 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
3401 the rules for the special rule on Type/instances. First check if
3402 we have the same name, and if so, try that special static path
3403 rather than the instance path.
3405 2002-01-18 Miguel de Icaza <miguel@ximian.com>
3407 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
3410 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
3411 Enum, ValueType, Delegate or Array for non-corlib compiles.
3413 * cs-tokenizer.cs: Catch long identifiers (645)
3415 * typemanager.cs (IndexerPropetyName): Ravi never tested this
3418 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
3419 fix, we were returning too early, so we were not registering
3420 pending methods from abstract classes.
3422 Do not register pending methods if the class is abstract.
3424 * expression.cs (Conditional.DoResolve): Report circular implicit
3425 conversions when we neecd to compute it for conditional
3428 (Is.DoResolve): If the expression is always of the provided type,
3429 flag warning 183. If the expression can not ever be of the
3430 provided type flag warning 184.
3432 * class.cs: Catch 169 as well.
3434 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
3437 2002-01-18 Nick Drochak <ndrochak@gol.com>
3439 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
3441 2002-01-17 Miguel de Icaza <miguel@ximian.com>
3443 * interface.cs: (PopulateMethod): Check for pointers being defined
3444 only if the unsafe context is active.
3445 (PopulateProperty): ditto.
3446 (PopulateIndexer): ditto.
3448 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
3449 specified. If pointers are present, make sure that they are
3450 present in an unsafe context.
3451 (Constructor, Constructor.Define): ditto.
3452 (Field, Field.Define): ditto.
3453 (Property, Property.Define): ditto.
3454 (Event, Event.Define): ditto.
3456 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
3457 hashtable if there are classes or structs defined.
3459 * expression.cs (LocalVariableReference.DoResolve): Simplify this
3460 code, as the constant resolution moved.
3462 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
3463 the metadata, so we can flag error 133.
3465 * decl.cs (MemberCore.UnsafeOK): New function to test that a
3466 pointer is being declared in an unsafe context.
3468 2002-01-16 Miguel de Icaza <miguel@ximian.com>
3470 * modifiers.cs (Modifiers.Check): Require a Location argument.
3471 Report error 227 for Unsafe use.
3473 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
3475 * statement.cs (For.Emit): If the test is null, then report that
3476 we do `return', as we wont reach anything afterwards.
3478 (Switch.SwitchGoverningType): Track the expression that matched
3481 * driver.cs: Allow negative numbers as an error code to flag.
3483 * cs-parser.jay: Handle 1551.
3485 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
3487 2002-01-15 Miguel de Icaza <miguel@ximian.com>
3489 * cs-parser.jay: Report 1518 (type declaration can only contain
3490 class, struct, interface, enum or delegate)
3492 (switch_label): Report 1523 (keywords `case' or `default' must
3495 (opt_switch_sections): Report 1522 (empty switch)
3497 * driver.cs: Report 1515 (response file specified multiple times)
3498 Report 1516 (Source file specified multiple times).
3500 * expression.cs (Argument.Resolve): Signal 1510
3502 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
3503 access not allowed in static code)
3505 2002-01-11 Ravi Pratap <ravi@ximian.com>
3507 * typemanager.cs (IsPointerType): Utility method which we are going
3510 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
3511 the object type, so we take care of that.
3513 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
3515 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
3516 added to non-params parameters :-)
3518 * typemanager.cs (CSharpName): Include 'void' type too.
3520 (void_ptr_type): Include in the set of core types.
3522 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
3525 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
3528 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
3529 completely forgotten about it.
3531 2002-01-10 Ravi Pratap <ravi@ximian.com>
3533 * cs-parser.jay (pointer_type): Add. This begins our implementation
3534 of parsing rules for unsafe code.
3536 (unsafe_statement): Implement.
3538 (embedded_statement): Modify to include the above.
3540 * statement.cs (Unsafe): Implement new class for unsafe blocks.
3542 * codegen.cs (EmitContext.InUnsafe): Add. This determines
3543 if the current context is an unsafe one.
3545 * cs-parser.jay (local_variable_pointer_type): Since local variable types
3546 are handled differently, we need separate rules for them.
3548 (local_variable_declaration): Update to use local_variable_pointer_type
3549 to allow variable declarations of unmanaged pointer types.
3551 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
3554 * ../errors/cs0214.cs : Add.
3556 2002-01-16 Nick Drochak <ndrochak@gol.com>
3558 * makefile: remove 'response' file when cleaning.
3560 2002-01-15 Miguel de Icaza <miguel@ximian.com>
3562 * cs-parser.jay: Report 1524.
3564 2002-01-14 Miguel de Icaza <miguel@ximian.com>
3566 * typemanager.cs (RegisterMethod): drop checking if we have
3567 registered this from here
3569 2002-01-12 Miguel de Icaza <miguel@ximian.com>
3571 * class.cs (Method.EmitDestructor): Implement calling our base
3574 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
3577 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
3578 this routine and will wrap the call in a try/catch block. Deal
3581 2002-01-11 Miguel de Icaza <miguel@ximian.com>
3583 * ecore.cs (Expression.MemberLookup): instead of taking a
3584 parameter `same_type' that was used to tell whether we could
3585 access private members we compute our containing type from the
3588 (FieldExpr): Added partial support for volatile fields. This does
3589 not work for volatile fields exposed from assemblies, as I can not
3590 figure out how to extract the modreq from it.
3592 Updated all the source files to use this.
3594 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
3595 because it is referenced by MemberLookup very often.
3597 2002-01-09 Ravi Pratap <ravi@ximian.com>
3599 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
3600 TypeBuilder.GetCustomAttributes to retrieve what we need.
3602 Get rid of redundant default_member_attr_type as this is the same as
3603 default_member_type which already exists.
3605 * interface.cs, attribute.cs : Update accordingly.
3607 2002-01-08 Miguel de Icaza <miguel@ximian.com>
3609 * typemanager.cs: Enable IndexerPropertyName again. It does not
3610 work for TYpeBuilders though. Ravi, can you please fix this?
3612 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
3614 * expression.cs (Argument.Emit): Handle the case of ref objects
3615 being passed to ref functions;
3617 (ParameterReference.EmitLoad): Loads the content of the pointer
3618 without dereferencing.
3620 2002-01-07 Miguel de Icaza <miguel@ximian.com>
3622 * cs-tokenizer.cs: Implemented the pre-processing expressions.
3624 2002-01-08 Ravi Pratap <ravi@ximian.com>
3626 * class.cs (Indexer.DefineMethod): Incorporate the interface
3627 type in the name of the method if we are doing explicit interface
3630 * expression.cs (ConversionExists): Remove as it is completely obsolete.
3632 (BetterConversion): Fix extremely trivial bug where we were referring to
3633 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
3636 * ../errors/bug16.cs : Add although we have fixed it.
3638 2002-01-07 Miguel de Icaza <miguel@ximian.com>
3640 * expression.cs (BaseIndexer): Begin implementation.
3642 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
3644 * cs-parser.jay (indexer_declarator): Use qualified_identifier
3645 production directly to remove a shift/reduce, and implement
3646 explicit interface implementation.
3648 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
3649 after a floating point suffix.
3651 * expression.cs (DoNumericPromotions): Improved the conversion for
3652 uint/uint. If we have a constant, we avoid doing a typecast to a
3655 * class.cs (Indexer): Implement explicit interface implementation
3658 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
3660 * class.cs: make the default instance constructor public and hidebysig.
3662 2001-01-03 Ravi Pratap <ravi@ximian.com>
3664 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
3665 so we can call it from elsewhere.
3667 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
3668 we emit it internally if the class has a defined indexer; otherwise the user
3669 emits it by decorating the class definition with the DefaultMemberAttribute.
3671 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
3672 attribute is not used on a type which defines an indexer.
3674 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
3675 character when we skip whitespace.
3677 * ../errors/cs0646.cs : Add.
3679 2002-01-03 Miguel de Icaza <miguel@ximian.com>
3681 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
3684 * makefile: Add practical target `mcs3.exe' which builds the third
3685 generation compiler.
3687 * expression.cs (New): Fix structures constructor calling.
3689 * class.cs (Property, Method, Indexer): Emit Final flag on the
3690 method if we are an interface implementation and we are not
3693 * ecore.cs (PropertyExpr): New public field `IsBase', tells
3694 whether this property is referencing a `base' method.
3696 * expression.cs (Invocation.EmitCall): take an extra argument:
3697 is_base, this is used to determine whether the `call' or
3698 `callvirt' opcode should be used.
3701 * delegate.cs: update EmitCall.
3703 * class.cs (Method.Define): Set NewSlot for the cases where we are
3704 not implementing an interface method.
3706 (Property.Define): ditto.
3708 2002-01-02 Miguel de Icaza <miguel@ximian.com>
3710 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
3711 'r'. Allows mcs to parse itself fully.
3713 2002-01-02 Ravi Pratap <ravi@ximian.com>
3715 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
3716 of the number of initializers that require the InitializeArray method.
3718 (CheckIndices): Store the Expression in all cases - not the plain value. Also
3719 update the above field where necessary.
3721 (MakeByteBlob): Update accordingly.
3723 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
3726 (EmitDynamicInitializers): Update in accordance with the new optimization.
3728 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
3729 same OpCode applies.
3731 * cs-parser.jay : Fix some glaring errors I introduced.
3733 2002-01-01 Ravi Pratap <ravi@ximian.com>
3735 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
3736 so that we can check for name clashes there too.
3738 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
3739 for interface indexers.
3741 * interfaces.cs (Define): Emit the default member attribute.
3743 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
3744 variable was being referred to while setting the value ;-)
3746 2002-01-01 Miguel de Icaza <miguel@ximian.com>
3748 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
3749 byte-by-byte information when we know the data is zero.
3751 Make the block always a multiple of 4, because
3752 DefineInitializedData has a bug.
3754 * assign.cs: Fix, we should assign from the temporary, not from
3757 * expression.cs (MakeByteBlob): Fix my incorrect code.
3759 2001-12-31 Miguel de Icaza <miguel@ximian.com>
3761 * typemanager.cs (EnumToUnderlying): This function is used to get
3762 the underlying type from an enumeration, because it does not
3765 * constant.cs: Use the I4_S form for values between -128 and 127.
3767 * statement.cs (Block.LookupLabel): Looks up a label.
3768 (Block): Drop support for labeled blocks.
3770 (LabeledStatement): New kind of statement that represents a label
3773 (Goto): Finally implement this bad boy.
3775 * cs-parser.jay: Update to reflect new mechanism to implement
3778 2001-12-30 Miguel de Icaza <miguel@ximian.com>
3780 * codegen.cs (EmitContext.This): a codegen property that keeps the
3781 a single instance of this instead of creating many different this
3784 * delegate.cs (Delegate.DoResolve): Update to use the property;
3786 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
3788 * expression.cs (BaseAccess.DoResolve): Ditto.
3790 2001-12-29 Ravi Pratap <ravi@ximian.com>
3792 * typemanager.cs (methodimpl_attr_type): Add to hold the type
3793 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
3795 (InitCoreTypes): Update accordingly.
3797 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
3798 so we can quickly store the state.
3800 (ApplyAttributes): Set the correct implementation flags
3801 for InternalCall methods.
3803 2001-12-29 Miguel de Icaza <miguel@ximian.com>
3805 * expression.cs (EmitCall): if a method is not virtual, then do
3806 not use callvirt on it.
3808 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
3809 user defined stuff) requires the use of stobj, which takes an
3810 address on the stack instead of an array and an index. So emit
3811 the Ldelema operation for it.
3813 (EmitStoreOpcode): Use stobj for valuetypes.
3815 (UnaryMutator.EmitCode): Use the right 1 value depending on
3816 whether we are dealing with int64/uint64, float or doubles.
3818 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
3819 constructors that I implemented last night.
3821 (Constructor.IsDefault): Fix to work properly for static
3824 * cs-parser.jay (CheckDef): report method signature errors.
3825 Update error number 103 to be 132.
3827 * decl.cs: New AdditionResult enumeration value: MethodExists.
3828 Although we do this check for methods later on in the semantic
3829 analysis, catching repeated default constructors is so easy that
3830 we catch these here.
3832 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
3835 (ParameterReference.EmitAssign, Emit): handle
3838 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
3839 (ArrayAccess.EmitStoreOpcode): ditto.
3841 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
3843 * expression.cs (MakeByteBlob): Complete all the missing types
3844 (uint, short, ushort, byte, sbyte)
3846 * class.cs: Only init instance field initializers on instance
3849 Rename `constructors' to instance_constructors.
3851 (TypeContainer.AddConstructor): Only add constructors to the list
3852 if it is not static.
3854 Make sure that we handle default_static_constructor independently
3855 everywhere where we handle instance_constructors
3857 2001-12-28 Miguel de Icaza <miguel@ximian.com>
3859 * class.cs: Do not lookup or create a base initializer for a
3862 (ConstructorInitializer.Resolve): use the proper type to lookup
3865 * cs-parser.jay: Report error 1585 (modifiers between type and name).
3867 * enum.cs, interface.cs: Remove CloseType, this is taken care by
3870 * decl.cs: CloseType is now an virtual method, the default
3871 implementation just closes this type.
3873 2001-12-28 Ravi Pratap <ravi@ximian.com>
3875 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
3876 to PreserveSig by default. Also emit HideBySig on such methods.
3878 Basically, set the defaults to standard values.
3880 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
3881 argument, if candidate is better, it can't be worse than the best !
3883 (Invocation): Re-write bits to differentiate between methods being
3884 applicable in their expanded form and their normal form - for params
3887 Get rid of use_standard everywhere as only standard conversions are allowed
3888 in overload resolution.
3890 More spec conformance.
3892 2001-12-27 Miguel de Icaza <miguel@ximian.com>
3894 * driver.cs: Add --timestamp, to see where the compiler spends
3897 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
3898 `this' in static code.
3900 (SimpleName.DoResolve): Implement in terms of a helper function
3901 that allows static-references to be passed upstream to
3904 (Expression.ResolveWithSimpleName): Resolve specially simple
3905 names when called by MemberAccess to implement the special
3908 (Expression.ImplicitReferenceConversion): Handle conversions from
3909 Null to reference types before others, as Null's type is
3912 * expression.cs (Invocation.EmitCall): Handle the special case of
3913 calling methods declared on a reference type from a ValueType
3914 (Base classes System.Object and System.Enum)
3916 (MemberAccess.Resolve): Only perform lookups on Enumerations if
3917 the left hand side is a TypeExpr, not on every enumeration.
3919 (Binary.Resolve): If types are reference types, then do a cast to
3920 object on operators != and == of both arguments.
3922 * typemanager.cs (FindMembers): Extract instance and static
3923 members if requested.
3925 * interface.cs (PopulateProperty): Use void_type instead of null
3926 as the return type for the setter method.
3928 (PopulateIndexer): ditto.
3930 2001-12-27 Ravi Pratap <ravi@ximian.com>
3932 * support.cs (ReflectionParameters): Fix minor bug where we
3933 were examining the wrong parameter for the ParamArray attribute.
3935 Cope with requests for the type of the parameter at position
3936 greater than the params parameter's. We now return the element
3937 type of the params array as that makes more sense.
3939 * expression.cs (Invocation.IsParamsMethodApplicable): Update
3940 accordingly as we no longer have to extract the element type
3943 (Invocation.OverloadResolve): Update.
3945 2001-12-27 Miguel de Icaza <miguel@ximian.com>
3947 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
3948 against IEnumerator, test whether the return value is a descendant
3949 of the IEnumerator interface.
3951 * class.cs (Indexer.Define): Use an auxiliary method to implement
3952 the other bits of the method definition. Begin support for
3953 explicit interface implementation.
3955 (Property.DefineMethod): Use TypeManager.void_type instead of null
3956 for an empty return value.
3958 2001-12-26 Miguel de Icaza <miguel@ximian.com>
3960 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
3961 dealing with a FieldExpr which is composed of a FieldBuilder, in
3962 the code path we did extract the constant, but we should have
3963 obtained the underlying value to be able to cast it (otherwise we
3964 end up in an infinite loop, this is what Ravi was running into).
3966 (ArrayCreation.UpdateIndices): Arrays might be empty.
3968 (MemberAccess.ResolveMemberAccess): Add support for section
3969 14.5.4.1 that deals with the special case of E.I when E is a type
3970 and something else, that I can be a reference to a static member.
3972 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
3973 handle a particular array type to create byte blobs, it is just
3974 something we dont generate byteblobs for.
3976 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
3979 * location.cs (Push): remove the key from the hashtable that we
3980 are about to add. This happens for empty files.
3982 * driver.cs: Dispose files after we have parsed them.
3984 (tokenize): new function that only runs the tokenizer on its
3985 input, for speed testing.
3987 2001-12-26 Ravi Pratap <ravi@ximian.com>
3989 * class.cs (Event.Define): Define the private field only if there
3990 are no accessors defined.
3992 * expression.cs (ResolveMemberAccess): If there is no associated
3993 field with the event, that means we have an event defined with its
3994 own accessors and we should flag error cs0070 since transforming
3995 ourselves into a field is not valid in that case.
3997 * ecore.cs (SimpleName.DoResolve): Same as above.
3999 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
4000 and charset to sane values.
4002 2001-12-25 Ravi Pratap <ravi@ximian.com>
4004 * assign.cs (DoResolve): Perform check on events only if they
4005 are being accessed outside the declaring type.
4007 * cs-parser.jay (event_declarations): Update rules to correctly
4008 set the type of the implicit parameter etc.
4010 (add_accessor, remove_accessor): Set current local parameters.
4012 * expression.cs (Binary): For delegate addition and subtraction,
4013 cast the return value from the method into the appropriate delegate
4016 2001-12-24 Ravi Pratap <ravi@ximian.com>
4018 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
4019 of these as the workaround is unnecessary.
4021 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
4022 delegate data - none of that is needed at all.
4024 Re-write bits to extract the instance expression and the delegate method
4027 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
4030 * attribute.cs (ApplyAttributes): New method to take care of common tasks
4031 of attaching attributes instead of duplicating code everywhere.
4033 * everywhere : Update code to do attribute emission using the above method.
4035 2001-12-23 Miguel de Icaza <miguel@ximian.com>
4037 * expression.cs (IsParamsMethodApplicable): if there are not
4038 parameters, return immediately.
4040 * ecore.cs: The 0 literal can be implicity converted to an enum
4043 (SimpleName.DoResolve): First lookup the type, then lookup the
4046 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
4047 want to get its address. If the InstanceExpression is not
4048 addressable, store the result in a temporary variable, then get
4051 * codegen.cs: Only display 219 errors on warning level or above.
4053 * expression.cs (ArrayAccess): Make it implement the
4054 IMemoryLocation interface.
4056 (Binary.DoResolve): handle the operator == (object a, object b)
4057 and operator != (object a, object b) without incurring into a
4058 BoxedCast (because 5 != o should never be performed).
4060 Handle binary enumerator operators.
4062 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
4063 value type, otherwise use Ldelem_ref.
4065 Use precomputed names;
4067 (AddressOf): Implement address of
4069 * cs-parser.jay (labeled_statement): Fix recursive block
4070 addition by reworking the production.
4072 * expression.cs (New.DoEmit): New has a special case:
4074 If we are dealing with a ValueType, we have a few
4075 situations to deal with:
4077 * The target of New is a ValueType variable, that is
4078 easy, we just pass this as the variable reference
4080 * The target of New is being passed as an argument,
4081 to a boxing operation or a function that takes a
4084 In this case, we need to create a temporary variable
4085 that is the argument of New.
4088 2001-12-23 Ravi Pratap <ravi@ximian.com>
4090 * rootcontext.cs (LookupType): Check that current_type is not null before
4091 going about looking at nested types.
4093 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
4094 not implement the IAssignMethod interface any more.
4096 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
4097 where we tranform them into FieldExprs if they are being resolved from within
4100 * ecore.cs (SimpleName.DoResolve): Do the same here.
4102 * assign.cs (DoResolve, Emit): Clean up code considerably.
4104 * ../errors/bug10.cs : Add.
4106 * ../errors/cs0070.cs : Add.
4108 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
4110 * assign.cs : Get rid of EventIsLocal everywhere.
4112 2001-12-23 Miguel de Icaza <miguel@ximian.com>
4114 * ecore.cs (ConvertIntLiteral): finished the implementation.
4116 * statement.cs (SwitchLabel): Convert the value we are using as a
4117 key before looking up the table.
4119 2001-12-22 Miguel de Icaza <miguel@ximian.com>
4121 * codegen.cs (EmitTopBlock): Require a Location argument now.
4123 * cs-parser.jay (constructor_declarator): We need to setup
4124 current_local_parameters before we parse the
4125 opt_constructor_initializer, to allow the variables to be bound
4126 to the constructor arguments.
4128 * rootcontext.cs (LookupType): First lookup nested classes in our
4129 class and our parents before we go looking outside our class.
4131 * expression.cs (ConstantFold): Extract/debox the values at the
4134 * rootcontext.cs (EmitCode): Resolve the constants first before we
4135 resolve the types. This is not really needed, but it helps debugging.
4137 * statement.cs: report location.
4139 * cs-parser.jay: pass location to throw statement.
4141 * driver.cs: Small bug fix.
4143 * report.cs: Updated format to be 4-zero filled digits.
4145 2001-12-22 Ravi Pratap <ravi@ximian.com>
4147 * expression.cs (CheckIndices): Fix minor bug where the wrong
4148 variable was being referred to ;-)
4150 (DoEmit): Do not call EmitStaticInitializers when the
4151 underlying type is System.Object.
4153 2001-12-21 Ravi Pratap <ravi@ximian.com>
4155 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
4156 and do the usual workaround for SRE.
4158 * class.cs (MyEventBuilder.EventType): New member to get at the type
4159 of the event, quickly.
4161 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
4163 * assign.cs (Assign.DoResolve): Handle the case when the target
4164 is an EventExpr and perform the necessary checks.
4166 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
4169 (SimpleName.MemberStaticCheck): Include check for EventExpr.
4171 (EventExpr): Set the type in the constructor itself since we
4172 are meant to be born fully resolved.
4174 (EventExpr.Define): Revert code I wrote earlier.
4176 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
4177 instance expression is null. The instance expression is a This in that case
4178 or a null, depending on whether it is a static method or not.
4180 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
4181 refers to more than one method.
4183 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
4184 and accordingly flag errors.
4186 2001-12-21 Miguel de Icaza <miguel@ximian.com>
4188 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
4190 2001-12-22 Miguel de Icaza <miguel@ximian.com>
4192 * location.cs (ToString): Provide useful rutine.
4194 2001-12-21 Miguel de Icaza <miguel@ximian.com>
4196 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
4197 objects, return the actual integral boxed.
4199 * statement.cs (SwitchLabel): define an ILLabel for each
4202 (Switch.CheckSwitch): If the value is a Literal, extract
4203 the underlying literal.
4205 Also in the unused hashtable we had, add the SwitchLabel so we can
4206 quickly look this value up.
4208 * constant.cs: Implement a bunch of new constants. Rewrite
4209 Literal based on this. Made changes everywhere to adapt to this.
4211 * expression.cs (Expression.MakeByteBlob): Optimize routine by
4212 dereferencing array only once, and also copes with enumrations.
4214 bytes are two bytes wide, not one.
4216 (Cast): Perform constant conversions.
4218 * ecore.cs (TryImplicitIntConversion): Return literals instead of
4219 wrappers to the literals here.
4221 * expression.cs (DoNumericPromotions): long literals can converted
4222 to ulong implicity (this is taken care of elsewhere, but I was
4225 * ecore.cs (Expression.Literalize): Make the return type Literal,
4226 to improve type checking.
4228 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
4230 2001-12-20 Miguel de Icaza <miguel@ximian.com>
4232 * literal.cs: Revert code from ravi that checked the bounds. The
4233 bounds are sane by the definition of the type itself.
4235 * typemanager.cs: Fix implementation of ImplementsInterface. We
4236 need to actually look up in our parent hierarchy for interfaces
4239 * const.cs: Use the underlying type for enumerations
4241 * delegate.cs: Compute the basename for the delegate creation,
4242 that should fix the delegate test case, and restore the correct
4243 Type Lookup semantics in rootcontext
4245 * rootcontext.cs: Revert Ravi's last patch. The correct way of
4246 referencing a nested type with the Reflection API is using the "+"
4249 * cs-parser.jay: Do not require EOF token at the end.
4251 2001-12-20 Ravi Pratap <ravi@ximian.com>
4253 * rootcontext.cs (LookupType): Concatenate type names with
4254 a '.' instead of a '+' The test suite passes again.
4256 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
4257 field of the enumeration.
4259 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
4260 the case when the member is an EventExpr.
4262 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
4263 static has an associated instance expression.
4265 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
4267 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
4269 * class.cs (Event.Define): Register event and perform appropriate checks
4272 We define the Add and Remove methods even if the use provides none because
4273 in that case, we provide default implementations ourselves.
4275 Define a private field of the type of the event. This is done by the CSC compiler
4276 and we should be doing it too ;-)
4278 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
4279 More methods we use in code we generate.
4281 (multicast_delegate_type, delegate_type): Two separate types since the distinction
4284 (InitCoreTypes): Update accordingly for the above.
4286 * class.cs (Event.Emit): Generate code for default accessors that we provide
4288 (EmitDefaultMethod): Do the job in the above.
4290 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
4293 2001-12-20 Miguel de Icaza <miguel@ximian.com>
4295 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
4296 builders even if we were missing one.
4298 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
4299 pass the Basename as our class name instead of the Name. The
4300 basename will be correctly composed for us.
4302 * parameter.cs (Paramters): Now takes a Location argument.
4304 * decl.cs (DeclSpace.LookupType): Removed convenience function and
4305 make all the code call directly LookupType in RootContext and take
4306 this chance to pass the Location information everywhere.
4308 * Everywhere: pass Location information.
4310 2001-12-19 Miguel de Icaza <miguel@ximian.com>
4312 * class.cs (Constructor.Define): Updated way of detecting the
4313 length of the parameters.
4315 (TypeContainer.DefineType): Use basename as the type name for
4318 (TypeContainer.Define): Do not recursively define types here, as
4319 definition is taken care in order by the RootContext.
4321 * tree.cs: Keep track of namespaces in a per-file basis.
4323 * parameter.cs (Parameter.ComputeSignature): Update to use
4326 (Parameters.GetSignature): ditto.
4328 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
4329 instead of a TypeContainer.
4331 (Interface.SemanticAnalysis): Use `this' instead of our parent to
4332 resolve names. Because we need to be resolve in our context, not
4335 * driver.cs: Implement response files.
4337 * class.cs (TypeContainer.DefineType): If we are defined, do not
4340 (Event.Emit): Emit the code for add/remove handlers.
4341 (Event.Define): Save the MethodBuilders for add/remove.
4343 * typemanager.cs: Use pair here too.
4345 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
4346 DictionaryEntry requires the first argument to be non-null.
4348 (enum_declaration): Compute full name for registering the
4351 (delegate_declaration): Instead of using
4352 formal_parameter_list, use opt_formal_parameter_list as the list
4355 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
4356 (EventParsing): New property that controls whether `add' and
4357 `remove' are returned as tokens or identifiers (for events);
4359 2001-12-19 Ravi Pratap <ravi@ximian.com>
4361 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
4362 use MyEventBuilder only and let it wrap the real builder for us.
4364 (MyEventBuilder): Revamp constructor etc.
4366 Implement all operations that we perform on EventBuilder in precisely the same
4369 (FindMembers): Update to use the EventBuilder member.
4371 (Event.Emit): Update accordingly.
4373 2001-12-18 Ravi Pratap <ravi@ximian.com>
4375 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
4376 by calling the appropriate methods.
4378 (GetCustomAttributes): Make stubs as they cannot possibly do anything
4381 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
4383 2001-12-17 Ravi Pratap <ravi@ximian.com>
4385 * delegate.cs (Delegate.Populate): Check that the return type
4386 and various parameters types are indeed accessible.
4388 * class.cs (Constructor.Define): Same here.
4390 (Field.Define): Ditto.
4392 (Event.Define): Ditto.
4394 (Operator.Define): Check that the underlying Method defined itself
4395 correctly - so it's MethodBuilder should not be null.
4397 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
4398 expression happens to be null.
4400 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
4401 members but as of now we don't seem to be able to do anything really useful with it.
4403 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
4404 not the EventBuilder.
4406 2001-12-18 Miguel de Icaza <miguel@ximian.com>
4408 * cs-tokenizer.cs: Add support for defines.
4409 Add support for #if, #elif, #else, #endif
4411 (eval_var): evaluates a variable.
4412 (eval): stubbed for evaluating functions.
4414 * cs-parser.jay: Pass the defines information
4416 * driver.cs: Add --define command line option.
4418 * decl.cs: Move MemberCore here.
4420 Make it the base class for DeclSpace. This allows us to catch and
4421 report 108 and 109 for everything now.
4423 * class.cs (TypeContainer.Define): Extract all the members
4424 before populating and emit the warning 108 (new keyword required
4425 to override) instead of having each member implement this.
4427 (MemberCore.Define): New abstract method, we will be using this in
4428 the warning reporting engine in Populate.
4430 (Operator.Define): Adjust to new MemberCore protocol.
4432 * const.cs (Const): This does not derive from Expression, it is a
4433 temporary object we use to create fields, it is a MemberCore.
4435 * class.cs (Method.Define): Allow the entry point to be in a
4438 * driver.cs: Rewrite the argument handler to clean it up a bit.
4440 * rootcontext.cs: Made it just an auxiliary namespace feature by
4441 making everything static.
4443 * driver.cs: Adapt code to use RootContext type name instead of
4446 * delegate.cs: Remove RootContext argument.
4448 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
4451 * class.cs (Event.Define): The lookup can fail.
4453 * cs-tokenizer.cs: Begin implementation of pre-procesor.
4455 * expression.cs: Resolve the this instance before invoking the code.
4457 2001-12-17 Miguel de Icaza <miguel@ximian.com>
4459 * cs-parser.jay: Add a production in element_access that allows
4460 the thing to become a "type" reference. This way we can parse
4461 things like "(string [])" as a type.
4463 Note that this still does not handle the more complex rules of
4467 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
4469 * ecore.cs: (CopyNewMethods): new utility function used to
4470 assemble the list of methods from running FindMembers.
4472 (MemberLookup): Rework FindMembers so that
4474 2001-12-16 Miguel de Icaza <miguel@ximian.com>
4476 * class.cs (TypeContainer): Remove Delegates who fail to be
4479 * delegate.cs (Populate): Verify that we dont get null return
4480 values. TODO: Check for AsAccessible.
4482 * cs-parser.jay: Use basename to emit error 574 (destructor should
4483 have the same name as container class), not the full name.
4485 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
4486 possible representation.
4488 Also implements integer type suffixes U and L.
4490 2001-12-15 Miguel de Icaza <miguel@ximian.com>
4492 * expression.cs (ArrayCreation.DoResolve): We need to do the
4493 argument resolution *always*.
4495 * decl.cs: Make this hold the namespace. Hold the root context as
4497 (LookupType): Move here.
4499 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
4501 * location.cs (Row, Name): Fixed the code, it was always returning
4502 references to the first file.
4504 * interface.cs: Register properties defined through interfaces.
4506 * driver.cs: Add support for globbing on the command line
4508 * class.cs (Field): Make it derive from MemberCore as well.
4511 2001-12-15 Ravi Pratap <ravi@ximian.com>
4513 * class.cs (Event::Define): Check that the type of the event is a delegate
4514 type else flag error #66.
4516 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
4519 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
4520 values of EntryPoint, CharSet etc etc.
4522 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
4524 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
4525 be null and we should ignore this. I am not sure if this is really clean. Apparently,
4526 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
4527 which needs this to do its work.
4529 * ../errors/cs0066.cs : Add.
4531 2001-12-14 Miguel de Icaza <miguel@ximian.com>
4533 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
4536 * class.cs: (MethodSignature.MethodSignature): Removed hack that
4537 clears out the parameters field.
4538 (MemberSignatureCompare): Cleanup
4540 (MemberCore): New base class used to share code between MethodCore
4543 (RegisterRequiredImplementations) BindingFlags.Public requires
4544 either BindingFlags.Instace or Static. Use instance here.
4546 (Property): Refactored code to cope better with the full spec.
4548 * parameter.cs (GetParameterInfo): Return an empty array instead
4551 * class.cs (Property): Abstract or extern properties have no bodies.
4553 * parameter.cs (GetParameterInfo): return a zero-sized array.
4555 * class.cs (TypeContainer.MethodModifiersValid): Move all the
4556 method modifier validation to the typecontainer so we can reuse
4559 (MethodCore.ParameterTypes): return an empty sized array of types.
4561 (Property.Define): Test property modifier validity.
4563 Add tests for sealed/override too.
4565 (Method.Emit): abstract or extern methods have no bodies.
4567 2001-12-14 Ravi Pratap <ravi@ximian.com>
4569 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
4572 (Method::Define, ::Emit): Modify accordingly.
4574 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
4576 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
4578 * makefile: Pass in /unsafe.
4580 2001-12-13 Miguel de Icaza <miguel@ximian.com>
4582 * class.cs (MakeKey): Kill routine.
4584 * class.cs (TypeContainer.Define): Correctly define explicit
4585 method implementations (they require the full interface name plus
4588 * typemanager.cs: Deply the PtrHashtable here and stop using the
4589 lame keys. Things work so much better.
4591 This of course broke everyone who depended on `RegisterMethod' to
4592 do the `test for existance' test. This has to be done elsewhere.
4594 * support.cs (PtrHashtable): A hashtable that avoid comparing with
4595 the object stupid Equals method (because, that like fails all over
4596 the place). We still do not use it.
4598 * class.cs (TypeContainer.SetRequiredInterface,
4599 TypeContainer.RequireMethods): Killed these two routines and moved
4600 all the functionality to RegisterRequiredImplementations.
4602 (TypeContainer.RegisterRequiredImplementations): This routine now
4603 registers all the implementations required in an array for the
4604 interfaces and abstract methods. We use an array of structures
4605 which can be computed ahead of time to reduce memory usage and we
4606 also assume that lookups are cheap as most classes will not
4607 implement too many interfaces.
4609 We also avoid creating too many MethodSignatures.
4611 (TypeContainer.IsInterfaceMethod): Update and optionally does not
4612 clear the "pending" bit if we find that there are problems with
4615 (TypeContainer.VerifyPendingMethods): Update to report errors of
4616 methods that look like implementations but are not.
4618 (TypeContainer.Define): Add support for explicit interface method
4621 2001-12-12 Miguel de Icaza <miguel@ximian.com>
4623 * typemanager.cs: Keep track of the parameters here instead of
4624 being a feature of the TypeContainer.
4626 * class.cs: Drop the registration of parameters here, as
4627 InterfaceMethods are also interface declarations.
4629 * delegate.cs: Register methods with the TypeManager not only with
4630 the TypeContainer. This code was buggy.
4632 * interface.cs: Full registation here.
4634 2001-12-11 Miguel de Icaza <miguel@ximian.com>
4636 * expression.cs: Remove reducer for binary expressions, it can not
4639 * const.cs: Put here the code that used to go into constant.cs
4641 * constant.cs: Put here the code for constants, this is a new base
4644 * literal.cs: Make Literal derive from Constant.
4646 2001-12-09 Miguel de Icaza <miguel@ximian.com>
4648 * statement.cs (Return.Emit): Report error 157 if the user
4649 attempts to return from a finally block.
4651 (Return.Emit): Instead of emitting a return, jump to the end of
4654 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
4655 LocalBuilder to store the result of the function. ReturnLabel is
4656 the target where we jump.
4659 2001-12-09 Radek Doulik <rodo@ximian.com>
4661 * cs-parser.jay: remember alias in current namespace
4663 * ecore.cs (SimpleName::DoResolve): use aliases for types or
4666 * class.cs (LookupAlias): lookup alias in my_namespace
4668 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
4670 (LookupAlias): lookup alias in this and if needed in parent
4673 2001-12-08 Miguel de Icaza <miguel@ximian.com>
4677 * rootcontext.cs: (ModuleBuilder) Made static, first step into
4678 making things static. I need this to avoid passing the
4679 TypeContainer when calling ParameterType.
4681 * support.cs (InternalParameters.ParameterType): Remove ugly hack
4682 that did string manipulation to compute the type and then call
4683 GetType. Use Parameter.ParameterType instead.
4685 * cs-tokenizer.cs: Consume the suffix for floating values.
4687 * expression.cs (ParameterReference): figure out whether this is a
4688 reference parameter or not. Kill an extra variable by computing
4689 the arg_idx during emission.
4691 * parameter.cs (Parameters.GetParameterInfo): New overloaded
4692 function that returns whether a parameter is an out/ref value or not.
4694 (Parameter.ParameterType): The type of the parameter (base,
4695 without ref/out applied).
4697 (Parameter.Resolve): Perform resolution here.
4698 (Parameter.ExternalType): The full type (with ref/out applied).
4700 * statement.cs (Using.Emit, Using.EmitExpression): Implement
4701 support for expressions on the using statement.
4703 2001-12-07 Miguel de Icaza <miguel@ximian.com>
4705 * statement.cs (Using.EmitLocalVariableDecls): Split the
4706 localvariable handling of the using statement.
4708 (Block.EmitMeta): Keep track of variable count across blocks. We
4709 were reusing slots on separate branches of blocks.
4711 (Try.Emit): Emit the general code block, we were not emitting it.
4713 Check the type of the declaration to be an IDisposable or
4714 something that can be implicity converted to it.
4716 Emit conversions if required.
4718 * ecore.cs (EmptyExpression): New utility class.
4719 (Expression.ImplicitConversionExists): New utility function.
4721 2001-12-06 Miguel de Icaza <miguel@ximian.com>
4723 * statement.cs (Using): Implement.
4725 * expression.cs (LocalVariableReference): Support read only variables.
4727 * statement.cs: Remove the explicit emit for the Leave opcode.
4728 (VariableInfo): Add a readonly field.
4730 2001-12-05 Miguel de Icaza <miguel@ximian.com>
4732 * ecore.cs (ConvCast): new class used to encapsulate the various
4733 explicit integer conversions that works in both checked and
4736 (Expression.ConvertNumericExplicit): Use new ConvCast class to
4737 properly generate the overflow opcodes.
4739 2001-12-04 Miguel de Icaza <miguel@ximian.com>
4741 * statement.cs: The correct type for the EmptyExpression is the
4742 element_type, not the variable type. Ravi pointed this out.
4744 2001-12-04 Ravi Pratap <ravi@ximian.com>
4746 * class.cs (Method::Define): Handle PInvoke methods specially
4747 by using DefinePInvokeMethod instead of the usual one.
4749 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
4750 above to do the task of extracting information and defining the method.
4752 2001-12-04 Ravi Pratap <ravi@ximian.com>
4754 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
4755 of the condition for string type.
4757 (Emit): Move that here.
4759 (ArrayCreation::CheckIndices): Keep string literals in their expression
4762 (EmitDynamicInitializers): Handle strings appropriately.
4764 2001-12-04 Miguel de Icaza <miguel@ximian.com>
4766 * codegen.cs (EmitContext): Replace multiple variables with a
4767 single pointer to the current Switch statement.
4769 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
4772 2001-12-03 Miguel de Icaza <miguel@ximian.com>
4776 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
4779 (Foreach.Emit): Foreach on arrays was not setting
4780 up the loop variables (for break/continue).
4782 (GotoCase): Semi-implented.
4784 2001-12-03 Ravi Pratap <ravi@ximian.com>
4786 * attribute.cs (CheckAttribute): Handle system attributes by using
4787 Attribute.GetAttributes to examine information we need.
4789 (GetValidPlaces): Same here.
4791 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
4793 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
4795 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
4797 (Method::Define): Set appropriate flags if we have a DllImport attribute.
4799 (Method::Emit): Handle the case when we are a PInvoke method.
4801 2001-12-03 Miguel de Icaza <miguel@ximian.com>
4803 * expression.cs: Use ResolveWithSimpleName on compound names.
4805 2001-12-02 Ravi Pratap <ravi@ximian.com>
4807 * constant.cs (EmitConstant): Make sure we resolve the associated expression
4808 before trying to reduce it.
4810 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
4812 * constant.cs (LookupConstantValue): Implement.
4814 (EmitConstant): Use the above in emitting the constant.
4816 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
4817 that are user-defined by doing a LookupConstantValue on them.
4819 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
4822 2001-11-29 Miguel de Icaza <miguel@ximian.com>
4824 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
4826 (BaseAccess.DoResolve): Implement.
4828 (MemberAccess.DoResolve): Split this routine into a
4829 ResolveMemberAccess routine that can be used independently
4831 2001-11-28 Miguel de Icaza <miguel@ximian.com>
4833 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
4834 As that share bits of the implementation. Is returns a boolean,
4835 while As returns the Type that is being probed.
4837 2001-12-01 Ravi Pratap <ravi@ximian.com>
4839 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
4840 instead of a Literal - much easier.
4842 (EnumInTransit): Remove - utterly useless :-)
4844 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
4846 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
4848 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
4849 chain when we have no associated expression.
4851 2001-11-30 Ravi Pratap <ravi@ximian.com>
4853 * constant.cs (Define): Use Location while reporting the errror.
4855 Also emit a warning when 'new' is used and there is no inherited
4858 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
4861 (LookupEnumValue): Implement to lookup an enum member's value and define it
4864 (Populate): Re-write accordingly to use the above routine.
4866 2001-11-27 Miguel de Icaza <miguel@ximian.com>
4868 * expression.cs (This): Fix prototype for DoResolveLValue to
4869 override the base class DoResolveLValue.
4871 * cs-parser.cs: Report errors cs574 and cs575 (destructor
4874 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
4875 (we need to load the address of the field here). This fixes
4878 (FieldExpr.DoResolveLValue): Call the DoResolve
4879 function to initialize the Instance expression.
4881 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
4882 correctly the GetEnumerator operation on a value type.
4884 * cs-parser.jay: Add more simple parsing error catches.
4886 * statement.cs (Switch): Add support for string switches.
4887 Handle null specially.
4889 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
4891 2001-11-28 Ravi Pratap <ravi@ximian.com>
4893 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
4895 (declare_local_constant): New helper function.
4897 * statement.cs (AddConstant): Keep a separate record of constants
4899 (IsConstant): Implement to determine if a variable is a constant.
4901 (GetConstantExpression): Implement.
4903 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
4905 * statement.cs (IsVariableDefined): Re-write.
4907 2001-11-27 Ravi Pratap <ravi@ximian.com>
4909 * class.cs (TypeContainer::FindMembers): Look for constants
4910 in the case when we are looking for MemberTypes.Field
4912 * expression.cs (MemberAccess::DoResolve): Check that in the
4913 case we are a FieldExpr and a Literal, we are not being accessed
4914 by an instance reference.
4916 * cs-parser.jay (local_constant_declaration): Implement.
4918 (declaration_statement): Implement for constant declarations.
4920 2001-11-26 Miguel de Icaza <miguel@ximian.com>
4922 * statement.cs (Switch): Catch double defaults.
4924 (Switch): More work on the switch() statement
4925 implementation. It works for integral values now, need to finish
4929 2001-11-24 Miguel de Icaza <miguel@ximian.com>
4931 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
4932 integer literals into other integer literals. To be used by
4935 2001-11-24 Ravi Pratap <ravi@ximian.com>
4937 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
4940 (EmitDynamicInitializers): Cope with the above since we extract data
4941 directly from ArrayData now.
4943 (ExpectInitializers): Keep track of whether initializers are mandatory
4946 (Bounds): Make it a hashtable to prevent the same dimension being
4947 recorded for every element in that dimension.
4949 (EmitDynamicInitializers): Fix bug which prevented the Set array method
4952 Also fix bug which was causing the indices to be emitted in the reverse
4955 2001-11-24 Miguel de Icaza <miguel@ximian.com>
4957 * expression.cs (ArrayCreation): Implement the bits that Ravi left
4958 unfinished. They do not work, because the underlying code is
4961 2001-11-22 Miguel de Icaza <miguel@ximian.com>
4963 * cs-parser.jay: Remove bogus fixme.
4965 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
4966 on Switch statement.
4968 2001-11-23 Ravi Pratap <ravi@ximian.com>
4970 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
4973 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
4974 parameter. Apparently, any expression is allowed.
4976 (ValidateInitializers): Update accordingly.
4978 (CheckIndices): Fix some tricky bugs thanks to recursion.
4980 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
4981 I was being completely brain-dead.
4983 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
4984 and re-write acordingly.
4986 (DelegateInvocation): Re-write accordingly.
4988 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
4990 (MakeByteBlob): Handle types more correctly.
4992 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
4993 initialization from expressions but it is incomplete because I am a complete
4996 2001-11-22 Miguel de Icaza <miguel@ximian.com>
4998 * statement.cs (If.Emit): Fix a bug that generated incorrect code
4999 on If. Basically, we have to return `true' (ie, we do return to
5000 our caller) only if both branches of the if return.
5002 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
5003 short-circuit operators, handle them as short circuit operators.
5005 (Cast.DoResolve): Resolve type.
5006 (Cast.Cast): Take an expression as the target type.
5008 * cs-parser.jay (cast_expression): Remove old hack that only
5009 allowed a limited set of types to be handled. Now we take a
5010 unary_expression and we resolve to a type during semantic
5013 Use the grammar productions from Rhys to handle casts (this is
5014 not complete like Rhys syntax yet, we fail to handle that corner
5015 case that C# has regarding (-x), but we will get there.
5017 2001-11-22 Ravi Pratap <ravi@ximian.com>
5019 * class.cs (EmitFieldInitializer): Take care of the case when we have a
5020 field which is an array type.
5022 * cs-parser.jay (declare_local_variables): Support array initialization too.
5024 * typemanager.cs (MakeKey): Implement.
5026 (everywhere): Use the above appropriately.
5028 * cs-parser.jay (for_statement): Update for array initialization while
5029 declaring variables.
5031 * ecore.cs : The error message was correct, it's the variable's names that
5032 were misleading ;-) Make the code more readable.
5034 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
5035 the correct type etc.
5037 (ConvertExplicit): Handle Enum types by examining the underlying type.
5039 2001-11-21 Ravi Pratap <ravi@ximian.com>
5041 * parameter.cs (GetCallingConvention): Always return
5042 CallingConventions.Standard for now.
5044 2001-11-22 Miguel de Icaza <miguel@ximian.com>
5046 * expression.cs (Binary.ResolveOperator): Update the values of `l'
5047 and `r' after calling DoNumericPromotions.
5049 * ecore.cs: Fix error message (the types were in the wrong order).
5051 * statement.cs (Foreach.ProbeCollectionType): Need to pass
5052 BindingFlags.Instance as well
5054 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
5055 implicit int literal conversion in an empty cast so that we
5056 propagate the right type upstream.
5058 (UnboxCast): new class used to unbox value types.
5059 (Expression.ConvertExplicit): Add explicit type conversions done
5062 (Expression.ImplicitNumericConversion): Oops, forgot to test for
5063 the target type before applying the implicit LongLiterals to ULong
5066 2001-11-21 Miguel de Icaza <miguel@ximian.com>
5068 * cs-parser.jay (for_statement): Reworked the way For works: now
5069 we declare manually any variables that are introduced in
5070 for_initializer to solve the problem of having out-of-band code
5071 emition (that is what got for broken).
5073 (declaration_statement): Perform the actual variable declaration
5074 that used to be done in local_variable_declaration here.
5076 (local_variable_declaration): Do not declare anything, just pass
5077 the information on a DictionaryEntry
5079 2001-11-20 Ravi Pratap <ravi@ximian.com>
5081 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
5082 re-write of the logic to now make it recursive.
5084 (UpdateIndices): Re-write accordingly.
5086 Store element data in a separate ArrayData list in the above methods.
5088 (MakeByteBlob): Implement to dump the array data into a byte array.
5090 2001-11-19 Ravi Pratap <ravi@ximian.com>
5092 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
5095 * constant.cs (Define): Implement.
5097 (EmitConstant): Re-write fully.
5099 Pass in location info.
5101 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
5104 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
5105 DictionaryEntry since we need location info too.
5107 (constant_declaration): Update accordingly.
5109 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
5110 code into another method : UpdateIndices.
5112 2001-11-18 Ravi Pratap <ravi@ximian.com>
5114 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
5115 some type checking etc.
5117 2001-11-17 Ravi Pratap <ravi@ximian.com>
5119 * expression.cs (ArrayCreation::ValidateInitializers): Implement
5120 bits to provide dimension info if the user skips doing that.
5122 Update second constructor to store the rank correctly.
5124 2001-11-16 Ravi Pratap <ravi@ximian.com>
5126 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
5127 and try to implement.
5129 * ../errors/cs0150.cs : Add.
5131 * ../errors/cs0178.cs : Add.
5133 2001-11-16 Miguel de Icaza <miguel@ximian.com>
5135 * statement.cs: Implement foreach on multi-dimensional arrays.
5137 * parameter.cs (Parameters.GetParameterByName): Also lookup the
5138 name of the params argument.
5140 * expression.cs: Use EmitStoreOpcode to get the right opcode while
5141 initializing the array.
5143 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
5144 we can use this elsewhere.
5146 * statement.cs: Finish implementation of foreach for single
5149 * cs-parser.jay: Use an out-of-band stack to pass information
5150 around, I wonder why I need this.
5152 foreach_block: Make the new foreach_block the current_block.
5154 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
5155 function used to return a static Parameters structure. Used for
5156 empty parameters, as those are created very frequently.
5158 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
5160 2001-11-15 Ravi Pratap <ravi@ximian.com>
5162 * interface.cs : Default modifier is private, not public. The
5163 make verify test passes again.
5165 2001-11-15 Ravi Pratap <ravi@ximian.com>
5167 * support.cs (ReflectionParameters): Fix logic to determine
5168 whether the last parameter is a params one. Test 9 passes again.
5170 * delegate.cs (Populate): Register the builders we define with
5171 RegisterParameterForBuilder. Test 19 passes again.
5173 * cs-parser.jay (property_declaration): Reference $6 instead
5174 of $$ to get at the location.
5176 (indexer_declaration): Similar stuff.
5180 * class.cs (Property): Register parameters for the Get and Set methods
5181 if they exist. Test 23 passes again.
5183 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
5184 call to EmitArguments as we are sure there aren't any params arguments.
5185 Test 32 passes again.
5187 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
5188 IndexOutOfRangeException.
5190 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
5191 Test 33 now passes again.
5193 2001-11-15 Miguel de Icaza <miguel@ximian.com>
5195 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
5196 broke a bunch of things. Will have to come up with a better way
5197 of tracking locations.
5199 * statement.cs: Implemented foreach for single dimension arrays.
5201 2001-11-09 Miguel de Icaza <miguel@ximian.com>
5203 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
5204 an error. This removes the lookup from the critical path.
5206 * cs-parser.jay: Removed use of temporary_loc, which is completely
5209 2001-11-14 Miguel de Icaza <miguel@ximian.com>
5211 * support.cs (ReflectionParameters.ParameterModifier): Report
5212 whether the argument is a PARAMS argument or not.
5214 * class.cs: Set the attribute `ParamArrayAttribute' on the
5217 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
5218 and cons_param_array_attribute (ConstructorInfo for
5219 ParamArrayAttribute).,
5221 * codegen.cs: Emit the return using the `Return' statement, that
5222 way we can report the error correctly for missing return values.
5224 * class.cs (Method.Emit): Clean up.
5226 * expression.cs (Argument.Resolve): Take another argument: the
5227 location where this argument is used. Notice that this is not
5228 part of the "Argument" class as to reduce the size of the
5229 structure (we know the approximate location anyways).
5231 Test if the argument is a variable-reference, if not, then
5232 complain with a 206.
5234 (Argument.Emit): Emit addresses of variables.
5236 (Argument.FullDesc): Simplify.
5238 (Invocation.DoResolve): Update for Argument.Resolve.
5240 (ElementAccess.DoResolve): ditto.
5242 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
5243 method should be virtual, as this method is always virtual.
5245 (NewDelegate.DoResolve): Update for Argument.Resolve.
5247 * class.cs (ConstructorInitializer.DoResolve): ditto.
5249 * attribute.cs (Attribute.Resolve): ditto.
5251 2001-11-13 Miguel de Icaza <miguel@ximian.com>
5253 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
5255 * expression.cs (ParameterReference): Drop IStackStorage and implement
5256 IAssignMethod instead.
5258 (LocalVariableReference): ditto.
5260 * ecore.cs (FieldExpr): Drop IStackStorage and implement
5261 IAssignMethod instead.
5263 2001-11-13 Miguel de Icaza <miguel@ximian.com>
5265 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
5266 enumerations that are used in heavily used structures derive from
5267 byte in a laughable and pathetic attempt to reduce memory usage.
5268 This is the kind of pre-optimzations that you should not do at
5269 home without adult supervision.
5271 * expression.cs (UnaryMutator): New class, used to handle ++ and
5272 -- separatedly from the other unary operators. Cleans up the
5273 code, and kills the ExpressionStatement dependency in Unary.
5275 (Unary): Removed `method' and `Arguments' from this class, making
5276 it smaller, and moving it all to SimpleCall, so I can reuse this
5277 code in other locations and avoid creating a lot of transient data
5278 strucutres when not required.
5280 * cs-parser.jay: Adjust for new changes.
5282 2001-11-11 Miguel de Icaza <miguel@ximian.com>
5284 * enum.cs (Enum.Populate): If there is a failure during
5287 * cs-parser.jay (opt_enum_base): we used to catch type errors
5288 here, but this is really incorrect. The type error should be
5289 catched during semantic analysis.
5291 2001-12-11 Ravi Pratap <ravi@ximian.com>
5293 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
5294 current_local_parameters as expected since I, in my stupidity, had forgotten
5297 * attribute.cs (GetValidPlaces): Fix stupid bug.
5299 * class.cs (Method::Emit): Perform check on applicability of attributes.
5301 (Constructor::Emit): Ditto.
5303 (Field::Emit): Ditto.
5305 (Field.Location): Store location information.
5307 (Property, Event, Indexer, Operator): Ditto.
5309 * cs-parser.jay (field_declaration): Pass in location for each field.
5311 * ../errors/cs0592.cs : Add.
5313 2001-11-12 Ravi Pratap <ravi@ximian.com>
5315 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
5317 (InitCoreTypes): Update accordingly.
5319 (RegisterAttrType, LookupAttr): Implement.
5321 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
5322 info about the same.
5324 (Resolve): Update to populate the above as necessary.
5328 (GetValidPlaces): Helper to the above.
5330 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
5332 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
5334 2001-11-12 Ravi Pratap <ravi@ximian.com>
5336 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
5338 * ../errors/cs0617.cs : Add.
5340 2001-11-11 Ravi Pratap <ravi@ximian.com>
5342 * enum.cs (Emit): Rename to Populate to be more consistent with what
5343 we expect it to do and when exactly it is called.
5345 * class.cs, rootcontext.cs : Update accordingly.
5347 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
5348 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
5350 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
5352 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
5353 of a fieldinfo using the above, when dealing with a FieldBuilder.
5355 2001-11-10 Ravi Pratap <ravi@ximian.com>
5357 * ../errors/cs0031.cs : Add.
5359 * ../errors/cs1008.cs : Add.
5361 * ../errrors/cs0543.cs : Add.
5363 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
5366 (FindMembers): Implement.
5368 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
5369 enums and delegates too.
5371 (enum_types): Rename to builder_to_enum.
5373 (delegate_types): Rename to builder_to_delegate.
5375 * delegate.cs (FindMembers): Implement.
5377 2001-11-09 Ravi Pratap <ravi@ximian.com>
5379 * typemanager.cs (IsEnumType): Implement.
5381 * enum.cs (Emit): Re-write parts to account for the underlying type
5382 better and perform checking etc.
5384 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
5385 of the underlying type.
5387 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
5390 * enum.cs (error31): Helper to report error #31.
5392 * cs-parser.jay (enum_declaration): Store location of each member too.
5394 * enum.cs (member_to_location): New hashtable.
5396 (AddEnumMember): Update location hashtable.
5398 (Emit): Use the location of each member while reporting errors.
5400 2001-11-09 Miguel de Icaza <miguel@ximian.com>
5402 * cs-parser.jay: A for_initializer if is a
5403 local_variable_declaration really ammount to have an implicit
5404 block with the variable declaration and no initializer for for.
5406 * statement.cs (For.Emit): Cope with null initializers.
5408 This fixes the infinite loop on for initializers.
5410 2001-11-08 Miguel de Icaza <miguel@ximian.com>
5412 * enum.cs: More cleanup.
5414 * ecore.cs: Remove dead code.
5416 * class.cs (Property.Emit): More simplification.
5417 (Event.Emit): ditto.
5419 Reworked to have less levels of indentation.
5421 2001-11-08 Ravi Pratap <ravi@ximian.com>
5423 * class.cs (Property): Emit attributes.
5433 * enum.cs (Emit): Ditto.
5435 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
5438 * class.cs (Field, Event, etc.): Move attribute generation into the
5439 Emit method everywhere.
5441 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
5442 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
5443 as we had no way of defining nested enums !
5445 * rootcontext.cs : Adjust code accordingly.
5447 * typemanager.cs (AddEnumType): To keep track of enum types separately.
5449 2001-11-07 Ravi Pratap <ravi@ximian.com>
5451 * expression.cs (EvalConstantExpression): Move into ecore.cs
5453 * enum.cs (Enum): Rename some members and make them public and readonly
5454 according to our convention.
5456 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
5459 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
5461 (Enum::Emit): Write a simple version for now which doesn't try to compute
5462 expressions. I shall modify this to be more robust in just a while.
5464 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
5466 (TypeContainer::CloseType): Create the Enum types too.
5468 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
5470 * expression.cs (EvalConstantExpression): Get rid of completely.
5472 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
5473 user-defined values and other cases.
5475 (IsValidEnumLiteral): Helper function.
5477 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
5478 out there in the case we had a literal FieldExpr.
5480 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
5482 (Literalize): Revamp a bit to take two arguments.
5484 (EnumLiteral): New class which derives from Literal to wrap enum literals.
5486 2001-11-06 Ravi Pratap <ravi@ximian.com>
5488 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
5490 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
5492 (Resolve): Use the above to ensure we have proper initializers.
5494 2001-11-05 Ravi Pratap <ravi@ximian.com>
5496 * expression.cs (Expression::EvalConstantExpression): New method to
5497 evaluate constant expressions.
5499 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
5501 2001-11-07 Miguel de Icaza <miguel@ximian.com>
5503 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
5506 (Binary.ResolveOperator): Handle operator != (object a, object b)
5507 and operator == (object a, object b);
5509 (Binary.DoNumericPromotions): Indicate whether the numeric
5510 promotion was possible.
5512 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
5515 Made the ArrayAccess implement interface IAssignMethod instead of
5516 IStackStore as the order in which arguments are passed reflects
5519 * assign.cs: Instead of using expr.ExprClass to select the way of
5520 assinging, probe for the IStackStore/IAssignMethod interfaces.
5522 * typemanager.cs: Load InitializeArray definition.
5524 * rootcontext.cs (RootContext.MakeStaticData): Used to define
5525 static data that can be used to initialize arrays.
5527 2001-11-05 Miguel de Icaza <miguel@ximian.com>
5529 * expression.cs: Handle operator== and operator!= for booleans.
5531 (Conditioal.Reduce): Implement reducer for the ?: operator.
5533 (Conditional.Resolve): Implement dead code elimination.
5535 (Binary.Resolve): Catch string literals and return a new
5536 concatenated string.
5538 (Unary.Reduce): Implement reduction of unary expressions.
5540 * ecore.cs: Split out the expression core handling here.
5542 (Expression.Reduce): New method used to perform constant folding
5543 and CSE. This is needed to support constant-expressions.
5545 * statement.cs (Statement.EmitBoolExpression): Pass true and false
5546 targets, and optimize for !x.
5548 2001-11-04 Ravi Pratap <ravi@ximian.com>
5550 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
5551 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
5552 set custom atttributes.
5554 * literal.cs (Literal::GetValue): New abstract method to return the actual
5555 value of the literal, cast as an object.
5557 (*Literal): Implement GetValue method.
5559 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
5560 expressions to the arraylist but objects of type Argument.
5562 * class.cs (TypeContainer::Emit): Emit our attributes too.
5564 (Method::Emit, Constructor::Emit): Ditto.
5566 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
5567 to be ignoring earlier.
5569 2001-11-03 Ravi Pratap <ravi@ximian.com>
5571 * attribute.cs (AttributeSection::Define): Implement to do the business
5572 of constructing a CustomAttributeBuilder.
5574 (Attribute): New trivial class. Increases readability of code.
5576 * cs-parser.jay : Update accordingly.
5578 (positional_argument_list, named_argument_list, named_argument): New rules
5580 (attribute_arguments): Use the above so that we are more correct.
5582 2001-11-02 Ravi Pratap <ravi@ximian.com>
5584 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
5585 to perform all checks for a method with a params parameter.
5587 (Invocation::OverloadResolve): Update to use the above method and therefore
5588 cope correctly with params method invocations.
5590 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
5593 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
5594 constructors in our parent too because we can't afford to miss out on
5597 * attribute.cs (AttributeSection): New name for the class Attribute
5599 Other trivial changes to improve readability.
5601 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
5602 use the new class names.
5604 2001-11-01 Ravi Pratap <ravi@ximian.com>
5606 * class.cs (Method::Define): Complete definition for params types too
5608 (Indexer::Define): Ditto.
5610 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
5611 Cope everywhere with a request for info about the array parameter.
5613 2001-11-01 Ravi Pratap <ravi@ximian.com>
5615 * tree.cs (RecordNamespace): Fix up to check for the correct key.
5617 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
5618 local_variable_type to extract the string corresponding to the type.
5620 (local_variable_type): Fixup the action to use the new helper method.
5622 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
5625 * expression.cs : Clean out code which uses the above.
5627 2001-10-31 Ravi Pratap <ravi@ximian.com>
5629 * typemanager.cs (RegisterMethod): Check if we already have an existing key
5630 and bale out if necessary by returning a false.
5632 (RegisterProperty): Ditto.
5634 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
5635 and print out appropriate error messages.
5637 * interface.cs (everywhere): Ditto.
5639 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
5640 location to constructor.
5642 * class.cs (Property, Event, Indexer): Update accordingly.
5644 * ../errors/cs111.cs : Added.
5646 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
5647 of a method, as laid down by the spec.
5649 (Invocation::OverloadResolve): Use the above method.
5651 2001-10-31 Ravi Pratap <ravi@ximian.com>
5653 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
5654 now take a TypeContainer and a Parameters object.
5656 (ParameterData): Modify return type of ParameterModifier method to be
5657 Parameter.Modifier and not a string.
5659 (ReflectionParameters, InternalParameters): Update accordingly.
5661 * expression.cs (Argument::GetParameterModifier): Same here.
5663 * support.cs (InternalParameters::ParameterType): Find a better way of determining
5664 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
5665 symbol in it at all so maybe this is only for now.
5667 2001-10-30 Ravi Pratap <ravi@ximian.com>
5669 * support.cs (InternalParameters): Constructor now takes an extra argument
5670 which is the actual Parameters class.
5672 (ParameterDesc): Update to provide info on ref/out modifiers.
5674 * class.cs (everywhere): Update call to InternalParameters to pass in
5675 the second argument too.
5677 * support.cs (ParameterData): Add ParameterModifier, which is a method
5678 to return the modifier info [ref/out etc]
5680 (InternalParameters, ReflectionParameters): Implement the above.
5682 * expression.cs (Argument::ParameterModifier): Similar function to return
5683 info about the argument's modifiers.
5685 (Invocation::OverloadResolve): Update to take into account matching modifiers
5688 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
5689 a new SetFormalParameters object which we pass to InternalParameters.
5691 2001-10-30 Ravi Pratap <ravi@ximian.com>
5693 * expression.cs (NewArray): Merge into the ArrayCreation class.
5695 2001-10-29 Ravi Pratap <ravi@ximian.com>
5697 * expression.cs (NewArray): Merge classes NewBuiltinArray and
5698 NewUserdefinedArray into one as there wasn't much of a use in having
5701 * expression.cs (Argument): Change field's name to ArgType from Type.
5703 (Type): New readonly property which returns the proper type, taking into
5704 account ref/out modifiers.
5706 (everywhere): Adjust code accordingly for the above.
5708 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
5709 whether we are emitting for a ref or out parameter.
5711 * expression.cs (Argument::Emit): Use the above field to set the state.
5713 (LocalVariableReference::Emit): Update to honour the flag and emit the
5716 * parameter.cs (Attributes): Set the correct flags for ref parameters.
5718 * expression.cs (Argument::FullDesc): New function to provide a full desc.
5720 * support.cs (ParameterData): Add method ParameterDesc to the interface.
5722 (ReflectionParameters, InternalParameters): Implement the above method.
5724 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
5727 (Invocation::FullMethodDesc): Ditto.
5729 2001-10-29 Miguel de Icaza <miguel@ximian.com>
5731 * cs-parser.jay: Add extra production for the second form of array
5734 * expression.cs (ArrayCreation): Update to reflect the above
5737 * Small changes to prepare for Array initialization.
5739 2001-10-28 Miguel de Icaza <miguel@ximian.com>
5741 * typemanager.cs (ImplementsInterface): interface might be null;
5742 Deal with this problem;
5744 Also, we do store negative hits on the cache (null values), so use
5745 this instead of calling t.GetInterfaces on the type everytime.
5747 2001-10-28 Ravi Pratap <ravi@ximian.com>
5749 * typemanager.cs (IsBuiltinType): New method to help determine the same.
5751 * expression.cs (New::DoResolve): Get rid of array creation code and instead
5752 split functionality out into different classes.
5754 (New::FormArrayType): Move into NewBuiltinArray.
5756 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
5759 (NewBuiltinArray): New class to handle creation of built-in arrays.
5761 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
5762 account creation of one-dimensional arrays.
5764 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
5766 (NewUserdefinedArray::DoResolve): Implement.
5768 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
5770 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
5771 we maintain inside the TypeManager. This is necessary to perform lookups on the
5774 (LookupType): Update to perform GetType on the module builders too.
5776 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
5778 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
5780 2001-10-23 Ravi Pratap <ravi@ximian.com>
5782 * expression.cs (New::DoResolve): Implement guts of array creation.
5784 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
5786 2001-10-27 Miguel de Icaza <miguel@ximian.com>
5788 * expression.cs: Fix bug I introduced lsat night that broke
5791 (Expression.Resolve): Report a 246 error (can not resolve name)
5792 if we find a SimpleName in the stream.
5794 (Expression.ResolveLValue): Ditto.
5796 (Expression.ResolveWithSimpleName): This function is a variant of
5797 ResolveName, this one allows SimpleNames to be returned without a
5798 warning. The only consumer of SimpleNames is MemberAccess
5800 2001-10-26 Miguel de Icaza <miguel@ximian.com>
5802 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
5803 might arrive here. I have my doubts that this is correct.
5805 * statement.cs (Lock): Implement lock statement.
5807 * cs-parser.jay: Small fixes to support `lock' and `using'
5809 * cs-tokenizer.cs: Remove extra space
5811 * driver.cs: New flag --checked, allows to turn on integer math
5814 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
5815 Threading.Monitor.Exit
5817 2001-10-23 Miguel de Icaza <miguel@ximian.com>
5819 * expression.cs (IndexerAccess::DoResolveLValue): Set the
5820 Expression Class to be IndexerAccess.
5822 Notice that Indexer::DoResolve sets the eclass to Value.
5824 2001-10-22 Miguel de Icaza <miguel@ximian.com>
5826 * class.cs (TypeContainer::Emit): Emit code for indexers.
5828 * assign.cs (IAssignMethod): New interface implemented by Indexers
5829 and Properties for handling assignment.
5831 (Assign::Emit): Simplify and reuse code.
5833 * expression.cs (IndexerAccess, PropertyExpr): Implement
5834 IAssignMethod, clean up old code.
5836 2001-10-22 Ravi Pratap <ravi@ximian.com>
5838 * typemanager.cs (ImplementsInterface): New method to determine if a type
5839 implements a given interface. Provides a nice cache too.
5841 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
5844 (ConvertReferenceExplicit): Ditto.
5846 * delegate.cs (Delegate::Populate): Update to define the parameters on the
5847 various methods, with correct names etc.
5849 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
5850 Operator.UnaryNegation.
5852 * cs-parser.jay (operator_declarator): Be a little clever in the case where
5853 we have a unary plus or minus operator.
5855 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
5858 * everywhere : update accordingly.
5860 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
5863 * class.cs (Method::Define): For the case where we are implementing a method
5864 inherited from an interface, we need to set the MethodAttributes.Final flag too.
5865 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
5867 2001-10-21 Ravi Pratap <ravi@ximian.com>
5869 * interface.cs (FindMembers): Implement to work around S.R.E
5872 * typemanager.cs (IsInterfaceType): Implement.
5874 (FindMembers): Update to handle interface types too.
5876 * expression.cs (ImplicitReferenceConversion): Re-write bits which
5877 use IsAssignableFrom as that is not correct - it doesn't work.
5879 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
5880 and accordingly override EmitStatement.
5882 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
5883 using the correct logic :-)
5885 2001-10-19 Ravi Pratap <ravi@ximian.com>
5887 * ../errors/cs-11.cs : Add to demonstrate error -11
5889 2001-10-17 Miguel de Icaza <miguel@ximian.com>
5891 * assign.cs (Assign::Resolve): Resolve right hand side first, and
5892 then pass this as a hint to ResolveLValue.
5894 * expression.cs (FieldExpr): Add Location information
5896 (FieldExpr::LValueResolve): Report assignment to readonly
5899 (Expression::ExprClassFromMemberInfo): Pass location information.
5901 (Expression::ResolveLValue): Add new method that resolves an
5904 (Expression::DoResolveLValue): Default invocation calls
5907 (Indexers): New class used to keep track of indexers in a given
5910 (IStackStore): Renamed from LValue, as it did not really describe
5911 what this did. Also ResolveLValue is gone from this interface and
5912 now is part of Expression.
5914 (ElementAccess): Depending on the element access type
5916 * typemanager.cs: Add `indexer_name_type' as a Core type
5917 (System.Runtime.CompilerServices.IndexerNameAttribute)
5919 * statement.cs (Goto): Take a location.
5921 2001-10-18 Ravi Pratap <ravi@ximian.com>
5923 * delegate.cs (Delegate::VerifyDelegate): New method to verify
5924 if two delegates are compatible.
5926 (NewDelegate::DoResolve): Update to take care of the case when
5927 we instantiate a delegate from another delegate.
5929 * typemanager.cs (FindMembers): Don't even try to look up members
5930 of Delegate types for now.
5932 2001-10-18 Ravi Pratap <ravi@ximian.com>
5934 * delegate.cs (NewDelegate): New class to take care of delegate
5937 * expression.cs (New): Split the delegate related code out into
5938 the NewDelegate class.
5940 * delegate.cs (DelegateInvocation): New class to handle delegate
5943 * expression.cs (Invocation): Split out delegate related code into
5944 the DelegateInvocation class.
5946 2001-10-17 Ravi Pratap <ravi@ximian.com>
5948 * expression.cs (New::DoResolve): Implement delegate creation fully
5949 and according to the spec.
5951 (New::DoEmit): Update to handle delegates differently.
5953 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
5954 because of which we were printing out arguments in reverse order !
5956 * delegate.cs (VerifyMethod): Implement to check if the given method
5957 matches the delegate.
5959 (FullDelegateDesc): Implement.
5961 (VerifyApplicability): Implement.
5963 * expression.cs (Invocation::DoResolve): Update to accordingly handle
5964 delegate invocations too.
5966 (Invocation::Emit): Ditto.
5968 * ../errors/cs1593.cs : Added.
5970 * ../errors/cs1594.cs : Added.
5972 * delegate.cs (InstanceExpression, TargetMethod): New properties.
5974 2001-10-16 Ravi Pratap <ravi@ximian.com>
5976 * typemanager.cs (intptr_type): Core type for System.IntPtr
5978 (InitCoreTypes): Update for the same.
5980 (iasyncresult_type, asynccallback_type): Ditto.
5982 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
5985 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
5988 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
5989 the builders for the 4 members of a delegate type :-)
5991 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
5994 * expression.cs (New::DoResolve): Implement guts for delegate creation.
5996 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
5998 2001-10-15 Miguel de Icaza <miguel@ximian.com>
6000 * statement.cs (Break::Emit): Implement.
6001 (Continue::Emit): Implement.
6003 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
6004 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
6005 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
6006 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
6009 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
6010 properties that track the label for the current loop (begin of the
6011 loop and end of the loop).
6013 2001-10-15 Ravi Pratap <ravi@ximian.com>
6015 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
6016 use of emitting anything at all.
6018 * class.cs, rootcontext.cs : Get rid of calls to the same.
6020 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
6022 (Populate): Define the constructor correctly and set the implementation
6025 * typemanager.cs (delegate_types): New hashtable to hold delegates that
6028 (AddDelegateType): Implement.
6030 (IsDelegateType): Implement helper method.
6032 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
6034 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
6035 and accordingly handle it.
6037 * delegate.cs (Populate): Take TypeContainer argument.
6038 Implement bits to define the Invoke method. However, I still haven't figured out
6039 how to take care of the native int bit :-(
6041 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
6042 Qualify the name of the delegate, not its return type !
6044 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
6047 (StandardConversionExists): Checking for array types turns out to be recursive.
6049 (ConvertReferenceExplicit): Implement array conversion.
6051 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
6053 2001-10-12 Ravi Pratap <ravi@ximian.com>
6055 * cs-parser.jay (delegate_declaration): Store the fully qualified
6056 name as it is a type declaration.
6058 * delegate.cs (ReturnType, Name): Rename members to these. Make them
6061 (DefineDelegate): Renamed from Define. Does the same thing essentially,
6062 as TypeContainer::DefineType.
6064 (Populate): Method in which all the definition of the various methods (Invoke)
6067 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
6070 (CloseDelegate): Finally creates the delegate.
6072 * class.cs (TypeContainer::DefineType): Update to define delegates.
6073 (Populate, Emit and CloseType): Do the same thing here too.
6075 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
6076 delegates in all these operations.
6078 2001-10-14 Miguel de Icaza <miguel@ximian.com>
6080 * expression.cs: LocalTemporary: a new expression used to
6081 reference a temporary that has been created.
6083 * assign.cs: Handle PropertyAccess back here, so that we can
6084 provide the proper semantic access to properties.
6086 * expression.cs (Expression::ConvertReferenceExplicit): Implement
6087 a few more explicit conversions.
6089 * modifiers.cs: `NEW' modifier maps to HideBySig.
6091 * expression.cs (PropertyExpr): Make this into an
6092 ExpressionStatement, and support the EmitStatement code path.
6094 Perform get/set error checking, clean up the interface.
6096 * assign.cs: recognize PropertyExprs as targets, and if so, turn
6097 them into toplevel access objects.
6099 2001-10-12 Miguel de Icaza <miguel@ximian.com>
6101 * expression.cs: PropertyExpr::PropertyExpr: use work around the
6104 * typemanager.cs: Keep track here of our PropertyBuilders again to
6105 work around lameness in SRE.
6107 2001-10-11 Miguel de Icaza <miguel@ximian.com>
6109 * expression.cs (LValue::LValueResolve): New method in the
6110 interface, used to perform a second resolution pass for LValues.
6112 (This::DoResolve): Catch the use of this in static methods.
6114 (This::LValueResolve): Implement.
6116 (This::Store): Remove warning, assigning to `this' in structures
6119 (Invocation::Emit): Deal with invocation of
6120 methods on value types. We need to pass the address to structure
6121 methods rather than the object itself. (The equivalent code to
6122 emit "this" for structures leaves the entire structure on the
6123 stack instead of a pointer to it).
6125 (ParameterReference::DoResolve): Compute the real index for the
6126 argument based on whether the method takes or not a `this' pointer
6127 (ie, the method is static).
6129 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
6130 value types returned from functions when we need to invoke a
6131 method on the sturcture.
6134 2001-10-11 Ravi Pratap <ravi@ximian.com>
6136 * class.cs (TypeContainer::DefineType): Method to actually do the business of
6137 defining the type in the Modulebuilder or Typebuilder. This is to take
6138 care of nested types which need to be defined on the TypeBuilder using
6141 (TypeContainer::GetClassBases): Implement. Essentially the code from the
6142 methods in RootContext, only ported to be part of TypeContainer.
6144 (TypeContainer::GetInterfaceOrClass): Ditto.
6146 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
6148 * interface.cs (Interface::DefineInterface): New method. Does exactly
6149 what RootContext.CreateInterface did earlier, only it takes care of nested types
6152 (Interface::GetInterfaces): Move from RootContext here and port.
6154 (Interface::GetInterfaceByName): Same here.
6156 * rootcontext.cs (ResolveTree): Re-write.
6158 (PopulateTypes): Re-write.
6160 * class.cs (TypeContainer::Populate): Populate nested types too.
6161 (TypeContainer::Emit): Emit nested members too.
6163 * typemanager.cs (AddUserType): Do not make use of the FullName property,
6164 instead just use the name argument passed in as it is already fully
6167 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
6168 to TypeContainer mapping to see if a type is user-defined.
6170 * class.cs (TypeContainer::CloseType): Implement.
6172 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
6173 the default constructor.
6175 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
6178 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
6180 * interface.cs (CloseType): Create the type here.
6182 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
6185 Remove all the methods which are now in TypeContainer.
6187 2001-10-10 Ravi Pratap <ravi@ximian.com>
6189 * delegate.cs (Define): Re-write bits to define the delegate
6192 2001-10-10 Miguel de Icaza <miguel@ximian.com>
6194 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
6196 * expression.cs (ImplicitReferenceConversion): handle null as well
6197 as a source to convert to any reference type.
6199 * statement.cs (Return): Perform any implicit conversions to
6200 expected return type.
6202 Validate use of return statement.
6204 * codegen.cs (EmitContext): Pass the expected return type here.
6206 * class.cs (Method, Constructor, Property): Pass expected return
6207 type to EmitContext.
6209 2001-10-09 Miguel de Icaza <miguel@ximian.com>
6211 * expression.cs: Make DoResolve take an EmitContext instead of a
6214 Replaced `l' and `location' for `loc', for consistency.
6216 (Error, Warning): Remove unneeded Tc argument.
6218 * assign.cs, literal.cs, constant.cs: Update to new calling
6221 * codegen.cs: EmitContext now contains a flag indicating whether
6222 code is being generated in a static method or not.
6224 * cs-parser.jay: DecomposeQI, new function that replaces the old
6225 QualifiedIdentifier. Now we always decompose the assembled
6226 strings from qualified_identifier productions into a group of
6229 2001-10-08 Miguel de Icaza <miguel@ximian.com>
6231 * rootcontext.cs: Deal with field-less struct types correctly now
6232 by passing the size option to Define Type.
6234 * class.cs: Removed hack that created one static field.
6236 2001-10-07 Miguel de Icaza <miguel@ximian.com>
6238 * statement.cs: Moved most of the code generation here.
6240 2001-10-09 Ravi Pratap <ravi@ximian.com>
6242 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
6245 (ElementAccess): Remove useless bits for now - keep checks as the spec
6248 2001-10-08 Ravi Pratap <ravi@ximian.com>
6250 * expression.cs (ElementAccess::DoResolve): Remove my crap code
6251 and start performing checks according to the spec.
6253 2001-10-07 Ravi Pratap <ravi@ximian.com>
6255 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
6256 rank_specifiers instead.
6258 (rank_specifiers): Change the order in which the rank specifiers are stored
6260 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
6262 * expression.cs (ElementAccess): Implement the LValue interface too.
6264 2001-10-06 Ravi Pratap <ravi@ximian.com>
6266 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
6267 except that user defined conversions are not included.
6269 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
6270 perform the conversion of the return type, if necessary.
6272 (New::DoResolve): Check whether we are creating an array or an object
6273 and accordingly do the needful.
6275 (New::Emit): Same here.
6277 (New::DoResolve): Implement guts of array creation.
6279 (New::FormLookupType): Helper function.
6281 2001-10-07 Miguel de Icaza <miguel@ximian.com>
6283 * codegen.cs: Removed most of the code generation here, and move the
6284 corresponding code generation bits to the statement classes.
6286 Added support for try/catch/finalize and throw.
6288 * cs-parser.jay: Added support for try/catch/finalize.
6290 * class.cs: Catch static methods having the flags override,
6291 virtual or abstract.
6293 * expression.cs (UserCast): This user cast was not really doing
6294 what it was supposed to do. Which is to be born in fully resolved
6295 state. Parts of the resolution were being performed at Emit time!
6299 2001-10-05 Miguel de Icaza <miguel@ximian.com>
6301 * expression.cs: Implicity convert the result from UserCast.
6303 2001-10-05 Ravi Pratap <ravi@ximian.com>
6305 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
6306 prevented it from working correctly.
6308 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
6309 merely ConvertImplicit.
6311 2001-10-05 Miguel de Icaza <miguel@ximian.com>
6313 * typemanager.cs: Make the LookupTypeContainer function static,
6314 and not per-instance.
6316 * class.cs: Make static FindMembers (the one that takes a Type
6319 * codegen.cs: Add EmitForeach here.
6321 * cs-parser.jay: Make foreach a toplevel object instead of the
6322 inline expansion, as we need to perform semantic analysis on it.
6324 2001-10-05 Ravi Pratap <ravi@ximian.com>
6326 * expression.cs (Expression::ImplicitUserConversion): Rename to
6327 UserDefinedConversion.
6329 (Expression::UserDefinedConversion): Take an extra argument specifying
6330 whether we look for explicit user conversions too.
6332 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
6334 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
6336 (ExplicitUserConversion): Make it a call to UserDefinedConversion
6337 with the appropriate arguments.
6339 * cs-parser.jay (cast_expression): Record location too.
6341 * expression.cs (Cast): Record location info.
6343 (Expression::ConvertExplicit): Take location argument.
6345 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
6346 to determine if we are doing explicit conversions.
6348 (UserCast::Emit): Update accordingly.
6350 (Expression::ConvertExplicit): Report an error if everything fails.
6352 * ../errors/cs0030.cs : Add.
6354 2001-10-04 Miguel de Icaza <miguel@ximian.com>
6356 * modifiers.cs: If the ABSTRACT keyword is present, also set the
6357 virtual and newslot bits.
6359 * class.cs (TypeContainer::RegisterRequiredImplementations):
6360 Record methods we need.
6362 (TypeContainer::MakeKey): Helper function to make keys for
6363 MethodBases, since the Methodbase key is useless.
6365 (TypeContainer::Populate): Call RegisterRequiredImplementations
6366 before defining the methods.
6368 Create a mapping for method_builders_to_methods ahead of time
6369 instead of inside a tight loop.
6371 (::RequireMethods): Accept an object as the data to set into the
6372 hashtable so we can report interface vs abstract method mismatch.
6374 2001-10-03 Miguel de Icaza <miguel@ximian.com>
6376 * report.cs: Make all of it static.
6378 * rootcontext.cs: Drop object_type and value_type computations, as
6379 we have those in the TypeManager anyways.
6381 Drop report instance variable too, now it is a global.
6383 * driver.cs: Use try/catch on command line handling.
6385 Add --probe option to debug the error reporting system with a test
6388 * report.cs: Add support for exiting program when a probe
6389 condition is reached.
6391 2001-10-03 Ravi Pratap <ravi@ximian.com>
6393 * expression.cs (Binary::DoNumericPromotions): Fix the case when
6394 we do a forcible conversion regardless of type, to check if
6395 ForceConversion returns a null.
6397 (Binary::error19): Use location to report error.
6399 (Unary::error23): Use location here too.
6401 * ../errors/cs0019.cs : Check in.
6403 * ../errors/cs0023.cs : Check in.
6405 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
6406 case of a non-null MethodInfo object with a length of 0 !
6408 (Binary::ResolveOperator): Flag error if overload resolution fails to find
6409 an applicable member - according to the spec :-)
6410 Also fix logic to find members in base types.
6412 (Unary::ResolveOperator): Same here.
6414 (Unary::report23): Change name to error23 and make first argument a TypeContainer
6415 as I was getting thoroughly confused between this and error19 :-)
6417 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
6418 (::FindMostEncompassedType): Implement.
6419 (::FindMostEncompassingType): Implement.
6420 (::StandardConversionExists): Implement.
6422 (UserImplicitCast): Re-vamp. We now need info about most specific
6423 source and target types so that we can do the necessary conversions.
6425 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
6426 mathematical union with no duplicates.
6428 2001-10-03 Miguel de Icaza <miguel@ximian.com>
6430 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
6431 in order from base classes to child classes, so that we can in
6432 child classes look up in our parent for method names and
6433 attributes (required for handling abstract, virtual, new, override
6434 constructs: we need to instrospect our base class, and if we dont
6435 populate the classes in order, the introspection might be
6436 incorrect. For example, a method could query its parent before
6437 the parent has any methods and would determine that the parent has
6438 no abstract methods (while it could have had them)).
6440 (RootContext::CreateType): Record the order in which we define the
6443 2001-10-02 Miguel de Icaza <miguel@ximian.com>
6445 * class.cs (TypeContainer::Populate): Also method definitions can
6446 fail now, keep track of this.
6448 (TypeContainer::FindMembers): Implement support for
6449 DeclaredOnly/noDeclaredOnly flag.
6451 (Constructor::Emit) Return the ConstructorBuilder.
6453 (Method::Emit) Return the MethodBuilder.
6454 Check for abstract or virtual methods to be public.
6456 * rootcontext.cs (RootContext::CreateType): Register all the
6457 abstract methods required for the class to be complete and the
6458 interface methods that must be implemented.
6460 * cs-parser.jay: Report error 501 (method requires body if it is
6461 not marked abstract or extern).
6463 * expression.cs (TypeOf::Emit): Implement.
6465 * typemanager.cs: runtime_handle_type, new global type.
6467 * class.cs (Property::Emit): Generate code for properties.
6469 2001-10-02 Ravi Pratap <ravi@ximian.com>
6471 * expression.cs (Unary::ResolveOperator): Find operators on base type
6472 too - we now conform exactly to the spec.
6474 (Binary::ResolveOperator): Same here.
6476 * class.cs (Operator::Define): Fix minor quirk in the tests.
6478 * ../errors/cs0215.cs : Added.
6480 * ../errors/cs0556.cs : Added.
6482 * ../errors/cs0555.cs : Added.
6484 2001-10-01 Miguel de Icaza <miguel@ximian.com>
6486 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
6487 single integer which is really efficient
6489 2001-10-01 Ravi Pratap <ravi@ximian.com>
6491 * expression.cs (Expression::ImplicitUserConversion): Use location
6492 even in the case when we are examining True operators.
6494 * class.cs (Operator::Define): Perform extensive checks to conform
6495 with the rules for operator overloading in the spec.
6497 * expression.cs (Expression::ImplicitReferenceConversion): Implement
6498 some of the other conversions mentioned in the spec.
6500 * typemanager.cs (array_type): New static member for the System.Array built-in
6503 (cloneable_interface): For System.ICloneable interface.
6505 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
6506 we start resolving the tree and populating types.
6508 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
6510 2001-10-01 Miguel de Icaza <miguel@ximian.com>
6512 * expression.cs (Expression::ExprClassFromMemberInfo,
6513 Expression::Literalize): Create literal expressions from
6514 FieldInfos which are literals.
6516 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
6517 type casts, because they were wrong. The test suite in tests
6520 (ImplicitNumericConversion): ushort to ulong requires a widening
6523 Int32 constant to long requires widening cast as well.
6525 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
6526 for integers because the type on the stack is not i4.
6528 2001-09-30 Miguel de Icaza <miguel@ximian.com>
6530 * expression.cs (report118): require location argument.
6532 * parameter.cs: Do not dereference potential null value.
6534 * class.cs: Catch methods that lack the `new' keyword when
6535 overriding a name. Report warnings when `new' is used without
6536 anything being there to override.
6538 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
6540 * class.cs: Only add constructor to hashtable if it is non-null
6541 (as now constructors can fail on define).
6543 (TypeManager, Class, Struct): Take location arguments.
6545 Catch field instance initialization in structs as errors.
6547 accepting_filter: a new filter for FindMembers that is static so
6548 that we dont create an instance per invocation.
6550 (Constructor::Define): Catch errors where a struct constructor is
6553 * cs-parser.jay: Pass location information for various new
6556 * delegate.cs (Delegate): take a location argument.
6558 * driver.cs: Do not call EmitCode if there were problesm in the
6559 Definition of the types, as many Builders wont be there.
6561 * decl.cs (Decl::Decl): Require a location argument.
6563 * cs-tokenizer.cs: Handle properly hex constants that can not fit
6564 into integers, and find the most appropiate integer for it.
6566 * literal.cs: Implement ULongLiteral.
6568 * rootcontext.cs: Provide better information about the location of
6569 failure when CreateType fails.
6571 2001-09-29 Miguel de Icaza <miguel@ximian.com>
6573 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
6576 * expression.cs (Binary::CheckShiftArguments): Add missing type
6578 (Binary::ResolveOperator): Add type to the logical and and logical
6579 or, Bitwise And/Or and Exclusive Or code paths, it was missing
6582 (Binary::DoNumericPromotions): In the case where either argument
6583 is ulong (and most signed types combined with ulong cause an
6584 error) perform implicit integer constant conversions as well.
6586 2001-09-28 Miguel de Icaza <miguel@ximian.com>
6588 * expression.cs (UserImplicitCast): Method should always be
6590 (Invocation::BetterConversion): Simplified test for IntLiteral.
6592 (Expression::ImplicitNumericConversion): Split this routine out.
6593 Put the code that performs implicit constant integer conversions
6596 (Expression::Resolve): Become a wrapper around DoResolve so we can
6597 check eclass and type being set after resolve.
6599 (Invocation::Badness): Remove this dead function
6601 (Binary::ResolveOperator): Do not compute the expensive argumnets
6602 unless we have a union for it.
6604 (Probe::Emit): Is needs to do an isinst and then
6605 compare against null.
6607 (::CanConvert): Added Location argument. If the Location argument
6608 is null (Location.Null), then we do not report errors. This is
6609 used by the `probe' mechanism of the Explicit conversion. We do
6610 not want to generate an error for something that the user
6611 explicitly requested to be casted. But the pipeline for an
6612 explicit cast first tests for potential implicit casts.
6614 So for now, if the Location is null, it means `Probe only' to
6615 avoid adding another argument. Might have to revise this
6618 (ClassCast): New class used to type cast objects into arbitrary
6619 classes (used in Explicit Reference Conversions).
6621 Implement `as' as well.
6623 Reverted all the patches from Ravi below: they were broken:
6625 * The use of `level' as a mechanism to stop recursive
6626 invocations is wrong. That was there just to catch the
6627 bug with a strack trace but not as a way of addressing
6630 To fix the problem we have to *understand* what is going
6631 on and the interactions and come up with a plan, not
6632 just get things going.
6634 * The use of the type conversion cache that I proposed
6635 last night had an open topic: How does this work across
6636 protection domains. A user defined conversion might not
6637 be public in the location where we are applying the
6638 conversion, a different conversion might be selected
6639 (ie, private A->B (better) but public B->A (worse),
6640 inside A, A->B applies, but outside it, B->A will
6643 * On top of that (ie, even if the above is solved),
6644 conversions in a cache need to be abstract. Ie, `To
6645 convert from an Int to a Short use an OpcodeCast', not
6646 `To convert from an Int to a Short use the OpcodeCast on
6647 the variable 5' (which is what this patch was doing).
6649 2001-09-28 Ravi Pratap <ravi@ximian.com>
6651 * expression.cs (Invocation::ConversionExists): Re-write to use
6652 the conversion cache
6654 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
6655 cache all conversions done, not just user-defined ones.
6657 (Invocation::BetterConversion): The real culprit. Use ConversionExists
6658 to determine if a conversion exists instead of acutually trying to
6659 perform the conversion. It's faster too.
6661 (Expression::ConvertExplicit): Modify to use ConversionExists to check
6662 and only then attempt the implicit conversion.
6664 2001-09-28 Ravi Pratap <ravi@ximian.com>
6666 * expression.cs (ConvertImplicit): Use a cache for conversions
6667 already found. Check level of recursion and bail out if necessary.
6669 2001-09-28 Miguel de Icaza <miguel@ximian.com>
6671 * typemanager.cs (string_concat_string_string, string_concat_object_object):
6672 Export standard methods that we expect for string operations.
6674 * statement.cs (Block::UsageWarning): Track usage of variables and
6675 report the errors for not used variables.
6677 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
6680 2001-09-27 Miguel de Icaza <miguel@ximian.com>
6682 * codegen.cs: remove unnneded code
6684 * expression.cs: Removed BuiltinTypeAccess class
6686 Fix the order in which implicit conversions are
6689 The previous fixed dropped support for boxed conversions (adding a
6690 test to the test suite now)
6692 (UserImplicitCast::CanConvert): Remove test for source being null,
6693 that code is broken. We should not feed a null to begin with, if
6694 we do, then we should track the bug where the problem originates
6695 and not try to cover it up here.
6697 Return a resolved expression of type UserImplicitCast on success
6698 rather than true/false. Ravi: this is what I was talking about,
6699 the pattern is to use a static method as a "constructor" for
6702 Also, do not create arguments until the very last minute,
6703 otherwise we always create the arguments even for lookups that
6704 will never be performed.
6706 (UserImplicitCast::Resolve): Eliminate, objects of type
6707 UserImplicitCast are born in a fully resolved state.
6709 * typemanager.cs (InitCoreTypes): Init also value_type
6712 * expression.cs (Cast::Resolve): First resolve the child expression.
6714 (LValue): Add new method AddressOf to be used by
6717 Change the argument of Store to take an EmitContext instead of an
6718 ILGenerator, because things like FieldExpr need to be able to call
6719 their children expression to generate the instance code.
6721 (Expression::Error, Expression::Warning): Sugar functions for
6724 (Expression::MemberLookup): Accept a TypeContainer instead of a
6725 Report as the first argument.
6727 (Expression::ResolvePrimary): Killed. I still want to improve
6728 this as currently the code is just not right.
6730 (Expression::ResolveMemberAccess): Simplify, but it is still
6733 (Unary::Resolve): Catch errors in AddressOf operators.
6735 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
6736 index to a byte for the short-version, or the compiler will choose
6737 the wrong Emit call, which generates the wrong data.
6739 (ParameterReference::Emit, ::Store): same.
6741 (FieldExpr::AddressOf): Implement.
6743 * typemanager.cs: TypeManager: made public variable instead of
6746 * driver.cs: document --fatal.
6748 * report.cs (ErrorMessage, WarningMessage): new names for the old
6749 Error and Warning classes.
6751 * cs-parser.jay (member_access): Turn built-in access to types
6752 into a normal simplename
6754 2001-09-27 Ravi Pratap <ravi@ximian.com>
6756 * expression.cs (Invocation::BetterConversion): Fix to cope
6757 with q being null, since this was introducing a bug.
6759 * expression.cs (ConvertImplicit): Do built-in conversions first.
6761 2001-09-27 Ravi Pratap <ravi@ximian.com>
6763 * expression.cs (UserImplicitCast::Resolve): Fix bug.
6765 2001-09-27 Ravi Pratap <ravi@ximian.com>
6767 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
6768 I had introduced long ago (what's new ?).
6770 * expression.cs (UserImplicitCast::CanConvert): Static method to do
6771 the work of all the checking.
6772 (ConvertImplicit): Call CanConvert and only then create object if necessary.
6773 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
6775 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
6776 that is the right way.
6778 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
6779 overloading resolution. Use everywhere instead of cutting and pasting code.
6781 (Binary::ResolveOperator): Use MakeUnionSet.
6783 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
6784 we have to convert to bool types. Not complete yet.
6786 2001-09-27 Miguel de Icaza <miguel@ximian.com>
6788 * typemanager.cs (TypeManager::CSharpName): support ushort.
6790 * expression.cs (Expression::TryImplicitIntConversion): Attempts
6791 to provide an expression that performsn an implicit constant int
6792 conversion (section 6.1.6).
6793 (Expression::ConvertImplicitRequired): Reworked to include
6794 implicit constant expression conversions.
6796 (Expression::ConvertNumericExplicit): Finished.
6798 (Invocation::Emit): If InstanceExpression is null, then it means
6799 that we perform a call on this.
6801 2001-09-26 Miguel de Icaza <miguel@ximian.com>
6803 * expression.cs (Unary::Emit): Remove some dead code.
6804 (Probe): Implement Resolve and Emit for `is'.
6805 (Expression::ConvertImplicitRequired): Attempt to do constant
6806 expression conversions here. Maybe should be moved to
6807 ConvertImplicit, but I am not sure.
6808 (Expression::ImplicitLongConstantConversionPossible,
6809 Expression::ImplicitIntConstantConversionPossible): New functions
6810 that tell whether is it possible to apply an implicit constant
6811 expression conversion.
6813 (ConvertNumericExplicit): Started work on explicit numeric
6816 * cs-parser.jay: Update operator constants.
6818 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
6819 (Parameters::GetSignature): Hook up VerifyArgs here.
6820 (Parameters::VerifyArgs): Verifies that no two arguments have the
6823 * class.cs (Operator): Update the operator names to reflect the
6824 ones that the spec expects (as we are just stringizing the
6827 * expression.cs (Unary::ResolveOperator): Fix bug: Use
6828 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
6829 previous usage did only work for our methods.
6830 (Expression::ConvertImplicit): Handle decimal implicit numeric
6831 conversions as well.
6832 (Expression::InternalTypeConstructor): Used to invoke constructors
6833 on internal types for default promotions.
6835 (Unary::Emit): Implement special handling for the pre/post
6836 increment/decrement for overloaded operators, as they need to have
6837 the same semantics as the other operators.
6839 (Binary::ResolveOperator): ditto.
6840 (Invocation::ConversionExists): ditto.
6841 (UserImplicitCast::Resolve): ditto.
6843 2001-09-26 Ravi Pratap <ravi@ximian.com>
6845 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
6846 operator, return after emitting body. Regression tests pass again !
6848 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
6849 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
6850 (Invocation::OverloadResolve): Ditto.
6851 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
6853 * everywhere : update calls to the above methods accordingly.
6855 2001-09-26 Miguel de Icaza <miguel@ximian.com>
6857 * assign.cs (Assign): Make it inherit from ExpressionStatement.
6859 * expression.cs (ExpressionStatement): New base class used for
6860 expressions that can appear in statements, so that we can provide
6861 an alternate path to generate expression that do not leave a value
6864 (Expression::Emit, and all the derivatives): We no longer return
6865 whether a value is left on the stack or not. Every expression
6866 after being emitted leaves a single value on the stack.
6868 * codegen.cs (EmitContext::EmitStatementExpression): Use the
6869 facilties of ExpressionStatement if possible.
6871 * cs-parser.jay: Update statement_expression.
6873 2001-09-25 Miguel de Icaza <miguel@ximian.com>
6875 * driver.cs: Change the wording of message
6877 2001-09-25 Ravi Pratap <ravi@ximian.com>
6879 * expression.cs (Binary::ResolveOperator): Had forgottten to set
6880 the type of the expression to the return type of the method if
6881 we have an overloaded operator match ! The regression tests pass again !
6882 (Unary::ResolveOperator): Ditto.
6884 * expression.cs (Invocation::ConversionExists): Correct the member lookup
6885 to find "op_Implicit", not "implicit" ;-)
6886 (UserImplicitCast): New class to take care of user-defined implicit conversions.
6887 (ConvertImplicit, ForceConversion): Take TypeContainer argument
6889 * everywhere : Correct calls to the above accordingly.
6891 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
6892 (ConvertImplicit): Do user-defined conversion if it exists.
6894 2001-09-24 Miguel de Icaza <miguel@ximian.com>
6896 * assign.cs: track location.
6897 (Resolve): Use implicit conversions on assignment.
6899 * literal.cs: Oops. Not good, Emit of short access values should
6900 pass (Bytes) or the wrong argument will be selected.
6902 * expression.cs (Unary::Emit): Emit code for -expr.
6904 (Unary::ResolveOperator): Handle `Substract' for non-constants
6905 (substract from zero from the non-constants).
6906 Deal with Doubles as well.
6908 (Expression::ConvertImplicitRequired): New routine that reports an
6909 error if no implicit conversion exists.
6911 (Invocation::OverloadResolve): Store the converted implicit
6912 expressions if we make them
6914 2001-09-24 Ravi Pratap <ravi@ximian.com>
6916 * class.cs (ConstructorInitializer): Take a Location argument.
6917 (ConstructorBaseInitializer): Same here.
6918 (ConstructorThisInitializer): Same here.
6920 * cs-parser.jay : Update all calls accordingly.
6922 * expression.cs (Unary, Binary, New): Take location argument.
6923 Update accordingly everywhere.
6925 * cs-parser.jay : Update all calls to the above to take a location
6930 2001-09-24 Ravi Pratap <ravi@ximian.com>
6932 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
6933 (Invocation::BetterConversion): Same here
6934 (Invocation::ConversionExists): Ditto.
6936 (Invocation::ConversionExists): Implement.
6938 2001-09-22 Ravi Pratap <ravi@ximian.com>
6940 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
6941 Also take an additional TypeContainer argument.
6943 * All over : Pass in TypeContainer as argument to OverloadResolve.
6945 * typemanager.cs (CSharpName): Update to check for the string type and return
6948 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
6951 2001-09-21 Ravi Pratap <ravi@ximian.com>
6953 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
6954 (Invocation::BetterFunction): Implement.
6955 (Invocation::BetterConversion): Implement.
6956 (Invocation::ConversionExists): Skeleton, no implementation yet.
6958 Okay, things work fine !
6960 2001-09-21 Miguel de Icaza <miguel@ximian.com>
6962 * typemanager.cs: declare and load enum_type, delegate_type and
6965 * expression.cs (Expression::Emit): Now emit returns a value that
6966 tells whether a value is left on the stack or not. This strategy
6967 might be reveted tomorrow with a mechanism that would address
6968 multiple assignments.
6969 (Expression::report118): Utility routine to report mismatches on
6972 (Unary::Report23): Report impossible type/operator combination
6975 (Unary::IsIncrementableNumber): Whether the type can be
6976 incremented or decremented with add.
6977 (Unary::ResolveOperator): Also allow enumerations to be bitwise
6979 (Unary::ResolveOperator): Implement ++, !, ~,
6981 (Invocation::Emit): Deal with new Emit convetion.
6983 * All Expression derivatives: Updated their Emit method to return
6984 whether they leave values on the stack or not.
6986 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
6987 stack for expressions that are statements.
6989 2001-09-20 Miguel de Icaza <miguel@ximian.com>
6991 * expression.cs (LValue): New interface. Must be implemented by
6993 (LocalVariableReference, ParameterReference, FieldExpr): Implement
6996 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
6997 interface for generating code, simplifies the code.
6999 2001-09-20 Ravi Pratap <ravi@ximian.com>
7001 * expression.cs (everywhere): Comment out return statements in ::Resolve
7002 methods to avoid the warnings.
7004 2001-09-20 Miguel de Icaza <miguel@ximian.com>
7006 * driver.cs (parse): Report error 2001 if we can not open the
7009 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
7012 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
7015 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
7016 otherwise nested blocks end up with the same index.
7018 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
7020 * expression.cs: Instead of having FIXMEs in the Resolve
7021 functions, throw exceptions so it is obvious that we are facing a
7024 * cs-parser.jay (invocation_expression): Pass Location information.
7026 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
7027 Use a basename for those routines because .NET does not like paths
7030 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
7033 2001-09-19 Miguel de Icaza <miguel@ximian.com>
7035 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
7036 are loading the correct data types (throws an exception if not).
7037 (TypeManager::InitCoreTypes): Use CoreLookupType
7039 * expression.cs (Unary::ResolveOperator): return the child
7040 expression for expressions which are just +expr.
7041 (Unary::ResolveOperator): Return negative literals for -LITERAL
7042 expressions (otherwise they are Unary {Literal}).
7043 (Invocation::Badness): Take into account `Implicit constant
7044 expression conversions'.
7046 * literal.cs (LongLiteral): Implement long literal class.
7047 (IntLiteral): export the `Value' of the intliteral.
7049 2001-09-19 Ravi Pratap <ravi@ximian.com>
7051 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
7053 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
7054 instead of 'Operator'
7056 * expression.cs (Binary::ResolveOperator): Update accordingly.
7057 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
7060 * cs-parser.jay (unary_expression): Update to use the new names.
7062 * gen-treedump.cs (GetUnary): Same here.
7064 * expression.cs (Unary::Resolve): Implement.
7065 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
7066 operators are found instead of making noise ;-)
7067 (Unary::ResolveOperator): New method to do precisely the same thing which
7068 Binary::ResolveOperator does for Binary expressions.
7069 (Unary.method, .Arguments): Add.
7070 (Unary::OperName): Implement.
7071 (Unary::ForceConversion): Copy and Paste !
7073 * class.cs (Operator::Define): Fix a small bug for the case when we have
7076 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
7077 for the inbuilt operators. Only overloading works for now ;-)
7079 2001-09-18 Miguel de Icaza <miguel@ximian.com>
7081 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
7082 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
7084 * expression.cs (This::Emit): Implement.
7085 (This::Resolve): Implement.
7086 (TypeOf:Resolve): Implement.
7087 (Expression::ResolveSimpleName): Add an implicit this to instance
7089 (MemberAccess::Resolve): Deal with Parameters and Fields.
7090 Bind instance variable to Field expressions.
7091 (FieldExpr::Instance): New field used to track the expression that
7092 represents the object instance.
7093 (FieldExpr::Resolve): Track potential errors from MemberLookup not
7095 (FieldExpr::Emit): Implement.
7097 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
7098 the last instruction contains a return opcode to avoid generating
7099 the last `ret' instruction (this generates correct code, and it is
7100 nice to pass the peverify output).
7102 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
7103 initializer for static and instance variables.
7104 (Constructor::Emit): Allow initializer to be null in the case of
7105 static constructors. Only emit initializer for instance
7108 (TypeContainer::FindMembers): Return a null array if there are no
7111 Also fix the code for the MemberTypes.Method branch, as it was not
7112 scanning that for operators (or tried to access null variables before).
7114 * assign.cs (Assign::Emit): Handle instance and static fields.
7118 * driver.cs: Stop compilation if there are parse errors.
7120 * cs-parser.jay (constructor_declaration): Provide default base
7121 initializer for non-static constructors.
7122 (constructor_declarator): Do not provide a default base
7123 initializers if none was specified.
7124 Catch the fact that constructors should not have parameters.
7126 * class.cs: Do not emit parent class initializers for static
7127 constructors, that should be flagged as an error.
7129 2001-09-18 Ravi Pratap <ravi@ximian.com>
7131 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
7132 Move back code into TypeContainer::Populate.
7134 2001-09-18 Ravi Pratap <ravi@ximian.com>
7136 * class.cs (TypeContainer::AddConstructor): Fix the check to
7137 compare against Name, not Basename.
7138 (Operator::OpType): Change Plus and Minus to Add and Subtract.
7140 * cs-parser.jay : Update accordingly.
7142 * class.cs (TypeContainer::FindMembers): For the case where we are searching
7143 for methods, don't forget to look into the operators too.
7144 (RegisterMethodBuilder): Helper method to take care of this for
7145 methods, constructors and operators.
7146 (Operator::Define): Completely revamp.
7147 (Operator.OperatorMethod, MethodName): New fields.
7148 (TypeContainer::Populate): Move the registering of builders into
7149 RegisterMethodBuilder.
7150 (Operator::Emit): Re-write.
7152 * expression.cs (Binary::Emit): Comment out code path to emit method
7153 invocation stuff for the case when we have a user defined operator. I am
7154 just not able to get it right !
7156 2001-09-17 Miguel de Icaza <miguel@ximian.com>
7158 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
7161 (Expression::MemberLookup): Provide a version that allows to
7162 specify the MemberTypes and BindingFlags.
7164 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
7165 so it was not fetching variable information from outer blocks.
7167 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
7168 Beforefieldinit as it was buggy.
7170 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
7173 * class.cs (Constructor::Emit): Only emit if block is not null.
7174 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
7175 deal with this by semantically definining it as if the user had
7178 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
7179 constructors as we now "emit" them at a higher level.
7181 (TypeContainer::DefineDefaultConstructor): Used to define the
7182 default constructors if none was provided.
7184 (ConstructorInitializer): Add methods Resolve and Emit.
7186 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
7188 2001-09-17 Ravi Pratap <ravi@ximian.com>
7190 * class.cs (TypeContainer::EmitDefaultConstructor): Register
7191 the default constructor builder with our hashtable for methodbuilders
7194 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
7195 and argument_count is 0 in which case we have a match.
7196 (Binary::ResolveOperator): More null checking and miscellaneous coding
7199 2001-09-17 Ravi Pratap <ravi@ximian.com>
7201 * rootcontext.cs (IsNameSpace): Compare against null.
7203 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
7205 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
7206 and Unary::Operator.
7208 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
7211 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
7212 we have overloaded operators.
7213 (Binary::ResolveOperator): Implement the part which does the operator overload
7216 * class.cs (Operator::Emit): Implement.
7217 (TypeContainer::Emit): Emit the operators we have too.
7219 * expression.cs (Binary::Emit): Update to emit the appropriate code for
7220 the case when we have a user-defined operator.
7222 2001-09-17 Miguel de Icaza <miguel@ximian.com>
7224 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
7226 2001-09-16 Ravi Pratap <ravi@ximian.com>
7228 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
7229 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
7230 (Constructor::Emit): Implement.
7231 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
7232 if we have no work to do.
7233 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
7236 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
7237 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
7239 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
7242 2001-09-15 Ravi Pratap <ravi@ximian.com>
7244 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
7246 (Tree::RecordNamespace): Method to do what the name says ;-)
7247 (Tree::Namespaces): Property to get at the namespaces hashtable.
7249 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
7252 * rootcontext.cs (IsNamespace): Fixed it :-)
7254 2001-09-14 Miguel de Icaza <miguel@ximian.com>
7256 * class.cs (TypeContainer::FindMembers): Add support for
7258 (MethodCore): New class that encapsulates both the shared aspects
7259 of a Constructor and a Method.
7260 (Method, Constructor): Factored pieces into MethodCore.
7262 * driver.cs: Added --fatal which makes errors throw exceptions.
7263 Load System assembly as well as part of the standard library.
7265 * report.cs: Allow throwing exceptions on errors for debugging.
7267 * modifiers.cs: Do not use `parent', instead use the real type
7268 container to evaluate permission settings.
7270 * class.cs: Put Ravi's patch back in. He is right, and we will
7271 have to cope with the
7273 2001-09-14 Ravi Pratap <ravi@ximian.com>
7275 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
7276 FamORAssem, not FamANDAssem.
7278 2001-09-14 Miguel de Icaza <miguel@ximian.com>
7280 * driver.cs: Added --parse option that only parses its input files
7283 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
7284 incorrect. IsTopLevel is not used to tell whether an object is
7285 root_types or not (that can be achieved by testing this ==
7286 root_types). But to see if this is a top-level *class* (not
7287 necessarly our "toplevel" container).
7289 2001-09-14 Ravi Pratap <ravi@ximian.com>
7291 * enum.cs (Enum::Define): Modify to call the Lookup method on the
7292 parent instead of a direct call to GetType.
7294 2001-09-14 Ravi Pratap <ravi@ximian.com>
7296 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
7297 Modifiers.TypeAttr. This should just be a call to that method.
7299 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
7300 object so that we can determine if we are top-level or not.
7302 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
7305 * enum.cs (Enum::Define): Ditto.
7307 * modifiers.cs (FieldAttr): Re-write.
7309 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
7310 (TypeContainer::HaveStaticConstructor): New property to provide access
7311 to precisely that info.
7313 * modifiers.cs (MethodAttr): Re-write.
7314 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
7316 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
7317 of top-level types as claimed.
7319 2001-09-13 Miguel de Icaza <miguel@ximian.com>
7321 * expression.cs (MemberLookup): Fruitless attempt to lookup
7322 constructors. Maybe I need to emit default constructors? That
7323 might be it (currently .NET emits this for me automatically).
7324 (Invocation::OverloadResolve): Cope with Arguments == null.
7325 (Invocation::EmitArguments): new function, shared by the new
7327 (Invocation::Emit): Handle static and instance methods. Emit
7328 proper call instruction for virtual or non-virtual invocations.
7329 (New::Emit): Implement.
7330 (New::Resolve): Implement.
7331 (MemberAccess:Resolve): Implement.
7332 (MethodGroupExpr::InstanceExpression): used conforming to the spec
7334 (FieldExpr::Resolve): Set type.
7336 * support.cs: Handle empty arguments.
7338 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
7339 SimpleLookup): Auxiliary routines to help parse a qualifier
7342 Update qualifier_identifier rule.
7344 * codegen.cs: Removed debugging messages.
7346 * class.cs: Make this a global thing, this acts just as a "key" to
7347 objects that we might have around.
7349 (Populate): Only initialize method_builders_to_methods once.
7351 * expression.cs (PropertyExpr): Initialize type from the
7354 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
7355 Resolve pattern. Attempt to implicitly convert value to boolean.
7358 * expression.cs: Set the type for the int32/int32 argument case.
7359 (Binary::ResolveOperator): Set the return type to boolean for
7360 comparission operators
7362 * typemanager.cs: Remove debugging print code.
7364 (Invocation::Resolve): resolve type.
7366 * class.cs: Allocate a MemberInfo of the correct size, as the code
7367 elsewhere depends on the test to reflect the correct contents.
7369 (Method::) Keep track of parameters, due to System.Reflection holes
7371 (TypeContainer::Populate): Keep track of MethodBuilders to Method
7374 (TypeContainer::FindMembers): Use ArrayList and then copy an array
7375 of the exact size and return that.
7377 (Class::LookupMethodByBuilder): New function that maps
7378 MethodBuilders to its methods. Required to locate the information
7379 on methods because System.Reflection bit us again.
7381 * support.cs: New file, contains an interface ParameterData and
7382 two implementations: ReflectionParameters and InternalParameters
7383 used to access Parameter information. We will need to grow this
7386 * expression.cs (Invocation::GetParameterData): implement a cache
7387 and a wrapper around the ParameterData creation for methods.
7388 (Invocation::OverloadResolve): Use new code.
7390 2001-09-13 Ravi Pratap <ravi@ximian.com>
7392 * class.cs (TypeContainer::EmitField): Remove and move into
7393 (Field::Define): here and modify accordingly.
7394 (Field.FieldBuilder): New member.
7395 (TypeContainer::Populate): Update accordingly.
7396 (TypeContainer::FindMembers): Implement.
7398 2001-09-13 Miguel de Icaza <miguel@ximian.com>
7400 * statement.cs: (VariableInfo::VariableType): New field to be
7401 initialized with the full type once it is resolved.
7403 2001-09-12 Miguel de Icaza <miguel@ximian.com>
7405 * parameter.cs (GetParameterInfo): Use a type cache to compute
7406 things only once, and to reuse this information
7408 * expression.cs (LocalVariableReference::Emit): Implement.
7409 (OpcodeCast::Emit): fix.
7411 (ParameterReference::Resolve): Implement.
7412 (ParameterReference::Emit): Implement.
7414 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
7415 that are expressions need to stay as Expressions.
7417 * typemanager.cs (CSharpName): Returns the C# name of a type if
7420 * expression.cs (Expression::ConvertImplicit): New function that
7421 implements implicit type conversions.
7423 (Expression::ImplicitReferenceConversion): Implements implicit
7424 reference conversions.
7426 (EmptyCast): New type for transparent casts.
7428 (OpcodeCast): New type for casts of types that are performed with
7429 a sequence of bytecodes.
7431 (BoxedCast): New type used for casting value types into reference
7432 types. Emits a box opcode.
7434 (Binary::DoNumericPromotions): Implements numeric promotions of
7435 and computation of the Binary::Type.
7437 (Binary::EmitBranchable): Optimization.
7439 (Binary::Emit): Implement code emission for expressions.
7441 * typemanager.cs (TypeManager): Added two new core types: sbyte
7444 2001-09-12 Ravi Pratap <ravi@ximian.com>
7446 * class.cs (TypeContainer::FindMembers): Method which does exactly
7447 what Type.FindMembers does, only we don't have to use reflection. No
7450 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
7451 typecontainer objects as we need to get at them.
7452 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
7454 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
7455 typecontainer object.
7457 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
7458 of just a Report object.
7460 2001-09-11 Ravi Pratap <ravi@ximian.com>
7462 * class.cs (Event::Define): Go back to using the prefixes "add_" and
7464 (TypeContainer::Populate): Now define the delegates of the type too.
7465 (TypeContainer.Delegates): Property to access the list of delegates defined
7468 * delegates.cs (Delegate::Define): Implement partially.
7470 * modifiers.cs (TypeAttr): Handle more flags.
7472 2001-09-11 Ravi Pratap <ravi@ximian.com>
7474 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
7476 (Operator::Define): Re-write logic to get types by using the LookupType method
7477 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
7478 (Indexer::Define): Ditto.
7479 (Event::Define): Ditto.
7480 (Property::Define): Ditto.
7482 2001-09-10 Ravi Pratap <ravi@ximian.com>
7484 * class.cs (TypeContainer::Populate): Now define operators too.
7485 (TypeContainer.Operators): New property to access the list of operators
7487 (Operator.OperatorMethodBuilder): New member to hold the method builder
7488 for the operator we are defining.
7489 (Operator::Define): Implement.
7491 2001-09-10 Ravi Pratap <ravi@ximian.com>
7493 * class.cs (Event::Define): Make the prefixes of the accessor methods
7494 addOn_ and removeOn_
7496 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
7497 of the location being passed in too. Ideally, this should go later since all
7498 error reporting should be done through the Report object.
7500 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
7501 (Populate): Iterate thru the indexers we have and define them too.
7502 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
7503 for the get and set accessors.
7504 (Indexer::Define): Implement.
7506 2001-09-09 Miguel de Icaza <miguel@ximian.com>
7508 * expression.cs (Binary::Resolve): Beginning of it. I scratched
7509 my previous implementation, did not work.
7511 * typemanager.cs: Add a couple of missing types (the longs).
7513 * literal.cs: Use TypeManager.bool_type instead of getting it.
7515 * expression.cs (EventExpr): New kind of expressions.
7516 (Expressio::ExprClassFromMemberInfo): finish
7518 2001-09-08 Miguel de Icaza <miguel@ximian.com>
7520 * assign.cs: Emit stores to static fields differently.
7522 2001-09-08 Ravi Pratap <ravi@ximian.com>
7524 * Merge in changes and adjust code to tackle conflicts. Backed out my
7525 code in Assign::Resolve ;-)
7527 2001-09-08 Ravi Pratap <ravi@ximian.com>
7529 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
7530 instead Report.Error and also pass in the location.
7531 (CSharpParser::Lexer): New readonly property to return the reference
7532 to the Tokenizer object.
7533 (declare_local_variables): Use Report.Error with location instead of plain
7537 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
7538 (Operator.CheckBinaryOperator): Ditto.
7540 * cs-parser.jay (operator_declarator): Update accordingly.
7542 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
7543 (CheckBinaryOperator): Same here.
7545 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
7546 on the name without any prefixes of namespace names etc. This is because we
7547 already might have something already fully qualified like
7548 'System.Console.WriteLine'
7550 * assign.cs (Resolve): Begin implementation. Stuck ;-)
7552 2001-09-07 Ravi Pratap <ravi@ximian.com>
7554 * cs-tokenizer.cs (location): Return a string which also contains
7557 * expression.cs (ElementAccess): New class for expressions of the
7558 type 'element access.'
7559 (BaseAccess): New class for expressions of the type 'base access.'
7560 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
7563 * cs-parser.jay (element_access): Implement action.
7564 (base_access): Implement actions.
7565 (checked_expression, unchecked_expression): Implement.
7567 * cs-parser.jay (local_variable_type): Correct and implement.
7568 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
7570 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
7572 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
7573 name and the specifiers.
7575 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
7577 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
7578 making them all public ;-)
7580 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
7583 2001-09-07 Miguel de Icaza <miguel@ximian.com>
7585 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
7587 (FieldExpr, PropertyExprs): New resolved expressions.
7588 (SimpleName::MemberStaticCheck): Perform static checks for access
7589 to non-static fields on static methods. Maybe this should be
7590 generalized for MemberAccesses.
7591 (SimpleName::ResolveSimpleName): More work on simple name
7594 * cs-parser.jay (primary_expression/qualified_identifier): track
7595 the parameter index.
7597 * codegen.cs (CodeGen::Save): Catch save exception, report error.
7598 (EmitContext::EmitBoolExpression): Chain to expression generation
7599 instead of temporary hack.
7600 (::EmitStatementExpression): Put generic expression code generation.
7602 * assign.cs (Assign::Emit): Implement variable assignments to
7603 local variables, parameters and fields.
7605 2001-09-06 Miguel de Icaza <miguel@ximian.com>
7607 * statement.cs (Block::GetVariableInfo): New method, returns the
7608 VariableInfo for a variable name in a block.
7609 (Block::GetVariableType): Implement in terms of GetVariableInfo
7611 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
7612 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
7614 2001-09-06 Ravi Pratap <ravi@ximian.com>
7616 * cs-parser.jay (operator_declaration): Continue on my quest : update
7617 to take attributes argument.
7618 (event_declaration): Ditto.
7619 (enum_declaration): Ditto.
7620 (indexer_declaration): Ditto.
7622 * class.cs (Operator::Operator): Update constructor accordingly.
7623 (Event::Event): Ditto.
7625 * delegate.cs (Delegate::Delegate): Same here.
7627 * enum.cs (Enum::Enum): Same here.
7629 2001-09-05 Ravi Pratap <ravi@ximian.com>
7631 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
7633 * ../tests/cs0658.cs : New file to demonstrate error 0658.
7635 * attribute.cs (Attributes): New class to encapsulate all attributes which were
7636 being passed around as an arraylist.
7637 (Attributes::AddAttribute): Method to add attribute sections.
7639 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
7640 (struct_declaration): Update accordingly.
7641 (constant_declaration): Update.
7642 (field_declaration): Update.
7643 (method_header): Update.
7644 (fixed_parameter): Update.
7645 (parameter_array): Ditto.
7646 (property_declaration): Ditto.
7647 (destructor_declaration): Ditto.
7649 * class.cs (Struct::Struct): Update constructors accordingly.
7650 (Class::Class): Ditto.
7651 (Field::Field): Ditto.
7652 (Method::Method): Ditto.
7653 (Property::Property): Ditto.
7654 (TypeContainer::OptAttribute): update property's return type.
7656 * interface.cs (Interface.opt_attributes): New member.
7657 (Interface::Interface): Update to take the extra Attributes argument.
7659 * parameter.cs (Parameter::Parameter): Ditto.
7661 * constant.cs (Constant::Constant): Ditto.
7663 * interface.cs (InterfaceMemberBase): New OptAttributes field.
7664 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
7665 the attributes as a parameter.
7666 (InterfaceProperty): Update constructor call.
7667 (InterfaceEvent): Ditto.
7668 (InterfaceMethod): Ditto.
7669 (InterfaceIndexer): Ditto.
7671 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
7672 pass the attributes too.
7673 (interface_event_declaration): Ditto.
7674 (interface_property_declaration): Ditto.
7675 (interface_method_declaration): Ditto.
7676 (interface_declaration): Ditto.
7678 2001-09-05 Miguel de Icaza <miguel@ximian.com>
7680 * class.cs (Method::Define): Track the "static Main" definition to
7681 create an entry point.
7683 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
7684 EntryPoint if we find it.
7686 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
7687 (EmitContext::ig): Make this variable public.
7689 * driver.cs: Make the default output file be the first file name
7690 with the .exe extension.
7692 Detect empty compilations
7694 Handle various kinds of output targets. Handle --target and
7695 rename -t to --dumper.
7697 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
7698 methods inherited from Expression return now an Expression. This
7699 will is used during the tree rewriting as we resolve them during
7702 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
7703 the spec. Missing entirely is the information about
7704 accessability of elements of it.
7706 (Expression::ExprClassFromMemberInfo): New constructor for
7707 Expressions that creates a fully initialized Expression based on
7708 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
7711 (Invocation::Resolve): Begin implementing resolution of invocations.
7713 * literal.cs (StringLiteral): Implement Emit.
7715 2001-09-05 Ravi Pratap <ravi@ximian.com>
7717 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
7720 2001-09-04 Ravi Pratap <ravi@ximian.com>
7722 * cs-parser.jay (attribute_arguments): Implement actions.
7723 (attribute): Fix bug in production. Implement action.
7724 (attribute_list): Implement.
7725 (attribute_target): Implement.
7726 (attribute_target_specifier, opt_target_specifier): Implement
7727 (CheckAttributeTarget): New method to check if the attribute target
7729 (attribute_section): Implement.
7730 (opt_attributes): Implement.
7732 * attribute.cs : New file to handle attributes.
7733 (Attribute): Class to hold attribute info.
7735 * cs-parser.jay (opt_attribute_target_specifier): Remove production
7736 (attribute_section): Modify production to use 2 different rules to
7737 achieve the same thing. 1 s/r conflict down !
7738 Clean out commented, useless, non-reducing dimension_separator rules.
7740 * class.cs (TypeContainer.attributes): New member to hold list
7741 of attributes for a type.
7742 (Struct::Struct): Modify to take one more argument, the attribute list.
7743 (Class::Class): Ditto.
7744 (Field::Field): Ditto.
7745 (Method::Method): Ditto.
7746 (Property::Property): Ditto.
7748 * cs-parser.jay (struct_declaration): Update constructor call to
7749 pass in the attributes too.
7750 (class_declaration): Ditto.
7751 (constant_declaration): Ditto.
7752 (field_declaration): Ditto.
7753 (method_header): Ditto.
7754 (fixed_parameter): Ditto.
7755 (parameter_array): Ditto.
7756 (property_declaration): Ditto.
7758 * constant.cs (Constant::Constant): Update constructor similarly.
7759 Use System.Collections.
7761 * parameter.cs (Parameter::Parameter): Update as above.
7763 2001-09-02 Ravi Pratap <ravi@ximian.com>
7765 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
7766 (TypeContainer.delegates): New member to hold list of delegates.
7768 * cs-parser.jay (delegate_declaration): Implement the action correctly
7769 this time as I seem to be on crack ;-)
7771 2001-09-02 Miguel de Icaza <miguel@ximian.com>
7773 * rootcontext.cs (RootContext::IsNamespace): new function, used to
7774 tell whether an identifier represents a namespace.
7776 * expression.cs (NamespaceExpr): A namespace expression, used only
7777 temporarly during expression resolution.
7778 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
7779 utility functions to resolve names on expressions.
7781 2001-09-01 Miguel de Icaza <miguel@ximian.com>
7783 * codegen.cs: Add hook for StatementExpressions.
7785 * class.cs: Fix inverted test for static flag in methods.
7787 2001-09-02 Ravi Pratap <ravi@ximian.com>
7789 * class.cs (Operator::CheckUnaryOperator): Correct error number used
7790 to make it coincide with MS' number.
7791 (Operator::CheckBinaryOperator): Ditto.
7793 * ../errors/errors.txt : Remove error numbers added earlier.
7795 * ../errors/cs1019.cs : Test case for error # 1019
7797 * ../errros/cs1020.cs : Test case for error # 1020
7799 * cs-parser.jay : Clean out commented cruft.
7800 (dimension_separators, dimension_separator): Comment out. Ostensibly not
7801 used anywhere - non-reducing rule.
7802 (namespace_declarations): Non-reducing rule - comment out.
7804 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
7805 with TypeContainer::AddEnum.
7807 * delegate.cs : New file for delegate handling classes.
7808 (Delegate): Class for declaring delegates.
7810 * makefile : Update.
7812 * cs-parser.jay (delegate_declaration): Implement.
7814 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
7816 * class.cs (Event::Define): Implement.
7817 (Event.EventBuilder): New member.
7819 * class.cs (TypeContainer::Populate): Update to define all enums and events
7821 (Events): New property for the events arraylist we hold. Shouldn't we move to using
7822 readonly fields for all these cases ?
7824 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
7826 * class.cs (Property): Revamp to use the convention of making fields readonly.
7827 Accordingly modify code elsewhere.
7829 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
7830 the Define method of the Property class.
7832 * class.cs : Clean up applied patch and update references to variables etc. Fix
7834 (TypeContainer::Populate): Update to define all the properties we have. Also
7835 define all enumerations.
7837 * enum.cs (Define): Implement.
7839 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
7841 * cs-parser.jay (overloadable_operator): The semantic value is an
7842 enum of the Operator class.
7843 (operator_declarator): Implement actions.
7844 (operator_declaration): Implement.
7846 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
7847 validity of definitions.
7848 (Operator::CheckBinaryOperator): Static method to check for binary operators
7849 (TypeContainer::AddOperator): New method to add an operator to a type.
7851 * cs-parser.jay (indexer_declaration): Added line to actually call the
7852 AddIndexer method so it gets added ;-)
7854 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
7855 already taken care of by the MS compiler ?
7857 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
7859 * class.cs (Operator): New class for operator declarations.
7860 (Operator::OpType): Enum for the various operators.
7862 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
7864 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
7865 ostensibly handle this in semantic analysis.
7867 * cs-parser.jay (general_catch_clause): Comment out
7868 (specific_catch_clauses, specific_catch_clause): Ditto.
7869 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
7870 (catch_args, opt_catch_args): New productions.
7871 (catch_clause): Rewrite to use the new productions above
7872 (catch_clauses): Modify accordingly.
7873 (opt_catch_clauses): New production to use in try_statement
7874 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
7875 and re-write the code in the actions to extract the specific and
7876 general catch clauses by being a little smart ;-)
7878 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
7879 Hooray, try and catch statements parse fine !
7881 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
7883 * statement.cs (Block::GetVariableType): Fix logic to extract the type
7884 string from the hashtable of variables.
7886 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
7887 I end up making that mistake ;-)
7888 (catch_clauses): Fixed gross error which made Key and Value of the
7889 DictionaryEntry the same : $1 !!
7891 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
7893 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
7895 * cs-parser.jay (event_declaration): Correct to remove the semicolon
7896 when the add and remove accessors are specified.
7898 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
7900 * cs-parser.jay (IndexerDeclaration): New helper class to hold
7901 information about indexer_declarator.
7902 (indexer_declarator): Implement actions.
7903 (parsing_indexer): New local boolean used to keep track of whether
7904 we are parsing indexers or properties. This is necessary because
7905 implicit_parameters come into picture even for the get accessor in the
7907 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
7909 * class.cs (Indexer): New class for indexer declarations.
7910 (TypeContainer::AddIndexer): New method to add an indexer to a type.
7911 (TypeContainer::indexers): New member to hold list of indexers for the
7914 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
7916 * cs-parser.jay (add_accessor_declaration): Implement action.
7917 (remove_accessor_declaration): Implement action.
7918 (event_accessors_declaration): Implement
7919 (variable_declarators): swap statements for first rule - trivial.
7921 * class.cs (Event): New class to hold information about event
7923 (TypeContainer::AddEvent): New method to add an event to a type
7924 (TypeContainer::events): New member to hold list of events.
7926 * cs-parser.jay (event_declaration): Implement actions.
7928 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
7930 * cs-parser.jay (dim_separators): Implement. Make it a string
7931 concatenating all the commas together, just as they appear.
7932 (opt_dim_separators): Modify accordingly
7933 (rank_specifiers): Update accordingly. Basically do the same
7934 thing - instead, collect the brackets here.
7935 (opt_rank_sepcifiers): Modify accordingly.
7936 (array_type): Modify to actually return the complete type string
7937 instead of ignoring the rank_specifiers.
7938 (expression_list): Implement to collect the expressions
7939 (variable_initializer): Implement. We make it a list of expressions
7940 essentially so that we can handle the array_initializer case neatly too.
7941 (variable_initializer_list): Implement.
7942 (array_initializer): Make it a list of variable_initializers
7943 (opt_array_initializer): Modify accordingly.
7945 * expression.cs (New::NType): Add enumeration to help us
7946 keep track of whether we have an object/delegate creation
7947 or an array creation.
7948 (New:NewType, New::Rank, New::Indices, New::Initializers): New
7949 members to hold data about array creation.
7950 (New:New): Modify to update NewType
7951 (New:New): New Overloaded contructor for the array creation
7954 * cs-parser.jay (array_creation_expression): Implement to call
7955 the overloaded New constructor.
7957 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
7959 * class.cs (TypeContainer::Constructors): Return member
7960 constructors instead of returning null.
7962 2001-08-26 Miguel de Icaza <miguel@ximian.com>
7964 * typemanager.cs (InitCoreTypes): Initialize the various core
7965 types after we have populated the type manager with the user
7966 defined types (this distinction will be important later while
7967 compiling corlib.dll)
7969 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
7970 on Expression Classification. Now all expressions have a method
7971 `Resolve' and a method `Emit'.
7973 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
7974 generation from working. Also add some temporary debugging
7977 2001-08-24 Miguel de Icaza <miguel@ximian.com>
7979 * codegen.cs: Lots of code generation pieces. This is only the
7980 beginning, will continue tomorrow with more touches of polish. We
7981 handle the fundamentals of if, while, do, for, return. Others are
7982 trickier and I need to start working on invocations soon.
7984 * gen-treedump.cs: Bug fix, use s.Increment here instead of
7987 * codegen.cs (EmitContext): New struct, used during code
7988 emission to keep a context. Most of the code generation will be
7991 * cs-parser.jay: Add embedded blocks to the list of statements of
7992 this block. So code generation proceeds in a top down fashion.
7994 2001-08-23 Miguel de Icaza <miguel@ximian.com>
7996 * statement.cs: Add support for multiple child blocks.
7998 2001-08-22 Miguel de Icaza <miguel@ximian.com>
8000 * codegen.cs (EmitCode): New function, will emit the code for a
8001 Block of code given a TypeContainer and its ILGenerator.
8003 * statement.cs (Block): Standard public readonly optimization.
8004 (Block::Block constructors): Link children.
8005 (Block::Child): Child Linker.
8006 (Block::EmitVariables): Emits IL variable declarations.
8008 * class.cs: Drop support for MethodGroups here, delay until
8010 (Method::): Applied the same simplification that I did before, and
8011 move from Properties to public readonly fields.
8012 (Method::ParameterTypes): Returns the parameter types for the
8013 function, and implements a cache that will be useful later when I
8014 do error checking and the semantic analysis on the methods is
8016 (Constructor::GetCallingConvention): Renamed from CallingConvetion
8017 and made a method, optional argument tells whether this is a class
8018 or a structure to apply the `has-this' bit.
8019 (Method::GetCallingConvention): Implement, returns the calling
8021 (Method::Define): Defines the type, a second pass is performed
8022 later to populate the methods.
8024 (Constructor::ParameterTypes): implement a cache similar to the
8025 one on Method::ParameterTypes, useful later when we do semantic
8028 (TypeContainer::EmitMethod): New method. Emits methods.
8030 * expression.cs: Removed MethodGroup class from here.
8032 * parameter.cs (Parameters::GetCallingConvention): new method.
8034 2001-08-21 Miguel de Icaza <miguel@ximian.com>
8036 * class.cs (TypeContainer::Populate): Drop RootContext from the
8039 (Constructor::CallingConvention): Returns the calling convention.
8040 (Constructor::ParameterTypes): Returns the constructor parameter
8043 (TypeContainer::AddConstructor): Keep track of default constructor
8044 and the default static constructor.
8046 (Constructor::) Another class that starts using `public readonly'
8047 instead of properties.
8049 (Constructor::IsDefault): Whether this is a default constructor.
8051 (Field::) use readonly public fields instead of properties also.
8053 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
8054 track of static constructors; If none is used, turn on
8055 BeforeFieldInit in the TypeAttributes.
8057 * cs-parser.jay (opt_argument_list): now the return can be null
8058 for the cases where there are no arguments.
8060 (constructor_declarator): If there is no implicit `base' or
8061 `this', then invoke the default parent constructor.
8063 * modifiers.cs (MethodAttr): New static function maps a set of
8064 modifiers flags into a MethodAttributes enum
8065 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
8066 MethodAttr, TypeAttr to represent the various mappings where the
8068 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
8070 2001-08-19 Miguel de Icaza <miguel@ximian.com>
8072 * parameter.cs (GetParameterInfo): Fix bug where there would be no
8075 * interface.cs (PopulateIndexer): Implemented the code generator
8076 for interface indexers.
8078 2001-08-17 Miguel de Icaza <miguel@ximian.com>
8080 * interface.cs (InterfaceMemberBase): Now we track the new status
8083 (PopulateProperty): Implement property population. Woohoo! Got
8084 Methods and Properties going today.
8086 Removed all the properties for interfaces, and replaced them with
8087 `public readonly' fields.
8089 2001-08-16 Miguel de Icaza <miguel@ximian.com>
8091 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
8092 initialize their hashtables/arraylists only when they are needed
8093 instead of doing this always.
8095 * parameter.cs: Handle refs and out parameters.
8097 * cs-parser.jay: Use an ArrayList to construct the arguments
8098 instead of the ParameterCollection, and then cast that to a
8101 * parameter.cs: Drop the use of ParameterCollection and use
8102 instead arrays of Parameters.
8104 (GetParameterInfo): Use the Type, not the Name when resolving
8107 2001-08-13 Miguel de Icaza <miguel@ximian.com>
8109 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
8110 and instead use public readonly fields.
8112 * class.cs: Put back walking code for type containers.
8114 2001-08-11 Miguel de Icaza <miguel@ximian.com>
8116 * class.cs (MakeConstant): Code to define constants.
8118 * rootcontext.cs (LookupType): New function. Used to locate types
8121 2001-08-08 Miguel de Icaza <miguel@ximian.com>
8123 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
8124 this System.Reflection code is. Kudos to Microsoft
8126 * typemanager.cs: Implement a type cache and avoid loading all
8127 types at boot time. Wrap in LookupType the internals. This made
8128 the compiler so much faster. Wow. I rule!
8130 * driver.cs: Make sure we always load mscorlib first (for
8131 debugging purposes, nothing really important).
8133 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
8134 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
8136 * rootcontext.cs: Lookup types on their namespace; Lookup types
8137 on namespaces that have been imported using the `using' keyword.
8139 * class.cs (TypeContainer::TypeAttr): Virtualize.
8140 (Class::TypeAttr): Return attributes suitable for this bad boy.
8141 (Struct::TypeAttr): ditto.
8142 Handle nested classes.
8143 (TypeContainer::) Remove all the type visiting code, it is now
8144 replaced with the rootcontext.cs code
8146 * rootcontext.cs (GetClassBases): Added support for structs.
8148 2001-08-06 Miguel de Icaza <miguel@ximian.com>
8150 * interface.cs, statement.cs, class.cs, parameter.cs,
8151 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
8152 Drop use of TypeRefs, and use strings instead.
8154 2001-08-04 Miguel de Icaza <miguel@ximian.com>
8158 * class.cs (Struct::Struct): set the SEALED flags after
8159 checking the modifiers.
8160 (TypeContainer::TypeAttr): new property, returns the
8161 TypeAttributes for a class.
8163 * cs-parser.jay (type_list): Oops, list production was creating a
8164 new list of base types.
8166 * rootcontext.cs (StdLib): New property.
8167 (GetInterfaceTypeByName): returns an interface by type name, and
8168 encapsulates error handling here.
8169 (GetInterfaces): simplified.
8170 (ResolveTree): Encapsulated all the tree resolution here.
8171 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
8174 * driver.cs: Add support for --nostdlib, to avoid loading the
8176 (Main): Do not put tree resolution here.
8178 * rootcontext.cs: Beginning of the class resolution.
8180 2001-08-03 Miguel de Icaza <miguel@ximian.com>
8182 * rootcontext.cs: Provide better error reporting.
8184 * cs-parser.jay (interface_base): set our $$ to be interfaces.
8186 * rootcontext.cs (CreateInterface): Handle the case where there
8187 are no parent interfaces.
8189 (CloseTypes): Routine to flush types at the end.
8190 (CreateInterface): Track types.
8191 (GetInterfaces): Returns an array of Types from the list of
8194 * typemanager.c (AddUserType): Mechanism to track user types (puts
8195 the type on the global type hash, and allows us to close it at the
8198 2001-08-02 Miguel de Icaza <miguel@ximian.com>
8200 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
8201 RecordInterface instead.
8203 * cs-parser.jay: Updated to reflect changes above.
8205 * decl.cs (Definition): Keep track of the TypeBuilder type that
8206 represents this type here. Not sure we will use it in the long
8207 run, but wont hurt for now.
8209 * driver.cs: Smaller changes to accomodate the new code.
8211 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
8214 * rootcontext.cs (CreateInterface): New method, used to create
8215 the System.TypeBuilder type for interfaces.
8216 (ResolveInterfaces): new entry point to resolve the interface
8218 (CodeGen): Property, used to keep track of the code generator.
8220 2001-07-26 Miguel de Icaza <miguel@ximian.com>
8222 * cs-parser.jay: Add a second production for delegate_declaration
8225 (enum_body): Put an opt_comma here instead of putting it on
8226 enum_body or enum_member_declarations so we can handle trailing
8227 commas on enumeration members. Gets rid of a shift/reduce.
8229 (type_list): Need a COMMA in the middle.
8231 (indexer_declaration): Tell tokenizer to recognize get/set
8233 * Remove old targets.
8235 * Re-add the parser target.
8237 2001-07-13 Simon Cozens <simon@simon-cozens.org>
8239 * cs-parser.jay: Add precendence rules for a number of operators
8240 ot reduce the number of shift/reduce conflicts in the grammar.
8242 2001-07-17 Miguel de Icaza <miguel@ximian.com>
8244 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
8247 Get rid of old crufty code.
8249 * rootcontext.cs: Use this to keep track of the parsed
8250 representation and the defined types available to the program.
8252 * gen-treedump.cs: adjust for new convention.
8254 * type.cs: Split out the type manager, and the assembly builder
8257 * typemanager.cs: the type manager will live here now.
8259 * cil-codegen.cs: And the code generator here.
8261 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
8263 * makefile: Fixed up for easy making.
8265 2001-07-13 Simon Cozens <simon@simon-cozens.org>
8267 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
8270 (unary_expression): Expand pre_increment_expression and
8271 post_decrement_expression to reduce a shift/reduce.
8273 2001-07-11 Simon Cozens
8275 * cs-tokenizer.cs: Hex numbers should begin with a 0.
8277 Improve allow_keyword_as_indent name.
8279 2001-06-19 Miguel de Icaza <miguel@ximian.com>
8281 * Adjustments for Beta2.
8283 2001-06-13 Miguel de Icaza <miguel@ximian.com>
8285 * decl.cs: Added `Define' abstract method.
8286 (InTransit): new property, used to catch recursive definitions.
8288 * interface.cs: Implement `Define'.
8290 * modifiers.cs: Map Modifiers.constants to
8291 System.Reflection.TypeAttribute flags.
8293 * class.cs: Keep track of types and user-defined types.
8294 (BuilderInit): New method for creating an assembly
8295 (ResolveType): New function to launch the resolution process, only
8296 used by interfaces for now.
8298 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
8299 that are inserted into the name space.
8301 2001-06-08 Miguel de Icaza <miguel@ximian.com>
8303 * ARGH. I have screwed up my tree so many times due to the use of
8304 rsync rather than using CVS. Going to fix this at once.
8306 * driver.cs: Objetify driver. Load assemblies, use assemblies to
8309 2001-06-07 Miguel de Icaza <miguel@ximian.com>
8311 * Experiment successful: Use System.Type rather that our own
8314 2001-05-25 Miguel de Icaza <miguel@ximian.com>
8316 * cs-parser.jay: Removed nsAliases from here.
8318 Use new namespaces, handle `using XXX;'
8320 * namespace.cs: Reimplemented namespace handling, use a recursive
8321 definition of the class. Now we can keep track of using clauses
8322 and catch invalid using clauses.
8324 2001-05-24 Miguel de Icaza <miguel@ximian.com>
8326 * gen-treedump.cs: Adapted for all the renaming.
8328 * expression.cs (Expression): this class now has a Type property
8329 which returns an expression Type.
8331 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
8332 `Type', as this has a different meaning now in the base
8334 2001-05-22 Miguel de Icaza <miguel@ximian.com>
8336 * interface.cs, class.cs: Removed from all the sources the
8337 references to signature computation, as we can not do method
8338 signature computation during the parsing time, as we are not
8339 trying to solve at that point distinguishing:
8343 void a (NS.Blah x) {}
8346 Which depending on the context might be valid or not, as we do not
8347 know if Blah is the same thing as NS.Blah at that point.
8349 * Redid everything so the code uses TypeRefs now instead of
8350 Types. TypeRefs are just temporary type placeholders, that need
8351 to be resolved. They initially have a pointer to a string and the
8352 current scope in which they are used. This is used later by the
8353 compiler to resolve the reference to an actual Type.
8355 * DeclSpace is no longer a CIR.Type, and neither are
8356 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
8357 are all DeclSpaces, but no Types.
8359 * type.cs (TypeRefManager): This implements the TypeRef manager,
8360 which keeps track of all the types that need to be resolved after
8361 the parsing has finished.
8363 2001-05-13 Miguel de Icaza <miguel@ximian.com>
8365 * ARGH. We are going to have to store `foreach' as a class rather
8366 than resolving it, as we need to verify error 1579 after name
8367 resolution. *OR* we could keep a flag that says `This request to
8368 IEnumerator comes from a foreach statement' which we can then use
8369 to generate the error.
8371 2001-05-10 Miguel de Icaza <miguel@ximian.com>
8373 * class.cs (TypeContainer.AddMethod): we now add methods to the
8374 MethodGroup instead of the method hashtable.
8376 * expression.cs: Add MethodGroup abstraction, which gets us one
8377 step closer to the specification in the way we handle method
8380 * cs-parser.jay (primary_expression): qualified_identifier now
8381 tried to match up an identifier to a local variable reference or
8382 to a parameter reference.
8384 current_local_parameters is now a parser global variable that
8385 points to the current parameters for the block, used during name
8388 (property_declaration): Now creates an implicit `value' argument to
8391 2001-05-09 Miguel de Icaza <miguel@ximian.com>
8393 * parameter.cs: Do not use `param' arguments as part of the
8394 signature, per the spec.
8396 2001-05-08 Miguel de Icaza <miguel@ximian.com>
8398 * decl.cs: Base class for classes, structs and interfaces. This
8399 is the "Declaration Space"
8401 * cs-parser.jay: Use CheckDef for checking declaration errors
8402 instead of having one on each function.
8404 * class.cs: Factor out some code for handling error handling in
8405 accordance to the "Declarations" section in the "Basic Concepts"
8406 chapter in the ECMA C# spec.
8408 * interface.cs: Make all interface member classes derive from
8409 InterfaceMemberBase.
8411 2001-05-07 Miguel de Icaza <miguel@ximian.com>
8413 * Many things: all interfaces are parsed and generated in
8414 gen-treedump. Support for member variables, constructors,
8415 destructors, properties, constants is there.
8417 Beginning of the IL backend, but very little done, just there for
8420 2001-04-29 Miguel de Icaza <miguel@ximian.com>
8422 * cs-parser.jay: Fix labeled statement.
8424 * cs-tokenizer.cs (escape): Escape " and ' always.
8425 ref_line, ref_name: keep track of the line/filename as instructed
8426 by #line by the compiler.
8429 2001-04-27 Miguel de Icaza <miguel@ximian.com>
8431 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
8432 to match the values in System.CodeDOM.
8434 Divid renamed to Divide.
8436 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
8438 (Statements.set): remove.
8440 * System.CodeDOM/CodeCatchClause.cs: always have a valid
8443 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
8444 falseStatements always have valid values.
8446 * cs-parser.jay: Use System.CodeDOM now.