1 2004-09-13 Marek Safar <marek.safar@seznam.cz>
3 * class.cs (MethodCore.CheckBase): Fix bug #65757.
5 2004-09-12 Marek Safar <marek.safar@seznam.cz>
7 * attribute.cs (Attribute.Resolve): Add error 653 report.
9 * class.cs (Class.ApplyAttributeBuilder): Add error 641
11 (Method.ApplyAttributeBuilder): Add error 685 report.
12 (Operator.Define): Add error 564 report.
14 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
16 * expression.cs (Invocation.DoResolve): Add error
19 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
22 2004-09-11 Marek Safar <marek.safar@seznam.cz>
24 * class.cs (ConstructorInitializer.Resolve):
25 Wrong error number (515->516).
27 2004-09-11 Marek Safar <marek.safar@seznam.cz>
29 * class.cs (Indexer.Define): Add error 631 report.
31 2004-09-11 Marek Safar <marek.safar@seznam.cz>
33 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
35 2004-09-11 Marek Safar <marek.safar@seznam.cz>
37 * expression.cs (Probe.DoResolve): Add error CS0241 report.
39 2004-09-10 Marek Safar <marek.safar@seznam.cz>
41 * cs-parser.jay: Added error CS0241 report.
43 2004-09-10 Raja R Harinath <rharinath@novell.com>
45 * cs-parser.jay (fixed_statement): Introduce a scope for the
46 declaration in the 'fixed' statement.
48 2004-09-09 Marek Safar <marek.safar@seznam.cz>
50 * cs-parser.jay: Added CS0230 error report.
52 2004-09-09 Marek Safar <marek.safar@seznam.cz>
54 * cs-parser.jay: Added errors CS0231 and CS0257 report.
56 2004-09-09 Marek Safar <marek.safar@seznam.cz>
58 * expression.cs (Argument.Resolve): Added error CS0192 and
61 2004-09-09 Marek Safar <marek.safar@seznam.cz>
63 C# 2.0 #pragma warning feature
65 * cs-tokenizer.cs (PreProcessPragma): New method;
66 Handles #pragma directive.
68 * report.cs (WarningRegions): New class; Support
69 class for #pragma warning directive. It tests whether
70 warning is enabled for a given line.
72 2004-09-08 Miguel de Icaza <miguel@ximian.com>
74 * const.cs: Add more descriptive error report, tahnks to
77 2004-09-08 Marek Safar <marek.safar@seznam.cz>
79 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
81 2004-09-07 Miguel de Icaza <miguel@ximian.com>
83 * expression.cs: Apply patch from Ben: Remove dead code from
84 ArrayCreation, and remove the TurnintoConstant call in const.cs,
85 as that code just threw an exception anwyays.
87 * const.cs: Remove the call to the turnintoconstant, for details
90 * literal.cs: The type of the null-literal is the null type; So
91 we use a placeholder type (literal.cs:System.Null, defined here)
94 * expression.cs (Conditional.DoResolve): Remove some old code that
95 is no longer needed, conversions have been fixed.
97 (ArrayCreationExpression.DoResolve): Return false if we fail to
98 resolve the inner expression.
100 2004-09-07 Raja R Harinath <rharinath@novell.com>
103 * cs-parser.jay (delegate_declaration): Record a delegate
104 declaration as a type declaration.
105 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
107 2004-09-06 Miguel de Icaza <miguel@ximian.com>
109 * parameter.cs: Do not crash if the type can not be resolved.
111 * expression.cs: Report errors with unsafe pointers, fixes #64896
113 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
115 * expression.cs: Pointer arith always needs to do a conv.i
116 if the operand is a long. fix 65320
118 2004-09-04 Marek Safar <marek.safar@seznam.cz>
120 Fixed cs0619-37.cs, cs0619-38.cs
122 * enum.cs (GetObsoleteAttribute): Removed.
124 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
125 on Enum member is double staged. The first is tested member
128 2004-09-04 Marek Safar <marek.safar@seznam.cz>
130 Fixed #56986, #63631, #65231
132 * class.cs: (TypeContainer.AddToMemberContainer): New method,
133 adds member to name container.
134 (TypeContainer.AddToTypeContainer): New method, adds type to
136 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
137 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
138 AddOperator): Simplified by reusing AddToMemberContainer.
139 (TypeContainer.UserDefinedStaticConstructor): Changed to property
141 (Method.CheckForDuplications): Fixed implementation to test all
143 (MemberBase): Detection whether member is explicit interface
144 implementation is now in constructor.
145 (MemberBase.UpdateMemberName): Handles IndexerName.
146 (Accessor): Changed to keep also location information.
147 (AbstractPropertyEventMethod): Is derived from MemberCore.
148 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
149 will be emited or not.
150 (PropertyBase.AreAccessorsDuplicateImplementation):
151 Tests whether accessors are not in collision with some method.
152 (Operator): Is derived from MethodCore to simplify common
155 * decl.cs (Flags.TestMethodDuplication): Test for duplication
157 (DeclSpace.AddToContainer): Adds the member to defined_names
158 table. It tests for duplications and enclosing name conflicts.
160 * enum.cs (EnumMember): Clean up to reuse the base structures
162 2004-09-03 Martin Baulig <martin@ximian.com>
164 Merged latest changes into gmcs. Please keep this comment in
165 here, it makes it easier for me to see what changed in MCS since
166 the last time I merged.
168 2004-09-03 Martin Baulig <martin@ximian.com>
170 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
171 into TypeContainer, to make partial classes work again.
173 2004-09-03 Martin Baulig <martin@ximian.com>
175 * rootcontext.cs (RootContext.V2): Removed.
177 2004-03-23 Martin Baulig <martin@ximian.com>
179 * expression.cs (Invocation.OverloadResolve): Added `bool
180 may_fail' argument and use it instead of the Location.IsNull() hack.
182 2004-09-09 Martin Baulig <martin@ximian.com>
184 * cs-parser.jay (namespace_declaration): Fixed CS0134 reporting.
186 2004-09-09 Martin Baulig <martin@ximian.com>
188 * generic.cs (TypeParameter.DefineType): Added support for
189 explicit interface methods.
191 2004-09-09 Martin Baulig <martin@ximian.com>
193 * README.Changes: New document. Started to list important changes
194 between MCS and GMCS here.
196 2004-09-08 Martin Baulig <martin@ximian.com>
199 (TypeContainer.CheckRecursiveDefinition): New protected method.
200 (TypeContainer.DefineType): Move the CS0146 check into
201 CheckRecursiveDefinition().
203 2004-09-06 Martin Baulig <martin@ximian.com>
205 * generic.cs (ConstructedType.CheckConstraints): Allow builtin
206 types for the constructor constraint.
208 2004-09-03 Martin Baulig <martin@ximian.com>
210 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
211 into TypeContainer, to make partial classes work again.
213 2004-09-03 Martin Baulig <martin@ximian.com>
215 * rootcontext.cs (RootContext.V2): Removed.
217 2004-03-23 Martin Baulig <martin@ximian.com>
219 * expression.cs (Invocation.OverloadResolve): Added `bool
220 may_fail' argument and use it instead of the Location.IsNull() hack.
222 2004-09-03 Martin Baulig <martin@ximian.com>
224 Merged latest changes into gmcs. Please keep this comment in
225 here, it makes it easier for me to see what changed in MCS since
226 the last time I merged.
228 2004-09-03 Raja R Harinath <rharinath@novell.com>
231 * expression.cs (BetterConversion): Don't allow either conversion
232 to be null. Remove redundant implicit conversion test when 'q ==
233 null' -- when this function is invoked, we already know that the
234 implicit conversion exists.
235 (BetterFunction): Assume that 'best' is non-null. Remove
236 redundant reimplementation of IsApplicable when 'best' is null.
237 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
239 (IsAncestralType): Extract from OverloadResolve.
240 (OverloadResolve): Make robust to the MethodGroupExpr being
241 unsorted. Implement all the logic of Section 14.5.5.1, and
242 support overloading of methods from multiple applicable types.
243 Clean up logic somewhat. Don't pass null methods to BetterFunction.
245 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
246 (RealError, Warning): Append type of report to related symbol.
248 2004-09-03 Marek Safar <marek.safar@seznam.cz>
250 * enum.cs: Fixed CLS-Compliance checks for enum members.
251 Error tests cs3008-8.cs, cs3014-8.cs
253 2004-09-02 Marek Safar <marek.safar@seznam.cz>
255 Fixed bug #62342, #63102
256 * class.cs: ImplementIndexer uses member.IsExplicitImpl
257 like ImplementMethod.
259 2004-09-02 Marek Safar <marek.safar@seznam.cz>
261 * attribute.cs (Attribute.GetAttributeArgumentExpression):
264 2004-09-02 Martin Baulig <martin@ximian.com>
266 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
267 TypeManager.GetArgumentTypes() rather than calling GetParameters()
270 2004-09-01 Marek Safar <marek.safar@seznam.cz>
272 C# 2.0 Static classes implemented
274 * class.cs (TypeContainer): instance_constructors,
275 initialized_fields, initialized_static_fields,
276 default_constructor, base_inteface_types are protected to be
277 accessible from StaticClass.
278 (TypeContainer.DefineDefaultConstructor): New virtual method
279 for custom default constructor generating
280 (StaticClass): New class to handle "Static classes" feature.
282 * cs-parser.jay: Handle static keyword on class like instance
285 * driver.cs: Added "/langversion" command line switch with two
286 options (iso-1, default).
288 2004-08-31 Marek Safar <marek.safar@seznam.cz>
290 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
292 2004-08-31 Miguel de Icaza <miguel@ximian.com>
294 * delegate.cs: Style.
296 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
298 * delegate.cs: Add seperate instance expr field for miguel.
300 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
302 * PointerArithmetic (Resolve): make sure we are not doing
303 pointer arith on void*. Also, make sure we are resolved
304 by not setting eclass until resolve.
306 All callers: Make sure that PointerArithmetic gets resolved.
308 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
310 * ArrayCreation (LookupType): If the type does not resolve
311 to an array, give an error.
313 2004-08-27 Marek Safar <marek.safar@seznam.cz>
315 * statement.cs (Try.Resolve): Fixed bug #64222
317 2004-08-27 Martin Baulig <martin@ximian.com>
320 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
323 2004-08-26 Marek Safar <marek.safar@seznam.cz>
325 * ecore.cs (Constantify): Get underlying type via
326 System.Enum.GetUnderlyingType to avoid StackOverflow on the
327 Windows in special cases.
329 2004-08-26 Marek Safar <marek.safar@seznam.cz>
331 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
332 for obtaining also private methods.
333 (GetRemoveMethod): Used GetRemoveMethod (true)
334 for obtaining also private methods.
336 2004-09-02 Martin Baulig <martin@ximian.com>
338 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
339 TypeManager.GetArgumentTypes() rather than calling GetParameters()
342 2004-08-27 Martin Baulig <martin@ximian.com>
345 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
348 2004-08-25 Martin Baulig <martin@ximian.com>
350 * support.cs (ReflectionParameters..ctor): If this is a generic
351 method, retrieve and store its type parameters.
352 (InternalParameters..ctor): Added `TypeParameter[]' argument.
353 (ReflectionParameters.GenericConstraints): The argument specifies
354 the type parameter, not the method parameter.
355 (InternalParameters.GenericConstraints): Likewise.
357 * generic.cs (TypeParameter.DefineType): Correctly handle
358 constraints wrt. generic methods in interfaces and their
361 2004-08-24 Martin Baulig <martin@ximian.com>
363 * generic.cs (TypeParameter.IsSubclassOf): New public method.
364 (Constraints.IsSubclassOf): New internal method.
366 * typemanager.cs (TypeManager.FindMembers): Added special support
367 for GenericTypeParameterBuilder's.
368 (TypeManager.IsSubclassOf, IsFamilyAccessible): Added support for
371 2004-08-24 Martin Baulig <martin@ximian.com>
374 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
375 this for accessibility checks.
376 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
377 IsNestedFamilyAccessible.
378 (TypeManager.IsSubclassOf): New method, do what the name actually
381 2004-08-24 Martin Baulig <martin@ximian.com>
383 * expression.cs (MemberAccess.DoResolve): When resolving ourselves
384 as a SimpleName, include the generic arity.
386 2004-08-24 Martin Baulig <martin@ximian.com>
388 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
389 MethodAttributes.HideBySig for operators.
391 2004-08-23 Martin Baulig <martin@ximian.com>
393 Back to the old error reporting system :-)
395 * report.cs (Message): Removed.
396 (Report.MessageData, ErrorData, WarningData): Removed.
397 (Report.Error, Warning): Back to the old system.
399 2004-08-23 Martin Baulig <martin@ximian.com>
401 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
403 * class.cs (TypeContainer.ParentContainer): New public virtual
404 method; replaces the explicit interface implementation.
405 (ClassPart.ParentContainer): Override.
407 2004-08-23 Martin Baulig <martin@ximian.com>
409 * statement.cs (Switch): Added support for constant switches; see
410 #59428 or test-285.cs.
412 2004-08-22 Marek Safar <marek.safar@seznam.cz>
415 * statement.cs (GetEnumeratorFilter): Removed useless
416 logic because C# specs is strict. GetEnumerator must be
419 2004-08-22 Martin Baulig <martin@ximian.com>
421 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
422 a switch and may break, reset the barrier. Fixes #59867.
424 2004-08-22 Marek Safar <marek.safar@seznam.cz>
426 CLS-Compliance speed up (~5% for corlib)
428 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
429 New method. Tests container for CLS-Compliant names
431 * class.cs (TypeContainer.VerifyClsName): New method.
432 Checks whether container name is CLS Compliant.
433 (Constructor): Implements IMethodData.
435 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
436 low-case table for CLS Compliance test.
437 (MemberCache.VerifyClsParameterConflict): New method.
438 Checks method parameters for CS3006 error.
440 * enum.cs (EnumMember): Is derived from MemberCore.
441 (Enum.VerifyClsName): Optimized for better performance.
443 2004-08-06 Marek Safar <marek.safar@seznam.cz>
445 * report.cs: Renamed Error_T to Error and changed all
448 2004-08-06 Marek Safar <marek.safar@seznam.cz>
450 * class.cs (TypeContainer.IndexerArrayList): New inner class
451 container for indexers.
452 (TypeContainer.DefaultIndexerName): New constant for default
453 indexer name. Replaced all "Item" with this constant.
454 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
456 * typemanager.cs (TypeManager.default_member_ctor): Cache here
457 DefaultMemberAttribute constructor.
459 2004-08-05 Martin Baulig <martin@ximian.com>
461 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
464 2004-08-05 Marek Safar <marek.safar@seznam.cz>
466 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
467 multi platforms problem.
469 * compiler.csproj: Included shared files.
471 2004-08-04 Marek Safar <marek.safar@seznam.cz>
473 Fix bug 60333, 55971 in the more general way
474 * attribute.cs (Attribute.GetAttributeArgumentExpression):
475 Added arg_type argument for constant conversion.
476 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
478 2004-08-04 Marek Safar <marek.safar@seznam.cz>
481 * class.cs (TypeContainer ): New inner classes MethodArrayList,
482 OperatorArrayList, MethodCoreArrayList for typecontainer
483 containers. Changed class member types to these new types.
484 (MethodArrayList.DefineMembers): Added test for CS0659.
486 2004-08-04 Miguel de Icaza <miguel@ximian.com>
488 * cfold.cs: Synchronize the folding with the code in expression.cs
489 Binary.DoNumericPromotions for uint operands.
491 * attribute.cs: Revert patch from Raja, it introduced a regression
492 while building Blam-1.2.1 (hard to isolate a test case).
494 2004-08-04 Marek Safar <marek.safar@seznam.cz>
498 (TypeContainer.Define): Renamed to DefineContainerMembers because of
500 (MethodCore.parent_method): New member. The method we're overriding
501 if this is an override method.
502 (MethodCore.CheckBase): Moved from Method class and made common.
503 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
505 (MethodCore.CheckForDuplications): New abstract method. For custom
506 member duplication search in a container
507 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
508 method and its return type.
509 (Event.conflict_symbol): New member. Symbol with same name in the
513 (MemberCache.FindMemberWithSameName): New method. The method
514 is looking for conflict with inherited symbols.
516 2004-08-04 Martin Baulig <martin@ximian.com>
518 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
520 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
522 2004-08-03 Marek Safar <marek.safar@seznam.cz>
524 * report.cs (Message): New enum for better error, warning reference in
526 (MessageData): New inner abstract class. It generally handles printing of
527 error and warning messages.
528 Removed unused Error, Warning, Message methods.
530 2004-08-03 Marek Safar <marek.safar@seznam.cz>
532 Fix for cs0592-8.cs test
534 (Attributable.ValidAttributeTargets): Made public.
535 (Attribute.ExplicitTarget): New member for explicit target value.
536 (Attribute.CheckTargets): Now we translate explicit attribute
537 target to Target here.
539 2004-08-03 Ben Maurer <bmaurer@ximian.com>
541 * ecore.cs (MethodGroupExpr): new IsBase property.
543 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
545 * delegate.cs (DelegateCreation): store a MethodGroupExpr
546 rather than an instance expr.
548 (DelegateCreation.Emit): Use the method group rather than
549 the instance expression. Also, if you have base.Foo as the
550 method for a delegate, make sure to emit ldftn, not ldftnvirt.
552 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
554 (NewDelegate.DoResolve): Only check for the existance of Invoke
555 if the method is going to be needed. Use MethodGroupExpr.
557 (NewDelegate.Emit): Remove, DelegateCreation implements this.
559 * expression.cs: For pointer arith., make sure to use
560 the size of the type, not the size of the pointer to
563 2004-08-03 Marek Safar <marek.safar@seznam.cz>
566 * class.cs (Class): Added error CS0502 test.
568 2004-08-03 John Luke <jluke@cfl.rr.com>
569 Raja R Harinath <rharinath@novell.com>
572 * attribute.cs (Attribute.complained_before): New flag.
573 (Attribute.ResolveType, Attribute.Resolve),
574 (Attribute.DefinePInvokeMethod): Set it.
575 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
577 2004-08-03 Martin Baulig <martin@ximian.com>
579 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
580 use a user-defined operator; we still need to do numeric
581 promotions in case one argument is a builtin type and the other
582 one has an implicit conversion to that type. Fixes #62322.
584 2004-08-18 Martin Baulig <martin@ximian.com>
586 * class.cs (Method.Define): Use the correct method name when
587 creating the MethodBuilder for a generic method.
589 2004-08-17 Martin Baulig <martin@ximian.com>
591 * generic.cs (Constraints): Support type parameter constraints.
593 2004-08-16 Martin Baulig <martin@ximian.com>
595 * cs-tokenizer.cs (Tokenizer.TypeOfParsing): New public property.
596 (Token.GENERIC_DIMENSION): New token; this is returned if we
597 encounter an unbound generic type in a typeof() expression.
599 * cs-parser.jay (opt_type_argument_list): Added GENERIC_DIMENSION;
600 this token is only generated while parsing a typeof() expression.
601 (typeof_expression): Removed the old unbound_type hack.
603 * generic.cs (TypeArguments.IsUnbound): New public property.
605 * decl.cs (MemberName): Added support for unbound types.
607 2004-08-14 Martin Baulig <martin@ximian.com>
610 (TypeManager.IsEqualGenericInstance): New static method.
611 (TypeManager.IsSubclassOrNestedChildOf, IsSubclassOf): This is
612 just used to check accessibility, so follow the rules of 26.1.6.
614 * expression.cs (MemberAccess.ResolveAsTypeStep): Return a
615 ConstructedType instead of a TypeExpression if we have type arguments.
617 * cs-parser.jay (typeof_expression): Support unbound generic types.
619 * ecore.cs (UnboundTypeExpression): New public class.
621 2004-08-12 Martin Baulig <martin@ximian.com>
623 * typemanager.cs (TypeManager.IsNestedChildOf): Use
624 TypeManager.IsEqual() rather than `=='.
626 * decl.cs (DeclSpace.CheckAccessLevel): Use `tb.FullName' for
627 generic instances as well.
629 2004-08-12 Martin Baulig <martin@ximian.com>
631 * expression.cs (Invocation.InferType): We can only infer method
632 type parameters. Fixes #62647.
634 2004-08-11 Martin Baulig <martin@ximian.com>
636 * class.cs (TypeContainer.DefineType): Create the TypeBuilder
637 before resolving the base classes.
639 2004-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
641 * Makefile: install .mdb file too.
643 2004-08-05 Martin Baulig <martin@ximian.com>
645 * ecore.cs (FieldExpr.DoResolveLValue): If we're resolving a field
646 initializer, the current type is just the TypeBuilder, not the
647 instantiated generic type.
648 (FieldExpr.IsFieldInitializer): New public property.
650 2004-08-04 Martin Baulig <martin@ximian.com>
652 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
654 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
656 2004-08-03 Martin Baulig <martin@ximian.com>
658 * class.cs (MethodData.Define): If we're an explicit
659 implementation, remove the generic arity from the type name.
661 2004-08-03 Martin Baulig <martin@ximian.com>
663 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
664 use a user-defined operator; we still need to do numeric
665 promotions in case one argument is a builtin type and the other
666 one has an implicit conversion to that type. Fixes #62322.
668 2004-08-02 Martin Baulig <martin@ximian.com>
670 * class.cs (TypeContainer.ifaces): Make this a `Type[]', not a
672 (TypeContainer.GetClassBases): Return the unexpanded list of
673 interfaces; we expand them later.
674 (TypeContainer.DefineType): After creating the TypeBuilder, call
675 TypeManager.ExpandInterfaces() to get an expanded and resolved
678 * ecore.cs (TypeExpr.GetInterfaces): Removed
680 * generics.cs (Constraints.InterfaceConstraints): Remove.
681 (TypeParameter.DefineType): Call TypeManager.RegisterBuilder() to
682 register the interface constraints.
685 (TypeManager.AddUserType): Removed the `ifaces' argument.
686 (TypeManager.AddTypeParameter): Likewise.
687 (TypeManager.AddUserInterface): Removed, was unused.
688 (TypeManager.RegisterBuilder): Take a `Type[]' instead of a
689 `TypeExpr[]' array for the interfaces.
690 (TypeManager.ExpandInterfaces): Call this after the TypeBuilder
691 has been defined, returns a list of the resolved interfaces types.
692 (TypeManager.GetInterfaces): Return a `Type[]', not a `TypeExpr[]'.
693 (TypeManager.GetExplicitInterfaces): Likewise.
695 2004-08-02 Martin Baulig <martin@ximian.com>
697 * expression.cs (Invocation.EmitCall): If we're invoking a method
698 on a type parameter, use the new `Constrained' prefix opcode.
700 2004-08-02 Martin Baulig <martin@ximian.com>
702 * statement.cs (LocalInfo.Flags): Added `IsThis'.
703 (LocalInfo.IsThis): New public property.
704 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
706 2004-08-01 Martin Baulig <martin@ximian.com>
708 * class.cs (TypeContainer.GetClassBases): Don't set the default
709 here since we may get called from GetPartialBases().
710 (TypeContainer.DefineType): If GetClassBases() didn't return a
711 parent, use the default one.
713 2004-07-30 Martin Baulig <martin@ximian.com>
715 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
717 * class.cs (SourceMethod): New public class, derive from the
718 symbol writer's ISourceMethod.
719 (Method): Use the new symbol writer API.
721 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
722 as argument and use the new symbol writer.
725 (SourceFile): Implement the symbol writer's ISourceFile.
726 (Location.SymbolDocument): Removed.
727 (Location.SourceFile): New public property.
729 * symbolwriter.cs: Use the new symbol writer API.
731 2004-07-30 Raja R Harinath <rharinath@novell.com>
733 * Makefile (install-local): Remove. Functionality moved to
736 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
738 * Makefile: Install mcs.exe.config file together with mcs.exe.
739 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
740 correct runtime version.
742 2004-07-25 Martin Baulig <martin@ximian.com>
745 (TypeContainer.RegisterOrder): Removed, this was unused.
746 (TypeContainer, interface_order): Removed.
747 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
748 TypeContainer as argument since we can also be called with a
749 `PartialContainer' for a partial class/struct/interface.
750 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
751 of checking whether we're an `Interface' - we could be a
753 (PartialContainer.Register): Override; call
754 AddClass()/AddStruct()/AddInterface() on our parent.
756 * cs-parser.jay (interface_member_declaration): Add things to the
757 `current_container', not the `current_class'.
759 * rootcontext.cs (RegisterOrder): The overloaded version which
760 takes an `Interface' was unused, removed.
762 * typemanager.cs (TypeManager.LookupInterface): Return a
763 `TypeContainer', not an `Interface'.
764 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
765 contain a `PartialContainer' for an interface, so check it's
766 `Kind' to figure out what it is.
768 2004-07-25 Martin Baulig <martin@ximian.com>
770 * class.cs (Class.DefaultTypeAttributes): New public constant.
771 (Struct.DefaultTypeAttributes): Likewise.
772 (Interface.DefaultTypeAttributes): Likewise.
773 (PartialContainer.TypeAttr): Override this and add the
774 DefaultTypeAttributes.
776 2004-07-25 Martin Baulig <martin@ximian.com>
778 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
779 we can just use the `Parent' field instead.
781 2004-07-25 Martin Baulig <martin@ximian.com>
783 * class.cs (TypeContainer.Emit): Renamed to EmitType().
785 2004-07-25 Martin Baulig <martin@ximian.com>
787 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
788 our parts before defining any methods.
789 (TypeContainer.VerifyImplements): Make this virtual.
790 (ClassPart.VerifyImplements): Override and call VerifyImplements()
791 on our PartialContainer.
793 2004-07-25 Martin Baulig <martin@ximian.com>
795 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
797 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
798 argument, we can just use the `Parent' field instead.
801 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
802 (MemberBase.DoDefine): Likewise.
804 2004-07-24 Martin Baulig <martin@ximian.com>
806 * decl.cs (MemberCore.Parent): New public field.
807 (DeclSpace.Parent): Moved to MemberCore.
809 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
810 (MemberBase.ctor): Added TypeContainer argument, pass it to our
812 (FieldBase, Field, Operator): Likewise.
813 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
814 (EventField, Event): Likewise.
816 2004-07-23 Martin Baulig <martin@ximian.com>
818 * class.cs (PartialContainer): New public class.
819 (ClassPart): New public class.
820 (TypeContainer): Added support for partial classes.
821 (TypeContainer.GetClassBases): Splitted some of the functionality
822 out into GetNormalBases() and GetPartialBases().
824 * cs-tokenizer.cs (Token.PARTIAL): New token.
825 (Tokenizer.consume_identifier): Added some hacks to recognize
826 `partial', but only if it's immediately followed by `class',
827 `struct' or `interface'.
829 * cs-parser.jay: Added support for partial clases.
831 2004-07-23 Martin Baulig <martin@ximian.com>
833 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
834 a `DeclSpace' and also made it readonly.
835 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
836 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
837 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
839 * cs-parser.jay: Pass the `current_class', not the
840 `current_container' (at the moment, this is still the same thing)
841 to a new Method, Property, Event, Indexer or Constructor.
843 2004-07-23 Martin Baulig <martin@ximian.com>
845 * cs-parser.jay (CSharpParser): Added a new `current_class' field
846 and removed the `current_interface' one.
847 (struct_declaration, class_declaration, interface_declaration):
848 Set `current_class' to the newly created class/struct/interface;
849 set their `Bases' and call Register() before parsing their body.
851 2004-07-23 Martin Baulig <martin@ximian.com>
853 * class.cs (Kind): New public enum.
854 (TypeContainer): Made this class abstract.
855 (TypeContainer.Kind): New public readonly field.
856 (TypeContainer.CheckDef): New public method; moved here from
858 (TypeContainer.Register): New public abstract method.
859 (TypeContainer.GetPendingImplementations): New public abstract
861 (TypeContainer.GetClassBases): Removed the `is_class' and
862 `is_iface' parameters.
863 (TypeContainer.DefineNestedTypes): Formerly known as
865 (ClassOrStruct): Made this class abstract.
867 * tree.cs (RootTypes): New public type.
869 2004-07-20 Martin Baulig <martin@ximian.com>
871 * tree.cs (Tree.RecordNamespace): Removed.
872 (Tree.Namespaces): Removed.
874 * rootcontext.cs (RootContext.IsNamespace): Removed.
876 * cs-parser.jay (namespace_declaration): Just create a new
879 2004-07-21 Lluis Sanchez Gual <lluis@novell.com>
881 * Makefile: Install gmcs.exe.config file together with gmcs.exe.
882 * gmcs.exe.config: Renamed from mcs.exe.config. Added supportedRuntime
883 entry to make sure it runs in the correct runtime version.
885 2004-07-18 Martin Baulig <martin@ximian.com>
887 * generic.cs (ConstructedType.CheckConstraints): Improved
888 constraints checking.
890 2004-07-18 Martin Baulig <martin@ximian.com>
892 * expression.cs (Invocation.BetterMethod): Call
893 TypeManager.TypeToCoreType() on all types and removed my previous
894 hack; we're already doig the right thing here.
896 2004-07-17 Martin Baulig <martin@ximian.com>
898 * decl.cs (MemberName.MakeName): Create the "class`1" names here.
900 2004-07-16 Martin Baulig <martin@ximian.com>
902 * iterators.cs: Added generics support.
904 2004-07-16 Martin Baulig <martin@ximian.com>
906 * iterators.cs: Rewrote this. We're now using one single Proxy
907 class for both the IEnumerable and the IEnumerator interface and
908 `Iterator' derives from Class so we can use the high-level API.
910 * class.cs (TypeContainer.AddIterator): New method.
911 (TypeContainer.DoDefineType): New protected virtual method, which
912 is called from DefineType().
913 (TypeContainer.DoDefineMembers): Call DefineType() and
914 DefineMembers() on all our iterators.
915 (TypeContainer.Emit): Call Emit() on all our iterators.
916 (TypeContainer.CloseType): Call CloseType() on all our iterators.
918 * codegen.cs (EmitContext.CurrentIterator): New public field.
920 2004-07-15 Martin Baulig <martin@ximian.com>
923 (TypeManager.not_supported_exception_type): New type.
925 2004-07-14 Martin Baulig <martin@ximian.com>
928 (TypeManager.generic_ienumerable_type): New type.
929 (TypeManager.generic_ienumerator_type): New type.
932 (RootContext.interfaces_first_stage): Added
933 "System.Collections.Generic.IEnumerator`1" and
934 "System.Collections.Generic.IEnumerable`1".
936 2004-07-14 Martin Baulig <martin@ximian.com>
938 * iterators.cs: Use real error numbers.
940 2004-07-14 Martin Baulig <martin@ximian.com>
942 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
943 requires this to be a System.Collection.IEnumerable and not a
944 class implementing that interface.
945 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
947 2004-07-13 Marek Safar <marek.safar@seznam.cz>
949 * class.cs: Fixed previous fix, it broke some error tests.
951 2004-07-12 Martin Baulig <martin@ximian.com>
953 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
956 2004-07-14 Martin Baulig <martin@ximian.com>
958 * decl.cs, expression.cs, generic.cs: Use a backqoute (`) and not
959 an exclamation mark (!) for the generic arity to reflect the
960 latest spec changes; ie. use "System.Collections.Generic.IList`1".
962 2004-07-13 Martin Baulig <martin@ximian.com>
964 * cs-tokenizer.cs (Tokenizer.parse_less_than): Allow array rank
965 specifiers being part of a type argument.
967 2004-07-13 Martin Baulig <martin@ximian.com>
969 * expression.cs (MemberAccess.ResolveAsTypeStep): Use the full `!'
970 name for generic types.
972 2004-07-13 Martin Baulig <martin@ximian.com>
974 * assign.cs (Assign.DoResolve): Moved the CS0131 check up a little
977 2004-07-09 Miguel de Icaza <miguel@ximian.com>
979 * assign.cs (LocalTemporary): Add new argument: is_address,If
980 `is_address' is true, then the value that we store is the address
981 to the real value, and not the value itself.
983 * ecore.cs (PropertyExpr): use the new local temporary
984 stuff to allow us to handle X.Y += z (where X is a struct)
986 2004-07-08 Martin Baulig <martin@ximian.com>
988 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
989 not always return, just like we're doing in Using.Resolve().
991 2004-07-07 Miguel de Icaza <miguel@ximian.com>
993 * cs-parser.jay (fixed_statement): flag this as Pinned.
995 2004-07-06 Miguel de Icaza <miguel@ximian.com>
997 * typemanager.cs (TypeManager): Removed MakePinned method, this
998 mechanism is replaced with the .NET 2.x compatible mechanism of
999 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
1001 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
1002 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
1003 `IsFixed' property which has a different meaning.
1005 2004-07-02 Raja R Harinath <rharinath@novell.com>
1007 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
1008 visible from inside a nested class, not just the names of the
1009 immediately enclosing class.
1012 2004-06-24 Raja R Harinath <rharinath@novell.com>
1014 * expression.cs (BetterConversion): Remove buggy special-case
1015 handling of "implicit constant expression conversions". At this
1016 point, we already know that the conversion is possible -- we're
1017 only checking to see which is better.
1019 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1021 * cs-parser.jay: Added error CS0210 test.
1023 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1025 * cs-parser.jay: Added error CS0134 test.
1027 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1030 * cs-parser.jay: Added error CS0145 test.
1032 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1034 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
1036 2004-06-23 Ben Maurer <bmaurer@ximian.com>
1038 * expression.cs (StackAlloc.Resolve): The argument may not
1039 be a constant; deal with this case.
1041 2004-06-23 Marek Safar <marek.safar@seznam.cz>
1043 * attribute.cs (IndexerName_GetIndexerName): Renamed to
1044 GetIndexerAttributeValue.
1045 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
1047 * class.cs (Indexer.Define): Added error tests for CS0415,
1050 2004-06-23 Miguel de Icaza <miguel@ximian.com>
1052 * attribute.cs (Attribute.Resolve): Keep field code in sync with
1055 2004-06-23 Martin Baulig <martin@ximian.com>
1057 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
1058 neither return nor throw, reset the barrier as well. Fixes #60457.
1060 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
1062 * class.cs : EventAttributes is now set to None by default.
1063 This fixes bug #60459.
1065 2004-06-18 Marek Safar <marek.safar@seznam.cz>
1068 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
1069 Don't throw exception but return null (it's sufficient now).
1071 2004-06-18 Marek Safar <marek.safar@seznam.cz>
1073 * typemanager.cs (GetArgumentTypes): Faster implementation.
1075 2004-06-18 Martin Baulig <martin@ximian.com>
1077 * attribute.cs (Attribute.Resolve): Check whether we're an
1078 EmptyCast which a Constant child. Fixes #60333.
1080 2004-06-17 Ben Maurer <bmaurer@ximian.com>
1082 * statement.cs (EmitCollectionForeach): Account for the fact that
1083 not all valuetypes are in areas which we can take the address of.
1084 For these variables, we store to a temporary variable. Also, make
1085 sure that we dont emit a `callvirt' on a valuetype method.
1087 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1089 * expression.cs (StackAlloc.DoReSolve): Added test for
1090 negative parameter (CS0247).
1092 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1095 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
1097 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1100 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
1103 2004-06-14 Marek Safar <marek.safar@seznam.cz>
1105 Fix bug #58254 & cs1555.cs, cs1556.cs
1106 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
1108 2004-06-14 Marek Safar <marek.safar@seznam.cz>
1110 * cs-parser.jay: Added error CS1669 test for indexers.
1112 2004-06-18 Martin Baulig <martin@ximian.com>
1114 * generics.cs (GenericMethod.ctor): Don't take an Attributes
1115 argument. Fixes #60441.
1117 2004-06-16 Ben Maurer <bmaurer@ximian.com>
1118 * ecore.cs (MethodGroupExpr.Name): Revert Martin's patch.
1119 The name needs to have the actual name of the method in order
1120 for other tests (such as the one in OverloadResolve for Invoke
1121 on a delegate) to work. As well, it does not really help
1122 error reporting because the method group had multiple methods.
1123 * Makefile: Remove MCS_DEBUG, you can enable with the DEBUG_FLAGS.
1124 Make profiling work.
1126 2004-06-13 Martin Baulig <martin@ximian.com>
1128 * cs-parser.jay: Don't allow generic attributes.
1130 2004-06-13 Martin Baulig <martin@ximian.com>
1132 * class.cs (MemberBase.DoDefineBase): New protected method.
1133 (MemberBase.DoDefine): Compute the `flags' in the new
1134 DoDefineBase() which must be called first.
1135 (Method.Define): Call DoDefineBase() first so we have the flags
1136 when defining the generic method.
1138 * cs-parser.jay (interface_method_declaration): Support generic methods.
1140 2004-06-13 Martin Baulig <martin@ximian.com>
1142 * decl.cs (TypeName): Removed.
1143 (MemberName): Removed TypeName and MemberNow; now we just have
1146 * cs-parser.jay: Don't distinguish between type arguments and type
1147 parameters in the grammar and simplified the rules a bit. The
1148 reduce/reduce conflicts are now gone (except the one we inherited
1151 2004-06-11 Martin Baulig <martin@ximian.com>
1153 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
1154 call this twice: for params and varargs methods.
1156 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1159 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
1161 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1163 * attribute.cs (Attribute.GetValidTargets): Made public.
1166 (AbstractPropertyEventMethod): New class for better code sharing.
1167 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
1169 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
1171 2004-06-09 Martin Baulig <martin@ximian.com>
1173 * cs-parser.jay: Removed a reduce/reduce conflict.
1175 2004-06-03 Martin Baulig <martin@ximian.com>
1177 * generic.cs (ConstructedType.GetMemberAccess): Renamed to
1178 GetSimpleName() and return a SimpleName.
1180 * ecore.cs (SimpleName.Arguments): New public field.
1181 (SimpleName): Added overloaded ctor which takes an additional
1182 TypeArguments argument.
1183 (SimpleName.SimpleNameResolve): Added support for generic methods.
1184 (MethodGroupExpr.ResolveGeneric): New public method. The code was
1185 formerly in MemberAccess.DoResolve(), but we also need it in
1186 SimpleNameResolve().
1188 * expression.cs (MemberAccess.DoResolve): Use the new
1189 MethodGroupExpr.ResolveGeneric().
1191 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1193 * decl.cs: If possible, use lookuptypedirect here. We can only do
1194 this if there is no `.' after the namespace. Avoids using
1195 LookupType, which does lots of slow processing.
1196 (FindNestedType) New method, does what it says :-).
1197 * namespace.cs: use LookupTypeDirect.
1198 * rootcontext.cs: use membercache, if possible.
1199 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
1201 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1204 According to the spec,
1206 In a member access of the form E.I, if E is a single identifier,
1207 and if the meaning of E as a simple-name (§7.5.2) is a constant,
1208 field, property, localvariable, or parameter with the same type as
1209 the meaning of E as a type-name (§3.8), then both possible
1210 meanings of E are permitted.
1212 We did not check that E as a simple-name had the same type as E as
1215 This trivial check gives us 5-7% on bootstrap time.
1217 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1219 * expression.cs (Invocation.OverloadResolve): Avoid the
1220 use of hashtables and boxing here by allocating on demand.
1222 2004-05-30 Martin Baulig <martin@ximian.com>
1224 * rootcontext.cs (RootContext.LookupType): Don't cache things if
1225 we're doing a silent lookup. Don't try to lookup nested types in
1226 TypeManager.object_type (thanks to Ben Maurer).
1228 2004-05-30 Martin Baulig <martin@ximian.com>
1230 Committing a patch from Ben Maurer.
1232 * rootcontext.cs (RootContext.LookupType): Cache negative results.
1234 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1236 * convert.cs: add a trivial cache for overload operator resolution.
1238 2004-05-31 Marek Safar <marek.safar@seznam.cz>
1241 (AttributeTester.GetObsoleteAttribute): Returns instance of
1242 ObsoleteAttribute when type is obsolete.
1245 (TypeContainer.VerifyObsoleteAttribute): Override.
1246 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
1247 (MethodCode.VerifyObsoleteAttribute): Override.
1248 (MemberBase.VerifyObsoleteAttribute): Override.
1251 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
1252 and report proper error.
1255 (Delegate.VerifyObsoleteAttribute): Override.
1258 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
1259 and report proper error.
1260 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
1263 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
1267 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
1268 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
1269 Added test for ObsoleteAttribute.
1272 (Catch): Derived from Statement.
1274 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1276 * decl.cs: If possible, use lookuptypedirect here. We can only do
1277 this if there is no `.' after the namespace. Avoids using
1278 LookupType, which does lots of slow processing.
1279 (FindNestedType) New method, does what it says :-).
1280 * namespace.cs: use LookupTypeDirect.
1281 * rootcontext.cs: use membercache, if possible.
1282 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
1284 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1287 According to the spec,
1289 In a member access of the form E.I, if E is a single identifier,
1290 and if the meaning of E as a simple-name (§7.5.2) is a constant,
1291 field, property, localvariable, or parameter with the same type as
1292 the meaning of E as a type-name (§3.8), then both possible
1293 meanings of E are permitted.
1295 We did not check that E as a simple-name had the same type as E as
1298 This trivial check gives us 5-7% on bootstrap time.
1300 2004-05-30 Marek Safar <marek.safar@seznam.cz>
1302 Fixed bug #59071 & cs0160.cs
1303 * statement.cs (Try.Resolve): Check here whether order of catch
1304 clauses matches their dependencies.
1306 2004-05-30 Marek Safar <marek.safar@seznam.cz>
1309 * ecore.cs (SimpleName.SimpleNameResolve): Added test for
1312 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1314 * expression.cs (Invocation.OverloadResolve): Avoid the
1315 use of hashtables and boxing here by allocating on demand.
1317 2004-05-30 Martin Baulig <martin@ximian.com>
1319 * rootcontext.cs (RootContext.LookupType): Don't cache things if
1320 we're doing a silent lookup. Don't try to lookup nested types in
1321 TypeManager.object_type (thanks to Ben Maurer).
1323 2004-05-30 Martin Baulig <martin@ximian.com>
1325 Committing a patch from Ben Maurer.
1327 * rootcontext.cs (RootContext.LookupType): Cache negative results.
1329 2004-05-29 Martin Baulig <martin@ximian.com>
1331 * class.cs (IMethodData.ShouldIgnore): New method.
1333 * typemanager.cs (TypeManager.MethodFlags): Don't take a
1334 `Location' argument, we don't need it anywhere. Use
1335 `IMethodData.ShouldIgnore ()' instead of
1336 `MethodData.GetMethodFlags ()'.
1337 (TypeManager.AddMethod): Removed.
1338 (TypeManager.AddMethod2): Renamed to AddMethod.
1340 2004-05-29 Martin Baulig <martin@ximian.com>
1342 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
1344 * convert.cs (Convert.ImplicitReferenceConversion): If we're
1345 converting from a class type S to an interface type and we already
1346 have an object on the stack, don't box it again. Fixes #52578.
1348 2004-05-29 Martin Baulig <martin@ximian.com>
1350 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
1351 Added support for `params' parameters. Fixes #59267.
1353 2004-05-29 Martin Baulig <martin@ximian.com>
1355 * literal.cs (NullPointer): Provide a private .ctor which sets
1356 `type' to TypeManager.object_type. Fixes #59048.
1358 2004-05-29 Martin Baulig <martin@ximian.com>
1360 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
1361 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
1363 * ecore.cs (EventExpr.instance_expr): Make the field private.
1365 2004-05-26 Marek Safar <marek.safar@seznam.cz>
1367 Fixed bug #50080 & cs0214-2.cs
1368 * expression.cs (Cast.DoResolve): Check unsafe context here.
1370 * statement.cs (Resolve.DoResolve): Likewise.
1372 2004-05-26 Martin Baulig <martin@ximian.com>
1374 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
1376 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
1377 (RootContext.LookupType): Pass down the `silent' flag.
1379 2004-05-25 Martin Baulig <martin@ximian.com>
1382 (MethodGroupExpr.IdenticalTypeName): New public property.
1383 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
1384 expression actually refers to a type.
1386 2004-05-25 Martin Baulig <martin@ximian.com>
1388 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
1389 for #56176 and made it actually work.
1391 2004-05-25 Martin Baulig <martin@ximian.com>
1393 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
1394 (FieldExpr, PropertyExpr): Override and implement
1395 CacheTemporaries. Fixes #52279.
1397 2004-05-25 Miguel de Icaza <miguel@ximian.com>
1399 * location.cs: In the new compiler listing a file twice is a
1400 warning, not an error.
1402 2004-05-24 Martin Baulig <martin@ximian.com>
1404 * enum.cs (Enum.DefineType): For the `BaseType' to be a
1405 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
1407 2004-05-24 Martin Baulig <martin@ximian.com>
1409 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
1410 walking the `using' list. Fixes #53921.
1412 2004-05-24 Martin Baulig <martin@ximian.com>
1414 * const.cs (Const.LookupConstantValue): Added support for
1415 EmptyCast's; fixes #55251.
1417 2004-05-24 Martin Baulig <martin@ximian.com>
1419 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
1420 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
1421 which does the CS0135 check. The reason is that we first need to
1422 check whether the variable actually exists.
1424 2004-05-24 Martin Baulig <martin@ximian.com>
1426 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
1427 than RootContext.LookupType() to find the explicit interface
1430 2004-05-24 Raja R Harinath <rharinath@novell.com>
1432 * Makefile: Simplify. Use executable.make.
1433 * mcs.exe.sources: New file. List of sources of mcs.exe.
1435 2004-05-24 Anders Carlsson <andersca@gnome.org>
1439 Use the invariant culture when doing String.Compare for CLS case
1442 2004-05-23 Martin Baulig <martin@ximian.com>
1444 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
1445 don't have any dots. Fixes #52622, added cs0246-8.cs.
1447 * namespace.cs (NamespaceEntry.Lookup): Likewise.
1449 2004-05-23 Marek Safar <marek.safar@seznam.cz>
1451 * class.cs (MemberBase.Define): Reuse MemberType member for
1452 resolved type. Other methods can use it too.
1454 2004-05-23 Martin Baulig <martin@ximian.com>
1456 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
1457 the variable also exists in the current block (otherwise, we need
1458 to report a CS0103). Fixes #58670.
1460 2004-05-23 Martin Baulig <martin@ximian.com>
1462 * flowanalysis.cs (Reachability.Reachable): Compute this
1463 on-the-fly rather than storing it as a field.
1465 2004-05-23 Martin Baulig <martin@ximian.com>
1467 * flowanalysis.cs (Reachability.And): Manually compute the
1468 resulting `barrier' from the reachability.
1470 2004-05-23 Marek Safar <marek.safar@seznam.cz>
1473 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
1474 instance of ObsoleteAttribute when symbol is obsolete.
1477 (IMethodData): Extended interface for ObsoleteAttribute support.
1479 2004-05-22 Marek Safar <marek.safar@seznam.cz>
1481 * attribute.cs: Fix bug #55970
1483 2004-05-22 Marek Safar <marek.safar@seznam.cz>
1487 (GetObsoleteAttribute): New method. Creates the instance of
1489 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
1490 ObsoleteAttribute when member is obsolete.
1491 (AttributeTester.Report_ObsoleteMessage): Common method for
1492 Obsolete error/warning reporting.
1495 (TypeContainer.base_classs_type): New member for storing parent type.
1498 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
1499 for this MemberCore.
1501 2004-05-21 Marek Safar <marek.safar@seznam.cz>
1503 * attribute.cs, const.cs: Fix bug #58590
1505 2004-05-21 Martin Baulig <martin@ximian.com>
1507 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
1508 out parameters if the end of the method is unreachable. Fixes
1511 2004-05-21 Marek Safar <marek.safar@seznam.cz>
1513 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
1514 Hari was right, why extra method.
1516 2004-05-21 Marek Safar <marek.safar@seznam.cz>
1518 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
1520 2004-05-20 Martin Baulig <martin@ximian.com>
1522 * delegate.cs: Convert this file to Unix mode - like the original
1525 2004-05-20 Martin Baulig <martin@ximian.com>
1527 * attribute.cs: Convert this file to Unix mode - like the original
1530 2004-05-19 Marek Safar <marek.safar@seznam.cz>
1532 Fix bug #58688 (MCS does not report error when the same attribute
1535 * attribute.cs (Attribute.Emit): Distinction between null and default.
1537 2004-05-19 Raja R Harinath <rharinath@novell.com>
1539 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
1540 of a top-level attribute without an attribute target.
1541 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
1543 (Attribute.Conditional_GetConditionName),
1544 (Attribute.Obsolete_GetObsoleteMessage): Update.
1545 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
1546 part of ScanForIndexerName.
1547 (Attribute.CanIgnoreInvalidAttribute): New function.
1548 (Attribute.ScanForIndexerName): Move to ...
1549 (Attributes.ScanForIndexerName): ... here.
1550 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
1551 (Attributes.Search): New internal variant that can choose not to
1552 complain if types aren't resolved. The original signature now
1554 (Attributes.GetClsCompliantAttribute): Use internal variant, with
1555 complaints suppressed.
1556 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
1557 only if it not useful.
1558 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
1559 top-level for attributes that are shared between the assembly
1560 and a top-level class.
1561 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
1562 * class.cs: Update to reflect changes.
1563 (DefineIndexers): Fuse loops.
1564 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
1565 a couple more variants of attribute names.
1567 2004-05-18 Marek Safar <marek.safar@seznam.cz>
1569 Fix bug #52585 (Implemented explicit attribute declaration)
1572 (Attributable.ValidAttributeTargets): New abstract method. It gets
1573 list of valid attribute targets for explicit target declaration.
1574 (Attribute.Target): It holds target itself.
1575 (AttributeSection): Removed.
1576 (Attribute.CheckTargets): New method. It checks whether attribute
1577 target is valid for the current element.
1580 (EventProperty): New class. For events that are declared like
1581 property (with add and remove accessors).
1582 (EventField): New class. For events that are declared like field.
1585 * cs-parser.jay: Implemented explicit attribute target declaration.
1587 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
1588 Override ValidAttributeTargets.
1591 (ReturnParameter): Class for applying custom attributes on
1593 (ParameterAtribute): New class. Class for applying custom
1594 attributes on the parameter type.
1596 2004-05-17 Miguel de Icaza <miguel@ximian.com>
1598 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
1601 (Method): Allow UNSAFE here.
1603 * modifiers.cs: Support unsafe reporting.
1605 2004-05-17 Marek Safar <marek.safar@seznam.cz>
1607 * decl.cs: Fix bug #58478.
1609 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1611 * statement.cs: When checking for unreachable code on an EmptyStatement,
1612 set the location. Fixes bug #58488.
1614 2004-05-13 Miguel de Icaza <miguel@ximian.com>
1616 * driver.cs: Add -pkg handling.
1618 From Gonzalo: UseShelLExecute=false
1620 2004-05-12 Marek Safar <marek.safar@seznam.cz>
1623 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
1625 (Attribute.IsClsCompliaceRequired): Moved to base for better
1627 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
1628 when attribute is AttributeUsageAttribute.
1629 (Attribute.GetValidTargets): Simplified.
1630 (Attribute.GetAttributeUsage): New method returns AttributeUsage
1631 attribute for this type.
1632 (Attribute.ApplyAttributes): Method renamed to Emit and make
1634 (GlobalAttributeSection): New class for special handling of global
1635 attributes (assembly, module).
1636 (AttributeSection.Emit): New method.
1638 * class.cs: Implemented Attributable abstract methods.
1639 (MethodCore.LabelParameters): Moved to Parameter class.
1640 (Accessor): Is back simple class.
1641 (PropertyMethod): Implemented Attributable abstract class.
1642 (DelegateMethod): Implemented Attributable abstract class.
1643 (Event): New constructor for disctintion between normal Event
1644 and Event with accessors.
1646 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
1648 * codegen.cs, const.cs, decl.cs, delegate.cs:
1649 (CommonAssemblyModulClass): Implemented Attributable abstract class
1652 * enum.cs: Implement IAttributeSupport interface.
1653 (EnumMember): New class for emum members. Implemented Attributable
1657 (ParameterBase): Is abstract.
1658 (ReturnParameter): New class for easier [return:] attribute handling.
1660 * typemanager.cs: Removed builder_to_attr.
1662 2004-05-11 Raja R Harinath <rharinath@novell.com>
1665 * attribute.cs (Attribute.GetPositionalValue): New function.
1666 * class.cs (TypeContainer.VerifyMembers): New function.
1667 (TypeContainer.Emit): Use it.
1668 (ClassOrStruct): New base class for Class and Struct.
1669 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
1670 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
1672 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
1673 then each non-static field should have a FieldOffset attribute.
1674 Otherwise, none of the fields should have a FieldOffset attribute.
1675 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
1676 and FieldOffset attributes.
1677 * typemanager.cs (TypeManager.struct_layout_attribute_type)
1678 (TypeManager.field_offset_attribute_type): New core types.
1679 (TypeManager.InitCoreTypes): Initialize them.
1681 2004-05-11 Michal Moskal <malekith@pld-linux.org>
1683 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
1684 Return correct type.
1687 2004-05-09 Miguel de Icaza <miguel@ximian.com>
1689 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
1690 be implicitly converted to ulong.
1692 * expression.cs: The logic for allowing operator &, | and ^ worked
1693 was wrong, it worked before because we did not report an error in
1694 an else branch. Fixes 57895.
1696 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
1697 allow volatile fields to be reference types.
1699 2004-05-07 Miguel de Icaza <miguel@ximian.com>
1701 * driver.cs: Add support for /debug-
1703 2004-05-07 Raja R Harinath <rharinath@novell.com>
1705 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
1706 Add a 'complain' parameter to silence errors.
1707 (Attribute.Resolve): Update to changes. Put in sanity check to catch
1708 silently overlooked type-resolutions.
1709 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
1711 (Attributes.Search): New function.
1712 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
1713 (Attributes.GetAttributeFullName): Remove hack.
1714 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
1715 Update to reflect changes.
1716 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
1717 Use Attributes.Search instead of nested loops.
1719 2004-05-07 Marek Safar <marek.safar@seznam.cz>
1722 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
1723 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
1724 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
1726 * report.cs: (Report.Warning): Renamed to Warning_T because of
1727 parameter collision.
1729 2004-05-05 Raja R Harinath <rharinath@novell.com>
1731 * expression.cs (MemberAccess.ResolveMemberAccess):
1732 Exit with non-zero status after Report.Error.
1733 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
1735 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
1737 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
1739 * support.cs: Don't hang when the file is empty.
1741 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
1743 * support.cs: In SeekableStreamReader, compute the preamble size of the
1744 underlying stream. Position changes should take into account that initial
1747 2004-05-03 Todd Berman <tberman@sevenl.net>
1749 * driver.cs: remove unused GetSysVersion function.
1751 2004-05-03 Todd Berman <tberman@sevenl.net>
1753 * driver.cs: Remove the hack from saturday, as well as the hack
1754 from jackson (LoadAssemblyFromGac), also adds the CWD to the
1755 link_paths to get that bit proper.
1757 2004-05-01 Todd Berman <tberman@sevenl.net>
1759 * driver.cs: Try a LoadFrom before a Load, this checks the current
1760 path. This is currently a bug in mono that is be fixed, however, this
1761 provides a workaround for now. This will be removed when the bug
1764 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
1766 * CryptoConvert.cs: Updated to latest version. Fix issue with
1767 incomplete key pairs (#57941).
1769 2004-05-01 Todd Berman <tberman@sevenl.net>
1771 * driver.cs: Remove '.' from path_chars, now System.* loads properly
1774 2004-04-30 Jackson Harper <jackson@ximian.com>
1776 * codegen.cs: Open keys readonly.
1778 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1780 * typemanager.cs: don't report cyclic struct layout when a struct
1781 contains 2 or more fields of the same type. Failed for Pango.AttrShape
1782 which has 2 Pango.Rectangle fields.
1784 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
1786 * expression.cs: Handle IntPtr comparisons with IL code
1787 rather than a method call.
1789 2004-04-29 Martin Baulig <martin@ximian.com>
1791 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
1792 the list of PropertyInfo's in class hierarchy and find the
1793 accessor. Fixes #56013.
1795 2004-04-29 Martin Baulig <martin@ximian.com>
1797 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
1799 2004-04-29 Martin Baulig <martin@ximian.com>
1801 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
1803 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
1805 2004-04-29 Martin Baulig <martin@ximian.com>
1807 * class.cs (ConstructorInitializer.Resolve): Check whether the
1808 parent .ctor is accessible. Fixes #52146.
1810 2004-04-29 Martin Baulig <martin@ximian.com>
1812 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
1814 * statement.cs (Using.EmitLocalVariableDecls): Use
1815 TypeManager.idisposable_type, not typeof (IDisposable).
1816 (Foreach.EmitCollectionForeach): Added support for valuetypes.
1818 2004-04-29 Martin Baulig <martin@ximian.com>
1820 * class.cs (Event.Define): Don't emit the field and don't set
1821 RTSpecialName and SpecialName for events on interfaces. Fixes
1824 2004-04-29 Raja R Harinath <rharinath@novell.com>
1826 Refactor Attribute.ApplyAttributes.
1827 * attribute.cs (Attributable): New base class for objects that can
1828 have Attributes applied on them.
1829 (Attribute): Make AttributeUsage fields public.
1830 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
1831 (Attribute.IsInternalCall): New property.
1832 (Attribute.UsageAttr): Convert to a public read-only property.
1833 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
1834 (Attribute.ResolveType, Attribute.Resolve)
1835 (Attribute.ScanForIndexerName): Update to reflect changes.
1836 (Attribute.CheckAttributeTarget): Re-format.
1837 (Attribute.ApplyAttributes): Refactor, to various
1838 Attributable.ApplyAttributeBuilder methods.
1839 * decl.cs (MemberCore): Make Attributable.
1840 * class.cs (Accessor): Make Attributable.
1841 (MethodData.ApplyAttributes): Use proper attribute types, not
1843 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
1844 (TypeContainer.ApplyAttributeBuilder)
1845 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
1846 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
1847 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
1848 (Operator.ApplyAttributeBuilder): New factored-out methods.
1849 * const.cs (Const.ApplyAttributeBuilder): Likewise.
1850 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
1851 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
1852 * parameter.cs (ParameterBase): New Attributable base class
1853 that can also represent Return types.
1854 (Parameter): Update to the changes.
1856 2004-04-29 Jackson Harper <jackson@ximian.com>
1858 * driver.cs: Prefer the corlib system version when looking for
1859 assemblies in the GAC. This is still a hack, but its a better hack
1862 2004-04-29 Marek Safar <marek.safar@seznam.cz>
1864 * decl.cs, enum.cs: Improved error 3005 reporting.
1866 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
1867 (related_symbols): New private member for list of symbols
1868 related to reported error/warning.
1870 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
1872 2004-04-29 Martin Baulig <martin@ximian.com>
1874 * ecore.cs (Expression.Constantify): If we're an enum and
1875 TypeManager.TypeToCoreType() doesn't give us another type, use
1876 t.UnderlyingSystemType. Fixes #56178.
1878 2004-04-29 Martin Baulig <martin@ximian.com>
1880 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
1881 interfaces and for each interface, only add members directly
1882 declared in that interface. Fixes #53255.
1884 2004-04-28 Martin Baulig <martin@ximian.com>
1886 * expression.cs (ConditionalLogicalOperator): Use a temporary
1887 variable for `left' to avoid that we evaluate it more than once;
1890 2004-04-28 Martin Baulig <martin@ximian.com>
1892 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
1895 2004-04-28 Martin Baulig <martin@ximian.com>
1897 * statement.cs (LocalInfo.Resolve): Check whether the type is not
1900 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
1901 whether the type is not void (CS1547).
1903 2004-04-28 Martin Baulig <martin@ximian.com>
1905 * expression.cs (Unary.DoResolveLValue): Override this and report
1906 CS0131 for anything but Operator.Indirection.
1908 2004-04-28 Martin Baulig <martin@ximian.com>
1910 Committing a patch from Ben Maurer; see bug #50820.
1912 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
1915 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
1918 2004-04-28 Martin Baulig <martin@ximian.com>
1920 Committing a patch from Ben Maurer; see bug #50820.
1922 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
1925 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
1928 2004-04-28 Martin Baulig <martin@ximian.com>
1930 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
1931 (Block.AddLabel): Call DoLookupLabel() to only search in the
1934 2004-04-28 Martin Baulig <martin@ximian.com>
1936 * cfold.cs (ConstantFold.BinaryFold): Added special support for
1937 comparing StringConstants and NullLiterals in Equality and Inequality.
1939 2004-04-28 Jackson Harper <jackson@ximian.com>
1941 * driver.cs: Attempt to load referenced assemblies from the
1942 GAC. This is the quick and dirty version of this method that
1943 doesnt take into account versions and just takes the first
1944 canidate found. Will be good enough for now as we will not have more
1945 then one version installed into the GAC until I update this method.
1947 2004-04-28 Martin Baulig <martin@ximian.com>
1949 * typemanager.cs (TypeManager.CheckStructCycles): New public
1950 static method to check for cycles in the struct layout.
1952 * rootcontext.cs (RootContext.PopulateTypes): Call
1953 TypeManager.CheckStructCycles() for each TypeContainer.
1954 [Note: We only need to visit each type once.]
1956 2004-04-28 Martin Baulig <martin@ximian.com>
1958 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
1960 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
1961 success and added `out object value'. Use a `bool resolved' field
1962 to check whether we've already been called rather than
1963 `ConstantValue != null' since this breaks for NullLiterals.
1965 2004-04-28 Raja R Harinath <rharinath@novell.com>
1967 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
1968 setting of this flag, since the 'set' method may be non-public.
1970 2004-04-28 Raja R Harinath <rharinath@novell.com>
1972 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
1973 check on current_vector.Block.
1975 2004-04-27 Martin Baulig <martin@ximian.com>
1977 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
1978 a field initializer. Fixes #56459.
1980 2004-04-27 Martin Baulig <martin@ximian.com>
1982 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
1983 we're not attempting to use an indexer. Fixes #52154.
1985 2004-04-27 Martin Baulig <martin@ximian.com>
1987 * statement.cs (Return): Don't create a return label if we don't
1988 need it; reverts my change from January 20th. Thanks to Ben
1991 2004-04-27 Martin Baulig <martin@ximian.com>
1993 According to the spec, `goto' can only leave a nested scope, but
1996 * statement.cs (Block.LookupLabel): Only lookup in the current
1997 block, don't recurse into parent or child blocks.
1998 (Block.AddLabel): Check in parent and child blocks, report
1999 CS0140/CS0158 if we find a duplicate.
2000 (Block): Removed this indexer for label lookups.
2001 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
2002 this already does the error reporting for us.
2005 (FlowBranching.UsageVector.Block): New public variable; may be null.
2006 (FlowBranching.CreateSibling): Added `Block' argument.
2007 (FlowBranching.LookupLabel): New public virtual method. Lookup a
2008 label for the target of a `goto' and check whether we're not
2009 leaving a `finally'.
2011 2004-04-27 Martin Baulig <martin@ximian.com>
2013 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2014 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
2017 2004-04-27 Martin Baulig <martin@ximian.com>
2019 * statement.cs (Block.AddLabel): Also check for implicit blocks
2020 and added a CS0158 check.
2022 2004-04-27 Martin Baulig <martin@ximian.com>
2024 * flowanalysis.cs (FlowBranchingLoop): New class.
2025 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
2026 UsageVector's instead of an ArrayList.
2027 (FlowBranching.Label): Likewise.
2028 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
2029 (FlowBranching.AddBreakVector): New method.
2031 2004-04-27 Miguel de Icaza <miguel@ximian.com>
2033 * attribute.cs: Small regression fix: only convert the type if we
2034 the type is different, fixes System.Drawing build.
2036 2004-04-27 Martin Baulig <martin@ximian.com>
2038 * attribute.cs (Attribute.Resolve): If we have a constant value
2039 for a named field or property, implicity convert it to the correct
2042 2004-04-27 Raja R Harinath <rharinath@novell.com>
2044 * statement.cs (Block.Block): Implicit blocks share
2045 'child_variable_names' fields with parent blocks.
2046 (Block.AddChildVariableNames): Remove.
2047 (Block.AddVariable): Mark variable as "used by a child block" in
2048 every surrounding block.
2049 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
2050 been used in a child block, complain about violation of "Invariant
2051 meaning in blocks" rule.
2052 * cs-parser.jay (declare_local_variables): Don't use
2053 AddChildVariableNames.
2054 (foreach_statement): Don't create an implicit block: 'foreach'
2057 2004-04-23 Miguel de Icaza <miguel@ximian.com>
2059 * convert.cs (ImplicitNumericConversion): 0 is also positive when
2060 converting from 0L to ulong. Fixes 57522.
2062 2004-04-22 Marek Safar <marek.safar@seznam.cz>
2064 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
2065 derived class hides via 'new' keyword field from base class (test-242.cs).
2066 TODO: Handle this in the more general way.
2068 * class.cs (CheckBase): Ditto.
2070 2004-04-22 Marek Safar <marek.safar@seznam.cz>
2072 * decl.cs (caching_flags): New member for storing cached values
2074 (MemberCore.Flags): New enum where bit flags for caching_flags
2076 (MemberCore.cls_compliance): Moved to caching_flags.
2077 (DeclSpace.Created): Moved to caching_flags.
2079 * class.cs: Use caching_flags instead of DeclSpace.Created
2081 2004-04-21 Miguel de Icaza <miguel@ximian.com>
2083 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
2084 if we are only a derived class, not a nested class.
2086 * typemanager.cs: Same as above, but do this at the MemberLookup
2087 level (used by field and methods, properties are handled in
2088 PropertyExpr). Allow for the qualified access if we are a nested
2091 2004-04-21 Marek Safar <marek.safar@seznam.cz>
2093 * class.cs: Refactoring.
2094 (IMethodData): New inteface; Holds links to parent members
2095 to avoid member duplication (reduced memory allocation).
2096 (Method): Implemented IMethodData interface.
2097 (PropertyBase): New inner classes for get/set methods.
2098 (PropertyBase.PropertyMethod): Implemented IMethodData interface
2099 (Event): New inner classes for add/remove methods.
2100 (Event.DelegateMethod): Implemented IMethodData interface.
2102 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
2103 EmitContext (related to class.cs refactoring).
2105 2004-04-21 Raja R Harinath <rharinath@novell.com>
2107 * delegate.cs (Delegate.VerifyApplicability): If the number of
2108 arguments are the same as the number of parameters, first try to
2109 verify applicability ignoring any 'params' modifier on the last
2113 2004-04-08 Martin Baulig <martin@ximian.com>
2115 Merged latest changes into gmcs. Please keep this comment in
2116 here, it makes it easier for me to see what changed in MCS since
2117 the last time I merged.
2119 2004-04-16 Raja R Harinath <rharinath@novell.com>
2121 * class.cs (TypeContainer.AddIndexer): Use
2122 'ExplicitInterfaceName' to determine if interface name was
2123 explicitly specified. 'InterfaceType' is not initialized at this time.
2124 (TypeContainer.DefineIndexers): Remove use of temporary list. The
2125 Indexers array is already in the required order. Initialize
2126 'IndexerName' only if there are normal indexers.
2127 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
2128 (TypeContainer.Emit): Emit DefaultMember attribute only if
2129 IndexerName is initialized.
2132 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
2134 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
2137 2004-04-15 Raja R Harinath <rharinath@novell.com>
2139 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
2143 * attribute.cs (Attribute.Resolve): Check for duplicate named
2147 2004-04-15 Miguel de Icaza <miguel@ximian.com>
2149 * iterators.cs (MarkYield): track whether we are in an exception,
2150 and generate code accordingly. Use a temporary value to store the
2151 result for our state.
2153 I had ignored a bit the interaction of try/catch with iterators
2154 since their behavior was not entirely obvious, but now it is
2155 possible to verify that our behavior is the same as MS .NET 2.0
2159 2004-04-14 Miguel de Icaza <miguel@ximian.com>
2161 * iterators.cs: Avoid creating temporaries if there is no work to
2164 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
2165 Enumerations, use TypeManager.EnumToUnderlying and call
2168 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
2171 (This.Emit): Use EmitContext.EmitThis to emit our
2174 (This.EmitAssign): Ditto.
2176 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
2177 codepaths, we will move all the functionality into
2180 (FieldExpr.EmitAssign): Ditto.
2182 This fixes several hidden bugs that I uncovered while doing a code
2183 review of this today.
2185 * codegen.cs (EmitThis): reworked so the semantics are more clear
2186 and also support value types "this" instances.
2188 * iterators.cs: Changed so that for iterators in value types, we
2189 do not pass the value type as a parameter.
2191 Initialization of the enumerator helpers is now done in the caller
2192 instead of passing the parameters to the constructors and having
2193 the constructor set the fields.
2195 The fields have now `assembly' visibility instead of private.
2197 2004-04-11 Miguel de Icaza <miguel@ximian.com>
2199 * expression.cs (Argument.Resolve): Check if fields passed as ref
2200 or out are contained in a MarshalByRefObject.
2202 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
2203 another compiler type.
2205 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
2207 * class.cs (Indexer.Define): use the new name checking method.
2208 Also, return false on an error.
2209 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
2210 (is_identifier_[start/part]_character): make static.
2212 2004-04-10 Miguel de Icaza <miguel@ximian.com>
2214 * expression.cs (Binary.ResolveOperator): Do no append strings
2215 twice: since we can be invoked more than once (array evaluation)
2216 on the same concatenation, take care of this here. Based on a fix
2217 from Ben (bug #56454)
2219 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
2221 * codegen.cs: Fix another case where CS1548 must be reported (when
2222 delay-sign isn't specified and no private is available #56564). Fix
2223 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
2224 error when MCS is used on the MS runtime and we need to delay-sign
2225 (which seems unsupported by AssemblyBuilder - see #56621).
2227 2004-04-08 Marek Safar <marek.safar@seznam.cz>
2229 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
2230 (TypeManager.ComputeNamespaces): Faster implementation for
2233 * compiler.csproj: Updated AssemblyName to mcs.
2235 2004-05-11 Jackson Harper <jackson@ximian.com>
2237 * Makefile: Preserve MONO_PATH
2239 2004-05-11 Jackson Harper <jackson@ximian.com>
2241 * Makefile: Use mono and mcs to build gmcs
2243 2004-05-03 Miguel de Icaza <miguel@ximian.com>
2245 * codegen.cs: Add patch from Robert Shade
2246 <rshade@dvsconsulting.com>, use FileAccess.Read on the keyfile, to
2249 2004-05-02 Sebastien Pouliot <sebastien@ximian.com>
2251 * CryptoConvert.cs: Updated to latest version. Fix issue with
2252 incomplete key pairs (#57941).
2254 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
2256 * codegen.cs: Fix another case where CS1548 must be reported (when
2257 delay-sign isn't specified and no private is available #56564). Fix
2258 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
2259 error when MCS is used on the MS runtime and we need to delay-sign
2260 (which seems unsupported by AssemblyBuilder - see #56621).
2262 2004-04-29 Jackson Harper <jackson@ximian.com>
2264 * Makefile: Set MONO_PATH to use the bootstrap corlib
2265 * driver.cs: Check the GAC for referenced assemblies.
2267 2004-04-29 Martin Baulig <martin@ximian.com>
2269 * Makefile (gmcs.exe): Set MONO_PATH to use `../class/lib/net_2_0'.
2271 2004-04-07 Martin Baulig <martin@ximian.com>
2273 * expression.cs (Binary.ResolveOperator): Added special case for
2274 Equality/Inequality between a type parameter and a null literal.
2276 2004-04-07 Martin Baulig <martin@ximian.com>
2278 * convert.cs: Check null literal -> type parameter conversions.
2280 2004-04-07 Martin Baulig <martin@ximian.com>
2282 * generic.cs (ConstructedType.CheckConstraints): Enforce the
2283 `class' and `struct' constraints.
2285 2004-04-07 Martin Baulig <martin@ximian.com>
2287 * generic.cs (SpecialConstraint): New public enum.
2288 (Constraints.Resolve): Added support for the `class' and `struct'
2291 * cs-parser.jay (type_parameter_constraint): Added support for the
2292 `class' and `struct' constraints.
2294 2004-04-07 Martin Baulig <martin@ximian.com>
2296 * support.cs (GenericConstraints): Replaced `Types' by
2297 `ClassConstraint' and `InterfaceConstraints'; added
2298 `HasClassConstraint'.
2300 2004-04-07 Martin Baulig <martin@ximian.com>
2303 (Constraints.InterfaceConstraints): New public property.
2304 (Constraints.Types): Make this property public
2305 (TypeParameter): Implement IMemberContainer.
2306 (TypeParameter.Define): Take a `GenericTypeParameterBuilder'
2307 instead of a TypeBuilder/MethodBuilder; pass the interface
2308 constraints to TypeManager.AddTypeParameter().
2309 (TypeParameter.DefineType): Just take an EmitContext and no
2310 TypeBuilder/MethodBuilder. Use the new public API.
2312 * typemanager.cs (TypeManager.AddTypeParameter): Added
2313 `TypeExpr[]' argument; add the interfaces to the
2314 `builder_to_ifaces' hash.
2315 (TypeManager.LookupMemberContainer): For
2316 GenericTypeParameterBuilders, get the TypeParameter from the
2317 `builder_to_type_param'.
2318 (TypeManager.FindMembers): For GenericTypeParameterBuilders, get
2319 the TypeParameter and call FindMembers on it.
2321 2004-04-07 Martin Baulig <martin@ximian.com>
2324 (MethodCore.GenericMethod): Moved this field here from Method.
2325 (MethodCore.IsDuplicateImplementation): Take the number of type
2326 parameters into account if we're a generic method.
2328 * expression.cs (Invocation.InferTypeArguments): Don't return true
2329 if `arguments' is null; we still need to check whether we actually
2330 don't need to infer anything in this case.
2331 (MemberAccess): Merged the functionality from GenericMemberAccess
2334 * generic.cs (GenericMemberAccess): Removed.
2336 2004-04-05 Martin Baulig <martin@ximian.com>
2338 * decl.cs (MemberCore): For generic classes, interfaces and
2339 structs, `Name' now includes the number of type parameters
2341 (DeclSpace.FindType): Removed the `num_type_args' argument; we now
2342 encode the number of type arguments in the type name.
2344 * expression.cs (Expression.MemberLookup): Removed the
2345 `num_type_args' argument; we now encode the number of type
2346 arguments in the type name.
2348 * ecore.cs (SimpleName): Encode the number of type arguments in
2349 the type name itself.
2351 * generic.cs (ConstructedType): Likewise.
2353 * tree.cs (Tree.RecordDecl): Take a `string' instead of a
2354 `MemberName'; we now include the number of type parameters in the
2357 * typemanager.cs (TypeManager.CheckGeneric): Removed.
2358 (TypeManager.MemberLookup): Removed the
2359 `num_type_args' argument; we now encode the number of type
2360 arguments in the type name.
2362 2004-04-03 Martin Baulig <martin@ximian.com>
2364 * decl.cs (MemberCore.ctor): Take a MemberName instead of a sting.
2365 (MemberCore.MemberName): Moved here from MemberBase.
2366 (DeclSpace.SetParameterInfo): Just take the constraints as an
2367 ArrayList; we already have the type parameters in our
2368 `MemberName'; also do the CS0080 reporting here.
2370 * cs-parser.jay (struct_declaration): Use `member_name' instead of
2371 `IDENTIFIER opt_type_parameter_list'; when constructing our
2372 `MemberName', it'll already include our type parameters.
2373 (class_declaration, interface_declaration): Likewise.
2374 (delegate_declaration): Likewise.
2375 (MakeName): Take a MemberName and return a MemberName.
2376 The following two changes are required to avoid shift/reduce conflicts:
2377 (member_name): Don't include a TypeName anymore; ie. this is now
2378 just 'IDENTIFIER opt_type_parameter_list'.
2379 (property_declaration, event_declaration): Use a
2380 `namespace_or_type_name' instead of a `member_name'.
2382 2004-04-03 Martin Baulig <martin@ximian.com>
2384 * decl.cs (MemberName): Renamed to `TypeName' and created a new
2386 (TypeName): Formerly known as MemberName.
2388 * namespace.cs (NamespaceEntry.UsingAlias): Take a `TypeName'
2389 instead of a `MemberName'.
2391 * cs-parser.jay (namespace_or_type_name): Create a TypeName.
2392 (member_name): New rule; create a MemberName.
2394 2004-04-02 Martin Baulig <martin@ximian.com>
2396 * namespace.cs (NamespaceEntry.VerifyUsing): Added error checking
2397 (CS0305 and CS0308).
2399 2004-04-02 Martin Baulig <martin@ximian.com>
2401 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Added
2402 support for nested types.
2404 2004-04-02 Martin Baulig <martin@ximian.com>
2406 * ecore.cs (IAlias): New public interface.
2407 (TypeExpr, TypeExpression): Implement IAlias.
2408 (TypeAliasExpression): New public class.
2410 * namespace.cs (Namespace): Implement IAlias.
2411 (Namespace.Lookup): Return an IAlias instead on an object.
2412 (Namespace.DefineName): Take an IAlias instead of an object.
2413 (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
2415 (NamespaceEntry.UsingAlias): Take a Membername instead of an
2417 (NamespaceEntry.LookupAlias): Return an IAlias instead on an
2419 (NamespaceEntry.Lookup): Likewise.
2421 * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
2424 * decl.cs (DeclSpace): Implement IAlias.
2425 (DeclSpace.LookupAlias): Return an IAlias instead of a string.
2427 * generic.cs (ConstructedType): Improved error checking.
2429 2004-04-02 Martin Baulig <martin@ximian.com>
2431 * convert.cs: Added type parameter conversions.
2434 (UnboxCast.Emit): Emit an `unbox.any' for type params.
2435 (ClassCast.Emit): If the source type is a type parameter, box it.
2436 If the target type is a type parameter, emit an `unbox.any'
2437 instead of a `classcast'.1
2439 2004-04-01 Martin Baulig <martin@ximian.com>
2441 * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
2443 2004-04-01 Martin Baulig <martin@ximian.com>
2445 * generic.cs (ConstructedType.CheckConstraints): Use
2446 Convert.ImplicitStandardConversionExists(); user-defined implicit
2447 conversions are not allowed according to the spec.
2449 2004-03-30 Martin Baulig <martin@ximian.com>
2451 * expression.cs (New): Added support for type parameters.
2454 (TypeManager.activator_type): New public static field.
2455 (TypeManager.activator_create_instance): Likewise.
2457 2004-03-30 Martin Baulig <martin@ximian.com>
2459 * typemanager.cs (TypeManager.HasConstructorConstraint): New
2462 2004-03-30 Martin Baulig <martin@ximian.com>
2464 * generic.cs (ConstructedType.CheckConstraints): Actually follow
2465 the spec here: the argument type must be convertible to the
2468 2004-03-30 Martin Baulig <martin@ximian.com>
2471 (TypeParameter.Define, TypeParameter.DefineMethod): Call
2472 TypeManager.AddTypeParameter().
2473 (ConstructedType.CheckConstraints): Re-enable this and actually
2474 check whether we have a constructor constraint.
2477 (TypeManager.builder_to_type_param): New static field.
2478 (TypeManager.AddTypeParameter): New static method.
2479 (TypeManager.LookupTypeParameter): New public method.
2481 2004-03-30 Martin Baulig <martin@ximian.com>
2483 * generic.cs (TypeParameter.DefineType): Return a boolean and use
2484 the new API to actually define the constructor constraint.
2487 (TypeManager.new_constraint_attr_type): New static field.
2488 (TypeManager.InitCoreTypes): Initialize it.
2490 2004-03-30 Martin Baulig <martin@ximian.com>
2492 * generic.cs (Constraints): Completed error checking, use correct
2495 2004-03-29 Martin Baulig <martin@ximian.com>
2497 * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
2499 * expression.cs (Invocation.InferTypeArguments): Added overloaded
2500 public version which takes a `ParameterData pd' instead of an
2503 2004-03-29 Martin Baulig <martin@ximian.com>
2505 * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
2508 2004-03-29 Martin Baulig <martin@ximian.com>
2510 * expression.cs (Argument.ResolveMethodGroup): If we're a
2511 ConstructedType, call GetMemberAccess() on it.
2513 2004-03-29 Martin Baulig <martin@ximian.com>
2515 * class.cs (MethodBase.CheckGenericOverride): New abstract method.
2516 (MethodCore.CheckGenericOverride): When overriding a generic
2517 method, check whether the constraints match.
2519 * support.cs (GenericConstraints): New public interface.
2520 (ParameterData.GenericConstraints): New public method.
2522 * parameter.cs (Parameter.Resolve): Check whether we're a generic
2523 method parameter and compute our constraints if appropriate.
2524 (Parameter.GenericConstraints): New public property.
2526 * generic.cs (Constraints): Implement GenericConstraints.
2528 2004-03-29 Martin Baulig <martin@ximian.com>
2530 * decl.cs (MemberCache.FindMemberToOverride): Use
2531 `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
2533 2004-03-29 Martin Baulig <martin@ximian.com>
2535 * generic.cs (GenericMethod.Define): Resolve our type parameters.
2537 2004-03-29 Martin Baulig <martin@ximian.com>
2539 * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
2540 not allowed on non-generic declarations").
2542 2004-03-29 Martin Baulig <martin@ximian.com>
2544 * expression.cs (Invocation.InferTypeArguments): Added overloaded
2545 public version of this method.
2547 * class.cs (MethodCore.IsDuplicateImplementation): Use
2548 Invocation.InferTypeArguments() to check this.
2550 2004-03-29 Martin Baulig <martin@ximian.com>
2552 * convert.cs: Use TypeManager.IsDelegateType() instead of
2553 comparing types correctly.
2555 2004-03-29 Martin Baulig <martin@ximian.com>
2557 * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
2558 types directly to make it work for generic instances.
2560 * typemanager.cs (TypeManager.IsSubclassOf): New static method.
2562 2004-03-29 Martin Baulig <martin@ximian.com>
2564 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
2567 2004-03-24 Martin Baulig <martin@ximian.com>
2569 * decl.cs (DeclSpace.FindType): Also use
2570 TypeManager.CheckGeneric() for types from the using clauses.
2572 2004-03-23 Martin Baulig <martin@ximian.com>
2574 * expression.cs (Invocation.OverloadResolve): Added `bool
2575 may_fail' argument and use it instead of the Location.IsNull() hack.
2577 2004-03-23 Martin Baulig <martin@ximian.com>
2579 * expression.cs (Invocation.InferType): Use correct type inference
2582 2004-03-23 Martin Baulig <martin@ximian.com>
2584 * ecore.cs (MethodGroupExpr.Name): Use
2585 TypeManager.CSharpSignature() instead of just the name.
2587 * expression.cs (Invocation.OverloadResolve): Provide better error
2589 (Invocation.DoResolve): OverloadResolve() never returns null
2590 without reporting an error, so removed the error -6 reporting here.
2592 2004-03-23 Martin Baulig <martin@ximian.com>
2594 * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
2597 * cs-parser.jay (delegate_declaration): Support generic delegates.
2599 * delegate.cs: Support generic delegates.
2601 2004-03-22 Martin Baulig <martin@ximian.com>
2603 * expression.cs (Invocation.InferParamsTypeArguments): New static
2604 method; does type inference for params arguments.
2606 2004-03-21 Martin Baulig <martin@ximian.com>
2608 * typemanager.cs (TypeManager.IsGenericMethod): New public static
2609 method; checks whether a method is a generic method.
2611 * expression.cs (Invocation.InferTypeArguments): New static method;
2612 infer type arguments for generic method invocation.
2614 * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
2615 property; we set this to true if we're resolving a generic method
2616 invocation and the user specified type arguments, ie. we're not
2617 doing type inference.
2619 2004-03-20 Martin Baulig <martin@ximian.com>
2621 * class.cs (MethodData.DeclaringType): New public property.
2622 (MethodData.Define): Set DeclaringType here.
2623 (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
2624 instead of OperatorMethodBuilder.DeclaringType.
2626 2004-03-20 Martin Baulig <martin@ximian.com>
2628 * cs-tokenizer.cs (xtoken): Return a special
2629 Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
2631 * cs-parser.jay (default_value_expression): Switch to the new
2634 2004-03-19 Martin Baulig <martin@ximian.com>
2636 * decl.cs (MemberName): New class. We use this to "construct"
2637 namespace_or_type_name's.
2639 * generics.cs (TypeArguments.GetDeclarations): New public method;
2640 returns the type arguments as a string[] and reports a CS0081 if
2641 one of them is not an identifier.
2643 * class.cs (MemberBase): The .ctor now takes the name as a
2644 MemberName instead of a string.
2645 (MemberBase.ExplicitInterfaceName): Changed type from string to
2647 (MemberBase.DoDefine): If we're an explicit implementation, the
2648 InterfaceType may be a generic instance.
2650 * cs-parser.jay (namespace_or_type_name): Return a MemberName.
2651 (namespace_name): Call MemberName.GetName () to transform the
2652 MemberName into a string and ensure we don't have any type
2654 (type_name): Call MemberName.GetTypeExpression() to transfrom the
2655 MemberName into an expression.
2656 (method_header): Use namespace_or_type_name instead of member_name.
2658 2004-04-07 Miguel de Icaza <miguel@ximian.com>
2660 * rootcontext.cs: Add new types to the boot resolution.
2662 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
2663 MulticastDelegate is not allowed.
2665 * typemanager.cs: Add new types to lookup: System.TypedReference
2668 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
2669 check for TypedReference or ArgIterator, they are not allowed.
2671 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
2672 makes us properly catch 1510 in some conditions (see bug 56016 for
2675 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
2677 * CryptoConvert.cs: update from corlib version
2680 2004-04-05 Miguel de Icaza <miguel@ximian.com>
2682 * class.cs (Indexer.Define): Check indexername declaration
2684 2004-04-05 Marek Safar <marek.safar@seznam.cz>
2686 * attribute.cs (IsClsCompliant): Fixed problem with handling
2687 all three states (compliant, not-compliant, undetected).
2689 2004-03-30 Marek Safar <marek.safar@seznam.cz>
2691 * attribute.cs (Attribute): Location is now public.
2692 (Resolve): Store resolved arguments (pos_values) in attribute class.
2693 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
2694 (GetClsCompliantAttributeValue): New method that gets
2695 CLSCompliantAttribute value.
2696 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
2697 if exists else null.
2698 (AttributeTester): New class for CLS-Compliant verification routines.
2700 * class.cs (Emit): Add CLS-Compliant verification.
2701 (Method.GetSignatureForError): Implemented.
2702 (Constructor.GetSignatureForError): Implemented
2703 (Constructor.HasCompliantArgs): Returns if constructor has
2704 CLS-Compliant arguments.
2705 (Constructor.Emit): Override.
2706 (Construcor.IsIdentifierClsCompliant): New method; For constructors
2707 is needed to test only parameters.
2708 (FieldBase.GetSignatureForError): Implemented.
2709 (TypeContainer): New member for storing base interfaces.
2710 (TypeContainer.FindMembers): Search in base interfaces too.
2712 * codegen.cs (GetClsComplianceAttribute): New method that gets
2713 assembly or module CLSCompliantAttribute value.
2714 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
2716 (ModuleClass.Emit): Add error 3012 test.
2718 * const.cs (Emit): Override and call base for CLS-Compliant tests.
2720 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
2721 state for all decl types.
2722 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
2723 if CLS-Compliant tests are required.
2724 (IsClsCompliaceRequired): New method. Analyze whether code
2725 must be CLS-Compliant.
2726 (IsExposedFromAssembly): New method. Returns true when MemberCore
2727 is exposed from assembly.
2728 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
2729 value or gets cached value.
2730 (HasClsCompliantAttribute): New method. Returns true if MemberCore
2731 is explicitly marked with CLSCompliantAttribute.
2732 (IsIdentifierClsCompliant): New abstract method. This method is
2733 used to testing error 3005.
2734 (IsIdentifierAndParamClsCompliant): New method. Common helper method
2735 for identifier and parameters CLS-Compliant testing.
2736 (VerifyClsCompliance): New method. The main virtual method for
2737 CLS-Compliant verifications.
2738 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
2739 null. I don't know why is null (too many public members !).
2740 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
2741 and get value of first CLSCompliantAttribute that found.
2743 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
2744 (VerifyClsCompliance): Override and add extra tests.
2746 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
2747 clscheck- disable CLS-Compliant verification event if assembly is has
2748 CLSCompliantAttribute(true).
2750 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
2751 ApllyAttribute is now called in emit section as in the other cases.
2752 Possible future Emit integration.
2753 (IsIdentifierClsCompliant): New override.
2754 (VerifyClsCompliance): New override.
2755 (GetEnumeratorName): Returns full enum name.
2757 * parameter.cs (GetSignatureForError): Implemented.
2759 * report.cs (WarningData): New struct for Warning message information.
2760 (LocationOfPreviousError): New method.
2761 (Warning): New method. Reports warning based on the warning table.
2762 (Error_T): New method. Reports error based on the error table.
2764 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
2765 verifications are done here.
2767 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
2769 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
2770 CLSCompliantAttribute.
2771 (all_imported_types): New member holds all imported types from other
2773 (LoadAllImportedTypes): New method fills static table with exported types
2774 from all referenced assemblies.
2775 (Modules): New property returns all assembly modules.
2777 2004-03-30 Miguel de Icaza <miguel@ximian.com>
2779 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
2780 throwing a parser error.
2782 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
2783 which removes the hardcoded get_/set_ prefixes for properties, as
2784 IL allows for the properties to be named something else.
2788 * expression.cs: Do not override operand before we know if it is
2791 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
2793 * typemanager.cs: support for pinned variables.
2795 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
2797 * decl.cs, typemanager.cs: Avoid using an arraylist
2798 as a buffer if there is only one result set.
2800 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
2802 * expression.cs: Make sure you cant call a static method
2803 with an instance expression, bug #56174.
2805 2004-03-29 Miguel de Icaza <miguel@ximian.com>
2807 * class.cs (IsDuplicateImplementation): Improve error reporting to
2808 flag 663 (method only differs in parameter modifier).
2810 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
2811 in preprocessor directives.
2813 * location.cs (LookupFile): Allow for the empty path.
2815 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
2816 better approach for some of that patch, but its failing with the
2817 CharSet enumeration. For now try/catch will do.
2819 * typemanager.cs: Do not crash if a struct does not have fields.
2822 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
2824 * expression.cs: cs0213, cant fix a fixed expression.
2827 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
2829 * cs-parser.jay: detect invalid embeded statements gracefully.
2832 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
2834 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
2837 the invocation type may not be a subclass of the tye of the item/
2838 The type of the item must be a subclass of the invocation item.
2843 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
2845 * attribute.cs: Added methods to get a string and a bool from an
2846 attribute. Required to information from AssemblyKeyFileAttribute,
2847 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
2848 * codegen.cs: Modified AssemblyName creation to include support for
2849 strongnames. Catch additional exceptions to report them as CS1548.
2850 * compiler.csproj: Updated include CryptoConvert.cs.
2851 * compiler.csproj.user: Removed file - user specific configuration.
2852 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
2853 Mono.Security assembly. The original class is maintained and tested in
2854 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
2855 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
2856 like CSC 8.0 (C# v2) supports.
2857 * Makefile: Added CryptoConvert.cs to mcs sources.
2858 * rootcontext.cs: Added new options for strongnames.
2860 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
2862 * driver.cs: For --expect-error, report error code `2'
2863 if the program compiled with no errors, error code `1' if
2864 it compiled with an error other than the one expected.
2866 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
2868 * compiler.csproj: Updated for Visual Studio .NET 2003.
2869 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
2870 * compiler.sln: Updated for Visual Studio .NET 2003.
2872 2004-03-24 Ravi Pratap M <ravi@ximian.com>
2874 * expression.cs: Fix bug #47234. We basically need to apply the
2875 rule that we prefer the conversion of null to a reference type
2876 when faced with a conversion to 'object' (csc behaviour).
2878 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
2880 * statement.cs: Shorter form for foreach, eliminates
2881 a local variable. r=Martin.
2883 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
2885 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
2886 checks if we can use brtrue/brfalse to test for 0.
2887 * expression.cs: use the above in the test for using brtrue/brfalse.
2890 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
2892 * expression.cs: Rewrite string concat stuff. Benefits:
2894 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
2895 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
2896 rather than a concat chain.
2898 * typemanager.cs: Add lookups for more concat overloads.
2900 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
2902 * expression.cs: Emit shorter il code for array init.
2919 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
2921 * statement.cs: Before, two switch blocks would be merged if the
2922 total size of the blocks (end_item - begin_item + 1) was less than
2923 two times the combined sizes of the blocks.
2925 Now, it will only merge if after the merge at least half of the
2930 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
2932 * class.cs : csc build fix for GetMethods(). See bug #52503.
2934 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
2936 * expression.cs: Make sure fp comparisons work with NaN.
2937 This fixes bug #54303. Mig approved this patch a long
2938 time ago, but we were not able to test b/c the runtime
2941 2004-03-19 Miguel de Icaza <miguel@ximian.com>
2943 * ecore.cs (TypExpr.GetHashCode): implement this overload.
2945 2004-03-19 Martin Baulig <martin@ximian.com>
2947 * class.cs (MemberCore.IsDuplicateImplementation): Check whether
2948 two overloads may unify for some type parameter substitutions and
2949 report a CS0408 if appropriate.
2951 2004-03-19 Martin Baulig <martin@ximian.com>
2953 * class.cs (MemberCore.IsDuplicateImplementation): Report the
2954 error here and not in our caller.
2956 2004-03-19 Martin Baulig <martin@ximian.com>
2958 * interface.cs: Completely killed this file.
2959 (Interface): We're now a TypeContainer and live in class.cs.
2961 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
2962 argument; we're now also called for interfaces.
2963 (TypeContainer.DefineMembers): Allow this method being called
2965 (TypeContainer.GetMethods): New public method; formerly known as
2966 Interface.GetMethod(). This is used by PendingImplementation.
2967 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
2968 it's now private and non-static.
2969 (Interface): Moved this here; it's now implemented similar to
2971 (Method, Property, Event, Indexer): Added `bool is_interface'
2972 argument to their .ctor's.
2973 (MemberBase.IsInterface): New public field.
2975 * cs-parser.jay: Create normal Method, Property, Event, Indexer
2976 instances instead of InterfaceMethod, InterfaceProperty, etc.
2977 (opt_interface_base): Removed; we now use `opt_class_base' instead.
2978 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
2980 2004-03-19 Martin Baulig <martin@ximian.com>
2982 * class.cs (MethodCore.IsDuplicateImplementation): New private
2983 method which does the CS0111 checking.
2984 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
2985 Use IsDuplicateImplementation().
2987 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
2989 * decl.cs (FindMemberToOverride): New method to find the correct
2990 method or property to override in the base class.
2992 - Make Method/Property use the above method to find the
2993 version in the base class.
2994 - Remove the InheritableMemberSignatureCompare as it is now
2997 This patch makes large code bases much faster to compile, as it is
2998 O(n) rather than O(n^2) to do this validation.
3000 Also, it fixes bug 52458 which is that nested classes are not
3001 taken into account when finding the base class member.
3003 Reviewed/Approved by Martin.
3005 2004-03-17 Martin Baulig <martin@ximian.com>
3007 * expression.cs (MemberAccess.DoResolve): Take the parent's number
3008 of type arguments into account; use the `real_num_type_args'
3009 approach like in DoResolveAsTypeStep().
3011 * generic.cs (GenericMemberAccess.DoResolve): Make this work for
3014 2004-03-17 Marek Safar <marek.safar@seznam.cz>
3016 * interface.cs: In all interface classes removed redundant
3017 member initialization.
3019 2004-03-16 Martin Baulig <martin@ximian.com>
3021 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
3023 2004-03-15 Miguel de Icaza <miguel@ximian.com>
3025 * decl.cs (DefineTypeAndParents): New helper method to define a
3026 type's containers before the type itself is defined; This is a
3027 bug exposed by the recent changes to Windows.Forms when an
3028 implemented interface was defined inside a class that had not been
3031 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
3033 (Check): Loop correctly to report errors modifiers
3034 (UNSAFE was not in the loop, since it was the same as TOP).
3036 * interface.cs: Every interface member now takes a ModFlags,
3037 instead of a "is_new" bool, which we set on the base MemberCore.
3039 Every place where we called "UnsafeOk" in the interface, now we
3040 call the proper member (InterfaceMethod.UnsafeOK) instead to get
3041 the unsafe settings from the member declaration instead of the
3042 container interface.
3044 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
3046 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
3047 `set_indexer_name' to the pending bits (one per type).
3049 We fixed a bug today that was picking the wrong method to
3050 override, since for properties the existing InterfaceMethod code
3051 basically ignored the method name. Now we make sure that the
3052 method name is one of the valid indexer names.
3054 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
3056 * support.cs (SeekableStreamReader): Keep track of stream byte
3057 positions and don't mix them with character offsets to the buffer.
3059 Patch from Gustavo Giráldez
3061 2004-03-15 Marek Safar <marek.safar@seznam.cz>
3063 * interface.cs (InterfaceSetGetBase): Removed double member
3064 initialization, base class does it as well.
3066 2004-03-13 Martin Baulig <martin@ximian.com>
3068 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
3069 when compiling corlib.
3071 2004-03-13 Miguel de Icaza <miguel@ximian.com>
3073 * convert.cs (ExplicitConversion): We were reporting an error on
3074 certain conversions (object_type source to a value type, when the
3075 expression was `null') before we had a chance to pass it through
3076 the user defined conversions.
3078 * driver.cs: Replace / and \ in resource specifications to dots.
3081 * class.cs: Add check for duplicate operators. Fixes 52477
3083 2004-03-11 Miguel de Icaza <miguel@ximian.com>
3085 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
3086 that are in the middle of the statements, not only at the end.
3089 * class.cs (TypeContainer.AddField): No longer set the
3090 `HaveStaticConstructor' flag, now we call it
3091 `UserDefineStaticConstructor' to diferentiate the slightly
3092 semantic difference.
3094 The situation is that we were not adding BeforeFieldInit (from
3095 Modifiers.TypeAttr) to classes that could have it.
3096 BeforeFieldInit should be set to classes that have no static
3101 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
3103 And most importantly Zoltan's comment:
3105 http://bugzilla.ximian.com/show_bug.cgi?id=44229
3107 "I think beforefieldinit means 'it's ok to initialize the type sometime
3108 before its static fields are used', i.e. initialization does not need
3109 to be triggered by the first access to the type. Setting this flag
3110 helps the JIT to compile better code, since it can run the static
3111 constructor at JIT time, and does not need to generate code to call it
3112 (possibly lots of times) at runtime. Unfortunately, mcs does not set
3113 this flag for lots of classes like String.
3115 csc sets this flag if the type does not have an explicit static
3116 constructor. The reasoning seems to be that if there are only static
3117 initalizers for a type, and no static constructor, then the programmer
3118 does not care when this initialization happens, so beforefieldinit
3121 This bug prevents the AOT compiler from being usable, since it
3122 generates so many calls to mono_runtime_class_init that the AOT code
3123 is much slower than the JITted code. The JITted code is faster,
3124 because it does not generate these calls if the vtable is type is
3125 already initialized, which is true in the majority of cases. But the
3126 AOT compiler can't do this."
3128 2004-03-10 Miguel de Icaza <miguel@ximian.com>
3130 * class.cs (MethodData.Emit): Refactor the code so symbolic
3131 information is generated for destructors; For some reasons we
3132 were taking a code path that did not generate symbolic information
3135 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
3137 * class.cs: Create a Constructor.CheckBase method that
3138 takes care of all validation type code. The method
3139 contains some code that was moved from Define.
3141 It also includes new code that checks for duplicate ctors.
3142 This fixes bug #55148.
3144 2004-03-09 Joshua Tauberer <tauberer@for.net>
3146 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
3147 a { ... }-style array creation invokes EmitStaticInitializers
3148 which is not good for reference-type arrays. String, decimal
3149 and now null constants (NullCast) are not counted toward
3150 static initializers.
3152 2004-03-05 Martin Baulig <martin@ximian.com>
3154 * location.cs (SourceFile.HasLineDirective): New public field;
3155 specifies whether the file contains or is referenced by a "#line"
3157 (Location.DefineSymbolDocuments): Ignore source files which
3158 either contain or are referenced by a "#line" directive.
3160 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
3162 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
3163 direct access to our parent, so check the method inline there.
3165 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
3167 * expression.cs (Invocation.EmitCall): Miguel's last commit
3168 caused a regression. If you had:
3173 In Foo the implict this would be null.
3175 2004-02-27 Miguel de Icaza <miguel@ximian.com>
3177 * expression.cs (Invocation.EmitCall): If the method is not
3178 virtual, do not emit a CallVirt to it, use Call.
3180 * typemanager.cs (GetFullNameSignature): Improve the method to
3181 cope with ".ctor" and replace it with the type name.
3183 * class.cs (ConstructorInitializer.Resolve): Now the method takes
3184 as an argument the ConstructorBuilder where it is being defined,
3185 to catch the recursive constructor invocations.
3187 2004-03-16 Martin Baulig <martin@ximian.com>
3189 * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
3190 ConstructedType, call ResolveType() on it to get the type rather
3191 than just using `expr.Type'.
3193 2004-03-16 Martin Baulig <martin@ximian.com>
3195 * generics.cs (ConstructedType.GetMemberAccess): Take the
3196 EmitContext instead on the TypeExpr and use
3197 ec.TypeContainer.CurrentType/ec.ContainerType.
3199 2004-03-16 Martin Baulig <martin@ximian.com>
3201 * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
3202 parameters before aliases.
3204 2004-03-16 Martin Baulig <martin@ximian.com>
3206 * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
3207 New oublic function; checks whether two generic instances may become
3208 equal under some instantiations (26.3.1).
3210 * class.cs (TypeContainer.Define): Call
3211 TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
3214 2004-03-16 Martin Baulig <martin@ximian.com>
3216 * class.cs (TypeContainer.GetClassBases): Moved
3217 Error_TypeParameterAsBase() here and also check whether the base
3218 class is not an attribute.
3220 2004-03-16 Martin Baulig <martin@ximian.com>
3222 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
3224 2004-03-16 Martin Baulig <martin@ximian.com>
3226 * class.cs (Error_TypeParameterAsBase): Use correct error number
3229 2004-03-16 Martin Baulig <martin@ximian.com>
3231 * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
3234 * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
3237 2004-03-15 Martin Baulig <martin@ximian.com>
3239 * typemanager.cs (TypeManager.GetFullName): New public method.
3240 (TypeManager.MemberLookup): Added `int_num_type_arguments'
3241 argument; only return members with the correct number of type
3243 (TypeManager.CheckGeneric): Allow -1 to bypass the check.
3244 (TypeManager.FilterWithClosure): Call CheckGeneric() to check
3245 whether the number of type arguments matches.
3247 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
3248 not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
3250 * expression.cs (MemberAccess): Added public `NumTypeArguments'
3251 field; it's set by the protected .ctor when we're actually a
3252 GenericMemberAccess.
3253 (MemberAccess.ResolveAsTypeStep): Compute the total number of type
3254 arguments and pass it to MemberLookupFinal ().
3256 * ecore.cs (Expression.MemberLookup): Added `int
3257 num_type_arguments' argument; only return members with the correct
3258 number of type arguments.
3259 (Expression.MemberLookupFailed): Check whether the MemberLookup
3260 failed because we did not have the correct number of type
3261 arguments; report CS0305 in this case.
3263 * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
3264 `e.ResolveAsTypeTerminal()' already did so.
3266 2004-03-15 Martin Baulig <martin@ximian.com>
3268 * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
3269 we're a ConstructedType; in this case, the caller must report an
3270 error (for instance CS0131).
3272 * generic.cs (TypeArguments): Added Location argument to the .ctor.
3273 (TypeArguments.Resolve): Actually report errors here.
3275 2004-03-15 Miguel de Icaza <miguel@ximian.com>
3277 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
3278 `set_indexer_name' to the pending bits (one per type).
3280 We fixed a bug today that was picking the wrong method to
3281 override, since for properties the existing InterfaceMethod code
3282 basically ignored the method name. Now we make sure that the
3283 method name is one of the valid indexer names.
3285 2004-03-15 Martin Baulig <martin@ximian.com>
3287 * typemanager.cs (TypeManager.IndexerPropertyName): Added support
3288 for generic instances.
3290 2004-03-13 Martin Baulig <martin@ximian.com>
3292 * class.cs (TypeContainer.DefineType): Call
3293 TypeManager.AddUserType() immediately after creating the
3294 TypeBuilder; pass all type parameters when creating the
3297 * decl.cs (DeclSpace.FindNestedType): New public method.
3298 (DeclSpace.FindType): Added `int num_type_args' argument; only
3299 return types with the correct number of type parameters.
3300 (DeclSpace.CountTypeParams): New public property.
3302 * ecore.cs (SimpleName.ctor): Added overloaded version which takes
3303 the number of type parameters; defaults to zero.
3305 * generic.cs (TypeArguments.Count): New public property.
3306 (ConstructedType.DoResolveAsTypeStep): First call
3307 ds.FindNestedType() to find out whether we're nested in the
3308 current generic type; in this case, we inherit all type parameters
3309 from the current class.
3311 * rootcontext.cs (RootContext.NamespaceLookup): Added `int
3312 num_type_args' argument.
3313 (RootContext.LookupType): Added overloaded version which takes the
3314 number of type arguments; only return types with the correct
3315 number of type arguments.
3317 * typemanager.cs (TypeManager.CheckGeneric): New public function;
3318 checks whether `Type t' has `int num_type_args'.
3320 2004-03-13 Martin Baulig <martin@ximian.com>
3322 * generic.cs (GenericMethod.DefineType): New method; calls
3323 DefineType() on all the type parameters.
3325 * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
3326 (MethodData.Define): If we're a generic method, call
3327 GenericMethod.DefineType() to define the type parameters.
3329 2004-03-10 Martin Baulig <martin@ximian.com>
3331 * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
3332 instead of IsAssignableFrom.
3334 2004-03-10 Martin Baulig <martin@ximian.com>
3336 * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
3338 * support.cs (ParameterData.HasArrayParameter): New property.
3339 (ReflectionParameters.ctor): Take a MethodBase instead of a
3340 ParameterInfo[]. If we have any type parameters, get the generic
3341 method definition and ask it whether we have variable arguments.
3343 2004-02-26 Miguel de Icaza <miguel@ximian.com>
3345 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
3346 routines to check if a type is an enumerable/enumerator allow
3347 classes that implement the IEnumerable or IEnumerator interfaces.
3349 * class.cs (Property, Operator): Implement IIteratorContainer, and
3350 implement SetYields.
3352 (Property.Define): Do the block swapping for get_methods in the
3353 context of iterators. We need to check if Properties also
3354 include indexers or not.
3356 (Operator): Assign the Block before invoking the
3357 OperatorMethod.Define, so we can trigger the Iterator code
3360 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
3361 Property and Operator classes are not created when we parse the
3362 declarator but until we have the block completed, so we use a
3363 singleton SimpleIteratorContainer.Simple to flag whether the
3364 SetYields has been invoked.
3366 We propagate this setting then to the Property or the Operator to
3367 allow the `yield' to function.
3369 2004-02-25 Marek Safar <marek.safar@seznam.cz>
3371 * codegen.cs: Implemented attribute support for modules.
3372 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
3373 Assembly/Module functionality.
3375 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
3376 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
3377 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
3379 2004-02-16 Marek Safar <marek.safar@seznam.cz>
3381 * interface.cs (FindMembers): The operation is performed on all base
3382 interfaces and not only on the first. It is required for future CLS Compliance patch.
3384 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
3386 * statement.cs, codegen.cs:
3387 This patch deals with patterns such as:
3389 public class List : IEnumerable {
3391 public MyEnumerator GetEnumerator () {
3392 return new MyEnumerator(this);
3395 IEnumerator IEnumerable.GetEnumerator () {
3399 public struct MyEnumerator : IEnumerator {
3404 Before, there were a few things we did wrong:
3405 1) we would emit callvirt on a struct, which is illegal
3406 2) we emited ldarg when we needed to emit ldarga
3407 3) we would mistakenly call the interface methods on an enumerator
3408 type that derived from IEnumerator and was in another assembly. For example:
3410 public class MyEnumerator : IEnumerator
3412 Would have the interface methods called, even if there were public impls of the
3413 method. In a struct, this lead to invalid IL code.
3415 2004-02-11 Marek Safar <marek.safar@seznam.cz>
3417 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
3420 * delegate.cs (Define): Fixed crash when delegate type is undefined.
3422 2004-02-11 Miguel de Icaza <miguel@ximian.com>
3424 * cs-parser.jay: Fix small regression: we were not testing V2
3425 compiler features correctly.
3427 * interface.cs: If the emit context is null, then create one
3429 2004-02-09 Marek Safar <marek.safar@seznam.cz>
3431 * decl.cs (GetSignatureForError): New virtual method to get full name
3434 * attribute.cs (IAttributeSupport): New interface for attribute setting.
3435 Now it is possible to rewrite ApplyAttributes method to be less if/else.
3437 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
3438 Duplicated members and code in these classes has been removed.
3439 Better encapsulation in these classes.
3441 2004-02-07 Miguel de Icaza <miguel@ximian.com>
3443 * assign.cs (Assign.DoResolve): When dealing with compound
3444 assignments, there is a new rule in ECMA C# 2.4 (might have been
3445 there before, but it is documented here) that states that in:
3449 If b is of type int, and the `op' is a shift-operator, then the
3450 above is evaluated as:
3454 * expression.cs (Binary.ResolveOperator): Instead of testing for
3455 int/uint/long/ulong, try to implicitly convert to any of those
3456 types and use that in pointer arithmetic.
3458 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
3459 method to print information for from the type, not from the
3460 null-method we were given.
3462 2004-02-01 Duncan Mak <duncan@ximian.com>
3464 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
3465 parsing for cmd, fixes bug #53694.
3467 2004-02-04 Marek Safar <marek.safar@seznam.cz>
3469 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
3470 in the member name duplication tests. Property and operator name duplication
3471 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
3473 2004-02-03 Marek Safar <marek.safar@seznam.cz>
3475 * interface.cs (PopulateMethod): Fixed crash when interface method
3476 returns not existing type (error test cs0246-3.cs).
3478 2004-02-02 Ravi Pratap M <ravi@ximian.com>
3480 * cs-parser.jay (interface_accessors): Re-write actions to also
3481 store attributes attached to get and set methods. Fix spelling
3484 (inteface_property_declaration): Modify accordingly.
3486 (InterfaceAccessorInfo): New helper class to store information to pass
3487 around between rules that use interface_accessors.
3489 * interface.cs (Emit): Apply attributes on the get and set
3490 accessors of properties and indexers too.
3492 * attribute.cs (ApplyAttributes): Modify accordingly to use the
3493 right MethodBuilder when applying attributes to the get and set accessors.
3495 2004-01-31 Miguel de Icaza <miguel@ximian.com>
3497 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
3499 2004-01-26 Miguel de Icaza <miguel@ximian.com>
3501 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
3503 2004-01-25 Miguel de Icaza <miguel@ximian.com>
3505 * cs-parser.jay: Remove YIELD token, instead use the new grammar
3506 changes that treat `yield' specially when present before `break'
3509 * cs-tokenizer.cs: yield is no longer a keyword.
3511 2004-01-23 Marek Safar <marek.safar@seznam.cz>
3513 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
3514 setting for default constructors.
3515 For default constructors are almost every time set wrong Modifier. The
3516 generated IL code has been alright. But inside mcs this values was
3517 wrong and this was reason why several of my CLS Compliance tests
3520 2004-02-27 Martin Baulig <martin@ximian.com>
3522 * generics.cs (ConstructedType.ResolveType): Make the nested type
3523 stuff actually work.
3525 2004-02-25 Martin Baulig <martin@ximian.com>
3527 * decl.cs (DeclSpace.CurrentTypeParameters): New protected
3528 property; returns the type parameters just from the current type,
3529 ie. with the ones from outer classes.
3530 (DeclSpace.LookupGeneric): First search in the current class, then
3532 (DeclSpace.initialize_type_params): When hiding a type parameter
3533 from an outer class, put it into the `type_param_list' anyways.
3535 * expression.cs (MemberAccess.expr): Made this field protected.
3537 * class.cs (TypeContainer.Define): The `CurrentType' just contains
3538 the type parameters from the current class.
3540 * generic.cs (ConstructedType.ResolveType): Support nested generic
3541 types by taking the type parameters which we inherit from outer
3542 classes into account.
3543 (GenericMemberAccess.ResolveAsTypeStep): Override this and added
3544 support for nested generic types.
3546 2004-02-23 Martin Baulig <martin@ximian.com>
3548 * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
3549 field and check whether we're nested inside a generic type.
3550 (DeclSpace.ResolveType): If we're resolving to a generic type
3551 definition, create a ConstructedType and return its resolved type.
3552 (DeclSpace.initialize_type_params): New private method;
3553 initializes the `type_param_list' field from the type parameters
3554 from this and all enclosing classes.
3555 (DeclSpace.TypeParameters): Call initialize_type_params() unless
3556 we're already initialized.
3558 2004-02-23 Martin Baulig <martin@ximian.com>
3560 * class.cs (Method.Define): Create the generic method before
3562 (Memberbase.DoDefine): Added DeclSpace argument (in addition to
3563 the TypeContainer one); we use this for generic methods.
3565 * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
3566 parent's TypeBuilder.
3568 2004-02-18 Martin Baulig <martin@ximian.com>
3570 * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
3571 to check for equality.
3573 2004-02-05 Martin Baulig <martin@ximian.com>
3575 * ecore.cs (FieldExpr.DoResolveLValue): If we have an
3576 `ec.TypeContainer.CurrentType', use it instead of
3577 `ec.ContainerType' to check whether we're in the type's ctor.
3579 2004-01-29 Martin Baulig <martin@ximian.com>
3581 * expression.cs (Invocation.DoResolve): If we're a
3582 `ConstructedType', then we're actually a generic method, so
3583 rewrite the expr as a GenericMemberAccess.
3585 * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
3586 here; manually parse it into a string.
3588 2004-01-28 Martin Baulig <martin@ximian.com>
3590 * typemanager.cs (TypeManager.IsEqual): New static method.
3591 (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
3592 check for equality instead of using `=='.
3594 2004-01-26 Martin Baulig <martin@ximian.com>
3596 * decl.cs (DeclSpace.CurrentType): New public field.
3598 * expression.cs (This.ResolveBase): If we have an
3599 `ec.TypeContainer.CurrentType', use it instead of
3602 * class.cs (TypeContainer.DefineType): If we're a generic type,
3603 create the `CurrentType' (unresolved).
3604 (TypeContainer.GenericType): New private field.
3605 (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
3606 it and store it in `GenericType' before creating the MemberCache.
3607 (TypeContainer.GetMembers): If we have a `GenericType', call
3608 TypeManager.FindMembers() on it.
3610 * interface.cs (Interface.GenericType): New private field.
3611 (Interface.DefineType): If we're a generic type, create the
3612 `CurrentType' (unresolved).
3613 (Interface.DefineMembers): If we have a `CurrentType', resolve it
3614 and store it in `GenericType' before creating the MemberCache.
3615 (Interface.GetMembers): If we have a `GenericType', call
3616 TypeManager.FindMembers() on it.
3618 2004-01-22 Martin Baulig <martin@ximian.com>
3620 * cs-parser.jay (namespace_or_type_name): Return an Expression,
3621 not a QualifiedIdentifier. This is what `type_name_expression'
3622 was previously doing.
3623 (type_name_expression): Removed; the code is now in
3624 `namespace_or_type_name'.
3625 (qualified_identifier): Removed, use `namespace_or_type_name'
3627 (QualifiedIdentifier): Removed this class.
3629 2004-01-22 Martin Baulig <martin@ximian.com>
3631 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
3632 not a string as alias name.
3634 2004-01-21 Miguel de Icaza <miguel@ximian.com>
3636 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
3637 #52730 bug, and instead compute correctly the need to use a
3638 temporary variable when requesting an address based on the
3639 static/instace modified of the field and the constructor.
3641 2004-01-21 Martin Baulig <martin@ximian.com>
3643 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
3644 class and namespace before looking up aliases. Fixes #52517.
3646 2004-01-21 Martin Baulig <martin@ximian.com>
3648 * flowanalysis.cs (UsageVector.Merge): Allow variables being
3649 assinged in a 'try'; fixes exception4.cs.
3651 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3652 * class.cs : Implemented parameter-less constructor for TypeContainer
3654 * decl.cs: Attributes are now stored here. New property OptAttributes
3656 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
3658 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
3660 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3662 * typemanager.cs (CSharpSignature): Now reports also inner class name.
3663 (CSharpSignature): New method for indexer and property signature.
3665 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3667 * pending.cs (IsVirtualFilter): Faster implementation.
3669 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3671 * typemanager.cs: Avoid inclusion of same assembly more than once.
3673 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3675 * cs-parser.jay: Fixed problem where the last assembly attribute
3676 has been applied also to following declaration (class, struct, etc.)
3678 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3680 * class.cs: Added error CS0538, CS0539 reporting.
3681 Fixed crash on Microsoft runtime when field type is void.
3683 * cs-parser.jay: Added error CS0537 reporting.
3685 * pending.cs: Added error CS0535 reporting.
3686 Improved error report for errors CS0536, CS0534.
3688 2004-01-20 Miguel de Icaza <miguel@ximian.com>
3690 Merge a few bits from the Anonymous Method MCS tree.
3692 * statement.cs (ToplevelBlock): New class for toplevel methods,
3693 will hold anonymous methods, lifted variables.
3695 * cs-parser.jay: Create toplevel blocks for delegates and for
3696 regular blocks of code.
3698 2004-01-20 Martin Baulig <martin@ximian.com>
3700 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
3701 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
3702 and `NeedExplicitReturn'; added `IsLastStatement'.
3703 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
3704 have a `ReturnLabel' or we're not unreachable.
3706 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
3707 child's reachability; don't just override ours with it. Fixes
3708 #58058 (lluis's example).
3709 (FlowBranching): Added public InTryOrCatch(), InCatch(),
3710 InFinally(), InLoop(), InSwitch() and
3711 BreakCrossesTryCatchBoundary() methods.
3713 * statement.cs (Return): Do all error checking in Resolve().
3714 Unless we are the last statement in a top-level block, always
3715 create a return label and jump to it.
3716 (Break, Continue): Do all error checking in Resolve(); also make
3717 sure we aren't leaving a `finally'.
3718 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
3719 statement in a top-level block.
3720 (Block.Flags): Added `IsDestructor'.
3721 (Block.IsDestructor): New public property.
3723 2004-01-20 Martin Baulig <martin@ximian.com>
3725 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
3727 2004-01-20 Martin Baulig <martin@ximian.com>
3729 * statement.cs (Statement.ResolveUnreachable): New public method.
3730 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
3731 (Block.Resolve): Resolve unreachable statements.
3733 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
3735 * expression.cs: We need to fix the case where we do
3736 not have a temp variable here.
3738 * assign.cs: Only expression compound assignments need
3739 temporary variables.
3741 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
3743 * flowanalysis.cs: Reduce memory allocation in a few ways:
3744 - A block with no variables should not allocate a bit
3746 - A method with no out parameters does not need any tracking
3747 for assignment of the parameters, so we need not allocate
3750 public readonly Type[] VariableTypes;
3751 public readonly string[] VariableNames;
3752 Are redundant. The data is already stored in the variable
3753 map, so we need not allocate another array for it.
3754 - We need to add alot of checks for if (params | locals) == null
3755 due to the first two changes.
3757 2004-01-18 Miguel de Icaza <miguel@ximian.com>
3759 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
3760 implement IMemoryLocation, we store a copy on a local variable and
3761 take the address of it. Patch from Benjamin Jemlich
3763 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
3764 to use a special "type_name_expression" rule which reduces the
3765 number of "QualifiedIdentifier" classes created, and instead
3766 directly creates MemberAccess expressions.
3768 2004-01-17 Miguel de Icaza <miguel@ximian.com>
3770 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
3771 that fixes #52853. Null literal assignment to ValueType
3773 * class.cs (MethodData.Emit): Instead of checking the name of the
3774 method to determine if its a destructor, create a new derived
3775 class from Method called Destructor, and test for that.
3777 * cs-parser.jay: Create a Destructor object instead of a Method.
3779 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
3783 2004-01-16 Miguel de Icaza <miguel@ximian.com>
3785 * expression.cs (Binary.ResolveOperator): Perform an implicit
3786 conversion from MethodGroups to their delegate types on the
3789 * delegate.cs: Introduce a new class DelegateCreation that is the
3790 base class for `NewDelegate' and `ImplicitDelegateCreation',
3791 factor some code in here.
3793 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
3794 conversion from MethodGroups to compatible delegate types.
3796 * ecore.cs (Expression.Resolve): Do not flag error 654
3797 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
3798 we allow conversions from MethodGroups to delegate types now.
3800 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
3801 assignments in v2 either.
3803 2004-01-10 Miguel de Icaza <miguel@ximian.com>
3805 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
3806 static read-only fields in ctors.
3808 Applied patch from Benjamin Jemlich
3810 * expression.cs (UnaryMutator): Avoid leaking local variables.
3812 2004-01-09 Miguel de Icaza <miguel@ximian.com>
3814 * cs-tokenizer.cs (IsCastToken): Allow the various native types
3815 here to return true, as they can be used like this:
3819 Fixed 49836 and all the other dups
3821 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
3823 * driver.cs: Implement /win32res and /win32icon.
3825 2004-01-08 Miguel de Icaza <miguel@ximian.com>
3827 * cs-parser.jay: Add a rule to improve error handling for the
3828 common mistake of placing modifiers after the type.
3830 2004-01-07 Miguel de Icaza <miguel@ximian.com>
3832 * cs-parser.jay (interface_event_declaration): Catch
3833 initialization of events on interfaces, and report cs0068
3835 * cs-parser.jay (interface_event_declaration): Catch
3836 initialization of events.
3838 * ecore.cs: Better report missing constructors.
3840 * expression.cs (Binary.ResolveOperator): My previous bug fix had
3841 the error reporting done in the wrong place. Fix.
3843 * expression.cs (Binary.ResolveOperator): Catch the
3844 operator + (E x, E y) error earlier, and later allow for implicit
3845 conversions in operator +/- (E e, U x) from U to the underlying
3848 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
3849 52596, if the container class is abstract, the default constructor
3850 is protected otherwise its public (before, we were always public).
3852 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
3855 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
3856 Jemlich that fixes bug #52597, MCS was generating invalid code for
3857 idisposable structs. Thanks to Ben for following up with this
3860 2004-01-06 Miguel de Icaza <miguel@ximian.com>
3862 * driver.cs: Allow assemblies without code to be generated, fixes
3865 2004-01-07 Nick Drochak <ndrochak@gol.com>
3867 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
3869 2004-01-05 Miguel de Icaza <miguel@ximian.com>
3871 * cs-parser.jay: Add rules to improve error reporting if fields or
3872 methods are declared at the namespace level (error 116)
3874 * Add rules to catch event add/remove
3876 2004-01-04 David Sheldon <dave-mono@earth.li>
3878 * expression.cs: Added matching ")" to error message for
3881 2004-01-03 Todd Berman <tberman@gentoo.org>
3883 * ecore.cs, attribute.cs:
3884 Applying fix from #52429.
3886 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3888 * ecore.cs, expression.cs, statement.cs:
3889 Total rewrite of how we handle branching. We
3890 now handle complex boolean expressions with fewer
3891 jumps. As well if (x == 0) no longer emits a ceq.
3893 if (x is Foo) is much faster now, because we generate
3896 Overall, we get a pretty big improvement on our benchmark
3897 tests. The code we generate is smaller and more readable.
3899 I did a full two-stage bootstrap. The patch was reviewed
3900 by Martin and Miguel.
3902 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3904 * cs-parser.jay: Make primary_expression not take a QI.
3905 we dont need this because the member_access rule covers
3906 us here. So we replace the rule with just IDENTIFIER.
3908 This has two good effects. First, we remove a s/r conflict.
3909 Second, we allocate many fewer QualifiedIdentifier objects.
3911 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3913 * attribute.cs: Handle MarshalAs attributes as pseudo, and
3914 set the correct information via SRE. This prevents
3915 hanging on the MS runtime. Fixes #29374.
3917 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3919 * convert.cs: correctly handle conversions to value types
3920 from Enum and ValueType as unboxing conversions.
3922 Fixes bug #52569. Patch by Benjamin Jemlich.
3924 2004-01-02 Ravi Pratap <ravi@ximian.com>
3926 * expression.cs (BetterConversion): Prefer int -> uint
3927 over int -> ulong (csc's behaviour). This fixed bug #52046.
3929 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
3931 * decl.cs (MemberCache.FindMembers): now returns a
3934 * typemanager.cs: In general, go with with ^^.
3935 (CopyNewMethods): take an IList.
3936 (RealMemberLookup): Only allocate an arraylist
3937 if we copy from two sets of methods.
3939 This change basically does two things:
3940 1) Fewer array lists allocated due to CopyNewMethods.
3941 2) the explicit cast in MemberList costed ALOT.
3943 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
3945 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
3946 a hashtable to avoid needless string allocations when an identifier is
3947 used more than once (the common case).
3949 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
3951 * pending.cs: MS's TypeBuilder.GetInterfaces ()
3952 is broken, it will not return anything. So, we
3953 have to use the information we have in mcs to
3956 * typemanager.cs: Add a cache for GetInterfaces,
3957 since this will now be used more often (due to ^^)
3959 (GetExplicitInterfaces) New method that gets the
3960 declared, not effective, interfaces on a type
3961 builder (eg, if you have interface IFoo, interface
3962 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
3965 This patch makes MCS able to bootstrap itself on
3968 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
3970 * expression.cs: Remove the Nop's that Miguel put
3973 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
3975 * report.cs, codegen.cs: Give the real stack trace to
3976 the error when an exception is thrown.
3978 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
3980 * decl.cs: only allocate hashtables for ifaces if
3983 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
3985 * expression.cs: fix the error from cs0121-2.cs
3986 (a parent interface has two child interfaces that
3987 have a function with the same name and 0 params
3988 and the function is called through the parent).
3990 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
3992 * class.cs, rootcontext.cs, typmanager.cs: do not
3995 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
3997 * codegen.cs: remove stack for the ec flow branching.
3998 It is already a linked list, so no need.
4000 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
4002 * Makefile: Allow custom profiler here.
4004 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
4006 * typemanager.cs (LookupType):
4007 - Use a static char [], because split takes
4008 a param array for args, so it was allocating
4010 - Do not store true in a hashtable, it boxes.
4012 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
4014 * flowanalysis.cs: bytify common enums.
4016 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
4018 * modifiers.cs: Add a new set of flags for the
4019 flags allowed on explicit interface impls.
4020 * cs-parser.jay: catch the use of modifiers in
4021 interfaces correctly.
4022 * class.cs: catch private void IFoo.Blah ().
4024 All related to bug #50572.
4026 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
4028 * decl.cs: Rewrite the consistant accessability checking.
4029 Accessability is not linear, it must be implemented in
4030 a tableish way. Fixes #49704.
4032 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
4034 * expression.cs: Handle negation in a checked context.
4035 We must use subtraction from zero. Fixes #38674.
4037 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
4039 * class.cs: Ignore static void main in DLLs.
4040 * rootcontext.cs: Handle the target type here,
4041 since we are have to access it from class.cs
4042 * driver.cs: account for the above.
4044 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
4046 * report.cs: Give line numbers and files if available.
4048 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
4050 * driver.cs: Implement /addmodule.
4052 * typemanager.cs: Change 'modules' field so it now contains Modules not
4055 2003-12-20 Martin Baulig <martin@ximian.com>
4057 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
4058 (FieldBase.IsAssigned): Removed this field.
4059 (FieldBase.SetAssigned): New public method.
4060 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
4062 2003-12-20 Martin Baulig <martin@ximian.com>
4064 * expression.cs (LocalVariableReference.DoResolve): Don't set
4065 `vi.Used' if we're called from DoResolveLValue().
4067 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
4068 returns the usage vector it just merged into the current one -
4069 pass this one to UsageWarning().
4070 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
4071 of the `EmitContext', don't call this recursively on our children.
4073 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
4075 * driver.cs: Implement /target:module.
4077 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
4079 * support.cs (CharArrayHashtable): New helper class.
4081 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
4082 char arrays, not strings, so we can avoid creating a string in
4083 consume_identifier if the identifier is a keyword.
4085 2003-12-16 Martin Baulig <martin@ximian.com>
4087 * statement.cs (LocalInfo.Assigned): Removed this property.
4088 (LocalInfo.Flags): Removed `Assigned'.
4089 (LocalInfo.IsAssigned): New public method; takes the EmitContext
4090 and uses flow analysis.
4091 (Block.UsageWarning): Made this method private.
4092 (Block.Resolve): Call UsageWarning() if appropriate.
4094 * expression.cs (LocalVariableReference.DoResolve): Always set
4095 LocalInfo.Used here.
4097 2003-12-13 Martin Baulig <martin@ximian.com>
4099 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
4100 any value here; we're now using flow analysis to figure out
4101 whether a statement/block returns a value.
4103 2003-12-13 Martin Baulig <martin@ximian.com>
4105 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
4107 (FlowBranching.MergeFinally): Don't call
4108 `branching.CheckOutParameters()' here, this is called in
4110 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
4111 when adding the `finally' vector.
4113 2003-12-13 Martin Baulig <martin@ximian.com>
4116 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
4117 actually work and also fix #48962.
4119 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
4121 * decl.cs: Do not check System.Object for nested types,
4122 since we know it does not have any. Big bang for buck:
4127 corlib: 17.99 seconds
4131 corlib: 17.39 seconds
4133 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
4135 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
4136 time we are returning 0 members, so we save alot here.
4138 2003-12-11 Martin Baulig <martin@ximian.com>
4140 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
4141 `MergeChild()', also just take the `FlowBranching' as argument;
4142 call Merge() on it and return the result.
4143 (FlowBranching.Merge): We don't need to do anything if we just
4146 2003-12-11 Martin Baulig <martin@ximian.com>
4148 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
4149 them in an `ArrayList' to reduce memory usage. Thanks to Ben
4150 Maurer for this idea.
4152 2003-12-11 Martin Baulig <martin@ximian.com>
4154 * flowanalysis.cs (MergeResult): This class is now gone; we now
4155 use the `UsageVector' for this. The reason for this is that if a
4156 branching just has one sibling, we don't need to "merge" them at
4157 all - that's the next step to do.
4158 (FlowBranching.Merge): We now return a `UsageVector' instead of a
4161 2003-12-11 Martin Baulig <martin@ximian.com>
4163 Reworked flow analyis and made it more precise and bug-free. The
4164 most important change is that we're now using a special `Reachability'
4165 class instead of having "magic" meanings of `FlowReturns'. I'll
4166 do some more cleanups and optimizations and also add some more
4167 documentation this week.
4169 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
4170 largely reworked this class.
4171 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
4172 the new `Reachability' class instead of having "magic" values here.
4173 (FlowBranching): We're now using an instance of `Reachability'
4174 instead of having separate `Returns', `Breaks' etc. fields.
4176 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
4177 based on flow analysis; ignore the return value of block.Emit ().
4179 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
4181 * driver.cs typemanager.cs: Find the mono extensions to corlib even
4182 if they are private.
4184 2003-12-09 Martin Baulig <martin@ximian.com>
4186 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
4187 call them directly on the UsageVector.
4189 2003-12-09 Martin Baulig <martin@ximian.com>
4191 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
4192 Changed return type from `FlowReturns' to `Reachability'.
4194 2003-12-09 Martin Baulig <martin@ximian.com>
4196 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
4197 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
4198 `Reachable' fields with a single `Reachability' one.
4200 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4202 * class.cs (FindMembers): Remove foreach's.
4215 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4220 This patch does a few things:
4221 1. EmptyStatement is now a singleton, so it is never reallocated.
4222 2. All blah is EmptyStatement constructs have been changed to
4223 blah == EmptyStatement.Value, which is much faster and valid
4224 now that EmptyStatement is a singleton.
4225 3. When resolving a block, rather than allocating a new array for
4226 the non-empty statements, empty statements are replaced with
4227 EmptyStatement.Value
4228 4. Some recursive functions have been made non-recursive.
4229 Mainly the performance impact is from (3), however (1) and (2) are needed for
4230 this to work. (4) does not make a big difference in normal situations, however
4231 it makes the profile look saner.
4236 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
4237 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
4238 Total memory allocated: 56397 KB
4241 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
4242 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
4243 Total memory allocated: 55666 KB
4245 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4247 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
4248 than the hashtable in a hashtable version
4250 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
4251 we always end up concating a string. This results in a huge perf
4252 loss, because many strings have to be tracked by the GC. In this
4253 patch, we first use a hashtable that works with two keys, so that
4254 the strings do not need to be concat'ed.
4265 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4267 * Makefile: Add a new target `do-time' that does a quick and simple
4268 profile, leaving easy to parse output.
4270 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
4272 * codegen.cs (Init): Create the dynamic assembly with
4273 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
4275 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
4277 * support.cs: Make the PtrHashtable use only one
4278 instance of its comparer.
4280 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
4282 * typemanager.cs: Fix lookup of GetNamespaces.
4284 2003-11-29 Miguel de Icaza <miguel@ximian.com>
4286 * expression.cs: Removed redundant line.
4288 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
4289 ArrayLists, use for loops with bounds.
4291 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
4294 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
4295 arraylists, use for loop with bounds.
4297 The above three changes give us a 0.071 second performance
4298 improvement out of 3.294 seconds down to 3.223. On my machine
4299 the above changes reduced the memory usage by 1,387 KB during
4302 * cs-parser.jay (QualifiedIdentifier): New class used to represent
4303 QualifiedIdentifiers. Before we created a new string through
4304 concatenation, and mostly later on, the result would be
4305 manipulated by DecomposeQI through string manipulation.
4307 This reduced the compiler memory usage for bootstrapping from
4308 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
4309 compile times in 0.05 seconds.
4311 2003-11-28 Dick Porter <dick@ximian.com>
4313 * support.cs: Do string compares with the Invariant culture.
4321 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
4322 the comparison is done with the Invariant culture.
4324 2003-11-27 Miguel de Icaza <miguel@ximian.com>
4326 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
4327 GetEnumerator method.
4329 (ProbeCollectionType): Iterate starting at the most specific type
4330 upwards looking for a GetEnumerator
4332 * expression.cs: Shift count can be up to 31 for int/uint and 63
4335 2003-11-26 Miguel de Icaza <miguel@ximian.com>
4337 * statement.cs (Block.LookupLabel): Also look for the label on the
4338 children blocks. Use a hash table to keep track of visited
4341 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
4342 we actually did transform the other operand, otherwise fall back
4343 to the common codepath that casts to long.
4345 * cs-tokenizer.cs: Use the same code pattern as the int case.
4346 Maybe I should do the parsing myself, and avoid depending on the
4347 Parse routines to get this done.
4349 2003-11-25 Miguel de Icaza <miguel@ximian.com>
4351 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
4352 which fixes bug 51347. This time test it.
4354 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
4355 attributes for example can not tell the difference between these.
4356 The difference was only a syntax feature of the language.
4358 * attribute.cs: Apply attributes to delegates.
4360 * delegate.cs: Call the apply attributes method.
4362 2003-11-24 Miguel de Icaza <miguel@ximian.com>
4364 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
4365 comparing 0 vs Byte.MinValue, not the value
4367 (ImplicitConversionRequired): When reporting a conversion error,
4368 use error 31 to print out the constant error instead of the
4371 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
4372 which fixes bug 51347.
4374 2003-11-22 Miguel de Icaza <miguel@ximian.com>
4376 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
4377 which fixes the -warnaserror command line option.
4379 2003-11-21 Miguel de Icaza <miguel@ximian.com>
4381 * cfold.cs (DoNumericPromotions): During constant folding of
4382 additions on UIntConstant, special case intconstants with
4383 IntConstants like we do on the expression binary operator.
4385 2003-11-12 Miguel de Icaza <miguel@ximian.com>
4387 * convert.cs (ImplicitReferenceConversion): We were missing a case
4388 (System.Enum are not value types or class types, so we need to
4389 classify them separatedly).
4391 * driver.cs: We do not support error 2007.
4393 2003-11-12 Jackson Harper <jackson@ximian.com>
4395 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
4396 system directory. Also use the full file name so users can
4397 libraries names mscorlib-o-tron.dll in a non system dir.
4399 2004-01-04 David Sheldon <dave-mono@earth.li>
4401 * expression.cs: Added matching ")" to error message for CS0077.
4403 2003-12-19 Martin Baulig <martin@ximian.com>
4405 * typemanager.cs (TypeManager.IsEqualGenericType): New public
4406 static method; see documentation in the method.
4407 (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
4409 * convert.cs (Convert.ImplicitReferenceConversion,
4410 Convert.ImplicitReferenceConversionExists): Add support for
4411 generic type declarations; see gen-36.cs.
4413 2003-12-19 Martin Baulig <martin@ximian.com>
4415 * pending.cs (Pending.InterfaceMethod): Use
4416 `Type.IsAssignableFrom()' instead of `=='.
4418 2003-12-18 Martin Baulig <martin@ximian.com>
4420 * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
4423 * convert.cs (Convert.ImplicitStandardConversionExists): Use
4424 `expr_type.Equals (target_type)' instead of `=='.
4426 2003-12-08 Martin Baulig <martin@ximian.com>
4428 * generics.cs (Constraints.Types): Removed.
4429 (Constraints.Resolve): Just resolve everything to TypeExpr's, not
4431 (Constraints.ResolveTypes): New public method; resolves the
4432 TypeExpr's to Type's.
4433 (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
4434 longer takes the constraints.
4435 (TypeParameter.DefineMethod): Likewise.
4436 (TypeParameter.DefineType): New public method. Calls
4437 `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
4440 2003-12-08 Martin Baulig <martin@ximian.com>
4442 * convert.cs (Convert.ImplicitConversionStandard): Use
4443 `expr_type.Equals (target_type)' instead of `=='.
4445 2003-12-08 Martin Baulig <martin@ximian.com>
4447 * typemanager.cs (TypeManager.GetReferenceType): Call
4448 `Type.MakeByRefType ()'.
4450 2003-12-08 Martin Baulig <martin@ximian.com>
4452 * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
4453 just has some special meaning in some situations. For instance,
4454 it is allowed to use `where' as the name of a variable etc.
4456 2003-12-04 Martin Baulig <martin@ximian.com>
4458 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
4459 `Type.MakeArrayType()' for array types.
4461 2003-11-18 Miguel de Icaza <miguel@ximian.com>
4463 * expression.cs (Invocation.VerifyArgumentsCompat): Remove
4466 (SizeOf.DoResolve): assign the `type_queried' field. This gets
4469 2003-11-16 Martin Baulig <martin@ximian.com>
4471 * codegen.cs (EmitContext.IsGeneric): Removed.
4473 * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
4474 ResolveGeneric() on the DeclSpace.
4476 2003-11-16 Martin Baulig <martin@ximian.com>
4478 * generic.cs (TypeArguments.Resolve):
4479 `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
4480 `ResolveType()' on it to get the Type.
4482 2003-11-15 Martin Baulig <martin@ximian.com>
4484 * generic.cs (ConstructedType.GetInterfaces): Override this.
4486 2003-11-14 Martin Baulig <martin@ximian.com>
4488 * interface.cs (Interface.DefineType): Define all type parameters
4489 before adding the interfaces we inherit.
4491 2003-11-11 Martin Baulig <martin@ximian.com>
4493 * generic.cs (ConstructedType.ResolveType): Always call
4494 `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
4496 2003-11-10 Martin Baulig <martin@ximian.com>
4498 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
4499 (TypeManager.InitCoreTypes): Initialize them here, but instead of
4500 calling `ResolveType()' on them, directly assign their `Type'.
4502 2003-11-08 Martin Baulig <martin@ximian.com>
4504 * generic.cs (ConstructedType): Override `IsClass' etc.
4506 2003-11-08 Martin Baulig <martin@ximian.com>
4508 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
4509 return value and the `out parent' parameter.
4510 (TypeContainer.DefineType): Moved the CS0644 check into
4511 GetClassBases(). Don't pass the interface types to the
4512 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
4513 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
4515 * ecore.cs (TypeExpr.IsAttribute): New property.
4516 (TypeExpr.GetInterfaces): New method.
4518 * interface.cs (Interface.GetInterfaceTypeByName): Return a
4519 TypeExpr instead of a Type.
4520 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
4521 (Interface.DefineType): Don't pass the interface types to the
4522 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
4523 them later and then call `TypeBulider.AddInterfaceImplementation()'.
4525 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
4526 instead of a `Type[]'.
4527 (TypeManager.RegisterBuilder): Likewise.
4528 (TypeManager.AddUserInterface): Likewise.
4529 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
4530 `Type[]' and also return a `TypeExpr[]'.
4531 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
4533 2003-11-08 Martin Baulig <martin@ximian.com>
4535 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
4538 2003-11-08 Martin Baulig <martin@ximian.com>
4540 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
4541 TypeManager.ResolveExpressionTypes().
4543 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
4544 instead of an Expression.
4545 (TypeExpr): This is now an abstract base class for `TypeExpression'.
4546 (TypeExpression): New public class; formerly known as `TypeExpr'.
4548 * expression.cs (ComposedCast): Derive from TypeExpr.
4550 * typemanager.cs (TypeManager.system_*_expr): These are now
4551 TypExpr's instead of Expression's.
4552 (TypeManager.ResolveExpressionTypes): New public static function;
4553 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
4556 2003-11-06 Miguel de Icaza <miguel@ximian.com>
4558 * expression.cs (New.DoResolve): Do not dereference value that
4559 might be a null return.
4561 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
4562 sure that the constant value has the right type. Fixes an
4563 unreported bug, similar to 50425.
4565 * const.cs (Const.LookupConstantValue): Call
4566 ImplicitStandardConversionExists before doing a conversion to
4567 avoid havng the TypeManager.ChangeType do conversions.
4569 Reduced the number of casts used
4571 (Const.ChangeType): New routine to enable reuse of the constant
4572 type changing code from statement.
4574 * typemanager.cs (ChangeType): Move common initialization to
4575 static global variables.
4579 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
4580 every value type to go through, even if it was void. Fix that.
4582 * cs-tokenizer.cs: Use is_identifier_start_character on the start
4583 character of the define, and the is_identifier_part_character for
4584 the rest of the string.
4586 2003-11-05 Miguel de Icaza <miguel@ximian.com>
4588 * expression.cs (UnaryMutator.EmitCode): When I updated
4589 LocalVariableReference.DoResolve, I overdid it, and dropped an
4590 optimization done on local variable references.
4592 2003-11-04 Miguel de Icaza <miguel@ximian.com>
4594 * ecore.cs: Convert the return from Ldlen into an int.
4596 2003-10-20 Miguel de Icaza <miguel@ximian.com>
4598 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
4599 the accessibility, this is a special case for toplevel non-public
4600 classes (internal for instance).
4602 2003-10-20 Nick Drochak <ndrochak@gol.com>
4604 * ecore.cs: Fix typo and build. Needed another right paren.
4606 2003-10-19 Miguel de Icaza <miguel@ximian.com>
4608 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
4609 `internal' case regular and protected, but not allowing protected
4610 to be evaluated later. Bug 49840
4612 2003-10-15 Miguel de Icaza <miguel@ximian.com>
4614 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
4615 to kb.Nlast, and not the kb.nFirst to isolate the switch
4618 Extract the underlying type, so enumerations of long/ulong are
4619 treated like long/ulong.
4621 2003-10-14 Miguel de Icaza <miguel@ximian.com>
4623 * expression.cs (New): Overload the meaning of RequestedType to
4624 track the possible creation of the NewDelegate type, since
4625 DoResolve is invoked more than once for new constructors on field
4628 See bugs: #48800 and #37014
4630 * cs-parser.jay (declare_local_constants): Take an arraylist
4631 instead of a single constant.
4633 (local_constant_declaration): It should take a
4634 constant_declarators, not a constant_declarator. Fixes 49487
4636 * convert.cs: Fix error report.
4638 2003-10-13 Jackson Harper <jackson@ximian.com>
4640 * typemanager.cs (TypeToCoreType): Add float and double this fixes
4643 2003-11-03 Martin Baulig <martin@ximian.com>
4645 * expression.cs (ArrayAccess.GetStoreOpcode): Added
4646 `out bool has_type_arg'; if set, we need to pass the type to
4648 (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
4649 Stelem_Any/Ldelem_Any for generic parameters.
4651 2003-11-02 Martin Baulig <martin@ximian.com>
4653 * expression.cs (Invocation.EmitCall): Use
4654 `TypeManager.IsValueType()' to check whether it's a value type.
4655 Don't set `struct_call' when calling a method on a type parameter.
4657 2003-11-02 Martin Baulig <martin@ximian.com>
4659 * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
4660 and removed the TypeBuilder argument.
4662 * typemanager.cs (TypeManager.IsValueType): Return
4663 `t.IsGenericParameter || t.IsValueType'.
4665 2003-10-25 Martin Baulig <martin@ximian.com>
4667 * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
4668 call ConstructedType.Resolve() on it.
4670 * generic.cs (ConstructedType.Resolve): Set `type' on success.
4672 2003-10-25 Martin Baulig <martin@ximian.com>
4674 * class.cs (TypeContainer.GetClassBases): Changed
4675 `out Type parent' into `out TypeExpr parent'. Moved CS0644 and
4676 CS8214 reporting here.
4677 (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
4678 instead of a `Type' for our parent. In case of a recursive
4679 declaration (see tests/gen-23.cs for an example), our parent is a
4680 ConstructedType and it doesn't have its type set. So, first
4681 create our own TypeBuilder, then call constructed.Resolve() to get
4682 the parent's type and finally TypeBuilder.SetParent() it.
4684 * ecore.cs (TypeExpr.Name): New public virtual property.
4687 (ConstructedType): We're now a TypeExpr and not just an Expression.
4688 (ConstructedType.ResolveAsTypeStep): Don't resolve our type
4689 arguments here; this is done later.
4690 (ConstructedType.Resolve): New public method to resolve the type
4691 arguments and bind them.
4693 2003-10-21 Martin Baulig <martin@ximian.com>
4695 * convert.cs: Use `TypeManager.IsValueType' instead of
4696 'type.IsValueType' everywhere.
4698 * typemanager.cs (TypeManager.IsValueType): Return true for type
4699 parameters. The reason for this is that we need to box a type
4700 parameter when converting it to a reference type.
4702 * cs-parser.jay: Added support for default value expressions.
4704 * generics.cs (DefaultValueExpression): New public class.
4706 2003-10-17 Martin Baulig <martin@ximian.com>
4708 * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
4709 TypeContainer so we can also use this for Interfaces.
4710 (TypeParameter.Resolve): Likewise.
4712 * interface.cs (Interface.DefineType): Added support for generic
4715 * cs-parser.jay: Added support for generic structs and interfaces.
4717 2003-10-17 Martin Baulig <martin@ximian.com>
4719 * generic.cs (GenericMemberAccess.DoResolve): We can now actually
4720 call generic methods :-)
4722 2003-10-16 Martin Baulig <martin@ximian.com>
4724 * cs-parser.jay (namespace_or_type_name): Only create a
4725 GenericMemberAccess if we actually have type arguments.
4727 2003-10-13 Martin Baulig <martin@ximian.com>
4729 * class.cs (Method.Define): If we're a generic method, call
4730 TypeBuilder.DefineGenericMethod () before resolving
4732 (MethodData): Added .ctor which takes an additional MethodBuilder
4733 argument; this is used for generic methods.
4734 (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
4735 we already have a MethodBuilder.
4737 2003-10-10 Martin Baulig <martin@ximian.com>
4739 * class.cs (Method): Added .ctor which takes a `GenericMethod'
4740 instead of a `DeclSpace'. This is used for generic methods.
4742 * cs-parser.jay (method_header): Added support for generic
4743 methods; create a `GenericMethod' instance and pass it to the
4744 `Method's .ctor; it'll be used as the `DeclSpace' to lookup
4745 parameters and locals.
4747 * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
4748 since we already have the location. Check whether we're a generic
4749 type declaration or a generic method and create the correct type
4752 * generic.cs (TypeParameter.DefineMethod): New public method.
4753 (GenericMethod): New public class; derives from DeclSpace and is
4754 used for generic methods.
4756 2003-10-09 Martin Baulig <martin@ximian.com>
4758 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
4760 (MethodCore.DoDefineParameters): Removed the TypeContainer
4761 argument; use the DeclSpace which was passed to the .ctor instead.
4762 (MethodCore.CheckParameter): Take a DeclSpace instead of a
4763 TypeContainer; we only need a DeclSpace here.
4765 2003-10-09 Martin Baulig <martin@ximian.com>
4767 * class.cs (MethodData): Added additional `DeclSpace ds' argument
4769 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
4770 EmitContext's .ctor.
4772 2003-10-09 Martin Baulig <martin@ximian.com>
4774 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
4775 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
4776 AsAccessible(), moved them as well.
4778 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
4780 2003-10-07 Miguel de Icaza <miguel@ximian.com>
4782 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
4783 generation for >=, as spotted by Paolo, bug 48679.
4784 Patch from David Waite.
4786 * cs-tokenizer.cs: Add handling for #pragma.
4788 * cs-parser.jay: Allow for both yield and yield return in the
4789 syntax. The anti-cobolization of C# fight will go on!
4791 * class.cs (TypeBuilder.DefineType): Catch error condition here
4792 (Parent.DefineType erroring out and returning null).
4794 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
4795 coping with enumerations variables, we were mistakenly processing
4796 them as a regular value type instead of built-in types. Fixes the
4799 * typemanager.cs (IsBuiltinOrEnum): New method.
4801 2003-09-30 Miguel de Icaza <miguel@ximian.com>
4803 * cs-parser.jay: Upgrade: yield now needs the return clause.
4805 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
4807 * cs-parser.jay : Renamed yyName to yyNames related to jay.
4809 2003-09-29 Martin Baulig <martin@ximian.com>
4811 * typemanager.cs (TypeManager.GetMethodFlags): Added support for
4812 inflated generic methods.
4814 * generics.cs (ConstructedType): Distinguish between open and
4815 closed constructed types; correctly resolve the arguments.
4817 2003-09-22 Martin Baulig <martin@ximian.com>
4819 * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
4820 all type arguments meet their constraints.
4822 2003-09-19 Martin Baulig <martin@ximian.com>
4824 * decl.cs (MemberCache.SetupCacheForInterface): Take a
4825 `MemberCache parent' argument. Normally, an interface doesn't
4826 have a parent type except System.Object, but we use this in gmcs
4827 for generic type parameters.
4829 2003-09-18 Martin Baulig <martin@ximian.com>
4831 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
4832 on `type.IsInterface'; don't check whether the type has a parent
4833 to determine whether it's an interface.
4835 2003-09-17 Martin Baulig <martin@ximian.com>
4837 * generic.cs (ConstructedType.ToString): Always use `name' as the
4840 2003-09-15 Martin Baulig <martin@ximian.com>
4842 * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
4844 * generic.cs (Constraints.Resolve): New public method; this is
4845 called to resolve the constraint types and to check whether all
4846 the constraints are correct.
4847 (Constraints.Types): New public property.
4848 (TypeParameter.Resolve): New public method; resolves all the
4851 * class.cs (TypeContainer.DefineType): Call
4852 TypeParameter.Resolve() before actually defining the type.
4854 2003-09-15 Martin Baulig <martin@ximian.com>
4856 * class.cs (TypeContainer.DefineType): Added an error flag to
4857 avoid reporting duplicate CS0146's ("class definition is
4860 * driver.cs (Driver.MainDriver): Abort if
4861 RootContext.ResolveTree() reported any errors.
4863 2003-09-07 Martin Baulig <martin@ximian.com>
4865 * report.cs (Error, Warning): Added overloaded versions which take
4866 a `params object[] args' and call String.Format().
4868 2003-09-07 Martin Baulig <martin@ximian.com>
4870 * decl.cs (DeclSpace..ctor): Don't call
4871 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
4872 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
4873 (DeclSpace.RecordDecl): New method.
4875 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
4877 2003-09-02 Ravi Pratap <ravi@ximian.com>
4879 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
4880 value attributes to be applied to ParameterBuilders.
4882 * class.cs (MethodCore.LabelParameters): Make static and more
4883 generic so that it can be used from other places - like interface
4884 methods, for instance.
4886 * interface.cs (Interface.Emit): Call LabelParameters before
4887 emitting attributes on the InterfaceMethod.
4889 2003-09-07 Martin Baulig <martin@ximian.com>
4891 * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
4892 if the number of type parameters doesn't match.
4894 2003-09-04 Martin Baulig <martin@ximian.com>
4896 * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
4897 for arrays of generic type params (ie. `!0[]').
4899 2003-09-04 Martin Baulig <martin@ximian.com>
4901 * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
4904 2003-09-04 Martin Baulig <martin@ximian.com>
4906 * decl.cs (DeclSpace.LookupGeneric): New method.
4907 (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
4910 * generic.cs (TypeParameterExpr): Take a TypeParameter as
4911 argument, not just a string.
4912 (TypeParameter.Define): New public method; this is called to
4913 actually define the generic parameter; after this, you can use the
4914 new `Type' property to get the type.
4916 2003-09-04 Martin Baulig <martin@ximian.com>
4918 * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
4919 is now an ArrayList; initialize the result of the `TypeParameters'
4921 (DeclSpace.GetGenericData): Removed.
4922 (DeclSpace.LookupGeneric): Temporarily removed; we need to
4923 implement this in a different way.
4924 (DeclSpace.GetTypeParameters): Removed; there's now a
4925 `TypeParameters' property.
4926 (DeclSpace.TypeParameters): New public property.
4928 * generic.cs (Constraints): Make this class public.
4929 (TypeParameter): New public class.
4931 2003-09-04 Martin Baulig <martin@ximian.com>
4933 * decl.cs (DeclSpace.GetTypeParameters): New method to return the
4936 * class.cs (TypeContainer.DefineType): Call
4937 TypeBuilder.DefineGenericParameter () on all generic parameters if
4938 this is a generic type.
4940 2003-08-28 Martin Baulig <martin@ximian.com>
4942 * sample-stack.il: Compile this with ilasm: "ilasm /dll
4945 * sample-hello.cs: Compile this with gmcs: "gmcs
4946 /r:sample-stack.dll sample-hello.cs".
4948 2003-08-28 Martin Baulig <martin@ximian.com>
4950 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
4951 the parameters to the generic type.
4953 2003-08-28 Martin Baulig <martin@ximian.com>
4955 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
4957 2003-08-28 Martin Baulig <martin@ximian.com>
4959 * cs-parser.jay (opt_type_argument_list): Use
4960 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
4961 (primary_expression): Replace `qualified_identifier' with `type_name'.
4962 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
4964 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
4965 parser to check whether it is syntactically a type parameter list;
4966 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
4969 2003-08-26 Martin Baulig <martin@ximian.com>
4971 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
4972 resolving aliases; fixes #47927.
4974 2003-08-26 Martin Baulig <martin@ximian.com>
4976 * statement.cs (Using.DoResolve): This is internally emitting a
4977 try/finally clause, so we need to set ec.NeedExplicitReturn if we
4978 do not always return. Fixes #47681.
4980 2003-08-26 Martin Baulig <martin@ximian.com>
4982 * decl.cs (MemberCore): Moved WarningNotHiding(),
4983 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
4985 (AdditionResult): Make this nested in DeclSpace.
4986 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
4987 argument; call NamespaceEntry.Define() unless we're nested in a
4990 * namespace.cs (Namespace.DefineName): New public function. This
4991 is called from DeclSpace's .ctor to add
4992 (Namespace.Lookup): Include DeclSpaces in the lookup.
4994 * class.cs (Operator): Derive from MemberBase, not MemberCore.
4996 * const.cs (Const): Derive from MemberBase, not MemberCore.
4998 2003-08-25 Martin Baulig <martin@ximian.com>
5000 * convert.cs (Convert.ExplicitReferenceConversion): When
5001 converting from an interface type to a class, unbox if the target
5002 type is a struct type. Fixes #47822.
5004 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5006 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
5009 2003-08-22 Martin Baulig <martin@ximian.com>
5011 * class.cs (TypeManager.DefineType): When defining a nested type,
5012 call DefineType() on our parent; fixes #47801.
5014 2003-08-22 Martin Baulig <martin@ximian.com>
5016 * class.cs (MethodData.Define): While checking if a method is an
5017 interface implementation, improve the test a bit more to fix #47654.
5019 2003-08-22 Martin Baulig <martin@ximian.com>
5021 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
5022 correctly; fixes #47722.
5024 2003-08-22 Martin Baulig <martin@ximian.com>
5026 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
5027 LocalVariableReference, ensure it's not read-only. Fixes #47536.
5029 * statement.cs (Fixed.DoResolve): Make all variables read-only.
5031 2003-08-22 Martin Baulig <martin@ximian.com>
5033 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
5034 can only be assigned in static constructors. Fixes #47161.
5036 2003-08-22 Martin Baulig <martin@ximian.com>
5038 Rewrote and improved the flow analysis code.
5040 * flowbranching.cs (FlowBranching): Make this class abstract.
5041 (FlowBranching.CreateBranching): New static function to create a
5043 (FlowBranchingBlock, FlowBranchingException): New classes.
5044 (FlowBranching.UsageVector.Type): New public readonly field.
5045 (FlowBranching.UsageVector.Breaks): Removed the setter.
5046 (FlowBranching.UsageVector.Returns): Removed the setter.
5047 (FlowBranching.UsageVector): Added Break(), Return(),
5048 NeverReachable() and Throw() methods to modify the reachability.
5049 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
5050 done by FlowBranching.Merge().
5051 (FlowBranching.UsageVector.MergeChild): New method; merges the
5052 merge result into the current vector.
5053 (FlowBranching.Merge): New abstract method to merge a branching.
5055 2003-08-12 Martin Baulig <martin@ximian.com>
5057 * expression.cs (Indirection.CacheTemporaries): Create the
5058 LocalTemporary with the pointer type, not its element type.
5060 2003-08-10 Miguel de Icaza <miguel@ximian.com>
5062 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
5063 token was a keyword or not.
5065 Add `error' options where an IDENTIFIER was expected; Provide
5066 CheckToken and CheckIdentifierToken convenience error reporting
5069 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
5071 * decl.cs: Rename `NamespaceEntry Namespace' public field into
5072 NameSpaceEntry NameSpaceEntry.
5074 (LookupInterfaceOrClass): Avoid creating a full qualified name
5075 from namespace and name: avoid doing lookups when we know the
5076 namespace is non-existant. Use new Tree.LookupByNamespace which
5077 looks up DeclSpaces based on their namespace, name pair.
5079 * driver.cs: Provide a new `parser verbose' to display the
5080 exception thrown during parsing. This is turned off by default
5081 now, so the output of a failure from mcs is more graceful.
5083 * namespace.cs: Track all the namespaces defined in a hashtable
5086 (IsNamespace): New method
5088 2003-08-09 Miguel de Icaza <miguel@ximian.com>
5090 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
5091 we know that we need to concatenate (full typename can never be
5096 * statement.cs: Use a bitfield; Do not initialize to null things
5097 which are done by the constructor by default.
5099 * cs-parser.jay: bug fix, parameter was 4, not 3.
5101 * expression.cs: Just use the property;
5103 * statement.cs: No need for GetVariableInfo method.
5105 2003-08-08 Martin Baulig <martin@ximian.com>
5107 * flowanalysis.cs (FlowReturns): This is now nested in the
5108 `FlowBranching' class.
5109 (MyBitVector): Moved this here from statement.cs.
5110 (FlowBranching.SiblingType): New enum type.
5111 (FlowBranching.CreateSibling): Added `SiblingType' argument.
5113 2003-08-07 Martin Baulig <martin@ximian.com>
5115 * flowanalysis.cs (FlowBranchingType): This is now nested in the
5116 `FlowBranching' class and called `BranchingType'.
5118 2003-08-07 Martin Baulig <martin@ximian.com>
5120 * flowanalysis.cs: Moved all the control flow analysis code into
5123 2003-08-07 Martin Baulig <martin@ximian.com>
5125 * assign.cs (Assign.DoResolve): `target' must either be an
5126 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
5129 2003-08-07 Miguel de Icaza <miguel@ximian.com>
5131 * expression.cs (BinaryMethod): This kind of expression is created by the
5132 Binary class if it determines that the operator has to be handled
5135 (BinaryDelegate): This kind of expression is created if we are
5136 dealing with a + or - operator on delegates.
5138 (Binary): remove method, argumetns, and DelegateOperator: when
5139 dealing with methods,
5141 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
5143 * statement.cs (Block): use bitfields for the three extra booleans
5144 we had in use. Remove unused topblock parameter.
5146 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
5148 * assign.cs: Drop extra unneeded tests.
5150 2003-08-06 Miguel de Icaza <miguel@ximian.com>
5152 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
5154 * statement.cs (Foreach): Use VariableStorage instead of
5157 * codegen.cs (VariableStorage): New class used by clients that
5158 require a variable stored: locals or fields for variables that
5159 need to live across yield.
5161 Maybe provide a convenience api for EmitThis+EmitLoad?
5163 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
5166 2003-08-05 Miguel de Icaza <miguel@ximian.com>
5168 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
5169 RemapParameterLValue): New methods that are used to turn a
5170 precomputed FieldInfo into an expression like this:
5174 The idea is to use this instead of making LocalVariableReference
5175 have more than one meaning.
5177 * cs-parser.jay: Add error production to BASE.
5179 * ecore.cs: Deal with TypeManager.GetField returning null, which
5180 is now a valid return value.
5182 (FieldExprNoAddress): New expression for Fields whose address can
5185 * expression.cs (LocalVariableReference): During the resolve
5186 phases, create new expressions if we are in a remapping context.
5187 Remove code that dealt with remapping here.
5189 (ParameterReference): same.
5191 (ProxyInstance): New expression, like the `This' expression, but
5192 it is born fully resolved. We know what we are doing, so remove
5193 the errors that are targeted to user-provided uses of `this'.
5195 * statement.cs (Foreach): our variable is now stored as an
5196 Expression; During resolution, follow the protocol, dont just
5197 assume it will return this.
5199 2003-08-06 Martin Baulig <martin@ximian.com>
5201 * support.cs (SeekableStreamReader.cs): New public class.
5203 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
5204 SeekableStreamReader instead of the normal StreamReader.
5206 2003-08-04 Martin Baulig <martin@ximian.com>
5208 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
5209 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
5210 deambiguate casts and delegate invocations.
5211 (parenthesized_expression): Use the new tokens to ensure this is
5212 not a cast of method invocation.
5214 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
5215 when reading a `)' and Deambiguate_CloseParens () was previously
5218 * expression.cs (ParenthesizedExpression): New class. This is
5219 just used for the CS0075 test.
5220 (Binary.DoResolve): Check for CS0075.
5222 2003-07-29 Ravi Pratap <ravi@ximian.com>
5224 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
5225 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
5226 reference comparison.
5228 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
5229 examine the ReturnType for equality - this is necessary in the
5230 cases of implicit and explicit operators whose signature also
5231 includes the return type.
5233 2003-07-26 Miguel de Icaza <miguel@ximian.com>
5235 * namespace.cs: Cache the result of the namespace computation,
5236 instead of computing it every time.
5238 2003-07-24 Miguel de Icaza <miguel@ximian.com>
5240 * decl.cs: Use a global arraylist that we reuse over invocations
5241 to avoid excesive memory consumption. Reduces memory usage on an
5242 mcs compile by one meg (45 average).
5244 * typemanager.cs (LookupTypeReflection): In .NET pointers are
5245 private, work around that.
5247 2003-07-23 Miguel de Icaza <miguel@ximian.com>
5249 * literal.cs (IntLiteral): Define Zero and One static literals.
5251 * cs-parser.jay (integer_literal): use static literals to reduce
5252 memory usage for the most used literals (0, 1 and -1). 211kb
5253 reduced in memory usage.
5255 Replace all calls to `new ArrayList' with `new
5256 ArrayList(4)' which is a good average number for most allocations,
5257 and also requires only 16 bytes of memory for its buffer by
5260 This reduced MCS memory usage in seven megabytes for the RSS after
5263 2003-07-28 Ravi Pratap <ravi@ximian.com>
5265 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
5266 handle params methods the correct way by forming only one
5267 applicable set with params and normal methods in them. Earlier we
5268 were looking at params methods only if we found no normal methods
5269 which was not the correct thing to do.
5271 (Invocation.BetterFunction): Take separate arguments indicating
5272 when candidate and the best method are params methods in their
5275 This fixes bugs #43367 and #46199.
5277 * attribute.cs: Documentation updates.
5279 (CheckAttribute): Rename to CheckAttributeTarget.
5280 (GetValidPlaces): Rename to GetValidTargets.
5282 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
5283 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
5287 2003-07-28 Miguel de Icaza <miguel@ximian.com>
5289 * codegen.cs: Compute IsGeneric correctly.
5291 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
5294 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
5295 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
5296 regressions, and I was chasing more bugs than I required.
5298 * interface.cs: Use expressions for base type names (like classes
5299 and structs have been doing for a while now), and resolve that.
5300 This patch should probably go into head as well.
5302 This makes it one less user of FindType.
5304 2003-07-24 Miguel de Icaza <miguel@ximian.com>
5306 This compiler can not self host currently. Need to fix that.
5308 * Makefile: compile to `gmcs.exe'
5310 * driver.cs: Turn on v2 by default on gmcs.
5312 * generic.cs (ConstructedType): Does no longer take a container
5313 type argument; That will be taken care of later.
5315 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
5316 Use SimpleName to resolve for now, so we can continue the work on
5317 the parser, until we get Type.GetType that understands generics.
5319 (ConstructedType.ToString): Implement
5321 (TypeArguments.Resolve): Resolve the child expressions as types.
5323 * cs-parser.jay: Rename interface_constraints to
5324 type_parameter_constraints
5326 (namespace_or_type_name): Only use constructed types for the basic
5327 construction, we will deal with identifier<...> later.
5329 (type/type_name): No longer call DecomposeQI, as
5330 namespace_or_type_name is always decoded now.
5332 2003-07-22 Ravi Pratap <ravi@ximian.com>
5334 * expression.cs (Invocation.OverloadResolve): Follow the spec more
5335 closely: we eliminate methods in base types when we have an
5336 applicable method in a top-level type.
5338 Please see section 14.5.5.1 for an exact description of what goes
5341 This fixes bug #45127 and a host of other related to corlib compilation.
5343 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
5344 array is the method corresponding to the top-level type (this is
5345 because of the changes made to icall.c) so we change this
5348 (MethodGroupExpr.Name): This too.
5350 * typemanager.cs (GetElementType): New method which does the right
5351 thing when compiling corlib.
5353 * everywhere: Make use of the above in the relevant places.
5355 2003-07-22 Martin Baulig <martin@ximian.com>
5357 * cs-parser.jay (invocation_expression): Moved
5358 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
5359 `cast_expression', but create a InvocationOrCast which later
5360 resolves to either an Invocation or a Cast.
5362 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
5363 method; call this before EmitStatement() to make sure that this
5364 expression can be used as a statement.
5366 * expression.cs (InvocationOrCast): New class; resolves to either
5367 an Invocation or a Cast.
5369 * statement.cs (StatementExpression): Call ResolveStatement() on
5370 the ExpressionStatement before emitting it.
5372 2003-07-21 Martin Baulig <martin@ximian.com>
5374 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
5375 `ref' and `out' attributes match; fixes #46220.
5376 (MemberAccess.ResolveMemberAccess): You can't reference a type
5377 through an expression; fixes #33180.
5378 (Indexers.GetIndexersForType): Don't return the indexers from
5379 interfaces the class implements; fixes #46502.
5381 2003-07-21 Martin Baulig <martin@ximian.com>
5383 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
5384 CS0661 checks; fixes bug #30442.
5386 2003-07-21 Martin Baulig <martin@ximian.com>
5388 * decl.cs (AdditionResult): Added `Error'.
5390 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
5392 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
5393 cs0031.cs actually work.
5395 2003-07-20 Miguel de Icaza <miguel@ximian.com>
5397 * cs-parser.jay (namespace_name): do not use
5398 namespace_or_type_name, use qualified_identifier, because
5399 namespace_or_type_name will soon return a composed expression
5400 instead of a string.
5402 (namespace_or_type_name): Instead of returning a string, now this
5403 production returns an expression.
5405 * codegen.cs (EmitContext): Setup IsGeneric property based on
5406 whether our DeclSpace is generic, our the method is generic.
5408 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
5409 the method is generic.
5411 * cs-parser.jay (type_arguments, opt_type_argument_list,
5412 type_parameters, type_parameter_list, opt_type_parameter_list,
5413 type_parameter,, opt_type_parameter_constraints_clauses,
5414 type_parameter_constraints_clauses,
5415 type_parameter_constraint_clause, type_parameter_constraint,
5416 interface_constraints): Add new production
5418 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
5419 DeclSpace is generic or not.
5421 (DeclSpace.SetParameterInfo): New routine, used to set the
5422 parameter info for a type.
5424 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
5425 returns a GenericTypeExpr
5427 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
5428 generic, lookup the generic argument.
5430 * attribute.cs: Do not allow TypeParameterExpressions in
5433 * class.cs: Do not allow the Main method to be defined in a
5436 * expression.cs (SizeOf): Do not allow generic types to be used as
5437 arguments to sizeof.
5439 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
5440 it: whether a type is generic or not. Only works for types we are
5441 currently building for now.
5443 2003-07-20 Martin Baulig <martin@ximian.com>
5445 * namespace.cs: Fixed that bug which caused a crash when compiling
5448 2003-07-20 Miguel de Icaza <miguel@ximian.com>
5450 * typemanager.cs (LookupTypeReflection): Never expose types which
5451 are NotPublic, NestedPrivate, NestedAssembly, or
5452 NestedFamANDAssem. We used to return these, and later do a check
5453 that would report a meaningful error, but the problem is that we
5454 would not get the real match, if there was a name override.
5456 2003-07-18 Miguel de Icaza <miguel@ximian.com>
5458 * namespace.cs (Namespace, Name): Do not compute the namespace
5459 name dynamically, compute it in the constructor. This reduced
5460 memory usage by 1697 KB.
5462 * driver.cs: Use --pause to pause at the end.
5464 2003-07-17 Peter Williams <peter@newton.cx>
5466 * Makefile: Change the name of the test target so that it doesn't
5467 conflict with the recursive test target.
5469 2003-07-17 Miguel de Icaza <miguel@ximian.com>
5471 * expression.cs (LocalVariableReference.Emit, EmitAssign,
5472 AddressOf): Do not use EmitThis, that was wrong, use the actual
5475 2003-07-15 Miguel de Icaza <miguel@ximian.com>
5477 * class.cs (MethodData.Define): While checking if a method is an
5478 interface implementation, improve the test: If we are not public
5479 (use new test here: use the computed MethodAttributes directly,
5480 instead of the parsed modifier flags) check if the `implementing'
5481 method comes from an interface or not.
5483 * pending.cs (VerifyPendingMethods): Slightly better error
5486 * makefile: add test target that does the mcs bootstrap.
5488 2003-07-16 Ravi Pratap <ravi@ximian.com>
5490 * interface.cs (Define): Do nothing here since there are no
5491 members to populate etc. Move the attribute emission out of here
5492 since this was just totally the wrong place to put it. Attribute
5493 application happens during the 'Emit' phase, not in the 'Define'
5496 (Emit): Add this method and move the attribute emission here
5498 * rootcontext.cs (EmitCode): Call the Emit method on interface
5501 2003-07-14 Ravi Pratap M <ravi@ximian.com>
5503 * expression.cs (OverloadResolve): Report error only if Location
5504 is not 'Null' which means that there was a probe going on.
5506 2003-07-14 Martin Baulig <martin@ximian.com>
5508 * expression.cs (ConditionalLogicalOperator): New public class to
5509 implement user defined conditional logical operators.
5510 This is section 14.11.2 in the spec and bug #40505.
5512 2003-07-14 Martin Baulig <martin@ximian.com>
5514 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
5516 2003-07-14 Martin Baulig <martin@ximian.com>
5518 * codegen.cs (EmitContext.InFixedInitializer): New public field.
5520 * ecore.cs (IVariable.VerifyFixed): New interface method.
5522 * expression.cs (Unary.ResolveOperator): When resolving the `&'
5523 operator, check whether the variable is actually fixed. Fixes bug
5524 #36055. Set a variable definitely assigned when taking its
5525 address as required by the spec.
5527 * statement.cs (LocalInfo.IsFixed): New field.
5528 (LocalInfo.MakePinned): Set `IsFixed' to true.
5530 2003-07-14 Ravi Pratap M <ravi@ximian.com>
5532 * attribute.cs (Attribute.Resolve): While doing a Member lookup
5533 for .ctors, ensure that we only ask for members declared in the
5534 attribute type (BindingFlags.DeclaredOnly).
5538 * expression.cs (Error_WrongNumArguments): Report error 1501
5539 correctly the way CSC does.
5541 2003-07-13 Martin Baulig <martin@ximian.com>
5543 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
5544 lookup on the fully qualified name, to make things like "X.X" work
5545 where "X.X" is a fully qualified type name, but we also have a
5546 namespace "X" in the using list. Fixes #41975.
5548 2003-07-13 Martin Baulig <martin@ximian.com>
5550 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
5551 function. If we're a CompoundAssign, we need to create an embedded
5552 CompoundAssign, not an embedded Assign.
5553 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
5556 2003-07-13 Martin Baulig <martin@ximian.com>
5558 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
5559 work to fix bug #46088.
5561 2003-07-13 Ravi Pratap <ravi@ximian.com>
5563 * class.cs (Operator.Emit): Do not emit attributes here - it is
5564 taken care of by the Method class that we delegate too. This takes
5567 2003-07-10 Martin Baulig <martin@ximian.com>
5569 * expression.cs (TypeOfVoid): New class.
5570 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
5572 2003-07-10 Martin Baulig <martin@ximian.com>
5574 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
5577 2003-07-10 Martin Baulig <martin@ximian.com>
5579 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
5580 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
5582 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
5584 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
5586 2003-07-10 Martin Baulig <martin@ximian.com>
5588 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
5589 of decimal. Fixes #42850.
5591 NOTE: I also fixed the created byte blob, but this doesn't work on
5592 the MS runtime and csc never produces any byte blobs for decimal
5595 2003-07-10 Martin Baulig <martin@ximian.com>
5597 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
5598 structs; fixes #32068.
5599 (Block.AddChildVariableNames): Fixed #44302.
5601 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5603 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
5605 2003-07-07 Miguel de Icaza <miguel@ximian.com>
5607 * attribute.cs: And this test is onger needed.
5609 2003-07-08 Martin Baulig <martin@ximian.com>
5611 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
5612 inaccessible types. Fixes #36313.
5614 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
5616 * namespace.cs (NamespaceEntry): Create implicit entries for all
5617 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
5618 implicit entries for N1.N2 and N1.
5620 2003-07-08 Martin Baulig <martin@ximian.com>
5622 Rewrote the handling of namespaces to fix a lot of the issues
5623 wrt. `using' aliases etc.
5625 * namespace.cs (Namespace): Splitted this class into a
5626 per-assembly `Namespace' and a per-file `NamespaceEntry'.
5628 * typemanager.cs (TypeManager.IsNamespace): Removed.
5629 (TypeManager.ComputeNamespaces): Only compute namespaces from
5630 loaded assemblies here, not the namespaces from the assembly we're
5631 currently compiling.
5633 2003-07-08 Martin Baulig <martin@ximian.com>
5635 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
5637 2003-07-07 Miguel de Icaza <miguel@ximian.com>
5639 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
5642 I thought about the memory savings here, but LookupTypeReflection
5643 is used under already very constrained scenarios. Compiling
5644 corlib or mcs only exposes one hit, so it would not really reduce
5645 any memory consumption.
5647 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5649 * typemanager.cs: fixes bug #45889 by only adding public types from
5650 other assemblies to the list of known types.
5652 2003-07-07 Miguel de Icaza <miguel@ximian.com>
5654 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
5655 on the type we resolved.
5657 2003-07-05 Martin Baulig <martin@ximian.com>
5659 * pending.cs (PendingImplementation.ParentImplements): Don't
5660 create the proxy if the parent is abstract.
5662 * class.cs (TypeContainer.DefineIndexers): Process explicit
5663 interface implementations first. Fixes #37714.
5665 2003-07-04 Miguel de Icaza <miguel@ximian.com>
5667 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
5668 defined recursively; but since we modify the input parameters
5669 (left is set to `this' temporarily), we reset this value if the
5670 left_is_explicit is false, which gives the original semantics to
5673 * literal.cs (NullPointer): new class used to represent a null
5674 literal in a pointer context.
5676 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
5677 type is a pointer, use a NullPointer object instead of a
5678 NullLiteral. Closes 43687
5680 (ExplicitConversion): Convert pointer values using
5681 the conv opcode to the proper type.
5683 * ecore.cs (New): change ValueTypeVariable property into a method,
5684 that returns whether the valuetype is suitable for being used.
5686 * expression.cs (Binary.DoNumericPromotions): Only return if we
5687 the int constant was a valid uint, and we can return both left and
5688 right as uints. If not, we continue processing, to trigger the
5689 type conversion. This fixes 39018.
5691 * statement.cs (Block.EmitMeta): During constant resolution, set
5692 the CurrentBlock property on the emitcontext, so that we resolve
5693 constants propertly.
5695 2003-07-02 Martin Baulig <martin@ximian.com>
5697 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
5698 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
5700 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
5701 than emitting it here.
5703 * statement.cs: Fixed some more flow analysis bugs.
5705 2003-07-02 Martin Baulig <martin@ximian.com>
5707 * class.cs (MethodData.Define): When implementing interface
5708 methods, set Final unless we're Virtual.
5710 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
5711 check work for interface methods.
5713 2003-07-01 Martin Baulig <martin@ximian.com>
5715 * ecore.cs (EmitContext.This): Replaced this property with a
5716 GetThis() method which takes a Location argument. This ensures
5717 that we get the correct error location for a CS0188.
5719 2003-07-01 Miguel de Icaza <miguel@ximian.com>
5721 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
5722 ImplicitStandardConversion.
5724 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
5726 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
5728 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
5731 2003-06-30 Miguel de Icaza <miguel@ximian.com>
5733 * class.cs (Constructor.Define): Turn off initlocals for unsafe
5736 (MethodData.Define): Turn off initlocals for unsafe methods.
5738 2003-06-29 Miguel de Icaza <miguel@ximian.com>
5740 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
5741 complete; Fixes #37521.
5743 * delegate.cs: Use Modifiers.TypeAttr to compute the
5744 TypeAttributes, instead of rolling our own. This makes the flags
5745 correct for the delegates.
5747 2003-06-28 Miguel de Icaza <miguel@ximian.com>
5749 * class.cs (Constructor.Define): Set the private flag for static
5750 constructors as well.
5752 * cs-parser.jay (statement_expression): Set the return value to
5753 null, to avoid a crash when we catch an error.
5755 2003-06-24 Miguel de Icaza <miguel@ximian.com>
5757 * cs-parser.jay: Applied patch from Jackson that adds support for
5758 extern and unsafe modifiers to destructor declarations.
5760 * expression.cs: Report error 21 if the user is trying to index a
5763 * driver.cs: Add an error message, suggested by the bug report.
5765 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
5766 if we do not have a ": this ()" constructor initializer. Fixes 45149
5768 2003-06-14 Miguel de Icaza <miguel@ximian.com>
5770 * namespace.cs: Add some information to reduce FAQs.
5772 2003-06-13 Miguel de Icaza <miguel@ximian.com>
5774 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
5775 underlying enumeration types. Fixes #43915.
5777 * expression.cs: Treat ushort/short as legal values to be used in
5780 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
5782 * delegate.cs: transfer custom attributes for paramenters from
5783 the delegate declaration to Invoke and BeginInvoke.
5785 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
5787 * attribute.cs: handle custom marshalers and emit marshal info
5790 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
5792 * makefile.gnu: Added anonymous.cs to the compiler sources.
5794 2003-05-28 Miguel de Icaza <miguel@ximian.com>
5796 * iterators.cs: Change the name of the proxy class to include two
5799 * cs-parser.jay: Update grammar to include anonymous methods.
5801 * anonymous.cs: new file.
5803 2003-05-27 Miguel de Icaza <miguel@ximian.com>
5805 * class.cs (Field.Define): Add missing test for pointers and
5808 2003-05-27 Ravi Pratap <ravi@ximian.com>
5810 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
5811 we use the stobj opcode.
5813 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
5814 since it wasn't the correct fix.
5816 It still is puzzling that we are required to use stobj for IntPtr
5817 which seems to be a ValueType.
5819 2003-05-26 Miguel de Icaza <miguel@ximian.com>
5821 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
5822 during regular simple name resolution. Now, the trick is that
5823 instead of returning for processing the simplename, we do a
5824 TypeManager.LookupType (ie, a rooted lookup as opposed to a
5825 contextual lookup type). If a match is found, return that, if
5826 not, return for further composition.
5828 This fixes long-standing 30485.
5830 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
5831 using the address to initialize an object, do an Stobj instead of
5832 using the regular Stelem.
5834 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
5835 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
5836 Because if we are a BaseIndexerAccess that value will be true.
5839 * statement.cs (GotoCase.Resolve): Return after reporting an
5840 error, do not attempt to continue.
5842 * expression.cs (PointerArithmetic.Emit): If our operand is a
5843 long, convert our constants to match the operand before
5844 multiplying. Convert to I type before adding. Fixes 43670.
5846 2003-05-14 Ravi Pratap <ravi@ximian.com>
5848 * enum.cs (ImplicitConversionExists) : Rename to
5849 ImplicitEnumConversionExists to remove ambiguity.
5851 * ecore.cs (NullCast): New type of cast expression class which
5852 basically is very similar to EmptyCast with the difference being
5853 it still is a constant since it is used only to cast a null to
5857 * convert.cs (ImplicitReferenceConversion): When casting a null
5858 literal, we return a NullCast.
5860 * literal.cs (NullLiteralTyped): Remove - I don't see why this
5861 should be around anymore.
5863 The renaming (reported was slightly wrong). Corrections:
5865 ConvertImplicitStandard -> ImplicitConversionStandard
5866 ConvertExplicitStandard -> ExplicitConversionStandard
5868 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
5869 before passing them in !
5871 * convert.cs (ImplicitConversionStandard): When comparing for
5872 equal expr and target types, ensure that expr is not a
5875 In general, we must not be checking (expr_type ==
5876 target_type) in the top level conversion methods
5877 (ImplicitConversion, ExplicitConversion etc). This checking is
5878 done in the methods that they delegate to.
5880 2003-05-20 Miguel de Icaza <miguel@ximian.com>
5882 * convert.cs: Move Error_CannotConvertType,
5883 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
5884 ImplicitNumericConversion, ImplicitConversionExists,
5885 ImplicitUserConversionExists, StandardConversionExists,
5886 FindMostEncompassedType, FindMostSpecificSource,
5887 FindMostSpecificTarget, ImplicitUserConversion,
5888 ExplicitUserConversion, GetConversionOperators,
5889 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
5890 TryImplicitIntConversion, Error_CannotConvertImplicit,
5891 ConvertImplicitRequired, ConvertNumericExplicit,
5892 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
5893 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
5896 Perform the following renames:
5898 StandardConversionExists -> ImplicitStandardConversionExists
5899 ConvertImplicit -> ImplicitConversion
5900 ConvertImplicitStandard -> ImplicitStandardConversion
5901 TryImplicitIntConversion -> ImplicitIntConversion
5902 ConvertImplicitRequired -> ImplicitConversionRequired
5903 ConvertNumericExplicit -> ExplicitNumericConversion
5904 ConvertReferenceExplicit -> ExplicitReferenceConversion
5905 ConvertExplicit -> ExplicitConversion
5906 ConvertExplicitStandard -> ExplicitStandardConversion
5908 2003-05-19 Martin Baulig <martin@ximian.com>
5910 * statement.cs (TypeInfo.StructInfo): Made this type protected.
5911 (TypeInfo): Added support for structs having structs as fields.
5913 * ecore.cs (FieldExpr): Implement IVariable.
5914 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
5915 VariableInfo for the field.
5917 2003-05-18 Martin Baulig <martin@ximian.com>
5919 * expression.cs (This.DoResolve): Report a CS0027 if we're
5920 emitting a field initializer.
5922 2003-05-18 Martin Baulig <martin@ximian.com>
5924 * expression.cs (This.ResolveBase): New public function.
5925 (This.DoResolve): Check for CS0188.
5927 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
5930 * ecore.cs (MethodGroupExpr.DoResolve): Set the
5931 `instance_expression' to null if we don't have any non-static
5934 2003-05-18 Martin Baulig <martin@ximian.com>
5936 Reworked the way how local variables and parameters are handled by
5937 the flow analysis code.
5939 * statement.cs (TypeInfo, VariableMap): New public classes.
5940 (VariableInfo): New public class. This is now responsible for
5941 checking whether a variable has been assigned. It is used for
5942 parameters and local variables.
5943 (Block.EmitMeta): Take the InternalParameters as argument; compute
5944 the layout of the flow vectors here.
5945 (Block.LocalMap, Block.ParameterMap): New public properties.
5946 (FlowBranching): The .ctor doesn't get the InternalParameters
5947 anymore since Block.EmitMeta() now computes the layout of the flow
5949 (MyStructInfo): This class is now known as `StructInfo' and nested
5950 in `TypeInfo'; we don't access this directly anymore.
5952 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
5953 property and removed IsAssigned(), IsFieldAssigned(),
5954 SetAssigned() and SetFieldAssigned(); we now call them on the
5955 VariableInfo so we don't need to duplicate this code everywhere.
5957 * expression.cs (ParameterReference): Added `Block block' argument
5959 (LocalVariableReference, ParameterReference, This): The new
5960 VariableInfo class is now responsible for all the definite
5963 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
5964 IsParameterAssigned, SetParameterAssigned): Removed.
5966 2003-05-18 Martin Baulig <martin@ximian.com>
5968 * typemanager.cs (InitCoreTypes): Try calling
5969 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
5970 the 3-args-version. Corlib now also needs our `void_type'.
5971 (GetMethod): Added overloaded version which takes an optional
5972 `bool report_errors' to allow lookups of optional methods.
5974 2003-05-12 Martin Baulig <martin@ximian.com>
5976 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
5977 only used for locals and not for parameters.
5979 2003-05-12 Miguel de Icaza <miguel@ximian.com>
5981 * support.cs (InternalParameters.ParameterType): Return the
5982 ExternalType of the parameter.
5984 * parameter.cs (Parameter.ExternalType): drop the two arguments,
5987 2003-05-11 Miguel de Icaza <miguel@ximian.com>
5989 * class.cs (MethodData.Define): Do not set the `newslot' on
5990 interface members, if they are also flagged as "override".
5992 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
5993 better code for ++i and i++. This only works for static fields
5994 and local variables.
5996 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
5997 want to pull the DeclSpace out of the builder_to_declspace instead
5998 of the TypeBuilder (like in TypeContainer.FindMembers).
6000 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
6001 instead of LookupTypeContainer. Fixes the crash on .NET for
6002 looking up interface members.
6004 * const.cs: Create our own emit context during the Definition
6005 stage, so that constants are evaluated in the proper context, when
6006 a recursive definition happens.
6008 2003-05-11 Martin Baulig <martin@ximian.com>
6010 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
6011 new block for a switch section.
6012 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
6013 the adding/lookup in the switch block. Fixes #39828.
6015 2003-05-09 Miguel de Icaza <miguel@ximian.com>
6017 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
6018 functionality: I needed to convert the data after I had performed
6019 the add/sub operation into the operands type size.
6021 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
6022 pass the type for the box operation, otherwise the resulting
6023 object would have been of type object.
6025 (BoxedCast): Add constructor to specify the type to box as.
6027 2003-05-07 Miguel de Icaza <miguel@ximian.com>
6029 * iterators.cs: I was reusing the `count' variable inadvertently,
6030 take steps to not allow this to happen.
6032 2003-05-06 Miguel de Icaza <miguel@ximian.com>
6034 * attribute.cs (Attribute.Resolve): Params attributes are encoded
6035 by creating an array at the point where the params starts and
6036 putting all those arguments there, then adjusting the size of the
6039 2003-05-05 Miguel de Icaza <miguel@ximian.com>
6041 * expression.cs (New.AddressOf): Implement interface
6042 IMemoryLocation. This is used when the `new' operator is used in
6043 the context of an invocation to a method on a value type.
6045 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
6048 * namespace.cs: Also check the using aliases here.
6050 * driver.cs: Move the test for using validity after the types have
6051 been entered, so we do a single pass that also includes the using
6054 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
6055 in the regular case. CreateSiblingForFinally is doing extra
6058 * attribute.cs (GetAttributeArgumentExpression): Store the result
6059 on an out value, and use the return value to indicate failure
6060 instead of using null (which is a valid return for Constant.GetValue).
6062 * statement.cs: Perform the analysis flow for the increment
6063 portion after the statement, because this will be the real flow of
6064 execution. Fixes #42385
6066 * codegen.cs (EmitContext.EmitArgument,
6067 EmitContext.EmitStoreArgument): New helper functions when the
6068 RemapToProxy flag is set.
6070 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
6073 Add support for remapping parameters.
6075 * iterators.cs: Propagate parameter values; Store parameter
6076 values in the proxy classes.
6078 2003-05-04 Miguel de Icaza <miguel@ximian.com>
6080 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
6081 need a proxy reference; I do not know what I was thinking
6083 * cs-parser.jay (constructor_initializer): catch another error,
6084 and display nice message.
6086 (field_declaration): catch void field declaration
6087 to flag a better error.
6089 * class.cs (MemberBase.CheckBase): Report an error instead of a
6090 warning if a new protected member is declared in a struct.
6091 (Field.Define): catch the error of readonly/volatile.
6093 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
6095 (FieldExpr.AddressOf): ditto. Catch error where the address of a
6096 volatile variable is taken
6098 2003-05-02 Miguel de Icaza <miguel@ximian.com>
6100 * statement.cs (Fixed.Resolve): Report an error if we are not in
6103 2003-05-01 Miguel de Icaza <miguel@ximian.com>
6105 * typemanager.cs: reuse the code that handles type clashes for
6106 delegates and enumerations.
6108 * class.cs (Report28): Always report.
6110 * expression.cs (EncodeAsAttribute): Allow nulls here.
6112 2003-04-28 Miguel de Icaza <miguel@ximian.com>
6114 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
6115 the functionality for testing whether an expression is valid for
6116 an attribute here. Also handle the case of arrays of elements
6119 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
6120 encoding a linear array into an array of objects that are suitable
6121 to be passed to an CustomAttributeBuilder.
6123 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
6125 * ecore.cs: (FieldExpr): Handle field remapping here.
6127 * iteratators.cs: Pass the instance variable (if the method is an
6128 instance method) to the constructors, so we can access the field
6129 variables on the class.
6131 TODO: Test this with structs. I think the THIS variable on
6132 structs might have to be a pointer, and not a refenrece
6134 2003-04-27 Miguel de Icaza <miguel@ximian.com>
6136 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
6137 local variables to fields in a proxy class.
6139 * iterators.cs (PopulateProxy): Rename our internal fields to
6141 Create a <THIS> field if we are an instance method, so we can
6142 reference our parent container variables.
6143 (MapVariable): Called back from the EmitContext code to enter a
6144 new variable to field mapping into the proxy class (we just create
6148 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
6149 for using the remapped locals to fields.
6151 I placed the code here, because that gives the same semantics to
6152 local variables, and only changes the Emit code.
6154 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
6155 statements inside iterators.
6156 (VariableInfo): Add a FieldBuilder for the cases when we are
6157 remapping local variables to fields in a proxy class
6159 * ecore.cs (SimpleNameResolve): Avoid testing two times for
6160 current_block != null.
6162 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
6163 not cope with strings, as it has been moved to the
6164 TableSwitchEmit. Fixed bug in switch generation.
6166 * expression.cs (New.DoResolve): Provide more context for the user
6167 when reporting an error.
6169 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
6172 * expression.cs (MemberAccess.DoResolve): When we get a type back,
6173 check the permissions for it. Note than in a type-resolution
6174 context the check was already present in DeclSpace.ResolveType,
6175 but was missing from the MemberAccess.
6177 (ArrayCreation.CheckIndices): warn if the user has
6178 more nested levels of expressions, but there are no more
6179 dimensions specified. Avoids crash on bug 41906.
6181 2003-04-26 Miguel de Icaza <miguel@ximian.com>
6183 * statement.cs (Block): replace Implicit bool, for a generic
6185 New flag: `Unchecked'. This is used during the EmitMeta phase
6186 (which is out-of-line with the regular Resolve/Emit process for a
6187 statement, as this is done ahead of time, but still gets a chance
6188 to call constant resolve).
6190 (Block.Flags): new enum for adding a new flag.
6192 (Block.EmitMeta): track the state of unchecked.
6194 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
6195 to enable constant resolution to work there as well.
6197 2003-04-22 Miguel de Icaza <miguel@ximian.com>
6199 * typemanager.cs (ienumerable_type): Also look up
6200 System.Collections.IEnumerable.
6202 2003-04-21 Miguel de Icaza <miguel@ximian.com>
6204 TODO: Test more than one conditional per method.
6206 * class.cs (Indexer.Define): Report the location where the user is
6207 referencing the unsupported feature.
6209 (MethodData): Overload the use of `conditionals' to
6210 minimize the creation of needless ArrayLists. This saves roughly
6211 212kb on my machine.
6213 (Method): Implement the new IIteratorContainer interface.
6214 (Method.SetYields): Implement the method by setting the ModFlags
6215 to contain METHOD_YIELDS.
6217 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
6218 which just got set to null.
6220 * iterators.cs: New file.
6222 (Yield, YieldBreak): New statements.
6224 * statement.cs (Return.Resolve): Flag an error if we are used in
6227 * codegen.cs (InIterator): New flag set if the code is being
6228 compiled in an iterator method.
6230 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
6231 internal modifier, and we just use it to avoid adding extra
6232 fields, as this is seldom used.
6234 * cs-parser.jay: Add yield_statement (yield and yield break).
6236 * driver.cs: New flag -v2 to turn on version 2 features.
6238 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
6239 hashtable when v2 is enabled.
6241 2003-04-20 Miguel de Icaza <miguel@ximian.com>
6243 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
6244 there is already a namespace defined with this name.
6246 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
6247 people upgraded their corlibs.
6249 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
6250 always use fully qualified types, no need to use the compiler
6253 (TypeManager.IsNamespace): Use binarysearch.
6255 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
6256 AddDelegate): I did not quite use the new IsValid API properly: I
6257 have to pass the short-name and the fullname. I was passing only
6258 the basename instead of the fullname sometimes.
6260 (TypeContainer.DefineType): call NamespaceClash.
6262 * interface.cs (Interface.DefineType): use NamespaceClash before
6265 * delegate.cs (Delegate.DefineType): use NamespaceClash before
6268 * enum.cs: (Enum.DefineType): use NamespaceClash before
6271 * typemanager.cs (: 3-line patch that gives us some tasty 11%
6272 speed increase. First, use the negative_hits cache when we get a
6273 negative. Second, add the type with its full original name
6274 instead of the new . and + encoded name (reflection uses + to
6275 separate type from a nested type). Use LookupTypeReflection
6276 directly which bypasses the type->name hashtable (that we already
6277 know does not contain the type.
6279 * decl.cs (DeclSpace.ResolveTypeExpr): track the
6280 location/container type.
6282 * driver.cs: When passing utf8, use directly the UTF8Encoding.
6284 2003-04-19 Miguel de Icaza <miguel@ximian.com>
6286 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
6288 * delegate.cs (NewDelegate.Resolve): Test whether an instance
6289 method is being referenced in the method group from a static
6290 context, and report error 120 if so.
6292 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
6295 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
6296 is created, we create the A namespace).
6298 * cs-parser.jay: A namespace also introduces a DeclarationFound.
6301 2003-04-18 Miguel de Icaza <miguel@ximian.com>
6303 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
6304 invocation to ModuleBuilder.GetType with the same values will
6305 return a new type instance, so we need to cache its return
6308 * expression.cs (Binary.ResolveOperator): Only allow the compare
6309 operators on enums if they are of the same type.
6311 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
6312 types of ValueType on their own case. Before we were giving them
6313 the same treatment as objects.
6315 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
6316 fullname. Short name is used to compare against container name.
6317 Fullname is used to check against defined namespace names.
6319 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
6320 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
6322 (Method.CheckBase): Call parent.
6323 (MemberBase.CheckBase): Check for protected members on sealed
6325 (PropertyBase.CheckBase): Call parent.
6326 (Field.Define): Call parent.
6328 * report.cs: Negative error codes are now mapped to 8000 - code,
6329 so that the display is render more nicely.
6331 * typemanager.cs: Do not use try/catch, instead report a regular
6334 (GetPointerType, GetReferenceType): These methods provide
6335 mechanisms to obtain the T* and T& from a T. We had the code
6336 previously scattered around the code base, and it also used
6337 TypeManager.LookupType that would go through plenty of caches.
6338 This one goes directly to the type source.
6340 In some places we did the Type.GetType followed by
6341 ModuleBuilder.GetType, but not in others, so this unifies the
6344 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
6345 statements now that we have namespace information.
6347 * typemanager.cs (IsNamespace): New method, returns whether the
6348 string presented is a namespace or not.
6350 (ComputeNamespaces): New public entry point, computes the list of
6351 available namespaces, using the GetNamespaces API call in Mono, or
6352 the slower version in MS.NET.
6354 Now before we start the semantic analysis phase, we have a
6355 complete list of namespaces including everything that the user has
6358 Deleted old code to cache namespaces in .nsc files.
6360 2003-04-17 Miguel de Icaza <miguel@ximian.com>
6362 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
6363 class/struct location definition Location for the implicit
6364 constructor location.
6366 (Operator.Define): Use the location of the operator for the
6367 implicit Method definition.
6369 (Constructor.Emit): use the constructor location for the implicit
6370 base initializer constructor.
6372 * ecore.cs: Remove ITypeExpression. This interface is now gone,
6373 and the Expression class now contains two new methods:
6375 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
6376 isolate type lookup from the rest of the resolution process.
6378 Since we use Expressions to hold type definitions due to the way
6379 we parse the input we have historically overloaded Resolve to
6380 perform the Type lookups if a special flag is passed. Now this is
6381 eliminated and two methods take their place.
6383 The differences in the two methods between xStep and xTerminal is
6384 that xStep is involved in our current lookup system that uses
6385 SimpleNames to compose a name, while xTerminal is used just to
6386 catch the case where the simplename lookup failed.
6388 2003-04-16 Miguel de Icaza <miguel@ximian.com>
6390 * expression.cs (ResolveMemberAccess): Remove redundant code.
6391 TypeExpr expressions are always born fully resolved.
6393 * interface.cs (PopulateMethod): Do not lookup the types twice.
6394 We were doing it once during SemanticAnalysis and once during
6397 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
6398 in local variable type definitions, were being returned as a
6399 SimpleName (we decomposed everything into a string), that is
6400 because primary_expression was being used instead of a type in the
6401 grammar (reduce/reduce conflicts).
6403 The part that was wrong is that we converted the expression into a
6404 string (an oversimplification in one hand, compounded with primary
6405 expressions doing string concatenation).
6411 Would return "A.B.C[]" as a SimpleName. This stopped things like
6412 using clauses from working on this particular context. And a type
6413 was being matched directly against "A.B.C[]".
6415 We now use the correct approach, and allow for ComposedCast to be
6416 part of the unary expression. So the "A.B.C []" become a composed
6417 cast of "A.B.C" (as a nested group of MemberAccess with a
6418 SimpleName at the end) plus the rank composition "[]".
6422 2003-04-10 Miguel de Icaza <miguel@ximian.com>
6424 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
6425 for the access level checking.
6427 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
6428 `TypeContainer container', because I kept getting confused when I
6429 was debugging this code.
6431 * expression.cs (Indexers): Instead of tracking getters/setters,
6432 we now track them in parallel. We create one arraylist less, but
6433 most importantly it is possible now for the LValue code to find a
6434 matching get for a set.
6436 (IndexerAccess.DoResolveLValue): Update the code.
6437 GetIndexersForType has been modified already to extract all the
6438 indexers from a type. The code assumed it did not.
6440 Also make the code set the correct return type for the indexer.
6441 This was fixed a long time ago for properties, but was missing for
6442 indexers. It used to be void_type.
6444 (Binary.Emit): Test first for doubles instead of
6445 floats, as they are more common.
6447 (Binary.EmitBranchable): Use the .un version of the branch opcodes
6448 when dealing with floats and the <=, >= operators. This fixes bug
6451 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
6452 to load the array value by emitting a load on the foreach variable
6453 type. This was incorrect.
6455 We now emit the code to load an element using the the array
6456 variable type, and then we emit the conversion operator.
6460 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
6462 * attribute.cs: Avoid allocation of ArrayLists in the common case.
6464 2003-04-09 Miguel de Icaza <miguel@ximian.com>
6466 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
6467 test for protection before we test for signatures.
6469 (MethodSignature.ToString): implement.
6471 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
6472 to the case where we reduced into a LongConstant.
6474 * decl.cs (CheckAccessLevel): If the type is an array, we can not
6475 depend on whether the information is acurrate, because the
6476 Microsoft runtime will always claim that the array type is public,
6477 regardless of the real state.
6479 If the type is a pointer, another problem happens: the type is
6480 reported as non-public in Microsoft.
6482 In both cases we have to call CheckAccessLevel recursively with
6483 the underlying type as the argument to be tested.
6485 2003-04-08 Miguel de Icaza <miguel@ximian.com>
6487 * assign.cs (Assign.Emit): If we are dealing with a compound
6488 assignment expression, we should use the code path that stores the
6489 intermediate result in a temporary value. This fixes #40903.
6491 *expression.cs (Indirection.ToString): Provide ToString method for
6494 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
6496 * class.cs: Null out fields holding references to Block objects so
6497 they can be garbage collected.
6499 * expression.cs (OverloadResolve): Remove unused local.
6501 2003-04-07 Martin Baulig <martin@ximian.com>
6503 * codegen.cs (EmitContext.CurrentFile): New public field.
6504 (EmitContext.Mark): Use the CurrentFile to check whether the
6505 location is in the correct file.
6506 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
6508 2003-04-07 Martin Baulig <martin@ximian.com>
6510 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
6512 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
6513 location. [FIXME: The location argument which gets passed to this
6514 method is sometimes wrong!]
6516 2003-04-07 Nick Drochak <ndrochak@gol.com>
6518 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
6520 2003-04-07 Miguel de Icaza <miguel@ximian.com>
6522 * expression.cs (Indirection.EmitAssign): We were using the
6523 temporary, but returning immediately instead of continuing the
6526 2003-04-06 Martin Baulig <martin@ximian.com>
6528 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
6529 if it's a nested child, but also deriving from the outer class.
6532 * typemanager.cs (IsNestedChildOf): Make this work if it's a
6533 nested child, but also deriving from the outer class. See
6535 (FilterWithClosure): We may access private members of the outer
6536 class if we're a nested child and deriving from the outer class.
6537 (RealMemberLookup): Only set `closure_private_ok' if the
6538 `original_bf' contained BindingFlags.NonPublic.
6540 2003-04-05 Martin Baulig <martin@ximian.com>
6542 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
6543 probe if its a type parameter, and if so, flag an error.
6545 * decl.cs: Move here the SetParameterInfo code from class.cs.
6546 Handle IsGeneric here.
6548 Handle a variety of errors in the parameter info definition.
6550 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
6551 type parameters here.
6553 * cs-parser.jay (class_declaration): report errors for parameters
6556 2003-01-21 Miguel de Icaza <miguel@ximian.com>
6558 * generic.cs: New file, contains support code for generics.
6560 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
6561 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
6563 Update parser for the above removals.
6565 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
6566 now taken care of in the parser.
6568 2003-04-02 Miguel de Icaza <miguel@ximian.com>
6570 * class.cs (Event.Define): Do not allow abstract events to have
6573 2003-04-01 Miguel de Icaza <miguel@ximian.com>
6575 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
6576 block in event declarations.
6578 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
6579 value type, get its address.
6581 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
6582 leaving a class on the stack instead of a boolean value (int
6583 0/1). Change the code so we compare against null, and then the
6584 result against zero.
6586 * class.cs (TypeContainer.GetClassBases): We were checking for the
6587 parent class being sealed too late.
6589 * expression.cs (Binary.Emit): For <= and >= when dealing with
6590 floating point values, use cgt.un and clt.un instead of cgt and
6593 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
6595 * statement.cs: Apply the same optimization as MS: skip the
6596 GetEnumerator returning an IEnumerator, and use the one returning a
6597 CharEnumerator instead. This allows us to avoid the try-finally block
6600 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
6602 * cs-parser.jay: Attributes cannot be applied to
6603 namespaces. Fixes #40473
6605 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6608 (Add*): check if the name is valid using the full name for constants,
6609 fields, properties and events.
6611 2003-03-28 Miguel de Icaza <miguel@ximian.com>
6613 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
6614 char constants to be part of the enumeration.
6616 * expression.cs (Conditional.DoResolve): Add support for operator
6617 true. Implements the missing functionality from 14.12
6619 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
6620 operator true/false as required by the spec.
6622 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
6623 implicit conversion to boolean.
6625 * statement.cs (Statement.ResolveBoolean): A boolean expression is
6626 also one where the type implements `operator true'.
6628 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
6629 get an expression that will invoke operator true based on an
6632 (GetConversionOperators): Removed the hack that called op_True
6635 (Expression.ResolveBoolean): Move this from Statement.
6637 2003-03-17 Miguel de Icaza <miguel@ximian.com>
6639 * ecore.cs (FieldExpr): do not allow initialization of initonly
6640 fields on derived classes
6642 2003-03-13 Martin Baulig <martin@ximian.com>
6644 * statement.cs (Block.Emit): Call ig.BeginScope() and
6645 ig.EndScope() when compiling with debugging info; call
6646 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
6648 2003-03-08 Miguel de Icaza <miguel@ximian.com>
6650 * expression.cs (Indexers): Do not construct immediately, allow
6651 for new members to be appended as we go. Fixes 38143
6653 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6655 * expression.cs: save/restore context when resolving an unchecked
6658 2003-03-05 Miguel de Icaza <miguel@ximian.com>
6660 * cfold.cs: Catch division by zero in modulus operator during
6663 2003-03-03 Miguel de Icaza <miguel@ximian.com>
6665 * interface.cs (Interface.DefineMembers): Avoid defining members
6668 2003-02-27 Miguel de Icaza <miguel@ximian.com>
6670 * driver.cs: handle the +/- options for -noconfig
6672 * statement.cs (Unckeched.Resolve): Also track the state of
6673 unchecked in the Resolve phase.
6675 2003-02-27 Martin Baulig <martin@ximian.com>
6677 * ecore.cs (Expression.MemberLookup): Don't create a
6678 MethodGroupExpr for something which is not a method. Fixes #38291.
6680 2003-02-25 Miguel de Icaza <miguel@ximian.com>
6682 * class.cs (MemberBase.CheckParameters): Also check that the type
6683 is unmanaged if it is a pointer.
6685 * expression.cs (SizeOf.Resolve): Add location information.
6687 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
6688 a managed type is declared.
6690 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
6691 parameter modifiers as well. Fixes bug 38606
6693 * class.cs: Very sad. Am backing out the speed up changes
6694 introduced by the ArrayList -> Array in the TypeContainer, as they
6695 were not actually that much faster, and introduced a bug (no error
6696 reports on duplicated methods).
6698 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
6699 source first, this will guarantee that we have a valid expression
6700 before calling in lower levels functions that will require a
6701 resolved object. Then use this original_source in the
6702 target.ResolveLValue instead of the original source that was
6705 Another change. Use target.Resolve instead of LValueResolve.
6706 Although we are resolving for LValues, we will let the Assign code
6707 take care of that (it will be called again from Resolve). This
6708 basically allows code like this:
6710 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
6711 class Y { void A (X x) { x [0] += o; }
6713 The problem was that the indexer was trying to resolve for
6714 set_Item (idx, object o) and never finding one. The real set_Item
6715 was set_Item (idx, X). By delaying the process we get the right
6720 2003-02-23 Martin Baulig <martin@ximian.com>
6722 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
6723 while calling DoEmit ().
6725 * codegen.cs (EmitContext.Mark): Don't mark locations in other
6726 source files; if you use the #line directive inside a method, the
6727 compiler stops emitting line numbers for the debugger until it
6728 reaches the end of the method or another #line directive which
6729 restores the original file.
6731 2003-02-23 Martin Baulig <martin@ximian.com>
6733 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
6735 2003-02-23 Martin Baulig <martin@ximian.com>
6737 * statement.cs (Block.AddChildVariableNames): We need to call this
6738 recursively, not just for our immediate children.
6740 2003-02-23 Martin Baulig <martin@ximian.com>
6742 * class.cs (Event.Define): Always make the field private, like csc does.
6744 * typemanager.cs (TypeManager.RealMemberLookup): Make events
6745 actually work, fixes bug #37521.
6747 2003-02-23 Miguel de Icaza <miguel@ximian.com>
6749 * delegate.cs: When creating the various temporary "Parameters"
6750 classes, make sure that we call the ComputeAndDefineParameterTypes
6751 on those new parameters (just like we do with the formal ones), to
6752 allow them to be resolved in the context of the DeclSpace.
6754 This fixes the bug that Dick observed in Bugzilla #38530.
6756 2003-02-22 Miguel de Icaza <miguel@ximian.com>
6758 * expression.cs (ResolveMemberAccess): When resolving a constant,
6759 do not attempt to pull a constant if the value was not able to
6760 generate a valid constant.
6762 * const.cs (LookupConstantValue): Do not report more errors than required.
6764 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6766 * expression.cs: fixes bug #38328.
6768 2003-02-18 Miguel de Icaza <miguel@ximian.com>
6770 * class.cs: Changed all the various members that can be part of a
6771 class from being an ArrayList to be an Array of the right type.
6772 During the DefineType type_list, interface_list, delegate_list and
6773 enum_list are turned into types, interfaces, delegates and enums
6776 And during the member population, indexer_list, event_list,
6777 constant_list, field_list, instance_constructor_list, method_list,
6778 operator_list and property_list are turned into their real arrays.
6780 Although we could probably perform this operation earlier, for
6781 good error reporting we need to keep the lists and remove the
6782 lists for longer than required.
6784 This optimization was triggered by Paolo profiling the compiler
6785 speed on the output of `gen-sample-program.pl' perl script.
6787 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
6788 not crash in methods like MemberLookupFailed that use this field.
6790 This problem arises when the compiler fails to resolve a type
6791 during interface type definition for example.
6793 2003-02-18 Miguel de Icaza <miguel@ximian.com>
6795 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
6796 inherit from System.Object, so we have to stop at null, not only
6797 when reaching System.Object.
6799 2003-02-17 Miguel de Icaza <miguel@ximian.com>
6801 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
6802 DeclaredOnly because the parent indexer might have had a different
6803 name, but did not loop until the top of the hierarchy was reached.
6805 The problem this one fixes is 35492: when a class implemented an
6806 indexer from an interface, we were getting the interface method
6807 (which was abstract) and we were flagging an error (can not invoke
6810 This also keeps bug 33089 functioning, and test-148 functioning.
6812 * typemanager.cs (IsSpecialMethod): The correct way of figuring
6813 out if a method is special is to see if it is declared in a
6814 property or event, or whether it is one of the predefined operator
6815 names. This should fix correctly #36804.
6817 2003-02-15 Miguel de Icaza <miguel@ximian.com>
6819 The goal here is to remove the dependency on EmptyCast.Peel ().
6820 Killing it completely.
6822 The problem is that currently in a number of places where
6823 constants are expected, we have to "probe" for an EmptyCast, and
6824 Peel, which is not the correct thing to do, as this will be
6825 repetitive and will likely lead to errors.
6827 The idea is to remove any EmptyCasts that are used in casts that
6828 can be reduced to constants, so we only have to cope with
6831 This bug hunt was triggered by Bug 37363 and the desire to remove
6832 the duplicate pattern where we were "peeling" emptycasts to check
6833 whether they were constants. Now constants will always be
6836 * ecore.cs: Use an enumconstant here instead of wrapping with
6839 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
6840 throwing me off. By handling this we can get rid of a few hacks.
6842 * statement.cs (Switch): Removed Peel() code.
6844 2003-02-14 Miguel de Icaza <miguel@ximian.com>
6846 * class.cs: Location information for error 508
6848 * expression.cs (New.DoResolve): Add a guard against double
6849 resolution of an expression.
6851 The New DoResolve might be called twice when initializing field
6852 expressions (see EmitFieldInitializers, the call to
6853 GetInitializerExpression will perform a resolve on the expression,
6854 and later the assign will trigger another resolution
6856 This leads to bugs (#37014)
6858 * delegate.cs: The signature for EndInvoke should contain any ref
6859 or out parameters as well. We were not doing this in the past.
6861 * class.cs (Field.Define): Do not overwrite the type definition
6862 inside the `volatile' group. Turns out that volatile enumerations
6863 were changing the type here to perform a validity test, which
6866 2003-02-12 Miguel de Icaza <miguel@ximian.com>
6868 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
6869 and structs, we do not want to load the instance variable
6871 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
6872 enum_type has to be handled like an object reference (implicit
6873 conversions exists from this to object), but the regular IsClass
6874 and IsValueType tests will never return true for this one.
6876 Also we use TypeManager.IsValueType instead of type.IsValueType,
6877 just for consistency with the rest of the code (this is only
6878 needed if we ever use the construct exposed by test-180.cs inside
6879 corlib, which we dont today).
6881 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
6883 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
6886 2003-02-09 Martin Baulig <martin@ximian.com>
6888 * namespace.cs (Namespace..ctor): Added SourceFile argument.
6889 (Namespace.DefineNamespaces): New static public method; this is
6890 called when we're compiling with debugging to add all namespaces
6893 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
6894 pass it to the Namespace's .ctor.
6896 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
6897 and MethodBase arguments; pass the namespace ID to the symwriter;
6898 pass the MethodBase instead of the token to the symwriter.
6899 (SymbolWriter.DefineNamespace): New method to add a namespace to
6902 2003-02-09 Martin Baulig <martin@ximian.com>
6904 * symbolwriter.cs: New file. This is a wrapper around
6905 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
6906 methods here in near future.
6908 2003-02-09 Martin Baulig <martin@ximian.com>
6910 * codegen.cs (EmitContext.Mark): Just pass the arguments to
6911 ILGenerator.MarkSequencePoint() which are actually used by the
6914 2003-02-09 Martin Baulig <martin@ximian.com>
6916 * location.cs (SourceFile): New public sealed class. This
6917 contains the name and an index which is used in the location's token.
6918 (Location): Reserve an appropriate number of bits in the token for
6919 the source file instead of walking over that list, this gives us a
6920 really huge performance improvement when compiling with debugging.
6922 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
6923 `SourceFile' argument instead of a string.
6924 (Driver.ProcessFile): Add all the files via Location.AddFile(),
6925 but don't parse/tokenize here, we need to generate the list of all
6926 source files before we do that.
6927 (Driver.ProcessFiles): New static function. Parses/tokenizes all
6930 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
6931 instead of a string.
6933 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
6936 2003-02-09 Martin Baulig <martin@ximian.com>
6938 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
6939 filename on `#line default'.
6941 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
6943 * statement.cs: don't clear the pinned var when the fixed statement
6944 returns from the method (fixes bug#37752).
6946 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
6948 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
6951 2003-02-07 Martin Baulig <martin@ximian.com>
6953 * driver.cs: Removed the `--debug-args' command line argument.
6955 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
6956 automatically by the AsssemblyBuilder.
6957 (CodeGen.InitializeSymbolWriter): We don't need to call any
6958 initialization function on the symbol writer anymore. This method
6959 doesn't take any arguments.
6961 2003-02-03 Miguel de Icaza <miguel@ximian.com>
6963 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
6964 from referenced assemblies as well.
6966 2003-02-02 Martin Baulig <martin@ximian.com>
6968 * class.cs (MethodData.Emit): Generate debugging info for external methods.
6970 2003-02-02 Martin Baulig <martin@ximian.com>
6972 * class.cs (Constructor.Emit): Open the symbol writer before
6973 emitting the constructor initializer.
6974 (ConstructorInitializer.Emit): Call ec.Mark() to allow
6975 single-stepping through constructor initializers.
6977 2003-01-30 Miguel de Icaza <miguel@ximian.com>
6979 * class.cs: Handle error 549: do not allow virtual methods in
6982 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
6984 * decl.cs: Check access levels when resolving types
6986 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
6988 * statement.cs: Add parameters and locals set in catch blocks that might
6989 return to set vector
6991 2003-01-29 Miguel de Icaza <miguel@ximian.com>
6993 * class.cs (Operator): Set the SpecialName flags for operators.
6995 * expression.cs (Invocation.DoResolve): Only block calls to
6996 accessors and operators on SpecialName methods.
6998 (Cast.TryReduce): Handle conversions from char constants.
7001 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
7003 * statement.cs: small memory and time optimization in FlowBranching.
7005 2003-01-28 Pedro Mart <yoros@wanadoo.es>
7007 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
7008 problem that the last fix but in the other sid (Set).
7010 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
7011 access when there is no indexer in the hierarchy.
7013 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
7015 * class.cs: Combine some if statements.
7017 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7019 * driver.cs: fixed bug #37187.
7021 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
7023 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
7024 any indexer, it's needed to build a list with all the indexers in the
7025 hierarchy (AllGetters), else we have problems. Fixes #35653.
7027 2003-01-23 Miguel de Icaza <miguel@ximian.com>
7029 * class.cs (MethodData.Define): It is wrong for an interface
7030 implementation to be static in both cases: explicit and implicit.
7031 We were only handling this in one case.
7033 Improve the if situation there to not have negations.
7035 * class.cs (Field.Define): Turns out that we do not need to check
7036 the unsafe bit on field definition, only on usage. Remove the test.
7038 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7040 * driver.cs: use assembly.Location instead of Codebase (the latest
7041 patch made mcs fail when using MS assemblies).
7043 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
7045 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
7046 get the path to *corlib.dll.
7048 2003-01-21 Nick Drochak <ndrochak@gol.com>
7052 * typemanager.cs: Remove compiler warnings
7054 2003-01-20 Duncan Mak <duncan@ximian.com>
7056 * AssemblyInfo.cs: Bump the version number to 0.19.
7058 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7060 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
7062 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
7064 * class.cs (Constructor::Emit): Emit debugging info for constructors.
7066 2003-01-17 Miguel de Icaza <miguel@ximian.com>
7068 * cs-parser.jay: Small fix: we were not comparing the constructor
7069 name correctly. Thanks to Zoltan for the initial pointer.
7071 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
7073 * cs-tokenizer.cs: Set file name when specified with #line
7075 2003-01-15 Miguel de Icaza <miguel@ximian.com>
7077 * cs-parser.jay: Only perform the constructor checks here if we
7078 are named like the class; This will help provider a better
7079 error. The constructor path is taken when a type definition is
7080 not found, but most likely the user forgot to add the type, so
7081 report that rather than the constructor error.
7083 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
7085 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
7088 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
7090 * cs-parser.jay: Add cleanup call.
7092 2003-01-13 Duncan Mak <duncan@ximian.com>
7094 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
7095 consistent with other methods.
7097 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
7099 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
7101 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
7103 * attribute.cs: only set GuidAttr to true when we have a
7106 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7110 * typemanager.cs: fixes to allow mcs compile corlib with the new
7111 Type.IsSubclassOf fix.
7113 2003-01-08 Miguel de Icaza <miguel@ximian.com>
7115 * expression.cs (LocalVariableReference.DoResolve): Classify a
7116 constant as a value, not as a variable. Also, set the type for
7119 * cs-parser.jay (fixed_statement): take a type instead of a
7120 pointer_type, so we can produce a better error message later.
7122 * statement.cs (Fixed.Resolve): Flag types that are not pointers
7125 (For.DoEmit): Make inifinite loops have a
7126 non-conditional branch back.
7128 (Fixed.DoEmit): First populate the pinned variables, then emit the
7129 statement, then clear the variables. Before I was emitting the
7130 code once for each fixed piece.
7133 2003-01-08 Martin Baulig <martin@ximian.com>
7135 * statement.cs (FlowBranching.MergeChild): A break in a
7136 SWITCH_SECTION does not leave a loop. Fixes #36155.
7138 2003-01-08 Martin Baulig <martin@ximian.com>
7140 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
7141 lives in the same number space than `param_map'. Fixes #36154.
7143 2003-01-07 Miguel de Icaza <miguel@ximian.com>
7145 * cs-parser.jay (constructor_declaration): Set the
7146 Constructor.ModFlags before probing for it. This makes the
7147 compiler report 514, 515 and 132 (the code was there, but got
7150 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
7151 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
7152 (GotoCase.Resolve): Set `Returns' to ALWAYS.
7154 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
7156 * enum.cs: create the enum static fields using the enum type.
7158 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
7160 * class.cs: don't try to create the ParamBuilder for the return
7161 type if it's not needed (and handle it breaking for the ms runtime
7164 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
7166 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
7168 2002-12-29 Miguel de Icaza <miguel@ximian.com>
7170 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
7171 the command. This showed up while compiling the JANET source
7172 code, which used \r as its only newline separator.
7174 2002-12-28 Miguel de Icaza <miguel@ximian.com>
7176 * class.cs (Method.Define): If we are an operator (because it
7177 reuses our code), then set the SpecialName and HideBySig. #36128
7179 2002-12-22 Miguel de Icaza <miguel@ximian.com>
7181 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
7182 exception, report error 120 `object reference required'.
7184 * driver.cs: Add --pause option, used during to measure the size
7185 of the process as it goes with --timestamp.
7187 * expression.cs (Invocation.DoResolve): Do not allow methods with
7188 SpecialName to be invoked.
7190 2002-12-21 Miguel de Icaza <miguel@ximian.com>
7192 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
7193 number before adding it.
7195 2002-12-21 Ravi Pratap <ravi@ximian.com>
7197 * ecore.cs (StandardImplicitConversion): When in an unsafe
7198 context, we allow conversion between void * to any other pointer
7199 type. This fixes bug #35973.
7201 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
7203 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
7204 is not thrown when extensionless outputs are used
7206 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7208 * rootcontext.cs: fixed compilation of corlib.
7210 2002-12-19 Miguel de Icaza <miguel@ximian.com>
7212 * attribute.cs (Attributes.Contains): Add new method.
7214 * class.cs (MethodCore.LabelParameters): if the parameter is an
7215 `out' parameter, check that no attribute `[In]' has been passed.
7217 * enum.cs: Handle the `value__' name in an enumeration.
7219 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
7221 * decl.cs: Added special case to allow overrides on "protected
7224 2002-12-18 Ravi Pratap <ravi@ximian.com>
7226 * attribute.cs (Attributes.AddAttributeSection): Rename to this
7227 since it makes much more sense.
7229 (Attributes.ctor): Don't require a Location parameter.
7231 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
7233 * attribute.cs (ApplyAttributes): Remove extra Location parameters
7234 since we already have that information per attribute.
7236 * everywhere : make appropriate changes.
7238 * class.cs (LabelParameters): Write the code which actually
7239 applies attributes to the return type. We can't do this on the MS
7240 .NET runtime so we flag a warning in the case an exception is
7243 2002-12-18 Miguel de Icaza <miguel@ximian.com>
7245 * const.cs: Handle implicit null conversions here too.
7247 2002-12-17 Ravi Pratap <ravi@ximian.com>
7249 * class.cs (MethodCore.LabelParameters): Remove the extra
7250 Type [] parameter since it is completely unnecessary. Instead
7251 pass in the method's attributes so that we can extract
7252 the "return" attribute.
7254 2002-12-17 Miguel de Icaza <miguel@ximian.com>
7256 * cs-parser.jay (parse): Use Report.Error to flag errors instead
7257 of ignoring it and letting the compile continue.
7259 * typemanager.cs (ChangeType): use an extra argument to return an
7260 error condition instead of throwing an exception.
7262 2002-12-15 Miguel de Icaza <miguel@ximian.com>
7264 * expression.cs (Unary.TryReduce): mimic the code for the regular
7265 code path. Perform an implicit cast in the cases where we can
7266 implicitly convert to one of the integral types, and then reduce
7267 based on that constant. This fixes bug #35483.
7269 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7271 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
7273 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7275 * namespace.cs: fixed bug #35489.
7277 2002-12-12 Miguel de Icaza <miguel@ximian.com>
7279 * class.cs: Remove some dead code.
7281 * cs-parser.jay: Estimate the number of methods needed
7282 (RootContext.MethodCount);
7284 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
7285 numbers instead of StringBuilders.
7287 * support.cs (PtrHashtable): Add constructor with initial size;
7288 We can now reduce reallocations of the method table.
7290 2002-12-10 Ravi Pratap <ravi@ximian.com>
7292 * attribute.cs (ApplyAttributes): Keep track of the emitted
7293 attributes on a per-target basis. This fixes bug #35413.
7295 2002-12-10 Miguel de Icaza <miguel@ximian.com>
7297 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
7298 default to the Windows 1252 encoding.
7300 (UnixParseOption): Support version, thanks to Alp for the missing
7303 * AssemblyInfo.cs: Add nice assembly information.
7305 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
7308 * cs-parser.jay: Allow a trailing comma before the close bracked
7309 in the attribute_section production.
7311 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
7312 address of the instance was being taken, I will take this out,
7313 because we take the address of the object immediately here.
7315 2002-12-09 Ravi Pratap <ravi@ximian.com>
7317 * typemanager.cs (AreMultipleAllowed): Take care of the most
7318 obvious case where attribute type is not in the current assembly -
7321 2002-12-08 Miguel de Icaza <miguel@ximian.com>
7323 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
7324 definitions, instead of doing that afterwards.
7326 Also we use a nice little hack, depending on the constructor, we
7327 know if we are a "composed" name or a simple name. Hence, we
7328 avoid the IndexOf test, and we avoid
7330 * codegen.cs: Add code to assist in a bug reporter to track down
7331 the source of a compiler crash.
7333 2002-12-07 Ravi Pratap <ravi@ximian.com>
7335 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
7336 types have been emitted for a given element and flag an error
7337 if something which does not have AllowMultiple set is used more
7340 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
7341 attribute types and their corresponding AllowMultiple properties
7343 (AreMultipleAllowed): Check the property for a given type.
7345 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
7346 property in the case we have a TypeContainer.
7348 (Attributes.AddAttribute): Detect duplicates and just skip on
7349 adding them. This trivial fix catches a pretty gross error in our
7350 attribute emission - global attributes were being emitted twice!
7352 Bugzilla bug #33187 is now fixed.
7354 2002-12-06 Miguel de Icaza <miguel@ximian.com>
7356 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
7359 * expression.cs (Binary.ResolveOperator): I can only use the
7360 Concat (string, string, string) and Concat (string, string,
7361 string, string) if the child is actually a concatenation of
7364 2002-12-04 Miguel de Icaza <miguel@ximian.com>
7366 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
7367 context where we need a 2-character lookahead.
7369 * pending.cs (PendingImplementation): Rework so we can keep track
7370 of interface types all the time, and flag those which were
7371 implemented by parents as optional.
7373 2002-12-03 Miguel de Icaza <miguel@ximian.com>
7375 * expression.cs (Binary.ResolveOperator): Use
7376 String.Concat(string,string,string) or
7377 String.Concat(string,string,string,string) when possible.
7379 * typemanager: More helper methods.
7382 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
7384 * pending.cs: remove the bogus return from GetMissingInterfaces()
7385 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
7387 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7389 * namespace.cs: avoid duplicated 'using xxx' being added to
7390 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
7391 when we get more than one 'using' statement for the same namespace.
7392 Report a CS0105 warning for it.
7394 2002-11-30 Miguel de Icaza <miguel@ximian.com>
7396 * cs-tokenizer.cs (consume_identifier): use read directly, instead
7397 of calling getChar/putback, uses internal knowledge of it.
7399 (xtoken): Reorder tokenizer so most common patterns are checked
7400 first. This reduces the compilation time in another 5% (from 8.11s
7401 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
7403 The parsing time is 22% of the compilation in mcs, and from that
7404 64% is spent on the tokenization process.
7406 I tried using a binary search for keywords, but this is slower
7407 than the hashtable. Another option would be to do a couple of
7410 * Not use a StringBuilder, instead use an array of chars,
7411 with a set value. Notice that this way we could catch
7412 the 645 error without having to do it *afterwards*.
7414 * We could write a hand-parser to avoid the hashtable
7415 compares altogether.
7417 The identifier consumption process takes 37% of the tokenization
7418 time. Another 15% is spent on is_number. 56% of the time spent
7419 on is_number is spent on Int64.Parse:
7421 * We could probably choose based on the string length to
7422 use Int32.Parse or Int64.Parse and avoid all the 64-bit
7425 Another 3% is spend on wrapping `xtoken' in the `token' function.
7427 Handle 0xa0 as whitespace (#34752)
7429 2002-11-26 Miguel de Icaza <miguel@ximian.com>
7431 * typemanager.cs (IsCLRType): New routine to tell whether a type
7432 is one of the builtin types.
7434 Maybe it needs to use TypeCodes to be faster. Maybe we could use
7435 typecode in more places instead of doing pointer comparissions.
7436 We could leverage some knowledge about the way the typecodes are
7439 New code to cache namespaces in assemblies, it is currently not
7440 invoked, to be used soon.
7442 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
7444 * expression.cs (Binary.ResolveOperator): specially handle
7445 strings, and do not perform user-defined operator overloading for
7448 2002-11-24 Miguel de Icaza <miguel@ximian.com>
7450 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
7451 internalcall as it is a pretty simple operation; Avoid whenever
7452 possible to call Char.IsLetter.
7454 (consume_identifier): Cut by half the number of
7455 hashtable calls by merging the is_keyword and GetKeyword behavior.
7457 Do not short-circuit, because if we do, we
7458 report errors (ie, #if false && true would produce an invalid
7462 2002-11-24 Martin Baulig <martin@ximian.com>
7464 * expression.cs (Cast.TryReduce): If we're in checked syntax,
7465 check constant ranges and report a CS0221. Fixes #33186.
7467 2002-11-24 Martin Baulig <martin@ximian.com>
7469 * cs-parser.jay: Make this work for uninitialized variable
7470 declarations in the `for' initializer. Fixes #32416.
7472 2002-11-24 Martin Baulig <martin@ximian.com>
7474 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
7475 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
7477 2002-11-24 Martin Baulig <martin@ximian.com>
7479 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
7480 argument; if true, we also check for user-defined conversions.
7481 This is only needed if both arguments are of a user-defined type.
7482 Fixes #30443, added test-175.cs.
7483 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
7485 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
7487 2002-11-24 Martin Baulig <martin@ximian.com>
7489 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
7490 function to get the store opcode.
7491 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
7492 only emit the Ldelema if the store opcode is Stobj. You must run
7493 both test-34 and test-167 to test this. Fixes #34529.
7495 2002-11-23 Martin Baulig <martin@ximian.com>
7497 * ecore.cs (Expression.MemberLookup): Added additional
7498 `qualifier_type' argument which is used when we're being called
7499 from MemberAccess.DoResolve() and null if we're called from a
7501 (Expression.MemberLookupFailed): New method to report errors; this
7502 does the CS1540 check and reports the correct error message.
7504 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
7505 argument for the CS1540 check and redone the way how we're dealing
7506 with private members. See the comment in the source code for details.
7507 (FilterWithClosure): Reverted this back to revision 1.197; renamed
7508 `closure_start_type' to `closure_qualifier_type' and check whether
7509 it's not null. It was not this filter being broken, it was just
7510 being called with the wrong arguments.
7512 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
7513 and pass it the correct `qualifier_type'; this also does the error
7516 2002-11-22 Miguel de Icaza <miguel@ximian.com>
7518 * expression.cs (Invocation.EmitParams): If the we are dealing
7519 with a non-built-in value type, load its address as well.
7521 (ArrayCreation): Use a a pretty constant instead
7522 of the hardcoded value 2. Use 6 instead of 2 for the number of
7523 static initializers.
7525 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
7526 because they are not really value types, just glorified integers.
7528 * driver.cs: Do not append .exe, the CSC compiler does not do it.
7530 * ecore.cs: Remove redundant code for enumerations, make them use
7531 the same code path as everything else, fixes the casting issue
7532 with enumerations in Windows.Forms.
7534 * attribute.cs: Do only cast to string if it is a string, the
7535 validation happens later.
7537 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
7538 people upgrade their corlibs.
7540 * ecore.cs: Oops, enumerations were not following the entire code path
7542 2002-11-21 Miguel de Icaza <miguel@ximian.com>
7544 * typemanager.cs (FilterWithClosure): Commented out the test for
7545 1540 in typemanager.cs, as it has problems when accessing
7546 protected methods from a parent class (see test-174.cs).
7548 * attribute.cs (Attribute.ValidateGuid): new method.
7549 (Attribute.Resolve): Use above.
7551 2002-11-19 Miguel de Icaza <miguel@ximian.com>
7553 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
7555 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
7556 handling for enumerations, as we only needed the TypeContainer
7557 functionality to begin with (this is required for the fix below to
7558 work for enums that reference constants in a container class for
7561 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
7563 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
7564 a valid TypeBuilder to perform lookups on.o
7566 * class.cs (InheritableMemberSignatureCompare): Use true in the
7567 call to GetGetMethod and GetSetMethod, because we are comparing
7568 the signature, and we need to get the methods *even* if they are
7571 (PropertyBase.CheckBase): ditto.
7573 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
7574 GotoCase.Resolve): Use Peel on EmpytCasts.
7576 * ecore.cs (EmptyCast): drop child, add Peel method.
7578 2002-11-17 Martin Baulig <martin@ximian.com>
7580 * ecore.cs (EmptyCast.Child): New public property.
7582 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
7583 label resolved to an EmptyCast. Fixes #34162.
7584 (GotoCase.Resolve): Likewise.
7585 (Block.EmitMeta): Likewise.
7587 2002-11-17 Martin Baulig <martin@ximian.com>
7589 * expression.cs (Invocation.BetterConversion): Prefer int over
7590 uint; short over ushort; long over ulong for integer literals.
7591 Use ImplicitConversionExists instead of StandardConversionExists
7592 since we also need to check for user-defined implicit conversions.
7593 Fixes #34165. Added test-173.cs.
7595 2002-11-16 Martin Baulig <martin@ximian.com>
7597 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
7598 with the `true' and `false' literals. Fixes #33151.
7600 2002-11-16 Martin Baulig <martin@ximian.com>
7602 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
7603 October 22nd; don't do the cs1540 check for static members.
7605 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
7606 now using our own filter here and doing the cs1540 check again.
7608 2002-11-16 Martin Baulig <martin@ximian.com>
7610 * support.cs (InternalParameters): Don't crash if we don't have
7611 any fixed parameters. Fixes #33532.
7613 2002-11-16 Martin Baulig <martin@ximian.com>
7615 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
7616 when looking up static methods to make this work on Windows.
7619 2002-11-16 Martin Baulig <martin@ximian.com>
7621 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
7622 a setter rather than using PropertyInfo.CanWrite.
7624 2002-11-15 Nick Drochak <ndrochak@gol.com>
7626 * class.cs: Allow acces to block member by subclasses. Fixes build
7629 2002-11-14 Martin Baulig <martin@ximian.com>
7631 * class.cs (Constructor.Emit): Added the extern/block check.
7634 2002-11-14 Martin Baulig <martin@ximian.com>
7636 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
7637 iteration while looking for indexers, this is needed because the
7638 indexer may have a different name in our base classes. Fixed the
7639 error reporting (no indexers at all, not get accessor, no
7640 overloaded match). Fixes bug #33089.
7641 (IndexerAccess.DoResolveLValue): Likewise.
7643 2002-11-14 Martin Baulig <martin@ximian.com>
7645 * class.cs (PropertyBase.CheckBase): Make this work for multiple
7646 indexers. Fixes the first part of bug #33089.
7647 (MethodSignature.InheritableMemberSignatureCompare): Added support
7650 2002-11-13 Ravi Pratap <ravi@ximian.com>
7652 * attribute.cs (Attribute.Resolve): Catch the
7653 NullReferenceException and report it since it isn't supposed to
7656 2002-11-12 Miguel de Icaza <miguel@ximian.com>
7658 * expression.cs (Binary.EmitBranchable): Also handle the cases for
7659 LogicalOr and LogicalAnd that can benefit from recursively
7660 handling EmitBranchable. The code now should be nice for Paolo.
7662 2002-11-08 Miguel de Icaza <miguel@ximian.com>
7664 * typemanager.cs (LookupType): Added a negative-hit hashtable for
7665 the Type lookups, as we perform quite a number of lookups on
7666 non-Types. This can be removed once we can deterministically tell
7667 whether we have a type or a namespace in advance.
7669 But this might require special hacks from our corlib.
7673 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
7674 and double which avoids a conversion from an integer to a double.
7676 * expression.cs: tiny optimization, avoid calling IsConstant,
7677 because it effectively performs the lookup twice.
7679 2002-11-06 Miguel de Icaza <miguel@ximian.com>
7681 But a bogus return here to keep the semantics of the old code
7682 until the Mono runtime is fixed.
7684 * pending.cs (GetMissingInterfaces): New method used to remove all
7685 the interfaces that are already implemented by our parent
7686 classes from the list of pending methods.
7688 * interface.cs: Add checks for calls after ResolveTypeExpr.
7690 2002-11-05 Miguel de Icaza <miguel@ximian.com>
7692 * class.cs (Class.Emit): Report warning 67: event not used if the
7693 warning level is beyond 3.
7695 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
7696 being a NullLiteral.
7698 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
7701 * class.cs (TypeContainer.GetClassBases): Cover a missing code
7702 path that might fail if a type can not be resolved.
7704 * expression.cs (Binary.Emit): Emit unsigned versions of the
7707 * driver.cs: use error 5.
7709 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
7711 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
7713 2002-11-01 Miguel de Icaza <miguel@ximian.com>
7715 * cs-parser.jay (switch_section): A beautiful patch from Martin
7716 Baulig that fixed 33094.
7718 2002-10-31 Miguel de Icaza <miguel@ximian.com>
7720 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
7721 Check whether the base is abstract and report an error if so.
7723 * expression.cs (IndexerAccess.DoResolveLValue,
7724 IndexerAccess.DoResolve): ditto.
7726 (Invocation.DoResolve): ditto.
7728 (Invocation.FullMethodDesc): Improve the report string.
7730 * statement.cs (Block): Eliminate IsVariableDefined as it is
7731 basically just a wrapper for GetVariableInfo.
7733 * ecore.cs (SimpleName): Use new
7735 * support.cs (ReflectionParamter.ParameterType): We unwrap the
7736 type, as we return the actual parameter ref/unref state on a
7739 2002-10-30 Miguel de Icaza <miguel@ximian.com>
7741 * support.cs: Return proper flags REF/OUT fixing the previous
7744 * expression.cs: Reverted last patch, that was wrong. Is_ref is
7745 not used to mean `ref' but `ref or out' in ParameterReference
7747 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
7748 full type signature instead of calling TypeManger.CSharpName
7751 * support.cs (InternalParameters.ParameterDesc): Do not compare
7752 directly to the modflags, because REF/OUT will actually be bitsets
7755 * delegate.cs (VerifyMethod): Check also the modifiers.
7757 * cs-tokenizer.cs: Fix bug where floating point values with an
7758 exponent where a sign was missing was ignored.
7760 * driver.cs: Allow multiple assemblies to be specified in a single
7763 2002-10-28 Miguel de Icaza <miguel@ximian.com>
7765 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
7766 because identifiers after a parenthesis would end up in this kind
7767 of production, and we needed to desamiguate it for having casts
7770 (UserDefinedType *) xxx
7772 2002-10-24 Miguel de Icaza <miguel@ximian.com>
7774 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
7775 we should set on the Bindingflags.NonPublic, but not turn on
7776 private_ok. private_ok controls whether a Private member is
7777 returned (this is chekced on the filter routine), while the
7778 BindingFlags.NonPublic just controls whether private/protected
7779 will be allowed. This fixes the problem part of the problem of
7780 private properties being allowed to be used in derived classes.
7782 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
7783 so we can call the children DoResolveLValue method (this will
7784 properly signal errors on lvalue assignments to base properties)
7786 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
7787 getter are null, and we have a property info, we know that this
7788 happened because the lookup failed, so we report an error 122 for
7789 protection level violation.
7791 We also silently return if setter and getter are null in the
7792 resolve functions, this condition only happens if we have flagged
7793 the error before. This is the other half of the problem.
7795 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
7796 not have accessibility information, that is why we were returning
7797 true in the filter function in typemanager.cs.
7799 To properly report 122 (property is inaccessible because of its
7800 protection level) correctly, we report this error in ResolveAccess
7801 by failing if both the setter and the getter are lacking (ie, the
7804 DoResolve and DoLResolve have been modified to check for both
7805 setter/getter being null and returning silently, the reason being
7806 that I did not want to put the knowledge about this error in upper
7809 int old = Report.Errors;
7810 x = new PropertyExpr (...);
7811 if (old != Report.Errors)
7816 So the property expr is returned, but it is invalid, so the error
7817 will be flagged during the resolve process.
7819 * class.cs: Remove InheritablePropertySignatureCompare from the
7820 class, as we no longer depend on the property signature to compute
7821 whether it is possible to implement a method or not.
7823 The reason is that calling PropertyInfo.GetGetMethod will return
7824 null (in .NET, in Mono it works, and we should change this), in
7825 cases where the Get Method does not exist in that particular
7830 class X { public virtual int A { get { return 1; } } }
7832 class Z : Y { public override int A { get { return 2; } } }
7834 Would fail in Z because the parent (Y) would not have the property
7835 defined. So we avoid this completely now (because the alternative
7836 fix was ugly and slow), and we now depend exclusively on the
7839 (PropertyBase.CheckBase): Use a method-base mechanism to find our
7840 reference method, instead of using the property.
7842 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
7843 routines are gone now.
7845 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
7846 names, they were incorrectly named.
7848 * cs-tokenizer.cs: Return are more gentle token on failure.
7850 * pending.cs (PendingImplementation.InterfaceMethod): This routine
7851 had an out-of-sync index variable, which caused it to remove from
7852 the list of pending methods the wrong method sometimes.
7854 2002-10-22 Miguel de Icaza <miguel@ximian.com>
7856 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
7857 CanWrite, because those refer to this particular instance of the
7858 property, and do not take into account the fact that we can
7859 override single members of a property.
7861 Constructor requires an EmitContext. The resolution process does
7862 not happen here, but we need to compute the accessors before,
7863 because the resolution does not always happen for properties.
7865 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
7866 subclass, before we did not update this flag, but we did update
7869 (GetAccessors): Drop this routine, as it did not work in the
7870 presence of partially overwritten set/get methods.
7872 Notice that this broke the cs1540 detection, but that will require
7875 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7879 * driver.cs: issue a warning instead of an error if we don't support
7880 debugging for the platform. Also ignore a couple of errors that may
7881 arise when trying to write the symbols. Undo my previous patch.
7883 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7885 * driver.cs: ignore /debug switch except for Unix platforms.
7887 2002-10-23 Nick Drochak <ndrochak@gol.com>
7889 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
7891 2002-10-21 Miguel de Icaza <miguel@ximian.com>
7893 * driver.cs: Do not make mcs-debug conditional, so we do not break
7896 * statement.cs (UsageVector.MergeChildren): I would like Martin to
7897 review this patch. But basically after all the children variables
7898 have been merged, the value of "Breaks" was not being set to
7899 new_breaks for Switch blocks. I think that it should be set after
7900 it has executed. Currently I set this to the value of new_breaks,
7901 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
7902 conservative, but I do not understand this code very well.
7904 I did not break anything in the build, so that is good ;-)
7906 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
7908 2002-10-20 Mark Crichton <crichton@gimp.org>
7910 * cfold.cs: Fixed compile blocker. Really fixed it this time.
7912 2002-10-20 Nick Drochak <ndrochak@gol.com>
7914 * cfold.cs: Fixed compile blocker.
7916 2002-10-20 Miguel de Icaza <miguel@ximian.com>
7918 * driver.cs: I was chekcing the key, not the file.
7920 2002-10-19 Ravi Pratap <ravi@ximian.com>
7922 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
7923 message that we were generating - we just need to silently return
7926 2002-10-19 Miguel de Icaza <miguel@ximian.com>
7928 * class.cs (Event.Define): Change my previous commit, as this
7929 breaks the debugger. This is a temporary hack, as it seems like
7930 the compiler is generating events incorrectly to begin with.
7932 * expression.cs (Binary.ResolveOperator): Added support for
7933 "U operator - (E x, E y)"
7935 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
7938 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
7939 init-only variables, but this path did not take into account that
7940 there might be also instance readonly variables. Correct this
7943 This fixes bug 32253
7945 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
7948 * driver.cs: Change the extension for modules to `netmodule'
7950 * cs-parser.jay: Improved slightly the location tracking for
7951 the debugger symbols.
7953 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
7954 modifiers that were specified instead of the hardcoded value
7955 (FamAndAssem). This was basically ignoring the static modifier,
7956 and others. Fixes 32429.
7958 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
7959 fixed a bug in the process (32476)
7961 * expression.cs (ArrayAccess.EmitAssign): Patch from
7962 hwang_rob@yahoo.ca that fixes bug 31834.3
7964 2002-10-18 Miguel de Icaza <miguel@ximian.com>
7966 * driver.cs: Make the module extension .netmodule.
7968 2002-10-16 Miguel de Icaza <miguel@ximian.com>
7970 * driver.cs: Report an error if the resource file is not found
7971 instead of crashing.
7973 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
7974 false, like Emit does.
7976 2002-10-16 Nick Drochak <ndrochak@gol.com>
7978 * typemanager.cs: Remove unused private member. Also reported mcs
7979 bug to report this as a warning like csc.
7981 2002-10-15 Martin Baulig <martin@gnome.org>
7983 * statement.cs (Statement.Emit): Made this a virtual method; emits
7984 the line number info and calls DoEmit().
7985 (Statement.DoEmit): New protected abstract method, formerly knows
7986 as Statement.Emit().
7988 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
7990 2002-10-11 Miguel de Icaza <miguel@ximian.com>
7992 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
7993 have fixed a remaining problem: not every AddXXXX was adding a
7994 fully qualified name.
7996 Now everyone registers a fully qualified name in the DeclSpace as
7997 being defined instead of the partial name.
7999 Downsides: we are slower than we need to be due to the excess
8000 copies and the names being registered this way.
8002 The reason for this is that we currently depend (on the corlib
8003 bootstrap for instance) that types are fully qualified, because
8004 we dump all the types in the namespace, and we should really have
8005 types inserted into the proper namespace, so we can only store the
8006 basenames in the defined_names array.
8008 2002-10-10 Martin Baulig <martin@gnome.org>
8010 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
8011 from bug #31834, see the bug report for a testcase which is
8014 2002-10-10 Martin Baulig <martin@gnome.org>
8016 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
8017 flow analysis code for this.
8019 * statement.cs (Do, While, For): Tell the flow analysis code about
8021 (FlowBranching.UsageVector): Added support for infinite loops.
8022 (Block.Resolve): Moved the dead code elimination here and use flow
8025 2002-10-09 Miguel de Icaza <miguel@ximian.com>
8027 * class.cs (Field.Define): Catch cycles on struct type
8030 * typemanager.cs (IsUnmanagedtype): Do not recursively check
8031 fields if the fields are static. We only need to check instance
8034 * expression.cs (As.DoResolve): Test for reference type.
8036 * statement.cs (Using.ResolveExpression): Use
8037 ConvertImplicitRequired, not ConvertImplicit which reports an
8039 (Using.ResolveLocalVariableDecls): ditto.
8041 * expression.cs (Binary.ResolveOperator): Report errors in a few
8042 places where we had to.
8044 * typemanager.cs (IsUnmanagedtype): Finish implementation.
8046 2002-10-08 Miguel de Icaza <miguel@ximian.com>
8048 * expression.cs: Use StoreFromPtr instead of extracting the type
8049 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
8051 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
8052 an enumeration value to a System.Enum, but System.Enum is not a
8053 value type, but an class type, so we need to box.
8055 (Expression.ConvertExplicit): One codepath could return
8056 errors but not flag them. Fix this. Fixes #31853
8058 * parameter.cs (Resolve): Do not allow void as a parameter type.
8060 2002-10-06 Martin Baulig <martin@gnome.org>
8062 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
8063 if it's a class type and not a struct. Fixes #31815.
8065 2002-10-06 Martin Baulig <martin@gnome.org>
8067 * statement.cs: Reworked the flow analysis code a bit to make it
8068 usable for dead code elimination.
8070 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8072 * cs-parser.jay: allow empty source files. Fixes bug #31781.
8074 2002-10-04 Miguel de Icaza <miguel@ximian.com>
8076 * expression.cs (ComposedCast.DoResolveType): A quick workaround
8077 to fix the test 165, will investigate deeper.
8079 2002-10-04 Martin Baulig <martin@gnome.org>
8081 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
8082 finally blocks actually work.
8083 (Try.Resolve): We don't need to create a sibling for `finally' if
8084 there is no finally block.
8086 2002-10-04 Martin Baulig <martin@gnome.org>
8088 * class.cs (Constructor.Define): The default accessibility for a
8089 non-default constructor is private, not public.
8091 2002-10-04 Miguel de Icaza <miguel@ximian.com>
8093 * class.cs (Constructor): Make AllowedModifiers public, add
8096 * cs-parser.jay: Perform the modifiers test here, as the
8097 constructor for the Constructor class usually receives a zero
8098 because of the way we create it (first we create, later we
8099 customize, and we were never checking the modifiers).
8101 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
8102 is a version of LookupTypeReflection that includes the type-name
8103 cache. This can be used as a fast path for functions that know
8104 the fully qualified name and are only calling into *.GetType() to
8105 obtain a composed type.
8107 This is also used by TypeManager.LookupType during its type
8110 (LookupType): We now also track the real type name, as sometimes
8111 we can get a quey for the real type name from things like
8112 ComposedCast. This fixes bug 31422.
8114 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
8115 complete type fullname, it does not have to go through the type
8116 resolution system to obtain the composed version of the type (for
8117 obtaining arrays or pointers).
8119 (Conditional.Emit): Use the EmitBoolExpression to
8120 generate nicer code, as requested by Paolo.
8122 (ArrayCreation.CheckIndices): Use the patch from
8123 hwang_rob@yahoo.ca to validate the array initializers.
8125 2002-10-03 Miguel de Icaza <miguel@ximian.com>
8127 * class.cs (ConstructorInitializer.Emit): simplify code by using
8128 Invocation.EmitCall, and at the same time, fix the bugs in calling
8129 parent constructors that took variable arguments.
8131 * ecore.cs (Expression.ConvertNumericExplicit,
8132 Expression.ImplicitNumericConversion): Remove the code that
8133 manually wrapped decimal (InternalTypeConstructor call is now gone
8136 * expression.cs (Cast.TryReduce): Also handle decimal types when
8137 trying to perform a constant fold on the type.
8139 * typemanager.cs (IsUnmanagedtype): Partially implemented.
8141 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
8142 that only turned off an error report, and did nothing else.
8144 2002-10-02 Miguel de Icaza <miguel@ximian.com>
8146 * driver.cs: Handle and ignore /fullpaths
8148 2002-10-01 Miguel de Icaza <miguel@ximian.com>
8150 * expression.cs (Binary.ResolveOperator): Catch the case where
8151 DoNumericPromotions returns true,
8153 (Binary.DoNumericPromotions): Simplify the code, and the tests.
8155 2002-09-27 Miguel de Icaza <miguel@ximian.com>
8157 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
8160 2002-09-26 Miguel de Icaza <miguel@ximian.com>
8162 * ecore.cs (ConvertNumericExplicit): It is not enough that the
8163 conversion exists, but it is also required that the conversion be
8164 performed. This manifested in "(Type64Enum) 2".
8166 * class.cs (TypeManager.AddMethod): The fix is not to change
8167 AddEnum, because that one was using a fully qualified name (every
8168 DeclSpace derivative does), but to change the AddMethod routine
8169 that was using an un-namespaced name. This now correctly reports
8170 the duplicated name.
8172 Revert patch until I can properly fix it. The issue
8173 is that we have a shared Type space across all namespaces
8174 currently, which is wrong.
8176 Options include making the Namespace a DeclSpace, and merge
8177 current_namespace/current_container in the parser.
8179 2002-09-25 Miguel de Icaza <miguel@ximian.com>
8181 * cs-parser.jay: Improve error reporting when we get a different
8182 kind of expression in local_variable_type and
8183 local_variable_pointer_type.
8185 Propagate this to avoid missleading errors being reported.
8187 * ecore.cs (ImplicitReferenceConversion): treat
8188 TypeManager.value_type as a target just like object_type. As
8193 Is valid, and needs to result in the int 1 being boxed before it
8194 is assigned to the value type v.
8196 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
8197 to validate the enumeration name.
8199 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
8200 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
8201 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
8203 * ecore.cs (TryImplicitIntConversion): When doing an
8204 implicit-enumeration-conversion, check if the type is 64-bits and
8205 perform a conversion before passing to EnumConstant.
8207 2002-09-23 Miguel de Icaza <miguel@ximian.com>
8209 * decl.cs (Error_AmbiguousTypeReference); New routine used to
8210 report ambiguous type references. Unlike the MS version, we
8211 report what the ambiguity is. Innovation at work ;-)
8213 (DeclSpace.FindType): Require a location argument to
8214 display when we display an ambiguous error.
8216 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
8218 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
8220 * expression.cs (EmitDynamicInitializers): Apply patch from
8221 hwang_rob@yahoo.ca that fixes the order in which we emit our
8224 2002-09-21 Martin Baulig <martin@gnome.org>
8226 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
8227 delegate takes no arguments.
8229 2002-09-20 Miguel de Icaza <miguel@ximian.com>
8231 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
8234 * expression.cs: Extract the underlying type.
8236 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
8238 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
8240 2002-09-19 Miguel de Icaza <miguel@ximian.com>
8242 * class.cs (TypeContainer.DefineType): We can not use the nice
8243 PackingSize with the size set to 1 DefineType method, because it
8244 will not allow us to define the interfaces that the struct
8247 This completes the fixing of bug 27287
8249 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
8250 means also structs. This fixes part of the problem.
8251 (Expresion.ImplicitReferenceConversionExists): ditto.
8253 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
8254 error if there were no errors reported during the type lookup
8255 process, to avoid duplicates or redundant errors. Without this
8256 you would get an ambiguous errors plus a type not found. We have
8257 beaten the user enough with the first error.
8259 (DeclSparce.FindType): Emit a warning if we have an ambiguous
8262 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
8263 during the resolution process, stop the lookup, this avoids
8264 repeated error reports (same error twice).
8266 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
8268 * typemanager.cs (LookupType): Redo the type lookup code to match
8269 the needs of System.Reflection.
8271 The issue is that System.Reflection requires references to nested
8272 types to begin with a "+" sign instead of a dot. So toplevel
8273 types look like: "NameSpace.TopLevelClass", and nested ones look
8274 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
8277 2002-09-19 Martin Baulig <martin@gnome.org>
8279 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
8280 says that a method always returns or always throws an exception,
8281 don't report the CS0161.
8283 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
8284 set `Returns = new_returns'.
8286 2002-09-19 Martin Baulig <martin@gnome.org>
8288 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
8289 to an enum constant, check for a CS0176.
8291 2002-09-18 Miguel de Icaza <miguel@ximian.com>
8293 * class.cs (TypeContainer.CheckPairedOperators): Now we check
8294 for operators that must be in pairs and report errors.
8296 * ecore.cs (SimpleName.DoResolveType): During the initial type
8297 resolution process, when we define types recursively, we must
8298 check first for types in our current scope before we perform
8299 lookups in the enclosing scopes.
8301 * expression.cs (MakeByteBlob): Handle Decimal blobs.
8303 (Invocation.VerifyArgumentsCompat): Call
8304 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
8305 I thought we were supposed to always call this, but there are a
8306 few places in the code where we dont do it.
8308 2002-09-17 Miguel de Icaza <miguel@ximian.com>
8310 * driver.cs: Add support in -linkres and -resource to specify the
8311 name of the identifier.
8313 2002-09-16 Miguel de Icaza <miguel@ximian.com>
8315 * ecore.cs (StandardConversionExists): Sync with the conversion
8316 code: allow anything-* to void* conversions.
8318 (FindMostSpecificSource): Use an Expression argument
8319 instead of a Type, because we might be handed over a Literal which
8320 gets a few more implicit conversions that plain types do not. So
8321 this information was being lost.
8323 Also, we drop the temporary type-holder expression when not
8326 2002-09-17 Martin Baulig <martin@gnome.org>
8328 * class.cs (PropertyBase.CheckBase): Don't check the base class if
8329 this is an explicit interface implementation.
8331 2002-09-17 Martin Baulig <martin@gnome.org>
8333 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
8334 different `IndexerName' attributes.
8336 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
8337 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
8338 virtual CommonResolve().
8340 2002-09-16 Miguel de Icaza <miguel@ximian.com>
8342 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
8343 and convert that to the UnderlyingType.
8345 * statement.cs (Foreach.Resolve): Indexers are just like variables
8346 or PropertyAccesses.
8348 * cs-tokenizer.cs (consume_string): Track line numbers and columns
8349 inside quoted strings, we were not doing this before.
8351 2002-09-16 Martin Baulig <martin@gnome.org>
8353 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
8354 resolve it. This is needed for the definite assignment check of the
8355 instance expression, fixes bug #29846.
8356 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
8358 2002-09-16 Nick Drochak <ndrochak@gol.com>
8360 * parameter.cs: Fix compile error. Cannot reference static member
8361 from an instance object. Is this an mcs bug?
8363 2002-09-14 Martin Baulig <martin@gnome.org>
8365 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
8366 multiple times. Fixes bug #30295, added test-166.cs.
8368 2002-09-14 Martin Baulig <martin@gnome.org>
8370 * statement.cs (Block.Emit): Don't emit unreachable code.
8371 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
8373 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
8375 2002-09-14 Martin Baulig <martin@gnome.org>
8377 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
8380 2002-09-14 Martin Baulig <martin@gnome.org>
8382 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
8383 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
8384 be false on the ms runtime.
8386 2002-09-13 Martin Baulig <martin@gnome.org>
8388 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
8389 the CS0038 error message.
8391 2002-09-12 Miguel de Icaza <miguel@ximian.com>
8393 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
8394 constant inside, return it.
8396 2002-09-12 Martin Baulig <martin@gnome.org>
8398 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
8399 implicit conversion can be done between enum types.
8401 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
8402 check whether an implicit conversion to the current enum's UnderlyingType
8403 exists and report an error if not.
8405 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
8406 without debugging support.
8408 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
8409 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
8411 2002-09-12 Martin Baulig <martin@gnome.org>
8413 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
8415 * ecore.cs (IMemberExpr.DeclaringType): New property.
8416 (SimpleName.SimpleNameResolve): Check whether we're accessing a
8417 nonstatic member of an outer type (CS0038).
8419 2002-09-11 Miguel de Icaza <miguel@ximian.com>
8421 * driver.cs: Activate the using-error detector at warning level
8422 4 (at least for MS-compatible APIs).
8424 * namespace.cs (VerifyUsing): Small buglett fix.
8426 * pending.cs (PendingImplementation): pass the container pointer.
8428 * interface.cs (GetMethods): Allow for recursive definition. Long
8429 term, I would like to move every type to support recursive
8430 definitions, not the current ordering mechanism that we have right
8433 The situation is this: Attributes are handled before interfaces,
8434 so we can apply attributes to interfaces. But some attributes
8435 implement interfaces, we will now handle the simple cases
8436 (recursive definitions will just get an error).
8438 * parameter.cs: Only invalidate types at the end if we fail to
8441 2002-09-09 Martin Baulig <martin@gnome.org>
8443 * ecore.cs (PropertyExpr.Emit): Also check for
8444 TypeManager.system_int_array_get_length so this'll also work when
8445 compiling corlib. Fixes #30003.
8447 2002-09-09 Martin Baulig <martin@gnome.org>
8449 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
8450 and throw an exception if we can't get the type's size. Fixed #30040,
8453 2002-09-09 Martin Baulig <martin@gnome.org>
8455 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
8457 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
8458 context. Fixes bug #30027.
8460 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
8461 virtual functions. Fixes bug #30043, added test-164.cs.
8463 2002-09-08 Ravi Pratap <ravi@ximian.com>
8465 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
8467 2002-09-08 Nick Drochak <ndrochak@gol.com>
8469 * driver.cs: Use an object to get the windows codepage since it's not a
8472 2002-09-08 Miguel de Icaza <miguel@ximian.com>
8474 * statement.cs (For.Emit): for infinite loops (test == null)
8475 return whether there is a break inside, not always "true".
8477 * namespace.cs (UsingEntry): New struct to hold the name of the
8478 using definition, the location where it is defined, and whether it
8479 has been used in a successful type lookup.
8481 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
8486 2002-09-06 Ravi Pratap <ravi@ximian.com>
8488 * attribute.cs : Fix incorrect code which relied on catching
8489 a NullReferenceException to detect a null being passed in
8490 where an object was expected.
8492 2002-09-06 Miguel de Icaza <miguel@ximian.com>
8494 * statement.cs (Try): flag the catch variable as assigned
8496 * expression.cs (Cast): Simplified by using ResolveType instead of
8499 * statement.cs (Catch): Fix bug by using ResolveType.
8501 2002-09-06 Ravi Pratap <ravi@ximian.com>
8503 * expression.cs (BetterConversion): Special case for when we have
8504 a NullLiteral as the argument and we have to choose between string
8505 and object types - we choose string the way csc does.
8507 * attribute.cs (Attribute.Resolve): Catch the
8508 NullReferenceException and report error #182 since the Mono
8509 runtime no more has the bug and having this exception raised means
8510 we tried to select a constructor which takes an object and is
8513 2002-09-05 Ravi Pratap <ravi@ximian.com>
8515 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
8516 message (1502, 1503) when we can't locate a method after overload
8517 resolution. This is much more informative and closes the bug
8520 * interface.cs (PopulateMethod): Return if there are no argument
8521 types. Fixes a NullReferenceException bug.
8523 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
8524 expressions too. Previously we were checking only in one place for
8525 positional arguments leaving out named arguments.
8527 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
8528 type to the enum type is not allowed. Remove code corresponding to
8531 (ConvertNumericExplicit): Allow explicit conversions from
8532 the underlying type to enum type. This precisely follows the spec
8533 and closes a bug filed by Gonzalo.
8535 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8538 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
8540 2002-09-03 Miguel de Icaza <miguel@ximian.com>
8542 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
8543 it was important that we stored the right value after the
8544 reduction in `converted'.
8546 2002-09-04 Martin Baulig <martin@gnome.org>
8548 * location.cs (Location.SymbolDocument): Use full pathnames for the
8551 2002-08-30 Miguel de Icaza <miguel@ximian.com>
8553 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
8554 of the expression resolve mechanism, because that will catch the
8555 SimpleName error failures.
8557 (Conditional): If we can not resolve the
8558 expression, return, do not crash.
8560 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8563 (location): display token name instead of its number.
8565 2002-08-28 Martin Baulig <martin@gnome.org>
8567 * expression.cs (Binary.ResolveOperator): Don't silently return
8568 but return an error if an operator cannot be applied between two
8571 2002-08-28 Martin Baulig <martin@gnome.org>
8573 * class.cs (Constructor.Define): Set the permission attributes
8574 correctly instead of making all constructors public.
8576 2002-08-28 Martin Baulig <martin@gnome.org>
8578 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
8579 for private members before reporting a CS0103; if we find anything,
8582 2002-08-28 Martin Baulig <martin@gnome.org>
8584 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
8585 to check whether `closure_start_type == closure_invocation_type',
8586 we also need to check whether `m.DeclaringType == closure_invocation_type'
8587 before bypassing the permission checks. We might be accessing
8588 protected/private members from the base class.
8589 (TypeManager.RealMemberLookup): Only set private_ok if private
8590 members were requested via BindingFlags.NonPublic.
8592 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
8594 * expression.cs (MemberAccess.ResolveMemberAccess): Set
8595 MethodGroupExpr.IsExplicitImpl if appropriate.
8596 (Invocation.DoResolve): Don't report the CS0120 for explicit
8597 interface implementations.
8599 2002-08-27 Martin Baulig <martin@gnome.org>
8601 * expression.cs (Invocation.DoResolve): If this is a static
8602 method and we don't have an InstanceExpression, we must report
8605 2002-08-25 Martin Baulig <martin@gnome.org>
8607 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
8608 `==' between a valuetype and an object.
8610 2002-08-25 Miguel de Icaza <miguel@ximian.com>
8612 * ecore.cs (TypeExpr): Provide a ToString method.
8614 2002-08-24 Martin Baulig <martin@gnome.org>
8616 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
8617 now called proggie.dbg and it's a binary file.
8619 2002-08-23 Martin Baulig <martin@gnome.org>
8621 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
8623 2002-08-23 Martin Baulig <martin@gnome.org>
8625 * struct.cs (MyStructInfo.ctor): Make this work with empty
8626 structs; it's not allowed to use foreach() on null.
8628 2002-08-23 Martin Baulig <martin@gnome.org>
8630 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
8631 writer the full pathname of the generated assembly.
8633 2002-08-23 Martin Baulig <martin@gnome.org>
8635 * statements.cs (FlowBranching.UsageVector.MergeChildren):
8636 A `finally' block never returns or breaks; improved handling of
8639 2002-08-23 Martin Baulig <martin@gnome.org>
8641 * statement.cs (Throw.Resolve): Allow `throw null'.
8643 2002-08-23 Martin Baulig <martin@gnome.org>
8645 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
8646 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
8647 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
8648 MemberLookup would return a wrong event if this is an explicit
8649 interface implementation and the class has an event with the same
8652 2002-08-23 Martin Baulig <martin@gnome.org>
8654 * statement.cs (Block.AddChildVariableNames): New public method.
8655 (Block.AddChildVariableName): Likewise.
8656 (Block.IsVariableNameUsedInChildBlock): Likewise.
8657 (Block.AddVariable): Check whether a variable name has already
8658 been used in a child block.
8660 * cs-parser.jay (declare_local_variables): Mark all variable names
8661 from the current block as being used in a child block in the
8664 2002-08-23 Martin Baulig <martin@gnome.org>
8666 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
8667 find the symbol writer.
8669 * driver.cs: csc also allows the arguments to /define being
8670 separated by commas, not only by semicolons.
8672 2002-08-23 Martin Baulig <martin@gnome.org>
8674 * interface.cs (Interface.GetMembers): Added static check for events.
8676 2002-08-15 Martin Baulig <martin@gnome.org>
8678 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
8679 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
8681 * ecore.cs (Expression.MemberLookup): Added documentation and explained
8682 why the MethodData.EmitDestructor() change was necessary.
8684 2002-08-20 Martin Baulig <martin@gnome.org>
8686 * class.cs (TypeContainer.FindMembers): Added static check for events.
8688 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
8690 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
8691 use Type.GetEvents(), not Type.FindMembers().
8693 2002-08-20 Martin Baulig <martin@gnome.org>
8695 * decl.cs (MemberCache): Added a special method cache which will
8696 be used for method-only searched. This ensures that a method
8697 search will return a MethodInfo with the correct ReflectedType for
8700 2002-08-20 Martin Baulig <martin@gnome.org>
8702 * decl.cs (DeclSpace.FindMembers): Made this public.
8704 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8706 * delegate.cs: fixed build on windows.
8707 [FIXME: Filed as bug #29150: MCS must report these errors.]
8709 2002-08-19 Ravi Pratap <ravi@ximian.com>
8711 * ecore.cs (StandardConversionExists): Return a false
8712 if we are trying to convert the void type to anything else
8713 since that is not allowed.
8715 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
8716 we flag error 70 in the event an event is trying to be accessed
8717 directly from outside the declaring type.
8719 2002-08-20 Martin Baulig <martin@gnome.org>
8721 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
8722 MemberCache from typemanager.cs to decl.cs.
8724 2002-08-19 Martin Baulig <martin@gnome.org>
8726 * class.cs (TypeContainer): Implement IMemberContainer.
8727 (TypeContainer.DefineMembers): Create the MemberCache.
8728 (TypeContainer.FindMembers): Do better BindingFlags checking; only
8729 return public members if BindingFlags.Public was given, check
8730 whether members are static.
8732 2002-08-16 Martin Baulig <martin@gnome.org>
8734 * decl.cs (DeclSpace.Define): Splitted this in Define and
8735 DefineMembers. DefineMembers is called first and initializes the
8738 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
8739 DefineMembers() on all our DeclSpaces.
8741 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
8742 but call DefineMembers() on all nested interfaces. We call their
8743 Define() in our new Define() function.
8745 * interface.cs (Interface): Implement IMemberContainer.
8746 (Interface.Define): Moved all code except the attribute stuf to
8748 (Interface.DefineMembers): Initialize the member cache.
8750 * typemanager.cs (IMemberFinder): Removed this interface, we don't
8751 need this anymore since we can use MemberCache.FindMembers directly.
8753 2002-08-19 Martin Baulig <martin@gnome.org>
8755 * typemanager.cs (MemberCache): When creating the cache for an
8756 interface type, add all inherited members.
8757 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
8758 to `out bool used_cache' and documented it.
8759 (TypeManager.MemberLookup): If we already used the cache in the first
8760 iteration, we don't need to do the interfaces check.
8762 2002-08-19 Martin Baulig <martin@gnome.org>
8764 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
8765 here from IMemberFinder and don't implement this interface anymore.
8766 (DeclSpace.MemberCache): Moved here from IMemberFinder.
8768 * typemanager.cs (IMemberFinder): This interface is now only used by
8769 classes which actually support the member cache.
8770 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
8771 since we only put DeclSpaces into this Hashtable.
8772 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
8773 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
8775 2002-08-16 Martin Baulig <martin@gnome.org>
8777 * typemanager.cs (ICachingMemberFinder): Removed.
8778 (IMemberFinder.MemberCache): New property.
8779 (TypeManager.FindMembers): Merged this with RealFindMembers().
8780 This function will never be called from TypeManager.MemberLookup()
8781 so we can't use the cache here, just the IMemberFinder.
8782 (TypeManager.MemberLookup_FindMembers): Check whether the
8783 IMemberFinder has a MemberCache and call the cache's FindMembers
8785 (MemberCache): Rewrote larger parts of this yet another time and
8786 cleaned it up a bit.
8788 2002-08-15 Miguel de Icaza <miguel@ximian.com>
8790 * driver.cs (LoadArgs): Support quoting.
8792 (Usage): Show the CSC-like command line arguments.
8794 Improved a few error messages.
8796 2002-08-15 Martin Baulig <martin@gnome.org>
8798 * typemanager.cs (IMemberContainer.Type): New property.
8799 (IMemberContainer.IsInterface): New property.
8801 The following changes are conditional to BROKEN_RUNTIME, which is
8802 defined at the top of the file.
8804 * typemanager.cs (MemberCache.MemberCache): Don't add the base
8805 class'es members, but add all members from TypeHandle.ObjectType
8806 if we're an interface.
8807 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
8808 is the current type.
8809 (MemberCache.CacheEntry.Container): Removed this field.
8810 (TypeHandle.GetMembers): Include inherited members.
8812 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8814 * typemanager.cs: fixed compilation and added a comment on a field that
8817 2002-08-15 Martin Baulig <martin@gnome.org>
8819 * class.cs (ConstructorInitializer.Resolve): In the
8820 Expression.MemberLookup call, use the queried_type as
8823 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
8824 declared' attribute, it's always true.
8825 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
8826 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
8827 temporary wrapper for FindMembers which tells MemberLookup whether
8828 members from the base classes are included in the return value.
8829 This will go away soon.
8830 (TypeManager.MemberLookup): Use this temporary hack here; once the
8831 new MemberCache is completed, we don't need to do the DeclaredOnly
8832 looping here anymore since the MemberCache will take care of this.
8833 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
8834 (MemberCache): When creating the MemberCache for a class, get
8835 members from the current class and all its base classes.
8836 (MemberCache.CacheEntry.Container): New field. This is a
8837 temporary hack until the Mono runtime is fixed to distinguish
8838 between ReflectedType and DeclaringType. It allows us to use MCS
8839 with both the MS runtime and the unfixed Mono runtime without
8840 problems and without accecting performance.
8841 (MemberCache.SearchMembers): The DeclaredOnly looping from
8842 TypeManager.MemberLookup is now done here.
8844 2002-08-14 Martin Baulig <martin@gnome.org>
8846 * statement.cs (MyStructInfo.MyStructInfo): Don't call
8847 Type.GetFields on dynamic types but get the fields from the
8848 corresponding TypeContainer.
8849 (MyStructInfo.GetStructInfo): Added check for enum types.
8851 * typemanager.cs (MemberList.IsSynchronized): Implemented.
8852 (MemberList.SyncRoot): Implemented.
8853 (TypeManager.FilterWithClosure): No need to check permissions if
8854 closure_start_type == closure_invocation_type, don't crash if
8855 closure_invocation_type is null.
8857 2002-08-13 Martin Baulig <martin@gnome.org>
8859 Rewrote TypeContainer.FindMembers to use a member cache. This
8860 gives us a speed increase of about 35% for the self-hosting MCS
8861 build and of about 15-20% for the class libs (both on GNU/Linux).
8863 * report.cs (Timer): New class to get enhanced profiling. This
8864 whole class is "TIMER" conditional since it remarkably slows down
8867 * class.cs (MemberList): New class. This is an IList wrapper
8868 which we're now using instead of passing MemberInfo[]'s around to
8869 avoid copying this array unnecessarily.
8870 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
8871 (ICachingMemberFinder, IMemberContainer): New interface.
8872 (TypeManager.FilterWithClosure): If `criteria' is null, the name
8873 has already been checked, otherwise use it for the name comparision.
8874 (TypeManager.FindMembers): Renamed to RealMemberFinder and
8875 provided wrapper which tries to use ICachingMemberFinder.FindMembers
8876 if possible. Returns a MemberList, not a MemberInfo [].
8877 (TypeHandle): New class, implements IMemberContainer. We create
8878 one instance of this class per type, it contains a MemberCache
8879 which is used to do the member lookups.
8880 (MemberCache): New class. Each instance of this class contains
8881 all members of a type and a name-based hash table.
8882 (MemberCache.FindMembers): This is our new member lookup
8883 function. First, it looks up all members of the requested name in
8884 the hash table. Then, it walks this list and sorts out all
8885 applicable members and returns them.
8887 2002-08-13 Martin Baulig <martin@gnome.org>
8889 In addition to a nice code cleanup, this gives us a performance
8890 increase of about 1.4% on GNU/Linux - not much, but it's already
8891 half a second for the self-hosting MCS compilation.
8893 * typemanager.cs (IMemberFinder): New interface. It is used by
8894 TypeManager.FindMembers to call FindMembers on a TypeContainer,
8895 Enum, Delegate or Interface.
8896 (TypeManager.finder_to_member_finder): New PtrHashtable.
8897 (TypeManager.finder_to_container): Removed.
8898 (TypeManager.finder_to_delegate): Removed.
8899 (TypeManager.finder_to_interface): Removed.
8900 (TypeManager.finder_to_enum): Removed.
8902 * interface.cs (Interface): Implement IMemberFinder.
8904 * delegate.cs (Delegate): Implement IMemberFinder.
8906 * enum.cs (Enum): Implement IMemberFinder.
8908 * class.cs (TypeContainer): Implement IMemberFinder.
8910 2002-08-12 Martin Baulig <martin@gnome.org>
8912 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
8914 2002-08-12 Martin Baulig <martin@gnome.org>
8916 * ecore.cs (ITypeExpression): New interface for expressions which
8918 (TypeExpression): Renamed to TypeLookupExpression.
8919 (Expression.DoResolve): If we're doing a types-only lookup, the
8920 expression must implement the ITypeExpression interface and we
8921 call DoResolveType() on it.
8922 (SimpleName): Implement the new ITypeExpression interface.
8923 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
8924 hack, the situation that we're only looking up types can't happen
8925 anymore when this method is called. Moved the type lookup code to
8926 DoResolveType() and call it.
8927 (SimpleName.DoResolveType): This ITypeExpression interface method
8928 is now doing the types-only lookup.
8929 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
8930 (ResolveFlags): Added MaskExprClass.
8932 * expression.cs (MemberAccess): Implement the ITypeExpression
8934 (MemberAccess.DoResolve): Added support for a types-only lookup
8935 when we're called via ITypeExpression.DoResolveType().
8936 (ComposedCast): Implement the ITypeExpression interface.
8938 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
8939 Expression.Resolve() with ResolveFlags.Type instead.
8941 2002-08-12 Martin Baulig <martin@gnome.org>
8943 * interface.cs (Interface.Define): Apply attributes.
8945 * attribute.cs (Attribute.ApplyAttributes): Added support for
8946 interface attributes.
8948 2002-08-11 Martin Baulig <martin@gnome.org>
8950 * statement.cs (Block.Emit): Only check the "this" variable if we
8951 do not always throw an exception.
8953 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
8954 whether the property has a set accessor.
8956 2002-08-11 Martin Baulig <martin@gnome.org>
8958 Added control flow analysis support for structs.
8960 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
8961 with control flow analysis turned off.
8962 (IVariable): New interface.
8963 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
8964 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
8965 (FieldExpr.DoResolve): Resolve the instance expression with flow
8966 analysis turned off and do the definite assignment check after the
8967 resolving when we know what the expression will resolve to.
8969 * expression.cs (LocalVariableReference, ParameterReference):
8970 Implement the new IVariable interface, only call the flow analysis
8971 code if ec.DoFlowAnalysis is true.
8972 (This): Added constructor which takes a Block argument. Implement
8973 the new IVariable interface.
8974 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
8975 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
8976 This does the definite assignment checks for struct members.
8978 * class.cs (Constructor.Emit): If this is a non-static `struct'
8979 constructor which doesn't have any initializer, call
8980 Block.AddThisVariable() to tell the flow analysis code that all
8981 struct elements must be initialized before control returns from
8984 * statement.cs (MyStructInfo): New public class.
8985 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
8986 argument to this indexer. If non-zero, check an individual struct
8987 member, not the whole struct.
8988 (FlowBranching.CheckOutParameters): Check struct members.
8989 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
8990 overloaded versions of these methods which take an additional
8991 `int field_idx' argument to check struct members.
8992 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
8993 overloaded versions of these methods which take an additional
8994 `string field_name' argument to check struct member.s
8995 (VariableInfo): Implement the IVariable interface.
8996 (VariableInfo.StructInfo): New public property. Returns the
8997 MyStructInfo instance of the variable if it's a struct or null.
8998 (Block.AddThisVariable): New public method. This is called from
8999 Constructor.Emit() for non-static `struct' constructor which do
9000 not have any initializer. It creates a special variable for the
9001 "this" instance variable which will be checked by the flow
9002 analysis code to ensure that all of the struct's fields are
9003 initialized before control returns from the constructor.
9004 (UsageVector): Added support for struct members. If a
9005 variable/parameter is a struct with N members, we reserve a slot
9006 in the usage vector for each member. A struct is considered fully
9007 initialized if either the struct itself (slot 0) or all its
9008 members are initialized.
9010 2002-08-08 Martin Baulig <martin@gnome.org>
9012 * driver.cs (Driver.MainDriver): Only report an error CS5001
9013 if there were no compilation errors.
9015 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
9016 `UnsafeContext' property to determine whether the parent is in
9017 unsafe context rather than checking the parent's ModFlags:
9018 classes nested in an unsafe class are unsafe as well.
9020 2002-08-08 Martin Baulig <martin@gnome.org>
9022 * statement.cs (UsageVector.MergeChildren): Distinguish between
9023 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
9024 we return. Added test17() and test18() to test-154.cs.
9026 2002-08-08 Martin Baulig <martin@gnome.org>
9028 * typemanager.cs (TypeManager.FilterWithClosure): If we have
9029 Family access, make sure the invoking type isn't a subclass of the
9030 queried type (that'd be a CS1540).
9032 * ecore.cs (Expression.MemberLookup): Added overloaded version of
9033 this method which takes an additional `Type invocation_type'.
9035 * expression.cs (BaseAccess.DoResolve): Use the base type as
9036 invocation and query type.
9037 (MemberAccess.DoResolve): If the lookup failed and we're about to
9038 report a CS0122, try a lookup with the ec.ContainerType - if this
9039 succeeds, we must report a CS1540.
9041 2002-08-08 Martin Baulig <martin@gnome.org>
9043 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
9044 (MethodGroupExpr): Implement the IMemberExpr interface.
9046 * expression (MemberAccess.ResolveMemberAccess): No need to have
9047 any special code for MethodGroupExprs anymore, they're now
9050 2002-08-08 Martin Baulig <martin@gnome.org>
9052 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
9053 Family, FamANDAssem and FamORAssem permissions.
9054 (TypeManager.IsSubclassOrNestedChildOf): New public method.
9056 2002-08-08 Martin Baulig <martin@gnome.org>
9058 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
9059 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
9062 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
9064 * driver.cs: implemented /resource option to embed managed resources.
9066 2002-08-07 Martin Baulig <martin@gnome.org>
9068 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
9069 (FieldBase.HasFieldInitializer): New public property.
9070 (FieldBase.GetInitializerExpression): New public method. Resolves and
9071 returns the field initializer and makes sure it is only resolved once.
9072 (TypeContainer.EmitFieldInitializers): Call
9073 FieldBase.GetInitializerExpression to get the initializer, this ensures
9074 that it isn't resolved multiple times.
9076 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
9077 the resolving process (SimpleName/MemberLookup) that we're currently
9078 emitting a field initializer (which must not access any instance members,
9079 this is an error CS0236).
9081 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
9082 argument, if the `IsFieldInitializer' flag is set, we must report and
9083 error CS0236 and not an error CS0120.
9085 2002-08-07 Martin Baulig <martin@gnome.org>
9087 * ecore.cs (IMemberExpr): New public interface.
9088 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
9089 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
9090 if the expression is an IMemberExpr.
9092 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
9093 to be null, implicitly default to `this' if we're non-static in
9094 this case. Simplified the code a lot by using the new IMemberExpr
9095 interface. Also fixed bug #28176 here.
9097 2002-08-06 Martin Baulig <martin@gnome.org>
9099 * cs-parser.jay (SimpleLookup): Removed. We need to create
9100 ParameterReferences during semantic analysis so that we can do a
9101 type-only search when resolving Cast, TypeOf and SizeOf.
9102 (block): Pass the `current_local_parameters' to the Block's
9105 * class.cs (ConstructorInitializer): Added `Parameters parameters'
9106 argument to the constructor.
9107 (ConstructorInitializer.Resolve): Create a temporary implicit
9108 block with the parameters.
9110 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
9111 references here if we aren't doing a type-only search.
9113 * statement.cs (Block): Added constructor which takes a
9114 `Parameters parameters' argument.
9115 (Block.Parameters): New public property.
9117 * support.cs (InternalParameters.Parameters): Renamed `parameters'
9118 to `Parameters' and made it public readonly.
9120 2002-08-06 Martin Baulig <martin@gnome.org>
9122 * ecore.cs (Expression.Warning): Made this public as well.
9124 * report.cs (Report.Debug): Print the contents of collections.
9126 2002-08-06 Martin Baulig <martin@gnome.org>
9128 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
9129 used to tell Resolve() which kinds of expressions it may return.
9130 (Expression.Resolve): Added overloaded version of this method which
9131 takes a `ResolveFlags flags' argument. This can be used to tell
9132 Resolve() which kinds of expressions it may return. Reports a
9134 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
9135 ResolveFlags.SimpleName.
9136 (Expression.Error118): Added overloaded version of this method which
9137 takes a `ResolveFlags flags' argument. It uses the flags to determine
9138 which kinds of expressions are allowed.
9140 * expression.cs (Argument.ResolveMethodGroup): New public method.
9141 Resolves an argument, but allows a MethodGroup to be returned.
9142 This is used when invoking a delegate.
9144 * TODO: Updated a bit.
9146 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9148 Fixed compilation with csc.
9150 * ecore.cs: Expression.Error made public. Is this correct? Should
9151 Warning be made public too?
9153 * expression.cs: use ea.Location instead of ea.loc.
9154 [FIXME: Filed as bug #28607: MCS must report these errors.]
9156 2002-08-06 Martin Baulig <martin@gnome.org>
9158 * ecore.cs (Expression.loc): Moved the location here instead of
9159 duplicating it in all derived classes.
9160 (Expression.Location): New public property.
9161 (Expression.Error, Expression.Warning): Made them non-static and
9162 removed the location argument.
9163 (Expression.Warning): Added overloaded version which takes an
9164 `int level' argument.
9165 (Expression.Error118): Make this non-static and removed the
9166 expression and location arguments.
9167 (TypeExpr): Added location argument to the constructor.
9169 * expression.cs (StaticCallExpr): Added location argument to
9171 (Indirection, PointerArithmetic): Likewise.
9172 (CheckedExpr, UnCheckedExpr): Likewise.
9173 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
9174 (StringPtr): Likewise.
9177 2002-08-05 Martin Baulig <martin@gnome.org>
9179 * expression.cs (BaseAccess.DoResolve): Actually report errors.
9181 * assign.cs (Assign.DoResolve): Check whether the source
9182 expression is a value or variable.
9184 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
9185 while resolving the corresponding blocks.
9187 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
9188 an error, don't silently return null.
9190 * statement.cs (Block.AddVariable): Do the error reporting here
9191 and distinguish between CS0128 and CS0136.
9192 (Block.DoResolve): Report all unused labels (warning CS0164).
9193 (LabeledStatement): Pass the location to the constructor.
9194 (LabeledStatement.HasBeenReferenced): New property.
9195 (LabeledStatement.Resolve): Set it to true here.
9197 * statement.cs (Return.Emit): Return success even after reporting
9198 a type mismatch error (CS0126 or CS0127), this is what csc does and
9199 it avoids confusing the users with any consecutive errors.
9201 2002-08-05 Martin Baulig <martin@gnome.org>
9203 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
9205 * const.cs (Const.LookupConstantValue): Catch circular definitions.
9207 * expression.cs (MemberAccess.DoResolve): Silently return if an
9208 error has already been reported.
9210 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
9211 error has already been reported.
9213 2002-08-05 Martin Baulig <martin@gnome.org>
9215 * statement.cs (UsageVector): Only initialize the `parameters'
9216 vector if we actually have any "out" parameters.
9218 2002-08-05 Martin Baulig <martin@gnome.org>
9220 * expression.cs (Binary.ResolveOperator): When combining delegates,
9221 they must have the same type.
9223 2002-08-05 Martin Baulig <martin@gnome.org>
9225 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
9226 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
9227 work with the ms runtime and we also don't need it: if we're a
9228 PropertyBuilder and not in the `indexer_arguments' hash, then we
9229 are a property and not an indexer.
9231 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
9232 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
9233 since the latter one doesn't work with the ms runtime.
9235 2002-08-03 Martin Baulig <martin@gnome.org>
9237 Fixed bugs #27998 and #22735.
9239 * class.cs (Method.IsOperator): New public field.
9240 (Method.CheckBase): Report CS0111 if there's already a method
9241 with the same parameters in the current class. Report CS0508 when
9242 attempting to change the return type of an inherited method.
9243 (MethodData.Emit): Report CS0179 if a method doesn't have a body
9244 and it's not marked abstract or extern.
9245 (PropertyBase): New abstract base class for Property and Indexer.
9246 (PropertyBase.CheckBase): Moved here from Property and made it work
9248 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
9249 the same so we can reuse it there.
9250 (Property, Indexer): Derive from PropertyBase.
9251 (MethodSignature.inheritable_property_signature_filter): New delegate
9252 to find properties and indexers.
9254 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
9255 argument and improved error reporting.
9257 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
9258 EmptyReadOnlyParameters and made it a property.
9260 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
9261 version of this method which takes a `PropertyInfo indexer'.
9262 (TypeManager.RegisterIndexer): New method.
9264 * class.cs: Added myself as author of this file :-)
9266 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9268 * class.cs: fixed compilation on windoze.
9270 2002-08-03 Martin Baulig <martin@gnome.org>
9272 * interface.cs (Interface.GetInterfaceBases): Check whether all
9273 base interfaces are at least as accessible than the current one.
9275 * class.cs (TypeContainer.GetClassBases): Check whether base types
9276 are at least as accessible than the current type.
9277 (TypeContainer.AsAccessible): Implemented and made non-static.
9278 (MemberBase.CheckParameters): Report errors if the accessibility
9281 * delegate.cs (Delegate.Delegate): The default visibility is
9282 internal for top-level types and private for nested types.
9283 (Delegate.Define): Report errors if the accessibility checks fail.
9285 * enum.cs (Enum.Enum): The default visibility is internal for
9286 top-level types and private for nested types.
9287 (Enum.DefineType): Compute the correct visibility.
9289 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
9290 function which takes a `bool is_toplevel' instead of a TypeContainer.
9292 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
9295 2002-08-02 Martin Baulig <martin@gnome.org>
9297 * expression.cs (LocalVariableReferenc): Added constructor which
9298 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
9299 (LocalVariableReference.IsReadOnly): New property.
9300 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
9301 variable is readonly, use our own readonly flag to do this; you can
9302 use the new constructor to get a writable reference to a read-only
9305 * cs-parser.jay (foreach_statement, using_statement): Get a writable
9306 reference to the local variable.
9308 2002-08-01 Miguel de Icaza <miguel@ximian.com>
9310 * rootcontext.cs (ResolveCore): Also include System.Exception
9312 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
9313 we reach an EmptyStatement.
9315 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
9318 * expression.cs (Binary.ResolveOperator): Check error result in
9321 use brtrue/brfalse directly and avoid compares to null.
9323 2002-08-02 Martin Baulig <martin@gnome.org>
9325 * class.cs (TypeContainer.Define): Define all nested interfaces here.
9326 Fixes bug #28407, added test-155.cs.
9328 2002-08-01 Martin Baulig <martin@gnome.org>
9330 * class.cs (Event.EmitDefaultMethod): Make this work with static
9331 events. Fixes #28311, added verify-3.cs.
9333 2002-08-01 Martin Baulig <martin@gnome.org>
9335 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
9336 `is_disposable' fields.
9337 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
9338 `hm.is_disposable' if we're using the collection pattern.
9339 (Foreach.EmitCollectionForeach): Use the correct type for the
9340 enumerator's local variable, only emit the try/finally block if
9341 necessary (fixes #27713).
9343 2002-08-01 Martin Baulig <martin@gnome.org>
9345 * ecore.cs (Expression.report118): Renamed to Error118 and made
9348 * statement.cs (Throw.Resolve): Check whether the expression is of
9349 the correct type (CS0118) and whether the type derives from
9350 System.Exception (CS0155).
9351 (Catch.Resolve): New method. Do the type lookup here and check
9352 whether it derives from System.Exception (CS0155).
9353 (Catch.CatchType, Catch.IsGeneral): New public properties.
9355 * typemanager.cs (TypeManager.exception_type): Added.
9357 2002-07-31 Miguel de Icaza <miguel@ximian.com>
9359 * driver.cs: Updated About function.
9361 2002-07-31 Martin Baulig <martin@gnome.org>
9363 Implemented Control Flow Analysis.
9365 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
9366 (EmitContext.CurrentBranching): Added.
9367 (EmitContext.StartFlowBranching): Added.
9368 (EmitContext.EndFlowBranching): Added.
9369 (EmitContext.KillFlowBranching): Added.
9370 (EmitContext.IsVariableAssigned): Added.
9371 (EmitContext.SetVariableAssigned): Added.
9372 (EmitContext.IsParameterAssigned): Added.
9373 (EmitContext.SetParameterAssigned): Added.
9374 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
9375 Added control flow analysis stuff here.
9377 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
9378 resolve the expression as lvalue.
9379 (LocalVariableReference.DoResolve): Check whether the variable has
9380 already been assigned.
9381 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
9382 the parameter as assigned here.
9383 (ParameterReference.DoResolve): Check whether the parameter has already
9385 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
9386 expression as lvalue.
9388 * statement.cs (FlowBranching): New class for the flow analysis code.
9389 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
9390 (LabeledStatement.IsDefined): New public property.
9391 (LabeledStatement.AddUsageVector): New public method to tell flow
9392 analyis that the label may be reached via a forward jump.
9393 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
9395 (VariableInfo.Number): New public field. This is used by flow analysis
9396 to number all locals of a block.
9397 (Block.CountVariables): New public property. This is the number of
9398 local variables in this block (including the locals from all parent
9400 (Block.EmitMeta): Number all the variables.
9402 * statement.cs: Added flow analysis support to all classes.
9404 2002-07-31 Martin Baulig <martin@gnome.org>
9406 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
9407 To get debugging messages, compile mcs with /define:MCS_DEBUG and
9408 then use this argument.
9410 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
9412 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
9413 use this to specify /define options.
9415 2002-07-29 Martin Baulig <martin@gnome.org>
9417 * statement.cs (Fixed): Moved all code that does variable lookups
9418 and resolvings from Emit to Resolve.
9420 * statement.cs (For): Moved all code that does variable lookups
9421 and resolvings from Emit to Resolve.
9423 * statement.cs (Using): Moved all code that does variable lookups
9424 and resolvings from Emit to Resolve.
9426 2002-07-29 Martin Baulig <martin@gnome.org>
9428 * attribute.cs (Attribute.Resolve): Explicitly catch a
9429 System.NullReferenceException when creating the
9430 CustromAttributeBuilder and report a different warning message.
9432 2002-07-29 Martin Baulig <martin@gnome.org>
9434 * support.cs (ParameterData.ParameterName): Added method to
9435 get the name of a parameter.
9437 * typemanager.cs (TypeManager.IsValueType): New public method.
9439 2002-07-29 Martin Baulig <martin@gnome.org>
9441 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
9442 is a flag which specifies that it's either ref or out.
9443 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
9444 the out parameter to `out Parameter.Modifier mod', also set the
9445 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
9447 * support.cs (InternalParameters.ParameterModifier): Distinguish
9448 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
9449 Parameter.Modifier.ISBYREF flag if it's either ref or out.
9451 * expression.cs (Argument.GetParameterModifier): Distinguish
9452 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
9453 Parameter.Modifier.ISBYREF flag if it's either ref or out.
9455 2002-07-29 Martin Baulig <martin@gnome.org>
9457 * expression.cs (ParameterReference.ParameterReference): Added
9458 `Location loc' argument to the constructor.
9460 * cs-parser.jay: Pass location to ParameterReference.
9462 2002-07-28 Miguel de Icaza <miguel@ximian.com>
9464 * statement.cs (Try): Initialize the location.
9466 * cs-parser.jay: pass location to Try.
9468 * expression.cs (Unary.Reduce): Change the prototype to return
9469 whether a constant fold could be performed or not. The result is
9470 returned in an out parameters. In the case of Indirection and
9471 AddressOf, we want to perform the full tests.
9473 2002-07-26 Miguel de Icaza <miguel@ximian.com>
9475 * statement.cs (Statement.Emit): Flag dead code.
9477 2002-07-27 Andrew Birkett <andy@nobugs.org>
9479 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
9481 2002-07-27 Martin Baulig <martin@gnome.org>
9483 * class.cs (MethodData.Define): Put back call to
9484 TypeManager.AddMethod(), accidentally commented this out.
9486 * report.cs (Debug): New public method to print debugging information,
9487 this is `[Conditional ("DEBUG")]'.
9489 2002-07-26 Martin Baulig <martin@gnome.org>
9491 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
9492 (switch_statement): Push the current_block to the switch_stack and
9493 pop it again when we're done with the switch.
9494 (switch_section): The new block is a child of the current_block.
9495 Fixes bug #24007, added test-152.cs.
9497 2002-07-27 Martin Baulig <martin@gnome.org>
9499 * expression.cs (Invocation.EmitArguments): When calling a varargs
9500 function with only its fixed arguments, we need to pass an empty
9503 2002-07-27 Martin Baulig <martin@gnome.org>
9505 Mono 0.13 has been released.
9507 2002-07-25 Miguel de Icaza <miguel@ximian.com>
9509 * driver.cs: Rename --resource to --linkres, because that is what
9510 we do currently, we dont support --resource yet.
9512 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
9514 2002-07-25 Martin Baulig <martin@gnome.org>
9516 * class.cs (MethodData): New public class. This is a `method builder'
9517 class for a method or one accessor of a Property/Indexer/Event.
9518 (MethodData.GetMethodFlags): Moved here from MemberBase.
9519 (MethodData.ApplyAttributes): Likewise.
9520 (MethodData.ApplyObsoleteAttribute): Likewise.
9521 (MethodData.ApplyConditionalAttribute): Likewise.
9522 (MethodData.ApplyDllImportAttribute): Likewise.
9523 (MethodData.CheckAbstractAndExternal): Likewise.
9524 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
9525 (MethodData.Emit): Formerly known as Method.Emit().
9526 (MemberBase): Moved everything which was specific to a single
9527 accessor/method to MethodData.
9528 (Method): Create a new MethodData and call Define() and Emit() on it.
9529 (Property, Indexer, Event): Create a new MethodData objects for each
9530 accessor and call Define() and Emit() on them.
9532 2002-07-25 Martin Baulig <martin@gnome.org>
9534 Made MethodCore derive from MemberBase to reuse the code from there.
9535 MemberBase now also checks for attributes.
9537 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
9538 (MemberBase.GetMethodFlags): Moved here from class Method and marked
9540 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
9541 `CallingConventions cc' and `Attributes opt_attrs' arguments.
9542 (MemberBase.ApplyAttributes): New virtual method; applies the
9543 attributes to a method or accessor.
9544 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
9545 (MemberBase.ApplyConditionalAttribute): Likewise.
9546 (MemberBase.ApplyDllImportAttribute): Likewise.
9547 (MemberBase.CheckAbstractAndExternal): Likewise.
9548 (MethodCore.ParameterTypes): This is now a property instead of a
9549 method, it's initialized from DoDefineParameters().
9550 (MethodCore.ParameterInfo): Removed the set accessor.
9551 (MethodCore.DoDefineParameters): New protected virtual method to
9552 initialize ParameterTypes and ParameterInfo.
9553 (Method.GetReturnType): We can now simply return the MemberType.
9554 (Method.GetMethodFlags): Override the MemberBase version and add
9555 the conditional flags.
9556 (Method.CheckBase): Moved some code from Define() here, call
9557 DoDefineParameters() here.
9558 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
9559 here to avoid some larger code duplication.
9560 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
9561 ensure that abstract and external accessors don't declare a body.
9563 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
9564 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
9565 lookup in the attribute's parent classes, so we need to abort as soon
9566 as we found the first match.
9567 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
9568 the attribute has no arguments.
9570 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
9573 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9575 * cs-parser.jay: reverted previous patch.
9577 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9579 * cs-parser.jay: fixed bug #22119.
9581 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9583 * attribute.cs: fixed compilation. The error was:
9584 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
9585 be assigned to before control leaves the current method."
9586 [FIXME: Filed as bug #28186: MCS must report this error.]
9588 2002-07-25 Martin Baulig <martin@gnome.org>
9590 * attribute.cs (Attribute.Conditional_GetConditionName): New static
9591 method to pull the condition name ouf of a Conditional attribute.
9592 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
9593 the obsolete message and error flag out of an Obsolete attribute.
9595 * class.cs (Method.GetMethodFlags): New public method to get the
9596 TypeManager.MethodFlags for this method.
9597 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
9599 (Method.Define): Get and apply the Obsolete and Conditional attributes;
9600 if we're overriding a virtual function, set the new private variable
9601 `parent_method'; call the new TypeManager.AddMethod().
9603 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
9604 the MethodBuilder and the Method in a PtrHashtable.
9605 (TypeManager.builder_to_method): Added for this purpose.
9606 (TypeManager.MethodFlags): Added IsObsoleteError.
9607 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
9608 Obsolete and Conditional arguments in MethodBuilders. If we discover
9609 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
9610 the message from the attribute.
9612 2002-07-24 Martin Baulig <martin@gnome.org>
9614 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
9615 preprocessor directives, ensure that the argument to #define/#undef is
9616 exactly one identifier and that it's actually an identifier.
9618 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
9621 2002-07-24 Martin Baulig <martin@gnome.org>
9623 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
9624 initialize it to TypeManager.object_type in the constructor.
9625 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
9626 of the `hm.get_current' method if we're using the collection pattern.
9627 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
9628 for the explicit conversion to make it work when we're using the collection
9629 pattern and the `Current' property has a different return type than `object'.
9632 2002-07-24 Martin Baulig <martin@gnome.org>
9634 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
9635 does not match, but don't report any errors. This method is called in
9636 order for all methods in a MethodGroupExpr until a matching method is
9637 found, so we don't want to bail out if the first method doesn't match.
9638 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
9639 matches, report the 123. Fixes #28070.
9641 2002-07-24 Martin Baulig <martin@gnome.org>
9643 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
9644 TypeManager.TypeToCoreType() to the top of the method so the
9645 following equality checks will work. Fixes #28107.
9647 2002-07-24 Martin Baulig <martin@gnome.org>
9649 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
9650 operand is of type uint, and the other operand is of type sbyte,
9651 short or int, the operands are converted to type long." -
9652 Actually do what this comment already told us. Fixes bug #28106,
9655 2002-07-24 Martin Baulig <martin@gnome.org>
9657 * class.cs (MethodBase): New abstract class. This is now a base
9658 class for Property, Indexer and Event to avoid some code duplication
9659 in their Define() and DefineMethods() methods.
9660 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
9661 generic methods for Define() and DefineMethods().
9662 (FieldBase): Derive from MemberBase, not MemberCore.
9663 (Property): Derive from MemberBase, not MemberCore.
9664 (Property.DefineMethod): Moved all the code from this method to the
9665 new MethodBase.DefineAccessor(), just call it with appropriate
9667 (Property.Define): Call the new Property.DoDefine(), this does some
9668 sanity checks and we don't need to duplicate the code everywhere.
9669 (Event): Derive from MemberBase, not MemberCore.
9670 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
9671 accessors, this will also make them work with interface events.
9672 (Indexer): Derive from MemberBase, not MemberCore.
9673 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
9674 (Indexer.Define): Use the new MethodBase functions.
9676 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
9677 argument to the constructor.
9678 (Interface.FindMembers): Added support for interface events.
9679 (Interface.PopluateEvent): Implemented.
9681 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
9683 2002-07-22 Miguel de Icaza <miguel@ximian.com>
9685 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
9686 but this is required to check for a method name being the same as
9687 the containing class.
9691 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9693 * interface.cs: initialize variable.
9695 2002-07-23 Martin Baulig <martin@gnome.org>
9697 Implemented the IndexerName attribute in interfaces.
9699 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
9700 name if this is an explicit interface implementation.
9701 (Indexer.InterfaceIndexerName): New public variable. If we're
9702 implementing an interface indexer, this is the IndexerName in that
9703 interface. Otherwise, it's the IndexerName.
9704 (Indexer.DefineMethod): If we're implementing interface indexer,
9705 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
9706 and Pending.ImplementIndexer methods.
9707 (Indexer.Define): Also define the PropertyBuilder if we're
9708 implementing an interface indexer and this is neither an explicit
9709 interface implementation nor do the IndexerName match the one in
9712 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
9713 If a method is defined here, then we always need to create a proxy
9714 for it. This is used when implementing interface indexers.
9715 (Pending.IsInterfaceIndexer): New public method.
9716 (Pending.ImplementIndexer): New public method.
9717 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
9718 This is used when implementing interface indexers to define a proxy
9720 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
9721 define a proxy if necessary.
9723 * interface.cs (Interface.IndexerName): New public variable.
9724 (Interface.PopulateIndexer): Set the IndexerName.
9725 (Interface.DefineIndexers): New private method. Populate all the
9726 indexers and make sure their IndexerNames match.
9728 * typemanager.cs (IndexerPropertyName): Added support for interface
9731 2002-07-22 Martin Baulig <martin@gnome.org>
9733 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
9734 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
9735 ret if HasReturnLabel.
9736 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
9739 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
9740 and set the ec.LoopBeginTryCatchLevel.
9741 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
9742 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
9743 the current ec.TryCatchLevel, the branch goes out of an exception
9744 block. In this case, we need to use Leave and not Br.
9746 2002-07-22 Martin Baulig <martin@gnome.org>
9748 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
9749 block unless the block does not always return or it is contained in
9750 another try { ... } catch { ... } block. Fixes bug #26506.
9751 Added verify-1.cs to the test suite.
9753 2002-07-22 Martin Baulig <martin@gnome.org>
9755 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
9756 then we do not always return. Fixes bug #24985.
9758 2002-07-22 Martin Baulig <martin@gnome.org>
9760 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
9761 lookup on a per-class level; ie. walk up the class hierarchy until we
9762 found at least one applicable method, then choose the best among them.
9763 Fixes bug #24463 and test-29.cs.
9765 2002-07-22 Martin Baulig <martin@gnome.org>
9767 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
9768 return types of the methods. The return type is not part of the
9769 signature and we must not check it to make the `new' modifier work.
9770 Fixes bug #27999, also added test-147.cs.
9771 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
9773 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
9774 on the method's return type.
9776 2002-07-21 Martin Baulig <martin@gnome.org>
9778 * assign.cs: Make this work if the rightmost source is a constant and
9779 we need to do an implicit type conversion. Also adding a few more tests
9780 to test-38.cs which should have caught this.
9782 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
9783 target in the makefile for this. The makefile.gnu is primarily intended
9784 for end-users who don't want to debug the compiler.
9786 2002-07-21 Martin Baulig <martin@gnome.org>
9788 * assign.cs: Improved the Assign class so it can now handle embedded
9789 assignments (X = Y = Z = something). As a side-effect this'll now also
9790 consume less local variables. test-38.cs now passes with MCS, added
9791 a few new test cases to that test.
9793 2002-07-20 Martin Baulig <martin@gnome.org>
9795 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
9796 instructions. Fixes bug #27977, also added test-146.cs.
9798 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9800 * cs-tokenizer.cs: fixed getHex ().
9802 2002-07-19 Martin Baulig <martin@gnome.org>
9804 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
9805 not Type.GetType() to lookup the array type. This is needed when
9806 we're constructing an array of a user-defined type.
9807 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
9808 single-dimensional arrays, but also for single-dimensial arrays of
9811 2002-07-19 Martin Baulig <martin@gnome.org>
9813 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
9814 this function is called, it's not allowed to share LocalBuilders
9817 2002-07-19 Martin Baulig <martin@gnome.org>
9819 * expression.cs (Argument.Resolve): Report an error 118 when trying
9820 to pass a type as argument.
9822 2002-07-18 Martin Baulig <martin@gnome.org>
9824 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
9825 Conv_R_Un for the signed `long' type.
9827 2002-07-15 Miguel de Icaza <miguel@ximian.com>
9829 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
9830 `expr' for the temporary result, as that will fail if we do
9831 multiple resolves on the same expression.
9833 2002-07-05 Miguel de Icaza <miguel@ximian.com>
9835 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
9836 ec.TypeContainer for looking up aliases.
9838 * class.cs (TypeContainer): Remove LookupAlias from here.
9840 * decl.cs (DeclSpace); Move here.
9842 2002-07-01 Miguel de Icaza <miguel@ximian.com>
9844 * class.cs (FindMembers): Only call filter if the constructor
9845 bulider is not null.
9847 Also handle delegates in `NestedTypes' now. Now we will perform
9848 type lookups using the standard resolution process. This also
9851 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
9852 This uses Expressions (the limited kind that can be parsed by the
9853 tree) instead of strings.
9855 * expression.cs (ComposedCast.ToString): Implement, used to flag
9856 errors since now we have to render expressions.
9858 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
9861 * ecore.cs (SimpleName.ToString): ditto.
9863 * cs-parser.jay: Instead of using strings to assemble types, use
9864 Expressions to assemble the type (using SimpleName, ComposedCast,
9865 MemberAccess). This should fix the type lookups in declarations,
9866 because we were using a different code path for this.
9868 * statement.cs (Block.Resolve): Continue processing statements
9869 even when there is an error.
9871 2002-07-17 Miguel de Icaza <miguel@ximian.com>
9873 * class.cs (Event.Define): Also remove the `remove' method from
9874 the list of pending items.
9876 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
9877 generate more compact code.
9879 2002-07-17 Martin Baulig <martin@gnome.org>
9881 * const.cs (Const.LookupConstantValue): Add support for constant
9882 `unchecked' and `checked' expressions.
9883 Also adding test case test-140.cs for this.
9885 2002-07-17 Martin Baulig <martin@gnome.org>
9887 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
9888 check whether mi.ReturnType implements the IEnumerator interface; the
9889 `==' and the IsAssignableFrom() will fail in this situation.
9891 2002-07-16 Ravi Pratap <ravi@ximian.com>
9893 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
9896 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9898 * expression.cs: fixed bug #27811.
9900 2002-07-14 Miguel de Icaza <miguel@ximian.com>
9902 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
9903 Molaro: when we are a ref, the value already contains a pointer
9904 value, do not take the address of it.
9906 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
9907 * removed mb-parser.jay and mb-tokenizer.cs
9909 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
9911 * expression.cs: check against the building corlib void type.
9913 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
9915 * ecore.cs: fix for valuetype static readonly fields: when
9916 initializing them, we need their address, not the address of a copy.
9918 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
9920 * typemanager.cs: register also enum_type in corlib.
9922 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
9924 * class.cs: allow calling this (but not base) initializers in structs.
9926 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
9928 * ecore.cs: make sure we compare against the building base types
9931 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
9933 * typemanager.cs: fix TypeToCoreType() to handle void and object
9934 (corlib gets no more typerefs after this change).
9936 2002-07-12 Miguel de Icaza <miguel@ximian.com>
9938 * expression.cs (ArrayCreation.EmitArrayArguments): use
9939 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
9941 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
9942 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
9943 array indexes, the runtime actually forbids them.
9945 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
9946 for array arguments here.
9948 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
9949 instead of the default for ValueTypes.
9951 (New.DoEmit): Use IsValueType instead of
9952 IsSubclassOf (value_type)
9953 (New.DoResolve): ditto.
9954 (Invocation.EmitCall): ditto.
9956 * assign.cs (Assign): ditto.
9958 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
9959 Statements *are* currently doing part of their resolution during
9962 Expressions do always resolve during resolve, but statements are
9963 only required to propagate resolution to their children.
9965 2002-07-11 Miguel de Icaza <miguel@ximian.com>
9967 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
9969 (LoadAssembly): Do not add the dll if it is already specified
9971 (MainDriver): Add the System directory to the link path at the end,
9972 after all the other -L arguments.
9974 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
9975 wrong opcode for loading bytes and bools (ldelem.i1 instead of
9976 ldelem.u1) and using the opposite for sbytes.
9978 This fixes Digger, and we can finally run it.
9980 * driver.cs (UnixParseOption): Move the option parsing here.
9981 (CSCParseOption): Implement CSC-like parsing of options.
9983 We now support both modes of operation, the old Unix way, and the
9984 new CSC-like way. This should help those who wanted to make cross
9987 The only thing broken is that /r:, /reference: and /lib: are not
9988 implemented, because I want to make those have the same semantics
9989 as the CSC compiler has, and kill once and for all the confussion
9990 around this. Will be doing this tomorrow.
9992 * statement.cs (Unsafe.Resolve): The state is checked during
9993 resolve, not emit, so we have to set the flags for IsUnsfe here.
9995 2002-07-10 Miguel de Icaza <miguel@ximian.com>
9997 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
9998 not catch the Error_ObjectRefRequired in SimpleName (as it is
9999 possible to have a class/instance variable name that later gets
10000 deambiguated), we have to check this here.
10002 2002-07-10 Ravi Pratap <ravi@ximian.com>
10004 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
10005 make static and put into Expression.
10007 (Event.Define): Register the private field of the event with the
10008 TypeManager so that GetFieldFromEvent can get at it.
10010 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
10011 keep track of the private field associated with an event which
10014 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
10017 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
10019 2002-07-10 Miguel de Icaza <miguel@ximian.com>
10021 * expression.cs (Binary.EmitBranchable): this routine emits the
10022 Binary expression in a branchable context. This basically means:
10023 we need to branch somewhere, not just get the value on the stack.
10025 This works together with Statement.EmitBoolExpression.
10027 * statement.cs (Statement.EmitBoolExpression): Use
10030 2002-07-09 Miguel de Icaza <miguel@ximian.com>
10032 * statement.cs (For): Reduce the number of jumps in loops.
10034 (For): Implement loop inversion for the For statement.
10036 (Break): We can be breaking out of a Try/Catch controlled section
10037 (foreach might have an implicit try/catch clause), so we need to
10038 use Leave instead of Br.
10040 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
10041 now). If the instace expression supports IMemoryLocation, we use
10042 the AddressOf method from the IMemoryLocation to extract the
10043 address instead of emitting the instance.
10045 This showed up with `This', as we were emitting the instance
10046 always (Emit) instead of the Address of This. Particularly
10047 interesting when This is a value type, as we dont want the Emit
10048 effect (which was to load the object).
10050 2002-07-08 Miguel de Icaza <miguel@ximian.com>
10052 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
10054 * statement.cs (Checked): Set the CheckedState during the resolve
10055 process too, as the ConvCast operations track the checked state on
10056 the resolve process, and not emit.
10058 * cs-parser.jay (namespace_member_declaration): Flag that we have
10059 found a declaration when we do. This is used to flag error 1529
10061 * driver.cs: Report ok when we display the help only.
10063 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
10065 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
10067 2002-07-04 Miguel de Icaza <miguel@ximian.com>
10069 * cs-tokenizer.cs (define): We also have to track locally the
10070 defines. AllDefines is just used for the Conditional Attribute,
10071 but we also need the local defines for the current source code.
10073 2002-07-03 Miguel de Icaza <miguel@ximian.com>
10075 * statement.cs (While, For, Do): These loops can exit through a
10076 Break statement, use this information to tell whether the
10077 statement is the last piece of code.
10079 (Break): Flag that we break.
10081 * codegen.cs (EmitContexts): New `Breaks' state variable.
10083 2002-07-03 Martin Baulig <martin@gnome.org>
10085 * class.cs (TypeContainer.MethodModifiersValid): Allow override
10086 modifiers in method declarations in structs. Otherwise, you won't
10087 be able to override things like Object.Equals().
10089 2002-07-02 Miguel de Icaza <miguel@ximian.com>
10091 * class.cs (Method, Property, Indexer): Do not allow the public
10092 modifier to be used in explicit interface implementations.
10094 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
10095 override modifiers in method declarations in structs
10097 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
10099 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
10100 integer or real overflow, report an error
10102 2002-07-02 Martin Baulig <martin@gnome.org>
10104 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
10105 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
10106 to tell the runtime about our newly created System.Object and
10107 System.ValueType types.
10109 2002-07-02 Miguel de Icaza <miguel@ximian.com>
10111 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
10112 struct instead of Ldarg/Starg.
10114 2002-07-02 Martin Baulig <martin@gnome.org>
10116 * expression.cs (Indirection.Indirection): Call
10117 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
10119 2002-07-02 Martin Baulig <martin@gnome.org>
10121 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
10122 ValueType, call TypeManager.TypeToCoreType() on it.
10123 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
10124 the OpCodes.Newarr argument.
10126 2002-07-02 Martin Baulig <martin@gnome.org>
10128 * expression.cs (Invocation.EmitCall): When compiling corlib,
10129 replace all calls to the system's System.Array type to calls to
10130 the newly created one.
10132 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
10133 System.Array methods.
10134 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
10135 from the system's System.Array type which must be replaced.
10137 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
10139 * typemanager.cs: load unverifiable_code_ctor so we can build
10140 corlib using the correct type. Avoid using GetTypeCode() with
10142 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
10143 TypeManager.object_type to allow building corlib.
10145 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
10147 * ecore.cs: handle System.Enum separately in LoadFromPtr().
10149 2002-07-01 Martin Baulig <martin@gnome.org>
10151 * class.cs: Make the last change actually work, we need to check
10152 whether `ifaces != null' to avoid a crash.
10154 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
10156 * class.cs: when we build structs without fields that implement
10157 interfaces, we need to add the interfaces separately, since there is
10158 no API to both set the size and add the interfaces at type creation
10161 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
10163 * expression.cs: the dimension arguments to the array constructors
10164 need to be converted if they are a long.
10166 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
10168 * class.cs: don't emit ldarg.0 if there is no parent constructor
10169 (fixes showstopper for corlib).
10171 2002-06-29 Martin Baulig <martin@gnome.org>
10173 MCS now compiles corlib on GNU/Linux :-)
10175 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
10176 ie. check for MethodImplOptions.InternalCall.
10178 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
10179 and TypeManager.attribute_type are null, so we must explicitly check
10180 whether parent is not null to find out whether it's an attribute type.
10181 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
10182 and SetBuilder, not only if the property is neither abstract nor external.
10183 This is necessary to set the MethodImplOptions on the accessor methods.
10184 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
10185 SetBuilder, see Property.Emit().
10187 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
10188 populate "System.Object", "System.ValueType" and "System.Attribute" since
10189 they've already been populated from BootCorlib_PopulateCoreTypes().
10191 2002-06-29 Martin Baulig <martin@gnome.org>
10193 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
10194 is the NullLiteral, we also need to make sure that target_type is not
10197 2002-06-29 Martin Baulig <martin@gnome.org>
10199 * rootcontext.cs (RootContext.ResolveCore): We must initialize
10200 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
10201 before calling BootstrapCorlib_ResolveDelegate ().
10203 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10205 * statement.cs: fixed build-breaker. All tests passed ok.
10207 2002-06-27 Martin Baulig <martin@gnome.org>
10209 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
10210 for System.Decimal when compiling corlib.
10212 2002-06-27 Martin Baulig <martin@gnome.org>
10214 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
10215 switch blocks which contain nothing but a default clause.
10217 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
10219 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
10221 2002-06-27 Martin Baulig <martin@gnome.org>
10223 * ecore.cs (PropertyExpr.PropertyExpr): Call
10224 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
10226 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
10227 is already a TypeBuilder.
10229 2002-06-27 Martin Baulig <martin@gnome.org>
10231 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
10232 `target_type == TypeManager.array_type', not IsAssignableFrom() in
10233 the "from an array-type to System.Array" case. This makes it work
10234 when compiling corlib.
10236 2002-06-27 Martin Baulig <martin@gnome.org>
10238 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
10239 non-static PropertyExpr, set its InstanceExpression. This makes
10240 the `ICollection.Count' property work in System/Array.cs.
10242 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
10244 * driver.cs: Made error handling more consistent. Errors now
10245 tracked by Report class, so many methods which used to return int
10246 now return void. Main() now prints success/failure and
10247 errors/warnings message.
10249 Renamed '--probe' compiler argument to '--expect-error'. Removed
10250 the magic number return values (123 and 124). Now, if the
10251 expected error occurs, the compiler exits with success (exit value
10252 0). If the compilation completes without seeing that particular
10253 error, the compiler exits with failure (exit value 1). The
10254 makefile in mcs/errors has been changed to handle the new behaviour.
10256 * report.cs: Made 'expected error' number a property and renamed
10257 it from 'Probe' to 'ExpectedError'.
10259 * genericparser.cs: Removed error handling support, since it is
10260 now all done by Report class.
10262 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
10263 class, so parse() no longer returns an int.
10265 * namespace.cs: Use Report.Error instead of GenericParser.error
10267 2002-06-22 Miguel de Icaza <miguel@ximian.com>
10269 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
10270 TypeContainer.AddOperator): At the front of the list put the
10271 explicit implementations, so they get resolved/defined first.
10273 2002-06-21 Miguel de Icaza <miguel@ximian.com>
10275 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
10276 interface type is implemented by this TypeContainer. Used during
10277 explicit interface implementation.
10279 (Property.Define, Indexer.Define, Method.Define): Validate that
10280 the given interface in the explicit implementation is one of the
10281 base classes for the containing type.
10283 Also if we are explicitly implementing an interface, but there is
10284 no match in the pending implementation table, report an error.
10286 (Property.Define): Only define the property if we are
10287 not explicitly implementing a property from an interface. Use the
10288 correct name also for those properties (the same CSC uses,
10289 although that is really not needed).
10291 (Property.Emit): Do not emit attributes for explicitly implemented
10292 properties, as there is no TypeBuilder.
10294 (Indexer.Emit): ditto.
10296 Hiding then means that we do not really *implement* a pending
10297 implementation, which makes code fail.
10299 2002-06-22 Martin Baulig <martin@gnome.org>
10301 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
10302 the return value of Object.GetType(). [FIXME: we need to do this whenever
10303 we get a type back from the reflection library].
10305 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
10307 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
10309 2002-06-20 Miguel de Icaza <miguel@ximian.com>
10311 * attribute.cs: Return null if we can not look up the type.
10313 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
10314 the interface types found.
10316 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
10317 interface types found.
10319 * typemanager.cs (GetInterfaces): Make this routine returns alll
10320 the interfaces and work around the lame differences between
10321 System.Type and System.Reflection.Emit.TypeBuilder in the results
10322 result for GetInterfaces.
10324 (ExpandInterfaces): Given an array of interface types, expand and
10325 eliminate repeated ocurrences of an interface. This expands in
10326 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
10329 2002-06-21 Martin Baulig <martin@gnome.org>
10331 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
10334 2002-06-21 Martin Baulig <martin@gnome.org>
10336 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
10337 and called with one of the core types, return the corresponding typebuilder for
10340 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
10343 2002-06-21 Martin Baulig <martin@gnome.org>
10345 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
10346 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
10347 (Expression.ConvertReferenceExplicit): Likewise.
10349 * expression.cs (ElementAccess.DoResolve): Likewise.
10350 (ElementAccess.DoResolveLValue): Likewise.
10352 2002-06-10 Martin Baulig <martin@gnome.org>
10354 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
10355 add the "value" parameter to the parameter list.
10357 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
10360 2002-06-19 Miguel de Icaza <miguel@ximian.com>
10362 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
10363 the argument to an int, uint, long or ulong, per the spec. Also
10364 catch negative constants in array creation.
10366 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
10368 * class.cs: do not allow the same interface to appear twice in
10369 the definition list.
10371 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
10373 * ecore.cs: don't use ldlen with System.Array.
10375 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
10377 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
10379 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
10381 * modifiers.cs: produce correct field attributes for protected
10382 internal. Easy fix so miguel can work on ther harder stuff:-)
10384 2002-06-18 Miguel de Icaza <miguel@ximian.com>
10386 * pending.cs: New file. Move the code from class.cs here.
10387 Support clearning the pending flag for all methods (when not doing
10388 explicit interface implementation).
10390 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
10392 * rootcontext.cs: added a couple more types needed to bootstrap.
10394 2002-06-17 Miguel de Icaza <miguel@ximian.com>
10396 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
10397 constructor in the type, instead of any constructor in the type
10398 hierarchy. Thanks to Paolo for finding this bug (it showed up as
10399 a bug in the Mono runtime when applying the params attribute).
10401 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
10402 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
10404 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
10406 * expression.cs (Unary.ResolveOperator): Use TypeManager
10407 to resolve the type.
10409 2002-06-13 Ravi Pratap <ravi@ximian.com>
10411 * cs-parser.jay (enum_member_declaration): Pass in the attributes
10414 * enum.cs (AddEnumMember): Add support to store the attributes associated
10415 with each member too.
10417 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
10418 field builders too - this takes care of the enum member case.
10420 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
10422 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
10423 address-of operator on both value types and pointers.
10425 2002-06-10 Martin Baulig <martin@gnome.org>
10427 * interface.cs (Interface.PopulateIndexer): Add the indexer's
10428 PropertyBuilder to the `property_builders' list.
10430 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
10431 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
10432 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
10433 find any indexers which are inherited from an interface.
10435 2002-06-09 Martin Baulig <martin@gnome.org>
10437 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
10438 the same type as the constant if necessary. There's also a test-130.cs
10441 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
10443 * typemanager.cs (TypeManager.ChangeType): Previously known as
10444 Enum.ChangeEnumType().
10446 2002-06-09 Martin Baulig <martin@gnome.org>
10448 * expression.cs (Cast.TryReduce): Added support for consts.
10450 2002-06-08 Ravi Pratap <ravi@ximian.com>
10452 * class.cs (Accessor): Hold attributes information so we can pass
10455 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
10456 Modify to pass in attributes attached to the methods.
10458 (add_accessor_declaration, remove_accessor_declaration): Ditto.
10460 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
10461 to handle the Accessor kind :-)
10463 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
10465 2002-06-08 Martin Baulig <martin@gnome.org>
10467 * expression.cs (Unary.TryReduceNegative): Added support for
10470 2002-06-08 Martin Baulig <martin@gnome.org>
10472 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
10473 name can't be found in the `defined_names' - the caller will do a
10474 MemberLookup in this case and thus find methods in System.Enum
10475 such as Enum.IsDefined().
10477 2002-06-08 Martin Baulig <martin@gnome.org>
10479 * enum.cs (Enum.ChangeEnumType): This is a custom version of
10480 Convert.ChangeType() which works with TypeBuilder created types.
10481 (Enum.LookupEnumValue, Enum.Define): Use it here.
10483 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
10484 `TypeBuilder.BaseType != null' check.
10485 (TypeContainer.FindMembers): Only lookup parent members if we
10486 actually have a parent.
10487 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
10488 (ConstructorInitializer.Resolve): Likewise.
10490 * interface.cs (Interface.FindMembers): Added
10491 `TypeBuilder.BaseType != null' check.
10493 * rootcontext.cs (RootContext.ResolveCore): Added
10494 "System.Runtime.CompilerServices.IndexerNameAttribute" to
10495 classes_second_stage.
10497 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
10498 debug_type and trace_type when compiling with --nostdlib.
10500 2002-06-07 Martin Baulig <martin@gnome.org>
10502 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
10503 (AddField): Set it to true when adding a non-static field.
10504 (DefineType): Use `have_nonstatic_fields' to find out whether we
10505 have non-static fields, not `Fields != null'.
10507 2002-06-02 Miguel de Icaza <miguel@ximian.com>
10509 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
10510 dereferencing a null on the static-field code path)
10512 2002-05-30 Martin Baulig <martin@gnome.org>
10514 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
10515 to take command line arguments. Use reflection to call the new
10516 custom `Initialize' function on the symbol writer and pass it the
10517 command line arguments.
10519 * driver.cs (--debug-args): New command line argument to pass command
10520 line arguments to the symbol writer.
10522 2002-05-28 Miguel de Icaza <miguel@ximian.com>
10524 * assign.cs (DoResolve): Forgot to do the implicit conversion to
10525 the target type for indexers and properties. Thanks to Joe for
10528 2002-05-27 Miguel de Icaza <miguel@ximian.com>
10530 * typemanager.cs (MethodFlags): returns the method flags
10531 (Obsolete/ShouldIgnore) that control warning emission and whether
10532 the invocation should be made, or ignored.
10534 * expression.cs (Invocation.Emit): Remove previous hack, we should
10535 not do this on matching a base type, we should do this based on an attribute
10537 Only emit calls to System.Diagnostics.Debug and
10538 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
10539 on the command line.
10541 * rootcontext.cs: Global settings for tracing and debugging.
10543 * cs-tokenizer.cs (define): New utility function to track
10544 defines. Set the global settings for TRACE and DEBUG if found.
10546 2002-05-25 Ravi Pratap <ravi@ximian.com>
10548 * interface.cs (Populate*): Pass in the TypeContainer as well as
10549 the DeclSpace as parameters so that we can create EmitContexts and
10550 then use that to apply attributes etc.
10552 (PopulateMethod, PopulateEvent, PopulateProperty)
10553 (PopulateIndexer): Apply attributes everywhere.
10555 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
10558 (ApplyAttributes): Update accordingly.
10560 We now apply interface attributes for all members too.
10562 2002-05-26 Miguel de Icaza <miguel@ximian.com>
10564 * class.cs (Indexer.Define); Correctly check if we are explicit
10565 implementation (instead of checking the Name for a ".", we
10566 directly look up if the InterfaceType was specified).
10568 Delay the creation of the PropertyBuilder.
10570 Only create the PropertyBuilder if we are not an explicit
10571 interface implementation. This means that explicit interface
10572 implementation members do not participate in regular function
10573 lookups, and hence fixes another major ambiguity problem in
10574 overload resolution (that was the visible effect).
10576 (DefineMethod): Return whether we are doing an interface
10579 * typemanager.cs: Temporary hack until we get attributes in
10580 interfaces (Ravi is working on that) and we get IndexerName
10581 support in interfaces.
10583 * interface.cs: Register the indexers as properties.
10585 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
10586 warning, I have verified that this is a bug in the .NET runtime
10587 (JavaScript suffers of the same problem).
10589 * typemanager.cs (MemberLookup): When looking up members for
10590 interfaces, the parent of an interface is the implicit
10591 System.Object (so we succeed in searches of Object methods in an
10592 interface method invocation. Example: IEnumerable x; x.ToString
10595 2002-05-25 Miguel de Icaza <miguel@ximian.com>
10597 * class.cs (Event): Events should also register if they do
10598 implement the methods that an interface requires.
10600 * typemanager.cs (MemberLookup); use the new GetInterfaces
10603 (GetInterfaces): The code used to lookup interfaces for a type is
10604 used in more than one place, factor it here.
10606 * driver.cs: Track the errors at the bottom of the file, we kept
10609 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
10610 instance if the method we are calling is static!
10612 2002-05-24 Miguel de Icaza <miguel@ximian.com>
10614 * attribute.cs (ApplyAttributes): Make this function filter out
10615 the IndexerName attribute (as that attribute in reality is never
10616 applied) and return the string constant for the IndexerName
10619 * class.cs (TypeContainer.Emit): Validate that all the indexers
10620 have the same IndexerName attribute, and if so, set the
10621 DefaultName attribute on the class.
10623 * typemanager.cs: The return value might contain other stuff (not
10624 only methods). For instance, consider a method with an "Item"
10625 property and an Item method.
10627 * class.cs: If there is a problem with the parameter types,
10630 2002-05-24 Ravi Pratap <ravi@ximian.com>
10632 * ecore.cs (ImplicitConversionExists): Wrapper function which also
10633 looks at user defined conversion after making a call to
10634 StandardConversionExists - we need this for overload resolution.
10636 * expression.cs : Update accordingly the various method calls.
10638 This fixes 2 bugs filed against implicit user defined conversions
10640 2002-05-22 Miguel de Icaza <miguel@ximian.com>
10642 * statement.cs: Track the result of the assignment.
10644 2002-05-21 Miguel de Icaza <miguel@ximian.com>
10646 * expression.cs (MemberAccess): Improved error reporting for
10647 inaccessible members.
10649 2002-05-22 Martin Baulig <martin@gnome.org>
10651 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
10652 itself with debugging support.
10654 2002-05-22 Martin Baulig <martin@gnome.org>
10656 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
10657 Removed, this isn't needed anymore.
10659 2002-05-20 Martin Baulig <martin@gnome.org>
10661 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
10662 be underlying type for an enum.
10664 2002-05-20 Miguel de Icaza <miguel@ximian.com>
10666 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
10667 that splits out the loading of just the core types.
10669 * rootcontext.cs (ResolveCore): Split the struct resolution in
10670 two, so we can load the enumeration underlying types before any
10673 * expression.cs (Is): Bandaid until we fix properly Switch (see
10674 bug #24985 for details).
10676 * typemanager.cs (ImplementsInterface): The hashtable will contain
10677 a null if there are no interfaces implemented.
10679 2002-05-18 Miguel de Icaza <miguel@ximian.com>
10681 * cs-parser.jay (indexer_declarator): It is fine to have array
10684 2002-05-17 Miguel de Icaza <miguel@ximian.com>
10686 * typemanager.cs: (RegisterBuilder): New function used to register
10687 TypeBuilders that implement interfaces. Since
10688 TypeBuilder.GetInterfaces (as usual) does not work with lame
10690 (AddUserType): register interfaces.
10692 (ImplementsInterface): Use the builder_to_ifaces hash if we are
10693 dealing with TypeBuilder. Also, arrays are showing up as
10694 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
10695 methods can not be invoked on them!
10697 * ecore.cs (ExplicitReferenceConversionExists): Made public.
10698 (ImplicitReferenceConversionExists): Split out from
10699 StandardConversionExists.
10701 * expression.cs (As): We were only implementing one of the three
10702 cases for the as operator. We now implement them all.
10703 (Is): Implement the various other cases for Is as well.
10705 * typemanager.cs (CACHE): New define used to control if we want or
10706 not the FindMembers cache. Seems to have a negative impact on
10707 performance currently
10709 (MemberLookup): Nested types have full acess to
10710 enclosing type members
10712 Remove code that coped with instance/static returns for events, we
10713 now catch this in RealFindMembers.
10715 (RealFindMembers): only perform static lookup if the instance
10716 lookup did not return a type or an event.
10718 2002-05-17 Miguel de Icaza <miguel@ximian.com>
10720 * assign.cs (CompoundAssign): We pass more semantic information
10721 now to Compound Assignments than we did before: now we have all
10722 the information at hand, and now we resolve the target *before* we
10723 do the expression expansion, which allows the "CacheValue" method
10724 to have the effect we intended (before, a [x] += 1 would generate
10725 two differen ArrayAccess expressions from the ElementAccess,
10726 during the resolution process).
10728 (CompoundAssign.DoResolve): Resolve target and original_source here.
10730 2002-05-16 Miguel de Icaza <miguel@ximian.com>
10732 * expression.cs (ArrayAccess): dropped debugging information.
10734 * typemanager.cs: Small bug fix: I was always returning i_members,
10735 instead of one of i_members or s_members (depending on which had
10738 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
10739 method is invoked before any code generation takes place, and it
10740 is a mechanism to inform that the expression will be invoked more
10741 than once, and that the method should use temporary values to
10742 avoid having side effects
10744 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
10746 * ecore.cs (Expression.CacheTemporaries): Provide empty default
10749 * expression.cs (Indirection, ArrayAccess): Add support for
10750 CacheTemporaries in these two bad boys.
10752 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
10753 ldobj or ldind_ref.
10754 (StoreFromPtr): Handle stobj as well.
10756 * expression.cs (UnaryMutator): Share more code.
10758 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
10759 down: I was not tracking the Filter function as well, which
10760 was affecting the results of the cache.
10762 2002-05-15 Miguel de Icaza <miguel@ximian.com>
10764 * attribute.cs: Remove the hack to handle the CharSet property on
10767 2002-05-14 Miguel de Icaza <miguel@ximian.com>
10769 * attribute.cs (DoResolve): More uglyness, we now only try to
10770 resolve the attribute partially, to extract the CharSet
10771 information (only if we are a StructLayout attribute). Otherwise
10773 (GetExtraTypeInfo): Add some code to conditionally kill in the
10774 future this. I am more and more convinced that the .NET
10775 framework has special code to handle the attribute setting on
10778 * expression.cs (IsParamsMethodApplicable): Revert my previous
10779 foreach change here, it was wrong.
10781 2002-05-13 Miguel de Icaza <miguel@ximian.com>
10783 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
10784 (pp_expr): do not abort on unknown input, just return.
10785 (eval): abort if there are pending chars.
10787 * attribute.cs (Attribute.Resolve): Positional parameters are
10788 optional. Deal with that case.
10790 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
10791 the Ansi/Unicode/Auto information for the type.
10793 (TypeContainer.DefineType): instantiate the EmitContext here, as
10794 we will be using it during the type definition (to resolve
10795 attributes) and during the emit phase.
10797 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
10798 to pull type information out of the attributes
10800 (Attribute.Resolve): track the constructor builder, and allow for
10801 multiple invocations (structs and classes will use this).
10803 * ecore.cs (MemberLookupFinal): new version with all the
10804 parameters customizable.
10806 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
10807 constructors. Return if the result value is null (as the error
10808 would have been flagged already by MemberLookupFinal)
10810 Do not allow instances of abstract classes or interfaces to be
10813 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
10814 We have to compare the assembly property here when dealing with
10815 FamANDAssem and Assembly access modifiers, because we might be
10816 creating an assembly from *modules* (that means that we are not
10817 getting TypeBuilders for types defined in other modules that are
10818 part of this assembly).
10820 (Method.Emit): If the method is marked abstract and has a body,
10823 (TypeContainer.DefineMembers): If both the defined member and the
10824 parent name match are methods, then do not emit any warnings: let
10825 the Method.Define routine take care of flagging warnings. But if
10826 there is a mismatch (method overrides something else, or method is
10827 overriwritten by something, then emit warning).
10829 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
10830 set to null, this means `do not check for the return type on the
10833 (Method.Define): set the return type for the method signature to
10834 null, so that we get methods with the same name and parameters and
10835 different return types. This is used to flag warning 114 (you are
10836 hiding a method, and you probably want to use the new/override
10839 * typemanager.cs (MemberLookup): Implemented proper access
10840 control, closing a long standing set of bug reports. The problem
10841 was that the Framework only has two bits: Public and NonPublic,
10842 and NonPublic includes private and protected methods, but we need
10843 to enforce the FamANDAssem, FamOrAssem and Family.
10845 2002-05-11 Miguel de Icaza <miguel@ximian.com>
10847 * statement.cs (GotoCase): Return true: Ammounts to giving up
10848 knowledge on whether we return or not, and letting the other case
10849 be responsible for it.
10851 2002-05-10 Miguel de Icaza <miguel@ximian.com>
10853 * driver.cs: Do not load directories for each file processed, only
10854 do it if there is a pattern.
10856 * ecore.cs: Report readonly assigns here as well, as we might have
10857 been resolved only by MemberAccess.
10859 (SimpleName.SimpleNameResolve): Also be useful for LValue
10860 resolution. We need this to propagate assign to local readonly variables
10862 * typemanager.cs: Use a ptrhashtable for the criteria, because we
10863 do not want to reuse potential criteria memory.
10865 * class.cs (MyEventBuilder): Set reflected_type;
10867 * ecore.cs (Constantify): Added support for constifying bools.
10869 (RootContext.LookupType): Added a cache for values looked up in
10870 the declaration space.
10872 * typemanager.cs (FindMembers): Now is a front-end to
10873 RealFindMembers, and provides a two-level hashtable-based cache to
10876 15% performance improvement: from 22.5 to 19.2 seconds.
10878 * expression.cs (IsParamsMethodApplicable): use foreach.
10879 (Invocation.DoResolve): ditto.
10880 (New.DoResolve): ditto.
10881 (ArrayCreation.DoResolve): ditto.
10883 * ecore.cs (FindMostEncompassingType): use foreach.
10885 * delegate.cs (NewDelegate.DoResolve): Use foreach
10887 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
10888 (RemoveMethods): use foreach.
10890 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
10891 nested foreach statements instead of for, and also break out of
10892 the inner loop once a match is found.
10894 (Invocation.OverloadResolve): Use foreach, simplify the code.
10896 2002-05-08 Miguel de Icaza <miguel@ximian.com>
10898 * cfold.cs (BinaryFold): During an enumeration evaluation context,
10899 we actually unwrap the expression to allow for extra information
10902 * expression.cs: Use Shr_Un on unsigned operations.
10904 2002-05-08 Ravi Pratap <ravi@ximian.com>
10906 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
10907 applicable operators was not being considered correctly. This closes
10908 the bug Miguel reported.
10910 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
10912 * attribute.cs: check that the type derives from System.Attribute
10913 and report the correct error in that case (moved the duplicate code to
10914 its own method, too).
10916 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
10918 * attribute.cs: lookup attribute type name as the spec says: first the
10919 bare attribute name and then name + "Attribute" (nant compiles with
10920 mcs after this fix).
10922 2002-05-07 Miguel de Icaza <miguel@ximian.com>
10924 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
10925 Because of the way we parse things, we should try to see if a
10926 UIntConstant can fit in an integer.
10928 2002-05-07 Ravi Pratap <ravi@ximian.com>
10930 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
10931 when we are in an explicit context.
10933 (ConvertReferenceExplicit): When converting from Iface type S to Class
10934 T make sure the rules are implemented as an OR.
10936 * parameter.cs (ParameterType): Make it a property for now although the
10937 purpose really isn't anything immediate.
10939 * expression.cs (Is*Applicable): Do better checking on the parameter type
10940 of a ref/out parameter. The ones from the system assemblies are already
10941 marked with the correct type so we don't need to do any correction.
10943 * ecore.cs (StandardConversionExists): Conversion from Interface types to
10944 the object type is standard too so include that.
10946 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10948 * ecore.cs (StandardConversionExists): Augment with missing code:
10949 deal with IntConstant, LongConstants and Enumerations.
10951 * assign.cs: Report the error, instead of failing silently
10953 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
10954 typecontainer that they are declared, because the
10955 typecontainer/namespace will have the list of using clauses that
10956 need to be applied.
10958 Assembly Attributes were escaping the normal registration
10961 (EmitCode): Apply attributes within an EmitContext that represents
10962 the container they were declared on.
10964 * cs-parser.jay: Track bases for structs. How did I get this wrong?
10966 2002-05-06 Ravi Pratap <ravi@ximian.com>
10968 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
10969 Revamp completely - make much cleaner as we now operate only
10972 (FindMostSpecificSource, FindMostSpecificTarget): New methods
10973 to implement the logic detailed in the spec more correctly.
10975 (UserDefinedConversion): Update accordingly.
10977 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10979 * statement.cs: Return flow analysis information up.
10981 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
10984 (token): Do not consume an extra character before calling
10987 2002-05-06 Piers Haken <piersh@friskit.com>
10989 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
10991 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10993 * class.cs (Constructor.Emit): Set the IsStatic flag in the
10994 EmitContext during the instance constructor initializer
10995 resolution, to stop access to instance variables.
10997 This is mandated by the spec, last paragraph of the `constructor
10998 initializers' section.
11000 2002-05-05 Miguel de Icaza <miguel@ximian.com>
11002 * cs-parser.jay, class.cs (Accessor): new class used to represent
11003 an accessor (get or set). In the past we used `null' to represent
11004 a missing accessor. But this is ambiguous because there was no
11005 way to tell in abstract indexers/properties if one of them was
11008 Now there is a way of addressing that.
11010 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
11011 instead of FindMembers.
11013 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
11014 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
11016 * attribute.cs: Treat indexers and properties as the same in terms
11017 of applying attributes
11019 * ecore.cs (FindMostEncompassedType): Use statically initialized
11020 EmptyExpressions()s like we do elsewhere to avoid creating useless
11021 objects (and we take this out of the tight loop).
11023 (GetConversionOperators): Move the code to extract the actual
11024 operators to a separate routine to clean things up.
11026 2002-05-04 Miguel de Icaza <miguel@ximian.com>
11028 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
11029 events are always registered FieldBuilders.
11031 * class.cs (FieldBase): New class shared by Fields
11033 * delegate.cs: If we are a toplevel delegate, use our full name.
11034 If we are a nested delegate, then only use our tail name.
11036 2002-05-02 Ravi Pratap <ravi@ximian.com>
11038 * expression.cs (IsApplicable): Ensure that we add the "&" to
11039 ref/out types before comparing it with the type of the argument.
11041 (IsParamsMethodApplicable): Ditto.
11043 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
11046 * delegate.cs : Handle the case when we have more than one applicable
11047 method. Flag an error only when we finish checking all.
11049 2002-05-02 Miguel de Icaza <miguel@ximian.com>
11051 * expression.cs: Add support for boolean static initializers.
11053 2002-05-01 Miguel de Icaza <miguel@ximian.com>
11055 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
11057 * parameter.cs (ComputeParameterTypes,
11058 ComputeAndDefineParameterTypes): Better error handling: now we
11059 clear the `types' cache if we fail during any of the type lookups.
11060 We also return the status code correctly to our caller
11062 * delegate.cs: If we fail to define a delegate, abort the extra
11065 * expression.cs (Binary.ResolveOperator): for
11066 operator==(object,object) and operator !=(object, object) we also
11067 have to verify that there is an implicit conversion from one to
11070 (ArrayAccess.DoResolve): Array Access can operate on
11073 2002-04-30 Miguel de Icaza <miguel@ximian.com>
11075 * assign.cs (CompoundAssign): A new class used as a "flag" that
11076 the assignment actually is happening as part of a compound
11077 assignment operator.
11079 During compound assignment, a few new rules exist to enable things
11086 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
11087 to the type of x) if y is implicitly convertible to the type of x,
11088 and the operator is a builtin operator and the return type of the
11089 operator is explicitly convertible to the type of x.
11091 * rootcontext.cs: Reset warning level to 2. 4 catches various
11092 "interesting" features in mcs, we must clean this up at some
11093 point, but currently am trying to kill other bugs ;-)
11095 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
11096 in container classes as well.
11098 * expression.cs (Binary.ResolveOperator): Handle string case
11099 before anything else (as operator overloading does emit an error
11100 before doing anything else).
11102 This code could go away when we move to a table driven model, but
11103 i could not come up with a good plan last night.
11105 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
11107 * typemanager.cs (CSharpName): reimplementation using regex.
11108 * class.cs: added null check for fields in Emit
11109 * rootcontext.cs: set warninglevel to 4
11111 2002-04-29 Miguel de Icaza <miguel@ximian.com>
11113 * typemanager.cs (CSharpName): reimplemented with Lupus
11116 2002-04-28 Miguel de Icaza <miguel@ximian.com>
11118 * statement.cs (If): correclty implement Resolve, because we were
11119 not catching sem errors in there. The same process is needed
11121 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
11124 (Statement.Warning_DeadCodeFound): Factorize code.
11125 (While): Report dead code here too.
11127 (Statement): Added Resolve virtual method to allow
11128 for resolution split from the emit code.
11130 2002-04-26 Miguel de Icaza <miguel@ximian.com>
11132 * statement.cs (EmitBoolExpression): No longer try to resolve the
11134 (MakeBoolean): New utility function that resolve, implicitly
11135 converts to boolean and tags the expression.
11138 (If, Do): Implement dead code elimination.
11139 (While): Implement loop inversion
11141 (Do, While, For, If): Resolve the expression prior to calling our
11144 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
11147 - added method Report28 (warning: program has more than one entry point)
11148 - added method IsEntryPoint, implements paragraph 10.1 of the spec
11149 - modified method Method.Define, the part at the end of the method
11151 * rootcontext.cs: added static public Location EntryPointLocation;
11153 * ../errors/cs0028.cs : Add test case for the above warning.
11156 - modified method CSharpName to allow arrays of primitive type to
11157 be printed nicely (e.g. instead of System.Int32[][] it now prints
11159 - added method CSharpSignature: returns the signature of a method
11160 in string format to be used in reporting errors, warnings, etc.
11162 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
11165 2002-04-26 Ravi Pratap <ravi@ximian.com>
11167 * delegate.cs (Define): Fix extremely silly bug where I was
11168 setting the type of the 'object' parameter of the BeginInvoke
11169 method to System.IAsyncResult instead of System.Object ;-)
11171 2002-04-26 Miguel de Icaza <miguel@ximian.com>
11173 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
11176 (Constructor.Emit): return if we fail to initialize the
11177 constructor. Another door closed!
11179 * expression.cs (New.DoResolve): Improve error message (from -6 to
11180 1501). Use DeclaredOnly lookup to find the exact constructor.
11182 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
11183 loop. This is useful.
11185 * cs-parser.jay: Adjust the default parameters so that destructors
11186 have the proper signature.
11188 2002-04-26 Martin Baulig <martin@gnome.org>
11190 * driver.cs (LoadAssembly): If `assembly' contains any characters
11191 which are only valid in path names and not in assembly names
11192 (currently slash, backslash and point), use Assembly.LoadFrom ()
11193 instead of Assembly.Load () on the `assembly' (before iteration
11194 over the link_paths).
11196 2002-04-26 Martin Baulig <martin@gnome.org>
11198 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
11200 2002-04-25 Miguel de Icaza <miguel@ximian.com>
11202 * class.cs (Property): use the new typemanager.MemberLookup
11204 (TypeContainer.MemberLookup): Implement using the
11205 TypeManager.MemberLookup now.
11207 * typemanager.cs: Make MemberLookup a function of the TypeManager,
11208 and return MemberInfos, so that these can be used without an
11209 EmitContext (what we had before).
11211 2002-04-24 Miguel de Icaza <miguel@ximian.com>
11213 * expression.cs: Fix the case where the argument to params if the
11214 type of the params. I omitted handling this before. Fixed
11216 2002-04-22 Miguel de Icaza <miguel@ximian.com>
11218 * driver.cs: Call BootCorlib_PopulateCoreType
11220 * class.cs (Property.CheckBase): Check for properties only, not
11223 * interface.cs: Temporary hack: try/catch around the
11224 CustomAttributeBuilder, because I am getting an exception that I
11227 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
11228 types whose definitions are required to be there (attributes are
11229 defined before standard types).
11231 Compute definitions as we boot the various types, as they are used
11232 immediately (value_type class will need object_type, but if we do
11233 not initialize object_type, we will pass a null, which will let
11234 the runtime pick the System.Object from the existing corlib, which
11235 is not what we want).
11237 2002-04-22 Patrik Torstensson <totte@labs2.com>
11239 * cs-tokenizer.cs: fixed a number of trim() issues.
11241 2002-04-22 Ravi Pratap <ravi@ximian.com>
11243 * expression.cs (Argument.Type): Ensure that we return the correct
11244 type when we have out or ref parameters [in which case we
11247 2002-04-22 Miguel de Icaza <miguel@ximian.com>
11249 * class.cs (Property, Indexer): Allow extern modifier in there.
11251 * typemanager.cs (InitBaseTypes): Initializes object_type and
11252 value_type, since those will be used early on during the bootstrap
11253 process to compile corlib.
11255 (InitCoreTypes): Move code from here to InitBaseTypes.
11257 2002-04-21 Miguel de Icaza <miguel@ximian.com>
11259 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
11260 single-dimension arrays as using the ldlen opcode.
11262 Daniel Lewis discovered this optimization.
11264 * typemanager.cs: Add signature for System.Array::get_Length
11266 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11268 * statement.cs: report the error when the foreach does not apply to an
11269 array nor a collection.
11271 2002-04-19 Miguel de Icaza <miguel@ximian.com>
11273 * expression.cs: Add implicit conversions to the operator ~.
11275 * constant.cs (DecimalConstant.Emit): Emit decimal value.
11277 * typemanager.cs: Locate the decimal constructor.
11279 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11281 * attribute.cs: use the new property of TypeOf.
11282 * expression.cs: added 'get' property around typearg.
11284 These changes fix a build breaker reported by NickD. Is this the
11285 correct way to fix? If not, please, revert my changes and make it
11288 2002-04-17 Miguel de Icaza <miguel@ximian.com>
11290 * attribute.cs: Add support for typeof in attribute invocations.
11291 I am not sure that this is right though.
11293 2002-04-14 Duncan Mak <duncan@ximian.com>
11295 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
11296 Binary.Operator.Division case.
11298 2002-04-13 Ravi Pratap <ravi@ximian.com>
11300 * class.cs (DefineType): Ensure that we do a proper check on
11301 attribute types and also register it with the TypeManager.
11303 (TypeContainer.Targets): The default for attribute types is
11304 AttributeTargets.All.
11306 * attribute.cs (ApplyAttributes): Registering the attribute type
11307 is done elsewhere, not when we discover we have a Usage attribute.
11309 2002-04-12 Ravi Pratap <ravi@ximian.com>
11311 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
11312 and get rid of is_delegate parameter.
11314 * everywhere : update.
11316 2002-04-12 Ravi Pratap <ravi@ximian.com>
11318 * cs-parser.jay (compilation_unit): Revamp completely to use
11319 some new ideas that I got from Rhys' grammar to solve the problems
11320 with assembly level attributes.
11322 (outer_declaration): New grammar production.
11324 (attribute_sections): Add.
11326 (opt_attributes): Base on attribute_sections
11328 (namespace_declaration): Allow opt_attributes to tackle the case
11329 when we have assembly level attributes - we are clever in this
11332 * attribute.cs (ApplyAttributes): Do not worry about assembly
11333 attributes in the non-global context.
11335 * rootcontext.cs (AddGlobalAttributes): Go back to using this
11336 instead of SetGlobalAttributes.
11338 * class.cs, rootcontext.cs : Ensure we define and generate
11339 attribute types before anything else.
11341 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
11342 and flag the new error -20 for the case when the attribute type
11343 does not have valid targets specified. csc does not catch this.
11345 * ../errors/errors.txt : update for error # -20
11347 2002-04-11 Ravi Pratap <ravi@ximian.com>
11349 * support.cs (InternalParameters.ParameterModifier): Do some null
11350 checking and return sane values.
11352 * class.cs (Method.Define): If we are a PInvoke method, ensure
11353 that we are static and extern. Report error # 601
11355 * ../errors/cs0601.cs : Add test case for the above error.
11357 2002-04-07 Ravi Pratap <ravi@ximian.com>
11359 * rootcontext.cs (attribute_types): We need to keep type of
11360 all attribute types separately and emit code for them first.
11362 (RegisterAttribute) : Implement.
11364 * class.cs (DefineType): Check if the current Type is a custom
11365 attribute type and register it accordingly.
11367 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
11368 adding the first attribute twice and rename to
11370 (SetGlobalAttributes): this.
11372 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
11375 * attribute.cs (ApplyAttributes): Take an additional argument telling us
11376 if we are processing global arguments. Hmm, I am unsure of this.
11378 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11380 * expression.cs: added static array of strings to avoid calling
11381 Enum.ToString () for Operator in Binary. Significant recover of
11384 2002-04-10 Miguel de Icaza <miguel@ximian.com>
11386 * class.cs (FindMembers): Allow the Builders of the various
11387 members to be null. If they are skip them. This only happens
11388 during the PInvoke declaration.
11390 2002-04-09 Miguel de Icaza <miguel@ximian.com>
11392 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
11393 failure, so we do not keep going afterwards.
11395 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
11396 wanted to pass `false' as the `is_delegate' argument. If this is
11397 the case, why not use delegate_type == null to mean `is_delegate =
11398 false' and anything else as is_delegate = true.
11400 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
11402 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
11403 code for the section, not the beginning of the tests.
11405 2002-04-08 Miguel de Icaza <miguel@ximian.com>
11407 * cfold.cs: Handle operator + (Enum x, Underlying x)
11409 * expression.cs (Binary): same. Warn about errors where we have
11410 Enum/Enum in operator + as well.
11412 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
11415 - added support for switch(bool)
11416 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
11417 - add TableSwitchEmit() to handle table-based switch statements
11419 2002-04-05 Ravi Pratap <ravi@ximian.com>
11421 * expression.cs (Invocation.OverloadResolve): Factor out code which
11422 does parameter compatibility checking with arguments so that we can
11423 re-use the code even from Delegate.VerifyApplicability
11425 (VerifyArgumentsCompat): Move above code here.
11427 * delegate.cs (VerifyApplicability): Get rid of duplicate code
11428 and instead make a call to the above method.
11430 2002-03-31 Ravi Pratap <ravi@ximian.com>
11432 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
11433 We use it to keep track of classes which are attribute types.
11435 2002-04-02 Miguel de Icaza <miguel@ximian.com>
11437 * delegate.cs (Delegate.Define): Correctly define the types in the
11438 presence of fixed and array parameters.
11440 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
11443 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
11444 include NonPublic after the first iteration.
11446 * class.cs (Indexer.CheckBase): Only check if both parents are
11449 * cs-parser.jay (accessor_body): If empty, set to null.
11451 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
11452 same code path here to resolve constants names that we did have in
11453 MemberAccess.DoResolve. There is too much code duplicated here.
11455 2002-04-01 Miguel de Icaza <miguel@ximian.com>
11457 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
11459 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
11462 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
11463 tokens, numbers and strings.
11465 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
11468 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
11469 asyncronous parameters and the regular parameters.
11471 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
11472 specify the target directory.
11474 * expression.cs: (This.DoResolve): Simplify
11475 (As.Emit): Optimize, do not generate IsInst if the expression is
11476 always of the given type.
11478 (Is.DoResolve): Bug fix, we were reporting both always/never for
11481 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
11482 creating too many unnecessary arrays.
11484 2002-03-31 Miguel de Icaza <miguel@ximian.com>
11486 * class.cs (EmitFieldInitializer): Use Assign expression to assign
11487 fields instead of rolling our own initializer. Takes care of all
11488 implicit conversions, and drops unnecessary static checks/argument.
11490 2002-03-31 Dick Porter <dick@ximian.com>
11492 * driver.cs: use the GetDirectories() return values properly, and
11493 use "/" as path separator.
11495 2002-03-30 Miguel de Icaza <miguel@ximian.com>
11497 * expression.cs (Unary): Optimize - - expr into expr.
11498 (Binary): Optimize a + (-b) into a -b.
11500 * codegen.cs (CodeGen): Made all methods static.
11502 2002-03-29 Miguel de Icaza <miguel@ximian.com>
11506 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
11507 TypeBuilder property.
11509 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
11512 * tree.cs: Removed the various RecordXXXX, and replaced with a
11513 single RecordDecl. Removed all the accessor methods, and just
11514 left a single access point Type
11516 * enum.cs: Rename DefineEnum to DefineType.
11518 * decl.cs: New abstract method `DefineType' used to unify the
11519 Defines for Enumerations, Interfaces, TypeContainers and
11522 (FindType): Moved LookupInterfaceOrClass here. Moved the
11523 LookupBaseClasses method that used to live in class.cs and
11524 interface.cs here, and renamed to FindType.
11526 * delegate.cs: Implement DefineType. Take advantage of the
11527 refactored pattern for locating the parent builder without taking
11528 the parent_builder argument (which we know does not work if we are
11529 nested, and triggering a toplevel definition).
11531 2002-03-28 Miguel de Icaza <miguel@ximian.com>
11533 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
11534 accessibility of a member has changed during override and report
11537 * class.cs (Method.Define, Property.Define): Only complain on
11538 overrides if the method is private, any other accessibility is
11539 fine (and since we just checked the permission is the same, we are
11542 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
11543 and elif are processed always. The other pre-processing
11544 directives are only processed if we are "taking" the path
11546 2002-03-29 Martin Baulig <martin@gnome.org>
11548 * class.cs (Method.Emit): Only emit symbolic debugging info if the
11549 current location is not Null.
11551 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
11552 a separate method so we can profile it.
11554 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
11555 `span.Seconds' are just seconds, but no minutes or hours.
11556 (MainDriver): Profile the CodeGen.SaveSymbols calls.
11558 2002-03-28 Miguel de Icaza <miguel@ximian.com>
11560 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
11561 Remove the gratuitous set of Final:
11563 // If an interface implementation, then we can set Final.
11564 if (((flags & MethodAttributes.Abstract) == 0) &&
11565 implementing.DeclaringType.IsInterface)
11566 flags |= MethodAttributes.Final;
11568 I do not know what I was smoking when I used that.
11571 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
11572 step into fixing the name resolution issues for delegates and
11573 unifying the toplevel name resolution.
11575 2002-03-28 Martin Baulig <martin@gnome.org>
11577 * class.cs (Method.Emit): If we have a symbol writer, call its
11578 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
11579 tell it about the current method.
11581 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
11582 writer that we're going to emit the first byte of IL code for a new
11583 statement (a new source line).
11584 (EmitContext.EmitTopBlock): If we have a symbol writer, call
11585 EmitContext.Mark() before emitting any code.
11587 * location.cs (SymbolDocument): Return null when we're Null.
11589 * statement.cs (Statement): Moved the `Location loc' variable here.
11590 (Statement.EmitBoolExpression): If we have a symbol writer, call
11591 ec.Mark() before emitting any code to tell it that we're at the
11592 beginning of a new statement.
11593 (StatementExpression): Added `Location' argument to the constructor.
11594 (Block): Added public readonly variable `StartLocation' and public
11595 variable `EndLocation'. The latter is to be set using SetEndLocation().
11596 (Block): Added constructor which takes a start and end location.
11597 (Block.SetEndLocation): New method. This sets the end location.
11598 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
11599 local variables we create.
11600 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
11601 each statement and do also mark the begin and end of the block.
11603 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
11604 tell it the current lexer.Location, use Location.Null for the end of the
11606 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
11607 current block, set its end location using SetEndLocation().
11608 (statement_expression): StatementExpression constructor now takes the
11609 lexer.Location as additional argument.
11610 (for_statement, declare_local_variables): Likewise.
11611 (declare_local_variables): When creating a new implicit block, use the
11612 new Block constructor and pass it the lexer.Location.
11614 2002-03-28 Miguel de Icaza <miguel@ximian.com>
11616 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
11617 members also on the parent interfaces recursively.
11619 2002-03-27 Miguel de Icaza <miguel@ximian.com>
11621 * report.cs: Use new formats, since Gonzalo finished the missing
11624 * expression.cs (Binary.ResolveOperator): added missing operator|
11625 operator& and operator^ for bool/bool.
11627 * cs-parser.jay: CheckDef now takes a Location argument that is
11628 used to report errors more precisly (instead of reporting the end
11629 of a definition, we try to track something which is a lot closer
11630 to the source of the problem).
11632 * cs-tokenizer.cs: Track global token use, so we can properly flag
11633 the use of #define/#undef after the first token has been seen.
11635 Also, rename the reportXXXX to Error_DescriptiveName
11637 * decl.cs (DeclSpace.IsTopLevel): Move property here from
11638 TypeContainer, so that Enum and Interface can use this too.
11640 * class.cs (TypeContainer.LookupInterfaceOrClass,
11641 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
11642 `builder' argument. Typically this was used to pass the parent
11643 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
11646 The problem is that a nested class could trigger the definition of
11647 a toplevel class, and the builder would be obviously wrong in that
11650 So we drop this argument, and we compute dynamically the
11651 TypeBuilder/ModuleBuilder (the correct information was available
11652 to us anyways from DeclSpace.Parent)
11654 * interface.cs (Interface.DefineInterface): Drop builder
11655 parameter cleanup like class.cs
11657 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
11660 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
11663 (Try.Emit): Propagate the returns value from the statement.
11665 (Return.Emit): Even if we are leavning
11667 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
11669 * modifiers.cs: Fix the computation of MethodAttributes flags.
11671 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
11673 * driver.cs: allow compilation of files that start with '/'.
11674 Add a default case when checking the argument of --target.
11676 2002-03-25 Miguel de Icaza <miguel@ximian.com>
11678 * interface.cs: Implement the same search algorithm for types in
11679 the interface code.
11681 * delegate.cs: Do not allow multiple definition.
11683 * Recovered ChangeLog that got accidentally amputated
11685 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
11687 * rootcontext.cs: Load manually enum to allow core classes to
11688 contain enumerations.
11690 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
11691 Update to new static methods in TypeManager.
11693 * typemanager.cs (GetMethod, GetConstructor): Use our
11694 implementation of FindMembers to find the members, since during
11695 corlib compilation, the types are TypeBuilders and GetMethod and
11696 GetConstructor do not work.
11698 Make all methods in TypeManager static.
11700 (InitCodeHelpers): Split the functionality from
11701 the InitCodeTypes function.
11703 * driver.cs: Call InitCodeHelpers after we have populated the
11706 * cs-parser.jay (delegate_declaration): we did not used to compute
11707 the delegate name correctly for void delegates.
11709 2002-03-24 Miguel de Icaza <miguel@ximian.com>
11711 * rootcontext.cs (RootContext): Init the interface_resolve_order
11712 and type_container_resolve_order always.
11714 (ResolveCore, BootstrapCorlib_ResolveClass,
11715 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
11716 compiler when compiling with --nostdlib
11718 * class.cs (TypeContainer.DefineType): Check that our parent is
11719 not null. This test is most important when we are bootstraping
11722 * codegen.cs: Split out the symbol writing code.
11724 2002-03-25 Martin Baulig <martin@gnome.org>
11726 * driver.cs (-g): Made -g an alias for --debug.
11728 2002-03-24 Martin Baulig <martin@gnome.org>
11730 * codegen.cs (SymbolWriter): New public variable. Returns the
11731 current symbol writer.
11732 (CodeGen): Added `bool want_debugging_support' argument to the
11733 constructor. If true, tell the ModuleBuild that we want debugging
11734 support and ask it for the ISymbolWriter.
11735 (Save): If we have a symbol writer, call it's Close() method after
11736 saving the assembly.
11738 * driver.c (--debug): New command line argument to create a
11739 debugger information file.
11741 * location.cs (SymbolDocument): New public property. Returns an
11742 ISymbolDocumentWriter object for the current source file or null
11743 if we don't have a symbol writer.
11745 2002-03-21 Miguel de Icaza <miguel@ximian.com>
11747 * driver.cs (LoadAssembly): Correctly return when all the paths
11748 have been tried and not before.
11750 * statement.cs (Switch.Emit): return the actual coverage for this
11751 statement (returns/not-returns)
11753 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
11754 switch of the statement if we are the last switch section. That
11755 kills two problems: try/catch problems (we used to emit an empty
11756 nop at the end) and switch statements where all branches would
11759 2002-03-19 Miguel de Icaza <miguel@ximian.com>
11761 * driver.cs: Add default assemblies (the equivalent to the
11762 Microsoft CSC.RSP file)
11764 * cs-tokenizer.cs: When updating `cols and setting it to zero,
11765 also update tokens_seen and set it to false.
11767 * driver.cs: Implement --recurse for Mike.
11769 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
11770 correctly splitting out the paths.
11772 2002-03-18 Miguel de Icaza <miguel@ximian.com>
11774 * interface.cs (Interface.PopulateProperty): Instead of using
11775 `parent' as the declaration space for the set parameters, use
11778 * support.cs (InternalParameters): InternalParameters constructor
11779 takes a DeclSpace instead of a TypeContainer.
11781 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
11782 types are being initialized, load the address of it before calling
11785 (New): Provide a mechanism to disable the generation of local
11786 value type temporaries when the caller will be providing us with
11787 an address to store it.
11789 (ArrayCreation.EmitDynamicInitializers): Use it.
11791 2002-03-17 Miguel de Icaza <miguel@ximian.com>
11793 * expression.cs (Invocation.EmitArguments): Only probe for array
11794 property if there is more than one argument. Sorry about that.
11796 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
11797 empty param arrays.
11799 * class.cs (Method.LabelParameters): Fix incorrect code path that
11800 prevented the `ParamArrayAttribute' from being applied to the
11803 2002-03-16 Miguel de Icaza <miguel@ximian.com>
11805 * support.cs (ReflectionParameters): Correctly compute whether the
11806 last argument is a params array. Fixes the problem with
11809 * typemanager.cs: Make the assemblies array always be non-null
11810 (empty, but non-null)
11812 * tree.cs (RecordDecl): New function that abstracts the recording
11813 of names. This reports error 101, and provides a pointer to the
11814 previous declaration. Fixes a crash in the compiler.
11816 * cs-parser.jay (constructor_declaration): Update to new grammar,
11817 and provide a constructor_body that can be empty.
11819 2002-03-15 Miguel de Icaza <miguel@ximian.com>
11821 * driver.cs: Add support for --resources.
11823 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
11824 Make all types for the various array helper methods be integer.
11826 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
11827 CheckState to ConvCast.
11829 (ConvCast): Now it takes a `checked' state argument, to avoid
11830 depending on the emit context for the conversion, and just using
11831 the resolve time setting.
11833 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
11834 instead of Invocation.EmitArguments. We do not emit the original
11835 arguments, instead we emit those which have been converted to
11836 unsigned int expressions.
11838 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
11840 * codegen.cs: ditto.
11842 * expression.cs (LocalVariableReference): Drop the use of the
11843 Store function that depended on the variable index.
11845 * statement.cs (VariableInfo): Drop the `Idx' property from this
11846 class, as this is not taking into account the indexes for
11847 temporaries tat we generate during the execution, getting the
11850 * class.cs: First emit class initializers, then call the parent
11853 * expression.cs (Binary): Fix opcode emision.
11854 (UnaryMutator.EmitCode): Support checked code generation
11856 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
11857 matches for events for both the Static and Instance scans,
11858 pointing to the same element. Fix that.
11860 2002-03-14 Miguel de Icaza <miguel@ximian.com>
11862 * rootcontext.cs (ResolveTree): Always set the
11863 interface_resolve_order, because nested interfaces will be calling
11866 * class.cs (GetInterfaceOrClass): Track the same resolution
11867 process used by TypeManager.LookupType. This fixes the nested
11868 type lookups in class declarations (separate path from
11871 (TypeContainer.DefineType): Also define nested interfaces.
11872 (TypeContainer.RegisterOrder): New public function used to
11873 register the order in which child interfaces need to be closed.
11875 Nested interfaces need to be closed after their parents have been
11878 * interface.cs (InterfaceAttr): Put all the logic for computing
11879 the interface attribute here.
11881 (DefineInterface): Register our interface order with the
11882 RootContext or with the TypeContainer depending on the case.
11884 2002-03-12 Miguel de Icaza <miguel@ximian.com>
11886 * cs-parser.jay: rework foreach statement to work with the new
11887 changes to the policy on SimpleNames.
11889 * report.cs: support Stacktrace on warnings as well.
11891 * makefile: drop --unsafe and /unsafe from the compile.
11893 2002-03-13 Ravi Pratap <ravi@ximian.com>
11895 * ecore.cs (StandardConversionExists): Modify to take an Expression
11896 as the first parameter. Ensure we do null -> reference type conversion
11899 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
11900 temporary Expression objects.
11902 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
11904 * interface.cs: workaround bug in method overloading resolution
11905 (there is already a bugzilla bug for it).
11907 2002-03-12 Miguel de Icaza <miguel@ximian.com>
11909 We could also solve this problem by having a separate path for
11910 performing type lookups, instead of DoResolve, we could have a
11911 ResolveType entry point, and only participating pieces of the
11912 production (simplename, deref, array) would implement this.
11914 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
11915 signal SimpleName to only resolve type names and not attempt to
11916 resolve anything else.
11918 * expression.cs (Cast): Set the flag.
11920 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
11922 * class.cs: Only report 108 if there is no `new' modifier.
11924 * cs-parser.jay: rework foreach statement to work with the new
11925 changes to the policy on SimpleNames.
11927 * report.cs: support Stacktrace on warnings as well.
11929 * makefile: drop --unsafe and /unsafe from the compile.
11931 2002-03-11 Miguel de Icaza <miguel@ximian.com>
11933 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
11934 lookups here, instead of doing that at parse time. This means
11935 that our grammar will not introduce `LocalVariableReferences' as
11936 expressions at this point. That solves the problem of code like
11940 static void Main ()
11944 This is only half the fix. The full fix requires parameters to
11945 also be handled in this way.
11947 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
11948 makes the use more obvious of the DeclSpace. The
11949 ec.TypeContainer.TypeBuilder is now only used to pull the
11950 TypeBuilder for it.
11952 My theory is that I can get rid of the TypeBuilder completely from
11953 the EmitContext, and have typecasts where it is used (from
11954 DeclSpace to where it matters).
11956 The only pending problem is that the code that implements Aliases
11957 is on TypeContainer, and probably should go in DeclSpace.
11959 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
11960 lookups here, instead of doing that at parse time. This means
11961 that our grammar will not introduce `LocalVariableReferences' as
11962 expressions at this point. That solves the problem of code like
11966 static void Main ()
11970 This is only half the fix. The full fix requires parameters to
11971 also be handled in this way.
11973 * class.cs (Property.DefineMethod): When implementing an interface
11974 method, set newslot, when implementing an abstract method, do not
11975 set the flag (before we tried never setting it, or always setting
11976 it, which is the difference).
11977 (Indexer.DefineMethod): same.
11978 (Method.DefineMethod): same.
11980 * ecore.cs: Only set the status used flag if we get back a Field.
11982 * attribute.cs: Temporary hack, so Paolo can keep working.
11984 2002-03-08 Ravi Pratap <ravi@ximian.com>
11986 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
11987 the unmanaged type in the case we have a MarshalAs attribute.
11989 (Resolve): Handle the case when we are parsing the special MarshalAs
11990 attribute [we need to store the unmanaged type to use later]
11992 * typemanager.cs (marshal_as_attr_type): Built in type for the
11993 MarshalAs Attribute.
11995 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
11996 on parameters and accordingly set the marshalling info.
11998 2002-03-09 Miguel de Icaza <miguel@ximian.com>
12000 * class.cs: Optimizing slightly by removing redundant code after
12001 we switched to the `NoTypes' return value.
12002 (Property.DefineMethod): use NoTypes here too.
12004 This fixes the bug I introduced in my last batch of changes.
12006 2002-03-05 Ravi Pratap <ravi@ximian.com>
12008 * tree.cs (RecordEnum): Add. We now keep track of enums too.
12010 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
12011 Enums since those are types too.
12013 * cs-parser.jay (enum_declaration): Record enums as we parse them.
12015 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
12016 thanks to a call during the lookup process.
12018 2002-03-07 Miguel de Icaza <miguel@ximian.com>
12020 * statement.cs (Foreach): Lots of work to accomodate a particular
12021 kind of foreach statement that I had not kept in mind. It is
12022 possible to have foreachs on classes that provide a GetEnumerator
12023 method that return objects that implement the "pattern" for using
12024 a foreach, there is no need to support GetEnumerator
12027 This is needed to compile nant.
12029 * decl.cs: Only report 114 if the member is not `Finalize' and if
12030 the warning level is at least 2.
12032 * class.cs: Moved the compare function from Method to
12035 (MethodSignature.InheritableMemberSignatureCompare): Add new
12036 filter function that is used to extract inheritable methods from a
12039 (Method.Define): Use the new `inheritable_method_signature_filter'
12042 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
12045 2002-03-06 Miguel de Icaza <miguel@ximian.com>
12047 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
12049 * cs-parser.jay: Add opt_semicolon to the interface declaration.
12051 * expression.cs: Pass location information to
12052 ConvertImplicitStandard.
12054 * class.cs: Added debugging code to track return values from
12057 2002-03-05 Miguel de Icaza <miguel@ximian.com>
12059 * expression.cs (Is.DoResolve): If either side of the `is' is an
12060 interface, do not flag the warning.
12062 * ecore.cs (ImplicitReferenceConversion): We need a separate test
12065 * report.cs: Allow for --fatal to be used with --probe.
12067 * typemanager.cs (NoTypes): Move the definition for the empty Type
12070 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
12072 (TypeContainer.DefineProxy): New function used to proxy to parent
12073 implementations when implementing interfaces.
12074 (TypeContainer.ParentImplements): used to lookup if our parent
12075 implements a public function that is required by an interface.
12076 (TypeContainer.VerifyPendingMethods): Hook this up.
12078 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
12079 `modules' and `assemblies' arraylists into arrays. We only grow
12080 these are the very early start up of the program, so this improves
12081 the speedof LookupType (nicely measured).
12083 * expression.cs (MakeByteBlob): Replaced unsafe code with
12084 BitConverter, as suggested by Paolo.
12086 * cfold.cs (ConstantFold.Binary): Special case: perform constant
12087 folding of string concatenation, but if either side is a string,
12088 and the other is not, then return null, and let the runtime use
12089 the concatenation on the string plus the object (using
12090 `Object.ToString').
12092 2002-03-04 Miguel de Icaza <miguel@ximian.com>
12094 Constant Folding has been implemented now.
12096 * expression.cs (Unary.Reduce): Do not throw an exception, catch
12097 the error instead on types that are not supported in one's
12100 * constant.cs (Constant and all children): New set of functions to
12101 perform implict and explicit conversions.
12103 * ecore.cs (EnumConstant): Implement the new functions to perform
12104 conversion by proxying to the child expression.
12106 * codegen.cs: (ConstantCheckState): Constant evaluation has its
12107 own separate setting that can not be turned off from the command
12108 line using --unchecked or --checked and is only controlled using
12109 the checked/unchecked statements and expressions. This setting is
12110 used by the constant folder to flag errors.
12112 * expression.cs (CheckedExpr, UncheckedExpr): Set the
12113 ConstantCheckState as well.
12115 During Resolve, they also have to flag the state, because the
12116 constant folder runs completely in the Resolve phase.
12118 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
12121 2002-03-01 Miguel de Icaza <miguel@ximian.com>
12123 * cfold.cs: New file, this file contains the constant folder.
12125 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
12126 argument to track whether we are using the resulting address to
12127 load or store a value and provide better error messages.
12129 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
12130 new AddressOf arguments.
12132 * statement.cs (Foreach.EmitCollectionForeach): Update
12134 * expression.cs (Argument.Emit): Call AddressOf with proper
12135 arguments to track usage.
12137 (New.DoEmit): Call AddressOf with new arguments.
12139 (Unary.Emit): Adjust AddressOf call.
12141 2002-03-01 Ravi Pratap <ravi@ximian.com>
12143 * cs-parser.jay (member_access): Change the case for pre-defined types
12144 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
12147 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
12150 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
12151 essentially like methods and apply attributes like MethodImplOptions to them too.
12153 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
12156 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
12157 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
12160 * Update code everywhere accordingly.
12162 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
12164 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
12166 2002-02-28 Ravi Pratap <ravi@ximian.com>
12168 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
12169 try performing lookups against those instead of jumping straight into using
12170 the 'using' clauses.
12172 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
12174 (LookupType): Perform lookups in implicit parents too.
12176 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
12177 sequence as RootContext.LookupType.
12179 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
12180 the various cases of namespace lookups into this method.
12182 2002-03-01 Miguel de Icaza <miguel@ximian.com>
12184 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
12185 in positional arguments)
12187 * class.cs (Operator): Update the AllowedModifiers to contain
12190 * cs-parser.jay: Update operator declaration to allow for the
12191 operator body to be empty.
12193 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
12196 2002-02-27 Miguel de Icaza <miguel@ximian.com>
12198 * class.cs (Method.Emit): Label parameters.
12200 * driver.cs: Return 1 or 0 as the program exit code.
12202 2002-02-26 Miguel de Icaza <miguel@ximian.com>
12204 * expression.cs: Special case the `null' object when trying to
12205 auto-compute the type, as anything can be explicitly converted to
12208 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
12209 spotting this Paolo.
12211 (Expression.ImplicitNumericConversion): Perform comparissions of
12212 the type using the underlying type in the case of an enumeration
12213 rather than using the enumeration type for the compare.
12215 Cope with the underlying == type case, which is not possible to
12218 (Expression.ConvertNumericExplicit): Perform comparissions of
12219 the type using the underlying type in the case of an enumeration
12220 rather than using the enumeration type for the compare.
12222 * driver.cs: If the user does not supply an extension, assume .exe
12224 * cs-parser.jay (if_statement): Rewrote so that we can track the
12225 location for the if statement.
12227 * expression.cs (Binary.ConstantFold): Only concat strings when
12228 the operation is "+", not everything ;-)
12230 * statement.cs (Statement.EmitBoolExpression): Take a location
12232 (If, While, Do): Track location.
12234 * expression.cs (Binary.ResolveOperator): In the object + string
12235 case, I was missing a call to ConvertImplicit
12237 2002-02-25 Ravi Pratap <ravi@ximian.com>
12239 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
12240 Location arguments. Ensure we use RootContext.LookupType to do our work
12241 and not try to do a direct Type.GetType and ModuleBuilder.GetType
12243 * interface.cs (PopulateMethod): Handle the type of the parameter being
12246 * expression.cs (Invocation.BetterFunction): Handle the case when we
12247 have a params method with no fixed arguments and a call is made with no
12250 2002-02-25 Miguel de Icaza <miguel@ximian.com>
12252 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
12253 the verbatim-string-literal
12255 * support.cs (InternalParameters.ParameterModifier): handle null
12257 (InternalParameters.ParameterType): ditto.
12259 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
12260 duplicating the name of the variable parameter.
12261 (GetParameterByName): Fix bug where we were not looking up array
12262 paramters if they were the only present (thanks Paolo!).
12263 (GetParameterInfo): We only have an empty set of types if both
12264 fixed and array are set to null.
12265 (GetParameterInfo-idx): Handle FixedParameter == null
12267 * cs-parser.jay: Handle the case where there is no catch
12268 statements (missing null test).
12270 2002-02-22 Miguel de Icaza <miguel@ximian.com>
12272 * driver.cs (MainDriver): Be conservative on our command line
12275 Catch DirectoryNotFoundException when calling GetFiles.
12277 (SplitPathAndPattern): Used to split the input specification into
12278 a path and a pattern that we can feed to Directory.GetFiles.
12280 2002-02-21 Miguel de Icaza <miguel@ximian.com>
12282 * statement.cs (Fixed): Implement the last case of the Fixed
12283 statement (string handling).
12285 * expression.cs (StringPtr): New class used to return a char * to
12286 a string; Used by the Fixed statement.
12288 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
12290 * expression.cs (Binary.ResolveOperator): Remove redundant
12291 MemberLookup pn parent type.
12292 Optimize union call, we do not need a union if the types are the same.
12293 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
12296 Specialize the use of MemberLookup everywhere, instead of using
12297 the default settings.
12299 (StackAlloc): Implement stackalloc keyword.
12301 * cs-parser.jay: Add rule to parse stackalloc.
12303 * driver.cs: Handle /h, /help, /?
12305 * expression.cs (MakeByteBlob): Removed the hacks we had in place
12306 before we supported unsafe code.
12308 * makefile: add --unsafe to the self compilation of mcs.
12310 2002-02-20 Miguel de Icaza <miguel@ximian.com>
12312 * expression.cs (PointerArithmetic): New class that is used to
12313 perform pointer arithmetic.
12314 (Binary.Resolve): Handle pointer arithmetic
12315 Handle pointer comparission.
12316 (ArrayPtr): Utility expression class that is used to take the
12317 address of an array.
12319 (ElementAccess): Implement array access for pointers
12321 * statement.cs (Fixed): Implement fixed statement for arrays, we
12322 are missing one more case before we are done.
12324 * expression.cs (Indirection): Implement EmitAssign and set the
12325 ExprClass to Variable. This allows pointer dereferences to be
12326 treated as variables, and to have values assigned to them.
12328 * ecore.cs (Expression.StoreFromPtr): New utility function to
12329 store values dereferencing.
12331 2002-02-20 Ravi Pratap <ravi@ximian.com>
12333 * expression.cs (Binary.ResolveOperator): Ensure that we are
12334 not trying to operate on a void type - this fixes the reported
12337 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
12338 the parent implementation is sealed.
12340 * ../errors/cs0239.cs : Add.
12342 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
12344 * typemanager.cs (unverifiable_code_type): Corresponds to
12345 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
12346 which have unsafe code in them.
12348 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
12351 2002-02-19 Miguel de Icaza <miguel@ximian.com>
12353 * cs-tokenizer.cs: Add support for @"litreal strings"
12355 Make tokenizer accept pre-processor directives
12356 on any column (remove the old C-like limitation).
12358 * rootcontext.cs (EmitCode): Emit any global attributes.
12359 (AddGlobalAttributes): Used to keep track of assembly attributes.
12361 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
12363 * cs-parser.jay: Add support for global attributes.
12365 2002-02-17 Miguel de Icaza <miguel@ximian.com>
12367 * expression.cs (Indirection): New helper class. Unary will
12368 create Indirection classes to be able to implement the
12369 IMemoryLocation interface on it.
12371 2002-02-16 Miguel de Icaza <miguel@ximian.com>
12373 * cs-parser.jay (fixed_statement): reference the right statement.
12375 * statement.cs (Fixed.Emit): Finish implementing the fixed
12376 statement for the &x case.
12378 2002-02-14 Miguel de Icaza <miguel@ximian.com>
12380 * class.cs (Property.Define, Method.Define): Remove newslot when
12383 * modifiers.cs: My use of NewSlot when `Abstract' was set was
12384 wrong. NewSlot should only be used if the `new' keyword is present.
12386 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
12387 locating our system dir. Sorry about this.
12389 2002-02-13 Miguel de Icaza <miguel@ximian.com>
12391 * driver.cs (GetSystemDir): Compute correctly the location of our
12392 system assemblies. I was using the compiler directory instead of
12393 the library directory.
12395 2002-02-13 Ravi Pratap <ravi@ximian.com>
12397 * expression.cs (BetterFunction): Put back in what Miguel commented out
12398 since it is the correct fix. The problem is elsewhere ;-)
12400 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
12401 parameters of the parms method are themselves compatible or not !
12403 (StandardConversionExists): Fix very dangerous bug where we were forgetting
12404 to check that a class implements an interface before saying that an implicit
12405 conversion was allowed. Use ImplementsInterface to do the checking.
12407 2002-02-13 Miguel de Icaza <miguel@ximian.com>
12409 * class.cs (Method.Define): Track whether we are an explicit
12410 implementation or not. And only call DefineMethodOverride if we
12411 are an explicit implementation.
12413 (Property.DefineMethod): Ditto.
12415 2002-02-11 Ravi Pratap <ravi@ximian.com>
12417 * expression.cs (BetterFunction): Catch hideous bug which was
12418 preventing us from detecting ambiguous calls due to implicit casts i.e
12421 2002-01-29 Miguel de Icaza <miguel@ximian.com>
12423 * support.cs (Pair): Remove un-needed method. I figured why I was
12424 getting the error in cs-parser.jay, the variable in a foreach loop
12425 is readonly, and the compiler does not really treat this as a variable.
12427 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
12428 instead of EQUALS in grammar.
12430 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
12432 * expression.cs (Unary.DoResolve): Check whether the argument is
12435 2002-01-28 Miguel de Icaza <miguel@ximian.com>
12437 * support.cs: Api for Pair to set a value. Despite the fact that
12438 the variables are public the MS C# compiler refuses to compile
12439 code that accesses the field if the variable is part of a foreach
12442 * statement.cs (Fixed): Begin implementation of the fixed
12445 (Block.AddVariable): Return the VariableInfo on success and null
12446 on failure instead of true/false.
12448 * cs-parser.jay (foreach): Catch errors on variables already
12449 defined (we were ignoring this value before) and properly unwind
12450 the block hierarchy
12452 (fixed_statement): grammar for the fixed statement.
12454 2002-01-25 Miguel de Icaza <miguel@ximian.com>
12456 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
12457 pointer types to be incretemented.
12459 (SizeOf): Implement.
12461 * cs-parser.jay (pointer_member_access): Implement
12462 expr->IDENTIFIER production.
12464 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
12465 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
12468 (Unary): Implement indirection.
12470 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
12471 use in non-unsafe context).
12473 (SimpleName.DoResolve): Check for pointers in field access on safe
12476 (Expression.LoadFromPtr): Factor the load-indirect code in this
12477 function. This was duplicated in UnboxCast and ParameterReference
12479 2002-01-24 Miguel de Icaza <miguel@ximian.com>
12481 * expression.cs (ComposedCast): report an error if a pointer cast
12482 is used in a safe region.
12484 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
12485 pointer type casts in unsafe context.
12487 * codegen.cs (EmitContext): Set up IsUnsafe.
12489 * cs-parser.jay (non_expression_type): Add productions for pointer
12492 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
12493 code. We should not use force into static mode if the method is
12494 not virtual. Fixes bug in MIS
12496 * statement.cs (Do.Emit, While.Emit, For.Emit,
12497 Statement.EmitBoolExpression): Add support to Do and While to
12498 propagate infinite loop as `I do return' semantics.
12500 Improve the For case to also test for boolean constants.
12502 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
12503 to the list of attributes we can add.
12505 Remove `EmitContext' argument.
12507 * class.cs (Method.Define): Apply parameter attributes.
12508 (Constructor.Define): Apply parameter attributes.
12509 (MethodCore.LabelParameters): Move here the core of labeling
12512 * support.cs (ReflectionParameters.ParameterModifier,
12513 InternalParameters.ParameterModifier): Use IsByRef on the type and
12514 only return the OUT bit for these parameters instead of in/out/ref
12517 This is because I miss-understood things. The ParameterInfo.IsIn
12518 and IsOut represent whether the parameter has the [In] and [Out]
12521 2002-01-22 Miguel de Icaza <miguel@ximian.com>
12523 * ecore.cs (FieldExpr.Emit): Release temporaries.
12525 * assign.cs (LocalTemporary.Release): new function.
12527 * codegen.cs (EmitContext.GetTemporaryStorage,
12528 EmitContext.FreeTemporaryStorage): Rework the way we deal with
12529 temporary storage. Now we can "put back" localbuilders when we
12532 2002-01-21 Miguel de Icaza <miguel@ximian.com>
12534 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
12535 need to make a copy of the variable to generate verifiable code.
12537 2002-01-19 Miguel de Icaza <miguel@ximian.com>
12539 * driver.cs: Compute dynamically the system directory.
12541 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
12542 Slower, but more generally useful. Used by the abstract
12543 registering implementation.
12545 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
12546 the rules for the special rule on Type/instances. First check if
12547 we have the same name, and if so, try that special static path
12548 rather than the instance path.
12550 2002-01-18 Miguel de Icaza <miguel@ximian.com>
12552 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
12555 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
12556 Enum, ValueType, Delegate or Array for non-corlib compiles.
12558 * cs-tokenizer.cs: Catch long identifiers (645)
12560 * typemanager.cs (IndexerPropetyName): Ravi never tested this
12563 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
12564 fix, we were returning too early, so we were not registering
12565 pending methods from abstract classes.
12567 Do not register pending methods if the class is abstract.
12569 * expression.cs (Conditional.DoResolve): Report circular implicit
12570 conversions when we neecd to compute it for conditional
12573 (Is.DoResolve): If the expression is always of the provided type,
12574 flag warning 183. If the expression can not ever be of the
12575 provided type flag warning 184.
12577 * class.cs: Catch 169 as well.
12579 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
12582 2002-01-18 Nick Drochak <ndrochak@gol.com>
12584 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
12586 2002-01-17 Miguel de Icaza <miguel@ximian.com>
12588 * interface.cs: (PopulateMethod): Check for pointers being defined
12589 only if the unsafe context is active.
12590 (PopulateProperty): ditto.
12591 (PopulateIndexer): ditto.
12593 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
12594 specified. If pointers are present, make sure that they are
12595 present in an unsafe context.
12596 (Constructor, Constructor.Define): ditto.
12597 (Field, Field.Define): ditto.
12598 (Property, Property.Define): ditto.
12599 (Event, Event.Define): ditto.
12601 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
12602 hashtable if there are classes or structs defined.
12604 * expression.cs (LocalVariableReference.DoResolve): Simplify this
12605 code, as the constant resolution moved.
12607 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
12608 the metadata, so we can flag error 133.
12610 * decl.cs (MemberCore.UnsafeOK): New function to test that a
12611 pointer is being declared in an unsafe context.
12613 2002-01-16 Miguel de Icaza <miguel@ximian.com>
12615 * modifiers.cs (Modifiers.Check): Require a Location argument.
12616 Report error 227 for Unsafe use.
12618 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
12620 * statement.cs (For.Emit): If the test is null, then report that
12621 we do `return', as we wont reach anything afterwards.
12623 (Switch.SwitchGoverningType): Track the expression that matched
12626 * driver.cs: Allow negative numbers as an error code to flag.
12628 * cs-parser.jay: Handle 1551.
12630 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
12632 2002-01-15 Miguel de Icaza <miguel@ximian.com>
12634 * cs-parser.jay: Report 1518 (type declaration can only contain
12635 class, struct, interface, enum or delegate)
12637 (switch_label): Report 1523 (keywords `case' or `default' must
12640 (opt_switch_sections): Report 1522 (empty switch)
12642 * driver.cs: Report 1515 (response file specified multiple times)
12643 Report 1516 (Source file specified multiple times).
12645 * expression.cs (Argument.Resolve): Signal 1510
12647 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
12648 access not allowed in static code)
12650 2002-01-11 Ravi Pratap <ravi@ximian.com>
12652 * typemanager.cs (IsPointerType): Utility method which we are going
12655 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
12656 the object type, so we take care of that.
12658 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
12660 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
12661 added to non-params parameters :-)
12663 * typemanager.cs (CSharpName): Include 'void' type too.
12665 (void_ptr_type): Include in the set of core types.
12667 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
12670 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
12673 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
12674 completely forgotten about it.
12676 2002-01-10 Ravi Pratap <ravi@ximian.com>
12678 * cs-parser.jay (pointer_type): Add. This begins our implementation
12679 of parsing rules for unsafe code.
12681 (unsafe_statement): Implement.
12683 (embedded_statement): Modify to include the above.
12685 * statement.cs (Unsafe): Implement new class for unsafe blocks.
12687 * codegen.cs (EmitContext.InUnsafe): Add. This determines
12688 if the current context is an unsafe one.
12690 * cs-parser.jay (local_variable_pointer_type): Since local variable types
12691 are handled differently, we need separate rules for them.
12693 (local_variable_declaration): Update to use local_variable_pointer_type
12694 to allow variable declarations of unmanaged pointer types.
12696 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
12697 in unsafe contexts.
12699 * ../errors/cs0214.cs : Add.
12701 2002-01-16 Nick Drochak <ndrochak@gol.com>
12703 * makefile: remove 'response' file when cleaning.
12705 2002-01-15 Miguel de Icaza <miguel@ximian.com>
12707 * cs-parser.jay: Report 1524.
12709 2002-01-14 Miguel de Icaza <miguel@ximian.com>
12711 * typemanager.cs (RegisterMethod): drop checking if we have
12712 registered this from here
12714 2002-01-12 Miguel de Icaza <miguel@ximian.com>
12716 * class.cs (Method.EmitDestructor): Implement calling our base
12719 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
12720 value of InFinally.
12722 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
12723 this routine and will wrap the call in a try/catch block. Deal
12726 2002-01-11 Miguel de Icaza <miguel@ximian.com>
12728 * ecore.cs (Expression.MemberLookup): instead of taking a
12729 parameter `same_type' that was used to tell whether we could
12730 access private members we compute our containing type from the
12733 (FieldExpr): Added partial support for volatile fields. This does
12734 not work for volatile fields exposed from assemblies, as I can not
12735 figure out how to extract the modreq from it.
12737 Updated all the source files to use this.
12739 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
12740 because it is referenced by MemberLookup very often.
12742 2002-01-09 Ravi Pratap <ravi@ximian.com>
12744 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
12745 TypeBuilder.GetCustomAttributes to retrieve what we need.
12747 Get rid of redundant default_member_attr_type as this is the same as
12748 default_member_type which already exists.
12750 * interface.cs, attribute.cs : Update accordingly.
12752 2002-01-08 Miguel de Icaza <miguel@ximian.com>
12754 * typemanager.cs: Enable IndexerPropertyName again. It does not
12755 work for TYpeBuilders though. Ravi, can you please fix this?
12757 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
12759 * expression.cs (Argument.Emit): Handle the case of ref objects
12760 being passed to ref functions;
12762 (ParameterReference.EmitLoad): Loads the content of the pointer
12763 without dereferencing.
12765 2002-01-07 Miguel de Icaza <miguel@ximian.com>
12767 * cs-tokenizer.cs: Implemented the pre-processing expressions.
12769 2002-01-08 Ravi Pratap <ravi@ximian.com>
12771 * class.cs (Indexer.DefineMethod): Incorporate the interface
12772 type in the name of the method if we are doing explicit interface
12775 * expression.cs (ConversionExists): Remove as it is completely obsolete.
12777 (BetterConversion): Fix extremely trivial bug where we were referring to
12778 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
12781 * ../errors/bug16.cs : Add although we have fixed it.
12783 2002-01-07 Miguel de Icaza <miguel@ximian.com>
12785 * expression.cs (BaseIndexer): Begin implementation.
12787 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
12789 * cs-parser.jay (indexer_declarator): Use qualified_identifier
12790 production directly to remove a shift/reduce, and implement
12791 explicit interface implementation.
12793 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
12794 after a floating point suffix.
12796 * expression.cs (DoNumericPromotions): Improved the conversion for
12797 uint/uint. If we have a constant, we avoid doing a typecast to a
12800 * class.cs (Indexer): Implement explicit interface implementation
12803 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
12805 * class.cs: make the default instance constructor public and hidebysig.
12807 2001-01-03 Ravi Pratap <ravi@ximian.com>
12809 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
12810 so we can call it from elsewhere.
12812 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
12813 we emit it internally if the class has a defined indexer; otherwise the user
12814 emits it by decorating the class definition with the DefaultMemberAttribute.
12816 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
12817 attribute is not used on a type which defines an indexer.
12819 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
12820 character when we skip whitespace.
12822 * ../errors/cs0646.cs : Add.
12824 2002-01-03 Miguel de Icaza <miguel@ximian.com>
12826 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
12829 * makefile: Add practical target `mcs3.exe' which builds the third
12830 generation compiler.
12832 * expression.cs (New): Fix structures constructor calling.
12834 * class.cs (Property, Method, Indexer): Emit Final flag on the
12835 method if we are an interface implementation and we are not
12838 * ecore.cs (PropertyExpr): New public field `IsBase', tells
12839 whether this property is referencing a `base' method.
12841 * expression.cs (Invocation.EmitCall): take an extra argument:
12842 is_base, this is used to determine whether the `call' or
12843 `callvirt' opcode should be used.
12846 * delegate.cs: update EmitCall.
12848 * class.cs (Method.Define): Set NewSlot for the cases where we are
12849 not implementing an interface method.
12851 (Property.Define): ditto.
12853 2002-01-02 Miguel de Icaza <miguel@ximian.com>
12855 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
12856 'r'. Allows mcs to parse itself fully.
12858 2002-01-02 Ravi Pratap <ravi@ximian.com>
12860 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
12861 of the number of initializers that require the InitializeArray method.
12863 (CheckIndices): Store the Expression in all cases - not the plain value. Also
12864 update the above field where necessary.
12866 (MakeByteBlob): Update accordingly.
12868 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
12871 (EmitDynamicInitializers): Update in accordance with the new optimization.
12873 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
12874 same OpCode applies.
12876 * cs-parser.jay : Fix some glaring errors I introduced.
12878 2002-01-01 Ravi Pratap <ravi@ximian.com>
12880 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
12881 so that we can check for name clashes there too.
12883 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
12884 for interface indexers.
12886 * interfaces.cs (Define): Emit the default member attribute.
12888 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
12889 variable was being referred to while setting the value ;-)
12891 2002-01-01 Miguel de Icaza <miguel@ximian.com>
12893 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
12894 byte-by-byte information when we know the data is zero.
12896 Make the block always a multiple of 4, because
12897 DefineInitializedData has a bug.
12899 * assign.cs: Fix, we should assign from the temporary, not from
12902 * expression.cs (MakeByteBlob): Fix my incorrect code.
12904 2001-12-31 Miguel de Icaza <miguel@ximian.com>
12906 * typemanager.cs (EnumToUnderlying): This function is used to get
12907 the underlying type from an enumeration, because it does not
12910 * constant.cs: Use the I4_S form for values between -128 and 127.
12912 * statement.cs (Block.LookupLabel): Looks up a label.
12913 (Block): Drop support for labeled blocks.
12915 (LabeledStatement): New kind of statement that represents a label
12918 (Goto): Finally implement this bad boy.
12920 * cs-parser.jay: Update to reflect new mechanism to implement
12923 2001-12-30 Miguel de Icaza <miguel@ximian.com>
12925 * codegen.cs (EmitContext.This): a codegen property that keeps the
12926 a single instance of this instead of creating many different this
12929 * delegate.cs (Delegate.DoResolve): Update to use the property;
12931 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
12933 * expression.cs (BaseAccess.DoResolve): Ditto.
12935 2001-12-29 Ravi Pratap <ravi@ximian.com>
12937 * typemanager.cs (methodimpl_attr_type): Add to hold the type
12938 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
12940 (InitCoreTypes): Update accordingly.
12942 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
12943 so we can quickly store the state.
12945 (ApplyAttributes): Set the correct implementation flags
12946 for InternalCall methods.
12948 2001-12-29 Miguel de Icaza <miguel@ximian.com>
12950 * expression.cs (EmitCall): if a method is not virtual, then do
12951 not use callvirt on it.
12953 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
12954 user defined stuff) requires the use of stobj, which takes an
12955 address on the stack instead of an array and an index. So emit
12956 the Ldelema operation for it.
12958 (EmitStoreOpcode): Use stobj for valuetypes.
12960 (UnaryMutator.EmitCode): Use the right 1 value depending on
12961 whether we are dealing with int64/uint64, float or doubles.
12963 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
12964 constructors that I implemented last night.
12966 (Constructor.IsDefault): Fix to work properly for static
12969 * cs-parser.jay (CheckDef): report method signature errors.
12970 Update error number 103 to be 132.
12972 * decl.cs: New AdditionResult enumeration value: MethodExists.
12973 Although we do this check for methods later on in the semantic
12974 analysis, catching repeated default constructors is so easy that
12975 we catch these here.
12977 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
12980 (ParameterReference.EmitAssign, Emit): handle
12983 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
12984 (ArrayAccess.EmitStoreOpcode): ditto.
12986 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
12988 * expression.cs (MakeByteBlob): Complete all the missing types
12989 (uint, short, ushort, byte, sbyte)
12991 * class.cs: Only init instance field initializers on instance
12994 Rename `constructors' to instance_constructors.
12996 (TypeContainer.AddConstructor): Only add constructors to the list
12997 if it is not static.
12999 Make sure that we handle default_static_constructor independently
13000 everywhere where we handle instance_constructors
13002 2001-12-28 Miguel de Icaza <miguel@ximian.com>
13004 * class.cs: Do not lookup or create a base initializer for a
13005 static constructor.
13007 (ConstructorInitializer.Resolve): use the proper type to lookup
13010 * cs-parser.jay: Report error 1585 (modifiers between type and name).
13012 * enum.cs, interface.cs: Remove CloseType, this is taken care by
13015 * decl.cs: CloseType is now an virtual method, the default
13016 implementation just closes this type.
13018 2001-12-28 Ravi Pratap <ravi@ximian.com>
13020 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
13021 to PreserveSig by default. Also emit HideBySig on such methods.
13023 Basically, set the defaults to standard values.
13025 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
13026 argument, if candidate is better, it can't be worse than the best !
13028 (Invocation): Re-write bits to differentiate between methods being
13029 applicable in their expanded form and their normal form - for params
13032 Get rid of use_standard everywhere as only standard conversions are allowed
13033 in overload resolution.
13035 More spec conformance.
13037 2001-12-27 Miguel de Icaza <miguel@ximian.com>
13039 * driver.cs: Add --timestamp, to see where the compiler spends
13042 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
13043 `this' in static code.
13045 (SimpleName.DoResolve): Implement in terms of a helper function
13046 that allows static-references to be passed upstream to
13049 (Expression.ResolveWithSimpleName): Resolve specially simple
13050 names when called by MemberAccess to implement the special
13053 (Expression.ImplicitReferenceConversion): Handle conversions from
13054 Null to reference types before others, as Null's type is
13057 * expression.cs (Invocation.EmitCall): Handle the special case of
13058 calling methods declared on a reference type from a ValueType
13059 (Base classes System.Object and System.Enum)
13061 (MemberAccess.Resolve): Only perform lookups on Enumerations if
13062 the left hand side is a TypeExpr, not on every enumeration.
13064 (Binary.Resolve): If types are reference types, then do a cast to
13065 object on operators != and == of both arguments.
13067 * typemanager.cs (FindMembers): Extract instance and static
13068 members if requested.
13070 * interface.cs (PopulateProperty): Use void_type instead of null
13071 as the return type for the setter method.
13073 (PopulateIndexer): ditto.
13075 2001-12-27 Ravi Pratap <ravi@ximian.com>
13077 * support.cs (ReflectionParameters): Fix minor bug where we
13078 were examining the wrong parameter for the ParamArray attribute.
13080 Cope with requests for the type of the parameter at position
13081 greater than the params parameter's. We now return the element
13082 type of the params array as that makes more sense.
13084 * expression.cs (Invocation.IsParamsMethodApplicable): Update
13085 accordingly as we no longer have to extract the element type
13088 (Invocation.OverloadResolve): Update.
13090 2001-12-27 Miguel de Icaza <miguel@ximian.com>
13092 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
13093 against IEnumerator, test whether the return value is a descendant
13094 of the IEnumerator interface.
13096 * class.cs (Indexer.Define): Use an auxiliary method to implement
13097 the other bits of the method definition. Begin support for
13098 explicit interface implementation.
13100 (Property.DefineMethod): Use TypeManager.void_type instead of null
13101 for an empty return value.
13103 2001-12-26 Miguel de Icaza <miguel@ximian.com>
13105 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
13106 dealing with a FieldExpr which is composed of a FieldBuilder, in
13107 the code path we did extract the constant, but we should have
13108 obtained the underlying value to be able to cast it (otherwise we
13109 end up in an infinite loop, this is what Ravi was running into).
13111 (ArrayCreation.UpdateIndices): Arrays might be empty.
13113 (MemberAccess.ResolveMemberAccess): Add support for section
13114 14.5.4.1 that deals with the special case of E.I when E is a type
13115 and something else, that I can be a reference to a static member.
13117 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
13118 handle a particular array type to create byte blobs, it is just
13119 something we dont generate byteblobs for.
13121 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
13124 * location.cs (Push): remove the key from the hashtable that we
13125 are about to add. This happens for empty files.
13127 * driver.cs: Dispose files after we have parsed them.
13129 (tokenize): new function that only runs the tokenizer on its
13130 input, for speed testing.
13132 2001-12-26 Ravi Pratap <ravi@ximian.com>
13134 * class.cs (Event.Define): Define the private field only if there
13135 are no accessors defined.
13137 * expression.cs (ResolveMemberAccess): If there is no associated
13138 field with the event, that means we have an event defined with its
13139 own accessors and we should flag error cs0070 since transforming
13140 ourselves into a field is not valid in that case.
13142 * ecore.cs (SimpleName.DoResolve): Same as above.
13144 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
13145 and charset to sane values.
13147 2001-12-25 Ravi Pratap <ravi@ximian.com>
13149 * assign.cs (DoResolve): Perform check on events only if they
13150 are being accessed outside the declaring type.
13152 * cs-parser.jay (event_declarations): Update rules to correctly
13153 set the type of the implicit parameter etc.
13155 (add_accessor, remove_accessor): Set current local parameters.
13157 * expression.cs (Binary): For delegate addition and subtraction,
13158 cast the return value from the method into the appropriate delegate
13161 2001-12-24 Ravi Pratap <ravi@ximian.com>
13163 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
13164 of these as the workaround is unnecessary.
13166 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
13167 delegate data - none of that is needed at all.
13169 Re-write bits to extract the instance expression and the delegate method
13172 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
13175 * attribute.cs (ApplyAttributes): New method to take care of common tasks
13176 of attaching attributes instead of duplicating code everywhere.
13178 * everywhere : Update code to do attribute emission using the above method.
13180 2001-12-23 Miguel de Icaza <miguel@ximian.com>
13182 * expression.cs (IsParamsMethodApplicable): if there are not
13183 parameters, return immediately.
13185 * ecore.cs: The 0 literal can be implicity converted to an enum
13188 (SimpleName.DoResolve): First lookup the type, then lookup the
13191 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
13192 want to get its address. If the InstanceExpression is not
13193 addressable, store the result in a temporary variable, then get
13196 * codegen.cs: Only display 219 errors on warning level or above.
13198 * expression.cs (ArrayAccess): Make it implement the
13199 IMemoryLocation interface.
13201 (Binary.DoResolve): handle the operator == (object a, object b)
13202 and operator != (object a, object b) without incurring into a
13203 BoxedCast (because 5 != o should never be performed).
13205 Handle binary enumerator operators.
13207 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
13208 value type, otherwise use Ldelem_ref.
13210 Use precomputed names;
13212 (AddressOf): Implement address of
13214 * cs-parser.jay (labeled_statement): Fix recursive block
13215 addition by reworking the production.
13217 * expression.cs (New.DoEmit): New has a special case:
13219 If we are dealing with a ValueType, we have a few
13220 situations to deal with:
13222 * The target of New is a ValueType variable, that is
13223 easy, we just pass this as the variable reference
13225 * The target of New is being passed as an argument,
13226 to a boxing operation or a function that takes a
13229 In this case, we need to create a temporary variable
13230 that is the argument of New.
13233 2001-12-23 Ravi Pratap <ravi@ximian.com>
13235 * rootcontext.cs (LookupType): Check that current_type is not null before
13236 going about looking at nested types.
13238 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
13239 not implement the IAssignMethod interface any more.
13241 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
13242 where we tranform them into FieldExprs if they are being resolved from within
13243 the declaring type.
13245 * ecore.cs (SimpleName.DoResolve): Do the same here.
13247 * assign.cs (DoResolve, Emit): Clean up code considerably.
13249 * ../errors/bug10.cs : Add.
13251 * ../errors/cs0070.cs : Add.
13253 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
13255 * assign.cs : Get rid of EventIsLocal everywhere.
13257 2001-12-23 Miguel de Icaza <miguel@ximian.com>
13259 * ecore.cs (ConvertIntLiteral): finished the implementation.
13261 * statement.cs (SwitchLabel): Convert the value we are using as a
13262 key before looking up the table.
13264 2001-12-22 Miguel de Icaza <miguel@ximian.com>
13266 * codegen.cs (EmitTopBlock): Require a Location argument now.
13268 * cs-parser.jay (constructor_declarator): We need to setup
13269 current_local_parameters before we parse the
13270 opt_constructor_initializer, to allow the variables to be bound
13271 to the constructor arguments.
13273 * rootcontext.cs (LookupType): First lookup nested classes in our
13274 class and our parents before we go looking outside our class.
13276 * expression.cs (ConstantFold): Extract/debox the values at the
13279 * rootcontext.cs (EmitCode): Resolve the constants first before we
13280 resolve the types. This is not really needed, but it helps debugging.
13282 * statement.cs: report location.
13284 * cs-parser.jay: pass location to throw statement.
13286 * driver.cs: Small bug fix.
13288 * report.cs: Updated format to be 4-zero filled digits.
13290 2001-12-22 Ravi Pratap <ravi@ximian.com>
13292 * expression.cs (CheckIndices): Fix minor bug where the wrong
13293 variable was being referred to ;-)
13295 (DoEmit): Do not call EmitStaticInitializers when the
13296 underlying type is System.Object.
13298 2001-12-21 Ravi Pratap <ravi@ximian.com>
13300 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
13301 and do the usual workaround for SRE.
13303 * class.cs (MyEventBuilder.EventType): New member to get at the type
13304 of the event, quickly.
13306 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
13308 * assign.cs (Assign.DoResolve): Handle the case when the target
13309 is an EventExpr and perform the necessary checks.
13311 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
13314 (SimpleName.MemberStaticCheck): Include check for EventExpr.
13316 (EventExpr): Set the type in the constructor itself since we
13317 are meant to be born fully resolved.
13319 (EventExpr.Define): Revert code I wrote earlier.
13321 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
13322 instance expression is null. The instance expression is a This in that case
13323 or a null, depending on whether it is a static method or not.
13325 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
13326 refers to more than one method.
13328 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
13329 and accordingly flag errors.
13331 2001-12-21 Miguel de Icaza <miguel@ximian.com>
13333 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
13335 2001-12-22 Miguel de Icaza <miguel@ximian.com>
13337 * location.cs (ToString): Provide useful rutine.
13339 2001-12-21 Miguel de Icaza <miguel@ximian.com>
13341 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
13342 objects, return the actual integral boxed.
13344 * statement.cs (SwitchLabel): define an ILLabel for each
13347 (Switch.CheckSwitch): If the value is a Literal, extract
13348 the underlying literal.
13350 Also in the unused hashtable we had, add the SwitchLabel so we can
13351 quickly look this value up.
13353 * constant.cs: Implement a bunch of new constants. Rewrite
13354 Literal based on this. Made changes everywhere to adapt to this.
13356 * expression.cs (Expression.MakeByteBlob): Optimize routine by
13357 dereferencing array only once, and also copes with enumrations.
13359 bytes are two bytes wide, not one.
13361 (Cast): Perform constant conversions.
13363 * ecore.cs (TryImplicitIntConversion): Return literals instead of
13364 wrappers to the literals here.
13366 * expression.cs (DoNumericPromotions): long literals can converted
13367 to ulong implicity (this is taken care of elsewhere, but I was
13368 missing this spot).
13370 * ecore.cs (Expression.Literalize): Make the return type Literal,
13371 to improve type checking.
13373 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
13375 2001-12-20 Miguel de Icaza <miguel@ximian.com>
13377 * literal.cs: Revert code from ravi that checked the bounds. The
13378 bounds are sane by the definition of the type itself.
13380 * typemanager.cs: Fix implementation of ImplementsInterface. We
13381 need to actually look up in our parent hierarchy for interfaces
13384 * const.cs: Use the underlying type for enumerations
13386 * delegate.cs: Compute the basename for the delegate creation,
13387 that should fix the delegate test case, and restore the correct
13388 Type Lookup semantics in rootcontext
13390 * rootcontext.cs: Revert Ravi's last patch. The correct way of
13391 referencing a nested type with the Reflection API is using the "+"
13394 * cs-parser.jay: Do not require EOF token at the end.
13396 2001-12-20 Ravi Pratap <ravi@ximian.com>
13398 * rootcontext.cs (LookupType): Concatenate type names with
13399 a '.' instead of a '+' The test suite passes again.
13401 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
13402 field of the enumeration.
13404 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
13405 the case when the member is an EventExpr.
13407 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
13408 static has an associated instance expression.
13410 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
13412 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
13414 * class.cs (Event.Define): Register event and perform appropriate checks
13417 We define the Add and Remove methods even if the use provides none because
13418 in that case, we provide default implementations ourselves.
13420 Define a private field of the type of the event. This is done by the CSC compiler
13421 and we should be doing it too ;-)
13423 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
13424 More methods we use in code we generate.
13426 (multicast_delegate_type, delegate_type): Two separate types since the distinction
13429 (InitCoreTypes): Update accordingly for the above.
13431 * class.cs (Event.Emit): Generate code for default accessors that we provide
13433 (EmitDefaultMethod): Do the job in the above.
13435 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
13438 2001-12-20 Miguel de Icaza <miguel@ximian.com>
13440 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
13441 builders even if we were missing one.
13443 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
13444 pass the Basename as our class name instead of the Name. The
13445 basename will be correctly composed for us.
13447 * parameter.cs (Paramters): Now takes a Location argument.
13449 * decl.cs (DeclSpace.LookupType): Removed convenience function and
13450 make all the code call directly LookupType in RootContext and take
13451 this chance to pass the Location information everywhere.
13453 * Everywhere: pass Location information.
13455 2001-12-19 Miguel de Icaza <miguel@ximian.com>
13457 * class.cs (Constructor.Define): Updated way of detecting the
13458 length of the parameters.
13460 (TypeContainer.DefineType): Use basename as the type name for
13463 (TypeContainer.Define): Do not recursively define types here, as
13464 definition is taken care in order by the RootContext.
13466 * tree.cs: Keep track of namespaces in a per-file basis.
13468 * parameter.cs (Parameter.ComputeSignature): Update to use
13471 (Parameters.GetSignature): ditto.
13473 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
13474 instead of a TypeContainer.
13476 (Interface.SemanticAnalysis): Use `this' instead of our parent to
13477 resolve names. Because we need to be resolve in our context, not
13480 * driver.cs: Implement response files.
13482 * class.cs (TypeContainer.DefineType): If we are defined, do not
13483 redefine ourselves.
13485 (Event.Emit): Emit the code for add/remove handlers.
13486 (Event.Define): Save the MethodBuilders for add/remove.
13488 * typemanager.cs: Use pair here too.
13490 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
13491 DictionaryEntry requires the first argument to be non-null.
13493 (enum_declaration): Compute full name for registering the
13496 (delegate_declaration): Instead of using
13497 formal_parameter_list, use opt_formal_parameter_list as the list
13500 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
13501 (EventParsing): New property that controls whether `add' and
13502 `remove' are returned as tokens or identifiers (for events);
13504 2001-12-19 Ravi Pratap <ravi@ximian.com>
13506 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
13507 use MyEventBuilder only and let it wrap the real builder for us.
13509 (MyEventBuilder): Revamp constructor etc.
13511 Implement all operations that we perform on EventBuilder in precisely the same
13514 (FindMembers): Update to use the EventBuilder member.
13516 (Event.Emit): Update accordingly.
13518 2001-12-18 Ravi Pratap <ravi@ximian.com>
13520 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
13521 by calling the appropriate methods.
13523 (GetCustomAttributes): Make stubs as they cannot possibly do anything
13526 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
13528 2001-12-17 Ravi Pratap <ravi@ximian.com>
13530 * delegate.cs (Delegate.Populate): Check that the return type
13531 and various parameters types are indeed accessible.
13533 * class.cs (Constructor.Define): Same here.
13535 (Field.Define): Ditto.
13537 (Event.Define): Ditto.
13539 (Operator.Define): Check that the underlying Method defined itself
13540 correctly - so it's MethodBuilder should not be null.
13542 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
13543 expression happens to be null.
13545 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
13546 members but as of now we don't seem to be able to do anything really useful with it.
13548 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
13549 not the EventBuilder.
13551 2001-12-18 Miguel de Icaza <miguel@ximian.com>
13553 * cs-tokenizer.cs: Add support for defines.
13554 Add support for #if, #elif, #else, #endif
13556 (eval_var): evaluates a variable.
13557 (eval): stubbed for evaluating functions.
13559 * cs-parser.jay: Pass the defines information
13561 * driver.cs: Add --define command line option.
13563 * decl.cs: Move MemberCore here.
13565 Make it the base class for DeclSpace. This allows us to catch and
13566 report 108 and 109 for everything now.
13568 * class.cs (TypeContainer.Define): Extract all the members
13569 before populating and emit the warning 108 (new keyword required
13570 to override) instead of having each member implement this.
13572 (MemberCore.Define): New abstract method, we will be using this in
13573 the warning reporting engine in Populate.
13575 (Operator.Define): Adjust to new MemberCore protocol.
13577 * const.cs (Const): This does not derive from Expression, it is a
13578 temporary object we use to create fields, it is a MemberCore.
13580 * class.cs (Method.Define): Allow the entry point to be in a
13583 * driver.cs: Rewrite the argument handler to clean it up a bit.
13585 * rootcontext.cs: Made it just an auxiliary namespace feature by
13586 making everything static.
13588 * driver.cs: Adapt code to use RootContext type name instead of
13591 * delegate.cs: Remove RootContext argument.
13593 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
13596 * class.cs (Event.Define): The lookup can fail.
13598 * cs-tokenizer.cs: Begin implementation of pre-procesor.
13600 * expression.cs: Resolve the this instance before invoking the code.
13602 2001-12-17 Miguel de Icaza <miguel@ximian.com>
13604 * cs-parser.jay: Add a production in element_access that allows
13605 the thing to become a "type" reference. This way we can parse
13606 things like "(string [])" as a type.
13608 Note that this still does not handle the more complex rules of
13612 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
13614 * ecore.cs: (CopyNewMethods): new utility function used to
13615 assemble the list of methods from running FindMembers.
13617 (MemberLookup): Rework FindMembers so that
13619 2001-12-16 Miguel de Icaza <miguel@ximian.com>
13621 * class.cs (TypeContainer): Remove Delegates who fail to be
13624 * delegate.cs (Populate): Verify that we dont get null return
13625 values. TODO: Check for AsAccessible.
13627 * cs-parser.jay: Use basename to emit error 574 (destructor should
13628 have the same name as container class), not the full name.
13630 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
13631 possible representation.
13633 Also implements integer type suffixes U and L.
13635 2001-12-15 Miguel de Icaza <miguel@ximian.com>
13637 * expression.cs (ArrayCreation.DoResolve): We need to do the
13638 argument resolution *always*.
13640 * decl.cs: Make this hold the namespace. Hold the root context as
13642 (LookupType): Move here.
13644 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
13646 * location.cs (Row, Name): Fixed the code, it was always returning
13647 references to the first file.
13649 * interface.cs: Register properties defined through interfaces.
13651 * driver.cs: Add support for globbing on the command line
13653 * class.cs (Field): Make it derive from MemberCore as well.
13656 2001-12-15 Ravi Pratap <ravi@ximian.com>
13658 * class.cs (Event::Define): Check that the type of the event is a delegate
13659 type else flag error #66.
13661 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
13664 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
13665 values of EntryPoint, CharSet etc etc.
13667 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
13669 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
13670 be null and we should ignore this. I am not sure if this is really clean. Apparently,
13671 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
13672 which needs this to do its work.
13674 * ../errors/cs0066.cs : Add.
13676 2001-12-14 Miguel de Icaza <miguel@ximian.com>
13678 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
13681 * class.cs: (MethodSignature.MethodSignature): Removed hack that
13682 clears out the parameters field.
13683 (MemberSignatureCompare): Cleanup
13685 (MemberCore): New base class used to share code between MethodCore
13688 (RegisterRequiredImplementations) BindingFlags.Public requires
13689 either BindingFlags.Instace or Static. Use instance here.
13691 (Property): Refactored code to cope better with the full spec.
13693 * parameter.cs (GetParameterInfo): Return an empty array instead
13696 * class.cs (Property): Abstract or extern properties have no bodies.
13698 * parameter.cs (GetParameterInfo): return a zero-sized array.
13700 * class.cs (TypeContainer.MethodModifiersValid): Move all the
13701 method modifier validation to the typecontainer so we can reuse
13702 this on properties.
13704 (MethodCore.ParameterTypes): return an empty sized array of types.
13706 (Property.Define): Test property modifier validity.
13708 Add tests for sealed/override too.
13710 (Method.Emit): abstract or extern methods have no bodies.
13712 2001-12-14 Ravi Pratap <ravi@ximian.com>
13714 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
13717 (Method::Define, ::Emit): Modify accordingly.
13719 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
13721 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
13723 * makefile: Pass in /unsafe.
13725 2001-12-13 Miguel de Icaza <miguel@ximian.com>
13727 * class.cs (MakeKey): Kill routine.
13729 * class.cs (TypeContainer.Define): Correctly define explicit
13730 method implementations (they require the full interface name plus
13733 * typemanager.cs: Deply the PtrHashtable here and stop using the
13734 lame keys. Things work so much better.
13736 This of course broke everyone who depended on `RegisterMethod' to
13737 do the `test for existance' test. This has to be done elsewhere.
13739 * support.cs (PtrHashtable): A hashtable that avoid comparing with
13740 the object stupid Equals method (because, that like fails all over
13741 the place). We still do not use it.
13743 * class.cs (TypeContainer.SetRequiredInterface,
13744 TypeContainer.RequireMethods): Killed these two routines and moved
13745 all the functionality to RegisterRequiredImplementations.
13747 (TypeContainer.RegisterRequiredImplementations): This routine now
13748 registers all the implementations required in an array for the
13749 interfaces and abstract methods. We use an array of structures
13750 which can be computed ahead of time to reduce memory usage and we
13751 also assume that lookups are cheap as most classes will not
13752 implement too many interfaces.
13754 We also avoid creating too many MethodSignatures.
13756 (TypeContainer.IsInterfaceMethod): Update and optionally does not
13757 clear the "pending" bit if we find that there are problems with
13760 (TypeContainer.VerifyPendingMethods): Update to report errors of
13761 methods that look like implementations but are not.
13763 (TypeContainer.Define): Add support for explicit interface method
13766 2001-12-12 Miguel de Icaza <miguel@ximian.com>
13768 * typemanager.cs: Keep track of the parameters here instead of
13769 being a feature of the TypeContainer.
13771 * class.cs: Drop the registration of parameters here, as
13772 InterfaceMethods are also interface declarations.
13774 * delegate.cs: Register methods with the TypeManager not only with
13775 the TypeContainer. This code was buggy.
13777 * interface.cs: Full registation here.
13779 2001-12-11 Miguel de Icaza <miguel@ximian.com>
13781 * expression.cs: Remove reducer for binary expressions, it can not
13784 * const.cs: Put here the code that used to go into constant.cs
13786 * constant.cs: Put here the code for constants, this is a new base
13787 class for Literals.
13789 * literal.cs: Make Literal derive from Constant.
13791 2001-12-09 Miguel de Icaza <miguel@ximian.com>
13793 * statement.cs (Return.Emit): Report error 157 if the user
13794 attempts to return from a finally block.
13796 (Return.Emit): Instead of emitting a return, jump to the end of
13799 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
13800 LocalBuilder to store the result of the function. ReturnLabel is
13801 the target where we jump.
13804 2001-12-09 Radek Doulik <rodo@ximian.com>
13806 * cs-parser.jay: remember alias in current namespace
13808 * ecore.cs (SimpleName::DoResolve): use aliases for types or
13811 * class.cs (LookupAlias): lookup alias in my_namespace
13813 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
13815 (LookupAlias): lookup alias in this and if needed in parent
13818 2001-12-08 Miguel de Icaza <miguel@ximian.com>
13822 * rootcontext.cs: (ModuleBuilder) Made static, first step into
13823 making things static. I need this to avoid passing the
13824 TypeContainer when calling ParameterType.
13826 * support.cs (InternalParameters.ParameterType): Remove ugly hack
13827 that did string manipulation to compute the type and then call
13828 GetType. Use Parameter.ParameterType instead.
13830 * cs-tokenizer.cs: Consume the suffix for floating values.
13832 * expression.cs (ParameterReference): figure out whether this is a
13833 reference parameter or not. Kill an extra variable by computing
13834 the arg_idx during emission.
13836 * parameter.cs (Parameters.GetParameterInfo): New overloaded
13837 function that returns whether a parameter is an out/ref value or not.
13839 (Parameter.ParameterType): The type of the parameter (base,
13840 without ref/out applied).
13842 (Parameter.Resolve): Perform resolution here.
13843 (Parameter.ExternalType): The full type (with ref/out applied).
13845 * statement.cs (Using.Emit, Using.EmitExpression): Implement
13846 support for expressions on the using statement.
13848 2001-12-07 Miguel de Icaza <miguel@ximian.com>
13850 * statement.cs (Using.EmitLocalVariableDecls): Split the
13851 localvariable handling of the using statement.
13853 (Block.EmitMeta): Keep track of variable count across blocks. We
13854 were reusing slots on separate branches of blocks.
13856 (Try.Emit): Emit the general code block, we were not emitting it.
13858 Check the type of the declaration to be an IDisposable or
13859 something that can be implicity converted to it.
13861 Emit conversions if required.
13863 * ecore.cs (EmptyExpression): New utility class.
13864 (Expression.ImplicitConversionExists): New utility function.
13866 2001-12-06 Miguel de Icaza <miguel@ximian.com>
13868 * statement.cs (Using): Implement.
13870 * expression.cs (LocalVariableReference): Support read only variables.
13872 * statement.cs: Remove the explicit emit for the Leave opcode.
13873 (VariableInfo): Add a readonly field.
13875 2001-12-05 Miguel de Icaza <miguel@ximian.com>
13877 * ecore.cs (ConvCast): new class used to encapsulate the various
13878 explicit integer conversions that works in both checked and
13879 unchecked contexts.
13881 (Expression.ConvertNumericExplicit): Use new ConvCast class to
13882 properly generate the overflow opcodes.
13884 2001-12-04 Miguel de Icaza <miguel@ximian.com>
13886 * statement.cs: The correct type for the EmptyExpression is the
13887 element_type, not the variable type. Ravi pointed this out.
13889 2001-12-04 Ravi Pratap <ravi@ximian.com>
13891 * class.cs (Method::Define): Handle PInvoke methods specially
13892 by using DefinePInvokeMethod instead of the usual one.
13894 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
13895 above to do the task of extracting information and defining the method.
13897 2001-12-04 Ravi Pratap <ravi@ximian.com>
13899 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
13900 of the condition for string type.
13902 (Emit): Move that here.
13904 (ArrayCreation::CheckIndices): Keep string literals in their expression
13907 (EmitDynamicInitializers): Handle strings appropriately.
13909 2001-12-04 Miguel de Icaza <miguel@ximian.com>
13911 * codegen.cs (EmitContext): Replace multiple variables with a
13912 single pointer to the current Switch statement.
13914 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
13917 2001-12-03 Miguel de Icaza <miguel@ximian.com>
13921 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
13924 (Foreach.Emit): Foreach on arrays was not setting
13925 up the loop variables (for break/continue).
13927 (GotoCase): Semi-implented.
13929 2001-12-03 Ravi Pratap <ravi@ximian.com>
13931 * attribute.cs (CheckAttribute): Handle system attributes by using
13932 Attribute.GetAttributes to examine information we need.
13934 (GetValidPlaces): Same here.
13936 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
13938 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
13940 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
13942 (Method::Define): Set appropriate flags if we have a DllImport attribute.
13944 (Method::Emit): Handle the case when we are a PInvoke method.
13946 2001-12-03 Miguel de Icaza <miguel@ximian.com>
13948 * expression.cs: Use ResolveWithSimpleName on compound names.
13950 2001-12-02 Ravi Pratap <ravi@ximian.com>
13952 * constant.cs (EmitConstant): Make sure we resolve the associated expression
13953 before trying to reduce it.
13955 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
13957 * constant.cs (LookupConstantValue): Implement.
13959 (EmitConstant): Use the above in emitting the constant.
13961 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
13962 that are user-defined by doing a LookupConstantValue on them.
13964 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
13967 2001-11-29 Miguel de Icaza <miguel@ximian.com>
13969 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
13971 (BaseAccess.DoResolve): Implement.
13973 (MemberAccess.DoResolve): Split this routine into a
13974 ResolveMemberAccess routine that can be used independently
13976 2001-11-28 Miguel de Icaza <miguel@ximian.com>
13978 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
13979 As that share bits of the implementation. Is returns a boolean,
13980 while As returns the Type that is being probed.
13982 2001-12-01 Ravi Pratap <ravi@ximian.com>
13984 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
13985 instead of a Literal - much easier.
13987 (EnumInTransit): Remove - utterly useless :-)
13989 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
13991 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
13993 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
13994 chain when we have no associated expression.
13996 2001-11-30 Ravi Pratap <ravi@ximian.com>
13998 * constant.cs (Define): Use Location while reporting the errror.
14000 Also emit a warning when 'new' is used and there is no inherited
14003 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
14006 (LookupEnumValue): Implement to lookup an enum member's value and define it
14009 (Populate): Re-write accordingly to use the above routine.
14011 2001-11-27 Miguel de Icaza <miguel@ximian.com>
14013 * expression.cs (This): Fix prototype for DoResolveLValue to
14014 override the base class DoResolveLValue.
14016 * cs-parser.cs: Report errors cs574 and cs575 (destructor
14019 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
14020 (we need to load the address of the field here). This fixes
14023 (FieldExpr.DoResolveLValue): Call the DoResolve
14024 function to initialize the Instance expression.
14026 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
14027 correctly the GetEnumerator operation on a value type.
14029 * cs-parser.jay: Add more simple parsing error catches.
14031 * statement.cs (Switch): Add support for string switches.
14032 Handle null specially.
14034 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
14036 2001-11-28 Ravi Pratap <ravi@ximian.com>
14038 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
14040 (declare_local_constant): New helper function.
14042 * statement.cs (AddConstant): Keep a separate record of constants
14044 (IsConstant): Implement to determine if a variable is a constant.
14046 (GetConstantExpression): Implement.
14048 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
14050 * statement.cs (IsVariableDefined): Re-write.
14052 2001-11-27 Ravi Pratap <ravi@ximian.com>
14054 * class.cs (TypeContainer::FindMembers): Look for constants
14055 in the case when we are looking for MemberTypes.Field
14057 * expression.cs (MemberAccess::DoResolve): Check that in the
14058 case we are a FieldExpr and a Literal, we are not being accessed
14059 by an instance reference.
14061 * cs-parser.jay (local_constant_declaration): Implement.
14063 (declaration_statement): Implement for constant declarations.
14065 2001-11-26 Miguel de Icaza <miguel@ximian.com>
14067 * statement.cs (Switch): Catch double defaults.
14069 (Switch): More work on the switch() statement
14070 implementation. It works for integral values now, need to finish
14074 2001-11-24 Miguel de Icaza <miguel@ximian.com>
14076 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
14077 integer literals into other integer literals. To be used by
14080 2001-11-24 Ravi Pratap <ravi@ximian.com>
14082 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
14085 (EmitDynamicInitializers): Cope with the above since we extract data
14086 directly from ArrayData now.
14088 (ExpectInitializers): Keep track of whether initializers are mandatory
14091 (Bounds): Make it a hashtable to prevent the same dimension being
14092 recorded for every element in that dimension.
14094 (EmitDynamicInitializers): Fix bug which prevented the Set array method
14097 Also fix bug which was causing the indices to be emitted in the reverse
14100 2001-11-24 Miguel de Icaza <miguel@ximian.com>
14102 * expression.cs (ArrayCreation): Implement the bits that Ravi left
14103 unfinished. They do not work, because the underlying code is
14106 2001-11-22 Miguel de Icaza <miguel@ximian.com>
14108 * cs-parser.jay: Remove bogus fixme.
14110 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
14111 on Switch statement.
14113 2001-11-23 Ravi Pratap <ravi@ximian.com>
14115 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
14118 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
14119 parameter. Apparently, any expression is allowed.
14121 (ValidateInitializers): Update accordingly.
14123 (CheckIndices): Fix some tricky bugs thanks to recursion.
14125 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
14126 I was being completely brain-dead.
14128 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
14129 and re-write acordingly.
14131 (DelegateInvocation): Re-write accordingly.
14133 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
14135 (MakeByteBlob): Handle types more correctly.
14137 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
14138 initialization from expressions but it is incomplete because I am a complete
14141 2001-11-22 Miguel de Icaza <miguel@ximian.com>
14143 * statement.cs (If.Emit): Fix a bug that generated incorrect code
14144 on If. Basically, we have to return `true' (ie, we do return to
14145 our caller) only if both branches of the if return.
14147 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
14148 short-circuit operators, handle them as short circuit operators.
14150 (Cast.DoResolve): Resolve type.
14151 (Cast.Cast): Take an expression as the target type.
14153 * cs-parser.jay (cast_expression): Remove old hack that only
14154 allowed a limited set of types to be handled. Now we take a
14155 unary_expression and we resolve to a type during semantic
14158 Use the grammar productions from Rhys to handle casts (this is
14159 not complete like Rhys syntax yet, we fail to handle that corner
14160 case that C# has regarding (-x), but we will get there.
14162 2001-11-22 Ravi Pratap <ravi@ximian.com>
14164 * class.cs (EmitFieldInitializer): Take care of the case when we have a
14165 field which is an array type.
14167 * cs-parser.jay (declare_local_variables): Support array initialization too.
14169 * typemanager.cs (MakeKey): Implement.
14171 (everywhere): Use the above appropriately.
14173 * cs-parser.jay (for_statement): Update for array initialization while
14174 declaring variables.
14176 * ecore.cs : The error message was correct, it's the variable's names that
14177 were misleading ;-) Make the code more readable.
14179 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
14180 the correct type etc.
14182 (ConvertExplicit): Handle Enum types by examining the underlying type.
14184 2001-11-21 Ravi Pratap <ravi@ximian.com>
14186 * parameter.cs (GetCallingConvention): Always return
14187 CallingConventions.Standard for now.
14189 2001-11-22 Miguel de Icaza <miguel@ximian.com>
14191 * expression.cs (Binary.ResolveOperator): Update the values of `l'
14192 and `r' after calling DoNumericPromotions.
14194 * ecore.cs: Fix error message (the types were in the wrong order).
14196 * statement.cs (Foreach.ProbeCollectionType): Need to pass
14197 BindingFlags.Instance as well
14199 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
14200 implicit int literal conversion in an empty cast so that we
14201 propagate the right type upstream.
14203 (UnboxCast): new class used to unbox value types.
14204 (Expression.ConvertExplicit): Add explicit type conversions done
14207 (Expression.ImplicitNumericConversion): Oops, forgot to test for
14208 the target type before applying the implicit LongLiterals to ULong
14211 2001-11-21 Miguel de Icaza <miguel@ximian.com>
14213 * cs-parser.jay (for_statement): Reworked the way For works: now
14214 we declare manually any variables that are introduced in
14215 for_initializer to solve the problem of having out-of-band code
14216 emition (that is what got for broken).
14218 (declaration_statement): Perform the actual variable declaration
14219 that used to be done in local_variable_declaration here.
14221 (local_variable_declaration): Do not declare anything, just pass
14222 the information on a DictionaryEntry
14224 2001-11-20 Ravi Pratap <ravi@ximian.com>
14226 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
14227 re-write of the logic to now make it recursive.
14229 (UpdateIndices): Re-write accordingly.
14231 Store element data in a separate ArrayData list in the above methods.
14233 (MakeByteBlob): Implement to dump the array data into a byte array.
14235 2001-11-19 Ravi Pratap <ravi@ximian.com>
14237 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
14240 * constant.cs (Define): Implement.
14242 (EmitConstant): Re-write fully.
14244 Pass in location info.
14246 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
14249 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
14250 DictionaryEntry since we need location info too.
14252 (constant_declaration): Update accordingly.
14254 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
14255 code into another method : UpdateIndices.
14257 2001-11-18 Ravi Pratap <ravi@ximian.com>
14259 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
14260 some type checking etc.
14262 2001-11-17 Ravi Pratap <ravi@ximian.com>
14264 * expression.cs (ArrayCreation::ValidateInitializers): Implement
14265 bits to provide dimension info if the user skips doing that.
14267 Update second constructor to store the rank correctly.
14269 2001-11-16 Ravi Pratap <ravi@ximian.com>
14271 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
14272 and try to implement.
14274 * ../errors/cs0150.cs : Add.
14276 * ../errors/cs0178.cs : Add.
14278 2001-11-16 Miguel de Icaza <miguel@ximian.com>
14280 * statement.cs: Implement foreach on multi-dimensional arrays.
14282 * parameter.cs (Parameters.GetParameterByName): Also lookup the
14283 name of the params argument.
14285 * expression.cs: Use EmitStoreOpcode to get the right opcode while
14286 initializing the array.
14288 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
14289 we can use this elsewhere.
14291 * statement.cs: Finish implementation of foreach for single
14294 * cs-parser.jay: Use an out-of-band stack to pass information
14295 around, I wonder why I need this.
14297 foreach_block: Make the new foreach_block the current_block.
14299 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
14300 function used to return a static Parameters structure. Used for
14301 empty parameters, as those are created very frequently.
14303 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
14305 2001-11-15 Ravi Pratap <ravi@ximian.com>
14307 * interface.cs : Default modifier is private, not public. The
14308 make verify test passes again.
14310 2001-11-15 Ravi Pratap <ravi@ximian.com>
14312 * support.cs (ReflectionParameters): Fix logic to determine
14313 whether the last parameter is a params one. Test 9 passes again.
14315 * delegate.cs (Populate): Register the builders we define with
14316 RegisterParameterForBuilder. Test 19 passes again.
14318 * cs-parser.jay (property_declaration): Reference $6 instead
14319 of $$ to get at the location.
14321 (indexer_declaration): Similar stuff.
14323 (attribute): Ditto.
14325 * class.cs (Property): Register parameters for the Get and Set methods
14326 if they exist. Test 23 passes again.
14328 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
14329 call to EmitArguments as we are sure there aren't any params arguments.
14330 Test 32 passes again.
14332 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
14333 IndexOutOfRangeException.
14335 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
14336 Test 33 now passes again.
14338 2001-11-15 Miguel de Icaza <miguel@ximian.com>
14340 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
14341 broke a bunch of things. Will have to come up with a better way
14342 of tracking locations.
14344 * statement.cs: Implemented foreach for single dimension arrays.
14346 2001-11-09 Miguel de Icaza <miguel@ximian.com>
14348 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
14349 an error. This removes the lookup from the critical path.
14351 * cs-parser.jay: Removed use of temporary_loc, which is completely
14354 2001-11-14 Miguel de Icaza <miguel@ximian.com>
14356 * support.cs (ReflectionParameters.ParameterModifier): Report
14357 whether the argument is a PARAMS argument or not.
14359 * class.cs: Set the attribute `ParamArrayAttribute' on the
14360 parameter argument.
14362 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
14363 and cons_param_array_attribute (ConstructorInfo for
14364 ParamArrayAttribute).,
14366 * codegen.cs: Emit the return using the `Return' statement, that
14367 way we can report the error correctly for missing return values.
14369 * class.cs (Method.Emit): Clean up.
14371 * expression.cs (Argument.Resolve): Take another argument: the
14372 location where this argument is used. Notice that this is not
14373 part of the "Argument" class as to reduce the size of the
14374 structure (we know the approximate location anyways).
14376 Test if the argument is a variable-reference, if not, then
14377 complain with a 206.
14379 (Argument.Emit): Emit addresses of variables.
14381 (Argument.FullDesc): Simplify.
14383 (Invocation.DoResolve): Update for Argument.Resolve.
14385 (ElementAccess.DoResolve): ditto.
14387 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
14388 method should be virtual, as this method is always virtual.
14390 (NewDelegate.DoResolve): Update for Argument.Resolve.
14392 * class.cs (ConstructorInitializer.DoResolve): ditto.
14394 * attribute.cs (Attribute.Resolve): ditto.
14396 2001-11-13 Miguel de Icaza <miguel@ximian.com>
14398 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
14400 * expression.cs (ParameterReference): Drop IStackStorage and implement
14401 IAssignMethod instead.
14403 (LocalVariableReference): ditto.
14405 * ecore.cs (FieldExpr): Drop IStackStorage and implement
14406 IAssignMethod instead.
14408 2001-11-13 Miguel de Icaza <miguel@ximian.com>
14410 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
14411 enumerations that are used in heavily used structures derive from
14412 byte in a laughable and pathetic attempt to reduce memory usage.
14413 This is the kind of pre-optimzations that you should not do at
14414 home without adult supervision.
14416 * expression.cs (UnaryMutator): New class, used to handle ++ and
14417 -- separatedly from the other unary operators. Cleans up the
14418 code, and kills the ExpressionStatement dependency in Unary.
14420 (Unary): Removed `method' and `Arguments' from this class, making
14421 it smaller, and moving it all to SimpleCall, so I can reuse this
14422 code in other locations and avoid creating a lot of transient data
14423 strucutres when not required.
14425 * cs-parser.jay: Adjust for new changes.
14427 2001-11-11 Miguel de Icaza <miguel@ximian.com>
14429 * enum.cs (Enum.Populate): If there is a failure during
14432 * cs-parser.jay (opt_enum_base): we used to catch type errors
14433 here, but this is really incorrect. The type error should be
14434 catched during semantic analysis.
14436 2001-12-11 Ravi Pratap <ravi@ximian.com>
14438 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
14439 current_local_parameters as expected since I, in my stupidity, had forgotten
14442 * attribute.cs (GetValidPlaces): Fix stupid bug.
14444 * class.cs (Method::Emit): Perform check on applicability of attributes.
14446 (Constructor::Emit): Ditto.
14448 (Field::Emit): Ditto.
14450 (Field.Location): Store location information.
14452 (Property, Event, Indexer, Operator): Ditto.
14454 * cs-parser.jay (field_declaration): Pass in location for each field.
14456 * ../errors/cs0592.cs : Add.
14458 2001-11-12 Ravi Pratap <ravi@ximian.com>
14460 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
14462 (InitCoreTypes): Update accordingly.
14464 (RegisterAttrType, LookupAttr): Implement.
14466 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
14467 info about the same.
14469 (Resolve): Update to populate the above as necessary.
14471 (Error592): Helper.
14473 (GetValidPlaces): Helper to the above.
14475 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
14477 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
14479 2001-11-12 Ravi Pratap <ravi@ximian.com>
14481 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
14483 * ../errors/cs0617.cs : Add.
14485 2001-11-11 Ravi Pratap <ravi@ximian.com>
14487 * enum.cs (Emit): Rename to Populate to be more consistent with what
14488 we expect it to do and when exactly it is called.
14490 * class.cs, rootcontext.cs : Update accordingly.
14492 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
14493 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
14495 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
14497 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
14498 of a fieldinfo using the above, when dealing with a FieldBuilder.
14500 2001-11-10 Ravi Pratap <ravi@ximian.com>
14502 * ../errors/cs0031.cs : Add.
14504 * ../errors/cs1008.cs : Add.
14506 * ../errrors/cs0543.cs : Add.
14508 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
14511 (FindMembers): Implement.
14513 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
14514 enums and delegates too.
14516 (enum_types): Rename to builder_to_enum.
14518 (delegate_types): Rename to builder_to_delegate.
14520 * delegate.cs (FindMembers): Implement.
14522 2001-11-09 Ravi Pratap <ravi@ximian.com>
14524 * typemanager.cs (IsEnumType): Implement.
14526 * enum.cs (Emit): Re-write parts to account for the underlying type
14527 better and perform checking etc.
14529 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
14530 of the underlying type.
14532 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
14535 * enum.cs (error31): Helper to report error #31.
14537 * cs-parser.jay (enum_declaration): Store location of each member too.
14539 * enum.cs (member_to_location): New hashtable.
14541 (AddEnumMember): Update location hashtable.
14543 (Emit): Use the location of each member while reporting errors.
14545 2001-11-09 Miguel de Icaza <miguel@ximian.com>
14547 * cs-parser.jay: A for_initializer if is a
14548 local_variable_declaration really ammount to have an implicit
14549 block with the variable declaration and no initializer for for.
14551 * statement.cs (For.Emit): Cope with null initializers.
14553 This fixes the infinite loop on for initializers.
14555 2001-11-08 Miguel de Icaza <miguel@ximian.com>
14557 * enum.cs: More cleanup.
14559 * ecore.cs: Remove dead code.
14561 * class.cs (Property.Emit): More simplification.
14562 (Event.Emit): ditto.
14564 Reworked to have less levels of indentation.
14566 2001-11-08 Ravi Pratap <ravi@ximian.com>
14568 * class.cs (Property): Emit attributes.
14578 * enum.cs (Emit): Ditto.
14580 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
14583 * class.cs (Field, Event, etc.): Move attribute generation into the
14584 Emit method everywhere.
14586 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
14587 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
14588 as we had no way of defining nested enums !
14590 * rootcontext.cs : Adjust code accordingly.
14592 * typemanager.cs (AddEnumType): To keep track of enum types separately.
14594 2001-11-07 Ravi Pratap <ravi@ximian.com>
14596 * expression.cs (EvalConstantExpression): Move into ecore.cs
14598 * enum.cs (Enum): Rename some members and make them public and readonly
14599 according to our convention.
14601 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
14604 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
14606 (Enum::Emit): Write a simple version for now which doesn't try to compute
14607 expressions. I shall modify this to be more robust in just a while.
14609 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
14611 (TypeContainer::CloseType): Create the Enum types too.
14613 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
14615 * expression.cs (EvalConstantExpression): Get rid of completely.
14617 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
14618 user-defined values and other cases.
14620 (IsValidEnumLiteral): Helper function.
14622 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
14623 out there in the case we had a literal FieldExpr.
14625 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
14627 (Literalize): Revamp a bit to take two arguments.
14629 (EnumLiteral): New class which derives from Literal to wrap enum literals.
14631 2001-11-06 Ravi Pratap <ravi@ximian.com>
14633 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
14635 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
14637 (Resolve): Use the above to ensure we have proper initializers.
14639 2001-11-05 Ravi Pratap <ravi@ximian.com>
14641 * expression.cs (Expression::EvalConstantExpression): New method to
14642 evaluate constant expressions.
14644 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
14646 2001-11-07 Miguel de Icaza <miguel@ximian.com>
14648 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
14651 (Binary.ResolveOperator): Handle operator != (object a, object b)
14652 and operator == (object a, object b);
14654 (Binary.DoNumericPromotions): Indicate whether the numeric
14655 promotion was possible.
14657 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
14660 Made the ArrayAccess implement interface IAssignMethod instead of
14661 IStackStore as the order in which arguments are passed reflects
14664 * assign.cs: Instead of using expr.ExprClass to select the way of
14665 assinging, probe for the IStackStore/IAssignMethod interfaces.
14667 * typemanager.cs: Load InitializeArray definition.
14669 * rootcontext.cs (RootContext.MakeStaticData): Used to define
14670 static data that can be used to initialize arrays.
14672 2001-11-05 Miguel de Icaza <miguel@ximian.com>
14674 * expression.cs: Handle operator== and operator!= for booleans.
14676 (Conditioal.Reduce): Implement reducer for the ?: operator.
14678 (Conditional.Resolve): Implement dead code elimination.
14680 (Binary.Resolve): Catch string literals and return a new
14681 concatenated string.
14683 (Unary.Reduce): Implement reduction of unary expressions.
14685 * ecore.cs: Split out the expression core handling here.
14687 (Expression.Reduce): New method used to perform constant folding
14688 and CSE. This is needed to support constant-expressions.
14690 * statement.cs (Statement.EmitBoolExpression): Pass true and false
14691 targets, and optimize for !x.
14693 2001-11-04 Ravi Pratap <ravi@ximian.com>
14695 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
14696 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
14697 set custom atttributes.
14699 * literal.cs (Literal::GetValue): New abstract method to return the actual
14700 value of the literal, cast as an object.
14702 (*Literal): Implement GetValue method.
14704 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
14705 expressions to the arraylist but objects of type Argument.
14707 * class.cs (TypeContainer::Emit): Emit our attributes too.
14709 (Method::Emit, Constructor::Emit): Ditto.
14711 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
14712 to be ignoring earlier.
14714 2001-11-03 Ravi Pratap <ravi@ximian.com>
14716 * attribute.cs (AttributeSection::Define): Implement to do the business
14717 of constructing a CustomAttributeBuilder.
14719 (Attribute): New trivial class. Increases readability of code.
14721 * cs-parser.jay : Update accordingly.
14723 (positional_argument_list, named_argument_list, named_argument): New rules
14725 (attribute_arguments): Use the above so that we are more correct.
14727 2001-11-02 Ravi Pratap <ravi@ximian.com>
14729 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
14730 to perform all checks for a method with a params parameter.
14732 (Invocation::OverloadResolve): Update to use the above method and therefore
14733 cope correctly with params method invocations.
14735 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
14738 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
14739 constructors in our parent too because we can't afford to miss out on
14742 * attribute.cs (AttributeSection): New name for the class Attribute
14744 Other trivial changes to improve readability.
14746 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
14747 use the new class names.
14749 2001-11-01 Ravi Pratap <ravi@ximian.com>
14751 * class.cs (Method::Define): Complete definition for params types too
14753 (Indexer::Define): Ditto.
14755 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
14756 Cope everywhere with a request for info about the array parameter.
14758 2001-11-01 Ravi Pratap <ravi@ximian.com>
14760 * tree.cs (RecordNamespace): Fix up to check for the correct key.
14762 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
14763 local_variable_type to extract the string corresponding to the type.
14765 (local_variable_type): Fixup the action to use the new helper method.
14767 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
14770 * expression.cs : Clean out code which uses the above.
14772 2001-10-31 Ravi Pratap <ravi@ximian.com>
14774 * typemanager.cs (RegisterMethod): Check if we already have an existing key
14775 and bale out if necessary by returning a false.
14777 (RegisterProperty): Ditto.
14779 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
14780 and print out appropriate error messages.
14782 * interface.cs (everywhere): Ditto.
14784 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
14785 location to constructor.
14787 * class.cs (Property, Event, Indexer): Update accordingly.
14789 * ../errors/cs111.cs : Added.
14791 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
14792 of a method, as laid down by the spec.
14794 (Invocation::OverloadResolve): Use the above method.
14796 2001-10-31 Ravi Pratap <ravi@ximian.com>
14798 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
14799 now take a TypeContainer and a Parameters object.
14801 (ParameterData): Modify return type of ParameterModifier method to be
14802 Parameter.Modifier and not a string.
14804 (ReflectionParameters, InternalParameters): Update accordingly.
14806 * expression.cs (Argument::GetParameterModifier): Same here.
14808 * support.cs (InternalParameters::ParameterType): Find a better way of determining
14809 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
14810 symbol in it at all so maybe this is only for now.
14812 2001-10-30 Ravi Pratap <ravi@ximian.com>
14814 * support.cs (InternalParameters): Constructor now takes an extra argument
14815 which is the actual Parameters class.
14817 (ParameterDesc): Update to provide info on ref/out modifiers.
14819 * class.cs (everywhere): Update call to InternalParameters to pass in
14820 the second argument too.
14822 * support.cs (ParameterData): Add ParameterModifier, which is a method
14823 to return the modifier info [ref/out etc]
14825 (InternalParameters, ReflectionParameters): Implement the above.
14827 * expression.cs (Argument::ParameterModifier): Similar function to return
14828 info about the argument's modifiers.
14830 (Invocation::OverloadResolve): Update to take into account matching modifiers
14833 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
14834 a new SetFormalParameters object which we pass to InternalParameters.
14836 2001-10-30 Ravi Pratap <ravi@ximian.com>
14838 * expression.cs (NewArray): Merge into the ArrayCreation class.
14840 2001-10-29 Ravi Pratap <ravi@ximian.com>
14842 * expression.cs (NewArray): Merge classes NewBuiltinArray and
14843 NewUserdefinedArray into one as there wasn't much of a use in having
14846 * expression.cs (Argument): Change field's name to ArgType from Type.
14848 (Type): New readonly property which returns the proper type, taking into
14849 account ref/out modifiers.
14851 (everywhere): Adjust code accordingly for the above.
14853 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
14854 whether we are emitting for a ref or out parameter.
14856 * expression.cs (Argument::Emit): Use the above field to set the state.
14858 (LocalVariableReference::Emit): Update to honour the flag and emit the
14861 * parameter.cs (Attributes): Set the correct flags for ref parameters.
14863 * expression.cs (Argument::FullDesc): New function to provide a full desc.
14865 * support.cs (ParameterData): Add method ParameterDesc to the interface.
14867 (ReflectionParameters, InternalParameters): Implement the above method.
14869 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
14872 (Invocation::FullMethodDesc): Ditto.
14874 2001-10-29 Miguel de Icaza <miguel@ximian.com>
14876 * cs-parser.jay: Add extra production for the second form of array
14879 * expression.cs (ArrayCreation): Update to reflect the above
14882 * Small changes to prepare for Array initialization.
14884 2001-10-28 Miguel de Icaza <miguel@ximian.com>
14886 * typemanager.cs (ImplementsInterface): interface might be null;
14887 Deal with this problem;
14889 Also, we do store negative hits on the cache (null values), so use
14890 this instead of calling t.GetInterfaces on the type everytime.
14892 2001-10-28 Ravi Pratap <ravi@ximian.com>
14894 * typemanager.cs (IsBuiltinType): New method to help determine the same.
14896 * expression.cs (New::DoResolve): Get rid of array creation code and instead
14897 split functionality out into different classes.
14899 (New::FormArrayType): Move into NewBuiltinArray.
14901 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
14904 (NewBuiltinArray): New class to handle creation of built-in arrays.
14906 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
14907 account creation of one-dimensional arrays.
14909 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
14911 (NewUserdefinedArray::DoResolve): Implement.
14913 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
14915 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
14916 we maintain inside the TypeManager. This is necessary to perform lookups on the
14919 (LookupType): Update to perform GetType on the module builders too.
14921 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
14923 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
14925 2001-10-23 Ravi Pratap <ravi@ximian.com>
14927 * expression.cs (New::DoResolve): Implement guts of array creation.
14929 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
14931 2001-10-27 Miguel de Icaza <miguel@ximian.com>
14933 * expression.cs: Fix bug I introduced lsat night that broke
14936 (Expression.Resolve): Report a 246 error (can not resolve name)
14937 if we find a SimpleName in the stream.
14939 (Expression.ResolveLValue): Ditto.
14941 (Expression.ResolveWithSimpleName): This function is a variant of
14942 ResolveName, this one allows SimpleNames to be returned without a
14943 warning. The only consumer of SimpleNames is MemberAccess
14945 2001-10-26 Miguel de Icaza <miguel@ximian.com>
14947 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
14948 might arrive here. I have my doubts that this is correct.
14950 * statement.cs (Lock): Implement lock statement.
14952 * cs-parser.jay: Small fixes to support `lock' and `using'
14954 * cs-tokenizer.cs: Remove extra space
14956 * driver.cs: New flag --checked, allows to turn on integer math
14959 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
14960 Threading.Monitor.Exit
14962 2001-10-23 Miguel de Icaza <miguel@ximian.com>
14964 * expression.cs (IndexerAccess::DoResolveLValue): Set the
14965 Expression Class to be IndexerAccess.
14967 Notice that Indexer::DoResolve sets the eclass to Value.
14969 2001-10-22 Miguel de Icaza <miguel@ximian.com>
14971 * class.cs (TypeContainer::Emit): Emit code for indexers.
14973 * assign.cs (IAssignMethod): New interface implemented by Indexers
14974 and Properties for handling assignment.
14976 (Assign::Emit): Simplify and reuse code.
14978 * expression.cs (IndexerAccess, PropertyExpr): Implement
14979 IAssignMethod, clean up old code.
14981 2001-10-22 Ravi Pratap <ravi@ximian.com>
14983 * typemanager.cs (ImplementsInterface): New method to determine if a type
14984 implements a given interface. Provides a nice cache too.
14986 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
14989 (ConvertReferenceExplicit): Ditto.
14991 * delegate.cs (Delegate::Populate): Update to define the parameters on the
14992 various methods, with correct names etc.
14994 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
14995 Operator.UnaryNegation.
14997 * cs-parser.jay (operator_declarator): Be a little clever in the case where
14998 we have a unary plus or minus operator.
15000 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
15003 * everywhere : update accordingly.
15005 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
15008 * class.cs (Method::Define): For the case where we are implementing a method
15009 inherited from an interface, we need to set the MethodAttributes.Final flag too.
15010 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
15012 2001-10-21 Ravi Pratap <ravi@ximian.com>
15014 * interface.cs (FindMembers): Implement to work around S.R.E
15017 * typemanager.cs (IsInterfaceType): Implement.
15019 (FindMembers): Update to handle interface types too.
15021 * expression.cs (ImplicitReferenceConversion): Re-write bits which
15022 use IsAssignableFrom as that is not correct - it doesn't work.
15024 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
15025 and accordingly override EmitStatement.
15027 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
15028 using the correct logic :-)
15030 2001-10-19 Ravi Pratap <ravi@ximian.com>
15032 * ../errors/cs-11.cs : Add to demonstrate error -11
15034 2001-10-17 Miguel de Icaza <miguel@ximian.com>
15036 * assign.cs (Assign::Resolve): Resolve right hand side first, and
15037 then pass this as a hint to ResolveLValue.
15039 * expression.cs (FieldExpr): Add Location information
15041 (FieldExpr::LValueResolve): Report assignment to readonly
15044 (Expression::ExprClassFromMemberInfo): Pass location information.
15046 (Expression::ResolveLValue): Add new method that resolves an
15049 (Expression::DoResolveLValue): Default invocation calls
15052 (Indexers): New class used to keep track of indexers in a given
15055 (IStackStore): Renamed from LValue, as it did not really describe
15056 what this did. Also ResolveLValue is gone from this interface and
15057 now is part of Expression.
15059 (ElementAccess): Depending on the element access type
15061 * typemanager.cs: Add `indexer_name_type' as a Core type
15062 (System.Runtime.CompilerServices.IndexerNameAttribute)
15064 * statement.cs (Goto): Take a location.
15066 2001-10-18 Ravi Pratap <ravi@ximian.com>
15068 * delegate.cs (Delegate::VerifyDelegate): New method to verify
15069 if two delegates are compatible.
15071 (NewDelegate::DoResolve): Update to take care of the case when
15072 we instantiate a delegate from another delegate.
15074 * typemanager.cs (FindMembers): Don't even try to look up members
15075 of Delegate types for now.
15077 2001-10-18 Ravi Pratap <ravi@ximian.com>
15079 * delegate.cs (NewDelegate): New class to take care of delegate
15082 * expression.cs (New): Split the delegate related code out into
15083 the NewDelegate class.
15085 * delegate.cs (DelegateInvocation): New class to handle delegate
15088 * expression.cs (Invocation): Split out delegate related code into
15089 the DelegateInvocation class.
15091 2001-10-17 Ravi Pratap <ravi@ximian.com>
15093 * expression.cs (New::DoResolve): Implement delegate creation fully
15094 and according to the spec.
15096 (New::DoEmit): Update to handle delegates differently.
15098 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
15099 because of which we were printing out arguments in reverse order !
15101 * delegate.cs (VerifyMethod): Implement to check if the given method
15102 matches the delegate.
15104 (FullDelegateDesc): Implement.
15106 (VerifyApplicability): Implement.
15108 * expression.cs (Invocation::DoResolve): Update to accordingly handle
15109 delegate invocations too.
15111 (Invocation::Emit): Ditto.
15113 * ../errors/cs1593.cs : Added.
15115 * ../errors/cs1594.cs : Added.
15117 * delegate.cs (InstanceExpression, TargetMethod): New properties.
15119 2001-10-16 Ravi Pratap <ravi@ximian.com>
15121 * typemanager.cs (intptr_type): Core type for System.IntPtr
15123 (InitCoreTypes): Update for the same.
15125 (iasyncresult_type, asynccallback_type): Ditto.
15127 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
15130 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
15133 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
15134 the builders for the 4 members of a delegate type :-)
15136 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
15139 * expression.cs (New::DoResolve): Implement guts for delegate creation.
15141 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
15143 2001-10-15 Miguel de Icaza <miguel@ximian.com>
15145 * statement.cs (Break::Emit): Implement.
15146 (Continue::Emit): Implement.
15148 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
15149 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
15150 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
15151 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
15154 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
15155 properties that track the label for the current loop (begin of the
15156 loop and end of the loop).
15158 2001-10-15 Ravi Pratap <ravi@ximian.com>
15160 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
15161 use of emitting anything at all.
15163 * class.cs, rootcontext.cs : Get rid of calls to the same.
15165 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
15167 (Populate): Define the constructor correctly and set the implementation
15170 * typemanager.cs (delegate_types): New hashtable to hold delegates that
15173 (AddDelegateType): Implement.
15175 (IsDelegateType): Implement helper method.
15177 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
15179 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
15180 and accordingly handle it.
15182 * delegate.cs (Populate): Take TypeContainer argument.
15183 Implement bits to define the Invoke method. However, I still haven't figured out
15184 how to take care of the native int bit :-(
15186 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
15187 Qualify the name of the delegate, not its return type !
15189 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
15192 (StandardConversionExists): Checking for array types turns out to be recursive.
15194 (ConvertReferenceExplicit): Implement array conversion.
15196 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
15198 2001-10-12 Ravi Pratap <ravi@ximian.com>
15200 * cs-parser.jay (delegate_declaration): Store the fully qualified
15201 name as it is a type declaration.
15203 * delegate.cs (ReturnType, Name): Rename members to these. Make them
15206 (DefineDelegate): Renamed from Define. Does the same thing essentially,
15207 as TypeContainer::DefineType.
15209 (Populate): Method in which all the definition of the various methods (Invoke)
15212 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
15215 (CloseDelegate): Finally creates the delegate.
15217 * class.cs (TypeContainer::DefineType): Update to define delegates.
15218 (Populate, Emit and CloseType): Do the same thing here too.
15220 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
15221 delegates in all these operations.
15223 2001-10-14 Miguel de Icaza <miguel@ximian.com>
15225 * expression.cs: LocalTemporary: a new expression used to
15226 reference a temporary that has been created.
15228 * assign.cs: Handle PropertyAccess back here, so that we can
15229 provide the proper semantic access to properties.
15231 * expression.cs (Expression::ConvertReferenceExplicit): Implement
15232 a few more explicit conversions.
15234 * modifiers.cs: `NEW' modifier maps to HideBySig.
15236 * expression.cs (PropertyExpr): Make this into an
15237 ExpressionStatement, and support the EmitStatement code path.
15239 Perform get/set error checking, clean up the interface.
15241 * assign.cs: recognize PropertyExprs as targets, and if so, turn
15242 them into toplevel access objects.
15244 2001-10-12 Miguel de Icaza <miguel@ximian.com>
15246 * expression.cs: PropertyExpr::PropertyExpr: use work around the
15249 * typemanager.cs: Keep track here of our PropertyBuilders again to
15250 work around lameness in SRE.
15252 2001-10-11 Miguel de Icaza <miguel@ximian.com>
15254 * expression.cs (LValue::LValueResolve): New method in the
15255 interface, used to perform a second resolution pass for LValues.
15257 (This::DoResolve): Catch the use of this in static methods.
15259 (This::LValueResolve): Implement.
15261 (This::Store): Remove warning, assigning to `this' in structures
15264 (Invocation::Emit): Deal with invocation of
15265 methods on value types. We need to pass the address to structure
15266 methods rather than the object itself. (The equivalent code to
15267 emit "this" for structures leaves the entire structure on the
15268 stack instead of a pointer to it).
15270 (ParameterReference::DoResolve): Compute the real index for the
15271 argument based on whether the method takes or not a `this' pointer
15272 (ie, the method is static).
15274 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
15275 value types returned from functions when we need to invoke a
15276 method on the sturcture.
15279 2001-10-11 Ravi Pratap <ravi@ximian.com>
15281 * class.cs (TypeContainer::DefineType): Method to actually do the business of
15282 defining the type in the Modulebuilder or Typebuilder. This is to take
15283 care of nested types which need to be defined on the TypeBuilder using
15284 DefineNestedMethod.
15286 (TypeContainer::GetClassBases): Implement. Essentially the code from the
15287 methods in RootContext, only ported to be part of TypeContainer.
15289 (TypeContainer::GetInterfaceOrClass): Ditto.
15291 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
15293 * interface.cs (Interface::DefineInterface): New method. Does exactly
15294 what RootContext.CreateInterface did earlier, only it takes care of nested types
15297 (Interface::GetInterfaces): Move from RootContext here and port.
15299 (Interface::GetInterfaceByName): Same here.
15301 * rootcontext.cs (ResolveTree): Re-write.
15303 (PopulateTypes): Re-write.
15305 * class.cs (TypeContainer::Populate): Populate nested types too.
15306 (TypeContainer::Emit): Emit nested members too.
15308 * typemanager.cs (AddUserType): Do not make use of the FullName property,
15309 instead just use the name argument passed in as it is already fully
15312 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
15313 to TypeContainer mapping to see if a type is user-defined.
15315 * class.cs (TypeContainer::CloseType): Implement.
15317 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
15318 the default constructor.
15320 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
15323 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
15325 * interface.cs (CloseType): Create the type here.
15327 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
15330 Remove all the methods which are now in TypeContainer.
15332 2001-10-10 Ravi Pratap <ravi@ximian.com>
15334 * delegate.cs (Define): Re-write bits to define the delegate
15337 2001-10-10 Miguel de Icaza <miguel@ximian.com>
15339 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
15341 * expression.cs (ImplicitReferenceConversion): handle null as well
15342 as a source to convert to any reference type.
15344 * statement.cs (Return): Perform any implicit conversions to
15345 expected return type.
15347 Validate use of return statement.
15349 * codegen.cs (EmitContext): Pass the expected return type here.
15351 * class.cs (Method, Constructor, Property): Pass expected return
15352 type to EmitContext.
15354 2001-10-09 Miguel de Icaza <miguel@ximian.com>
15356 * expression.cs: Make DoResolve take an EmitContext instead of a
15359 Replaced `l' and `location' for `loc', for consistency.
15361 (Error, Warning): Remove unneeded Tc argument.
15363 * assign.cs, literal.cs, constant.cs: Update to new calling
15366 * codegen.cs: EmitContext now contains a flag indicating whether
15367 code is being generated in a static method or not.
15369 * cs-parser.jay: DecomposeQI, new function that replaces the old
15370 QualifiedIdentifier. Now we always decompose the assembled
15371 strings from qualified_identifier productions into a group of
15374 2001-10-08 Miguel de Icaza <miguel@ximian.com>
15376 * rootcontext.cs: Deal with field-less struct types correctly now
15377 by passing the size option to Define Type.
15379 * class.cs: Removed hack that created one static field.
15381 2001-10-07 Miguel de Icaza <miguel@ximian.com>
15383 * statement.cs: Moved most of the code generation here.
15385 2001-10-09 Ravi Pratap <ravi@ximian.com>
15387 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
15390 (ElementAccess): Remove useless bits for now - keep checks as the spec
15393 2001-10-08 Ravi Pratap <ravi@ximian.com>
15395 * expression.cs (ElementAccess::DoResolve): Remove my crap code
15396 and start performing checks according to the spec.
15398 2001-10-07 Ravi Pratap <ravi@ximian.com>
15400 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
15401 rank_specifiers instead.
15403 (rank_specifiers): Change the order in which the rank specifiers are stored
15405 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
15407 * expression.cs (ElementAccess): Implement the LValue interface too.
15409 2001-10-06 Ravi Pratap <ravi@ximian.com>
15411 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
15412 except that user defined conversions are not included.
15414 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
15415 perform the conversion of the return type, if necessary.
15417 (New::DoResolve): Check whether we are creating an array or an object
15418 and accordingly do the needful.
15420 (New::Emit): Same here.
15422 (New::DoResolve): Implement guts of array creation.
15424 (New::FormLookupType): Helper function.
15426 2001-10-07 Miguel de Icaza <miguel@ximian.com>
15428 * codegen.cs: Removed most of the code generation here, and move the
15429 corresponding code generation bits to the statement classes.
15431 Added support for try/catch/finalize and throw.
15433 * cs-parser.jay: Added support for try/catch/finalize.
15435 * class.cs: Catch static methods having the flags override,
15436 virtual or abstract.
15438 * expression.cs (UserCast): This user cast was not really doing
15439 what it was supposed to do. Which is to be born in fully resolved
15440 state. Parts of the resolution were being performed at Emit time!
15444 2001-10-05 Miguel de Icaza <miguel@ximian.com>
15446 * expression.cs: Implicity convert the result from UserCast.
15448 2001-10-05 Ravi Pratap <ravi@ximian.com>
15450 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
15451 prevented it from working correctly.
15453 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
15454 merely ConvertImplicit.
15456 2001-10-05 Miguel de Icaza <miguel@ximian.com>
15458 * typemanager.cs: Make the LookupTypeContainer function static,
15459 and not per-instance.
15461 * class.cs: Make static FindMembers (the one that takes a Type
15464 * codegen.cs: Add EmitForeach here.
15466 * cs-parser.jay: Make foreach a toplevel object instead of the
15467 inline expansion, as we need to perform semantic analysis on it.
15469 2001-10-05 Ravi Pratap <ravi@ximian.com>
15471 * expression.cs (Expression::ImplicitUserConversion): Rename to
15472 UserDefinedConversion.
15474 (Expression::UserDefinedConversion): Take an extra argument specifying
15475 whether we look for explicit user conversions too.
15477 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
15479 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
15481 (ExplicitUserConversion): Make it a call to UserDefinedConversion
15482 with the appropriate arguments.
15484 * cs-parser.jay (cast_expression): Record location too.
15486 * expression.cs (Cast): Record location info.
15488 (Expression::ConvertExplicit): Take location argument.
15490 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
15491 to determine if we are doing explicit conversions.
15493 (UserCast::Emit): Update accordingly.
15495 (Expression::ConvertExplicit): Report an error if everything fails.
15497 * ../errors/cs0030.cs : Add.
15499 2001-10-04 Miguel de Icaza <miguel@ximian.com>
15501 * modifiers.cs: If the ABSTRACT keyword is present, also set the
15502 virtual and newslot bits.
15504 * class.cs (TypeContainer::RegisterRequiredImplementations):
15505 Record methods we need.
15507 (TypeContainer::MakeKey): Helper function to make keys for
15508 MethodBases, since the Methodbase key is useless.
15510 (TypeContainer::Populate): Call RegisterRequiredImplementations
15511 before defining the methods.
15513 Create a mapping for method_builders_to_methods ahead of time
15514 instead of inside a tight loop.
15516 (::RequireMethods): Accept an object as the data to set into the
15517 hashtable so we can report interface vs abstract method mismatch.
15519 2001-10-03 Miguel de Icaza <miguel@ximian.com>
15521 * report.cs: Make all of it static.
15523 * rootcontext.cs: Drop object_type and value_type computations, as
15524 we have those in the TypeManager anyways.
15526 Drop report instance variable too, now it is a global.
15528 * driver.cs: Use try/catch on command line handling.
15530 Add --probe option to debug the error reporting system with a test
15533 * report.cs: Add support for exiting program when a probe
15534 condition is reached.
15536 2001-10-03 Ravi Pratap <ravi@ximian.com>
15538 * expression.cs (Binary::DoNumericPromotions): Fix the case when
15539 we do a forcible conversion regardless of type, to check if
15540 ForceConversion returns a null.
15542 (Binary::error19): Use location to report error.
15544 (Unary::error23): Use location here too.
15546 * ../errors/cs0019.cs : Check in.
15548 * ../errors/cs0023.cs : Check in.
15550 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
15551 case of a non-null MethodInfo object with a length of 0 !
15553 (Binary::ResolveOperator): Flag error if overload resolution fails to find
15554 an applicable member - according to the spec :-)
15555 Also fix logic to find members in base types.
15557 (Unary::ResolveOperator): Same here.
15559 (Unary::report23): Change name to error23 and make first argument a TypeContainer
15560 as I was getting thoroughly confused between this and error19 :-)
15562 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
15563 (::FindMostEncompassedType): Implement.
15564 (::FindMostEncompassingType): Implement.
15565 (::StandardConversionExists): Implement.
15567 (UserImplicitCast): Re-vamp. We now need info about most specific
15568 source and target types so that we can do the necessary conversions.
15570 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
15571 mathematical union with no duplicates.
15573 2001-10-03 Miguel de Icaza <miguel@ximian.com>
15575 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
15576 in order from base classes to child classes, so that we can in
15577 child classes look up in our parent for method names and
15578 attributes (required for handling abstract, virtual, new, override
15579 constructs: we need to instrospect our base class, and if we dont
15580 populate the classes in order, the introspection might be
15581 incorrect. For example, a method could query its parent before
15582 the parent has any methods and would determine that the parent has
15583 no abstract methods (while it could have had them)).
15585 (RootContext::CreateType): Record the order in which we define the
15588 2001-10-02 Miguel de Icaza <miguel@ximian.com>
15590 * class.cs (TypeContainer::Populate): Also method definitions can
15591 fail now, keep track of this.
15593 (TypeContainer::FindMembers): Implement support for
15594 DeclaredOnly/noDeclaredOnly flag.
15596 (Constructor::Emit) Return the ConstructorBuilder.
15598 (Method::Emit) Return the MethodBuilder.
15599 Check for abstract or virtual methods to be public.
15601 * rootcontext.cs (RootContext::CreateType): Register all the
15602 abstract methods required for the class to be complete and the
15603 interface methods that must be implemented.
15605 * cs-parser.jay: Report error 501 (method requires body if it is
15606 not marked abstract or extern).
15608 * expression.cs (TypeOf::Emit): Implement.
15610 * typemanager.cs: runtime_handle_type, new global type.
15612 * class.cs (Property::Emit): Generate code for properties.
15614 2001-10-02 Ravi Pratap <ravi@ximian.com>
15616 * expression.cs (Unary::ResolveOperator): Find operators on base type
15617 too - we now conform exactly to the spec.
15619 (Binary::ResolveOperator): Same here.
15621 * class.cs (Operator::Define): Fix minor quirk in the tests.
15623 * ../errors/cs0215.cs : Added.
15625 * ../errors/cs0556.cs : Added.
15627 * ../errors/cs0555.cs : Added.
15629 2001-10-01 Miguel de Icaza <miguel@ximian.com>
15631 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
15632 single integer which is really efficient
15634 2001-10-01 Ravi Pratap <ravi@ximian.com>
15636 * expression.cs (Expression::ImplicitUserConversion): Use location
15637 even in the case when we are examining True operators.
15639 * class.cs (Operator::Define): Perform extensive checks to conform
15640 with the rules for operator overloading in the spec.
15642 * expression.cs (Expression::ImplicitReferenceConversion): Implement
15643 some of the other conversions mentioned in the spec.
15645 * typemanager.cs (array_type): New static member for the System.Array built-in
15648 (cloneable_interface): For System.ICloneable interface.
15650 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
15651 we start resolving the tree and populating types.
15653 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
15655 2001-10-01 Miguel de Icaza <miguel@ximian.com>
15657 * expression.cs (Expression::ExprClassFromMemberInfo,
15658 Expression::Literalize): Create literal expressions from
15659 FieldInfos which are literals.
15661 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
15662 type casts, because they were wrong. The test suite in tests
15665 (ImplicitNumericConversion): ushort to ulong requires a widening
15668 Int32 constant to long requires widening cast as well.
15670 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
15671 for integers because the type on the stack is not i4.
15673 2001-09-30 Miguel de Icaza <miguel@ximian.com>
15675 * expression.cs (report118): require location argument.
15677 * parameter.cs: Do not dereference potential null value.
15679 * class.cs: Catch methods that lack the `new' keyword when
15680 overriding a name. Report warnings when `new' is used without
15681 anything being there to override.
15683 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
15685 * class.cs: Only add constructor to hashtable if it is non-null
15686 (as now constructors can fail on define).
15688 (TypeManager, Class, Struct): Take location arguments.
15690 Catch field instance initialization in structs as errors.
15692 accepting_filter: a new filter for FindMembers that is static so
15693 that we dont create an instance per invocation.
15695 (Constructor::Define): Catch errors where a struct constructor is
15698 * cs-parser.jay: Pass location information for various new
15701 * delegate.cs (Delegate): take a location argument.
15703 * driver.cs: Do not call EmitCode if there were problesm in the
15704 Definition of the types, as many Builders wont be there.
15706 * decl.cs (Decl::Decl): Require a location argument.
15708 * cs-tokenizer.cs: Handle properly hex constants that can not fit
15709 into integers, and find the most appropiate integer for it.
15711 * literal.cs: Implement ULongLiteral.
15713 * rootcontext.cs: Provide better information about the location of
15714 failure when CreateType fails.
15716 2001-09-29 Miguel de Icaza <miguel@ximian.com>
15718 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
15721 * expression.cs (Binary::CheckShiftArguments): Add missing type
15723 (Binary::ResolveOperator): Add type to the logical and and logical
15724 or, Bitwise And/Or and Exclusive Or code paths, it was missing
15727 (Binary::DoNumericPromotions): In the case where either argument
15728 is ulong (and most signed types combined with ulong cause an
15729 error) perform implicit integer constant conversions as well.
15731 2001-09-28 Miguel de Icaza <miguel@ximian.com>
15733 * expression.cs (UserImplicitCast): Method should always be
15735 (Invocation::BetterConversion): Simplified test for IntLiteral.
15737 (Expression::ImplicitNumericConversion): Split this routine out.
15738 Put the code that performs implicit constant integer conversions
15741 (Expression::Resolve): Become a wrapper around DoResolve so we can
15742 check eclass and type being set after resolve.
15744 (Invocation::Badness): Remove this dead function
15746 (Binary::ResolveOperator): Do not compute the expensive argumnets
15747 unless we have a union for it.
15749 (Probe::Emit): Is needs to do an isinst and then
15750 compare against null.
15752 (::CanConvert): Added Location argument. If the Location argument
15753 is null (Location.Null), then we do not report errors. This is
15754 used by the `probe' mechanism of the Explicit conversion. We do
15755 not want to generate an error for something that the user
15756 explicitly requested to be casted. But the pipeline for an
15757 explicit cast first tests for potential implicit casts.
15759 So for now, if the Location is null, it means `Probe only' to
15760 avoid adding another argument. Might have to revise this
15763 (ClassCast): New class used to type cast objects into arbitrary
15764 classes (used in Explicit Reference Conversions).
15766 Implement `as' as well.
15768 Reverted all the patches from Ravi below: they were broken:
15770 * The use of `level' as a mechanism to stop recursive
15771 invocations is wrong. That was there just to catch the
15772 bug with a strack trace but not as a way of addressing
15775 To fix the problem we have to *understand* what is going
15776 on and the interactions and come up with a plan, not
15777 just get things going.
15779 * The use of the type conversion cache that I proposed
15780 last night had an open topic: How does this work across
15781 protection domains. A user defined conversion might not
15782 be public in the location where we are applying the
15783 conversion, a different conversion might be selected
15784 (ie, private A->B (better) but public B->A (worse),
15785 inside A, A->B applies, but outside it, B->A will
15788 * On top of that (ie, even if the above is solved),
15789 conversions in a cache need to be abstract. Ie, `To
15790 convert from an Int to a Short use an OpcodeCast', not
15791 `To convert from an Int to a Short use the OpcodeCast on
15792 the variable 5' (which is what this patch was doing).
15794 2001-09-28 Ravi Pratap <ravi@ximian.com>
15796 * expression.cs (Invocation::ConversionExists): Re-write to use
15797 the conversion cache
15799 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
15800 cache all conversions done, not just user-defined ones.
15802 (Invocation::BetterConversion): The real culprit. Use ConversionExists
15803 to determine if a conversion exists instead of acutually trying to
15804 perform the conversion. It's faster too.
15806 (Expression::ConvertExplicit): Modify to use ConversionExists to check
15807 and only then attempt the implicit conversion.
15809 2001-09-28 Ravi Pratap <ravi@ximian.com>
15811 * expression.cs (ConvertImplicit): Use a cache for conversions
15812 already found. Check level of recursion and bail out if necessary.
15814 2001-09-28 Miguel de Icaza <miguel@ximian.com>
15816 * typemanager.cs (string_concat_string_string, string_concat_object_object):
15817 Export standard methods that we expect for string operations.
15819 * statement.cs (Block::UsageWarning): Track usage of variables and
15820 report the errors for not used variables.
15822 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
15825 2001-09-27 Miguel de Icaza <miguel@ximian.com>
15827 * codegen.cs: remove unnneded code
15829 * expression.cs: Removed BuiltinTypeAccess class
15831 Fix the order in which implicit conversions are
15834 The previous fixed dropped support for boxed conversions (adding a
15835 test to the test suite now)
15837 (UserImplicitCast::CanConvert): Remove test for source being null,
15838 that code is broken. We should not feed a null to begin with, if
15839 we do, then we should track the bug where the problem originates
15840 and not try to cover it up here.
15842 Return a resolved expression of type UserImplicitCast on success
15843 rather than true/false. Ravi: this is what I was talking about,
15844 the pattern is to use a static method as a "constructor" for
15847 Also, do not create arguments until the very last minute,
15848 otherwise we always create the arguments even for lookups that
15849 will never be performed.
15851 (UserImplicitCast::Resolve): Eliminate, objects of type
15852 UserImplicitCast are born in a fully resolved state.
15854 * typemanager.cs (InitCoreTypes): Init also value_type
15855 (System.ValueType).
15857 * expression.cs (Cast::Resolve): First resolve the child expression.
15859 (LValue): Add new method AddressOf to be used by
15862 Change the argument of Store to take an EmitContext instead of an
15863 ILGenerator, because things like FieldExpr need to be able to call
15864 their children expression to generate the instance code.
15866 (Expression::Error, Expression::Warning): Sugar functions for
15869 (Expression::MemberLookup): Accept a TypeContainer instead of a
15870 Report as the first argument.
15872 (Expression::ResolvePrimary): Killed. I still want to improve
15873 this as currently the code is just not right.
15875 (Expression::ResolveMemberAccess): Simplify, but it is still
15878 (Unary::Resolve): Catch errors in AddressOf operators.
15880 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
15881 index to a byte for the short-version, or the compiler will choose
15882 the wrong Emit call, which generates the wrong data.
15884 (ParameterReference::Emit, ::Store): same.
15886 (FieldExpr::AddressOf): Implement.
15888 * typemanager.cs: TypeManager: made public variable instead of
15891 * driver.cs: document --fatal.
15893 * report.cs (ErrorMessage, WarningMessage): new names for the old
15894 Error and Warning classes.
15896 * cs-parser.jay (member_access): Turn built-in access to types
15897 into a normal simplename
15899 2001-09-27 Ravi Pratap <ravi@ximian.com>
15901 * expression.cs (Invocation::BetterConversion): Fix to cope
15902 with q being null, since this was introducing a bug.
15904 * expression.cs (ConvertImplicit): Do built-in conversions first.
15906 2001-09-27 Ravi Pratap <ravi@ximian.com>
15908 * expression.cs (UserImplicitCast::Resolve): Fix bug.
15910 2001-09-27 Ravi Pratap <ravi@ximian.com>
15912 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
15913 I had introduced long ago (what's new ?).
15915 * expression.cs (UserImplicitCast::CanConvert): Static method to do
15916 the work of all the checking.
15917 (ConvertImplicit): Call CanConvert and only then create object if necessary.
15918 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
15920 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
15921 that is the right way.
15923 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
15924 overloading resolution. Use everywhere instead of cutting and pasting code.
15926 (Binary::ResolveOperator): Use MakeUnionSet.
15928 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
15929 we have to convert to bool types. Not complete yet.
15931 2001-09-27 Miguel de Icaza <miguel@ximian.com>
15933 * typemanager.cs (TypeManager::CSharpName): support ushort.
15935 * expression.cs (Expression::TryImplicitIntConversion): Attempts
15936 to provide an expression that performsn an implicit constant int
15937 conversion (section 6.1.6).
15938 (Expression::ConvertImplicitRequired): Reworked to include
15939 implicit constant expression conversions.
15941 (Expression::ConvertNumericExplicit): Finished.
15943 (Invocation::Emit): If InstanceExpression is null, then it means
15944 that we perform a call on this.
15946 2001-09-26 Miguel de Icaza <miguel@ximian.com>
15948 * expression.cs (Unary::Emit): Remove some dead code.
15949 (Probe): Implement Resolve and Emit for `is'.
15950 (Expression::ConvertImplicitRequired): Attempt to do constant
15951 expression conversions here. Maybe should be moved to
15952 ConvertImplicit, but I am not sure.
15953 (Expression::ImplicitLongConstantConversionPossible,
15954 Expression::ImplicitIntConstantConversionPossible): New functions
15955 that tell whether is it possible to apply an implicit constant
15956 expression conversion.
15958 (ConvertNumericExplicit): Started work on explicit numeric
15961 * cs-parser.jay: Update operator constants.
15963 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
15964 (Parameters::GetSignature): Hook up VerifyArgs here.
15965 (Parameters::VerifyArgs): Verifies that no two arguments have the
15968 * class.cs (Operator): Update the operator names to reflect the
15969 ones that the spec expects (as we are just stringizing the
15972 * expression.cs (Unary::ResolveOperator): Fix bug: Use
15973 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
15974 previous usage did only work for our methods.
15975 (Expression::ConvertImplicit): Handle decimal implicit numeric
15976 conversions as well.
15977 (Expression::InternalTypeConstructor): Used to invoke constructors
15978 on internal types for default promotions.
15980 (Unary::Emit): Implement special handling for the pre/post
15981 increment/decrement for overloaded operators, as they need to have
15982 the same semantics as the other operators.
15984 (Binary::ResolveOperator): ditto.
15985 (Invocation::ConversionExists): ditto.
15986 (UserImplicitCast::Resolve): ditto.
15988 2001-09-26 Ravi Pratap <ravi@ximian.com>
15990 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
15991 operator, return after emitting body. Regression tests pass again !
15993 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
15994 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
15995 (Invocation::OverloadResolve): Ditto.
15996 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
15998 * everywhere : update calls to the above methods accordingly.
16000 2001-09-26 Miguel de Icaza <miguel@ximian.com>
16002 * assign.cs (Assign): Make it inherit from ExpressionStatement.
16004 * expression.cs (ExpressionStatement): New base class used for
16005 expressions that can appear in statements, so that we can provide
16006 an alternate path to generate expression that do not leave a value
16009 (Expression::Emit, and all the derivatives): We no longer return
16010 whether a value is left on the stack or not. Every expression
16011 after being emitted leaves a single value on the stack.
16013 * codegen.cs (EmitContext::EmitStatementExpression): Use the
16014 facilties of ExpressionStatement if possible.
16016 * cs-parser.jay: Update statement_expression.
16018 2001-09-25 Miguel de Icaza <miguel@ximian.com>
16020 * driver.cs: Change the wording of message
16022 2001-09-25 Ravi Pratap <ravi@ximian.com>
16024 * expression.cs (Binary::ResolveOperator): Had forgottten to set
16025 the type of the expression to the return type of the method if
16026 we have an overloaded operator match ! The regression tests pass again !
16027 (Unary::ResolveOperator): Ditto.
16029 * expression.cs (Invocation::ConversionExists): Correct the member lookup
16030 to find "op_Implicit", not "implicit" ;-)
16031 (UserImplicitCast): New class to take care of user-defined implicit conversions.
16032 (ConvertImplicit, ForceConversion): Take TypeContainer argument
16034 * everywhere : Correct calls to the above accordingly.
16036 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
16037 (ConvertImplicit): Do user-defined conversion if it exists.
16039 2001-09-24 Miguel de Icaza <miguel@ximian.com>
16041 * assign.cs: track location.
16042 (Resolve): Use implicit conversions on assignment.
16044 * literal.cs: Oops. Not good, Emit of short access values should
16045 pass (Bytes) or the wrong argument will be selected.
16047 * expression.cs (Unary::Emit): Emit code for -expr.
16049 (Unary::ResolveOperator): Handle `Substract' for non-constants
16050 (substract from zero from the non-constants).
16051 Deal with Doubles as well.
16053 (Expression::ConvertImplicitRequired): New routine that reports an
16054 error if no implicit conversion exists.
16056 (Invocation::OverloadResolve): Store the converted implicit
16057 expressions if we make them
16059 2001-09-24 Ravi Pratap <ravi@ximian.com>
16061 * class.cs (ConstructorInitializer): Take a Location argument.
16062 (ConstructorBaseInitializer): Same here.
16063 (ConstructorThisInitializer): Same here.
16065 * cs-parser.jay : Update all calls accordingly.
16067 * expression.cs (Unary, Binary, New): Take location argument.
16068 Update accordingly everywhere.
16070 * cs-parser.jay : Update all calls to the above to take a location
16073 * class.cs : Ditto.
16075 2001-09-24 Ravi Pratap <ravi@ximian.com>
16077 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
16078 (Invocation::BetterConversion): Same here
16079 (Invocation::ConversionExists): Ditto.
16081 (Invocation::ConversionExists): Implement.
16083 2001-09-22 Ravi Pratap <ravi@ximian.com>
16085 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
16086 Also take an additional TypeContainer argument.
16088 * All over : Pass in TypeContainer as argument to OverloadResolve.
16090 * typemanager.cs (CSharpName): Update to check for the string type and return
16093 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
16096 2001-09-21 Ravi Pratap <ravi@ximian.com>
16098 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
16099 (Invocation::BetterFunction): Implement.
16100 (Invocation::BetterConversion): Implement.
16101 (Invocation::ConversionExists): Skeleton, no implementation yet.
16103 Okay, things work fine !
16105 2001-09-21 Miguel de Icaza <miguel@ximian.com>
16107 * typemanager.cs: declare and load enum_type, delegate_type and
16110 * expression.cs (Expression::Emit): Now emit returns a value that
16111 tells whether a value is left on the stack or not. This strategy
16112 might be reveted tomorrow with a mechanism that would address
16113 multiple assignments.
16114 (Expression::report118): Utility routine to report mismatches on
16117 (Unary::Report23): Report impossible type/operator combination
16120 (Unary::IsIncrementableNumber): Whether the type can be
16121 incremented or decremented with add.
16122 (Unary::ResolveOperator): Also allow enumerations to be bitwise
16124 (Unary::ResolveOperator): Implement ++, !, ~,
16126 (Invocation::Emit): Deal with new Emit convetion.
16128 * All Expression derivatives: Updated their Emit method to return
16129 whether they leave values on the stack or not.
16131 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
16132 stack for expressions that are statements.
16134 2001-09-20 Miguel de Icaza <miguel@ximian.com>
16136 * expression.cs (LValue): New interface. Must be implemented by
16138 (LocalVariableReference, ParameterReference, FieldExpr): Implement
16141 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
16142 interface for generating code, simplifies the code.
16144 2001-09-20 Ravi Pratap <ravi@ximian.com>
16146 * expression.cs (everywhere): Comment out return statements in ::Resolve
16147 methods to avoid the warnings.
16149 2001-09-20 Miguel de Icaza <miguel@ximian.com>
16151 * driver.cs (parse): Report error 2001 if we can not open the
16154 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
16157 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
16160 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
16161 otherwise nested blocks end up with the same index.
16163 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
16165 * expression.cs: Instead of having FIXMEs in the Resolve
16166 functions, throw exceptions so it is obvious that we are facing a
16169 * cs-parser.jay (invocation_expression): Pass Location information.
16171 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
16172 Use a basename for those routines because .NET does not like paths
16175 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
16178 2001-09-19 Miguel de Icaza <miguel@ximian.com>
16180 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
16181 are loading the correct data types (throws an exception if not).
16182 (TypeManager::InitCoreTypes): Use CoreLookupType
16184 * expression.cs (Unary::ResolveOperator): return the child
16185 expression for expressions which are just +expr.
16186 (Unary::ResolveOperator): Return negative literals for -LITERAL
16187 expressions (otherwise they are Unary {Literal}).
16188 (Invocation::Badness): Take into account `Implicit constant
16189 expression conversions'.
16191 * literal.cs (LongLiteral): Implement long literal class.
16192 (IntLiteral): export the `Value' of the intliteral.
16194 2001-09-19 Ravi Pratap <ravi@ximian.com>
16196 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
16198 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
16199 instead of 'Operator'
16201 * expression.cs (Binary::ResolveOperator): Update accordingly.
16202 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
16205 * cs-parser.jay (unary_expression): Update to use the new names.
16207 * gen-treedump.cs (GetUnary): Same here.
16209 * expression.cs (Unary::Resolve): Implement.
16210 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
16211 operators are found instead of making noise ;-)
16212 (Unary::ResolveOperator): New method to do precisely the same thing which
16213 Binary::ResolveOperator does for Binary expressions.
16214 (Unary.method, .Arguments): Add.
16215 (Unary::OperName): Implement.
16216 (Unary::ForceConversion): Copy and Paste !
16218 * class.cs (Operator::Define): Fix a small bug for the case when we have
16221 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
16222 for the inbuilt operators. Only overloading works for now ;-)
16224 2001-09-18 Miguel de Icaza <miguel@ximian.com>
16226 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
16227 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
16229 * expression.cs (This::Emit): Implement.
16230 (This::Resolve): Implement.
16231 (TypeOf:Resolve): Implement.
16232 (Expression::ResolveSimpleName): Add an implicit this to instance
16234 (MemberAccess::Resolve): Deal with Parameters and Fields.
16235 Bind instance variable to Field expressions.
16236 (FieldExpr::Instance): New field used to track the expression that
16237 represents the object instance.
16238 (FieldExpr::Resolve): Track potential errors from MemberLookup not
16240 (FieldExpr::Emit): Implement.
16242 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
16243 the last instruction contains a return opcode to avoid generating
16244 the last `ret' instruction (this generates correct code, and it is
16245 nice to pass the peverify output).
16247 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
16248 initializer for static and instance variables.
16249 (Constructor::Emit): Allow initializer to be null in the case of
16250 static constructors. Only emit initializer for instance
16253 (TypeContainer::FindMembers): Return a null array if there are no
16256 Also fix the code for the MemberTypes.Method branch, as it was not
16257 scanning that for operators (or tried to access null variables before).
16259 * assign.cs (Assign::Emit): Handle instance and static fields.
16263 * driver.cs: Stop compilation if there are parse errors.
16265 * cs-parser.jay (constructor_declaration): Provide default base
16266 initializer for non-static constructors.
16267 (constructor_declarator): Do not provide a default base
16268 initializers if none was specified.
16269 Catch the fact that constructors should not have parameters.
16271 * class.cs: Do not emit parent class initializers for static
16272 constructors, that should be flagged as an error.
16274 2001-09-18 Ravi Pratap <ravi@ximian.com>
16276 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
16277 Move back code into TypeContainer::Populate.
16279 2001-09-18 Ravi Pratap <ravi@ximian.com>
16281 * class.cs (TypeContainer::AddConstructor): Fix the check to
16282 compare against Name, not Basename.
16283 (Operator::OpType): Change Plus and Minus to Add and Subtract.
16285 * cs-parser.jay : Update accordingly.
16287 * class.cs (TypeContainer::FindMembers): For the case where we are searching
16288 for methods, don't forget to look into the operators too.
16289 (RegisterMethodBuilder): Helper method to take care of this for
16290 methods, constructors and operators.
16291 (Operator::Define): Completely revamp.
16292 (Operator.OperatorMethod, MethodName): New fields.
16293 (TypeContainer::Populate): Move the registering of builders into
16294 RegisterMethodBuilder.
16295 (Operator::Emit): Re-write.
16297 * expression.cs (Binary::Emit): Comment out code path to emit method
16298 invocation stuff for the case when we have a user defined operator. I am
16299 just not able to get it right !
16301 2001-09-17 Miguel de Icaza <miguel@ximian.com>
16303 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
16306 (Expression::MemberLookup): Provide a version that allows to
16307 specify the MemberTypes and BindingFlags.
16309 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
16310 so it was not fetching variable information from outer blocks.
16312 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
16313 Beforefieldinit as it was buggy.
16315 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
16316 that Ravi put here.
16318 * class.cs (Constructor::Emit): Only emit if block is not null.
16319 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
16320 deal with this by semantically definining it as if the user had
16323 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
16324 constructors as we now "emit" them at a higher level.
16326 (TypeContainer::DefineDefaultConstructor): Used to define the
16327 default constructors if none was provided.
16329 (ConstructorInitializer): Add methods Resolve and Emit.
16331 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
16333 2001-09-17 Ravi Pratap <ravi@ximian.com>
16335 * class.cs (TypeContainer::EmitDefaultConstructor): Register
16336 the default constructor builder with our hashtable for methodbuilders
16339 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
16340 and argument_count is 0 in which case we have a match.
16341 (Binary::ResolveOperator): More null checking and miscellaneous coding
16344 2001-09-17 Ravi Pratap <ravi@ximian.com>
16346 * rootcontext.cs (IsNameSpace): Compare against null.
16348 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
16350 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
16351 and Unary::Operator.
16353 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
16356 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
16357 we have overloaded operators.
16358 (Binary::ResolveOperator): Implement the part which does the operator overload
16361 * class.cs (Operator::Emit): Implement.
16362 (TypeContainer::Emit): Emit the operators we have too.
16364 * expression.cs (Binary::Emit): Update to emit the appropriate code for
16365 the case when we have a user-defined operator.
16367 2001-09-17 Miguel de Icaza <miguel@ximian.com>
16369 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
16371 2001-09-16 Ravi Pratap <ravi@ximian.com>
16373 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
16374 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
16375 (Constructor::Emit): Implement.
16376 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
16377 if we have no work to do.
16378 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
16381 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
16382 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
16384 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
16387 2001-09-15 Ravi Pratap <ravi@ximian.com>
16389 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
16391 (Tree::RecordNamespace): Method to do what the name says ;-)
16392 (Tree::Namespaces): Property to get at the namespaces hashtable.
16394 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
16397 * rootcontext.cs (IsNamespace): Fixed it :-)
16399 2001-09-14 Miguel de Icaza <miguel@ximian.com>
16401 * class.cs (TypeContainer::FindMembers): Add support for
16403 (MethodCore): New class that encapsulates both the shared aspects
16404 of a Constructor and a Method.
16405 (Method, Constructor): Factored pieces into MethodCore.
16407 * driver.cs: Added --fatal which makes errors throw exceptions.
16408 Load System assembly as well as part of the standard library.
16410 * report.cs: Allow throwing exceptions on errors for debugging.
16412 * modifiers.cs: Do not use `parent', instead use the real type
16413 container to evaluate permission settings.
16415 * class.cs: Put Ravi's patch back in. He is right, and we will
16416 have to cope with the
16418 2001-09-14 Ravi Pratap <ravi@ximian.com>
16420 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
16421 FamORAssem, not FamANDAssem.
16423 2001-09-14 Miguel de Icaza <miguel@ximian.com>
16425 * driver.cs: Added --parse option that only parses its input files
16428 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
16429 incorrect. IsTopLevel is not used to tell whether an object is
16430 root_types or not (that can be achieved by testing this ==
16431 root_types). But to see if this is a top-level *class* (not
16432 necessarly our "toplevel" container).
16434 2001-09-14 Ravi Pratap <ravi@ximian.com>
16436 * enum.cs (Enum::Define): Modify to call the Lookup method on the
16437 parent instead of a direct call to GetType.
16439 2001-09-14 Ravi Pratap <ravi@ximian.com>
16441 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
16442 Modifiers.TypeAttr. This should just be a call to that method.
16444 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
16445 object so that we can determine if we are top-level or not.
16447 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
16450 * enum.cs (Enum::Define): Ditto.
16452 * modifiers.cs (FieldAttr): Re-write.
16454 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
16455 (TypeContainer::HaveStaticConstructor): New property to provide access
16456 to precisely that info.
16458 * modifiers.cs (MethodAttr): Re-write.
16459 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
16461 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
16462 of top-level types as claimed.
16464 2001-09-13 Miguel de Icaza <miguel@ximian.com>
16466 * expression.cs (MemberLookup): Fruitless attempt to lookup
16467 constructors. Maybe I need to emit default constructors? That
16468 might be it (currently .NET emits this for me automatically).
16469 (Invocation::OverloadResolve): Cope with Arguments == null.
16470 (Invocation::EmitArguments): new function, shared by the new
16471 constructor and us.
16472 (Invocation::Emit): Handle static and instance methods. Emit
16473 proper call instruction for virtual or non-virtual invocations.
16474 (New::Emit): Implement.
16475 (New::Resolve): Implement.
16476 (MemberAccess:Resolve): Implement.
16477 (MethodGroupExpr::InstanceExpression): used conforming to the spec
16478 to track instances.
16479 (FieldExpr::Resolve): Set type.
16481 * support.cs: Handle empty arguments.
16483 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
16484 SimpleLookup): Auxiliary routines to help parse a qualifier
16487 Update qualifier_identifier rule.
16489 * codegen.cs: Removed debugging messages.
16491 * class.cs: Make this a global thing, this acts just as a "key" to
16492 objects that we might have around.
16494 (Populate): Only initialize method_builders_to_methods once.
16496 * expression.cs (PropertyExpr): Initialize type from the
16499 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
16500 Resolve pattern. Attempt to implicitly convert value to boolean.
16503 * expression.cs: Set the type for the int32/int32 argument case.
16504 (Binary::ResolveOperator): Set the return type to boolean for
16505 comparission operators
16507 * typemanager.cs: Remove debugging print code.
16509 (Invocation::Resolve): resolve type.
16511 * class.cs: Allocate a MemberInfo of the correct size, as the code
16512 elsewhere depends on the test to reflect the correct contents.
16514 (Method::) Keep track of parameters, due to System.Reflection holes
16516 (TypeContainer::Populate): Keep track of MethodBuilders to Method
16519 (TypeContainer::FindMembers): Use ArrayList and then copy an array
16520 of the exact size and return that.
16522 (Class::LookupMethodByBuilder): New function that maps
16523 MethodBuilders to its methods. Required to locate the information
16524 on methods because System.Reflection bit us again.
16526 * support.cs: New file, contains an interface ParameterData and
16527 two implementations: ReflectionParameters and InternalParameters
16528 used to access Parameter information. We will need to grow this
16531 * expression.cs (Invocation::GetParameterData): implement a cache
16532 and a wrapper around the ParameterData creation for methods.
16533 (Invocation::OverloadResolve): Use new code.
16535 2001-09-13 Ravi Pratap <ravi@ximian.com>
16537 * class.cs (TypeContainer::EmitField): Remove and move into
16538 (Field::Define): here and modify accordingly.
16539 (Field.FieldBuilder): New member.
16540 (TypeContainer::Populate): Update accordingly.
16541 (TypeContainer::FindMembers): Implement.
16543 2001-09-13 Miguel de Icaza <miguel@ximian.com>
16545 * statement.cs: (VariableInfo::VariableType): New field to be
16546 initialized with the full type once it is resolved.
16548 2001-09-12 Miguel de Icaza <miguel@ximian.com>
16550 * parameter.cs (GetParameterInfo): Use a type cache to compute
16551 things only once, and to reuse this information
16553 * expression.cs (LocalVariableReference::Emit): Implement.
16554 (OpcodeCast::Emit): fix.
16556 (ParameterReference::Resolve): Implement.
16557 (ParameterReference::Emit): Implement.
16559 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
16560 that are expressions need to stay as Expressions.
16562 * typemanager.cs (CSharpName): Returns the C# name of a type if
16565 * expression.cs (Expression::ConvertImplicit): New function that
16566 implements implicit type conversions.
16568 (Expression::ImplicitReferenceConversion): Implements implicit
16569 reference conversions.
16571 (EmptyCast): New type for transparent casts.
16573 (OpcodeCast): New type for casts of types that are performed with
16574 a sequence of bytecodes.
16576 (BoxedCast): New type used for casting value types into reference
16577 types. Emits a box opcode.
16579 (Binary::DoNumericPromotions): Implements numeric promotions of
16580 and computation of the Binary::Type.
16582 (Binary::EmitBranchable): Optimization.
16584 (Binary::Emit): Implement code emission for expressions.
16586 * typemanager.cs (TypeManager): Added two new core types: sbyte
16589 2001-09-12 Ravi Pratap <ravi@ximian.com>
16591 * class.cs (TypeContainer::FindMembers): Method which does exactly
16592 what Type.FindMembers does, only we don't have to use reflection. No
16593 implementation yet.
16595 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
16596 typecontainer objects as we need to get at them.
16597 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
16599 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
16600 typecontainer object.
16602 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
16603 of just a Report object.
16605 2001-09-11 Ravi Pratap <ravi@ximian.com>
16607 * class.cs (Event::Define): Go back to using the prefixes "add_" and
16609 (TypeContainer::Populate): Now define the delegates of the type too.
16610 (TypeContainer.Delegates): Property to access the list of delegates defined
16613 * delegates.cs (Delegate::Define): Implement partially.
16615 * modifiers.cs (TypeAttr): Handle more flags.
16617 2001-09-11 Ravi Pratap <ravi@ximian.com>
16619 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
16621 (Operator::Define): Re-write logic to get types by using the LookupType method
16622 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
16623 (Indexer::Define): Ditto.
16624 (Event::Define): Ditto.
16625 (Property::Define): Ditto.
16627 2001-09-10 Ravi Pratap <ravi@ximian.com>
16629 * class.cs (TypeContainer::Populate): Now define operators too.
16630 (TypeContainer.Operators): New property to access the list of operators
16632 (Operator.OperatorMethodBuilder): New member to hold the method builder
16633 for the operator we are defining.
16634 (Operator::Define): Implement.
16636 2001-09-10 Ravi Pratap <ravi@ximian.com>
16638 * class.cs (Event::Define): Make the prefixes of the accessor methods
16639 addOn_ and removeOn_
16641 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
16642 of the location being passed in too. Ideally, this should go later since all
16643 error reporting should be done through the Report object.
16645 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
16646 (Populate): Iterate thru the indexers we have and define them too.
16647 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
16648 for the get and set accessors.
16649 (Indexer::Define): Implement.
16651 2001-09-09 Miguel de Icaza <miguel@ximian.com>
16653 * expression.cs (Binary::Resolve): Beginning of it. I scratched
16654 my previous implementation, did not work.
16656 * typemanager.cs: Add a couple of missing types (the longs).
16658 * literal.cs: Use TypeManager.bool_type instead of getting it.
16660 * expression.cs (EventExpr): New kind of expressions.
16661 (Expressio::ExprClassFromMemberInfo): finish
16663 2001-09-08 Miguel de Icaza <miguel@ximian.com>
16665 * assign.cs: Emit stores to static fields differently.
16667 2001-09-08 Ravi Pratap <ravi@ximian.com>
16669 * Merge in changes and adjust code to tackle conflicts. Backed out my
16670 code in Assign::Resolve ;-)
16672 2001-09-08 Ravi Pratap <ravi@ximian.com>
16674 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
16675 instead Report.Error and also pass in the location.
16676 (CSharpParser::Lexer): New readonly property to return the reference
16677 to the Tokenizer object.
16678 (declare_local_variables): Use Report.Error with location instead of plain
16682 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
16683 (Operator.CheckBinaryOperator): Ditto.
16685 * cs-parser.jay (operator_declarator): Update accordingly.
16687 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
16688 (CheckBinaryOperator): Same here.
16690 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
16691 on the name without any prefixes of namespace names etc. This is because we
16692 already might have something already fully qualified like
16693 'System.Console.WriteLine'
16695 * assign.cs (Resolve): Begin implementation. Stuck ;-)
16697 2001-09-07 Ravi Pratap <ravi@ximian.com>
16699 * cs-tokenizer.cs (location): Return a string which also contains
16702 * expression.cs (ElementAccess): New class for expressions of the
16703 type 'element access.'
16704 (BaseAccess): New class for expressions of the type 'base access.'
16705 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
16708 * cs-parser.jay (element_access): Implement action.
16709 (base_access): Implement actions.
16710 (checked_expression, unchecked_expression): Implement.
16712 * cs-parser.jay (local_variable_type): Correct and implement.
16713 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
16715 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
16717 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
16718 name and the specifiers.
16720 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
16722 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
16723 making them all public ;-)
16725 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
16728 2001-09-07 Miguel de Icaza <miguel@ximian.com>
16730 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
16732 (FieldExpr, PropertyExprs): New resolved expressions.
16733 (SimpleName::MemberStaticCheck): Perform static checks for access
16734 to non-static fields on static methods. Maybe this should be
16735 generalized for MemberAccesses.
16736 (SimpleName::ResolveSimpleName): More work on simple name
16739 * cs-parser.jay (primary_expression/qualified_identifier): track
16740 the parameter index.
16742 * codegen.cs (CodeGen::Save): Catch save exception, report error.
16743 (EmitContext::EmitBoolExpression): Chain to expression generation
16744 instead of temporary hack.
16745 (::EmitStatementExpression): Put generic expression code generation.
16747 * assign.cs (Assign::Emit): Implement variable assignments to
16748 local variables, parameters and fields.
16750 2001-09-06 Miguel de Icaza <miguel@ximian.com>
16752 * statement.cs (Block::GetVariableInfo): New method, returns the
16753 VariableInfo for a variable name in a block.
16754 (Block::GetVariableType): Implement in terms of GetVariableInfo
16756 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
16757 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
16759 2001-09-06 Ravi Pratap <ravi@ximian.com>
16761 * cs-parser.jay (operator_declaration): Continue on my quest : update
16762 to take attributes argument.
16763 (event_declaration): Ditto.
16764 (enum_declaration): Ditto.
16765 (indexer_declaration): Ditto.
16767 * class.cs (Operator::Operator): Update constructor accordingly.
16768 (Event::Event): Ditto.
16770 * delegate.cs (Delegate::Delegate): Same here.
16772 * enum.cs (Enum::Enum): Same here.
16774 2001-09-05 Ravi Pratap <ravi@ximian.com>
16776 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
16778 * ../tests/cs0658.cs : New file to demonstrate error 0658.
16780 * attribute.cs (Attributes): New class to encapsulate all attributes which were
16781 being passed around as an arraylist.
16782 (Attributes::AddAttribute): Method to add attribute sections.
16784 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
16785 (struct_declaration): Update accordingly.
16786 (constant_declaration): Update.
16787 (field_declaration): Update.
16788 (method_header): Update.
16789 (fixed_parameter): Update.
16790 (parameter_array): Ditto.
16791 (property_declaration): Ditto.
16792 (destructor_declaration): Ditto.
16794 * class.cs (Struct::Struct): Update constructors accordingly.
16795 (Class::Class): Ditto.
16796 (Field::Field): Ditto.
16797 (Method::Method): Ditto.
16798 (Property::Property): Ditto.
16799 (TypeContainer::OptAttribute): update property's return type.
16801 * interface.cs (Interface.opt_attributes): New member.
16802 (Interface::Interface): Update to take the extra Attributes argument.
16804 * parameter.cs (Parameter::Parameter): Ditto.
16806 * constant.cs (Constant::Constant): Ditto.
16808 * interface.cs (InterfaceMemberBase): New OptAttributes field.
16809 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
16810 the attributes as a parameter.
16811 (InterfaceProperty): Update constructor call.
16812 (InterfaceEvent): Ditto.
16813 (InterfaceMethod): Ditto.
16814 (InterfaceIndexer): Ditto.
16816 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
16817 pass the attributes too.
16818 (interface_event_declaration): Ditto.
16819 (interface_property_declaration): Ditto.
16820 (interface_method_declaration): Ditto.
16821 (interface_declaration): Ditto.
16823 2001-09-05 Miguel de Icaza <miguel@ximian.com>
16825 * class.cs (Method::Define): Track the "static Main" definition to
16826 create an entry point.
16828 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
16829 EntryPoint if we find it.
16831 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
16832 (EmitContext::ig): Make this variable public.
16834 * driver.cs: Make the default output file be the first file name
16835 with the .exe extension.
16837 Detect empty compilations
16839 Handle various kinds of output targets. Handle --target and
16840 rename -t to --dumper.
16842 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
16843 methods inherited from Expression return now an Expression. This
16844 will is used during the tree rewriting as we resolve them during
16847 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
16848 the spec. Missing entirely is the information about
16849 accessability of elements of it.
16851 (Expression::ExprClassFromMemberInfo): New constructor for
16852 Expressions that creates a fully initialized Expression based on
16853 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
16856 (Invocation::Resolve): Begin implementing resolution of invocations.
16858 * literal.cs (StringLiteral): Implement Emit.
16860 2001-09-05 Ravi Pratap <ravi@ximian.com>
16862 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
16865 2001-09-04 Ravi Pratap <ravi@ximian.com>
16867 * cs-parser.jay (attribute_arguments): Implement actions.
16868 (attribute): Fix bug in production. Implement action.
16869 (attribute_list): Implement.
16870 (attribute_target): Implement.
16871 (attribute_target_specifier, opt_target_specifier): Implement
16872 (CheckAttributeTarget): New method to check if the attribute target
16874 (attribute_section): Implement.
16875 (opt_attributes): Implement.
16877 * attribute.cs : New file to handle attributes.
16878 (Attribute): Class to hold attribute info.
16880 * cs-parser.jay (opt_attribute_target_specifier): Remove production
16881 (attribute_section): Modify production to use 2 different rules to
16882 achieve the same thing. 1 s/r conflict down !
16883 Clean out commented, useless, non-reducing dimension_separator rules.
16885 * class.cs (TypeContainer.attributes): New member to hold list
16886 of attributes for a type.
16887 (Struct::Struct): Modify to take one more argument, the attribute list.
16888 (Class::Class): Ditto.
16889 (Field::Field): Ditto.
16890 (Method::Method): Ditto.
16891 (Property::Property): Ditto.
16893 * cs-parser.jay (struct_declaration): Update constructor call to
16894 pass in the attributes too.
16895 (class_declaration): Ditto.
16896 (constant_declaration): Ditto.
16897 (field_declaration): Ditto.
16898 (method_header): Ditto.
16899 (fixed_parameter): Ditto.
16900 (parameter_array): Ditto.
16901 (property_declaration): Ditto.
16903 * constant.cs (Constant::Constant): Update constructor similarly.
16904 Use System.Collections.
16906 * parameter.cs (Parameter::Parameter): Update as above.
16908 2001-09-02 Ravi Pratap <ravi@ximian.com>
16910 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
16911 (TypeContainer.delegates): New member to hold list of delegates.
16913 * cs-parser.jay (delegate_declaration): Implement the action correctly
16914 this time as I seem to be on crack ;-)
16916 2001-09-02 Miguel de Icaza <miguel@ximian.com>
16918 * rootcontext.cs (RootContext::IsNamespace): new function, used to
16919 tell whether an identifier represents a namespace.
16921 * expression.cs (NamespaceExpr): A namespace expression, used only
16922 temporarly during expression resolution.
16923 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
16924 utility functions to resolve names on expressions.
16926 2001-09-01 Miguel de Icaza <miguel@ximian.com>
16928 * codegen.cs: Add hook for StatementExpressions.
16930 * class.cs: Fix inverted test for static flag in methods.
16932 2001-09-02 Ravi Pratap <ravi@ximian.com>
16934 * class.cs (Operator::CheckUnaryOperator): Correct error number used
16935 to make it coincide with MS' number.
16936 (Operator::CheckBinaryOperator): Ditto.
16938 * ../errors/errors.txt : Remove error numbers added earlier.
16940 * ../errors/cs1019.cs : Test case for error # 1019
16942 * ../errros/cs1020.cs : Test case for error # 1020
16944 * cs-parser.jay : Clean out commented cruft.
16945 (dimension_separators, dimension_separator): Comment out. Ostensibly not
16946 used anywhere - non-reducing rule.
16947 (namespace_declarations): Non-reducing rule - comment out.
16949 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
16950 with TypeContainer::AddEnum.
16952 * delegate.cs : New file for delegate handling classes.
16953 (Delegate): Class for declaring delegates.
16955 * makefile : Update.
16957 * cs-parser.jay (delegate_declaration): Implement.
16959 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
16961 * class.cs (Event::Define): Implement.
16962 (Event.EventBuilder): New member.
16964 * class.cs (TypeContainer::Populate): Update to define all enums and events
16966 (Events): New property for the events arraylist we hold. Shouldn't we move to using
16967 readonly fields for all these cases ?
16969 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
16971 * class.cs (Property): Revamp to use the convention of making fields readonly.
16972 Accordingly modify code elsewhere.
16974 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
16975 the Define method of the Property class.
16977 * class.cs : Clean up applied patch and update references to variables etc. Fix
16979 (TypeContainer::Populate): Update to define all the properties we have. Also
16980 define all enumerations.
16982 * enum.cs (Define): Implement.
16984 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
16986 * cs-parser.jay (overloadable_operator): The semantic value is an
16987 enum of the Operator class.
16988 (operator_declarator): Implement actions.
16989 (operator_declaration): Implement.
16991 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
16992 validity of definitions.
16993 (Operator::CheckBinaryOperator): Static method to check for binary operators
16994 (TypeContainer::AddOperator): New method to add an operator to a type.
16996 * cs-parser.jay (indexer_declaration): Added line to actually call the
16997 AddIndexer method so it gets added ;-)
16999 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
17000 already taken care of by the MS compiler ?
17002 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
17004 * class.cs (Operator): New class for operator declarations.
17005 (Operator::OpType): Enum for the various operators.
17007 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
17009 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
17010 ostensibly handle this in semantic analysis.
17012 * cs-parser.jay (general_catch_clause): Comment out
17013 (specific_catch_clauses, specific_catch_clause): Ditto.
17014 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
17015 (catch_args, opt_catch_args): New productions.
17016 (catch_clause): Rewrite to use the new productions above
17017 (catch_clauses): Modify accordingly.
17018 (opt_catch_clauses): New production to use in try_statement
17019 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
17020 and re-write the code in the actions to extract the specific and
17021 general catch clauses by being a little smart ;-)
17023 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
17024 Hooray, try and catch statements parse fine !
17026 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
17028 * statement.cs (Block::GetVariableType): Fix logic to extract the type
17029 string from the hashtable of variables.
17031 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
17032 I end up making that mistake ;-)
17033 (catch_clauses): Fixed gross error which made Key and Value of the
17034 DictionaryEntry the same : $1 !!
17036 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
17038 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
17040 * cs-parser.jay (event_declaration): Correct to remove the semicolon
17041 when the add and remove accessors are specified.
17043 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
17045 * cs-parser.jay (IndexerDeclaration): New helper class to hold
17046 information about indexer_declarator.
17047 (indexer_declarator): Implement actions.
17048 (parsing_indexer): New local boolean used to keep track of whether
17049 we are parsing indexers or properties. This is necessary because
17050 implicit_parameters come into picture even for the get accessor in the
17051 case of an indexer.
17052 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
17054 * class.cs (Indexer): New class for indexer declarations.
17055 (TypeContainer::AddIndexer): New method to add an indexer to a type.
17056 (TypeContainer::indexers): New member to hold list of indexers for the
17059 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
17061 * cs-parser.jay (add_accessor_declaration): Implement action.
17062 (remove_accessor_declaration): Implement action.
17063 (event_accessors_declaration): Implement
17064 (variable_declarators): swap statements for first rule - trivial.
17066 * class.cs (Event): New class to hold information about event
17068 (TypeContainer::AddEvent): New method to add an event to a type
17069 (TypeContainer::events): New member to hold list of events.
17071 * cs-parser.jay (event_declaration): Implement actions.
17073 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
17075 * cs-parser.jay (dim_separators): Implement. Make it a string
17076 concatenating all the commas together, just as they appear.
17077 (opt_dim_separators): Modify accordingly
17078 (rank_specifiers): Update accordingly. Basically do the same
17079 thing - instead, collect the brackets here.
17080 (opt_rank_sepcifiers): Modify accordingly.
17081 (array_type): Modify to actually return the complete type string
17082 instead of ignoring the rank_specifiers.
17083 (expression_list): Implement to collect the expressions
17084 (variable_initializer): Implement. We make it a list of expressions
17085 essentially so that we can handle the array_initializer case neatly too.
17086 (variable_initializer_list): Implement.
17087 (array_initializer): Make it a list of variable_initializers
17088 (opt_array_initializer): Modify accordingly.
17090 * expression.cs (New::NType): Add enumeration to help us
17091 keep track of whether we have an object/delegate creation
17092 or an array creation.
17093 (New:NewType, New::Rank, New::Indices, New::Initializers): New
17094 members to hold data about array creation.
17095 (New:New): Modify to update NewType
17096 (New:New): New Overloaded contructor for the array creation
17099 * cs-parser.jay (array_creation_expression): Implement to call
17100 the overloaded New constructor.
17102 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
17104 * class.cs (TypeContainer::Constructors): Return member
17105 constructors instead of returning null.
17107 2001-08-26 Miguel de Icaza <miguel@ximian.com>
17109 * typemanager.cs (InitCoreTypes): Initialize the various core
17110 types after we have populated the type manager with the user
17111 defined types (this distinction will be important later while
17112 compiling corlib.dll)
17114 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
17115 on Expression Classification. Now all expressions have a method
17116 `Resolve' and a method `Emit'.
17118 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
17119 generation from working. Also add some temporary debugging
17122 2001-08-24 Miguel de Icaza <miguel@ximian.com>
17124 * codegen.cs: Lots of code generation pieces. This is only the
17125 beginning, will continue tomorrow with more touches of polish. We
17126 handle the fundamentals of if, while, do, for, return. Others are
17127 trickier and I need to start working on invocations soon.
17129 * gen-treedump.cs: Bug fix, use s.Increment here instead of
17132 * codegen.cs (EmitContext): New struct, used during code
17133 emission to keep a context. Most of the code generation will be
17136 * cs-parser.jay: Add embedded blocks to the list of statements of
17137 this block. So code generation proceeds in a top down fashion.
17139 2001-08-23 Miguel de Icaza <miguel@ximian.com>
17141 * statement.cs: Add support for multiple child blocks.
17143 2001-08-22 Miguel de Icaza <miguel@ximian.com>
17145 * codegen.cs (EmitCode): New function, will emit the code for a
17146 Block of code given a TypeContainer and its ILGenerator.
17148 * statement.cs (Block): Standard public readonly optimization.
17149 (Block::Block constructors): Link children.
17150 (Block::Child): Child Linker.
17151 (Block::EmitVariables): Emits IL variable declarations.
17153 * class.cs: Drop support for MethodGroups here, delay until
17155 (Method::): Applied the same simplification that I did before, and
17156 move from Properties to public readonly fields.
17157 (Method::ParameterTypes): Returns the parameter types for the
17158 function, and implements a cache that will be useful later when I
17159 do error checking and the semantic analysis on the methods is
17161 (Constructor::GetCallingConvention): Renamed from CallingConvetion
17162 and made a method, optional argument tells whether this is a class
17163 or a structure to apply the `has-this' bit.
17164 (Method::GetCallingConvention): Implement, returns the calling
17166 (Method::Define): Defines the type, a second pass is performed
17167 later to populate the methods.
17169 (Constructor::ParameterTypes): implement a cache similar to the
17170 one on Method::ParameterTypes, useful later when we do semantic
17173 (TypeContainer::EmitMethod): New method. Emits methods.
17175 * expression.cs: Removed MethodGroup class from here.
17177 * parameter.cs (Parameters::GetCallingConvention): new method.
17179 2001-08-21 Miguel de Icaza <miguel@ximian.com>
17181 * class.cs (TypeContainer::Populate): Drop RootContext from the
17184 (Constructor::CallingConvention): Returns the calling convention.
17185 (Constructor::ParameterTypes): Returns the constructor parameter
17188 (TypeContainer::AddConstructor): Keep track of default constructor
17189 and the default static constructor.
17191 (Constructor::) Another class that starts using `public readonly'
17192 instead of properties.
17194 (Constructor::IsDefault): Whether this is a default constructor.
17196 (Field::) use readonly public fields instead of properties also.
17198 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
17199 track of static constructors; If none is used, turn on
17200 BeforeFieldInit in the TypeAttributes.
17202 * cs-parser.jay (opt_argument_list): now the return can be null
17203 for the cases where there are no arguments.
17205 (constructor_declarator): If there is no implicit `base' or
17206 `this', then invoke the default parent constructor.
17208 * modifiers.cs (MethodAttr): New static function maps a set of
17209 modifiers flags into a MethodAttributes enum
17210 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
17211 MethodAttr, TypeAttr to represent the various mappings where the
17212 modifiers are used.
17213 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
17215 2001-08-19 Miguel de Icaza <miguel@ximian.com>
17217 * parameter.cs (GetParameterInfo): Fix bug where there would be no
17220 * interface.cs (PopulateIndexer): Implemented the code generator
17221 for interface indexers.
17223 2001-08-17 Miguel de Icaza <miguel@ximian.com>
17225 * interface.cs (InterfaceMemberBase): Now we track the new status
17228 (PopulateProperty): Implement property population. Woohoo! Got
17229 Methods and Properties going today.
17231 Removed all the properties for interfaces, and replaced them with
17232 `public readonly' fields.
17234 2001-08-16 Miguel de Icaza <miguel@ximian.com>
17236 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
17237 initialize their hashtables/arraylists only when they are needed
17238 instead of doing this always.
17240 * parameter.cs: Handle refs and out parameters.
17242 * cs-parser.jay: Use an ArrayList to construct the arguments
17243 instead of the ParameterCollection, and then cast that to a
17246 * parameter.cs: Drop the use of ParameterCollection and use
17247 instead arrays of Parameters.
17249 (GetParameterInfo): Use the Type, not the Name when resolving
17252 2001-08-13 Miguel de Icaza <miguel@ximian.com>
17254 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
17255 and instead use public readonly fields.
17257 * class.cs: Put back walking code for type containers.
17259 2001-08-11 Miguel de Icaza <miguel@ximian.com>
17261 * class.cs (MakeConstant): Code to define constants.
17263 * rootcontext.cs (LookupType): New function. Used to locate types
17266 2001-08-08 Miguel de Icaza <miguel@ximian.com>
17268 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
17269 this System.Reflection code is. Kudos to Microsoft
17271 * typemanager.cs: Implement a type cache and avoid loading all
17272 types at boot time. Wrap in LookupType the internals. This made
17273 the compiler so much faster. Wow. I rule!
17275 * driver.cs: Make sure we always load mscorlib first (for
17276 debugging purposes, nothing really important).
17278 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
17279 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
17281 * rootcontext.cs: Lookup types on their namespace; Lookup types
17282 on namespaces that have been imported using the `using' keyword.
17284 * class.cs (TypeContainer::TypeAttr): Virtualize.
17285 (Class::TypeAttr): Return attributes suitable for this bad boy.
17286 (Struct::TypeAttr): ditto.
17287 Handle nested classes.
17288 (TypeContainer::) Remove all the type visiting code, it is now
17289 replaced with the rootcontext.cs code
17291 * rootcontext.cs (GetClassBases): Added support for structs.
17293 2001-08-06 Miguel de Icaza <miguel@ximian.com>
17295 * interface.cs, statement.cs, class.cs, parameter.cs,
17296 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
17297 Drop use of TypeRefs, and use strings instead.
17299 2001-08-04 Miguel de Icaza <miguel@ximian.com>
17303 * class.cs (Struct::Struct): set the SEALED flags after
17304 checking the modifiers.
17305 (TypeContainer::TypeAttr): new property, returns the
17306 TypeAttributes for a class.
17308 * cs-parser.jay (type_list): Oops, list production was creating a
17309 new list of base types.
17311 * rootcontext.cs (StdLib): New property.
17312 (GetInterfaceTypeByName): returns an interface by type name, and
17313 encapsulates error handling here.
17314 (GetInterfaces): simplified.
17315 (ResolveTree): Encapsulated all the tree resolution here.
17316 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
17319 * driver.cs: Add support for --nostdlib, to avoid loading the
17320 default assemblies.
17321 (Main): Do not put tree resolution here.
17323 * rootcontext.cs: Beginning of the class resolution.
17325 2001-08-03 Miguel de Icaza <miguel@ximian.com>
17327 * rootcontext.cs: Provide better error reporting.
17329 * cs-parser.jay (interface_base): set our $$ to be interfaces.
17331 * rootcontext.cs (CreateInterface): Handle the case where there
17332 are no parent interfaces.
17334 (CloseTypes): Routine to flush types at the end.
17335 (CreateInterface): Track types.
17336 (GetInterfaces): Returns an array of Types from the list of
17337 defined interfaces.
17339 * typemanager.c (AddUserType): Mechanism to track user types (puts
17340 the type on the global type hash, and allows us to close it at the
17343 2001-08-02 Miguel de Icaza <miguel@ximian.com>
17345 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
17346 RecordInterface instead.
17348 * cs-parser.jay: Updated to reflect changes above.
17350 * decl.cs (Definition): Keep track of the TypeBuilder type that
17351 represents this type here. Not sure we will use it in the long
17352 run, but wont hurt for now.
17354 * driver.cs: Smaller changes to accomodate the new code.
17356 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
17359 * rootcontext.cs (CreateInterface): New method, used to create
17360 the System.TypeBuilder type for interfaces.
17361 (ResolveInterfaces): new entry point to resolve the interface
17363 (CodeGen): Property, used to keep track of the code generator.
17365 2001-07-26 Miguel de Icaza <miguel@ximian.com>
17367 * cs-parser.jay: Add a second production for delegate_declaration
17370 (enum_body): Put an opt_comma here instead of putting it on
17371 enum_body or enum_member_declarations so we can handle trailing
17372 commas on enumeration members. Gets rid of a shift/reduce.
17374 (type_list): Need a COMMA in the middle.
17376 (indexer_declaration): Tell tokenizer to recognize get/set
17378 * Remove old targets.
17380 * Re-add the parser target.
17382 2001-07-13 Simon Cozens <simon@simon-cozens.org>
17384 * cs-parser.jay: Add precendence rules for a number of operators
17385 ot reduce the number of shift/reduce conflicts in the grammar.
17387 2001-07-17 Miguel de Icaza <miguel@ximian.com>
17389 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
17392 Get rid of old crufty code.
17394 * rootcontext.cs: Use this to keep track of the parsed
17395 representation and the defined types available to the program.
17397 * gen-treedump.cs: adjust for new convention.
17399 * type.cs: Split out the type manager, and the assembly builder
17402 * typemanager.cs: the type manager will live here now.
17404 * cil-codegen.cs: And the code generator here.
17406 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
17408 * makefile: Fixed up for easy making.
17410 2001-07-13 Simon Cozens <simon@simon-cozens.org>
17412 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
17415 (unary_expression): Expand pre_increment_expression and
17416 post_decrement_expression to reduce a shift/reduce.
17418 2001-07-11 Simon Cozens
17420 * cs-tokenizer.cs: Hex numbers should begin with a 0.
17422 Improve allow_keyword_as_indent name.
17424 2001-06-19 Miguel de Icaza <miguel@ximian.com>
17426 * Adjustments for Beta2.
17428 2001-06-13 Miguel de Icaza <miguel@ximian.com>
17430 * decl.cs: Added `Define' abstract method.
17431 (InTransit): new property, used to catch recursive definitions.
17433 * interface.cs: Implement `Define'.
17435 * modifiers.cs: Map Modifiers.constants to
17436 System.Reflection.TypeAttribute flags.
17438 * class.cs: Keep track of types and user-defined types.
17439 (BuilderInit): New method for creating an assembly
17440 (ResolveType): New function to launch the resolution process, only
17441 used by interfaces for now.
17443 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
17444 that are inserted into the name space.
17446 2001-06-08 Miguel de Icaza <miguel@ximian.com>
17448 * ARGH. I have screwed up my tree so many times due to the use of
17449 rsync rather than using CVS. Going to fix this at once.
17451 * driver.cs: Objetify driver. Load assemblies, use assemblies to
17454 2001-06-07 Miguel de Icaza <miguel@ximian.com>
17456 * Experiment successful: Use System.Type rather that our own
17459 2001-05-25 Miguel de Icaza <miguel@ximian.com>
17461 * cs-parser.jay: Removed nsAliases from here.
17463 Use new namespaces, handle `using XXX;'
17465 * namespace.cs: Reimplemented namespace handling, use a recursive
17466 definition of the class. Now we can keep track of using clauses
17467 and catch invalid using clauses.
17469 2001-05-24 Miguel de Icaza <miguel@ximian.com>
17471 * gen-treedump.cs: Adapted for all the renaming.
17473 * expression.cs (Expression): this class now has a Type property
17474 which returns an expression Type.
17476 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
17477 `Type', as this has a different meaning now in the base
17479 2001-05-22 Miguel de Icaza <miguel@ximian.com>
17481 * interface.cs, class.cs: Removed from all the sources the
17482 references to signature computation, as we can not do method
17483 signature computation during the parsing time, as we are not
17484 trying to solve at that point distinguishing:
17488 void a (NS.Blah x) {}
17491 Which depending on the context might be valid or not, as we do not
17492 know if Blah is the same thing as NS.Blah at that point.
17494 * Redid everything so the code uses TypeRefs now instead of
17495 Types. TypeRefs are just temporary type placeholders, that need
17496 to be resolved. They initially have a pointer to a string and the
17497 current scope in which they are used. This is used later by the
17498 compiler to resolve the reference to an actual Type.
17500 * DeclSpace is no longer a CIR.Type, and neither are
17501 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
17502 are all DeclSpaces, but no Types.
17504 * type.cs (TypeRefManager): This implements the TypeRef manager,
17505 which keeps track of all the types that need to be resolved after
17506 the parsing has finished.
17508 2001-05-13 Miguel de Icaza <miguel@ximian.com>
17510 * ARGH. We are going to have to store `foreach' as a class rather
17511 than resolving it, as we need to verify error 1579 after name
17512 resolution. *OR* we could keep a flag that says `This request to
17513 IEnumerator comes from a foreach statement' which we can then use
17514 to generate the error.
17516 2001-05-10 Miguel de Icaza <miguel@ximian.com>
17518 * class.cs (TypeContainer.AddMethod): we now add methods to the
17519 MethodGroup instead of the method hashtable.
17521 * expression.cs: Add MethodGroup abstraction, which gets us one
17522 step closer to the specification in the way we handle method
17525 * cs-parser.jay (primary_expression): qualified_identifier now
17526 tried to match up an identifier to a local variable reference or
17527 to a parameter reference.
17529 current_local_parameters is now a parser global variable that
17530 points to the current parameters for the block, used during name
17533 (property_declaration): Now creates an implicit `value' argument to
17536 2001-05-09 Miguel de Icaza <miguel@ximian.com>
17538 * parameter.cs: Do not use `param' arguments as part of the
17539 signature, per the spec.
17541 2001-05-08 Miguel de Icaza <miguel@ximian.com>
17543 * decl.cs: Base class for classes, structs and interfaces. This
17544 is the "Declaration Space"
17546 * cs-parser.jay: Use CheckDef for checking declaration errors
17547 instead of having one on each function.
17549 * class.cs: Factor out some code for handling error handling in
17550 accordance to the "Declarations" section in the "Basic Concepts"
17551 chapter in the ECMA C# spec.
17553 * interface.cs: Make all interface member classes derive from
17554 InterfaceMemberBase.
17556 2001-05-07 Miguel de Icaza <miguel@ximian.com>
17558 * Many things: all interfaces are parsed and generated in
17559 gen-treedump. Support for member variables, constructors,
17560 destructors, properties, constants is there.
17562 Beginning of the IL backend, but very little done, just there for
17565 2001-04-29 Miguel de Icaza <miguel@ximian.com>
17567 * cs-parser.jay: Fix labeled statement.
17569 * cs-tokenizer.cs (escape): Escape " and ' always.
17570 ref_line, ref_name: keep track of the line/filename as instructed
17571 by #line by the compiler.
17574 2001-04-27 Miguel de Icaza <miguel@ximian.com>
17576 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
17577 to match the values in System.CodeDOM.
17579 Divid renamed to Divide.
17581 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
17583 (Statements.set): remove.
17585 * System.CodeDOM/CodeCatchClause.cs: always have a valid
17588 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
17589 falseStatements always have valid values.
17591 * cs-parser.jay: Use System.CodeDOM now.