1 2004-03-29 Martin Baulig <martin@ximian.com>
3 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
6 2004-03-24 Martin Baulig <martin@ximian.com>
8 * decl.cs (DeclSpace.FindType): Also use
9 TypeManager.CheckGeneric() for types from the using clauses.
11 2004-03-23 Martin Baulig <martin@ximian.com>
13 * expression.cs (Invocation.OverloadResolve): Added `bool
14 may_fail' argument and use it instead of the Location.IsNull() hack.
16 2004-03-23 Martin Baulig <martin@ximian.com>
18 * expression.cs (Invocation.InferType): Use correct type inference
21 2004-03-23 Martin Baulig <martin@ximian.com>
23 * ecore.cs (MethodGroupExpr.Name): Use
24 TypeManager.CSharpSignature() instead of just the name.
26 * expression.cs (Invocation.OverloadResolve): Provide better error
28 (Invocation.DoResolve): OverloadResolve() never returns null
29 without reporting an error, so removed the error -6 reporting here.
31 2004-03-23 Martin Baulig <martin@ximian.com>
33 * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
36 * cs-parser.jay (delegate_declaration): Support generic delegates.
38 * delegate.cs: Support generic delegates.
40 2004-03-22 Martin Baulig <martin@ximian.com>
42 * expression.cs (Invocation.InferParamsTypeArguments): New static
43 method; does type inference for params arguments.
45 2004-03-21 Martin Baulig <martin@ximian.com>
47 * typemanager.cs (TypeManager.IsGenericMethod): New public static
48 method; checks whether a method is a generic method.
50 * expression.cs (Invocation.InferTypeArguments): New static method;
51 infer type arguments for generic method invocation.
53 * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
54 property; we set this to true if we're resolving a generic method
55 invocation and the user specified type arguments, ie. we're not
58 2004-03-20 Martin Baulig <martin@ximian.com>
60 * class.cs (MethodData.DeclaringType): New public property.
61 (MethodData.Define): Set DeclaringType here.
62 (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
63 instead of OperatorMethodBuilder.DeclaringType.
65 2004-03-20 Martin Baulig <martin@ximian.com>
67 * cs-tokenizer.cs (xtoken): Return a special
68 Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
70 * cs-parser.jay (default_value_expression): Switch to the new
73 2004-03-19 Martin Baulig <martin@ximian.com>
75 * decl.cs (MemberName): New class. We use this to "construct"
76 namespace_or_type_name's.
78 * generics.cs (TypeArguments.GetDeclarations): New public method;
79 returns the type arguments as a string[] and reports a CS0081 if
80 one of them is not an identifier.
82 * class.cs (MemberBase): The .ctor now takes the name as a
83 MemberName instead of a string.
84 (MemberBase.ExplicitInterfaceName): Changed type from string to
86 (MemberBase.DoDefine): If we're an explicit implementation, the
87 InterfaceType may be a generic instance.
89 * cs-parser.jay (namespace_or_type_name): Return a MemberName.
90 (namespace_name): Call MemberName.GetName () to transform the
91 MemberName into a string and ensure we don't have any type
93 (type_name): Call MemberName.GetTypeExpression() to transfrom the
94 MemberName into an expression.
95 (method_header): Use namespace_or_type_name instead of member_name.
97 2004-03-19 Martin Baulig <martin@ximian.com>
99 * class.cs (MemberCore.IsDuplicateImplementation): Check whether
100 two overloads may unify for some type parameter substitutions and
101 report a CS0408 if appropriate.
103 2004-03-19 Martin Baulig <martin@ximian.com>
105 * class.cs (MemberCore.IsDuplicateImplementation): Report the
106 error here and not in our caller.
108 2004-03-19 Martin Baulig <martin@ximian.com>
110 * interface.cs: Completely killed this file.
111 (Interface): We're now a TypeContainer and live in class.cs.
113 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
114 argument; we're now also called for interfaces.
115 (TypeContainer.DefineMembers): Allow this method being called
117 (TypeContainer.GetMethods): New public method; formerly known as
118 Interface.GetMethod(). This is used by PendingImplementation.
119 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
120 it's now private and non-static.
121 (Interface): Moved this here; it's now implemented similar to
123 (Method, Property, Event, Indexer): Added `bool is_interface'
124 argument to their .ctor's.
125 (MemberBase.IsInterface): New public field.
127 * cs-parser.jay: Create normal Method, Property, Event, Indexer
128 instances instead of InterfaceMethod, InterfaceProperty, etc.
129 (opt_interface_base): Removed; we now use `opt_class_base' instead.
130 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
132 2004-03-19 Martin Baulig <martin@ximian.com>
134 * class.cs (MethodCore.IsDuplicateImplementation): New private
135 method which does the CS0111 checking.
136 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
137 Use IsDuplicateImplementation().
139 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
141 * decl.cs (FindMemberToOverride): New method to find the correct
142 method or property to override in the base class.
144 - Make Method/Property use the above method to find the
145 version in the base class.
146 - Remove the InheritableMemberSignatureCompare as it is now
149 This patch makes large code bases much faster to compile, as it is
150 O(n) rather than O(n^2) to do this validation.
152 Also, it fixes bug 52458 which is that nested classes are not
153 taken into account when finding the base class member.
155 Reviewed/Approved by Martin.
157 2004-03-17 Martin Baulig <martin@ximian.com>
159 * expression.cs (MemberAccess.DoResolve): Take the parent's number
160 of type arguments into account; use the `real_num_type_args'
161 approach like in DoResolveAsTypeStep().
163 * generic.cs (GenericMemberAccess.DoResolve): Make this work for
166 2004-03-17 Marek Safar <marek.safar@seznam.cz>
168 * interface.cs: In all interface classes removed redundant
169 member initialization.
171 2004-03-16 Martin Baulig <martin@ximian.com>
173 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
175 2004-03-15 Miguel de Icaza <miguel@ximian.com>
177 * decl.cs (DefineTypeAndParents): New helper method to define a
178 type's containers before the type itself is defined; This is a
179 bug exposed by the recent changes to Windows.Forms when an
180 implemented interface was defined inside a class that had not been
183 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
185 (Check): Loop correctly to report errors modifiers
186 (UNSAFE was not in the loop, since it was the same as TOP).
188 * interface.cs: Every interface member now takes a ModFlags,
189 instead of a "is_new" bool, which we set on the base MemberCore.
191 Every place where we called "UnsafeOk" in the interface, now we
192 call the proper member (InterfaceMethod.UnsafeOK) instead to get
193 the unsafe settings from the member declaration instead of the
196 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
198 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
199 `set_indexer_name' to the pending bits (one per type).
201 We fixed a bug today that was picking the wrong method to
202 override, since for properties the existing InterfaceMethod code
203 basically ignored the method name. Now we make sure that the
204 method name is one of the valid indexer names.
206 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
208 * support.cs (SeekableStreamReader): Keep track of stream byte
209 positions and don't mix them with character offsets to the buffer.
211 Patch from Gustavo Giráldez
213 2004-03-15 Marek Safar <marek.safar@seznam.cz>
215 * interface.cs (InterfaceSetGetBase): Removed double member
216 initialization, base class does it as well.
218 2004-03-13 Martin Baulig <martin@ximian.com>
220 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
221 when compiling corlib.
223 2004-03-13 Miguel de Icaza <miguel@ximian.com>
225 * convert.cs (ExplicitConversion): We were reporting an error on
226 certain conversions (object_type source to a value type, when the
227 expression was `null') before we had a chance to pass it through
228 the user defined conversions.
230 * driver.cs: Replace / and \ in resource specifications to dots.
233 * class.cs: Add check for duplicate operators. Fixes 52477
235 2004-03-11 Miguel de Icaza <miguel@ximian.com>
237 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
238 that are in the middle of the statements, not only at the end.
241 * class.cs (TypeContainer.AddField): No longer set the
242 `HaveStaticConstructor' flag, now we call it
243 `UserDefineStaticConstructor' to diferentiate the slightly
246 The situation is that we were not adding BeforeFieldInit (from
247 Modifiers.TypeAttr) to classes that could have it.
248 BeforeFieldInit should be set to classes that have no static
253 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
255 And most importantly Zoltan's comment:
257 http://bugzilla.ximian.com/show_bug.cgi?id=44229
259 "I think beforefieldinit means 'it's ok to initialize the type sometime
260 before its static fields are used', i.e. initialization does not need
261 to be triggered by the first access to the type. Setting this flag
262 helps the JIT to compile better code, since it can run the static
263 constructor at JIT time, and does not need to generate code to call it
264 (possibly lots of times) at runtime. Unfortunately, mcs does not set
265 this flag for lots of classes like String.
267 csc sets this flag if the type does not have an explicit static
268 constructor. The reasoning seems to be that if there are only static
269 initalizers for a type, and no static constructor, then the programmer
270 does not care when this initialization happens, so beforefieldinit
273 This bug prevents the AOT compiler from being usable, since it
274 generates so many calls to mono_runtime_class_init that the AOT code
275 is much slower than the JITted code. The JITted code is faster,
276 because it does not generate these calls if the vtable is type is
277 already initialized, which is true in the majority of cases. But the
278 AOT compiler can't do this."
280 2004-03-10 Miguel de Icaza <miguel@ximian.com>
282 * class.cs (MethodData.Emit): Refactor the code so symbolic
283 information is generated for destructors; For some reasons we
284 were taking a code path that did not generate symbolic information
287 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
289 * class.cs: Create a Constructor.CheckBase method that
290 takes care of all validation type code. The method
291 contains some code that was moved from Define.
293 It also includes new code that checks for duplicate ctors.
294 This fixes bug #55148.
296 2004-03-09 Joshua Tauberer <tauberer@for.net>
298 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
299 a { ... }-style array creation invokes EmitStaticInitializers
300 which is not good for reference-type arrays. String, decimal
301 and now null constants (NullCast) are not counted toward
304 2004-03-05 Martin Baulig <martin@ximian.com>
306 * location.cs (SourceFile.HasLineDirective): New public field;
307 specifies whether the file contains or is referenced by a "#line"
309 (Location.DefineSymbolDocuments): Ignore source files which
310 either contain or are referenced by a "#line" directive.
312 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
314 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
315 direct access to our parent, so check the method inline there.
317 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
319 * expression.cs (Invocation.EmitCall): Miguel's last commit
320 caused a regression. If you had:
325 In Foo the implict this would be null.
327 2004-02-27 Miguel de Icaza <miguel@ximian.com>
329 * expression.cs (Invocation.EmitCall): If the method is not
330 virtual, do not emit a CallVirt to it, use Call.
332 * typemanager.cs (GetFullNameSignature): Improve the method to
333 cope with ".ctor" and replace it with the type name.
335 * class.cs (ConstructorInitializer.Resolve): Now the method takes
336 as an argument the ConstructorBuilder where it is being defined,
337 to catch the recursive constructor invocations.
339 2004-03-16 Martin Baulig <martin@ximian.com>
341 * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
342 ConstructedType, call ResolveType() on it to get the type rather
343 than just using `expr.Type'.
345 2004-03-16 Martin Baulig <martin@ximian.com>
347 * generics.cs (ConstructedType.GetMemberAccess): Take the
348 EmitContext instead on the TypeExpr and use
349 ec.TypeContainer.CurrentType/ec.ContainerType.
351 2004-03-16 Martin Baulig <martin@ximian.com>
353 * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
354 parameters before aliases.
356 2004-03-16 Martin Baulig <martin@ximian.com>
358 * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
359 New oublic function; checks whether two generic instances may become
360 equal under some instantiations (26.3.1).
362 * class.cs (TypeContainer.Define): Call
363 TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
366 2004-03-16 Martin Baulig <martin@ximian.com>
368 * class.cs (TypeContainer.GetClassBases): Moved
369 Error_TypeParameterAsBase() here and also check whether the base
370 class is not an attribute.
372 2004-03-16 Martin Baulig <martin@ximian.com>
374 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
376 2004-03-16 Martin Baulig <martin@ximian.com>
378 * class.cs (Error_TypeParameterAsBase): Use correct error number
381 2004-03-16 Martin Baulig <martin@ximian.com>
383 * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
386 * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
389 2004-03-15 Martin Baulig <martin@ximian.com>
391 * typemanager.cs (TypeManager.GetFullName): New public method.
392 (TypeManager.MemberLookup): Added `int_num_type_arguments'
393 argument; only return members with the correct number of type
395 (TypeManager.CheckGeneric): Allow -1 to bypass the check.
396 (TypeManager.FilterWithClosure): Call CheckGeneric() to check
397 whether the number of type arguments matches.
399 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
400 not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
402 * expression.cs (MemberAccess): Added public `NumTypeArguments'
403 field; it's set by the protected .ctor when we're actually a
405 (MemberAccess.ResolveAsTypeStep): Compute the total number of type
406 arguments and pass it to MemberLookupFinal ().
408 * ecore.cs (Expression.MemberLookup): Added `int
409 num_type_arguments' argument; only return members with the correct
410 number of type arguments.
411 (Expression.MemberLookupFailed): Check whether the MemberLookup
412 failed because we did not have the correct number of type
413 arguments; report CS0305 in this case.
415 * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
416 `e.ResolveAsTypeTerminal()' already did so.
418 2004-03-15 Martin Baulig <martin@ximian.com>
420 * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
421 we're a ConstructedType; in this case, the caller must report an
422 error (for instance CS0131).
424 * generic.cs (TypeArguments): Added Location argument to the .ctor.
425 (TypeArguments.Resolve): Actually report errors here.
427 2004-03-15 Miguel de Icaza <miguel@ximian.com>
429 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
430 `set_indexer_name' to the pending bits (one per type).
432 We fixed a bug today that was picking the wrong method to
433 override, since for properties the existing InterfaceMethod code
434 basically ignored the method name. Now we make sure that the
435 method name is one of the valid indexer names.
437 2004-03-15 Martin Baulig <martin@ximian.com>
439 * typemanager.cs (TypeManager.IndexerPropertyName): Added support
440 for generic instances.
442 2004-03-13 Martin Baulig <martin@ximian.com>
444 * class.cs (TypeContainer.DefineType): Call
445 TypeManager.AddUserType() immediately after creating the
446 TypeBuilder; pass all type parameters when creating the
449 * decl.cs (DeclSpace.FindNestedType): New public method.
450 (DeclSpace.FindType): Added `int num_type_args' argument; only
451 return types with the correct number of type parameters.
452 (DeclSpace.CountTypeParams): New public property.
454 * ecore.cs (SimpleName.ctor): Added overloaded version which takes
455 the number of type parameters; defaults to zero.
457 * generic.cs (TypeArguments.Count): New public property.
458 (ConstructedType.DoResolveAsTypeStep): First call
459 ds.FindNestedType() to find out whether we're nested in the
460 current generic type; in this case, we inherit all type parameters
461 from the current class.
463 * rootcontext.cs (RootContext.NamespaceLookup): Added `int
464 num_type_args' argument.
465 (RootContext.LookupType): Added overloaded version which takes the
466 number of type arguments; only return types with the correct
467 number of type arguments.
469 * typemanager.cs (TypeManager.CheckGeneric): New public function;
470 checks whether `Type t' has `int num_type_args'.
472 2004-03-13 Martin Baulig <martin@ximian.com>
474 * generic.cs (GenericMethod.DefineType): New method; calls
475 DefineType() on all the type parameters.
477 * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
478 (MethodData.Define): If we're a generic method, call
479 GenericMethod.DefineType() to define the type parameters.
481 2004-03-10 Martin Baulig <martin@ximian.com>
483 * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
484 instead of IsAssignableFrom.
486 2004-03-10 Martin Baulig <martin@ximian.com>
488 * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
490 * support.cs (ParameterData.HasArrayParameter): New property.
491 (ReflectionParameters.ctor): Take a MethodBase instead of a
492 ParameterInfo[]. If we have any type parameters, get the generic
493 method definition and ask it whether we have variable arguments.
495 2004-02-26 Miguel de Icaza <miguel@ximian.com>
497 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
498 routines to check if a type is an enumerable/enumerator allow
499 classes that implement the IEnumerable or IEnumerator interfaces.
501 * class.cs (Property, Operator): Implement IIteratorContainer, and
504 (Property.Define): Do the block swapping for get_methods in the
505 context of iterators. We need to check if Properties also
506 include indexers or not.
508 (Operator): Assign the Block before invoking the
509 OperatorMethod.Define, so we can trigger the Iterator code
512 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
513 Property and Operator classes are not created when we parse the
514 declarator but until we have the block completed, so we use a
515 singleton SimpleIteratorContainer.Simple to flag whether the
516 SetYields has been invoked.
518 We propagate this setting then to the Property or the Operator to
519 allow the `yield' to function.
521 2004-02-25 Marek Safar <marek.safar@seznam.cz>
523 * codegen.cs: Implemented attribute support for modules.
524 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
525 Assembly/Module functionality.
527 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
528 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
529 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
531 2004-02-16 Marek Safar <marek.safar@seznam.cz>
533 * interface.cs (FindMembers): The operation is performed on all base
534 interfaces and not only on the first. It is required for future CLS Compliance patch.
536 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
538 * statement.cs, codegen.cs:
539 This patch deals with patterns such as:
541 public class List : IEnumerable {
543 public MyEnumerator GetEnumerator () {
544 return new MyEnumerator(this);
547 IEnumerator IEnumerable.GetEnumerator () {
551 public struct MyEnumerator : IEnumerator {
556 Before, there were a few things we did wrong:
557 1) we would emit callvirt on a struct, which is illegal
558 2) we emited ldarg when we needed to emit ldarga
559 3) we would mistakenly call the interface methods on an enumerator
560 type that derived from IEnumerator and was in another assembly. For example:
562 public class MyEnumerator : IEnumerator
564 Would have the interface methods called, even if there were public impls of the
565 method. In a struct, this lead to invalid IL code.
567 2004-02-11 Marek Safar <marek.safar@seznam.cz>
569 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
572 * delegate.cs (Define): Fixed crash when delegate type is undefined.
574 2004-02-11 Miguel de Icaza <miguel@ximian.com>
576 * cs-parser.jay: Fix small regression: we were not testing V2
577 compiler features correctly.
579 * interface.cs: If the emit context is null, then create one
581 2004-02-09 Marek Safar <marek.safar@seznam.cz>
583 * decl.cs (GetSignatureForError): New virtual method to get full name
586 * attribute.cs (IAttributeSupport): New interface for attribute setting.
587 Now it is possible to rewrite ApplyAttributes method to be less if/else.
589 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
590 Duplicated members and code in these classes has been removed.
591 Better encapsulation in these classes.
593 2004-02-07 Miguel de Icaza <miguel@ximian.com>
595 * assign.cs (Assign.DoResolve): When dealing with compound
596 assignments, there is a new rule in ECMA C# 2.4 (might have been
597 there before, but it is documented here) that states that in:
601 If b is of type int, and the `op' is a shift-operator, then the
602 above is evaluated as:
606 * expression.cs (Binary.ResolveOperator): Instead of testing for
607 int/uint/long/ulong, try to implicitly convert to any of those
608 types and use that in pointer arithmetic.
610 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
611 method to print information for from the type, not from the
612 null-method we were given.
614 2004-02-01 Duncan Mak <duncan@ximian.com>
616 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
617 parsing for cmd, fixes bug #53694.
619 2004-02-04 Marek Safar <marek.safar@seznam.cz>
621 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
622 in the member name duplication tests. Property and operator name duplication
623 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
625 2004-02-03 Marek Safar <marek.safar@seznam.cz>
627 * interface.cs (PopulateMethod): Fixed crash when interface method
628 returns not existing type (error test cs0246-3.cs).
630 2004-02-02 Ravi Pratap M <ravi@ximian.com>
632 * cs-parser.jay (interface_accessors): Re-write actions to also
633 store attributes attached to get and set methods. Fix spelling
636 (inteface_property_declaration): Modify accordingly.
638 (InterfaceAccessorInfo): New helper class to store information to pass
639 around between rules that use interface_accessors.
641 * interface.cs (Emit): Apply attributes on the get and set
642 accessors of properties and indexers too.
644 * attribute.cs (ApplyAttributes): Modify accordingly to use the
645 right MethodBuilder when applying attributes to the get and set accessors.
647 2004-01-31 Miguel de Icaza <miguel@ximian.com>
649 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
651 2004-01-26 Miguel de Icaza <miguel@ximian.com>
653 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
655 2004-01-25 Miguel de Icaza <miguel@ximian.com>
657 * cs-parser.jay: Remove YIELD token, instead use the new grammar
658 changes that treat `yield' specially when present before `break'
661 * cs-tokenizer.cs: yield is no longer a keyword.
663 2004-01-23 Marek Safar <marek.safar@seznam.cz>
665 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
666 setting for default constructors.
667 For default constructors are almost every time set wrong Modifier. The
668 generated IL code has been alright. But inside mcs this values was
669 wrong and this was reason why several of my CLS Compliance tests
672 2004-02-27 Martin Baulig <martin@ximian.com>
674 * generics.cs (ConstructedType.ResolveType): Make the nested type
677 2004-02-25 Martin Baulig <martin@ximian.com>
679 * decl.cs (DeclSpace.CurrentTypeParameters): New protected
680 property; returns the type parameters just from the current type,
681 ie. with the ones from outer classes.
682 (DeclSpace.LookupGeneric): First search in the current class, then
684 (DeclSpace.initialize_type_params): When hiding a type parameter
685 from an outer class, put it into the `type_param_list' anyways.
687 * expression.cs (MemberAccess.expr): Made this field protected.
689 * class.cs (TypeContainer.Define): The `CurrentType' just contains
690 the type parameters from the current class.
692 * generic.cs (ConstructedType.ResolveType): Support nested generic
693 types by taking the type parameters which we inherit from outer
694 classes into account.
695 (GenericMemberAccess.ResolveAsTypeStep): Override this and added
696 support for nested generic types.
698 2004-02-23 Martin Baulig <martin@ximian.com>
700 * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
701 field and check whether we're nested inside a generic type.
702 (DeclSpace.ResolveType): If we're resolving to a generic type
703 definition, create a ConstructedType and return its resolved type.
704 (DeclSpace.initialize_type_params): New private method;
705 initializes the `type_param_list' field from the type parameters
706 from this and all enclosing classes.
707 (DeclSpace.TypeParameters): Call initialize_type_params() unless
708 we're already initialized.
710 2004-02-23 Martin Baulig <martin@ximian.com>
712 * class.cs (Method.Define): Create the generic method before
714 (Memberbase.DoDefine): Added DeclSpace argument (in addition to
715 the TypeContainer one); we use this for generic methods.
717 * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
718 parent's TypeBuilder.
720 2004-02-18 Martin Baulig <martin@ximian.com>
722 * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
723 to check for equality.
725 2004-02-05 Martin Baulig <martin@ximian.com>
727 * ecore.cs (FieldExpr.DoResolveLValue): If we have an
728 `ec.TypeContainer.CurrentType', use it instead of
729 `ec.ContainerType' to check whether we're in the type's ctor.
731 2004-01-29 Martin Baulig <martin@ximian.com>
733 * expression.cs (Invocation.DoResolve): If we're a
734 `ConstructedType', then we're actually a generic method, so
735 rewrite the expr as a GenericMemberAccess.
737 * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
738 here; manually parse it into a string.
740 2004-01-28 Martin Baulig <martin@ximian.com>
742 * typemanager.cs (TypeManager.IsEqual): New static method.
743 (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
744 check for equality instead of using `=='.
746 2004-01-26 Martin Baulig <martin@ximian.com>
748 * decl.cs (DeclSpace.CurrentType): New public field.
750 * expression.cs (This.ResolveBase): If we have an
751 `ec.TypeContainer.CurrentType', use it instead of
754 * class.cs (TypeContainer.DefineType): If we're a generic type,
755 create the `CurrentType' (unresolved).
756 (TypeContainer.GenericType): New private field.
757 (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
758 it and store it in `GenericType' before creating the MemberCache.
759 (TypeContainer.GetMembers): If we have a `GenericType', call
760 TypeManager.FindMembers() on it.
762 * interface.cs (Interface.GenericType): New private field.
763 (Interface.DefineType): If we're a generic type, create the
764 `CurrentType' (unresolved).
765 (Interface.DefineMembers): If we have a `CurrentType', resolve it
766 and store it in `GenericType' before creating the MemberCache.
767 (Interface.GetMembers): If we have a `GenericType', call
768 TypeManager.FindMembers() on it.
770 2004-01-22 Martin Baulig <martin@ximian.com>
772 * cs-parser.jay (namespace_or_type_name): Return an Expression,
773 not a QualifiedIdentifier. This is what `type_name_expression'
774 was previously doing.
775 (type_name_expression): Removed; the code is now in
776 `namespace_or_type_name'.
777 (qualified_identifier): Removed, use `namespace_or_type_name'
779 (QualifiedIdentifier): Removed this class.
781 2004-01-22 Martin Baulig <martin@ximian.com>
783 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
784 not a string as alias name.
786 2004-01-21 Miguel de Icaza <miguel@ximian.com>
788 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
789 #52730 bug, and instead compute correctly the need to use a
790 temporary variable when requesting an address based on the
791 static/instace modified of the field and the constructor.
793 2004-01-21 Martin Baulig <martin@ximian.com>
795 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
796 class and namespace before looking up aliases. Fixes #52517.
798 2004-01-21 Martin Baulig <martin@ximian.com>
800 * flowanalysis.cs (UsageVector.Merge): Allow variables being
801 assinged in a 'try'; fixes exception4.cs.
803 2004-01-21 Marek Safar <marek.safar@seznam.cz>
804 * class.cs : Implemented parameter-less constructor for TypeContainer
806 * decl.cs: Attributes are now stored here. New property OptAttributes
808 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
810 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
812 2004-01-21 Marek Safar <marek.safar@seznam.cz>
814 * typemanager.cs (CSharpSignature): Now reports also inner class name.
815 (CSharpSignature): New method for indexer and property signature.
817 2004-01-21 Marek Safar <marek.safar@seznam.cz>
819 * pending.cs (IsVirtualFilter): Faster implementation.
821 2004-01-21 Marek Safar <marek.safar@seznam.cz>
823 * typemanager.cs: Avoid inclusion of same assembly more than once.
825 2004-01-21 Marek Safar <marek.safar@seznam.cz>
827 * cs-parser.jay: Fixed problem where the last assembly attribute
828 has been applied also to following declaration (class, struct, etc.)
830 2004-01-21 Marek Safar <marek.safar@seznam.cz>
832 * class.cs: Added error CS0538, CS0539 reporting.
833 Fixed crash on Microsoft runtime when field type is void.
835 * cs-parser.jay: Added error CS0537 reporting.
837 * pending.cs: Added error CS0535 reporting.
838 Improved error report for errors CS0536, CS0534.
840 2004-01-20 Miguel de Icaza <miguel@ximian.com>
842 Merge a few bits from the Anonymous Method MCS tree.
844 * statement.cs (ToplevelBlock): New class for toplevel methods,
845 will hold anonymous methods, lifted variables.
847 * cs-parser.jay: Create toplevel blocks for delegates and for
848 regular blocks of code.
850 2004-01-20 Martin Baulig <martin@ximian.com>
852 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
853 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
854 and `NeedExplicitReturn'; added `IsLastStatement'.
855 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
856 have a `ReturnLabel' or we're not unreachable.
858 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
859 child's reachability; don't just override ours with it. Fixes
860 #58058 (lluis's example).
861 (FlowBranching): Added public InTryOrCatch(), InCatch(),
862 InFinally(), InLoop(), InSwitch() and
863 BreakCrossesTryCatchBoundary() methods.
865 * statement.cs (Return): Do all error checking in Resolve().
866 Unless we are the last statement in a top-level block, always
867 create a return label and jump to it.
868 (Break, Continue): Do all error checking in Resolve(); also make
869 sure we aren't leaving a `finally'.
870 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
871 statement in a top-level block.
872 (Block.Flags): Added `IsDestructor'.
873 (Block.IsDestructor): New public property.
875 2004-01-20 Martin Baulig <martin@ximian.com>
877 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
879 2004-01-20 Martin Baulig <martin@ximian.com>
881 * statement.cs (Statement.ResolveUnreachable): New public method.
882 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
883 (Block.Resolve): Resolve unreachable statements.
885 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
887 * expression.cs: We need to fix the case where we do
888 not have a temp variable here.
890 * assign.cs: Only expression compound assignments need
893 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
895 * flowanalysis.cs: Reduce memory allocation in a few ways:
896 - A block with no variables should not allocate a bit
898 - A method with no out parameters does not need any tracking
899 for assignment of the parameters, so we need not allocate
902 public readonly Type[] VariableTypes;
903 public readonly string[] VariableNames;
904 Are redundant. The data is already stored in the variable
905 map, so we need not allocate another array for it.
906 - We need to add alot of checks for if (params | locals) == null
907 due to the first two changes.
909 2004-01-18 Miguel de Icaza <miguel@ximian.com>
911 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
912 implement IMemoryLocation, we store a copy on a local variable and
913 take the address of it. Patch from Benjamin Jemlich
915 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
916 to use a special "type_name_expression" rule which reduces the
917 number of "QualifiedIdentifier" classes created, and instead
918 directly creates MemberAccess expressions.
920 2004-01-17 Miguel de Icaza <miguel@ximian.com>
922 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
923 that fixes #52853. Null literal assignment to ValueType
925 * class.cs (MethodData.Emit): Instead of checking the name of the
926 method to determine if its a destructor, create a new derived
927 class from Method called Destructor, and test for that.
929 * cs-parser.jay: Create a Destructor object instead of a Method.
931 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
935 2004-01-16 Miguel de Icaza <miguel@ximian.com>
937 * expression.cs (Binary.ResolveOperator): Perform an implicit
938 conversion from MethodGroups to their delegate types on the
941 * delegate.cs: Introduce a new class DelegateCreation that is the
942 base class for `NewDelegate' and `ImplicitDelegateCreation',
943 factor some code in here.
945 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
946 conversion from MethodGroups to compatible delegate types.
948 * ecore.cs (Expression.Resolve): Do not flag error 654
949 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
950 we allow conversions from MethodGroups to delegate types now.
952 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
953 assignments in v2 either.
955 2004-01-10 Miguel de Icaza <miguel@ximian.com>
957 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
958 static read-only fields in ctors.
960 Applied patch from Benjamin Jemlich
962 * expression.cs (UnaryMutator): Avoid leaking local variables.
964 2004-01-09 Miguel de Icaza <miguel@ximian.com>
966 * cs-tokenizer.cs (IsCastToken): Allow the various native types
967 here to return true, as they can be used like this:
971 Fixed 49836 and all the other dups
973 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
975 * driver.cs: Implement /win32res and /win32icon.
977 2004-01-08 Miguel de Icaza <miguel@ximian.com>
979 * cs-parser.jay: Add a rule to improve error handling for the
980 common mistake of placing modifiers after the type.
982 2004-01-07 Miguel de Icaza <miguel@ximian.com>
984 * cs-parser.jay (interface_event_declaration): Catch
985 initialization of events on interfaces, and report cs0068
987 * cs-parser.jay (interface_event_declaration): Catch
988 initialization of events.
990 * ecore.cs: Better report missing constructors.
992 * expression.cs (Binary.ResolveOperator): My previous bug fix had
993 the error reporting done in the wrong place. Fix.
995 * expression.cs (Binary.ResolveOperator): Catch the
996 operator + (E x, E y) error earlier, and later allow for implicit
997 conversions in operator +/- (E e, U x) from U to the underlying
1000 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
1001 52596, if the container class is abstract, the default constructor
1002 is protected otherwise its public (before, we were always public).
1004 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
1007 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
1008 Jemlich that fixes bug #52597, MCS was generating invalid code for
1009 idisposable structs. Thanks to Ben for following up with this
1012 2004-01-06 Miguel de Icaza <miguel@ximian.com>
1014 * driver.cs: Allow assemblies without code to be generated, fixes
1017 2004-01-07 Nick Drochak <ndrochak@gol.com>
1019 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
1021 2004-01-05 Miguel de Icaza <miguel@ximian.com>
1023 * cs-parser.jay: Add rules to improve error reporting if fields or
1024 methods are declared at the namespace level (error 116)
1026 * Add rules to catch event add/remove
1028 2004-01-04 David Sheldon <dave-mono@earth.li>
1030 * expression.cs: Added matching ")" to error message for
1033 2004-01-03 Todd Berman <tberman@gentoo.org>
1035 * ecore.cs, attribute.cs:
1036 Applying fix from #52429.
1038 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
1040 * ecore.cs, expression.cs, statement.cs:
1041 Total rewrite of how we handle branching. We
1042 now handle complex boolean expressions with fewer
1043 jumps. As well if (x == 0) no longer emits a ceq.
1045 if (x is Foo) is much faster now, because we generate
1048 Overall, we get a pretty big improvement on our benchmark
1049 tests. The code we generate is smaller and more readable.
1051 I did a full two-stage bootstrap. The patch was reviewed
1052 by Martin and Miguel.
1054 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
1056 * cs-parser.jay: Make primary_expression not take a QI.
1057 we dont need this because the member_access rule covers
1058 us here. So we replace the rule with just IDENTIFIER.
1060 This has two good effects. First, we remove a s/r conflict.
1061 Second, we allocate many fewer QualifiedIdentifier objects.
1063 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
1065 * attribute.cs: Handle MarshalAs attributes as pseudo, and
1066 set the correct information via SRE. This prevents
1067 hanging on the MS runtime. Fixes #29374.
1069 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
1071 * convert.cs: correctly handle conversions to value types
1072 from Enum and ValueType as unboxing conversions.
1074 Fixes bug #52569. Patch by Benjamin Jemlich.
1076 2004-01-02 Ravi Pratap <ravi@ximian.com>
1078 * expression.cs (BetterConversion): Prefer int -> uint
1079 over int -> ulong (csc's behaviour). This fixed bug #52046.
1081 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
1083 * decl.cs (MemberCache.FindMembers): now returns a
1086 * typemanager.cs: In general, go with with ^^.
1087 (CopyNewMethods): take an IList.
1088 (RealMemberLookup): Only allocate an arraylist
1089 if we copy from two sets of methods.
1091 This change basically does two things:
1092 1) Fewer array lists allocated due to CopyNewMethods.
1093 2) the explicit cast in MemberList costed ALOT.
1095 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
1097 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
1098 a hashtable to avoid needless string allocations when an identifier is
1099 used more than once (the common case).
1101 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
1103 * pending.cs: MS's TypeBuilder.GetInterfaces ()
1104 is broken, it will not return anything. So, we
1105 have to use the information we have in mcs to
1108 * typemanager.cs: Add a cache for GetInterfaces,
1109 since this will now be used more often (due to ^^)
1111 (GetExplicitInterfaces) New method that gets the
1112 declared, not effective, interfaces on a type
1113 builder (eg, if you have interface IFoo, interface
1114 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
1117 This patch makes MCS able to bootstrap itself on
1120 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
1122 * expression.cs: Remove the Nop's that Miguel put
1125 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
1127 * report.cs, codegen.cs: Give the real stack trace to
1128 the error when an exception is thrown.
1130 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
1132 * decl.cs: only allocate hashtables for ifaces if
1135 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
1137 * expression.cs: fix the error from cs0121-2.cs
1138 (a parent interface has two child interfaces that
1139 have a function with the same name and 0 params
1140 and the function is called through the parent).
1142 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
1144 * class.cs, rootcontext.cs, typmanager.cs: do not
1147 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
1149 * codegen.cs: remove stack for the ec flow branching.
1150 It is already a linked list, so no need.
1152 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
1154 * Makefile: Allow custom profiler here.
1156 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
1158 * typemanager.cs (LookupType):
1159 - Use a static char [], because split takes
1160 a param array for args, so it was allocating
1162 - Do not store true in a hashtable, it boxes.
1164 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
1166 * flowanalysis.cs: bytify common enums.
1168 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
1170 * modifiers.cs: Add a new set of flags for the
1171 flags allowed on explicit interface impls.
1172 * cs-parser.jay: catch the use of modifiers in
1173 interfaces correctly.
1174 * class.cs: catch private void IFoo.Blah ().
1176 All related to bug #50572.
1178 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
1180 * decl.cs: Rewrite the consistant accessability checking.
1181 Accessability is not linear, it must be implemented in
1182 a tableish way. Fixes #49704.
1184 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
1186 * expression.cs: Handle negation in a checked context.
1187 We must use subtraction from zero. Fixes #38674.
1189 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
1191 * class.cs: Ignore static void main in DLLs.
1192 * rootcontext.cs: Handle the target type here,
1193 since we are have to access it from class.cs
1194 * driver.cs: account for the above.
1196 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
1198 * report.cs: Give line numbers and files if available.
1200 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
1202 * driver.cs: Implement /addmodule.
1204 * typemanager.cs: Change 'modules' field so it now contains Modules not
1207 2003-12-20 Martin Baulig <martin@ximian.com>
1209 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
1210 (FieldBase.IsAssigned): Removed this field.
1211 (FieldBase.SetAssigned): New public method.
1212 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
1214 2003-12-20 Martin Baulig <martin@ximian.com>
1216 * expression.cs (LocalVariableReference.DoResolve): Don't set
1217 `vi.Used' if we're called from DoResolveLValue().
1219 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
1220 returns the usage vector it just merged into the current one -
1221 pass this one to UsageWarning().
1222 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
1223 of the `EmitContext', don't call this recursively on our children.
1225 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
1227 * driver.cs: Implement /target:module.
1229 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
1231 * support.cs (CharArrayHashtable): New helper class.
1233 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
1234 char arrays, not strings, so we can avoid creating a string in
1235 consume_identifier if the identifier is a keyword.
1237 2003-12-16 Martin Baulig <martin@ximian.com>
1239 * statement.cs (LocalInfo.Assigned): Removed this property.
1240 (LocalInfo.Flags): Removed `Assigned'.
1241 (LocalInfo.IsAssigned): New public method; takes the EmitContext
1242 and uses flow analysis.
1243 (Block.UsageWarning): Made this method private.
1244 (Block.Resolve): Call UsageWarning() if appropriate.
1246 * expression.cs (LocalVariableReference.DoResolve): Always set
1247 LocalInfo.Used here.
1249 2003-12-13 Martin Baulig <martin@ximian.com>
1251 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
1252 any value here; we're now using flow analysis to figure out
1253 whether a statement/block returns a value.
1255 2003-12-13 Martin Baulig <martin@ximian.com>
1257 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
1259 (FlowBranching.MergeFinally): Don't call
1260 `branching.CheckOutParameters()' here, this is called in
1262 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
1263 when adding the `finally' vector.
1265 2003-12-13 Martin Baulig <martin@ximian.com>
1268 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
1269 actually work and also fix #48962.
1271 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
1273 * decl.cs: Do not check System.Object for nested types,
1274 since we know it does not have any. Big bang for buck:
1279 corlib: 17.99 seconds
1283 corlib: 17.39 seconds
1285 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
1287 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
1288 time we are returning 0 members, so we save alot here.
1290 2003-12-11 Martin Baulig <martin@ximian.com>
1292 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
1293 `MergeChild()', also just take the `FlowBranching' as argument;
1294 call Merge() on it and return the result.
1295 (FlowBranching.Merge): We don't need to do anything if we just
1298 2003-12-11 Martin Baulig <martin@ximian.com>
1300 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
1301 them in an `ArrayList' to reduce memory usage. Thanks to Ben
1302 Maurer for this idea.
1304 2003-12-11 Martin Baulig <martin@ximian.com>
1306 * flowanalysis.cs (MergeResult): This class is now gone; we now
1307 use the `UsageVector' for this. The reason for this is that if a
1308 branching just has one sibling, we don't need to "merge" them at
1309 all - that's the next step to do.
1310 (FlowBranching.Merge): We now return a `UsageVector' instead of a
1313 2003-12-11 Martin Baulig <martin@ximian.com>
1315 Reworked flow analyis and made it more precise and bug-free. The
1316 most important change is that we're now using a special `Reachability'
1317 class instead of having "magic" meanings of `FlowReturns'. I'll
1318 do some more cleanups and optimizations and also add some more
1319 documentation this week.
1321 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
1322 largely reworked this class.
1323 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
1324 the new `Reachability' class instead of having "magic" values here.
1325 (FlowBranching): We're now using an instance of `Reachability'
1326 instead of having separate `Returns', `Breaks' etc. fields.
1328 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
1329 based on flow analysis; ignore the return value of block.Emit ().
1331 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
1333 * driver.cs typemanager.cs: Find the mono extensions to corlib even
1334 if they are private.
1336 2003-12-09 Martin Baulig <martin@ximian.com>
1338 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
1339 call them directly on the UsageVector.
1341 2003-12-09 Martin Baulig <martin@ximian.com>
1343 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
1344 Changed return type from `FlowReturns' to `Reachability'.
1346 2003-12-09 Martin Baulig <martin@ximian.com>
1348 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
1349 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
1350 `Reachable' fields with a single `Reachability' one.
1352 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
1354 * class.cs (FindMembers): Remove foreach's.
1367 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
1372 This patch does a few things:
1373 1. EmptyStatement is now a singleton, so it is never reallocated.
1374 2. All blah is EmptyStatement constructs have been changed to
1375 blah == EmptyStatement.Value, which is much faster and valid
1376 now that EmptyStatement is a singleton.
1377 3. When resolving a block, rather than allocating a new array for
1378 the non-empty statements, empty statements are replaced with
1379 EmptyStatement.Value
1380 4. Some recursive functions have been made non-recursive.
1381 Mainly the performance impact is from (3), however (1) and (2) are needed for
1382 this to work. (4) does not make a big difference in normal situations, however
1383 it makes the profile look saner.
1388 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
1389 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
1390 Total memory allocated: 56397 KB
1393 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
1394 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
1395 Total memory allocated: 55666 KB
1397 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
1399 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
1400 than the hashtable in a hashtable version
1402 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
1403 we always end up concating a string. This results in a huge perf
1404 loss, because many strings have to be tracked by the GC. In this
1405 patch, we first use a hashtable that works with two keys, so that
1406 the strings do not need to be concat'ed.
1417 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
1419 * Makefile: Add a new target `do-time' that does a quick and simple
1420 profile, leaving easy to parse output.
1422 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
1424 * codegen.cs (Init): Create the dynamic assembly with
1425 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
1427 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
1429 * support.cs: Make the PtrHashtable use only one
1430 instance of its comparer.
1432 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
1434 * typemanager.cs: Fix lookup of GetNamespaces.
1436 2003-11-29 Miguel de Icaza <miguel@ximian.com>
1438 * expression.cs: Removed redundant line.
1440 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
1441 ArrayLists, use for loops with bounds.
1443 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
1446 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
1447 arraylists, use for loop with bounds.
1449 The above three changes give us a 0.071 second performance
1450 improvement out of 3.294 seconds down to 3.223. On my machine
1451 the above changes reduced the memory usage by 1,387 KB during
1454 * cs-parser.jay (QualifiedIdentifier): New class used to represent
1455 QualifiedIdentifiers. Before we created a new string through
1456 concatenation, and mostly later on, the result would be
1457 manipulated by DecomposeQI through string manipulation.
1459 This reduced the compiler memory usage for bootstrapping from
1460 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
1461 compile times in 0.05 seconds.
1463 2003-11-28 Dick Porter <dick@ximian.com>
1465 * support.cs: Do string compares with the Invariant culture.
1473 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
1474 the comparison is done with the Invariant culture.
1476 2003-11-27 Miguel de Icaza <miguel@ximian.com>
1478 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
1479 GetEnumerator method.
1481 (ProbeCollectionType): Iterate starting at the most specific type
1482 upwards looking for a GetEnumerator
1484 * expression.cs: Shift count can be up to 31 for int/uint and 63
1487 2003-11-26 Miguel de Icaza <miguel@ximian.com>
1489 * statement.cs (Block.LookupLabel): Also look for the label on the
1490 children blocks. Use a hash table to keep track of visited
1493 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
1494 we actually did transform the other operand, otherwise fall back
1495 to the common codepath that casts to long.
1497 * cs-tokenizer.cs: Use the same code pattern as the int case.
1498 Maybe I should do the parsing myself, and avoid depending on the
1499 Parse routines to get this done.
1501 2003-11-25 Miguel de Icaza <miguel@ximian.com>
1503 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
1504 which fixes bug 51347. This time test it.
1506 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
1507 attributes for example can not tell the difference between these.
1508 The difference was only a syntax feature of the language.
1510 * attribute.cs: Apply attributes to delegates.
1512 * delegate.cs: Call the apply attributes method.
1514 2003-11-24 Miguel de Icaza <miguel@ximian.com>
1516 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
1517 comparing 0 vs Byte.MinValue, not the value
1519 (ImplicitConversionRequired): When reporting a conversion error,
1520 use error 31 to print out the constant error instead of the
1523 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
1524 which fixes bug 51347.
1526 2003-11-22 Miguel de Icaza <miguel@ximian.com>
1528 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
1529 which fixes the -warnaserror command line option.
1531 2003-11-21 Miguel de Icaza <miguel@ximian.com>
1533 * cfold.cs (DoNumericPromotions): During constant folding of
1534 additions on UIntConstant, special case intconstants with
1535 IntConstants like we do on the expression binary operator.
1537 2003-11-12 Miguel de Icaza <miguel@ximian.com>
1539 * convert.cs (ImplicitReferenceConversion): We were missing a case
1540 (System.Enum are not value types or class types, so we need to
1541 classify them separatedly).
1543 * driver.cs: We do not support error 2007.
1545 2003-11-12 Jackson Harper <jackson@ximian.com>
1547 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
1548 system directory. Also use the full file name so users can
1549 libraries names mscorlib-o-tron.dll in a non system dir.
1551 2004-01-04 David Sheldon <dave-mono@earth.li>
1553 * expression.cs: Added matching ")" to error message for CS0077.
1555 2003-12-19 Martin Baulig <martin@ximian.com>
1557 * typemanager.cs (TypeManager.IsEqualGenericType): New public
1558 static method; see documentation in the method.
1559 (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
1561 * convert.cs (Convert.ImplicitReferenceConversion,
1562 Convert.ImplicitReferenceConversionExists): Add support for
1563 generic type declarations; see gen-36.cs.
1565 2003-12-19 Martin Baulig <martin@ximian.com>
1567 * pending.cs (Pending.InterfaceMethod): Use
1568 `Type.IsAssignableFrom()' instead of `=='.
1570 2003-12-18 Martin Baulig <martin@ximian.com>
1572 * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
1575 * convert.cs (Convert.ImplicitStandardConversionExists): Use
1576 `expr_type.Equals (target_type)' instead of `=='.
1578 2003-12-08 Martin Baulig <martin@ximian.com>
1580 * generics.cs (Constraints.Types): Removed.
1581 (Constraints.Resolve): Just resolve everything to TypeExpr's, not
1583 (Constraints.ResolveTypes): New public method; resolves the
1584 TypeExpr's to Type's.
1585 (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
1586 longer takes the constraints.
1587 (TypeParameter.DefineMethod): Likewise.
1588 (TypeParameter.DefineType): New public method. Calls
1589 `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
1592 2003-12-08 Martin Baulig <martin@ximian.com>
1594 * convert.cs (Convert.ImplicitConversionStandard): Use
1595 `expr_type.Equals (target_type)' instead of `=='.
1597 2003-12-08 Martin Baulig <martin@ximian.com>
1599 * typemanager.cs (TypeManager.GetReferenceType): Call
1600 `Type.MakeByRefType ()'.
1602 2003-12-08 Martin Baulig <martin@ximian.com>
1604 * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
1605 just has some special meaning in some situations. For instance,
1606 it is allowed to use `where' as the name of a variable etc.
1608 2003-12-04 Martin Baulig <martin@ximian.com>
1610 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
1611 `Type.MakeArrayType()' for array types.
1613 2003-11-18 Miguel de Icaza <miguel@ximian.com>
1615 * expression.cs (Invocation.VerifyArgumentsCompat): Remove
1618 (SizeOf.DoResolve): assign the `type_queried' field. This gets
1621 2003-11-16 Martin Baulig <martin@ximian.com>
1623 * codegen.cs (EmitContext.IsGeneric): Removed.
1625 * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
1626 ResolveGeneric() on the DeclSpace.
1628 2003-11-16 Martin Baulig <martin@ximian.com>
1630 * generic.cs (TypeArguments.Resolve):
1631 `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
1632 `ResolveType()' on it to get the Type.
1634 2003-11-15 Martin Baulig <martin@ximian.com>
1636 * generic.cs (ConstructedType.GetInterfaces): Override this.
1638 2003-11-14 Martin Baulig <martin@ximian.com>
1640 * interface.cs (Interface.DefineType): Define all type parameters
1641 before adding the interfaces we inherit.
1643 2003-11-11 Martin Baulig <martin@ximian.com>
1645 * generic.cs (ConstructedType.ResolveType): Always call
1646 `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
1648 2003-11-10 Martin Baulig <martin@ximian.com>
1650 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
1651 (TypeManager.InitCoreTypes): Initialize them here, but instead of
1652 calling `ResolveType()' on them, directly assign their `Type'.
1654 2003-11-08 Martin Baulig <martin@ximian.com>
1656 * generic.cs (ConstructedType): Override `IsClass' etc.
1658 2003-11-08 Martin Baulig <martin@ximian.com>
1660 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
1661 return value and the `out parent' parameter.
1662 (TypeContainer.DefineType): Moved the CS0644 check into
1663 GetClassBases(). Don't pass the interface types to the
1664 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
1665 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
1667 * ecore.cs (TypeExpr.IsAttribute): New property.
1668 (TypeExpr.GetInterfaces): New method.
1670 * interface.cs (Interface.GetInterfaceTypeByName): Return a
1671 TypeExpr instead of a Type.
1672 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
1673 (Interface.DefineType): Don't pass the interface types to the
1674 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
1675 them later and then call `TypeBulider.AddInterfaceImplementation()'.
1677 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
1678 instead of a `Type[]'.
1679 (TypeManager.RegisterBuilder): Likewise.
1680 (TypeManager.AddUserInterface): Likewise.
1681 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
1682 `Type[]' and also return a `TypeExpr[]'.
1683 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
1685 2003-11-08 Martin Baulig <martin@ximian.com>
1687 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
1690 2003-11-08 Martin Baulig <martin@ximian.com>
1692 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
1693 TypeManager.ResolveExpressionTypes().
1695 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
1696 instead of an Expression.
1697 (TypeExpr): This is now an abstract base class for `TypeExpression'.
1698 (TypeExpression): New public class; formerly known as `TypeExpr'.
1700 * expression.cs (ComposedCast): Derive from TypeExpr.
1702 * typemanager.cs (TypeManager.system_*_expr): These are now
1703 TypExpr's instead of Expression's.
1704 (TypeManager.ResolveExpressionTypes): New public static function;
1705 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
1708 2003-11-06 Miguel de Icaza <miguel@ximian.com>
1710 * expression.cs (New.DoResolve): Do not dereference value that
1711 might be a null return.
1713 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
1714 sure that the constant value has the right type. Fixes an
1715 unreported bug, similar to 50425.
1717 * const.cs (Const.LookupConstantValue): Call
1718 ImplicitStandardConversionExists before doing a conversion to
1719 avoid havng the TypeManager.ChangeType do conversions.
1721 Reduced the number of casts used
1723 (Const.ChangeType): New routine to enable reuse of the constant
1724 type changing code from statement.
1726 * typemanager.cs (ChangeType): Move common initialization to
1727 static global variables.
1731 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
1732 every value type to go through, even if it was void. Fix that.
1734 * cs-tokenizer.cs: Use is_identifier_start_character on the start
1735 character of the define, and the is_identifier_part_character for
1736 the rest of the string.
1738 2003-11-05 Miguel de Icaza <miguel@ximian.com>
1740 * expression.cs (UnaryMutator.EmitCode): When I updated
1741 LocalVariableReference.DoResolve, I overdid it, and dropped an
1742 optimization done on local variable references.
1744 2003-11-04 Miguel de Icaza <miguel@ximian.com>
1746 * ecore.cs: Convert the return from Ldlen into an int.
1748 2003-10-20 Miguel de Icaza <miguel@ximian.com>
1750 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
1751 the accessibility, this is a special case for toplevel non-public
1752 classes (internal for instance).
1754 2003-10-20 Nick Drochak <ndrochak@gol.com>
1756 * ecore.cs: Fix typo and build. Needed another right paren.
1758 2003-10-19 Miguel de Icaza <miguel@ximian.com>
1760 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
1761 `internal' case regular and protected, but not allowing protected
1762 to be evaluated later. Bug 49840
1764 2003-10-15 Miguel de Icaza <miguel@ximian.com>
1766 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
1767 to kb.Nlast, and not the kb.nFirst to isolate the switch
1770 Extract the underlying type, so enumerations of long/ulong are
1771 treated like long/ulong.
1773 2003-10-14 Miguel de Icaza <miguel@ximian.com>
1775 * expression.cs (New): Overload the meaning of RequestedType to
1776 track the possible creation of the NewDelegate type, since
1777 DoResolve is invoked more than once for new constructors on field
1780 See bugs: #48800 and #37014
1782 * cs-parser.jay (declare_local_constants): Take an arraylist
1783 instead of a single constant.
1785 (local_constant_declaration): It should take a
1786 constant_declarators, not a constant_declarator. Fixes 49487
1788 * convert.cs: Fix error report.
1790 2003-10-13 Jackson Harper <jackson@ximian.com>
1792 * typemanager.cs (TypeToCoreType): Add float and double this fixes
1795 2003-11-03 Martin Baulig <martin@ximian.com>
1797 * expression.cs (ArrayAccess.GetStoreOpcode): Added
1798 `out bool has_type_arg'; if set, we need to pass the type to
1800 (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
1801 Stelem_Any/Ldelem_Any for generic parameters.
1803 2003-11-02 Martin Baulig <martin@ximian.com>
1805 * expression.cs (Invocation.EmitCall): Use
1806 `TypeManager.IsValueType()' to check whether it's a value type.
1807 Don't set `struct_call' when calling a method on a type parameter.
1809 2003-11-02 Martin Baulig <martin@ximian.com>
1811 * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
1812 and removed the TypeBuilder argument.
1814 * typemanager.cs (TypeManager.IsValueType): Return
1815 `t.IsGenericParameter || t.IsValueType'.
1817 2003-10-25 Martin Baulig <martin@ximian.com>
1819 * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
1820 call ConstructedType.Resolve() on it.
1822 * generic.cs (ConstructedType.Resolve): Set `type' on success.
1824 2003-10-25 Martin Baulig <martin@ximian.com>
1826 * class.cs (TypeContainer.GetClassBases): Changed
1827 `out Type parent' into `out TypeExpr parent'. Moved CS0644 and
1828 CS8214 reporting here.
1829 (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
1830 instead of a `Type' for our parent. In case of a recursive
1831 declaration (see tests/gen-23.cs for an example), our parent is a
1832 ConstructedType and it doesn't have its type set. So, first
1833 create our own TypeBuilder, then call constructed.Resolve() to get
1834 the parent's type and finally TypeBuilder.SetParent() it.
1836 * ecore.cs (TypeExpr.Name): New public virtual property.
1839 (ConstructedType): We're now a TypeExpr and not just an Expression.
1840 (ConstructedType.ResolveAsTypeStep): Don't resolve our type
1841 arguments here; this is done later.
1842 (ConstructedType.Resolve): New public method to resolve the type
1843 arguments and bind them.
1845 2003-10-21 Martin Baulig <martin@ximian.com>
1847 * convert.cs: Use `TypeManager.IsValueType' instead of
1848 'type.IsValueType' everywhere.
1850 * typemanager.cs (TypeManager.IsValueType): Return true for type
1851 parameters. The reason for this is that we need to box a type
1852 parameter when converting it to a reference type.
1854 * cs-parser.jay: Added support for default value expressions.
1856 * generics.cs (DefaultValueExpression): New public class.
1858 2003-10-17 Martin Baulig <martin@ximian.com>
1860 * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
1861 TypeContainer so we can also use this for Interfaces.
1862 (TypeParameter.Resolve): Likewise.
1864 * interface.cs (Interface.DefineType): Added support for generic
1867 * cs-parser.jay: Added support for generic structs and interfaces.
1869 2003-10-17 Martin Baulig <martin@ximian.com>
1871 * generic.cs (GenericMemberAccess.DoResolve): We can now actually
1872 call generic methods :-)
1874 2003-10-16 Martin Baulig <martin@ximian.com>
1876 * cs-parser.jay (namespace_or_type_name): Only create a
1877 GenericMemberAccess if we actually have type arguments.
1879 2003-10-13 Martin Baulig <martin@ximian.com>
1881 * class.cs (Method.Define): If we're a generic method, call
1882 TypeBuilder.DefineGenericMethod () before resolving
1884 (MethodData): Added .ctor which takes an additional MethodBuilder
1885 argument; this is used for generic methods.
1886 (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
1887 we already have a MethodBuilder.
1889 2003-10-10 Martin Baulig <martin@ximian.com>
1891 * class.cs (Method): Added .ctor which takes a `GenericMethod'
1892 instead of a `DeclSpace'. This is used for generic methods.
1894 * cs-parser.jay (method_header): Added support for generic
1895 methods; create a `GenericMethod' instance and pass it to the
1896 `Method's .ctor; it'll be used as the `DeclSpace' to lookup
1897 parameters and locals.
1899 * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
1900 since we already have the location. Check whether we're a generic
1901 type declaration or a generic method and create the correct type
1904 * generic.cs (TypeParameter.DefineMethod): New public method.
1905 (GenericMethod): New public class; derives from DeclSpace and is
1906 used for generic methods.
1908 2003-10-09 Martin Baulig <martin@ximian.com>
1910 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
1912 (MethodCore.DoDefineParameters): Removed the TypeContainer
1913 argument; use the DeclSpace which was passed to the .ctor instead.
1914 (MethodCore.CheckParameter): Take a DeclSpace instead of a
1915 TypeContainer; we only need a DeclSpace here.
1917 2003-10-09 Martin Baulig <martin@ximian.com>
1919 * class.cs (MethodData): Added additional `DeclSpace ds' argument
1921 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
1922 EmitContext's .ctor.
1924 2003-10-09 Martin Baulig <martin@ximian.com>
1926 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
1927 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
1928 AsAccessible(), moved them as well.
1930 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
1932 2003-10-07 Miguel de Icaza <miguel@ximian.com>
1934 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
1935 generation for >=, as spotted by Paolo, bug 48679.
1936 Patch from David Waite.
1938 * cs-tokenizer.cs: Add handling for #pragma.
1940 * cs-parser.jay: Allow for both yield and yield return in the
1941 syntax. The anti-cobolization of C# fight will go on!
1943 * class.cs (TypeBuilder.DefineType): Catch error condition here
1944 (Parent.DefineType erroring out and returning null).
1946 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
1947 coping with enumerations variables, we were mistakenly processing
1948 them as a regular value type instead of built-in types. Fixes the
1951 * typemanager.cs (IsBuiltinOrEnum): New method.
1953 2003-09-30 Miguel de Icaza <miguel@ximian.com>
1955 * cs-parser.jay: Upgrade: yield now needs the return clause.
1957 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
1959 * cs-parser.jay : Renamed yyName to yyNames related to jay.
1961 2003-09-29 Martin Baulig <martin@ximian.com>
1963 * typemanager.cs (TypeManager.GetMethodFlags): Added support for
1964 inflated generic methods.
1966 * generics.cs (ConstructedType): Distinguish between open and
1967 closed constructed types; correctly resolve the arguments.
1969 2003-09-22 Martin Baulig <martin@ximian.com>
1971 * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
1972 all type arguments meet their constraints.
1974 2003-09-19 Martin Baulig <martin@ximian.com>
1976 * decl.cs (MemberCache.SetupCacheForInterface): Take a
1977 `MemberCache parent' argument. Normally, an interface doesn't
1978 have a parent type except System.Object, but we use this in gmcs
1979 for generic type parameters.
1981 2003-09-18 Martin Baulig <martin@ximian.com>
1983 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
1984 on `type.IsInterface'; don't check whether the type has a parent
1985 to determine whether it's an interface.
1987 2003-09-17 Martin Baulig <martin@ximian.com>
1989 * generic.cs (ConstructedType.ToString): Always use `name' as the
1992 2003-09-15 Martin Baulig <martin@ximian.com>
1994 * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
1996 * generic.cs (Constraints.Resolve): New public method; this is
1997 called to resolve the constraint types and to check whether all
1998 the constraints are correct.
1999 (Constraints.Types): New public property.
2000 (TypeParameter.Resolve): New public method; resolves all the
2003 * class.cs (TypeContainer.DefineType): Call
2004 TypeParameter.Resolve() before actually defining the type.
2006 2003-09-15 Martin Baulig <martin@ximian.com>
2008 * class.cs (TypeContainer.DefineType): Added an error flag to
2009 avoid reporting duplicate CS0146's ("class definition is
2012 * driver.cs (Driver.MainDriver): Abort if
2013 RootContext.ResolveTree() reported any errors.
2015 2003-09-07 Martin Baulig <martin@ximian.com>
2017 * report.cs (Error, Warning): Added overloaded versions which take
2018 a `params object[] args' and call String.Format().
2020 2003-09-07 Martin Baulig <martin@ximian.com>
2022 * decl.cs (DeclSpace..ctor): Don't call
2023 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
2024 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
2025 (DeclSpace.RecordDecl): New method.
2027 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
2029 2003-09-02 Ravi Pratap <ravi@ximian.com>
2031 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
2032 value attributes to be applied to ParameterBuilders.
2034 * class.cs (MethodCore.LabelParameters): Make static and more
2035 generic so that it can be used from other places - like interface
2036 methods, for instance.
2038 * interface.cs (Interface.Emit): Call LabelParameters before
2039 emitting attributes on the InterfaceMethod.
2041 2003-09-07 Martin Baulig <martin@ximian.com>
2043 * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
2044 if the number of type parameters doesn't match.
2046 2003-09-04 Martin Baulig <martin@ximian.com>
2048 * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
2049 for arrays of generic type params (ie. `!0[]').
2051 2003-09-04 Martin Baulig <martin@ximian.com>
2053 * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
2056 2003-09-04 Martin Baulig <martin@ximian.com>
2058 * decl.cs (DeclSpace.LookupGeneric): New method.
2059 (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
2062 * generic.cs (TypeParameterExpr): Take a TypeParameter as
2063 argument, not just a string.
2064 (TypeParameter.Define): New public method; this is called to
2065 actually define the generic parameter; after this, you can use the
2066 new `Type' property to get the type.
2068 2003-09-04 Martin Baulig <martin@ximian.com>
2070 * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
2071 is now an ArrayList; initialize the result of the `TypeParameters'
2073 (DeclSpace.GetGenericData): Removed.
2074 (DeclSpace.LookupGeneric): Temporarily removed; we need to
2075 implement this in a different way.
2076 (DeclSpace.GetTypeParameters): Removed; there's now a
2077 `TypeParameters' property.
2078 (DeclSpace.TypeParameters): New public property.
2080 * generic.cs (Constraints): Make this class public.
2081 (TypeParameter): New public class.
2083 2003-09-04 Martin Baulig <martin@ximian.com>
2085 * decl.cs (DeclSpace.GetTypeParameters): New method to return the
2088 * class.cs (TypeContainer.DefineType): Call
2089 TypeBuilder.DefineGenericParameter () on all generic parameters if
2090 this is a generic type.
2092 2003-08-28 Martin Baulig <martin@ximian.com>
2094 * sample-stack.il: Compile this with ilasm: "ilasm /dll
2097 * sample-hello.cs: Compile this with gmcs: "gmcs
2098 /r:sample-stack.dll sample-hello.cs".
2100 2003-08-28 Martin Baulig <martin@ximian.com>
2102 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
2103 the parameters to the generic type.
2105 2003-08-28 Martin Baulig <martin@ximian.com>
2107 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
2109 2003-08-28 Martin Baulig <martin@ximian.com>
2111 * cs-parser.jay (opt_type_argument_list): Use
2112 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
2113 (primary_expression): Replace `qualified_identifier' with `type_name'.
2114 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
2116 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
2117 parser to check whether it is syntactically a type parameter list;
2118 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
2121 2003-08-26 Martin Baulig <martin@ximian.com>
2123 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
2124 resolving aliases; fixes #47927.
2126 2003-08-26 Martin Baulig <martin@ximian.com>
2128 * statement.cs (Using.DoResolve): This is internally emitting a
2129 try/finally clause, so we need to set ec.NeedExplicitReturn if we
2130 do not always return. Fixes #47681.
2132 2003-08-26 Martin Baulig <martin@ximian.com>
2134 * decl.cs (MemberCore): Moved WarningNotHiding(),
2135 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
2137 (AdditionResult): Make this nested in DeclSpace.
2138 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
2139 argument; call NamespaceEntry.Define() unless we're nested in a
2142 * namespace.cs (Namespace.DefineName): New public function. This
2143 is called from DeclSpace's .ctor to add
2144 (Namespace.Lookup): Include DeclSpaces in the lookup.
2146 * class.cs (Operator): Derive from MemberBase, not MemberCore.
2148 * const.cs (Const): Derive from MemberBase, not MemberCore.
2150 2003-08-25 Martin Baulig <martin@ximian.com>
2152 * convert.cs (Convert.ExplicitReferenceConversion): When
2153 converting from an interface type to a class, unbox if the target
2154 type is a struct type. Fixes #47822.
2156 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2158 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
2161 2003-08-22 Martin Baulig <martin@ximian.com>
2163 * class.cs (TypeManager.DefineType): When defining a nested type,
2164 call DefineType() on our parent; fixes #47801.
2166 2003-08-22 Martin Baulig <martin@ximian.com>
2168 * class.cs (MethodData.Define): While checking if a method is an
2169 interface implementation, improve the test a bit more to fix #47654.
2171 2003-08-22 Martin Baulig <martin@ximian.com>
2173 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
2174 correctly; fixes #47722.
2176 2003-08-22 Martin Baulig <martin@ximian.com>
2178 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
2179 LocalVariableReference, ensure it's not read-only. Fixes #47536.
2181 * statement.cs (Fixed.DoResolve): Make all variables read-only.
2183 2003-08-22 Martin Baulig <martin@ximian.com>
2185 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
2186 can only be assigned in static constructors. Fixes #47161.
2188 2003-08-22 Martin Baulig <martin@ximian.com>
2190 Rewrote and improved the flow analysis code.
2192 * flowbranching.cs (FlowBranching): Make this class abstract.
2193 (FlowBranching.CreateBranching): New static function to create a
2195 (FlowBranchingBlock, FlowBranchingException): New classes.
2196 (FlowBranching.UsageVector.Type): New public readonly field.
2197 (FlowBranching.UsageVector.Breaks): Removed the setter.
2198 (FlowBranching.UsageVector.Returns): Removed the setter.
2199 (FlowBranching.UsageVector): Added Break(), Return(),
2200 NeverReachable() and Throw() methods to modify the reachability.
2201 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
2202 done by FlowBranching.Merge().
2203 (FlowBranching.UsageVector.MergeChild): New method; merges the
2204 merge result into the current vector.
2205 (FlowBranching.Merge): New abstract method to merge a branching.
2207 2003-08-12 Martin Baulig <martin@ximian.com>
2209 * expression.cs (Indirection.CacheTemporaries): Create the
2210 LocalTemporary with the pointer type, not its element type.
2212 2003-08-10 Miguel de Icaza <miguel@ximian.com>
2214 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
2215 token was a keyword or not.
2217 Add `error' options where an IDENTIFIER was expected; Provide
2218 CheckToken and CheckIdentifierToken convenience error reporting
2221 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
2223 * decl.cs: Rename `NamespaceEntry Namespace' public field into
2224 NameSpaceEntry NameSpaceEntry.
2226 (LookupInterfaceOrClass): Avoid creating a full qualified name
2227 from namespace and name: avoid doing lookups when we know the
2228 namespace is non-existant. Use new Tree.LookupByNamespace which
2229 looks up DeclSpaces based on their namespace, name pair.
2231 * driver.cs: Provide a new `parser verbose' to display the
2232 exception thrown during parsing. This is turned off by default
2233 now, so the output of a failure from mcs is more graceful.
2235 * namespace.cs: Track all the namespaces defined in a hashtable
2238 (IsNamespace): New method
2240 2003-08-09 Miguel de Icaza <miguel@ximian.com>
2242 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
2243 we know that we need to concatenate (full typename can never be
2248 * statement.cs: Use a bitfield; Do not initialize to null things
2249 which are done by the constructor by default.
2251 * cs-parser.jay: bug fix, parameter was 4, not 3.
2253 * expression.cs: Just use the property;
2255 * statement.cs: No need for GetVariableInfo method.
2257 2003-08-08 Martin Baulig <martin@ximian.com>
2259 * flowanalysis.cs (FlowReturns): This is now nested in the
2260 `FlowBranching' class.
2261 (MyBitVector): Moved this here from statement.cs.
2262 (FlowBranching.SiblingType): New enum type.
2263 (FlowBranching.CreateSibling): Added `SiblingType' argument.
2265 2003-08-07 Martin Baulig <martin@ximian.com>
2267 * flowanalysis.cs (FlowBranchingType): This is now nested in the
2268 `FlowBranching' class and called `BranchingType'.
2270 2003-08-07 Martin Baulig <martin@ximian.com>
2272 * flowanalysis.cs: Moved all the control flow analysis code into
2275 2003-08-07 Martin Baulig <martin@ximian.com>
2277 * assign.cs (Assign.DoResolve): `target' must either be an
2278 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
2281 2003-08-07 Miguel de Icaza <miguel@ximian.com>
2283 * expression.cs (BinaryMethod): This kind of expression is created by the
2284 Binary class if it determines that the operator has to be handled
2287 (BinaryDelegate): This kind of expression is created if we are
2288 dealing with a + or - operator on delegates.
2290 (Binary): remove method, argumetns, and DelegateOperator: when
2291 dealing with methods,
2293 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
2295 * statement.cs (Block): use bitfields for the three extra booleans
2296 we had in use. Remove unused topblock parameter.
2298 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
2300 * assign.cs: Drop extra unneeded tests.
2302 2003-08-06 Miguel de Icaza <miguel@ximian.com>
2304 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
2306 * statement.cs (Foreach): Use VariableStorage instead of
2309 * codegen.cs (VariableStorage): New class used by clients that
2310 require a variable stored: locals or fields for variables that
2311 need to live across yield.
2313 Maybe provide a convenience api for EmitThis+EmitLoad?
2315 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
2318 2003-08-05 Miguel de Icaza <miguel@ximian.com>
2320 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
2321 RemapParameterLValue): New methods that are used to turn a
2322 precomputed FieldInfo into an expression like this:
2326 The idea is to use this instead of making LocalVariableReference
2327 have more than one meaning.
2329 * cs-parser.jay: Add error production to BASE.
2331 * ecore.cs: Deal with TypeManager.GetField returning null, which
2332 is now a valid return value.
2334 (FieldExprNoAddress): New expression for Fields whose address can
2337 * expression.cs (LocalVariableReference): During the resolve
2338 phases, create new expressions if we are in a remapping context.
2339 Remove code that dealt with remapping here.
2341 (ParameterReference): same.
2343 (ProxyInstance): New expression, like the `This' expression, but
2344 it is born fully resolved. We know what we are doing, so remove
2345 the errors that are targeted to user-provided uses of `this'.
2347 * statement.cs (Foreach): our variable is now stored as an
2348 Expression; During resolution, follow the protocol, dont just
2349 assume it will return this.
2351 2003-08-06 Martin Baulig <martin@ximian.com>
2353 * support.cs (SeekableStreamReader.cs): New public class.
2355 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
2356 SeekableStreamReader instead of the normal StreamReader.
2358 2003-08-04 Martin Baulig <martin@ximian.com>
2360 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
2361 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
2362 deambiguate casts and delegate invocations.
2363 (parenthesized_expression): Use the new tokens to ensure this is
2364 not a cast of method invocation.
2366 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
2367 when reading a `)' and Deambiguate_CloseParens () was previously
2370 * expression.cs (ParenthesizedExpression): New class. This is
2371 just used for the CS0075 test.
2372 (Binary.DoResolve): Check for CS0075.
2374 2003-07-29 Ravi Pratap <ravi@ximian.com>
2376 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
2377 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
2378 reference comparison.
2380 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
2381 examine the ReturnType for equality - this is necessary in the
2382 cases of implicit and explicit operators whose signature also
2383 includes the return type.
2385 2003-07-26 Miguel de Icaza <miguel@ximian.com>
2387 * namespace.cs: Cache the result of the namespace computation,
2388 instead of computing it every time.
2390 2003-07-24 Miguel de Icaza <miguel@ximian.com>
2392 * decl.cs: Use a global arraylist that we reuse over invocations
2393 to avoid excesive memory consumption. Reduces memory usage on an
2394 mcs compile by one meg (45 average).
2396 * typemanager.cs (LookupTypeReflection): In .NET pointers are
2397 private, work around that.
2399 2003-07-23 Miguel de Icaza <miguel@ximian.com>
2401 * literal.cs (IntLiteral): Define Zero and One static literals.
2403 * cs-parser.jay (integer_literal): use static literals to reduce
2404 memory usage for the most used literals (0, 1 and -1). 211kb
2405 reduced in memory usage.
2407 Replace all calls to `new ArrayList' with `new
2408 ArrayList(4)' which is a good average number for most allocations,
2409 and also requires only 16 bytes of memory for its buffer by
2412 This reduced MCS memory usage in seven megabytes for the RSS after
2415 2003-07-28 Ravi Pratap <ravi@ximian.com>
2417 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
2418 handle params methods the correct way by forming only one
2419 applicable set with params and normal methods in them. Earlier we
2420 were looking at params methods only if we found no normal methods
2421 which was not the correct thing to do.
2423 (Invocation.BetterFunction): Take separate arguments indicating
2424 when candidate and the best method are params methods in their
2427 This fixes bugs #43367 and #46199.
2429 * attribute.cs: Documentation updates.
2431 (CheckAttribute): Rename to CheckAttributeTarget.
2432 (GetValidPlaces): Rename to GetValidTargets.
2434 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
2435 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
2439 2003-07-28 Miguel de Icaza <miguel@ximian.com>
2441 * codegen.cs: Compute IsGeneric correctly.
2443 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
2446 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
2447 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
2448 regressions, and I was chasing more bugs than I required.
2450 * interface.cs: Use expressions for base type names (like classes
2451 and structs have been doing for a while now), and resolve that.
2452 This patch should probably go into head as well.
2454 This makes it one less user of FindType.
2456 2003-07-24 Miguel de Icaza <miguel@ximian.com>
2458 This compiler can not self host currently. Need to fix that.
2460 * Makefile: compile to `gmcs.exe'
2462 * driver.cs: Turn on v2 by default on gmcs.
2464 * generic.cs (ConstructedType): Does no longer take a container
2465 type argument; That will be taken care of later.
2467 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
2468 Use SimpleName to resolve for now, so we can continue the work on
2469 the parser, until we get Type.GetType that understands generics.
2471 (ConstructedType.ToString): Implement
2473 (TypeArguments.Resolve): Resolve the child expressions as types.
2475 * cs-parser.jay: Rename interface_constraints to
2476 type_parameter_constraints
2478 (namespace_or_type_name): Only use constructed types for the basic
2479 construction, we will deal with identifier<...> later.
2481 (type/type_name): No longer call DecomposeQI, as
2482 namespace_or_type_name is always decoded now.
2484 2003-07-22 Ravi Pratap <ravi@ximian.com>
2486 * expression.cs (Invocation.OverloadResolve): Follow the spec more
2487 closely: we eliminate methods in base types when we have an
2488 applicable method in a top-level type.
2490 Please see section 14.5.5.1 for an exact description of what goes
2493 This fixes bug #45127 and a host of other related to corlib compilation.
2495 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
2496 array is the method corresponding to the top-level type (this is
2497 because of the changes made to icall.c) so we change this
2500 (MethodGroupExpr.Name): This too.
2502 * typemanager.cs (GetElementType): New method which does the right
2503 thing when compiling corlib.
2505 * everywhere: Make use of the above in the relevant places.
2507 2003-07-22 Martin Baulig <martin@ximian.com>
2509 * cs-parser.jay (invocation_expression): Moved
2510 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
2511 `cast_expression', but create a InvocationOrCast which later
2512 resolves to either an Invocation or a Cast.
2514 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
2515 method; call this before EmitStatement() to make sure that this
2516 expression can be used as a statement.
2518 * expression.cs (InvocationOrCast): New class; resolves to either
2519 an Invocation or a Cast.
2521 * statement.cs (StatementExpression): Call ResolveStatement() on
2522 the ExpressionStatement before emitting it.
2524 2003-07-21 Martin Baulig <martin@ximian.com>
2526 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
2527 `ref' and `out' attributes match; fixes #46220.
2528 (MemberAccess.ResolveMemberAccess): You can't reference a type
2529 through an expression; fixes #33180.
2530 (Indexers.GetIndexersForType): Don't return the indexers from
2531 interfaces the class implements; fixes #46502.
2533 2003-07-21 Martin Baulig <martin@ximian.com>
2535 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
2536 CS0661 checks; fixes bug #30442.
2538 2003-07-21 Martin Baulig <martin@ximian.com>
2540 * decl.cs (AdditionResult): Added `Error'.
2542 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
2544 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
2545 cs0031.cs actually work.
2547 2003-07-20 Miguel de Icaza <miguel@ximian.com>
2549 * cs-parser.jay (namespace_name): do not use
2550 namespace_or_type_name, use qualified_identifier, because
2551 namespace_or_type_name will soon return a composed expression
2552 instead of a string.
2554 (namespace_or_type_name): Instead of returning a string, now this
2555 production returns an expression.
2557 * codegen.cs (EmitContext): Setup IsGeneric property based on
2558 whether our DeclSpace is generic, our the method is generic.
2560 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
2561 the method is generic.
2563 * cs-parser.jay (type_arguments, opt_type_argument_list,
2564 type_parameters, type_parameter_list, opt_type_parameter_list,
2565 type_parameter,, opt_type_parameter_constraints_clauses,
2566 type_parameter_constraints_clauses,
2567 type_parameter_constraint_clause, type_parameter_constraint,
2568 interface_constraints): Add new production
2570 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
2571 DeclSpace is generic or not.
2573 (DeclSpace.SetParameterInfo): New routine, used to set the
2574 parameter info for a type.
2576 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
2577 returns a GenericTypeExpr
2579 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
2580 generic, lookup the generic argument.
2582 * attribute.cs: Do not allow TypeParameterExpressions in
2585 * class.cs: Do not allow the Main method to be defined in a
2588 * expression.cs (SizeOf): Do not allow generic types to be used as
2589 arguments to sizeof.
2591 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
2592 it: whether a type is generic or not. Only works for types we are
2593 currently building for now.
2595 2003-07-20 Martin Baulig <martin@ximian.com>
2597 * namespace.cs: Fixed that bug which caused a crash when compiling
2600 2003-07-20 Miguel de Icaza <miguel@ximian.com>
2602 * typemanager.cs (LookupTypeReflection): Never expose types which
2603 are NotPublic, NestedPrivate, NestedAssembly, or
2604 NestedFamANDAssem. We used to return these, and later do a check
2605 that would report a meaningful error, but the problem is that we
2606 would not get the real match, if there was a name override.
2608 2003-07-18 Miguel de Icaza <miguel@ximian.com>
2610 * namespace.cs (Namespace, Name): Do not compute the namespace
2611 name dynamically, compute it in the constructor. This reduced
2612 memory usage by 1697 KB.
2614 * driver.cs: Use --pause to pause at the end.
2616 2003-07-17 Peter Williams <peter@newton.cx>
2618 * Makefile: Change the name of the test target so that it doesn't
2619 conflict with the recursive test target.
2621 2003-07-17 Miguel de Icaza <miguel@ximian.com>
2623 * expression.cs (LocalVariableReference.Emit, EmitAssign,
2624 AddressOf): Do not use EmitThis, that was wrong, use the actual
2627 2003-07-15 Miguel de Icaza <miguel@ximian.com>
2629 * class.cs (MethodData.Define): While checking if a method is an
2630 interface implementation, improve the test: If we are not public
2631 (use new test here: use the computed MethodAttributes directly,
2632 instead of the parsed modifier flags) check if the `implementing'
2633 method comes from an interface or not.
2635 * pending.cs (VerifyPendingMethods): Slightly better error
2638 * makefile: add test target that does the mcs bootstrap.
2640 2003-07-16 Ravi Pratap <ravi@ximian.com>
2642 * interface.cs (Define): Do nothing here since there are no
2643 members to populate etc. Move the attribute emission out of here
2644 since this was just totally the wrong place to put it. Attribute
2645 application happens during the 'Emit' phase, not in the 'Define'
2648 (Emit): Add this method and move the attribute emission here
2650 * rootcontext.cs (EmitCode): Call the Emit method on interface
2653 2003-07-14 Ravi Pratap M <ravi@ximian.com>
2655 * expression.cs (OverloadResolve): Report error only if Location
2656 is not 'Null' which means that there was a probe going on.
2658 2003-07-14 Martin Baulig <martin@ximian.com>
2660 * expression.cs (ConditionalLogicalOperator): New public class to
2661 implement user defined conditional logical operators.
2662 This is section 14.11.2 in the spec and bug #40505.
2664 2003-07-14 Martin Baulig <martin@ximian.com>
2666 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
2668 2003-07-14 Martin Baulig <martin@ximian.com>
2670 * codegen.cs (EmitContext.InFixedInitializer): New public field.
2672 * ecore.cs (IVariable.VerifyFixed): New interface method.
2674 * expression.cs (Unary.ResolveOperator): When resolving the `&'
2675 operator, check whether the variable is actually fixed. Fixes bug
2676 #36055. Set a variable definitely assigned when taking its
2677 address as required by the spec.
2679 * statement.cs (LocalInfo.IsFixed): New field.
2680 (LocalInfo.MakePinned): Set `IsFixed' to true.
2682 2003-07-14 Ravi Pratap M <ravi@ximian.com>
2684 * attribute.cs (Attribute.Resolve): While doing a Member lookup
2685 for .ctors, ensure that we only ask for members declared in the
2686 attribute type (BindingFlags.DeclaredOnly).
2690 * expression.cs (Error_WrongNumArguments): Report error 1501
2691 correctly the way CSC does.
2693 2003-07-13 Martin Baulig <martin@ximian.com>
2695 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
2696 lookup on the fully qualified name, to make things like "X.X" work
2697 where "X.X" is a fully qualified type name, but we also have a
2698 namespace "X" in the using list. Fixes #41975.
2700 2003-07-13 Martin Baulig <martin@ximian.com>
2702 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
2703 function. If we're a CompoundAssign, we need to create an embedded
2704 CompoundAssign, not an embedded Assign.
2705 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
2708 2003-07-13 Martin Baulig <martin@ximian.com>
2710 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
2711 work to fix bug #46088.
2713 2003-07-13 Ravi Pratap <ravi@ximian.com>
2715 * class.cs (Operator.Emit): Do not emit attributes here - it is
2716 taken care of by the Method class that we delegate too. This takes
2719 2003-07-10 Martin Baulig <martin@ximian.com>
2721 * expression.cs (TypeOfVoid): New class.
2722 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
2724 2003-07-10 Martin Baulig <martin@ximian.com>
2726 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
2729 2003-07-10 Martin Baulig <martin@ximian.com>
2731 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
2732 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
2734 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
2736 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
2738 2003-07-10 Martin Baulig <martin@ximian.com>
2740 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
2741 of decimal. Fixes #42850.
2743 NOTE: I also fixed the created byte blob, but this doesn't work on
2744 the MS runtime and csc never produces any byte blobs for decimal
2747 2003-07-10 Martin Baulig <martin@ximian.com>
2749 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
2750 structs; fixes #32068.
2751 (Block.AddChildVariableNames): Fixed #44302.
2753 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2755 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
2757 2003-07-07 Miguel de Icaza <miguel@ximian.com>
2759 * attribute.cs: And this test is onger needed.
2761 2003-07-08 Martin Baulig <martin@ximian.com>
2763 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
2764 inaccessible types. Fixes #36313.
2766 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
2768 * namespace.cs (NamespaceEntry): Create implicit entries for all
2769 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
2770 implicit entries for N1.N2 and N1.
2772 2003-07-08 Martin Baulig <martin@ximian.com>
2774 Rewrote the handling of namespaces to fix a lot of the issues
2775 wrt. `using' aliases etc.
2777 * namespace.cs (Namespace): Splitted this class into a
2778 per-assembly `Namespace' and a per-file `NamespaceEntry'.
2780 * typemanager.cs (TypeManager.IsNamespace): Removed.
2781 (TypeManager.ComputeNamespaces): Only compute namespaces from
2782 loaded assemblies here, not the namespaces from the assembly we're
2783 currently compiling.
2785 2003-07-08 Martin Baulig <martin@ximian.com>
2787 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
2789 2003-07-07 Miguel de Icaza <miguel@ximian.com>
2791 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
2794 I thought about the memory savings here, but LookupTypeReflection
2795 is used under already very constrained scenarios. Compiling
2796 corlib or mcs only exposes one hit, so it would not really reduce
2797 any memory consumption.
2799 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2801 * typemanager.cs: fixes bug #45889 by only adding public types from
2802 other assemblies to the list of known types.
2804 2003-07-07 Miguel de Icaza <miguel@ximian.com>
2806 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
2807 on the type we resolved.
2809 2003-07-05 Martin Baulig <martin@ximian.com>
2811 * pending.cs (PendingImplementation.ParentImplements): Don't
2812 create the proxy if the parent is abstract.
2814 * class.cs (TypeContainer.DefineIndexers): Process explicit
2815 interface implementations first. Fixes #37714.
2817 2003-07-04 Miguel de Icaza <miguel@ximian.com>
2819 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
2820 defined recursively; but since we modify the input parameters
2821 (left is set to `this' temporarily), we reset this value if the
2822 left_is_explicit is false, which gives the original semantics to
2825 * literal.cs (NullPointer): new class used to represent a null
2826 literal in a pointer context.
2828 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
2829 type is a pointer, use a NullPointer object instead of a
2830 NullLiteral. Closes 43687
2832 (ExplicitConversion): Convert pointer values using
2833 the conv opcode to the proper type.
2835 * ecore.cs (New): change ValueTypeVariable property into a method,
2836 that returns whether the valuetype is suitable for being used.
2838 * expression.cs (Binary.DoNumericPromotions): Only return if we
2839 the int constant was a valid uint, and we can return both left and
2840 right as uints. If not, we continue processing, to trigger the
2841 type conversion. This fixes 39018.
2843 * statement.cs (Block.EmitMeta): During constant resolution, set
2844 the CurrentBlock property on the emitcontext, so that we resolve
2845 constants propertly.
2847 2003-07-02 Martin Baulig <martin@ximian.com>
2849 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
2850 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
2852 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
2853 than emitting it here.
2855 * statement.cs: Fixed some more flow analysis bugs.
2857 2003-07-02 Martin Baulig <martin@ximian.com>
2859 * class.cs (MethodData.Define): When implementing interface
2860 methods, set Final unless we're Virtual.
2862 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
2863 check work for interface methods.
2865 2003-07-01 Martin Baulig <martin@ximian.com>
2867 * ecore.cs (EmitContext.This): Replaced this property with a
2868 GetThis() method which takes a Location argument. This ensures
2869 that we get the correct error location for a CS0188.
2871 2003-07-01 Miguel de Icaza <miguel@ximian.com>
2873 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
2874 ImplicitStandardConversion.
2876 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
2878 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
2880 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
2883 2003-06-30 Miguel de Icaza <miguel@ximian.com>
2885 * class.cs (Constructor.Define): Turn off initlocals for unsafe
2888 (MethodData.Define): Turn off initlocals for unsafe methods.
2890 2003-06-29 Miguel de Icaza <miguel@ximian.com>
2892 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
2893 complete; Fixes #37521.
2895 * delegate.cs: Use Modifiers.TypeAttr to compute the
2896 TypeAttributes, instead of rolling our own. This makes the flags
2897 correct for the delegates.
2899 2003-06-28 Miguel de Icaza <miguel@ximian.com>
2901 * class.cs (Constructor.Define): Set the private flag for static
2902 constructors as well.
2904 * cs-parser.jay (statement_expression): Set the return value to
2905 null, to avoid a crash when we catch an error.
2907 2003-06-24 Miguel de Icaza <miguel@ximian.com>
2909 * cs-parser.jay: Applied patch from Jackson that adds support for
2910 extern and unsafe modifiers to destructor declarations.
2912 * expression.cs: Report error 21 if the user is trying to index a
2915 * driver.cs: Add an error message, suggested by the bug report.
2917 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
2918 if we do not have a ": this ()" constructor initializer. Fixes 45149
2920 2003-06-14 Miguel de Icaza <miguel@ximian.com>
2922 * namespace.cs: Add some information to reduce FAQs.
2924 2003-06-13 Miguel de Icaza <miguel@ximian.com>
2926 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
2927 underlying enumeration types. Fixes #43915.
2929 * expression.cs: Treat ushort/short as legal values to be used in
2932 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
2934 * delegate.cs: transfer custom attributes for paramenters from
2935 the delegate declaration to Invoke and BeginInvoke.
2937 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
2939 * attribute.cs: handle custom marshalers and emit marshal info
2942 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
2944 * makefile.gnu: Added anonymous.cs to the compiler sources.
2946 2003-05-28 Miguel de Icaza <miguel@ximian.com>
2948 * iterators.cs: Change the name of the proxy class to include two
2951 * cs-parser.jay: Update grammar to include anonymous methods.
2953 * anonymous.cs: new file.
2955 2003-05-27 Miguel de Icaza <miguel@ximian.com>
2957 * class.cs (Field.Define): Add missing test for pointers and
2960 2003-05-27 Ravi Pratap <ravi@ximian.com>
2962 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
2963 we use the stobj opcode.
2965 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
2966 since it wasn't the correct fix.
2968 It still is puzzling that we are required to use stobj for IntPtr
2969 which seems to be a ValueType.
2971 2003-05-26 Miguel de Icaza <miguel@ximian.com>
2973 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
2974 during regular simple name resolution. Now, the trick is that
2975 instead of returning for processing the simplename, we do a
2976 TypeManager.LookupType (ie, a rooted lookup as opposed to a
2977 contextual lookup type). If a match is found, return that, if
2978 not, return for further composition.
2980 This fixes long-standing 30485.
2982 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
2983 using the address to initialize an object, do an Stobj instead of
2984 using the regular Stelem.
2986 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
2987 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
2988 Because if we are a BaseIndexerAccess that value will be true.
2991 * statement.cs (GotoCase.Resolve): Return after reporting an
2992 error, do not attempt to continue.
2994 * expression.cs (PointerArithmetic.Emit): If our operand is a
2995 long, convert our constants to match the operand before
2996 multiplying. Convert to I type before adding. Fixes 43670.
2998 2003-05-14 Ravi Pratap <ravi@ximian.com>
3000 * enum.cs (ImplicitConversionExists) : Rename to
3001 ImplicitEnumConversionExists to remove ambiguity.
3003 * ecore.cs (NullCast): New type of cast expression class which
3004 basically is very similar to EmptyCast with the difference being
3005 it still is a constant since it is used only to cast a null to
3009 * convert.cs (ImplicitReferenceConversion): When casting a null
3010 literal, we return a NullCast.
3012 * literal.cs (NullLiteralTyped): Remove - I don't see why this
3013 should be around anymore.
3015 The renaming (reported was slightly wrong). Corrections:
3017 ConvertImplicitStandard -> ImplicitConversionStandard
3018 ConvertExplicitStandard -> ExplicitConversionStandard
3020 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
3021 before passing them in !
3023 * convert.cs (ImplicitConversionStandard): When comparing for
3024 equal expr and target types, ensure that expr is not a
3027 In general, we must not be checking (expr_type ==
3028 target_type) in the top level conversion methods
3029 (ImplicitConversion, ExplicitConversion etc). This checking is
3030 done in the methods that they delegate to.
3032 2003-05-20 Miguel de Icaza <miguel@ximian.com>
3034 * convert.cs: Move Error_CannotConvertType,
3035 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
3036 ImplicitNumericConversion, ImplicitConversionExists,
3037 ImplicitUserConversionExists, StandardConversionExists,
3038 FindMostEncompassedType, FindMostSpecificSource,
3039 FindMostSpecificTarget, ImplicitUserConversion,
3040 ExplicitUserConversion, GetConversionOperators,
3041 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
3042 TryImplicitIntConversion, Error_CannotConvertImplicit,
3043 ConvertImplicitRequired, ConvertNumericExplicit,
3044 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
3045 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
3048 Perform the following renames:
3050 StandardConversionExists -> ImplicitStandardConversionExists
3051 ConvertImplicit -> ImplicitConversion
3052 ConvertImplicitStandard -> ImplicitStandardConversion
3053 TryImplicitIntConversion -> ImplicitIntConversion
3054 ConvertImplicitRequired -> ImplicitConversionRequired
3055 ConvertNumericExplicit -> ExplicitNumericConversion
3056 ConvertReferenceExplicit -> ExplicitReferenceConversion
3057 ConvertExplicit -> ExplicitConversion
3058 ConvertExplicitStandard -> ExplicitStandardConversion
3060 2003-05-19 Martin Baulig <martin@ximian.com>
3062 * statement.cs (TypeInfo.StructInfo): Made this type protected.
3063 (TypeInfo): Added support for structs having structs as fields.
3065 * ecore.cs (FieldExpr): Implement IVariable.
3066 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
3067 VariableInfo for the field.
3069 2003-05-18 Martin Baulig <martin@ximian.com>
3071 * expression.cs (This.DoResolve): Report a CS0027 if we're
3072 emitting a field initializer.
3074 2003-05-18 Martin Baulig <martin@ximian.com>
3076 * expression.cs (This.ResolveBase): New public function.
3077 (This.DoResolve): Check for CS0188.
3079 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
3082 * ecore.cs (MethodGroupExpr.DoResolve): Set the
3083 `instance_expression' to null if we don't have any non-static
3086 2003-05-18 Martin Baulig <martin@ximian.com>
3088 Reworked the way how local variables and parameters are handled by
3089 the flow analysis code.
3091 * statement.cs (TypeInfo, VariableMap): New public classes.
3092 (VariableInfo): New public class. This is now responsible for
3093 checking whether a variable has been assigned. It is used for
3094 parameters and local variables.
3095 (Block.EmitMeta): Take the InternalParameters as argument; compute
3096 the layout of the flow vectors here.
3097 (Block.LocalMap, Block.ParameterMap): New public properties.
3098 (FlowBranching): The .ctor doesn't get the InternalParameters
3099 anymore since Block.EmitMeta() now computes the layout of the flow
3101 (MyStructInfo): This class is now known as `StructInfo' and nested
3102 in `TypeInfo'; we don't access this directly anymore.
3104 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
3105 property and removed IsAssigned(), IsFieldAssigned(),
3106 SetAssigned() and SetFieldAssigned(); we now call them on the
3107 VariableInfo so we don't need to duplicate this code everywhere.
3109 * expression.cs (ParameterReference): Added `Block block' argument
3111 (LocalVariableReference, ParameterReference, This): The new
3112 VariableInfo class is now responsible for all the definite
3115 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
3116 IsParameterAssigned, SetParameterAssigned): Removed.
3118 2003-05-18 Martin Baulig <martin@ximian.com>
3120 * typemanager.cs (InitCoreTypes): Try calling
3121 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
3122 the 3-args-version. Corlib now also needs our `void_type'.
3123 (GetMethod): Added overloaded version which takes an optional
3124 `bool report_errors' to allow lookups of optional methods.
3126 2003-05-12 Martin Baulig <martin@ximian.com>
3128 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
3129 only used for locals and not for parameters.
3131 2003-05-12 Miguel de Icaza <miguel@ximian.com>
3133 * support.cs (InternalParameters.ParameterType): Return the
3134 ExternalType of the parameter.
3136 * parameter.cs (Parameter.ExternalType): drop the two arguments,
3139 2003-05-11 Miguel de Icaza <miguel@ximian.com>
3141 * class.cs (MethodData.Define): Do not set the `newslot' on
3142 interface members, if they are also flagged as "override".
3144 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
3145 better code for ++i and i++. This only works for static fields
3146 and local variables.
3148 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
3149 want to pull the DeclSpace out of the builder_to_declspace instead
3150 of the TypeBuilder (like in TypeContainer.FindMembers).
3152 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
3153 instead of LookupTypeContainer. Fixes the crash on .NET for
3154 looking up interface members.
3156 * const.cs: Create our own emit context during the Definition
3157 stage, so that constants are evaluated in the proper context, when
3158 a recursive definition happens.
3160 2003-05-11 Martin Baulig <martin@ximian.com>
3162 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
3163 new block for a switch section.
3164 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
3165 the adding/lookup in the switch block. Fixes #39828.
3167 2003-05-09 Miguel de Icaza <miguel@ximian.com>
3169 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
3170 functionality: I needed to convert the data after I had performed
3171 the add/sub operation into the operands type size.
3173 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
3174 pass the type for the box operation, otherwise the resulting
3175 object would have been of type object.
3177 (BoxedCast): Add constructor to specify the type to box as.
3179 2003-05-07 Miguel de Icaza <miguel@ximian.com>
3181 * iterators.cs: I was reusing the `count' variable inadvertently,
3182 take steps to not allow this to happen.
3184 2003-05-06 Miguel de Icaza <miguel@ximian.com>
3186 * attribute.cs (Attribute.Resolve): Params attributes are encoded
3187 by creating an array at the point where the params starts and
3188 putting all those arguments there, then adjusting the size of the
3191 2003-05-05 Miguel de Icaza <miguel@ximian.com>
3193 * expression.cs (New.AddressOf): Implement interface
3194 IMemoryLocation. This is used when the `new' operator is used in
3195 the context of an invocation to a method on a value type.
3197 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
3200 * namespace.cs: Also check the using aliases here.
3202 * driver.cs: Move the test for using validity after the types have
3203 been entered, so we do a single pass that also includes the using
3206 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
3207 in the regular case. CreateSiblingForFinally is doing extra
3210 * attribute.cs (GetAttributeArgumentExpression): Store the result
3211 on an out value, and use the return value to indicate failure
3212 instead of using null (which is a valid return for Constant.GetValue).
3214 * statement.cs: Perform the analysis flow for the increment
3215 portion after the statement, because this will be the real flow of
3216 execution. Fixes #42385
3218 * codegen.cs (EmitContext.EmitArgument,
3219 EmitContext.EmitStoreArgument): New helper functions when the
3220 RemapToProxy flag is set.
3222 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
3225 Add support for remapping parameters.
3227 * iterators.cs: Propagate parameter values; Store parameter
3228 values in the proxy classes.
3230 2003-05-04 Miguel de Icaza <miguel@ximian.com>
3232 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
3233 need a proxy reference; I do not know what I was thinking
3235 * cs-parser.jay (constructor_initializer): catch another error,
3236 and display nice message.
3238 (field_declaration): catch void field declaration
3239 to flag a better error.
3241 * class.cs (MemberBase.CheckBase): Report an error instead of a
3242 warning if a new protected member is declared in a struct.
3243 (Field.Define): catch the error of readonly/volatile.
3245 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
3247 (FieldExpr.AddressOf): ditto. Catch error where the address of a
3248 volatile variable is taken
3250 2003-05-02 Miguel de Icaza <miguel@ximian.com>
3252 * statement.cs (Fixed.Resolve): Report an error if we are not in
3255 2003-05-01 Miguel de Icaza <miguel@ximian.com>
3257 * typemanager.cs: reuse the code that handles type clashes for
3258 delegates and enumerations.
3260 * class.cs (Report28): Always report.
3262 * expression.cs (EncodeAsAttribute): Allow nulls here.
3264 2003-04-28 Miguel de Icaza <miguel@ximian.com>
3266 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
3267 the functionality for testing whether an expression is valid for
3268 an attribute here. Also handle the case of arrays of elements
3271 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
3272 encoding a linear array into an array of objects that are suitable
3273 to be passed to an CustomAttributeBuilder.
3275 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
3277 * ecore.cs: (FieldExpr): Handle field remapping here.
3279 * iteratators.cs: Pass the instance variable (if the method is an
3280 instance method) to the constructors, so we can access the field
3281 variables on the class.
3283 TODO: Test this with structs. I think the THIS variable on
3284 structs might have to be a pointer, and not a refenrece
3286 2003-04-27 Miguel de Icaza <miguel@ximian.com>
3288 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
3289 local variables to fields in a proxy class.
3291 * iterators.cs (PopulateProxy): Rename our internal fields to
3293 Create a <THIS> field if we are an instance method, so we can
3294 reference our parent container variables.
3295 (MapVariable): Called back from the EmitContext code to enter a
3296 new variable to field mapping into the proxy class (we just create
3300 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
3301 for using the remapped locals to fields.
3303 I placed the code here, because that gives the same semantics to
3304 local variables, and only changes the Emit code.
3306 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
3307 statements inside iterators.
3308 (VariableInfo): Add a FieldBuilder for the cases when we are
3309 remapping local variables to fields in a proxy class
3311 * ecore.cs (SimpleNameResolve): Avoid testing two times for
3312 current_block != null.
3314 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
3315 not cope with strings, as it has been moved to the
3316 TableSwitchEmit. Fixed bug in switch generation.
3318 * expression.cs (New.DoResolve): Provide more context for the user
3319 when reporting an error.
3321 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
3324 * expression.cs (MemberAccess.DoResolve): When we get a type back,
3325 check the permissions for it. Note than in a type-resolution
3326 context the check was already present in DeclSpace.ResolveType,
3327 but was missing from the MemberAccess.
3329 (ArrayCreation.CheckIndices): warn if the user has
3330 more nested levels of expressions, but there are no more
3331 dimensions specified. Avoids crash on bug 41906.
3333 2003-04-26 Miguel de Icaza <miguel@ximian.com>
3335 * statement.cs (Block): replace Implicit bool, for a generic
3337 New flag: `Unchecked'. This is used during the EmitMeta phase
3338 (which is out-of-line with the regular Resolve/Emit process for a
3339 statement, as this is done ahead of time, but still gets a chance
3340 to call constant resolve).
3342 (Block.Flags): new enum for adding a new flag.
3344 (Block.EmitMeta): track the state of unchecked.
3346 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
3347 to enable constant resolution to work there as well.
3349 2003-04-22 Miguel de Icaza <miguel@ximian.com>
3351 * typemanager.cs (ienumerable_type): Also look up
3352 System.Collections.IEnumerable.
3354 2003-04-21 Miguel de Icaza <miguel@ximian.com>
3356 TODO: Test more than one conditional per method.
3358 * class.cs (Indexer.Define): Report the location where the user is
3359 referencing the unsupported feature.
3361 (MethodData): Overload the use of `conditionals' to
3362 minimize the creation of needless ArrayLists. This saves roughly
3363 212kb on my machine.
3365 (Method): Implement the new IIteratorContainer interface.
3366 (Method.SetYields): Implement the method by setting the ModFlags
3367 to contain METHOD_YIELDS.
3369 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
3370 which just got set to null.
3372 * iterators.cs: New file.
3374 (Yield, YieldBreak): New statements.
3376 * statement.cs (Return.Resolve): Flag an error if we are used in
3379 * codegen.cs (InIterator): New flag set if the code is being
3380 compiled in an iterator method.
3382 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
3383 internal modifier, and we just use it to avoid adding extra
3384 fields, as this is seldom used.
3386 * cs-parser.jay: Add yield_statement (yield and yield break).
3388 * driver.cs: New flag -v2 to turn on version 2 features.
3390 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
3391 hashtable when v2 is enabled.
3393 2003-04-20 Miguel de Icaza <miguel@ximian.com>
3395 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
3396 there is already a namespace defined with this name.
3398 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
3399 people upgraded their corlibs.
3401 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
3402 always use fully qualified types, no need to use the compiler
3405 (TypeManager.IsNamespace): Use binarysearch.
3407 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
3408 AddDelegate): I did not quite use the new IsValid API properly: I
3409 have to pass the short-name and the fullname. I was passing only
3410 the basename instead of the fullname sometimes.
3412 (TypeContainer.DefineType): call NamespaceClash.
3414 * interface.cs (Interface.DefineType): use NamespaceClash before
3417 * delegate.cs (Delegate.DefineType): use NamespaceClash before
3420 * enum.cs: (Enum.DefineType): use NamespaceClash before
3423 * typemanager.cs (: 3-line patch that gives us some tasty 11%
3424 speed increase. First, use the negative_hits cache when we get a
3425 negative. Second, add the type with its full original name
3426 instead of the new . and + encoded name (reflection uses + to
3427 separate type from a nested type). Use LookupTypeReflection
3428 directly which bypasses the type->name hashtable (that we already
3429 know does not contain the type.
3431 * decl.cs (DeclSpace.ResolveTypeExpr): track the
3432 location/container type.
3434 * driver.cs: When passing utf8, use directly the UTF8Encoding.
3436 2003-04-19 Miguel de Icaza <miguel@ximian.com>
3438 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
3440 * delegate.cs (NewDelegate.Resolve): Test whether an instance
3441 method is being referenced in the method group from a static
3442 context, and report error 120 if so.
3444 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
3447 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
3448 is created, we create the A namespace).
3450 * cs-parser.jay: A namespace also introduces a DeclarationFound.
3453 2003-04-18 Miguel de Icaza <miguel@ximian.com>
3455 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
3456 invocation to ModuleBuilder.GetType with the same values will
3457 return a new type instance, so we need to cache its return
3460 * expression.cs (Binary.ResolveOperator): Only allow the compare
3461 operators on enums if they are of the same type.
3463 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
3464 types of ValueType on their own case. Before we were giving them
3465 the same treatment as objects.
3467 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
3468 fullname. Short name is used to compare against container name.
3469 Fullname is used to check against defined namespace names.
3471 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
3472 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
3474 (Method.CheckBase): Call parent.
3475 (MemberBase.CheckBase): Check for protected members on sealed
3477 (PropertyBase.CheckBase): Call parent.
3478 (Field.Define): Call parent.
3480 * report.cs: Negative error codes are now mapped to 8000 - code,
3481 so that the display is render more nicely.
3483 * typemanager.cs: Do not use try/catch, instead report a regular
3486 (GetPointerType, GetReferenceType): These methods provide
3487 mechanisms to obtain the T* and T& from a T. We had the code
3488 previously scattered around the code base, and it also used
3489 TypeManager.LookupType that would go through plenty of caches.
3490 This one goes directly to the type source.
3492 In some places we did the Type.GetType followed by
3493 ModuleBuilder.GetType, but not in others, so this unifies the
3496 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
3497 statements now that we have namespace information.
3499 * typemanager.cs (IsNamespace): New method, returns whether the
3500 string presented is a namespace or not.
3502 (ComputeNamespaces): New public entry point, computes the list of
3503 available namespaces, using the GetNamespaces API call in Mono, or
3504 the slower version in MS.NET.
3506 Now before we start the semantic analysis phase, we have a
3507 complete list of namespaces including everything that the user has
3510 Deleted old code to cache namespaces in .nsc files.
3512 2003-04-17 Miguel de Icaza <miguel@ximian.com>
3514 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
3515 class/struct location definition Location for the implicit
3516 constructor location.
3518 (Operator.Define): Use the location of the operator for the
3519 implicit Method definition.
3521 (Constructor.Emit): use the constructor location for the implicit
3522 base initializer constructor.
3524 * ecore.cs: Remove ITypeExpression. This interface is now gone,
3525 and the Expression class now contains two new methods:
3527 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
3528 isolate type lookup from the rest of the resolution process.
3530 Since we use Expressions to hold type definitions due to the way
3531 we parse the input we have historically overloaded Resolve to
3532 perform the Type lookups if a special flag is passed. Now this is
3533 eliminated and two methods take their place.
3535 The differences in the two methods between xStep and xTerminal is
3536 that xStep is involved in our current lookup system that uses
3537 SimpleNames to compose a name, while xTerminal is used just to
3538 catch the case where the simplename lookup failed.
3540 2003-04-16 Miguel de Icaza <miguel@ximian.com>
3542 * expression.cs (ResolveMemberAccess): Remove redundant code.
3543 TypeExpr expressions are always born fully resolved.
3545 * interface.cs (PopulateMethod): Do not lookup the types twice.
3546 We were doing it once during SemanticAnalysis and once during
3549 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
3550 in local variable type definitions, were being returned as a
3551 SimpleName (we decomposed everything into a string), that is
3552 because primary_expression was being used instead of a type in the
3553 grammar (reduce/reduce conflicts).
3555 The part that was wrong is that we converted the expression into a
3556 string (an oversimplification in one hand, compounded with primary
3557 expressions doing string concatenation).
3563 Would return "A.B.C[]" as a SimpleName. This stopped things like
3564 using clauses from working on this particular context. And a type
3565 was being matched directly against "A.B.C[]".
3567 We now use the correct approach, and allow for ComposedCast to be
3568 part of the unary expression. So the "A.B.C []" become a composed
3569 cast of "A.B.C" (as a nested group of MemberAccess with a
3570 SimpleName at the end) plus the rank composition "[]".
3574 2003-04-10 Miguel de Icaza <miguel@ximian.com>
3576 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
3577 for the access level checking.
3579 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
3580 `TypeContainer container', because I kept getting confused when I
3581 was debugging this code.
3583 * expression.cs (Indexers): Instead of tracking getters/setters,
3584 we now track them in parallel. We create one arraylist less, but
3585 most importantly it is possible now for the LValue code to find a
3586 matching get for a set.
3588 (IndexerAccess.DoResolveLValue): Update the code.
3589 GetIndexersForType has been modified already to extract all the
3590 indexers from a type. The code assumed it did not.
3592 Also make the code set the correct return type for the indexer.
3593 This was fixed a long time ago for properties, but was missing for
3594 indexers. It used to be void_type.
3596 (Binary.Emit): Test first for doubles instead of
3597 floats, as they are more common.
3599 (Binary.EmitBranchable): Use the .un version of the branch opcodes
3600 when dealing with floats and the <=, >= operators. This fixes bug
3603 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
3604 to load the array value by emitting a load on the foreach variable
3605 type. This was incorrect.
3607 We now emit the code to load an element using the the array
3608 variable type, and then we emit the conversion operator.
3612 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
3614 * attribute.cs: Avoid allocation of ArrayLists in the common case.
3616 2003-04-09 Miguel de Icaza <miguel@ximian.com>
3618 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
3619 test for protection before we test for signatures.
3621 (MethodSignature.ToString): implement.
3623 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
3624 to the case where we reduced into a LongConstant.
3626 * decl.cs (CheckAccessLevel): If the type is an array, we can not
3627 depend on whether the information is acurrate, because the
3628 Microsoft runtime will always claim that the array type is public,
3629 regardless of the real state.
3631 If the type is a pointer, another problem happens: the type is
3632 reported as non-public in Microsoft.
3634 In both cases we have to call CheckAccessLevel recursively with
3635 the underlying type as the argument to be tested.
3637 2003-04-08 Miguel de Icaza <miguel@ximian.com>
3639 * assign.cs (Assign.Emit): If we are dealing with a compound
3640 assignment expression, we should use the code path that stores the
3641 intermediate result in a temporary value. This fixes #40903.
3643 *expression.cs (Indirection.ToString): Provide ToString method for
3646 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
3648 * class.cs: Null out fields holding references to Block objects so
3649 they can be garbage collected.
3651 * expression.cs (OverloadResolve): Remove unused local.
3653 2003-04-07 Martin Baulig <martin@ximian.com>
3655 * codegen.cs (EmitContext.CurrentFile): New public field.
3656 (EmitContext.Mark): Use the CurrentFile to check whether the
3657 location is in the correct file.
3658 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
3660 2003-04-07 Martin Baulig <martin@ximian.com>
3662 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
3664 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
3665 location. [FIXME: The location argument which gets passed to this
3666 method is sometimes wrong!]
3668 2003-04-07 Nick Drochak <ndrochak@gol.com>
3670 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
3672 2003-04-07 Miguel de Icaza <miguel@ximian.com>
3674 * expression.cs (Indirection.EmitAssign): We were using the
3675 temporary, but returning immediately instead of continuing the
3678 2003-04-06 Martin Baulig <martin@ximian.com>
3680 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
3681 if it's a nested child, but also deriving from the outer class.
3684 * typemanager.cs (IsNestedChildOf): Make this work if it's a
3685 nested child, but also deriving from the outer class. See
3687 (FilterWithClosure): We may access private members of the outer
3688 class if we're a nested child and deriving from the outer class.
3689 (RealMemberLookup): Only set `closure_private_ok' if the
3690 `original_bf' contained BindingFlags.NonPublic.
3692 2003-04-05 Martin Baulig <martin@ximian.com>
3694 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
3695 probe if its a type parameter, and if so, flag an error.
3697 * decl.cs: Move here the SetParameterInfo code from class.cs.
3698 Handle IsGeneric here.
3700 Handle a variety of errors in the parameter info definition.
3702 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
3703 type parameters here.
3705 * cs-parser.jay (class_declaration): report errors for parameters
3708 2003-01-21 Miguel de Icaza <miguel@ximian.com>
3710 * generic.cs: New file, contains support code for generics.
3712 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
3713 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
3715 Update parser for the above removals.
3717 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
3718 now taken care of in the parser.
3720 2003-04-02 Miguel de Icaza <miguel@ximian.com>
3722 * class.cs (Event.Define): Do not allow abstract events to have
3725 2003-04-01 Miguel de Icaza <miguel@ximian.com>
3727 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
3728 block in event declarations.
3730 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
3731 value type, get its address.
3733 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
3734 leaving a class on the stack instead of a boolean value (int
3735 0/1). Change the code so we compare against null, and then the
3736 result against zero.
3738 * class.cs (TypeContainer.GetClassBases): We were checking for the
3739 parent class being sealed too late.
3741 * expression.cs (Binary.Emit): For <= and >= when dealing with
3742 floating point values, use cgt.un and clt.un instead of cgt and
3745 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
3747 * statement.cs: Apply the same optimization as MS: skip the
3748 GetEnumerator returning an IEnumerator, and use the one returning a
3749 CharEnumerator instead. This allows us to avoid the try-finally block
3752 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
3754 * cs-parser.jay: Attributes cannot be applied to
3755 namespaces. Fixes #40473
3757 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3760 (Add*): check if the name is valid using the full name for constants,
3761 fields, properties and events.
3763 2003-03-28 Miguel de Icaza <miguel@ximian.com>
3765 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
3766 char constants to be part of the enumeration.
3768 * expression.cs (Conditional.DoResolve): Add support for operator
3769 true. Implements the missing functionality from 14.12
3771 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
3772 operator true/false as required by the spec.
3774 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
3775 implicit conversion to boolean.
3777 * statement.cs (Statement.ResolveBoolean): A boolean expression is
3778 also one where the type implements `operator true'.
3780 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
3781 get an expression that will invoke operator true based on an
3784 (GetConversionOperators): Removed the hack that called op_True
3787 (Expression.ResolveBoolean): Move this from Statement.
3789 2003-03-17 Miguel de Icaza <miguel@ximian.com>
3791 * ecore.cs (FieldExpr): do not allow initialization of initonly
3792 fields on derived classes
3794 2003-03-13 Martin Baulig <martin@ximian.com>
3796 * statement.cs (Block.Emit): Call ig.BeginScope() and
3797 ig.EndScope() when compiling with debugging info; call
3798 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
3800 2003-03-08 Miguel de Icaza <miguel@ximian.com>
3802 * expression.cs (Indexers): Do not construct immediately, allow
3803 for new members to be appended as we go. Fixes 38143
3805 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3807 * expression.cs: save/restore context when resolving an unchecked
3810 2003-03-05 Miguel de Icaza <miguel@ximian.com>
3812 * cfold.cs: Catch division by zero in modulus operator during
3815 2003-03-03 Miguel de Icaza <miguel@ximian.com>
3817 * interface.cs (Interface.DefineMembers): Avoid defining members
3820 2003-02-27 Miguel de Icaza <miguel@ximian.com>
3822 * driver.cs: handle the +/- options for -noconfig
3824 * statement.cs (Unckeched.Resolve): Also track the state of
3825 unchecked in the Resolve phase.
3827 2003-02-27 Martin Baulig <martin@ximian.com>
3829 * ecore.cs (Expression.MemberLookup): Don't create a
3830 MethodGroupExpr for something which is not a method. Fixes #38291.
3832 2003-02-25 Miguel de Icaza <miguel@ximian.com>
3834 * class.cs (MemberBase.CheckParameters): Also check that the type
3835 is unmanaged if it is a pointer.
3837 * expression.cs (SizeOf.Resolve): Add location information.
3839 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
3840 a managed type is declared.
3842 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
3843 parameter modifiers as well. Fixes bug 38606
3845 * class.cs: Very sad. Am backing out the speed up changes
3846 introduced by the ArrayList -> Array in the TypeContainer, as they
3847 were not actually that much faster, and introduced a bug (no error
3848 reports on duplicated methods).
3850 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
3851 source first, this will guarantee that we have a valid expression
3852 before calling in lower levels functions that will require a
3853 resolved object. Then use this original_source in the
3854 target.ResolveLValue instead of the original source that was
3857 Another change. Use target.Resolve instead of LValueResolve.
3858 Although we are resolving for LValues, we will let the Assign code
3859 take care of that (it will be called again from Resolve). This
3860 basically allows code like this:
3862 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
3863 class Y { void A (X x) { x [0] += o; }
3865 The problem was that the indexer was trying to resolve for
3866 set_Item (idx, object o) and never finding one. The real set_Item
3867 was set_Item (idx, X). By delaying the process we get the right
3872 2003-02-23 Martin Baulig <martin@ximian.com>
3874 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
3875 while calling DoEmit ().
3877 * codegen.cs (EmitContext.Mark): Don't mark locations in other
3878 source files; if you use the #line directive inside a method, the
3879 compiler stops emitting line numbers for the debugger until it
3880 reaches the end of the method or another #line directive which
3881 restores the original file.
3883 2003-02-23 Martin Baulig <martin@ximian.com>
3885 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
3887 2003-02-23 Martin Baulig <martin@ximian.com>
3889 * statement.cs (Block.AddChildVariableNames): We need to call this
3890 recursively, not just for our immediate children.
3892 2003-02-23 Martin Baulig <martin@ximian.com>
3894 * class.cs (Event.Define): Always make the field private, like csc does.
3896 * typemanager.cs (TypeManager.RealMemberLookup): Make events
3897 actually work, fixes bug #37521.
3899 2003-02-23 Miguel de Icaza <miguel@ximian.com>
3901 * delegate.cs: When creating the various temporary "Parameters"
3902 classes, make sure that we call the ComputeAndDefineParameterTypes
3903 on those new parameters (just like we do with the formal ones), to
3904 allow them to be resolved in the context of the DeclSpace.
3906 This fixes the bug that Dick observed in Bugzilla #38530.
3908 2003-02-22 Miguel de Icaza <miguel@ximian.com>
3910 * expression.cs (ResolveMemberAccess): When resolving a constant,
3911 do not attempt to pull a constant if the value was not able to
3912 generate a valid constant.
3914 * const.cs (LookupConstantValue): Do not report more errors than required.
3916 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3918 * expression.cs: fixes bug #38328.
3920 2003-02-18 Miguel de Icaza <miguel@ximian.com>
3922 * class.cs: Changed all the various members that can be part of a
3923 class from being an ArrayList to be an Array of the right type.
3924 During the DefineType type_list, interface_list, delegate_list and
3925 enum_list are turned into types, interfaces, delegates and enums
3928 And during the member population, indexer_list, event_list,
3929 constant_list, field_list, instance_constructor_list, method_list,
3930 operator_list and property_list are turned into their real arrays.
3932 Although we could probably perform this operation earlier, for
3933 good error reporting we need to keep the lists and remove the
3934 lists for longer than required.
3936 This optimization was triggered by Paolo profiling the compiler
3937 speed on the output of `gen-sample-program.pl' perl script.
3939 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
3940 not crash in methods like MemberLookupFailed that use this field.
3942 This problem arises when the compiler fails to resolve a type
3943 during interface type definition for example.
3945 2003-02-18 Miguel de Icaza <miguel@ximian.com>
3947 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
3948 inherit from System.Object, so we have to stop at null, not only
3949 when reaching System.Object.
3951 2003-02-17 Miguel de Icaza <miguel@ximian.com>
3953 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
3954 DeclaredOnly because the parent indexer might have had a different
3955 name, but did not loop until the top of the hierarchy was reached.
3957 The problem this one fixes is 35492: when a class implemented an
3958 indexer from an interface, we were getting the interface method
3959 (which was abstract) and we were flagging an error (can not invoke
3962 This also keeps bug 33089 functioning, and test-148 functioning.
3964 * typemanager.cs (IsSpecialMethod): The correct way of figuring
3965 out if a method is special is to see if it is declared in a
3966 property or event, or whether it is one of the predefined operator
3967 names. This should fix correctly #36804.
3969 2003-02-15 Miguel de Icaza <miguel@ximian.com>
3971 The goal here is to remove the dependency on EmptyCast.Peel ().
3972 Killing it completely.
3974 The problem is that currently in a number of places where
3975 constants are expected, we have to "probe" for an EmptyCast, and
3976 Peel, which is not the correct thing to do, as this will be
3977 repetitive and will likely lead to errors.
3979 The idea is to remove any EmptyCasts that are used in casts that
3980 can be reduced to constants, so we only have to cope with
3983 This bug hunt was triggered by Bug 37363 and the desire to remove
3984 the duplicate pattern where we were "peeling" emptycasts to check
3985 whether they were constants. Now constants will always be
3988 * ecore.cs: Use an enumconstant here instead of wrapping with
3991 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
3992 throwing me off. By handling this we can get rid of a few hacks.
3994 * statement.cs (Switch): Removed Peel() code.
3996 2003-02-14 Miguel de Icaza <miguel@ximian.com>
3998 * class.cs: Location information for error 508
4000 * expression.cs (New.DoResolve): Add a guard against double
4001 resolution of an expression.
4003 The New DoResolve might be called twice when initializing field
4004 expressions (see EmitFieldInitializers, the call to
4005 GetInitializerExpression will perform a resolve on the expression,
4006 and later the assign will trigger another resolution
4008 This leads to bugs (#37014)
4010 * delegate.cs: The signature for EndInvoke should contain any ref
4011 or out parameters as well. We were not doing this in the past.
4013 * class.cs (Field.Define): Do not overwrite the type definition
4014 inside the `volatile' group. Turns out that volatile enumerations
4015 were changing the type here to perform a validity test, which
4018 2003-02-12 Miguel de Icaza <miguel@ximian.com>
4020 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
4021 and structs, we do not want to load the instance variable
4023 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
4024 enum_type has to be handled like an object reference (implicit
4025 conversions exists from this to object), but the regular IsClass
4026 and IsValueType tests will never return true for this one.
4028 Also we use TypeManager.IsValueType instead of type.IsValueType,
4029 just for consistency with the rest of the code (this is only
4030 needed if we ever use the construct exposed by test-180.cs inside
4031 corlib, which we dont today).
4033 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
4035 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
4038 2003-02-09 Martin Baulig <martin@ximian.com>
4040 * namespace.cs (Namespace..ctor): Added SourceFile argument.
4041 (Namespace.DefineNamespaces): New static public method; this is
4042 called when we're compiling with debugging to add all namespaces
4045 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
4046 pass it to the Namespace's .ctor.
4048 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
4049 and MethodBase arguments; pass the namespace ID to the symwriter;
4050 pass the MethodBase instead of the token to the symwriter.
4051 (SymbolWriter.DefineNamespace): New method to add a namespace to
4054 2003-02-09 Martin Baulig <martin@ximian.com>
4056 * symbolwriter.cs: New file. This is a wrapper around
4057 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
4058 methods here in near future.
4060 2003-02-09 Martin Baulig <martin@ximian.com>
4062 * codegen.cs (EmitContext.Mark): Just pass the arguments to
4063 ILGenerator.MarkSequencePoint() which are actually used by the
4066 2003-02-09 Martin Baulig <martin@ximian.com>
4068 * location.cs (SourceFile): New public sealed class. This
4069 contains the name and an index which is used in the location's token.
4070 (Location): Reserve an appropriate number of bits in the token for
4071 the source file instead of walking over that list, this gives us a
4072 really huge performance improvement when compiling with debugging.
4074 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
4075 `SourceFile' argument instead of a string.
4076 (Driver.ProcessFile): Add all the files via Location.AddFile(),
4077 but don't parse/tokenize here, we need to generate the list of all
4078 source files before we do that.
4079 (Driver.ProcessFiles): New static function. Parses/tokenizes all
4082 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
4083 instead of a string.
4085 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
4088 2003-02-09 Martin Baulig <martin@ximian.com>
4090 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
4091 filename on `#line default'.
4093 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
4095 * statement.cs: don't clear the pinned var when the fixed statement
4096 returns from the method (fixes bug#37752).
4098 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
4100 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
4103 2003-02-07 Martin Baulig <martin@ximian.com>
4105 * driver.cs: Removed the `--debug-args' command line argument.
4107 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
4108 automatically by the AsssemblyBuilder.
4109 (CodeGen.InitializeSymbolWriter): We don't need to call any
4110 initialization function on the symbol writer anymore. This method
4111 doesn't take any arguments.
4113 2003-02-03 Miguel de Icaza <miguel@ximian.com>
4115 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
4116 from referenced assemblies as well.
4118 2003-02-02 Martin Baulig <martin@ximian.com>
4120 * class.cs (MethodData.Emit): Generate debugging info for external methods.
4122 2003-02-02 Martin Baulig <martin@ximian.com>
4124 * class.cs (Constructor.Emit): Open the symbol writer before
4125 emitting the constructor initializer.
4126 (ConstructorInitializer.Emit): Call ec.Mark() to allow
4127 single-stepping through constructor initializers.
4129 2003-01-30 Miguel de Icaza <miguel@ximian.com>
4131 * class.cs: Handle error 549: do not allow virtual methods in
4134 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
4136 * decl.cs: Check access levels when resolving types
4138 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
4140 * statement.cs: Add parameters and locals set in catch blocks that might
4141 return to set vector
4143 2003-01-29 Miguel de Icaza <miguel@ximian.com>
4145 * class.cs (Operator): Set the SpecialName flags for operators.
4147 * expression.cs (Invocation.DoResolve): Only block calls to
4148 accessors and operators on SpecialName methods.
4150 (Cast.TryReduce): Handle conversions from char constants.
4153 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
4155 * statement.cs: small memory and time optimization in FlowBranching.
4157 2003-01-28 Pedro Mart <yoros@wanadoo.es>
4159 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
4160 problem that the last fix but in the other sid (Set).
4162 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
4163 access when there is no indexer in the hierarchy.
4165 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
4167 * class.cs: Combine some if statements.
4169 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4171 * driver.cs: fixed bug #37187.
4173 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
4175 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
4176 any indexer, it's needed to build a list with all the indexers in the
4177 hierarchy (AllGetters), else we have problems. Fixes #35653.
4179 2003-01-23 Miguel de Icaza <miguel@ximian.com>
4181 * class.cs (MethodData.Define): It is wrong for an interface
4182 implementation to be static in both cases: explicit and implicit.
4183 We were only handling this in one case.
4185 Improve the if situation there to not have negations.
4187 * class.cs (Field.Define): Turns out that we do not need to check
4188 the unsafe bit on field definition, only on usage. Remove the test.
4190 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4192 * driver.cs: use assembly.Location instead of Codebase (the latest
4193 patch made mcs fail when using MS assemblies).
4195 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
4197 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
4198 get the path to *corlib.dll.
4200 2003-01-21 Nick Drochak <ndrochak@gol.com>
4204 * typemanager.cs: Remove compiler warnings
4206 2003-01-20 Duncan Mak <duncan@ximian.com>
4208 * AssemblyInfo.cs: Bump the version number to 0.19.
4210 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4212 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
4214 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
4216 * class.cs (Constructor::Emit): Emit debugging info for constructors.
4218 2003-01-17 Miguel de Icaza <miguel@ximian.com>
4220 * cs-parser.jay: Small fix: we were not comparing the constructor
4221 name correctly. Thanks to Zoltan for the initial pointer.
4223 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
4225 * cs-tokenizer.cs: Set file name when specified with #line
4227 2003-01-15 Miguel de Icaza <miguel@ximian.com>
4229 * cs-parser.jay: Only perform the constructor checks here if we
4230 are named like the class; This will help provider a better
4231 error. The constructor path is taken when a type definition is
4232 not found, but most likely the user forgot to add the type, so
4233 report that rather than the constructor error.
4235 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
4237 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
4240 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4242 * cs-parser.jay: Add cleanup call.
4244 2003-01-13 Duncan Mak <duncan@ximian.com>
4246 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
4247 consistent with other methods.
4249 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4251 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
4253 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
4255 * attribute.cs: only set GuidAttr to true when we have a
4258 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4262 * typemanager.cs: fixes to allow mcs compile corlib with the new
4263 Type.IsSubclassOf fix.
4265 2003-01-08 Miguel de Icaza <miguel@ximian.com>
4267 * expression.cs (LocalVariableReference.DoResolve): Classify a
4268 constant as a value, not as a variable. Also, set the type for
4271 * cs-parser.jay (fixed_statement): take a type instead of a
4272 pointer_type, so we can produce a better error message later.
4274 * statement.cs (Fixed.Resolve): Flag types that are not pointers
4277 (For.DoEmit): Make inifinite loops have a
4278 non-conditional branch back.
4280 (Fixed.DoEmit): First populate the pinned variables, then emit the
4281 statement, then clear the variables. Before I was emitting the
4282 code once for each fixed piece.
4285 2003-01-08 Martin Baulig <martin@ximian.com>
4287 * statement.cs (FlowBranching.MergeChild): A break in a
4288 SWITCH_SECTION does not leave a loop. Fixes #36155.
4290 2003-01-08 Martin Baulig <martin@ximian.com>
4292 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
4293 lives in the same number space than `param_map'. Fixes #36154.
4295 2003-01-07 Miguel de Icaza <miguel@ximian.com>
4297 * cs-parser.jay (constructor_declaration): Set the
4298 Constructor.ModFlags before probing for it. This makes the
4299 compiler report 514, 515 and 132 (the code was there, but got
4302 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
4303 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
4304 (GotoCase.Resolve): Set `Returns' to ALWAYS.
4306 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
4308 * enum.cs: create the enum static fields using the enum type.
4310 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
4312 * class.cs: don't try to create the ParamBuilder for the return
4313 type if it's not needed (and handle it breaking for the ms runtime
4316 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
4318 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
4320 2002-12-29 Miguel de Icaza <miguel@ximian.com>
4322 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
4323 the command. This showed up while compiling the JANET source
4324 code, which used \r as its only newline separator.
4326 2002-12-28 Miguel de Icaza <miguel@ximian.com>
4328 * class.cs (Method.Define): If we are an operator (because it
4329 reuses our code), then set the SpecialName and HideBySig. #36128
4331 2002-12-22 Miguel de Icaza <miguel@ximian.com>
4333 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
4334 exception, report error 120 `object reference required'.
4336 * driver.cs: Add --pause option, used during to measure the size
4337 of the process as it goes with --timestamp.
4339 * expression.cs (Invocation.DoResolve): Do not allow methods with
4340 SpecialName to be invoked.
4342 2002-12-21 Miguel de Icaza <miguel@ximian.com>
4344 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
4345 number before adding it.
4347 2002-12-21 Ravi Pratap <ravi@ximian.com>
4349 * ecore.cs (StandardImplicitConversion): When in an unsafe
4350 context, we allow conversion between void * to any other pointer
4351 type. This fixes bug #35973.
4353 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
4355 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
4356 is not thrown when extensionless outputs are used
4358 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4360 * rootcontext.cs: fixed compilation of corlib.
4362 2002-12-19 Miguel de Icaza <miguel@ximian.com>
4364 * attribute.cs (Attributes.Contains): Add new method.
4366 * class.cs (MethodCore.LabelParameters): if the parameter is an
4367 `out' parameter, check that no attribute `[In]' has been passed.
4369 * enum.cs: Handle the `value__' name in an enumeration.
4371 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
4373 * decl.cs: Added special case to allow overrides on "protected
4376 2002-12-18 Ravi Pratap <ravi@ximian.com>
4378 * attribute.cs (Attributes.AddAttributeSection): Rename to this
4379 since it makes much more sense.
4381 (Attributes.ctor): Don't require a Location parameter.
4383 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
4385 * attribute.cs (ApplyAttributes): Remove extra Location parameters
4386 since we already have that information per attribute.
4388 * everywhere : make appropriate changes.
4390 * class.cs (LabelParameters): Write the code which actually
4391 applies attributes to the return type. We can't do this on the MS
4392 .NET runtime so we flag a warning in the case an exception is
4395 2002-12-18 Miguel de Icaza <miguel@ximian.com>
4397 * const.cs: Handle implicit null conversions here too.
4399 2002-12-17 Ravi Pratap <ravi@ximian.com>
4401 * class.cs (MethodCore.LabelParameters): Remove the extra
4402 Type [] parameter since it is completely unnecessary. Instead
4403 pass in the method's attributes so that we can extract
4404 the "return" attribute.
4406 2002-12-17 Miguel de Icaza <miguel@ximian.com>
4408 * cs-parser.jay (parse): Use Report.Error to flag errors instead
4409 of ignoring it and letting the compile continue.
4411 * typemanager.cs (ChangeType): use an extra argument to return an
4412 error condition instead of throwing an exception.
4414 2002-12-15 Miguel de Icaza <miguel@ximian.com>
4416 * expression.cs (Unary.TryReduce): mimic the code for the regular
4417 code path. Perform an implicit cast in the cases where we can
4418 implicitly convert to one of the integral types, and then reduce
4419 based on that constant. This fixes bug #35483.
4421 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4423 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
4425 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4427 * namespace.cs: fixed bug #35489.
4429 2002-12-12 Miguel de Icaza <miguel@ximian.com>
4431 * class.cs: Remove some dead code.
4433 * cs-parser.jay: Estimate the number of methods needed
4434 (RootContext.MethodCount);
4436 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
4437 numbers instead of StringBuilders.
4439 * support.cs (PtrHashtable): Add constructor with initial size;
4440 We can now reduce reallocations of the method table.
4442 2002-12-10 Ravi Pratap <ravi@ximian.com>
4444 * attribute.cs (ApplyAttributes): Keep track of the emitted
4445 attributes on a per-target basis. This fixes bug #35413.
4447 2002-12-10 Miguel de Icaza <miguel@ximian.com>
4449 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
4450 default to the Windows 1252 encoding.
4452 (UnixParseOption): Support version, thanks to Alp for the missing
4455 * AssemblyInfo.cs: Add nice assembly information.
4457 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
4460 * cs-parser.jay: Allow a trailing comma before the close bracked
4461 in the attribute_section production.
4463 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
4464 address of the instance was being taken, I will take this out,
4465 because we take the address of the object immediately here.
4467 2002-12-09 Ravi Pratap <ravi@ximian.com>
4469 * typemanager.cs (AreMultipleAllowed): Take care of the most
4470 obvious case where attribute type is not in the current assembly -
4473 2002-12-08 Miguel de Icaza <miguel@ximian.com>
4475 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
4476 definitions, instead of doing that afterwards.
4478 Also we use a nice little hack, depending on the constructor, we
4479 know if we are a "composed" name or a simple name. Hence, we
4480 avoid the IndexOf test, and we avoid
4482 * codegen.cs: Add code to assist in a bug reporter to track down
4483 the source of a compiler crash.
4485 2002-12-07 Ravi Pratap <ravi@ximian.com>
4487 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
4488 types have been emitted for a given element and flag an error
4489 if something which does not have AllowMultiple set is used more
4492 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
4493 attribute types and their corresponding AllowMultiple properties
4495 (AreMultipleAllowed): Check the property for a given type.
4497 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
4498 property in the case we have a TypeContainer.
4500 (Attributes.AddAttribute): Detect duplicates and just skip on
4501 adding them. This trivial fix catches a pretty gross error in our
4502 attribute emission - global attributes were being emitted twice!
4504 Bugzilla bug #33187 is now fixed.
4506 2002-12-06 Miguel de Icaza <miguel@ximian.com>
4508 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
4511 * expression.cs (Binary.ResolveOperator): I can only use the
4512 Concat (string, string, string) and Concat (string, string,
4513 string, string) if the child is actually a concatenation of
4516 2002-12-04 Miguel de Icaza <miguel@ximian.com>
4518 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
4519 context where we need a 2-character lookahead.
4521 * pending.cs (PendingImplementation): Rework so we can keep track
4522 of interface types all the time, and flag those which were
4523 implemented by parents as optional.
4525 2002-12-03 Miguel de Icaza <miguel@ximian.com>
4527 * expression.cs (Binary.ResolveOperator): Use
4528 String.Concat(string,string,string) or
4529 String.Concat(string,string,string,string) when possible.
4531 * typemanager: More helper methods.
4534 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
4536 * pending.cs: remove the bogus return from GetMissingInterfaces()
4537 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
4539 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4541 * namespace.cs: avoid duplicated 'using xxx' being added to
4542 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
4543 when we get more than one 'using' statement for the same namespace.
4544 Report a CS0105 warning for it.
4546 2002-11-30 Miguel de Icaza <miguel@ximian.com>
4548 * cs-tokenizer.cs (consume_identifier): use read directly, instead
4549 of calling getChar/putback, uses internal knowledge of it.
4551 (xtoken): Reorder tokenizer so most common patterns are checked
4552 first. This reduces the compilation time in another 5% (from 8.11s
4553 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
4555 The parsing time is 22% of the compilation in mcs, and from that
4556 64% is spent on the tokenization process.
4558 I tried using a binary search for keywords, but this is slower
4559 than the hashtable. Another option would be to do a couple of
4562 * Not use a StringBuilder, instead use an array of chars,
4563 with a set value. Notice that this way we could catch
4564 the 645 error without having to do it *afterwards*.
4566 * We could write a hand-parser to avoid the hashtable
4567 compares altogether.
4569 The identifier consumption process takes 37% of the tokenization
4570 time. Another 15% is spent on is_number. 56% of the time spent
4571 on is_number is spent on Int64.Parse:
4573 * We could probably choose based on the string length to
4574 use Int32.Parse or Int64.Parse and avoid all the 64-bit
4577 Another 3% is spend on wrapping `xtoken' in the `token' function.
4579 Handle 0xa0 as whitespace (#34752)
4581 2002-11-26 Miguel de Icaza <miguel@ximian.com>
4583 * typemanager.cs (IsCLRType): New routine to tell whether a type
4584 is one of the builtin types.
4586 Maybe it needs to use TypeCodes to be faster. Maybe we could use
4587 typecode in more places instead of doing pointer comparissions.
4588 We could leverage some knowledge about the way the typecodes are
4591 New code to cache namespaces in assemblies, it is currently not
4592 invoked, to be used soon.
4594 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
4596 * expression.cs (Binary.ResolveOperator): specially handle
4597 strings, and do not perform user-defined operator overloading for
4600 2002-11-24 Miguel de Icaza <miguel@ximian.com>
4602 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
4603 internalcall as it is a pretty simple operation; Avoid whenever
4604 possible to call Char.IsLetter.
4606 (consume_identifier): Cut by half the number of
4607 hashtable calls by merging the is_keyword and GetKeyword behavior.
4609 Do not short-circuit, because if we do, we
4610 report errors (ie, #if false && true would produce an invalid
4614 2002-11-24 Martin Baulig <martin@ximian.com>
4616 * expression.cs (Cast.TryReduce): If we're in checked syntax,
4617 check constant ranges and report a CS0221. Fixes #33186.
4619 2002-11-24 Martin Baulig <martin@ximian.com>
4621 * cs-parser.jay: Make this work for uninitialized variable
4622 declarations in the `for' initializer. Fixes #32416.
4624 2002-11-24 Martin Baulig <martin@ximian.com>
4626 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
4627 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
4629 2002-11-24 Martin Baulig <martin@ximian.com>
4631 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
4632 argument; if true, we also check for user-defined conversions.
4633 This is only needed if both arguments are of a user-defined type.
4634 Fixes #30443, added test-175.cs.
4635 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
4637 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
4639 2002-11-24 Martin Baulig <martin@ximian.com>
4641 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
4642 function to get the store opcode.
4643 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
4644 only emit the Ldelema if the store opcode is Stobj. You must run
4645 both test-34 and test-167 to test this. Fixes #34529.
4647 2002-11-23 Martin Baulig <martin@ximian.com>
4649 * ecore.cs (Expression.MemberLookup): Added additional
4650 `qualifier_type' argument which is used when we're being called
4651 from MemberAccess.DoResolve() and null if we're called from a
4653 (Expression.MemberLookupFailed): New method to report errors; this
4654 does the CS1540 check and reports the correct error message.
4656 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
4657 argument for the CS1540 check and redone the way how we're dealing
4658 with private members. See the comment in the source code for details.
4659 (FilterWithClosure): Reverted this back to revision 1.197; renamed
4660 `closure_start_type' to `closure_qualifier_type' and check whether
4661 it's not null. It was not this filter being broken, it was just
4662 being called with the wrong arguments.
4664 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
4665 and pass it the correct `qualifier_type'; this also does the error
4668 2002-11-22 Miguel de Icaza <miguel@ximian.com>
4670 * expression.cs (Invocation.EmitParams): If the we are dealing
4671 with a non-built-in value type, load its address as well.
4673 (ArrayCreation): Use a a pretty constant instead
4674 of the hardcoded value 2. Use 6 instead of 2 for the number of
4675 static initializers.
4677 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
4678 because they are not really value types, just glorified integers.
4680 * driver.cs: Do not append .exe, the CSC compiler does not do it.
4682 * ecore.cs: Remove redundant code for enumerations, make them use
4683 the same code path as everything else, fixes the casting issue
4684 with enumerations in Windows.Forms.
4686 * attribute.cs: Do only cast to string if it is a string, the
4687 validation happens later.
4689 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
4690 people upgrade their corlibs.
4692 * ecore.cs: Oops, enumerations were not following the entire code path
4694 2002-11-21 Miguel de Icaza <miguel@ximian.com>
4696 * typemanager.cs (FilterWithClosure): Commented out the test for
4697 1540 in typemanager.cs, as it has problems when accessing
4698 protected methods from a parent class (see test-174.cs).
4700 * attribute.cs (Attribute.ValidateGuid): new method.
4701 (Attribute.Resolve): Use above.
4703 2002-11-19 Miguel de Icaza <miguel@ximian.com>
4705 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
4707 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
4708 handling for enumerations, as we only needed the TypeContainer
4709 functionality to begin with (this is required for the fix below to
4710 work for enums that reference constants in a container class for
4713 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
4715 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
4716 a valid TypeBuilder to perform lookups on.o
4718 * class.cs (InheritableMemberSignatureCompare): Use true in the
4719 call to GetGetMethod and GetSetMethod, because we are comparing
4720 the signature, and we need to get the methods *even* if they are
4723 (PropertyBase.CheckBase): ditto.
4725 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
4726 GotoCase.Resolve): Use Peel on EmpytCasts.
4728 * ecore.cs (EmptyCast): drop child, add Peel method.
4730 2002-11-17 Martin Baulig <martin@ximian.com>
4732 * ecore.cs (EmptyCast.Child): New public property.
4734 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
4735 label resolved to an EmptyCast. Fixes #34162.
4736 (GotoCase.Resolve): Likewise.
4737 (Block.EmitMeta): Likewise.
4739 2002-11-17 Martin Baulig <martin@ximian.com>
4741 * expression.cs (Invocation.BetterConversion): Prefer int over
4742 uint; short over ushort; long over ulong for integer literals.
4743 Use ImplicitConversionExists instead of StandardConversionExists
4744 since we also need to check for user-defined implicit conversions.
4745 Fixes #34165. Added test-173.cs.
4747 2002-11-16 Martin Baulig <martin@ximian.com>
4749 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
4750 with the `true' and `false' literals. Fixes #33151.
4752 2002-11-16 Martin Baulig <martin@ximian.com>
4754 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
4755 October 22nd; don't do the cs1540 check for static members.
4757 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
4758 now using our own filter here and doing the cs1540 check again.
4760 2002-11-16 Martin Baulig <martin@ximian.com>
4762 * support.cs (InternalParameters): Don't crash if we don't have
4763 any fixed parameters. Fixes #33532.
4765 2002-11-16 Martin Baulig <martin@ximian.com>
4767 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
4768 when looking up static methods to make this work on Windows.
4771 2002-11-16 Martin Baulig <martin@ximian.com>
4773 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
4774 a setter rather than using PropertyInfo.CanWrite.
4776 2002-11-15 Nick Drochak <ndrochak@gol.com>
4778 * class.cs: Allow acces to block member by subclasses. Fixes build
4781 2002-11-14 Martin Baulig <martin@ximian.com>
4783 * class.cs (Constructor.Emit): Added the extern/block check.
4786 2002-11-14 Martin Baulig <martin@ximian.com>
4788 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
4789 iteration while looking for indexers, this is needed because the
4790 indexer may have a different name in our base classes. Fixed the
4791 error reporting (no indexers at all, not get accessor, no
4792 overloaded match). Fixes bug #33089.
4793 (IndexerAccess.DoResolveLValue): Likewise.
4795 2002-11-14 Martin Baulig <martin@ximian.com>
4797 * class.cs (PropertyBase.CheckBase): Make this work for multiple
4798 indexers. Fixes the first part of bug #33089.
4799 (MethodSignature.InheritableMemberSignatureCompare): Added support
4802 2002-11-13 Ravi Pratap <ravi@ximian.com>
4804 * attribute.cs (Attribute.Resolve): Catch the
4805 NullReferenceException and report it since it isn't supposed to
4808 2002-11-12 Miguel de Icaza <miguel@ximian.com>
4810 * expression.cs (Binary.EmitBranchable): Also handle the cases for
4811 LogicalOr and LogicalAnd that can benefit from recursively
4812 handling EmitBranchable. The code now should be nice for Paolo.
4814 2002-11-08 Miguel de Icaza <miguel@ximian.com>
4816 * typemanager.cs (LookupType): Added a negative-hit hashtable for
4817 the Type lookups, as we perform quite a number of lookups on
4818 non-Types. This can be removed once we can deterministically tell
4819 whether we have a type or a namespace in advance.
4821 But this might require special hacks from our corlib.
4825 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
4826 and double which avoids a conversion from an integer to a double.
4828 * expression.cs: tiny optimization, avoid calling IsConstant,
4829 because it effectively performs the lookup twice.
4831 2002-11-06 Miguel de Icaza <miguel@ximian.com>
4833 But a bogus return here to keep the semantics of the old code
4834 until the Mono runtime is fixed.
4836 * pending.cs (GetMissingInterfaces): New method used to remove all
4837 the interfaces that are already implemented by our parent
4838 classes from the list of pending methods.
4840 * interface.cs: Add checks for calls after ResolveTypeExpr.
4842 2002-11-05 Miguel de Icaza <miguel@ximian.com>
4844 * class.cs (Class.Emit): Report warning 67: event not used if the
4845 warning level is beyond 3.
4847 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
4848 being a NullLiteral.
4850 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
4853 * class.cs (TypeContainer.GetClassBases): Cover a missing code
4854 path that might fail if a type can not be resolved.
4856 * expression.cs (Binary.Emit): Emit unsigned versions of the
4859 * driver.cs: use error 5.
4861 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
4863 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
4865 2002-11-01 Miguel de Icaza <miguel@ximian.com>
4867 * cs-parser.jay (switch_section): A beautiful patch from Martin
4868 Baulig that fixed 33094.
4870 2002-10-31 Miguel de Icaza <miguel@ximian.com>
4872 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
4873 Check whether the base is abstract and report an error if so.
4875 * expression.cs (IndexerAccess.DoResolveLValue,
4876 IndexerAccess.DoResolve): ditto.
4878 (Invocation.DoResolve): ditto.
4880 (Invocation.FullMethodDesc): Improve the report string.
4882 * statement.cs (Block): Eliminate IsVariableDefined as it is
4883 basically just a wrapper for GetVariableInfo.
4885 * ecore.cs (SimpleName): Use new
4887 * support.cs (ReflectionParamter.ParameterType): We unwrap the
4888 type, as we return the actual parameter ref/unref state on a
4891 2002-10-30 Miguel de Icaza <miguel@ximian.com>
4893 * support.cs: Return proper flags REF/OUT fixing the previous
4896 * expression.cs: Reverted last patch, that was wrong. Is_ref is
4897 not used to mean `ref' but `ref or out' in ParameterReference
4899 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
4900 full type signature instead of calling TypeManger.CSharpName
4903 * support.cs (InternalParameters.ParameterDesc): Do not compare
4904 directly to the modflags, because REF/OUT will actually be bitsets
4907 * delegate.cs (VerifyMethod): Check also the modifiers.
4909 * cs-tokenizer.cs: Fix bug where floating point values with an
4910 exponent where a sign was missing was ignored.
4912 * driver.cs: Allow multiple assemblies to be specified in a single
4915 2002-10-28 Miguel de Icaza <miguel@ximian.com>
4917 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
4918 because identifiers after a parenthesis would end up in this kind
4919 of production, and we needed to desamiguate it for having casts
4922 (UserDefinedType *) xxx
4924 2002-10-24 Miguel de Icaza <miguel@ximian.com>
4926 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
4927 we should set on the Bindingflags.NonPublic, but not turn on
4928 private_ok. private_ok controls whether a Private member is
4929 returned (this is chekced on the filter routine), while the
4930 BindingFlags.NonPublic just controls whether private/protected
4931 will be allowed. This fixes the problem part of the problem of
4932 private properties being allowed to be used in derived classes.
4934 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
4935 so we can call the children DoResolveLValue method (this will
4936 properly signal errors on lvalue assignments to base properties)
4938 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
4939 getter are null, and we have a property info, we know that this
4940 happened because the lookup failed, so we report an error 122 for
4941 protection level violation.
4943 We also silently return if setter and getter are null in the
4944 resolve functions, this condition only happens if we have flagged
4945 the error before. This is the other half of the problem.
4947 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
4948 not have accessibility information, that is why we were returning
4949 true in the filter function in typemanager.cs.
4951 To properly report 122 (property is inaccessible because of its
4952 protection level) correctly, we report this error in ResolveAccess
4953 by failing if both the setter and the getter are lacking (ie, the
4956 DoResolve and DoLResolve have been modified to check for both
4957 setter/getter being null and returning silently, the reason being
4958 that I did not want to put the knowledge about this error in upper
4961 int old = Report.Errors;
4962 x = new PropertyExpr (...);
4963 if (old != Report.Errors)
4968 So the property expr is returned, but it is invalid, so the error
4969 will be flagged during the resolve process.
4971 * class.cs: Remove InheritablePropertySignatureCompare from the
4972 class, as we no longer depend on the property signature to compute
4973 whether it is possible to implement a method or not.
4975 The reason is that calling PropertyInfo.GetGetMethod will return
4976 null (in .NET, in Mono it works, and we should change this), in
4977 cases where the Get Method does not exist in that particular
4982 class X { public virtual int A { get { return 1; } } }
4984 class Z : Y { public override int A { get { return 2; } } }
4986 Would fail in Z because the parent (Y) would not have the property
4987 defined. So we avoid this completely now (because the alternative
4988 fix was ugly and slow), and we now depend exclusively on the
4991 (PropertyBase.CheckBase): Use a method-base mechanism to find our
4992 reference method, instead of using the property.
4994 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
4995 routines are gone now.
4997 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
4998 names, they were incorrectly named.
5000 * cs-tokenizer.cs: Return are more gentle token on failure.
5002 * pending.cs (PendingImplementation.InterfaceMethod): This routine
5003 had an out-of-sync index variable, which caused it to remove from
5004 the list of pending methods the wrong method sometimes.
5006 2002-10-22 Miguel de Icaza <miguel@ximian.com>
5008 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
5009 CanWrite, because those refer to this particular instance of the
5010 property, and do not take into account the fact that we can
5011 override single members of a property.
5013 Constructor requires an EmitContext. The resolution process does
5014 not happen here, but we need to compute the accessors before,
5015 because the resolution does not always happen for properties.
5017 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
5018 subclass, before we did not update this flag, but we did update
5021 (GetAccessors): Drop this routine, as it did not work in the
5022 presence of partially overwritten set/get methods.
5024 Notice that this broke the cs1540 detection, but that will require
5027 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5031 * driver.cs: issue a warning instead of an error if we don't support
5032 debugging for the platform. Also ignore a couple of errors that may
5033 arise when trying to write the symbols. Undo my previous patch.
5035 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5037 * driver.cs: ignore /debug switch except for Unix platforms.
5039 2002-10-23 Nick Drochak <ndrochak@gol.com>
5041 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
5043 2002-10-21 Miguel de Icaza <miguel@ximian.com>
5045 * driver.cs: Do not make mcs-debug conditional, so we do not break
5048 * statement.cs (UsageVector.MergeChildren): I would like Martin to
5049 review this patch. But basically after all the children variables
5050 have been merged, the value of "Breaks" was not being set to
5051 new_breaks for Switch blocks. I think that it should be set after
5052 it has executed. Currently I set this to the value of new_breaks,
5053 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
5054 conservative, but I do not understand this code very well.
5056 I did not break anything in the build, so that is good ;-)
5058 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
5060 2002-10-20 Mark Crichton <crichton@gimp.org>
5062 * cfold.cs: Fixed compile blocker. Really fixed it this time.
5064 2002-10-20 Nick Drochak <ndrochak@gol.com>
5066 * cfold.cs: Fixed compile blocker.
5068 2002-10-20 Miguel de Icaza <miguel@ximian.com>
5070 * driver.cs: I was chekcing the key, not the file.
5072 2002-10-19 Ravi Pratap <ravi@ximian.com>
5074 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
5075 message that we were generating - we just need to silently return
5078 2002-10-19 Miguel de Icaza <miguel@ximian.com>
5080 * class.cs (Event.Define): Change my previous commit, as this
5081 breaks the debugger. This is a temporary hack, as it seems like
5082 the compiler is generating events incorrectly to begin with.
5084 * expression.cs (Binary.ResolveOperator): Added support for
5085 "U operator - (E x, E y)"
5087 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
5090 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
5091 init-only variables, but this path did not take into account that
5092 there might be also instance readonly variables. Correct this
5095 This fixes bug 32253
5097 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
5100 * driver.cs: Change the extension for modules to `netmodule'
5102 * cs-parser.jay: Improved slightly the location tracking for
5103 the debugger symbols.
5105 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
5106 modifiers that were specified instead of the hardcoded value
5107 (FamAndAssem). This was basically ignoring the static modifier,
5108 and others. Fixes 32429.
5110 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
5111 fixed a bug in the process (32476)
5113 * expression.cs (ArrayAccess.EmitAssign): Patch from
5114 hwang_rob@yahoo.ca that fixes bug 31834.3
5116 2002-10-18 Miguel de Icaza <miguel@ximian.com>
5118 * driver.cs: Make the module extension .netmodule.
5120 2002-10-16 Miguel de Icaza <miguel@ximian.com>
5122 * driver.cs: Report an error if the resource file is not found
5123 instead of crashing.
5125 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
5126 false, like Emit does.
5128 2002-10-16 Nick Drochak <ndrochak@gol.com>
5130 * typemanager.cs: Remove unused private member. Also reported mcs
5131 bug to report this as a warning like csc.
5133 2002-10-15 Martin Baulig <martin@gnome.org>
5135 * statement.cs (Statement.Emit): Made this a virtual method; emits
5136 the line number info and calls DoEmit().
5137 (Statement.DoEmit): New protected abstract method, formerly knows
5138 as Statement.Emit().
5140 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
5142 2002-10-11 Miguel de Icaza <miguel@ximian.com>
5144 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
5145 have fixed a remaining problem: not every AddXXXX was adding a
5146 fully qualified name.
5148 Now everyone registers a fully qualified name in the DeclSpace as
5149 being defined instead of the partial name.
5151 Downsides: we are slower than we need to be due to the excess
5152 copies and the names being registered this way.
5154 The reason for this is that we currently depend (on the corlib
5155 bootstrap for instance) that types are fully qualified, because
5156 we dump all the types in the namespace, and we should really have
5157 types inserted into the proper namespace, so we can only store the
5158 basenames in the defined_names array.
5160 2002-10-10 Martin Baulig <martin@gnome.org>
5162 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
5163 from bug #31834, see the bug report for a testcase which is
5166 2002-10-10 Martin Baulig <martin@gnome.org>
5168 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
5169 flow analysis code for this.
5171 * statement.cs (Do, While, For): Tell the flow analysis code about
5173 (FlowBranching.UsageVector): Added support for infinite loops.
5174 (Block.Resolve): Moved the dead code elimination here and use flow
5177 2002-10-09 Miguel de Icaza <miguel@ximian.com>
5179 * class.cs (Field.Define): Catch cycles on struct type
5182 * typemanager.cs (IsUnmanagedtype): Do not recursively check
5183 fields if the fields are static. We only need to check instance
5186 * expression.cs (As.DoResolve): Test for reference type.
5188 * statement.cs (Using.ResolveExpression): Use
5189 ConvertImplicitRequired, not ConvertImplicit which reports an
5191 (Using.ResolveLocalVariableDecls): ditto.
5193 * expression.cs (Binary.ResolveOperator): Report errors in a few
5194 places where we had to.
5196 * typemanager.cs (IsUnmanagedtype): Finish implementation.
5198 2002-10-08 Miguel de Icaza <miguel@ximian.com>
5200 * expression.cs: Use StoreFromPtr instead of extracting the type
5201 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
5203 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
5204 an enumeration value to a System.Enum, but System.Enum is not a
5205 value type, but an class type, so we need to box.
5207 (Expression.ConvertExplicit): One codepath could return
5208 errors but not flag them. Fix this. Fixes #31853
5210 * parameter.cs (Resolve): Do not allow void as a parameter type.
5212 2002-10-06 Martin Baulig <martin@gnome.org>
5214 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
5215 if it's a class type and not a struct. Fixes #31815.
5217 2002-10-06 Martin Baulig <martin@gnome.org>
5219 * statement.cs: Reworked the flow analysis code a bit to make it
5220 usable for dead code elimination.
5222 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5224 * cs-parser.jay: allow empty source files. Fixes bug #31781.
5226 2002-10-04 Miguel de Icaza <miguel@ximian.com>
5228 * expression.cs (ComposedCast.DoResolveType): A quick workaround
5229 to fix the test 165, will investigate deeper.
5231 2002-10-04 Martin Baulig <martin@gnome.org>
5233 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
5234 finally blocks actually work.
5235 (Try.Resolve): We don't need to create a sibling for `finally' if
5236 there is no finally block.
5238 2002-10-04 Martin Baulig <martin@gnome.org>
5240 * class.cs (Constructor.Define): The default accessibility for a
5241 non-default constructor is private, not public.
5243 2002-10-04 Miguel de Icaza <miguel@ximian.com>
5245 * class.cs (Constructor): Make AllowedModifiers public, add
5248 * cs-parser.jay: Perform the modifiers test here, as the
5249 constructor for the Constructor class usually receives a zero
5250 because of the way we create it (first we create, later we
5251 customize, and we were never checking the modifiers).
5253 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
5254 is a version of LookupTypeReflection that includes the type-name
5255 cache. This can be used as a fast path for functions that know
5256 the fully qualified name and are only calling into *.GetType() to
5257 obtain a composed type.
5259 This is also used by TypeManager.LookupType during its type
5262 (LookupType): We now also track the real type name, as sometimes
5263 we can get a quey for the real type name from things like
5264 ComposedCast. This fixes bug 31422.
5266 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
5267 complete type fullname, it does not have to go through the type
5268 resolution system to obtain the composed version of the type (for
5269 obtaining arrays or pointers).
5271 (Conditional.Emit): Use the EmitBoolExpression to
5272 generate nicer code, as requested by Paolo.
5274 (ArrayCreation.CheckIndices): Use the patch from
5275 hwang_rob@yahoo.ca to validate the array initializers.
5277 2002-10-03 Miguel de Icaza <miguel@ximian.com>
5279 * class.cs (ConstructorInitializer.Emit): simplify code by using
5280 Invocation.EmitCall, and at the same time, fix the bugs in calling
5281 parent constructors that took variable arguments.
5283 * ecore.cs (Expression.ConvertNumericExplicit,
5284 Expression.ImplicitNumericConversion): Remove the code that
5285 manually wrapped decimal (InternalTypeConstructor call is now gone
5288 * expression.cs (Cast.TryReduce): Also handle decimal types when
5289 trying to perform a constant fold on the type.
5291 * typemanager.cs (IsUnmanagedtype): Partially implemented.
5293 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
5294 that only turned off an error report, and did nothing else.
5296 2002-10-02 Miguel de Icaza <miguel@ximian.com>
5298 * driver.cs: Handle and ignore /fullpaths
5300 2002-10-01 Miguel de Icaza <miguel@ximian.com>
5302 * expression.cs (Binary.ResolveOperator): Catch the case where
5303 DoNumericPromotions returns true,
5305 (Binary.DoNumericPromotions): Simplify the code, and the tests.
5307 2002-09-27 Miguel de Icaza <miguel@ximian.com>
5309 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
5312 2002-09-26 Miguel de Icaza <miguel@ximian.com>
5314 * ecore.cs (ConvertNumericExplicit): It is not enough that the
5315 conversion exists, but it is also required that the conversion be
5316 performed. This manifested in "(Type64Enum) 2".
5318 * class.cs (TypeManager.AddMethod): The fix is not to change
5319 AddEnum, because that one was using a fully qualified name (every
5320 DeclSpace derivative does), but to change the AddMethod routine
5321 that was using an un-namespaced name. This now correctly reports
5322 the duplicated name.
5324 Revert patch until I can properly fix it. The issue
5325 is that we have a shared Type space across all namespaces
5326 currently, which is wrong.
5328 Options include making the Namespace a DeclSpace, and merge
5329 current_namespace/current_container in the parser.
5331 2002-09-25 Miguel de Icaza <miguel@ximian.com>
5333 * cs-parser.jay: Improve error reporting when we get a different
5334 kind of expression in local_variable_type and
5335 local_variable_pointer_type.
5337 Propagate this to avoid missleading errors being reported.
5339 * ecore.cs (ImplicitReferenceConversion): treat
5340 TypeManager.value_type as a target just like object_type. As
5345 Is valid, and needs to result in the int 1 being boxed before it
5346 is assigned to the value type v.
5348 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
5349 to validate the enumeration name.
5351 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
5352 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
5353 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
5355 * ecore.cs (TryImplicitIntConversion): When doing an
5356 implicit-enumeration-conversion, check if the type is 64-bits and
5357 perform a conversion before passing to EnumConstant.
5359 2002-09-23 Miguel de Icaza <miguel@ximian.com>
5361 * decl.cs (Error_AmbiguousTypeReference); New routine used to
5362 report ambiguous type references. Unlike the MS version, we
5363 report what the ambiguity is. Innovation at work ;-)
5365 (DeclSpace.FindType): Require a location argument to
5366 display when we display an ambiguous error.
5368 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
5370 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
5372 * expression.cs (EmitDynamicInitializers): Apply patch from
5373 hwang_rob@yahoo.ca that fixes the order in which we emit our
5376 2002-09-21 Martin Baulig <martin@gnome.org>
5378 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
5379 delegate takes no arguments.
5381 2002-09-20 Miguel de Icaza <miguel@ximian.com>
5383 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
5386 * expression.cs: Extract the underlying type.
5388 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
5390 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
5392 2002-09-19 Miguel de Icaza <miguel@ximian.com>
5394 * class.cs (TypeContainer.DefineType): We can not use the nice
5395 PackingSize with the size set to 1 DefineType method, because it
5396 will not allow us to define the interfaces that the struct
5399 This completes the fixing of bug 27287
5401 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
5402 means also structs. This fixes part of the problem.
5403 (Expresion.ImplicitReferenceConversionExists): ditto.
5405 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
5406 error if there were no errors reported during the type lookup
5407 process, to avoid duplicates or redundant errors. Without this
5408 you would get an ambiguous errors plus a type not found. We have
5409 beaten the user enough with the first error.
5411 (DeclSparce.FindType): Emit a warning if we have an ambiguous
5414 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
5415 during the resolution process, stop the lookup, this avoids
5416 repeated error reports (same error twice).
5418 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
5420 * typemanager.cs (LookupType): Redo the type lookup code to match
5421 the needs of System.Reflection.
5423 The issue is that System.Reflection requires references to nested
5424 types to begin with a "+" sign instead of a dot. So toplevel
5425 types look like: "NameSpace.TopLevelClass", and nested ones look
5426 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
5429 2002-09-19 Martin Baulig <martin@gnome.org>
5431 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
5432 says that a method always returns or always throws an exception,
5433 don't report the CS0161.
5435 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
5436 set `Returns = new_returns'.
5438 2002-09-19 Martin Baulig <martin@gnome.org>
5440 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
5441 to an enum constant, check for a CS0176.
5443 2002-09-18 Miguel de Icaza <miguel@ximian.com>
5445 * class.cs (TypeContainer.CheckPairedOperators): Now we check
5446 for operators that must be in pairs and report errors.
5448 * ecore.cs (SimpleName.DoResolveType): During the initial type
5449 resolution process, when we define types recursively, we must
5450 check first for types in our current scope before we perform
5451 lookups in the enclosing scopes.
5453 * expression.cs (MakeByteBlob): Handle Decimal blobs.
5455 (Invocation.VerifyArgumentsCompat): Call
5456 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
5457 I thought we were supposed to always call this, but there are a
5458 few places in the code where we dont do it.
5460 2002-09-17 Miguel de Icaza <miguel@ximian.com>
5462 * driver.cs: Add support in -linkres and -resource to specify the
5463 name of the identifier.
5465 2002-09-16 Miguel de Icaza <miguel@ximian.com>
5467 * ecore.cs (StandardConversionExists): Sync with the conversion
5468 code: allow anything-* to void* conversions.
5470 (FindMostSpecificSource): Use an Expression argument
5471 instead of a Type, because we might be handed over a Literal which
5472 gets a few more implicit conversions that plain types do not. So
5473 this information was being lost.
5475 Also, we drop the temporary type-holder expression when not
5478 2002-09-17 Martin Baulig <martin@gnome.org>
5480 * class.cs (PropertyBase.CheckBase): Don't check the base class if
5481 this is an explicit interface implementation.
5483 2002-09-17 Martin Baulig <martin@gnome.org>
5485 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
5486 different `IndexerName' attributes.
5488 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
5489 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
5490 virtual CommonResolve().
5492 2002-09-16 Miguel de Icaza <miguel@ximian.com>
5494 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
5495 and convert that to the UnderlyingType.
5497 * statement.cs (Foreach.Resolve): Indexers are just like variables
5498 or PropertyAccesses.
5500 * cs-tokenizer.cs (consume_string): Track line numbers and columns
5501 inside quoted strings, we were not doing this before.
5503 2002-09-16 Martin Baulig <martin@gnome.org>
5505 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
5506 resolve it. This is needed for the definite assignment check of the
5507 instance expression, fixes bug #29846.
5508 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
5510 2002-09-16 Nick Drochak <ndrochak@gol.com>
5512 * parameter.cs: Fix compile error. Cannot reference static member
5513 from an instance object. Is this an mcs bug?
5515 2002-09-14 Martin Baulig <martin@gnome.org>
5517 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
5518 multiple times. Fixes bug #30295, added test-166.cs.
5520 2002-09-14 Martin Baulig <martin@gnome.org>
5522 * statement.cs (Block.Emit): Don't emit unreachable code.
5523 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
5525 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
5527 2002-09-14 Martin Baulig <martin@gnome.org>
5529 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
5532 2002-09-14 Martin Baulig <martin@gnome.org>
5534 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
5535 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
5536 be false on the ms runtime.
5538 2002-09-13 Martin Baulig <martin@gnome.org>
5540 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
5541 the CS0038 error message.
5543 2002-09-12 Miguel de Icaza <miguel@ximian.com>
5545 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
5546 constant inside, return it.
5548 2002-09-12 Martin Baulig <martin@gnome.org>
5550 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
5551 implicit conversion can be done between enum types.
5553 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
5554 check whether an implicit conversion to the current enum's UnderlyingType
5555 exists and report an error if not.
5557 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
5558 without debugging support.
5560 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
5561 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
5563 2002-09-12 Martin Baulig <martin@gnome.org>
5565 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
5567 * ecore.cs (IMemberExpr.DeclaringType): New property.
5568 (SimpleName.SimpleNameResolve): Check whether we're accessing a
5569 nonstatic member of an outer type (CS0038).
5571 2002-09-11 Miguel de Icaza <miguel@ximian.com>
5573 * driver.cs: Activate the using-error detector at warning level
5574 4 (at least for MS-compatible APIs).
5576 * namespace.cs (VerifyUsing): Small buglett fix.
5578 * pending.cs (PendingImplementation): pass the container pointer.
5580 * interface.cs (GetMethods): Allow for recursive definition. Long
5581 term, I would like to move every type to support recursive
5582 definitions, not the current ordering mechanism that we have right
5585 The situation is this: Attributes are handled before interfaces,
5586 so we can apply attributes to interfaces. But some attributes
5587 implement interfaces, we will now handle the simple cases
5588 (recursive definitions will just get an error).
5590 * parameter.cs: Only invalidate types at the end if we fail to
5593 2002-09-09 Martin Baulig <martin@gnome.org>
5595 * ecore.cs (PropertyExpr.Emit): Also check for
5596 TypeManager.system_int_array_get_length so this'll also work when
5597 compiling corlib. Fixes #30003.
5599 2002-09-09 Martin Baulig <martin@gnome.org>
5601 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
5602 and throw an exception if we can't get the type's size. Fixed #30040,
5605 2002-09-09 Martin Baulig <martin@gnome.org>
5607 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
5609 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
5610 context. Fixes bug #30027.
5612 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
5613 virtual functions. Fixes bug #30043, added test-164.cs.
5615 2002-09-08 Ravi Pratap <ravi@ximian.com>
5617 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
5619 2002-09-08 Nick Drochak <ndrochak@gol.com>
5621 * driver.cs: Use an object to get the windows codepage since it's not a
5624 2002-09-08 Miguel de Icaza <miguel@ximian.com>
5626 * statement.cs (For.Emit): for infinite loops (test == null)
5627 return whether there is a break inside, not always "true".
5629 * namespace.cs (UsingEntry): New struct to hold the name of the
5630 using definition, the location where it is defined, and whether it
5631 has been used in a successful type lookup.
5633 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
5638 2002-09-06 Ravi Pratap <ravi@ximian.com>
5640 * attribute.cs : Fix incorrect code which relied on catching
5641 a NullReferenceException to detect a null being passed in
5642 where an object was expected.
5644 2002-09-06 Miguel de Icaza <miguel@ximian.com>
5646 * statement.cs (Try): flag the catch variable as assigned
5648 * expression.cs (Cast): Simplified by using ResolveType instead of
5651 * statement.cs (Catch): Fix bug by using ResolveType.
5653 2002-09-06 Ravi Pratap <ravi@ximian.com>
5655 * expression.cs (BetterConversion): Special case for when we have
5656 a NullLiteral as the argument and we have to choose between string
5657 and object types - we choose string the way csc does.
5659 * attribute.cs (Attribute.Resolve): Catch the
5660 NullReferenceException and report error #182 since the Mono
5661 runtime no more has the bug and having this exception raised means
5662 we tried to select a constructor which takes an object and is
5665 2002-09-05 Ravi Pratap <ravi@ximian.com>
5667 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
5668 message (1502, 1503) when we can't locate a method after overload
5669 resolution. This is much more informative and closes the bug
5672 * interface.cs (PopulateMethod): Return if there are no argument
5673 types. Fixes a NullReferenceException bug.
5675 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
5676 expressions too. Previously we were checking only in one place for
5677 positional arguments leaving out named arguments.
5679 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
5680 type to the enum type is not allowed. Remove code corresponding to
5683 (ConvertNumericExplicit): Allow explicit conversions from
5684 the underlying type to enum type. This precisely follows the spec
5685 and closes a bug filed by Gonzalo.
5687 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5690 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
5692 2002-09-03 Miguel de Icaza <miguel@ximian.com>
5694 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
5695 it was important that we stored the right value after the
5696 reduction in `converted'.
5698 2002-09-04 Martin Baulig <martin@gnome.org>
5700 * location.cs (Location.SymbolDocument): Use full pathnames for the
5703 2002-08-30 Miguel de Icaza <miguel@ximian.com>
5705 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
5706 of the expression resolve mechanism, because that will catch the
5707 SimpleName error failures.
5709 (Conditional): If we can not resolve the
5710 expression, return, do not crash.
5712 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5715 (location): display token name instead of its number.
5717 2002-08-28 Martin Baulig <martin@gnome.org>
5719 * expression.cs (Binary.ResolveOperator): Don't silently return
5720 but return an error if an operator cannot be applied between two
5723 2002-08-28 Martin Baulig <martin@gnome.org>
5725 * class.cs (Constructor.Define): Set the permission attributes
5726 correctly instead of making all constructors public.
5728 2002-08-28 Martin Baulig <martin@gnome.org>
5730 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
5731 for private members before reporting a CS0103; if we find anything,
5734 2002-08-28 Martin Baulig <martin@gnome.org>
5736 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
5737 to check whether `closure_start_type == closure_invocation_type',
5738 we also need to check whether `m.DeclaringType == closure_invocation_type'
5739 before bypassing the permission checks. We might be accessing
5740 protected/private members from the base class.
5741 (TypeManager.RealMemberLookup): Only set private_ok if private
5742 members were requested via BindingFlags.NonPublic.
5744 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
5746 * expression.cs (MemberAccess.ResolveMemberAccess): Set
5747 MethodGroupExpr.IsExplicitImpl if appropriate.
5748 (Invocation.DoResolve): Don't report the CS0120 for explicit
5749 interface implementations.
5751 2002-08-27 Martin Baulig <martin@gnome.org>
5753 * expression.cs (Invocation.DoResolve): If this is a static
5754 method and we don't have an InstanceExpression, we must report
5757 2002-08-25 Martin Baulig <martin@gnome.org>
5759 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
5760 `==' between a valuetype and an object.
5762 2002-08-25 Miguel de Icaza <miguel@ximian.com>
5764 * ecore.cs (TypeExpr): Provide a ToString method.
5766 2002-08-24 Martin Baulig <martin@gnome.org>
5768 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
5769 now called proggie.dbg and it's a binary file.
5771 2002-08-23 Martin Baulig <martin@gnome.org>
5773 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
5775 2002-08-23 Martin Baulig <martin@gnome.org>
5777 * struct.cs (MyStructInfo.ctor): Make this work with empty
5778 structs; it's not allowed to use foreach() on null.
5780 2002-08-23 Martin Baulig <martin@gnome.org>
5782 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
5783 writer the full pathname of the generated assembly.
5785 2002-08-23 Martin Baulig <martin@gnome.org>
5787 * statements.cs (FlowBranching.UsageVector.MergeChildren):
5788 A `finally' block never returns or breaks; improved handling of
5791 2002-08-23 Martin Baulig <martin@gnome.org>
5793 * statement.cs (Throw.Resolve): Allow `throw null'.
5795 2002-08-23 Martin Baulig <martin@gnome.org>
5797 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
5798 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
5799 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
5800 MemberLookup would return a wrong event if this is an explicit
5801 interface implementation and the class has an event with the same
5804 2002-08-23 Martin Baulig <martin@gnome.org>
5806 * statement.cs (Block.AddChildVariableNames): New public method.
5807 (Block.AddChildVariableName): Likewise.
5808 (Block.IsVariableNameUsedInChildBlock): Likewise.
5809 (Block.AddVariable): Check whether a variable name has already
5810 been used in a child block.
5812 * cs-parser.jay (declare_local_variables): Mark all variable names
5813 from the current block as being used in a child block in the
5816 2002-08-23 Martin Baulig <martin@gnome.org>
5818 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
5819 find the symbol writer.
5821 * driver.cs: csc also allows the arguments to /define being
5822 separated by commas, not only by semicolons.
5824 2002-08-23 Martin Baulig <martin@gnome.org>
5826 * interface.cs (Interface.GetMembers): Added static check for events.
5828 2002-08-15 Martin Baulig <martin@gnome.org>
5830 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
5831 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
5833 * ecore.cs (Expression.MemberLookup): Added documentation and explained
5834 why the MethodData.EmitDestructor() change was necessary.
5836 2002-08-20 Martin Baulig <martin@gnome.org>
5838 * class.cs (TypeContainer.FindMembers): Added static check for events.
5840 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
5842 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
5843 use Type.GetEvents(), not Type.FindMembers().
5845 2002-08-20 Martin Baulig <martin@gnome.org>
5847 * decl.cs (MemberCache): Added a special method cache which will
5848 be used for method-only searched. This ensures that a method
5849 search will return a MethodInfo with the correct ReflectedType for
5852 2002-08-20 Martin Baulig <martin@gnome.org>
5854 * decl.cs (DeclSpace.FindMembers): Made this public.
5856 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5858 * delegate.cs: fixed build on windows.
5859 [FIXME: Filed as bug #29150: MCS must report these errors.]
5861 2002-08-19 Ravi Pratap <ravi@ximian.com>
5863 * ecore.cs (StandardConversionExists): Return a false
5864 if we are trying to convert the void type to anything else
5865 since that is not allowed.
5867 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
5868 we flag error 70 in the event an event is trying to be accessed
5869 directly from outside the declaring type.
5871 2002-08-20 Martin Baulig <martin@gnome.org>
5873 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
5874 MemberCache from typemanager.cs to decl.cs.
5876 2002-08-19 Martin Baulig <martin@gnome.org>
5878 * class.cs (TypeContainer): Implement IMemberContainer.
5879 (TypeContainer.DefineMembers): Create the MemberCache.
5880 (TypeContainer.FindMembers): Do better BindingFlags checking; only
5881 return public members if BindingFlags.Public was given, check
5882 whether members are static.
5884 2002-08-16 Martin Baulig <martin@gnome.org>
5886 * decl.cs (DeclSpace.Define): Splitted this in Define and
5887 DefineMembers. DefineMembers is called first and initializes the
5890 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
5891 DefineMembers() on all our DeclSpaces.
5893 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
5894 but call DefineMembers() on all nested interfaces. We call their
5895 Define() in our new Define() function.
5897 * interface.cs (Interface): Implement IMemberContainer.
5898 (Interface.Define): Moved all code except the attribute stuf to
5900 (Interface.DefineMembers): Initialize the member cache.
5902 * typemanager.cs (IMemberFinder): Removed this interface, we don't
5903 need this anymore since we can use MemberCache.FindMembers directly.
5905 2002-08-19 Martin Baulig <martin@gnome.org>
5907 * typemanager.cs (MemberCache): When creating the cache for an
5908 interface type, add all inherited members.
5909 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
5910 to `out bool used_cache' and documented it.
5911 (TypeManager.MemberLookup): If we already used the cache in the first
5912 iteration, we don't need to do the interfaces check.
5914 2002-08-19 Martin Baulig <martin@gnome.org>
5916 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
5917 here from IMemberFinder and don't implement this interface anymore.
5918 (DeclSpace.MemberCache): Moved here from IMemberFinder.
5920 * typemanager.cs (IMemberFinder): This interface is now only used by
5921 classes which actually support the member cache.
5922 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
5923 since we only put DeclSpaces into this Hashtable.
5924 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
5925 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
5927 2002-08-16 Martin Baulig <martin@gnome.org>
5929 * typemanager.cs (ICachingMemberFinder): Removed.
5930 (IMemberFinder.MemberCache): New property.
5931 (TypeManager.FindMembers): Merged this with RealFindMembers().
5932 This function will never be called from TypeManager.MemberLookup()
5933 so we can't use the cache here, just the IMemberFinder.
5934 (TypeManager.MemberLookup_FindMembers): Check whether the
5935 IMemberFinder has a MemberCache and call the cache's FindMembers
5937 (MemberCache): Rewrote larger parts of this yet another time and
5938 cleaned it up a bit.
5940 2002-08-15 Miguel de Icaza <miguel@ximian.com>
5942 * driver.cs (LoadArgs): Support quoting.
5944 (Usage): Show the CSC-like command line arguments.
5946 Improved a few error messages.
5948 2002-08-15 Martin Baulig <martin@gnome.org>
5950 * typemanager.cs (IMemberContainer.Type): New property.
5951 (IMemberContainer.IsInterface): New property.
5953 The following changes are conditional to BROKEN_RUNTIME, which is
5954 defined at the top of the file.
5956 * typemanager.cs (MemberCache.MemberCache): Don't add the base
5957 class'es members, but add all members from TypeHandle.ObjectType
5958 if we're an interface.
5959 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
5960 is the current type.
5961 (MemberCache.CacheEntry.Container): Removed this field.
5962 (TypeHandle.GetMembers): Include inherited members.
5964 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5966 * typemanager.cs: fixed compilation and added a comment on a field that
5969 2002-08-15 Martin Baulig <martin@gnome.org>
5971 * class.cs (ConstructorInitializer.Resolve): In the
5972 Expression.MemberLookup call, use the queried_type as
5975 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
5976 declared' attribute, it's always true.
5977 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
5978 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
5979 temporary wrapper for FindMembers which tells MemberLookup whether
5980 members from the base classes are included in the return value.
5981 This will go away soon.
5982 (TypeManager.MemberLookup): Use this temporary hack here; once the
5983 new MemberCache is completed, we don't need to do the DeclaredOnly
5984 looping here anymore since the MemberCache will take care of this.
5985 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
5986 (MemberCache): When creating the MemberCache for a class, get
5987 members from the current class and all its base classes.
5988 (MemberCache.CacheEntry.Container): New field. This is a
5989 temporary hack until the Mono runtime is fixed to distinguish
5990 between ReflectedType and DeclaringType. It allows us to use MCS
5991 with both the MS runtime and the unfixed Mono runtime without
5992 problems and without accecting performance.
5993 (MemberCache.SearchMembers): The DeclaredOnly looping from
5994 TypeManager.MemberLookup is now done here.
5996 2002-08-14 Martin Baulig <martin@gnome.org>
5998 * statement.cs (MyStructInfo.MyStructInfo): Don't call
5999 Type.GetFields on dynamic types but get the fields from the
6000 corresponding TypeContainer.
6001 (MyStructInfo.GetStructInfo): Added check for enum types.
6003 * typemanager.cs (MemberList.IsSynchronized): Implemented.
6004 (MemberList.SyncRoot): Implemented.
6005 (TypeManager.FilterWithClosure): No need to check permissions if
6006 closure_start_type == closure_invocation_type, don't crash if
6007 closure_invocation_type is null.
6009 2002-08-13 Martin Baulig <martin@gnome.org>
6011 Rewrote TypeContainer.FindMembers to use a member cache. This
6012 gives us a speed increase of about 35% for the self-hosting MCS
6013 build and of about 15-20% for the class libs (both on GNU/Linux).
6015 * report.cs (Timer): New class to get enhanced profiling. This
6016 whole class is "TIMER" conditional since it remarkably slows down
6019 * class.cs (MemberList): New class. This is an IList wrapper
6020 which we're now using instead of passing MemberInfo[]'s around to
6021 avoid copying this array unnecessarily.
6022 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
6023 (ICachingMemberFinder, IMemberContainer): New interface.
6024 (TypeManager.FilterWithClosure): If `criteria' is null, the name
6025 has already been checked, otherwise use it for the name comparision.
6026 (TypeManager.FindMembers): Renamed to RealMemberFinder and
6027 provided wrapper which tries to use ICachingMemberFinder.FindMembers
6028 if possible. Returns a MemberList, not a MemberInfo [].
6029 (TypeHandle): New class, implements IMemberContainer. We create
6030 one instance of this class per type, it contains a MemberCache
6031 which is used to do the member lookups.
6032 (MemberCache): New class. Each instance of this class contains
6033 all members of a type and a name-based hash table.
6034 (MemberCache.FindMembers): This is our new member lookup
6035 function. First, it looks up all members of the requested name in
6036 the hash table. Then, it walks this list and sorts out all
6037 applicable members and returns them.
6039 2002-08-13 Martin Baulig <martin@gnome.org>
6041 In addition to a nice code cleanup, this gives us a performance
6042 increase of about 1.4% on GNU/Linux - not much, but it's already
6043 half a second for the self-hosting MCS compilation.
6045 * typemanager.cs (IMemberFinder): New interface. It is used by
6046 TypeManager.FindMembers to call FindMembers on a TypeContainer,
6047 Enum, Delegate or Interface.
6048 (TypeManager.finder_to_member_finder): New PtrHashtable.
6049 (TypeManager.finder_to_container): Removed.
6050 (TypeManager.finder_to_delegate): Removed.
6051 (TypeManager.finder_to_interface): Removed.
6052 (TypeManager.finder_to_enum): Removed.
6054 * interface.cs (Interface): Implement IMemberFinder.
6056 * delegate.cs (Delegate): Implement IMemberFinder.
6058 * enum.cs (Enum): Implement IMemberFinder.
6060 * class.cs (TypeContainer): Implement IMemberFinder.
6062 2002-08-12 Martin Baulig <martin@gnome.org>
6064 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
6066 2002-08-12 Martin Baulig <martin@gnome.org>
6068 * ecore.cs (ITypeExpression): New interface for expressions which
6070 (TypeExpression): Renamed to TypeLookupExpression.
6071 (Expression.DoResolve): If we're doing a types-only lookup, the
6072 expression must implement the ITypeExpression interface and we
6073 call DoResolveType() on it.
6074 (SimpleName): Implement the new ITypeExpression interface.
6075 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
6076 hack, the situation that we're only looking up types can't happen
6077 anymore when this method is called. Moved the type lookup code to
6078 DoResolveType() and call it.
6079 (SimpleName.DoResolveType): This ITypeExpression interface method
6080 is now doing the types-only lookup.
6081 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
6082 (ResolveFlags): Added MaskExprClass.
6084 * expression.cs (MemberAccess): Implement the ITypeExpression
6086 (MemberAccess.DoResolve): Added support for a types-only lookup
6087 when we're called via ITypeExpression.DoResolveType().
6088 (ComposedCast): Implement the ITypeExpression interface.
6090 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
6091 Expression.Resolve() with ResolveFlags.Type instead.
6093 2002-08-12 Martin Baulig <martin@gnome.org>
6095 * interface.cs (Interface.Define): Apply attributes.
6097 * attribute.cs (Attribute.ApplyAttributes): Added support for
6098 interface attributes.
6100 2002-08-11 Martin Baulig <martin@gnome.org>
6102 * statement.cs (Block.Emit): Only check the "this" variable if we
6103 do not always throw an exception.
6105 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
6106 whether the property has a set accessor.
6108 2002-08-11 Martin Baulig <martin@gnome.org>
6110 Added control flow analysis support for structs.
6112 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
6113 with control flow analysis turned off.
6114 (IVariable): New interface.
6115 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
6116 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
6117 (FieldExpr.DoResolve): Resolve the instance expression with flow
6118 analysis turned off and do the definite assignment check after the
6119 resolving when we know what the expression will resolve to.
6121 * expression.cs (LocalVariableReference, ParameterReference):
6122 Implement the new IVariable interface, only call the flow analysis
6123 code if ec.DoFlowAnalysis is true.
6124 (This): Added constructor which takes a Block argument. Implement
6125 the new IVariable interface.
6126 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
6127 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
6128 This does the definite assignment checks for struct members.
6130 * class.cs (Constructor.Emit): If this is a non-static `struct'
6131 constructor which doesn't have any initializer, call
6132 Block.AddThisVariable() to tell the flow analysis code that all
6133 struct elements must be initialized before control returns from
6136 * statement.cs (MyStructInfo): New public class.
6137 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
6138 argument to this indexer. If non-zero, check an individual struct
6139 member, not the whole struct.
6140 (FlowBranching.CheckOutParameters): Check struct members.
6141 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
6142 overloaded versions of these methods which take an additional
6143 `int field_idx' argument to check struct members.
6144 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
6145 overloaded versions of these methods which take an additional
6146 `string field_name' argument to check struct member.s
6147 (VariableInfo): Implement the IVariable interface.
6148 (VariableInfo.StructInfo): New public property. Returns the
6149 MyStructInfo instance of the variable if it's a struct or null.
6150 (Block.AddThisVariable): New public method. This is called from
6151 Constructor.Emit() for non-static `struct' constructor which do
6152 not have any initializer. It creates a special variable for the
6153 "this" instance variable which will be checked by the flow
6154 analysis code to ensure that all of the struct's fields are
6155 initialized before control returns from the constructor.
6156 (UsageVector): Added support for struct members. If a
6157 variable/parameter is a struct with N members, we reserve a slot
6158 in the usage vector for each member. A struct is considered fully
6159 initialized if either the struct itself (slot 0) or all its
6160 members are initialized.
6162 2002-08-08 Martin Baulig <martin@gnome.org>
6164 * driver.cs (Driver.MainDriver): Only report an error CS5001
6165 if there were no compilation errors.
6167 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
6168 `UnsafeContext' property to determine whether the parent is in
6169 unsafe context rather than checking the parent's ModFlags:
6170 classes nested in an unsafe class are unsafe as well.
6172 2002-08-08 Martin Baulig <martin@gnome.org>
6174 * statement.cs (UsageVector.MergeChildren): Distinguish between
6175 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
6176 we return. Added test17() and test18() to test-154.cs.
6178 2002-08-08 Martin Baulig <martin@gnome.org>
6180 * typemanager.cs (TypeManager.FilterWithClosure): If we have
6181 Family access, make sure the invoking type isn't a subclass of the
6182 queried type (that'd be a CS1540).
6184 * ecore.cs (Expression.MemberLookup): Added overloaded version of
6185 this method which takes an additional `Type invocation_type'.
6187 * expression.cs (BaseAccess.DoResolve): Use the base type as
6188 invocation and query type.
6189 (MemberAccess.DoResolve): If the lookup failed and we're about to
6190 report a CS0122, try a lookup with the ec.ContainerType - if this
6191 succeeds, we must report a CS1540.
6193 2002-08-08 Martin Baulig <martin@gnome.org>
6195 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
6196 (MethodGroupExpr): Implement the IMemberExpr interface.
6198 * expression (MemberAccess.ResolveMemberAccess): No need to have
6199 any special code for MethodGroupExprs anymore, they're now
6202 2002-08-08 Martin Baulig <martin@gnome.org>
6204 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
6205 Family, FamANDAssem and FamORAssem permissions.
6206 (TypeManager.IsSubclassOrNestedChildOf): New public method.
6208 2002-08-08 Martin Baulig <martin@gnome.org>
6210 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
6211 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
6214 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
6216 * driver.cs: implemented /resource option to embed managed resources.
6218 2002-08-07 Martin Baulig <martin@gnome.org>
6220 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
6221 (FieldBase.HasFieldInitializer): New public property.
6222 (FieldBase.GetInitializerExpression): New public method. Resolves and
6223 returns the field initializer and makes sure it is only resolved once.
6224 (TypeContainer.EmitFieldInitializers): Call
6225 FieldBase.GetInitializerExpression to get the initializer, this ensures
6226 that it isn't resolved multiple times.
6228 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
6229 the resolving process (SimpleName/MemberLookup) that we're currently
6230 emitting a field initializer (which must not access any instance members,
6231 this is an error CS0236).
6233 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
6234 argument, if the `IsFieldInitializer' flag is set, we must report and
6235 error CS0236 and not an error CS0120.
6237 2002-08-07 Martin Baulig <martin@gnome.org>
6239 * ecore.cs (IMemberExpr): New public interface.
6240 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
6241 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
6242 if the expression is an IMemberExpr.
6244 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
6245 to be null, implicitly default to `this' if we're non-static in
6246 this case. Simplified the code a lot by using the new IMemberExpr
6247 interface. Also fixed bug #28176 here.
6249 2002-08-06 Martin Baulig <martin@gnome.org>
6251 * cs-parser.jay (SimpleLookup): Removed. We need to create
6252 ParameterReferences during semantic analysis so that we can do a
6253 type-only search when resolving Cast, TypeOf and SizeOf.
6254 (block): Pass the `current_local_parameters' to the Block's
6257 * class.cs (ConstructorInitializer): Added `Parameters parameters'
6258 argument to the constructor.
6259 (ConstructorInitializer.Resolve): Create a temporary implicit
6260 block with the parameters.
6262 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
6263 references here if we aren't doing a type-only search.
6265 * statement.cs (Block): Added constructor which takes a
6266 `Parameters parameters' argument.
6267 (Block.Parameters): New public property.
6269 * support.cs (InternalParameters.Parameters): Renamed `parameters'
6270 to `Parameters' and made it public readonly.
6272 2002-08-06 Martin Baulig <martin@gnome.org>
6274 * ecore.cs (Expression.Warning): Made this public as well.
6276 * report.cs (Report.Debug): Print the contents of collections.
6278 2002-08-06 Martin Baulig <martin@gnome.org>
6280 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
6281 used to tell Resolve() which kinds of expressions it may return.
6282 (Expression.Resolve): Added overloaded version of this method which
6283 takes a `ResolveFlags flags' argument. This can be used to tell
6284 Resolve() which kinds of expressions it may return. Reports a
6286 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
6287 ResolveFlags.SimpleName.
6288 (Expression.Error118): Added overloaded version of this method which
6289 takes a `ResolveFlags flags' argument. It uses the flags to determine
6290 which kinds of expressions are allowed.
6292 * expression.cs (Argument.ResolveMethodGroup): New public method.
6293 Resolves an argument, but allows a MethodGroup to be returned.
6294 This is used when invoking a delegate.
6296 * TODO: Updated a bit.
6298 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6300 Fixed compilation with csc.
6302 * ecore.cs: Expression.Error made public. Is this correct? Should
6303 Warning be made public too?
6305 * expression.cs: use ea.Location instead of ea.loc.
6306 [FIXME: Filed as bug #28607: MCS must report these errors.]
6308 2002-08-06 Martin Baulig <martin@gnome.org>
6310 * ecore.cs (Expression.loc): Moved the location here instead of
6311 duplicating it in all derived classes.
6312 (Expression.Location): New public property.
6313 (Expression.Error, Expression.Warning): Made them non-static and
6314 removed the location argument.
6315 (Expression.Warning): Added overloaded version which takes an
6316 `int level' argument.
6317 (Expression.Error118): Make this non-static and removed the
6318 expression and location arguments.
6319 (TypeExpr): Added location argument to the constructor.
6321 * expression.cs (StaticCallExpr): Added location argument to
6323 (Indirection, PointerArithmetic): Likewise.
6324 (CheckedExpr, UnCheckedExpr): Likewise.
6325 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
6326 (StringPtr): Likewise.
6329 2002-08-05 Martin Baulig <martin@gnome.org>
6331 * expression.cs (BaseAccess.DoResolve): Actually report errors.
6333 * assign.cs (Assign.DoResolve): Check whether the source
6334 expression is a value or variable.
6336 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
6337 while resolving the corresponding blocks.
6339 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
6340 an error, don't silently return null.
6342 * statement.cs (Block.AddVariable): Do the error reporting here
6343 and distinguish between CS0128 and CS0136.
6344 (Block.DoResolve): Report all unused labels (warning CS0164).
6345 (LabeledStatement): Pass the location to the constructor.
6346 (LabeledStatement.HasBeenReferenced): New property.
6347 (LabeledStatement.Resolve): Set it to true here.
6349 * statement.cs (Return.Emit): Return success even after reporting
6350 a type mismatch error (CS0126 or CS0127), this is what csc does and
6351 it avoids confusing the users with any consecutive errors.
6353 2002-08-05 Martin Baulig <martin@gnome.org>
6355 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
6357 * const.cs (Const.LookupConstantValue): Catch circular definitions.
6359 * expression.cs (MemberAccess.DoResolve): Silently return if an
6360 error has already been reported.
6362 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
6363 error has already been reported.
6365 2002-08-05 Martin Baulig <martin@gnome.org>
6367 * statement.cs (UsageVector): Only initialize the `parameters'
6368 vector if we actually have any "out" parameters.
6370 2002-08-05 Martin Baulig <martin@gnome.org>
6372 * expression.cs (Binary.ResolveOperator): When combining delegates,
6373 they must have the same type.
6375 2002-08-05 Martin Baulig <martin@gnome.org>
6377 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
6378 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
6379 work with the ms runtime and we also don't need it: if we're a
6380 PropertyBuilder and not in the `indexer_arguments' hash, then we
6381 are a property and not an indexer.
6383 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
6384 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
6385 since the latter one doesn't work with the ms runtime.
6387 2002-08-03 Martin Baulig <martin@gnome.org>
6389 Fixed bugs #27998 and #22735.
6391 * class.cs (Method.IsOperator): New public field.
6392 (Method.CheckBase): Report CS0111 if there's already a method
6393 with the same parameters in the current class. Report CS0508 when
6394 attempting to change the return type of an inherited method.
6395 (MethodData.Emit): Report CS0179 if a method doesn't have a body
6396 and it's not marked abstract or extern.
6397 (PropertyBase): New abstract base class for Property and Indexer.
6398 (PropertyBase.CheckBase): Moved here from Property and made it work
6400 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
6401 the same so we can reuse it there.
6402 (Property, Indexer): Derive from PropertyBase.
6403 (MethodSignature.inheritable_property_signature_filter): New delegate
6404 to find properties and indexers.
6406 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
6407 argument and improved error reporting.
6409 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
6410 EmptyReadOnlyParameters and made it a property.
6412 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
6413 version of this method which takes a `PropertyInfo indexer'.
6414 (TypeManager.RegisterIndexer): New method.
6416 * class.cs: Added myself as author of this file :-)
6418 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6420 * class.cs: fixed compilation on windoze.
6422 2002-08-03 Martin Baulig <martin@gnome.org>
6424 * interface.cs (Interface.GetInterfaceBases): Check whether all
6425 base interfaces are at least as accessible than the current one.
6427 * class.cs (TypeContainer.GetClassBases): Check whether base types
6428 are at least as accessible than the current type.
6429 (TypeContainer.AsAccessible): Implemented and made non-static.
6430 (MemberBase.CheckParameters): Report errors if the accessibility
6433 * delegate.cs (Delegate.Delegate): The default visibility is
6434 internal for top-level types and private for nested types.
6435 (Delegate.Define): Report errors if the accessibility checks fail.
6437 * enum.cs (Enum.Enum): The default visibility is internal for
6438 top-level types and private for nested types.
6439 (Enum.DefineType): Compute the correct visibility.
6441 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
6442 function which takes a `bool is_toplevel' instead of a TypeContainer.
6444 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
6447 2002-08-02 Martin Baulig <martin@gnome.org>
6449 * expression.cs (LocalVariableReferenc): Added constructor which
6450 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
6451 (LocalVariableReference.IsReadOnly): New property.
6452 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
6453 variable is readonly, use our own readonly flag to do this; you can
6454 use the new constructor to get a writable reference to a read-only
6457 * cs-parser.jay (foreach_statement, using_statement): Get a writable
6458 reference to the local variable.
6460 2002-08-01 Miguel de Icaza <miguel@ximian.com>
6462 * rootcontext.cs (ResolveCore): Also include System.Exception
6464 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
6465 we reach an EmptyStatement.
6467 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
6470 * expression.cs (Binary.ResolveOperator): Check error result in
6473 use brtrue/brfalse directly and avoid compares to null.
6475 2002-08-02 Martin Baulig <martin@gnome.org>
6477 * class.cs (TypeContainer.Define): Define all nested interfaces here.
6478 Fixes bug #28407, added test-155.cs.
6480 2002-08-01 Martin Baulig <martin@gnome.org>
6482 * class.cs (Event.EmitDefaultMethod): Make this work with static
6483 events. Fixes #28311, added verify-3.cs.
6485 2002-08-01 Martin Baulig <martin@gnome.org>
6487 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
6488 `is_disposable' fields.
6489 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
6490 `hm.is_disposable' if we're using the collection pattern.
6491 (Foreach.EmitCollectionForeach): Use the correct type for the
6492 enumerator's local variable, only emit the try/finally block if
6493 necessary (fixes #27713).
6495 2002-08-01 Martin Baulig <martin@gnome.org>
6497 * ecore.cs (Expression.report118): Renamed to Error118 and made
6500 * statement.cs (Throw.Resolve): Check whether the expression is of
6501 the correct type (CS0118) and whether the type derives from
6502 System.Exception (CS0155).
6503 (Catch.Resolve): New method. Do the type lookup here and check
6504 whether it derives from System.Exception (CS0155).
6505 (Catch.CatchType, Catch.IsGeneral): New public properties.
6507 * typemanager.cs (TypeManager.exception_type): Added.
6509 2002-07-31 Miguel de Icaza <miguel@ximian.com>
6511 * driver.cs: Updated About function.
6513 2002-07-31 Martin Baulig <martin@gnome.org>
6515 Implemented Control Flow Analysis.
6517 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
6518 (EmitContext.CurrentBranching): Added.
6519 (EmitContext.StartFlowBranching): Added.
6520 (EmitContext.EndFlowBranching): Added.
6521 (EmitContext.KillFlowBranching): Added.
6522 (EmitContext.IsVariableAssigned): Added.
6523 (EmitContext.SetVariableAssigned): Added.
6524 (EmitContext.IsParameterAssigned): Added.
6525 (EmitContext.SetParameterAssigned): Added.
6526 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
6527 Added control flow analysis stuff here.
6529 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
6530 resolve the expression as lvalue.
6531 (LocalVariableReference.DoResolve): Check whether the variable has
6532 already been assigned.
6533 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
6534 the parameter as assigned here.
6535 (ParameterReference.DoResolve): Check whether the parameter has already
6537 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
6538 expression as lvalue.
6540 * statement.cs (FlowBranching): New class for the flow analysis code.
6541 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
6542 (LabeledStatement.IsDefined): New public property.
6543 (LabeledStatement.AddUsageVector): New public method to tell flow
6544 analyis that the label may be reached via a forward jump.
6545 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
6547 (VariableInfo.Number): New public field. This is used by flow analysis
6548 to number all locals of a block.
6549 (Block.CountVariables): New public property. This is the number of
6550 local variables in this block (including the locals from all parent
6552 (Block.EmitMeta): Number all the variables.
6554 * statement.cs: Added flow analysis support to all classes.
6556 2002-07-31 Martin Baulig <martin@gnome.org>
6558 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
6559 To get debugging messages, compile mcs with /define:MCS_DEBUG and
6560 then use this argument.
6562 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
6564 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
6565 use this to specify /define options.
6567 2002-07-29 Martin Baulig <martin@gnome.org>
6569 * statement.cs (Fixed): Moved all code that does variable lookups
6570 and resolvings from Emit to Resolve.
6572 * statement.cs (For): Moved all code that does variable lookups
6573 and resolvings from Emit to Resolve.
6575 * statement.cs (Using): Moved all code that does variable lookups
6576 and resolvings from Emit to Resolve.
6578 2002-07-29 Martin Baulig <martin@gnome.org>
6580 * attribute.cs (Attribute.Resolve): Explicitly catch a
6581 System.NullReferenceException when creating the
6582 CustromAttributeBuilder and report a different warning message.
6584 2002-07-29 Martin Baulig <martin@gnome.org>
6586 * support.cs (ParameterData.ParameterName): Added method to
6587 get the name of a parameter.
6589 * typemanager.cs (TypeManager.IsValueType): New public method.
6591 2002-07-29 Martin Baulig <martin@gnome.org>
6593 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
6594 is a flag which specifies that it's either ref or out.
6595 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
6596 the out parameter to `out Parameter.Modifier mod', also set the
6597 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
6599 * support.cs (InternalParameters.ParameterModifier): Distinguish
6600 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
6601 Parameter.Modifier.ISBYREF flag if it's either ref or out.
6603 * expression.cs (Argument.GetParameterModifier): Distinguish
6604 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
6605 Parameter.Modifier.ISBYREF flag if it's either ref or out.
6607 2002-07-29 Martin Baulig <martin@gnome.org>
6609 * expression.cs (ParameterReference.ParameterReference): Added
6610 `Location loc' argument to the constructor.
6612 * cs-parser.jay: Pass location to ParameterReference.
6614 2002-07-28 Miguel de Icaza <miguel@ximian.com>
6616 * statement.cs (Try): Initialize the location.
6618 * cs-parser.jay: pass location to Try.
6620 * expression.cs (Unary.Reduce): Change the prototype to return
6621 whether a constant fold could be performed or not. The result is
6622 returned in an out parameters. In the case of Indirection and
6623 AddressOf, we want to perform the full tests.
6625 2002-07-26 Miguel de Icaza <miguel@ximian.com>
6627 * statement.cs (Statement.Emit): Flag dead code.
6629 2002-07-27 Andrew Birkett <andy@nobugs.org>
6631 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
6633 2002-07-27 Martin Baulig <martin@gnome.org>
6635 * class.cs (MethodData.Define): Put back call to
6636 TypeManager.AddMethod(), accidentally commented this out.
6638 * report.cs (Debug): New public method to print debugging information,
6639 this is `[Conditional ("DEBUG")]'.
6641 2002-07-26 Martin Baulig <martin@gnome.org>
6643 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
6644 (switch_statement): Push the current_block to the switch_stack and
6645 pop it again when we're done with the switch.
6646 (switch_section): The new block is a child of the current_block.
6647 Fixes bug #24007, added test-152.cs.
6649 2002-07-27 Martin Baulig <martin@gnome.org>
6651 * expression.cs (Invocation.EmitArguments): When calling a varargs
6652 function with only its fixed arguments, we need to pass an empty
6655 2002-07-27 Martin Baulig <martin@gnome.org>
6657 Mono 0.13 has been released.
6659 2002-07-25 Miguel de Icaza <miguel@ximian.com>
6661 * driver.cs: Rename --resource to --linkres, because that is what
6662 we do currently, we dont support --resource yet.
6664 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
6666 2002-07-25 Martin Baulig <martin@gnome.org>
6668 * class.cs (MethodData): New public class. This is a `method builder'
6669 class for a method or one accessor of a Property/Indexer/Event.
6670 (MethodData.GetMethodFlags): Moved here from MemberBase.
6671 (MethodData.ApplyAttributes): Likewise.
6672 (MethodData.ApplyObsoleteAttribute): Likewise.
6673 (MethodData.ApplyConditionalAttribute): Likewise.
6674 (MethodData.ApplyDllImportAttribute): Likewise.
6675 (MethodData.CheckAbstractAndExternal): Likewise.
6676 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
6677 (MethodData.Emit): Formerly known as Method.Emit().
6678 (MemberBase): Moved everything which was specific to a single
6679 accessor/method to MethodData.
6680 (Method): Create a new MethodData and call Define() and Emit() on it.
6681 (Property, Indexer, Event): Create a new MethodData objects for each
6682 accessor and call Define() and Emit() on them.
6684 2002-07-25 Martin Baulig <martin@gnome.org>
6686 Made MethodCore derive from MemberBase to reuse the code from there.
6687 MemberBase now also checks for attributes.
6689 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
6690 (MemberBase.GetMethodFlags): Moved here from class Method and marked
6692 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
6693 `CallingConventions cc' and `Attributes opt_attrs' arguments.
6694 (MemberBase.ApplyAttributes): New virtual method; applies the
6695 attributes to a method or accessor.
6696 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
6697 (MemberBase.ApplyConditionalAttribute): Likewise.
6698 (MemberBase.ApplyDllImportAttribute): Likewise.
6699 (MemberBase.CheckAbstractAndExternal): Likewise.
6700 (MethodCore.ParameterTypes): This is now a property instead of a
6701 method, it's initialized from DoDefineParameters().
6702 (MethodCore.ParameterInfo): Removed the set accessor.
6703 (MethodCore.DoDefineParameters): New protected virtual method to
6704 initialize ParameterTypes and ParameterInfo.
6705 (Method.GetReturnType): We can now simply return the MemberType.
6706 (Method.GetMethodFlags): Override the MemberBase version and add
6707 the conditional flags.
6708 (Method.CheckBase): Moved some code from Define() here, call
6709 DoDefineParameters() here.
6710 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
6711 here to avoid some larger code duplication.
6712 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
6713 ensure that abstract and external accessors don't declare a body.
6715 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
6716 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
6717 lookup in the attribute's parent classes, so we need to abort as soon
6718 as we found the first match.
6719 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
6720 the attribute has no arguments.
6722 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
6725 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6727 * cs-parser.jay: reverted previous patch.
6729 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6731 * cs-parser.jay: fixed bug #22119.
6733 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6735 * attribute.cs: fixed compilation. The error was:
6736 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
6737 be assigned to before control leaves the current method."
6738 [FIXME: Filed as bug #28186: MCS must report this error.]
6740 2002-07-25 Martin Baulig <martin@gnome.org>
6742 * attribute.cs (Attribute.Conditional_GetConditionName): New static
6743 method to pull the condition name ouf of a Conditional attribute.
6744 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
6745 the obsolete message and error flag out of an Obsolete attribute.
6747 * class.cs (Method.GetMethodFlags): New public method to get the
6748 TypeManager.MethodFlags for this method.
6749 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
6751 (Method.Define): Get and apply the Obsolete and Conditional attributes;
6752 if we're overriding a virtual function, set the new private variable
6753 `parent_method'; call the new TypeManager.AddMethod().
6755 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
6756 the MethodBuilder and the Method in a PtrHashtable.
6757 (TypeManager.builder_to_method): Added for this purpose.
6758 (TypeManager.MethodFlags): Added IsObsoleteError.
6759 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
6760 Obsolete and Conditional arguments in MethodBuilders. If we discover
6761 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
6762 the message from the attribute.
6764 2002-07-24 Martin Baulig <martin@gnome.org>
6766 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
6767 preprocessor directives, ensure that the argument to #define/#undef is
6768 exactly one identifier and that it's actually an identifier.
6770 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
6773 2002-07-24 Martin Baulig <martin@gnome.org>
6775 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
6776 initialize it to TypeManager.object_type in the constructor.
6777 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
6778 of the `hm.get_current' method if we're using the collection pattern.
6779 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
6780 for the explicit conversion to make it work when we're using the collection
6781 pattern and the `Current' property has a different return type than `object'.
6784 2002-07-24 Martin Baulig <martin@gnome.org>
6786 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
6787 does not match, but don't report any errors. This method is called in
6788 order for all methods in a MethodGroupExpr until a matching method is
6789 found, so we don't want to bail out if the first method doesn't match.
6790 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
6791 matches, report the 123. Fixes #28070.
6793 2002-07-24 Martin Baulig <martin@gnome.org>
6795 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
6796 TypeManager.TypeToCoreType() to the top of the method so the
6797 following equality checks will work. Fixes #28107.
6799 2002-07-24 Martin Baulig <martin@gnome.org>
6801 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
6802 operand is of type uint, and the other operand is of type sbyte,
6803 short or int, the operands are converted to type long." -
6804 Actually do what this comment already told us. Fixes bug #28106,
6807 2002-07-24 Martin Baulig <martin@gnome.org>
6809 * class.cs (MethodBase): New abstract class. This is now a base
6810 class for Property, Indexer and Event to avoid some code duplication
6811 in their Define() and DefineMethods() methods.
6812 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
6813 generic methods for Define() and DefineMethods().
6814 (FieldBase): Derive from MemberBase, not MemberCore.
6815 (Property): Derive from MemberBase, not MemberCore.
6816 (Property.DefineMethod): Moved all the code from this method to the
6817 new MethodBase.DefineAccessor(), just call it with appropriate
6819 (Property.Define): Call the new Property.DoDefine(), this does some
6820 sanity checks and we don't need to duplicate the code everywhere.
6821 (Event): Derive from MemberBase, not MemberCore.
6822 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
6823 accessors, this will also make them work with interface events.
6824 (Indexer): Derive from MemberBase, not MemberCore.
6825 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
6826 (Indexer.Define): Use the new MethodBase functions.
6828 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
6829 argument to the constructor.
6830 (Interface.FindMembers): Added support for interface events.
6831 (Interface.PopluateEvent): Implemented.
6833 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
6835 2002-07-22 Miguel de Icaza <miguel@ximian.com>
6837 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
6838 but this is required to check for a method name being the same as
6839 the containing class.
6843 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6845 * interface.cs: initialize variable.
6847 2002-07-23 Martin Baulig <martin@gnome.org>
6849 Implemented the IndexerName attribute in interfaces.
6851 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
6852 name if this is an explicit interface implementation.
6853 (Indexer.InterfaceIndexerName): New public variable. If we're
6854 implementing an interface indexer, this is the IndexerName in that
6855 interface. Otherwise, it's the IndexerName.
6856 (Indexer.DefineMethod): If we're implementing interface indexer,
6857 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
6858 and Pending.ImplementIndexer methods.
6859 (Indexer.Define): Also define the PropertyBuilder if we're
6860 implementing an interface indexer and this is neither an explicit
6861 interface implementation nor do the IndexerName match the one in
6864 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
6865 If a method is defined here, then we always need to create a proxy
6866 for it. This is used when implementing interface indexers.
6867 (Pending.IsInterfaceIndexer): New public method.
6868 (Pending.ImplementIndexer): New public method.
6869 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
6870 This is used when implementing interface indexers to define a proxy
6872 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
6873 define a proxy if necessary.
6875 * interface.cs (Interface.IndexerName): New public variable.
6876 (Interface.PopulateIndexer): Set the IndexerName.
6877 (Interface.DefineIndexers): New private method. Populate all the
6878 indexers and make sure their IndexerNames match.
6880 * typemanager.cs (IndexerPropertyName): Added support for interface
6883 2002-07-22 Martin Baulig <martin@gnome.org>
6885 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
6886 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
6887 ret if HasReturnLabel.
6888 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
6891 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
6892 and set the ec.LoopBeginTryCatchLevel.
6893 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
6894 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
6895 the current ec.TryCatchLevel, the branch goes out of an exception
6896 block. In this case, we need to use Leave and not Br.
6898 2002-07-22 Martin Baulig <martin@gnome.org>
6900 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
6901 block unless the block does not always return or it is contained in
6902 another try { ... } catch { ... } block. Fixes bug #26506.
6903 Added verify-1.cs to the test suite.
6905 2002-07-22 Martin Baulig <martin@gnome.org>
6907 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
6908 then we do not always return. Fixes bug #24985.
6910 2002-07-22 Martin Baulig <martin@gnome.org>
6912 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
6913 lookup on a per-class level; ie. walk up the class hierarchy until we
6914 found at least one applicable method, then choose the best among them.
6915 Fixes bug #24463 and test-29.cs.
6917 2002-07-22 Martin Baulig <martin@gnome.org>
6919 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
6920 return types of the methods. The return type is not part of the
6921 signature and we must not check it to make the `new' modifier work.
6922 Fixes bug #27999, also added test-147.cs.
6923 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
6925 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
6926 on the method's return type.
6928 2002-07-21 Martin Baulig <martin@gnome.org>
6930 * assign.cs: Make this work if the rightmost source is a constant and
6931 we need to do an implicit type conversion. Also adding a few more tests
6932 to test-38.cs which should have caught this.
6934 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
6935 target in the makefile for this. The makefile.gnu is primarily intended
6936 for end-users who don't want to debug the compiler.
6938 2002-07-21 Martin Baulig <martin@gnome.org>
6940 * assign.cs: Improved the Assign class so it can now handle embedded
6941 assignments (X = Y = Z = something). As a side-effect this'll now also
6942 consume less local variables. test-38.cs now passes with MCS, added
6943 a few new test cases to that test.
6945 2002-07-20 Martin Baulig <martin@gnome.org>
6947 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
6948 instructions. Fixes bug #27977, also added test-146.cs.
6950 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6952 * cs-tokenizer.cs: fixed getHex ().
6954 2002-07-19 Martin Baulig <martin@gnome.org>
6956 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
6957 not Type.GetType() to lookup the array type. This is needed when
6958 we're constructing an array of a user-defined type.
6959 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
6960 single-dimensional arrays, but also for single-dimensial arrays of
6963 2002-07-19 Martin Baulig <martin@gnome.org>
6965 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
6966 this function is called, it's not allowed to share LocalBuilders
6969 2002-07-19 Martin Baulig <martin@gnome.org>
6971 * expression.cs (Argument.Resolve): Report an error 118 when trying
6972 to pass a type as argument.
6974 2002-07-18 Martin Baulig <martin@gnome.org>
6976 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
6977 Conv_R_Un for the signed `long' type.
6979 2002-07-15 Miguel de Icaza <miguel@ximian.com>
6981 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
6982 `expr' for the temporary result, as that will fail if we do
6983 multiple resolves on the same expression.
6985 2002-07-05 Miguel de Icaza <miguel@ximian.com>
6987 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
6988 ec.TypeContainer for looking up aliases.
6990 * class.cs (TypeContainer): Remove LookupAlias from here.
6992 * decl.cs (DeclSpace); Move here.
6994 2002-07-01 Miguel de Icaza <miguel@ximian.com>
6996 * class.cs (FindMembers): Only call filter if the constructor
6997 bulider is not null.
6999 Also handle delegates in `NestedTypes' now. Now we will perform
7000 type lookups using the standard resolution process. This also
7003 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
7004 This uses Expressions (the limited kind that can be parsed by the
7005 tree) instead of strings.
7007 * expression.cs (ComposedCast.ToString): Implement, used to flag
7008 errors since now we have to render expressions.
7010 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
7013 * ecore.cs (SimpleName.ToString): ditto.
7015 * cs-parser.jay: Instead of using strings to assemble types, use
7016 Expressions to assemble the type (using SimpleName, ComposedCast,
7017 MemberAccess). This should fix the type lookups in declarations,
7018 because we were using a different code path for this.
7020 * statement.cs (Block.Resolve): Continue processing statements
7021 even when there is an error.
7023 2002-07-17 Miguel de Icaza <miguel@ximian.com>
7025 * class.cs (Event.Define): Also remove the `remove' method from
7026 the list of pending items.
7028 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
7029 generate more compact code.
7031 2002-07-17 Martin Baulig <martin@gnome.org>
7033 * const.cs (Const.LookupConstantValue): Add support for constant
7034 `unchecked' and `checked' expressions.
7035 Also adding test case test-140.cs for this.
7037 2002-07-17 Martin Baulig <martin@gnome.org>
7039 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
7040 check whether mi.ReturnType implements the IEnumerator interface; the
7041 `==' and the IsAssignableFrom() will fail in this situation.
7043 2002-07-16 Ravi Pratap <ravi@ximian.com>
7045 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
7048 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7050 * expression.cs: fixed bug #27811.
7052 2002-07-14 Miguel de Icaza <miguel@ximian.com>
7054 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
7055 Molaro: when we are a ref, the value already contains a pointer
7056 value, do not take the address of it.
7058 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
7059 * removed mb-parser.jay and mb-tokenizer.cs
7061 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7063 * expression.cs: check against the building corlib void type.
7065 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
7067 * ecore.cs: fix for valuetype static readonly fields: when
7068 initializing them, we need their address, not the address of a copy.
7070 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
7072 * typemanager.cs: register also enum_type in corlib.
7074 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7076 * class.cs: allow calling this (but not base) initializers in structs.
7078 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
7080 * ecore.cs: make sure we compare against the building base types
7083 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
7085 * typemanager.cs: fix TypeToCoreType() to handle void and object
7086 (corlib gets no more typerefs after this change).
7088 2002-07-12 Miguel de Icaza <miguel@ximian.com>
7090 * expression.cs (ArrayCreation.EmitArrayArguments): use
7091 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
7093 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
7094 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
7095 array indexes, the runtime actually forbids them.
7097 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
7098 for array arguments here.
7100 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
7101 instead of the default for ValueTypes.
7103 (New.DoEmit): Use IsValueType instead of
7104 IsSubclassOf (value_type)
7105 (New.DoResolve): ditto.
7106 (Invocation.EmitCall): ditto.
7108 * assign.cs (Assign): ditto.
7110 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
7111 Statements *are* currently doing part of their resolution during
7114 Expressions do always resolve during resolve, but statements are
7115 only required to propagate resolution to their children.
7117 2002-07-11 Miguel de Icaza <miguel@ximian.com>
7119 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
7121 (LoadAssembly): Do not add the dll if it is already specified
7123 (MainDriver): Add the System directory to the link path at the end,
7124 after all the other -L arguments.
7126 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
7127 wrong opcode for loading bytes and bools (ldelem.i1 instead of
7128 ldelem.u1) and using the opposite for sbytes.
7130 This fixes Digger, and we can finally run it.
7132 * driver.cs (UnixParseOption): Move the option parsing here.
7133 (CSCParseOption): Implement CSC-like parsing of options.
7135 We now support both modes of operation, the old Unix way, and the
7136 new CSC-like way. This should help those who wanted to make cross
7139 The only thing broken is that /r:, /reference: and /lib: are not
7140 implemented, because I want to make those have the same semantics
7141 as the CSC compiler has, and kill once and for all the confussion
7142 around this. Will be doing this tomorrow.
7144 * statement.cs (Unsafe.Resolve): The state is checked during
7145 resolve, not emit, so we have to set the flags for IsUnsfe here.
7147 2002-07-10 Miguel de Icaza <miguel@ximian.com>
7149 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
7150 not catch the Error_ObjectRefRequired in SimpleName (as it is
7151 possible to have a class/instance variable name that later gets
7152 deambiguated), we have to check this here.
7154 2002-07-10 Ravi Pratap <ravi@ximian.com>
7156 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
7157 make static and put into Expression.
7159 (Event.Define): Register the private field of the event with the
7160 TypeManager so that GetFieldFromEvent can get at it.
7162 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
7163 keep track of the private field associated with an event which
7166 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
7169 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
7171 2002-07-10 Miguel de Icaza <miguel@ximian.com>
7173 * expression.cs (Binary.EmitBranchable): this routine emits the
7174 Binary expression in a branchable context. This basically means:
7175 we need to branch somewhere, not just get the value on the stack.
7177 This works together with Statement.EmitBoolExpression.
7179 * statement.cs (Statement.EmitBoolExpression): Use
7182 2002-07-09 Miguel de Icaza <miguel@ximian.com>
7184 * statement.cs (For): Reduce the number of jumps in loops.
7186 (For): Implement loop inversion for the For statement.
7188 (Break): We can be breaking out of a Try/Catch controlled section
7189 (foreach might have an implicit try/catch clause), so we need to
7190 use Leave instead of Br.
7192 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
7193 now). If the instace expression supports IMemoryLocation, we use
7194 the AddressOf method from the IMemoryLocation to extract the
7195 address instead of emitting the instance.
7197 This showed up with `This', as we were emitting the instance
7198 always (Emit) instead of the Address of This. Particularly
7199 interesting when This is a value type, as we dont want the Emit
7200 effect (which was to load the object).
7202 2002-07-08 Miguel de Icaza <miguel@ximian.com>
7204 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
7206 * statement.cs (Checked): Set the CheckedState during the resolve
7207 process too, as the ConvCast operations track the checked state on
7208 the resolve process, and not emit.
7210 * cs-parser.jay (namespace_member_declaration): Flag that we have
7211 found a declaration when we do. This is used to flag error 1529
7213 * driver.cs: Report ok when we display the help only.
7215 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
7217 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
7219 2002-07-04 Miguel de Icaza <miguel@ximian.com>
7221 * cs-tokenizer.cs (define): We also have to track locally the
7222 defines. AllDefines is just used for the Conditional Attribute,
7223 but we also need the local defines for the current source code.
7225 2002-07-03 Miguel de Icaza <miguel@ximian.com>
7227 * statement.cs (While, For, Do): These loops can exit through a
7228 Break statement, use this information to tell whether the
7229 statement is the last piece of code.
7231 (Break): Flag that we break.
7233 * codegen.cs (EmitContexts): New `Breaks' state variable.
7235 2002-07-03 Martin Baulig <martin@gnome.org>
7237 * class.cs (TypeContainer.MethodModifiersValid): Allow override
7238 modifiers in method declarations in structs. Otherwise, you won't
7239 be able to override things like Object.Equals().
7241 2002-07-02 Miguel de Icaza <miguel@ximian.com>
7243 * class.cs (Method, Property, Indexer): Do not allow the public
7244 modifier to be used in explicit interface implementations.
7246 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
7247 override modifiers in method declarations in structs
7249 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
7251 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
7252 integer or real overflow, report an error
7254 2002-07-02 Martin Baulig <martin@gnome.org>
7256 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
7257 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
7258 to tell the runtime about our newly created System.Object and
7259 System.ValueType types.
7261 2002-07-02 Miguel de Icaza <miguel@ximian.com>
7263 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
7264 struct instead of Ldarg/Starg.
7266 2002-07-02 Martin Baulig <martin@gnome.org>
7268 * expression.cs (Indirection.Indirection): Call
7269 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
7271 2002-07-02 Martin Baulig <martin@gnome.org>
7273 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
7274 ValueType, call TypeManager.TypeToCoreType() on it.
7275 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
7276 the OpCodes.Newarr argument.
7278 2002-07-02 Martin Baulig <martin@gnome.org>
7280 * expression.cs (Invocation.EmitCall): When compiling corlib,
7281 replace all calls to the system's System.Array type to calls to
7282 the newly created one.
7284 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
7285 System.Array methods.
7286 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
7287 from the system's System.Array type which must be replaced.
7289 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
7291 * typemanager.cs: load unverifiable_code_ctor so we can build
7292 corlib using the correct type. Avoid using GetTypeCode() with
7294 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
7295 TypeManager.object_type to allow building corlib.
7297 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
7299 * ecore.cs: handle System.Enum separately in LoadFromPtr().
7301 2002-07-01 Martin Baulig <martin@gnome.org>
7303 * class.cs: Make the last change actually work, we need to check
7304 whether `ifaces != null' to avoid a crash.
7306 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7308 * class.cs: when we build structs without fields that implement
7309 interfaces, we need to add the interfaces separately, since there is
7310 no API to both set the size and add the interfaces at type creation
7313 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7315 * expression.cs: the dimension arguments to the array constructors
7316 need to be converted if they are a long.
7318 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
7320 * class.cs: don't emit ldarg.0 if there is no parent constructor
7321 (fixes showstopper for corlib).
7323 2002-06-29 Martin Baulig <martin@gnome.org>
7325 MCS now compiles corlib on GNU/Linux :-)
7327 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
7328 ie. check for MethodImplOptions.InternalCall.
7330 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
7331 and TypeManager.attribute_type are null, so we must explicitly check
7332 whether parent is not null to find out whether it's an attribute type.
7333 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
7334 and SetBuilder, not only if the property is neither abstract nor external.
7335 This is necessary to set the MethodImplOptions on the accessor methods.
7336 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
7337 SetBuilder, see Property.Emit().
7339 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
7340 populate "System.Object", "System.ValueType" and "System.Attribute" since
7341 they've already been populated from BootCorlib_PopulateCoreTypes().
7343 2002-06-29 Martin Baulig <martin@gnome.org>
7345 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
7346 is the NullLiteral, we also need to make sure that target_type is not
7349 2002-06-29 Martin Baulig <martin@gnome.org>
7351 * rootcontext.cs (RootContext.ResolveCore): We must initialize
7352 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
7353 before calling BootstrapCorlib_ResolveDelegate ().
7355 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7357 * statement.cs: fixed build-breaker. All tests passed ok.
7359 2002-06-27 Martin Baulig <martin@gnome.org>
7361 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
7362 for System.Decimal when compiling corlib.
7364 2002-06-27 Martin Baulig <martin@gnome.org>
7366 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
7367 switch blocks which contain nothing but a default clause.
7369 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
7371 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
7373 2002-06-27 Martin Baulig <martin@gnome.org>
7375 * ecore.cs (PropertyExpr.PropertyExpr): Call
7376 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
7378 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
7379 is already a TypeBuilder.
7381 2002-06-27 Martin Baulig <martin@gnome.org>
7383 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
7384 `target_type == TypeManager.array_type', not IsAssignableFrom() in
7385 the "from an array-type to System.Array" case. This makes it work
7386 when compiling corlib.
7388 2002-06-27 Martin Baulig <martin@gnome.org>
7390 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
7391 non-static PropertyExpr, set its InstanceExpression. This makes
7392 the `ICollection.Count' property work in System/Array.cs.
7394 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
7396 * driver.cs: Made error handling more consistent. Errors now
7397 tracked by Report class, so many methods which used to return int
7398 now return void. Main() now prints success/failure and
7399 errors/warnings message.
7401 Renamed '--probe' compiler argument to '--expect-error'. Removed
7402 the magic number return values (123 and 124). Now, if the
7403 expected error occurs, the compiler exits with success (exit value
7404 0). If the compilation completes without seeing that particular
7405 error, the compiler exits with failure (exit value 1). The
7406 makefile in mcs/errors has been changed to handle the new behaviour.
7408 * report.cs: Made 'expected error' number a property and renamed
7409 it from 'Probe' to 'ExpectedError'.
7411 * genericparser.cs: Removed error handling support, since it is
7412 now all done by Report class.
7414 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
7415 class, so parse() no longer returns an int.
7417 * namespace.cs: Use Report.Error instead of GenericParser.error
7419 2002-06-22 Miguel de Icaza <miguel@ximian.com>
7421 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
7422 TypeContainer.AddOperator): At the front of the list put the
7423 explicit implementations, so they get resolved/defined first.
7425 2002-06-21 Miguel de Icaza <miguel@ximian.com>
7427 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
7428 interface type is implemented by this TypeContainer. Used during
7429 explicit interface implementation.
7431 (Property.Define, Indexer.Define, Method.Define): Validate that
7432 the given interface in the explicit implementation is one of the
7433 base classes for the containing type.
7435 Also if we are explicitly implementing an interface, but there is
7436 no match in the pending implementation table, report an error.
7438 (Property.Define): Only define the property if we are
7439 not explicitly implementing a property from an interface. Use the
7440 correct name also for those properties (the same CSC uses,
7441 although that is really not needed).
7443 (Property.Emit): Do not emit attributes for explicitly implemented
7444 properties, as there is no TypeBuilder.
7446 (Indexer.Emit): ditto.
7448 Hiding then means that we do not really *implement* a pending
7449 implementation, which makes code fail.
7451 2002-06-22 Martin Baulig <martin@gnome.org>
7453 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
7454 the return value of Object.GetType(). [FIXME: we need to do this whenever
7455 we get a type back from the reflection library].
7457 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
7459 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
7461 2002-06-20 Miguel de Icaza <miguel@ximian.com>
7463 * attribute.cs: Return null if we can not look up the type.
7465 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
7466 the interface types found.
7468 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
7469 interface types found.
7471 * typemanager.cs (GetInterfaces): Make this routine returns alll
7472 the interfaces and work around the lame differences between
7473 System.Type and System.Reflection.Emit.TypeBuilder in the results
7474 result for GetInterfaces.
7476 (ExpandInterfaces): Given an array of interface types, expand and
7477 eliminate repeated ocurrences of an interface. This expands in
7478 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
7481 2002-06-21 Martin Baulig <martin@gnome.org>
7483 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
7486 2002-06-21 Martin Baulig <martin@gnome.org>
7488 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
7489 and called with one of the core types, return the corresponding typebuilder for
7492 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
7495 2002-06-21 Martin Baulig <martin@gnome.org>
7497 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
7498 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
7499 (Expression.ConvertReferenceExplicit): Likewise.
7501 * expression.cs (ElementAccess.DoResolve): Likewise.
7502 (ElementAccess.DoResolveLValue): Likewise.
7504 2002-06-10 Martin Baulig <martin@gnome.org>
7506 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
7507 add the "value" parameter to the parameter list.
7509 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
7512 2002-06-19 Miguel de Icaza <miguel@ximian.com>
7514 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
7515 the argument to an int, uint, long or ulong, per the spec. Also
7516 catch negative constants in array creation.
7518 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
7520 * class.cs: do not allow the same interface to appear twice in
7521 the definition list.
7523 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
7525 * ecore.cs: don't use ldlen with System.Array.
7527 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
7529 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
7531 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
7533 * modifiers.cs: produce correct field attributes for protected
7534 internal. Easy fix so miguel can work on ther harder stuff:-)
7536 2002-06-18 Miguel de Icaza <miguel@ximian.com>
7538 * pending.cs: New file. Move the code from class.cs here.
7539 Support clearning the pending flag for all methods (when not doing
7540 explicit interface implementation).
7542 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
7544 * rootcontext.cs: added a couple more types needed to bootstrap.
7546 2002-06-17 Miguel de Icaza <miguel@ximian.com>
7548 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
7549 constructor in the type, instead of any constructor in the type
7550 hierarchy. Thanks to Paolo for finding this bug (it showed up as
7551 a bug in the Mono runtime when applying the params attribute).
7553 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
7554 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
7556 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
7558 * expression.cs (Unary.ResolveOperator): Use TypeManager
7559 to resolve the type.
7561 2002-06-13 Ravi Pratap <ravi@ximian.com>
7563 * cs-parser.jay (enum_member_declaration): Pass in the attributes
7566 * enum.cs (AddEnumMember): Add support to store the attributes associated
7567 with each member too.
7569 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
7570 field builders too - this takes care of the enum member case.
7572 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
7574 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
7575 address-of operator on both value types and pointers.
7577 2002-06-10 Martin Baulig <martin@gnome.org>
7579 * interface.cs (Interface.PopulateIndexer): Add the indexer's
7580 PropertyBuilder to the `property_builders' list.
7582 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
7583 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
7584 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
7585 find any indexers which are inherited from an interface.
7587 2002-06-09 Martin Baulig <martin@gnome.org>
7589 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
7590 the same type as the constant if necessary. There's also a test-130.cs
7593 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
7595 * typemanager.cs (TypeManager.ChangeType): Previously known as
7596 Enum.ChangeEnumType().
7598 2002-06-09 Martin Baulig <martin@gnome.org>
7600 * expression.cs (Cast.TryReduce): Added support for consts.
7602 2002-06-08 Ravi Pratap <ravi@ximian.com>
7604 * class.cs (Accessor): Hold attributes information so we can pass
7607 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
7608 Modify to pass in attributes attached to the methods.
7610 (add_accessor_declaration, remove_accessor_declaration): Ditto.
7612 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
7613 to handle the Accessor kind :-)
7615 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
7617 2002-06-08 Martin Baulig <martin@gnome.org>
7619 * expression.cs (Unary.TryReduceNegative): Added support for
7622 2002-06-08 Martin Baulig <martin@gnome.org>
7624 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
7625 name can't be found in the `defined_names' - the caller will do a
7626 MemberLookup in this case and thus find methods in System.Enum
7627 such as Enum.IsDefined().
7629 2002-06-08 Martin Baulig <martin@gnome.org>
7631 * enum.cs (Enum.ChangeEnumType): This is a custom version of
7632 Convert.ChangeType() which works with TypeBuilder created types.
7633 (Enum.LookupEnumValue, Enum.Define): Use it here.
7635 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
7636 `TypeBuilder.BaseType != null' check.
7637 (TypeContainer.FindMembers): Only lookup parent members if we
7638 actually have a parent.
7639 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
7640 (ConstructorInitializer.Resolve): Likewise.
7642 * interface.cs (Interface.FindMembers): Added
7643 `TypeBuilder.BaseType != null' check.
7645 * rootcontext.cs (RootContext.ResolveCore): Added
7646 "System.Runtime.CompilerServices.IndexerNameAttribute" to
7647 classes_second_stage.
7649 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
7650 debug_type and trace_type when compiling with --nostdlib.
7652 2002-06-07 Martin Baulig <martin@gnome.org>
7654 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
7655 (AddField): Set it to true when adding a non-static field.
7656 (DefineType): Use `have_nonstatic_fields' to find out whether we
7657 have non-static fields, not `Fields != null'.
7659 2002-06-02 Miguel de Icaza <miguel@ximian.com>
7661 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
7662 dereferencing a null on the static-field code path)
7664 2002-05-30 Martin Baulig <martin@gnome.org>
7666 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
7667 to take command line arguments. Use reflection to call the new
7668 custom `Initialize' function on the symbol writer and pass it the
7669 command line arguments.
7671 * driver.cs (--debug-args): New command line argument to pass command
7672 line arguments to the symbol writer.
7674 2002-05-28 Miguel de Icaza <miguel@ximian.com>
7676 * assign.cs (DoResolve): Forgot to do the implicit conversion to
7677 the target type for indexers and properties. Thanks to Joe for
7680 2002-05-27 Miguel de Icaza <miguel@ximian.com>
7682 * typemanager.cs (MethodFlags): returns the method flags
7683 (Obsolete/ShouldIgnore) that control warning emission and whether
7684 the invocation should be made, or ignored.
7686 * expression.cs (Invocation.Emit): Remove previous hack, we should
7687 not do this on matching a base type, we should do this based on an attribute
7689 Only emit calls to System.Diagnostics.Debug and
7690 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
7691 on the command line.
7693 * rootcontext.cs: Global settings for tracing and debugging.
7695 * cs-tokenizer.cs (define): New utility function to track
7696 defines. Set the global settings for TRACE and DEBUG if found.
7698 2002-05-25 Ravi Pratap <ravi@ximian.com>
7700 * interface.cs (Populate*): Pass in the TypeContainer as well as
7701 the DeclSpace as parameters so that we can create EmitContexts and
7702 then use that to apply attributes etc.
7704 (PopulateMethod, PopulateEvent, PopulateProperty)
7705 (PopulateIndexer): Apply attributes everywhere.
7707 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
7710 (ApplyAttributes): Update accordingly.
7712 We now apply interface attributes for all members too.
7714 2002-05-26 Miguel de Icaza <miguel@ximian.com>
7716 * class.cs (Indexer.Define); Correctly check if we are explicit
7717 implementation (instead of checking the Name for a ".", we
7718 directly look up if the InterfaceType was specified).
7720 Delay the creation of the PropertyBuilder.
7722 Only create the PropertyBuilder if we are not an explicit
7723 interface implementation. This means that explicit interface
7724 implementation members do not participate in regular function
7725 lookups, and hence fixes another major ambiguity problem in
7726 overload resolution (that was the visible effect).
7728 (DefineMethod): Return whether we are doing an interface
7731 * typemanager.cs: Temporary hack until we get attributes in
7732 interfaces (Ravi is working on that) and we get IndexerName
7733 support in interfaces.
7735 * interface.cs: Register the indexers as properties.
7737 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
7738 warning, I have verified that this is a bug in the .NET runtime
7739 (JavaScript suffers of the same problem).
7741 * typemanager.cs (MemberLookup): When looking up members for
7742 interfaces, the parent of an interface is the implicit
7743 System.Object (so we succeed in searches of Object methods in an
7744 interface method invocation. Example: IEnumerable x; x.ToString
7747 2002-05-25 Miguel de Icaza <miguel@ximian.com>
7749 * class.cs (Event): Events should also register if they do
7750 implement the methods that an interface requires.
7752 * typemanager.cs (MemberLookup); use the new GetInterfaces
7755 (GetInterfaces): The code used to lookup interfaces for a type is
7756 used in more than one place, factor it here.
7758 * driver.cs: Track the errors at the bottom of the file, we kept
7761 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
7762 instance if the method we are calling is static!
7764 2002-05-24 Miguel de Icaza <miguel@ximian.com>
7766 * attribute.cs (ApplyAttributes): Make this function filter out
7767 the IndexerName attribute (as that attribute in reality is never
7768 applied) and return the string constant for the IndexerName
7771 * class.cs (TypeContainer.Emit): Validate that all the indexers
7772 have the same IndexerName attribute, and if so, set the
7773 DefaultName attribute on the class.
7775 * typemanager.cs: The return value might contain other stuff (not
7776 only methods). For instance, consider a method with an "Item"
7777 property and an Item method.
7779 * class.cs: If there is a problem with the parameter types,
7782 2002-05-24 Ravi Pratap <ravi@ximian.com>
7784 * ecore.cs (ImplicitConversionExists): Wrapper function which also
7785 looks at user defined conversion after making a call to
7786 StandardConversionExists - we need this for overload resolution.
7788 * expression.cs : Update accordingly the various method calls.
7790 This fixes 2 bugs filed against implicit user defined conversions
7792 2002-05-22 Miguel de Icaza <miguel@ximian.com>
7794 * statement.cs: Track the result of the assignment.
7796 2002-05-21 Miguel de Icaza <miguel@ximian.com>
7798 * expression.cs (MemberAccess): Improved error reporting for
7799 inaccessible members.
7801 2002-05-22 Martin Baulig <martin@gnome.org>
7803 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
7804 itself with debugging support.
7806 2002-05-22 Martin Baulig <martin@gnome.org>
7808 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
7809 Removed, this isn't needed anymore.
7811 2002-05-20 Martin Baulig <martin@gnome.org>
7813 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
7814 be underlying type for an enum.
7816 2002-05-20 Miguel de Icaza <miguel@ximian.com>
7818 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
7819 that splits out the loading of just the core types.
7821 * rootcontext.cs (ResolveCore): Split the struct resolution in
7822 two, so we can load the enumeration underlying types before any
7825 * expression.cs (Is): Bandaid until we fix properly Switch (see
7826 bug #24985 for details).
7828 * typemanager.cs (ImplementsInterface): The hashtable will contain
7829 a null if there are no interfaces implemented.
7831 2002-05-18 Miguel de Icaza <miguel@ximian.com>
7833 * cs-parser.jay (indexer_declarator): It is fine to have array
7836 2002-05-17 Miguel de Icaza <miguel@ximian.com>
7838 * typemanager.cs: (RegisterBuilder): New function used to register
7839 TypeBuilders that implement interfaces. Since
7840 TypeBuilder.GetInterfaces (as usual) does not work with lame
7842 (AddUserType): register interfaces.
7844 (ImplementsInterface): Use the builder_to_ifaces hash if we are
7845 dealing with TypeBuilder. Also, arrays are showing up as
7846 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
7847 methods can not be invoked on them!
7849 * ecore.cs (ExplicitReferenceConversionExists): Made public.
7850 (ImplicitReferenceConversionExists): Split out from
7851 StandardConversionExists.
7853 * expression.cs (As): We were only implementing one of the three
7854 cases for the as operator. We now implement them all.
7855 (Is): Implement the various other cases for Is as well.
7857 * typemanager.cs (CACHE): New define used to control if we want or
7858 not the FindMembers cache. Seems to have a negative impact on
7859 performance currently
7861 (MemberLookup): Nested types have full acess to
7862 enclosing type members
7864 Remove code that coped with instance/static returns for events, we
7865 now catch this in RealFindMembers.
7867 (RealFindMembers): only perform static lookup if the instance
7868 lookup did not return a type or an event.
7870 2002-05-17 Miguel de Icaza <miguel@ximian.com>
7872 * assign.cs (CompoundAssign): We pass more semantic information
7873 now to Compound Assignments than we did before: now we have all
7874 the information at hand, and now we resolve the target *before* we
7875 do the expression expansion, which allows the "CacheValue" method
7876 to have the effect we intended (before, a [x] += 1 would generate
7877 two differen ArrayAccess expressions from the ElementAccess,
7878 during the resolution process).
7880 (CompoundAssign.DoResolve): Resolve target and original_source here.
7882 2002-05-16 Miguel de Icaza <miguel@ximian.com>
7884 * expression.cs (ArrayAccess): dropped debugging information.
7886 * typemanager.cs: Small bug fix: I was always returning i_members,
7887 instead of one of i_members or s_members (depending on which had
7890 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
7891 method is invoked before any code generation takes place, and it
7892 is a mechanism to inform that the expression will be invoked more
7893 than once, and that the method should use temporary values to
7894 avoid having side effects
7896 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
7898 * ecore.cs (Expression.CacheTemporaries): Provide empty default
7901 * expression.cs (Indirection, ArrayAccess): Add support for
7902 CacheTemporaries in these two bad boys.
7904 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
7906 (StoreFromPtr): Handle stobj as well.
7908 * expression.cs (UnaryMutator): Share more code.
7910 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
7911 down: I was not tracking the Filter function as well, which
7912 was affecting the results of the cache.
7914 2002-05-15 Miguel de Icaza <miguel@ximian.com>
7916 * attribute.cs: Remove the hack to handle the CharSet property on
7919 2002-05-14 Miguel de Icaza <miguel@ximian.com>
7921 * attribute.cs (DoResolve): More uglyness, we now only try to
7922 resolve the attribute partially, to extract the CharSet
7923 information (only if we are a StructLayout attribute). Otherwise
7925 (GetExtraTypeInfo): Add some code to conditionally kill in the
7926 future this. I am more and more convinced that the .NET
7927 framework has special code to handle the attribute setting on
7930 * expression.cs (IsParamsMethodApplicable): Revert my previous
7931 foreach change here, it was wrong.
7933 2002-05-13 Miguel de Icaza <miguel@ximian.com>
7935 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
7936 (pp_expr): do not abort on unknown input, just return.
7937 (eval): abort if there are pending chars.
7939 * attribute.cs (Attribute.Resolve): Positional parameters are
7940 optional. Deal with that case.
7942 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
7943 the Ansi/Unicode/Auto information for the type.
7945 (TypeContainer.DefineType): instantiate the EmitContext here, as
7946 we will be using it during the type definition (to resolve
7947 attributes) and during the emit phase.
7949 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
7950 to pull type information out of the attributes
7952 (Attribute.Resolve): track the constructor builder, and allow for
7953 multiple invocations (structs and classes will use this).
7955 * ecore.cs (MemberLookupFinal): new version with all the
7956 parameters customizable.
7958 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
7959 constructors. Return if the result value is null (as the error
7960 would have been flagged already by MemberLookupFinal)
7962 Do not allow instances of abstract classes or interfaces to be
7965 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
7966 We have to compare the assembly property here when dealing with
7967 FamANDAssem and Assembly access modifiers, because we might be
7968 creating an assembly from *modules* (that means that we are not
7969 getting TypeBuilders for types defined in other modules that are
7970 part of this assembly).
7972 (Method.Emit): If the method is marked abstract and has a body,
7975 (TypeContainer.DefineMembers): If both the defined member and the
7976 parent name match are methods, then do not emit any warnings: let
7977 the Method.Define routine take care of flagging warnings. But if
7978 there is a mismatch (method overrides something else, or method is
7979 overriwritten by something, then emit warning).
7981 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
7982 set to null, this means `do not check for the return type on the
7985 (Method.Define): set the return type for the method signature to
7986 null, so that we get methods with the same name and parameters and
7987 different return types. This is used to flag warning 114 (you are
7988 hiding a method, and you probably want to use the new/override
7991 * typemanager.cs (MemberLookup): Implemented proper access
7992 control, closing a long standing set of bug reports. The problem
7993 was that the Framework only has two bits: Public and NonPublic,
7994 and NonPublic includes private and protected methods, but we need
7995 to enforce the FamANDAssem, FamOrAssem and Family.
7997 2002-05-11 Miguel de Icaza <miguel@ximian.com>
7999 * statement.cs (GotoCase): Return true: Ammounts to giving up
8000 knowledge on whether we return or not, and letting the other case
8001 be responsible for it.
8003 2002-05-10 Miguel de Icaza <miguel@ximian.com>
8005 * driver.cs: Do not load directories for each file processed, only
8006 do it if there is a pattern.
8008 * ecore.cs: Report readonly assigns here as well, as we might have
8009 been resolved only by MemberAccess.
8011 (SimpleName.SimpleNameResolve): Also be useful for LValue
8012 resolution. We need this to propagate assign to local readonly variables
8014 * typemanager.cs: Use a ptrhashtable for the criteria, because we
8015 do not want to reuse potential criteria memory.
8017 * class.cs (MyEventBuilder): Set reflected_type;
8019 * ecore.cs (Constantify): Added support for constifying bools.
8021 (RootContext.LookupType): Added a cache for values looked up in
8022 the declaration space.
8024 * typemanager.cs (FindMembers): Now is a front-end to
8025 RealFindMembers, and provides a two-level hashtable-based cache to
8028 15% performance improvement: from 22.5 to 19.2 seconds.
8030 * expression.cs (IsParamsMethodApplicable): use foreach.
8031 (Invocation.DoResolve): ditto.
8032 (New.DoResolve): ditto.
8033 (ArrayCreation.DoResolve): ditto.
8035 * ecore.cs (FindMostEncompassingType): use foreach.
8037 * delegate.cs (NewDelegate.DoResolve): Use foreach
8039 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
8040 (RemoveMethods): use foreach.
8042 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
8043 nested foreach statements instead of for, and also break out of
8044 the inner loop once a match is found.
8046 (Invocation.OverloadResolve): Use foreach, simplify the code.
8048 2002-05-08 Miguel de Icaza <miguel@ximian.com>
8050 * cfold.cs (BinaryFold): During an enumeration evaluation context,
8051 we actually unwrap the expression to allow for extra information
8054 * expression.cs: Use Shr_Un on unsigned operations.
8056 2002-05-08 Ravi Pratap <ravi@ximian.com>
8058 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
8059 applicable operators was not being considered correctly. This closes
8060 the bug Miguel reported.
8062 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
8064 * attribute.cs: check that the type derives from System.Attribute
8065 and report the correct error in that case (moved the duplicate code to
8066 its own method, too).
8068 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
8070 * attribute.cs: lookup attribute type name as the spec says: first the
8071 bare attribute name and then name + "Attribute" (nant compiles with
8072 mcs after this fix).
8074 2002-05-07 Miguel de Icaza <miguel@ximian.com>
8076 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
8077 Because of the way we parse things, we should try to see if a
8078 UIntConstant can fit in an integer.
8080 2002-05-07 Ravi Pratap <ravi@ximian.com>
8082 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
8083 when we are in an explicit context.
8085 (ConvertReferenceExplicit): When converting from Iface type S to Class
8086 T make sure the rules are implemented as an OR.
8088 * parameter.cs (ParameterType): Make it a property for now although the
8089 purpose really isn't anything immediate.
8091 * expression.cs (Is*Applicable): Do better checking on the parameter type
8092 of a ref/out parameter. The ones from the system assemblies are already
8093 marked with the correct type so we don't need to do any correction.
8095 * ecore.cs (StandardConversionExists): Conversion from Interface types to
8096 the object type is standard too so include that.
8098 2002-05-06 Miguel de Icaza <miguel@ximian.com>
8100 * ecore.cs (StandardConversionExists): Augment with missing code:
8101 deal with IntConstant, LongConstants and Enumerations.
8103 * assign.cs: Report the error, instead of failing silently
8105 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
8106 typecontainer that they are declared, because the
8107 typecontainer/namespace will have the list of using clauses that
8110 Assembly Attributes were escaping the normal registration
8113 (EmitCode): Apply attributes within an EmitContext that represents
8114 the container they were declared on.
8116 * cs-parser.jay: Track bases for structs. How did I get this wrong?
8118 2002-05-06 Ravi Pratap <ravi@ximian.com>
8120 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
8121 Revamp completely - make much cleaner as we now operate only
8124 (FindMostSpecificSource, FindMostSpecificTarget): New methods
8125 to implement the logic detailed in the spec more correctly.
8127 (UserDefinedConversion): Update accordingly.
8129 2002-05-06 Miguel de Icaza <miguel@ximian.com>
8131 * statement.cs: Return flow analysis information up.
8133 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
8136 (token): Do not consume an extra character before calling
8139 2002-05-06 Piers Haken <piersh@friskit.com>
8141 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
8143 2002-05-06 Miguel de Icaza <miguel@ximian.com>
8145 * class.cs (Constructor.Emit): Set the IsStatic flag in the
8146 EmitContext during the instance constructor initializer
8147 resolution, to stop access to instance variables.
8149 This is mandated by the spec, last paragraph of the `constructor
8150 initializers' section.
8152 2002-05-05 Miguel de Icaza <miguel@ximian.com>
8154 * cs-parser.jay, class.cs (Accessor): new class used to represent
8155 an accessor (get or set). In the past we used `null' to represent
8156 a missing accessor. But this is ambiguous because there was no
8157 way to tell in abstract indexers/properties if one of them was
8160 Now there is a way of addressing that.
8162 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
8163 instead of FindMembers.
8165 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
8166 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
8168 * attribute.cs: Treat indexers and properties as the same in terms
8169 of applying attributes
8171 * ecore.cs (FindMostEncompassedType): Use statically initialized
8172 EmptyExpressions()s like we do elsewhere to avoid creating useless
8173 objects (and we take this out of the tight loop).
8175 (GetConversionOperators): Move the code to extract the actual
8176 operators to a separate routine to clean things up.
8178 2002-05-04 Miguel de Icaza <miguel@ximian.com>
8180 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
8181 events are always registered FieldBuilders.
8183 * class.cs (FieldBase): New class shared by Fields
8185 * delegate.cs: If we are a toplevel delegate, use our full name.
8186 If we are a nested delegate, then only use our tail name.
8188 2002-05-02 Ravi Pratap <ravi@ximian.com>
8190 * expression.cs (IsApplicable): Ensure that we add the "&" to
8191 ref/out types before comparing it with the type of the argument.
8193 (IsParamsMethodApplicable): Ditto.
8195 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
8198 * delegate.cs : Handle the case when we have more than one applicable
8199 method. Flag an error only when we finish checking all.
8201 2002-05-02 Miguel de Icaza <miguel@ximian.com>
8203 * expression.cs: Add support for boolean static initializers.
8205 2002-05-01 Miguel de Icaza <miguel@ximian.com>
8207 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
8209 * parameter.cs (ComputeParameterTypes,
8210 ComputeAndDefineParameterTypes): Better error handling: now we
8211 clear the `types' cache if we fail during any of the type lookups.
8212 We also return the status code correctly to our caller
8214 * delegate.cs: If we fail to define a delegate, abort the extra
8217 * expression.cs (Binary.ResolveOperator): for
8218 operator==(object,object) and operator !=(object, object) we also
8219 have to verify that there is an implicit conversion from one to
8222 (ArrayAccess.DoResolve): Array Access can operate on
8225 2002-04-30 Miguel de Icaza <miguel@ximian.com>
8227 * assign.cs (CompoundAssign): A new class used as a "flag" that
8228 the assignment actually is happening as part of a compound
8229 assignment operator.
8231 During compound assignment, a few new rules exist to enable things
8238 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
8239 to the type of x) if y is implicitly convertible to the type of x,
8240 and the operator is a builtin operator and the return type of the
8241 operator is explicitly convertible to the type of x.
8243 * rootcontext.cs: Reset warning level to 2. 4 catches various
8244 "interesting" features in mcs, we must clean this up at some
8245 point, but currently am trying to kill other bugs ;-)
8247 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
8248 in container classes as well.
8250 * expression.cs (Binary.ResolveOperator): Handle string case
8251 before anything else (as operator overloading does emit an error
8252 before doing anything else).
8254 This code could go away when we move to a table driven model, but
8255 i could not come up with a good plan last night.
8257 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
8259 * typemanager.cs (CSharpName): reimplementation using regex.
8260 * class.cs: added null check for fields in Emit
8261 * rootcontext.cs: set warninglevel to 4
8263 2002-04-29 Miguel de Icaza <miguel@ximian.com>
8265 * typemanager.cs (CSharpName): reimplemented with Lupus
8268 2002-04-28 Miguel de Icaza <miguel@ximian.com>
8270 * statement.cs (If): correclty implement Resolve, because we were
8271 not catching sem errors in there. The same process is needed
8273 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
8276 (Statement.Warning_DeadCodeFound): Factorize code.
8277 (While): Report dead code here too.
8279 (Statement): Added Resolve virtual method to allow
8280 for resolution split from the emit code.
8282 2002-04-26 Miguel de Icaza <miguel@ximian.com>
8284 * statement.cs (EmitBoolExpression): No longer try to resolve the
8286 (MakeBoolean): New utility function that resolve, implicitly
8287 converts to boolean and tags the expression.
8290 (If, Do): Implement dead code elimination.
8291 (While): Implement loop inversion
8293 (Do, While, For, If): Resolve the expression prior to calling our
8296 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
8299 - added method Report28 (warning: program has more than one entry point)
8300 - added method IsEntryPoint, implements paragraph 10.1 of the spec
8301 - modified method Method.Define, the part at the end of the method
8303 * rootcontext.cs: added static public Location EntryPointLocation;
8305 * ../errors/cs0028.cs : Add test case for the above warning.
8308 - modified method CSharpName to allow arrays of primitive type to
8309 be printed nicely (e.g. instead of System.Int32[][] it now prints
8311 - added method CSharpSignature: returns the signature of a method
8312 in string format to be used in reporting errors, warnings, etc.
8314 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
8317 2002-04-26 Ravi Pratap <ravi@ximian.com>
8319 * delegate.cs (Define): Fix extremely silly bug where I was
8320 setting the type of the 'object' parameter of the BeginInvoke
8321 method to System.IAsyncResult instead of System.Object ;-)
8323 2002-04-26 Miguel de Icaza <miguel@ximian.com>
8325 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
8328 (Constructor.Emit): return if we fail to initialize the
8329 constructor. Another door closed!
8331 * expression.cs (New.DoResolve): Improve error message (from -6 to
8332 1501). Use DeclaredOnly lookup to find the exact constructor.
8334 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
8335 loop. This is useful.
8337 * cs-parser.jay: Adjust the default parameters so that destructors
8338 have the proper signature.
8340 2002-04-26 Martin Baulig <martin@gnome.org>
8342 * driver.cs (LoadAssembly): If `assembly' contains any characters
8343 which are only valid in path names and not in assembly names
8344 (currently slash, backslash and point), use Assembly.LoadFrom ()
8345 instead of Assembly.Load () on the `assembly' (before iteration
8346 over the link_paths).
8348 2002-04-26 Martin Baulig <martin@gnome.org>
8350 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
8352 2002-04-25 Miguel de Icaza <miguel@ximian.com>
8354 * class.cs (Property): use the new typemanager.MemberLookup
8356 (TypeContainer.MemberLookup): Implement using the
8357 TypeManager.MemberLookup now.
8359 * typemanager.cs: Make MemberLookup a function of the TypeManager,
8360 and return MemberInfos, so that these can be used without an
8361 EmitContext (what we had before).
8363 2002-04-24 Miguel de Icaza <miguel@ximian.com>
8365 * expression.cs: Fix the case where the argument to params if the
8366 type of the params. I omitted handling this before. Fixed
8368 2002-04-22 Miguel de Icaza <miguel@ximian.com>
8370 * driver.cs: Call BootCorlib_PopulateCoreType
8372 * class.cs (Property.CheckBase): Check for properties only, not
8375 * interface.cs: Temporary hack: try/catch around the
8376 CustomAttributeBuilder, because I am getting an exception that I
8379 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
8380 types whose definitions are required to be there (attributes are
8381 defined before standard types).
8383 Compute definitions as we boot the various types, as they are used
8384 immediately (value_type class will need object_type, but if we do
8385 not initialize object_type, we will pass a null, which will let
8386 the runtime pick the System.Object from the existing corlib, which
8387 is not what we want).
8389 2002-04-22 Patrik Torstensson <totte@labs2.com>
8391 * cs-tokenizer.cs: fixed a number of trim() issues.
8393 2002-04-22 Ravi Pratap <ravi@ximian.com>
8395 * expression.cs (Argument.Type): Ensure that we return the correct
8396 type when we have out or ref parameters [in which case we
8399 2002-04-22 Miguel de Icaza <miguel@ximian.com>
8401 * class.cs (Property, Indexer): Allow extern modifier in there.
8403 * typemanager.cs (InitBaseTypes): Initializes object_type and
8404 value_type, since those will be used early on during the bootstrap
8405 process to compile corlib.
8407 (InitCoreTypes): Move code from here to InitBaseTypes.
8409 2002-04-21 Miguel de Icaza <miguel@ximian.com>
8411 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
8412 single-dimension arrays as using the ldlen opcode.
8414 Daniel Lewis discovered this optimization.
8416 * typemanager.cs: Add signature for System.Array::get_Length
8418 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8420 * statement.cs: report the error when the foreach does not apply to an
8421 array nor a collection.
8423 2002-04-19 Miguel de Icaza <miguel@ximian.com>
8425 * expression.cs: Add implicit conversions to the operator ~.
8427 * constant.cs (DecimalConstant.Emit): Emit decimal value.
8429 * typemanager.cs: Locate the decimal constructor.
8431 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8433 * attribute.cs: use the new property of TypeOf.
8434 * expression.cs: added 'get' property around typearg.
8436 These changes fix a build breaker reported by NickD. Is this the
8437 correct way to fix? If not, please, revert my changes and make it
8440 2002-04-17 Miguel de Icaza <miguel@ximian.com>
8442 * attribute.cs: Add support for typeof in attribute invocations.
8443 I am not sure that this is right though.
8445 2002-04-14 Duncan Mak <duncan@ximian.com>
8447 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
8448 Binary.Operator.Division case.
8450 2002-04-13 Ravi Pratap <ravi@ximian.com>
8452 * class.cs (DefineType): Ensure that we do a proper check on
8453 attribute types and also register it with the TypeManager.
8455 (TypeContainer.Targets): The default for attribute types is
8456 AttributeTargets.All.
8458 * attribute.cs (ApplyAttributes): Registering the attribute type
8459 is done elsewhere, not when we discover we have a Usage attribute.
8461 2002-04-12 Ravi Pratap <ravi@ximian.com>
8463 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
8464 and get rid of is_delegate parameter.
8466 * everywhere : update.
8468 2002-04-12 Ravi Pratap <ravi@ximian.com>
8470 * cs-parser.jay (compilation_unit): Revamp completely to use
8471 some new ideas that I got from Rhys' grammar to solve the problems
8472 with assembly level attributes.
8474 (outer_declaration): New grammar production.
8476 (attribute_sections): Add.
8478 (opt_attributes): Base on attribute_sections
8480 (namespace_declaration): Allow opt_attributes to tackle the case
8481 when we have assembly level attributes - we are clever in this
8484 * attribute.cs (ApplyAttributes): Do not worry about assembly
8485 attributes in the non-global context.
8487 * rootcontext.cs (AddGlobalAttributes): Go back to using this
8488 instead of SetGlobalAttributes.
8490 * class.cs, rootcontext.cs : Ensure we define and generate
8491 attribute types before anything else.
8493 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
8494 and flag the new error -20 for the case when the attribute type
8495 does not have valid targets specified. csc does not catch this.
8497 * ../errors/errors.txt : update for error # -20
8499 2002-04-11 Ravi Pratap <ravi@ximian.com>
8501 * support.cs (InternalParameters.ParameterModifier): Do some null
8502 checking and return sane values.
8504 * class.cs (Method.Define): If we are a PInvoke method, ensure
8505 that we are static and extern. Report error # 601
8507 * ../errors/cs0601.cs : Add test case for the above error.
8509 2002-04-07 Ravi Pratap <ravi@ximian.com>
8511 * rootcontext.cs (attribute_types): We need to keep type of
8512 all attribute types separately and emit code for them first.
8514 (RegisterAttribute) : Implement.
8516 * class.cs (DefineType): Check if the current Type is a custom
8517 attribute type and register it accordingly.
8519 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
8520 adding the first attribute twice and rename to
8522 (SetGlobalAttributes): this.
8524 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
8527 * attribute.cs (ApplyAttributes): Take an additional argument telling us
8528 if we are processing global arguments. Hmm, I am unsure of this.
8530 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8532 * expression.cs: added static array of strings to avoid calling
8533 Enum.ToString () for Operator in Binary. Significant recover of
8536 2002-04-10 Miguel de Icaza <miguel@ximian.com>
8538 * class.cs (FindMembers): Allow the Builders of the various
8539 members to be null. If they are skip them. This only happens
8540 during the PInvoke declaration.
8542 2002-04-09 Miguel de Icaza <miguel@ximian.com>
8544 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
8545 failure, so we do not keep going afterwards.
8547 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
8548 wanted to pass `false' as the `is_delegate' argument. If this is
8549 the case, why not use delegate_type == null to mean `is_delegate =
8550 false' and anything else as is_delegate = true.
8552 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
8554 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
8555 code for the section, not the beginning of the tests.
8557 2002-04-08 Miguel de Icaza <miguel@ximian.com>
8559 * cfold.cs: Handle operator + (Enum x, Underlying x)
8561 * expression.cs (Binary): same. Warn about errors where we have
8562 Enum/Enum in operator + as well.
8564 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
8567 - added support for switch(bool)
8568 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
8569 - add TableSwitchEmit() to handle table-based switch statements
8571 2002-04-05 Ravi Pratap <ravi@ximian.com>
8573 * expression.cs (Invocation.OverloadResolve): Factor out code which
8574 does parameter compatibility checking with arguments so that we can
8575 re-use the code even from Delegate.VerifyApplicability
8577 (VerifyArgumentsCompat): Move above code here.
8579 * delegate.cs (VerifyApplicability): Get rid of duplicate code
8580 and instead make a call to the above method.
8582 2002-03-31 Ravi Pratap <ravi@ximian.com>
8584 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
8585 We use it to keep track of classes which are attribute types.
8587 2002-04-02 Miguel de Icaza <miguel@ximian.com>
8589 * delegate.cs (Delegate.Define): Correctly define the types in the
8590 presence of fixed and array parameters.
8592 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
8595 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
8596 include NonPublic after the first iteration.
8598 * class.cs (Indexer.CheckBase): Only check if both parents are
8601 * cs-parser.jay (accessor_body): If empty, set to null.
8603 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
8604 same code path here to resolve constants names that we did have in
8605 MemberAccess.DoResolve. There is too much code duplicated here.
8607 2002-04-01 Miguel de Icaza <miguel@ximian.com>
8609 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
8611 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
8614 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
8615 tokens, numbers and strings.
8617 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
8620 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
8621 asyncronous parameters and the regular parameters.
8623 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
8624 specify the target directory.
8626 * expression.cs: (This.DoResolve): Simplify
8627 (As.Emit): Optimize, do not generate IsInst if the expression is
8628 always of the given type.
8630 (Is.DoResolve): Bug fix, we were reporting both always/never for
8633 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
8634 creating too many unnecessary arrays.
8636 2002-03-31 Miguel de Icaza <miguel@ximian.com>
8638 * class.cs (EmitFieldInitializer): Use Assign expression to assign
8639 fields instead of rolling our own initializer. Takes care of all
8640 implicit conversions, and drops unnecessary static checks/argument.
8642 2002-03-31 Dick Porter <dick@ximian.com>
8644 * driver.cs: use the GetDirectories() return values properly, and
8645 use "/" as path separator.
8647 2002-03-30 Miguel de Icaza <miguel@ximian.com>
8649 * expression.cs (Unary): Optimize - - expr into expr.
8650 (Binary): Optimize a + (-b) into a -b.
8652 * codegen.cs (CodeGen): Made all methods static.
8654 2002-03-29 Miguel de Icaza <miguel@ximian.com>
8658 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
8659 TypeBuilder property.
8661 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
8664 * tree.cs: Removed the various RecordXXXX, and replaced with a
8665 single RecordDecl. Removed all the accessor methods, and just
8666 left a single access point Type
8668 * enum.cs: Rename DefineEnum to DefineType.
8670 * decl.cs: New abstract method `DefineType' used to unify the
8671 Defines for Enumerations, Interfaces, TypeContainers and
8674 (FindType): Moved LookupInterfaceOrClass here. Moved the
8675 LookupBaseClasses method that used to live in class.cs and
8676 interface.cs here, and renamed to FindType.
8678 * delegate.cs: Implement DefineType. Take advantage of the
8679 refactored pattern for locating the parent builder without taking
8680 the parent_builder argument (which we know does not work if we are
8681 nested, and triggering a toplevel definition).
8683 2002-03-28 Miguel de Icaza <miguel@ximian.com>
8685 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
8686 accessibility of a member has changed during override and report
8689 * class.cs (Method.Define, Property.Define): Only complain on
8690 overrides if the method is private, any other accessibility is
8691 fine (and since we just checked the permission is the same, we are
8694 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
8695 and elif are processed always. The other pre-processing
8696 directives are only processed if we are "taking" the path
8698 2002-03-29 Martin Baulig <martin@gnome.org>
8700 * class.cs (Method.Emit): Only emit symbolic debugging info if the
8701 current location is not Null.
8703 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
8704 a separate method so we can profile it.
8706 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
8707 `span.Seconds' are just seconds, but no minutes or hours.
8708 (MainDriver): Profile the CodeGen.SaveSymbols calls.
8710 2002-03-28 Miguel de Icaza <miguel@ximian.com>
8712 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
8713 Remove the gratuitous set of Final:
8715 // If an interface implementation, then we can set Final.
8716 if (((flags & MethodAttributes.Abstract) == 0) &&
8717 implementing.DeclaringType.IsInterface)
8718 flags |= MethodAttributes.Final;
8720 I do not know what I was smoking when I used that.
8723 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
8724 step into fixing the name resolution issues for delegates and
8725 unifying the toplevel name resolution.
8727 2002-03-28 Martin Baulig <martin@gnome.org>
8729 * class.cs (Method.Emit): If we have a symbol writer, call its
8730 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
8731 tell it about the current method.
8733 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
8734 writer that we're going to emit the first byte of IL code for a new
8735 statement (a new source line).
8736 (EmitContext.EmitTopBlock): If we have a symbol writer, call
8737 EmitContext.Mark() before emitting any code.
8739 * location.cs (SymbolDocument): Return null when we're Null.
8741 * statement.cs (Statement): Moved the `Location loc' variable here.
8742 (Statement.EmitBoolExpression): If we have a symbol writer, call
8743 ec.Mark() before emitting any code to tell it that we're at the
8744 beginning of a new statement.
8745 (StatementExpression): Added `Location' argument to the constructor.
8746 (Block): Added public readonly variable `StartLocation' and public
8747 variable `EndLocation'. The latter is to be set using SetEndLocation().
8748 (Block): Added constructor which takes a start and end location.
8749 (Block.SetEndLocation): New method. This sets the end location.
8750 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
8751 local variables we create.
8752 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
8753 each statement and do also mark the begin and end of the block.
8755 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
8756 tell it the current lexer.Location, use Location.Null for the end of the
8758 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
8759 current block, set its end location using SetEndLocation().
8760 (statement_expression): StatementExpression constructor now takes the
8761 lexer.Location as additional argument.
8762 (for_statement, declare_local_variables): Likewise.
8763 (declare_local_variables): When creating a new implicit block, use the
8764 new Block constructor and pass it the lexer.Location.
8766 2002-03-28 Miguel de Icaza <miguel@ximian.com>
8768 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
8769 members also on the parent interfaces recursively.
8771 2002-03-27 Miguel de Icaza <miguel@ximian.com>
8773 * report.cs: Use new formats, since Gonzalo finished the missing
8776 * expression.cs (Binary.ResolveOperator): added missing operator|
8777 operator& and operator^ for bool/bool.
8779 * cs-parser.jay: CheckDef now takes a Location argument that is
8780 used to report errors more precisly (instead of reporting the end
8781 of a definition, we try to track something which is a lot closer
8782 to the source of the problem).
8784 * cs-tokenizer.cs: Track global token use, so we can properly flag
8785 the use of #define/#undef after the first token has been seen.
8787 Also, rename the reportXXXX to Error_DescriptiveName
8789 * decl.cs (DeclSpace.IsTopLevel): Move property here from
8790 TypeContainer, so that Enum and Interface can use this too.
8792 * class.cs (TypeContainer.LookupInterfaceOrClass,
8793 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
8794 `builder' argument. Typically this was used to pass the parent
8795 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
8798 The problem is that a nested class could trigger the definition of
8799 a toplevel class, and the builder would be obviously wrong in that
8802 So we drop this argument, and we compute dynamically the
8803 TypeBuilder/ModuleBuilder (the correct information was available
8804 to us anyways from DeclSpace.Parent)
8806 * interface.cs (Interface.DefineInterface): Drop builder
8807 parameter cleanup like class.cs
8809 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
8812 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
8815 (Try.Emit): Propagate the returns value from the statement.
8817 (Return.Emit): Even if we are leavning
8819 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
8821 * modifiers.cs: Fix the computation of MethodAttributes flags.
8823 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
8825 * driver.cs: allow compilation of files that start with '/'.
8826 Add a default case when checking the argument of --target.
8828 2002-03-25 Miguel de Icaza <miguel@ximian.com>
8830 * interface.cs: Implement the same search algorithm for types in
8833 * delegate.cs: Do not allow multiple definition.
8835 * Recovered ChangeLog that got accidentally amputated
8837 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
8839 * rootcontext.cs: Load manually enum to allow core classes to
8840 contain enumerations.
8842 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
8843 Update to new static methods in TypeManager.
8845 * typemanager.cs (GetMethod, GetConstructor): Use our
8846 implementation of FindMembers to find the members, since during
8847 corlib compilation, the types are TypeBuilders and GetMethod and
8848 GetConstructor do not work.
8850 Make all methods in TypeManager static.
8852 (InitCodeHelpers): Split the functionality from
8853 the InitCodeTypes function.
8855 * driver.cs: Call InitCodeHelpers after we have populated the
8858 * cs-parser.jay (delegate_declaration): we did not used to compute
8859 the delegate name correctly for void delegates.
8861 2002-03-24 Miguel de Icaza <miguel@ximian.com>
8863 * rootcontext.cs (RootContext): Init the interface_resolve_order
8864 and type_container_resolve_order always.
8866 (ResolveCore, BootstrapCorlib_ResolveClass,
8867 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
8868 compiler when compiling with --nostdlib
8870 * class.cs (TypeContainer.DefineType): Check that our parent is
8871 not null. This test is most important when we are bootstraping
8874 * codegen.cs: Split out the symbol writing code.
8876 2002-03-25 Martin Baulig <martin@gnome.org>
8878 * driver.cs (-g): Made -g an alias for --debug.
8880 2002-03-24 Martin Baulig <martin@gnome.org>
8882 * codegen.cs (SymbolWriter): New public variable. Returns the
8883 current symbol writer.
8884 (CodeGen): Added `bool want_debugging_support' argument to the
8885 constructor. If true, tell the ModuleBuild that we want debugging
8886 support and ask it for the ISymbolWriter.
8887 (Save): If we have a symbol writer, call it's Close() method after
8888 saving the assembly.
8890 * driver.c (--debug): New command line argument to create a
8891 debugger information file.
8893 * location.cs (SymbolDocument): New public property. Returns an
8894 ISymbolDocumentWriter object for the current source file or null
8895 if we don't have a symbol writer.
8897 2002-03-21 Miguel de Icaza <miguel@ximian.com>
8899 * driver.cs (LoadAssembly): Correctly return when all the paths
8900 have been tried and not before.
8902 * statement.cs (Switch.Emit): return the actual coverage for this
8903 statement (returns/not-returns)
8905 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
8906 switch of the statement if we are the last switch section. That
8907 kills two problems: try/catch problems (we used to emit an empty
8908 nop at the end) and switch statements where all branches would
8911 2002-03-19 Miguel de Icaza <miguel@ximian.com>
8913 * driver.cs: Add default assemblies (the equivalent to the
8914 Microsoft CSC.RSP file)
8916 * cs-tokenizer.cs: When updating `cols and setting it to zero,
8917 also update tokens_seen and set it to false.
8919 * driver.cs: Implement --recurse for Mike.
8921 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
8922 correctly splitting out the paths.
8924 2002-03-18 Miguel de Icaza <miguel@ximian.com>
8926 * interface.cs (Interface.PopulateProperty): Instead of using
8927 `parent' as the declaration space for the set parameters, use
8930 * support.cs (InternalParameters): InternalParameters constructor
8931 takes a DeclSpace instead of a TypeContainer.
8933 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
8934 types are being initialized, load the address of it before calling
8937 (New): Provide a mechanism to disable the generation of local
8938 value type temporaries when the caller will be providing us with
8939 an address to store it.
8941 (ArrayCreation.EmitDynamicInitializers): Use it.
8943 2002-03-17 Miguel de Icaza <miguel@ximian.com>
8945 * expression.cs (Invocation.EmitArguments): Only probe for array
8946 property if there is more than one argument. Sorry about that.
8948 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
8951 * class.cs (Method.LabelParameters): Fix incorrect code path that
8952 prevented the `ParamArrayAttribute' from being applied to the
8955 2002-03-16 Miguel de Icaza <miguel@ximian.com>
8957 * support.cs (ReflectionParameters): Correctly compute whether the
8958 last argument is a params array. Fixes the problem with
8961 * typemanager.cs: Make the assemblies array always be non-null
8962 (empty, but non-null)
8964 * tree.cs (RecordDecl): New function that abstracts the recording
8965 of names. This reports error 101, and provides a pointer to the
8966 previous declaration. Fixes a crash in the compiler.
8968 * cs-parser.jay (constructor_declaration): Update to new grammar,
8969 and provide a constructor_body that can be empty.
8971 2002-03-15 Miguel de Icaza <miguel@ximian.com>
8973 * driver.cs: Add support for --resources.
8975 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
8976 Make all types for the various array helper methods be integer.
8978 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
8979 CheckState to ConvCast.
8981 (ConvCast): Now it takes a `checked' state argument, to avoid
8982 depending on the emit context for the conversion, and just using
8983 the resolve time setting.
8985 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
8986 instead of Invocation.EmitArguments. We do not emit the original
8987 arguments, instead we emit those which have been converted to
8988 unsigned int expressions.
8990 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
8992 * codegen.cs: ditto.
8994 * expression.cs (LocalVariableReference): Drop the use of the
8995 Store function that depended on the variable index.
8997 * statement.cs (VariableInfo): Drop the `Idx' property from this
8998 class, as this is not taking into account the indexes for
8999 temporaries tat we generate during the execution, getting the
9002 * class.cs: First emit class initializers, then call the parent
9005 * expression.cs (Binary): Fix opcode emision.
9006 (UnaryMutator.EmitCode): Support checked code generation
9008 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
9009 matches for events for both the Static and Instance scans,
9010 pointing to the same element. Fix that.
9012 2002-03-14 Miguel de Icaza <miguel@ximian.com>
9014 * rootcontext.cs (ResolveTree): Always set the
9015 interface_resolve_order, because nested interfaces will be calling
9018 * class.cs (GetInterfaceOrClass): Track the same resolution
9019 process used by TypeManager.LookupType. This fixes the nested
9020 type lookups in class declarations (separate path from
9023 (TypeContainer.DefineType): Also define nested interfaces.
9024 (TypeContainer.RegisterOrder): New public function used to
9025 register the order in which child interfaces need to be closed.
9027 Nested interfaces need to be closed after their parents have been
9030 * interface.cs (InterfaceAttr): Put all the logic for computing
9031 the interface attribute here.
9033 (DefineInterface): Register our interface order with the
9034 RootContext or with the TypeContainer depending on the case.
9036 2002-03-12 Miguel de Icaza <miguel@ximian.com>
9038 * cs-parser.jay: rework foreach statement to work with the new
9039 changes to the policy on SimpleNames.
9041 * report.cs: support Stacktrace on warnings as well.
9043 * makefile: drop --unsafe and /unsafe from the compile.
9045 2002-03-13 Ravi Pratap <ravi@ximian.com>
9047 * ecore.cs (StandardConversionExists): Modify to take an Expression
9048 as the first parameter. Ensure we do null -> reference type conversion
9051 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
9052 temporary Expression objects.
9054 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
9056 * interface.cs: workaround bug in method overloading resolution
9057 (there is already a bugzilla bug for it).
9059 2002-03-12 Miguel de Icaza <miguel@ximian.com>
9061 We could also solve this problem by having a separate path for
9062 performing type lookups, instead of DoResolve, we could have a
9063 ResolveType entry point, and only participating pieces of the
9064 production (simplename, deref, array) would implement this.
9066 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
9067 signal SimpleName to only resolve type names and not attempt to
9068 resolve anything else.
9070 * expression.cs (Cast): Set the flag.
9072 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
9074 * class.cs: Only report 108 if there is no `new' modifier.
9076 * cs-parser.jay: rework foreach statement to work with the new
9077 changes to the policy on SimpleNames.
9079 * report.cs: support Stacktrace on warnings as well.
9081 * makefile: drop --unsafe and /unsafe from the compile.
9083 2002-03-11 Miguel de Icaza <miguel@ximian.com>
9085 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9086 lookups here, instead of doing that at parse time. This means
9087 that our grammar will not introduce `LocalVariableReferences' as
9088 expressions at this point. That solves the problem of code like
9096 This is only half the fix. The full fix requires parameters to
9097 also be handled in this way.
9099 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
9100 makes the use more obvious of the DeclSpace. The
9101 ec.TypeContainer.TypeBuilder is now only used to pull the
9104 My theory is that I can get rid of the TypeBuilder completely from
9105 the EmitContext, and have typecasts where it is used (from
9106 DeclSpace to where it matters).
9108 The only pending problem is that the code that implements Aliases
9109 is on TypeContainer, and probably should go in DeclSpace.
9111 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9112 lookups here, instead of doing that at parse time. This means
9113 that our grammar will not introduce `LocalVariableReferences' as
9114 expressions at this point. That solves the problem of code like
9122 This is only half the fix. The full fix requires parameters to
9123 also be handled in this way.
9125 * class.cs (Property.DefineMethod): When implementing an interface
9126 method, set newslot, when implementing an abstract method, do not
9127 set the flag (before we tried never setting it, or always setting
9128 it, which is the difference).
9129 (Indexer.DefineMethod): same.
9130 (Method.DefineMethod): same.
9132 * ecore.cs: Only set the status used flag if we get back a Field.
9134 * attribute.cs: Temporary hack, so Paolo can keep working.
9136 2002-03-08 Ravi Pratap <ravi@ximian.com>
9138 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
9139 the unmanaged type in the case we have a MarshalAs attribute.
9141 (Resolve): Handle the case when we are parsing the special MarshalAs
9142 attribute [we need to store the unmanaged type to use later]
9144 * typemanager.cs (marshal_as_attr_type): Built in type for the
9145 MarshalAs Attribute.
9147 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
9148 on parameters and accordingly set the marshalling info.
9150 2002-03-09 Miguel de Icaza <miguel@ximian.com>
9152 * class.cs: Optimizing slightly by removing redundant code after
9153 we switched to the `NoTypes' return value.
9154 (Property.DefineMethod): use NoTypes here too.
9156 This fixes the bug I introduced in my last batch of changes.
9158 2002-03-05 Ravi Pratap <ravi@ximian.com>
9160 * tree.cs (RecordEnum): Add. We now keep track of enums too.
9162 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
9163 Enums since those are types too.
9165 * cs-parser.jay (enum_declaration): Record enums as we parse them.
9167 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
9168 thanks to a call during the lookup process.
9170 2002-03-07 Miguel de Icaza <miguel@ximian.com>
9172 * statement.cs (Foreach): Lots of work to accomodate a particular
9173 kind of foreach statement that I had not kept in mind. It is
9174 possible to have foreachs on classes that provide a GetEnumerator
9175 method that return objects that implement the "pattern" for using
9176 a foreach, there is no need to support GetEnumerator
9179 This is needed to compile nant.
9181 * decl.cs: Only report 114 if the member is not `Finalize' and if
9182 the warning level is at least 2.
9184 * class.cs: Moved the compare function from Method to
9187 (MethodSignature.InheritableMemberSignatureCompare): Add new
9188 filter function that is used to extract inheritable methods from a
9191 (Method.Define): Use the new `inheritable_method_signature_filter'
9194 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
9197 2002-03-06 Miguel de Icaza <miguel@ximian.com>
9199 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
9201 * cs-parser.jay: Add opt_semicolon to the interface declaration.
9203 * expression.cs: Pass location information to
9204 ConvertImplicitStandard.
9206 * class.cs: Added debugging code to track return values from
9209 2002-03-05 Miguel de Icaza <miguel@ximian.com>
9211 * expression.cs (Is.DoResolve): If either side of the `is' is an
9212 interface, do not flag the warning.
9214 * ecore.cs (ImplicitReferenceConversion): We need a separate test
9217 * report.cs: Allow for --fatal to be used with --probe.
9219 * typemanager.cs (NoTypes): Move the definition for the empty Type
9222 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
9224 (TypeContainer.DefineProxy): New function used to proxy to parent
9225 implementations when implementing interfaces.
9226 (TypeContainer.ParentImplements): used to lookup if our parent
9227 implements a public function that is required by an interface.
9228 (TypeContainer.VerifyPendingMethods): Hook this up.
9230 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
9231 `modules' and `assemblies' arraylists into arrays. We only grow
9232 these are the very early start up of the program, so this improves
9233 the speedof LookupType (nicely measured).
9235 * expression.cs (MakeByteBlob): Replaced unsafe code with
9236 BitConverter, as suggested by Paolo.
9238 * cfold.cs (ConstantFold.Binary): Special case: perform constant
9239 folding of string concatenation, but if either side is a string,
9240 and the other is not, then return null, and let the runtime use
9241 the concatenation on the string plus the object (using
9244 2002-03-04 Miguel de Icaza <miguel@ximian.com>
9246 Constant Folding has been implemented now.
9248 * expression.cs (Unary.Reduce): Do not throw an exception, catch
9249 the error instead on types that are not supported in one's
9252 * constant.cs (Constant and all children): New set of functions to
9253 perform implict and explicit conversions.
9255 * ecore.cs (EnumConstant): Implement the new functions to perform
9256 conversion by proxying to the child expression.
9258 * codegen.cs: (ConstantCheckState): Constant evaluation has its
9259 own separate setting that can not be turned off from the command
9260 line using --unchecked or --checked and is only controlled using
9261 the checked/unchecked statements and expressions. This setting is
9262 used by the constant folder to flag errors.
9264 * expression.cs (CheckedExpr, UncheckedExpr): Set the
9265 ConstantCheckState as well.
9267 During Resolve, they also have to flag the state, because the
9268 constant folder runs completely in the Resolve phase.
9270 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
9273 2002-03-01 Miguel de Icaza <miguel@ximian.com>
9275 * cfold.cs: New file, this file contains the constant folder.
9277 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
9278 argument to track whether we are using the resulting address to
9279 load or store a value and provide better error messages.
9281 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
9282 new AddressOf arguments.
9284 * statement.cs (Foreach.EmitCollectionForeach): Update
9286 * expression.cs (Argument.Emit): Call AddressOf with proper
9287 arguments to track usage.
9289 (New.DoEmit): Call AddressOf with new arguments.
9291 (Unary.Emit): Adjust AddressOf call.
9293 2002-03-01 Ravi Pratap <ravi@ximian.com>
9295 * cs-parser.jay (member_access): Change the case for pre-defined types
9296 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
9299 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
9302 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
9303 essentially like methods and apply attributes like MethodImplOptions to them too.
9305 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
9308 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
9309 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
9312 * Update code everywhere accordingly.
9314 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
9316 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
9318 2002-02-28 Ravi Pratap <ravi@ximian.com>
9320 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
9321 try performing lookups against those instead of jumping straight into using
9322 the 'using' clauses.
9324 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
9326 (LookupType): Perform lookups in implicit parents too.
9328 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
9329 sequence as RootContext.LookupType.
9331 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
9332 the various cases of namespace lookups into this method.
9334 2002-03-01 Miguel de Icaza <miguel@ximian.com>
9336 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
9337 in positional arguments)
9339 * class.cs (Operator): Update the AllowedModifiers to contain
9342 * cs-parser.jay: Update operator declaration to allow for the
9343 operator body to be empty.
9345 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
9348 2002-02-27 Miguel de Icaza <miguel@ximian.com>
9350 * class.cs (Method.Emit): Label parameters.
9352 * driver.cs: Return 1 or 0 as the program exit code.
9354 2002-02-26 Miguel de Icaza <miguel@ximian.com>
9356 * expression.cs: Special case the `null' object when trying to
9357 auto-compute the type, as anything can be explicitly converted to
9360 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
9361 spotting this Paolo.
9363 (Expression.ImplicitNumericConversion): Perform comparissions of
9364 the type using the underlying type in the case of an enumeration
9365 rather than using the enumeration type for the compare.
9367 Cope with the underlying == type case, which is not possible to
9370 (Expression.ConvertNumericExplicit): Perform comparissions of
9371 the type using the underlying type in the case of an enumeration
9372 rather than using the enumeration type for the compare.
9374 * driver.cs: If the user does not supply an extension, assume .exe
9376 * cs-parser.jay (if_statement): Rewrote so that we can track the
9377 location for the if statement.
9379 * expression.cs (Binary.ConstantFold): Only concat strings when
9380 the operation is "+", not everything ;-)
9382 * statement.cs (Statement.EmitBoolExpression): Take a location
9384 (If, While, Do): Track location.
9386 * expression.cs (Binary.ResolveOperator): In the object + string
9387 case, I was missing a call to ConvertImplicit
9389 2002-02-25 Ravi Pratap <ravi@ximian.com>
9391 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
9392 Location arguments. Ensure we use RootContext.LookupType to do our work
9393 and not try to do a direct Type.GetType and ModuleBuilder.GetType
9395 * interface.cs (PopulateMethod): Handle the type of the parameter being
9398 * expression.cs (Invocation.BetterFunction): Handle the case when we
9399 have a params method with no fixed arguments and a call is made with no
9402 2002-02-25 Miguel de Icaza <miguel@ximian.com>
9404 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
9405 the verbatim-string-literal
9407 * support.cs (InternalParameters.ParameterModifier): handle null
9409 (InternalParameters.ParameterType): ditto.
9411 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
9412 duplicating the name of the variable parameter.
9413 (GetParameterByName): Fix bug where we were not looking up array
9414 paramters if they were the only present (thanks Paolo!).
9415 (GetParameterInfo): We only have an empty set of types if both
9416 fixed and array are set to null.
9417 (GetParameterInfo-idx): Handle FixedParameter == null
9419 * cs-parser.jay: Handle the case where there is no catch
9420 statements (missing null test).
9422 2002-02-22 Miguel de Icaza <miguel@ximian.com>
9424 * driver.cs (MainDriver): Be conservative on our command line
9427 Catch DirectoryNotFoundException when calling GetFiles.
9429 (SplitPathAndPattern): Used to split the input specification into
9430 a path and a pattern that we can feed to Directory.GetFiles.
9432 2002-02-21 Miguel de Icaza <miguel@ximian.com>
9434 * statement.cs (Fixed): Implement the last case of the Fixed
9435 statement (string handling).
9437 * expression.cs (StringPtr): New class used to return a char * to
9438 a string; Used by the Fixed statement.
9440 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
9442 * expression.cs (Binary.ResolveOperator): Remove redundant
9443 MemberLookup pn parent type.
9444 Optimize union call, we do not need a union if the types are the same.
9445 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
9448 Specialize the use of MemberLookup everywhere, instead of using
9449 the default settings.
9451 (StackAlloc): Implement stackalloc keyword.
9453 * cs-parser.jay: Add rule to parse stackalloc.
9455 * driver.cs: Handle /h, /help, /?
9457 * expression.cs (MakeByteBlob): Removed the hacks we had in place
9458 before we supported unsafe code.
9460 * makefile: add --unsafe to the self compilation of mcs.
9462 2002-02-20 Miguel de Icaza <miguel@ximian.com>
9464 * expression.cs (PointerArithmetic): New class that is used to
9465 perform pointer arithmetic.
9466 (Binary.Resolve): Handle pointer arithmetic
9467 Handle pointer comparission.
9468 (ArrayPtr): Utility expression class that is used to take the
9469 address of an array.
9471 (ElementAccess): Implement array access for pointers
9473 * statement.cs (Fixed): Implement fixed statement for arrays, we
9474 are missing one more case before we are done.
9476 * expression.cs (Indirection): Implement EmitAssign and set the
9477 ExprClass to Variable. This allows pointer dereferences to be
9478 treated as variables, and to have values assigned to them.
9480 * ecore.cs (Expression.StoreFromPtr): New utility function to
9481 store values dereferencing.
9483 2002-02-20 Ravi Pratap <ravi@ximian.com>
9485 * expression.cs (Binary.ResolveOperator): Ensure that we are
9486 not trying to operate on a void type - this fixes the reported
9489 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
9490 the parent implementation is sealed.
9492 * ../errors/cs0239.cs : Add.
9494 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
9496 * typemanager.cs (unverifiable_code_type): Corresponds to
9497 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
9498 which have unsafe code in them.
9500 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
9503 2002-02-19 Miguel de Icaza <miguel@ximian.com>
9505 * cs-tokenizer.cs: Add support for @"litreal strings"
9507 Make tokenizer accept pre-processor directives
9508 on any column (remove the old C-like limitation).
9510 * rootcontext.cs (EmitCode): Emit any global attributes.
9511 (AddGlobalAttributes): Used to keep track of assembly attributes.
9513 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
9515 * cs-parser.jay: Add support for global attributes.
9517 2002-02-17 Miguel de Icaza <miguel@ximian.com>
9519 * expression.cs (Indirection): New helper class. Unary will
9520 create Indirection classes to be able to implement the
9521 IMemoryLocation interface on it.
9523 2002-02-16 Miguel de Icaza <miguel@ximian.com>
9525 * cs-parser.jay (fixed_statement): reference the right statement.
9527 * statement.cs (Fixed.Emit): Finish implementing the fixed
9528 statement for the &x case.
9530 2002-02-14 Miguel de Icaza <miguel@ximian.com>
9532 * class.cs (Property.Define, Method.Define): Remove newslot when
9535 * modifiers.cs: My use of NewSlot when `Abstract' was set was
9536 wrong. NewSlot should only be used if the `new' keyword is present.
9538 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
9539 locating our system dir. Sorry about this.
9541 2002-02-13 Miguel de Icaza <miguel@ximian.com>
9543 * driver.cs (GetSystemDir): Compute correctly the location of our
9544 system assemblies. I was using the compiler directory instead of
9545 the library directory.
9547 2002-02-13 Ravi Pratap <ravi@ximian.com>
9549 * expression.cs (BetterFunction): Put back in what Miguel commented out
9550 since it is the correct fix. The problem is elsewhere ;-)
9552 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
9553 parameters of the parms method are themselves compatible or not !
9555 (StandardConversionExists): Fix very dangerous bug where we were forgetting
9556 to check that a class implements an interface before saying that an implicit
9557 conversion was allowed. Use ImplementsInterface to do the checking.
9559 2002-02-13 Miguel de Icaza <miguel@ximian.com>
9561 * class.cs (Method.Define): Track whether we are an explicit
9562 implementation or not. And only call DefineMethodOverride if we
9563 are an explicit implementation.
9565 (Property.DefineMethod): Ditto.
9567 2002-02-11 Ravi Pratap <ravi@ximian.com>
9569 * expression.cs (BetterFunction): Catch hideous bug which was
9570 preventing us from detecting ambiguous calls due to implicit casts i.e
9573 2002-01-29 Miguel de Icaza <miguel@ximian.com>
9575 * support.cs (Pair): Remove un-needed method. I figured why I was
9576 getting the error in cs-parser.jay, the variable in a foreach loop
9577 is readonly, and the compiler does not really treat this as a variable.
9579 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
9580 instead of EQUALS in grammar.
9582 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
9584 * expression.cs (Unary.DoResolve): Check whether the argument is
9587 2002-01-28 Miguel de Icaza <miguel@ximian.com>
9589 * support.cs: Api for Pair to set a value. Despite the fact that
9590 the variables are public the MS C# compiler refuses to compile
9591 code that accesses the field if the variable is part of a foreach
9594 * statement.cs (Fixed): Begin implementation of the fixed
9597 (Block.AddVariable): Return the VariableInfo on success and null
9598 on failure instead of true/false.
9600 * cs-parser.jay (foreach): Catch errors on variables already
9601 defined (we were ignoring this value before) and properly unwind
9604 (fixed_statement): grammar for the fixed statement.
9606 2002-01-25 Miguel de Icaza <miguel@ximian.com>
9608 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
9609 pointer types to be incretemented.
9611 (SizeOf): Implement.
9613 * cs-parser.jay (pointer_member_access): Implement
9614 expr->IDENTIFIER production.
9616 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
9617 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
9620 (Unary): Implement indirection.
9622 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
9623 use in non-unsafe context).
9625 (SimpleName.DoResolve): Check for pointers in field access on safe
9628 (Expression.LoadFromPtr): Factor the load-indirect code in this
9629 function. This was duplicated in UnboxCast and ParameterReference
9631 2002-01-24 Miguel de Icaza <miguel@ximian.com>
9633 * expression.cs (ComposedCast): report an error if a pointer cast
9634 is used in a safe region.
9636 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
9637 pointer type casts in unsafe context.
9639 * codegen.cs (EmitContext): Set up IsUnsafe.
9641 * cs-parser.jay (non_expression_type): Add productions for pointer
9644 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
9645 code. We should not use force into static mode if the method is
9646 not virtual. Fixes bug in MIS
9648 * statement.cs (Do.Emit, While.Emit, For.Emit,
9649 Statement.EmitBoolExpression): Add support to Do and While to
9650 propagate infinite loop as `I do return' semantics.
9652 Improve the For case to also test for boolean constants.
9654 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
9655 to the list of attributes we can add.
9657 Remove `EmitContext' argument.
9659 * class.cs (Method.Define): Apply parameter attributes.
9660 (Constructor.Define): Apply parameter attributes.
9661 (MethodCore.LabelParameters): Move here the core of labeling
9664 * support.cs (ReflectionParameters.ParameterModifier,
9665 InternalParameters.ParameterModifier): Use IsByRef on the type and
9666 only return the OUT bit for these parameters instead of in/out/ref
9669 This is because I miss-understood things. The ParameterInfo.IsIn
9670 and IsOut represent whether the parameter has the [In] and [Out]
9673 2002-01-22 Miguel de Icaza <miguel@ximian.com>
9675 * ecore.cs (FieldExpr.Emit): Release temporaries.
9677 * assign.cs (LocalTemporary.Release): new function.
9679 * codegen.cs (EmitContext.GetTemporaryStorage,
9680 EmitContext.FreeTemporaryStorage): Rework the way we deal with
9681 temporary storage. Now we can "put back" localbuilders when we
9684 2002-01-21 Miguel de Icaza <miguel@ximian.com>
9686 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
9687 need to make a copy of the variable to generate verifiable code.
9689 2002-01-19 Miguel de Icaza <miguel@ximian.com>
9691 * driver.cs: Compute dynamically the system directory.
9693 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
9694 Slower, but more generally useful. Used by the abstract
9695 registering implementation.
9697 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
9698 the rules for the special rule on Type/instances. First check if
9699 we have the same name, and if so, try that special static path
9700 rather than the instance path.
9702 2002-01-18 Miguel de Icaza <miguel@ximian.com>
9704 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
9707 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
9708 Enum, ValueType, Delegate or Array for non-corlib compiles.
9710 * cs-tokenizer.cs: Catch long identifiers (645)
9712 * typemanager.cs (IndexerPropetyName): Ravi never tested this
9715 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
9716 fix, we were returning too early, so we were not registering
9717 pending methods from abstract classes.
9719 Do not register pending methods if the class is abstract.
9721 * expression.cs (Conditional.DoResolve): Report circular implicit
9722 conversions when we neecd to compute it for conditional
9725 (Is.DoResolve): If the expression is always of the provided type,
9726 flag warning 183. If the expression can not ever be of the
9727 provided type flag warning 184.
9729 * class.cs: Catch 169 as well.
9731 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
9734 2002-01-18 Nick Drochak <ndrochak@gol.com>
9736 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
9738 2002-01-17 Miguel de Icaza <miguel@ximian.com>
9740 * interface.cs: (PopulateMethod): Check for pointers being defined
9741 only if the unsafe context is active.
9742 (PopulateProperty): ditto.
9743 (PopulateIndexer): ditto.
9745 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
9746 specified. If pointers are present, make sure that they are
9747 present in an unsafe context.
9748 (Constructor, Constructor.Define): ditto.
9749 (Field, Field.Define): ditto.
9750 (Property, Property.Define): ditto.
9751 (Event, Event.Define): ditto.
9753 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
9754 hashtable if there are classes or structs defined.
9756 * expression.cs (LocalVariableReference.DoResolve): Simplify this
9757 code, as the constant resolution moved.
9759 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
9760 the metadata, so we can flag error 133.
9762 * decl.cs (MemberCore.UnsafeOK): New function to test that a
9763 pointer is being declared in an unsafe context.
9765 2002-01-16 Miguel de Icaza <miguel@ximian.com>
9767 * modifiers.cs (Modifiers.Check): Require a Location argument.
9768 Report error 227 for Unsafe use.
9770 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
9772 * statement.cs (For.Emit): If the test is null, then report that
9773 we do `return', as we wont reach anything afterwards.
9775 (Switch.SwitchGoverningType): Track the expression that matched
9778 * driver.cs: Allow negative numbers as an error code to flag.
9780 * cs-parser.jay: Handle 1551.
9782 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
9784 2002-01-15 Miguel de Icaza <miguel@ximian.com>
9786 * cs-parser.jay: Report 1518 (type declaration can only contain
9787 class, struct, interface, enum or delegate)
9789 (switch_label): Report 1523 (keywords `case' or `default' must
9792 (opt_switch_sections): Report 1522 (empty switch)
9794 * driver.cs: Report 1515 (response file specified multiple times)
9795 Report 1516 (Source file specified multiple times).
9797 * expression.cs (Argument.Resolve): Signal 1510
9799 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
9800 access not allowed in static code)
9802 2002-01-11 Ravi Pratap <ravi@ximian.com>
9804 * typemanager.cs (IsPointerType): Utility method which we are going
9807 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
9808 the object type, so we take care of that.
9810 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
9812 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
9813 added to non-params parameters :-)
9815 * typemanager.cs (CSharpName): Include 'void' type too.
9817 (void_ptr_type): Include in the set of core types.
9819 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
9822 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
9825 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
9826 completely forgotten about it.
9828 2002-01-10 Ravi Pratap <ravi@ximian.com>
9830 * cs-parser.jay (pointer_type): Add. This begins our implementation
9831 of parsing rules for unsafe code.
9833 (unsafe_statement): Implement.
9835 (embedded_statement): Modify to include the above.
9837 * statement.cs (Unsafe): Implement new class for unsafe blocks.
9839 * codegen.cs (EmitContext.InUnsafe): Add. This determines
9840 if the current context is an unsafe one.
9842 * cs-parser.jay (local_variable_pointer_type): Since local variable types
9843 are handled differently, we need separate rules for them.
9845 (local_variable_declaration): Update to use local_variable_pointer_type
9846 to allow variable declarations of unmanaged pointer types.
9848 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
9851 * ../errors/cs0214.cs : Add.
9853 2002-01-16 Nick Drochak <ndrochak@gol.com>
9855 * makefile: remove 'response' file when cleaning.
9857 2002-01-15 Miguel de Icaza <miguel@ximian.com>
9859 * cs-parser.jay: Report 1524.
9861 2002-01-14 Miguel de Icaza <miguel@ximian.com>
9863 * typemanager.cs (RegisterMethod): drop checking if we have
9864 registered this from here
9866 2002-01-12 Miguel de Icaza <miguel@ximian.com>
9868 * class.cs (Method.EmitDestructor): Implement calling our base
9871 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
9874 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
9875 this routine and will wrap the call in a try/catch block. Deal
9878 2002-01-11 Miguel de Icaza <miguel@ximian.com>
9880 * ecore.cs (Expression.MemberLookup): instead of taking a
9881 parameter `same_type' that was used to tell whether we could
9882 access private members we compute our containing type from the
9885 (FieldExpr): Added partial support for volatile fields. This does
9886 not work for volatile fields exposed from assemblies, as I can not
9887 figure out how to extract the modreq from it.
9889 Updated all the source files to use this.
9891 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
9892 because it is referenced by MemberLookup very often.
9894 2002-01-09 Ravi Pratap <ravi@ximian.com>
9896 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
9897 TypeBuilder.GetCustomAttributes to retrieve what we need.
9899 Get rid of redundant default_member_attr_type as this is the same as
9900 default_member_type which already exists.
9902 * interface.cs, attribute.cs : Update accordingly.
9904 2002-01-08 Miguel de Icaza <miguel@ximian.com>
9906 * typemanager.cs: Enable IndexerPropertyName again. It does not
9907 work for TYpeBuilders though. Ravi, can you please fix this?
9909 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
9911 * expression.cs (Argument.Emit): Handle the case of ref objects
9912 being passed to ref functions;
9914 (ParameterReference.EmitLoad): Loads the content of the pointer
9915 without dereferencing.
9917 2002-01-07 Miguel de Icaza <miguel@ximian.com>
9919 * cs-tokenizer.cs: Implemented the pre-processing expressions.
9921 2002-01-08 Ravi Pratap <ravi@ximian.com>
9923 * class.cs (Indexer.DefineMethod): Incorporate the interface
9924 type in the name of the method if we are doing explicit interface
9927 * expression.cs (ConversionExists): Remove as it is completely obsolete.
9929 (BetterConversion): Fix extremely trivial bug where we were referring to
9930 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
9933 * ../errors/bug16.cs : Add although we have fixed it.
9935 2002-01-07 Miguel de Icaza <miguel@ximian.com>
9937 * expression.cs (BaseIndexer): Begin implementation.
9939 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
9941 * cs-parser.jay (indexer_declarator): Use qualified_identifier
9942 production directly to remove a shift/reduce, and implement
9943 explicit interface implementation.
9945 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
9946 after a floating point suffix.
9948 * expression.cs (DoNumericPromotions): Improved the conversion for
9949 uint/uint. If we have a constant, we avoid doing a typecast to a
9952 * class.cs (Indexer): Implement explicit interface implementation
9955 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
9957 * class.cs: make the default instance constructor public and hidebysig.
9959 2001-01-03 Ravi Pratap <ravi@ximian.com>
9961 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
9962 so we can call it from elsewhere.
9964 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
9965 we emit it internally if the class has a defined indexer; otherwise the user
9966 emits it by decorating the class definition with the DefaultMemberAttribute.
9968 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
9969 attribute is not used on a type which defines an indexer.
9971 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
9972 character when we skip whitespace.
9974 * ../errors/cs0646.cs : Add.
9976 2002-01-03 Miguel de Icaza <miguel@ximian.com>
9978 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
9981 * makefile: Add practical target `mcs3.exe' which builds the third
9982 generation compiler.
9984 * expression.cs (New): Fix structures constructor calling.
9986 * class.cs (Property, Method, Indexer): Emit Final flag on the
9987 method if we are an interface implementation and we are not
9990 * ecore.cs (PropertyExpr): New public field `IsBase', tells
9991 whether this property is referencing a `base' method.
9993 * expression.cs (Invocation.EmitCall): take an extra argument:
9994 is_base, this is used to determine whether the `call' or
9995 `callvirt' opcode should be used.
9998 * delegate.cs: update EmitCall.
10000 * class.cs (Method.Define): Set NewSlot for the cases where we are
10001 not implementing an interface method.
10003 (Property.Define): ditto.
10005 2002-01-02 Miguel de Icaza <miguel@ximian.com>
10007 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
10008 'r'. Allows mcs to parse itself fully.
10010 2002-01-02 Ravi Pratap <ravi@ximian.com>
10012 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
10013 of the number of initializers that require the InitializeArray method.
10015 (CheckIndices): Store the Expression in all cases - not the plain value. Also
10016 update the above field where necessary.
10018 (MakeByteBlob): Update accordingly.
10020 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
10023 (EmitDynamicInitializers): Update in accordance with the new optimization.
10025 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
10026 same OpCode applies.
10028 * cs-parser.jay : Fix some glaring errors I introduced.
10030 2002-01-01 Ravi Pratap <ravi@ximian.com>
10032 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
10033 so that we can check for name clashes there too.
10035 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
10036 for interface indexers.
10038 * interfaces.cs (Define): Emit the default member attribute.
10040 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
10041 variable was being referred to while setting the value ;-)
10043 2002-01-01 Miguel de Icaza <miguel@ximian.com>
10045 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
10046 byte-by-byte information when we know the data is zero.
10048 Make the block always a multiple of 4, because
10049 DefineInitializedData has a bug.
10051 * assign.cs: Fix, we should assign from the temporary, not from
10054 * expression.cs (MakeByteBlob): Fix my incorrect code.
10056 2001-12-31 Miguel de Icaza <miguel@ximian.com>
10058 * typemanager.cs (EnumToUnderlying): This function is used to get
10059 the underlying type from an enumeration, because it does not
10062 * constant.cs: Use the I4_S form for values between -128 and 127.
10064 * statement.cs (Block.LookupLabel): Looks up a label.
10065 (Block): Drop support for labeled blocks.
10067 (LabeledStatement): New kind of statement that represents a label
10070 (Goto): Finally implement this bad boy.
10072 * cs-parser.jay: Update to reflect new mechanism to implement
10075 2001-12-30 Miguel de Icaza <miguel@ximian.com>
10077 * codegen.cs (EmitContext.This): a codegen property that keeps the
10078 a single instance of this instead of creating many different this
10081 * delegate.cs (Delegate.DoResolve): Update to use the property;
10083 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
10085 * expression.cs (BaseAccess.DoResolve): Ditto.
10087 2001-12-29 Ravi Pratap <ravi@ximian.com>
10089 * typemanager.cs (methodimpl_attr_type): Add to hold the type
10090 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
10092 (InitCoreTypes): Update accordingly.
10094 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
10095 so we can quickly store the state.
10097 (ApplyAttributes): Set the correct implementation flags
10098 for InternalCall methods.
10100 2001-12-29 Miguel de Icaza <miguel@ximian.com>
10102 * expression.cs (EmitCall): if a method is not virtual, then do
10103 not use callvirt on it.
10105 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
10106 user defined stuff) requires the use of stobj, which takes an
10107 address on the stack instead of an array and an index. So emit
10108 the Ldelema operation for it.
10110 (EmitStoreOpcode): Use stobj for valuetypes.
10112 (UnaryMutator.EmitCode): Use the right 1 value depending on
10113 whether we are dealing with int64/uint64, float or doubles.
10115 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
10116 constructors that I implemented last night.
10118 (Constructor.IsDefault): Fix to work properly for static
10121 * cs-parser.jay (CheckDef): report method signature errors.
10122 Update error number 103 to be 132.
10124 * decl.cs: New AdditionResult enumeration value: MethodExists.
10125 Although we do this check for methods later on in the semantic
10126 analysis, catching repeated default constructors is so easy that
10127 we catch these here.
10129 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
10132 (ParameterReference.EmitAssign, Emit): handle
10135 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
10136 (ArrayAccess.EmitStoreOpcode): ditto.
10138 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
10140 * expression.cs (MakeByteBlob): Complete all the missing types
10141 (uint, short, ushort, byte, sbyte)
10143 * class.cs: Only init instance field initializers on instance
10146 Rename `constructors' to instance_constructors.
10148 (TypeContainer.AddConstructor): Only add constructors to the list
10149 if it is not static.
10151 Make sure that we handle default_static_constructor independently
10152 everywhere where we handle instance_constructors
10154 2001-12-28 Miguel de Icaza <miguel@ximian.com>
10156 * class.cs: Do not lookup or create a base initializer for a
10157 static constructor.
10159 (ConstructorInitializer.Resolve): use the proper type to lookup
10162 * cs-parser.jay: Report error 1585 (modifiers between type and name).
10164 * enum.cs, interface.cs: Remove CloseType, this is taken care by
10167 * decl.cs: CloseType is now an virtual method, the default
10168 implementation just closes this type.
10170 2001-12-28 Ravi Pratap <ravi@ximian.com>
10172 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
10173 to PreserveSig by default. Also emit HideBySig on such methods.
10175 Basically, set the defaults to standard values.
10177 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
10178 argument, if candidate is better, it can't be worse than the best !
10180 (Invocation): Re-write bits to differentiate between methods being
10181 applicable in their expanded form and their normal form - for params
10184 Get rid of use_standard everywhere as only standard conversions are allowed
10185 in overload resolution.
10187 More spec conformance.
10189 2001-12-27 Miguel de Icaza <miguel@ximian.com>
10191 * driver.cs: Add --timestamp, to see where the compiler spends
10194 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
10195 `this' in static code.
10197 (SimpleName.DoResolve): Implement in terms of a helper function
10198 that allows static-references to be passed upstream to
10201 (Expression.ResolveWithSimpleName): Resolve specially simple
10202 names when called by MemberAccess to implement the special
10205 (Expression.ImplicitReferenceConversion): Handle conversions from
10206 Null to reference types before others, as Null's type is
10209 * expression.cs (Invocation.EmitCall): Handle the special case of
10210 calling methods declared on a reference type from a ValueType
10211 (Base classes System.Object and System.Enum)
10213 (MemberAccess.Resolve): Only perform lookups on Enumerations if
10214 the left hand side is a TypeExpr, not on every enumeration.
10216 (Binary.Resolve): If types are reference types, then do a cast to
10217 object on operators != and == of both arguments.
10219 * typemanager.cs (FindMembers): Extract instance and static
10220 members if requested.
10222 * interface.cs (PopulateProperty): Use void_type instead of null
10223 as the return type for the setter method.
10225 (PopulateIndexer): ditto.
10227 2001-12-27 Ravi Pratap <ravi@ximian.com>
10229 * support.cs (ReflectionParameters): Fix minor bug where we
10230 were examining the wrong parameter for the ParamArray attribute.
10232 Cope with requests for the type of the parameter at position
10233 greater than the params parameter's. We now return the element
10234 type of the params array as that makes more sense.
10236 * expression.cs (Invocation.IsParamsMethodApplicable): Update
10237 accordingly as we no longer have to extract the element type
10240 (Invocation.OverloadResolve): Update.
10242 2001-12-27 Miguel de Icaza <miguel@ximian.com>
10244 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
10245 against IEnumerator, test whether the return value is a descendant
10246 of the IEnumerator interface.
10248 * class.cs (Indexer.Define): Use an auxiliary method to implement
10249 the other bits of the method definition. Begin support for
10250 explicit interface implementation.
10252 (Property.DefineMethod): Use TypeManager.void_type instead of null
10253 for an empty return value.
10255 2001-12-26 Miguel de Icaza <miguel@ximian.com>
10257 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
10258 dealing with a FieldExpr which is composed of a FieldBuilder, in
10259 the code path we did extract the constant, but we should have
10260 obtained the underlying value to be able to cast it (otherwise we
10261 end up in an infinite loop, this is what Ravi was running into).
10263 (ArrayCreation.UpdateIndices): Arrays might be empty.
10265 (MemberAccess.ResolveMemberAccess): Add support for section
10266 14.5.4.1 that deals with the special case of E.I when E is a type
10267 and something else, that I can be a reference to a static member.
10269 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
10270 handle a particular array type to create byte blobs, it is just
10271 something we dont generate byteblobs for.
10273 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
10276 * location.cs (Push): remove the key from the hashtable that we
10277 are about to add. This happens for empty files.
10279 * driver.cs: Dispose files after we have parsed them.
10281 (tokenize): new function that only runs the tokenizer on its
10282 input, for speed testing.
10284 2001-12-26 Ravi Pratap <ravi@ximian.com>
10286 * class.cs (Event.Define): Define the private field only if there
10287 are no accessors defined.
10289 * expression.cs (ResolveMemberAccess): If there is no associated
10290 field with the event, that means we have an event defined with its
10291 own accessors and we should flag error cs0070 since transforming
10292 ourselves into a field is not valid in that case.
10294 * ecore.cs (SimpleName.DoResolve): Same as above.
10296 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
10297 and charset to sane values.
10299 2001-12-25 Ravi Pratap <ravi@ximian.com>
10301 * assign.cs (DoResolve): Perform check on events only if they
10302 are being accessed outside the declaring type.
10304 * cs-parser.jay (event_declarations): Update rules to correctly
10305 set the type of the implicit parameter etc.
10307 (add_accessor, remove_accessor): Set current local parameters.
10309 * expression.cs (Binary): For delegate addition and subtraction,
10310 cast the return value from the method into the appropriate delegate
10313 2001-12-24 Ravi Pratap <ravi@ximian.com>
10315 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
10316 of these as the workaround is unnecessary.
10318 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
10319 delegate data - none of that is needed at all.
10321 Re-write bits to extract the instance expression and the delegate method
10324 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
10327 * attribute.cs (ApplyAttributes): New method to take care of common tasks
10328 of attaching attributes instead of duplicating code everywhere.
10330 * everywhere : Update code to do attribute emission using the above method.
10332 2001-12-23 Miguel de Icaza <miguel@ximian.com>
10334 * expression.cs (IsParamsMethodApplicable): if there are not
10335 parameters, return immediately.
10337 * ecore.cs: The 0 literal can be implicity converted to an enum
10340 (SimpleName.DoResolve): First lookup the type, then lookup the
10343 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
10344 want to get its address. If the InstanceExpression is not
10345 addressable, store the result in a temporary variable, then get
10348 * codegen.cs: Only display 219 errors on warning level or above.
10350 * expression.cs (ArrayAccess): Make it implement the
10351 IMemoryLocation interface.
10353 (Binary.DoResolve): handle the operator == (object a, object b)
10354 and operator != (object a, object b) without incurring into a
10355 BoxedCast (because 5 != o should never be performed).
10357 Handle binary enumerator operators.
10359 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
10360 value type, otherwise use Ldelem_ref.
10362 Use precomputed names;
10364 (AddressOf): Implement address of
10366 * cs-parser.jay (labeled_statement): Fix recursive block
10367 addition by reworking the production.
10369 * expression.cs (New.DoEmit): New has a special case:
10371 If we are dealing with a ValueType, we have a few
10372 situations to deal with:
10374 * The target of New is a ValueType variable, that is
10375 easy, we just pass this as the variable reference
10377 * The target of New is being passed as an argument,
10378 to a boxing operation or a function that takes a
10381 In this case, we need to create a temporary variable
10382 that is the argument of New.
10385 2001-12-23 Ravi Pratap <ravi@ximian.com>
10387 * rootcontext.cs (LookupType): Check that current_type is not null before
10388 going about looking at nested types.
10390 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
10391 not implement the IAssignMethod interface any more.
10393 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
10394 where we tranform them into FieldExprs if they are being resolved from within
10395 the declaring type.
10397 * ecore.cs (SimpleName.DoResolve): Do the same here.
10399 * assign.cs (DoResolve, Emit): Clean up code considerably.
10401 * ../errors/bug10.cs : Add.
10403 * ../errors/cs0070.cs : Add.
10405 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
10407 * assign.cs : Get rid of EventIsLocal everywhere.
10409 2001-12-23 Miguel de Icaza <miguel@ximian.com>
10411 * ecore.cs (ConvertIntLiteral): finished the implementation.
10413 * statement.cs (SwitchLabel): Convert the value we are using as a
10414 key before looking up the table.
10416 2001-12-22 Miguel de Icaza <miguel@ximian.com>
10418 * codegen.cs (EmitTopBlock): Require a Location argument now.
10420 * cs-parser.jay (constructor_declarator): We need to setup
10421 current_local_parameters before we parse the
10422 opt_constructor_initializer, to allow the variables to be bound
10423 to the constructor arguments.
10425 * rootcontext.cs (LookupType): First lookup nested classes in our
10426 class and our parents before we go looking outside our class.
10428 * expression.cs (ConstantFold): Extract/debox the values at the
10431 * rootcontext.cs (EmitCode): Resolve the constants first before we
10432 resolve the types. This is not really needed, but it helps debugging.
10434 * statement.cs: report location.
10436 * cs-parser.jay: pass location to throw statement.
10438 * driver.cs: Small bug fix.
10440 * report.cs: Updated format to be 4-zero filled digits.
10442 2001-12-22 Ravi Pratap <ravi@ximian.com>
10444 * expression.cs (CheckIndices): Fix minor bug where the wrong
10445 variable was being referred to ;-)
10447 (DoEmit): Do not call EmitStaticInitializers when the
10448 underlying type is System.Object.
10450 2001-12-21 Ravi Pratap <ravi@ximian.com>
10452 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
10453 and do the usual workaround for SRE.
10455 * class.cs (MyEventBuilder.EventType): New member to get at the type
10456 of the event, quickly.
10458 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
10460 * assign.cs (Assign.DoResolve): Handle the case when the target
10461 is an EventExpr and perform the necessary checks.
10463 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
10466 (SimpleName.MemberStaticCheck): Include check for EventExpr.
10468 (EventExpr): Set the type in the constructor itself since we
10469 are meant to be born fully resolved.
10471 (EventExpr.Define): Revert code I wrote earlier.
10473 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
10474 instance expression is null. The instance expression is a This in that case
10475 or a null, depending on whether it is a static method or not.
10477 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
10478 refers to more than one method.
10480 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
10481 and accordingly flag errors.
10483 2001-12-21 Miguel de Icaza <miguel@ximian.com>
10485 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
10487 2001-12-22 Miguel de Icaza <miguel@ximian.com>
10489 * location.cs (ToString): Provide useful rutine.
10491 2001-12-21 Miguel de Icaza <miguel@ximian.com>
10493 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
10494 objects, return the actual integral boxed.
10496 * statement.cs (SwitchLabel): define an ILLabel for each
10499 (Switch.CheckSwitch): If the value is a Literal, extract
10500 the underlying literal.
10502 Also in the unused hashtable we had, add the SwitchLabel so we can
10503 quickly look this value up.
10505 * constant.cs: Implement a bunch of new constants. Rewrite
10506 Literal based on this. Made changes everywhere to adapt to this.
10508 * expression.cs (Expression.MakeByteBlob): Optimize routine by
10509 dereferencing array only once, and also copes with enumrations.
10511 bytes are two bytes wide, not one.
10513 (Cast): Perform constant conversions.
10515 * ecore.cs (TryImplicitIntConversion): Return literals instead of
10516 wrappers to the literals here.
10518 * expression.cs (DoNumericPromotions): long literals can converted
10519 to ulong implicity (this is taken care of elsewhere, but I was
10520 missing this spot).
10522 * ecore.cs (Expression.Literalize): Make the return type Literal,
10523 to improve type checking.
10525 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
10527 2001-12-20 Miguel de Icaza <miguel@ximian.com>
10529 * literal.cs: Revert code from ravi that checked the bounds. The
10530 bounds are sane by the definition of the type itself.
10532 * typemanager.cs: Fix implementation of ImplementsInterface. We
10533 need to actually look up in our parent hierarchy for interfaces
10536 * const.cs: Use the underlying type for enumerations
10538 * delegate.cs: Compute the basename for the delegate creation,
10539 that should fix the delegate test case, and restore the correct
10540 Type Lookup semantics in rootcontext
10542 * rootcontext.cs: Revert Ravi's last patch. The correct way of
10543 referencing a nested type with the Reflection API is using the "+"
10546 * cs-parser.jay: Do not require EOF token at the end.
10548 2001-12-20 Ravi Pratap <ravi@ximian.com>
10550 * rootcontext.cs (LookupType): Concatenate type names with
10551 a '.' instead of a '+' The test suite passes again.
10553 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
10554 field of the enumeration.
10556 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
10557 the case when the member is an EventExpr.
10559 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
10560 static has an associated instance expression.
10562 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
10564 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
10566 * class.cs (Event.Define): Register event and perform appropriate checks
10569 We define the Add and Remove methods even if the use provides none because
10570 in that case, we provide default implementations ourselves.
10572 Define a private field of the type of the event. This is done by the CSC compiler
10573 and we should be doing it too ;-)
10575 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
10576 More methods we use in code we generate.
10578 (multicast_delegate_type, delegate_type): Two separate types since the distinction
10581 (InitCoreTypes): Update accordingly for the above.
10583 * class.cs (Event.Emit): Generate code for default accessors that we provide
10585 (EmitDefaultMethod): Do the job in the above.
10587 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
10590 2001-12-20 Miguel de Icaza <miguel@ximian.com>
10592 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
10593 builders even if we were missing one.
10595 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
10596 pass the Basename as our class name instead of the Name. The
10597 basename will be correctly composed for us.
10599 * parameter.cs (Paramters): Now takes a Location argument.
10601 * decl.cs (DeclSpace.LookupType): Removed convenience function and
10602 make all the code call directly LookupType in RootContext and take
10603 this chance to pass the Location information everywhere.
10605 * Everywhere: pass Location information.
10607 2001-12-19 Miguel de Icaza <miguel@ximian.com>
10609 * class.cs (Constructor.Define): Updated way of detecting the
10610 length of the parameters.
10612 (TypeContainer.DefineType): Use basename as the type name for
10615 (TypeContainer.Define): Do not recursively define types here, as
10616 definition is taken care in order by the RootContext.
10618 * tree.cs: Keep track of namespaces in a per-file basis.
10620 * parameter.cs (Parameter.ComputeSignature): Update to use
10623 (Parameters.GetSignature): ditto.
10625 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
10626 instead of a TypeContainer.
10628 (Interface.SemanticAnalysis): Use `this' instead of our parent to
10629 resolve names. Because we need to be resolve in our context, not
10632 * driver.cs: Implement response files.
10634 * class.cs (TypeContainer.DefineType): If we are defined, do not
10635 redefine ourselves.
10637 (Event.Emit): Emit the code for add/remove handlers.
10638 (Event.Define): Save the MethodBuilders for add/remove.
10640 * typemanager.cs: Use pair here too.
10642 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
10643 DictionaryEntry requires the first argument to be non-null.
10645 (enum_declaration): Compute full name for registering the
10648 (delegate_declaration): Instead of using
10649 formal_parameter_list, use opt_formal_parameter_list as the list
10652 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
10653 (EventParsing): New property that controls whether `add' and
10654 `remove' are returned as tokens or identifiers (for events);
10656 2001-12-19 Ravi Pratap <ravi@ximian.com>
10658 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
10659 use MyEventBuilder only and let it wrap the real builder for us.
10661 (MyEventBuilder): Revamp constructor etc.
10663 Implement all operations that we perform on EventBuilder in precisely the same
10666 (FindMembers): Update to use the EventBuilder member.
10668 (Event.Emit): Update accordingly.
10670 2001-12-18 Ravi Pratap <ravi@ximian.com>
10672 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
10673 by calling the appropriate methods.
10675 (GetCustomAttributes): Make stubs as they cannot possibly do anything
10678 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
10680 2001-12-17 Ravi Pratap <ravi@ximian.com>
10682 * delegate.cs (Delegate.Populate): Check that the return type
10683 and various parameters types are indeed accessible.
10685 * class.cs (Constructor.Define): Same here.
10687 (Field.Define): Ditto.
10689 (Event.Define): Ditto.
10691 (Operator.Define): Check that the underlying Method defined itself
10692 correctly - so it's MethodBuilder should not be null.
10694 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
10695 expression happens to be null.
10697 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
10698 members but as of now we don't seem to be able to do anything really useful with it.
10700 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
10701 not the EventBuilder.
10703 2001-12-18 Miguel de Icaza <miguel@ximian.com>
10705 * cs-tokenizer.cs: Add support for defines.
10706 Add support for #if, #elif, #else, #endif
10708 (eval_var): evaluates a variable.
10709 (eval): stubbed for evaluating functions.
10711 * cs-parser.jay: Pass the defines information
10713 * driver.cs: Add --define command line option.
10715 * decl.cs: Move MemberCore here.
10717 Make it the base class for DeclSpace. This allows us to catch and
10718 report 108 and 109 for everything now.
10720 * class.cs (TypeContainer.Define): Extract all the members
10721 before populating and emit the warning 108 (new keyword required
10722 to override) instead of having each member implement this.
10724 (MemberCore.Define): New abstract method, we will be using this in
10725 the warning reporting engine in Populate.
10727 (Operator.Define): Adjust to new MemberCore protocol.
10729 * const.cs (Const): This does not derive from Expression, it is a
10730 temporary object we use to create fields, it is a MemberCore.
10732 * class.cs (Method.Define): Allow the entry point to be in a
10735 * driver.cs: Rewrite the argument handler to clean it up a bit.
10737 * rootcontext.cs: Made it just an auxiliary namespace feature by
10738 making everything static.
10740 * driver.cs: Adapt code to use RootContext type name instead of
10743 * delegate.cs: Remove RootContext argument.
10745 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
10748 * class.cs (Event.Define): The lookup can fail.
10750 * cs-tokenizer.cs: Begin implementation of pre-procesor.
10752 * expression.cs: Resolve the this instance before invoking the code.
10754 2001-12-17 Miguel de Icaza <miguel@ximian.com>
10756 * cs-parser.jay: Add a production in element_access that allows
10757 the thing to become a "type" reference. This way we can parse
10758 things like "(string [])" as a type.
10760 Note that this still does not handle the more complex rules of
10764 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
10766 * ecore.cs: (CopyNewMethods): new utility function used to
10767 assemble the list of methods from running FindMembers.
10769 (MemberLookup): Rework FindMembers so that
10771 2001-12-16 Miguel de Icaza <miguel@ximian.com>
10773 * class.cs (TypeContainer): Remove Delegates who fail to be
10776 * delegate.cs (Populate): Verify that we dont get null return
10777 values. TODO: Check for AsAccessible.
10779 * cs-parser.jay: Use basename to emit error 574 (destructor should
10780 have the same name as container class), not the full name.
10782 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
10783 possible representation.
10785 Also implements integer type suffixes U and L.
10787 2001-12-15 Miguel de Icaza <miguel@ximian.com>
10789 * expression.cs (ArrayCreation.DoResolve): We need to do the
10790 argument resolution *always*.
10792 * decl.cs: Make this hold the namespace. Hold the root context as
10794 (LookupType): Move here.
10796 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
10798 * location.cs (Row, Name): Fixed the code, it was always returning
10799 references to the first file.
10801 * interface.cs: Register properties defined through interfaces.
10803 * driver.cs: Add support for globbing on the command line
10805 * class.cs (Field): Make it derive from MemberCore as well.
10808 2001-12-15 Ravi Pratap <ravi@ximian.com>
10810 * class.cs (Event::Define): Check that the type of the event is a delegate
10811 type else flag error #66.
10813 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
10816 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
10817 values of EntryPoint, CharSet etc etc.
10819 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
10821 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
10822 be null and we should ignore this. I am not sure if this is really clean. Apparently,
10823 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
10824 which needs this to do its work.
10826 * ../errors/cs0066.cs : Add.
10828 2001-12-14 Miguel de Icaza <miguel@ximian.com>
10830 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
10833 * class.cs: (MethodSignature.MethodSignature): Removed hack that
10834 clears out the parameters field.
10835 (MemberSignatureCompare): Cleanup
10837 (MemberCore): New base class used to share code between MethodCore
10840 (RegisterRequiredImplementations) BindingFlags.Public requires
10841 either BindingFlags.Instace or Static. Use instance here.
10843 (Property): Refactored code to cope better with the full spec.
10845 * parameter.cs (GetParameterInfo): Return an empty array instead
10848 * class.cs (Property): Abstract or extern properties have no bodies.
10850 * parameter.cs (GetParameterInfo): return a zero-sized array.
10852 * class.cs (TypeContainer.MethodModifiersValid): Move all the
10853 method modifier validation to the typecontainer so we can reuse
10854 this on properties.
10856 (MethodCore.ParameterTypes): return an empty sized array of types.
10858 (Property.Define): Test property modifier validity.
10860 Add tests for sealed/override too.
10862 (Method.Emit): abstract or extern methods have no bodies.
10864 2001-12-14 Ravi Pratap <ravi@ximian.com>
10866 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
10869 (Method::Define, ::Emit): Modify accordingly.
10871 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
10873 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
10875 * makefile: Pass in /unsafe.
10877 2001-12-13 Miguel de Icaza <miguel@ximian.com>
10879 * class.cs (MakeKey): Kill routine.
10881 * class.cs (TypeContainer.Define): Correctly define explicit
10882 method implementations (they require the full interface name plus
10885 * typemanager.cs: Deply the PtrHashtable here and stop using the
10886 lame keys. Things work so much better.
10888 This of course broke everyone who depended on `RegisterMethod' to
10889 do the `test for existance' test. This has to be done elsewhere.
10891 * support.cs (PtrHashtable): A hashtable that avoid comparing with
10892 the object stupid Equals method (because, that like fails all over
10893 the place). We still do not use it.
10895 * class.cs (TypeContainer.SetRequiredInterface,
10896 TypeContainer.RequireMethods): Killed these two routines and moved
10897 all the functionality to RegisterRequiredImplementations.
10899 (TypeContainer.RegisterRequiredImplementations): This routine now
10900 registers all the implementations required in an array for the
10901 interfaces and abstract methods. We use an array of structures
10902 which can be computed ahead of time to reduce memory usage and we
10903 also assume that lookups are cheap as most classes will not
10904 implement too many interfaces.
10906 We also avoid creating too many MethodSignatures.
10908 (TypeContainer.IsInterfaceMethod): Update and optionally does not
10909 clear the "pending" bit if we find that there are problems with
10912 (TypeContainer.VerifyPendingMethods): Update to report errors of
10913 methods that look like implementations but are not.
10915 (TypeContainer.Define): Add support for explicit interface method
10918 2001-12-12 Miguel de Icaza <miguel@ximian.com>
10920 * typemanager.cs: Keep track of the parameters here instead of
10921 being a feature of the TypeContainer.
10923 * class.cs: Drop the registration of parameters here, as
10924 InterfaceMethods are also interface declarations.
10926 * delegate.cs: Register methods with the TypeManager not only with
10927 the TypeContainer. This code was buggy.
10929 * interface.cs: Full registation here.
10931 2001-12-11 Miguel de Icaza <miguel@ximian.com>
10933 * expression.cs: Remove reducer for binary expressions, it can not
10936 * const.cs: Put here the code that used to go into constant.cs
10938 * constant.cs: Put here the code for constants, this is a new base
10939 class for Literals.
10941 * literal.cs: Make Literal derive from Constant.
10943 2001-12-09 Miguel de Icaza <miguel@ximian.com>
10945 * statement.cs (Return.Emit): Report error 157 if the user
10946 attempts to return from a finally block.
10948 (Return.Emit): Instead of emitting a return, jump to the end of
10951 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
10952 LocalBuilder to store the result of the function. ReturnLabel is
10953 the target where we jump.
10956 2001-12-09 Radek Doulik <rodo@ximian.com>
10958 * cs-parser.jay: remember alias in current namespace
10960 * ecore.cs (SimpleName::DoResolve): use aliases for types or
10963 * class.cs (LookupAlias): lookup alias in my_namespace
10965 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
10967 (LookupAlias): lookup alias in this and if needed in parent
10970 2001-12-08 Miguel de Icaza <miguel@ximian.com>
10974 * rootcontext.cs: (ModuleBuilder) Made static, first step into
10975 making things static. I need this to avoid passing the
10976 TypeContainer when calling ParameterType.
10978 * support.cs (InternalParameters.ParameterType): Remove ugly hack
10979 that did string manipulation to compute the type and then call
10980 GetType. Use Parameter.ParameterType instead.
10982 * cs-tokenizer.cs: Consume the suffix for floating values.
10984 * expression.cs (ParameterReference): figure out whether this is a
10985 reference parameter or not. Kill an extra variable by computing
10986 the arg_idx during emission.
10988 * parameter.cs (Parameters.GetParameterInfo): New overloaded
10989 function that returns whether a parameter is an out/ref value or not.
10991 (Parameter.ParameterType): The type of the parameter (base,
10992 without ref/out applied).
10994 (Parameter.Resolve): Perform resolution here.
10995 (Parameter.ExternalType): The full type (with ref/out applied).
10997 * statement.cs (Using.Emit, Using.EmitExpression): Implement
10998 support for expressions on the using statement.
11000 2001-12-07 Miguel de Icaza <miguel@ximian.com>
11002 * statement.cs (Using.EmitLocalVariableDecls): Split the
11003 localvariable handling of the using statement.
11005 (Block.EmitMeta): Keep track of variable count across blocks. We
11006 were reusing slots on separate branches of blocks.
11008 (Try.Emit): Emit the general code block, we were not emitting it.
11010 Check the type of the declaration to be an IDisposable or
11011 something that can be implicity converted to it.
11013 Emit conversions if required.
11015 * ecore.cs (EmptyExpression): New utility class.
11016 (Expression.ImplicitConversionExists): New utility function.
11018 2001-12-06 Miguel de Icaza <miguel@ximian.com>
11020 * statement.cs (Using): Implement.
11022 * expression.cs (LocalVariableReference): Support read only variables.
11024 * statement.cs: Remove the explicit emit for the Leave opcode.
11025 (VariableInfo): Add a readonly field.
11027 2001-12-05 Miguel de Icaza <miguel@ximian.com>
11029 * ecore.cs (ConvCast): new class used to encapsulate the various
11030 explicit integer conversions that works in both checked and
11031 unchecked contexts.
11033 (Expression.ConvertNumericExplicit): Use new ConvCast class to
11034 properly generate the overflow opcodes.
11036 2001-12-04 Miguel de Icaza <miguel@ximian.com>
11038 * statement.cs: The correct type for the EmptyExpression is the
11039 element_type, not the variable type. Ravi pointed this out.
11041 2001-12-04 Ravi Pratap <ravi@ximian.com>
11043 * class.cs (Method::Define): Handle PInvoke methods specially
11044 by using DefinePInvokeMethod instead of the usual one.
11046 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
11047 above to do the task of extracting information and defining the method.
11049 2001-12-04 Ravi Pratap <ravi@ximian.com>
11051 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
11052 of the condition for string type.
11054 (Emit): Move that here.
11056 (ArrayCreation::CheckIndices): Keep string literals in their expression
11059 (EmitDynamicInitializers): Handle strings appropriately.
11061 2001-12-04 Miguel de Icaza <miguel@ximian.com>
11063 * codegen.cs (EmitContext): Replace multiple variables with a
11064 single pointer to the current Switch statement.
11066 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
11069 2001-12-03 Miguel de Icaza <miguel@ximian.com>
11073 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
11076 (Foreach.Emit): Foreach on arrays was not setting
11077 up the loop variables (for break/continue).
11079 (GotoCase): Semi-implented.
11081 2001-12-03 Ravi Pratap <ravi@ximian.com>
11083 * attribute.cs (CheckAttribute): Handle system attributes by using
11084 Attribute.GetAttributes to examine information we need.
11086 (GetValidPlaces): Same here.
11088 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
11090 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
11092 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
11094 (Method::Define): Set appropriate flags if we have a DllImport attribute.
11096 (Method::Emit): Handle the case when we are a PInvoke method.
11098 2001-12-03 Miguel de Icaza <miguel@ximian.com>
11100 * expression.cs: Use ResolveWithSimpleName on compound names.
11102 2001-12-02 Ravi Pratap <ravi@ximian.com>
11104 * constant.cs (EmitConstant): Make sure we resolve the associated expression
11105 before trying to reduce it.
11107 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
11109 * constant.cs (LookupConstantValue): Implement.
11111 (EmitConstant): Use the above in emitting the constant.
11113 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
11114 that are user-defined by doing a LookupConstantValue on them.
11116 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
11119 2001-11-29 Miguel de Icaza <miguel@ximian.com>
11121 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
11123 (BaseAccess.DoResolve): Implement.
11125 (MemberAccess.DoResolve): Split this routine into a
11126 ResolveMemberAccess routine that can be used independently
11128 2001-11-28 Miguel de Icaza <miguel@ximian.com>
11130 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
11131 As that share bits of the implementation. Is returns a boolean,
11132 while As returns the Type that is being probed.
11134 2001-12-01 Ravi Pratap <ravi@ximian.com>
11136 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
11137 instead of a Literal - much easier.
11139 (EnumInTransit): Remove - utterly useless :-)
11141 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
11143 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
11145 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
11146 chain when we have no associated expression.
11148 2001-11-30 Ravi Pratap <ravi@ximian.com>
11150 * constant.cs (Define): Use Location while reporting the errror.
11152 Also emit a warning when 'new' is used and there is no inherited
11155 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
11158 (LookupEnumValue): Implement to lookup an enum member's value and define it
11161 (Populate): Re-write accordingly to use the above routine.
11163 2001-11-27 Miguel de Icaza <miguel@ximian.com>
11165 * expression.cs (This): Fix prototype for DoResolveLValue to
11166 override the base class DoResolveLValue.
11168 * cs-parser.cs: Report errors cs574 and cs575 (destructor
11171 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
11172 (we need to load the address of the field here). This fixes
11175 (FieldExpr.DoResolveLValue): Call the DoResolve
11176 function to initialize the Instance expression.
11178 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
11179 correctly the GetEnumerator operation on a value type.
11181 * cs-parser.jay: Add more simple parsing error catches.
11183 * statement.cs (Switch): Add support for string switches.
11184 Handle null specially.
11186 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
11188 2001-11-28 Ravi Pratap <ravi@ximian.com>
11190 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
11192 (declare_local_constant): New helper function.
11194 * statement.cs (AddConstant): Keep a separate record of constants
11196 (IsConstant): Implement to determine if a variable is a constant.
11198 (GetConstantExpression): Implement.
11200 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
11202 * statement.cs (IsVariableDefined): Re-write.
11204 2001-11-27 Ravi Pratap <ravi@ximian.com>
11206 * class.cs (TypeContainer::FindMembers): Look for constants
11207 in the case when we are looking for MemberTypes.Field
11209 * expression.cs (MemberAccess::DoResolve): Check that in the
11210 case we are a FieldExpr and a Literal, we are not being accessed
11211 by an instance reference.
11213 * cs-parser.jay (local_constant_declaration): Implement.
11215 (declaration_statement): Implement for constant declarations.
11217 2001-11-26 Miguel de Icaza <miguel@ximian.com>
11219 * statement.cs (Switch): Catch double defaults.
11221 (Switch): More work on the switch() statement
11222 implementation. It works for integral values now, need to finish
11226 2001-11-24 Miguel de Icaza <miguel@ximian.com>
11228 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
11229 integer literals into other integer literals. To be used by
11232 2001-11-24 Ravi Pratap <ravi@ximian.com>
11234 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
11237 (EmitDynamicInitializers): Cope with the above since we extract data
11238 directly from ArrayData now.
11240 (ExpectInitializers): Keep track of whether initializers are mandatory
11243 (Bounds): Make it a hashtable to prevent the same dimension being
11244 recorded for every element in that dimension.
11246 (EmitDynamicInitializers): Fix bug which prevented the Set array method
11249 Also fix bug which was causing the indices to be emitted in the reverse
11252 2001-11-24 Miguel de Icaza <miguel@ximian.com>
11254 * expression.cs (ArrayCreation): Implement the bits that Ravi left
11255 unfinished. They do not work, because the underlying code is
11258 2001-11-22 Miguel de Icaza <miguel@ximian.com>
11260 * cs-parser.jay: Remove bogus fixme.
11262 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
11263 on Switch statement.
11265 2001-11-23 Ravi Pratap <ravi@ximian.com>
11267 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
11270 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
11271 parameter. Apparently, any expression is allowed.
11273 (ValidateInitializers): Update accordingly.
11275 (CheckIndices): Fix some tricky bugs thanks to recursion.
11277 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
11278 I was being completely brain-dead.
11280 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
11281 and re-write acordingly.
11283 (DelegateInvocation): Re-write accordingly.
11285 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
11287 (MakeByteBlob): Handle types more correctly.
11289 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
11290 initialization from expressions but it is incomplete because I am a complete
11293 2001-11-22 Miguel de Icaza <miguel@ximian.com>
11295 * statement.cs (If.Emit): Fix a bug that generated incorrect code
11296 on If. Basically, we have to return `true' (ie, we do return to
11297 our caller) only if both branches of the if return.
11299 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
11300 short-circuit operators, handle them as short circuit operators.
11302 (Cast.DoResolve): Resolve type.
11303 (Cast.Cast): Take an expression as the target type.
11305 * cs-parser.jay (cast_expression): Remove old hack that only
11306 allowed a limited set of types to be handled. Now we take a
11307 unary_expression and we resolve to a type during semantic
11310 Use the grammar productions from Rhys to handle casts (this is
11311 not complete like Rhys syntax yet, we fail to handle that corner
11312 case that C# has regarding (-x), but we will get there.
11314 2001-11-22 Ravi Pratap <ravi@ximian.com>
11316 * class.cs (EmitFieldInitializer): Take care of the case when we have a
11317 field which is an array type.
11319 * cs-parser.jay (declare_local_variables): Support array initialization too.
11321 * typemanager.cs (MakeKey): Implement.
11323 (everywhere): Use the above appropriately.
11325 * cs-parser.jay (for_statement): Update for array initialization while
11326 declaring variables.
11328 * ecore.cs : The error message was correct, it's the variable's names that
11329 were misleading ;-) Make the code more readable.
11331 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
11332 the correct type etc.
11334 (ConvertExplicit): Handle Enum types by examining the underlying type.
11336 2001-11-21 Ravi Pratap <ravi@ximian.com>
11338 * parameter.cs (GetCallingConvention): Always return
11339 CallingConventions.Standard for now.
11341 2001-11-22 Miguel de Icaza <miguel@ximian.com>
11343 * expression.cs (Binary.ResolveOperator): Update the values of `l'
11344 and `r' after calling DoNumericPromotions.
11346 * ecore.cs: Fix error message (the types were in the wrong order).
11348 * statement.cs (Foreach.ProbeCollectionType): Need to pass
11349 BindingFlags.Instance as well
11351 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
11352 implicit int literal conversion in an empty cast so that we
11353 propagate the right type upstream.
11355 (UnboxCast): new class used to unbox value types.
11356 (Expression.ConvertExplicit): Add explicit type conversions done
11359 (Expression.ImplicitNumericConversion): Oops, forgot to test for
11360 the target type before applying the implicit LongLiterals to ULong
11363 2001-11-21 Miguel de Icaza <miguel@ximian.com>
11365 * cs-parser.jay (for_statement): Reworked the way For works: now
11366 we declare manually any variables that are introduced in
11367 for_initializer to solve the problem of having out-of-band code
11368 emition (that is what got for broken).
11370 (declaration_statement): Perform the actual variable declaration
11371 that used to be done in local_variable_declaration here.
11373 (local_variable_declaration): Do not declare anything, just pass
11374 the information on a DictionaryEntry
11376 2001-11-20 Ravi Pratap <ravi@ximian.com>
11378 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
11379 re-write of the logic to now make it recursive.
11381 (UpdateIndices): Re-write accordingly.
11383 Store element data in a separate ArrayData list in the above methods.
11385 (MakeByteBlob): Implement to dump the array data into a byte array.
11387 2001-11-19 Ravi Pratap <ravi@ximian.com>
11389 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
11392 * constant.cs (Define): Implement.
11394 (EmitConstant): Re-write fully.
11396 Pass in location info.
11398 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
11401 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
11402 DictionaryEntry since we need location info too.
11404 (constant_declaration): Update accordingly.
11406 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
11407 code into another method : UpdateIndices.
11409 2001-11-18 Ravi Pratap <ravi@ximian.com>
11411 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
11412 some type checking etc.
11414 2001-11-17 Ravi Pratap <ravi@ximian.com>
11416 * expression.cs (ArrayCreation::ValidateInitializers): Implement
11417 bits to provide dimension info if the user skips doing that.
11419 Update second constructor to store the rank correctly.
11421 2001-11-16 Ravi Pratap <ravi@ximian.com>
11423 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
11424 and try to implement.
11426 * ../errors/cs0150.cs : Add.
11428 * ../errors/cs0178.cs : Add.
11430 2001-11-16 Miguel de Icaza <miguel@ximian.com>
11432 * statement.cs: Implement foreach on multi-dimensional arrays.
11434 * parameter.cs (Parameters.GetParameterByName): Also lookup the
11435 name of the params argument.
11437 * expression.cs: Use EmitStoreOpcode to get the right opcode while
11438 initializing the array.
11440 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
11441 we can use this elsewhere.
11443 * statement.cs: Finish implementation of foreach for single
11446 * cs-parser.jay: Use an out-of-band stack to pass information
11447 around, I wonder why I need this.
11449 foreach_block: Make the new foreach_block the current_block.
11451 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
11452 function used to return a static Parameters structure. Used for
11453 empty parameters, as those are created very frequently.
11455 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
11457 2001-11-15 Ravi Pratap <ravi@ximian.com>
11459 * interface.cs : Default modifier is private, not public. The
11460 make verify test passes again.
11462 2001-11-15 Ravi Pratap <ravi@ximian.com>
11464 * support.cs (ReflectionParameters): Fix logic to determine
11465 whether the last parameter is a params one. Test 9 passes again.
11467 * delegate.cs (Populate): Register the builders we define with
11468 RegisterParameterForBuilder. Test 19 passes again.
11470 * cs-parser.jay (property_declaration): Reference $6 instead
11471 of $$ to get at the location.
11473 (indexer_declaration): Similar stuff.
11475 (attribute): Ditto.
11477 * class.cs (Property): Register parameters for the Get and Set methods
11478 if they exist. Test 23 passes again.
11480 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
11481 call to EmitArguments as we are sure there aren't any params arguments.
11482 Test 32 passes again.
11484 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
11485 IndexOutOfRangeException.
11487 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
11488 Test 33 now passes again.
11490 2001-11-15 Miguel de Icaza <miguel@ximian.com>
11492 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
11493 broke a bunch of things. Will have to come up with a better way
11494 of tracking locations.
11496 * statement.cs: Implemented foreach for single dimension arrays.
11498 2001-11-09 Miguel de Icaza <miguel@ximian.com>
11500 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
11501 an error. This removes the lookup from the critical path.
11503 * cs-parser.jay: Removed use of temporary_loc, which is completely
11506 2001-11-14 Miguel de Icaza <miguel@ximian.com>
11508 * support.cs (ReflectionParameters.ParameterModifier): Report
11509 whether the argument is a PARAMS argument or not.
11511 * class.cs: Set the attribute `ParamArrayAttribute' on the
11512 parameter argument.
11514 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
11515 and cons_param_array_attribute (ConstructorInfo for
11516 ParamArrayAttribute).,
11518 * codegen.cs: Emit the return using the `Return' statement, that
11519 way we can report the error correctly for missing return values.
11521 * class.cs (Method.Emit): Clean up.
11523 * expression.cs (Argument.Resolve): Take another argument: the
11524 location where this argument is used. Notice that this is not
11525 part of the "Argument" class as to reduce the size of the
11526 structure (we know the approximate location anyways).
11528 Test if the argument is a variable-reference, if not, then
11529 complain with a 206.
11531 (Argument.Emit): Emit addresses of variables.
11533 (Argument.FullDesc): Simplify.
11535 (Invocation.DoResolve): Update for Argument.Resolve.
11537 (ElementAccess.DoResolve): ditto.
11539 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
11540 method should be virtual, as this method is always virtual.
11542 (NewDelegate.DoResolve): Update for Argument.Resolve.
11544 * class.cs (ConstructorInitializer.DoResolve): ditto.
11546 * attribute.cs (Attribute.Resolve): ditto.
11548 2001-11-13 Miguel de Icaza <miguel@ximian.com>
11550 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
11552 * expression.cs (ParameterReference): Drop IStackStorage and implement
11553 IAssignMethod instead.
11555 (LocalVariableReference): ditto.
11557 * ecore.cs (FieldExpr): Drop IStackStorage and implement
11558 IAssignMethod instead.
11560 2001-11-13 Miguel de Icaza <miguel@ximian.com>
11562 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
11563 enumerations that are used in heavily used structures derive from
11564 byte in a laughable and pathetic attempt to reduce memory usage.
11565 This is the kind of pre-optimzations that you should not do at
11566 home without adult supervision.
11568 * expression.cs (UnaryMutator): New class, used to handle ++ and
11569 -- separatedly from the other unary operators. Cleans up the
11570 code, and kills the ExpressionStatement dependency in Unary.
11572 (Unary): Removed `method' and `Arguments' from this class, making
11573 it smaller, and moving it all to SimpleCall, so I can reuse this
11574 code in other locations and avoid creating a lot of transient data
11575 strucutres when not required.
11577 * cs-parser.jay: Adjust for new changes.
11579 2001-11-11 Miguel de Icaza <miguel@ximian.com>
11581 * enum.cs (Enum.Populate): If there is a failure during
11584 * cs-parser.jay (opt_enum_base): we used to catch type errors
11585 here, but this is really incorrect. The type error should be
11586 catched during semantic analysis.
11588 2001-12-11 Ravi Pratap <ravi@ximian.com>
11590 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
11591 current_local_parameters as expected since I, in my stupidity, had forgotten
11594 * attribute.cs (GetValidPlaces): Fix stupid bug.
11596 * class.cs (Method::Emit): Perform check on applicability of attributes.
11598 (Constructor::Emit): Ditto.
11600 (Field::Emit): Ditto.
11602 (Field.Location): Store location information.
11604 (Property, Event, Indexer, Operator): Ditto.
11606 * cs-parser.jay (field_declaration): Pass in location for each field.
11608 * ../errors/cs0592.cs : Add.
11610 2001-11-12 Ravi Pratap <ravi@ximian.com>
11612 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
11614 (InitCoreTypes): Update accordingly.
11616 (RegisterAttrType, LookupAttr): Implement.
11618 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
11619 info about the same.
11621 (Resolve): Update to populate the above as necessary.
11623 (Error592): Helper.
11625 (GetValidPlaces): Helper to the above.
11627 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
11629 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
11631 2001-11-12 Ravi Pratap <ravi@ximian.com>
11633 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
11635 * ../errors/cs0617.cs : Add.
11637 2001-11-11 Ravi Pratap <ravi@ximian.com>
11639 * enum.cs (Emit): Rename to Populate to be more consistent with what
11640 we expect it to do and when exactly it is called.
11642 * class.cs, rootcontext.cs : Update accordingly.
11644 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
11645 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
11647 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
11649 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
11650 of a fieldinfo using the above, when dealing with a FieldBuilder.
11652 2001-11-10 Ravi Pratap <ravi@ximian.com>
11654 * ../errors/cs0031.cs : Add.
11656 * ../errors/cs1008.cs : Add.
11658 * ../errrors/cs0543.cs : Add.
11660 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
11663 (FindMembers): Implement.
11665 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
11666 enums and delegates too.
11668 (enum_types): Rename to builder_to_enum.
11670 (delegate_types): Rename to builder_to_delegate.
11672 * delegate.cs (FindMembers): Implement.
11674 2001-11-09 Ravi Pratap <ravi@ximian.com>
11676 * typemanager.cs (IsEnumType): Implement.
11678 * enum.cs (Emit): Re-write parts to account for the underlying type
11679 better and perform checking etc.
11681 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
11682 of the underlying type.
11684 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
11687 * enum.cs (error31): Helper to report error #31.
11689 * cs-parser.jay (enum_declaration): Store location of each member too.
11691 * enum.cs (member_to_location): New hashtable.
11693 (AddEnumMember): Update location hashtable.
11695 (Emit): Use the location of each member while reporting errors.
11697 2001-11-09 Miguel de Icaza <miguel@ximian.com>
11699 * cs-parser.jay: A for_initializer if is a
11700 local_variable_declaration really ammount to have an implicit
11701 block with the variable declaration and no initializer for for.
11703 * statement.cs (For.Emit): Cope with null initializers.
11705 This fixes the infinite loop on for initializers.
11707 2001-11-08 Miguel de Icaza <miguel@ximian.com>
11709 * enum.cs: More cleanup.
11711 * ecore.cs: Remove dead code.
11713 * class.cs (Property.Emit): More simplification.
11714 (Event.Emit): ditto.
11716 Reworked to have less levels of indentation.
11718 2001-11-08 Ravi Pratap <ravi@ximian.com>
11720 * class.cs (Property): Emit attributes.
11730 * enum.cs (Emit): Ditto.
11732 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
11735 * class.cs (Field, Event, etc.): Move attribute generation into the
11736 Emit method everywhere.
11738 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
11739 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
11740 as we had no way of defining nested enums !
11742 * rootcontext.cs : Adjust code accordingly.
11744 * typemanager.cs (AddEnumType): To keep track of enum types separately.
11746 2001-11-07 Ravi Pratap <ravi@ximian.com>
11748 * expression.cs (EvalConstantExpression): Move into ecore.cs
11750 * enum.cs (Enum): Rename some members and make them public and readonly
11751 according to our convention.
11753 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
11756 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
11758 (Enum::Emit): Write a simple version for now which doesn't try to compute
11759 expressions. I shall modify this to be more robust in just a while.
11761 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
11763 (TypeContainer::CloseType): Create the Enum types too.
11765 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
11767 * expression.cs (EvalConstantExpression): Get rid of completely.
11769 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
11770 user-defined values and other cases.
11772 (IsValidEnumLiteral): Helper function.
11774 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
11775 out there in the case we had a literal FieldExpr.
11777 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
11779 (Literalize): Revamp a bit to take two arguments.
11781 (EnumLiteral): New class which derives from Literal to wrap enum literals.
11783 2001-11-06 Ravi Pratap <ravi@ximian.com>
11785 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
11787 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
11789 (Resolve): Use the above to ensure we have proper initializers.
11791 2001-11-05 Ravi Pratap <ravi@ximian.com>
11793 * expression.cs (Expression::EvalConstantExpression): New method to
11794 evaluate constant expressions.
11796 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
11798 2001-11-07 Miguel de Icaza <miguel@ximian.com>
11800 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
11803 (Binary.ResolveOperator): Handle operator != (object a, object b)
11804 and operator == (object a, object b);
11806 (Binary.DoNumericPromotions): Indicate whether the numeric
11807 promotion was possible.
11809 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
11812 Made the ArrayAccess implement interface IAssignMethod instead of
11813 IStackStore as the order in which arguments are passed reflects
11816 * assign.cs: Instead of using expr.ExprClass to select the way of
11817 assinging, probe for the IStackStore/IAssignMethod interfaces.
11819 * typemanager.cs: Load InitializeArray definition.
11821 * rootcontext.cs (RootContext.MakeStaticData): Used to define
11822 static data that can be used to initialize arrays.
11824 2001-11-05 Miguel de Icaza <miguel@ximian.com>
11826 * expression.cs: Handle operator== and operator!= for booleans.
11828 (Conditioal.Reduce): Implement reducer for the ?: operator.
11830 (Conditional.Resolve): Implement dead code elimination.
11832 (Binary.Resolve): Catch string literals and return a new
11833 concatenated string.
11835 (Unary.Reduce): Implement reduction of unary expressions.
11837 * ecore.cs: Split out the expression core handling here.
11839 (Expression.Reduce): New method used to perform constant folding
11840 and CSE. This is needed to support constant-expressions.
11842 * statement.cs (Statement.EmitBoolExpression): Pass true and false
11843 targets, and optimize for !x.
11845 2001-11-04 Ravi Pratap <ravi@ximian.com>
11847 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
11848 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
11849 set custom atttributes.
11851 * literal.cs (Literal::GetValue): New abstract method to return the actual
11852 value of the literal, cast as an object.
11854 (*Literal): Implement GetValue method.
11856 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
11857 expressions to the arraylist but objects of type Argument.
11859 * class.cs (TypeContainer::Emit): Emit our attributes too.
11861 (Method::Emit, Constructor::Emit): Ditto.
11863 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
11864 to be ignoring earlier.
11866 2001-11-03 Ravi Pratap <ravi@ximian.com>
11868 * attribute.cs (AttributeSection::Define): Implement to do the business
11869 of constructing a CustomAttributeBuilder.
11871 (Attribute): New trivial class. Increases readability of code.
11873 * cs-parser.jay : Update accordingly.
11875 (positional_argument_list, named_argument_list, named_argument): New rules
11877 (attribute_arguments): Use the above so that we are more correct.
11879 2001-11-02 Ravi Pratap <ravi@ximian.com>
11881 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
11882 to perform all checks for a method with a params parameter.
11884 (Invocation::OverloadResolve): Update to use the above method and therefore
11885 cope correctly with params method invocations.
11887 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
11890 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
11891 constructors in our parent too because we can't afford to miss out on
11894 * attribute.cs (AttributeSection): New name for the class Attribute
11896 Other trivial changes to improve readability.
11898 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
11899 use the new class names.
11901 2001-11-01 Ravi Pratap <ravi@ximian.com>
11903 * class.cs (Method::Define): Complete definition for params types too
11905 (Indexer::Define): Ditto.
11907 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
11908 Cope everywhere with a request for info about the array parameter.
11910 2001-11-01 Ravi Pratap <ravi@ximian.com>
11912 * tree.cs (RecordNamespace): Fix up to check for the correct key.
11914 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
11915 local_variable_type to extract the string corresponding to the type.
11917 (local_variable_type): Fixup the action to use the new helper method.
11919 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
11922 * expression.cs : Clean out code which uses the above.
11924 2001-10-31 Ravi Pratap <ravi@ximian.com>
11926 * typemanager.cs (RegisterMethod): Check if we already have an existing key
11927 and bale out if necessary by returning a false.
11929 (RegisterProperty): Ditto.
11931 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
11932 and print out appropriate error messages.
11934 * interface.cs (everywhere): Ditto.
11936 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
11937 location to constructor.
11939 * class.cs (Property, Event, Indexer): Update accordingly.
11941 * ../errors/cs111.cs : Added.
11943 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
11944 of a method, as laid down by the spec.
11946 (Invocation::OverloadResolve): Use the above method.
11948 2001-10-31 Ravi Pratap <ravi@ximian.com>
11950 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
11951 now take a TypeContainer and a Parameters object.
11953 (ParameterData): Modify return type of ParameterModifier method to be
11954 Parameter.Modifier and not a string.
11956 (ReflectionParameters, InternalParameters): Update accordingly.
11958 * expression.cs (Argument::GetParameterModifier): Same here.
11960 * support.cs (InternalParameters::ParameterType): Find a better way of determining
11961 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
11962 symbol in it at all so maybe this is only for now.
11964 2001-10-30 Ravi Pratap <ravi@ximian.com>
11966 * support.cs (InternalParameters): Constructor now takes an extra argument
11967 which is the actual Parameters class.
11969 (ParameterDesc): Update to provide info on ref/out modifiers.
11971 * class.cs (everywhere): Update call to InternalParameters to pass in
11972 the second argument too.
11974 * support.cs (ParameterData): Add ParameterModifier, which is a method
11975 to return the modifier info [ref/out etc]
11977 (InternalParameters, ReflectionParameters): Implement the above.
11979 * expression.cs (Argument::ParameterModifier): Similar function to return
11980 info about the argument's modifiers.
11982 (Invocation::OverloadResolve): Update to take into account matching modifiers
11985 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
11986 a new SetFormalParameters object which we pass to InternalParameters.
11988 2001-10-30 Ravi Pratap <ravi@ximian.com>
11990 * expression.cs (NewArray): Merge into the ArrayCreation class.
11992 2001-10-29 Ravi Pratap <ravi@ximian.com>
11994 * expression.cs (NewArray): Merge classes NewBuiltinArray and
11995 NewUserdefinedArray into one as there wasn't much of a use in having
11998 * expression.cs (Argument): Change field's name to ArgType from Type.
12000 (Type): New readonly property which returns the proper type, taking into
12001 account ref/out modifiers.
12003 (everywhere): Adjust code accordingly for the above.
12005 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
12006 whether we are emitting for a ref or out parameter.
12008 * expression.cs (Argument::Emit): Use the above field to set the state.
12010 (LocalVariableReference::Emit): Update to honour the flag and emit the
12013 * parameter.cs (Attributes): Set the correct flags for ref parameters.
12015 * expression.cs (Argument::FullDesc): New function to provide a full desc.
12017 * support.cs (ParameterData): Add method ParameterDesc to the interface.
12019 (ReflectionParameters, InternalParameters): Implement the above method.
12021 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
12024 (Invocation::FullMethodDesc): Ditto.
12026 2001-10-29 Miguel de Icaza <miguel@ximian.com>
12028 * cs-parser.jay: Add extra production for the second form of array
12031 * expression.cs (ArrayCreation): Update to reflect the above
12034 * Small changes to prepare for Array initialization.
12036 2001-10-28 Miguel de Icaza <miguel@ximian.com>
12038 * typemanager.cs (ImplementsInterface): interface might be null;
12039 Deal with this problem;
12041 Also, we do store negative hits on the cache (null values), so use
12042 this instead of calling t.GetInterfaces on the type everytime.
12044 2001-10-28 Ravi Pratap <ravi@ximian.com>
12046 * typemanager.cs (IsBuiltinType): New method to help determine the same.
12048 * expression.cs (New::DoResolve): Get rid of array creation code and instead
12049 split functionality out into different classes.
12051 (New::FormArrayType): Move into NewBuiltinArray.
12053 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
12056 (NewBuiltinArray): New class to handle creation of built-in arrays.
12058 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
12059 account creation of one-dimensional arrays.
12061 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
12063 (NewUserdefinedArray::DoResolve): Implement.
12065 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
12067 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
12068 we maintain inside the TypeManager. This is necessary to perform lookups on the
12071 (LookupType): Update to perform GetType on the module builders too.
12073 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
12075 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
12077 2001-10-23 Ravi Pratap <ravi@ximian.com>
12079 * expression.cs (New::DoResolve): Implement guts of array creation.
12081 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
12083 2001-10-27 Miguel de Icaza <miguel@ximian.com>
12085 * expression.cs: Fix bug I introduced lsat night that broke
12088 (Expression.Resolve): Report a 246 error (can not resolve name)
12089 if we find a SimpleName in the stream.
12091 (Expression.ResolveLValue): Ditto.
12093 (Expression.ResolveWithSimpleName): This function is a variant of
12094 ResolveName, this one allows SimpleNames to be returned without a
12095 warning. The only consumer of SimpleNames is MemberAccess
12097 2001-10-26 Miguel de Icaza <miguel@ximian.com>
12099 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
12100 might arrive here. I have my doubts that this is correct.
12102 * statement.cs (Lock): Implement lock statement.
12104 * cs-parser.jay: Small fixes to support `lock' and `using'
12106 * cs-tokenizer.cs: Remove extra space
12108 * driver.cs: New flag --checked, allows to turn on integer math
12111 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
12112 Threading.Monitor.Exit
12114 2001-10-23 Miguel de Icaza <miguel@ximian.com>
12116 * expression.cs (IndexerAccess::DoResolveLValue): Set the
12117 Expression Class to be IndexerAccess.
12119 Notice that Indexer::DoResolve sets the eclass to Value.
12121 2001-10-22 Miguel de Icaza <miguel@ximian.com>
12123 * class.cs (TypeContainer::Emit): Emit code for indexers.
12125 * assign.cs (IAssignMethod): New interface implemented by Indexers
12126 and Properties for handling assignment.
12128 (Assign::Emit): Simplify and reuse code.
12130 * expression.cs (IndexerAccess, PropertyExpr): Implement
12131 IAssignMethod, clean up old code.
12133 2001-10-22 Ravi Pratap <ravi@ximian.com>
12135 * typemanager.cs (ImplementsInterface): New method to determine if a type
12136 implements a given interface. Provides a nice cache too.
12138 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
12141 (ConvertReferenceExplicit): Ditto.
12143 * delegate.cs (Delegate::Populate): Update to define the parameters on the
12144 various methods, with correct names etc.
12146 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
12147 Operator.UnaryNegation.
12149 * cs-parser.jay (operator_declarator): Be a little clever in the case where
12150 we have a unary plus or minus operator.
12152 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
12155 * everywhere : update accordingly.
12157 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
12160 * class.cs (Method::Define): For the case where we are implementing a method
12161 inherited from an interface, we need to set the MethodAttributes.Final flag too.
12162 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
12164 2001-10-21 Ravi Pratap <ravi@ximian.com>
12166 * interface.cs (FindMembers): Implement to work around S.R.E
12169 * typemanager.cs (IsInterfaceType): Implement.
12171 (FindMembers): Update to handle interface types too.
12173 * expression.cs (ImplicitReferenceConversion): Re-write bits which
12174 use IsAssignableFrom as that is not correct - it doesn't work.
12176 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
12177 and accordingly override EmitStatement.
12179 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
12180 using the correct logic :-)
12182 2001-10-19 Ravi Pratap <ravi@ximian.com>
12184 * ../errors/cs-11.cs : Add to demonstrate error -11
12186 2001-10-17 Miguel de Icaza <miguel@ximian.com>
12188 * assign.cs (Assign::Resolve): Resolve right hand side first, and
12189 then pass this as a hint to ResolveLValue.
12191 * expression.cs (FieldExpr): Add Location information
12193 (FieldExpr::LValueResolve): Report assignment to readonly
12196 (Expression::ExprClassFromMemberInfo): Pass location information.
12198 (Expression::ResolveLValue): Add new method that resolves an
12201 (Expression::DoResolveLValue): Default invocation calls
12204 (Indexers): New class used to keep track of indexers in a given
12207 (IStackStore): Renamed from LValue, as it did not really describe
12208 what this did. Also ResolveLValue is gone from this interface and
12209 now is part of Expression.
12211 (ElementAccess): Depending on the element access type
12213 * typemanager.cs: Add `indexer_name_type' as a Core type
12214 (System.Runtime.CompilerServices.IndexerNameAttribute)
12216 * statement.cs (Goto): Take a location.
12218 2001-10-18 Ravi Pratap <ravi@ximian.com>
12220 * delegate.cs (Delegate::VerifyDelegate): New method to verify
12221 if two delegates are compatible.
12223 (NewDelegate::DoResolve): Update to take care of the case when
12224 we instantiate a delegate from another delegate.
12226 * typemanager.cs (FindMembers): Don't even try to look up members
12227 of Delegate types for now.
12229 2001-10-18 Ravi Pratap <ravi@ximian.com>
12231 * delegate.cs (NewDelegate): New class to take care of delegate
12234 * expression.cs (New): Split the delegate related code out into
12235 the NewDelegate class.
12237 * delegate.cs (DelegateInvocation): New class to handle delegate
12240 * expression.cs (Invocation): Split out delegate related code into
12241 the DelegateInvocation class.
12243 2001-10-17 Ravi Pratap <ravi@ximian.com>
12245 * expression.cs (New::DoResolve): Implement delegate creation fully
12246 and according to the spec.
12248 (New::DoEmit): Update to handle delegates differently.
12250 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
12251 because of which we were printing out arguments in reverse order !
12253 * delegate.cs (VerifyMethod): Implement to check if the given method
12254 matches the delegate.
12256 (FullDelegateDesc): Implement.
12258 (VerifyApplicability): Implement.
12260 * expression.cs (Invocation::DoResolve): Update to accordingly handle
12261 delegate invocations too.
12263 (Invocation::Emit): Ditto.
12265 * ../errors/cs1593.cs : Added.
12267 * ../errors/cs1594.cs : Added.
12269 * delegate.cs (InstanceExpression, TargetMethod): New properties.
12271 2001-10-16 Ravi Pratap <ravi@ximian.com>
12273 * typemanager.cs (intptr_type): Core type for System.IntPtr
12275 (InitCoreTypes): Update for the same.
12277 (iasyncresult_type, asynccallback_type): Ditto.
12279 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
12282 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
12285 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
12286 the builders for the 4 members of a delegate type :-)
12288 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
12291 * expression.cs (New::DoResolve): Implement guts for delegate creation.
12293 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
12295 2001-10-15 Miguel de Icaza <miguel@ximian.com>
12297 * statement.cs (Break::Emit): Implement.
12298 (Continue::Emit): Implement.
12300 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
12301 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
12302 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
12303 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
12306 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
12307 properties that track the label for the current loop (begin of the
12308 loop and end of the loop).
12310 2001-10-15 Ravi Pratap <ravi@ximian.com>
12312 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
12313 use of emitting anything at all.
12315 * class.cs, rootcontext.cs : Get rid of calls to the same.
12317 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
12319 (Populate): Define the constructor correctly and set the implementation
12322 * typemanager.cs (delegate_types): New hashtable to hold delegates that
12325 (AddDelegateType): Implement.
12327 (IsDelegateType): Implement helper method.
12329 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
12331 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
12332 and accordingly handle it.
12334 * delegate.cs (Populate): Take TypeContainer argument.
12335 Implement bits to define the Invoke method. However, I still haven't figured out
12336 how to take care of the native int bit :-(
12338 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
12339 Qualify the name of the delegate, not its return type !
12341 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
12344 (StandardConversionExists): Checking for array types turns out to be recursive.
12346 (ConvertReferenceExplicit): Implement array conversion.
12348 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
12350 2001-10-12 Ravi Pratap <ravi@ximian.com>
12352 * cs-parser.jay (delegate_declaration): Store the fully qualified
12353 name as it is a type declaration.
12355 * delegate.cs (ReturnType, Name): Rename members to these. Make them
12358 (DefineDelegate): Renamed from Define. Does the same thing essentially,
12359 as TypeContainer::DefineType.
12361 (Populate): Method in which all the definition of the various methods (Invoke)
12364 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
12367 (CloseDelegate): Finally creates the delegate.
12369 * class.cs (TypeContainer::DefineType): Update to define delegates.
12370 (Populate, Emit and CloseType): Do the same thing here too.
12372 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
12373 delegates in all these operations.
12375 2001-10-14 Miguel de Icaza <miguel@ximian.com>
12377 * expression.cs: LocalTemporary: a new expression used to
12378 reference a temporary that has been created.
12380 * assign.cs: Handle PropertyAccess back here, so that we can
12381 provide the proper semantic access to properties.
12383 * expression.cs (Expression::ConvertReferenceExplicit): Implement
12384 a few more explicit conversions.
12386 * modifiers.cs: `NEW' modifier maps to HideBySig.
12388 * expression.cs (PropertyExpr): Make this into an
12389 ExpressionStatement, and support the EmitStatement code path.
12391 Perform get/set error checking, clean up the interface.
12393 * assign.cs: recognize PropertyExprs as targets, and if so, turn
12394 them into toplevel access objects.
12396 2001-10-12 Miguel de Icaza <miguel@ximian.com>
12398 * expression.cs: PropertyExpr::PropertyExpr: use work around the
12401 * typemanager.cs: Keep track here of our PropertyBuilders again to
12402 work around lameness in SRE.
12404 2001-10-11 Miguel de Icaza <miguel@ximian.com>
12406 * expression.cs (LValue::LValueResolve): New method in the
12407 interface, used to perform a second resolution pass for LValues.
12409 (This::DoResolve): Catch the use of this in static methods.
12411 (This::LValueResolve): Implement.
12413 (This::Store): Remove warning, assigning to `this' in structures
12416 (Invocation::Emit): Deal with invocation of
12417 methods on value types. We need to pass the address to structure
12418 methods rather than the object itself. (The equivalent code to
12419 emit "this" for structures leaves the entire structure on the
12420 stack instead of a pointer to it).
12422 (ParameterReference::DoResolve): Compute the real index for the
12423 argument based on whether the method takes or not a `this' pointer
12424 (ie, the method is static).
12426 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
12427 value types returned from functions when we need to invoke a
12428 method on the sturcture.
12431 2001-10-11 Ravi Pratap <ravi@ximian.com>
12433 * class.cs (TypeContainer::DefineType): Method to actually do the business of
12434 defining the type in the Modulebuilder or Typebuilder. This is to take
12435 care of nested types which need to be defined on the TypeBuilder using
12436 DefineNestedMethod.
12438 (TypeContainer::GetClassBases): Implement. Essentially the code from the
12439 methods in RootContext, only ported to be part of TypeContainer.
12441 (TypeContainer::GetInterfaceOrClass): Ditto.
12443 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
12445 * interface.cs (Interface::DefineInterface): New method. Does exactly
12446 what RootContext.CreateInterface did earlier, only it takes care of nested types
12449 (Interface::GetInterfaces): Move from RootContext here and port.
12451 (Interface::GetInterfaceByName): Same here.
12453 * rootcontext.cs (ResolveTree): Re-write.
12455 (PopulateTypes): Re-write.
12457 * class.cs (TypeContainer::Populate): Populate nested types too.
12458 (TypeContainer::Emit): Emit nested members too.
12460 * typemanager.cs (AddUserType): Do not make use of the FullName property,
12461 instead just use the name argument passed in as it is already fully
12464 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
12465 to TypeContainer mapping to see if a type is user-defined.
12467 * class.cs (TypeContainer::CloseType): Implement.
12469 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
12470 the default constructor.
12472 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
12475 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
12477 * interface.cs (CloseType): Create the type here.
12479 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
12482 Remove all the methods which are now in TypeContainer.
12484 2001-10-10 Ravi Pratap <ravi@ximian.com>
12486 * delegate.cs (Define): Re-write bits to define the delegate
12489 2001-10-10 Miguel de Icaza <miguel@ximian.com>
12491 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
12493 * expression.cs (ImplicitReferenceConversion): handle null as well
12494 as a source to convert to any reference type.
12496 * statement.cs (Return): Perform any implicit conversions to
12497 expected return type.
12499 Validate use of return statement.
12501 * codegen.cs (EmitContext): Pass the expected return type here.
12503 * class.cs (Method, Constructor, Property): Pass expected return
12504 type to EmitContext.
12506 2001-10-09 Miguel de Icaza <miguel@ximian.com>
12508 * expression.cs: Make DoResolve take an EmitContext instead of a
12511 Replaced `l' and `location' for `loc', for consistency.
12513 (Error, Warning): Remove unneeded Tc argument.
12515 * assign.cs, literal.cs, constant.cs: Update to new calling
12518 * codegen.cs: EmitContext now contains a flag indicating whether
12519 code is being generated in a static method or not.
12521 * cs-parser.jay: DecomposeQI, new function that replaces the old
12522 QualifiedIdentifier. Now we always decompose the assembled
12523 strings from qualified_identifier productions into a group of
12526 2001-10-08 Miguel de Icaza <miguel@ximian.com>
12528 * rootcontext.cs: Deal with field-less struct types correctly now
12529 by passing the size option to Define Type.
12531 * class.cs: Removed hack that created one static field.
12533 2001-10-07 Miguel de Icaza <miguel@ximian.com>
12535 * statement.cs: Moved most of the code generation here.
12537 2001-10-09 Ravi Pratap <ravi@ximian.com>
12539 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
12542 (ElementAccess): Remove useless bits for now - keep checks as the spec
12545 2001-10-08 Ravi Pratap <ravi@ximian.com>
12547 * expression.cs (ElementAccess::DoResolve): Remove my crap code
12548 and start performing checks according to the spec.
12550 2001-10-07 Ravi Pratap <ravi@ximian.com>
12552 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
12553 rank_specifiers instead.
12555 (rank_specifiers): Change the order in which the rank specifiers are stored
12557 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
12559 * expression.cs (ElementAccess): Implement the LValue interface too.
12561 2001-10-06 Ravi Pratap <ravi@ximian.com>
12563 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
12564 except that user defined conversions are not included.
12566 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
12567 perform the conversion of the return type, if necessary.
12569 (New::DoResolve): Check whether we are creating an array or an object
12570 and accordingly do the needful.
12572 (New::Emit): Same here.
12574 (New::DoResolve): Implement guts of array creation.
12576 (New::FormLookupType): Helper function.
12578 2001-10-07 Miguel de Icaza <miguel@ximian.com>
12580 * codegen.cs: Removed most of the code generation here, and move the
12581 corresponding code generation bits to the statement classes.
12583 Added support for try/catch/finalize and throw.
12585 * cs-parser.jay: Added support for try/catch/finalize.
12587 * class.cs: Catch static methods having the flags override,
12588 virtual or abstract.
12590 * expression.cs (UserCast): This user cast was not really doing
12591 what it was supposed to do. Which is to be born in fully resolved
12592 state. Parts of the resolution were being performed at Emit time!
12596 2001-10-05 Miguel de Icaza <miguel@ximian.com>
12598 * expression.cs: Implicity convert the result from UserCast.
12600 2001-10-05 Ravi Pratap <ravi@ximian.com>
12602 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
12603 prevented it from working correctly.
12605 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
12606 merely ConvertImplicit.
12608 2001-10-05 Miguel de Icaza <miguel@ximian.com>
12610 * typemanager.cs: Make the LookupTypeContainer function static,
12611 and not per-instance.
12613 * class.cs: Make static FindMembers (the one that takes a Type
12616 * codegen.cs: Add EmitForeach here.
12618 * cs-parser.jay: Make foreach a toplevel object instead of the
12619 inline expansion, as we need to perform semantic analysis on it.
12621 2001-10-05 Ravi Pratap <ravi@ximian.com>
12623 * expression.cs (Expression::ImplicitUserConversion): Rename to
12624 UserDefinedConversion.
12626 (Expression::UserDefinedConversion): Take an extra argument specifying
12627 whether we look for explicit user conversions too.
12629 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
12631 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
12633 (ExplicitUserConversion): Make it a call to UserDefinedConversion
12634 with the appropriate arguments.
12636 * cs-parser.jay (cast_expression): Record location too.
12638 * expression.cs (Cast): Record location info.
12640 (Expression::ConvertExplicit): Take location argument.
12642 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
12643 to determine if we are doing explicit conversions.
12645 (UserCast::Emit): Update accordingly.
12647 (Expression::ConvertExplicit): Report an error if everything fails.
12649 * ../errors/cs0030.cs : Add.
12651 2001-10-04 Miguel de Icaza <miguel@ximian.com>
12653 * modifiers.cs: If the ABSTRACT keyword is present, also set the
12654 virtual and newslot bits.
12656 * class.cs (TypeContainer::RegisterRequiredImplementations):
12657 Record methods we need.
12659 (TypeContainer::MakeKey): Helper function to make keys for
12660 MethodBases, since the Methodbase key is useless.
12662 (TypeContainer::Populate): Call RegisterRequiredImplementations
12663 before defining the methods.
12665 Create a mapping for method_builders_to_methods ahead of time
12666 instead of inside a tight loop.
12668 (::RequireMethods): Accept an object as the data to set into the
12669 hashtable so we can report interface vs abstract method mismatch.
12671 2001-10-03 Miguel de Icaza <miguel@ximian.com>
12673 * report.cs: Make all of it static.
12675 * rootcontext.cs: Drop object_type and value_type computations, as
12676 we have those in the TypeManager anyways.
12678 Drop report instance variable too, now it is a global.
12680 * driver.cs: Use try/catch on command line handling.
12682 Add --probe option to debug the error reporting system with a test
12685 * report.cs: Add support for exiting program when a probe
12686 condition is reached.
12688 2001-10-03 Ravi Pratap <ravi@ximian.com>
12690 * expression.cs (Binary::DoNumericPromotions): Fix the case when
12691 we do a forcible conversion regardless of type, to check if
12692 ForceConversion returns a null.
12694 (Binary::error19): Use location to report error.
12696 (Unary::error23): Use location here too.
12698 * ../errors/cs0019.cs : Check in.
12700 * ../errors/cs0023.cs : Check in.
12702 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
12703 case of a non-null MethodInfo object with a length of 0 !
12705 (Binary::ResolveOperator): Flag error if overload resolution fails to find
12706 an applicable member - according to the spec :-)
12707 Also fix logic to find members in base types.
12709 (Unary::ResolveOperator): Same here.
12711 (Unary::report23): Change name to error23 and make first argument a TypeContainer
12712 as I was getting thoroughly confused between this and error19 :-)
12714 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
12715 (::FindMostEncompassedType): Implement.
12716 (::FindMostEncompassingType): Implement.
12717 (::StandardConversionExists): Implement.
12719 (UserImplicitCast): Re-vamp. We now need info about most specific
12720 source and target types so that we can do the necessary conversions.
12722 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
12723 mathematical union with no duplicates.
12725 2001-10-03 Miguel de Icaza <miguel@ximian.com>
12727 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
12728 in order from base classes to child classes, so that we can in
12729 child classes look up in our parent for method names and
12730 attributes (required for handling abstract, virtual, new, override
12731 constructs: we need to instrospect our base class, and if we dont
12732 populate the classes in order, the introspection might be
12733 incorrect. For example, a method could query its parent before
12734 the parent has any methods and would determine that the parent has
12735 no abstract methods (while it could have had them)).
12737 (RootContext::CreateType): Record the order in which we define the
12740 2001-10-02 Miguel de Icaza <miguel@ximian.com>
12742 * class.cs (TypeContainer::Populate): Also method definitions can
12743 fail now, keep track of this.
12745 (TypeContainer::FindMembers): Implement support for
12746 DeclaredOnly/noDeclaredOnly flag.
12748 (Constructor::Emit) Return the ConstructorBuilder.
12750 (Method::Emit) Return the MethodBuilder.
12751 Check for abstract or virtual methods to be public.
12753 * rootcontext.cs (RootContext::CreateType): Register all the
12754 abstract methods required for the class to be complete and the
12755 interface methods that must be implemented.
12757 * cs-parser.jay: Report error 501 (method requires body if it is
12758 not marked abstract or extern).
12760 * expression.cs (TypeOf::Emit): Implement.
12762 * typemanager.cs: runtime_handle_type, new global type.
12764 * class.cs (Property::Emit): Generate code for properties.
12766 2001-10-02 Ravi Pratap <ravi@ximian.com>
12768 * expression.cs (Unary::ResolveOperator): Find operators on base type
12769 too - we now conform exactly to the spec.
12771 (Binary::ResolveOperator): Same here.
12773 * class.cs (Operator::Define): Fix minor quirk in the tests.
12775 * ../errors/cs0215.cs : Added.
12777 * ../errors/cs0556.cs : Added.
12779 * ../errors/cs0555.cs : Added.
12781 2001-10-01 Miguel de Icaza <miguel@ximian.com>
12783 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
12784 single integer which is really efficient
12786 2001-10-01 Ravi Pratap <ravi@ximian.com>
12788 * expression.cs (Expression::ImplicitUserConversion): Use location
12789 even in the case when we are examining True operators.
12791 * class.cs (Operator::Define): Perform extensive checks to conform
12792 with the rules for operator overloading in the spec.
12794 * expression.cs (Expression::ImplicitReferenceConversion): Implement
12795 some of the other conversions mentioned in the spec.
12797 * typemanager.cs (array_type): New static member for the System.Array built-in
12800 (cloneable_interface): For System.ICloneable interface.
12802 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
12803 we start resolving the tree and populating types.
12805 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
12807 2001-10-01 Miguel de Icaza <miguel@ximian.com>
12809 * expression.cs (Expression::ExprClassFromMemberInfo,
12810 Expression::Literalize): Create literal expressions from
12811 FieldInfos which are literals.
12813 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
12814 type casts, because they were wrong. The test suite in tests
12817 (ImplicitNumericConversion): ushort to ulong requires a widening
12820 Int32 constant to long requires widening cast as well.
12822 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
12823 for integers because the type on the stack is not i4.
12825 2001-09-30 Miguel de Icaza <miguel@ximian.com>
12827 * expression.cs (report118): require location argument.
12829 * parameter.cs: Do not dereference potential null value.
12831 * class.cs: Catch methods that lack the `new' keyword when
12832 overriding a name. Report warnings when `new' is used without
12833 anything being there to override.
12835 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
12837 * class.cs: Only add constructor to hashtable if it is non-null
12838 (as now constructors can fail on define).
12840 (TypeManager, Class, Struct): Take location arguments.
12842 Catch field instance initialization in structs as errors.
12844 accepting_filter: a new filter for FindMembers that is static so
12845 that we dont create an instance per invocation.
12847 (Constructor::Define): Catch errors where a struct constructor is
12850 * cs-parser.jay: Pass location information for various new
12853 * delegate.cs (Delegate): take a location argument.
12855 * driver.cs: Do not call EmitCode if there were problesm in the
12856 Definition of the types, as many Builders wont be there.
12858 * decl.cs (Decl::Decl): Require a location argument.
12860 * cs-tokenizer.cs: Handle properly hex constants that can not fit
12861 into integers, and find the most appropiate integer for it.
12863 * literal.cs: Implement ULongLiteral.
12865 * rootcontext.cs: Provide better information about the location of
12866 failure when CreateType fails.
12868 2001-09-29 Miguel de Icaza <miguel@ximian.com>
12870 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
12873 * expression.cs (Binary::CheckShiftArguments): Add missing type
12875 (Binary::ResolveOperator): Add type to the logical and and logical
12876 or, Bitwise And/Or and Exclusive Or code paths, it was missing
12879 (Binary::DoNumericPromotions): In the case where either argument
12880 is ulong (and most signed types combined with ulong cause an
12881 error) perform implicit integer constant conversions as well.
12883 2001-09-28 Miguel de Icaza <miguel@ximian.com>
12885 * expression.cs (UserImplicitCast): Method should always be
12887 (Invocation::BetterConversion): Simplified test for IntLiteral.
12889 (Expression::ImplicitNumericConversion): Split this routine out.
12890 Put the code that performs implicit constant integer conversions
12893 (Expression::Resolve): Become a wrapper around DoResolve so we can
12894 check eclass and type being set after resolve.
12896 (Invocation::Badness): Remove this dead function
12898 (Binary::ResolveOperator): Do not compute the expensive argumnets
12899 unless we have a union for it.
12901 (Probe::Emit): Is needs to do an isinst and then
12902 compare against null.
12904 (::CanConvert): Added Location argument. If the Location argument
12905 is null (Location.Null), then we do not report errors. This is
12906 used by the `probe' mechanism of the Explicit conversion. We do
12907 not want to generate an error for something that the user
12908 explicitly requested to be casted. But the pipeline for an
12909 explicit cast first tests for potential implicit casts.
12911 So for now, if the Location is null, it means `Probe only' to
12912 avoid adding another argument. Might have to revise this
12915 (ClassCast): New class used to type cast objects into arbitrary
12916 classes (used in Explicit Reference Conversions).
12918 Implement `as' as well.
12920 Reverted all the patches from Ravi below: they were broken:
12922 * The use of `level' as a mechanism to stop recursive
12923 invocations is wrong. That was there just to catch the
12924 bug with a strack trace but not as a way of addressing
12927 To fix the problem we have to *understand* what is going
12928 on and the interactions and come up with a plan, not
12929 just get things going.
12931 * The use of the type conversion cache that I proposed
12932 last night had an open topic: How does this work across
12933 protection domains. A user defined conversion might not
12934 be public in the location where we are applying the
12935 conversion, a different conversion might be selected
12936 (ie, private A->B (better) but public B->A (worse),
12937 inside A, A->B applies, but outside it, B->A will
12940 * On top of that (ie, even if the above is solved),
12941 conversions in a cache need to be abstract. Ie, `To
12942 convert from an Int to a Short use an OpcodeCast', not
12943 `To convert from an Int to a Short use the OpcodeCast on
12944 the variable 5' (which is what this patch was doing).
12946 2001-09-28 Ravi Pratap <ravi@ximian.com>
12948 * expression.cs (Invocation::ConversionExists): Re-write to use
12949 the conversion cache
12951 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
12952 cache all conversions done, not just user-defined ones.
12954 (Invocation::BetterConversion): The real culprit. Use ConversionExists
12955 to determine if a conversion exists instead of acutually trying to
12956 perform the conversion. It's faster too.
12958 (Expression::ConvertExplicit): Modify to use ConversionExists to check
12959 and only then attempt the implicit conversion.
12961 2001-09-28 Ravi Pratap <ravi@ximian.com>
12963 * expression.cs (ConvertImplicit): Use a cache for conversions
12964 already found. Check level of recursion and bail out if necessary.
12966 2001-09-28 Miguel de Icaza <miguel@ximian.com>
12968 * typemanager.cs (string_concat_string_string, string_concat_object_object):
12969 Export standard methods that we expect for string operations.
12971 * statement.cs (Block::UsageWarning): Track usage of variables and
12972 report the errors for not used variables.
12974 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
12977 2001-09-27 Miguel de Icaza <miguel@ximian.com>
12979 * codegen.cs: remove unnneded code
12981 * expression.cs: Removed BuiltinTypeAccess class
12983 Fix the order in which implicit conversions are
12986 The previous fixed dropped support for boxed conversions (adding a
12987 test to the test suite now)
12989 (UserImplicitCast::CanConvert): Remove test for source being null,
12990 that code is broken. We should not feed a null to begin with, if
12991 we do, then we should track the bug where the problem originates
12992 and not try to cover it up here.
12994 Return a resolved expression of type UserImplicitCast on success
12995 rather than true/false. Ravi: this is what I was talking about,
12996 the pattern is to use a static method as a "constructor" for
12999 Also, do not create arguments until the very last minute,
13000 otherwise we always create the arguments even for lookups that
13001 will never be performed.
13003 (UserImplicitCast::Resolve): Eliminate, objects of type
13004 UserImplicitCast are born in a fully resolved state.
13006 * typemanager.cs (InitCoreTypes): Init also value_type
13007 (System.ValueType).
13009 * expression.cs (Cast::Resolve): First resolve the child expression.
13011 (LValue): Add new method AddressOf to be used by
13014 Change the argument of Store to take an EmitContext instead of an
13015 ILGenerator, because things like FieldExpr need to be able to call
13016 their children expression to generate the instance code.
13018 (Expression::Error, Expression::Warning): Sugar functions for
13021 (Expression::MemberLookup): Accept a TypeContainer instead of a
13022 Report as the first argument.
13024 (Expression::ResolvePrimary): Killed. I still want to improve
13025 this as currently the code is just not right.
13027 (Expression::ResolveMemberAccess): Simplify, but it is still
13030 (Unary::Resolve): Catch errors in AddressOf operators.
13032 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
13033 index to a byte for the short-version, or the compiler will choose
13034 the wrong Emit call, which generates the wrong data.
13036 (ParameterReference::Emit, ::Store): same.
13038 (FieldExpr::AddressOf): Implement.
13040 * typemanager.cs: TypeManager: made public variable instead of
13043 * driver.cs: document --fatal.
13045 * report.cs (ErrorMessage, WarningMessage): new names for the old
13046 Error and Warning classes.
13048 * cs-parser.jay (member_access): Turn built-in access to types
13049 into a normal simplename
13051 2001-09-27 Ravi Pratap <ravi@ximian.com>
13053 * expression.cs (Invocation::BetterConversion): Fix to cope
13054 with q being null, since this was introducing a bug.
13056 * expression.cs (ConvertImplicit): Do built-in conversions first.
13058 2001-09-27 Ravi Pratap <ravi@ximian.com>
13060 * expression.cs (UserImplicitCast::Resolve): Fix bug.
13062 2001-09-27 Ravi Pratap <ravi@ximian.com>
13064 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
13065 I had introduced long ago (what's new ?).
13067 * expression.cs (UserImplicitCast::CanConvert): Static method to do
13068 the work of all the checking.
13069 (ConvertImplicit): Call CanConvert and only then create object if necessary.
13070 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
13072 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
13073 that is the right way.
13075 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
13076 overloading resolution. Use everywhere instead of cutting and pasting code.
13078 (Binary::ResolveOperator): Use MakeUnionSet.
13080 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
13081 we have to convert to bool types. Not complete yet.
13083 2001-09-27 Miguel de Icaza <miguel@ximian.com>
13085 * typemanager.cs (TypeManager::CSharpName): support ushort.
13087 * expression.cs (Expression::TryImplicitIntConversion): Attempts
13088 to provide an expression that performsn an implicit constant int
13089 conversion (section 6.1.6).
13090 (Expression::ConvertImplicitRequired): Reworked to include
13091 implicit constant expression conversions.
13093 (Expression::ConvertNumericExplicit): Finished.
13095 (Invocation::Emit): If InstanceExpression is null, then it means
13096 that we perform a call on this.
13098 2001-09-26 Miguel de Icaza <miguel@ximian.com>
13100 * expression.cs (Unary::Emit): Remove some dead code.
13101 (Probe): Implement Resolve and Emit for `is'.
13102 (Expression::ConvertImplicitRequired): Attempt to do constant
13103 expression conversions here. Maybe should be moved to
13104 ConvertImplicit, but I am not sure.
13105 (Expression::ImplicitLongConstantConversionPossible,
13106 Expression::ImplicitIntConstantConversionPossible): New functions
13107 that tell whether is it possible to apply an implicit constant
13108 expression conversion.
13110 (ConvertNumericExplicit): Started work on explicit numeric
13113 * cs-parser.jay: Update operator constants.
13115 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
13116 (Parameters::GetSignature): Hook up VerifyArgs here.
13117 (Parameters::VerifyArgs): Verifies that no two arguments have the
13120 * class.cs (Operator): Update the operator names to reflect the
13121 ones that the spec expects (as we are just stringizing the
13124 * expression.cs (Unary::ResolveOperator): Fix bug: Use
13125 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
13126 previous usage did only work for our methods.
13127 (Expression::ConvertImplicit): Handle decimal implicit numeric
13128 conversions as well.
13129 (Expression::InternalTypeConstructor): Used to invoke constructors
13130 on internal types for default promotions.
13132 (Unary::Emit): Implement special handling for the pre/post
13133 increment/decrement for overloaded operators, as they need to have
13134 the same semantics as the other operators.
13136 (Binary::ResolveOperator): ditto.
13137 (Invocation::ConversionExists): ditto.
13138 (UserImplicitCast::Resolve): ditto.
13140 2001-09-26 Ravi Pratap <ravi@ximian.com>
13142 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
13143 operator, return after emitting body. Regression tests pass again !
13145 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
13146 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
13147 (Invocation::OverloadResolve): Ditto.
13148 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
13150 * everywhere : update calls to the above methods accordingly.
13152 2001-09-26 Miguel de Icaza <miguel@ximian.com>
13154 * assign.cs (Assign): Make it inherit from ExpressionStatement.
13156 * expression.cs (ExpressionStatement): New base class used for
13157 expressions that can appear in statements, so that we can provide
13158 an alternate path to generate expression that do not leave a value
13161 (Expression::Emit, and all the derivatives): We no longer return
13162 whether a value is left on the stack or not. Every expression
13163 after being emitted leaves a single value on the stack.
13165 * codegen.cs (EmitContext::EmitStatementExpression): Use the
13166 facilties of ExpressionStatement if possible.
13168 * cs-parser.jay: Update statement_expression.
13170 2001-09-25 Miguel de Icaza <miguel@ximian.com>
13172 * driver.cs: Change the wording of message
13174 2001-09-25 Ravi Pratap <ravi@ximian.com>
13176 * expression.cs (Binary::ResolveOperator): Had forgottten to set
13177 the type of the expression to the return type of the method if
13178 we have an overloaded operator match ! The regression tests pass again !
13179 (Unary::ResolveOperator): Ditto.
13181 * expression.cs (Invocation::ConversionExists): Correct the member lookup
13182 to find "op_Implicit", not "implicit" ;-)
13183 (UserImplicitCast): New class to take care of user-defined implicit conversions.
13184 (ConvertImplicit, ForceConversion): Take TypeContainer argument
13186 * everywhere : Correct calls to the above accordingly.
13188 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
13189 (ConvertImplicit): Do user-defined conversion if it exists.
13191 2001-09-24 Miguel de Icaza <miguel@ximian.com>
13193 * assign.cs: track location.
13194 (Resolve): Use implicit conversions on assignment.
13196 * literal.cs: Oops. Not good, Emit of short access values should
13197 pass (Bytes) or the wrong argument will be selected.
13199 * expression.cs (Unary::Emit): Emit code for -expr.
13201 (Unary::ResolveOperator): Handle `Substract' for non-constants
13202 (substract from zero from the non-constants).
13203 Deal with Doubles as well.
13205 (Expression::ConvertImplicitRequired): New routine that reports an
13206 error if no implicit conversion exists.
13208 (Invocation::OverloadResolve): Store the converted implicit
13209 expressions if we make them
13211 2001-09-24 Ravi Pratap <ravi@ximian.com>
13213 * class.cs (ConstructorInitializer): Take a Location argument.
13214 (ConstructorBaseInitializer): Same here.
13215 (ConstructorThisInitializer): Same here.
13217 * cs-parser.jay : Update all calls accordingly.
13219 * expression.cs (Unary, Binary, New): Take location argument.
13220 Update accordingly everywhere.
13222 * cs-parser.jay : Update all calls to the above to take a location
13225 * class.cs : Ditto.
13227 2001-09-24 Ravi Pratap <ravi@ximian.com>
13229 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
13230 (Invocation::BetterConversion): Same here
13231 (Invocation::ConversionExists): Ditto.
13233 (Invocation::ConversionExists): Implement.
13235 2001-09-22 Ravi Pratap <ravi@ximian.com>
13237 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
13238 Also take an additional TypeContainer argument.
13240 * All over : Pass in TypeContainer as argument to OverloadResolve.
13242 * typemanager.cs (CSharpName): Update to check for the string type and return
13245 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
13248 2001-09-21 Ravi Pratap <ravi@ximian.com>
13250 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
13251 (Invocation::BetterFunction): Implement.
13252 (Invocation::BetterConversion): Implement.
13253 (Invocation::ConversionExists): Skeleton, no implementation yet.
13255 Okay, things work fine !
13257 2001-09-21 Miguel de Icaza <miguel@ximian.com>
13259 * typemanager.cs: declare and load enum_type, delegate_type and
13262 * expression.cs (Expression::Emit): Now emit returns a value that
13263 tells whether a value is left on the stack or not. This strategy
13264 might be reveted tomorrow with a mechanism that would address
13265 multiple assignments.
13266 (Expression::report118): Utility routine to report mismatches on
13269 (Unary::Report23): Report impossible type/operator combination
13272 (Unary::IsIncrementableNumber): Whether the type can be
13273 incremented or decremented with add.
13274 (Unary::ResolveOperator): Also allow enumerations to be bitwise
13276 (Unary::ResolveOperator): Implement ++, !, ~,
13278 (Invocation::Emit): Deal with new Emit convetion.
13280 * All Expression derivatives: Updated their Emit method to return
13281 whether they leave values on the stack or not.
13283 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
13284 stack for expressions that are statements.
13286 2001-09-20 Miguel de Icaza <miguel@ximian.com>
13288 * expression.cs (LValue): New interface. Must be implemented by
13290 (LocalVariableReference, ParameterReference, FieldExpr): Implement
13293 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
13294 interface for generating code, simplifies the code.
13296 2001-09-20 Ravi Pratap <ravi@ximian.com>
13298 * expression.cs (everywhere): Comment out return statements in ::Resolve
13299 methods to avoid the warnings.
13301 2001-09-20 Miguel de Icaza <miguel@ximian.com>
13303 * driver.cs (parse): Report error 2001 if we can not open the
13306 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
13309 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
13312 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
13313 otherwise nested blocks end up with the same index.
13315 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
13317 * expression.cs: Instead of having FIXMEs in the Resolve
13318 functions, throw exceptions so it is obvious that we are facing a
13321 * cs-parser.jay (invocation_expression): Pass Location information.
13323 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
13324 Use a basename for those routines because .NET does not like paths
13327 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
13330 2001-09-19 Miguel de Icaza <miguel@ximian.com>
13332 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
13333 are loading the correct data types (throws an exception if not).
13334 (TypeManager::InitCoreTypes): Use CoreLookupType
13336 * expression.cs (Unary::ResolveOperator): return the child
13337 expression for expressions which are just +expr.
13338 (Unary::ResolveOperator): Return negative literals for -LITERAL
13339 expressions (otherwise they are Unary {Literal}).
13340 (Invocation::Badness): Take into account `Implicit constant
13341 expression conversions'.
13343 * literal.cs (LongLiteral): Implement long literal class.
13344 (IntLiteral): export the `Value' of the intliteral.
13346 2001-09-19 Ravi Pratap <ravi@ximian.com>
13348 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
13350 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
13351 instead of 'Operator'
13353 * expression.cs (Binary::ResolveOperator): Update accordingly.
13354 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
13357 * cs-parser.jay (unary_expression): Update to use the new names.
13359 * gen-treedump.cs (GetUnary): Same here.
13361 * expression.cs (Unary::Resolve): Implement.
13362 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
13363 operators are found instead of making noise ;-)
13364 (Unary::ResolveOperator): New method to do precisely the same thing which
13365 Binary::ResolveOperator does for Binary expressions.
13366 (Unary.method, .Arguments): Add.
13367 (Unary::OperName): Implement.
13368 (Unary::ForceConversion): Copy and Paste !
13370 * class.cs (Operator::Define): Fix a small bug for the case when we have
13373 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
13374 for the inbuilt operators. Only overloading works for now ;-)
13376 2001-09-18 Miguel de Icaza <miguel@ximian.com>
13378 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
13379 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
13381 * expression.cs (This::Emit): Implement.
13382 (This::Resolve): Implement.
13383 (TypeOf:Resolve): Implement.
13384 (Expression::ResolveSimpleName): Add an implicit this to instance
13386 (MemberAccess::Resolve): Deal with Parameters and Fields.
13387 Bind instance variable to Field expressions.
13388 (FieldExpr::Instance): New field used to track the expression that
13389 represents the object instance.
13390 (FieldExpr::Resolve): Track potential errors from MemberLookup not
13392 (FieldExpr::Emit): Implement.
13394 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
13395 the last instruction contains a return opcode to avoid generating
13396 the last `ret' instruction (this generates correct code, and it is
13397 nice to pass the peverify output).
13399 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
13400 initializer for static and instance variables.
13401 (Constructor::Emit): Allow initializer to be null in the case of
13402 static constructors. Only emit initializer for instance
13405 (TypeContainer::FindMembers): Return a null array if there are no
13408 Also fix the code for the MemberTypes.Method branch, as it was not
13409 scanning that for operators (or tried to access null variables before).
13411 * assign.cs (Assign::Emit): Handle instance and static fields.
13415 * driver.cs: Stop compilation if there are parse errors.
13417 * cs-parser.jay (constructor_declaration): Provide default base
13418 initializer for non-static constructors.
13419 (constructor_declarator): Do not provide a default base
13420 initializers if none was specified.
13421 Catch the fact that constructors should not have parameters.
13423 * class.cs: Do not emit parent class initializers for static
13424 constructors, that should be flagged as an error.
13426 2001-09-18 Ravi Pratap <ravi@ximian.com>
13428 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
13429 Move back code into TypeContainer::Populate.
13431 2001-09-18 Ravi Pratap <ravi@ximian.com>
13433 * class.cs (TypeContainer::AddConstructor): Fix the check to
13434 compare against Name, not Basename.
13435 (Operator::OpType): Change Plus and Minus to Add and Subtract.
13437 * cs-parser.jay : Update accordingly.
13439 * class.cs (TypeContainer::FindMembers): For the case where we are searching
13440 for methods, don't forget to look into the operators too.
13441 (RegisterMethodBuilder): Helper method to take care of this for
13442 methods, constructors and operators.
13443 (Operator::Define): Completely revamp.
13444 (Operator.OperatorMethod, MethodName): New fields.
13445 (TypeContainer::Populate): Move the registering of builders into
13446 RegisterMethodBuilder.
13447 (Operator::Emit): Re-write.
13449 * expression.cs (Binary::Emit): Comment out code path to emit method
13450 invocation stuff for the case when we have a user defined operator. I am
13451 just not able to get it right !
13453 2001-09-17 Miguel de Icaza <miguel@ximian.com>
13455 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
13458 (Expression::MemberLookup): Provide a version that allows to
13459 specify the MemberTypes and BindingFlags.
13461 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
13462 so it was not fetching variable information from outer blocks.
13464 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
13465 Beforefieldinit as it was buggy.
13467 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
13468 that Ravi put here.
13470 * class.cs (Constructor::Emit): Only emit if block is not null.
13471 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
13472 deal with this by semantically definining it as if the user had
13475 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
13476 constructors as we now "emit" them at a higher level.
13478 (TypeContainer::DefineDefaultConstructor): Used to define the
13479 default constructors if none was provided.
13481 (ConstructorInitializer): Add methods Resolve and Emit.
13483 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
13485 2001-09-17 Ravi Pratap <ravi@ximian.com>
13487 * class.cs (TypeContainer::EmitDefaultConstructor): Register
13488 the default constructor builder with our hashtable for methodbuilders
13491 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
13492 and argument_count is 0 in which case we have a match.
13493 (Binary::ResolveOperator): More null checking and miscellaneous coding
13496 2001-09-17 Ravi Pratap <ravi@ximian.com>
13498 * rootcontext.cs (IsNameSpace): Compare against null.
13500 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
13502 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
13503 and Unary::Operator.
13505 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
13508 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
13509 we have overloaded operators.
13510 (Binary::ResolveOperator): Implement the part which does the operator overload
13513 * class.cs (Operator::Emit): Implement.
13514 (TypeContainer::Emit): Emit the operators we have too.
13516 * expression.cs (Binary::Emit): Update to emit the appropriate code for
13517 the case when we have a user-defined operator.
13519 2001-09-17 Miguel de Icaza <miguel@ximian.com>
13521 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
13523 2001-09-16 Ravi Pratap <ravi@ximian.com>
13525 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
13526 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
13527 (Constructor::Emit): Implement.
13528 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
13529 if we have no work to do.
13530 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
13533 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
13534 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
13536 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
13539 2001-09-15 Ravi Pratap <ravi@ximian.com>
13541 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
13543 (Tree::RecordNamespace): Method to do what the name says ;-)
13544 (Tree::Namespaces): Property to get at the namespaces hashtable.
13546 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
13549 * rootcontext.cs (IsNamespace): Fixed it :-)
13551 2001-09-14 Miguel de Icaza <miguel@ximian.com>
13553 * class.cs (TypeContainer::FindMembers): Add support for
13555 (MethodCore): New class that encapsulates both the shared aspects
13556 of a Constructor and a Method.
13557 (Method, Constructor): Factored pieces into MethodCore.
13559 * driver.cs: Added --fatal which makes errors throw exceptions.
13560 Load System assembly as well as part of the standard library.
13562 * report.cs: Allow throwing exceptions on errors for debugging.
13564 * modifiers.cs: Do not use `parent', instead use the real type
13565 container to evaluate permission settings.
13567 * class.cs: Put Ravi's patch back in. He is right, and we will
13568 have to cope with the
13570 2001-09-14 Ravi Pratap <ravi@ximian.com>
13572 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
13573 FamORAssem, not FamANDAssem.
13575 2001-09-14 Miguel de Icaza <miguel@ximian.com>
13577 * driver.cs: Added --parse option that only parses its input files
13580 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
13581 incorrect. IsTopLevel is not used to tell whether an object is
13582 root_types or not (that can be achieved by testing this ==
13583 root_types). But to see if this is a top-level *class* (not
13584 necessarly our "toplevel" container).
13586 2001-09-14 Ravi Pratap <ravi@ximian.com>
13588 * enum.cs (Enum::Define): Modify to call the Lookup method on the
13589 parent instead of a direct call to GetType.
13591 2001-09-14 Ravi Pratap <ravi@ximian.com>
13593 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
13594 Modifiers.TypeAttr. This should just be a call to that method.
13596 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
13597 object so that we can determine if we are top-level or not.
13599 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
13602 * enum.cs (Enum::Define): Ditto.
13604 * modifiers.cs (FieldAttr): Re-write.
13606 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
13607 (TypeContainer::HaveStaticConstructor): New property to provide access
13608 to precisely that info.
13610 * modifiers.cs (MethodAttr): Re-write.
13611 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
13613 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
13614 of top-level types as claimed.
13616 2001-09-13 Miguel de Icaza <miguel@ximian.com>
13618 * expression.cs (MemberLookup): Fruitless attempt to lookup
13619 constructors. Maybe I need to emit default constructors? That
13620 might be it (currently .NET emits this for me automatically).
13621 (Invocation::OverloadResolve): Cope with Arguments == null.
13622 (Invocation::EmitArguments): new function, shared by the new
13623 constructor and us.
13624 (Invocation::Emit): Handle static and instance methods. Emit
13625 proper call instruction for virtual or non-virtual invocations.
13626 (New::Emit): Implement.
13627 (New::Resolve): Implement.
13628 (MemberAccess:Resolve): Implement.
13629 (MethodGroupExpr::InstanceExpression): used conforming to the spec
13630 to track instances.
13631 (FieldExpr::Resolve): Set type.
13633 * support.cs: Handle empty arguments.
13635 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
13636 SimpleLookup): Auxiliary routines to help parse a qualifier
13639 Update qualifier_identifier rule.
13641 * codegen.cs: Removed debugging messages.
13643 * class.cs: Make this a global thing, this acts just as a "key" to
13644 objects that we might have around.
13646 (Populate): Only initialize method_builders_to_methods once.
13648 * expression.cs (PropertyExpr): Initialize type from the
13651 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
13652 Resolve pattern. Attempt to implicitly convert value to boolean.
13655 * expression.cs: Set the type for the int32/int32 argument case.
13656 (Binary::ResolveOperator): Set the return type to boolean for
13657 comparission operators
13659 * typemanager.cs: Remove debugging print code.
13661 (Invocation::Resolve): resolve type.
13663 * class.cs: Allocate a MemberInfo of the correct size, as the code
13664 elsewhere depends on the test to reflect the correct contents.
13666 (Method::) Keep track of parameters, due to System.Reflection holes
13668 (TypeContainer::Populate): Keep track of MethodBuilders to Method
13671 (TypeContainer::FindMembers): Use ArrayList and then copy an array
13672 of the exact size and return that.
13674 (Class::LookupMethodByBuilder): New function that maps
13675 MethodBuilders to its methods. Required to locate the information
13676 on methods because System.Reflection bit us again.
13678 * support.cs: New file, contains an interface ParameterData and
13679 two implementations: ReflectionParameters and InternalParameters
13680 used to access Parameter information. We will need to grow this
13683 * expression.cs (Invocation::GetParameterData): implement a cache
13684 and a wrapper around the ParameterData creation for methods.
13685 (Invocation::OverloadResolve): Use new code.
13687 2001-09-13 Ravi Pratap <ravi@ximian.com>
13689 * class.cs (TypeContainer::EmitField): Remove and move into
13690 (Field::Define): here and modify accordingly.
13691 (Field.FieldBuilder): New member.
13692 (TypeContainer::Populate): Update accordingly.
13693 (TypeContainer::FindMembers): Implement.
13695 2001-09-13 Miguel de Icaza <miguel@ximian.com>
13697 * statement.cs: (VariableInfo::VariableType): New field to be
13698 initialized with the full type once it is resolved.
13700 2001-09-12 Miguel de Icaza <miguel@ximian.com>
13702 * parameter.cs (GetParameterInfo): Use a type cache to compute
13703 things only once, and to reuse this information
13705 * expression.cs (LocalVariableReference::Emit): Implement.
13706 (OpcodeCast::Emit): fix.
13708 (ParameterReference::Resolve): Implement.
13709 (ParameterReference::Emit): Implement.
13711 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
13712 that are expressions need to stay as Expressions.
13714 * typemanager.cs (CSharpName): Returns the C# name of a type if
13717 * expression.cs (Expression::ConvertImplicit): New function that
13718 implements implicit type conversions.
13720 (Expression::ImplicitReferenceConversion): Implements implicit
13721 reference conversions.
13723 (EmptyCast): New type for transparent casts.
13725 (OpcodeCast): New type for casts of types that are performed with
13726 a sequence of bytecodes.
13728 (BoxedCast): New type used for casting value types into reference
13729 types. Emits a box opcode.
13731 (Binary::DoNumericPromotions): Implements numeric promotions of
13732 and computation of the Binary::Type.
13734 (Binary::EmitBranchable): Optimization.
13736 (Binary::Emit): Implement code emission for expressions.
13738 * typemanager.cs (TypeManager): Added two new core types: sbyte
13741 2001-09-12 Ravi Pratap <ravi@ximian.com>
13743 * class.cs (TypeContainer::FindMembers): Method which does exactly
13744 what Type.FindMembers does, only we don't have to use reflection. No
13745 implementation yet.
13747 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
13748 typecontainer objects as we need to get at them.
13749 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
13751 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
13752 typecontainer object.
13754 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
13755 of just a Report object.
13757 2001-09-11 Ravi Pratap <ravi@ximian.com>
13759 * class.cs (Event::Define): Go back to using the prefixes "add_" and
13761 (TypeContainer::Populate): Now define the delegates of the type too.
13762 (TypeContainer.Delegates): Property to access the list of delegates defined
13765 * delegates.cs (Delegate::Define): Implement partially.
13767 * modifiers.cs (TypeAttr): Handle more flags.
13769 2001-09-11 Ravi Pratap <ravi@ximian.com>
13771 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
13773 (Operator::Define): Re-write logic to get types by using the LookupType method
13774 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
13775 (Indexer::Define): Ditto.
13776 (Event::Define): Ditto.
13777 (Property::Define): Ditto.
13779 2001-09-10 Ravi Pratap <ravi@ximian.com>
13781 * class.cs (TypeContainer::Populate): Now define operators too.
13782 (TypeContainer.Operators): New property to access the list of operators
13784 (Operator.OperatorMethodBuilder): New member to hold the method builder
13785 for the operator we are defining.
13786 (Operator::Define): Implement.
13788 2001-09-10 Ravi Pratap <ravi@ximian.com>
13790 * class.cs (Event::Define): Make the prefixes of the accessor methods
13791 addOn_ and removeOn_
13793 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
13794 of the location being passed in too. Ideally, this should go later since all
13795 error reporting should be done through the Report object.
13797 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
13798 (Populate): Iterate thru the indexers we have and define them too.
13799 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
13800 for the get and set accessors.
13801 (Indexer::Define): Implement.
13803 2001-09-09 Miguel de Icaza <miguel@ximian.com>
13805 * expression.cs (Binary::Resolve): Beginning of it. I scratched
13806 my previous implementation, did not work.
13808 * typemanager.cs: Add a couple of missing types (the longs).
13810 * literal.cs: Use TypeManager.bool_type instead of getting it.
13812 * expression.cs (EventExpr): New kind of expressions.
13813 (Expressio::ExprClassFromMemberInfo): finish
13815 2001-09-08 Miguel de Icaza <miguel@ximian.com>
13817 * assign.cs: Emit stores to static fields differently.
13819 2001-09-08 Ravi Pratap <ravi@ximian.com>
13821 * Merge in changes and adjust code to tackle conflicts. Backed out my
13822 code in Assign::Resolve ;-)
13824 2001-09-08 Ravi Pratap <ravi@ximian.com>
13826 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
13827 instead Report.Error and also pass in the location.
13828 (CSharpParser::Lexer): New readonly property to return the reference
13829 to the Tokenizer object.
13830 (declare_local_variables): Use Report.Error with location instead of plain
13834 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
13835 (Operator.CheckBinaryOperator): Ditto.
13837 * cs-parser.jay (operator_declarator): Update accordingly.
13839 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
13840 (CheckBinaryOperator): Same here.
13842 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
13843 on the name without any prefixes of namespace names etc. This is because we
13844 already might have something already fully qualified like
13845 'System.Console.WriteLine'
13847 * assign.cs (Resolve): Begin implementation. Stuck ;-)
13849 2001-09-07 Ravi Pratap <ravi@ximian.com>
13851 * cs-tokenizer.cs (location): Return a string which also contains
13854 * expression.cs (ElementAccess): New class for expressions of the
13855 type 'element access.'
13856 (BaseAccess): New class for expressions of the type 'base access.'
13857 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
13860 * cs-parser.jay (element_access): Implement action.
13861 (base_access): Implement actions.
13862 (checked_expression, unchecked_expression): Implement.
13864 * cs-parser.jay (local_variable_type): Correct and implement.
13865 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
13867 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
13869 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
13870 name and the specifiers.
13872 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
13874 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
13875 making them all public ;-)
13877 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
13880 2001-09-07 Miguel de Icaza <miguel@ximian.com>
13882 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
13884 (FieldExpr, PropertyExprs): New resolved expressions.
13885 (SimpleName::MemberStaticCheck): Perform static checks for access
13886 to non-static fields on static methods. Maybe this should be
13887 generalized for MemberAccesses.
13888 (SimpleName::ResolveSimpleName): More work on simple name
13891 * cs-parser.jay (primary_expression/qualified_identifier): track
13892 the parameter index.
13894 * codegen.cs (CodeGen::Save): Catch save exception, report error.
13895 (EmitContext::EmitBoolExpression): Chain to expression generation
13896 instead of temporary hack.
13897 (::EmitStatementExpression): Put generic expression code generation.
13899 * assign.cs (Assign::Emit): Implement variable assignments to
13900 local variables, parameters and fields.
13902 2001-09-06 Miguel de Icaza <miguel@ximian.com>
13904 * statement.cs (Block::GetVariableInfo): New method, returns the
13905 VariableInfo for a variable name in a block.
13906 (Block::GetVariableType): Implement in terms of GetVariableInfo
13908 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
13909 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
13911 2001-09-06 Ravi Pratap <ravi@ximian.com>
13913 * cs-parser.jay (operator_declaration): Continue on my quest : update
13914 to take attributes argument.
13915 (event_declaration): Ditto.
13916 (enum_declaration): Ditto.
13917 (indexer_declaration): Ditto.
13919 * class.cs (Operator::Operator): Update constructor accordingly.
13920 (Event::Event): Ditto.
13922 * delegate.cs (Delegate::Delegate): Same here.
13924 * enum.cs (Enum::Enum): Same here.
13926 2001-09-05 Ravi Pratap <ravi@ximian.com>
13928 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
13930 * ../tests/cs0658.cs : New file to demonstrate error 0658.
13932 * attribute.cs (Attributes): New class to encapsulate all attributes which were
13933 being passed around as an arraylist.
13934 (Attributes::AddAttribute): Method to add attribute sections.
13936 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
13937 (struct_declaration): Update accordingly.
13938 (constant_declaration): Update.
13939 (field_declaration): Update.
13940 (method_header): Update.
13941 (fixed_parameter): Update.
13942 (parameter_array): Ditto.
13943 (property_declaration): Ditto.
13944 (destructor_declaration): Ditto.
13946 * class.cs (Struct::Struct): Update constructors accordingly.
13947 (Class::Class): Ditto.
13948 (Field::Field): Ditto.
13949 (Method::Method): Ditto.
13950 (Property::Property): Ditto.
13951 (TypeContainer::OptAttribute): update property's return type.
13953 * interface.cs (Interface.opt_attributes): New member.
13954 (Interface::Interface): Update to take the extra Attributes argument.
13956 * parameter.cs (Parameter::Parameter): Ditto.
13958 * constant.cs (Constant::Constant): Ditto.
13960 * interface.cs (InterfaceMemberBase): New OptAttributes field.
13961 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
13962 the attributes as a parameter.
13963 (InterfaceProperty): Update constructor call.
13964 (InterfaceEvent): Ditto.
13965 (InterfaceMethod): Ditto.
13966 (InterfaceIndexer): Ditto.
13968 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
13969 pass the attributes too.
13970 (interface_event_declaration): Ditto.
13971 (interface_property_declaration): Ditto.
13972 (interface_method_declaration): Ditto.
13973 (interface_declaration): Ditto.
13975 2001-09-05 Miguel de Icaza <miguel@ximian.com>
13977 * class.cs (Method::Define): Track the "static Main" definition to
13978 create an entry point.
13980 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
13981 EntryPoint if we find it.
13983 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
13984 (EmitContext::ig): Make this variable public.
13986 * driver.cs: Make the default output file be the first file name
13987 with the .exe extension.
13989 Detect empty compilations
13991 Handle various kinds of output targets. Handle --target and
13992 rename -t to --dumper.
13994 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
13995 methods inherited from Expression return now an Expression. This
13996 will is used during the tree rewriting as we resolve them during
13999 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
14000 the spec. Missing entirely is the information about
14001 accessability of elements of it.
14003 (Expression::ExprClassFromMemberInfo): New constructor for
14004 Expressions that creates a fully initialized Expression based on
14005 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
14008 (Invocation::Resolve): Begin implementing resolution of invocations.
14010 * literal.cs (StringLiteral): Implement Emit.
14012 2001-09-05 Ravi Pratap <ravi@ximian.com>
14014 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
14017 2001-09-04 Ravi Pratap <ravi@ximian.com>
14019 * cs-parser.jay (attribute_arguments): Implement actions.
14020 (attribute): Fix bug in production. Implement action.
14021 (attribute_list): Implement.
14022 (attribute_target): Implement.
14023 (attribute_target_specifier, opt_target_specifier): Implement
14024 (CheckAttributeTarget): New method to check if the attribute target
14026 (attribute_section): Implement.
14027 (opt_attributes): Implement.
14029 * attribute.cs : New file to handle attributes.
14030 (Attribute): Class to hold attribute info.
14032 * cs-parser.jay (opt_attribute_target_specifier): Remove production
14033 (attribute_section): Modify production to use 2 different rules to
14034 achieve the same thing. 1 s/r conflict down !
14035 Clean out commented, useless, non-reducing dimension_separator rules.
14037 * class.cs (TypeContainer.attributes): New member to hold list
14038 of attributes for a type.
14039 (Struct::Struct): Modify to take one more argument, the attribute list.
14040 (Class::Class): Ditto.
14041 (Field::Field): Ditto.
14042 (Method::Method): Ditto.
14043 (Property::Property): Ditto.
14045 * cs-parser.jay (struct_declaration): Update constructor call to
14046 pass in the attributes too.
14047 (class_declaration): Ditto.
14048 (constant_declaration): Ditto.
14049 (field_declaration): Ditto.
14050 (method_header): Ditto.
14051 (fixed_parameter): Ditto.
14052 (parameter_array): Ditto.
14053 (property_declaration): Ditto.
14055 * constant.cs (Constant::Constant): Update constructor similarly.
14056 Use System.Collections.
14058 * parameter.cs (Parameter::Parameter): Update as above.
14060 2001-09-02 Ravi Pratap <ravi@ximian.com>
14062 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
14063 (TypeContainer.delegates): New member to hold list of delegates.
14065 * cs-parser.jay (delegate_declaration): Implement the action correctly
14066 this time as I seem to be on crack ;-)
14068 2001-09-02 Miguel de Icaza <miguel@ximian.com>
14070 * rootcontext.cs (RootContext::IsNamespace): new function, used to
14071 tell whether an identifier represents a namespace.
14073 * expression.cs (NamespaceExpr): A namespace expression, used only
14074 temporarly during expression resolution.
14075 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
14076 utility functions to resolve names on expressions.
14078 2001-09-01 Miguel de Icaza <miguel@ximian.com>
14080 * codegen.cs: Add hook for StatementExpressions.
14082 * class.cs: Fix inverted test for static flag in methods.
14084 2001-09-02 Ravi Pratap <ravi@ximian.com>
14086 * class.cs (Operator::CheckUnaryOperator): Correct error number used
14087 to make it coincide with MS' number.
14088 (Operator::CheckBinaryOperator): Ditto.
14090 * ../errors/errors.txt : Remove error numbers added earlier.
14092 * ../errors/cs1019.cs : Test case for error # 1019
14094 * ../errros/cs1020.cs : Test case for error # 1020
14096 * cs-parser.jay : Clean out commented cruft.
14097 (dimension_separators, dimension_separator): Comment out. Ostensibly not
14098 used anywhere - non-reducing rule.
14099 (namespace_declarations): Non-reducing rule - comment out.
14101 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
14102 with TypeContainer::AddEnum.
14104 * delegate.cs : New file for delegate handling classes.
14105 (Delegate): Class for declaring delegates.
14107 * makefile : Update.
14109 * cs-parser.jay (delegate_declaration): Implement.
14111 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
14113 * class.cs (Event::Define): Implement.
14114 (Event.EventBuilder): New member.
14116 * class.cs (TypeContainer::Populate): Update to define all enums and events
14118 (Events): New property for the events arraylist we hold. Shouldn't we move to using
14119 readonly fields for all these cases ?
14121 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
14123 * class.cs (Property): Revamp to use the convention of making fields readonly.
14124 Accordingly modify code elsewhere.
14126 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
14127 the Define method of the Property class.
14129 * class.cs : Clean up applied patch and update references to variables etc. Fix
14131 (TypeContainer::Populate): Update to define all the properties we have. Also
14132 define all enumerations.
14134 * enum.cs (Define): Implement.
14136 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
14138 * cs-parser.jay (overloadable_operator): The semantic value is an
14139 enum of the Operator class.
14140 (operator_declarator): Implement actions.
14141 (operator_declaration): Implement.
14143 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
14144 validity of definitions.
14145 (Operator::CheckBinaryOperator): Static method to check for binary operators
14146 (TypeContainer::AddOperator): New method to add an operator to a type.
14148 * cs-parser.jay (indexer_declaration): Added line to actually call the
14149 AddIndexer method so it gets added ;-)
14151 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
14152 already taken care of by the MS compiler ?
14154 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
14156 * class.cs (Operator): New class for operator declarations.
14157 (Operator::OpType): Enum for the various operators.
14159 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
14161 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
14162 ostensibly handle this in semantic analysis.
14164 * cs-parser.jay (general_catch_clause): Comment out
14165 (specific_catch_clauses, specific_catch_clause): Ditto.
14166 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
14167 (catch_args, opt_catch_args): New productions.
14168 (catch_clause): Rewrite to use the new productions above
14169 (catch_clauses): Modify accordingly.
14170 (opt_catch_clauses): New production to use in try_statement
14171 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
14172 and re-write the code in the actions to extract the specific and
14173 general catch clauses by being a little smart ;-)
14175 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
14176 Hooray, try and catch statements parse fine !
14178 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
14180 * statement.cs (Block::GetVariableType): Fix logic to extract the type
14181 string from the hashtable of variables.
14183 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
14184 I end up making that mistake ;-)
14185 (catch_clauses): Fixed gross error which made Key and Value of the
14186 DictionaryEntry the same : $1 !!
14188 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
14190 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
14192 * cs-parser.jay (event_declaration): Correct to remove the semicolon
14193 when the add and remove accessors are specified.
14195 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
14197 * cs-parser.jay (IndexerDeclaration): New helper class to hold
14198 information about indexer_declarator.
14199 (indexer_declarator): Implement actions.
14200 (parsing_indexer): New local boolean used to keep track of whether
14201 we are parsing indexers or properties. This is necessary because
14202 implicit_parameters come into picture even for the get accessor in the
14203 case of an indexer.
14204 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
14206 * class.cs (Indexer): New class for indexer declarations.
14207 (TypeContainer::AddIndexer): New method to add an indexer to a type.
14208 (TypeContainer::indexers): New member to hold list of indexers for the
14211 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
14213 * cs-parser.jay (add_accessor_declaration): Implement action.
14214 (remove_accessor_declaration): Implement action.
14215 (event_accessors_declaration): Implement
14216 (variable_declarators): swap statements for first rule - trivial.
14218 * class.cs (Event): New class to hold information about event
14220 (TypeContainer::AddEvent): New method to add an event to a type
14221 (TypeContainer::events): New member to hold list of events.
14223 * cs-parser.jay (event_declaration): Implement actions.
14225 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
14227 * cs-parser.jay (dim_separators): Implement. Make it a string
14228 concatenating all the commas together, just as they appear.
14229 (opt_dim_separators): Modify accordingly
14230 (rank_specifiers): Update accordingly. Basically do the same
14231 thing - instead, collect the brackets here.
14232 (opt_rank_sepcifiers): Modify accordingly.
14233 (array_type): Modify to actually return the complete type string
14234 instead of ignoring the rank_specifiers.
14235 (expression_list): Implement to collect the expressions
14236 (variable_initializer): Implement. We make it a list of expressions
14237 essentially so that we can handle the array_initializer case neatly too.
14238 (variable_initializer_list): Implement.
14239 (array_initializer): Make it a list of variable_initializers
14240 (opt_array_initializer): Modify accordingly.
14242 * expression.cs (New::NType): Add enumeration to help us
14243 keep track of whether we have an object/delegate creation
14244 or an array creation.
14245 (New:NewType, New::Rank, New::Indices, New::Initializers): New
14246 members to hold data about array creation.
14247 (New:New): Modify to update NewType
14248 (New:New): New Overloaded contructor for the array creation
14251 * cs-parser.jay (array_creation_expression): Implement to call
14252 the overloaded New constructor.
14254 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
14256 * class.cs (TypeContainer::Constructors): Return member
14257 constructors instead of returning null.
14259 2001-08-26 Miguel de Icaza <miguel@ximian.com>
14261 * typemanager.cs (InitCoreTypes): Initialize the various core
14262 types after we have populated the type manager with the user
14263 defined types (this distinction will be important later while
14264 compiling corlib.dll)
14266 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
14267 on Expression Classification. Now all expressions have a method
14268 `Resolve' and a method `Emit'.
14270 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
14271 generation from working. Also add some temporary debugging
14274 2001-08-24 Miguel de Icaza <miguel@ximian.com>
14276 * codegen.cs: Lots of code generation pieces. This is only the
14277 beginning, will continue tomorrow with more touches of polish. We
14278 handle the fundamentals of if, while, do, for, return. Others are
14279 trickier and I need to start working on invocations soon.
14281 * gen-treedump.cs: Bug fix, use s.Increment here instead of
14284 * codegen.cs (EmitContext): New struct, used during code
14285 emission to keep a context. Most of the code generation will be
14288 * cs-parser.jay: Add embedded blocks to the list of statements of
14289 this block. So code generation proceeds in a top down fashion.
14291 2001-08-23 Miguel de Icaza <miguel@ximian.com>
14293 * statement.cs: Add support for multiple child blocks.
14295 2001-08-22 Miguel de Icaza <miguel@ximian.com>
14297 * codegen.cs (EmitCode): New function, will emit the code for a
14298 Block of code given a TypeContainer and its ILGenerator.
14300 * statement.cs (Block): Standard public readonly optimization.
14301 (Block::Block constructors): Link children.
14302 (Block::Child): Child Linker.
14303 (Block::EmitVariables): Emits IL variable declarations.
14305 * class.cs: Drop support for MethodGroups here, delay until
14307 (Method::): Applied the same simplification that I did before, and
14308 move from Properties to public readonly fields.
14309 (Method::ParameterTypes): Returns the parameter types for the
14310 function, and implements a cache that will be useful later when I
14311 do error checking and the semantic analysis on the methods is
14313 (Constructor::GetCallingConvention): Renamed from CallingConvetion
14314 and made a method, optional argument tells whether this is a class
14315 or a structure to apply the `has-this' bit.
14316 (Method::GetCallingConvention): Implement, returns the calling
14318 (Method::Define): Defines the type, a second pass is performed
14319 later to populate the methods.
14321 (Constructor::ParameterTypes): implement a cache similar to the
14322 one on Method::ParameterTypes, useful later when we do semantic
14325 (TypeContainer::EmitMethod): New method. Emits methods.
14327 * expression.cs: Removed MethodGroup class from here.
14329 * parameter.cs (Parameters::GetCallingConvention): new method.
14331 2001-08-21 Miguel de Icaza <miguel@ximian.com>
14333 * class.cs (TypeContainer::Populate): Drop RootContext from the
14336 (Constructor::CallingConvention): Returns the calling convention.
14337 (Constructor::ParameterTypes): Returns the constructor parameter
14340 (TypeContainer::AddConstructor): Keep track of default constructor
14341 and the default static constructor.
14343 (Constructor::) Another class that starts using `public readonly'
14344 instead of properties.
14346 (Constructor::IsDefault): Whether this is a default constructor.
14348 (Field::) use readonly public fields instead of properties also.
14350 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
14351 track of static constructors; If none is used, turn on
14352 BeforeFieldInit in the TypeAttributes.
14354 * cs-parser.jay (opt_argument_list): now the return can be null
14355 for the cases where there are no arguments.
14357 (constructor_declarator): If there is no implicit `base' or
14358 `this', then invoke the default parent constructor.
14360 * modifiers.cs (MethodAttr): New static function maps a set of
14361 modifiers flags into a MethodAttributes enum
14362 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
14363 MethodAttr, TypeAttr to represent the various mappings where the
14364 modifiers are used.
14365 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
14367 2001-08-19 Miguel de Icaza <miguel@ximian.com>
14369 * parameter.cs (GetParameterInfo): Fix bug where there would be no
14372 * interface.cs (PopulateIndexer): Implemented the code generator
14373 for interface indexers.
14375 2001-08-17 Miguel de Icaza <miguel@ximian.com>
14377 * interface.cs (InterfaceMemberBase): Now we track the new status
14380 (PopulateProperty): Implement property population. Woohoo! Got
14381 Methods and Properties going today.
14383 Removed all the properties for interfaces, and replaced them with
14384 `public readonly' fields.
14386 2001-08-16 Miguel de Icaza <miguel@ximian.com>
14388 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
14389 initialize their hashtables/arraylists only when they are needed
14390 instead of doing this always.
14392 * parameter.cs: Handle refs and out parameters.
14394 * cs-parser.jay: Use an ArrayList to construct the arguments
14395 instead of the ParameterCollection, and then cast that to a
14398 * parameter.cs: Drop the use of ParameterCollection and use
14399 instead arrays of Parameters.
14401 (GetParameterInfo): Use the Type, not the Name when resolving
14404 2001-08-13 Miguel de Icaza <miguel@ximian.com>
14406 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
14407 and instead use public readonly fields.
14409 * class.cs: Put back walking code for type containers.
14411 2001-08-11 Miguel de Icaza <miguel@ximian.com>
14413 * class.cs (MakeConstant): Code to define constants.
14415 * rootcontext.cs (LookupType): New function. Used to locate types
14418 2001-08-08 Miguel de Icaza <miguel@ximian.com>
14420 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
14421 this System.Reflection code is. Kudos to Microsoft
14423 * typemanager.cs: Implement a type cache and avoid loading all
14424 types at boot time. Wrap in LookupType the internals. This made
14425 the compiler so much faster. Wow. I rule!
14427 * driver.cs: Make sure we always load mscorlib first (for
14428 debugging purposes, nothing really important).
14430 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
14431 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
14433 * rootcontext.cs: Lookup types on their namespace; Lookup types
14434 on namespaces that have been imported using the `using' keyword.
14436 * class.cs (TypeContainer::TypeAttr): Virtualize.
14437 (Class::TypeAttr): Return attributes suitable for this bad boy.
14438 (Struct::TypeAttr): ditto.
14439 Handle nested classes.
14440 (TypeContainer::) Remove all the type visiting code, it is now
14441 replaced with the rootcontext.cs code
14443 * rootcontext.cs (GetClassBases): Added support for structs.
14445 2001-08-06 Miguel de Icaza <miguel@ximian.com>
14447 * interface.cs, statement.cs, class.cs, parameter.cs,
14448 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
14449 Drop use of TypeRefs, and use strings instead.
14451 2001-08-04 Miguel de Icaza <miguel@ximian.com>
14455 * class.cs (Struct::Struct): set the SEALED flags after
14456 checking the modifiers.
14457 (TypeContainer::TypeAttr): new property, returns the
14458 TypeAttributes for a class.
14460 * cs-parser.jay (type_list): Oops, list production was creating a
14461 new list of base types.
14463 * rootcontext.cs (StdLib): New property.
14464 (GetInterfaceTypeByName): returns an interface by type name, and
14465 encapsulates error handling here.
14466 (GetInterfaces): simplified.
14467 (ResolveTree): Encapsulated all the tree resolution here.
14468 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
14471 * driver.cs: Add support for --nostdlib, to avoid loading the
14472 default assemblies.
14473 (Main): Do not put tree resolution here.
14475 * rootcontext.cs: Beginning of the class resolution.
14477 2001-08-03 Miguel de Icaza <miguel@ximian.com>
14479 * rootcontext.cs: Provide better error reporting.
14481 * cs-parser.jay (interface_base): set our $$ to be interfaces.
14483 * rootcontext.cs (CreateInterface): Handle the case where there
14484 are no parent interfaces.
14486 (CloseTypes): Routine to flush types at the end.
14487 (CreateInterface): Track types.
14488 (GetInterfaces): Returns an array of Types from the list of
14489 defined interfaces.
14491 * typemanager.c (AddUserType): Mechanism to track user types (puts
14492 the type on the global type hash, and allows us to close it at the
14495 2001-08-02 Miguel de Icaza <miguel@ximian.com>
14497 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
14498 RecordInterface instead.
14500 * cs-parser.jay: Updated to reflect changes above.
14502 * decl.cs (Definition): Keep track of the TypeBuilder type that
14503 represents this type here. Not sure we will use it in the long
14504 run, but wont hurt for now.
14506 * driver.cs: Smaller changes to accomodate the new code.
14508 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
14511 * rootcontext.cs (CreateInterface): New method, used to create
14512 the System.TypeBuilder type for interfaces.
14513 (ResolveInterfaces): new entry point to resolve the interface
14515 (CodeGen): Property, used to keep track of the code generator.
14517 2001-07-26 Miguel de Icaza <miguel@ximian.com>
14519 * cs-parser.jay: Add a second production for delegate_declaration
14522 (enum_body): Put an opt_comma here instead of putting it on
14523 enum_body or enum_member_declarations so we can handle trailing
14524 commas on enumeration members. Gets rid of a shift/reduce.
14526 (type_list): Need a COMMA in the middle.
14528 (indexer_declaration): Tell tokenizer to recognize get/set
14530 * Remove old targets.
14532 * Re-add the parser target.
14534 2001-07-13 Simon Cozens <simon@simon-cozens.org>
14536 * cs-parser.jay: Add precendence rules for a number of operators
14537 ot reduce the number of shift/reduce conflicts in the grammar.
14539 2001-07-17 Miguel de Icaza <miguel@ximian.com>
14541 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
14544 Get rid of old crufty code.
14546 * rootcontext.cs: Use this to keep track of the parsed
14547 representation and the defined types available to the program.
14549 * gen-treedump.cs: adjust for new convention.
14551 * type.cs: Split out the type manager, and the assembly builder
14554 * typemanager.cs: the type manager will live here now.
14556 * cil-codegen.cs: And the code generator here.
14558 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
14560 * makefile: Fixed up for easy making.
14562 2001-07-13 Simon Cozens <simon@simon-cozens.org>
14564 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
14567 (unary_expression): Expand pre_increment_expression and
14568 post_decrement_expression to reduce a shift/reduce.
14570 2001-07-11 Simon Cozens
14572 * cs-tokenizer.cs: Hex numbers should begin with a 0.
14574 Improve allow_keyword_as_indent name.
14576 2001-06-19 Miguel de Icaza <miguel@ximian.com>
14578 * Adjustments for Beta2.
14580 2001-06-13 Miguel de Icaza <miguel@ximian.com>
14582 * decl.cs: Added `Define' abstract method.
14583 (InTransit): new property, used to catch recursive definitions.
14585 * interface.cs: Implement `Define'.
14587 * modifiers.cs: Map Modifiers.constants to
14588 System.Reflection.TypeAttribute flags.
14590 * class.cs: Keep track of types and user-defined types.
14591 (BuilderInit): New method for creating an assembly
14592 (ResolveType): New function to launch the resolution process, only
14593 used by interfaces for now.
14595 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
14596 that are inserted into the name space.
14598 2001-06-08 Miguel de Icaza <miguel@ximian.com>
14600 * ARGH. I have screwed up my tree so many times due to the use of
14601 rsync rather than using CVS. Going to fix this at once.
14603 * driver.cs: Objetify driver. Load assemblies, use assemblies to
14606 2001-06-07 Miguel de Icaza <miguel@ximian.com>
14608 * Experiment successful: Use System.Type rather that our own
14611 2001-05-25 Miguel de Icaza <miguel@ximian.com>
14613 * cs-parser.jay: Removed nsAliases from here.
14615 Use new namespaces, handle `using XXX;'
14617 * namespace.cs: Reimplemented namespace handling, use a recursive
14618 definition of the class. Now we can keep track of using clauses
14619 and catch invalid using clauses.
14621 2001-05-24 Miguel de Icaza <miguel@ximian.com>
14623 * gen-treedump.cs: Adapted for all the renaming.
14625 * expression.cs (Expression): this class now has a Type property
14626 which returns an expression Type.
14628 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
14629 `Type', as this has a different meaning now in the base
14631 2001-05-22 Miguel de Icaza <miguel@ximian.com>
14633 * interface.cs, class.cs: Removed from all the sources the
14634 references to signature computation, as we can not do method
14635 signature computation during the parsing time, as we are not
14636 trying to solve at that point distinguishing:
14640 void a (NS.Blah x) {}
14643 Which depending on the context might be valid or not, as we do not
14644 know if Blah is the same thing as NS.Blah at that point.
14646 * Redid everything so the code uses TypeRefs now instead of
14647 Types. TypeRefs are just temporary type placeholders, that need
14648 to be resolved. They initially have a pointer to a string and the
14649 current scope in which they are used. This is used later by the
14650 compiler to resolve the reference to an actual Type.
14652 * DeclSpace is no longer a CIR.Type, and neither are
14653 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
14654 are all DeclSpaces, but no Types.
14656 * type.cs (TypeRefManager): This implements the TypeRef manager,
14657 which keeps track of all the types that need to be resolved after
14658 the parsing has finished.
14660 2001-05-13 Miguel de Icaza <miguel@ximian.com>
14662 * ARGH. We are going to have to store `foreach' as a class rather
14663 than resolving it, as we need to verify error 1579 after name
14664 resolution. *OR* we could keep a flag that says `This request to
14665 IEnumerator comes from a foreach statement' which we can then use
14666 to generate the error.
14668 2001-05-10 Miguel de Icaza <miguel@ximian.com>
14670 * class.cs (TypeContainer.AddMethod): we now add methods to the
14671 MethodGroup instead of the method hashtable.
14673 * expression.cs: Add MethodGroup abstraction, which gets us one
14674 step closer to the specification in the way we handle method
14677 * cs-parser.jay (primary_expression): qualified_identifier now
14678 tried to match up an identifier to a local variable reference or
14679 to a parameter reference.
14681 current_local_parameters is now a parser global variable that
14682 points to the current parameters for the block, used during name
14685 (property_declaration): Now creates an implicit `value' argument to
14688 2001-05-09 Miguel de Icaza <miguel@ximian.com>
14690 * parameter.cs: Do not use `param' arguments as part of the
14691 signature, per the spec.
14693 2001-05-08 Miguel de Icaza <miguel@ximian.com>
14695 * decl.cs: Base class for classes, structs and interfaces. This
14696 is the "Declaration Space"
14698 * cs-parser.jay: Use CheckDef for checking declaration errors
14699 instead of having one on each function.
14701 * class.cs: Factor out some code for handling error handling in
14702 accordance to the "Declarations" section in the "Basic Concepts"
14703 chapter in the ECMA C# spec.
14705 * interface.cs: Make all interface member classes derive from
14706 InterfaceMemberBase.
14708 2001-05-07 Miguel de Icaza <miguel@ximian.com>
14710 * Many things: all interfaces are parsed and generated in
14711 gen-treedump. Support for member variables, constructors,
14712 destructors, properties, constants is there.
14714 Beginning of the IL backend, but very little done, just there for
14717 2001-04-29 Miguel de Icaza <miguel@ximian.com>
14719 * cs-parser.jay: Fix labeled statement.
14721 * cs-tokenizer.cs (escape): Escape " and ' always.
14722 ref_line, ref_name: keep track of the line/filename as instructed
14723 by #line by the compiler.
14726 2001-04-27 Miguel de Icaza <miguel@ximian.com>
14728 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
14729 to match the values in System.CodeDOM.
14731 Divid renamed to Divide.
14733 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
14735 (Statements.set): remove.
14737 * System.CodeDOM/CodeCatchClause.cs: always have a valid
14740 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
14741 falseStatements always have valid values.
14743 * cs-parser.jay: Use System.CodeDOM now.