1 2006-11-08 Raja R Harinath <rharinath@novell.com>
3 Address parts of #58244 -- most of what's left is in the runtime
4 * driver.cs (LoadAssembly): Simplify slightly. Add CS0009 and
5 CS1509 error checks, and handle them for all assembly loads, not
6 just the first invocation.
7 (LoadModule): Likewise. Move handling of 'adder_method' ...
8 * codegen.cs (AssemblyClass.AddModule): ... here.
10 2006-11-02 Marek Safar <marek.safar@gmail.com>
12 * statement.cs.cs (CollectionForeach.TryType): Issue a error when
13 IEnumerable<T> is ambiguous.
15 2006-10-31 Marek Safar <marek.safar@gmail.com>
18 * statement.cs.cs (CollectionForeach.TryType): Issue a warning when
19 GetEnumerator is ambiguous.
21 * report.cs: Add new warning.
23 2006-10-29 Marek Safar <marek.safar@gmail.com>
26 ecore.cs (PropertyExpr.InstanceResolve): The qualifier for access
27 to protected member can be nested type.
29 2006-10-28 Marek Safar <marek.safar@gmail.com>
32 ecore.cs (PropertyExpr.InstanceResolve): The qualifier for access
33 to protected member must derive from current type.
35 2006-10-27 Marek Safar <marek.safar@gmail.com>
37 assign.cs: Reuses error method.
39 ecore.cs (Expression.Error_ValueCannotBeConverted): Report a value
40 instead of type for constants.
41 (Expression.Error_ValueAssignment): Common error method.
43 * expression.cs (UnaryMutator.ResolveOperator): Value cannot be used
46 2006-10-27 Marek Safar <marek.safar@gmail.com>
49 * expression.cs (MemberAccess.DoResolve): Check nested type
52 2006-10-27 Atsushi Enomoto <atsushi@ximian.com>
54 * doc.cs : nested delegates were not handled. Fixed bug #79754.
56 2006-10-26 Marek Safar <marek.safar@gmail.com>
59 * cs-tokenizer.cs (IsCastToken): Enable a cast of anonymous method.
61 2006-10-26 Marek Safar <marek.safar@gmail.com>
63 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Don't allow to have
64 type forwarder of the same type multiple times.
66 2006-10-26 Raja R Harinath <rharinath@novell.com>
69 * ecore.cs (PropertyExpr.InstanceResolve): Always resolve the
70 instance as an rvalue, even when we later resolve as an lvalue.
72 2006-10-25 Martin Baulig <martin@ximian.com>
74 * anonymous.cs: Fix #79673.
76 2006-10-24 Marek Safar <marek.safar@seznam.cz>
79 expression.cs (ArrayCreation.GetAttributableValue): An initializer can be
80 ignored when is optimized (= default value) as its value is already set.
82 2006-10-23 Marek Safar <marek.safar@seznam.cz>
85 * report.cs (SymbolRelatedToPreviousError): Uses DeclSpace instead of
86 TypeContainer for type lookup.
88 2006-10-23 Marek Safar <marek.safar@seznam.cz>
91 * ecore.cs (ResolveAsBaseTerminal): Removed redundant error test.
92 * expression.cs (OverloadResolve): Always convert type name for
94 (ResolveNamespaceOrType): Don't confuse a nested type with any
97 2006-10-18 Martin Baulig <martin@ximian.com>
99 * anonymous.cs: Propagate the IsStatic state, fixes the crasher in banshee.
101 2006-10-17 Miguel de Icaza <miguel@novell.com>
103 * convert.cs: Fix typo, fixes the test-535.cs, we were casting to
104 an int32, but requesting an int64 from the conversion
106 2006-10-12 Martin Baulig <martin@ximian.com>
109 (AnonymousContainer.Resolve): Inflate the `ReturnType'. Fixes #79592.
111 2006-10-12 Martin Baulig <martin@ximian.com>
114 (Using.EmitLocalVariableDeclFinally): Small fix for iterators.
116 2006-10-11 Miguel de Icaza <miguel@novell.com>
118 * convert.cs: Remove broken code: I was doing the "Existance"
119 tests for Implicit conversions.
121 2006-10-10 Miguel de Icaza <miguel@novell.com>
123 * convert.cs: Added one missing case in
124 ImplicitStandardConversionExists uint64 to intptr.
128 * typemanager.cs (uintptr_type): another core known type.
130 * ecore.cs (OperatorCast): routine used to do cast operations that
131 depend on op_Explicit. We could change some of the Decimal
132 conversions to use this.
134 This one has a probe mechanism that checks both types for an op_
135 which it coudl be used to eliminate two classes: CastToDecimal
138 * convert.cs: Implement the conversions documented in #59800
140 2006-10-10 Martin Baulig <martin@ximian.com>
142 * iterators.cs (Iterator.Resolve): Call RootScope.ResolveType()
143 before RootScope.ResolveMembers().
145 * anonymous.cs (ScopeInfo.CapturedScope.ctor): Use the child's
146 `CurrentType' if appropriate.
148 2006-10-09 Marek Safar <marek.safar@seznam.cz>
151 * cs-tokenizer.cs (Deambiguate_CloseParens): Expression cannot be cast
152 when contains binary operators.
153 * cs-parser.jay: Updated.
155 2006-10-09 Martin Baulig <martin@ximian.com>
158 (Delegate.DefineType): Don't call TypeParameter.Resolve() here;
159 moved that into Define() and also do the other type parameter
160 checks there. Fixes #79094. Added gtest-292.cs.
163 (ArrayCreation.EmitDynamicInitializers): Use `etype.IsValueType'
164 since that doesn't include type parameters; don't use `Ldelema'
165 for type parameters. Fixes #78980. Added gtest-293.cs.
167 2006-10-08 Marek Safar <marek.safar@seznam.cz>
170 * convert.cs (ExplicitReferenceConversion): Only enum to enum value
171 conversion is allowed.
173 2006-10-06 Marek Safar <marek.safar@seznam.cz>
175 * ecore.cs (Expression.MemberLookup): Don't register any symbol for
176 error reporting when no error occurs.
178 2006-10-06 Marek Safar <marek.safar@seznam.cz>
180 * cfold.cs (ConstantFold.BinaryFold): Report an error when the conversion
183 2006-10-06 Raja R Harinath <rharinath@novell.com>
186 * class.cs (DefineTypeBuilder): Check circular dependencies before
187 setting the parent of the TypeBuilder.
188 (CheckRecursiveDefinition): Don't use 'BaseType', since
189 it may not be valid until after DefineTypeBuilder. Use
192 2006-10-04 Martin Baulig <martin@ximian.com>
194 Merged the Anonymous Methods patch.
196 * anonymous.cs, iterators.cs: The new anonymous methods code.
198 * statement.cs (Variable): New public abstract class.
199 (LocalInfo.Variable): New public property.
200 (LocalInfo.ResolveVariable): New public method.
201 (Block.Flags): Add `IsIterator'.
202 (Block.AddVariable): Improved the CS0136 check.
203 (Block.AnonymousChildren): New public property.
204 (Block.AddAnonymousChild): New public method.
205 (ToplevelBlock): Update to use the new anonymous method framework.
206 (ToplevelBlock.ctor): `container' is now a `Block' and not a
207 `ToplevelBlock'; this is required to correctly implement the
209 (Fixed, Using): Use `TemporaryVariable' instead of directly
210 creating the `LocalBuilder'.
212 * parameter.cs (Parameter.ResolveVariable): New public method.
213 (Parameters.ResolveVariable): Likewise.
215 * ecore.cs (TemporaryVariable): Use the new `Variable' framework.
217 * class.cs (TypeContainer): Replaced the `iterators' list and
218 corresponding methods with a list of `CompilerGeneratedClass'es.
219 (TypeContainer.ResolveMembers): New public method.
220 (Method): `IIteratorContainer' has been replaced by
223 * expression.cs (VariableReference): New public abstract base
224 class for `LocalVariableReference', `ParameterReference' and
227 * codegen.cs (EmitContext): Removed `capture_context',
228 `HaveCaptureInfo', `EmitScopeInitFromBlock()' and `Capture*()'.
229 (EmitContext.EmitThis): Removed.
231 * cs-parser.jay: Replace `iterator_container' with
234 2006-10-04 Martin Baulig <martin@ximian.com>
236 * generic.cs (GenericMethod): Don't make this abstract.
237 (Constraints.Clone): Added dummy implementation.
239 2006-10-04 Raja R Harinath <harinath@gmail.com>
242 * namespace.cs (LookForAnyGenericType): Avoid nullref on
243 'declspaces'. Avoid allocating arrays willy-nilly.
246 * cfold.cs (BinaryFold): Move boolean Equality and Inequality
247 cases out of the switch.
249 2006-09-28 Marek Safar <marek.safar@seznam.cz>
251 * namespace.cs (Namespace.Error_NamespaceDoesNotExist): Better error
252 message when non-generic type is used with the type arguments.
253 * expression.cs: Updated.
255 2006-09-28 Raja R Harinath <rharinath@novell.com>
258 * convert.cs (Convert.ImplicitStandardConversionExists): Avoid infloop.
259 * expression.cs (EmptyExpression.Grab, EmptyExpression.Release):
260 Change semantics slightly. Don't insist on having only one
261 temporary EmptyExpression -- just throttle the creation of new ones.
264 * ecore.cs (Expression.MemberLookup): Enable CS0229 errors for
265 non-interfaces too. If no methods are found, don't try to create
268 2006-09-28 Marek Safar <marek.safar@seznam.cz>
270 * ecore.cs (ResolveAsTypeStep): Print better error when type can be
273 * namespace.cs (Namespace.LookForAnyGenericType): New method to help
274 us produce better error message.
276 2006-09-27 Marek Safar <marek.safar@seznam.cz>
278 * expression.cs (Binary.ResolveOperator): Warn about a side effect
281 * report.cs: A new warning added.
283 2006-09-27 Martin Baulig <martin@ximian.com>
285 * generic.cs (GenericMethod): Don't make this abstract.
287 2006-09-27 Martin Baulig <martin@ximian.com>
290 (InternalErrorException): Added overloaded ctor taking a params array.
292 2006-09-26 Marek Safar <marek.safar@seznam.cz>
294 * class.cs, codegen.cs, const.cs, cs-tokenizer.cs, driver.cs, ecore.cs:
295 Fixed the cases when same error was reported twice.
297 * report.cs (SymbolRelatedToPreviousError): Simplified as all our messages
298 now report symbol information.
300 2006-09-25 Martin Baulig <martin@ximian.com>
302 * class.cs: Completely unified with the gmcs version.
304 2006-09-25 Martin Baulig <martin@ximian.com>
306 * typemanager.cs (TypeManager.IsNullableType): New public function.
307 (TypeManager.IsNullableTypeOf): Likewise.
308 (TypeManager.IsNullableValueType): Likewise.
310 * class.cs (MethodCore): Added the `GenericMethod' argument from
311 gmcs and also unified all classes derived from `MethodCore' with gmcs.
313 2006-09-24 Raja R Harinath <harinath@gmail.com>
315 * convert.cs: Unify with gmcs version.
317 2006-09-24 Marek Safar <marek.safar@seznam.cz>
319 * decl.cs (DeclSpace.VerifyClsCompliance): When type has type parameters
322 * report.cs: New warning.
324 2006-09-24 Marek Safar <marek.safar@seznam.cz>
326 * anonymous.cs (AnonymousMethod.Compatible): Cannot generate arguments
327 for anonymous block with out argument.
329 2006-09-24 Marek Safar <marek.safar@seznam.cz>
331 * class.cs (ClassOrStruct.VerifyMembers): Fixed to report correctly
332 not used private events only.
334 2006-09-23 Marek Safar <marek.safar@seznam.cz>
336 * cfold.cs (BinaryFold): On the guest to unify empty constant cast.
338 * const.cs (Const.Define): Check for constant type.
339 (Const.IsConstantTypeValid): Looks for valid constant types.
341 * convert.cs (ImplicitReferenceConversion): NullCast to EmptyConstantCast.
343 * ecore.cs (EmptyConstantCast): New common class for all constant based
346 * expression.cs (Is.DoResolve): Handle null constant especially.
347 (New.DoResolve): Check for new void().
348 (MemberAccess.DoResolve): Cope with all kind of nulls.
350 * literal.cs (NullConstant): Uses EmptyConstantCast.
351 (NullDefault): Based on EmptyConstantCast.
352 (NullLiteral): Uses EmptyConstantCast.
354 * statement.cs (Block.ResolveMeta): Check for constant type.
356 2006-09-22 Martin Baulig <martin@ximian.com>
358 * delegate.cs, attribute.cs: Merged with the gmcs versions.
360 2006-09-22 Raja R Harinath <rharinath@novell.com>
362 * literal.cs (NullDefault): The type of default(IFoo) is 'IFoo',
366 * typemanager.cs (Closure.Filter): Consider PrivateScope attributes.
367 * decl.cs (DeclSpace.FindMemberToOverride): Likewise. Reorganize
370 2006-09-22 Martin Baulig <martin@ximian.com>
372 * ecore.cs: Merged with the gmcs version.
374 * generic.cs (ConstructedType): New dummy class.
375 (TypeArguments): Don't make this abstract.
378 (TypeManager.IsGenericTypeDefinition): New method.
379 (TypeManager.GetGenericFieldDefinition): Moved here from gmcs.
381 2006-09-22 Raja R Harinath <rharinath@novell.com>
383 * expression.cs (ComposedCast): Check for arrays of TypedReference
384 before creating the type, not after.
386 2006-09-21 Marek Safar <marek.safar@seznam.cz>
388 * cfold.cs, const.cs, enum.cs, statement.cs: Updated
391 * constant.cs (Constant.ImplicitConversionRequired): Designed to used
392 when constant must be implicitly convertible.
394 * convert.cs (ImplicitReferenceConversion): Reuse ToType.
396 * ecore.cs (NullCast): Derives from NullConstant.
398 * expression.cs (Is.DoResolve): Removed useless variables.
399 (Conditional.DoResolve): Quick hack for `Foo () ? null : null'.
400 (New.Constantify): Add enum support.
401 (MemberAccess.DoResolve): Add warning when accessing null constant or
404 * generic.cs (GenericConstraints.IsReferenceType): Another dummy
407 * literal.cs (NullConstant): New abstract class with common
408 functionality for all null specializations.
409 (NullDefault): Represents default(X) when result can be
411 (NullLiteral): Updated.
413 * report.cs: Add new warning.
415 2006-09-21 Martin Baulig <martin@ximian.com>
417 * generic.cs (GenericTypeParameterBuilder): Removed this ugly hack.
419 2006-09-21 Martin Baulig <martin@ximian.com>
421 * generic.cs (GenericConstraints): New dummy class.
422 (Constraints): Likewise.
423 (TypeParameter): Likewise.
424 (TypeParameterName): Likewise.
425 (GenericMethod): Likewise.
427 * typemanager.cs (TypeManager.GetGenericArguments): New method.
429 * decl.cs: Merged with the gmcs version.
431 2006-09-21 Raja R Harinath <rharinath@novell.com>
433 * generic.cs (TypeParameter): Implement IMemberContainer.
434 (GenericTypeParameterBuilder): New. An abominable repugnant hack.
436 * rootcontext.cs: Unify with gmcs version.
438 * report.cs: Unify with gmcs version.
439 * typemanager.cs (AddTypeParameter, LookupTypeParameter): Move
440 from gmcs/generics.cs.
441 * generics.cs (TypeParameter): New dummy class.
443 * support.cs: Unify with gmcs version.
445 2006-09-20 Raja R Harinath <rharinath@novell.com>
447 * ecore.cs (MethodGroupExpr.ResolveGeneric): New dummy method.
448 * expression.cs (MemberAccess, BaseAccess): Remove GMCS_SOURCE #ifdef.
450 * decl.cs (MemberName): Unify with gmcs, except for GetTypeExpression.
451 * generic.cs (TypeArguments): New dummy class to help avoid #ifdefs.
452 * mcs.exe.sources: Add generic.cs.
454 * codegen.cs: Unify with gmcs version.
456 * codegen.cs (IResolveContent.GenericDeclContainer): Copy from gmcs.
457 (EmitContext): Add GenericDeclContainer implementation.
458 * decl.cs (MemberCore, DeclSpace): Likewise.
459 * namespace.cs: Remove #ifdef GMCS_SOURCE.
461 * namespace.cs (GetTypeInAssembly): Remove #ifdef GMCS_SOURCE.
462 MCS TypeManager has a corresponding dummy method.
464 2006-09-19 Martin Baulig <martin@ximian.com>
466 * expression.cs: Completely merged with the gmcs version.
468 2006-09-19 Martin Baulig <martin@ximian.com>
470 * expression.cs (Invocation): Merged with the gmcs version.
471 (ArrayAccess.GetStoreOpcode): Likewise.
473 2006-09-19 Martin Baulig <martin@ximian.com>
476 (TypeManager.IsGenericMethod): Moved here from ../gmcs/generic.cs.
477 (TypeManager.IsGenericMethodDefinition): Likewise.
479 2006-09-19 Martin Baulig <martin@ximian.com>
482 (TypeManager.IsEqual): Moved the gmcs implementation here.
483 (TypeManager.DropGenericTypeArguments): Likewise.
484 (TypeManager.DropGenericMethodArguments): Likewise.
485 (TypeManager.GetTypeArguments): Moved here from gmcs.
486 (TypeManager.HasGenericArguments): Likewise.
488 2006-09-19 Martin Baulig <martin@ximian.com>
490 * expression.cs (Binary): Merged with the gmcs version.
492 2006-09-19 Martin Baulig <martin@ximian.com>
494 * expression.cs (Probe, As, Is): Merged with the gmcs version.
496 2006-09-19 Martin Baulig <martin@ximian.com>
498 * typemanager.cs: Merged with the gmcs version.
500 2006-09-16 Raja R Harinath <rharinath@novell.com>
502 * AssemblyInfo.cs [GMCS_SOURCE]: Unify with gmcs source.
503 * driver.cs: Likewise.
505 2006-09-16 Marek Safar <marek.safar@seznam.cz>
508 * class.cs (MethodCore.VerifyClsCompliance): Do check for abstract members
509 only if parent type is class.
510 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Fixed missing cache
513 2006-09-15 Marek Safar <marek.safar@seznam.cz>
516 * expression.cs(MemberAccess.DoResolve): Don't crash when not allowed
518 * typemanager.cs(CSharpName): Converts NullType to null.
520 2006-09-15 Martin Baulig <martin@ximian.com>
523 (TypeManager.GetMethodName): Added mcs implementation.
524 (TypeManager.IsEqual): Likewise.
527 (SimpleName.RemoveGenericArity): Added dummy implementation.
529 * pending.cs: Merged with the gmcs version.
531 2006-09-15 Martin Baulig <martin@ximian.com>
533 * statement.cs: Merge with the gmcs version.
535 2006-09-15 Martin Baulig <martin@ximian.com>
537 * statement.cs (Switch): Merge with the gmcs implementation
538 (without nullables), which is newer.
540 2006-09-15 Martin Baulig <martin@ximian.com>
542 * statement.cs (Block.Variables): Make this public.
543 (ToplevelBlock.Parameters): Make this a property.
544 (Throw.Resolve): Use `TypeManager.IsSubclassOf ()'.
546 2006-09-15 Martin Baulig <martin@ximian.com>
548 * namespace.cs: Merge with the gmcs version.
550 2006-09-15 Martin Baulig <martin@ximian.com>
552 * decl.cs (MemberName): Minor code cleanups.
554 2006-09-15 Martin Baulig <martin@ximian.com>
556 * parameter.cs: Merge with the gmcs version.
558 2006-09-15 Martin Baulig <martin@ximian.com>
560 * enum.cs: Merge with the gmcs version: 3005 is a warning in gmcs
563 2006-09-15 Martin Baulig <martin@ximian.com>
565 * flowanalysis.cs: Merged from GMCS; added the generics code into
566 a `GMCS_SOURCE' conditional so we can share this file.
568 2006-09-08 Martin Baulig <martin@ximian.com>
570 * typemanager.cs (TypeManager.interlocked_type): New public field.
571 (TypeManager.int_interlocked_compare-exchange): New public field.
572 (TypeManager.InitEnumUnderlyingTypes): Also initialize the
573 enumerator types here and call InitGenericCoreTypes().
574 (TypeManager.InitCoreTypes): Call InitEnumeratorTypes() right
575 after calling InitEnumUnderlyingTypes().
578 (RootContext.ResolveCore): Added `System.Threading.Interlocked' to
579 `classes_second_stage'.
581 2006-09-14 Marek Safar <marek.safar@seznam.cz>
583 * assign.cs, ecore.cs, expression.cs: Share error message text.
584 * class.cs (FieldMember.Define): Check for varible of static type.
585 * driver.cs (LoadAssembly): Uses error output for errors.
586 * statement.cs: Updated.
588 2006-09-08 Marek Safar <marek.safar@seznam.cz>
590 * expression.cs (Error_OperatorCannotBeApplied): Report type instead of
593 2006-09-07 Martin Baulig <martin@ximian.com>
596 (MainDriver): Revert r62663 from Marek; see #70506 for details.
598 2006-08-29 Miguel de Icaza <miguel@novell.com>
600 * cs-parser.jay: Turn 1522 into a warning, instead of an error #79210
602 2006-08-17 Miguel de Icaza <miguel@novell.com>
604 * cs-tokenizer.cs: Apply patch from Atsushi Enomoto that fixes
605 #52019 and #79064, the use of the \uXXXX sequence in source code
606 to represent unicode characters.
608 2006-08-15 Marek Safar <marek.safar@seznam.cz>
610 * expression.cs (SizeOf.DoResolve): Check for void type. Fixed enum types
612 * class.cs, ecore.cs, statement.cs: Merged to one error message.
614 2006-08-13 Miguel de Icaza <miguel@novell.com>
616 * assign.cs: Catch attempts to assign to a method groups in += and
619 2006-08-13 Marek Safar <marek.safar@seznam.cz>
622 * cs-parser.jay: Don't destroy current array type by typeof of array's.
624 2006-08-12 Marek Safar <marek.safar@seznam.cz>
626 * class.cs (Method.Define): Issue a warning when generic method looks like
628 * decl.cs (MemberCore.GetSignatureForError): Print member type arguments
631 2006-08-09 Marek Safar <marek.safar@seznam.cz>
633 * anonymous.cs(AnonymousDelegate.Emit): Uses Constructor filter when
635 * decl.cs (MemberCache.FindMembers): When container is interface we need to
636 search all base interfaces as a member can be ambiguous.
637 * delegate.cs (Delegate.FindMembers): Fixed to return valid data for
638 Constructor member type filter.
639 (Delegate.ResolveConstructorMethod) Uses Constructor filter.
640 * ecore.cs: (Expression.MemberLookup): Implemented ambiguity error/warning
641 reporting for returned memberinfos.
642 * report.cs: Updated.
643 * typemanager.cs (TypeManager.LookupBaseInterfacesCache): Uses TypeManager
644 version to work on all runtimes.
645 (TypeManager.RealMemberLookup): Removed members filtering.
647 2006-08-08 Raja R Harinath <rharinath@novell.com>
649 * ecore.cs (FieldExpr.EmitAssign): Release temporary.
650 (PropertyExpr.EmitAssign): Likewise.
651 * expression.cs (Indirection.EmitAssign): Likewise.
652 (LocalVariableReference.EmitAssign): Likewise.
653 (ParameterReference.EmitAssign): Likewise.
654 (Invocation.EmitArguments): Likewise.
655 (ArrayAccess.EmitAssign): Likewise.
656 (IndexerAccess.EmitAssign): Likewise.
657 (This.EmitAssign): Likewise.
658 (ConditionalLogicalOperator.Emit): Likewise.
661 * codegen.cs (EmitContext.GetTemporaryLocal): Simplify. Use Stack
662 instead of ArrayList. If the hashtable has a LocalBuilder, don't
663 leave it in after returning it.
664 (EmitContext.FreeTemporaryLocal): Simplify. Update to changes.
666 2006-08-06 Marek Safar <marek.safar@seznam.cz>
668 * expresssion.cs (IndexerAccess.DoResolve): Fixed to report correct error
671 2006-08-03 Raja R Harinath <rharinath@novell.com>
673 Fix cs0146-3.cs and cs0146-4.cs.
674 * class.cs (TypeManager.CheckRecursiveDefinition): Check that
675 enclosing types don't depend on the current type.
677 2006-08-02 Raja R Harinath <rharinath@novell.com>
680 * class.cs (TypeContainer.DoDefineMembers): Use
681 FindBaseMemberWithSameName on Parent, since we're interested in
682 whether we hide inherited members or not.
683 (FindBaseMemberWithSameName): Make slightly more robust.
685 Fix the non-generic testcase from #77396
686 * decl.cs (DeclSpace.DeclContainer): Remove override.
688 * namespace.cs (NamespaceEntry.Doppelganger): Create slave
689 declspaces for doppelgangers too.
690 (UsingEntry): Implement IResolveContext.
691 (UsingEntry.Resolve): Don't set ToplevelTypes.Namespace. Use
692 'this' as the resolve context.
693 (LocalAliasEntry): Likewise.
695 Implement parts of #77403
696 * roottypes.cs (RootDeclSpace): New. Used to represent the
697 toplevel declaration space. Each namespace declaration introduces
698 a "partial" root declaretion space.
699 * namespace.cs (NamespaceEntry.SlaveDeclSpace): New.
700 (NamespaceEntry.ctor): Create a SlaveDeclSpace if necessary.
701 * cs-parser.jay (CSharpParser.ctor): Initialize 'current_class'
702 from 'current_namespace.SlaveDeclSpace'.
703 (namespace_declaration): Likewise.
704 * class.cs (TypeContainer.ctor): Remove parent==ToplevelTypes
705 check. It can't happen now.
706 * decl.cs (DeclSpace.LookupType): Likewise.
707 * driver.cs (MainDriver): Sanity check.
709 2006-08-01 Raja R Harinath <rharinath@novell.com>
711 * decl.cs (DeclSpace.FindNestedType): Remove.
712 (DeclSpace.LookupNestedTypeINHierarchy): Use PartialContainer and
713 LookupTypeContainer to get the container of the nested type.
714 * class.cs (TypeContainer.FindNestedType): Make non-override.
716 2006-07-31 Raja R Harinath <rharinath@novell.com>
718 * decl.cs (DeclSpace.PartialContainer): Move field from ...
719 * class.cs (TypeContainer.PartialContainer): ... here.
720 (TypeContainer.AddBasesForPart): New helper.
721 (MemberBase.ParentContainer): Remove. Use Parent.PartialContainer
723 * cs-parser.jay (current_class): Convert to DeclSpace.
724 (struct_declaration, interface_declaration, class_declaration):
725 Use AddBasesForPart instead of .Bases directly.
726 * const.cs, iterators.cs: Update to changes.
728 2006-07-28 Raja R Harinath <rharinath@novell.com>
730 * class.cs (TypeContainer.AddMemberType): Rename from
732 (TypeContainer.AddMember): Rename from AddToMemberContainer.
733 (AddTypeContainer): New. Combine AddClassOrStruct and
735 (AddPartial): Update. Add 'is_partial' argument.
736 * roottypes.cs: Update to changes.
737 * cs-parser.jay (push_current_class): New helper for handling
738 current_container and current_class.
739 (struct_declaration, interface_declaration, class_declaration):
742 2006-07-26 Raja R Harinath <rharinath@novell.com>
744 * roottypes.cs: Rename from tree.cs.
746 Rename RootContext.Tree.Types to RootContext.ToplevelTypes.
747 * tree.cs (Tree, ITreeDump): Remove types.
748 * rootcontext.cs (tree, Tree): Remove fields.
749 (root, ToplevelTypes): New.
750 * *.cs: Update to rename.
752 * tree.cs (Tree.RecordDecl): Remove.
753 (RootTypes.AddToTypeContainer): Record the toplevel type in its
755 * class.cs, cs-parser.jay: Remove mention of RecordDecl.
757 2006-07-23 Raja R Harinath <harinath@gmail.com>
759 * codegen.cs (EmitContext.Flags): Move InCatch, InFinally,
760 DoFlowAnalysis and OmitStructFlowAnalysis here.
761 (ec.With): Rename from WithUnsafe and generalize.
762 (ec.WithCheckState): Remove. All users can be handled by 'With'.
763 (ec.WithFlowAnalyis): New.
764 * ecore.cs, expression.cs, statement.cs: Update.
766 2006-07-22 Raja R Harinath <harinath@gmail.com>
768 * statement.cs (Block.ResolveMeta): Simplify slightly.
770 * codegen.cs (EmitContext.Flags): New enum. Used to represent the
771 multiple boolean fields. Convert InUnsafe, constant_check_state,
772 check_state to flags.
773 (CheckState, ConstantCheckState): Update.
774 (InUnsafe): New read-only property.
775 (FlagsHandle): Rename from CheckStateHandle and convert to handle
777 (WithUnsafe): New helper similar to WithCheckState.
778 * statement.cs (Block.ResolveMeta): Use WithUnsafe.
779 (Unsafe.Resolve, Unsafe.DoEmit): Likewise.
781 2006-07-21 Raja R Harinath <rharinath@novell.com>
783 Make comparisons use the same IL irrespective of whether they're
784 in a 'checked' or 'unchecked' context: one of the issues in #78899
785 * codegen.cs (EmitContext.CheckState): Make read-only property.
786 (EmitContext.ConstantCheckState): Likewise.
787 (EmitContext.CheckStateHandle, EmitContext.WithCheckState): New
788 helper that implement a save/restore stack for CheckState
789 values. This is the only way to change check-state.
790 * ecore.cs (Expression.ExpressionToArrayArgument): Use WithCheckState.
791 * expression.cs (CheckedExpr.DoResolve, CheckedExpr.Emit): Likewise.
792 (CheckedExpr.EmitBranchable): New forwarding method.
793 (UnCheckedExpr): Likewise.
794 * statement.cs (Block.ResolveMeta): Use WithCheckState.
795 (Unchecked.Resolve, Unchecked.DoEmit): Likewise.
796 (Checked.Resolve, checked.DoEmit): Likewise.
798 2006-07-20 Miguel de Icaza <miguel@novell.com>
800 * anonymous.cs: Cache the resolved anonymous delegate, and return
801 this so that the ResolveTopBlock is only triggered once, not
804 Currently we trigger ResolvetopBlock twice due to a first pass of
805 argument check compatibility, and a second pass that does the
808 2006-07-15 Marek Safar <marek.safar@seznam.cz>
810 * annonymous.cs (AnonymousMethod.CreateScopeType): Fixed nested type
812 * rootcontext.cs (Reset): Add helper_classes.
814 2006-07-15 Marek Safar <marek.safar@seznam.cz>
817 * statement.cs (Switch.SimpleSwitchEmit): Handle case null at any position
820 2006-07-13 Miguel de Icaza <miguel@novell.com>
822 * statement.cs (Lock): Handle expressions of type
823 TypeManager.null_type specially. Fixes #78770
825 2006-07-08 Marek Safar <marek.safar@seznam.cz>
827 * expression.cs (Binary.ResolveOperator): Don't crash when null is assigned
830 2006-07-08 Marek Safar <marek.safar@seznam.cz>
832 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Fixed to look
833 for accessors as well.
834 * ecore.cs (EventExpr): Add AccessorTable.
836 2006-07-01 Marek Safar <marek.safar@seznam.cz>
839 * attribute.cs, class.cs, ecore.cs : Add missing location of related symbol
840 for CS0122 where appropriate.
841 * typemanager.cs (IsNestedChildOf): Type can be null in the case of top
843 (Filter): Assembly can be null in the case of top level attributes.
845 2006-06-25 Marek Safar <marek.safar@seznam.cz>
849 * ecore.cs (Expression.MemberLookupFailed): Don't crash when failed lookup
850 is done at global level.
852 2006-06-24 Marek Safar <marek.safar@seznam.cz>
854 A fix for #77002, Implemented TypeForwarder support.
856 * attribute.cs (Attribute.GetArgumentType): Reads type argument.
857 * expression.cs (TypeOf.TypeArgument): Exposes typeof type.
858 * typemanager.cs (): Add type_forwarder_attr_type.
860 2006-06-24 Marek Safar <marek.safar@seznam.cz>
862 * report.cs: Add CS0469 warning.
864 2006-06-21 Martin Baulig <martin@ximian.com>
866 * codegen.cs (CodeGen.Save): Moved the symbol file generation into
867 the `try'-block, so we also report CS0016 etc. there.
869 2006-06-21 Martin Baulig <martin@ximian.com>
872 (Delegate.VerifyMethod): Allow `params' methods; fixes #78678.
874 2006-06-21 Martin Baulig <martin@ximian.com>
876 * expression.cs (Unary.ResolveOperator): In `Operator.AddressOf',
877 also report CS1686 for parameters.
879 2006-06-21 Martin Baulig <martin@ximian.com>
881 * statement.cs (GotoCase.Resolve): Report a warning (CS0469)
882 instead of an error if the value is not implicitly convertible to
883 the switch types; fixes #77964.
885 2006-06-21 Raja R Harinath <rharinath@novell.com>
888 * class.cs (FieldBase.ResolveInitializer): Stop resolution if
889 FieldBuilder is null.
892 * expression.cs (Binary.CheckShiftArguments): Don't overwrite original
893 'left' and 'right' before error-checking.
895 2006-06-16 Juraj Skripsky <js@hotfeet.ch>
897 * ecore.cs (SimpleName.Error_ObjectRefRequired): Do not truncate the name.
899 (MemberExpr.EmitInstance): Use GetSignatureForError () to get full name.
900 (FieldExpr.DoResolve): likewise.
901 (PropertyExpr.InstanceResolve): likewise.
902 (EventExpr.InstanceResolve): likewise.
904 2006-06-04 Marek Safar <marek.safar@seznam.cz>
906 * parameter.cs (Parameter.ApplyAttributeBuilder): More DefaultValue
907 attribute applicable tests for attribute argument.
909 2006-06-02 Raja R Harinath <rharinath@novell.com>
912 * expression.cs (Binary.DoNumericPromotions): Remove and rewrite.
913 (Binary.OverloadResolve_PredefinedIntegral): New.
914 (Binary.OverloadResolve_PredefinedFloating): New.
915 (Binary.OverloadResolve_PredefinedString): New.
916 (Binary.ResolveOperator): Use those instead of DoNumericPromotions.
917 Follow the standard more closely, and treat numeric promotions in
918 terms of overload resolution.
919 (Binary.CheckShiftArguments): Simplify.
921 2006-06-01 Raja R Harinath <rharinath@novell.com>
923 * flowanalysis.cs (MyBitVector): Simplify representation.
924 (MyBitVector.Clone): Avoid allocating BitArray.
925 (MyBitVector.operator&): Rename from MyBitVector.And and make symmetric.
926 (MyBitVector.operator|): Likewise, with MyBitVector.Or.
927 (*): Update. Change all references to MyBitVector.And and
928 MyBitVector.Or to &= and |=.
930 2006-05-29 Raja R Harinath <rharinath@novell.com>
933 * cs-parser.jay (formal_parameter_list): Extend the pattern below
934 to param arguments too.
936 2006-05-26 Miguel de Icaza <miguel@novell.com>
938 * cs-parser.jay: Catch another parsing form for arglist being
939 followed by other arguments. Fixes #78313.
941 2006-05-24 Raja R Harinath <rharinath@novell.com>
943 * flowanalysis.cs (FlowBranchingToplevel.AddReturnOrigin): Move
944 checking of out parameters to ...
945 (FlowBranchingToplevel.Merge): ... here.
946 (FlowBranchingException.AddBreakOrigin): If 'finally_vector' is
947 set, propagate the origin upward, and only complain if there was
949 (FlowBranchingException.AddContinueOrigin): Likewise.
950 (FlowBranchingException.AddReturnOrigin): Likewise.
951 (FlowBranchingException.AddGotoOrigin): Likewise.
953 2006-05-23 Raja R Harinath <rharinath@novell.com>
955 * flowanalysis.cs (UsageVector.MergeOrigins): If an origin is
956 unreachable, skip it.
957 (FlowBranchingException.Merge): Always propagate jumps, even if
958 the finally block renders subsequent code unreachable.
960 2006-05-18 Raja R Harinath <rharinath@novell.com>
963 * statement.cs (Goto.Resolve): Move responsibility for resolving
964 'goto' to FlowBranching.AddGotoOrigin.
965 (Goto.SetResolvedTarget): New. Callback to set the
966 LabeledStatement that's the target of the goto.
967 (Goto.DoEmit): Use Leave instead of Br when crossing an
968 unwind-protect boundary.
969 * flowanalysis.cs (FlowBranching.AddGotoOrigin): Rename from
970 LookupLabel and adjust to new semantics.
971 (FlowBranchingToplevel.AddGotoOrigin): Likewise.
972 (FlowBranchingBlock.AddGotoOrigin): Likewise. Use
973 Goto.SetResolvedTarget to update target.
974 (FlowBranchingLabeled.AddGotoOrigin): Likewise.
975 (FlowBranchingException.AddGotoOrigin): Rewrite to be similar to
976 AddBreakOrigin & co. Delay propagation until ...
977 (FlowBranchingException.Merge): ... this.
979 * statement.cs (Block.Resolve): Always depend on flow-branching to
980 determine unreachability. Kill workaround that originally emitted
981 only one statement after an "unreachable" label (see infloop in
984 Fix #77869, #76148, #77755, #75255 and a host of other bugs.
985 This is still "wrong", but anything better would probably need a
986 multi-pass algorithm.
987 * flowanalysis.cs (FlowBranchingLabeled): Salt away a copy of the
988 usage vector. Force current usage vector to be reachable, to
989 optimistically signify backward jumps.
990 (FlowBranchingLabeled.LookupLabel): Note if a backward jump is
992 (FlowBranchingLabeled.Merge): New. If no backward jump was
993 detected, return the original salted-away usage vector instead,
994 updated with appropriate changes. Print unreachable warning if
996 * statement.cs (Block.Resolve): Don't print unreachable warning on
999 2006-05-17 Gert Driesen <drieseng@users.sourceforge.net>
1001 * driver.cs: Pass filename without path to AssemblyBuilder's
1002 AddResourceFile. Fixes bug #78407.
1004 2006-05-17 Raja R Harinath <rharinath@novell.com>
1006 * statement.cs (LabeledStatement.Resolve): Move merging of origins ...
1007 * flowanalysis.cs (FlowBranchingLabeled): ... here.
1008 (FlowBranching.MergeChild): Overwrite
1009 reachability information from Labeled branchings too.
1011 2006-05-16 Raja R Harinath <rharinath@novell.com>
1013 * statement.cs (Goto.Resolve): Merge jump origins here ...
1014 * flowanalysis.cs (FlowBranching.Label): ... rather than here.
1016 * flowanalysis.cs (FlowBranching.LookupLabel): Move CS0159 check ...
1017 (FlowBranchingToplevel.LookupLabel): ... here. Add CS1632 check.
1018 (FlowBranchingGoto.LookupLabel): New. Handle back jumps.
1019 (FlowBranchingBlock.LookupLabel): Call LabeledStatement.AddReference
1021 * statement.cs (Goto.Resolve): ... not here.
1022 (Goto.Emit): Remove CS1632 check.
1024 2006-05-14 Marek Safar <marek.safar@seznam.cz>
1026 * ecore.cs (Expression.ResolveAsTypeTerminal): Fixed type in the obsolete
1029 2006-05-11 Raja R Harinath <rharinath@novell.com>
1031 * flowanalysis.cs (UsageVector.MergeJumpOrigins): Kill.
1032 (FlowBranchingBlock.Label): Use UsageVector.MergeOrigins.
1033 (FlowBranchingException.Label): Likewise.
1035 * flowanalysis.cs (MyBitVector.SetAll): New. Sets all bits to the
1037 (MyBitVector.Or): Use it to avoid losing information (Count).
1038 (FlowBranching.MergeOrigins): Likewise.
1040 * flowanalysis.cs (UsageVector.IsDirty): Remove.
1041 (UsageVector.Parameters, UsageVector.ParameterVector): Likewise.
1042 (UsageVector.Locals, UsageVector.LocalVector): Likewise.
1043 (UsageVector.ToString): Simplify.
1044 (UsageVector.MergeSiblings): Move here from ...
1045 (FlowBranching.Merge): ... here.
1046 (FlowBranchingToplevel.CheckOutParameters): Take an UsageVector,
1049 2006-05-10 Raja R Harinath <rharinath@novell.com>
1051 * flowanalysis.cs (UsageVector.MergeOrigins): Simplify, now that a
1052 null bitvector is treated as all-true.
1054 * flowanalysis.cs (MyBitVector.And, MyBitVector.Or): Make lazier.
1055 (MyBitVector): Rationalize invariants. 'vector != null' implies
1056 that we have our own copy of the bitvector. Otherwise,
1057 'InheritsFrom == null' implies all inherited bits are true.
1059 2006-05-09 Marek Safar <marek.safar@seznam.cz>
1061 * statement.cs (LocalInfo): Add IsConstant.
1062 (LocalInfo.DeclareLocal): Moved from EmitMeta and changed to don't emit
1063 local variable for constants.
1065 2006-05-09 Raja R Harinath <rharinath@novell.com>
1067 * flowanalysis.cs (MyBitVector.Empty): New.
1068 (MyBitVector): Don't allow InheritedFrom to be null.
1069 (MyBitVector.And, MyBitVector.Or): Treat 'null' as all-ones.
1070 (UsageVector, FlowBranching): Update to changes.
1072 * flowanalysis.cs (FlowBranching.InTryWithCatch): Don't terminate
1073 recursion. The 'Parent == null' condition isn't sufficient for
1075 (FlowBranching.AddBreakOrigin): Likewise.
1076 (FlowBranching.AddContinueOrigin): Likewise.
1077 (FlowBranching.AddReturnOrigin): Likewise.
1078 (FlowBranching.StealFinallyClauses): Likewise.
1079 (FlowBranching.MergeTopBlock): Move to FlowBranchingToplevel.
1080 (FlowBranching.CheckOutParameters): Likewise.
1081 (FlowBranchingToplevel): Terminate all the above recursions here.
1082 (FlowBranchingToplevel.End): Rename from MergeTopBlock.
1083 * codegen.cs (EmitContext.ResolveTopBlock): Update to changes.
1085 * flowanalysis.cs (BranchingType.Toplevel): New. Represents a
1087 (FlowBranchingToplevel): New. Empty for now.
1088 (FlowBranching.MergeTopBlock): Update.
1089 * codegen.cs (EmitContext.ResolveTopBlock): Create a Toplevel
1090 branching for the anonymous delegate.
1091 (EmitContext.StartFlowBranching): Add ToplevelBlock variant.
1093 * flowanalysis.cs (UsageVector.MergeOrigins): Reorganize.
1094 (UsageVector.MergeJumpOrigins): Don't ignore current reachability
1095 information at the start of the merge. Reorganize.
1097 2006-05-07 Marek Safar <marek.safar@seznam.cz>
1099 * class.cs (MethodData.Define): Method cannot implement interface accessor.
1101 2006-05-07 Marek Safar <marek.safar@seznam.cz>
1103 * expression.cs (QualifiedAliasMember.ResolveAsTypeStep): Pass location
1104 to newly introduced ctor.
1106 * namespace.cs (Namespace.Error_NamespaceDoesNotExist): Moved an error
1107 message to one place.
1108 (GlobalRootNamespace.Error_NamespaceDoesNotExist): Custom message for
1111 2006-05-07 Marek Safar <marek.safar@seznam.cz>
1113 * const.cs (Const.Error_ExpressionMustBeConstant): Better error message.
1115 * ecore.cs (Expression.ResolveAsConstant): Updated.
1117 * statement.cs (ResolveMeta): Updated.
1119 2006-05-06 Marek Safar <marek.safar@seznam.cz>
1121 * cs-parser.jay: __arglist cannot be used in initializer.
1123 2006-05-06 Marek Safar <marek.safar@seznam.cz>
1126 * namespace.cs (LocalAliasEntry.DoResolve): Don't allow to access nested
1129 2006-05-05 Raja R Harinath <rharinath@novell.com>
1131 * statement.cs (EmptyStatement.ResolveUnreachable): Override.
1132 (LabeledStatement): Add 'name' parameter.
1133 (LabeledStatement.Name, LabeledStatement.JumpOrigins): New.
1134 (Block.AddLabel): Update to changes.
1135 * cs-parser.jay (labeled_statement): Likewise.
1137 * flowanalysis.cs (BranchingType.Labeled): New.
1138 (UsageVector.MergeOrigins): Remove unused 'branching' argument.
1139 (FlowBranchingLabeled): New. Does nothing for now, but will
1140 eventually handle 'goto' flows.
1141 * codegen.cs (StartFlowBranching): Add new LabeledStatement variant.
1142 * statement.cs (LabeledStatement.Resolve): Create a FlowBranching
1143 that's terminated ...
1144 (Block.Resolve): ... here.
1146 * flowanalysis.cs (UsageVector.MergeFinally): Remove.
1147 (UsageVector.MergeFinallyOrigins): Likewise.
1148 (FlowBranching.InTryOrCatch): Likewise.
1149 (FlowBranching.AddFinallyVector): Likewise.
1150 (FlowBranchingException): Update to changes.
1153 * statement.cs (Return.Resolve): Move error checking to ...
1154 * flowbranching.cs (FlowBranching.AddReturnOrigin): ... this.
1155 (FlowBranchingException): Handle return origins like break and
1157 (FlowBranching.UsageVector.CheckOutParameters): Remove.
1159 2006-05-04 Marek Safar <marek.safar@seznam.cz>
1162 * class.cs (TypeContainer.FindMembers): Includes event method in the methods
1165 2006-05-04 Marek Safar <marek.safar@seznam.cz>
1168 * class.cs (MethodData.Define): Do public accessor check only when method
1169 implements an interface.
1171 2006-05-04 Raja R Harinath <rharinath@novell.com>
1173 Remove special handling of 'break'
1174 * flowanalysis.cs (Reachability): Remove all mention of 'breaks'.
1175 (Reachability.Meet): Simplify. Remove 'do_breaks' argument.
1176 (UsageVector.Break): Remove.
1177 (FlowBranching.Merge): Use 'Reachable.IsUnreachable' to determine
1179 (FlowBranchingBreakable.Merge): Don't ResetBreaks.
1181 * statement.cs (Break.Resolve): Call UsageVector.Goto (), not
1182 UsageVector.Breaks (). Don't set NeedsReturnLabel.
1184 2006-05-03 Marek Safar <marek.safar@seznam.cz>
1187 * pending.cs (PendingImplementation.BaseImplements): A found member cannot
1188 be the interface member.
1190 2006-05-03 Marek Safar <marek.safar@seznam.cz>
1193 * constant.cs (LongConstant.EmitLong): Fixed to catch also negative values
1194 for emitting small (int) values.
1196 2006-05-03 Raja R Harinath <rharinath@novell.com>
1199 * flowanalysis.cs (FlowBranchingException.Merge): Ensure
1200 control-flow passes through the 'finally' after merging-in all the
1201 control-flows from 'try' and the 'catch' clauses.
1203 * flowanalysis.cs (FlowBranching.IsLoop): Remove.
1204 (FlowBranching.IsTryOrCatch): Remove 'is_return' parameter. It's
1205 always true at the only non-recursive entry point.
1206 (FlowBranching.CreateBranching) [BranchingType.Loop]: Return a
1207 FlowBranchingBreakable.
1208 (FlowBranchingLoop): Remove.
1209 * statement.cs (Return.DoResolve): Update to changes.
1212 * flowanalysis.cs (FlowBranching.BranchingType.Embedded): New.
1213 (FlowBranching.CreateBranching): Handle it: create a
1214 FlowBranchingContinuable.
1215 (FlowBranching.BreakCrossesExceptionBoundary): Remove.
1216 (FlowBranching.AddContinueOrigin): Similar to AddBreakOrigin,
1217 except that it handles the 'continue' command.
1218 (FlowBranching.UsageVector.MergeOrigins): Rename from
1220 (FlowBranchingContinuable): Similar to FlowBranchingBreakable,
1221 except that it overrides AddContinueOrigin.
1222 (FlowBranchingException): Override AddContinueOrigin, similar to
1224 * statement.cs (While.Resolve, Foreach.ArrayForeach.Resolve):
1225 Create a new branching around the embedded statement.
1226 (Do.Resolve, For.Resolve): Likewise. Do reachability analysis for
1227 control flow after the embedded statement.
1228 (Continue.Resolve): Move all error checking to AddContinueOrigin.
1230 * flowanalysis.cs (FlowBranching.IsSwitch): Remove.
1231 (FlowBranching.CreateBranching) [BranchingType.Switch]: Create a
1232 FlowBranchingBreakable.
1233 (FlowBranchingSwitch): Remove.
1236 * statement.cs (Break.Resolve): Simplify. Move responsibility for
1237 error reporting to ...
1238 * flowanalysis.cs (FlowBranching.AddBreakOrigin) ... this.
1239 Rename from 'AddBreakVector'. Add new location argument. Return
1240 a bool indicating whether the 'break' crosses an unwind-protect.
1241 (FlowBranchingException.AddBreakOrigin): Add.
1242 (FlowBranchingException.Merge): Propagate 'break's to surrounding
1243 flowbranching after updating with the effects of the 'finally'
1245 (FlowBranchingBreakable): New common base class for
1246 FlowBranchingLoop and FlowBranchingSwitch.
1248 * statement.cs (Foreach.ArrayForeach.Resolve): Set barrier after
1250 (Foreach.CollectionForeach.Resolve): Remove extraneous flowbranching.
1252 2006-05-02 Raja R Harinath <rharinath@novell.com>
1254 * statement.cs (Do.Resolve): If the loop is infinite, set the
1256 (While.Resolve, For.Resolve): Set a barrier after the embedded
1257 statement. There's no direct control flow that goes from the end
1258 of the embedded statement to the end of the loop.
1259 * flowanalysis.cs (FlowBranching.Infinite): Remove.
1260 (FlowBranchingLoop.Merge): Don't look at 'Infinite'. The changes
1261 above ensure that the reachability is correctly computed.
1263 * flowanalysis.cs (Reachability.ResetBarrier): Remove.
1264 (UsageVector.MergeBreakOrigins): If the current path is
1265 unreachable, treat it as if all parameters/locals are initialized.
1266 (FlowBranchingLoop.Merge): Don't clear any barriers. Handle
1267 infinite loops before merging-in break origins.
1269 * flowanalysis.cs (Reachability.Meet): Simplify code handling 'returns'.
1270 (Reachability.Reachable): Split part into ...
1271 (Reachability.Unreachable): ... this. Simplify.
1272 (Reachability.IsUnreachable): Use 'Unreachable' instead.
1274 * flowanalysis.cs (Reachability.SetReturnsSometimes): Remove.
1275 (Reachability.SetThrowsSometimes): Likewise.
1276 (FlowBranchingBlock.MergeTopBlock): Don't compare against
1277 TriState.Always, use corresponding property.
1278 * statement.cs (Lock.Resolve, Try.Resolve, Using.Resolve): Likewise.
1279 (Block.Resolve): Likewise. Remove some redundant checks.
1281 2006-05-02 Raja R Harinath <harinath@gmail.com>
1283 * flowanalysis.cs (UsageVector.Throw): Set barrier too.
1284 (Reachability.Meet): Don't bother checking AlwaysThrows --
1285 barrier is always set.
1286 (FlowBranchingBlock.Merge): Likewise.
1288 2006-05-01 Raja R Harinath <harinath@gmail.com>
1290 * codegen.cs (EmitContext.ResolveTopBlock): Remove redundant
1291 checks for unreachable.
1293 2006-05-01 Marek Safar <marek.safar@seznam.cz>
1296 * flowanalysis.cs (UsageVector.IsAssigned): Add flag to ignore short path.
1298 * statement.cs (Block.UsageWarning): Uses newly introduced flag to detect
1299 whether field is really assigned.
1301 2006-04-30 Raja R Harinath <harinath@gmail.com>
1303 * flowanalysis.cs (Reachability): Make 4-argument constructor
1305 (Reachability.Meet): Rename from 'And'. Remove static variant.
1306 (Reachability.Always): Rename from the highly misleading
1307 'Reachability.Never'.
1308 (FlowBranching.Merge): Update to changes. Mark an impossible
1309 situation with a 'throw'.
1310 (*): Update to changes.
1312 2006-04-29 Raja R Harinath <harinath@gmail.com>
1314 * flowanalysis.cs (TriState): Rename from FlowBranching.FlowReturns.
1316 (FlowBranching.TriState_Meet): Rename from AndFlowReturns. Simplify.
1317 (FlowBranching.TriState_Max): Rename from OrFlowReturns. Simplify.
1318 (*): Update to changes.
1319 * statement.cs: Update to changes.
1321 2006-04-28 Marek Safar <marek.safar@seznam.cz>
1324 *class.cs (Method.FindOutBaseMethod): Base method cannot be property method.
1326 2006-04-28 Raja R Harinath <harinath@gmail.com>
1328 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't create a
1331 * flowanalysis.cs (UsageVector.MergeChild): Change FlowBranching
1332 argument to two arguments: an usage-vector and a bool. Move call
1333 to FlowBranching.Merge () ...
1334 (FlowBranching.MergeChild, FlowBranching.MergeTopBlock): ... here.
1336 * flowanalysis.cs (UsageVector.MergeChild): Move special-case
1337 handling of loop and switch reachability to ...
1338 (FlowBranchingLoop.Merge, FlowBranchingSwitch.Merge): ... these.
1340 2006-04-27 Raja R Harinath <harinath@gmail.com>
1342 * flowanalysis.cs (FlowBranching.InLoop): Move special-case
1343 handling to FlowBranchingLoop.InLoop.
1344 (FlowBranching.InSwitch): Likewise, to FlowBranchingSwitch.
1346 2006-04-26 Marek Safar <marek.safar@seznam.cz>
1349 * anonymous.cs (AnonymousMethod.DoResolve): Moved the check whether
1350 anonymous method is allowed from AnonymousContainer here.
1352 * attribute.cs, codegen.cs (EmitContext): Add IsAnonymousMethodAllowed.
1354 2006-04-24 Raja R Harinath <rharinath@novell.com>
1357 * flowanalysis.cs (MyBitVector.Or): Add null check on argument.
1359 2006-04-23 Marek Safar <marek.safar@seznam.cz>
1362 * constant.cs (FloatConstant.Reduce): Add range checking for checked context.
1363 (DoubleConstant.Reduce): Ditto.
1365 2006-04-23 Raja R Harinath <rharinath@novell.com>
1367 * expression.cs (LocalVariableReference.DoResolveBase): Simplify.
1368 Remove 'lvalue_right_side' argument. Move parts to ...
1369 (LocalVariableReference.ResolveLocalInfo, LocalVariable.DoResolve)
1370 (LocalVariable.DoResolveLValue): ... these.
1372 2006-04-21 Raja R Harinath <rharinath@novell.com>
1375 * codegen.cs (EmitContext.InRefOutArgumentResolving): Remove.
1376 * expression.cs (EmptyExpression.LValueMemberOutAccess): New.
1377 (LocalVariableReference.DoResolveBase): Use it to implement new
1379 (IndexerAccess.DoResolveLValue): Handle LValueMemberOutAccess.
1380 (Argument.Resolve): Simplify. Move CS1510 check ...
1381 * ecore.cs (Expression.ResolveLValue): ... here.
1382 (UnboxCast.DoResolveLValue): Handle LValueMemberOutAccess.
1383 (PropertyExpr.DoResolveLValue): Likewise.
1384 (FieldExpr.Report_AssignToReadonly): Likewise.
1385 (FieldExpr.DoResolve): Add 'out_access' argument. Use
1386 LValueMemberAccess or LValueMemberOutAccess on instance depending
1388 (FieldExpr.DoResolveLValue): Pass 'out_access' argument to
1389 DoResolve as appropriate.
1391 2006-04-20 Raja R Harinath <rharinath@novell.com>
1394 * expression.cs (Invocation.VerifyArgumentsCompat): Don't try
1395 implicit conversions on 'out' and 'ref' arguments.
1397 * expression.cs (Invocation.VerifyArgumentsCompat): Reorganize to
1398 improve clarity. Remove dead code.
1401 * statement.cs (Block.UsageWarning): Allow VariableInfo to be null.
1402 (Catch.Resolve): Resolve VarBlock if it exists.
1404 2006-04-19 Miguel de Icaza <miguel@novell.com>
1406 * statement.cs (Foreach.EmitFinally): Do not emit the enumerator
1407 twice, this was some residual code, the enumerator was emitted
1408 properly in the two branche of if later.
1410 2006-04-19 Raja R Harinath <rharinath@novell.com>
1412 * expression.cs (Cast.ResolveLValue): Remove. The result of a
1413 cast is never an lvalue.
1414 (Cast.DoResolve, Cast.ResolveRest): Combine.
1415 (Argument.Emit): Simplify slightly. Move 'Expr is
1416 IMemoryLocation' check ...
1417 (Argument.Resolve): ... here.
1418 (Argument.Error_LValueRequired): Remove. Inline into only user.
1420 Simplifications. Fix cs0191-2.cs
1421 * ecore.cs (FieldExpr.DoResolve): Move handling of CS0192, CS0198,
1422 CS1649 and CS1651 to ...
1423 (FieldExpr.Report_AssignToReadonly): ... this. Simplify by moving
1424 the actual selection of the error code and message to a lookup
1425 table. Add a dummy return value to simplify callsites.
1426 (FieldExpr.ResolveLValue): Don't allow a constructor to write to
1427 readonly fields of other instances of the same type. Move CS0197
1429 * expression.cs (Argument.Resolve): ... here. Simplify code.
1430 Ensure that ec.InRefOutArgumentResolving is only set during LValue
1431 resolution of an out or ref argument. The code simplification
1432 above uses this invariant.
1434 2006-04-18 Raja R Harinath <rharinath@novell.com>
1436 Possibly fix #77752. Fix cs1690-[4-7].cs.
1437 * ecore.cs (Expression.CheckMarshalByRefAccess): Renamed from
1438 CheckMarshallByRefAccess. Drop parameter.
1439 (FieldExpr.CheckMarshalByRefAccess): Update. Change CS1690 to a
1441 (FieldExpr.DoResolve): Call CheckMarshalByRefAccess on
1443 * report.cs (AllWarnings): Add CS1690.
1444 * expression.cs (Argument.Resolve): Use EmptyExpression.OutAccess
1446 (LocalVariableReference.DoResolveBase): Update.
1448 2006-04-09 Marek Safar <marek.safar@seznam.cz>
1450 * class.cs (MethodOrOperator): Moved common parts from method class.
1451 detect obsolete attributes.
1452 (Method.Define): Simplified as it reuses code from base.
1453 (Constructor.ValidAttributeTargets): Fixed issue found during
1455 (Destructor.ValidAttributeTargets): Fixed issue found during
1457 (Operator): Finished refactoring set off by #78020. Operator class is now
1458 ordinary method class.
1460 * anonymous.cs: Updated.
1462 * decl.cs (DeclSpace): Add IsGeneric
1464 2006-04-09 Marek Safar <marek.safar@seznam.cz>
1466 * class.cs (Constructor.Emit): Don't emit the attributes twice.
1468 2006-04-09 Marek Safar <marek.safar@seznam.cz>
1470 * class.cs (Operator.Emit): Extracted code from MethodData to correctly
1471 detect obsolete attributes.
1472 (Method.CreateEmitContext): Moved to MethodOrOperator.
1474 2006-04-09 Marek Safar <marek.safar@seznam.cz>
1477 * class.cs (TypeContainer.MemberCoreArrayList.DefineContainerMembers): Throw
1478 customized exception to make crash detection easier.
1479 (MethodOrOperator): Started to work on new base class for methods and
1481 (Method): Derives from MethodOrOperator.
1482 (Constructor.Emit): Emits its own attributes.
1483 (AbstractPropertyEventMethod.Emit): Ditto.
1484 (Operator): Derives from MethodOrOperator, will refactor fully in extra
1486 (Operator.Emit): It's temporary more tricky than should be.
1488 * doc.cs (GetMethodDocCommentName): Updated after operator changes.
1490 * report.cs (InternalErrorException): Add ctor with inner exception.
1492 2006-04-08 Marek Safar <marek.safar@seznam.cz>
1495 * ecore.cs (SimpleName.ResolveAsTypeStep): Report better error when type is
1498 2006-04-07 Marek Safar <marek.safar@seznam.cz>
1501 * expression.cs (ArrayCreation.GetAttributableValue): Creates correctly typed
1504 2006-04-06 Marek Safar <marek.safar@seznam.cz>
1506 * class.cs (Class.ApplyAttributeBuilder): Report an error when ComImport
1507 attribute is present and Guid not.
1508 (Interface.ApplyAttributeBuilder): Ditto.
1510 * attribute.cs: Add error message.
1512 2006-04-06 Marek Safar <marek.safar@seznam.cz>
1516 * attribute.cs (Attribute.AttachTo): The attribute can have multiple
1517 sources (it's composite) so hold them in extra array as they are used in
1518 Emit phase only. It worked in the previous versions by mistake.
1519 (Attribute.Emit): Emit attribute for more owners when exist.
1521 * codegen.cs, class.cs: Updated to don't re-attach attribute twice as now
1522 it has now different behaviour.
1524 2006-04-04 Marek Safar <marek.safar@seznam.cz>
1526 * constant.cs (Constant.IsDefaultInitializer): New method.
1528 * class.cs: Updated.
1530 * expression.cs (ArrayCreation.CheckIndices): Add an optimization to don't
1531 re-initialize default values. It saves KBs almost for every assembly.
1532 Thanks Zoltan for the idea.
1533 (ArrayCreation.ResolveInitializers): Renamed from ValidateInitializers.
1534 (ArrayCreation.DoResolve): Resolve only once.
1535 (ArrayCreation.Emit): Emit static initializer only when it is faster.
1536 (ArrayCreation.GetAttributableValue): Cope with optimized values.
1538 2006-04-03 Zoltan Varga <vargaz@gmail.com>
1540 * report.cs (Warning, Error): Add 0-, 1-, and 2- argument specializations.
1543 2006-04-01 Marek Safar <marek.safar@seznam.cz>
1545 * assign.cs (Assign.DoResolve): Assignment to same variable can occur
1546 in an embedded statement too.
1548 2006-04-01 Raja R Harinath <rharinath@novell.com>
1551 * statement.cs (Switch.EmitObjectInteger) [ulong]: Remove bad cast.
1553 2006-04-01 Marek Safar <marek.safar@seznam.cz>
1557 * class.cs (TypeContainer.AddPartial): Don't report an error when modifier
1560 * modifiers.cs: Add DEFAULT_ACCESS_MODIFER.
1562 2006-03-31 Marek Safar <marek.safar@seznam.cz>
1564 * assign.cs (LocalTemporary): Don't require ILGenerator in the resolve
1567 * anonymous.cs, assign.cs, ecore.cs, expression.cs: Updated after
1568 LocalTemporary change.
1570 * class.cs (ClassOrStruct.DefineDefaultConstructor): Moved from
1572 (ClassOrStruct.DefineFieldInitializers): Implemented static field
1573 initializers optimization.
1574 (ClassOrStruct.TypeAttr): Moved from modifiers.
1575 (Constructor.CheckBase): Don't crash when static ctor has parameters.
1576 (FieldBase.ResolveInitializer): Resolves initializer.
1577 (FieldBase.HasDefaultInitializer): New property.
1579 * cs-parser.jay: Removed message.
1581 * expression.cs (CompilerGeneratedThis): New specialization.
1583 * modifiers.cs (TypeAttr): Moved to ClassOrStruct.TypeAttr
1585 2006-03-28 Marek Safar <marek.safar@seznam.cz>
1587 * cs-parser.jay, cs-tokenizer.cs: On demand Stack allocation.
1589 2006-03-27 Marek Safar <marek.safar@seznam.cz>
1591 * ecore.cs (Expression.ResolveAsConstant): Clean up, enum constants should
1592 be now EnumConstants only.
1594 2006-03-27 Marek Safar <marek.safar@seznam.cz>
1596 * attribute.cs, driver.cs: Reset more caches.
1598 2006-03-26 Marek Safar <marek.safar@seznam.cz>
1600 * cs-tokenizer.cs (adjust_real): Uses float.Parse for float literals.
1602 2006-03-26 Marek Safar <marek.safar@seznam.cz>
1604 * constant.cs (Constant.Reduce): Replaced EmitContext with single bool
1605 for easier reuse. Updated all overrides.
1606 (IntegralConstant): New base class for all integral constants.
1607 (IntegralConstant.Error_ValueCannotBeConverted): When assigned value if out
1608 of the constant range, report custom error.
1609 (UIntConstant.Reduce): Fixed uint conversion.
1611 * ecore.cs, literal.cs: Reduce updates.
1613 2006-03-26 Marek Safar <marek.safar@seznam.cz>
1617 * class.cs (Constructor.Define): Removed extra if for default ctors.
1618 A patch from Atsushi Enomoto.
1620 2006-03-26 Marek Safar <marek.safar@seznam.cz>
1622 * attribute.cs (Attribute.ResolveConstructor): Conversion was moved to
1623 GetAttributableValue.
1625 * constant.cs (Constant.GetAttributableValue): Does implicit conversion
1628 * convert.cs (ImplicitConversionRequired): Error message moved to
1631 * ecore.cs (Expression.GetAttributableValue): Add type parameter for
1632 automatic implicit conversion of an output value.
1633 (EnumConstant.GetAttributableValue): Don't reduce the enum constants.
1635 * expression.cs (ArrayCreation.GetAttributableValue): Add element type
1637 (TypeOf.GetAttributableValue): Add extra handling for object type.
1639 * literal.cs (DoubleLiteral.Error_ValueCannotBeConverted): Doubles can have
1640 special error message.
1642 2006-03-25 Marek Safar <marek.safar@seznam.cz>
1644 * class.cs (Constructor.Emit): Don't crash when struct ctor is
1646 (Constructor.ApplyAttributeBuilder): Transform MethodImplAttribute to be
1647 compatible with MS runtime.
1649 2006-03-23 Marek Safar <marek.safar@seznam.cz>
1651 * attribute.cs (Attribute.ResolveConstructor): Check for an invalid
1652 attribute arguments here.
1654 * class.cs (Indexer.Define): The check was moved to attribute class.
1656 2006-03-22 Marek Safar <marek.safar@seznam.cz>
1658 * assign.cs, class.cs, codegen.cs, convert.cs, decl.cs, ecore.cs,
1659 expression.cs, typemanager.cs: Minor changes from gmcs to make merging
1662 2006-03-22 Raja R Harinath <rharinath@novell.com>
1664 Support ParameterDefaultValueAttribute in gmcs. Also applied to
1665 mcs to keep code differences small.
1666 * attribute.cs (Attribute.GetParameterDefaultValue): New.
1667 * typemanager.cs (parameter_default_value_attribute_type): New.
1668 * parameter.cs (Parameter.ApplyAttributeBuilder): Use them. Add
1671 2006-03-21 Marek Safar <marek.safar@seznam.cz>
1673 * expression.cs (StringConcat.Append): Reverted back to no warning state.
1675 2006-03-21 Marek Safar <marek.safar@seznam.cz>
1677 * const.cs (Error_ConstantCanBeInitializedWithNullOnly): Share a message.
1679 * statement.cs (Block.ResolveMeta): Look for wrong object constants in
1682 2006-03-21 Atsushi Enomoto <atsushi@ximian.com>
1684 * doc-bootstrap.cs : fix build.
1686 2006-03-20 Marek Safar <marek.safar@seznam.cz>
1688 * expression.cs (StringConcat.Append): Issue a warning when empty string
1691 2006-03-20 Marek Safar <marek.safar@seznam.cz>
1693 * assign.cs (CompoundAssign.ResolveSource): Removed.
1695 * attribute.cs (ResolvePossibleAttributeType): Updated after MemberAccess
1698 * class.cs (TypeContainer.FindMethods): Removed.
1699 (TypeContainer.CheckMemberUsage): Made static.
1701 * codegen.cs (GetAssemblyName): Uses Length for empty string test.
1703 * constant.cs (CheckRange): Removed unused type argument.
1704 (CheckUnsigned): Removed unused type argument.
1706 * cs-parser.jay: Updated after MemberAccess clean up.
1707 Uses Length for empty string test.
1709 * cs-tokenizer.cs: Uses Length for empty string test.
1710 (IsCastToken): Made static.
1711 (is_hex): Made static.
1712 (real_type_suffix): Made static.
1714 * decl.cs (SetupCache): Made static.
1715 (OnGenerateDocComment): Removed unused ds argument.
1717 * delegate.cs (VerifyDelegate): Removed unused argument.
1719 * doc.cs: Uses Length for empty string test.
1721 * driver.cs: Uses Length for empty string test.
1723 * enum.cs (IsValidEnumType): Made static
1725 * expression.cs (EnumLiftUp): Removed unused argument.
1726 (ResolveMethodGroup): Ditto.
1727 (BetterConversion): Ditto.
1728 (GetVarargsTypes): Ditto.
1729 (UpdateIndices): Ditto.
1730 (ValidateInitializers): Ditto.
1731 (MemberAccess.ctor): Ditto.
1732 (GetIndexersForType): Ditto.
1734 * flowanalysis.cs: (MergeFinally): Removed unused argument.
1736 * iterators.cs: Updated after MemberAccess clean up.
1738 * location.cs: Uses Length for empty string test.
1740 * namespace.cs: Uses Length for empty string test.
1742 * report.cs (CheckWarningCode): Made static.
1744 * statement.cs (LabeledStatement): Removed unused argument.
1746 * typemanager.cs (FilterNone): Removed.
1748 2006-03-18 Marek Safar <marek.safar@seznam.cz>
1750 * codegen.cs (EmitContext.TestObsoleteMethodUsage): Removed as it become
1753 * class.cs: Updated.
1755 2006-03-18 Marek Safar <marek.safar@seznam.cz>
1757 * cs-parser.jay.cs: __arglist is not allowed for delegates.
1759 2006-03-18 Marek Safar <marek.safar@seznam.cz>
1763 * expression.cs (VerifyArgumentsCompat): Reverted to double error
1764 reporting, it's more tricky than I thought.
1766 2006-03-18 Marek Safar <marek.safar@seznam.cz>
1770 * anonymous.cs.cs (AnonymousMethod): Add host to allow access to
1772 (AnonymousMethod.ImplicitStandardConversionExists): New method.
1773 (AnonymousMethod.Compatible): Moved parameter resolving to DoResolve.
1774 Add more error reporting; Fixed issue with params.
1776 * convert.cs (ImplicitStandardConversionExists): Returned conversion check.
1778 * cs-parser.jay: AnonymousMethod requires host container.
1780 * delegate.cs (NewDelegate.DoResolve): Updated after Compatible changes.
1782 2006-03-18 Raja R Harinath <harinath@gmail.com>
1784 * class.cs: Change 'TypeContainer ds' constructor argument to
1785 'DeclSpace parent'. Some classes were missed below due to
1786 different naming convention.
1788 * class.cs (MemberCore.Parent): Delete. This makes the
1789 ParentContainer changes below enforceable by the compiler.
1791 Treat pointers to enclosing declaration space as 'DeclSpace', not
1793 * class.cs, const.cs, delegate.cs, enum.cs, iterator.cs: Change
1794 'TypeContainer parent' constructor argument to 'DeclSpace parent'.
1796 * statement.cs (LocalInfo..ctor): Use DeclSpace argument instead
1798 (Block.AddThisVariable): Likewise.
1799 * class.cs (MethodData.Define, MethodData.Emit): Likewise.
1800 (AbstractPropertyEventMethod.Emit): Likewise.
1801 (AbstractPropertyEventMethod.EmitMethod): Likewise.
1802 (GetMethod.Define, SetMethod.Define): Likewise.
1803 (PropertyMethod.Define, DelegateMethod.Define): Likewise.
1804 (DelegateMethod.EmitMethod): Likewise.
1806 Fix regression test-partial-13.cs.
1807 Rationalize use of PartialContainer. Ensure that the partial
1808 class semantics can be tied to type-correctness, i.e., any
1809 violation will cause a compile error.
1810 * class.cs, const.cs: Access all fields that belong to class
1811 TypeContainer via ParentContainer. Arguments of EmitContexts and
1812 Resolve()-like functions still use 'Parent'.
1814 * class.cs (SourceMethod): Use DeclSpace, not TypeContainer.
1815 (*.CreateEmitContext): Change TypeContainer argument to DeclSpace.
1816 (PropertyMethod.CheckModifiers): Remove unused argument.
1817 * codegen.cs (EmitContext..ctor): Change TypeContainer argument to
1820 2006-03-17 Raja R Harinath <harinath@gmail.com>
1822 Make semantics of PartialContainer simpler.
1823 * decl.cs (DeclSpace.IsPartial): Remove.
1824 * class.cs (TypeContainer.IsPartial): Likewise.
1825 (TypeContainer..ctor): Set PartialContainer to point to self.
1826 (TypeContainer.GetClsCompliantAttributeValue): Don't use IsPartial.
1827 (TypeContainer.FindNestedType): Likewise.
1828 (MemberCore.ParentContainer): Simplify. Remove deprecation.
1830 2006-03-17 Marek Safar <marek.safar@seznam.cz>
1832 * typemanager.cs.cs (GetInterfaces): Don't recreate 0-sized arrays.
1834 2006-03-15 Marek Safar <marek.safar@seznam.cz>
1836 * class.cs (FieldMember.Emit): ParentContainer is real parent for partial
1839 2006-03-15 Marek Safar <marek.safar@seznam.cz>
1841 * class.cs (Operator.Define): An error for base conversion was not
1844 2006-03-14 Atsushi Enomoto <atsushi@ximian.com>
1846 * iterator.cs : yield break is allowed in try statement which has
1847 catch clauses. Fixed bug #77767.
1849 2006-03-13 Marek Safar <marek.safar@seznam.cz>
1851 A fix for #77593, #77574.
1853 * class.cs (MethodCore.CheckBase): Another if for operator.
1855 2006-03-09 Marek Safar <marek.safar@seznam.cz>
1857 * anonymous.cs (AnonymousMethod.Compatible): Don't crash when parameters
1860 * delegate.cs (Delegate.GetInvokeMethod): Use emitcontext free MemberLookup.
1861 (DelegateCreation.ImplicitStandardConversionExists): New method for just
1864 *ecore.cs (Expression.MemberLookup): Don't ask for emitcontext when it's
1867 * assign.cs, constant.cs, convert.cs, delegate.cs, expression.cs:
1868 Updated after another emitcontext usage was clean up. It should help us to
1869 synchronize with gmcs easier.
1871 2006-03-04 Marek Safar <marek.safar@seznam.cz>
1875 * class.cs (SetMethod.DefineParameters): Uses new parameters type ctor.
1876 (Event.Define): ditto
1877 (SetIndexerMethod.DefineParameters): Uses Parameters.MergeGenerated.
1879 * delegate.cs (Delegate.Define): Uses Parameters.MergeGenerated.
1880 Removed redundant code and set NewSlot for Invoke method too.
1882 * parameter.cs (Parameters.ctor): Add custom, type ctor.
1883 (Parameters.MergeGenerated): New method. Use this method when you merge
1884 compiler generated argument with user arguments.
1886 2006-03-03 Marek Safar <marek.safar@seznam.cz>
1888 * attribute.cs (ResolveAsTypeTerminal): Removed.
1890 * ecore.cs (Expression.ResolveAsTypeTerminal): Make virtual to allow
1891 specialization for predefined types; 30% speed up.
1892 Finally placed obsolete check to right place.
1893 (Expression.ResolveType): Removed.
1895 * enum.cs, expression.cs, parameter.cs, statement.cs, typemanager.cs:
1896 Updated after ResolveType was removed.
1898 * expression.cs (Cast.ctor): Check void cast.
1899 (Binary.ResolveAsTypeTerminal): Is never type.
1900 (Conditional.ResolveAsTypeTerminal): Is never type.
1902 * rootcontext.cs (ResolveCore): Set base type to simplify some code later.
1904 2006-03-01 Raja R Harinath <rharinath@novell.com>
1907 * expression.cs (ParameterReference.DoResolveBase): Change return
1909 (ParameterReference.DoResolve, ParameterReference.DoResolveLValue):
1913 * ecore.cs (PropertyExpr.InstanceResolve): Fix CS1540 check.
1916 * typemanager.cs (GetFullNameSignature): Don't nullref on
1917 protected accessors.
1919 2006-02-27 Marek Safar <marek.safar@seznam.cz>
1921 * attribute.cs (Attribute.PosArguments, Attribute.NamedArguments): Use
1922 these two separated members to simplify the code.
1923 (Attribute.Resolve): Refactored to use new fields and methods.
1924 (Attribute.ResolveConstructor): Extracted from ResolveArguments and
1925 implemented obsolete attribute checking.
1926 (Attribute.ResolveNamedArguments): Extracted from ResolveArguments and
1927 implemented obsolete checking again. It look line never ending quest ;-)
1928 (GlobalAttribute.ResolveConstructor): Need to override as the rest.
1930 * cfold.cs (BinaryFold): TryReduce throws an exception to indicate error.
1932 * constanct.cs (TryReduce): Throws OverflowException to indicate error.
1934 *class.cs (Property.Define): Add RegisterProperty call.
1936 * cs-parser.jay: Replaced ArrayList with fixed array for attribute
1937 argument groups (only 2).
1939 * ecore.cs (Expression.GetAttributableValue): New virtual method used for
1940 encoding expression to arguments.
1941 (Expression.ExprClassToResolveFlags): Just turned to property.
1943 * expression.cs (ArrayCreation.ValidateInitializers): Slightly optimized.
1944 (ArrayCreation.GetAttributableValue): Renamed from EncodeAsAttribute and
1945 optimized as well as implemented support for zero-length attributes.
1947 * typemanager.cs (TypeManager.RegisterProperty, TypeManager.GetProperty):
1948 Add caching of PropertyInfo's.
1950 2006-02-25 Marek Safar <marek.safar@seznam.cz>
1952 * delegate.cs (DelegateCreation.ResolveMethodGroupExpr): Don't report
1953 error multiple times.
1955 2006-02-25 Marek Safar <marek.safar@seznam.cz>
1957 New partial class implementation.
1958 A fix for #77027, #77029, #77403
1960 * attribute.cs (Attributable): Made attributes protected.
1962 * class.cs (TypeContainer): Add PartialContainer and partial_parts as
1963 the replacements of ClassPart and PartialContainer.
1964 (TypeContainer.AddClassOrStruct): Call RecordDecl here.
1965 (TypeContainer.AddInterface): Ditto.
1966 (TypeContainer.AddPartial): The main method for partial classes. It checks
1967 for errors and merges ModFlags and attributes. At the end class is added to
1969 (TYpeContainer.DefineDefaultConstructor): Checks whether default ctor is
1971 (TypeContainer.GetClsCompliantAttributeValue): Cope with partial class too.
1972 (TypeContainer.GetNormalPartialBases): Resolves base classes and interfaces
1973 from the rest of partial classes.
1974 (TypeContainer.GetClassBases): Simplified.
1975 (TypeContainer.DefineTypeBuilder): New method, mostly extracted from
1977 (TypeContainer.DefineDefaultConstructor): Is used by derived classes.
1978 (TypeContainer.HasExplicitLayout): Uses Flags now.
1979 (PartialContainer): Removed.
1980 (ClassOrStruct.AddToContainer): Moved enclosing member name check here.
1981 (StaticClass): Was merged with Class.
1982 (Class.GetClassBases): class and static class bases are verified here.
1983 (Class.TypeAttr): Added static attributes when class is static.
1984 (Struct.RegisterFieldForInitialization): Moved from TypeContainer.
1985 (MemberBase): In some cases we need to call parent container for partial
1986 class. It should be eliminated but it's not easy now.
1988 * cs-parser.jay: Replaced all PartialContainer with AddPartial.
1990 * decls.cs (MemberCore.DocComment): Introduced new property as is used by
1991 partial classed to accumulate class comments.
1992 (MemberCore.GetClsCompliantAttributeValue): Moved from TypeContainer.
1994 * doc.cs (GenerateTypeDocComment): Partial classes clean up.
1996 * driver.cs (MainDriver): Tree.GetDecl was removed.
1998 * modifiers.cs (Modifiers): Add partial modifier.
2000 * tree.cs (Tree.decl): Removed.
2001 (RootTypes): Started to use this class more often for root types
2004 2006-02-22 Marek Safar <marek.safar@seznam.cz>
2008 * attribute.cs (AttributeTester.GetCoClassAttribute): Don't crash when
2009 external interface does not have an attribute.
2011 2006-02-22 Marek Safar <marek.safar@seznam.cz>
2013 Another prerequisites for new partial classs implementation.
2015 * attribute.cs (Attribute.Equal): Implemented.
2016 (Attribute.Emit): Changed as attributes can be applied more than twice.
2017 (Attributes.Emit): Check for duplicate attributes here.
2019 * class.cs, decl.cs, delegate.cs, doc.cs, enum.cs: Don't pass DeclSpace
2020 as a parameter, clean-up.
2022 2006-02-11 Marek Safar <marek.safar@seznam.cz>
2026 * class.cs (TypeContainer.DefineType): Cannot use ResolveType because it
2027 contains obsolete attribute check which can in some cases look for base
2028 type of current class which is not initialized yet.
2029 (TypeContainer.BaseType): Replacement of ptype.
2031 * decl.cs (MemberCore.CheckObsoleteType): Reuse existing code.
2033 2006-02-11 Marek Safar <marek.safar@seznam.cz>
2035 First of prerequisites for new partial classs implemention.
2037 * attribute.cs (Attributable): Extended by ResolveContext;
2038 Attributes finally have correct context for resolving in all cases.
2039 (AttachTo): Attribute owner is assigned here.
2041 * codegen.cs (IResolveContext): Introduce new interface to hold
2042 all information needed in resolving phase.
2043 (EmitContext): Implements IResolveContext; more clean-up needed here.
2045 * decl.cs (MemberCore): Implemented IResolveContext.
2047 * anonymous.cs, attribute.cs, class.cs, codegen.cs, const.cs,
2048 decl.cs, ecore.cs, enum.cs, expression.cs, iterators.cs, namespace.cs,
2049 parameter.cs, statement.cs, tree.cs, typemanager.cs:
2050 Refactored to use new IResolveContext instead of EmitContext; cleanup
2052 2006-02-06 Miguel de Icaza <miguel@novell.com>
2054 * codegen.cs (EmitScopeInitFromBlock): check here the
2055 capture_context, there is no need to make two calls to the
2058 * anonymous.cs: Add some debugging messages that might help me
2059 track other instances of this problem in the future (the
2060 regression of test 467).
2062 * cs-parser.jay: track the variable block, as we need to initalize
2063 any captured variables declared in this block for the "catch"
2064 portion of the "Try" statement.
2066 * statement.cs (Try.Emit): If the "Catch" has a VarBlock, emit any
2067 scope initialization for captured variables.
2069 Also, move the emit for the variables after the block location has
2072 2006-02-06 Marek Safar <marek.safar@seznam.cz>
2074 * ecore.cs (PropertyExpr.FindAccessors): Just made flags const.
2076 2006-02-02 Miguel de Icaza <miguel@novell.com>
2078 * anonymous.cs (CaptureContext.EmitInitScope): I was wrong in the
2079 commit yesterday, the initialization for the roots is necessary.
2080 What is not necessary is the scope activation.
2082 2006-02-02 Raja R Harinath <rharinath@novell.com>
2084 * ecore.cs (PropertyExpr.DoResolveLValue): Add CS0206 check.
2085 * expression.cs (IndexerAccess.DoResolveLValue): Add CS1612 and
2087 (Argument.Resolve): Remove CS0206 checks.
2089 2006-02-01 Miguel de Icaza <miguel@novell.com>
2091 * anonymous.cs (CaptureContext.EmitInitScope): Do not emit the
2092 scopes for all the roots, the scopes will now be emitted when the
2093 Blocks are entered. [This change was wrong, fixed on 2006-02-02]
2095 (CaptureContext.EmitScopeInitFromBlock): Simply emit the ScopeInfo
2096 code. This reduces a lot of existing cruft.
2098 * statement.cs (Block.Emit): Call EmitScopeInitFromBlock here, so
2099 that the ScopeInfo is generated as we enter the scope, not at the
2100 time of use, which is what we used to do before.
2102 * codegen.cs (EmitScopeInitFromBlock): New routine, this is called
2103 every time a Block is about to be emitted if we have a
2106 2006-02-01 Raja R Harinath <rharinath@novell.com>
2108 * typemanager.cs (NoTypes, NoTypeExprs): Remove.
2110 * *.cs: Use Type.EmptyTypes instead of TypeManager.NoTypes.
2112 * typemanager.cs (cons_param_array_attribute): Make private.
2113 (Reset): Set it to null.
2114 (InitCoreHelpers): Don't initialize it.
2115 (ConsParamArrayAttribute): New. Initialize it as needed.
2116 * parameter.cs (ParamsParameter.ApplyAttribute): Update to change.
2118 2006-01-31 Miguel de Icaza <miguel@novell.com>
2120 * expression.cs: There might be errors reported during the
2121 selection of applicable methods. If there are errors, do not
2122 continue execution as it will lead the compiler to crash.
2124 2006-01-30 Miguel de Icaza <miguel@novell.com>
2126 * expression.cs: Member access is not allowed on anonymous
2127 methods. Fixes #77402.
2129 2006-01-30 Raja R Harinath <rharinath@novell.com>
2132 * cs-parser.jay (VariableDeclaration): Don't set
2133 current_array_type to null.
2134 (field_declaration, event_declaration, declaration_statement):
2135 Set it to null here.
2137 2006-01-28 Raja R Harinath <harinath@gmail.com>
2139 * typemanager.cs (GenericParameterPosition): New.
2142 2006-01-28 Atsushi Enomoto <atsushi@ximian.com>
2144 * doc.cs : To process "include" elements, first we should create
2145 another list than XmlNodeList, because it could result in node
2146 removal, which could result in that the XmlNodeList gives up
2149 (Also made code identical to gmcs again.)
2151 2006-01-25 Miguel de Icaza <miguel@novell.com>
2153 * ecore.cs: Introduce an error report that we were not catching
2154 before, if not silent, we must report the error. Gonzalo ran into
2157 2006-01-23 Miguel de Icaza <miguel@novell.com>
2159 A fix for bug: #76957
2161 * iterators.cs (MoveNextMethod.CreateMethodHost): call
2162 ComputeMethodHost before creating the method, this is a new
2165 * anonymous.cs (AnonymousContainer): Now we track all the scopes
2166 that this method references (RegisterScope). The actual scope
2167 where the method is hosted is computed with the ComputeMethodHost
2168 before we create the method.
2170 Moved the Deepest routine here.
2172 (AnonymousContainer.ComputeMethodHost): New routine used to
2173 compute the proper ScopeInfo that will host the anonymous method.
2175 (ScopeInfo): Deal with multiple roots. The problem was that we
2176 did not have a unique root where all ScopeInfos could be hanged
2177 from. Remove `topmost' ScopeInfo, and instead keep an arraylist
2180 Remove AdjustMethodScope which is now computed at the end. Remove
2181 LinkScope which did a partial link, instead link all ScopeInfos
2182 before code generation from the new "LinkScopes" routine.
2184 Simplify all the Add* routines as they no longer need to maintain
2185 the tree, they just need to record that they are using variables
2188 (IsAncestor, GetAncestorScopes, GetParentScope, LinkScope): New
2189 routines to produce the forest of ScopeInfo trees.
2191 * class.cs (TypeContainer.AppendMethod): This is just like
2192 AddMethod, but ensures that an interface implementation method
2193 (IEnumerable.XXX) is not inserted at the beginning of the queue of
2194 methods, but at the end.
2196 We use this functionality to ensure that the generated MoveNext
2197 method in the iterator class is resolved/emitted before the
2198 enumerator methods created.
2200 This is required because the MoveNext method computes the right
2201 ScopeInfo for the method. And the other methods will eventually
2202 need to resolve and fetch information computed from the anonymous
2205 2006-01-21 Raja R Harinath <harinath@gmail.com>
2206 Carlos Alberto Cortez <calberto.cortez@gmail.com>
2209 * namespace.cs (NamespaceEntry.UsingExternalAliases): Don't add to
2211 (NamespaceEntry.LookupAlias): Lookup 'extern_aliases' hash too.
2212 (NamespaceEntry.VerifyUsing): Resolve external aliases too.
2214 2006-01-18 Raja R Harinath <rharinath@novell.com>
2216 Fix #76656, cs0231-2.cs.
2217 * cs-parser.jay (formal_parameter_list): Make error case catch
2219 (parenthesized_expression_0): Add CS1026 check.
2220 (invocation_expression): Remove unused { $$ = lexer.Location }.
2222 2006-01-17 Raja R Harinath <rharinath@novell.com>
2225 * cs-parser.jay (statement_expression): Don't list out the
2226 individual statement-expressions. Convert syntax error into
2229 2006-01-16 Raja R Harinath <rharinath@novell.com>
2232 * ecore.cs (MemberAccess.CheckIntermediateModification): Remove.
2233 (UnboxCast.DoResolveLValue): New. Move CS0445 check from
2234 CheckIntermediateModification.
2235 (FieldExpr.DoResolve): Add new two-argument version that
2236 allows us to resolve the InstanceExpression as an lvalue.
2237 The one-argument variant is now just a wrapper.
2238 (FieldExpr.DoResolveLValue): Use two-argument DoResolve.
2239 Resolve the lhs as an lvalue if the it has a value type.
2240 (FieldExpr.AssignToReadonly): Move CS1648 and CS1650 checks
2241 from Assign.DoResolve.
2242 (PropertyExpr.InstanceResolve): Allow InstanceExpression to be
2243 resolved as an lvalue.
2244 (PropertyExpr.DoResolve): Update.
2245 (PropertyExpr.DoResolveLValue): Resolve the lhs as an lvalue if it
2246 has a value type. Move CS1612 check here from
2247 CheckIntermediateModification.
2248 * assign.cs (Assign.DoResolve): Remove CS1648 and CS1650 checks.
2249 * expression.cs (EmptyExpression.OutAccess): New. Used as the
2250 'right_side' of a ResolveLValue on an 'out' argument.
2251 (EmptyExpression.LValueMemberAccess): New. Used as the
2252 'right_side' of a propagated ResolveLValue on a value type.
2253 (LocalVariableReference.DoResolveBase): Recognize
2254 EmptyExpression.OutAccess and EmptyExpression.LValueMemberAccess.
2256 (Argument.Resolve): Use EmptyExpression.OutAccess rather than
2257 EmptyExpression.Null.
2259 2006-01-16 Atsushi Enomoto <atsushi@ximian.com>
2261 * typemanager.cs : added IsGenericParameter(). In mcs it always
2263 * doc.cs : for generic parameters, use GenericParameterPosition,
2266 2006-01-12 Ben Maurer <bmaurer@andrew.cmu.edu>
2268 * expression.cs: Fix Console.WriteLine ((this = x).foo);
2270 2006-01-12 Miguel de Icaza <miguel@novell.com>
2272 This fixes the problem where we used ldfld instead of ldflda to
2273 load the "THIS" pointer on captured parameters, when THIS is a
2274 value type. See bug #77205.
2276 * iterators.cs (CapturedThisReference.Emit): Pass false to
2277 EmitThis (we do not need the address).
2279 * codegen.cs (EmitThis): it needs to know whether we need the
2280 address of `this' or not. This is used by value types.
2282 * expression.cs (This.AddressOf): Pass true to the EmitThis call,
2283 every other call passes false.
2285 2006-01-12 Raja R Harinath <rharinath@novell.com>
2288 * typemanager.cs (TryGetBaseDefinition): Rename from the mis-named
2290 * expression.cs (Invocation.OverloadResolve): Update.
2291 (Invocation.DoResolve): Avoid double resolution of invocation.
2293 2006-01-11 Raja R Harinath <rharinath@novell.com>
2296 * expression.cs (Unary.Emit): When in /checked+ mode, don't emit
2297 unary negation of floating point types as 0-expr; negation cannot
2298 overflow in floating point types.
2301 * expression.cs (MemberAccess.DoResolve): Disallow the use of '.'
2302 on operands of 'void' type.
2305 * cfold.cs (BinaryFold): Implement folding of BinaryOr, BinaryAnd
2306 and ExclusiveOr for boolean constants too.
2308 2006-01-09 Raja R Harinath <rharinath@novell.com>
2311 * expression.cs (Invocation.OverloadResolve): Replace reflected
2312 override methods with their base virtual methods, rather than
2314 * typemanager.cs (TypeManager.GetOverride): New.
2316 2006-01-05 Jb Evain <jbevain@gmail.com>
2318 * class.cs (Property.Define, Indexer.Define): do not tag the
2319 properties as SpecialName | RTSpecialName.
2321 2006-01-04 Miguel de Icaza <miguel@novell.com>
2323 * class.cs (MethodCore.IsDuplicateImplementation): This method was
2324 doing a low-level comparission of parameter types. It was lacking
2325 a check for __argslist.
2327 2005-12-30 Miguel de Icaza <miguel@novell.com>
2329 * expression.cs (ParameterReference.DoResolveBase): Allow
2330 reference parameters if they are local to this block.
2332 This allows the ref and out parameters of a delegate to be used in
2333 an anonymous method, for example:
2335 delegate void set (out int x);
2337 set s = delegate (out int x){
2341 This is used by functionality introduced late in the C# language.
2343 * anonymous.cs (AnonymousMethod.Compatible): Allow anonymous
2344 method that take ref and out parameters.
2346 Fixes #77119 which was a late change in the spec.
2348 2005-12-23 Miguel de Icaza <miguel@novell.com>
2350 * anonymous.cs (ScopeInfo.LinkScope): Do not link the scope to its
2351 parent if its the same scope. Fixes #77060.
2353 2005-12-21 Miguel de Icaza <miguel@novell.com>
2355 * driver.cs: Report the case of no source files and no -out:
2358 2005-12-20 Raja R Harinath <rharinath@novell.com>
2361 * expression.cs (ComposedCast.GetSignatureForError): Define.
2363 2005-12-18 Carlos Alberto Cortez <calberto.cortez@gmail.com>
2367 * namespace.cs (NamespaceEntry): Add extern_aliases as a
2368 ListDictionary, to contain the ExternAliasEntry entries (in
2369 addition to the NamespaceEntry.aliases hashtable). This field is
2370 shared between the original entry and its doppelganger (bodyless
2372 (NamespaceEntry.UsingExternalAlias): Add the extern alias entry to
2373 extern_aliases field.
2374 (NamespaceEntry.Lookup): Move the IsImplicit check after the
2375 lookup in extern_aliases.
2377 2005-12-16 Raja R Harinath <rharinath@novell.com>
2380 * class.cs (TypeContainer.Mark_HasEquals): New.
2381 (TypeContainer.Mark_HasGetHashCode): New.
2382 (ClassPart): Override them.
2383 (MethodCore.CheckBase): Use them instead of referring to Parent.Methods.
2386 * enum.cs (EnumMember.EnumMember): Pass the parent_enum as the
2387 'parent' argument to the base constructor.
2389 Remove all mention of TypeContainer from decl.cs.
2390 * decl.cs (MemberCore.Parent): Change into a DeclSpace.
2391 (MemberCore.MemberCore): Change type of 'parent' argument to DeclSpace.
2392 (DeclSpace.DeclSpace): Likewise.
2393 (DeclSpace.DefineMembers): Remove unused argument.
2394 * cs-parser.jay (pop_current_class): Update to changes. Simplify
2395 debugging check -- we don't care if the debug code throws an
2396 InvalidCastException instead of an InternalErrorException.
2397 * class.cs (TypeContainer.DefineMembers): Update to changes.
2398 (TypeContainer.DoDefineMembers): Likewise.
2399 (TypeContainer.GetMethods): Likewise.
2400 (PropertyMember.Define): Likewise.
2401 (MemberBase.Parent): New property that forwards to
2402 MemberCore.Parent, but ensures that we get a TypeContainer.
2403 * rootcontext.cs (RootContext.PopulateCoreType): Update to changes.
2404 (RootContext.PopulateTypes): Likewise. Remove special case code
2405 for !RootContext.StdLib: DefineMembers is idempotent.
2407 2005-12-14 Miguel de Icaza <miguel@novell.com>
2409 * convert.cs (ExplicitConversionCore): Check the return value from
2410 ExplicitConversionCore which can return null on failure. Fixes #76914
2412 2005-12-13 Marek Safar <marek.safar@seznam.cz>
2414 * class.cs (Method.ApplyAttributeBuilder): Test out modifier properly.
2416 2005-12-11 Atsushi Enomoto <atsushi@ximian.com>
2418 * doc.cs : The search for referenced namespace was insufficient to
2419 get global one as it used to do. Fixed bug #76965.
2421 2005-12-10 Atsushi Enomoto <atsushi@ximian.com>
2423 * doc.cs : check name in cref in the last phase that whether it is
2426 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
2428 * cs-tokenizer.cs : reverted the latest change: it somehow broke
2431 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
2433 * doc.cs : so it turned out that we cannot skip override check for
2434 interface members. Fixed bug #76954.
2436 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
2438 * cs-tokenizer.cs : fixed bug #75984:
2439 - #warning and #error should not be handled when the source line
2441 - #line is not checked strictly when the source line is disabled.
2442 - #define and #undef is on the other hand checked strictly at any
2445 2005-12-08 Atsushi Enomoto <atsushi@ximian.com>
2447 * cs-tokenizer.cs : missing Location (actually, filename) in one of
2450 2005-12-05 Marek Safar <marek.safar@seznam.cz>
2452 * attribute.cs (GlobalAttribute.ctor): Pass NamespaceEntry only.
2454 * class.cs (EmitFieldInitializers): Simplified and fixed to work with
2456 (FieldBase.EmitInitializer): Moved from TypeContainer and simplified.
2457 (FieldBase.Initializer): Initializer is now optional.
2458 (EventField.Define): Only event field can have initializer.
2460 * codegen.cs (EmitContext): DeclSpace is not readonly (small hack).
2462 * const.cs (Const): Reuse initializer.
2464 * cs-parser.jay: Updated after FieldBase changes.
2465 Added current_array_type to simplify array initializers.
2467 * ecore.cs (NullCast.IsDefaultValue): Implemented.
2469 * expression.cs, iterators.cs: Updated.
2471 * namespace.cs (NamespaceEntry): Made UsingFound private.
2473 2005-12-05 Marek Safar <marek.safar@seznam.cz>
2475 * parameterCollection.cs: Obsolete, removed.
2476 * parser.cs: Obsolete, removed.
2478 2005-12-05 Marek Safar <marek.safar@seznam.cz>
2481 * class.cs (Constructor.Emit): Set obsolete checking for whole context.
2483 * enum.cs (Enum.Define): Set obsolete context here.
2485 2005-12-05 Atsushi Enomoto <atsushi@ximian.com>
2488 - FindDocumentedMember() now expects 1) paramList as null
2489 when "we don't have to check the number of parameters" and
2490 2) Type.EmptyTypes when "there is no arguments".
2491 - Introduced FoundMember struct to hold the exact type which was
2492 used to find the documented member (the above change broke
2493 test-xml-044; it might be better just to use DeclaringType than
2494 what MS does, like this change does, but it depends on usage.)
2496 2005-12-05 Atsushi Enomoto <atsushi@ximian.com>
2498 * doc.cs : documented member might be from DeclaringType for nested
2499 types. Fixed bug #76782.
2501 2005-12-03 Ben Maurer <bmaurer@ximian.com>
2503 * anonymous.cs: Have the param code handle leaving copies on the
2504 stack etc. Allows anonymous params to take part in the assignment
2505 code (++, +=, etc). Fixes bug #76550
2507 * expression.cs: Handle the prepare_for_load/leave_copy by passing
2508 it down to the anon code.
2510 * iterators.cs: Use dummy var here
2512 * codegen.cs: Handle new vars
2514 2005-12-01 Marek Safar <marek.safar@seznam.cz>
2517 * class.cs (MethodData.Define): Set proper Obsolete context.
2519 * ecore.cs (FieldExpr.ResolveMemberAccess): Don't check [Obsolete] in
2521 (FieldExpr.DoResolve): Ditto.
2523 2005-12-01 Marek Safar <marek.safar@seznam.cz>
2526 * class.cs (MethodCore.DoDefineParameters): Test [Obsolete] only when
2527 parent is not obsolete.
2529 2005-12-01 Atsushi Enomoto <atsushi@ximian.com>
2531 * doc.cs : (FindDocumentedMember) find parameterless members first
2532 and get CS0419 in the early stage. Fixed first case of bug #76727.
2534 2005-11-30 Marek Safar <marek.safar@seznam.cz>
2537 * ecore.cs (Expression.ResolveAsConstant): Report constant error only when
2538 no error was reported.
2540 *expression.cs (Binary.DoResolve): left can be null.
2542 2005-11-22 Marek Safar <marek.safar@seznam.cz>
2545 * class.cs (MethodData.Emit): Parameters should be labeled first.
2547 2005-11-21 Marek Safar <marek.safar@seznam.cz>
2550 * parameter.cs (Parameter.ApplyAttributeBuilder): Fixed `ref' detection.
2552 2005-11-18 Marek Safar <marek.safar@seznam.cz>
2554 * attribute.cs (AreParametersCompliant): Moved to Parameter.
2556 * class.cs (MethodCore): Parameter clean up.
2557 (IMethodData): Added ParameterInfo.
2558 (MethodData): Parameter clean up.
2559 (Indexer.Define): Parameter clean up.
2571 * typemanager.cs: Parameter clean up.
2573 * delegate.cs (Define): Get rid of duplicated code.
2575 * expression.cs (ParameterReference): Removed useless parameters
2577 (Invocation): Ditto.
2579 * parameter.cs (ParamsParameter): New class, params specialization.
2580 (ArglistParameter): Attemp to separate arglist.
2581 (Parameter): Refactored to be reusable and faster.
2582 (Parameter.Modifier): Made understandable.
2583 (Parameters): Changed to be used as a class for `this' assembly
2584 parameters. Refactored to use new specialized classes.
2586 * support.cs (ParameterData): Added Types property.
2587 (InternalParameters): Deleted.
2589 2005-08-20 Martin Baulig <martin@ximian.com>
2591 Merging this patch from GMCS to fix #75867.
2593 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
2594 scope if we don't already have it.
2596 2005-11-17 Martin Baulig <martin@ximian.com>
2599 (CaptureContext.EmitMethodHostInstance): Use `Ldarg_0' if we
2600 inherit the scope from our parent. Fixes #76653.
2602 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
2604 * doc.cs : the previous patch does not actually fix the bug.
2605 PropertyInfo override check is now implemented and really fixed it.
2606 * expression.cs : Invocation.IsAncestralType() is used from doc.cs.
2608 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
2610 * doc.cs : apply "override filter" also to properties.
2613 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
2615 * doc.cs : renamed FindMembers() to FindMethodBase(). For interfaces,
2616 no need to check overrides. For classes, omit those results from
2617 interfaces since they must exist in the class. Fixed bug #76726.
2619 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
2621 * typemanager.cs : (GetFullNameSignature) differentiate indexers
2622 with different parameters. Fixed the second problem in #76685.
2624 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
2626 * doc.cs : (FindDocumentedMember) pass invocation_type as well (to
2627 get expected 'protected' access in CheckValidFamilyAccess()).
2630 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
2632 * doc.cs : (GenerateTypeDocComment) Fields could be FixedField.
2633 Fixed bug #76705. CS1569 was incorrectly commented out.
2635 2005-11-14 Atsushi Enomoto <atsushi@ximian.com>
2637 * doc.cs : use Invocation.IsOverride() to do real override check.
2638 * expression.cs : made Invocation.IsOverride() internal.
2640 2005-11-14 Atsushi Enomoto <atsushi@ximian.com>
2642 * doc.cs : use TypeManager.FindMembers() instead of (possible)
2643 TypeBuilder.FindMembers() and filter overriden base members out.
2646 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
2648 * doc.cs : ref/out parameters are represented as '@' (instead of
2649 '&' in type FullName). Fixed bug #76630 (additionally crefs).
2651 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
2653 * doc.cs : when there was no '.' in cref to methods in doc comment,
2654 then parameters were missing in the output. Fixed bug #76691.
2656 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
2658 * driver.cs : don't output docs when there is an error.
2661 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
2664 Now it should detect indexers. Fixed primary concern in bug #76685.
2665 Fixed CS0419 message to not show the identical member signature in
2668 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
2670 * doc.cs : (FindDocumentedMember) use TypeManager.MemberLookup()
2671 instead of Type.FindMembers() since it does not handle events.
2674 2005-11-12 Gert Driesen <drieseng@users.sourceforge.net>
2676 * codegen.cs: Fixed typo (speficied -> specified).
2678 2005-11-11 Marek Safar <marek.safar@seznam.cz>
2681 * doc.cs (FindDocumentedTypeNonArray): Don't resolve again.
2683 2005-11-11 Marek Safar <marek.safar@seznam.cz>
2685 * attribute.cs: Changed error message.
2687 * cs-tokenizer.cs: One more check.
2689 2005-11-10 Marek Safar <marek.safar@seznam.cz>
2691 * statement.cs (Block.Resolve): Ignore empty statement.
2693 2005-11-10 Marek Safar <marek.safar@seznam.cz>
2695 * report.cs: Made error/warning methods more strict to avoid
2698 * anonymous.cs, attribute.cs, class.cs, codegen.cs, constant.cs,
2699 convert.cs, cs-parser.jay, cs-tokenizer.cs, decl.cs, delegate.cs,
2700 doc.cs, driver.cs, ecore.cs, expression.cs, location.cs,
2701 namespace.cs, parameter.cs, statement.cs, typemanager.cs: Updated.
2703 2005-11-08 Marek Safar <marek.safar@seznam.cz>
2705 * attribute.cs (Attribute.GetCoClassAttributeValue): New method.
2706 (AttributeTester.GetCoClassAttribute): Get CoClassAttribute.
2708 * class.cs (TypeContainer.IsComImport): New property.
2709 (Constructor.Define): Create proper ctor for ComImport types.
2711 * expression.cs (New.CheckComImport): Fixed.
2713 2005-11-07 Miguel de Icaza <miguel@novell.com>
2715 * anonymous.cs (CaptureContext.AddParameterToContext): The fact
2716 that a parameter has been captured does not mean that we do not
2717 have to do the rest of the processing. This fixes the second part
2718 of #76592. If there was another anonymous method capturing
2719 values in the past, the Scope would never be set for the second
2720 method that captured the same parameter.
2722 (CaptureContext.EmitAssignParameter): When `leave_copy' is passed,
2723 properly manipulate the stack. Second part of fix for #76592.
2725 * expression.cs (New): Add support for invoking "new" on
2726 interfaces that have been flagged with the ComImport attribute and
2727 the CoClass. Fixes #76637
2729 * statement.cs (Try.DoEmit): When a variable is captured, do not
2730 try to emit the vi.LocalBuilder variable as it has been captured.
2731 Create a temporary variable and store the results on the
2732 FieldBuilder. Fixes #76642
2734 2005-11-07 Marek Safar <marek.safar@seznam.cz>
2736 * class.cs (CheckPairedOperators): Made compilable with csc 2.0.
2738 * ecore.cs (InstanceResolve): Fixed CS1540 detection.
2740 * expression.cs (Binary.DoResolve): Added && optimalization.
2742 * typemanager.cs (AddUserType): Removed useless argument.
2744 2005-11-04 Marek Safar <marek.safar@seznam.cz>
2746 * statement.cs (Block.variables): Uses ListDictionary.
2748 2005-11-03 Marek Safar <marek.safar@seznam.cz>
2751 * class.cs (PartialContainer.EmitType): Customized to emit
2752 security attributes.
2753 (ClassPart.ApplyAttributeBuilder): Transform security attribute
2754 for partial classes.
2756 2005-11-03 Marek Safar <marek.safar@seznam.cz>
2759 * expression.cs (ElementAccess.DoResolveLValue): Fixed buffer
2760 access has to be fixed.
2762 * typemanager.cs (IsUnmanagedType): Wrong common field type.
2764 2005-11-01 Marek Safar <marek.safar@seznam.cz>
2767 * ecore.cs (NullCast.Reduce): Implemented.
2769 * expression.cs (ArrayCreation.CheckIndices): Correcly check
2772 * statement.cs (SwitchLabel.ResolveAndReduce): Catch null
2774 (Foreach.Resolve): Catch null properly.
2776 2005-10-29 Marek Safar <marek.safar@seznam.cz>
2778 * cs-tokenizer.cs: Warning text fix.
2780 * driver.cs: AllWarningNumbers exposed on public interface.
2782 * report.cs (): Reviewed warning numbers.
2783 (IsValidWarning): Use binary search.
2785 2005-10-29 Marek Safar <marek.safar@seznam.cz>
2787 * driver.cs: Implemeted resource visibility.
2788 (Resources): New class for code sharing between /res: and
2791 2005-10-28 Marek Safar <marek.safar@seznam.cz>
2794 * cfold.cs (ConstantFold.BinaryFold): Implemented null cast
2797 * convert (Convert.ImplicitReferenceConversion): NullCast holds
2800 * ecore.cs (NullCast): Child is contant only.
2802 * literal.cs (NullLiteral.Reduce): null can be converted to any
2805 2005-10-28 Kornél Pál <kornelpal@hotmail.com>
2807 * driver.cs: Use Encoding.Default as default code page instead
2810 2005-10-27 Raja R Harinath <rharinath@novell.com>
2813 * expression.cs (Invocation.Error_InvalidArguments): Handle
2814 __arglist parameters.
2815 (Invocation.VerifyArgumentsCompat): Likewise.
2816 * support.cs (ReflectionParameters.GetSignatureForError): Print
2817 __arglist parameters.
2818 (InternalParamters.GetSignatureForError): Likewise.
2819 * parameter.cs (Parameters.GetSignatureForError): Likewise.
2821 2005-10-26 Marek Safar <marek.safar@seznam.cz>
2823 * attribute.cs (GetPropertyValue): Made public.
2825 * codegen.cs (AssemblyClass): ResolveClsCompliance renamed to
2827 Add new property WrapNonExceptionThrows to handle 2.0 assembly
2829 (AssemblyClass.Emit): Emit RuntimeCompatibilityAttribute when it
2832 * driver.cs: Reflect method name change.
2834 * statement.cs (Try.Resolve): Warn when try has both general
2837 * typemanager.cs: runtime_compatibility_attr_type new predefined
2840 2005-10-26 Raja R Harinath <harinath@gmail.com>
2843 * pending.cs (InterfaceMethod): Allow tm.args [i] to be null --
2844 treat it as an empty parameter list.
2846 2005-10-26 Raja R Harinath <rharinath@novell.com>
2849 * ecore.cs (SimpleName.DoSimpleNameResolve): Make fall-back
2850 ResolveAsTypeStep silent.
2851 * statement.cs (Block.AddConstant): Mark block as used.
2852 (Block.ResolveMeta): Avoid piling on error messages
2853 if a constant initializer resolution fails.
2855 2005-10-25 Raja R Harinath <rharinath@novell.com>
2857 * namespace.cs (RootNamespace.VerifyUsingForAll, Namespace.VerifyUsing):
2859 (NamespaceEntry.VerifyAllUsing): New.
2860 (NamespaceEntry.AliasEntry.Resolve): New. Handles common error
2861 behaviour. Delegates actual resolution of alias to ...
2862 (NamespaceEntry.DoResolve): ... this. Renamed from Resolve.
2863 (NamespaceEntry.LocalAliasEntry, NamespaceEntry.ExternAliasEntry):
2865 * driver.cs (Driver.MainDriver): Update.
2867 * namespace.cs (NamespaceEntry.DefineNamespace): Remove.
2868 (NamespaceEntry.SymbolFileID): Make into a on-demand computed
2870 (Namespace.DefineNamespaces, RootNamespace.DefineNamespacesForAll):
2872 * symbolwriter.cs (SymbolWriter.Initialize): Don't call
2873 RootNamespace.DefineNamespacesForAll.
2875 2005-10-24 Raja R Harinath <harinath@gmail.com>
2877 * typemanager.cs (assemblies, external_aliases, modules)
2878 (AddAssembly, AddExternAlias, AddModule GetAssemblies, Modules)
2879 (ComputeNamespaces, GetRootNamespace): Remove extra staging
2880 overhead. Move resposibility ...
2881 * namespace.cs (GlobalRootNamespace): ... here. Update to changes.
2882 * driver.cs, attribute.cs, codegen.cs: Update to changes.
2884 2005-10-23 Raja R Harinath <harinath@gmail.com>
2886 * namespace.cs (RootNamespace.all_namespaces): Renamed from
2887 cached_namespaces. Improve usage.
2888 (RootNamespace.Reset, RootNamespace.RegisterNamespace)
2889 (RootNamespace.VerifyUsingForAll, RootNamespace.DefineNamespacesForAll):
2890 Move from GlobalRootNamespace and simplify.
2891 (RootNamespace.Global): Make instance variable.
2892 (RootNamespace.RootNamespace): Add "alias name" parameter.
2893 (GlobalRootNamespace): Simplify drastically.
2894 (Namespace.Lookup): Don't use GetNamespace.
2895 * typemanager.cs (GetRootNamespace): Rename from
2896 ComputeNamespaceForAlias.
2897 (NamespaceClash): Use Global.IsNamespace instead of GetNamespace.
2899 2005-10-23 Marek Safar <marek.safar@seznam.cz>
2901 * anonymous.cs (AnonymousContainer): Don't crash when container
2904 2005-10-23 Marek Safar <marek.safar@seznam.cz>
2906 * expression.cs (Binary.DoResolve): Warn when comparing same
2909 2005-10-23 Marek Safar <marek.safar@seznam.cz>
2912 * expression.cs (Binary.DoResolve): It looks like there are no
2913 convetsion rules in enum context.
2915 2005-10-19 Carlos Alberto Cortez <calberto.cortez@gmail.com>
2917 Add support for extern alias qualifiers.
2918 * typemanager.cs: Move some LookupTypeReflection code
2919 to namespace.cs, to have cleaner code. Added some methods
2920 to help us keep track of the extern aliased references.
2921 * driver.cs: Add suport for extern alias assemblies on command
2922 line and check for their warnings/errors. Also keep track of the
2923 extern aliased assemblies.
2924 * namespace.cs: Move the global functionality of Namespace
2925 to GlobalRootNamespace/RootNamespace. Now the global namespace
2926 is GlobalRootNamespace.Globa. Also the code moved from
2927 typemanager.cs lives in GlobalRootNames.cs/RootNamespace.cs.
2928 Finally added LocalAliasEntry (AliasEntry before) and
2929 ExternAliasEntry, to handle alias statements.
2930 * cs-parser.jay: Add support in the grammar for extern alias
2932 * doc.cs, delegate.cs, expression.cs ecore.cs, symbolwriter.cs:
2933 Update callings to Namespace (now in GlobalRootNamespace).
2935 2005-10-18 Raja R Harinath <rharinath@novell.com>
2938 * class.cs (TypeContainer.DefineType): Move updating of
2939 topological sort earlier in the code.
2940 * decl.cs (DeclSpace.ResolveBaseTypeExpr): Don't use TypeBuilder.
2942 2005-10-18 Marek Safar <marek.safar@seznam.cz>
2945 * cfold.cs (BinaryFold): Reduce constant in enum conversion.
2947 * constant.cs (Constant.TryReduce): Moved from Cast class.
2948 (Reduce): Made little bit more OO and fixed missing conversions.
2950 * ecore.cs (Reduce): Implemented.
2951 (Binary.EnumLiftUp): New method to upgrade values to enum values.
2953 * literal.cs (Reduce): Implemented.
2955 * class.cs: Reverted Miguel's wrong commit.
2957 2005-10-14 Miguel de Icaza <miguel@novell.com>
2959 * ecore.cs (GetMemberType): Report the correct mapping for the MemberCore
2961 2005-10-14 Atsushi Enomoto <atsushi@ximian.com>
2963 * cs-parser.jay, expression.cs : CS0214 was missing error location
2964 for constants. Fixed bug #76404.
2966 2005-10-11 Marek Safar <marek.safar@seznam.cz>
2969 * convert.cs (ExplicitConversionCore): Fixed object->enum
2972 2005-10-10 Raja R Harinath <rharinath@novell.com>
2974 * ecore.cs (PropertyExpr.Emit): Use Invocation.EmitCall to emit
2976 (PropertyExpr.EmitCall): Likewise.
2977 * expression.cs (Invocation.EmitArguments): Handle case where
2979 (Invocation.EmitCall): Avoid allocating temporary variable if
2980 there are no arguments.
2982 2005-10-07 Raja R Harinath <rharinath@novell.com>
2985 * convert.cs (ImplicitConversionStandard): Move conversion of
2986 void* to arbitrary pointer types ...
2987 (ExplicitConversionStandard): .. here.
2988 * ecore.cs (Expression.Error_ValueCannotBeConverted): Fix CS0266
2989 error to always print typenames.
2991 2005-10-07 Raja R Harinath <rharinath@novell.com>
2993 * convert.cs (GetConversionOperator): Rename from
2994 GetConversionOperators. Move operator selection code from ...
2995 (UserDefinedConversion): ... here.
2997 2005-10-06 Marek Safar <marek.safar@seznam.cz>
2999 * convert.cs (ExplicitConversionCore): Removed duplicate enum
3002 2005-10-05 Marek Safar <marek.safar@seznam.cz>
3004 * assign.cs (Assign.DoResolve): Error method changed.
3006 * cfold.cs (DoConstantNumericPromotions): Error method changed.
3008 * const.cs (ResolveValue): Reset in_transit immediately.
3010 * constant.cs: Error method changed.
3012 * convert.cs: Removed useless location parameter.
3013 (ExplicitNumericConversion): Don't do double enum check.
3014 (ExplicitConversionCore): Renamed from ExplicitConversion.
3015 (ExplicitUnsafe): Extracted from ExplicitConversion.
3016 (ExplicitConversion): Uses for error reporting.
3018 * ecore.cs (Error_ValueCannotBeConverted): More logic for more
3020 (ResolveBoolean): Uses common error method.
3021 (CastToDecimal): Get rid of ec.
3022 (CastFromDecimal): Optimized.
3023 (ConvCast): Get rid of ec.
3025 * enum.cs (ResolveValue): Reset in_transit immediately.
3026 (Emit): Return after first error.
3028 * expression.cs: Convert changes.
3030 * literal.cs: Error method changed.
3032 * statement.cs: Error method changed.
3034 2005-10-03 Raja R Harinath <rharinath@novell.com>
3036 * support.cs (SeekableStreamReader.Position): Don't error out when
3037 the requested position is just beyond the end of the current
3040 2005-09-28 Raja R Harinath <rharinath@novell.com>
3042 * support.cs (SeekableStreamReader): Simplify drastically. Don't
3043 try to keep in sync with the byte count of the underlying Stream.
3044 However, this limits us to a window size of 2048 characters: i.e.,
3045 the maximum lookahead of our lexer/parser can be 2048 characters.
3047 2005-09-28 Marek Safar <marek.safar@seznam.cz>
3050 * driver.cs: Fix compilation files with full root path.
3052 2005-09-25 Miguel de Icaza <miguel@novell.com>
3054 * report.cs (SymbolRelatedToPreviousError): Format the output so
3055 it does not use an open parenthesis that is never closed.
3057 * driver.cs: Follow coding guidelines
3059 2005-09-27 Marek Safar <marek.safar@seznam.cz>
3062 * const.cs (Const.ResolveValue): Check for assigning non-null
3063 value to reference type.
3065 2005-09-27 Marek Safar <marek.safar@seznam.cz>
3067 * anonymous.cs: Implemented ExprClassName.
3069 * assign.cs (Assign.DoResolve): Don't chrash when type is not
3072 * attribute.cs (ResolveArguments): Enabled MethodImplOptions
3075 * class.cs (StaticClass.DefineContainerMembers): Report protected
3078 * codegen.cs: if(ed) PRODUCTION.
3080 * convert.cs (Error_CannotImplicitConversion): Better error
3083 * cs-parser.jay: More error checks.
3085 * cs-tokenizer.cs (consume_identifier): Fixed Miguel's revert.
3087 * driver.cs (CSCParseOption): Enabled wrong option check.
3089 * ecore.cs (Expression.ExprClassName): Turned to property.
3090 (MemberExpr.CheckIntermediateModification): For checking boxed
3091 value types modification.
3093 * statement.cs (Fixed.Resolve): Expression type must be
3094 convertible to fixed type.
3095 (CollectionForeach.GetEnumeratorFilter,TryType):
3096 Small refactoring for easier error checking.
3098 2005-09-26 Marek Safar <marek.safar@seznam.cz>
3100 * attribute.cs (Attribute.Resolve): Check Obsolete attribute for
3103 * class.cs (GeneratedBaseInitializer): New class for customization
3104 compiler generated initializers.
3105 (MemberBase.DoDefine): Check Obsolete attribute here.
3106 (FieldMember.DoDefine): Ditto.
3108 * const.cs (ExternalConstant.CreateDecimal): Builder for decimal
3111 * decl.cs (MemberCore.EmitContext): Returns valid current ec.
3112 (MemberCore.GetObsoleteAttribute): Removed argument.
3113 (MemberCore.CheckObsoleteness): Obsolete attributes are hierarchic.
3114 (MemberCore.CheckObsoleteType): New helper.
3118 * statement.cs: Updates after MemberCore changes.
3120 * ecore.cs (TypeExpr.ResolveType): Check type obsoleteness here.
3121 (FieldExpr.ResolveMemberAccess): Fixed decimal constants checks.
3123 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't check
3124 obsolete attribute for compiler construct.
3125 (As.DoResolve): Cache result.
3127 * iterators.cs (Define_Constructor): Use GeneratedBaseInitializer.
3129 2005-09-26 Raja R Harinath <rharinath@novell.com>
3132 * expression.cs (This.VerifyFixed): In a value type T, the type of
3133 'this' is T&, iow, 'this' is either an out or ref parameter. In a
3134 value type R, 'this' is treated as a value parameter.
3136 2005-09-22 Miguel de Icaza <miguel@novell.com>
3138 * statement.cs (Lock): Use the TemporaryVariable class instead of
3139 manually using local variables as those do not work when variables
3142 * ecore.cs: Moved the TemporaryVariable class from being a nested
3143 class inside Foreach to be a public class that can be employed in
3146 2005-09-19 Marek Safar <marek.safar@seznam.cz>
3148 * cs-parser.jay: interface_accessors replaced by
3149 accessor_declarations.
3151 * ecore.cs, literal.cs, statement.cs: NullLiteral holds null
3154 * statement.cs (GotoCase.Resolve): Convert null constant to
3156 (SwitchLabel.ResolveAndReduce): Ditto.
3157 (SwitchLabel.NullStringCase): Custom null stamp.
3158 (Switch.SimpleSwitchEmit): Fix from NullLiteral to NullStringCase.
3160 typemanager.cs (CSharpSignature): Don't skip first argument
3163 2005-09-18 Miguel de Icaza <miguel@novell.com>
3165 * driver.cs: Set InEmacs based on the environment variable EMACS.
3167 * location.cs (InEmacs): in this mode, do not report column
3168 location as it confuses Emacs.
3170 2005-09-16 Marek Safar <marek.safar@seznam.cz>
3172 * cfold.cs, constant.cs, convert.cs, ecore.cs,
3173 expression.cs, iterators.cs, literal.cs: Store constants and
3176 * class.cs (MemberBase.ShortName): Pass location.
3178 * cs-parser.jay: Some location fixes.
3180 * ecore.cs (Expression.Location): Made virtual.
3182 2005-09-05 Miguel de Icaza <miguel@novell.com>
3184 * expression.cs (Cast.TryReduce): Only reduce to an EnumConstant
3185 if the underlying types are the same, otherwise we need to produce
3186 code that will do the proper cast.
3188 This was exposed by Marek's constant rewrite which produced
3189 invalid code for the call site:
3192 void Method (X v) {}
3196 This fixes test-49.cs
3198 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
3200 * attribute.cs : (Attribute.IsValidArgumentType): array of string/
3201 Type/Object should be allowed as well. Fixed bug #75968.
3203 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
3205 * expression.cs : (Binary.DoResolve): when one is enum constant and
3206 another is constant 0, then return enum one *as enum type*.
3209 2005-09-02 Raja R Harinath <rharinath@novell.com>
3211 * attribute.cs (GetMarshal): Work even if "DefineCustom" is
3215 * ecore.cs (SimpleNameResolve.DoSimpleNameResolve): Disable
3216 flow-branching for LocalVariableReferences in case we were invoked
3217 from a MemberAccess.
3218 * expression.cs (LocalVariableReference.VerifyAssigned): New.
3220 (LocalVariableReference.DoResolveBase): ... this.
3221 (MemberAccess.Resolve): Do the check that was disabled during
3224 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
3227 (PartialContainer.Create): check abstract/sealed/static strictly
3228 but abstract/sealed can exist only at one side. Fixed bug #75883.
3230 2005-09-01 Kornél Pál <kornelpal@hotmail.com>
3233 * attribute.cs (Attribute.GetMarshal): If ArraySubType is not
3234 specified, don't default to UnmanagedType.I4.
3236 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
3238 * expression.cs : conditional operator should check possibly
3239 incorrect assign expression. Fixed bug #75946.
3241 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
3243 * cs-tokenizer.cs, cs-parser.jay, driver.cs, support.cs :
3244 Reverting the change. gmcs is much complex than mcs on this matter.
3246 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
3248 * cs-tokenizer.cs : To read another token ahead of the actual
3249 consumption, use new SavedToken and cache token instead of moving
3250 back the stream with SeekableStreamReader (it seemed problematic).
3252 driver.cs : Thus use StreamReader directly.
3253 * support.cs : Thus removed SeekableStreamReader.
3255 2005-08-30 Raja R Harinath <rharinath@novell.com>
3258 * anonymous.cs (ScopeInfo.MakeFieldName): New helper.
3259 (ScopeInfo.EmitScopeType): Use it to construct field names from
3260 names of captured locals.
3263 * ecore.cs (BoxedCast.BoxedCast) [1-argument variant]: Remove.
3264 * convert.cs (ImplicitReferenceConversion, TryImplicitIntConversion):
3265 Pass 'target_type' to BoxedCast. Don't default to 'object'.
3266 (ExplicitConversion): Remove enum cases already handled by
3267 implicit conversion. Move implicit conversion check to the beginning.
3268 * delegate.cs (DelegateCreation.ResolveMethodGroupExpr): Update.
3269 * expression.cs (ArrayCreation.EmitDynamicInitializers):
3270 Don't treat System.Enum as a struct.
3272 2005-08-30 Jb Evain <jbevain@gmail.com>
3274 * attribute.cs: handles as expression in parameters.
3276 2005-08-30 Raja R Harinath <rharinath@novell.com>
3279 * class.cs (TypeContainer.VerifyClsName): Don't use a
3280 PartialContainer when verifying CLS compliance.
3281 (AbstractPropertyEventMethod): Set Parent here, ...
3282 (PropertyMethod): ... not here.
3284 2005-08-30 Atsushi Enomoto <atsushi@ximian.com>
3286 * attribute.cs : escaped attribute name should not be allowed to be
3287 resolved (e.g. @class as classAttribute). Fixed bug #75930.
3289 2005-08-29 Raja R Harinath <rharinath@novell.com>
3292 * convert.cs (ImplicitStandardConversionExists): Allow zero also
3293 when converting a long constant to unsigned long.
3294 * expression.cs (Invocation.OverloadResolve): Add sanity check to
3295 detect where IsApplicable and VerifyArgumentsCompat disagree.
3297 2005-08-29 Raja R Harinath <rharinath@novell.com>
3298 and Carlos Alberto Cortez <carlos@unixmexico.org>
3301 * class.cs (TypeContainer.CanElideInitializer): New helper.
3302 (TypeContainer.EmitFieldInitializers): Use it to determine if we
3303 can safely emitting the initializer of a field.
3305 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
3307 * statement.cs : (Continue.Resolve()) Unlike break, continue is not
3308 allowed inside a switch (without loop). Fixed bug #75433.
3310 2005-08-26 Kornél Pál <kornelpal@hotmail.com>
3312 * AssemblyInfo.cs: Using Consts.MonoVersion instead of MonoVersion.cs.
3313 * mcs.exe.sources: Using Consts.MonoVersion instead of MonoVersion.cs.
3315 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
3317 * driver.cs : kinda reverting the default encoding changes (not exact
3318 revert since I noticed that "codepage:reset" might not work fine).
3320 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
3322 * class.cs : (AbstractPropertyEventMethod) SetupName() now takes
3323 Location. Now getter and setter store location correctly.
3324 (errors/cs0111-12.cs now reports the expected location.)
3326 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
3328 * driver.cs : Use default encoding on the environment.
3329 Removed (now that) extra parameter for SeekableStreamReader.
3330 * support.cs : (SeekableStreamReader) third .ctor() argument for
3331 StreamReader is not required (always true). preamble size could
3332 be acquired in simpler and safe way.
3334 2005-08-24 Atsushi Enomoto <atsushi@ximian.com>
3336 * cs-parser.jay: report CS0642 at warning level 3
3337 and report CS0642 for an if else statement also
3338 fixes bug #74745. Patch by John Luke (and a bit
3340 Removed extra CS0642 warning check for "while",
3342 * statement.cs: In Block.Resolve(), CS0642 check
3343 is reimplemented to check a sequence of an empty
3344 statement and a block.
3346 Both fix bug #66777.
3348 2005-08-24 Marek Safar <marek.safar@seznam.cz>
3350 * attribute.cs (GetMethodObsoleteAttribute): Disabled obsolete properties
3351 detection until I fix it.
3353 * cs-tokenizer.cs: Changed error message.
3355 * cs-parser.jay: Fixed 2 error locations.
3357 * ecore.cs (Error_TypeDoesNotContainDefinition): Share error message.
3358 (PropertyExpr.Error_PropertyNotFound): First attempt to detect non C#
3361 * enum.cs (GetSignatureForError): Fixed.
3363 * expression.cs (Invocation.IsSpecialMethodInvocation): Improved special
3367 * typemanager.cs (RegisterProperty): Removed.
3369 * statement.cs (CheckInvariantMeaningInBlock): Changed error message.
3371 2005-08-24 Raja R Harinath <rharinath@novell.com>
3374 * expression.cs (ArrayAccess.EmitLoadOpcode): Emit ldelem.i for pointers.
3375 (ArrayAccess.GetStoreOpcode): Return stelem.i for pointers.
3377 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
3379 * expression.cs : tiny fix is required for not warning positive ulong.
3382 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
3384 * expression.cs : add CS0652 check for constant and integral
3385 expression. Fixed bug #53974.
3387 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
3389 * expression.cs : in DoNumericPromotions(), check if there is implicit
3390 conversion overload for string (to check CS0034). Fixed bug #52492.
3392 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
3394 * cs-tokenizer.cs : Check newline in char constant. Fixed bug #75245.
3396 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
3398 * ecore.cs : report location when it is *not* Null.
3400 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
3406 Added OmitStructFlowAnalysis to EmitContext to handle CS0165 check
3407 correctly. Fixed bug #75721.
3409 2005-08-23 Raja R Harinath <rharinath@novell.com>
3411 * support.cs (SeekableStreamReader.Position): Avoid an expensive
3412 loop that performs 'min (pos, char_count)'.
3415 * expression.cs (Unary.ResolveOperator): Don't discard implicit
3416 converted value in Operator.OnesComplement.
3418 2005-08-22 Ben Maurer <bmaurer@ximian.com>
3420 * anonymous.cs: If the anon method is pulled into a helper class,
3421 it needs to be `internal' not `private'. Fixes runtime behavior on
3424 2005-08-20 Martin Baulig <martin@ximian.com>
3426 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
3427 scope if we don't already have it.
3429 * expression.cs (Invocation.EmitCall): Use `ec.EmitThis ()' rather
3430 than `ig.Emit (OpCodes.Ldarg_0)' to make it work inside iterators;
3433 2005-08-17 Marek Safar <marek.safar@seznam.cz>
3436 * decl.cs (DeclSpace.VerifyClsCompliance): Skip when collision object
3439 2005-08-16 Marek Safar <marek.safar@seznam.cz>
3441 The big constants rewrite
3442 Fix #75746, #75685 and more
3443 As a side effect saved 1MB for MWF ;-)
3445 * attribute.cs (GetAttributeArgumentExpression): Use ToType, GetTypedValue.
3446 (GetMarshal, GetMethodImplOptions, GetLayoutKindValue): Values are not
3447 enum based for corlib compilation.
3449 * cfold.cs (BinaryFold): Convert operand for enum additions. Fixed enum
3452 * class.cs (FixedField.Define): Use ResolveAsConstant.
3454 * const.cs (IConstant): Interface constants and enums.
3455 (Const.ResolveValue): New method for constant resolvning.
3456 (ExternalConstant): Constants from imported assemblies.
3458 * constant.cs (Constant.GetTypedValue): Used to get constant with forced
3459 conversion; like enums.
3460 (Constant.ToType): Converts this constant to different type.
3461 (Constant.Increment): Adds 1.
3463 * convert.cs (ImplicitConversionRequired): Simplified.
3465 * cs-parser.jay: Create EnumMember directly.
3467 * decl.cs (MemberCore.CheckObsoleteness): Checks for ObsoleteAttribute presence.
3469 * doc.cs (GenerateEnumDocComment): Removed.
3471 * ecore.cs (Expression.ResolveAsConstant): New constant specific method.
3472 (ConvertIntLiteral): Removed.
3473 (FieldExpr.ResolveMemberAccess): Refactored to remove constant specific if(s).
3475 * enum.cs (EnumMember): Implement IConstant.
3476 (Enum.IsValidEnumConstant): Removed.
3477 (Enum.GetNextDefaultValue): Removed.
3478 (Enum.FindMembers): Updated.
3479 (Enum.GenerateDocComment): Iterate enum members.
3481 * expression.cs (Cast.TryReduce): Handle enums correctly.
3482 (New.Constantify): Made public.
3483 (MemberAccess.DoResolve): Removed contant specific if(s).
3485 * literal.cs (NullLiteral): Implement new abstract methods.
3487 * statement.cs (GotoCase.Resolve): Use new constant methods.
3488 (SwitchLabel.ResolveAndReduce): Use new constant methods.
3490 * typemanager.cs (LookupEnum): Removed.
3491 (IsEnumType): Fixed to work with corlib.
3492 (RegisterConstant): Removed.
3493 (LookupConstant): Removed.
3494 (GetConstant): Changed to work with IConstant.
3496 2005-08-04 Atsushi Enomoto <atsushi@ximian.com>
3498 * location.cs : Fixed overflown (>255) column number.
3500 2005-08-03 Raja R Harinath <rharinath@novell.com>
3502 First cut of the qualified-alias-member feature.
3503 * cs-tokenizer.cs (Tokenizer.is_punct): Recognize the double-colon
3505 * cs-parser.jay (DOUBLE_COLON): New token.
3506 (namespace_or_type_name): Add rule for recognizing
3507 qualified-alias-members.
3508 (primary_expression): Likewise.
3509 (element_access): Allow QualifiedAliasMember as a possible
3510 type-bearing expression.
3511 (local_variable_type, local_variable_pointer_type): Likewise.
3512 * namespace.cs (NamespaceEntry.LookupAlias): New. Looks up
3513 aliases in the current and enclosing namespace declarations.
3514 (NamespaceEntry.UsingAlias): Add CS0440 warning.
3515 * decl.cs (MemberName.is_double_colon): New.
3516 (MemberName.MemberName): Add new constructor for alias-member.
3517 (MemberName.GetTypeExpression): Generate QualifiedAliasMember too.
3518 * expression.cs (QualifiedAliasMember): New expression type.
3520 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
3522 * location.cs : it borked when no argument was specified.
3524 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
3526 * location.cs : tiny ToString() format fix.
3528 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
3530 * statement.cs : oops, it was missing.
3532 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
3534 A set of fixes for precise line/column location.
3537 "token" field now holds a file/line "delta", a line number offset
3538 from the segment, and a column number. See also:
3539 http://lists.ximian.com/pipermail/mono-devel-list/2004-
3540 December/009508.html
3541 Removed static IsNull. Use instance IsNull property instead.
3543 For some tokens it stores Location. For Identifier it stores
3544 LocatedToken which is a pair of string name and location.
3545 Column numbers are adjusted only at getChar().
3547 Use Location.ToString() for reporting (it now contains column).
3549 Largely modified to use LocatedToken instead of
3550 string (IDENTIFIER), and to acquire Location from some tokens.
3551 * namespace.cs, decl.cs, ecore.cs, class.cs, delegate.cs,
3552 iterators.cs, const.cs, anonymous.cs, tree.cs, enum.cs,
3554 Now MemberName holds Location. DeclSpace.ctor() receives Location
3555 as a parameter. Removed extra parameters to all derived classes.
3556 Replaced Location.IsNull() with instance property.
3557 * assign.cs, expression.cs :
3558 Added .ctor() overload that omits Location.
3560 Added "nameEscaped" flag that indicates the identifier was escaped
3561 in the source file. This fixes bug #57047.
3563 2005-08-02 Marek Safar <marek.safar@seznam.cz>
3565 * attribute.cs (AttributeTester.GetImportedIgnoreCaseClsType):
3566 New method, looking for lo-case imported cls type.
3568 * decl.cs (DeclSpace.VerifyClsCompliance): Check CS3005 for types
3571 * driver.cs: Removed VerifyTopLevelNameClsCompliance usage.
3573 * enum (Enum.VerifyClsCompliance): Hardcode non-compliant types.
3575 * typemanager.cs (TypeManager.AllClsTopLevelTypes): Renamed from
3577 (TypeManager.LoadAllImportedTypes): Lo-case imported types.
3579 Optimized to save 3.5 MB for SWF compilation.
3581 2005-08-01 Marek Safar <marek.safar@seznam.cz>
3583 * class.cs (AddToTypeContainer): Use inheritance insted of if(s).
3584 (PartialContainer.Create): Moved logic AddToContainer.
3585 (PartialContainer.MarkForDuplicationCheck): Shares name.
3587 * decl.cs (DeclSpace.AddToContainer): Check name collisions at one
3590 * namespace.cs (Namespace.AddDeclSpace): Lazy declspaces
3592 (Namespace.GetSignatureForError): New method.
3594 * tree.cs (Tree.RecordDecl): Moved to AddToContainer.
3595 (RootTypes.AddToTypeContainer): se inheritance insted of if(s).
3597 2005-08-01 Raja R Harinath <rharinath@novell.com>
3600 * ecore.cs (Expression.MemberLookupFailed): Use queried_type for
3601 member lookup rather than qualifier_type, since qualifier_type can
3604 2005-08-01 Marek Safar <marek.safar@seznam.cz>
3606 * enum.cs (Enum.VerifyClsName): Fixed to allow not CLSCompliant
3609 2005-07-31 Miguel de Icaza <miguel@novell.com>
3611 * statement.cs: Copy the local exception into the exception
3612 captured local. Fixes 75674
3614 2005-07-31 Raja R Harinath <harinath@gmail.com>
3617 * expression.cs (Invocation.OverloadResolve): Don't report error
3618 CS1501 if error CS1502 has been reported.
3619 (New.DoResolve): Delegate CS1501 reporting to
3620 Invocation.OverloadResolve.
3623 * statement.cs (Block.CheckInvariantMeaningInBlock): Verify
3624 invariant-meaning-in-block property in an enclosing block if
3627 2005-07-29 Marek Safar <marek.safar@seznam.cz>
3629 * statement.cs (SwitchLabel.ResolveAndReduce): Refactored.
3630 (SwitchLabel.Erorr_AlreadyOccurs): Share error message.
3631 (Switch.CheckSwitch): Just save 50kb for SWF.
3633 2005-07-27 Martin Baulig <martin@ximian.com>
3635 * anonymous.cs (CaptureContext.AddField): Added
3636 `AnonymousContainer am' argument; compute its toplevel scope if
3637 it's not already computed. Fixes #75649.
3639 2005-07-26 Raja R Harinath <rharinath@novell.com>
3642 * class.cs (Constructor.Emit): Reset block to null if the block
3645 2005-07-25 Marek Safar <marek.safar@seznam.cz>
3647 * class.cs (TypeContainer.VerifyMembers): Be compatible in warning 169.
3649 2005-07-25 Marek Safar <marek.safar@seznam.cz>
3651 * class.cs (MethodData.Define): Check whether accessor implementing
3652 interface is public.
3654 * driver.cs (Driver.parse): Try to be smart and check for `MZ' header.
3656 2005-07-22 Marek Safar <marek.safar@seznam.cz>
3659 * namespace.cs (LookupType): Moved same type check to...
3661 * typemanager.cs (LookupTypeReflection): Don't allow to import more types
3664 2005-07-21 Raja R Harinath <rharinath@novell.com>
3666 * namespace.cs (NamespaceLookupType): Avoid a string allocation when we
3667 already found a typebuilder.
3668 * class.cs (MethodCore.IsDuplicateImplementation): Compare
3669 MemberNames, not strings.
3671 * const.cs (Error_ExpressionMustBeConst):
3672 Rename from Error_EpressionMustBeConst.
3673 * const.cs, class.cs, statement.cd: Update.
3675 2005-07-21 Marek Safar <marek.safar@seznam.cz>
3679 * const.cs (Const.LookupConstantValue): Report missing contant expression
3681 (Error_EpressionMustBeConstant): Only one error method.
3683 * class.cs, statement.c: Updated.
3685 2005-07-20 Raja R Harinath <rharinath@novell.com>
3687 * statement.cs (Block.Flags): Add back HasVarargs.
3688 (Block.flags): Make protected.
3689 (ToplevelBlock.HasVarargs): Convert to a property that updates flags.
3691 * typemanager.cs (types, typecontainers, user_types): Remove.
3692 (UserTypes, TypeContainers): Likewise.
3693 (HandleDuplicate, AddDelegateType, AddEnumType): Likewise.
3694 (CleanUp, Reset): Update.
3695 (AddUserType): Combine variants. Now, only updates builder_to_declspace.
3696 (GetNestedType): Use Type.GetNestedType.
3697 (CoreLookupType): Take two arguments, the namespace and the
3698 basename of the type. Update to use the Namespace.Lookup
3700 (InitEnumUnderlyingTypes, InitCoreTypes): Update.
3701 (RealMemberLookup): Use IsNestedChildOf instead of playing with
3702 string concatenation and substring matches.
3703 * class.cs, enum.cs, delegate.cs: Update to changes.
3705 2005-07-20 Marek Safar <marek.safar@seznam.cz>
3707 * constant.cs (Constant.Error_ConstantValueCannotBeConverted): Moved from
3708 Expression and made virtual.
3710 * convert.cs (ImplicitReferenceConversionExists): Skip for value types.
3711 (ImplicitStandardConversionExists): Fixed `byte' typo ?
3713 * ecore.cs (Expression.Error_ConstantValueCannotBeConverted): Moved.
3715 * literal.cs (NullLiteral.Error_ConstantValueCannotBeConverted): Customize
3718 * convert.cs, ecore.cs, enum.cs: Reflect Error_ConstantValueCannotBeConverted
3721 2005-07-18 Marek Safar <marek.safar@seznam.cz>
3724 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Check whether
3725 AssemblyCultureAttribute is not used on executable.
3728 * typemanager.cs: Add System.Reflection.AssemblyCultureAttribute.
3730 2005-07-16 Raja R Harinath <rharinath@novell.com>
3733 * expression.cs (Binary.Warning_UnintendeReferenceComparison):
3734 New. Reports CS0252/CS0253.
3735 Mostly taken from preliminary patch by Duncak Mak.
3736 (Binary.DoResolveOperator): Store results of operator lookup.
3737 Use them to detect if we need to warn about unintended reference
3740 2005-07-15 Raja R Harinath <rharinath@novell.com>
3743 * namespace.cs (Namespace.Lookup): Add back location parameter.
3744 (Namespace.LookupType): Add CS0436 report. Add location parameter.
3745 * delegate.cs, ecore.cs, expression.cs: Update to changes.
3747 * codegen.cs (EmitContext.DeclSpace): Make readonly.
3748 * namespace.cs (Namespace.Lookup): Carve out type lookup into ...
3749 (Namespace.LookupType): ... this.
3750 (NamespaceEntry.GetUsingTable): Allocate only one zero-sized array
3752 * typemanager.cs (LookupTypeReflection): Remove buggy code that
3753 purported to handle pointers.
3754 (char_ptr_type, void_ptr_type): Use GetPointerType rather than
3757 2005-07-15 Marek Safar <marek.safar@seznam.cz>
3759 * expression.cs (MemberAccess.ResolveNamespaceOrType): Don't report nested
3762 2005-07-15 Raja R Harinath <rharinath@novell.com>
3764 * namespace.cs (Namespace.Lookup): Drop location parameter.
3765 (NamespaceEntry.LookupAlias): Remove. Merge into ...
3766 (NamespaceEntry.Lookup): ... this.
3767 (NamespaceEntry.Error_AmbiguousTypeReference):
3768 Move here from DeclSpace.
3769 (NamespaceEntry.LookupNamespaceOrType): Move support for dotted
3771 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): ... here.
3772 * decl.cs (DeclSpace.ErrorAmbiguousTypeReference):
3773 Move to NamespaceEntry.
3774 * delegate.cs, expression.cs: Update to changes.
3776 2005-07-14 Marek Safar <marek.safar@seznam.cz>
3778 * attribute.cs (Attribute.ResolveAttributeType): Renamed from
3779 CheckAttributeType and refactored.
3780 (Attribute.ResolvePossibleAttributeType): Changed to reuse
3781 ResolveAsTypeTerminal error handling.
3782 (ResolveAsTypeTerminal): Introduced because of global attributes extra
3784 (GetSignatureForError): Print errors in same way.
3787 * codegen.cs: Reflect attribute GetSignatureForError change.
3790 * expression.cs: Add silent parameter to ResolveAsTypeStep.
3792 * namespace.cs (UsingEntry): Refactored to make fields private.
3795 statement.cs: Error_UnexpectedKind has extra parameter.
3797 2005-07-14 Raja R Harinath <rharinath@novell.com>
3799 * ecore.cs (IAlias): Remove.
3800 * decl.cs (DeclSpace): Don't derive from IAlias. Remove members
3801 that implement the interface.
3802 * namespace.cs (Namespace): Likewise.
3803 (Namespace.declspaces): Renamed from 'defined_names'.
3804 (Namespace.AddDeclSpace): Renamed from 'DefineName'. Take a
3805 DeclSpace instead of an IAlias.
3806 * tree.cs (Tree.AddDecl): Update.
3808 2005-07-12 Raja R Harinath <rharinath@novell.com>
3810 * statement.cs (Block.Flags); Remove HasVarargs.
3811 (Block.HasVarargs): Move to ToplevelBlock.
3812 (Block.ThisVariable, Block.AddThisVariable): Likewise.
3813 (Block.Variables): Make protected. Initialize variable hashtable
3815 (Block.AddVariable): Update.
3816 (Block.Resolve): Update to changes.
3817 (ToplevelBlock.HasVarargs): New boolean.
3818 (ToplevelBlock.ThisVariable): Move here from Block.
3819 (ToplevelBlock.AddThisVariable): Likewise.
3820 (ToplevelBlock.IsThisAssigned): New. Forwards call to this_variable.
3821 * expression.cs (This.ResolveBase): Update to changes.
3822 (ArglistAccess.DoResolve): Likewise.
3824 2005-07-11 Marek Safar <marek.safar@seznam.cz>
3827 * ecore.cs, class.cs: Use SetAssigned instead of direct access.
3829 * class.cs (TypeContainer.VerifyMembers): Distinguish between
3830 not used and not used & assigned.
3831 (FieldBase.ASSIGNED): Moved to MemberCore.Flags.
3833 2005-07-11 Marek Safar <marek.safar@seznam.cz>
3836 * expression.cs (Is.DoResolve): null is never provided type.
3838 2005-07-08 Marek Safar <marek.safar@seznam.cz>
3841 * cs-parser.jay: Less strict event error rule to catch more errors.
3843 2005-07-08 Martin Baulig <martin@ximian.com>
3845 Fix test-iter-10.cs - distinguish whether we `yield' in a property
3846 gettter (allowed) or setter (not allowed).
3848 * class.cs (Accessor): Implement IIteratorContainer.
3849 (Accessor.Yields): New public field.
3850 (PropertyBase.PropertyMethod.Define): Handle iterators on a
3854 (get_accessor_declaration, set_accessor_declaration): Set the
3855 `yields' flag on the accessor, not the property.
3856 (property_declaration): Do the iterators check on a per-accessor
3857 basis and not for the whole property.
3859 2005-07-08 Martin Baulig <martin@ximian.com>
3861 * anonymous.cs (CaptureContext.EmitParameterInstance): Correctly
3862 handle parameters in nested scopes; fixes #74808; see gtest-188.cs.
3864 2005-07-07 Marek Safar <marek.safar@seznam.cz>
3867 * attribute.cs (orig_sec_assembly): Holds original version of assembly.
3868 (ExtractSecurityPermissionSet): Cope with self referencing security
3869 attributes properly.
3871 * driver.cs (SetOutputFile): Made public property OutputFile.
3873 2005-07-07 Raja R Harinath <rharinath@novell.com>
3876 * class.cs (TypeContainer.first_nonstatic_field): Rename from
3877 has_nonstatic_fields. Make into a FieldBase pointer.
3878 (TypeContainer.AddField): Add CS0282 check.
3879 (TypeContainer.EmitType): Update.
3881 2005-07-06 Miguel de Icaza <miguel@novell.com>
3883 * cs-tokenizer.cs (consume_identifier): Do not create strings to
3884 compare if they start with __.
3886 2005-07-06 Raja R Harinath <rharinath@novell.com>
3888 * statement.cs (Switch.SwitchGoverningType): Only look at
3889 UserCasts that don't need implicit standard conversions to one of
3890 the allowed switch types (Fixes test-322.cs).
3891 (LocalInfo.Resolve): Re-enable sanity-test.
3893 2005-07-06 Marek Safar <marek.safar@seznam.cz>
3895 * cs-tokenizer.cs (consume_identifier): Detect double undescores
3897 * ecore.cs (FieldExpr.AddressOf): Changed volatile error to warning.
3899 * expression.cs (Invocation.DoResolve): Report error CS0245 here.
3901 2005-07-06 Raja R Harinath <rharinath@novell.com>
3904 * ecore.cs (SimpleName.GetSignatureForError): Add.
3905 * expression.cs (MemberAccess.DoResolve): Don't clobber 'expr' field.
3906 (MemberAccess.GetSignatureForError): Add.
3908 2005-07-05 Marek Safar <marek.safar@seznam.cz>
3910 The big error and warning messages review.
3940 * typemanager.cs: Updated.
3942 * class.cs: (MethodCore.SetYields): Moved here to share.
3943 (PropertyMethod.Define): Moved iterator setup here.
3945 * iterators.cs: Add orig_method to have full access to parent
3948 2005-07-05 Raja R Harinath <rharinath@novell.com>
3950 Make 'fixed variable' handling standards compliant. Fix #70807, #72729.
3951 * ecore.cs (IVariable.VerifyFixed): Remove 'is_expression' parameter.
3952 (FieldExpr.VerifyFixed): Ensure that the field is part of a fixed
3953 variable of struct type.
3954 * expression.cs (Unary.ResolveOperator): Update to change.
3955 (Indirection.VerifyFixed): Likewise.
3956 (LocalVariableReference.VerifyFixed): A local variable is always fixed.
3957 (ParameterReference.VerifyFixed): Value parameters are fixed.
3958 (This.VerifyFixed): Treat 'this' as a value parameter.
3959 * statement.cs (LocalInfo.IsFixed): Remove.
3961 2005-07-01 Martin Baulig <martin@ximian.com>
3963 * iterators.cs (Iterator.CapturedThisReference.Emit): Use
3964 `ec.EmitThis ()' to get the correct scope.
3966 2005-07-01 Martin Baulig <martin@ximian.com>
3968 * ecore.cs (FieldExpr.DoResolve): Don't capture the field if it's
3969 instance is a ParameterReference; fixes #75299.
3971 2005-07-01 Martin Baulig <martin@ximian.com>
3973 Reverted Marek's latest patch (r46725):
3974 - it contains structural changes which are neither mentioned in
3975 the ChangeLog nor explained anywhere; for example the additional
3976 argument of EmitContext's and Iterator's .ctor's and the
3977 TypeContainer.DefineMembers() change.
3978 - structural changes like this should go in in seperate patches
3979 and not be hidden in a huge patch which just seems to affect
3980 warnings and errors.
3981 a big and hard to understand patch.
3982 - it breaks iterators and causes regressions, for instance in
3985 2005-06-30 Raja R Harinath <rharinath@novell.com>
3988 * expression.cs (Indexers.map): Remove.
3989 (Indexers.Append): Filter out inaccessible setters and getters.
3990 (IndexerAccess.DoResolve, IndexerAccess.DoResolveLValue): Update.
3993 * ecore.cs (MemberExpr.EmitInstance): New. Add CS0120 check.
3995 (FieldExpr.EmitInstance, PropertyExpr.EmitInstance): ... these.
3996 (FieldExpr.Emit, PropertyExpr.Emit): Update.
3997 (FieldExpr.EmitAssign, PropertyExpr.EmitAssign): Update.
3998 * expression.cs (Invocation.EmitCall): Add CS0120 check.
4000 2005-06-30 Marek Safar <marek.safar@seznam.cz>
4003 * class.cs (FieldBase.GetInitializerExpression): One more field
4006 2005-06-28 Miguel de Icaza <miguel@novell.com>
4008 * pending.cs: Do not define a proxy if the base method is virtual,
4009 it will be picked up by the runtime (bug 75270).
4011 2005-06-08 Martin Baulig <martin@ximian.com>
4013 The big Iterators rewrite :-)
4015 * iterators.cs: Rewrite this to use the anonymous methods framework.
4017 * rootcontext.cs (RootContext.DefineTypes): Define Delegates
4018 before the TypeContainers; see 2test-21.cs.
4021 (TypeContainer.DefineType): Don't create a new EmitContext if we
4022 already have one (this only happens if we're an Iterator).
4023 (TypeContainer.Define): Also call Define() on all our iterators.
4024 (Method.CreateEmitContext): Added support for iterators.
4027 (AnonymousContainer): New abstract base class for `AnonymousMethod'.
4028 (AnonymousContainer.CreateMethodHost): Moved here from
4029 AnonymousMethod and made abstract.
4030 (AnonymousContainer.CreateScopeType): New abstract method.
4031 (AnonymousContainer.IsIterator): New public property.
4032 (ScopeInfo.EmitScopeType): Call CreateScopeType() on our Host to
4033 get the ScopeTypeBuilder rather than manually defining it here.
4034 (ScopeInfo.EmitScopeInstance): New public method; correctly handle
4037 * driver.cs (Driver.MainDriver): Call TypeManager.InitCodeHelpers()
4038 before RootContext.DefineTypes().
4040 * codegen.cs (EmitContext.RemapToProxy): Removed.
4041 (EmitContext.CurrentAnonymousMethod): Changed type from
4042 AnonymousMethod -> AnonymousContainer.
4043 (EmitContext.ResolveTopBlock): Protect from being called twice.
4044 (EmitContext.MapVariable, RemapParameter(LValue)): Removed.
4045 (EmitContext.EmitThis): Removed the iterators hacks; use the
4046 anonymous methods framework for that.
4049 (ToplevelBlock.Container): Make this a property, not a field.
4050 (ToplevelBlock.ReParent): New public method; move the
4051 ToplevelBlock into a new container.
4052 (Foreach.TemporaryVariable): Simplify.
4054 2005-06-05 Martin Baulig <martin@ximian.com>
4056 * statement.cs (LocalInfo.CompilerGenerated): New flag.
4057 (Block.AddTemporaryVariable): New public method; creates a new
4058 `LocalInfo' for a temporary variable.
4059 (Block.EmitMeta): Create the LocalBuilders for all the temporary
4061 (Foreach.TemporaryVariable): Use Block.AddTemporaryVariable() for
4062 non-iterator variables.
4064 2005-06-05 Martin Baulig <martin@ximian.com>
4066 * statement.cs (Foreach.TemporaryVariable): Create the
4067 LocalBuilder in the Emit phase and not in Resolve since in some
4068 situations, we don't have an ILGenerator during Resolve; see
4069 2test-19.cs for an example.
4071 2005-06-04 Martin Baulig <martin@ximian.com>
4073 **** Merged r45395 from GCS ****
4075 The big Foreach rewrite - Part II.
4077 * typemanager.cs (TypeManager.object_getcurrent_void): Replaced
4078 with `PropertyInfo ienumerator_getcurrent'.
4080 * codegen.cs (VariableStorage): Removed.
4083 (Foreach): Derive from Statement, not ExceptionStatement.
4084 (Foreach.CollectionForeach): New nested class. Moved all the code
4085 dealing with collection foreach here.
4086 (Foreach.ForeachHelperMethods): Removed.
4087 (Foreach.TemporaryVariable): Implement IMemoryLocation.
4089 2005-05-23 Martin Baulig <martin@ximian.com>
4091 * statement.cs (Try.DoResolve): Don't create a `finally' if we
4092 don't need to. Fix #75014.
4094 2005-05-20 Martin Baulig <martin@ximian.com>
4096 Merged r44808 from GMCS.
4098 * class.cs (TypeContainer.CircularDepException): Removed.
4099 (TypeContainer.DefineType): Removed the `InTransit' stuff.
4100 (TypeContainer.CheckRecursiveDefinition): Check for circular class
4101 (CS0146) and interface (CS0529) dependencies here.
4103 2005-06-21 Raja R Harinath <rharinath@novell.com>
4105 * expression.cs (Invocation.EmitCall): Fix initialization
4106 'this_call' to reflect current behaviour. Fix indentation.
4108 * convert.cs (FindMostEncompassedType): Add two trivial special
4109 cases (number_of_types == 0 || number_of_types == 1).
4110 (FindMostEncompasingType): Likewise.
4112 2005-06-17 Raja R Harinath <rharinath@novell.com>
4114 Some cleanups preparing for the fix of #75283.
4115 * ecore.cs (PropertyExpr.InstanceResolve): Tighten conditions for
4117 (EventExpr.InstanceResolve): Likewise.
4118 (EventExpr.DoResolve): Remove redundant checks.
4120 2005-06-10 Duncan Mak <duncan@novell.com>
4122 * cs-tokenizer.cs (process_directives): New flag for controlling
4123 the processing of preprocessor directives.
4124 (x_token): After seeing a '#', return Token.NONE instead of going
4125 to handle_preprocessing_directive() when not processing
4126 directives. This avoids unnecessary processing during the token peek in
4131 * cs-tokenizer.cs (handle_preprocessing_directive, xtoken): Use
4132 the existing error reporting methods instead of Report.Error.
4134 * convert.cs (priv_fmt_expr): Remove. It's not needed anymore
4135 after Raja's rewrite.
4137 2005-06-08 Miguel de Icaza <miguel@novell.com>
4139 * class.cs: Small fix.
4141 2005-06-08 Raja R Harinath <rharinath@novell.com>
4144 * class.cs (GetPartialBases): Fix return value check of
4147 2005-06-07 Raja R Harinath <rharinath@novell.com>
4149 Ensure that partial classes are registered in their enclosing
4150 namespace. Initial part of fix of #75160.
4151 * tree.cs (Tree.RecordDecl): Add new namespace argument.
4152 Register declspace with namespace here, not in
4153 DeclSpace.RecordDecl.
4154 * cs-parser.jay: Pass namespace to RecordDecl.
4155 * class.cs (PartialContainer.Create): Likewise.
4156 (ClassPart.DefineType): New sanity-check. Throws an exception if
4158 * decl.cs (Declspace.RecordDecl): Remove.
4159 * namespace.cs (NamespaceEntry.DefineName): Remove.
4161 2005-06-06 Marek Safar <marek.safar@seznam.cz>
4163 * rootcontext.cs: Reset TargetExt as well.
4165 2005-06-03 Raja R Harinath <rharinath@novell.com>
4167 * ecore.cs (Expression.Resolve): Emit CS0654 error when
4170 2005-06-02 Raja R Harinath <rharinath@novell.com>
4172 Fix #75080, cs0119.cs.
4173 * ecore.cs (Expression.ExprClassToResolveFlags): New. Broken out
4175 (Expression.Resolve): ... this. Use it. Remove bogus code
4176 allowing ExprClass.Type and ExprClass.Namespace for
4177 ResolveFlags.VariableOrValue.
4178 (Expression.Resolve) [1-argument variant]: Change default resolve
4179 flags based on language version.
4180 (Expression.Error_UnexpectedKind): Use a simple string array
4181 rather than an ArrayList.
4182 * expression.cs (TypeOf.DoResolve): Set eclass to ExprClass.Value,
4184 (TypeOfVoid.DoResolve): Likewise.
4185 (MemberAccess.DoResolve) [3-argument variant]: Make private. Drop
4186 flags argument -- it always has the same value.
4188 2005-05-31 Raja R Harinath <rharinath@novell.com>
4191 * ecore.cs (Expression.ResolveLValue): Add a Location parameter.
4192 Use it in the error message.
4193 * assign.cs, expression.cs, statement.cs: Update.
4195 2005-05-30 Raja R Harinath <rharinath@novell.com>
4198 * ecore.cs (Expression.MemberLookupFailed): Add CS0122 check in
4199 the "almostMatchedMember" case too.
4200 * typemanager.cs (Closure.CheckValidFamilyAccess): Add anything
4201 that failed the accessibility checks to 'almost_match'.
4203 2005-05-27 Vladimir Vukicevic <vladimir@pobox.com>
4205 * attribute.cs: Use internal MethodBuilder methods to set
4206 ExactSpelling and SetLastError on PInvoke methods, instead
4207 of passing them via charset. Fixes #75060.
4209 2005-05-27 Raja R Harinath <rharinath@novell.com>
4211 * parameter.cs (Parameter): Remove TODO comment.
4212 (Parameter.DefineParameter): Remove Location parameter.
4213 (Parameters.LabelParameters): Likewise.
4214 * class.cs (Constructor.Emit): Update to change.
4215 (MethodData.Emit): Likewise.
4216 * anonymous.cs (AnonymousMethod.EmitMethod): Likewise.
4217 * delegate.cs (Delegate.Define, Delegate.Emit): Likewise.
4219 2005-05-27 Atsushi Enomoto <atsushi@ximian.com>
4222 Removed Parameters.Location and added Parameter.Location instead.
4223 Removed Location parameter from Emit() and GetSignature().
4230 Modified all related calls.
4232 2005-05-26 Raja R Harinath <rharinath@novell.com>
4234 Improve user-defined conversion handling.
4235 * convert.cs (GetConversionOperators): Rewrite. Return only the
4236 applicable operators.
4237 (AddConversionOperators): New. Helper for GetConversionOperators.
4238 (FindMostEncompassedType, FindMostEncompassingType): Verify that
4239 there is only one most encompassed/encompassing type.
4240 (FindMostSpecificSource, FindMostSpecificTarget): Remove
4241 "applicable operator" handling.
4242 (UserConversion): Move cache here from GetConversionOperators.
4243 Directly cache the chosen operator, rather than the whole
4245 (ExplicitNumericConversion): Fix buggy implementation of Decimal
4246 case. Allow conversion of decimal to sbyte and byte too.
4247 * expression.cs (EmptyExpression.Grab, EmptyExpression.Release):
4248 New static methods. Used to avoid allocating EmptyExpressions in
4251 2005-05-24 Duncan Mak <duncan@novell.com>
4253 * ecore.cs (CastFromDecimal): New class for casting a decimal to
4254 another class, used in Convert.ExplicitNumericConversion.
4255 (CastToDecimal): New class, similar to above, but casts to
4256 System.Decimal, used in Convert.ImplicitNumericConversion and also
4257 in explicit convesion from double/float to decimal.
4259 * convert.cs (ImplicitNumericConversion): Handle implicit
4260 conversions to System.Decimal.
4261 (ExplicitNumericConversion): handle explicit conversions to
4266 2005-05-20 Miguel de Icaza <miguel@novell.com>
4268 * typemanager.cs (EnumToUnderlying): Do not throw if we do not
4269 know the type at this stage, just break through. Fixes #75008
4271 2005-05-19 Martin Baulig <martin@ximian.com>
4274 (ImplicitDelegateCreation.Check): Added `bool check_only' argument
4275 to disable error reporting.
4277 * convert.cs (Convert.ImplicitStandardConversionExists): Use it
4278 here since we don't want to report an error; see the new test-336.cs.
4280 2005-05-19 Raja R Harinath <rharinath@novell.com>
4282 * statement.cs (ToplevelBlock.GetParameterReference)
4283 (ToplevelBlock.IsParameterReference,ToplevelBlock.IsLocalParameter):
4284 Move here from class Block.
4285 * ecore.cs (SimpleName.SimpleNameResolve): Update to changes.
4286 * expression.cs (ParameterReference.DoResolveBase): Likewise.
4288 2005-05-18 Martin Baulig <martin@ximian.com>
4293 (FlowBranching.Reachability): Add non-static public And() and Or()
4295 (FlowBranchingSwitch): New class; do the `break_origins' thing
4296 like in FlowBranchingLoop.
4297 (FlowBranching.UsageVector.MergeBreakOrigins): Also merge the
4298 reachability, not just locals and parameters.
4299 (FlowBranching.MergeChild): Remove some of the hacks for loop and
4300 switch; MergeBreakOrigins() now takes care of that.
4302 2005-05-18 Martin Baulig <martin@ximian.com>
4304 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
4305 a loop and may leave it, reset the barrier; fixes #74974.
4307 2005-05-17 Marek Safar <marek.safar@seznam.cz>
4309 * attribute.cs (Attribute.ResolveArguments): GuidAttribute check
4312 * cs-parser.jay: Catch more lexical errors.
4314 * report.cs: Add one more Error method.
4317 * typemanager.cs: Register System.Runtime.InteropServices.GuidAttribute
4319 2005-05-17 Martin Baulig <martin@ximian.com>
4321 * expression.cs (Argument.Resolve): Turn on flow analysis; fix
4324 2005-05-16 Raja R Harinath <rharinath@novell.com>
4326 Fix test-382.cs. Emit values of decimal constants.
4327 * class.cs (TypeContainer.RegisterFieldForInitialization): New.
4329 (TypeContainer.AddField): ... this.
4330 (TypeContainer.EmitFieldInitializers): Allow the list of fields
4331 with initializers to include 'Const's.
4332 (ClassPart.RegisterFieldForInitialization): Forward to
4334 * const.cs (Const.Const): Pass initializer to base class.
4335 (Const.Define): In case of decimal constants, register them for
4336 initialization in a static constructor.
4338 2005-05-14 Martin Baulig <martin@ximian.com>
4340 * statement.cs (Block.Resolve): Correctly handle unreachable code;
4341 do not call ResolveUnreachable() on unreachable statements in
4342 here, see the comment in the source code.
4344 2005-05-13 Raja R Harinath <rharinath@novell.com>
4347 * expression.cs (BinaryResolveOperator): If one of the operands of
4348 an equality comparison is 'null' and the other is a pointer type,
4349 convert the null to a NullPointer.
4350 * convert.cs (ImplicitReferenceConversion): If the expression is a
4351 NullLiteral and the target type is a pointer type, return a
4352 NullPointer instead.
4353 (ImplicitConversionStandard): Likewise.
4355 2005-05-13 Marek Safar <marek.safar@seznam.cz>
4357 * cs-parser.jay: Set readonly context based on special constructs.
4359 * expression.cs (LocalVariableReference.DoResolveBase): Improved
4360 readonly variable error handling.
4362 * rootcontext.cs (EmitCode): Don't verify members when error
4365 * statement.cs (LocalInfo): Add reaodnly context information.
4366 (SetReadOnlyContext, GetReadOnlyContext): New methods.
4368 2005-05-13 Raja R Harinath <rharinath@novell.com>
4370 * statement.cs (Block.Resolve): Revert change below. Modify fix
4371 for #74041 to initialize 'resolved' to false only for explicit
4372 blocks. Fixes #74873.
4374 2005-05-12 Raja R Harinath <harinath@gmail.com>
4377 * typemanager.cs (unmanaged_enclosing_types): New.
4378 (IsUnmanagedType): Avoid infloops by using
4379 'unmanaged_enclosing_types' to talk with recursive invocations.
4381 2005-05-13 Martin Baulig <martin@ximian.com>
4383 * statement.cs (Block.Resolve): Make the `bool unresolved' flag an
4384 instance variable, not a local. Fix #74873.
4385 (Block.ResolveUnreachable): Set it to true here.
4387 2005-05-11 Duncan Mak <duncan@novell.com>
4389 * cs-tokenizer.cs (get_cmd_arg): Check that 'c' is not -1 before
4390 continuing to process for 'arg'.
4391 (handle_preprocessing_directive): Check the argument of the #endif
4392 directive and report error CS1025 if there are any trailing
4395 According to the C# spec, having even whitespace after the #endif
4396 directive is illegal; however, because we call arg.TrimEnd ()
4397 beforehand, we have the same behavior as csc, allowing whitespace
4398 after the directive.
4402 2005-05-11 Marek Safar <marek.safar@seznam.cz>
4406 * class.cs (ConstructorInitializer.GetOverloadedConstructor): Removed.
4407 (Constructor.GetObsoleteAttribute): Implemented correctly.
4409 2005-05-10 Martin Baulig <martin@ximian.com>
4411 * support.cs (ReflectionParameters.ParameterModifier): Use
4412 `Parameter.Modifier.REF' if we both have `ParameterAttributes.Out'
4413 and `ParameterAttributes.In'. Fixes #74884.
4415 2005-05-10 Marek Safar <marek.safar@seznam.cz>
4417 * class.cs (Method.Define): Catch attempt for Finalizer declaration.
4419 * expression.cs (Argument.GetParameterModifier): Turned to property.
4420 (Invocation.Error_InvalidArguments): Add more descriptive errors.
4422 * parameter.cs (Parameter.GetModifierSignature): Translates modifier to
4425 2005-05-09 Raja R Harinath <rharinath@novell.com>
4428 * decl.cs (MemberCache.AddMethods): Register override methods,
4429 rather than non-override methods.
4430 * typemanager.cs (RegisterOverride): New.
4431 (IsOverride): Update.
4433 2005-05-09 Marek Safar <marek.safar@seznam.cz>
4437 * ecore.cs (SimpleName.SimpleNameResolve): Add in_transit to catch
4438 recursive declaration.
4440 * statement.cs (Block.ResolveMeta): Report any error in resolving.
4442 2005-05-06 Marek Safar <marek.safar@seznam.cz>
4444 * cfold (DoConstantNumericPromotions): Don't try to convert 0 enum.
4446 * expression.cs (Binary.DoResolve): (x && 0) is always 0.
4448 2005-05-05 Raja R Harinath <rharinath@novell.com>
4451 * decl.cs (DeclSpace.FamilyAccessible):
4452 Use TypeManager.IsNestedFamilyAccessible.
4454 Fix reopened #64812.
4455 * typemanager.cs (Closure.Filter): Introduce checks for 'protected
4458 2005-05-04 Raja R Harinath <rharinath@novell.com>
4459 Abin Thomas <projectmonokochi@rediffmail.com>
4460 Anoob V E <projectmonokochi@rediffmail.com>
4461 Harilal P R <projectmonokochi@rediffmail.com>
4464 * typemanager.cs (Closure.CheckValidFamilyAccess): Don't blindly
4465 allow access to all static members.
4467 2005-05-04 Martin Baulig <martin@ximian.com>
4469 * ecore.cs (FieldExpr.DoResolveLValue): Always call fb.SetAssigned().
4471 2005-05-04 Martin Baulig <martin@ximian.com>
4475 * statement.cs (Switch.SimpleSwitchEmit): Always emit the default
4476 section at the end; make things work if `default' is not the last
4479 2005-05-04 Martin Baulig <martin@ximian.com>
4483 * statement.cs (Switch): Replaced the `got_default' field with a
4484 `default_section' one.
4485 (Switch.CheckSwitch): Set `default_section' here.
4486 (Switch.Resolve): If we're a constant switch and the constant is
4487 not found, use the default section.
4489 2005-05-03 Martin Baulig <martin@ximian.com>
4491 * expression.cs (ArrayAccess.EmitGetLength): New public method.
4493 * statement.cs (Foreach.ArrayForeach): New nested class.
4494 (Foreach.TemporaryVariable): New nested class.
4495 (Foreach.EmitArrayForeach): Removed; this is now in the new
4498 2005-05-03 Raja R Harinath <rharinath@novell.com>
4500 * pending.cs (BaseImplements): Move the #74773 fix here. This is
4502 (VerifyPendingMethods): Revert change below.
4504 * typemanager.cs (IsOverride, RegisterNonOverride): New.
4505 * decl.cs (MemberCache.AddMethod): Register "non-override" methods
4506 that used to trigger warning -28. Remove warning -28.
4507 * expression.cs (Invocation.OverloadResolve): Use
4508 TypeManager.IsOverride to distinguish override methods.
4511 * pending.cs (VerifyPendingMethods): If a base type implements the
4512 requested interface, don't bother checking individual methods of
4513 the base type. As a side-effect, this prevents the creation of
4514 unnecessary proxies.
4516 2005-05-02 Martin Baulig <martin@ximian.com>
4520 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
4521 Also `And' the locals if the old vector is null.
4522 (FlowBranching.UsageVector.BitVector.And): Allow `vector' being
4523 null; in this case we basically reset all the variables.
4525 2005-05-02 Martin Baulig <martin@ximian.com>
4529 * flowanalysis.cs (FlowBranching.UsageVector.MergeBreakOrigins):
4530 Added `FlowBranching branching' argument; always `and' the
4531 variables instead of `or'ing them unless we're an infinite loop.
4533 * statement.cs (While.Resolve): Create a new sibling unless we're
4536 2005-05-02 Martin Baulig <martin@ximian.com>
4540 * class.cs (ConstructorInitializer.Resolve): Added `Block block'
4541 arguments; use it instead of creating a new TopLevelBlock.
4542 (Constructor.Emit): Call `block.ResolveMeta ()' before resolving
4543 our ConstructorInitializer.
4546 (TopLevelBlock.TopLevelBranching): New public property.
4547 (TopLevelBlock.ResolveMeta): New public method; call ResolveMeta()
4548 and create our `TopLevelBranching'.
4550 * codegen.cs (EmitContext.ResolveTopBlock): If we're not an
4551 anonymous method host, use `block.TopLevelBranching' rather than
4552 creating a new branching.
4554 2005-04-20 Miguel de Icaza <miguel@novell.com>
4556 * anonymous.cs (ScopeInfo.AddChild): when adding a new child to
4557 a ScopeInfo, if any of the current children is a child of the new
4558 entry, move those children there.
4560 2005-04-30 Martin Baulig <martin@ximian.com>
4562 * statement.cs (Switch.SimpleSwitchEmit): Reset `default_at_end'
4563 at the beginning of a SwitchSection. Fix #73335.
4565 2005-04-27 Marek Safar <marek.safar@seznam.cz>
4568 * class.cs (EmitFieldInitializers): Use FieldExpr in initializer.
4570 * ecore.cs (FieldExpr): Add a new ctor with in_initializer.
4571 (FieldExpr.DoResolve): Obsolete members are ignored for field
4574 2005-04-26 Marek Safar <marek.safar@seznam.cz>
4576 * attribute.cs (AreOverloadedMethodParamsClsCompliant): Add array
4577 of arrays detection.
4579 * class.cs (Interface.VerifyClsCompliance): Add base interfaces
4581 (Field.VerifyClsCompliance): Volatile fields are not compliant.
4583 * decl.cs (MemberCache.VerifyClsParameterConflict): Add array of
4586 2005-04-25 Ben Maurer <bmaurer@ximian.com>
4588 * cs-parser.jay: Use the prefered version of -unsafe in error
4591 2005-04-22 Marek Safar <marek.safar@seznam.cz>
4593 * driver.cs (CompilerCallableEntryPoint.Invoke): Reset under any
4596 2005-04-20 John Luke <john.luke@gmail.com>
4598 * driver.cs: fix typo in error message, --outout to --output
4600 2005-04-20 Marek Safar <marek.safar@seznam.cz>
4602 * codegen.cs (InRefOutArgumentResolving): New field.
4604 * ecore.cs (FieldExpr.DoResolve): Check for assigning to readonly
4605 fields outside contructor.
4607 * expression.cs (Argument.Resolve): Set InRefOutArgumentResolving.
4609 2005-04-19 Miguel de Icaza <miguel@novell.com>
4611 * anonymous.cs (CaptureContext.EmitParameterInstance): The
4612 parameter code was not completed ever, so it was not as up-to-date
4613 as local variables. Must finish it.
4615 The bug fix was to compare the Toplevel of the block, not the
4616 current block. Thanks for Ben for pointing this out.
4618 2005-04-19 Raja R Harinath <rharinath@novell.com>
4620 * decl.cs (AddMethods): Use the declaring type of the problem
4621 method to determine if we want to squash a warning.
4623 2005-04-19 Marek Safar <marek.safar@seznam.cz>
4625 * attribute.cs: Removed debug output.
4627 * decl.cs (MemberCache.AddMethods): Fixed Finalize ignoring.
4629 * driver.cs (Driver.parse): Synchronize parser ErrorOutput with
4632 2005-04-18 Raja R Harinath <rharinath@novell.com>
4635 * expression.cs (Binary.EqualsNullIsReferenceEquals): New.
4636 (Binary.DoResolveOperator): Use it to avoid blindly optimizing out
4637 all null comparisons against reference types.
4639 2005-04-18 Marek Safar <marek.safar@seznam.cz>
4642 * class.cs (TypeContainer.CircularDepException) New nested
4644 (GetPartialBases, GetNormalBases, GetClassBases): Removed error.
4645 (TypeContainer.DefineType): Removed error, reset InTransit before
4647 (Class.DefineType): Throw exception when is in Transit.
4648 Catch exception and report error.
4649 (Struct.DefineType): Throw exception when is in Transit.
4650 Catch exception and report error.
4651 (Interface.DefineType): Throw exception when is in Transit.
4652 Catch exception and report error.
4654 * codegen.cs: Add InCatch,InFinally to EmitContext to easily
4655 handle nested exception handlers.
4657 * flowanalysis.cs (InTryWithCatch): New method, search for try with
4660 * iterators.cs (Yield.CheckContext): Add CS1626 report. Updated
4661 InFinally and InCatch storage.
4663 * statement.cs (Throw.Resolve): Use InCatch, InFinally from ec.
4664 (Catch.Resolve): Set and Restore ec.InCatch.
4665 (Try.Resolve): Set and Restore ec.InFinally.
4666 (Try.HasCatch): True when try has catch.
4668 2005-04-17 Atsushi Enomoto <atsushi@ximian.com>
4670 * doc.cs : In some cases FilterName returns MonoEvent and MonoField
4671 for the same event member, so exclude such cases from warning 419.
4674 2005-04-16 Miguel de Icaza <miguel@novell.com>
4676 * expression.cs (Binary.ResolveOperator): Apply patch from John
4677 Luke to fix bug 59864: operators &, | and ^ on enumerations
4678 require that the same enum type on both sides.
4680 * driver.cs: Add warnings to old flag usage, this is to assist
4681 people who produce Makefiles and hope that the Makefiles will be
4684 * class.cs (TypeContainer.EmitType): Moved the definition of the
4685 special $PRIVATE$ field from the resolve phase to the Emit phase.
4686 During resolve we do not know if we are a struct with
4687 HasExplicitLayout, we know this only after the attributes for the
4690 Set the FieldOffset to zero on the dummy field that we create for
4691 the class. Fixes 74590.
4693 2005-04-16 Raja R Harinath <rharinath@novell.com>
4696 * ecore.cs (PropertyExpr.resolved): New.
4697 (DoResolve): Use it to handle a case of double resolution here.
4698 Handle a case of identical-name-and-type-name.
4699 * expression.cs (ArrayCreation.CheckIndices): Avoid double
4700 resolution by storing the results of expression resolution back
4701 into the "probes" array.
4703 2005-04-15 Raja R Harinath <rharinath@novell.com>
4705 Fix cs0208-7.cs and cs0208-8.cs.
4706 * typemanager.cs (IsUnmanagedType): Arrays are not allowed
4707 (cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve
4708 error reporting to point out the reason a struct is not unmanaged.
4710 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
4712 * doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and
4713 just use TypeExpr.Type. This fixes bug #74595 when merged to gmcs.
4715 2005-04-13 Raja R Harinath <rharinath@novell.com>
4718 * ecore.cs (PropertyExpr.InstanceResolve): Handle a case of
4719 IdenticalNameAndTypeName here.
4720 (EventExpr.InstanceResolve): Likewise.
4722 2005-04-13 Marek Safar <marek.safar@seznam.cz>
4724 C# 2.0 DefaultCharSetAttribute implementation
4726 * attribute.cs (Attribute.ResolveAsTypeStep): New protected method
4727 which allows us to set GlobalNamespace for every resolve.
4728 (Attribute.ResolveArguments): Cut from Resolve.
4729 (Attribute.GetCharSetValue): Returns CharSet named argument.
4730 (Attribute.DefinePInvokeMethod): Gets default charset from
4732 (GlobalAttribute.ResolveAsTypeStep): Override.
4733 (GlobalAttribute.ResolveArguments): Override.
4735 * class.cs (TypeAttr): Is protected.
4737 * codegen.cs (ModuleClass.DefaultCharSet): New member.
4738 (ModuleClass.DefaultCharSetType): New memeber.
4739 (ModuleClass.ResolveAttributes): Resolves DefaultCharSetAttribute.
4741 * decl.cs (Decl.TypeAttr): New protected virtual. Returns default
4742 charset from module.
4744 * delegate.cs (TypeAttr): Override.
4745 (Delegate.DefineType): Use this TypeAttr.
4747 * driver.cs (Driver.MainDriver): Call Module.ResolveAttributes
4748 at very early stage (before types are defined) to resolve model
4749 module attributes. It will probably not work with corlib but it
4752 * enum.cs (Enum.TypeAttr): New protected virtual. Returns default
4753 charset from module.
4755 * typemanager.cs (default_charset_type): New type.
4757 2005-04-13 Raja R Harinath <rharinath@novell.com>
4759 * decl.cs (MemberCache.AddMethods): Don't warn if
4760 System.Object.Finalize has buggy MethodAttributes.
4762 * typemanager.cs (IsUnmanagedType): Restore !IsValueType check
4765 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
4767 * doc.cs : detect ambiguous reference to overloaded members.
4768 Fixed bug #71603. MS 1.1 csc does not detect it.
4770 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
4772 * doc.cs : delegates must not be referenced with parameters.
4775 2005-04-12 Miguel de Icaza <miguel@novell.com>
4777 * typemanager.cs (IsUnmanagedType): Arrays are allowed.
4779 2005-04-10 Miguel de Icaza <miguel@novell.com>
4781 * driver.cs (MainDriver): Stop processing if the CLS stage found
4784 (CompilerCallableEntryPoint.InvokeCompiler): Always
4785 reset after execution; Take a TextWriter argument for the
4788 * report.cs: Use the error stream instead of hardcoding stderr.
4790 2005-04-09 Miguel de Icaza <miguel@novell.com>
4792 * class.cs: Reduce code paths to test, too small of an
4793 optimization to make it worth the extra testing. Always perform
4796 2005-04-08 Raja R Harinath <rharinath@novell.com>
4799 * class.cs (OperatorArrayList.CheckPairedOperators): Skip
4800 operators that had errors reported on them.
4802 2005-04-08 Marek Safar <marek.safar@seznam.cz>
4804 * attribute.cs (Attribute.IsValidArgumentType): Test valid named
4806 (Attribute.Resolve): Add named argument type checking.
4808 * class.cs (FixedField.Define): Use IsPrimitiveType
4810 * expression.cs (Binary.ResolveOperator): Reflect IsCLRType renaming.
4812 * iterators.cs (Iterator.DefineIterator): Add check for arglist and
4813 unsafe parameter types.
4815 * statement.cs (Using.ResolveExpression): Add better error description.
4817 * typemanager.cs (IsCLRType): Renamed to IsPrimitiveType.
4819 2005-04-08 Raja R Harinath <rharinath@novell.com>
4822 * attribute.cs (Attribute.GetAttributeUsage): Resolve
4823 AttributeUsageAttribute in the emitcontext of the attribute class,
4824 not in the emitcontext of the attributable entity it was attached to.
4825 * cs-parser.jay: Use 'current_class', not 'current_container',
4826 when creating a GlobalAttribute.
4828 2005-04-08 Alp Toker <alp@atoker.com>
4830 * pending.cs: The fix to #58413 failed to compile methods implementing
4831 interfaces with/without params modifiers and vice versa, even though
4832 params modifiers aren't part of the signature. Make the modifier check
4833 less strict as in csc.
4835 2005-04-07 Abin Thomas <projectmonokochi@rediffmail.com>
4836 Anoob V E <projectmonokochi@rediffmail.com>
4837 Harilal P R <projectmonokochi@rediffmail.com>
4840 * pending.cs (TypeAndMethods.mods): New. Store the parameter
4841 modifiers of pending methods.
4842 (PendingImplementation.PendingImplementation): Initialize it.
4843 Add Parameter.Modifier [][] mods and initialize it with ParameterData.
4844 (PendingImplementation.InterFaceMethod): Repalce Type[] argument
4845 with ParameterData. Add check for modifiers.
4846 * class.cs (MethodData.Define): Update to changes.
4848 2005-04-07 Raja R Harinath <rharinath@novell.com>
4850 * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat.
4852 2005-04-07 Marek Safar <marek.safar@seznam.cz>
4854 * class.cs (PropertyMethod.Define): Check private accessor in abstract
4857 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't allow RequiredAttribute
4860 * typemanager.cs: Registered RequiredAttributeAttribute.
4862 2005-04-06 Marek Safar <marek.safar@seznam.cz>
4864 * class.cs (VerifyMembers): Doesn't need EmitContext argument.
4865 Warning CS0169 is back at level 3.
4866 (IMethodData.SetMemberIsUsed): New method.
4868 * decl.cs (IsUsed): New value; moved from FieldBase.Status
4869 (SetMemberIsUsed, IsUsed): New methods, encapsulate IsUsed.
4871 * delegate.cs (ResolveMethodGroupExpr): Call SetMemberIsUsed.
4873 * ecore.cs (FieldExpr.ResolveMemberAccess): Call SetMemberIsUsed for
4875 (PropertyExpr.ResolveAccessors): Call SetMemberIsUsed when delegate
4878 * expression.cs (OverloadResolve): Call SetMemberIsUsed. when method
4881 * rootcontext.cs (RootContext.EmitCode): Call VerifyMembers in extra run
4882 to avoid the problems with nested types.
4884 2005-04-05 Abin Thomas <projectmonokochi@rediffmail.com>
4885 Anoob V.E <projectmonokochi@rediffmail.com>
4886 Harilal P.R <projectmonokochi@rediffmail.com>
4887 Raja R Harinath <rharinath@novell.com>
4890 * delegate.cs (Define): Emit ParamArrayAttribute for 'params'
4892 * typemanager (GetConstructor): Make public.
4894 2005-04-05 John Luke <john.luke@gmail.com>
4895 Raja R Harinath <rharinath@novell.com>
4898 * typemanager.cs (IsUnmanagedType): Check non-public fields of a
4899 struct too. Return false quicker in a few cases.
4900 (VerifyUnManaged): Use it.
4902 2005-04-05 Raja R Harinath <rharinath@novell.com>
4905 * statement.cs (Block.Resolve): Initialize 'unreachable' to false,
4906 not 'unreachable_seen'.
4908 2005-04-04 Marek Safar <marek.safar@seznam.cz>
4910 * attribute.cs (Attribute.GetValue): Removed unused.
4912 * codegen.cs (CodeGen.TrimExt): Removed unused.
4914 * cs-parser.jay (output): Removed unused.
4916 * cs-tokenizer.cs (hex_digits): Removed unused.
4918 * enum.cs (MapToInternalType, GetEnumeratorName): Removed unused.
4920 * expression.cs (Indirection.LoadExprValue): Removed unused.
4921 (ArrayCreation.ExpressionToArrayArgument): Removed unused.
4923 * iterators.cs (Iterator.param_types): Removed unused.
4925 * statement.cs (Goto.block): Removed unused.
4926 (ToplevelBlock.did): Removed unused.
4927 (Switch.ResolveConstantSwitch): Removed unused.
4929 2005-04-01 Ben Maurer <bmaurer@ximian.com>
4931 * rootcontext.cs: Allow mcs to bootstrap with the compilation
4934 2005-04-01 Raja R Harinath <rharinath@novell.com>
4936 Fix #74232 and cs0208-3.cs.
4937 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0208 check.
4938 * typemanager.cs (IsUnmanagedType): Don't allow 'object' as an
4939 unmanaged type. Don't use FieldBuilders when 't' is a
4940 TypeBuilder. Use ModFlags and MemberType fields.
4941 * class.cs (MemberBase.member_type): Rename from MemberType.
4942 (MemberBase.MemberType): New property. Determines member_type on
4944 (MemberBase.DoDefine): Don't initialize MemberType here.
4945 (FieldMember.Define): Likewise.
4947 2005-04-01 Marek Safar <marek.safar@seznam.cz>
4950 * class.cs (Event.Emit): Call Add/Remove emit even for interfaces.
4951 Attributes are emitted there.
4953 2005-04-01 Raja R Harinath <rharinath@novell.com>
4955 * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
4956 keyword in 'partial enum' too.
4957 * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
4959 Report from Kamil Skalski <nazgul@omega.pl>.
4962 * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
4963 have partial containers too.
4965 * ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning
4966 in block' checks to Block.CheckInvariantMeaningInBlock.
4967 * statement.cs (Block.GetKnownVariableInfo): Make private.
4968 (Block.IsVariableUsedInChildBlock): Remove.
4969 (Block.IsVariableUsedInBlock): Likewise.
4970 (Block.CheckInvariantMeaningInBlock): New. Show location of
4971 conflicting declaration.
4972 (Block.AddVariable): Make error messages less long-winded and more
4973 specific. Show location of conflicting declaration.
4974 * parameter.cs (Parameters.Location): New readonly property.
4976 2005-03-31 Raja R Harinath <rharinath@novell.com>
4978 Clean up semantics of invoking ResolveMemberAccess.
4979 * ecore.cs (SimpleName.DoSimpleNameResolve): If a MemberExpression
4980 can have an instance, ensure that we pass in a non-TypeExpression
4981 to ResolveMemberAccess. Tighten up IdenticalNameAndTypeName checks.
4982 (MemberExpr.DoSimpleNameResolve): Remove type_is_inferred
4983 argument. Update to changes and simplify.
4984 (FieldExpr.Emitinstance): Remove CS0120 check.
4985 (PropertyExpr.EmitInstance): Likewise.
4986 * expression.cs (Argument.Resolve): Likewise.
4987 (Invocation.DoResolve): Update to changes in semantics of
4990 2005-03-31 Marek Safar <marek.safar@seznam.cz>
4993 * class.cs (AbstractPropertyEventMethod.EmitMethod): Enable emit method
4996 * decl.cs (MemberCache.AddMethods): Fix infinite loop.
4998 2005-03-31 Raja R Harinath <rharinath@novell.com>
5000 Fix difference in behaviour with commandline invocation.
5001 * driver.cs (Driver.Reset): New.
5002 (CompilerCallableEntryPoint): Call it.
5004 * statement.cs (If.Resolve): Avoid spurious "uninitialized
5005 variable" warnings if the boolean expression failed to resolve.
5007 2005-03-30 Sebastien Pouliot <sebastien@ximian.com>
5009 * attribute.cs: Fix the union of several permissions when some of them
5010 are unrestricted (so the result isn't an unrestricted permission set).
5013 2005-03-30 Raja R Harinath <rharinath@novell.com>
5015 * ecore.cs (MemberExpr): New class. Convert from interface
5017 (MemberExpr.ResolveMemberAccess): Refactor and move here from
5018 MemberAccess.ResolveMemberAccess. Tighten up pre-conditions and
5020 (MethodGroupExpr, FieldExpr, PropertyExpr, EventExpr): Update.
5021 (MethodGroupExpr.IsExplicitImpl): Remove.
5022 (Expression.GetFieldFromEvent): Remove.
5023 (SimpleName.MemberStaticCheck): Remove.
5024 (SimpleName.DoSimpleNameResolve): Update to changes.
5025 * expression.cs (MemberAccess.ResolveMemberAccess): Refactor.
5026 (MemberAccess.IdenticalNameAndTypeName): Remove.
5027 (MemberAccess.error176): Move to MemberExpr.
5028 (MemberAccess.DoResolve): Update to changes.
5029 (BaseAccess.DoResolve): Likewise.
5031 2005-03-30 Marek Safar <marek.safar@seznam.cz>
5033 C# 2.0 Conditional attribute class implementation
5035 * attribute.cs (AttributeTester.IsAttributeExcluded): New method.
5036 Analyzes class whether it has attribute which has ConditionalAttribute
5037 and its condition is not defined.
5039 * class.cs (Class.ApplyAttributeBuilder): Add IsAttributeExcluded check.
5040 (Class.IsExcluded): New method. Search for at least one defined
5041 condition in ConditionalAttribute of attribute class.
5043 2005-03-30 Raja R Harinath <rharinath@novell.com>
5045 * ecore.cs (PropertyExpr): Derive from Expression, not
5046 ExpressionStatement.
5047 (PropertyExpr.EmitStatement): Remove.
5049 2005-03-29 Raja R Harinath <rharinath@novell.com>
5052 * expression.cs (MemberAccess.ResolveMemberAccess): Allow the
5053 internal field "value__" of an enum be private. The examples for
5054 "value__" that I found on MSDN all used FieldAttributes.Private.
5056 * decl.cs (MemberCache.AddMethods): Use C# terminology in warning.
5057 Don't mention IL method attribute names.
5059 Fix #47991. Remove a TODO.
5060 * statement.cs (Block.Toplevel): Make into a field.
5061 (Block.Parameters): Move into ToplevelBlock.
5062 (Block.known_variables): Rename from child_variable_names.
5063 (Block.Block): Remove variants that take Parameters. Initialize
5064 'Toplevel' with the immediately surrounding toplevel block.
5065 (Block.AddKnownVariable): Rename from AddChildVariableName. Add a
5066 LocalInfo parameter.
5067 (Block.GetKnownVariableInfo): New.
5068 (Block.IsVariableNameUsedInChildBlock): Update.
5069 (Block.IsVariableNameUsedInBlock): New. Checks if a name is used in
5070 the block, even though it may not be in scope.
5071 (Block.AddVariable): Remove Parameters parameter. Use
5072 Toplevel.Parameters instead.
5073 (Block.AddConstant): Remove Parameters parameter.
5074 (Block.GetParameterReference): Update to use Toplevel.Parameters.
5075 (Block.IsParamaterReference): Likewise.
5076 (Block.IsLocalParameter): Likewise. Simplify a lot.
5077 (ToplevelBlock.Parameters): New. Moved from Block.
5078 (ToplevelBlock.ToplevelBlock): Update to changes. Always
5079 initialize Parameters to a non-null value.
5080 * cs-parser.jay: Update to changes.
5081 * ecore.cs (SimpleName.SimpleNameResolve): Emit cs0136 error for
5082 simple names that mean different things in the same block. Use
5083 Block.IsVariableNameUsedInBlock.
5085 2005-03-28 Raja R Harinath <rharinath@novell.com>
5087 * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer.
5088 (TypeHandle.TypeHandle): Use LookupMemberCache rather than
5089 GetTypeHandle. It is possible for a reflected type to derive from
5090 a TypeBuilder (e.g., int[] derives from the TypeBuilder
5091 System.Array during mscorlib compilation).
5092 * decl.cs (MemberCache.MemberCache): If the base cache doesn't
5093 contain a method_hash, don't create one either. Don't create a
5094 deep copy of the base cache's method_hash.
5095 (MemberCache.SetupCache): Rename back from DeepCopy.
5096 (MemberCache.AddMethods): Rewrite, now that method_hash isn't
5097 already initialized. If we see an override function, add its
5098 underlying base virtual function to the member_hash too.
5100 * enum.cs (Enum.LookupEnumValue): Remove debugging code.
5102 2005-03-26 Raja R Harinath <harinath@acm.org>
5105 * assign.cs (Assign.DoResolve): When the RHS of an assignment
5106 fails to resolve, ensure that the LHS is still resolved as an
5109 2005-03-25 Raja R Harinath <harinath@acm.org>
5111 * enum.cs (Enum.DefineType): Set ec.InEnumContext and
5113 (Enum.current_ec): Remove.
5114 (Enum.LookupEnumValue): Remove EmitContext argument.
5115 Just uses the one created during DefineType.
5116 (Enum.FindMembers): Update.
5117 * expression.cs (MemberAccess.DoResolve): Update.
5119 2005-03-22 Marek Safar <marek.safar@seznam.cz>
5121 * assign.cs (Assign.DoResolve): Check for CS1717 when
5122 source and target are same (uses Equals).
5124 * expression.cs (LocalVariableReference, ParameterReference,
5125 This): Implemented Equals, GetHashCode.
5127 * statement.cs (Block.GetParameterReference): Removed useless
5130 2005-03-22 Raja R Harinath <rharinath@novell.com>
5133 * statement.cs (Block.AddVariable): Ensure that we skip implicit
5134 blocks before deciding whether the error is cs0136 or cs0128.
5136 * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
5137 (using_alias_directive, using_namespace_directive): Pass
5138 MemberName, not an expression to Namespace.UsingAlias and
5140 (MakeName): Use the MemberName of the namespace.
5141 * namespace.cs (Namespace.MemberName): New.
5142 (UsingEntry.UsingEntry): Take a MemberName, not an expression.
5143 (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
5145 * decl.cs (MemberName.Name): Make readonly.
5146 (MemberName.FromDotted): New "constructor".
5147 (MemberName.Equals, MemberName.GetHashCode): Implement overrides.
5148 (MemberCore.Name): Compute from MemberName on demand.
5149 (MemberCore.SetMemberName): Provide a way to change the
5151 (MemberCore.AddToContainer): Don't take a fullname parameter.
5152 * class.cs (TypeContainer.AddToMemberContainer): Don't add the
5153 fully qualified name of the container to the member name.
5154 (TypeContainer.AddToTypeContainer): Use a fully qualified name
5155 only if the type is a member of the root container.
5156 (TypeContainer.AddMethod, TypeContainer.AddProperty): Use
5157 MemberName.Left rather than searching for an embedded ".".
5158 (PartialContainer.CreatePart): Update to changes in RootContext.
5159 (MemberBase.ShortName): Turn into a property. Use
5160 MemberCore.SetMemberName.
5161 (MemberBase.ExplicitInterfaceName): Remove.
5162 (MemberBase.UpdateMemberName): Remove.
5163 (AbstractPropertyEventMethod.UpdateName): Use SetMemberName.
5164 (PropertyBase.SetMemberName): New override.
5165 * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key.
5166 (Tree.GetDecl): New.
5167 (Tree.AllDecls): Rename from Decls.
5168 * attribute.cs, enum.cs, report.cs: Update to changes.
5169 * driver.cs (MainDriver): Use MemberName.FromDotted on
5170 RootContext.MainClass.
5172 2005-03-21 Marek Safar <marek.safar@seznam.cz>
5174 * class.cs (FixedField.Define): Check for CS1664 and more sanity
5177 * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708.
5179 2005-03-18 Marek Safar <marek.safar@seznam.cz>
5181 * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
5182 property accessor modifiers.
5184 * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
5185 fixed buffer attribute (CS1716).
5186 (PropertyMethod.HasCustomAccessModifier): When property accessor
5187 has custom modifier.
5189 * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
5191 (PropertyExpr.DoResolveLValue): Add CS0272.
5193 2005-03-17 Miguel de Icaza <miguel@novell.com>
5195 * convert.cs: When converting to a pointer, use the proper Conv.U
5196 or Conv.I depending on the source data type.
5198 * cs-tokenizer.cs: Make the size for large decimal constants,
5201 2005-03-17 Martin Baulig <martin@ximian.com>
5203 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
5204 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
5206 2005-03-17 Martin Baulig <martin@ximian.com>
5208 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
5209 to bool so we can return an error condition.
5210 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
5213 2005-03-16 Zoltan Varga <vargaz@freemail.hu>
5215 * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping
5218 2005-03-16 Raja R Harinath <rharinath@novell.com>
5220 Remove TypeManager.LookupType and TypeManager.LookupTypeDirect.
5221 Refactor to avoid traversing the list of assemblies, and to avoid
5222 string concatenation.
5223 * typemanager.cs (guid_attr_type): Remove.
5224 (negative_hits, pointers, references): Remove hashes.
5226 (GetConstructedType): New. Uses type_hash to handle constructed
5227 types (arrays, references, pointers).
5228 (GetReferenceType, GetPointerType): Use it.
5229 (GetNestedType): New. Uses type_hash to handle nested types of
5231 (LookupType, LookupTypeDirect): Remove.
5232 (CoreLookupType): Inline parts of old LookupTypeDirect code. Use
5233 'types' hash and LookupTypeReflection directly.
5234 (params_string, params_object): Use GetConstructedType.
5235 * namespace.cs (Namespace.cached_types): New. Cache of reflected
5237 (Namespace.Lookup): Use cached_types.
5238 (NamespaceEntry.LookupNamespaceOrType): Inline the functionality
5239 provided by old TypeManager.LookupType.
5240 * rootcontext.cs (MakeFQN): Remove.
5241 * decl.cs (DeclSpace.MakeFQN): Likewise.
5242 (DeclSpace.LookupType): Use TypeManager.GetNestedType.
5243 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
5244 TypeManager.GetConstructedType.
5245 * tree.cs (decl_ns_hash, LookupByNamespace): Remove.
5247 2005-03-15 Marek Safar <marek.safar@seznam.cz>
5249 * class.cs (MethodCore.CheckBase): Report CS1715 for properties and
5252 * cs-parser.jay: Reports CS1527 for any namespace element.
5254 * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
5257 * expression.cs (ParameterReference.IsAssigned): Changed error to
5259 (Error_WrongNumArguments): Moved CS0245 detection here.
5261 * statement.cs (Return.Resolve): Add CS1622 report.
5263 2005-03-11 Marek Safar <marek.safar@seznam.cz>
5265 * class.cs (StaticClass.DefineContainerMembers): Added CS0720.
5267 2005-03-11 Zoltan Varga <vargaz@freemail.hu>
5269 * attribute.cs expression.cs: Get rid of some allocations.
5271 2004-03-11 Atsushi Enomoto <atsushi@ximian.com>
5273 * doc.cs : just eliminate the latest change.
5275 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
5277 * doc.cs : commented out the latest change. It breaks xml-030.cs
5279 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
5281 * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will
5282 fail. So invoke CreateType() in FindDocumentedType().
5284 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
5286 * cs-tokenizer.cs : added IsKeyword().
5287 * doc.cs : Detect keyword incorrectly used as identifier.
5288 Allow identifiers prefixed by @.
5290 2005-03-10 Marek Safar <marek.safar@seznam.cz>
5292 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
5293 It caused exception in namespace resolving (again!).
5295 * class.cs (Class.ctor): Removed exit.
5296 (PropertyMethod.ctor): ditto.
5298 * codegen.cs (Codegen.Reset): Reset static data.
5299 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
5301 * cs-tokenizer.cs (Cleanup): Removed.
5303 * driver.cs (GetSystemDir): Rewrote to one line command.
5304 It caused problem with unloaded dynamic modules.
5305 (UnixParseOption): Removed Exit.
5306 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
5307 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
5308 Now can be mcs used as library.
5310 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
5313 * location.cs (Reset): Reset static data.
5315 * namespace.cs (Reset): Reset static data.
5317 * report.cs (Report.Reset): Reset static data.
5319 * rootcontext.cs (RootContext.Reset): Reset static data.
5321 * tree.cs (RootTypes.ctor): Use Location.Null
5323 * typemanager.cs (TypeManager.Reset): Reset static data.
5324 (CoreLookupType): Removed Exit.
5325 (TypeHandle.Reset): Reset static data.
5327 2005-03-10 Raja R Harinath <rharinath@novell.com>
5330 * typemanager.cs (ComputeNamespaces): Import namespaces from
5331 referenced modules too.
5333 2005-03-09 Raja R Harinath <rharinath@novell.com>
5335 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
5338 2005-03-09 Raja R Harinath <rharinath@novell.com>
5340 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
5341 enclosing DeclSpace. This ensures that a name-lookup populates
5342 more caches and there are fewer 'TypeExpression's. Carve out
5343 nested type lookup into ...
5344 (LookupNestedTypeInHierarchy): ... this.
5346 2005-03-09 Raja R Harinath <rharinath@novell.com>
5348 Clean up a few partial-class semantics.
5349 Fixes test-357.cs and cs1618-2.cs.
5350 * cs-parser.jay (struct_declaration): Use 'current_class' as
5351 parent of newly-created struct. Remove call to Register ().
5352 Use 'pop_current_class' to complete handing the current struct.
5353 (interface_declaration): Likewise.
5354 (class_declaration): Likewise.
5355 (enum_declaration): Use 'current_class' as parent of newly created
5357 (delegate_declaration): Likewise.
5358 (pop_current_class): New function. This is used to handle closing
5359 up the 'current_class' and 'current_container', and pointing them
5360 to the enclosing class/container.
5361 (CSharpParser): Initialize 'current_class' too.
5362 * decl.cs (MemberCore): Add check for invariant: a partial
5363 container is not a parsed entity, and thus does not enclose any
5365 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
5366 (DeclSpace.BaseTypeExpr): Use it.
5367 (DeclSpace.LookupType): Add check for invariant.
5368 * class.cs (TypeContainer): Add check for invariant: a nested
5369 class should have the same NamespaceEntry as its enclosing class.
5370 (TypeContainer.EmitFieldInitializers): Make virtual.
5371 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
5373 (TypeContainer.Register): Remove.
5374 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
5375 null. Use TypeResolveEmitContext for resolving base types and
5376 interfaces. Move initialization of Parts.TypeBuilder here from
5378 (TypeContainer.DefineNestedTypes): ... here.
5379 (PartialContainer): Take a Namespace not a NamespaceEntry.
5380 (PartialContainer.Create): Don't use Register. Call the
5381 appropriate Add... function directly.
5382 (ClassPart): Take both the PartialContainer and the enclosing
5383 class as constructor arguments.
5384 (ClassPart.EmitFieldInitializers): Override.
5385 (ClassPart.PartFindNestedTypes): Remove.
5386 (FieldBase.GetInitializerExpression): Resolve the initializer
5387 expression in the emit context of the enclosing class.
5388 * tree.cs (RootTypes): Remove Register ().
5390 2005-03-08 Marek Safar <marek.safar@seznam.cz>
5392 * cs-parser.jay: Removed CS0134.
5394 * driver.cs: Removed CS1901.
5396 * expression.cs (SizeOf.DoResolve): Don't report CS0233
5397 for predefined types.
5399 2005-03-07 Duncan Mak <duncan@novell.com>
5401 * codegen.cs (Save): Catch UnauthorizedAccessException as
5402 well. Fixes bug #73454.
5404 2005-03-07 Marek Safar <marek.safar@seznam.cz>
5406 * cs-tokenizer.cs (xtoken): Add CS1035.
5408 * class.cs (MethodData.Define): Add CS0683.
5409 (FieldMember.ctor): Add CS0681.
5411 2005-03-07 Raja R Harinath <rharinath@novell.com>
5413 * ecore.cs (SimpleName.DoResolve): Rename from
5414 SimpleName.DoResolveAllowStatic.
5415 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
5416 Pass 'intermediate' flag to MemberStaticCheck.
5417 (SimpleName.MemberStaticCheck): Skip "static check" only in case
5418 of "intermediate" lookups via MemberAccess.
5419 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
5420 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
5422 2005-03-07 Raja R Harinath <rharinath@novell.com>
5425 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
5426 slipped in because of variable names that are identical to a
5427 builtin type's BCL equivalent ('string String;', 'int Int32;').
5428 (PropertyExpr.EmitInstance): Likewise.
5430 2005-03-04 Marek Safar <marek.safar@seznam.cz>
5432 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
5434 * report.cs (warning_ignore_table): Made public.
5436 2005-03-04 Raja R Harinath <rharinath@novell.com>
5439 * class.cs (MethodData.Emit): Pass 'container' to
5440 container.GetObsoleteAttribute instead of 'container.Parent'.
5442 2005-03-03 Marek Safar <marek.safar@seznam.cz>
5444 * cs-parser.jay: Add 1534 error test.
5446 * iterators.cs (Yield.CheckContext): Add error 1629.
5447 (Iterator.ctor): Save unsafe modifier.
5448 (MoveNextMethod.DoEmit): Restore unsafe context.
5450 * namespace.cs (UsingAlias): Better error message.
5452 2005-03-03 Dan Winship <danw@novell.com>
5454 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
5455 the warning message [#73219]
5457 2005-03-03 Raja R Harinath <rharinath@novell.com>
5459 Fix compile with MCS 1.0.0.0.
5460 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
5461 w_restore to not depend on string constant folding.
5463 2005-03-03 Raja R Harinath <rharinath@novell.com>
5465 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
5466 CS0246 check to users who passed 'silent = false'.
5467 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
5469 (SimpleName.SimpleNameResolve): Update.
5470 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
5471 (MemberAccess.IdenticalNameAndTypeName): Update.
5472 * doc.cs (FindDocumentedTypeNonArray): Update.
5474 2005-03-03 Raja R Harinath <rharinath@novell.com>
5476 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
5477 * parameters.cs (ComputeAndDefineParameters): Remove.
5478 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
5479 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
5480 Use GetParameterInfo.
5482 2005-03-02 Marek Safar <marek.safar@seznam.cz>
5484 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
5486 2005-03-02 Raja R Harinath <rharinath@novell.com>
5488 Unify DeclSpace.LookupType and DeclSpace.FindType.
5489 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
5490 is in charge of defining nested types on demand.
5491 (DeclSpace.LookupType): Use it when the current_type is a
5492 TypeBuilder. Use LookupTypeDirect for reflected types.
5493 (DeclSpace.FindType): Remove.
5494 (DeclSpace.LookupInterfaceOrClass): Likewise.
5495 (DeclSpace.DefineTypeAndParents): Likewise.
5496 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
5497 DeclSpace.LookupType.
5498 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
5499 * typemanager.cs (LookupType): Simplify.
5500 (AddUserType): Remove type from negative_hits.
5501 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
5502 * class.cs (TypeContainer.FindMembers): Move handling of nested
5504 (TypeContainer.FindMembers_NestedTypes): ... here.
5505 (TypeContainer.FindNestedType): Implement override.
5506 (ClassPart.FindNestedType): Delegate to PartialContainer.
5507 (ClassPart.PartFindNestedType): Looks up the nested types of the
5510 2005-03-02 Martin Baulig <martin@ximian.com>
5512 * class.cs (TypeContainer.DoDefineMembers): We also need a default
5513 static constructor in static classes.
5515 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
5517 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
5518 sizeParamIndex is not specified.
5520 2005-03-01 Marek Safar <marek.safar@seznam.cz>
5523 * report.cs (WarningMessage.IsEnabled): Missing null check.
5525 2005-02-28 Marek Safar <marek.safar@seznam.cz>
5527 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
5528 in the fields and not in the properties.
5530 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
5532 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
5535 2005-02-28 Marek Safar <marek.safar@seznam.cz>
5537 * attribute.cs: Small refactoring (improved robustness).
5538 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
5539 (ValidateGuid): Removed.
5540 (Resolve): Removed referenced to above mentioned.
5541 (GetAttributeUsage): Made private and changed to work without
5543 (GetIndexerAttributeValue): Don't crash.
5544 (GetConditionalAttributeValue): Ditto.
5545 (GetClsCompliantAttributeValue): Ditto.
5546 (ExtractSecurityPermissionSet): All attributes exceptions are
5548 (GetPropertyValue): New helper.
5549 (GetMethodImplOptions): New method.
5550 (DefinePInvokeMethod): Reuse common code. Implemented handling of
5551 some missing properties.
5553 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
5554 (Method.ApplyAttributeBuilder): Updated.
5556 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
5559 2005-02-28 Raja R Harinath <rharinath@novell.com>
5562 * report.cs (Report.SymbolRelatedToPreviousError): Handle
5563 non-simple types (array, pointer, reference).
5565 2005-02-28 Marek Safar <marek.safar@seznam.cz>
5567 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
5569 * class.cs (MethodCore.IsDuplicateImplementation): Special error
5571 (Method.CheckBase): Catch wrong destructor here.
5572 (MethodData.Define): Add errors 550, 668.
5574 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
5576 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
5578 * pending.cs (VerifyPendingMethods): Add error 551.
5580 * typemanager.cs (CSharpName): Next error report helper.
5582 2005-02-25 Marek Safar <marek.safar@seznam.cz>
5584 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
5585 attributes. Removed useless attribute double check.
5586 It saves almost 2MBs for corlib.
5588 2005-02-25 Raja R Harinath <rharinath@novell.com>
5591 * statement.cs (ExpressionStatement.Resolve): Make robust to being
5592 called twice in case of error.
5594 2005-02-23 Chris Toshok <toshok@ximian.com>
5596 Fix compiler portions of #72827.
5597 * statement.cs (Block.Emit): call Begin/EndScope on the
5598 EmitContext instead of the ILGenerator.
5600 * codegen.cs (EmitContext.BeginScope): new method, call
5601 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
5603 (EmitContext.BeginScope): same, but EndScope and CloseScope
5605 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
5606 offset and call the superclass's OpenScope(int) with it.
5607 (SymbolWriter.CloseScope): get the current il
5608 offset and call superclass's CloseScope(int) with it.
5610 2005-02-23 Marek Safar <marek.safar@seznam.cz>
5612 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
5613 CS1677 for out and ref as well.
5615 * class.cs (Method.Define): Add error CS1599 detection.
5617 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
5619 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
5621 * delegate.cs (Delegate.Define): Add error CS1599 detection.
5623 * support.cs.cs (ModifierDesc): New helper method.
5625 2005-02-23 Raja R Harinath <rharinath@novell.com>
5626 Abin Thomas <projectmonokochi@rediffmail.com>
5627 Anoob V E <projectmonokochi@rediffmail.com>
5628 Harilal P R <projectmonokochi@rediffmail.com>
5631 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
5632 MemberLookup (used for error reporting) actually returns a result.
5633 Fix error report number (122, not 112).
5635 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
5636 Anoob V E <projectmonokochi@rediffmail.com>
5637 Harilal P R <projectmonokochi@rediffmail.com>
5640 * pending.cs (PendingImplementation.GetAbstractMethods):
5641 Find NonPublic members too.
5643 2005-02-22 Marek Safar <marek.safar@seznam.cz>
5645 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
5648 * class.cs (MethodCore.CheckMethodAgainstBase):
5649 Add error 239 report.
5651 2005-02-21 Raja R Harinath <rharinath@novell.com>
5654 * expression.cs (Invocation.IsApplicable): Make public.
5655 (Invocation.IsParamsMethodApplicable): Likewise.
5656 * delegate.cs (Delegate.VerifyApplicability): Don't use
5657 Invocation.VerifyArgumentCompat for parameter applicability
5658 testing. Use Invocation.IsApplicable and
5659 Invocation.IsParamsMethodApplicable.
5661 2005-02-21 Marek Safar <marek.safar@seznam.cz>
5663 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
5665 * class.cs (Operator.Define): Add error 217 report.
5667 2005-02-21 Raja R Harinath <rharinath@novell.com>
5669 * namespace.cs (UsingEntry.Resolve): Undo change below.
5671 2005-02-21 Raja R Harinath <rharinath@novell.com>
5674 * ecore.cs (Expression.MemberLookupFailed): Add argument to
5675 disable the error message when the extended MemberLookup also
5677 (Expression.MemberLookupFinal): Update.
5678 (SimpleName.DoSimpleNameResolve): Update.
5679 * expression.cs (MemberAccess.ResolveNamespaceOrType):
5680 Don't use MemberLookupFinal.
5681 (New.DoResolve): Update.
5682 (BaseAccess.CommonResolve): Update.
5684 2005-02-21 Raja R Harinath <rharinath@novell.com>
5687 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
5688 occured previously, don't resolve again.
5690 2005-02-21 Marek Safar <marek.safar@seznam.cz>
5693 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
5694 argument. Call ResolveAttributeUsage for unresolved.
5695 when types doesn't match ctor arguments.
5697 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
5698 for nested attribute classes.
5699 (Class.attribute_usage): Removed.
5700 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
5701 for attribute class.
5703 * ecore.cs (IsAttribute): Removed.
5705 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
5707 * rootcontext.cs (RegisterAttribute): Removed, attributes are
5709 (attribute_types): Removed.
5710 (EmitCode): Global attributes are emited as the latest.
5712 2005-02-18 Marek Safar <marek.safar@seznam.cz>
5714 * class.cs (EmitFieldInitializers): Don't emit field initializer
5715 for default values when optimilization is on.
5717 * constant.cs (Constant.IsDefaultValue): New property.
5719 * driver.cs: Add /optimize handling.
5723 * literal.cs: Implement new IsDefaultValue property.
5725 * rootcontext.cs (Optimize): New field, holds /optimize option.
5727 2005-02-18 Raja R Harinath <rharinath@novell.com>
5729 Fix crasher in re-opened #72347.
5730 * namespace.cs (Namespace.Lookup): Return null if
5731 DeclSpace.DefineType returns null.
5734 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
5736 2005-02-18 Raja R Harinath <rharinath@novell.com>
5738 Fix remainder of #63202. Change semantics of DoResolveLValue: it
5739 now returns null if it cannot resolve to an lvalue.
5740 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
5741 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
5742 returned null. Remove check for SimpleName.
5743 (EventExpr.DoResolveLValue): New.
5744 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
5745 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
5747 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
5749 (Unary.ResolveOperator): Move CS0211 check ...
5750 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
5752 (Unary.DoResolveLValue): Simplify.
5753 (AddressOf.DoResolveLValue): New.
5754 (ArrayAccess.DoResolveLValue): New.
5756 2005-02-16 Marek Safar <marek.safar@seznam.cz>
5758 * attribute.cs (Attribute.Resolve): Add arguments casting for
5759 when types doesn't match ctor arguments.
5761 2005-02-16 Raja R Harinath <rharinath@novell.com>
5763 Fix parts of #63202.
5764 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
5765 lookup of operator in base type. Ensure that all checks happen
5766 when the operator resolves to an "op_..." method.
5768 2005-02-15 Raja R Harinath <rharinath@novell.com>
5771 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
5772 'ignore_cs0104' parameter. Pass it to ...
5773 (NamespaceEntry.Lookup): ... this.
5774 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
5775 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
5776 (TypeLookupExpression.DoResolveAsTypeStep): Update.
5777 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
5778 Update. Request that cs0104 errors be ignored.
5779 (ComposedCast.ResolveAsTypeStep): Update.
5781 2005-02-14 Raja R Harinath <rharinath@novell.com>
5784 * expression.cs (Invocation.BetterFunction): Remove support for
5785 comparing virtual functions and their overrides.
5786 (Invocation.IsOverride): New.
5787 (Invocation.OverloadResolve): Don't consider 'override' functions
5788 during candidate selection. Store them in a lookaside list.
5789 If the selected method is a 'virtual' function, use the list to
5790 find any overrides that are closer to the LHS type.
5792 2005-02-14 Marek Safar <marek.safar@seznam.cz>
5794 * expression.cs (New.DoResolve): Add complex core type reduction.
5795 (New.Constantify): Converts complex core type syntax like 'new int ()'
5798 2005-02-14 Raja R Harinath <rharinath@novell.com>
5800 * decl.cs (EntryType.EntryType): New constructor to create an
5801 updated copy of a cache entry.
5802 (MemberCache.AddMethods): Use it.
5803 (MemberCache.ClearDeclaredOnly): Remove.
5804 (MemberCache.MemberCache): Update.
5806 2005-02-11 Miguel de Icaza <miguel@novell.com>
5808 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
5809 variable. This one is represents the actual low-level declaration
5810 of the method, as opposed to the semantic level `IsStatic'.
5812 An anonymous method which is hosted into a static method might be
5813 actually an instance method. IsStatic would reflect the
5814 container, while MethodIsStatic represents the actual code
5817 * expression.cs (ParameterReference): Use the new MethodIsStatic
5818 instead of IsStatic.
5820 * anonymous.cs (AnonymousMethod.Compatible): Pass the
5821 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
5822 set on the current EmitContext.
5824 * expression.cs (Cast): Overload DoResolveLValue so we can pass
5825 resolve our casted expression as an LValue. This triggers the
5826 proper LValue processing that is later required by Assign.
5830 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
5832 2005-02-11 Marek Safar <marek.safar@seznam.cz>
5834 C# 2.0 Fixed buffer implementation
5836 * anonymous.cs: Update after RegisterHelperClass renaming.
5838 * attribute.cs (AttributeTester.fixed_buffer_cache):
5839 Cache of external fixed buffers.
5840 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
5841 implementation if field is fixed buffer else null.
5844 (TypeContainer.AddField): Accept FieldMember instead of Field.
5845 (FieldBase.IsFieldClsCompliant): Extracted code from
5846 VerifyClsCompliance descendant customization.
5847 (FixedField): New class handles fixed buffer fields.
5848 (FixedFieldExternal): Keeps information about imported fixed
5850 (IFixedField): Make access to internal or external fixed buffer
5853 * cs-parser.jay: Add fixed buffer parsing.
5855 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
5858 * expression.cs (Indirection): Extended implementation to accept
5860 (PointerArithmetic.Emit): Get element from fixed buffer as well.
5861 (ElementAccess.MakePointerAccess): Get type as parameter.
5862 (DoResolve): Add fixed buffer field expression conversion.
5863 (DoResolveLValue): Ditto.
5864 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
5865 (ArrayPtr): Derives from FixedBufferPtr.
5866 (ArrayPtr.Emit): Add extra emit for array elements.
5868 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
5870 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
5871 for compiler generated types.
5872 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
5874 * statement.cs (Fixed): Refactored to be easier add fixed buffer
5875 and consume less memory.
5876 (Fixed.Resolve): Add fixed buffer case.
5878 * typemanager.cs (compiler_generated_attr_ctor,
5879 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
5880 (HasElementType): Add our own implementation to work on every
5883 2005-02-11 Miguel de Icaza <miguel@novell.com>
5885 * anonymous.cs (CaptureContext): Track whether `this' has been
5888 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
5889 only captured `this' if it was implicitly done (instance
5890 methods/variables were used).
5892 * codegen.cs (EmitContext.CaptureThis): New method to flag that
5893 `this' must be captured.
5895 2005-01-30 Miguel de Icaza <miguel@novell.com>
5897 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
5898 is null it means that there has been no need to capture anything,
5899 so we just create a sibling.
5901 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
5903 Just a partial fix. The other half is fairly elusive.
5905 2005-02-10 Raja R Harinath <rharinath@novell.com>
5907 Fix #52586, cs0121-4.cs.
5908 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
5909 and return a hashtable.
5910 (MemberCache.ClearDeclaredOnly): New.
5911 (MemberCache.MemberCache): Update to change. Make a deep copy of
5912 the method_hash of a base type too.
5913 (MemberCache.AddMethods): Adapt to having a deep copy of the base
5914 type methods. Overwrite entries with the same MethodHandle so
5915 that the ReflectedType is correct. The process leaves in base
5916 virtual functions and their overrides as distinct entries.
5917 (CacheEntry): Now a class instead of a struct. It shouldn't alter
5918 matters since it was boxed in a ArrayList before.
5919 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
5921 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
5922 case of a virtual function and its override (choose the overload
5924 (Invocation.OverloadResolve): Avoid 'override' members during
5925 'applicable_type' calculation.
5927 2005-02-09 Raja R Harinath <rharinath@novell.com>
5929 Combine two near-redundant caches.
5930 * typemanager.cs (method_params): Rename from method_internal_params.
5931 (TypeManager.GetParameterData): New. Replace
5932 Invocation.GetParameterData.
5933 (TypeManager.LookupParametersByBuilder): Remove.
5934 * expression.cs (Invocation.method_parameter_cache): Remove.
5935 (Invocation.GetParameterData): Remove.
5937 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
5940 2005-02-08 Raja R Harinath <rharinath@novell.com>
5943 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
5944 TypeManager.multicast_delegate_type is null, resolve it by looking
5945 up "System.MulticastDelegate".
5946 * rootcontext.cs (RootContext.ResolveCore): Simplify.
5948 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
5949 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
5950 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
5953 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
5954 (LabeledStatement.AddReference): New. Set 'referenced'.
5955 (Goto.Resolve): Use it.
5957 2005-02-05 John Luke <john.luke@gmail.com>
5959 * driver.cs: remove duplicate -doc line in Usage ()
5961 2005-02-04 Raja R Harinath <rharinath@novell.com>
5963 * location.cs (Location.AddFile): Fix CS2002 error report.
5965 2005-02-02 Martin Baulig <martin@ximian.com>
5967 * delegate.cs (Delegate.DefineType): Report an internal error if
5968 TypeManager.multicast_delegate_type is null. See bug #72015 for
5971 2005-02-02 Raja R Harinath <rharinath@novell.com>
5973 Fix a crasher in a variant of #31984.
5974 * const.cs (Constant.CheckBase): New override that defers the
5975 new-or-override check in case the base type hasn't been populated
5977 (Constant.Define): Ensure the new-or-override check is performed.
5979 2005-02-01 Duncan Mak <duncan@ximian.com>
5981 * const.cs (LookupConstantValue): Check that `ce' is not null
5982 before calling GetValue ().
5984 2005-02-01 Raja R Harinath <rharinath@novell.com>
5986 Fix test-334.cs (#69519).
5987 * cs-parser.jay (using_alias_directive): Pass in an expression to
5988 NamespaceEntry.UsingAlias.
5989 (using_namespace_directive): Pass in an expression to
5990 NamespaceEntry.Using.
5991 (namespace_name): Don't flatten to a string.
5992 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
5993 (NamespaceEntry.AliasEntry.Resolve): Lookup using
5995 (NamespaceEntry.UsingEntry): Likewise.
5996 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
5998 (NamespaceEntry.LookupForUsing): Remove.
5999 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
6001 (NamespaceEntry.Lookup): Remove support for dotted names.
6003 2005-02-01 Raja R Harinath <rharinath@novell.com>
6005 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
6007 (NamespaceEntry.ImplicitParent): Compute on demand.
6008 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
6009 parallels the current.
6010 (NamespaceEntry.LookupForUsing): Use it.
6011 (NamespaceEntry.Lookup): If the current namespace-entry is
6012 implicit, don't search aliases and using tables.
6014 2005-02-01 Raja R Harinath <rharinath@novell.com>
6017 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
6019 (TypeContainer.BaseCache): Compute on demand.
6020 (TypeContainer.FindMembers): Define constants and types if they're
6021 not already created.
6022 (FieldMember.Define): Move resetting of ec.InUnsafe before error
6024 * const.cs (Constant.Define): Make idempotent.
6026 2005-01-29 Miguel de Icaza <miguel@novell.com>
6028 * pending.cs: Produce better code (no nops produced by using Ldarg
6031 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
6032 i - 1' it should be arg + 1.
6036 2005-01-28 Raja R Harinath <rharinath@novell.com>
6038 * attribute.cs (Attribute.CheckAttributeType): Make private
6040 (Attribute.ResolveType): Make virtual.
6041 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
6042 handling of RootContext.Tree.Types.
6044 2005-01-27 Raja R Harinath <rharinath@novell.com>
6046 Update attribute-handling to use the SimpleName/MemberAccess
6048 * cs-parser.jay (attribute): Pass in an expression to the
6049 constructors of Attribute and GlobalAttribute.
6050 * attribute.cs (Attribute): Take an expression for the name.
6051 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
6052 passed in attribute name expression.
6053 (Attribute.CheckAttributeType): Use it.
6054 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
6055 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
6056 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
6057 argument to prevent error messages if the lookup fails.
6059 2005-01-27 Marek Safar <marek.safar@seznam.cz>
6061 * expression.cs (Indirection): Implemented IVariable interface
6062 to support indirection in AddressOf operator.
6063 (PointerArithmetic.Emit): Add optimalization for case where
6064 result can be precomputed.
6066 2005-01-26 Martin Baulig <martin@ximian.com>
6068 * class.cs (TypeContainer.AttributeTargets): Return the correct
6069 AttributeTargets depending on our `Kind' instead of throwing an
6070 exception; fixes #71632.
6072 2005-01-26 Marek Safar <marek.safar@seznam.cz>
6075 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
6078 2005-01-25 Raja R Harinath <rharinath@novell.com>
6081 * expression.cs (MemberAccess.DoResolve): Don't complain with
6082 cs0572 when the LHS of a member access has identical name and type
6085 2005-01-25 Marek Safar <marek.safar@seznam.cz>
6088 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
6090 Create custom PermissionSet only for PermissionSetAttribute.
6092 2005-01-24 Marek Safar <marek.safar@seznam.cz>
6095 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
6096 delegates in static class.
6098 2005-01-24 Martin Baulig <martin@ximian.com>
6100 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
6101 merging an implicit block, just use its reachability.
6103 * statement.cs (Block.Resolve): Make the unreachable code check
6104 work wrt. implicit blocks; see test-337 from #63842.
6106 2005-01-21 Alp Toker <alp@atoker.com>
6108 * cs-parser.jay: destructor_declaration's container is PartialContainer
6109 not Class when partial types are used, so use Kind prop instead of
6112 2005-01-22 Miguel de Icaza <miguel@ximian.com>
6114 * cs-parser.jay: Improve error reporting when an interface
6117 2005-01-20 Dick Porter <dick@ximian.com>
6119 * support.cs: SeekableStreamReader fix from Sandor Dobos
6120 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
6121 chars are read. Fixes bug 70369.
6123 2005-01-20 Raja R Harinath <rharinath@novell.com>
6125 * cs-parser.jay (catch_clause): Simplify current_block handling
6128 2005-01-17 Miguel de Icaza <miguel@ximian.com>
6130 * convert.cs (ImplicitStandardConversionExists): Synchronize the
6131 code with ImplicitStandardConversion to handle the implicit
6132 conversion of method groups into valid delegate invocations.
6134 The problem is that in parameter handling we were using this code
6135 path. Fixes bug #64698
6137 2005-01-19 Raja R Harinath <rharinath@novell.com>
6139 * cs-parser.jay: Fix several infelicities.
6140 - Avoid assigning to the parser value stack. Code like
6141 '$3 = null' is unclean. Synthesize a value for the code block
6143 - Avoid using oob_stack for storing location information. Use ...
6144 (_mark_): ... this. New (empty) rule. Saves the current location
6146 (foreach_statement): Avoid using oob_stack for current_block
6147 handling. Use technique used in for_statement and
6148 using_statement. Synthesize a value for the code block to store
6149 additional intermediate information.
6151 2005-01-13 Miguel de Icaza <miguel@ximian.com>
6153 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
6154 of a different type is only allowed to private fields of a
6155 containing type, not on fields of a base class.
6157 See test-174.cs and error cs0122-9.cs
6159 2005-01-13 Raja R Harinath <rharinath@novell.com>
6161 Fix test-335.cs (bug #58126).
6162 * cs-parser.jay (argument): Split out non-expression parts of the
6163 rule into 'non_simple_argument'.
6164 (invocation_expression): Support parenthesized invocations with
6165 multiple arguments, and with single non-simple arguments.
6167 2005-01-13 Raja R Harinath <rharinath@novell.com>
6169 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
6172 2005-01-12 Raja R Harinath <rharinath@novell.com>
6174 Fix cs0038-1.cs, cs1640-6.cs.
6175 * ecore.cs (Expression.Resolve): Remove special-case for
6176 SimpleName in error-handling.
6177 (Expression.almostMatchedMembers): Relax access permission to
6179 (Expression.MemberLookupFailed): Handle duplicates in
6180 almostMatchedMembers list.
6181 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
6182 * expression.cs (New.DoResolve): Report CS1540 for more cases.
6183 * typemanager.cs (GetFullNameSignature): Use the MethodBase
6184 overload if the passed in MemberInfo is a MethodBase.
6186 2005-01-12 Marek Safar <marek.safar@seznam.cz>
6189 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
6190 for non-CAS & merge permission sets properly.
6192 2005-01-11 Raja R Harinath <rharinath@novell.com>
6194 Improve standard-compliance of simple name and member access
6195 resolution. Fixes bugs #52697, #57200, #67520, #69519.
6196 * ecore.cs (FullNamedExpression): New abstract base class
6197 for Namespaces and TypeExpressions.
6198 (ResolveFlags.SimpleName): Remove.
6199 (SimpleName): Remove support for dotted names.
6200 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
6201 DeclSpace.FindType and DeclSpace.LookupType.
6202 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
6203 (Expression.ExprClassName): Make member function.
6204 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
6205 a namespace. Remove creation of dotted "SimpleName"s.
6206 (MemberAccess.DoResolve): Likewise.
6207 * decl.cs (DeclSpace.Cache): Make private.
6208 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
6209 (DeclSpace.FindType): Update.
6210 (DeclSpace.LookupType): Move here from RootContext. Return a
6211 FullNamedExpression.
6212 * namespace.cs (Namespace): Derive from FullNamedExpression
6213 so that it can be part of expression resolution.
6214 (Namespace.Lookup): Return an FullNamedExpression.
6215 (NamespaceEntry.LookupAlias): Lookup aliases only in current
6217 * rootcontext.cs (NamespaceLookup): Remove.
6218 (LookupType): Move to DeclSpace.
6219 * attribute.cs (CheckAttributeType): Update.
6220 * doc.cs (FindDocumentedType): Remove allowAlias argument.
6221 (FindDocumentedTypeNonArray): Likewise.
6223 2005-01-11 Raja R Harinath <rharinath@novell.com>
6225 Fix cs0509.cs, cs1632.cs.
6226 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
6227 is the same as IsInterface.
6228 (TypeContainer.GetClassBases): Likewise.
6229 * statement.cs (LabeledStatement.ig): New field.
6230 (LabeledStatement.LabelTarget): Save ILGenerator which created the
6232 (LabeledStatement.DoEmit): Check that the label was created with
6233 the same ILGenerator.
6235 2005-01-10 Marek Safar <marek.safar@seznam.cz>
6238 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
6239 accessors to its properties.
6241 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
6242 from accessors to property.
6244 2005-01-10 Marek Safar <marek.safar@seznam.cz>
6247 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
6250 2005-01-08 Miguel de Icaza <miguel@ximian.com>
6252 * attribute.cs: Check for null and empty strings.
6254 I have lost another battle to Paolo.
6256 2005-01-07 Marek Safar <marek.safar@seznam.cz>
6259 * class.cs (PropertyMethod): Set Parent field in ctors.
6260 (SetMethod.InternalParameters): Add unsafe switch hack.
6261 Override MarkForDuplicationCheck where it is appropriate.
6263 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
6264 It says whether container allows members with the same name.
6266 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
6267 Removed is_method parameter.
6269 2005-01-06 Duncan Mak <duncan@ximian.com>
6271 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
6272 because the previous change led to incorrect reporting of CS1032
6273 ("Cannot define/undefine preprocessor symbols after first token in
6274 file"). Instead of using `tokens_seen' as the only flag that
6275 triggers CS1040, introduce `comments_seen'. This new flag is used
6276 to signify having seen comments on the current line, so it is
6277 unset after a newline.
6279 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
6281 * doc.cs : When searching for a type, find nested type too.
6282 This fixes bug #71040.
6284 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
6287 - Warn missing member comment on those classes which also does not
6288 have doc comments. Fixed bug #71041.
6289 - Don't warn missing doc comment on default constructor.
6292 2005-01-06 Duncan Mak <duncan@ximian.com>
6294 * cs-tokenizer.cs (xtoken): After handling traditional C-style
6295 comments, set `tokens_seen' to true. This allows us to detect
6296 misplaced preprocessor directives (i.e. not at the beginning of
6297 the a line, nor after whitespaces). In that case, report error
6298 CS1040. This fixes bug #56460.
6300 * cs-parser.jay (interface_member_declaration): Add checks for
6301 IsExplicitImpl, and report CS0541 error if an interface member is
6302 defined as an explicit interface declaration.
6304 2005-01-06 Marek Safar <marek.safar@seznam.cz>
6307 * class.cs (PropertyMethod): Set Parent field in ctors.
6308 (SetMethod.InternalParameters): Add unsafe switch hack.
6310 * decl.cs (MemberCore.Parent): Cannot be readonly.
6312 2005-01-06 Raja R Harinath <rharinath@novell.com>
6314 * decl.cs (DeclSpace.ResolveType): Remove.
6315 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
6316 Merge in code from ...
6317 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
6318 * class.cs, enum.cs: Update to changes.
6320 2005-01-06 Miguel de Icaza <miguel@ximian.com>
6322 * anonymous.cs: Ensure that we init the scope of our parent if it
6323 has not been initialized yet.
6325 2004-12-30 Duncan Mak <duncan@ximian.com>
6327 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
6328 if field.FieldBuilder is null. Fixes #70758.
6330 * convert.cs: Fixed some typos and updated some of the comments.
6331 (ImplicitStandardConversionExists):
6332 (TryImplicitIntConversion): If `target_type' is an interface and
6333 the type of `ic' implements this interface, return true or a new
6334 BoxedCast instead of null. This fixes #70468.
6336 2004-12-29 Duncan Mak <duncan@ximian.com>
6338 * expression.cs (Argument.Emit): Check that Expr is
6339 IMemoryLocation before casting to it, and report CS1510 otherwise.
6343 2004-12-21 Ben Maurer <bmaurer@ximian.com>
6345 * statement.cs (Block.ThisVariable): remove the recursion here, to
6346 make the --profile more sane.
6348 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
6350 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
6351 assembly, by JB Evain.
6353 2004-12-17 Raja R Harinath <rharinath@novell.com>
6355 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
6356 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
6357 "parent" refers to enclosing type/class. "base" refers to superclass.
6359 2004-12-17 Raja R Harinath <rharinath@novell.com>
6361 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
6362 Ensure that we only have GlobalAttributes.
6363 * attribute.cs (Attribute.Emit): Make non-virtual.
6364 (GlobalAttribute.Emit): Remove.
6365 (Attribute.Resolve): Make virtual.
6366 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
6367 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
6368 the argument. Don't create one.
6369 (Attribute.GetObsoleteAttribute): Likewise.
6370 (Attribute.GetClsCompliantAttributeValue): Likewise.
6371 * class.cs, decl.cs: Update to changes.
6373 2004-12-17 Marek Safar <marek.safar@seznam.cz>
6375 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
6377 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
6379 * statement.cs (Foreach.Resolve): Add error 186 report.
6381 2004-12-16 Marek Safar <marek.safar@seznam.cz>
6383 * expression.cs (Conditional.DoResolve): Add warning 429.
6385 * statement.cs (If.Resolve): Add warning 665.
6387 2004-12-16 Raja R Harinath <rharinath@novell.com>
6389 New invariant: RootContext.Tree.Types.NamespaceEntry == null
6390 except when in the parser, and in GlobalAttribute.
6391 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
6392 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
6393 RootContext.Tree.Types.NamespaceEntry once work is done.
6394 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
6395 and resets RootContext.Tree.Types.NamespaceEntry.
6397 2004-12-15 Marek Safar <marek.safar@seznam.cz>
6399 * cs-parser.jay: Don't create a block for every variable.
6401 2004-12-14 Miguel de Icaza <miguel@ximian.com>
6403 * location.cs: Provide extra information.
6405 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
6406 variables from the captured environment, it is the ldarg_0.
6408 2004-12-14 Marek Safar <marek.safar@seznam.cz>
6410 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
6413 * class.cs: Changed warning level for 169 to avoid developer
6414 displeasure from warning flooding. It will be changed back when they
6415 fix most of current BCL warnings.
6417 * RootContext.cs: Pushed default WarningLevel to 3.
6419 * statement.cs: Removed unused variable.
6421 2004-12-14 Marek Safar <marek.safar@seznam.cz>
6423 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
6424 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
6425 Add error 502 report.
6426 (StaticClass.DefineType): Add error 441 report.
6427 (Class.AllowedModifiersProp): New virtual property as temporary
6428 extension to AllowedModifiers.
6429 (Class.DefineType): Add error 418 report. Moved ModFlags check here
6430 to share implementation with StaticClass and don't call virtual
6433 * driver.cs (MainDriver): Add error 1558 test.
6435 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
6436 report. Moved error 36 test here.
6438 * statement.cs (Throw.Resolve): Add error 724 report.
6440 * typemanager.cs: Add out_attribute_type core type.
6442 2004-12-13 Marek Safar <marek.safar@seznam.cz>
6444 * class.cs (TypeContainer.VerifyClsCompliance): Add error
6446 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
6448 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
6451 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
6453 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
6454 Add error 3023 report.
6455 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
6457 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
6460 2004-12-12 John Luke <john.luke@gmail.com>
6462 * driver.cs (AddArgs): take -- into account when
6463 adding arguments, fixes bug 65710
6465 2004-12-12 Martin Baulig <martin@ximian.com>
6467 * expression.cs (Unary.TryReduceNegative): Added support for
6468 SByteConstant and ByteConstant.
6469 (Unary.Reduce): Check error values from TryReduceNegative().
6471 2004-12-10 Marek Safar <marek.safar@seznam.cz>
6473 * attributes.cs (Attribute.Resolve): Avoid multiple error report
6474 and report exception as error 182.
6476 2004-12-10 Raja R Harinath <rharinath@novell.com>
6478 * driver.cs (Main): Fix message when there are warnings.
6480 2004-12-09 Miguel de Icaza <miguel@ximian.com>
6482 * delegate.cs: Fixed my fix from yesterday, sorry about that.
6484 2004-12-09 Marek Safar <marek.safar@seznam.cz>
6486 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
6487 Reduced number of warnings.
6489 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
6491 2004-12-08 Miguel de Icaza <miguel@ximian.com>
6493 * driver.cs: Removed message.
6495 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
6497 2004-12-08 <vargaz@freemail.hu>
6499 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
6501 2004-12-08 Martin Baulig <martin@ximian.com>
6503 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
6504 instead of a CS3002 for properties and indexer.
6506 2004-12-08 Martin Baulig <martin@ximian.com>
6508 * decl.cs (MemberName.ToString): Make this work again.
6510 2004-12-08 Marek Safar <marek.safar@seznam.cz>
6512 * attribute.cs (Resolve): Add error 591 detection.
6514 * class.cs (FieldMember.Define): Add error 1547 detection.
6515 (Indexer.Define): Add error 620 detection.
6516 (Operator.Define): Add error 590 detection.
6518 * ecore.cs: Missing argument for error 79.
6520 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
6523 2004-12-07 Marek Safar <marek.safar@seznam.cz>
6526 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
6529 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
6531 * cs-parser.jay : handle doc comments on implicit/explicit operators.
6532 Some operator comments were suppressed.
6533 * doc.cs : Implicit/explicit operator name in doc comments are like
6534 "op_Explicit(type)~returnType", so added suffix handling.
6536 2004-12-07 Martin Baulig <martin@ximian.com>
6539 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
6540 (MemberCore.GetClsCompliantAttributeValue): Likewise.
6541 (DeclSpace.ec): New protected field; store the EmitContext here.
6542 (DeclSpace.EmitContext): New public property; moved here from
6544 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
6547 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
6548 (Enum.Emit): Don't create a new EmitContext.
6550 * delegate.cs (Delegate.DefineType): Always create the
6553 * iterators.cs (Iterators.DefineIterator): Create a new
6554 EmitContext and store it in `ec'.
6556 2004-08-24 Martin Baulig <martin@ximian.com>
6559 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
6560 this for accessibility checks.
6561 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
6562 IsNestedFamilyAccessible.
6563 (TypeManager.IsSubclassOf): New method, do what the name actually
6566 2004-12-06 Raja R Harinath <rharinath@novell.com>
6568 Fix crash on cs0657-17.cs.
6569 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
6570 Use RootContext.Tree.Types, not 'new RootTypes ()'.
6571 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
6572 the case where the NamespaceEntry gets overwritten.
6574 2004-12-06 Marek Safar <marek.safar@seznam.cz>
6576 Fixed #69195, #56821
6577 * ecore.cs (ResolveBoolean): Tiny refactoring.
6579 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
6580 of right expression resolving when left is false constant and
6581 operator is LogicalAnd OR true constant and operator is LogicalOr.
6583 * statement.cs (ResolveUnreachable): Always reports warning.
6585 2004-12-05 Miguel de Icaza <miguel@ximian.com>
6587 * class.cs: Distinguish between 1721 and 1722 (just a little help
6588 for the programmer).
6590 2004-12-03 Miguel de Icaza <miguel@ximian.com>
6592 * delegate.cs: Only allow this on new versions of the language.
6594 2004-12-02 Duncan Mak <duncan@ximian.com>
6596 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
6598 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
6599 here as a static method. Take an additional bool out parameter
6600 `must_do_cs1540_check' for signaling to InstanceResolve.
6601 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
6602 member field from PropertyExpr class and made it an argument of
6604 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
6605 check for MarshalByRefObject, and report CS0122 instead of CS1540.
6606 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
6607 and `remove_accessor' as well as InstanceResolve: report CS0122
6612 2004-12-03 Raja R Harinath <rharinath@novell.com>
6614 Fix test-327.cs, test-328.cs, and put in early infrastructure
6615 for eventually fixing #52697.
6616 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
6617 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
6619 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
6620 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
6621 (VerifyUsing, error246): Update.
6622 * rootcontext.cs (RootContext.NamespaceLookup): Just use
6623 'NamespaceEntry.LookupNamespaceOrType'.
6625 2004-12-03 Martin Baulig <martin@ximian.com>
6627 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
6628 method as our child, call AnonymousMethod.Compatible() on it.
6630 2004-12-03 Raja R Harinath <rharinath@novell.com>
6632 Disable XML documentation support in 'basic' profile.
6633 * decl.cs, class.cs [BOOTSTRAP_WITH_OLDLIB]: Don't import System.Xml.
6634 Redirect XmlElement to System.Object.
6635 * driver.cs, enum.cs, rootcontext.cs: Don't reference System.Xml.
6636 * doc.cs [BOOTSTRAP_WITH_OLDLIB]: Disable compile.
6637 * mcs.exe.sources: Add doc-bootstrap.cs.
6638 * doc-bootstrap.cs: New file. Contains empty stub implementation
6641 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
6643 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
6644 comments are allowed.
6646 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
6648 * delegate.cs: Add checks for subtypes in paramaters and return values
6649 in VerifyMethod () to add support for Covariance/Contravariance
6652 2004-12-02 Miguel de Icaza <miguel@ximian.com>
6654 * report.cs: Remove extra closing parenthesis.
6656 * convert.cs (Error_CannotImplicitConversion): If the name of the
6657 types are the same, provide some extra information.
6659 * class.cs (FieldBase): Use an unused bit field from the field to
6660 encode the `has_offset' property from the FieldMember. This saves
6661 a couple of Ks on bootstrap compilation.
6663 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
6664 method as our child, return the AnonymousMethod resolved
6667 * expression.cs (New.DoResolve): Allow return values from
6668 NewDelegate to also include AnonymousMethods.
6672 2004-12-02 Marek Safar <marek.safar@seznam.cz>
6675 * attribute.cs (Resolve): Improved implementation of params
6676 attribute arguments.
6678 * support.cs (ParameterData): Add HasParams to be faster.
6680 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
6682 all things are for /doc support:
6684 * doc.cs: new file that supports XML documentation generation.
6685 * mcs.exe.sources: added doc.cs.
6687 Handle /doc command line option.
6688 Report error 2006 instead of 5 for missing file name for /doc.
6689 Generate XML documentation when required, after type resolution.
6691 Added support for picking up documentation (/// and /** ... */),
6692 including a new XmlCommentState enumeration.
6694 Added lines to fill Documentation element for field, constant,
6695 property, indexer, method, constructor, destructor, operator, event
6696 and class, struct, interface, delegate, enum.
6697 Added lines to warn incorrect comment.
6699 Added Documentation field (passed only when /doc was specified).
6701 Added DocComment, DocCommentHeader, GenerateDocComment() and
6702 OnGenerateDocComment() and some supporting private members for
6703 /doc feature to MemberCore.
6705 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
6707 Added overriden DocCommentHeader.
6709 Added overriden DocCommentHeader and GenerateDocComment().
6711 2004-12-01 Miguel de Icaza <miguel@ximian.com>
6713 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
6714 unwrapping the enumeration values, chain to
6715 DoConstantNumericPromotions again, so we can promote things to the
6716 fundamental types (takes care of enums that are bytes, sbytes).
6720 2004-12-01 Raja R Harinath <rharinath@novell.com>
6722 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
6723 Fix long-standing bug in type-lookup. Use FindType instead of
6724 LookupType when ec.ResolvingTypeTree.
6725 (Attribute.ResolveType, Attribute.Resolve)
6726 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
6728 (Attributes.Search): Remove internal version. Update.
6729 (Attributes.SearchMulti): Update.
6730 (Attributes.GetClsCompliantAttribute): Remove.
6731 (Attributes.GetIndexerNameAttribute): Remove.
6732 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
6733 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
6734 * class.cs (Indexer.Define): Likewise.
6736 2004-12-01 Marek Safar <marek.safar@seznam.cz>
6739 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
6740 MarshallByReference members access.
6742 * expression.cs: Use CheckMarshallByRefAccess;
6743 Better error CS0197 message.
6745 * report.cs: Print whole related error message.
6747 2004-11-30 Raja R Harinath <rharinath@novell.com>
6749 * Makefile (mcs.exe) [PROFILE=default]: Keep a copy of mcs.exe in
6750 the current directory to help debugging.
6752 2004-11-29 Marek Safar <marek.safar@seznam.cz>
6754 * class (GetClassBases): Better error 60 report.
6755 (EventProperty): Disabled warning 67 detection.
6757 2004-11-29 Marek Safar <marek.safar@seznam.cz>
6760 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
6762 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
6765 2004-11-29 Marek Safar <marek.safar@seznam.cz>
6768 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
6770 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
6772 2004-11-26 Miguel de Icaza <miguel@ximian.com>
6774 * attribute.cs (Attribute.Resolve): Refine error reporting and
6775 report a cs0117 if the identifier does not exist, to distinguish
6776 from 0617 which is a miss-use of the actual identifier.
6778 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
6779 between cs0070 and cs0079.
6781 * class.cs (MemberBase.DoDefine): When reporting a wrong
6782 accessibility level, we use MethodCore to compare instead of
6783 Method (this was a regression in some refactoring effort).
6785 So now we correctly report cs0056 again.
6787 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
6788 testing the target_type (which was known to be object_type) and
6789 not the source type (which is anonymous_method).
6791 Fixed reporting of error cs1660.
6793 * expression.cs (UserCast.Source): Expose the underlying cast.
6795 * statement.cs (Switch.SwitchGoverningType): Sort the list of
6796 allowed types to find a match to int32 first (most common).
6798 In addition, it ignores any ImplicitUserConversions that did an
6799 internal implicit conversion (as the switch statement allows only
6800 one integral conversion to exist).
6802 * class.cs (PartialContainer.Create): rename `name' to
6803 `member_name' for clarity. Then replace the string calls with a
6804 call to MemberName.GetPartialName, as now using
6805 MemberName.ToString is an error (this is due to the side effects
6806 it had, that were fixed in the past).
6808 This will restore the error reporting on a number of partial class
6809 errors that were missusing this (and getting an exception as a
6810 results, which is now just a plain textual warning, because
6811 yyparse debug output would crash otherwise).
6813 2004-11-26 Raja R Harinath <rharinath@novell.com>
6815 * Makefile (PROGRAM_INSTALL_DIR): Remove.
6817 2004-11-25 Ben Maurer <bmaurer@ximian.com>
6819 * rootcontext.cs (LookupType): Make sure to cache lookups that
6820 don't give us a negative result. This saves about 5% of corlib
6823 2004-11-25 Miguel de Icaza <miguel@ximian.com>
6825 * report.cs (AbstractMessage.Print): messages are sent to stderr
6827 * class.cs (TypeContainer.GetClassBases): It is an error to have a
6828 non-interface in the list of interfaces (at this point, either
6829 parent was properly set, or a base class is being listed in the
6830 interfaces section).
6832 This flags error 1722, and resolves the crash from bug 69259.
6834 2004-11-25 Ben Maurer <bmaurer@ximian.com>
6836 * statement.cs (Using.EmitExpressionFinally): make this work right
6837 for valuetypes. Fixes 69926.
6839 2004-11-25 Miguel de Icaza <miguel@ximian.com>
6841 * const.cs (Const.ChangeType): Cope with the "0 literal can be
6842 converted to an enum" here, before we try to change the underlying
6843 type. This code exists, but it is a different code path than the
6844 one used while encoding constants.
6846 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
6847 old bug: when converting from the null literal to a pointer,
6848 return an EmptyCast, not the NullLiteral.
6850 This fixes #69921, the recent null_type changes probably made this
6853 (ImplicitReferenceConversionExists): In addition, resynchronized
6854 the code here, so it matches the same code in
6855 ImplicitReferenceConversionExists for the `from any class-type S
6856 to any interface-type T'.
6859 2004-11-25 Marek Safar <marek.safar@seznam.cz>
6861 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
6863 2004-11-24 Miguel de Icaza <miguel@ximian.com>
6865 * cs-parser.jay: Use verbosity accordingly.
6867 2004-11-24 Marek Safar <marek.safar@seznam.cz>
6869 * expression.cs (Unary.ResolveOperator): Do not report warning;
6870 AddressOf reads from variable.
6872 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
6874 2004-11-24 Marek Safar <marek.safar@seznam.cz>
6878 * attribute.cs (Attributable): Removed CheckTargets.
6879 (Attributes.Emit): Explicit attribute targets are tested here.
6881 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
6882 not enabled for interfaces.
6884 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
6885 (GetAssemblyName): Ouch next bug there.
6887 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
6889 * expression.cs: Error 275 added.
6891 2004-11-23 Marek Safar <marek.safar@seznam.cz>
6893 Fix bug #69177 (Implemented decimal constant support)
6895 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
6896 (BinaryFold): Add DecimalConstant.
6898 * const.cs (Define): Decimal constant
6900 (ChangeType): Add decimal type handling.
6901 (LookupConstantValue): Don't set value for decimal type but
6902 emit DecimalConstantAttribute. Needed for constant optimization.
6904 * constant.cs (ToDecimal): New method.
6905 (ConvertToDecimal): New method.
6906 (IntConstant): Implemented ConvertToDecimal.
6907 (DecimalConstant.Emit): Emit optimized version for decimals in
6910 * expression.cs (ResolveOperator): Changed order of constant
6911 reduction to work correctly with native types which have
6912 overloaded operators.
6913 (ResolveMemberAccess): Extract constant value from attribute
6916 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
6918 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
6919 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
6920 (ChangeType): Decimal is special.
6921 (TypeToCoreType): Add decimal type.
6923 2004-11-22 Marek Safar <marek.safar@seznam.cz>
6925 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
6928 2004-11-22 Marek Safar <marek.safar@seznam.cz>
6930 * class.cs (EventField.ApplyAttributeBuilder): Fix error
6933 2004-11-19 Marek Safar <marek.safar@seznam.cz>
6935 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
6937 * pending.cs (PendingImplementation): Grab only interfaces.
6939 2004-11-19 Marek Safar <marek.safar@seznam.cz>
6941 * statement.cs (ForeachHelperMethods): Add location member and
6942 error 202 detection.
6944 2004-11-19 Raja R Harinath <rharinath@novell.com>
6946 * Makefile (EXTRA_DISTFILES): Remove mcs.exe.config. It's
6947 automatically handled by executable.make.
6948 (PROGRAM): Make profile-specific.
6950 2004-11-18 Marek Safar <marek.safar@seznam.cz>
6952 * expression.cs (DoResolveBase): Fixed wrong warning for out
6955 2004-11-18 Martin Baulig <martin@ximian.com>
6957 Merged latest changes into gmcs. Please keep this comment in
6958 here, it makes it easier for me to see what changed in MCS since
6959 the last time I merged.
6961 2004-11-17 Raja R Harinath <rharinath@novell.com>
6963 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
6964 (TypeHandle.GetMemberCache): New.
6965 (TypeHandle.TypeHandle): Update.
6966 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
6967 (TypeManager.LookupParentInterfacesCache):
6968 Rename from LookupInterfaceCache. Optimize slightly.
6969 (TypeManager.MemberLookup_FindMembers): Update.
6970 * decl.cs (MemberCache.MemberCache): Set Container to null in the
6972 (AddCacheContents): Rename from AddHashtable.
6973 * class.cs (TypeContainer.parent_container): Remove.
6974 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
6975 (TypeContainer.DoDefineMembers): Don't initialize it.
6976 Update to name changes.
6978 2004-11-17 Miguel de Icaza <miguel@ximian.com>
6980 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
6981 that factors the code to check access modifiers on override.
6983 (PropertyBase): Use the code here.
6985 Patch from Lluis S'anchez, fixes bug #69361.
6987 2004-11-15 Miguel de Icaza <miguel@ximian.com>
6989 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
6990 routine that is used to report the use of a captured variable
6991 whose address has been taken.
6993 There are two checks: one when variables are being captured and
6994 the other check is when the address of a variable is taken.
6996 (because an anonymous methods might be resolved before *or* after
6997 the address has been taken) and
6999 * expression.cs (Conditional.DoResolve): Remove the special
7000 casing that Martin added to trueExpr and falseExpr being both
7001 NullLiteral. We get the right behavior now just by introducing
7002 the null_type into the compiler.
7004 * convert.cs (ExplicitConversion): Change the code to use
7005 null_type instead of testing `expr is NullLiteral'.
7006 (ImplicitConversionStandard): use null_type too.
7007 (ImplicitReferenceConversionExists): use null_type too.
7008 (ImplicitReferenceConversion): use null_type too.
7010 * literal.cs: The type of `NullLiteral' is now null_type instead
7012 (Resolve): Set the type here.
7014 * typemanager.cs: Introduce null_type.
7016 2004-11-17 Martin Baulig <martin@ximian.com>
7018 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
7019 direction, like FindMembers() does. Fixes #69546, testcase is in
7022 2004-11-16 Martin Baulig <martin@ximian.com>
7024 This is based on a patch from Marek Safar, see bug #69082.
7025 Fixes bugs #63705 and #67130.
7027 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
7028 method; create a MemberCache for an interface type and cache the
7031 * decl.cs (IMemberContainer.ParentContainer): Removed.
7032 (IMemberContainer.ParentCache): New property.
7033 (MemberCache.SetupCacheForInterface): Removed.
7034 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
7035 to create a cache for an interface's "parent".
7037 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
7040 2004-11-16 Martin Baulig <martin@ximian.com>
7042 Merged back from gmcs; these changes already went into gmcs a
7043 couple of weeks ago.
7046 (TypeManager.AddUserType): Removed the `ifaces' argument.
7047 (TypeManager.RegisterBuilder): Take a `Type []' instead of a
7049 (TypeManager.AddUserInterface): Removed.
7050 (TypeManager.ExpandInterfaces): Return a `Type []' instead of a
7052 (TypeManager.GetInterfaces): Likewise.
7053 (TypeManager.GetExplicitInterfaces): Likewise.
7055 * ecore.cs (TypeExpr.GetInterfaces): Removed.
7057 * class.cs (TypeContainer.base_class_type): Replaced with `ptype'.
7058 (TypeContainer.base_inteface_types): Replaced with `ifaces'.
7060 2004-11-14 Ben Maurer <bmaurer@ximian.com>
7062 * statement.cs: Avoid adding bools to a hashtable.
7064 2004-11-07 Miguel de Icaza <miguel@ximian.com>
7066 * expression.cs (Invocation.OverloadResolve): Flag error if we are
7067 calling an unsafe method from a safe location.
7069 2004-11-06 Marek Safar <marek.safar@seznam.cz>
7072 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
7074 2004-11-06 Miguel de Icaza <miguel@ximian.com>
7076 * namespace.cs (VerifyUsing): use GetPartialName instead of
7079 2004-11-05 Miguel de Icaza <miguel@ximian.com>
7081 * statement.cs (Return.Resolve): Fix regression in typo: if
7082 `in_exc', we have to request a NeedReturnLabel, this was a typo
7083 introduced in the anonymous method check-in. Fixes #69131.
7085 * Indexers were using the ShortName when defining themselves,
7086 causing a regression in the compiler bootstrap when applying the
7087 patch from 2004-11-02 (first part), now they use their full name
7088 and the bug is gone.
7090 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
7092 * driver.cs: Strip the path from the names of embedded resources. Fixes
7095 2004-11-04 Raja R Harinath <rharinath@novell.com>
7097 Fix error message regression: cs0104-2.cs.
7098 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
7099 (AliasEntry.Resolve): Update.
7100 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
7102 (RootContext.LookupType): Update.
7104 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
7106 * cs-parser.jay: Add support for handling accessor modifiers
7107 * class: Add support port accessor modifiers and error checking,
7108 define PropertyMethod.Define as virtual (not abstract anymore)
7109 * ecore.cs: Add checking for proeprties access with access modifiers
7110 * iterators.cs: Modify Accessor constructor call based in the modified
7112 2004-11-02 Ben Maurer <bmaurer@ximian.com>
7114 * expression.cs (StringConcat): Handle being called twice,
7115 as when we have a concat in a field init with more than two
7118 2004-11-02 Miguel de Icaza <miguel@ximian.com>
7120 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
7121 special case explicit implementations, we should always produce
7122 the .property or .event declaration.
7124 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
7125 since it will not return correct data if people use this
7126 unresolved in the presence of using statements (see test-313).
7128 * class.cs (MethodData.Define): If we are an explicit interface
7129 implementation, set the method name to the full name of the
7130 interface plus the name of the method.
7132 Notice that using the method.MethodName.GetFullName() does not
7133 work, as it will only contain the name as declared on the source
7134 file (it can be a shorthand in the presence of using statements)
7135 and not the fully qualifed type name, for example:
7139 class D : ICloneable {
7140 object ICloneable.Clone () {
7144 Would produce a method called `ICloneable.Clone' instead of
7145 `System.ICloneable.Clone'.
7147 * namespace.cs (Alias.Resolve): Use GetPartialName.
7149 2004-11-01 Marek Safar <marek.safar@seznam.cz>
7151 * cs-parser.jay: Add error 1055 report.
7153 2004-11-01 Miguel de Icaza <miguel@ximian.com>
7155 * assign.cs (Assign.DoResolve): Only do the transform of
7156 assignment into a New if the types are compatible, if not, fall
7157 through and let the implicit code deal with the errors and with
7158 the necessary conversions.
7160 2004-11-01 Marek Safar <marek.safar@seznam.cz>
7162 * cs-parser.jay: Add error 1031 report.
7164 * cs-tokenizer.cs: Add location for error 1038.
7166 2004-10-31 Marek Safar <marek.safar@seznam.cz>
7168 * cs-parser.jay: Add error 1016 report.
7170 2004-10-31 Marek Safar <marek.safar@seznam.cz>
7172 * cs-parser.jay: Add errors 1575,1611 report.
7174 2004-10-31 Marek Safar <marek.safar@seznam.cz>
7176 * cs-parser.jay: Add error 1001 report.
7178 2004-10-31 Marek Safar <marek.safar@seznam.cz>
7181 * attribute.cs (GetMarshal): Add method argument for
7182 caller identification.
7184 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
7185 agument for GetMarshal and RuntimeMissingSupport.
7187 2004-10-31 Marek Safar <marek.safar@seznam.cz>
7189 * attribute.cs (ExtractSecurityPermissionSet): Removed
7190 TypeManager.code_access_permission_type.
7192 * typemanager.cs: Removed TypeManager.code_access_permission_type.
7194 2004-10-27 Miguel de Icaza <miguel@ximian.com>
7196 * expression.cs (LocalVariableReference.DoResolveLValue): Check
7197 for obsolete use of a variable here. Fixes regression on errors
7198 cs0619-25 and cs0619-26.
7200 2004-10-27 Marek Safar <marek.safar@seznam.cz>
7202 Fix #62358, implemented security attribute encoding.
7204 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
7205 Tests permitted SecurityAction for assembly or other types.
7206 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
7207 data from SecurityPermissionAttribute to PermisionSet class.
7209 * class.cs (ApplyAttributeBuilder): Added special handling
7210 for System.Security.Permissions.SecurityAttribute based types.
7212 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
7213 special handling for System.Security.Permissions.SecurityAttribute
7216 * enum.cs (ApplyAttributeBuilder): Added special handling
7217 for System.Security.Permissions.SecurityAttribute based types.
7219 * parameter.cs (ApplyAttributeBuilder): Added special handling
7220 for System.Security.Permissions.SecurityAttribute based types.
7222 * rootcontext.cs: Next 2 core types.
7224 * typemanager.cs (TypeManager.security_permission_attr_type):
7225 Built in type for the SecurityPermission Attribute.
7226 (code_access_permission_type): Build in type.
7228 2004-10-17 Miguel de Icaza <miguel@ximian.com>
7230 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
7231 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
7232 all of this information into
7233 EmitContext.EmitCapturedVariableInstance.
7235 * codegen.cs (EmitCapturedVariableInstance): move here the
7236 funcionality of emitting an ldarg.0 in the presence of a
7237 remapping. This centralizes the instance emit code.
7239 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
7240 then emit a load of this: it means that we have reached the
7241 topmost ScopeInfo: the one that contains the pointer to the
7242 instance of the class hosting the anonymous method.
7244 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
7245 captures to the topmost CaptureContext.
7247 2004-10-12 Miguel de Icaza <miguel@ximian.com>
7249 * expression.cs (LocalVariableReference): Move the knowledge about
7250 the iterators into codegen's EmitCapturedVariableInstance.
7252 2004-10-11 Miguel de Icaza <miguel@ximian.com>
7254 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
7255 all code paths return a value from an anonymous method (it is the
7256 same as the 161 error, but for anonymous methods).
7258 2004-10-08 Miguel de Icaza <miguel@ximian.com>
7260 The introduction of anonymous methods in the compiler changed
7261 various ways of doing things in the compiler. The most
7262 significant one is the hard split between the resolution phase
7263 and the emission phases of the compiler.
7265 For instance, routines that referenced local variables no
7266 longer can safely create temporary variables during the
7267 resolution phase: they must do so from the emission phase,
7268 since the variable might have been "captured", hence access to
7269 it can not be done with the local-variable operations from the runtime.
7273 (Block.Flags): New flag `IsTopLevel' to indicate that this block
7274 is a toplevel block.
7276 (ToplevelBlock): A new kind of Block, these are the blocks that
7277 are created by the parser for all toplevel method bodies. These
7278 include methods, accessors and anonymous methods.
7280 These contain some extra information not found in regular blocks:
7281 A pointer to an optional CaptureContext (for tracking captured
7282 local variables and parameters). A pointer to the parent
7285 (Return.Resolve): Catch missmatches when returning a value from an
7286 anonymous method (error 1662).
7287 Invoke NeedReturnLabel from the Resolve phase instead of the emit
7290 (Break.Resolve): ditto.
7292 (SwitchLabel): instead of defining the labels during the
7293 resolution phase, we now turned the public ILLabel and ILLabelCode
7294 labels into methods called GetILLabelCode() and GetILLabel() that
7295 only define the label during the Emit phase.
7297 (GotoCase): Track the SwitchLabel instead of the computed label
7298 (its contained therein). Emit the code by using
7299 SwitchLabel.GetILLabelCode ().
7301 (LocalInfo.Flags.Captured): A new flag has been introduce to track
7302 whether the Local has been captured or not.
7304 (LocalInfo.IsCaptured): New property, used to tell whether the
7305 local has been captured.
7307 * anonymous.cs: Vastly updated to contain the anonymous method
7310 The main classes here are: CaptureContext which tracks any
7311 captured information for a toplevel block and ScopeInfo used to
7312 track the activation frames for various local variables.
7314 Each toplevel block has an optional capture context associated
7315 with it. When a method contains an anonymous method both the
7316 toplevel method and the anonymous method will create a capture
7317 context. When variables or parameters are captured, they are
7318 recorded on the CaptureContext that owns them, for example:
7322 MyDelegate d = delegate {
7327 Here `a' will be recorded as captured on the toplevel
7328 CapturedContext, the inner captured context will not have anything
7329 (it will only have data if local variables or parameters from it
7330 are captured in a nested anonymous method.
7332 The ScopeInfo is used to track the activation frames for local
7333 variables, for example:
7335 for (int i = 0; i < 10; i++)
7336 for (int j = 0; j < 10; j++){
7337 MyDelegate d = delegate {
7342 At runtime this captures a single captured variable `i', but it
7343 captures 10 different versions of the variable `j'. The variable
7344 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
7345 recorded on a child.
7347 The toplevel ScopeInfo will also track information like the `this'
7348 pointer if instance variables were referenced (this is necessary
7349 as the anonymous method lives inside a nested class in the host
7350 type of the method).
7352 (AnonymousMethod): Expanded to track the Toplevel, implement
7353 `AnonymousMethod.Compatible' to tell whether an anonymous method
7354 can be converted to a target delegate type.
7356 The routine now also produces the anonymous method content
7358 (AnonymousDelegate): A helper class that derives from
7359 DelegateCreation, this is used to generate the code necessary to
7360 produce the delegate for the anonymous method that was created.
7362 * assign.cs: API adjustments for new changes in
7363 Convert.ImplicitStandardConversionExists.
7365 * class.cs: Adjustments to cope with the fact that now toplevel
7366 blocks are of type `ToplevelBlock'.
7368 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
7369 insteda of standard blocks.
7371 Flag errors if params arguments are passed to anonymous methods.
7373 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
7374 `CurrentAnonymousMethod' which points to the current Anonymous
7375 Method. The variable points to the AnonymousMethod class that
7376 holds the code being compiled. It is set in the new EmitContext
7377 created for the anonymous method.
7379 (EmitContext.Phase): Introduce a variable and an enumeration to
7380 assist in enforcing some rules about when and where we are allowed
7381 to invoke certain methods (EmitContext.NeedsReturnLabel is the
7382 only one that enfonces this right now).
7384 (EmitContext.HaveCaptureInfo): new helper method that returns
7385 whether we have a CapturedContext initialized.
7387 (EmitContext.CaptureVariable): New method used to register that a
7388 LocalInfo must be flagged for capturing.
7390 (EmitContext.CapturedParameter): New method used to register that a
7391 parameters must be flagged for capturing.
7393 (EmitContext.CapturedField): New method used to register that a
7394 field must be flagged for capturing.
7396 (EmitContext.HaveCapturedVariables,
7397 EmitContext.HaveCapturedFields): Return whether there are captured
7398 variables or fields.
7400 (EmitContext.EmitMethodHostInstance): This is used to emit the
7401 instance for the anonymous method. The instance might be null
7402 (static methods), this (for anonymous methods that capture nothing
7403 and happen to live side-by-side with the current method body) or a
7404 more complicated expression if the method has a CaptureContext.
7406 (EmitContext.EmitTopBlock): Routine that drives the emission of
7407 code: it will first resolve the top block, then emit any metadata
7408 and then emit the code. The split is done so that we can extract
7409 any anonymous methods and flag any captured variables/parameters.
7411 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
7412 during this phase, the ILGenerator should not be used as labels
7413 and local variables declared here might not be accessible to any
7414 code that is part of an anonymous method.
7416 Exceptions to this include the temporary variables that are
7417 created by some statements internally for holding temporary
7420 (EmitContext.EmitMeta): New routine, in charge of emitting all the
7423 (EmitContext.TemporaryReturn): This method is typically called
7424 from the Emit phase, and its the only place where we allow the
7425 ReturnLabel to be defined other than the EmitMeta. The reason is
7426 that otherwise we would have to duplicate a lot of logic in the
7427 Resolve phases of various methods that today is on the Emit
7430 (EmitContext.NeedReturnLabel): This no longer creates the label,
7431 as the ILGenerator is not valid during the resolve phase.
7433 (EmitContext.EmitThis): Extended the knowledge in this class to
7434 work in anonymous methods in addition to iterators.
7436 (EmitContext.EmitCapturedVariableInstance): This emits whatever
7437 code is necessary on the stack to access the instance to a local
7438 variable (the variable will be accessed as a field).
7440 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
7441 EmitContext.EmitAddressOfParameter): Routines to support
7442 parameters (not completed at this point).
7444 Removals: Removed RemapLocal and RemapLocalLValue. We probably
7445 will also remove the parameters.
7447 * convert.cs (Convert): Define a `ConstantEC' which points to a
7448 null. This is just to prefity some code that uses
7449 ImplicitStandardConversion code and do not have an EmitContext
7452 The idea is to flag explicitly that at that point in time, it is
7453 known that the conversion will not trigger the delegate checking
7454 code in implicit conversions (which requires a valid
7457 Everywhere: pass new EmitContext parameter since
7458 ImplicitStandardConversionExists now requires it to check for
7459 anonymous method conversions.
7461 (Convert.ImplicitStandardConversionExists): If the type of an
7462 expression is the anonymous_method_type, and the type is a
7463 delegate, we invoke the AnonymousMethod.Compatible method to check
7464 whether an implicit conversion is possible.
7466 (Convert.ImplicitConversionStandard): Only do implicit method
7467 group conversions if the language level is not ISO_1.
7469 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
7470 MethodInfo for the Invoke method. used by Delegate and
7473 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
7474 method conversions if the target type is a delegate.
7476 Removed extra debugging nops.
7478 (LocalVariableReference): Turn the `local_info' into a public
7481 Add `prepared' field, the same hack used for FieldExprs to cope
7482 with composed assignments, as Local variables do not necessarily
7483 operate purely on the stack as they used to: they can be captured
7486 Add `temp' for a temporary result, like fields.
7488 Refactor DoResolve and DoResolveLValue into DoResolveBase.
7490 It now copes with Local variables that are captured and emits the
7491 proper instance variable to load it from a field in the captured
7494 (ParameterReference.DoResolveBase): During the resolve phase,
7495 capture parameters if we are in an anonymous method.
7497 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
7498 anonymous method, use the EmitContext helper routines to emit the
7499 parameter reference.
7501 * iterators.cs: Set RemapToProxy to true/false during the
7504 * parameters.cs (GetParameterByName): New helper method.
7506 * typemanager.cs (anonymous_method_type) a new type that
7507 represents an anonyous method. This is always an internal type,
7508 used as a fencepost to test against the anonymous-methodness of an
7511 2004-10-20 Marek Safar <marek.safar@seznam.cz>
7513 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
7515 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
7517 2004-10-18 Martin Baulig <martin@ximian.com>
7519 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
7520 `Type' directly, but call ResolveType() on it.
7521 (Catch.Resolve): Likewise.
7522 (Foreach.Resolve): Likewise.
7524 2004-10-18 Martin Baulig <martin@ximian.com>
7526 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
7527 `Type' directly, but call ResolveType() on it.
7528 (Probe.DoResolve): Likewise.
7529 (ArrayCreation.LookupType): Likewise.
7530 (TypeOf.DoResolve): Likewise.
7531 (SizeOf.DoResolve): Likewise.
7533 2004-10-18 Martin Baulig <martin@ximian.com>
7535 * expression.cs (Invocation.BetterFunction): Put back
7536 TypeManager.TypeToCoreType().
7538 2004-10-18 Raja R Harinath <rharinath@novell.com>
7540 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
7543 2004-10-18 Martin Baulig <martin@ximian.com>
7545 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
7546 `Type' directly, but call ResolveType() on it.
7548 2004-10-18 Martin Baulig <martin@ximian.com>
7550 * class.cs (FieldMember.Define): Don't access the TypeExpr's
7551 `Type' directly, but call ResolveType() on it.
7552 (MemberBase.DoDefine): Likewise.
7554 * expression.cs (New.DoResolve): Don't access the TypeExpr's
7555 `Type' directly, but call ResolveType() on it.
7556 (ComposedCast.DoResolveAsTypeStep): Likewise.
7558 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
7559 `Type' directly, but call ResolveType() on it.
7561 2004-10-17 John Luke <john.luke@gmail.com>
7563 * class.cs (Operator.GetSignatureForError): use CSharpName
7565 * parameter.cs (Parameter.GetSignatureForError): Returns
7566 correct name even if was not defined.
7568 2004-10-13 Raja R Harinath <rharinath@novell.com>
7571 * class.cs (TypeContainer.EmitContext): New property.
7572 (DefineNestedTypes): Create an emitcontext for each part.
7573 (MethodCore.DoDefineParameters): Use container's emitcontext.
7574 Pass type array to InternalParameters.
7575 (MemberBase.DoDefine): Use container's emitcontext.
7576 (FieldMember.Define): Likewise.
7577 (Event.Define): Likewise.
7578 (SetMethod.GetParameterInfo): Change argument to EmitContext.
7579 Pass type array to InternalParameters.
7580 (SetIndexerMethod.GetParameterInfo): Likewise.
7581 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
7582 * delegate.cs (Define): Pass emitcontext to
7583 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
7584 array to InternalParameters.
7585 * expression.cs (ParameterReference.DoResolveBase): Pass
7586 emitcontext to GetParameterInfo.
7587 (ComposedCast.DoResolveAsTypeStep): Remove check on
7588 ec.ResolvingTypeTree.
7589 * parameter.cs (Parameter.Resolve): Change argument to
7590 EmitContext. Use ResolveAsTypeTerminal.
7591 (Parameter.GetSignature): Change argument to EmitContext.
7592 (Parameters.ComputeSignature): Likewise.
7593 (Parameters.ComputeParameterTypes): Likewise.
7594 (Parameters.GetParameterInfo): Likewise.
7595 (Parameters.ComputeAndDefineParameterTypes): Likewise.
7596 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
7597 * support.cs (InternalParameters..ctor): Remove variant that takes
7599 * typemanager.cs (system_intptr_expr): New.
7600 (InitExpressionTypes): Initialize it.
7602 2004-10-12 Chris Toshok <toshok@ximian.com>
7604 * cs-parser.jay: fix location for try_statement and catch_clause.
7606 2004-10-11 Martin Baulig <martin@ximian.com>
7608 * report.cs: Don't make --fatal abort on warnings, we have
7609 -warnaserror for that.
7611 2004-10-07 Raja R Harinath <rharinath@novell.com>
7613 More DeclSpace.ResolveType avoidance.
7614 * decl.cs (MemberCore.InUnsafe): New property.
7615 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
7616 with newly created EmitContext.
7617 (FieldMember.Define): Likewise.
7618 * delegate.cs (Delegate.Define): Likewise.
7619 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
7620 only if normal name-lookup fails.
7621 (TypeExpr.DoResolve): Enable error-checking.
7622 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
7623 (SizeOf.DoResolve): Likewise.
7624 (ComposedCast.DoResolveAsTypeStep): Likewise.
7625 (StackAlloc.DoResolve): Likewise.
7626 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
7627 (Block.Unsafe): New property.
7628 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
7629 (Unsafe): Set 'unsafe' flag of contained block.
7630 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
7631 (Fixed.Resolve): Likewise.
7632 (Catch.Resolve): Likewise.
7633 (Using.ResolveLocalVariableDecls): Likewise.
7634 (Foreach.Resolve): Likewise.
7636 2004-10-05 John Luke <john.luke@gmail.com>
7638 * cs-parser.jay: add location to error CS0175
7640 2004-10-04 Miguel de Icaza <miguel@ximian.com>
7642 * ecore.cs (Expression.Constantity): Add support for turning null
7645 * const.cs (Const.Define): Allow constants to be reference types
7646 as long as the value is Null.
7648 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
7650 * namespace.cs (NamespaceEntry.Using): No matter which warning
7651 level is set, check if this namespace name has already been added.
7653 2004-10-03 Ben Maurer <bmaurer@ximian.com>
7655 * expression.cs: reftype [!=]= null should always use br[true,false].
7658 2004-10-03 Marek Safar <marek.safar@seznam.cz>
7661 * attribute.cs: Enum conversion moved to
7662 GetAttributeArgumentExpression to be applied to the all
7665 2004-10-01 Raja R Harinath <rharinath@novell.com>
7667 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
7668 * class.c (TypeContainer.DefineType): Flag error if
7669 base types aren't accessible due to access permissions.
7670 * decl.cs (DeclSpace.ResolveType): Move logic to
7671 Expression.ResolveAsTypeTerminal.
7672 (DeclSpace.ResolveTypeExpr): Thin layer over
7673 Expression.ResolveAsTypeTerminal.
7674 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
7675 Refactor code into NestedAccess. Use it.
7676 (DeclSpace.NestedAccess): New.
7677 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
7678 argument to silence errors. Check access permissions.
7679 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
7680 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
7681 (Cast.DoResolve): Likewise.
7682 (New.DoResolve): Likewise.
7683 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
7684 (TypeOf.DoResolve): Likewise.
7686 * expression.cs (Invocation.BetterConversion): Return the Type of
7687 the better conversion. Implement section 14.4.2.3 more faithfully.
7688 (Invocation.BetterFunction): Make boolean. Make correspondence to
7689 section 14.4.2.2 explicit.
7690 (Invocation.OverloadResolve): Update.
7691 (Invocation): Remove is_base field.
7692 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
7693 (Invocation.Emit): Likewise.
7695 2004-09-27 Raja R Harinath <rharinath@novell.com>
7697 * README: Update to changes.
7699 2004-09-24 Marek Safar <marek.safar@seznam.cz>
7701 * cs-parser.jay: Reverted 642 warning fix.
7703 2004-09-23 Marek Safar <marek.safar@seznam.cz>
7706 * decl.cs (FindMemberWithSameName): Indexer can have more than
7709 2004-09-23 Marek Safar <marek.safar@seznam.cz>
7711 * expression.cs (LocalVariableReference.DoResolveLValue):
7712 Do not report warning 219 for out values.
7713 (EmptyExpression.Null): New member to avoid extra allocations.
7715 2004-09-23 Marek Safar <marek.safar@seznam.cz>
7717 * cs-parser.jay: Fix wrong warning 642 report.
7719 * cs-tokenizer.cs (CheckNextToken): New helper;
7720 Inspect next character if is same as expected.
7722 2004-09-23 Martin Baulig <martin@ximian.com>
7724 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
7725 (Convert.ImplicitReferenceConversionExists): Likewise.
7727 2004-09-23 Marek Safar <marek.safar@seznam.cz>
7729 * class.cs (Operator.Define): Add error 448 and 559 report.
7731 2004-09-22 Marek Safar <marek.safar@seznam.cz>
7733 * class.cs (MemberBase.IsTypePermitted): New protected
7734 method for checking error CS0610.
7736 2004-09-22 Marek Safar <marek.safar@seznam.cz>
7738 * class.cs (TypeContainer.HasExplicitLayout): New property
7739 Returns whether container has StructLayout attribute set Explicit.
7740 (FieldMember): New abstract class for consts and fields.
7741 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
7742 (Field): Reuse FieldMember.
7744 * const.cs (Const): Reuse FieldMember.
7746 * rootcontext.cs: EmitConstants call moved to class.
7748 2004-09-22 Martin Baulig <martin@ximian.com>
7750 Thanks to Peter Sestoft for this bug report.
7752 * expression.cs (Conditional): If both the `trueExpr' and the
7753 `falseExpr' is a NullLiteral, return a NullLiteral.
7755 2004-09-22 Martin Baulig <martin@ximian.com>
7757 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
7758 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
7759 for the "get_Current" call.
7761 2004-09-22 Martin Baulig <martin@ximian.com>
7763 Marek and me just fixed one of our oldest bugs: #28562 :-)
7765 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
7767 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
7768 we're an EnumConstant, just return that.
7769 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
7770 an EnumConstant. In this case, we need to use GetValueAsEnumType()
7771 to get the value which'll actually be written into the attribute.
7772 However, we have to use GetValue() to access the attribute's value
7775 2004-09-22 Marek Safar <marek.safar@seznam.cz>
7777 * constant.cs (Constant.IsNegative): New abstract property
7780 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
7781 (StackAlloc.DoResolve): Reused IsNegative.
7783 2004-09-21 Martin Baulig <martin@ximian.com>
7785 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
7786 if we're used in an iterator, we may be called from different
7789 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
7790 we actually have an exception block.
7792 2004-09-20 John Luke <jluke@cfl.rr.com>
7794 * class.cs, cs-parser.jay: Improve the error report for 1520:
7795 report the actual line where the error happens, not where the
7798 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
7799 Pass location information that was available elsewhere.
7801 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
7803 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
7804 runtime to delay sign assemblies.
7806 2004-09-19 Miguel de Icaza <miguel@ximian.com>
7808 * cs-parser.jay: Do not report the stack trace, this is barely
7811 2004-08-22 John Luke <john.luke@gmail.com>
7813 * driver.cs : check that a resource id is not already used
7814 before adding it, report CS1508 if it is, bug #63637
7816 2004-09-19 Miguel de Icaza <miguel@ximian.com>
7818 * ecore.cs: Removed dead code.
7820 2004-09-18 Marek Safar <marek.safar@seznam.cz>
7822 * class.cs: Do not report warning CS0067 on the interfaces.
7824 2004-09-16 Marek Safar <marek.safar@seznam.cz>
7826 * cs-parser.jay: Add error 504 report.
7828 2004-09-16 Marek Safar <marek.safar@seznam.cz>
7830 * rootcontext.cs: WarningLevel is 4 by default now.
7832 * statement.cs (Fixed.Resolve): Do not null
7835 2004-09-16 Marek Safar <marek.safar@seznam.cz>
7838 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
7839 deep search when property is not virtual.
7840 (PropertyExpr.ResolveAccessors): Make one call for both
7843 2004-09-15 Marek Safar <marek.safar@seznam.cz>
7846 * statement.cs: Error 152 report constains also location.
7848 2004-09-15 Marek Safar <marek.safar@seznam.cz>
7851 * const.cs: Explicitly set constant as static.
7853 2004-09-15 Marek Safar <marek.safar@seznam.cz>
7856 * cs-parser.jay: Add error 1017 report.
7858 2004-09-15 Marek Safar <marek.safar@seznam.cz>
7860 Fixed bug #59980, #64224
7861 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
7863 * typemanager.cs (IsSpecialMethod): Simplified
7865 2004-09-14 Marek Safar <marek.safar@seznam.cz>
7867 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
7868 condition with better params.
7870 2004-09-14 Marek Safar <marek.safar@seznam.cz>
7873 * attribute.cs (Resolve): Property has to have both
7876 2004-09-14 Martin Baulig <martin@ximian.com>
7878 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
7880 2004-09-14 Marek Safar <marek.safar@seznam.cz>
7883 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
7884 called and is obsolete then this member suppress message
7885 when call is inside next [Obsolete] method or type.
7887 * expression.cs: Use TestObsoleteMethodUsage member.
7889 2004-09-14 Martin Baulig <martin@ximian.com>
7891 * cs-parser.jay: Sync a bit with the GMCS version.
7893 2004-09-14 Martin Baulig <martin@ximian.com>
7895 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
7896 (CSharpParser.yacc_verbose_flag): New public field.
7898 * genericparser.cs: Removed.
7900 2004-09-14 Raja R Harinath <rharinath@novell.com>
7902 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
7904 2004-09-13 Marek Safar <marek.safar@seznam.cz>
7906 * class.cs (MethodCore.CheckBase): Fix bug #65757.
7908 2004-09-10 Martin Baulig <martin@ximian.com>
7910 Backported my MemberName changes from GMCS into MCS.
7912 - we are now using a special `MemberName' class instead of using
7913 strings; in GMCS, the `MemberName' also contains the type
7916 - changed the grammar rules a bit:
7917 * the old `member_name' is now a `namespace_or_type_name':
7918 The rule is that we use `namespace_or_type_name' everywhere
7919 where we expect either a "member name" (GetEnumerator) or a
7920 "member name" with an explicit interface name
7921 (IEnumerable.GetEnumerator).
7922 In GMCS, the explicit interface name may include type arguments
7923 (IEnumerable<T>.GetEnumerator).
7924 * we use `member_name' instead of just `IDENTIFIER' for
7926 The rule is that we use `member_name' wherever a member may
7927 have type parameters in GMCS.
7929 * decl.cs (MemberName): New public class.
7930 (MemberCore.MemberName): New public readonly field.
7931 (MemberCore.ctor): Take a `MemberName' argument, not a string.
7932 (DeclSpace): Likewise.
7934 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
7935 * enum.cs (Enum.ctor): Likewise.
7937 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
7939 (AliasEntry.ctor): Take a MemberName, not an Expression.
7940 (AliasEntry.UsingAlias): Likewise.
7942 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
7943 (IMethodData.MemberName): Changed type from string to MemberName.
7944 (MemberBase.ExplicitInterfaceName): Likewise.
7945 (AbstractPropertyEventMethod.SetupName): Make this private.
7946 (AbstractPropertyEventMethod.ctor): Added `string prefix'
7947 argument; compute the member name here.
7948 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
7949 on the `member.MemberName' and the `prefix'.
7951 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
7953 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
7954 thus, we get a `MemberName' instead of a `string'. These
7955 declarations may have type parameters in GMCS.
7956 (interface_method_declaration, delegate_declaration): Likewise.
7957 (class_declaration, interface_declaration): Likewise.
7958 (method_header): Use `namespace_or_type_name' instead of
7959 `member_name'. We may be an explicit interface implementation.
7960 (property_declaration, event_declaration): Likewise.
7961 (member_name): This is now just an `IDENTIFIER', not a
7962 `namespace_or_type_name'.
7963 (type_name, interface_type): Removed.
7964 (namespace_or_type_name): Return a MemberName, not an Expression.
7965 (primary_expression): Use `member_name' instead of `IDENTIFIER';
7966 call GetTypeExpression() on the MemberName to get an expression.
7967 (IndexerDeclaration.interface_type): Changed type from string to
7969 (MakeName): Operate on MemberName's instead of string's.
7971 2004-09-13 Raja R Harinath <rharinath@novell.com>
7974 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
7975 (NamespaceEntry.Lookup): Add new argument to flag if we want the
7976 lookup to avoid symbols introduced by 'using'.
7977 * rootcontext.cs (NamespaceLookup): Update.
7979 2004-09-12 Marek Safar <marek.safar@seznam.cz>
7981 * class.cs (TypeContainer.DoDefineMembers): Do not call
7982 DefineDefaultConstructor for static classes.
7984 2004-09-12 Marek Safar <marek.safar@seznam.cz>
7986 * attribute.cs (Attribute.Resolve): Add error 653 report.
7988 * class.cs (Class.ApplyAttributeBuilder): Add error 641
7990 (Method.ApplyAttributeBuilder): Add error 685 report.
7991 (Operator.Define): Add error 564 report.
7993 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
7995 * expression.cs (Invocation.DoResolve): Add error
7998 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
8001 2004-09-11 Marek Safar <marek.safar@seznam.cz>
8003 * class.cs (ConstructorInitializer.Resolve):
8004 Wrong error number (515->516).
8006 2004-09-11 Marek Safar <marek.safar@seznam.cz>
8008 * class.cs (Indexer.Define): Add error 631 report.
8010 2004-09-11 Marek Safar <marek.safar@seznam.cz>
8012 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
8014 2004-09-11 Marek Safar <marek.safar@seznam.cz>
8016 * expression.cs (Probe.DoResolve): Add error CS0241 report.
8018 2004-09-10 Marek Safar <marek.safar@seznam.cz>
8020 * cs-parser.jay: Added error CS0241 report.
8022 2004-09-10 Raja R Harinath <rharinath@novell.com>
8024 * cs-parser.jay (fixed_statement): Introduce a scope for the
8025 declaration in the 'fixed' statement.
8027 2004-09-09 Marek Safar <marek.safar@seznam.cz>
8029 * cs-parser.jay: Added CS0230 error report.
8031 2004-09-09 Marek Safar <marek.safar@seznam.cz>
8033 * cs-parser.jay: Added errors CS0231 and CS0257 report.
8035 2004-09-09 Marek Safar <marek.safar@seznam.cz>
8037 * expression.cs (Argument.Resolve): Added error CS0192 and
8040 2004-09-09 Marek Safar <marek.safar@seznam.cz>
8042 C# 2.0 #pragma warning feature
8044 * cs-tokenizer.cs (PreProcessPragma): New method;
8045 Handles #pragma directive.
8047 * report.cs (WarningRegions): New class; Support
8048 class for #pragma warning directive. It tests whether
8049 warning is enabled for a given line.
8051 2004-09-08 Miguel de Icaza <miguel@ximian.com>
8053 * const.cs: Add more descriptive error report, tahnks to
8056 2004-09-08 Marek Safar <marek.safar@seznam.cz>
8058 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
8060 2004-09-07 Miguel de Icaza <miguel@ximian.com>
8062 * expression.cs: Apply patch from Ben: Remove dead code from
8063 ArrayCreation, and remove the TurnintoConstant call in const.cs,
8064 as that code just threw an exception anwyays.
8066 * const.cs: Remove the call to the turnintoconstant, for details
8069 * literal.cs: The type of the null-literal is the null type; So
8070 we use a placeholder type (literal.cs:System.Null, defined here)
8073 * expression.cs (Conditional.DoResolve): Remove some old code that
8074 is no longer needed, conversions have been fixed.
8076 (ArrayCreationExpression.DoResolve): Return false if we fail to
8077 resolve the inner expression.
8079 2004-09-07 Raja R Harinath <rharinath@novell.com>
8082 * cs-parser.jay (delegate_declaration): Record a delegate
8083 declaration as a type declaration.
8084 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
8086 2004-09-06 Miguel de Icaza <miguel@ximian.com>
8088 * parameter.cs: Do not crash if the type can not be resolved.
8090 * expression.cs: Report errors with unsafe pointers, fixes #64896
8092 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
8094 * expression.cs: Pointer arith always needs to do a conv.i
8095 if the operand is a long. fix 65320
8097 2004-09-04 Marek Safar <marek.safar@seznam.cz>
8099 Fixed cs0619-37.cs, cs0619-38.cs
8101 * enum.cs (GetObsoleteAttribute): Removed.
8103 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
8104 on Enum member is double staged. The first is tested member
8107 2004-09-04 Marek Safar <marek.safar@seznam.cz>
8109 Fixed #56986, #63631, #65231
8111 * class.cs: (TypeContainer.AddToMemberContainer): New method,
8112 adds member to name container.
8113 (TypeContainer.AddToTypeContainer): New method, adds type to
8115 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
8116 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
8117 AddOperator): Simplified by reusing AddToMemberContainer.
8118 (TypeContainer.UserDefinedStaticConstructor): Changed to property
8120 (Method.CheckForDuplications): Fixed implementation to test all
8122 (MemberBase): Detection whether member is explicit interface
8123 implementation is now in constructor.
8124 (MemberBase.UpdateMemberName): Handles IndexerName.
8125 (Accessor): Changed to keep also location information.
8126 (AbstractPropertyEventMethod): Is derived from MemberCore.
8127 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
8128 will be emited or not.
8129 (PropertyBase.AreAccessorsDuplicateImplementation):
8130 Tests whether accessors are not in collision with some method.
8131 (Operator): Is derived from MethodCore to simplify common
8134 * decl.cs (Flags.TestMethodDuplication): Test for duplication
8136 (DeclSpace.AddToContainer): Adds the member to defined_names
8137 table. It tests for duplications and enclosing name conflicts.
8139 * enum.cs (EnumMember): Clean up to reuse the base structures
8141 2004-09-03 Martin Baulig <martin@ximian.com>
8143 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
8144 into TypeContainer, to make partial classes work again.
8146 2004-09-03 Martin Baulig <martin@ximian.com>
8148 * rootcontext.cs (RootContext.V2): Removed.
8150 2004-03-23 Martin Baulig <martin@ximian.com>
8152 * expression.cs (Invocation.OverloadResolve): Added `bool
8153 may_fail' argument and use it instead of the Location.IsNull() hack.
8155 2004-09-03 Martin Baulig <martin@ximian.com>
8157 Merged latest changes into gmcs. Please keep this comment in
8158 here, it makes it easier for me to see what changed in MCS since
8159 the last time I merged.
8161 2004-09-03 Raja R Harinath <rharinath@novell.com>
8164 * expression.cs (BetterConversion): Don't allow either conversion
8165 to be null. Remove redundant implicit conversion test when 'q ==
8166 null' -- when this function is invoked, we already know that the
8167 implicit conversion exists.
8168 (BetterFunction): Assume that 'best' is non-null. Remove
8169 redundant reimplementation of IsApplicable when 'best' is null.
8170 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
8171 number of arguments.
8172 (IsAncestralType): Extract from OverloadResolve.
8173 (OverloadResolve): Make robust to the MethodGroupExpr being
8174 unsorted. Implement all the logic of Section 14.5.5.1, and
8175 support overloading of methods from multiple applicable types.
8176 Clean up logic somewhat. Don't pass null methods to BetterFunction.
8178 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
8179 (RealError, Warning): Append type of report to related symbol.
8181 2004-09-03 Marek Safar <marek.safar@seznam.cz>
8183 * enum.cs: Fixed CLS-Compliance checks for enum members.
8184 Error tests cs3008-8.cs, cs3014-8.cs
8186 2004-09-02 Marek Safar <marek.safar@seznam.cz>
8188 Fixed bug #62342, #63102
8189 * class.cs: ImplementIndexer uses member.IsExplicitImpl
8190 like ImplementMethod.
8192 2004-09-02 Marek Safar <marek.safar@seznam.cz>
8194 * attribute.cs (Attribute.GetAttributeArgumentExpression):
8197 2004-09-02 Martin Baulig <martin@ximian.com>
8199 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
8200 TypeManager.GetArgumentTypes() rather than calling GetParameters()
8203 2004-09-01 Marek Safar <marek.safar@seznam.cz>
8205 C# 2.0 Static classes implemented
8207 * class.cs (TypeContainer): instance_constructors,
8208 initialized_fields, initialized_static_fields,
8209 default_constructor, base_inteface_types are protected to be
8210 accessible from StaticClass.
8211 (TypeContainer.DefineDefaultConstructor): New virtual method
8212 for custom default constructor generating
8213 (StaticClass): New class to handle "Static classes" feature.
8215 * cs-parser.jay: Handle static keyword on class like instance
8218 * driver.cs: Added "/langversion" command line switch with two
8219 options (iso-1, default).
8221 2004-08-31 Marek Safar <marek.safar@seznam.cz>
8223 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
8225 2004-08-31 Miguel de Icaza <miguel@ximian.com>
8227 * delegate.cs: Style.
8229 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
8231 * delegate.cs: Add seperate instance expr field for miguel.
8233 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
8235 * PointerArithmetic (Resolve): make sure we are not doing
8236 pointer arith on void*. Also, make sure we are resolved
8237 by not setting eclass until resolve.
8239 All callers: Make sure that PointerArithmetic gets resolved.
8241 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
8243 * ArrayCreation (LookupType): If the type does not resolve
8244 to an array, give an error.
8246 2004-08-27 Marek Safar <marek.safar@seznam.cz>
8248 * statement.cs (Try.Resolve): Fixed bug #64222
8250 2004-08-27 Martin Baulig <martin@ximian.com>
8253 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
8256 2004-08-26 Marek Safar <marek.safar@seznam.cz>
8258 * ecore.cs (Constantify): Get underlying type via
8259 System.Enum.GetUnderlyingType to avoid StackOverflow on the
8260 Windows in special cases.
8262 2004-08-26 Marek Safar <marek.safar@seznam.cz>
8264 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
8265 for obtaining also private methods.
8266 (GetRemoveMethod): Used GetRemoveMethod (true)
8267 for obtaining also private methods.
8269 2004-08-24 Martin Baulig <martin@ximian.com>
8271 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
8272 MethodAttributes.HideBySig for operators.
8274 2004-08-23 Martin Baulig <martin@ximian.com>
8276 Back to the old error reporting system :-)
8278 * report.cs (Message): Removed.
8279 (Report.MessageData, ErrorData, WarningData): Removed.
8280 (Report.Error, Warning): Back to the old system.
8282 2004-08-23 Martin Baulig <martin@ximian.com>
8284 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
8286 * class.cs (TypeContainer.ParentContainer): New public virtual
8287 method; replaces the explicit interface implementation.
8288 (ClassPart.ParentContainer): Override.
8290 2004-08-23 Martin Baulig <martin@ximian.com>
8292 * statement.cs (Switch): Added support for constant switches; see
8293 #59428 or test-285.cs.
8295 2004-08-22 Marek Safar <marek.safar@seznam.cz>
8298 * statement.cs (GetEnumeratorFilter): Removed useless
8299 logic because C# specs is strict. GetEnumerator must be
8302 2004-08-22 Martin Baulig <martin@ximian.com>
8304 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
8305 a switch and may break, reset the barrier. Fixes #59867.
8307 2004-08-22 Marek Safar <marek.safar@seznam.cz>
8309 CLS-Compliance speed up (~5% for corlib)
8311 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
8312 New method. Tests container for CLS-Compliant names
8314 * class.cs (TypeContainer.VerifyClsName): New method.
8315 Checks whether container name is CLS Compliant.
8316 (Constructor): Implements IMethodData.
8318 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
8319 low-case table for CLS Compliance test.
8320 (MemberCache.VerifyClsParameterConflict): New method.
8321 Checks method parameters for CS3006 error.
8323 * enum.cs (EnumMember): Is derived from MemberCore.
8324 (Enum.VerifyClsName): Optimized for better performance.
8326 2004-08-06 Marek Safar <marek.safar@seznam.cz>
8328 * report.cs: Renamed Error_T to Error and changed all
8331 2004-08-06 Marek Safar <marek.safar@seznam.cz>
8333 * class.cs (TypeContainer.IndexerArrayList): New inner class
8334 container for indexers.
8335 (TypeContainer.DefaultIndexerName): New constant for default
8336 indexer name. Replaced all "Item" with this constant.
8337 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
8339 * typemanager.cs (TypeManager.default_member_ctor): Cache here
8340 DefaultMemberAttribute constructor.
8342 2004-08-05 Martin Baulig <martin@ximian.com>
8344 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
8347 2004-08-05 Marek Safar <marek.safar@seznam.cz>
8349 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
8350 multi platforms problem.
8352 * compiler.csproj: Included shared files.
8354 2004-08-04 Marek Safar <marek.safar@seznam.cz>
8356 Fix bug 60333, 55971 in the more general way
8357 * attribute.cs (Attribute.GetAttributeArgumentExpression):
8358 Added arg_type argument for constant conversion.
8359 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
8361 2004-08-04 Marek Safar <marek.safar@seznam.cz>
8364 * class.cs (TypeContainer ): New inner classes MethodArrayList,
8365 OperatorArrayList, MethodCoreArrayList for typecontainer
8366 containers. Changed class member types to these new types.
8367 (MethodArrayList.DefineMembers): Added test for CS0659.
8369 2004-08-04 Miguel de Icaza <miguel@ximian.com>
8371 * cfold.cs: Synchronize the folding with the code in expression.cs
8372 Binary.DoNumericPromotions for uint operands.
8374 * attribute.cs: Revert patch from Raja, it introduced a regression
8375 while building Blam-1.2.1 (hard to isolate a test case).
8377 2004-08-04 Marek Safar <marek.safar@seznam.cz>
8381 (TypeContainer.Define): Renamed to DefineContainerMembers because of
8383 (MethodCore.parent_method): New member. The method we're overriding
8384 if this is an override method.
8385 (MethodCore.CheckBase): Moved from Method class and made common.
8386 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
8388 (MethodCore.CheckForDuplications): New abstract method. For custom
8389 member duplication search in a container
8390 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
8391 method and its return type.
8392 (Event.conflict_symbol): New member. Symbol with same name in the
8396 (MemberCache.FindMemberWithSameName): New method. The method
8397 is looking for conflict with inherited symbols.
8399 2004-08-04 Martin Baulig <martin@ximian.com>
8401 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
8403 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
8405 2004-08-03 Marek Safar <marek.safar@seznam.cz>
8407 * report.cs (Message): New enum for better error, warning reference in
8409 (MessageData): New inner abstract class. It generally handles printing of
8410 error and warning messages.
8411 Removed unused Error, Warning, Message methods.
8413 2004-08-03 Marek Safar <marek.safar@seznam.cz>
8415 Fix for cs0592-8.cs test
8417 (Attributable.ValidAttributeTargets): Made public.
8418 (Attribute.ExplicitTarget): New member for explicit target value.
8419 (Attribute.CheckTargets): Now we translate explicit attribute
8420 target to Target here.
8422 2004-08-03 Ben Maurer <bmaurer@ximian.com>
8424 * ecore.cs (MethodGroupExpr): new IsBase property.
8426 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
8428 * delegate.cs (DelegateCreation): store a MethodGroupExpr
8429 rather than an instance expr.
8431 (DelegateCreation.Emit): Use the method group rather than
8432 the instance expression. Also, if you have base.Foo as the
8433 method for a delegate, make sure to emit ldftn, not ldftnvirt.
8435 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
8437 (NewDelegate.DoResolve): Only check for the existance of Invoke
8438 if the method is going to be needed. Use MethodGroupExpr.
8440 (NewDelegate.Emit): Remove, DelegateCreation implements this.
8442 * expression.cs: For pointer arith., make sure to use
8443 the size of the type, not the size of the pointer to
8446 2004-08-03 Marek Safar <marek.safar@seznam.cz>
8449 * class.cs (Class): Added error CS0502 test.
8451 2004-08-03 John Luke <jluke@cfl.rr.com>
8452 Raja R Harinath <rharinath@novell.com>
8455 * attribute.cs (Attribute.complained_before): New flag.
8456 (Attribute.ResolveType, Attribute.Resolve),
8457 (Attribute.DefinePInvokeMethod): Set it.
8458 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
8460 2004-08-03 Martin Baulig <martin@ximian.com>
8462 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
8463 use a user-defined operator; we still need to do numeric
8464 promotions in case one argument is a builtin type and the other
8465 one has an implicit conversion to that type. Fixes #62322.
8467 2004-08-02 Martin Baulig <martin@ximian.com>
8469 * statement.cs (LocalInfo.Flags): Added `IsThis'.
8470 (LocalInfo.IsThis): New public property.
8471 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
8473 2004-08-01 Martin Baulig <martin@ximian.com>
8475 * class.cs (TypeContainer.GetClassBases): Don't set the default
8476 here since we may get called from GetPartialBases().
8477 (TypeContainer.DefineType): If GetClassBases() didn't return a
8478 parent, use the default one.
8480 2004-07-30 Duncan Mak <duncan@ximian.com>
8482 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
8484 2004-07-30 Martin Baulig <martin@ximian.com>
8486 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
8488 * class.cs (SourceMethod): New public class, derive from the
8489 symbol writer's ISourceMethod.
8490 (Method): Use the new symbol writer API.
8492 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
8493 as argument and use the new symbol writer.
8496 (SourceFile): Implement the symbol writer's ISourceFile.
8497 (Location.SymbolDocument): Removed.
8498 (Location.SourceFile): New public property.
8500 * symbolwriter.cs: Use the new symbol writer API.
8502 2004-07-30 Raja R Harinath <rharinath@novell.com>
8504 * Makefile (install-local): Remove. Functionality moved to
8507 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
8509 * Makefile: Install mcs.exe.config file together with mcs.exe.
8510 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
8511 correct runtime version.
8513 2004-07-25 Martin Baulig <martin@ximian.com>
8516 (TypeContainer.RegisterOrder): Removed, this was unused.
8517 (TypeContainer, interface_order): Removed.
8518 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
8519 TypeContainer as argument since we can also be called with a
8520 `PartialContainer' for a partial class/struct/interface.
8521 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
8522 of checking whether we're an `Interface' - we could be a
8524 (PartialContainer.Register): Override; call
8525 AddClass()/AddStruct()/AddInterface() on our parent.
8527 * cs-parser.jay (interface_member_declaration): Add things to the
8528 `current_container', not the `current_class'.
8530 * rootcontext.cs (RegisterOrder): The overloaded version which
8531 takes an `Interface' was unused, removed.
8533 * typemanager.cs (TypeManager.LookupInterface): Return a
8534 `TypeContainer', not an `Interface'.
8535 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
8536 contain a `PartialContainer' for an interface, so check it's
8537 `Kind' to figure out what it is.
8539 2004-07-25 Martin Baulig <martin@ximian.com>
8541 * class.cs (Class.DefaultTypeAttributes): New public constant.
8542 (Struct.DefaultTypeAttributes): Likewise.
8543 (Interface.DefaultTypeAttributes): Likewise.
8544 (PartialContainer.TypeAttr): Override this and add the
8545 DefaultTypeAttributes.
8547 2004-07-25 Martin Baulig <martin@ximian.com>
8549 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
8550 we can just use the `Parent' field instead.
8552 2004-07-25 Martin Baulig <martin@ximian.com>
8554 * class.cs (TypeContainer.Emit): Renamed to EmitType().
8556 2004-07-25 Martin Baulig <martin@ximian.com>
8558 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
8559 our parts before defining any methods.
8560 (TypeContainer.VerifyImplements): Make this virtual.
8561 (ClassPart.VerifyImplements): Override and call VerifyImplements()
8562 on our PartialContainer.
8564 2004-07-25 Martin Baulig <martin@ximian.com>
8566 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
8568 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
8569 argument, we can just use the `Parent' field instead.
8572 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
8573 (MemberBase.DoDefine): Likewise.
8575 2004-07-24 Martin Baulig <martin@ximian.com>
8577 * decl.cs (MemberCore.Parent): New public field.
8578 (DeclSpace.Parent): Moved to MemberCore.
8580 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
8581 (MemberBase.ctor): Added TypeContainer argument, pass it to our
8583 (FieldBase, Field, Operator): Likewise.
8584 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
8585 (EventField, Event): Likewise.
8587 2004-07-23 Martin Baulig <martin@ximian.com>
8589 * class.cs (PartialContainer): New public class.
8590 (ClassPart): New public class.
8591 (TypeContainer): Added support for partial classes.
8592 (TypeContainer.GetClassBases): Splitted some of the functionality
8593 out into GetNormalBases() and GetPartialBases().
8595 * cs-tokenizer.cs (Token.PARTIAL): New token.
8596 (Tokenizer.consume_identifier): Added some hacks to recognize
8597 `partial', but only if it's immediately followed by `class',
8598 `struct' or `interface'.
8600 * cs-parser.jay: Added support for partial clases.
8602 2004-07-23 Martin Baulig <martin@ximian.com>
8604 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
8605 a `DeclSpace' and also made it readonly.
8606 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
8607 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
8608 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
8610 * cs-parser.jay: Pass the `current_class', not the
8611 `current_container' (at the moment, this is still the same thing)
8612 to a new Method, Property, Event, Indexer or Constructor.
8614 2004-07-23 Martin Baulig <martin@ximian.com>
8616 * cs-parser.jay (CSharpParser): Added a new `current_class' field
8617 and removed the `current_interface' one.
8618 (struct_declaration, class_declaration, interface_declaration):
8619 Set `current_class' to the newly created class/struct/interface;
8620 set their `Bases' and call Register() before parsing their body.
8622 2004-07-23 Martin Baulig <martin@ximian.com>
8624 * class.cs (Kind): New public enum.
8625 (TypeContainer): Made this class abstract.
8626 (TypeContainer.Kind): New public readonly field.
8627 (TypeContainer.CheckDef): New public method; moved here from
8629 (TypeContainer.Register): New public abstract method.
8630 (TypeContainer.GetPendingImplementations): New public abstract
8632 (TypeContainer.GetClassBases): Removed the `is_class' and
8633 `is_iface' parameters.
8634 (TypeContainer.DefineNestedTypes): Formerly known as
8636 (ClassOrStruct): Made this class abstract.
8638 * tree.cs (RootTypes): New public type.
8640 2004-07-20 Martin Baulig <martin@ximian.com>
8642 * tree.cs (Tree.RecordNamespace): Removed.
8643 (Tree.Namespaces): Removed.
8645 * rootcontext.cs (RootContext.IsNamespace): Removed.
8647 * cs-parser.jay (namespace_declaration): Just create a new
8648 NamespaceEntry here.
8650 2004-07-20 Martin Baulig <martin@ximian.com>
8652 * statement.cs (ExceptionStatement): New abstract class. This is
8653 now used as a base class for everyone who's using `finally'.
8654 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
8655 our local variables before using them.
8657 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
8658 virtual method. This is used by Yield.Resolve() to "steal" an
8659 outer block's `finally' clauses.
8660 (FlowBranchingException): The .ctor now takes an ExceptionStatement
8663 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
8664 version which takes an ExceptionStatement. This version must be
8665 used to create exception branchings.
8668 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
8669 (Iterator.EmitMoveNext): Added exception support; protect the
8670 block with a `fault' clause, properly handle 'finally' clauses.
8671 (Iterator.EmitDispose): Run all the `finally' clauses here.
8673 2004-07-20 Martin Baulig <martin@ximian.com>
8675 * iterator.cs: This is the first of a set of changes in the
8676 iterator code. Match the spec more closely: if we're an
8677 IEnumerable, then GetEnumerator() must be called. The first time
8678 GetEnumerator() is called, it returns the current instance; all
8679 subsequent invocations (if any) must create a copy.
8681 2004-07-19 Miguel de Icaza <miguel@ximian.com>
8683 * expression.cs: Resolve the constant expression before returning
8686 2004-07-19 Martin Baulig <martin@ximian.com>
8688 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
8689 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
8690 the return type of the new EmitContext.
8692 2004-07-18 Martin Baulig <martin@ximian.com>
8694 * class.cs (Property.Define): Fix iterators.
8696 * iterators.cs (Iterator.Define): Moved the
8697 `container.AddInterator (this)' call here from the .ctor; only do
8698 it if we resolved successfully.
8700 2004-07-17 Miguel de Icaza <miguel@ximian.com>
8702 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
8703 `true' for preprocessing directives that we parse. The return
8704 value indicates whether we should return to regular tokenizing or
8705 not, not whether it was parsed successfully.
8707 In the past if we were in: #if false ... #line #endif, we would
8708 resume parsing after `#line'. See bug 61604.
8710 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
8711 building: IsEnumType should return true only for enums, not for
8712 enums or System.Enum itself. This fixes #61593.
8714 Likely what happened is that corlib was wrong: mcs depended on
8715 this bug in some places. The bug got fixed, we had to add the
8716 hack, which caused bug 61593.
8718 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
8719 that was a workaround for the older conditions.
8721 2004-07-16 Ben Maurer <bmaurer@ximian.com>
8723 * assign.cs: IAssignMethod has a new interface, as documented
8724 inline. All assignment code now uses this new api.
8726 * ecore.cs, expression.cs: All classes which implement
8727 IAssignMethod now use the new interface.
8729 * expression.cs (Invocation): add a hack to EmitCall so that
8730 IndexerAccess can be the target of a compound assignment without
8731 evaluating its arguments twice.
8733 * statement.cs: Handle changes in Invocation api.
8735 2004-07-16 Martin Baulig <martin@ximian.com>
8737 * iterators.cs: Rewrote this. We're now using one single Proxy
8738 class for both the IEnumerable and the IEnumerator interface and
8739 `Iterator' derives from Class so we can use the high-level API.
8741 * class.cs (TypeContainer.AddIterator): New method.
8742 (TypeContainer.DoDefineType): New protected virtual method, which
8743 is called from DefineType().
8744 (TypeContainer.DoDefineMembers): Call DefineType() and
8745 DefineMembers() on all our iterators.
8746 (TypeContainer.Emit): Call Emit() on all our iterators.
8747 (TypeContainer.CloseType): Call CloseType() on all our iterators.
8749 * codegen.cs (EmitContext.CurrentIterator): New public field.
8751 2004-07-15 Martin Baulig <martin@ximian.com>
8754 (TypeManager.not_supported_exception_type): New type.
8756 2004-07-14 Martin Baulig <martin@ximian.com>
8758 * iterators.cs: Use real error numbers.
8760 2004-07-14 Martin Baulig <martin@ximian.com>
8762 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
8763 requires this to be a System.Collection.IEnumerable and not a
8764 class implementing that interface.
8765 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
8767 2004-07-13 Marek Safar <marek.safar@seznam.cz>
8769 * class.cs: Fixed previous fix, it broke some error tests.
8771 2004-07-12 Martin Baulig <martin@ximian.com>
8773 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
8776 2004-07-09 Miguel de Icaza <miguel@ximian.com>
8778 * assign.cs (LocalTemporary): Add new argument: is_address,If
8779 `is_address' is true, then the value that we store is the address
8780 to the real value, and not the value itself.
8782 * ecore.cs (PropertyExpr): use the new local temporary
8783 stuff to allow us to handle X.Y += z (where X is a struct)
8785 2004-07-08 Martin Baulig <martin@ximian.com>
8787 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
8788 not always return, just like we're doing in Using.Resolve().
8790 2004-07-07 Miguel de Icaza <miguel@ximian.com>
8792 * cs-parser.jay (fixed_statement): flag this as Pinned.
8794 2004-07-06 Miguel de Icaza <miguel@ximian.com>
8796 * typemanager.cs (TypeManager): Removed MakePinned method, this
8797 mechanism is replaced with the .NET 2.x compatible mechanism of
8798 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
8800 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
8801 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
8802 `IsFixed' property which has a different meaning.
8804 2004-07-02 Raja R Harinath <rharinath@novell.com>
8806 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
8807 visible from inside a nested class, not just the names of the
8808 immediately enclosing class.
8811 2004-06-24 Raja R Harinath <rharinath@novell.com>
8813 * expression.cs (BetterConversion): Remove buggy special-case
8814 handling of "implicit constant expression conversions". At this
8815 point, we already know that the conversion is possible -- we're
8816 only checking to see which is better.
8818 2004-06-24 Marek Safar <marek.safar@seznam.cz>
8820 * cs-parser.jay: Added error CS0210 test.
8822 2004-06-24 Marek Safar <marek.safar@seznam.cz>
8824 * cs-parser.jay: Added error CS0134 test.
8826 2004-06-24 Marek Safar <marek.safar@seznam.cz>
8829 * cs-parser.jay: Added error CS0145 test.
8831 2004-06-24 Marek Safar <marek.safar@seznam.cz>
8833 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
8835 2004-06-23 Ben Maurer <bmaurer@ximian.com>
8837 * expression.cs (StackAlloc.Resolve): The argument may not
8838 be a constant; deal with this case.
8840 2004-06-23 Marek Safar <marek.safar@seznam.cz>
8842 * attribute.cs (IndexerName_GetIndexerName): Renamed to
8843 GetIndexerAttributeValue.
8844 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
8846 * class.cs (Indexer.Define): Added error tests for CS0415,
8849 2004-06-23 Miguel de Icaza <miguel@ximian.com>
8851 * attribute.cs (Attribute.Resolve): Keep field code in sync with
8854 2004-06-23 Martin Baulig <martin@ximian.com>
8856 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
8857 neither return nor throw, reset the barrier as well. Fixes #60457.
8859 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
8861 * class.cs : EventAttributes is now set to None by default.
8862 This fixes bug #60459.
8864 2004-06-18 Marek Safar <marek.safar@seznam.cz>
8867 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
8868 Don't throw exception but return null (it's sufficient now).
8870 2004-06-18 Marek Safar <marek.safar@seznam.cz>
8872 * typemanager.cs (GetArgumentTypes): Faster implementation.
8874 2004-06-18 Martin Baulig <martin@ximian.com>
8876 * attribute.cs (Attribute.Resolve): Check whether we're an
8877 EmptyCast which a Constant child. Fixes #60333.
8879 2004-06-17 Ben Maurer <bmaurer@ximian.com>
8881 * statement.cs (EmitCollectionForeach): Account for the fact that
8882 not all valuetypes are in areas which we can take the address of.
8883 For these variables, we store to a temporary variable. Also, make
8884 sure that we dont emit a `callvirt' on a valuetype method.
8886 2004-06-15 Marek Safar <marek.safar@seznam.cz>
8888 * expression.cs (StackAlloc.DoReSolve): Added test for
8889 negative parameter (CS0247).
8891 2004-06-15 Marek Safar <marek.safar@seznam.cz>
8894 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
8896 2004-06-15 Marek Safar <marek.safar@seznam.cz>
8899 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
8902 2004-06-14 Marek Safar <marek.safar@seznam.cz>
8904 Fix bug #58254 & cs1555.cs, cs1556.cs
8905 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
8907 2004-06-14 Marek Safar <marek.safar@seznam.cz>
8909 * cs-parser.jay: Added error CS1669 test for indexers.
8911 2004-06-11 Martin Baulig <martin@ximian.com>
8913 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
8914 call this twice: for params and varargs methods.
8916 2004-06-11 Marek Safar <marek.safar@seznam.cz>
8919 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
8921 2004-06-11 Marek Safar <marek.safar@seznam.cz>
8923 * attribute.cs (Attribute.GetValidTargets): Made public.
8926 (AbstractPropertyEventMethod): New class for better code sharing.
8927 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
8929 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
8931 2004-06-11 Raja R Harinath <rharinath@novell.com>
8934 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
8935 that the call to Resolve is part of a MemberAccess.
8936 (Expression.Resolve): Use it for SimpleName resolution.
8937 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
8938 Add 'intermediate' boolean argument.
8939 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
8940 error message when the SimpleName can be resolved ambiguously
8941 between an expression and a type.
8942 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
8944 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
8945 call on the left-side.
8947 2004-06-11 Marek Safar <marek.safar@seznam.cz>
8950 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
8952 2004-06-11 Marek Safar <marek.safar@seznam.cz>
8954 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
8956 2004-06-11 Martin Baulig <martin@ximian.com>
8958 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
8959 varargs methods if applicable.
8961 2004-06-11 Martin Baulig <martin@ximian.com>
8963 * expression.cs (Invocation.EmitCall): Don't use
8964 `method.CallingConvention == CallingConventions.VarArgs' since the
8965 method could also have `CallingConventions.HasThis'.
8967 2004-06-11 Marek Safar <marek.safar@seznam.cz>
8969 * class.cs (Event.GetSignatureForError): Implemented.
8970 Fixed crash in error test cs3010.cs
8972 2004-06-10 Miguel de Icaza <miguel@ximian.com>
8974 * cs-tokenizer.cs: Change the way we track __arglist to be
8975 consistent with the other keywords.
8977 2004-06-09 Miguel de Icaza <miguel@ximian.com>
8979 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
8982 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
8984 * codegen.cs: Check that all referenced assemblies have a strongname
8985 before strongnaming the compiled assembly. If not report error CS1577.
8986 Fix bug #56563. Patch by Jackson Harper.
8987 * typemanager.cs: Added a method to return all referenced assemblies.
8988 Fix bug #56563. Patch by Jackson Harper.
8990 2004-06-08 Marek Safar <marek.safar@seznam.cz>
8993 (Method.ApplyAttributeBuilder): Moved and added conditional
8994 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
8997 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
8999 2004-06-08 Marek Safar <marek.safar@seznam.cz>
9002 * class.cs: (EventField.attribute_targets): Changed default target.
9004 2004-06-08 Martin Baulig <martin@ximian.com>
9006 * expression.cs (Invocation.EmitCall): Enable varargs methods.
9008 2004-06-08 Martin Baulig <martin@ximian.com>
9010 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
9012 2004-06-07 Martin Baulig <martin@ximian.com>
9014 Added support for varargs methods.
9016 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
9019 * cs-parser.jay: Added support for `__arglist'.
9021 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
9023 * expression.cs (Argument.AType): Added `ArgList'.
9024 (Invocation): Added support for varargs methods.
9025 (ArglistAccess): New public class.
9026 (Arglist): New public class.
9028 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
9030 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
9031 a method's top-level block if the method has varargs.
9033 * support.cs (ReflectionParameters, InternalParameters): Added
9034 support for varargs methods.
9036 2004-06-07 Miguel de Icaza <miguel@ximian.com>
9038 * class.cs: Provide location in indexer error report.
9040 * driver.cs: Use standard names.
9042 * namespace.cs: Catch the use of using after a namespace has been
9043 declared also on using aliases.
9045 2004-06-03 Raja R Harinath <rharinath@novell.com>
9048 * typemanager.cs (closure_private_ok, closure_invocation_type)
9049 (closure_qualifier_type, closure_invocation_assembly)
9050 (FilterWithClosure): Move to ...
9051 (Closure): New internal nested class.
9052 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
9053 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
9054 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
9055 (MemberLookup, MemberLookupFailed): Use it.
9056 * expression.cs (New.DoResolve): Treat the lookup for the
9057 constructor as being qualified by the 'new'ed type.
9058 (Indexers.GetIndexersForTypeOrInterface): Update.
9060 2004-06-03 Marek Safar <marek.safar@seznam.cz>
9063 (GetConditionalAttributeValue): New method. Returns
9064 condition of ConditionalAttribute.
9065 (SearchMulti): New method. Returns all attributes of type 't'.
9066 Use it when attribute is AllowMultiple = true.
9067 (IsConditionalMethodExcluded): New method.
9070 (Method.IsExcluded): Implemented. Returns true if method has conditional
9071 attribute and the conditions is not defined (method is excluded).
9072 (IMethodData): Extended interface for ConditionalAttribute support.
9073 (PropertyMethod.IsExcluded): Implemented.
9076 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
9079 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
9082 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
9084 * expression.cs (ArrayCreationExpression): Make this just an
9085 `expression'. It can't be a statement, so the code here was
9088 2004-06-02 Marek Safar <marek.safar@seznam.cz>
9091 * typemanager.cs (GetFullNameSignature): New method for
9094 2004-06-02 Marek Safar <marek.safar@seznam.cz>
9097 * class.cs (MemberBase.GetSignatureForError): New virtual method.
9098 Use this method when MethodBuilder is null.
9099 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
9100 Added test for error CS0626 (MONO reports error for this situation).
9101 (IMethodData.GetSignatureForError): Extended interface.
9103 2004-06-01 Marek Safar <marek.safar@seznam.cz>
9106 (AttributeTester.GetObsoleteAttribute): Returns instance of
9107 ObsoleteAttribute when type is obsolete.
9110 (TypeContainer.VerifyObsoleteAttribute): Override.
9111 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
9112 (MethodCode.VerifyObsoleteAttribute): Override.
9113 (MemberBase.VerifyObsoleteAttribute): Override.
9116 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
9117 and report proper error.
9120 Delegate.VerifyObsoleteAttribute): Override.
9123 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
9124 and report proper error.
9125 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
9128 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
9132 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
9133 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
9134 Added test for ObsoleteAttribute.
9137 (Catch): Derived from Statement.
9139 2004-06-01 Marek Safar <marek.safar@seznam.cz>
9141 Fixed bug #59071 & cs0160.cs
9143 * statement.cs (Try.Resolve): Check here whether order of catch
9144 clauses matches their dependencies.
9146 2004-05-31 Miguel de Icaza <miguel@ximian.com>
9148 * Reverted patch to namespace.cs (Use lookuptypedirect). This
9149 caused a regression: #59343. Referencing nested classes from an
9150 assembly stopped working.
9152 2004-05-31 Martin Baulig <martin@ximian.com>
9154 MCS is now frozen for beta 2.
9156 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
9158 * convert.cs: add a trivial cache for overload operator resolution.
9160 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
9162 * decl.cs: If possible, use lookuptypedirect here. We can only do
9163 this if there is no `.' after the namespace. Avoids using
9164 LookupType, which does lots of slow processing.
9165 (FindNestedType) New method, does what it says :-).
9166 * namespace.cs: use LookupTypeDirect.
9167 * rootcontext.cs: use membercache, if possible.
9168 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
9170 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
9173 According to the spec,
9175 In a member access of the form E.I, if E is a single identifier,
9176 and if the meaning of E as a simple-name (§7.5.2) is a constant,
9177 field, property, localvariable, or parameter with the same type as
9178 the meaning of E as a type-name (§3.8), then both possible
9179 meanings of E are permitted.
9181 We did not check that E as a simple-name had the same type as E as
9184 This trivial check gives us 5-7% on bootstrap time.
9186 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
9188 * expression.cs (Invocation.OverloadResolve): Avoid the
9189 use of hashtables and boxing here by allocating on demand.
9191 2004-05-30 Martin Baulig <martin@ximian.com>
9193 * rootcontext.cs (RootContext.LookupType): Don't cache things if
9194 we're doing a silent lookup. Don't try to lookup nested types in
9195 TypeManager.object_type (thanks to Ben Maurer).
9197 2004-05-30 Martin Baulig <martin@ximian.com>
9199 Committing a patch from Ben Maurer.
9201 * rootcontext.cs (RootContext.LookupType): Cache negative results.
9203 2004-05-29 Martin Baulig <martin@ximian.com>
9205 * class.cs (IMethodData.ShouldIgnore): New method.
9207 * typemanager.cs (TypeManager.MethodFlags): Don't take a
9208 `Location' argument, we don't need it anywhere. Use
9209 `IMethodData.ShouldIgnore ()' instead of
9210 `MethodData.GetMethodFlags ()'.
9211 (TypeManager.AddMethod): Removed.
9212 (TypeManager.AddMethod2): Renamed to AddMethod.
9214 2004-05-29 Martin Baulig <martin@ximian.com>
9216 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
9218 * convert.cs (Convert.ImplicitReferenceConversion): If we're
9219 converting from a class type S to an interface type and we already
9220 have an object on the stack, don't box it again. Fixes #52578.
9222 2004-05-29 Martin Baulig <martin@ximian.com>
9224 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
9225 Added support for `params' parameters. Fixes #59267.
9227 2004-05-29 Martin Baulig <martin@ximian.com>
9229 * literal.cs (NullPointer): Provide a private .ctor which sets
9230 `type' to TypeManager.object_type. Fixes #59048.
9232 2004-05-29 Martin Baulig <martin@ximian.com>
9234 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
9235 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
9237 * ecore.cs (EventExpr.instance_expr): Make the field private.
9239 2004-05-26 Marek Safar <marek.safar@seznam.cz>
9241 Fixed bug #50080 & cs0214-2.cs
9242 * expression.cs (Cast.DoResolve): Check unsafe context here.
9244 * statement.cs (Resolve.DoResolve): Likewise.
9246 2004-05-26 Martin Baulig <martin@ximian.com>
9248 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
9250 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
9251 (RootContext.LookupType): Pass down the `silent' flag.
9253 2004-05-25 Martin Baulig <martin@ximian.com>
9256 (MethodGroupExpr.IdenticalTypeName): New public property.
9257 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
9258 expression actually refers to a type.
9260 2004-05-25 Martin Baulig <martin@ximian.com>
9262 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
9263 for #56176 and made it actually work.
9265 2004-05-25 Martin Baulig <martin@ximian.com>
9267 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
9268 (FieldExpr, PropertyExpr): Override and implement
9269 CacheTemporaries. Fixes #52279.
9271 2004-05-25 Miguel de Icaza <miguel@ximian.com>
9273 * location.cs: In the new compiler listing a file twice is a
9274 warning, not an error.
9276 2004-05-24 Martin Baulig <martin@ximian.com>
9278 * enum.cs (Enum.DefineType): For the `BaseType' to be a
9279 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
9281 2004-05-24 Martin Baulig <martin@ximian.com>
9283 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
9284 walking the `using' list. Fixes #53921.
9286 2004-05-24 Martin Baulig <martin@ximian.com>
9288 * const.cs (Const.LookupConstantValue): Added support for
9289 EmptyCast's; fixes #55251.
9291 2004-05-24 Martin Baulig <martin@ximian.com>
9293 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
9294 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
9295 which does the CS0135 check. The reason is that we first need to
9296 check whether the variable actually exists.
9298 2004-05-24 Martin Baulig <martin@ximian.com>
9300 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
9301 than RootContext.LookupType() to find the explicit interface
9304 2004-05-24 Raja R Harinath <rharinath@novell.com>
9306 * Makefile: Simplify. Use executable.make.
9307 * mcs.exe.sources: New file. List of sources of mcs.exe.
9309 2004-05-24 Anders Carlsson <andersca@gnome.org>
9313 Use the invariant culture when doing String.Compare for CLS case
9316 2004-05-23 Martin Baulig <martin@ximian.com>
9318 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
9319 don't have any dots. Fixes #52622, added cs0246-8.cs.
9321 * namespace.cs (NamespaceEntry.Lookup): Likewise.
9323 2004-05-23 Marek Safar <marek.safar@seznam.cz>
9325 * class.cs (MemberBase.Define): Reuse MemberType member for
9326 resolved type. Other methods can use it too.
9328 2004-05-23 Martin Baulig <martin@ximian.com>
9330 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
9331 the variable also exists in the current block (otherwise, we need
9332 to report a CS0103). Fixes #58670.
9334 2004-05-23 Martin Baulig <martin@ximian.com>
9336 * flowanalysis.cs (Reachability.Reachable): Compute this
9337 on-the-fly rather than storing it as a field.
9339 2004-05-23 Martin Baulig <martin@ximian.com>
9341 * flowanalysis.cs (Reachability.And): Manually compute the
9342 resulting `barrier' from the reachability.
9344 2004-05-23 Marek Safar <marek.safar@seznam.cz>
9347 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
9348 instance of ObsoleteAttribute when symbol is obsolete.
9351 (IMethodData): Extended interface for ObsoleteAttribute support.
9353 2004-05-22 Marek Safar <marek.safar@seznam.cz>
9355 * attribute.cs: Fix bug #55970
9357 2004-05-22 Marek Safar <marek.safar@seznam.cz>
9361 (GetObsoleteAttribute): New method. Creates the instance of
9363 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
9364 ObsoleteAttribute when member is obsolete.
9365 (AttributeTester.Report_ObsoleteMessage): Common method for
9366 Obsolete error/warning reporting.
9369 (TypeContainer.base_classs_type): New member for storing parent type.
9372 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
9373 for this MemberCore.
9375 2004-05-21 Marek Safar <marek.safar@seznam.cz>
9377 * attribute.cs, const.cs: Fix bug #58590
9379 2004-05-21 Martin Baulig <martin@ximian.com>
9381 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
9382 out parameters if the end of the method is unreachable. Fixes
9385 2004-05-21 Marek Safar <marek.safar@seznam.cz>
9387 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
9388 Hari was right, why extra method.
9390 2004-05-21 Marek Safar <marek.safar@seznam.cz>
9392 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
9394 2004-05-20 Martin Baulig <martin@ximian.com>
9396 Merged this back from gmcs to keep the differences to a minumum.
9398 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
9399 instead of a Declspace.
9400 (Attribute.ResolveType): Likewise.
9401 (Attributes.Search): Likewise.
9402 (Attributes.Contains): Likewise.
9403 (Attributes.GetClsCompliantAttribute): Likewise.
9405 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
9407 (MethodData.ApplyAttributes): Take an EmitContext instead of a
9410 2004-05-19 Marek Safar <marek.safar@seznam.cz>
9412 Fix bug #58688 (MCS does not report error when the same attribute
9415 * attribute.cs (Attribute.Emit): Distinction between null and default.
9417 2004-05-19 Raja R Harinath <rharinath@novell.com>
9419 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
9420 of a top-level attribute without an attribute target.
9421 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
9423 (Attribute.Conditional_GetConditionName),
9424 (Attribute.Obsolete_GetObsoleteMessage): Update.
9425 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
9426 part of ScanForIndexerName.
9427 (Attribute.CanIgnoreInvalidAttribute): New function.
9428 (Attribute.ScanForIndexerName): Move to ...
9429 (Attributes.ScanForIndexerName): ... here.
9430 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
9431 (Attributes.Search): New internal variant that can choose not to
9432 complain if types aren't resolved. The original signature now
9434 (Attributes.GetClsCompliantAttribute): Use internal variant, with
9435 complaints suppressed.
9436 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
9437 only if it not useful.
9438 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
9439 top-level for attributes that are shared between the assembly
9440 and a top-level class.
9441 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
9442 * class.cs: Update to reflect changes.
9443 (DefineIndexers): Fuse loops.
9444 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
9445 a couple more variants of attribute names.
9447 2004-05-18 Marek Safar <marek.safar@seznam.cz>
9449 Fix bug #52585 (Implemented explicit attribute declaration)
9452 (Attributable.ValidAttributeTargets): New abstract method. It gets
9453 list of valid attribute targets for explicit target declaration.
9454 (Attribute.Target): It holds target itself.
9455 (AttributeSection): Removed.
9456 (Attribute.CheckTargets): New method. It checks whether attribute
9457 target is valid for the current element.
9460 (EventProperty): New class. For events that are declared like
9461 property (with add and remove accessors).
9462 (EventField): New class. For events that are declared like field.
9465 * cs-parser.jay: Implemented explicit attribute target declaration.
9467 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
9468 Override ValidAttributeTargets.
9471 (ReturnParameter): Class for applying custom attributes on
9473 (ParameterAtribute): New class. Class for applying custom
9474 attributes on the parameter type.
9476 2004-05-17 Miguel de Icaza <miguel@ximian.com>
9478 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
9481 (Method): Allow UNSAFE here.
9483 * modifiers.cs: Support unsafe reporting.
9485 2004-05-17 Marek Safar <marek.safar@seznam.cz>
9487 * decl.cs: Fix bug #58478.
9489 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9491 * statement.cs: When checking for unreachable code on an EmptyStatement,
9492 set the location. Fixes bug #58488.
9494 2004-05-13 Miguel de Icaza <miguel@ximian.com>
9496 * driver.cs: Add -pkg handling.
9498 From Gonzalo: UseShelLExecute=false
9500 2004-05-12 Marek Safar <marek.safar@seznam.cz>
9503 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
9505 (Attribute.IsClsCompliaceRequired): Moved to base for better
9507 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
9508 when attribute is AttributeUsageAttribute.
9509 (Attribute.GetValidTargets): Simplified.
9510 (Attribute.GetAttributeUsage): New method returns AttributeUsage
9511 attribute for this type.
9512 (Attribute.ApplyAttributes): Method renamed to Emit and make
9514 (GlobalAttributeSection): New class for special handling of global
9515 attributes (assembly, module).
9516 (AttributeSection.Emit): New method.
9518 * class.cs: Implemented Attributable abstract methods.
9519 (MethodCore.LabelParameters): Moved to Parameter class.
9520 (Accessor): Is back simple class.
9521 (PropertyMethod): Implemented Attributable abstract class.
9522 (DelegateMethod): Implemented Attributable abstract class.
9523 (Event): New constructor for disctintion between normal Event
9524 and Event with accessors.
9526 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
9528 * codegen.cs, const.cs, decl.cs, delegate.cs:
9529 (CommonAssemblyModulClass): Implemented Attributable abstract class
9532 * enum.cs: Implement IAttributeSupport interface.
9533 (EnumMember): New class for emum members. Implemented Attributable
9537 (ParameterBase): Is abstract.
9538 (ReturnParameter): New class for easier [return:] attribute handling.
9540 * typemanager.cs: Removed builder_to_attr.
9542 2004-05-11 Raja R Harinath <rharinath@novell.com>
9545 * attribute.cs (Attribute.GetPositionalValue): New function.
9546 * class.cs (TypeContainer.VerifyMembers): New function.
9547 (TypeContainer.Emit): Use it.
9548 (ClassOrStruct): New base class for Class and Struct.
9549 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
9550 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
9552 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
9553 then each non-static field should have a FieldOffset attribute.
9554 Otherwise, none of the fields should have a FieldOffset attribute.
9555 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
9556 and FieldOffset attributes.
9557 * typemanager.cs (TypeManager.struct_layout_attribute_type)
9558 (TypeManager.field_offset_attribute_type): New core types.
9559 (TypeManager.InitCoreTypes): Initialize them.
9561 2004-05-11 Michal Moskal <malekith@pld-linux.org>
9563 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
9564 Return correct type.
9567 2004-05-09 Miguel de Icaza <miguel@ximian.com>
9569 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
9570 be implicitly converted to ulong.
9572 * expression.cs: The logic for allowing operator &, | and ^ worked
9573 was wrong, it worked before because we did not report an error in
9574 an else branch. Fixes 57895.
9576 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
9577 allow volatile fields to be reference types.
9579 2004-05-07 Miguel de Icaza <miguel@ximian.com>
9581 * driver.cs: Add support for /debug-
9583 2004-05-07 Raja R Harinath <rharinath@novell.com>
9585 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
9586 Add a 'complain' parameter to silence errors.
9587 (Attribute.Resolve): Update to changes. Put in sanity check to catch
9588 silently overlooked type-resolutions.
9589 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
9591 (Attributes.Search): New function.
9592 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
9593 (Attributes.GetAttributeFullName): Remove hack.
9594 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
9595 Update to reflect changes.
9596 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
9597 Use Attributes.Search instead of nested loops.
9599 2004-05-07 Marek Safar <marek.safar@seznam.cz>
9602 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
9603 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
9604 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
9606 * report.cs: (Report.Warning): Renamed to Warning_T because of
9607 parameter collision.
9609 2004-05-05 Raja R Harinath <rharinath@novell.com>
9611 * expression.cs (MemberAccess.ResolveMemberAccess):
9612 Exit with non-zero status after Report.Error.
9613 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
9615 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
9617 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
9619 * support.cs: Don't hang when the file is empty.
9621 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
9623 * support.cs: In SeekableStreamReader, compute the preamble size of the
9624 underlying stream. Position changes should take into account that initial
9627 2004-05-03 Todd Berman <tberman@sevenl.net>
9629 * driver.cs: remove unused GetSysVersion function.
9631 2004-05-03 Todd Berman <tberman@sevenl.net>
9633 * driver.cs: Remove the hack from saturday, as well as the hack
9634 from jackson (LoadAssemblyFromGac), also adds the CWD to the
9635 link_paths to get that bit proper.
9637 2004-05-01 Todd Berman <tberman@sevenl.net>
9639 * driver.cs: Try a LoadFrom before a Load, this checks the current
9640 path. This is currently a bug in mono that is be fixed, however, this
9641 provides a workaround for now. This will be removed when the bug
9644 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
9646 * CryptoConvert.cs: Updated to latest version. Fix issue with
9647 incomplete key pairs (#57941).
9649 2004-05-01 Todd Berman <tberman@sevenl.net>
9651 * driver.cs: Remove '.' from path_chars, now System.* loads properly
9654 2004-04-30 Jackson Harper <jackson@ximian.com>
9656 * codegen.cs: Open keys readonly.
9658 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9660 * typemanager.cs: don't report cyclic struct layout when a struct
9661 contains 2 or more fields of the same type. Failed for Pango.AttrShape
9662 which has 2 Pango.Rectangle fields.
9664 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
9666 * expression.cs: Handle IntPtr comparisons with IL code
9667 rather than a method call.
9669 2004-04-29 Martin Baulig <martin@ximian.com>
9671 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
9672 the list of PropertyInfo's in class hierarchy and find the
9673 accessor. Fixes #56013.
9675 2004-04-29 Martin Baulig <martin@ximian.com>
9677 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
9679 2004-04-29 Martin Baulig <martin@ximian.com>
9681 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
9683 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
9685 2004-04-29 Martin Baulig <martin@ximian.com>
9687 * class.cs (ConstructorInitializer.Resolve): Check whether the
9688 parent .ctor is accessible. Fixes #52146.
9690 2004-04-29 Martin Baulig <martin@ximian.com>
9692 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
9694 * statement.cs (Using.EmitLocalVariableDecls): Use
9695 TypeManager.idisposable_type, not typeof (IDisposable).
9696 (Foreach.EmitCollectionForeach): Added support for valuetypes.
9698 2004-04-29 Martin Baulig <martin@ximian.com>
9700 * class.cs (Event.Define): Don't emit the field and don't set
9701 RTSpecialName and SpecialName for events on interfaces. Fixes
9704 2004-04-29 Raja R Harinath <rharinath@novell.com>
9706 Refactor Attribute.ApplyAttributes.
9707 * attribute.cs (Attributable): New base class for objects that can
9708 have Attributes applied on them.
9709 (Attribute): Make AttributeUsage fields public.
9710 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
9711 (Attribute.IsInternalCall): New property.
9712 (Attribute.UsageAttr): Convert to a public read-only property.
9713 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
9714 (Attribute.ResolveType, Attribute.Resolve)
9715 (Attribute.ScanForIndexerName): Update to reflect changes.
9716 (Attribute.CheckAttributeTarget): Re-format.
9717 (Attribute.ApplyAttributes): Refactor, to various
9718 Attributable.ApplyAttributeBuilder methods.
9719 * decl.cs (MemberCore): Make Attributable.
9720 * class.cs (Accessor): Make Attributable.
9721 (MethodData.ApplyAttributes): Use proper attribute types, not
9723 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
9724 (TypeContainer.ApplyAttributeBuilder)
9725 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
9726 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
9727 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
9728 (Operator.ApplyAttributeBuilder): New factored-out methods.
9729 * const.cs (Const.ApplyAttributeBuilder): Likewise.
9730 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
9731 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
9732 * parameter.cs (ParameterBase): New Attributable base class
9733 that can also represent Return types.
9734 (Parameter): Update to the changes.
9736 2004-04-29 Jackson Harper <jackson@ximian.com>
9738 * driver.cs: Prefer the corlib system version when looking for
9739 assemblies in the GAC. This is still a hack, but its a better hack
9742 2004-04-29 Marek Safar <marek.safar@seznam.cz>
9744 * decl.cs, enum.cs: Improved error 3005 reporting.
9746 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
9747 (related_symbols): New private member for list of symbols
9748 related to reported error/warning.
9750 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
9752 2004-04-29 Martin Baulig <martin@ximian.com>
9754 * ecore.cs (Expression.Constantify): If we're an enum and
9755 TypeManager.TypeToCoreType() doesn't give us another type, use
9756 t.UnderlyingSystemType. Fixes #56178.
9758 2004-04-29 Martin Baulig <martin@ximian.com>
9760 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
9761 interfaces and for each interface, only add members directly
9762 declared in that interface. Fixes #53255.
9764 2004-04-28 Martin Baulig <martin@ximian.com>
9766 * expression.cs (ConditionalLogicalOperator): Use a temporary
9767 variable for `left' to avoid that we evaluate it more than once;
9770 2004-04-28 Martin Baulig <martin@ximian.com>
9772 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
9775 2004-04-28 Martin Baulig <martin@ximian.com>
9777 * statement.cs (LocalInfo.Resolve): Check whether the type is not
9780 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
9781 whether the type is not void (CS1547).
9783 2004-04-28 Martin Baulig <martin@ximian.com>
9785 * expression.cs (Unary.DoResolveLValue): Override this and report
9786 CS0131 for anything but Operator.Indirection.
9788 2004-04-28 Martin Baulig <martin@ximian.com>
9790 Committing a patch from Ben Maurer; see bug #50820.
9792 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
9795 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
9798 2004-04-28 Martin Baulig <martin@ximian.com>
9800 Committing a patch from Ben Maurer; see bug #50820.
9802 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
9805 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
9808 2004-04-28 Martin Baulig <martin@ximian.com>
9810 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
9811 (Block.AddLabel): Call DoLookupLabel() to only search in the
9814 2004-04-28 Martin Baulig <martin@ximian.com>
9816 * cfold.cs (ConstantFold.BinaryFold): Added special support for
9817 comparing StringConstants and NullLiterals in Equality and Inequality.
9819 2004-04-28 Jackson Harper <jackson@ximian.com>
9821 * driver.cs: Attempt to load referenced assemblies from the
9822 GAC. This is the quick and dirty version of this method that
9823 doesnt take into account versions and just takes the first
9824 canidate found. Will be good enough for now as we will not have more
9825 then one version installed into the GAC until I update this method.
9827 2004-04-28 Martin Baulig <martin@ximian.com>
9829 * typemanager.cs (TypeManager.CheckStructCycles): New public
9830 static method to check for cycles in the struct layout.
9832 * rootcontext.cs (RootContext.PopulateTypes): Call
9833 TypeManager.CheckStructCycles() for each TypeContainer.
9834 [Note: We only need to visit each type once.]
9836 2004-04-28 Martin Baulig <martin@ximian.com>
9838 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
9840 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
9841 success and added `out object value'. Use a `bool resolved' field
9842 to check whether we've already been called rather than
9843 `ConstantValue != null' since this breaks for NullLiterals.
9845 2004-04-28 Raja R Harinath <rharinath@novell.com>
9847 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
9848 setting of this flag, since the 'set' method may be non-public.
9850 2004-04-28 Raja R Harinath <rharinath@novell.com>
9852 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
9853 check on current_vector.Block.
9855 2004-04-27 Martin Baulig <martin@ximian.com>
9857 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
9858 a field initializer. Fixes #56459.
9860 2004-04-27 Martin Baulig <martin@ximian.com>
9862 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
9863 we're not attempting to use an indexer. Fixes #52154.
9865 2004-04-27 Martin Baulig <martin@ximian.com>
9867 * statement.cs (Return): Don't create a return label if we don't
9868 need it; reverts my change from January 20th. Thanks to Ben
9871 2004-04-27 Martin Baulig <martin@ximian.com>
9873 According to the spec, `goto' can only leave a nested scope, but
9876 * statement.cs (Block.LookupLabel): Only lookup in the current
9877 block, don't recurse into parent or child blocks.
9878 (Block.AddLabel): Check in parent and child blocks, report
9879 CS0140/CS0158 if we find a duplicate.
9880 (Block): Removed this indexer for label lookups.
9881 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
9882 this already does the error reporting for us.
9885 (FlowBranching.UsageVector.Block): New public variable; may be null.
9886 (FlowBranching.CreateSibling): Added `Block' argument.
9887 (FlowBranching.LookupLabel): New public virtual method. Lookup a
9888 label for the target of a `goto' and check whether we're not
9889 leaving a `finally'.
9891 2004-04-27 Martin Baulig <martin@ximian.com>
9893 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
9894 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
9897 2004-04-27 Martin Baulig <martin@ximian.com>
9899 * statement.cs (Block.AddLabel): Also check for implicit blocks
9900 and added a CS0158 check.
9902 2004-04-27 Martin Baulig <martin@ximian.com>
9904 * flowanalysis.cs (FlowBranchingLoop): New class.
9905 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
9906 UsageVector's instead of an ArrayList.
9907 (FlowBranching.Label): Likewise.
9908 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
9909 (FlowBranching.AddBreakVector): New method.
9911 2004-04-27 Miguel de Icaza <miguel@ximian.com>
9913 * attribute.cs: Small regression fix: only convert the type if we
9914 the type is different, fixes System.Drawing build.
9916 2004-04-27 Martin Baulig <martin@ximian.com>
9918 * attribute.cs (Attribute.Resolve): If we have a constant value
9919 for a named field or property, implicity convert it to the correct
9922 2004-04-27 Raja R Harinath <rharinath@novell.com>
9924 * statement.cs (Block.Block): Implicit blocks share
9925 'child_variable_names' fields with parent blocks.
9926 (Block.AddChildVariableNames): Remove.
9927 (Block.AddVariable): Mark variable as "used by a child block" in
9928 every surrounding block.
9929 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
9930 been used in a child block, complain about violation of "Invariant
9931 meaning in blocks" rule.
9932 * cs-parser.jay (declare_local_variables): Don't use
9933 AddChildVariableNames.
9934 (foreach_statement): Don't create an implicit block: 'foreach'
9937 2004-04-23 Miguel de Icaza <miguel@ximian.com>
9939 * convert.cs (ImplicitNumericConversion): 0 is also positive when
9940 converting from 0L to ulong. Fixes 57522.
9942 2004-04-22 Marek Safar <marek.safar@seznam.cz>
9944 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
9945 derived class hides via 'new' keyword field from base class (test-242.cs).
9946 TODO: Handle this in the more general way.
9948 * class.cs (CheckBase): Ditto.
9950 2004-04-22 Marek Safar <marek.safar@seznam.cz>
9952 * decl.cs (caching_flags): New member for storing cached values
9954 (MemberCore.Flags): New enum where bit flags for caching_flags
9956 (MemberCore.cls_compliance): Moved to caching_flags.
9957 (DeclSpace.Created): Moved to caching_flags.
9959 * class.cs: Use caching_flags instead of DeclSpace.Created
9961 2004-04-21 Miguel de Icaza <miguel@ximian.com>
9963 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
9964 if we are only a derived class, not a nested class.
9966 * typemanager.cs: Same as above, but do this at the MemberLookup
9967 level (used by field and methods, properties are handled in
9968 PropertyExpr). Allow for the qualified access if we are a nested
9971 2004-04-21 Marek Safar <marek.safar@seznam.cz>
9973 * class.cs: Refactoring.
9974 (IMethodData): New inteface; Holds links to parent members
9975 to avoid member duplication (reduced memory allocation).
9976 (Method): Implemented IMethodData interface.
9977 (PropertyBase): New inner classes for get/set methods.
9978 (PropertyBase.PropertyMethod): Implemented IMethodData interface
9979 (Event): New inner classes for add/remove methods.
9980 (Event.DelegateMethod): Implemented IMethodData interface.
9982 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
9983 EmitContext (related to class.cs refactoring).
9985 2004-04-21 Raja R Harinath <rharinath@novell.com>
9987 * delegate.cs (Delegate.VerifyApplicability): If the number of
9988 arguments are the same as the number of parameters, first try to
9989 verify applicability ignoring any 'params' modifier on the last
9993 2004-04-16 Raja R Harinath <rharinath@novell.com>
9995 * class.cs (TypeContainer.AddIndexer): Use
9996 'ExplicitInterfaceName' to determine if interface name was
9997 explicitly specified. 'InterfaceType' is not initialized at this time.
9998 (TypeContainer.DefineIndexers): Remove use of temporary list. The
9999 Indexers array is already in the required order. Initialize
10000 'IndexerName' only if there are normal indexers.
10001 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
10002 (TypeContainer.Emit): Emit DefaultMember attribute only if
10003 IndexerName is initialized.
10006 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
10008 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
10011 2004-04-15 Raja R Harinath <rharinath@novell.com>
10013 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
10017 * attribute.cs (Attribute.Resolve): Check for duplicate named
10021 2004-04-15 Miguel de Icaza <miguel@ximian.com>
10023 * iterators.cs (MarkYield): track whether we are in an exception,
10024 and generate code accordingly. Use a temporary value to store the
10025 result for our state.
10027 I had ignored a bit the interaction of try/catch with iterators
10028 since their behavior was not entirely obvious, but now it is
10029 possible to verify that our behavior is the same as MS .NET 2.0
10033 2004-04-14 Miguel de Icaza <miguel@ximian.com>
10035 * iterators.cs: Avoid creating temporaries if there is no work to
10038 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
10039 Enumerations, use TypeManager.EnumToUnderlying and call
10042 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
10045 (This.Emit): Use EmitContext.EmitThis to emit our
10048 (This.EmitAssign): Ditto.
10050 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
10051 codepaths, we will move all the functionality into
10054 (FieldExpr.EmitAssign): Ditto.
10056 This fixes several hidden bugs that I uncovered while doing a code
10057 review of this today.
10059 * codegen.cs (EmitThis): reworked so the semantics are more clear
10060 and also support value types "this" instances.
10062 * iterators.cs: Changed so that for iterators in value types, we
10063 do not pass the value type as a parameter.
10065 Initialization of the enumerator helpers is now done in the caller
10066 instead of passing the parameters to the constructors and having
10067 the constructor set the fields.
10069 The fields have now `assembly' visibility instead of private.
10071 2004-04-11 Miguel de Icaza <miguel@ximian.com>
10073 * expression.cs (Argument.Resolve): Check if fields passed as ref
10074 or out are contained in a MarshalByRefObject.
10076 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
10077 another compiler type.
10079 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
10081 * class.cs (Indexer.Define): use the new name checking method.
10082 Also, return false on an error.
10083 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
10084 (is_identifier_[start/part]_character): make static.
10086 2004-04-10 Miguel de Icaza <miguel@ximian.com>
10088 * expression.cs (Binary.ResolveOperator): Do no append strings
10089 twice: since we can be invoked more than once (array evaluation)
10090 on the same concatenation, take care of this here. Based on a fix
10091 from Ben (bug #56454)
10093 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
10095 * codegen.cs: Fix another case where CS1548 must be reported (when
10096 delay-sign isn't specified and no private is available #56564). Fix
10097 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
10098 error when MCS is used on the MS runtime and we need to delay-sign
10099 (which seems unsupported by AssemblyBuilder - see #56621).
10101 2004-04-08 Marek Safar <marek.safar@seznam.cz>
10103 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
10104 (TypeManager.ComputeNamespaces): Faster implementation for
10107 * compiler.csproj: Updated AssemblyName to mcs.
10109 2004-04-07 Miguel de Icaza <miguel@ximian.com>
10111 * rootcontext.cs: Add new types to the boot resolution.
10113 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
10114 MulticastDelegate is not allowed.
10116 * typemanager.cs: Add new types to lookup: System.TypedReference
10119 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
10120 check for TypedReference or ArgIterator, they are not allowed.
10122 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
10123 makes us properly catch 1510 in some conditions (see bug 56016 for
10126 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
10128 * CryptoConvert.cs: update from corlib version
10131 2004-04-05 Miguel de Icaza <miguel@ximian.com>
10133 * class.cs (Indexer.Define): Check indexername declaration
10135 2004-04-05 Marek Safar <marek.safar@seznam.cz>
10137 * attribute.cs (IsClsCompliant): Fixed problem with handling
10138 all three states (compliant, not-compliant, undetected).
10140 2004-03-30 Marek Safar <marek.safar@seznam.cz>
10142 * attribute.cs (Attribute): Location is now public.
10143 (Resolve): Store resolved arguments (pos_values) in attribute class.
10144 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
10145 (GetClsCompliantAttributeValue): New method that gets
10146 CLSCompliantAttribute value.
10147 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
10148 if exists else null.
10149 (AttributeTester): New class for CLS-Compliant verification routines.
10151 * class.cs (Emit): Add CLS-Compliant verification.
10152 (Method.GetSignatureForError): Implemented.
10153 (Constructor.GetSignatureForError): Implemented
10154 (Constructor.HasCompliantArgs): Returns if constructor has
10155 CLS-Compliant arguments.
10156 (Constructor.Emit): Override.
10157 (Construcor.IsIdentifierClsCompliant): New method; For constructors
10158 is needed to test only parameters.
10159 (FieldBase.GetSignatureForError): Implemented.
10160 (TypeContainer): New member for storing base interfaces.
10161 (TypeContainer.FindMembers): Search in base interfaces too.
10163 * codegen.cs (GetClsComplianceAttribute): New method that gets
10164 assembly or module CLSCompliantAttribute value.
10165 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
10167 (ModuleClass.Emit): Add error 3012 test.
10169 * const.cs (Emit): Override and call base for CLS-Compliant tests.
10171 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
10172 state for all decl types.
10173 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
10174 if CLS-Compliant tests are required.
10175 (IsClsCompliaceRequired): New method. Analyze whether code
10176 must be CLS-Compliant.
10177 (IsExposedFromAssembly): New method. Returns true when MemberCore
10178 is exposed from assembly.
10179 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
10180 value or gets cached value.
10181 (HasClsCompliantAttribute): New method. Returns true if MemberCore
10182 is explicitly marked with CLSCompliantAttribute.
10183 (IsIdentifierClsCompliant): New abstract method. This method is
10184 used to testing error 3005.
10185 (IsIdentifierAndParamClsCompliant): New method. Common helper method
10186 for identifier and parameters CLS-Compliant testing.
10187 (VerifyClsCompliance): New method. The main virtual method for
10188 CLS-Compliant verifications.
10189 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
10190 null. I don't know why is null (too many public members !).
10191 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
10192 and get value of first CLSCompliantAttribute that found.
10194 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
10195 (VerifyClsCompliance): Override and add extra tests.
10197 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
10198 clscheck- disable CLS-Compliant verification event if assembly is has
10199 CLSCompliantAttribute(true).
10201 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
10202 ApllyAttribute is now called in emit section as in the other cases.
10203 Possible future Emit integration.
10204 (IsIdentifierClsCompliant): New override.
10205 (VerifyClsCompliance): New override.
10206 (GetEnumeratorName): Returns full enum name.
10208 * parameter.cs (GetSignatureForError): Implemented.
10210 * report.cs (WarningData): New struct for Warning message information.
10211 (LocationOfPreviousError): New method.
10212 (Warning): New method. Reports warning based on the warning table.
10213 (Error_T): New method. Reports error based on the error table.
10215 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
10216 verifications are done here.
10218 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
10220 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
10221 CLSCompliantAttribute.
10222 (all_imported_types): New member holds all imported types from other
10224 (LoadAllImportedTypes): New method fills static table with exported types
10225 from all referenced assemblies.
10226 (Modules): New property returns all assembly modules.
10228 2004-03-30 Miguel de Icaza <miguel@ximian.com>
10230 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
10231 throwing a parser error.
10233 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
10234 which removes the hardcoded get_/set_ prefixes for properties, as
10235 IL allows for the properties to be named something else.
10239 * expression.cs: Do not override operand before we know if it is
10240 non-null. Fix 56207
10242 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
10244 * typemanager.cs: support for pinned variables.
10246 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
10248 * decl.cs, typemanager.cs: Avoid using an arraylist
10249 as a buffer if there is only one result set.
10251 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
10253 * expression.cs: Make sure you cant call a static method
10254 with an instance expression, bug #56174.
10256 2004-03-29 Miguel de Icaza <miguel@ximian.com>
10258 * class.cs (IsDuplicateImplementation): Improve error reporting to
10259 flag 663 (method only differs in parameter modifier).
10261 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
10262 in preprocessor directives.
10264 * location.cs (LookupFile): Allow for the empty path.
10266 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
10267 better approach for some of that patch, but its failing with the
10268 CharSet enumeration. For now try/catch will do.
10270 * typemanager.cs: Do not crash if a struct does not have fields.
10273 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
10275 * expression.cs: cs0213, cant fix a fixed expression.
10278 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
10280 * cs-parser.jay: detect invalid embeded statements gracefully.
10283 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
10285 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
10288 the invocation type may not be a subclass of the tye of the item/
10289 The type of the item must be a subclass of the invocation item.
10294 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
10296 * attribute.cs: Added methods to get a string and a bool from an
10297 attribute. Required to information from AssemblyKeyFileAttribute,
10298 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
10299 * codegen.cs: Modified AssemblyName creation to include support for
10300 strongnames. Catch additional exceptions to report them as CS1548.
10301 * compiler.csproj: Updated include CryptoConvert.cs.
10302 * compiler.csproj.user: Removed file - user specific configuration.
10303 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
10304 Mono.Security assembly. The original class is maintained and tested in
10305 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
10306 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
10307 like CSC 8.0 (C# v2) supports.
10308 * Makefile: Added CryptoConvert.cs to mcs sources.
10309 * rootcontext.cs: Added new options for strongnames.
10311 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
10313 * driver.cs: For --expect-error, report error code `2'
10314 if the program compiled with no errors, error code `1' if
10315 it compiled with an error other than the one expected.
10317 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
10319 * compiler.csproj: Updated for Visual Studio .NET 2003.
10320 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
10321 * compiler.sln: Updated for Visual Studio .NET 2003.
10323 2004-03-24 Ravi Pratap M <ravi@ximian.com>
10325 * expression.cs: Fix bug #47234. We basically need to apply the
10326 rule that we prefer the conversion of null to a reference type
10327 when faced with a conversion to 'object' (csc behaviour).
10329 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
10331 * statement.cs: Shorter form for foreach, eliminates
10332 a local variable. r=Martin.
10334 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
10336 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
10337 checks if we can use brtrue/brfalse to test for 0.
10338 * expression.cs: use the above in the test for using brtrue/brfalse.
10339 cleanup code a bit.
10341 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
10343 * expression.cs: Rewrite string concat stuff. Benefits:
10345 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
10346 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
10347 rather than a concat chain.
10349 * typemanager.cs: Add lookups for more concat overloads.
10351 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
10353 * expression.cs: Emit shorter il code for array init.
10370 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
10372 * statement.cs: Before, two switch blocks would be merged if the
10373 total size of the blocks (end_item - begin_item + 1) was less than
10374 two times the combined sizes of the blocks.
10376 Now, it will only merge if after the merge at least half of the
10381 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
10383 * class.cs : csc build fix for GetMethods(). See bug #52503.
10385 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
10387 * expression.cs: Make sure fp comparisons work with NaN.
10388 This fixes bug #54303. Mig approved this patch a long
10389 time ago, but we were not able to test b/c the runtime
10392 2004-03-19 Miguel de Icaza <miguel@ximian.com>
10394 * ecore.cs (TypExpr.GetHashCode): implement this overload.
10396 2004-03-19 Martin Baulig <martin@ximian.com>
10398 * class.cs (MemberCore.IsDuplicateImplementation): Report the
10399 error here and not in our caller.
10401 2004-03-19 Martin Baulig <martin@ximian.com>
10403 * interface.cs: Completely killed this file.
10404 (Interface): We're now a TypeContainer and live in class.cs.
10406 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
10407 argument; we're now also called for interfaces.
10408 (TypeContainer.DefineMembers): Allow this method being called
10410 (TypeContainer.GetMethods): New public method; formerly known as
10411 Interface.GetMethod(). This is used by PendingImplementation.
10412 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
10413 it's now private and non-static.
10414 (Interface): Moved this here; it's now implemented similar to
10416 (Method, Property, Event, Indexer): Added `bool is_interface'
10417 argument to their .ctor's.
10418 (MemberBase.IsInterface): New public field.
10420 * cs-parser.jay: Create normal Method, Property, Event, Indexer
10421 instances instead of InterfaceMethod, InterfaceProperty, etc.
10422 (opt_interface_base): Removed; we now use `opt_class_base' instead.
10423 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
10425 2004-03-19 Martin Baulig <martin@ximian.com>
10427 * class.cs (MethodCore.IsDuplicateImplementation): New private
10428 method which does the CS0111 checking.
10429 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
10430 Use IsDuplicateImplementation().
10432 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
10434 * decl.cs (FindMemberToOverride): New method to find the correct
10435 method or property to override in the base class.
10437 - Make Method/Property use the above method to find the
10438 version in the base class.
10439 - Remove the InheritableMemberSignatureCompare as it is now
10442 This patch makes large code bases much faster to compile, as it is
10443 O(n) rather than O(n^2) to do this validation.
10445 Also, it fixes bug 52458 which is that nested classes are not
10446 taken into account when finding the base class member.
10448 Reviewed/Approved by Martin.
10450 2004-03-17 Marek Safar <marek.safar@seznam.cz>
10452 * interface.cs: In all interface classes removed redundant
10453 member initialization.
10455 2004-03-16 Martin Baulig <martin@ximian.com>
10457 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
10459 2004-03-15 Miguel de Icaza <miguel@ximian.com>
10461 * decl.cs (DefineTypeAndParents): New helper method to define a
10462 type's containers before the type itself is defined; This is a
10463 bug exposed by the recent changes to Windows.Forms when an
10464 implemented interface was defined inside a class that had not been
10467 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
10469 (Check): Loop correctly to report errors modifiers
10470 (UNSAFE was not in the loop, since it was the same as TOP).
10472 * interface.cs: Every interface member now takes a ModFlags,
10473 instead of a "is_new" bool, which we set on the base MemberCore.
10475 Every place where we called "UnsafeOk" in the interface, now we
10476 call the proper member (InterfaceMethod.UnsafeOK) instead to get
10477 the unsafe settings from the member declaration instead of the
10478 container interface.
10480 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
10482 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
10483 `set_indexer_name' to the pending bits (one per type).
10485 We fixed a bug today that was picking the wrong method to
10486 override, since for properties the existing InterfaceMethod code
10487 basically ignored the method name. Now we make sure that the
10488 method name is one of the valid indexer names.
10490 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
10492 * support.cs (SeekableStreamReader): Keep track of stream byte
10493 positions and don't mix them with character offsets to the buffer.
10495 Patch from Gustavo Giráldez
10497 2004-03-15 Marek Safar <marek.safar@seznam.cz>
10499 * interface.cs (InterfaceSetGetBase): Removed double member
10500 initialization, base class does it as well.
10502 2004-03-13 Martin Baulig <martin@ximian.com>
10504 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
10505 when compiling corlib.
10507 2004-03-13 Miguel de Icaza <miguel@ximian.com>
10509 * convert.cs (ExplicitConversion): We were reporting an error on
10510 certain conversions (object_type source to a value type, when the
10511 expression was `null') before we had a chance to pass it through
10512 the user defined conversions.
10514 * driver.cs: Replace / and \ in resource specifications to dots.
10517 * class.cs: Add check for duplicate operators. Fixes 52477
10519 2004-03-11 Miguel de Icaza <miguel@ximian.com>
10521 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
10522 that are in the middle of the statements, not only at the end.
10525 * class.cs (TypeContainer.AddField): No longer set the
10526 `HaveStaticConstructor' flag, now we call it
10527 `UserDefineStaticConstructor' to diferentiate the slightly
10528 semantic difference.
10530 The situation is that we were not adding BeforeFieldInit (from
10531 Modifiers.TypeAttr) to classes that could have it.
10532 BeforeFieldInit should be set to classes that have no static
10537 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
10539 And most importantly Zoltan's comment:
10541 http://bugzilla.ximian.com/show_bug.cgi?id=44229
10543 "I think beforefieldinit means 'it's ok to initialize the type sometime
10544 before its static fields are used', i.e. initialization does not need
10545 to be triggered by the first access to the type. Setting this flag
10546 helps the JIT to compile better code, since it can run the static
10547 constructor at JIT time, and does not need to generate code to call it
10548 (possibly lots of times) at runtime. Unfortunately, mcs does not set
10549 this flag for lots of classes like String.
10551 csc sets this flag if the type does not have an explicit static
10552 constructor. The reasoning seems to be that if there are only static
10553 initalizers for a type, and no static constructor, then the programmer
10554 does not care when this initialization happens, so beforefieldinit
10557 This bug prevents the AOT compiler from being usable, since it
10558 generates so many calls to mono_runtime_class_init that the AOT code
10559 is much slower than the JITted code. The JITted code is faster,
10560 because it does not generate these calls if the vtable is type is
10561 already initialized, which is true in the majority of cases. But the
10562 AOT compiler can't do this."
10564 2004-03-10 Miguel de Icaza <miguel@ximian.com>
10566 * class.cs (MethodData.Emit): Refactor the code so symbolic
10567 information is generated for destructors; For some reasons we
10568 were taking a code path that did not generate symbolic information
10571 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
10573 * class.cs: Create a Constructor.CheckBase method that
10574 takes care of all validation type code. The method
10575 contains some code that was moved from Define.
10577 It also includes new code that checks for duplicate ctors.
10578 This fixes bug #55148.
10580 2004-03-09 Joshua Tauberer <tauberer@for.net>
10582 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
10583 a { ... }-style array creation invokes EmitStaticInitializers
10584 which is not good for reference-type arrays. String, decimal
10585 and now null constants (NullCast) are not counted toward
10586 static initializers.
10588 2004-03-05 Martin Baulig <martin@ximian.com>
10590 * location.cs (SourceFile.HasLineDirective): New public field;
10591 specifies whether the file contains or is referenced by a "#line"
10593 (Location.DefineSymbolDocuments): Ignore source files which
10594 either contain or are referenced by a "#line" directive.
10596 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
10598 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
10599 direct access to our parent, so check the method inline there.
10601 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
10603 * expression.cs (Invocation.EmitCall): Miguel's last commit
10604 caused a regression. If you had:
10609 In Foo the implict this would be null.
10611 2004-02-27 Miguel de Icaza <miguel@ximian.com>
10613 * expression.cs (Invocation.EmitCall): If the method is not
10614 virtual, do not emit a CallVirt to it, use Call.
10616 * typemanager.cs (GetFullNameSignature): Improve the method to
10617 cope with ".ctor" and replace it with the type name.
10619 * class.cs (ConstructorInitializer.Resolve): Now the method takes
10620 as an argument the ConstructorBuilder where it is being defined,
10621 to catch the recursive constructor invocations.
10623 2004-02-26 Miguel de Icaza <miguel@ximian.com>
10625 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
10626 routines to check if a type is an enumerable/enumerator allow
10627 classes that implement the IEnumerable or IEnumerator interfaces.
10629 * class.cs (Property, Operator): Implement IIteratorContainer, and
10630 implement SetYields.
10632 (Property.Define): Do the block swapping for get_methods in the
10633 context of iterators. We need to check if Properties also
10634 include indexers or not.
10636 (Operator): Assign the Block before invoking the
10637 OperatorMethod.Define, so we can trigger the Iterator code
10640 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
10641 Property and Operator classes are not created when we parse the
10642 declarator but until we have the block completed, so we use a
10643 singleton SimpleIteratorContainer.Simple to flag whether the
10644 SetYields has been invoked.
10646 We propagate this setting then to the Property or the Operator to
10647 allow the `yield' to function.
10649 2004-02-25 Marek Safar <marek.safar@seznam.cz>
10651 * codegen.cs: Implemented attribute support for modules.
10652 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
10653 Assembly/Module functionality.
10655 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
10656 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
10657 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
10659 2004-02-16 Marek Safar <marek.safar@seznam.cz>
10661 * interface.cs (FindMembers): The operation is performed on all base
10662 interfaces and not only on the first. It is required for future CLS Compliance patch.
10664 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
10666 * statement.cs, codegen.cs:
10667 This patch deals with patterns such as:
10669 public class List : IEnumerable {
10671 public MyEnumerator GetEnumerator () {
10672 return new MyEnumerator(this);
10675 IEnumerator IEnumerable.GetEnumerator () {
10679 public struct MyEnumerator : IEnumerator {
10684 Before, there were a few things we did wrong:
10685 1) we would emit callvirt on a struct, which is illegal
10686 2) we emited ldarg when we needed to emit ldarga
10687 3) we would mistakenly call the interface methods on an enumerator
10688 type that derived from IEnumerator and was in another assembly. For example:
10690 public class MyEnumerator : IEnumerator
10692 Would have the interface methods called, even if there were public impls of the
10693 method. In a struct, this lead to invalid IL code.
10695 2004-02-11 Marek Safar <marek.safar@seznam.cz>
10697 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
10700 * delegate.cs (Define): Fixed crash when delegate type is undefined.
10702 2004-02-11 Miguel de Icaza <miguel@ximian.com>
10704 * cs-parser.jay: Fix small regression: we were not testing V2
10705 compiler features correctly.
10707 * interface.cs: If the emit context is null, then create one
10709 2004-02-09 Marek Safar <marek.safar@seznam.cz>
10711 * decl.cs (GetSignatureForError): New virtual method to get full name
10712 for error messages.
10714 * attribute.cs (IAttributeSupport): New interface for attribute setting.
10715 Now it is possible to rewrite ApplyAttributes method to be less if/else.
10717 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
10718 Duplicated members and code in these classes has been removed.
10719 Better encapsulation in these classes.
10721 2004-02-07 Miguel de Icaza <miguel@ximian.com>
10723 * assign.cs (Assign.DoResolve): When dealing with compound
10724 assignments, there is a new rule in ECMA C# 2.4 (might have been
10725 there before, but it is documented here) that states that in:
10729 If b is of type int, and the `op' is a shift-operator, then the
10730 above is evaluated as:
10734 * expression.cs (Binary.ResolveOperator): Instead of testing for
10735 int/uint/long/ulong, try to implicitly convert to any of those
10736 types and use that in pointer arithmetic.
10738 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
10739 method to print information for from the type, not from the
10740 null-method we were given.
10742 2004-02-01 Duncan Mak <duncan@ximian.com>
10744 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
10745 parsing for cmd, fixes bug #53694.
10747 2004-02-04 Marek Safar <marek.safar@seznam.cz>
10749 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
10750 in the member name duplication tests. Property and operator name duplication
10751 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
10753 2004-02-03 Marek Safar <marek.safar@seznam.cz>
10755 * interface.cs (PopulateMethod): Fixed crash when interface method
10756 returns not existing type (error test cs0246-3.cs).
10758 2004-02-02 Ravi Pratap M <ravi@ximian.com>
10760 * cs-parser.jay (interface_accessors): Re-write actions to also
10761 store attributes attached to get and set methods. Fix spelling
10764 (inteface_property_declaration): Modify accordingly.
10766 (InterfaceAccessorInfo): New helper class to store information to pass
10767 around between rules that use interface_accessors.
10769 * interface.cs (Emit): Apply attributes on the get and set
10770 accessors of properties and indexers too.
10772 * attribute.cs (ApplyAttributes): Modify accordingly to use the
10773 right MethodBuilder when applying attributes to the get and set accessors.
10775 2004-01-31 Miguel de Icaza <miguel@ximian.com>
10777 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
10779 2004-01-26 Miguel de Icaza <miguel@ximian.com>
10781 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
10783 2004-01-25 Miguel de Icaza <miguel@ximian.com>
10785 * cs-parser.jay: Remove YIELD token, instead use the new grammar
10786 changes that treat `yield' specially when present before `break'
10787 or `return' tokens.
10789 * cs-tokenizer.cs: yield is no longer a keyword.
10791 2004-01-23 Marek Safar <marek.safar@seznam.cz>
10793 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
10794 setting for default constructors.
10795 For default constructors are almost every time set wrong Modifier. The
10796 generated IL code has been alright. But inside mcs this values was
10797 wrong and this was reason why several of my CLS Compliance tests
10800 2004-01-22 Martin Baulig <martin@ximian.com>
10802 * cs-parser.jay (namespace_or_type_name): Return an Expression,
10803 not a QualifiedIdentifier. This is what `type_name_expression'
10804 was previously doing.
10805 (type_name_expression): Removed; the code is now in
10806 `namespace_or_type_name'.
10807 (qualified_identifier): Removed, use `namespace_or_type_name'
10809 (QualifiedIdentifier): Removed this class.
10811 2004-01-22 Martin Baulig <martin@ximian.com>
10813 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
10814 not a string as alias name.
10816 2004-01-21 Miguel de Icaza <miguel@ximian.com>
10818 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
10819 #52730 bug, and instead compute correctly the need to use a
10820 temporary variable when requesting an address based on the
10821 static/instace modified of the field and the constructor.
10823 2004-01-21 Martin Baulig <martin@ximian.com>
10825 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
10826 class and namespace before looking up aliases. Fixes #52517.
10828 2004-01-21 Martin Baulig <martin@ximian.com>
10830 * flowanalysis.cs (UsageVector.Merge): Allow variables being
10831 assinged in a 'try'; fixes exception4.cs.
10833 2004-01-21 Marek Safar <marek.safar@seznam.cz>
10834 * class.cs : Implemented parameter-less constructor for TypeContainer
10836 * decl.cs: Attributes are now stored here. New property OptAttributes
10838 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
10840 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
10842 2004-01-21 Marek Safar <marek.safar@seznam.cz>
10844 * typemanager.cs (CSharpSignature): Now reports also inner class name.
10845 (CSharpSignature): New method for indexer and property signature.
10847 2004-01-21 Marek Safar <marek.safar@seznam.cz>
10849 * pending.cs (IsVirtualFilter): Faster implementation.
10851 2004-01-21 Marek Safar <marek.safar@seznam.cz>
10853 * typemanager.cs: Avoid inclusion of same assembly more than once.
10855 2004-01-21 Marek Safar <marek.safar@seznam.cz>
10857 * cs-parser.jay: Fixed problem where the last assembly attribute
10858 has been applied also to following declaration (class, struct, etc.)
10860 2004-01-21 Marek Safar <marek.safar@seznam.cz>
10862 * class.cs: Added error CS0538, CS0539 reporting.
10863 Fixed crash on Microsoft runtime when field type is void.
10865 * cs-parser.jay: Added error CS0537 reporting.
10867 * pending.cs: Added error CS0535 reporting.
10868 Improved error report for errors CS0536, CS0534.
10870 2004-01-20 Miguel de Icaza <miguel@ximian.com>
10872 Merge a few bits from the Anonymous Method MCS tree.
10874 * statement.cs (ToplevelBlock): New class for toplevel methods,
10875 will hold anonymous methods, lifted variables.
10877 * cs-parser.jay: Create toplevel blocks for delegates and for
10878 regular blocks of code.
10880 2004-01-20 Martin Baulig <martin@ximian.com>
10882 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
10883 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
10884 and `NeedExplicitReturn'; added `IsLastStatement'.
10885 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
10886 have a `ReturnLabel' or we're not unreachable.
10888 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
10889 child's reachability; don't just override ours with it. Fixes
10890 #58058 (lluis's example).
10891 (FlowBranching): Added public InTryOrCatch(), InCatch(),
10892 InFinally(), InLoop(), InSwitch() and
10893 BreakCrossesTryCatchBoundary() methods.
10895 * statement.cs (Return): Do all error checking in Resolve().
10896 Unless we are the last statement in a top-level block, always
10897 create a return label and jump to it.
10898 (Break, Continue): Do all error checking in Resolve(); also make
10899 sure we aren't leaving a `finally'.
10900 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
10901 statement in a top-level block.
10902 (Block.Flags): Added `IsDestructor'.
10903 (Block.IsDestructor): New public property.
10905 2004-01-20 Martin Baulig <martin@ximian.com>
10907 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
10909 2004-01-20 Martin Baulig <martin@ximian.com>
10911 * statement.cs (Statement.ResolveUnreachable): New public method.
10912 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
10913 (Block.Resolve): Resolve unreachable statements.
10915 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
10917 * expression.cs: We need to fix the case where we do
10918 not have a temp variable here.
10920 * assign.cs: Only expression compound assignments need
10921 temporary variables.
10923 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
10925 * flowanalysis.cs: Reduce memory allocation in a few ways:
10926 - A block with no variables should not allocate a bit
10928 - A method with no out parameters does not need any tracking
10929 for assignment of the parameters, so we need not allocate
10932 public readonly Type[] VariableTypes;
10933 public readonly string[] VariableNames;
10934 Are redundant. The data is already stored in the variable
10935 map, so we need not allocate another array for it.
10936 - We need to add alot of checks for if (params | locals) == null
10937 due to the first two changes.
10939 2004-01-18 Miguel de Icaza <miguel@ximian.com>
10941 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
10942 implement IMemoryLocation, we store a copy on a local variable and
10943 take the address of it. Patch from Benjamin Jemlich
10945 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
10946 to use a special "type_name_expression" rule which reduces the
10947 number of "QualifiedIdentifier" classes created, and instead
10948 directly creates MemberAccess expressions.
10950 2004-01-17 Miguel de Icaza <miguel@ximian.com>
10952 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
10953 that fixes #52853. Null literal assignment to ValueType
10955 * class.cs (MethodData.Emit): Instead of checking the name of the
10956 method to determine if its a destructor, create a new derived
10957 class from Method called Destructor, and test for that.
10959 * cs-parser.jay: Create a Destructor object instead of a Method.
10961 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
10965 2004-01-16 Miguel de Icaza <miguel@ximian.com>
10967 * expression.cs (Binary.ResolveOperator): Perform an implicit
10968 conversion from MethodGroups to their delegate types on the
10969 Addition operation.
10971 * delegate.cs: Introduce a new class DelegateCreation that is the
10972 base class for `NewDelegate' and `ImplicitDelegateCreation',
10973 factor some code in here.
10975 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
10976 conversion from MethodGroups to compatible delegate types.
10978 * ecore.cs (Expression.Resolve): Do not flag error 654
10979 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
10980 we allow conversions from MethodGroups to delegate types now.
10982 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
10983 assignments in v2 either.
10985 2004-01-10 Miguel de Icaza <miguel@ximian.com>
10987 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
10988 static read-only fields in ctors.
10990 Applied patch from Benjamin Jemlich
10992 * expression.cs (UnaryMutator): Avoid leaking local variables.
10994 2004-01-09 Miguel de Icaza <miguel@ximian.com>
10996 * cs-tokenizer.cs (IsCastToken): Allow the various native types
10997 here to return true, as they can be used like this:
10999 (XXX) int.MEMBER ()
11001 Fixed 49836 and all the other dups
11003 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
11005 * driver.cs: Implement /win32res and /win32icon.
11007 2004-01-08 Miguel de Icaza <miguel@ximian.com>
11009 * cs-parser.jay: Add a rule to improve error handling for the
11010 common mistake of placing modifiers after the type.
11012 2004-01-07 Miguel de Icaza <miguel@ximian.com>
11014 * cs-parser.jay (interface_event_declaration): Catch
11015 initialization of events on interfaces, and report cs0068
11017 * cs-parser.jay (interface_event_declaration): Catch
11018 initialization of events.
11020 * ecore.cs: Better report missing constructors.
11022 * expression.cs (Binary.ResolveOperator): My previous bug fix had
11023 the error reporting done in the wrong place. Fix.
11025 * expression.cs (Binary.ResolveOperator): Catch the
11026 operator + (E x, E y) error earlier, and later allow for implicit
11027 conversions in operator +/- (E e, U x) from U to the underlying
11030 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
11031 52596, if the container class is abstract, the default constructor
11032 is protected otherwise its public (before, we were always public).
11034 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
11037 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
11038 Jemlich that fixes bug #52597, MCS was generating invalid code for
11039 idisposable structs. Thanks to Ben for following up with this
11042 2004-01-06 Miguel de Icaza <miguel@ximian.com>
11044 * driver.cs: Allow assemblies without code to be generated, fixes
11047 2004-01-07 Nick Drochak <ndrochak@gol.com>
11049 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
11051 2004-01-05 Miguel de Icaza <miguel@ximian.com>
11053 * cs-parser.jay: Add rules to improve error reporting if fields or
11054 methods are declared at the namespace level (error 116)
11056 * Add rules to catch event add/remove
11058 2004-01-04 David Sheldon <dave-mono@earth.li>
11060 * expression.cs: Added matching ")" to error message for
11063 2004-01-03 Todd Berman <tberman@gentoo.org>
11065 * ecore.cs, attribute.cs:
11066 Applying fix from #52429.
11068 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
11070 * ecore.cs, expression.cs, statement.cs:
11071 Total rewrite of how we handle branching. We
11072 now handle complex boolean expressions with fewer
11073 jumps. As well if (x == 0) no longer emits a ceq.
11075 if (x is Foo) is much faster now, because we generate
11078 Overall, we get a pretty big improvement on our benchmark
11079 tests. The code we generate is smaller and more readable.
11081 I did a full two-stage bootstrap. The patch was reviewed
11082 by Martin and Miguel.
11084 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
11086 * cs-parser.jay: Make primary_expression not take a QI.
11087 we dont need this because the member_access rule covers
11088 us here. So we replace the rule with just IDENTIFIER.
11090 This has two good effects. First, we remove a s/r conflict.
11091 Second, we allocate many fewer QualifiedIdentifier objects.
11093 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
11095 * attribute.cs: Handle MarshalAs attributes as pseudo, and
11096 set the correct information via SRE. This prevents
11097 hanging on the MS runtime. Fixes #29374.
11099 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
11101 * convert.cs: correctly handle conversions to value types
11102 from Enum and ValueType as unboxing conversions.
11104 Fixes bug #52569. Patch by Benjamin Jemlich.
11106 2004-01-02 Ravi Pratap <ravi@ximian.com>
11108 * expression.cs (BetterConversion): Prefer int -> uint
11109 over int -> ulong (csc's behaviour). This fixed bug #52046.
11111 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
11113 * decl.cs (MemberCache.FindMembers): now returns a
11116 * typemanager.cs: In general, go with with ^^.
11117 (CopyNewMethods): take an IList.
11118 (RealMemberLookup): Only allocate an arraylist
11119 if we copy from two sets of methods.
11121 This change basically does two things:
11122 1) Fewer array lists allocated due to CopyNewMethods.
11123 2) the explicit cast in MemberList costed ALOT.
11125 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
11127 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
11128 a hashtable to avoid needless string allocations when an identifier is
11129 used more than once (the common case).
11131 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
11133 * pending.cs: MS's TypeBuilder.GetInterfaces ()
11134 is broken, it will not return anything. So, we
11135 have to use the information we have in mcs to
11138 * typemanager.cs: Add a cache for GetInterfaces,
11139 since this will now be used more often (due to ^^)
11141 (GetExplicitInterfaces) New method that gets the
11142 declared, not effective, interfaces on a type
11143 builder (eg, if you have interface IFoo, interface
11144 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
11147 This patch makes MCS able to bootstrap itself on
11150 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
11152 * expression.cs: Remove the Nop's that Miguel put
11155 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
11157 * report.cs, codegen.cs: Give the real stack trace to
11158 the error when an exception is thrown.
11160 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
11162 * decl.cs: only allocate hashtables for ifaces if
11165 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
11167 * expression.cs: fix the error from cs0121-2.cs
11168 (a parent interface has two child interfaces that
11169 have a function with the same name and 0 params
11170 and the function is called through the parent).
11172 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
11174 * class.cs, rootcontext.cs, typmanager.cs: do not
11177 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
11179 * codegen.cs: remove stack for the ec flow branching.
11180 It is already a linked list, so no need.
11182 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
11184 * Makefile: Allow custom profiler here.
11186 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
11188 * typemanager.cs (LookupType):
11189 - Use a static char [], because split takes
11190 a param array for args, so it was allocating
11192 - Do not store true in a hashtable, it boxes.
11194 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
11196 * flowanalysis.cs: bytify common enums.
11198 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
11200 * modifiers.cs: Add a new set of flags for the
11201 flags allowed on explicit interface impls.
11202 * cs-parser.jay: catch the use of modifiers in
11203 interfaces correctly.
11204 * class.cs: catch private void IFoo.Blah ().
11206 All related to bug #50572.
11208 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
11210 * decl.cs: Rewrite the consistant accessability checking.
11211 Accessability is not linear, it must be implemented in
11212 a tableish way. Fixes #49704.
11214 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
11216 * expression.cs: Handle negation in a checked context.
11217 We must use subtraction from zero. Fixes #38674.
11219 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
11221 * class.cs: Ignore static void main in DLLs.
11222 * rootcontext.cs: Handle the target type here,
11223 since we are have to access it from class.cs
11224 * driver.cs: account for the above.
11226 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
11228 * report.cs: Give line numbers and files if available.
11230 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
11232 * driver.cs: Implement /addmodule.
11234 * typemanager.cs: Change 'modules' field so it now contains Modules not
11237 2003-12-20 Martin Baulig <martin@ximian.com>
11239 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
11240 (FieldBase.IsAssigned): Removed this field.
11241 (FieldBase.SetAssigned): New public method.
11242 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
11244 2003-12-20 Martin Baulig <martin@ximian.com>
11246 * expression.cs (LocalVariableReference.DoResolve): Don't set
11247 `vi.Used' if we're called from DoResolveLValue().
11249 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
11250 returns the usage vector it just merged into the current one -
11251 pass this one to UsageWarning().
11252 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
11253 of the `EmitContext', don't call this recursively on our children.
11255 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
11257 * driver.cs: Implement /target:module.
11259 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
11261 * support.cs (CharArrayHashtable): New helper class.
11263 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
11264 char arrays, not strings, so we can avoid creating a string in
11265 consume_identifier if the identifier is a keyword.
11267 2003-12-16 Martin Baulig <martin@ximian.com>
11269 * statement.cs (LocalInfo.Assigned): Removed this property.
11270 (LocalInfo.Flags): Removed `Assigned'.
11271 (LocalInfo.IsAssigned): New public method; takes the EmitContext
11272 and uses flow analysis.
11273 (Block.UsageWarning): Made this method private.
11274 (Block.Resolve): Call UsageWarning() if appropriate.
11276 * expression.cs (LocalVariableReference.DoResolve): Always set
11277 LocalInfo.Used here.
11279 2003-12-13 Martin Baulig <martin@ximian.com>
11281 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
11282 any value here; we're now using flow analysis to figure out
11283 whether a statement/block returns a value.
11285 2003-12-13 Martin Baulig <martin@ximian.com>
11287 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
11289 (FlowBranching.MergeFinally): Don't call
11290 `branching.CheckOutParameters()' here, this is called in
11292 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
11293 when adding the `finally' vector.
11295 2003-12-13 Martin Baulig <martin@ximian.com>
11298 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
11299 actually work and also fix #48962.
11301 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
11303 * decl.cs: Do not check System.Object for nested types,
11304 since we know it does not have any. Big bang for buck:
11307 Run 1: 8.35 seconds
11308 Run 2: 8.32 seconds
11309 corlib: 17.99 seconds
11311 Run 1: 8.17 seconds
11312 Run 2: 8.17 seconds
11313 corlib: 17.39 seconds
11315 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
11317 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
11318 time we are returning 0 members, so we save alot here.
11320 2003-12-11 Martin Baulig <martin@ximian.com>
11322 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
11323 `MergeChild()', also just take the `FlowBranching' as argument;
11324 call Merge() on it and return the result.
11325 (FlowBranching.Merge): We don't need to do anything if we just
11328 2003-12-11 Martin Baulig <martin@ximian.com>
11330 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
11331 them in an `ArrayList' to reduce memory usage. Thanks to Ben
11332 Maurer for this idea.
11334 2003-12-11 Martin Baulig <martin@ximian.com>
11336 * flowanalysis.cs (MergeResult): This class is now gone; we now
11337 use the `UsageVector' for this. The reason for this is that if a
11338 branching just has one sibling, we don't need to "merge" them at
11339 all - that's the next step to do.
11340 (FlowBranching.Merge): We now return a `UsageVector' instead of a
11343 2003-12-11 Martin Baulig <martin@ximian.com>
11345 Reworked flow analyis and made it more precise and bug-free. The
11346 most important change is that we're now using a special `Reachability'
11347 class instead of having "magic" meanings of `FlowReturns'. I'll
11348 do some more cleanups and optimizations and also add some more
11349 documentation this week.
11351 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
11352 largely reworked this class.
11353 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
11354 the new `Reachability' class instead of having "magic" values here.
11355 (FlowBranching): We're now using an instance of `Reachability'
11356 instead of having separate `Returns', `Breaks' etc. fields.
11358 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
11359 based on flow analysis; ignore the return value of block.Emit ().
11361 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
11363 * driver.cs typemanager.cs: Find the mono extensions to corlib even
11364 if they are private.
11366 2003-12-09 Martin Baulig <martin@ximian.com>
11368 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
11369 call them directly on the UsageVector.
11371 2003-12-09 Martin Baulig <martin@ximian.com>
11373 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
11374 Changed return type from `FlowReturns' to `Reachability'.
11376 2003-12-09 Martin Baulig <martin@ximian.com>
11378 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
11379 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
11380 `Reachable' fields with a single `Reachability' one.
11382 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
11384 * class.cs (FindMembers): Remove foreach's.
11389 Run 1: 8.74 seconds
11390 Run 2: 8.71 seconds
11393 Run 1: 8.64 seconds
11394 Run 2: 8.58 seconds
11397 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
11402 This patch does a few things:
11403 1. EmptyStatement is now a singleton, so it is never reallocated.
11404 2. All blah is EmptyStatement constructs have been changed to
11405 blah == EmptyStatement.Value, which is much faster and valid
11406 now that EmptyStatement is a singleton.
11407 3. When resolving a block, rather than allocating a new array for
11408 the non-empty statements, empty statements are replaced with
11409 EmptyStatement.Value
11410 4. Some recursive functions have been made non-recursive.
11411 Mainly the performance impact is from (3), however (1) and (2) are needed for
11412 this to work. (4) does not make a big difference in normal situations, however
11413 it makes the profile look saner.
11418 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
11419 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
11420 Total memory allocated: 56397 KB
11423 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
11424 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
11425 Total memory allocated: 55666 KB
11427 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
11429 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
11430 than the hashtable in a hashtable version
11432 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
11433 we always end up concating a string. This results in a huge perf
11434 loss, because many strings have to be tracked by the GC. In this
11435 patch, we first use a hashtable that works with two keys, so that
11436 the strings do not need to be concat'ed.
11440 Run 1: 8.74 seconds
11441 Run 2: 8.71 seconds
11444 Run 1: 8.65 seconds
11445 Run 2: 8.56 seconds
11447 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
11449 * Makefile: Add a new target `do-time' that does a quick and simple
11450 profile, leaving easy to parse output.
11452 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
11454 * codegen.cs (Init): Create the dynamic assembly with
11455 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
11457 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
11459 * support.cs: Make the PtrHashtable use only one
11460 instance of its comparer.
11462 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
11464 * typemanager.cs: Fix lookup of GetNamespaces.
11466 2003-11-29 Miguel de Icaza <miguel@ximian.com>
11468 * expression.cs: Removed redundant line.
11470 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
11471 ArrayLists, use for loops with bounds.
11473 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
11476 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
11477 arraylists, use for loop with bounds.
11479 The above three changes give us a 0.071 second performance
11480 improvement out of 3.294 seconds down to 3.223. On my machine
11481 the above changes reduced the memory usage by 1,387 KB during
11482 compiler bootstrap.
11484 * cs-parser.jay (QualifiedIdentifier): New class used to represent
11485 QualifiedIdentifiers. Before we created a new string through
11486 concatenation, and mostly later on, the result would be
11487 manipulated by DecomposeQI through string manipulation.
11489 This reduced the compiler memory usage for bootstrapping from
11490 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
11491 compile times in 0.05 seconds.
11493 2003-11-28 Dick Porter <dick@ximian.com>
11495 * support.cs: Do string compares with the Invariant culture.
11503 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
11504 the comparison is done with the Invariant culture.
11506 2003-11-27 Miguel de Icaza <miguel@ximian.com>
11508 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
11509 GetEnumerator method.
11511 (ProbeCollectionType): Iterate starting at the most specific type
11512 upwards looking for a GetEnumerator
11514 * expression.cs: Shift count can be up to 31 for int/uint and 63
11517 2003-11-26 Miguel de Icaza <miguel@ximian.com>
11519 * statement.cs (Block.LookupLabel): Also look for the label on the
11520 children blocks. Use a hash table to keep track of visited
11523 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
11524 we actually did transform the other operand, otherwise fall back
11525 to the common codepath that casts to long.
11527 * cs-tokenizer.cs: Use the same code pattern as the int case.
11528 Maybe I should do the parsing myself, and avoid depending on the
11529 Parse routines to get this done.
11531 2003-11-25 Miguel de Icaza <miguel@ximian.com>
11533 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
11534 which fixes bug 51347. This time test it.
11536 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
11537 attributes for example can not tell the difference between these.
11538 The difference was only a syntax feature of the language.
11540 * attribute.cs: Apply attributes to delegates.
11542 * delegate.cs: Call the apply attributes method.
11544 2003-11-24 Miguel de Icaza <miguel@ximian.com>
11546 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
11547 comparing 0 vs Byte.MinValue, not the value
11549 (ImplicitConversionRequired): When reporting a conversion error,
11550 use error 31 to print out the constant error instead of the
11553 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
11554 which fixes bug 51347.
11556 2003-11-22 Miguel de Icaza <miguel@ximian.com>
11558 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
11559 which fixes the -warnaserror command line option.
11561 2003-11-21 Miguel de Icaza <miguel@ximian.com>
11563 * cfold.cs (DoNumericPromotions): During constant folding of
11564 additions on UIntConstant, special case intconstants with
11565 IntConstants like we do on the expression binary operator.
11567 2003-11-12 Miguel de Icaza <miguel@ximian.com>
11569 * convert.cs (ImplicitReferenceConversion): We were missing a case
11570 (System.Enum are not value types or class types, so we need to
11571 classify them separatedly).
11573 * driver.cs: We do not support error 2007.
11575 2003-11-12 Jackson Harper <jackson@ximian.com>
11577 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
11578 system directory. Also use the full file name so users can
11579 libraries names mscorlib-o-tron.dll in a non system dir.
11581 2003-11-10 Martin Baulig <martin@ximian.com>
11583 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
11584 (TypeManager.InitCoreTypes): Initialize them here, but instead of
11585 calling `ResolveType()' on them, directly assign their `Type'.
11587 2003-11-08 Martin Baulig <martin@ximian.com>
11589 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
11590 return value and the `out parent' parameter.
11591 (TypeContainer.DefineType): Moved the CS0644 check into
11592 GetClassBases(). Don't pass the interface types to the
11593 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
11594 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
11596 * ecore.cs (TypeExpr.IsAttribute): New property.
11597 (TypeExpr.GetInterfaces): New method.
11599 * interface.cs (Interface.GetInterfaceTypeByName): Return a
11600 TypeExpr instead of a Type.
11601 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
11602 (Interface.DefineType): Don't pass the interface types to the
11603 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
11604 them later and then call `TypeBulider.AddInterfaceImplementation()'.
11606 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
11607 instead of a `Type[]'.
11608 (TypeManager.RegisterBuilder): Likewise.
11609 (TypeManager.AddUserInterface): Likewise.
11610 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
11611 `Type[]' and also return a `TypeExpr[]'.
11612 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
11614 2003-11-08 Martin Baulig <martin@ximian.com>
11616 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
11619 2003-11-08 Martin Baulig <martin@ximian.com>
11621 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
11622 TypeManager.ResolveExpressionTypes().
11624 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
11625 instead of an Expression.
11626 (TypeExpr): This is now an abstract base class for `TypeExpression'.
11627 (TypeExpression): New public class; formerly known as `TypeExpr'.
11629 * expression.cs (ComposedCast): Derive from TypeExpr.
11631 * typemanager.cs (TypeManager.system_*_expr): These are now
11632 TypExpr's instead of Expression's.
11633 (TypeManager.ResolveExpressionTypes): New public static function;
11634 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
11637 2003-11-06 Miguel de Icaza <miguel@ximian.com>
11639 * expression.cs (New.DoResolve): Do not dereference value that
11640 might be a null return.
11642 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
11643 sure that the constant value has the right type. Fixes an
11644 unreported bug, similar to 50425.
11646 * const.cs (Const.LookupConstantValue): Call
11647 ImplicitStandardConversionExists before doing a conversion to
11648 avoid havng the TypeManager.ChangeType do conversions.
11650 Reduced the number of casts used
11652 (Const.ChangeType): New routine to enable reuse of the constant
11653 type changing code from statement.
11655 * typemanager.cs (ChangeType): Move common initialization to
11656 static global variables.
11660 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
11661 every value type to go through, even if it was void. Fix that.
11663 * cs-tokenizer.cs: Use is_identifier_start_character on the start
11664 character of the define, and the is_identifier_part_character for
11665 the rest of the string.
11667 2003-11-05 Miguel de Icaza <miguel@ximian.com>
11669 * expression.cs (UnaryMutator.EmitCode): When I updated
11670 LocalVariableReference.DoResolve, I overdid it, and dropped an
11671 optimization done on local variable references.
11673 2003-11-04 Miguel de Icaza <miguel@ximian.com>
11675 * ecore.cs: Convert the return from Ldlen into an int.
11677 2003-10-20 Miguel de Icaza <miguel@ximian.com>
11679 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
11680 the accessibility, this is a special case for toplevel non-public
11681 classes (internal for instance).
11683 2003-10-20 Nick Drochak <ndrochak@gol.com>
11685 * ecore.cs: Fix typo and build. Needed another right paren.
11687 2003-10-19 Miguel de Icaza <miguel@ximian.com>
11689 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
11690 `internal' case regular and protected, but not allowing protected
11691 to be evaluated later. Bug 49840
11693 2003-10-15 Miguel de Icaza <miguel@ximian.com>
11695 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
11696 to kb.Nlast, and not the kb.nFirst to isolate the switch
11699 Extract the underlying type, so enumerations of long/ulong are
11700 treated like long/ulong.
11702 2003-10-14 Miguel de Icaza <miguel@ximian.com>
11704 * expression.cs (New): Overload the meaning of RequestedType to
11705 track the possible creation of the NewDelegate type, since
11706 DoResolve is invoked more than once for new constructors on field
11709 See bugs: #48800 and #37014
11711 * cs-parser.jay (declare_local_constants): Take an arraylist
11712 instead of a single constant.
11714 (local_constant_declaration): It should take a
11715 constant_declarators, not a constant_declarator. Fixes 49487
11717 * convert.cs: Fix error report.
11719 2003-10-13 Jackson Harper <jackson@ximian.com>
11721 * typemanager.cs (TypeToCoreType): Add float and double this fixes
11724 2003-10-09 Martin Baulig <martin@ximian.com>
11726 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
11728 (MethodCore.DoDefineParameters): Removed the TypeContainer
11729 argument; use the DeclSpace which was passed to the .ctor instead.
11730 (MethodCore.CheckParameter): Take a DeclSpace instead of a
11731 TypeContainer; we only need a DeclSpace here.
11733 2003-10-09 Martin Baulig <martin@ximian.com>
11735 * class.cs (MethodData): Added additional `DeclSpace ds' argument
11737 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
11738 EmitContext's .ctor.
11740 2003-10-09 Martin Baulig <martin@ximian.com>
11742 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
11743 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
11744 AsAccessible(), moved them as well.
11746 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
11748 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
11750 * cs-parser.jay : Renamed yyName to yyNames related to jay.
11752 2003-10-07 Miguel de Icaza <miguel@ximian.com>
11754 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
11755 generation for >=, as spotted by Paolo, bug 48679.
11756 Patch from David Waite.
11758 * cs-tokenizer.cs: Add handling for #pragma.
11760 * cs-parser.jay: Allow for both yield and yield return in the
11761 syntax. The anti-cobolization of C# fight will go on!
11763 * class.cs (TypeBuilder.DefineType): Catch error condition here
11764 (Parent.DefineType erroring out and returning null).
11766 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
11767 coping with enumerations variables, we were mistakenly processing
11768 them as a regular value type instead of built-in types. Fixes the
11771 * typemanager.cs (IsBuiltinOrEnum): New method.
11773 2003-09-30 Miguel de Icaza <miguel@ximian.com>
11775 * cs-parser.jay: Upgrade: yield now needs the return clause.
11777 2003-09-19 Martin Baulig <martin@ximian.com>
11779 * decl.cs (MemberCache.SetupCacheForInterface): Take a
11780 `MemberCache parent' argument. Normally, an interface doesn't
11781 have a parent type except System.Object, but we use this in gmcs
11782 for generic type parameters.
11784 2003-09-18 Martin Baulig <martin@ximian.com>
11786 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
11787 on `type.IsInterface'; don't check whether the type has a parent
11788 to determine whether it's an interface.
11790 2003-09-15 Martin Baulig <martin@ximian.com>
11792 * class.cs (TypeContainer.DefineType): Added an error flag to
11793 avoid reporting duplicate CS0146's ("class definition is
11796 * driver.cs (Driver.MainDriver): Abort if
11797 RootContext.ResolveTree() reported any errors.
11799 2003-09-07 Martin Baulig <martin@ximian.com>
11801 * report.cs (Error, Warning): Added overloaded versions which take
11802 a `params object[] args' and call String.Format().
11804 2003-09-07 Martin Baulig <martin@ximian.com>
11806 * decl.cs (DeclSpace..ctor): Don't call
11807 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
11808 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
11809 (DeclSpace.RecordDecl): New method.
11811 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
11813 2003-09-02 Ravi Pratap <ravi@ximian.com>
11815 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
11816 value attributes to be applied to ParameterBuilders.
11818 * class.cs (MethodCore.LabelParameters): Make static and more
11819 generic so that it can be used from other places - like interface
11820 methods, for instance.
11822 * interface.cs (Interface.Emit): Call LabelParameters before
11823 emitting attributes on the InterfaceMethod.
11825 2003-08-26 Martin Baulig <martin@ximian.com>
11827 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
11828 resolving aliases; fixes #47927.
11830 2003-08-26 Martin Baulig <martin@ximian.com>
11832 * statement.cs (Using.DoResolve): This is internally emitting a
11833 try/finally clause, so we need to set ec.NeedExplicitReturn if we
11834 do not always return. Fixes #47681.
11836 2003-08-26 Martin Baulig <martin@ximian.com>
11838 * decl.cs (MemberCore): Moved WarningNotHiding(),
11839 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
11841 (AdditionResult): Make this nested in DeclSpace.
11842 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
11843 argument; call NamespaceEntry.Define() unless we're nested in a
11846 * namespace.cs (Namespace.DefineName): New public function. This
11847 is called from DeclSpace's .ctor to add
11848 (Namespace.Lookup): Include DeclSpaces in the lookup.
11850 * class.cs (Operator): Derive from MemberBase, not MemberCore.
11852 * const.cs (Const): Derive from MemberBase, not MemberCore.
11854 2003-08-25 Martin Baulig <martin@ximian.com>
11856 * convert.cs (Convert.ExplicitReferenceConversion): When
11857 converting from an interface type to a class, unbox if the target
11858 type is a struct type. Fixes #47822.
11860 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11862 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
11865 2003-08-22 Martin Baulig <martin@ximian.com>
11867 * class.cs (TypeManager.DefineType): When defining a nested type,
11868 call DefineType() on our parent; fixes #47801.
11870 2003-08-22 Martin Baulig <martin@ximian.com>
11872 * class.cs (MethodData.Define): While checking if a method is an
11873 interface implementation, improve the test a bit more to fix #47654.
11875 2003-08-22 Martin Baulig <martin@ximian.com>
11877 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
11878 correctly; fixes #47722.
11880 2003-08-22 Martin Baulig <martin@ximian.com>
11882 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
11883 LocalVariableReference, ensure it's not read-only. Fixes #47536.
11885 * statement.cs (Fixed.DoResolve): Make all variables read-only.
11887 2003-08-22 Martin Baulig <martin@ximian.com>
11889 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
11890 can only be assigned in static constructors. Fixes #47161.
11892 2003-08-22 Martin Baulig <martin@ximian.com>
11894 Rewrote and improved the flow analysis code.
11896 * flowbranching.cs (FlowBranching): Make this class abstract.
11897 (FlowBranching.CreateBranching): New static function to create a
11898 new flow branching.
11899 (FlowBranchingBlock, FlowBranchingException): New classes.
11900 (FlowBranching.UsageVector.Type): New public readonly field.
11901 (FlowBranching.UsageVector.Breaks): Removed the setter.
11902 (FlowBranching.UsageVector.Returns): Removed the setter.
11903 (FlowBranching.UsageVector): Added Break(), Return(),
11904 NeverReachable() and Throw() methods to modify the reachability.
11905 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
11906 done by FlowBranching.Merge().
11907 (FlowBranching.UsageVector.MergeChild): New method; merges the
11908 merge result into the current vector.
11909 (FlowBranching.Merge): New abstract method to merge a branching.
11911 2003-08-12 Martin Baulig <martin@ximian.com>
11913 * expression.cs (Indirection.CacheTemporaries): Create the
11914 LocalTemporary with the pointer type, not its element type.
11916 2003-08-10 Miguel de Icaza <miguel@ximian.com>
11918 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
11919 token was a keyword or not.
11921 Add `error' options where an IDENTIFIER was expected; Provide
11922 CheckToken and CheckIdentifierToken convenience error reporting
11925 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
11927 * decl.cs: Rename `NamespaceEntry Namespace' public field into
11928 NameSpaceEntry NameSpaceEntry.
11930 (LookupInterfaceOrClass): Avoid creating a full qualified name
11931 from namespace and name: avoid doing lookups when we know the
11932 namespace is non-existant. Use new Tree.LookupByNamespace which
11933 looks up DeclSpaces based on their namespace, name pair.
11935 * driver.cs: Provide a new `parser verbose' to display the
11936 exception thrown during parsing. This is turned off by default
11937 now, so the output of a failure from mcs is more graceful.
11939 * namespace.cs: Track all the namespaces defined in a hashtable
11942 (IsNamespace): New method
11944 2003-08-09 Miguel de Icaza <miguel@ximian.com>
11946 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
11947 we know that we need to concatenate (full typename can never be
11952 * statement.cs: Use a bitfield; Do not initialize to null things
11953 which are done by the constructor by default.
11955 * cs-parser.jay: bug fix, parameter was 4, not 3.
11957 * expression.cs: Just use the property;
11959 * statement.cs: No need for GetVariableInfo method.
11961 2003-08-08 Martin Baulig <martin@ximian.com>
11963 * flowanalysis.cs (FlowReturns): This is now nested in the
11964 `FlowBranching' class.
11965 (MyBitVector): Moved this here from statement.cs.
11966 (FlowBranching.SiblingType): New enum type.
11967 (FlowBranching.CreateSibling): Added `SiblingType' argument.
11969 2003-08-07 Martin Baulig <martin@ximian.com>
11971 * flowanalysis.cs (FlowBranchingType): This is now nested in the
11972 `FlowBranching' class and called `BranchingType'.
11974 2003-08-07 Martin Baulig <martin@ximian.com>
11976 * flowanalysis.cs: Moved all the control flow analysis code into
11979 2003-08-07 Martin Baulig <martin@ximian.com>
11981 * assign.cs (Assign.DoResolve): `target' must either be an
11982 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
11985 2003-08-07 Miguel de Icaza <miguel@ximian.com>
11987 * expression.cs (BinaryMethod): This kind of expression is created by the
11988 Binary class if it determines that the operator has to be handled
11991 (BinaryDelegate): This kind of expression is created if we are
11992 dealing with a + or - operator on delegates.
11994 (Binary): remove method, argumetns, and DelegateOperator: when
11995 dealing with methods,
11997 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
11999 * statement.cs (Block): use bitfields for the three extra booleans
12000 we had in use. Remove unused topblock parameter.
12002 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
12004 * assign.cs: Drop extra unneeded tests.
12006 2003-08-06 Miguel de Icaza <miguel@ximian.com>
12008 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
12010 * statement.cs (Foreach): Use VariableStorage instead of
12013 * codegen.cs (VariableStorage): New class used by clients that
12014 require a variable stored: locals or fields for variables that
12015 need to live across yield.
12017 Maybe provide a convenience api for EmitThis+EmitLoad?
12019 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
12022 2003-08-05 Miguel de Icaza <miguel@ximian.com>
12024 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
12025 RemapParameterLValue): New methods that are used to turn a
12026 precomputed FieldInfo into an expression like this:
12030 The idea is to use this instead of making LocalVariableReference
12031 have more than one meaning.
12033 * cs-parser.jay: Add error production to BASE.
12035 * ecore.cs: Deal with TypeManager.GetField returning null, which
12036 is now a valid return value.
12038 (FieldExprNoAddress): New expression for Fields whose address can
12041 * expression.cs (LocalVariableReference): During the resolve
12042 phases, create new expressions if we are in a remapping context.
12043 Remove code that dealt with remapping here.
12045 (ParameterReference): same.
12047 (ProxyInstance): New expression, like the `This' expression, but
12048 it is born fully resolved. We know what we are doing, so remove
12049 the errors that are targeted to user-provided uses of `this'.
12051 * statement.cs (Foreach): our variable is now stored as an
12052 Expression; During resolution, follow the protocol, dont just
12053 assume it will return this.
12055 2003-08-06 Martin Baulig <martin@ximian.com>
12057 * support.cs (SeekableStreamReader.cs): New public class.
12059 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
12060 SeekableStreamReader instead of the normal StreamReader.
12062 2003-08-04 Martin Baulig <martin@ximian.com>
12064 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
12065 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
12066 deambiguate casts and delegate invocations.
12067 (parenthesized_expression): Use the new tokens to ensure this is
12068 not a cast of method invocation.
12070 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
12071 when reading a `)' and Deambiguate_CloseParens () was previously
12074 * expression.cs (ParenthesizedExpression): New class. This is
12075 just used for the CS0075 test.
12076 (Binary.DoResolve): Check for CS0075.
12078 2003-07-29 Ravi Pratap <ravi@ximian.com>
12080 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
12081 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
12082 reference comparison.
12084 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
12085 examine the ReturnType for equality - this is necessary in the
12086 cases of implicit and explicit operators whose signature also
12087 includes the return type.
12089 2003-07-26 Miguel de Icaza <miguel@ximian.com>
12091 * namespace.cs: Cache the result of the namespace computation,
12092 instead of computing it every time.
12094 2003-07-24 Miguel de Icaza <miguel@ximian.com>
12096 * decl.cs: Use a global arraylist that we reuse over invocations
12097 to avoid excesive memory consumption. Reduces memory usage on an
12098 mcs compile by one meg (45 average).
12100 * typemanager.cs (LookupTypeReflection): In .NET pointers are
12101 private, work around that.
12103 2003-07-23 Miguel de Icaza <miguel@ximian.com>
12105 * literal.cs (IntLiteral): Define Zero and One static literals.
12107 * cs-parser.jay (integer_literal): use static literals to reduce
12108 memory usage for the most used literals (0, 1 and -1). 211kb
12109 reduced in memory usage.
12111 Replace all calls to `new ArrayList' with `new
12112 ArrayList(4)' which is a good average number for most allocations,
12113 and also requires only 16 bytes of memory for its buffer by
12116 This reduced MCS memory usage in seven megabytes for the RSS after
12119 2003-07-28 Ravi Pratap <ravi@ximian.com>
12121 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
12122 handle params methods the correct way by forming only one
12123 applicable set with params and normal methods in them. Earlier we
12124 were looking at params methods only if we found no normal methods
12125 which was not the correct thing to do.
12127 (Invocation.BetterFunction): Take separate arguments indicating
12128 when candidate and the best method are params methods in their
12131 This fixes bugs #43367 and #46199.
12133 * attribute.cs: Documentation updates.
12135 (CheckAttribute): Rename to CheckAttributeTarget.
12136 (GetValidPlaces): Rename to GetValidTargets.
12138 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
12139 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
12143 2003-07-28 Martin Baulig <martin@ximian.com>
12145 * class.cs (TypeContainer.DefineMembers): Use the base type's full
12146 name when looking up the base class of a nested class. Fixes #46977.
12148 2003-07-26 Martin Baulig <martin@ximian.com>
12150 * expression.cs (Indexers.Indexer): New nested struct; contains
12151 getter, setter and the indexer's type.
12152 (Indexers.Properties): This is now an ArrayList of
12153 Indexers.Indexer's.
12154 (IndexerAccess.DoResolveLValue): Correctly set the type if the
12155 indexer doesn't have any getters.
12157 * assign.cs (Assign.DoResolve): Also do the implicit conversions
12158 for embedded property and indexer assignments.
12160 2003-07-26 Martin Baulig <martin@ximian.com>
12162 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
12163 preprocessor directive is not the first non-whitespace character
12166 2003-07-26 Martin Baulig <martin@ximian.com>
12168 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
12169 namespace parsing, follow the spec more closely.
12171 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
12172 NamespaceEntry.Lookup().
12174 2003-07-25 Martin Baulig <martin@ximian.com>
12176 * MethodCore.cs (OverridesSomething): New public field; it's set
12177 from TypeContainer.DefineMembers if this method overrides
12178 something (which doesn't need to be a method). Fix #39462.
12180 2003-07-25 Ravi Pratap <ravi@ximian.com>
12182 * typemanager.cs (GetMembers): Ensure that the list of members is
12183 reversed. This keeps things in sync.
12185 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
12186 find an AttributeUsage attribute.
12188 * expression.cs (Invocation.OverloadResolve): Perform the check
12189 which disallows Invoke to be directly called on a Delegate.
12191 (Error_InvokeOnDelegate): Report error cs1533.
12193 2003-07-25 Martin Baulig <martin@ximian.com>
12195 * expression.cs (Indexers.GetIndexersForType): Only look in the
12196 interface hierarchy if the requested type is already an
12197 interface. Fixes #46788 while keeping #46502 fixed.
12199 2003-07-25 Martin Baulig <martin@ximian.com>
12201 * class.cs (TypeContainer.DefineMembers): Check whether all
12202 readonly fields have been assigned and report warning CS0649 if
12205 * statement.cs (LocalInfo.IsFixed): Always return true if this is
12208 2003-07-24 Ravi Pratap <ravi@ximian.com>
12210 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
12211 returned from GetMethods to make things consistent with the
12212 assumptions MCS makes about ordering of methods.
12214 This should comprehensively fix bug #45127 and it does :-)
12216 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
12217 ordering is actually reverse.
12219 * Clean up some debug messages I left lying around.
12221 * interface.cs (Populate*): Get rid of code which emits attributes
12222 since the stage in which we emit attributes is the 'Emit' stage,
12223 not the define stage.
12225 (Emit): Move attribute emission for interface members here.
12227 2003-07-22 Ravi Pratap <ravi@ximian.com>
12229 * expression.cs (Invocation.OverloadResolve): Follow the spec more
12230 closely: we eliminate methods in base types when we have an
12231 applicable method in a top-level type.
12233 Please see section 14.5.5.1 for an exact description of what goes
12236 This fixes bug #45127 and a host of other related to corlib compilation.
12238 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
12239 array is the method corresponding to the top-level type (this is
12240 because of the changes made to icall.c) so we change this
12243 (MethodGroupExpr.Name): This too.
12245 * typemanager.cs (GetElementType): New method which does the right
12246 thing when compiling corlib.
12248 * everywhere: Make use of the above in the relevant places.
12250 2003-07-22 Martin Baulig <martin@ximian.com>
12252 * cs-parser.jay (invocation_expression): Moved
12253 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
12254 `cast_expression', but create a InvocationOrCast which later
12255 resolves to either an Invocation or a Cast.
12257 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
12258 method; call this before EmitStatement() to make sure that this
12259 expression can be used as a statement.
12261 * expression.cs (InvocationOrCast): New class; resolves to either
12262 an Invocation or a Cast.
12264 * statement.cs (StatementExpression): Call ResolveStatement() on
12265 the ExpressionStatement before emitting it.
12267 2003-07-21 Martin Baulig <martin@ximian.com>
12269 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
12270 `ref' and `out' attributes match; fixes #46220.
12271 (MemberAccess.ResolveMemberAccess): You can't reference a type
12272 through an expression; fixes #33180.
12273 (Indexers.GetIndexersForType): Don't return the indexers from
12274 interfaces the class implements; fixes #46502.
12276 2003-07-21 Martin Baulig <martin@ximian.com>
12278 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
12279 CS0661 checks; fixes bug #30442.
12281 2003-07-21 Martin Baulig <martin@ximian.com>
12283 * decl.cs (AdditionResult): Added `Error'.
12285 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
12287 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
12288 makes cs0031.cs actually work.
12290 2003-07-20 Martin Baulig <martin@ximian.com>
12292 * namespace.cs: Fixed that bug which caused a crash when compiling
12293 the debugger's GUI.
12295 2003-07-20 Miguel de Icaza <miguel@ximian.com>
12297 * typemanager.cs (LookupTypeReflection): Never expose types which
12298 are NotPublic, NestedPrivate, NestedAssembly, or
12299 NestedFamANDAssem. We used to return these, and later do a check
12300 that would report a meaningful error, but the problem is that we
12301 would not get the real match, if there was a name override.
12303 2003-07-18 Miguel de Icaza <miguel@ximian.com>
12305 * namespace.cs (Namespace, Name): Do not compute the namespace
12306 name dynamically, compute it in the constructor. This reduced
12307 memory usage by 1697 KB.
12309 * driver.cs: Use --pause to pause at the end.
12311 2003-07-17 Peter Williams <peter@newton.cx>
12313 * Makefile: Change the name of the test target so that it doesn't
12314 conflict with the recursive test target.
12316 2003-07-17 Miguel de Icaza <miguel@ximian.com>
12318 * expression.cs (LocalVariableReference.Emit, EmitAssign,
12319 AddressOf): Do not use EmitThis, that was wrong, use the actual
12322 2003-07-15 Miguel de Icaza <miguel@ximian.com>
12324 * class.cs (MethodData.Define): While checking if a method is an
12325 interface implementation, improve the test: If we are not public
12326 (use new test here: use the computed MethodAttributes directly,
12327 instead of the parsed modifier flags) check if the `implementing'
12328 method comes from an interface or not.
12330 * pending.cs (VerifyPendingMethods): Slightly better error
12333 * makefile: add test target that does the mcs bootstrap.
12335 2003-07-16 Ravi Pratap <ravi@ximian.com>
12337 * interface.cs (Define): Do nothing here since there are no
12338 members to populate etc. Move the attribute emission out of here
12339 since this was just totally the wrong place to put it. Attribute
12340 application happens during the 'Emit' phase, not in the 'Define'
12343 (Emit): Add this method and move the attribute emission here
12345 * rootcontext.cs (EmitCode): Call the Emit method on interface
12348 2003-07-14 Ravi Pratap M <ravi@ximian.com>
12350 * expression.cs (OverloadResolve): Report error only if Location
12351 is not 'Null' which means that there was a probe going on.
12353 2003-07-14 Martin Baulig <martin@ximian.com>
12355 * expression.cs (ConditionalLogicalOperator): New public class to
12356 implement user defined conditional logical operators.
12357 This is section 14.11.2 in the spec and bug #40505.
12359 2003-07-14 Martin Baulig <martin@ximian.com>
12361 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
12363 2003-07-14 Martin Baulig <martin@ximian.com>
12365 * codegen.cs (EmitContext.InFixedInitializer): New public field.
12367 * ecore.cs (IVariable.VerifyFixed): New interface method.
12369 * expression.cs (Unary.ResolveOperator): When resolving the `&'
12370 operator, check whether the variable is actually fixed. Fixes bug
12371 #36055. Set a variable definitely assigned when taking its
12372 address as required by the spec.
12374 * statement.cs (LocalInfo.IsFixed): New field.
12375 (LocalInfo.MakePinned): Set `IsFixed' to true.
12377 2003-07-14 Ravi Pratap M <ravi@ximian.com>
12379 * attribute.cs (Attribute.Resolve): While doing a Member lookup
12380 for .ctors, ensure that we only ask for members declared in the
12381 attribute type (BindingFlags.DeclaredOnly).
12385 * expression.cs (Error_WrongNumArguments): Report error 1501
12386 correctly the way CSC does.
12388 2003-07-13 Martin Baulig <martin@ximian.com>
12390 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
12391 lookup on the fully qualified name, to make things like "X.X" work
12392 where "X.X" is a fully qualified type name, but we also have a
12393 namespace "X" in the using list. Fixes #41975.
12395 2003-07-13 Martin Baulig <martin@ximian.com>
12397 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
12398 function. If we're a CompoundAssign, we need to create an embedded
12399 CompoundAssign, not an embedded Assign.
12400 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
12403 2003-07-13 Martin Baulig <martin@ximian.com>
12405 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
12406 work to fix bug #46088.
12408 2003-07-13 Ravi Pratap <ravi@ximian.com>
12410 * class.cs (Operator.Emit): Do not emit attributes here - it is
12411 taken care of by the Method class that we delegate too. This takes
12412 care of bug #45876.
12414 2003-07-10 Martin Baulig <martin@ximian.com>
12416 * expression.cs (TypeOfVoid): New class.
12417 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
12419 2003-07-10 Martin Baulig <martin@ximian.com>
12421 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
12424 2003-07-10 Martin Baulig <martin@ximian.com>
12426 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
12427 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
12429 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
12431 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
12433 2003-07-10 Martin Baulig <martin@ximian.com>
12435 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
12436 of decimal. Fixes #42850.
12438 NOTE: I also fixed the created byte blob, but this doesn't work on
12439 the MS runtime and csc never produces any byte blobs for decimal
12442 2003-07-10 Martin Baulig <martin@ximian.com>
12444 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
12445 structs; fixes #32068.
12446 (Block.AddChildVariableNames): Fixed #44302.
12448 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12450 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
12452 2003-07-07 Miguel de Icaza <miguel@ximian.com>
12454 * attribute.cs: And this test is onger needed.
12456 2003-07-08 Martin Baulig <martin@ximian.com>
12458 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
12459 inaccessible types. Fixes #36313.
12461 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
12463 * namespace.cs (NamespaceEntry): Create implicit entries for all
12464 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
12465 implicit entries for N1.N2 and N1.
12467 2003-07-08 Martin Baulig <martin@ximian.com>
12469 Rewrote the handling of namespaces to fix a lot of the issues
12470 wrt. `using' aliases etc.
12472 * namespace.cs (Namespace): Splitted this class into a
12473 per-assembly `Namespace' and a per-file `NamespaceEntry'.
12475 * typemanager.cs (TypeManager.IsNamespace): Removed.
12476 (TypeManager.ComputeNamespaces): Only compute namespaces from
12477 loaded assemblies here, not the namespaces from the assembly we're
12478 currently compiling.
12480 2003-07-08 Martin Baulig <martin@ximian.com>
12482 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
12484 2003-07-07 Miguel de Icaza <miguel@ximian.com>
12486 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
12489 I thought about the memory savings here, but LookupTypeReflection
12490 is used under already very constrained scenarios. Compiling
12491 corlib or mcs only exposes one hit, so it would not really reduce
12492 any memory consumption.
12494 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12496 * typemanager.cs: fixes bug #45889 by only adding public types from
12497 other assemblies to the list of known types.
12499 2003-07-07 Miguel de Icaza <miguel@ximian.com>
12501 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
12502 on the type we resolved.
12504 2003-07-05 Martin Baulig <martin@ximian.com>
12506 * pending.cs (PendingImplementation.ParentImplements): Don't
12507 create the proxy if the parent is abstract.
12509 * class.cs (TypeContainer.DefineIndexers): Process explicit
12510 interface implementations first. Fixes #37714.
12512 2003-07-04 Miguel de Icaza <miguel@ximian.com>
12514 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
12515 defined recursively; but since we modify the input parameters
12516 (left is set to `this' temporarily), we reset this value if the
12517 left_is_explicit is false, which gives the original semantics to
12520 * literal.cs (NullPointer): new class used to represent a null
12521 literal in a pointer context.
12523 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
12524 type is a pointer, use a NullPointer object instead of a
12525 NullLiteral. Closes 43687
12527 (ExplicitConversion): Convert pointer values using
12528 the conv opcode to the proper type.
12530 * ecore.cs (New): change ValueTypeVariable property into a method,
12531 that returns whether the valuetype is suitable for being used.
12533 * expression.cs (Binary.DoNumericPromotions): Only return if we
12534 the int constant was a valid uint, and we can return both left and
12535 right as uints. If not, we continue processing, to trigger the
12536 type conversion. This fixes 39018.
12538 * statement.cs (Block.EmitMeta): During constant resolution, set
12539 the CurrentBlock property on the emitcontext, so that we resolve
12540 constants propertly.
12542 2003-07-02 Martin Baulig <martin@ximian.com>
12544 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
12545 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
12547 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
12548 than emitting it here.
12550 * statement.cs: Fixed some more flow analysis bugs.
12552 2003-07-02 Martin Baulig <martin@ximian.com>
12554 * class.cs (MethodData.Define): When implementing interface
12555 methods, set Final unless we're Virtual.
12557 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
12558 check work for interface methods.
12560 2003-07-01 Martin Baulig <martin@ximian.com>
12562 * ecore.cs (EmitContext.This): Replaced this property with a
12563 GetThis() method which takes a Location argument. This ensures
12564 that we get the correct error location for a CS0188.
12566 2003-07-01 Miguel de Icaza <miguel@ximian.com>
12568 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
12569 ImplicitStandardConversion.
12571 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
12573 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
12575 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
12578 2003-06-30 Miguel de Icaza <miguel@ximian.com>
12580 * class.cs (Constructor.Define): Turn off initlocals for unsafe
12583 (MethodData.Define): Turn off initlocals for unsafe methods.
12585 2003-06-29 Miguel de Icaza <miguel@ximian.com>
12587 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
12588 complete; Fixes #37521.
12590 * delegate.cs: Use Modifiers.TypeAttr to compute the
12591 TypeAttributes, instead of rolling our own. This makes the flags
12592 correct for the delegates.
12594 2003-06-28 Miguel de Icaza <miguel@ximian.com>
12596 * class.cs (Constructor.Define): Set the private flag for static
12597 constructors as well.
12599 * cs-parser.jay (statement_expression): Set the return value to
12600 null, to avoid a crash when we catch an error.
12602 2003-06-24 Miguel de Icaza <miguel@ximian.com>
12604 * cs-parser.jay: Applied patch from Jackson that adds support for
12605 extern and unsafe modifiers to destructor declarations.
12607 * expression.cs: Report error 21 if the user is trying to index a
12610 * driver.cs: Add an error message, suggested by the bug report.
12612 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
12613 if we do not have a ": this ()" constructor initializer. Fixes 45149
12615 2003-06-14 Miguel de Icaza <miguel@ximian.com>
12617 * namespace.cs: Add some information to reduce FAQs.
12619 2003-06-13 Miguel de Icaza <miguel@ximian.com>
12621 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
12622 underlying enumeration types. Fixes #43915.
12624 * expression.cs: Treat ushort/short as legal values to be used in
12625 bitwise operations.
12627 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
12629 * delegate.cs: transfer custom attributes for paramenters from
12630 the delegate declaration to Invoke and BeginInvoke.
12632 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
12634 * attribute.cs: handle custom marshalers and emit marshal info
12637 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
12639 * makefile.gnu: Added anonymous.cs to the compiler sources.
12641 2003-05-28 Miguel de Icaza <miguel@ximian.com>
12643 * iterators.cs: Change the name of the proxy class to include two
12646 * cs-parser.jay: Update grammar to include anonymous methods.
12648 * anonymous.cs: new file.
12650 2003-05-27 Miguel de Icaza <miguel@ximian.com>
12652 * class.cs (Field.Define): Add missing test for pointers and
12655 2003-05-27 Ravi Pratap <ravi@ximian.com>
12657 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
12658 we use the stobj opcode.
12660 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
12661 since it wasn't the correct fix.
12663 It still is puzzling that we are required to use stobj for IntPtr
12664 which seems to be a ValueType.
12666 2003-05-26 Miguel de Icaza <miguel@ximian.com>
12668 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
12669 during regular simple name resolution. Now, the trick is that
12670 instead of returning for processing the simplename, we do a
12671 TypeManager.LookupType (ie, a rooted lookup as opposed to a
12672 contextual lookup type). If a match is found, return that, if
12673 not, return for further composition.
12675 This fixes long-standing 30485.
12677 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
12678 using the address to initialize an object, do an Stobj instead of
12679 using the regular Stelem.
12681 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
12682 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
12683 Because if we are a BaseIndexerAccess that value will be true.
12686 * statement.cs (GotoCase.Resolve): Return after reporting an
12687 error, do not attempt to continue.
12689 * expression.cs (PointerArithmetic.Emit): If our operand is a
12690 long, convert our constants to match the operand before
12691 multiplying. Convert to I type before adding. Fixes 43670.
12693 2003-05-14 Ravi Pratap <ravi@ximian.com>
12695 * enum.cs (ImplicitConversionExists) : Rename to
12696 ImplicitEnumConversionExists to remove ambiguity.
12698 * ecore.cs (NullCast): New type of cast expression class which
12699 basically is very similar to EmptyCast with the difference being
12700 it still is a constant since it is used only to cast a null to
12702 (eg. (string) null)
12704 * convert.cs (ImplicitReferenceConversion): When casting a null
12705 literal, we return a NullCast.
12707 * literal.cs (NullLiteralTyped): Remove - I don't see why this
12708 should be around anymore.
12710 The renaming (reported was slightly wrong). Corrections:
12712 ConvertImplicitStandard -> ImplicitConversionStandard
12713 ConvertExplicitStandard -> ExplicitConversionStandard
12715 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
12716 before passing them in !
12718 * convert.cs (ImplicitConversionStandard): When comparing for
12719 equal expr and target types, ensure that expr is not a
12722 In general, we must not be checking (expr_type ==
12723 target_type) in the top level conversion methods
12724 (ImplicitConversion, ExplicitConversion etc). This checking is
12725 done in the methods that they delegate to.
12727 2003-05-20 Miguel de Icaza <miguel@ximian.com>
12729 * convert.cs: Move Error_CannotConvertType,
12730 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
12731 ImplicitNumericConversion, ImplicitConversionExists,
12732 ImplicitUserConversionExists, StandardConversionExists,
12733 FindMostEncompassedType, FindMostSpecificSource,
12734 FindMostSpecificTarget, ImplicitUserConversion,
12735 ExplicitUserConversion, GetConversionOperators,
12736 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
12737 TryImplicitIntConversion, Error_CannotConvertImplicit,
12738 ConvertImplicitRequired, ConvertNumericExplicit,
12739 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
12740 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
12743 Perform the following renames:
12745 StandardConversionExists -> ImplicitStandardConversionExists
12746 ConvertImplicit -> ImplicitConversion
12747 ConvertImplicitStandard -> ImplicitStandardConversion
12748 TryImplicitIntConversion -> ImplicitIntConversion
12749 ConvertImplicitRequired -> ImplicitConversionRequired
12750 ConvertNumericExplicit -> ExplicitNumericConversion
12751 ConvertReferenceExplicit -> ExplicitReferenceConversion
12752 ConvertExplicit -> ExplicitConversion
12753 ConvertExplicitStandard -> ExplicitStandardConversion
12755 2003-05-19 Martin Baulig <martin@ximian.com>
12757 * statement.cs (TypeInfo.StructInfo): Made this type protected.
12758 (TypeInfo): Added support for structs having structs as fields.
12760 * ecore.cs (FieldExpr): Implement IVariable.
12761 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
12762 VariableInfo for the field.
12764 2003-05-18 Martin Baulig <martin@ximian.com>
12766 * expression.cs (This.DoResolve): Report a CS0027 if we're
12767 emitting a field initializer.
12769 2003-05-18 Martin Baulig <martin@ximian.com>
12771 * expression.cs (This.ResolveBase): New public function.
12772 (This.DoResolve): Check for CS0188.
12774 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
12777 * ecore.cs (MethodGroupExpr.DoResolve): Set the
12778 `instance_expression' to null if we don't have any non-static
12781 2003-05-18 Martin Baulig <martin@ximian.com>
12783 Reworked the way how local variables and parameters are handled by
12784 the flow analysis code.
12786 * statement.cs (TypeInfo, VariableMap): New public classes.
12787 (VariableInfo): New public class. This is now responsible for
12788 checking whether a variable has been assigned. It is used for
12789 parameters and local variables.
12790 (Block.EmitMeta): Take the InternalParameters as argument; compute
12791 the layout of the flow vectors here.
12792 (Block.LocalMap, Block.ParameterMap): New public properties.
12793 (FlowBranching): The .ctor doesn't get the InternalParameters
12794 anymore since Block.EmitMeta() now computes the layout of the flow
12796 (MyStructInfo): This class is now known as `StructInfo' and nested
12797 in `TypeInfo'; we don't access this directly anymore.
12799 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
12800 property and removed IsAssigned(), IsFieldAssigned(),
12801 SetAssigned() and SetFieldAssigned(); we now call them on the
12802 VariableInfo so we don't need to duplicate this code everywhere.
12804 * expression.cs (ParameterReference): Added `Block block' argument
12806 (LocalVariableReference, ParameterReference, This): The new
12807 VariableInfo class is now responsible for all the definite
12810 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
12811 IsParameterAssigned, SetParameterAssigned): Removed.
12813 2003-05-18 Martin Baulig <martin@ximian.com>
12815 * typemanager.cs (InitCoreTypes): Try calling
12816 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
12817 the 3-args-version. Corlib now also needs our `void_type'.
12818 (GetMethod): Added overloaded version which takes an optional
12819 `bool report_errors' to allow lookups of optional methods.
12821 2003-05-12 Martin Baulig <martin@ximian.com>
12823 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
12824 only used for locals and not for parameters.
12826 2003-05-12 Miguel de Icaza <miguel@ximian.com>
12828 * support.cs (InternalParameters.ParameterType): Return the
12829 ExternalType of the parameter.
12831 * parameter.cs (Parameter.ExternalType): drop the two arguments,
12834 2003-05-11 Miguel de Icaza <miguel@ximian.com>
12836 * class.cs (MethodData.Define): Do not set the `newslot' on
12837 interface members, if they are also flagged as "override".
12839 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
12840 better code for ++i and i++. This only works for static fields
12841 and local variables.
12843 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
12844 want to pull the DeclSpace out of the builder_to_declspace instead
12845 of the TypeBuilder (like in TypeContainer.FindMembers).
12847 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
12848 instead of LookupTypeContainer. Fixes the crash on .NET for
12849 looking up interface members.
12851 * const.cs: Create our own emit context during the Definition
12852 stage, so that constants are evaluated in the proper context, when
12853 a recursive definition happens.
12855 2003-05-11 Martin Baulig <martin@ximian.com>
12857 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
12858 new block for a switch section.
12859 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
12860 the adding/lookup in the switch block. Fixes #39828.
12862 2003-05-09 Miguel de Icaza <miguel@ximian.com>
12864 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
12865 functionality: I needed to convert the data after I had performed
12866 the add/sub operation into the operands type size.
12868 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
12869 pass the type for the box operation, otherwise the resulting
12870 object would have been of type object.
12872 (BoxedCast): Add constructor to specify the type to box as.
12874 2003-05-07 Miguel de Icaza <miguel@ximian.com>
12876 * iterators.cs: I was reusing the `count' variable inadvertently,
12877 take steps to not allow this to happen.
12879 2003-05-06 Miguel de Icaza <miguel@ximian.com>
12881 * attribute.cs (Attribute.Resolve): Params attributes are encoded
12882 by creating an array at the point where the params starts and
12883 putting all those arguments there, then adjusting the size of the
12886 2003-05-05 Miguel de Icaza <miguel@ximian.com>
12888 * expression.cs (New.AddressOf): Implement interface
12889 IMemoryLocation. This is used when the `new' operator is used in
12890 the context of an invocation to a method on a value type.
12892 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
12895 * namespace.cs: Also check the using aliases here.
12897 * driver.cs: Move the test for using validity after the types have
12898 been entered, so we do a single pass that also includes the using
12901 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
12902 in the regular case. CreateSiblingForFinally is doing extra
12905 * attribute.cs (GetAttributeArgumentExpression): Store the result
12906 on an out value, and use the return value to indicate failure
12907 instead of using null (which is a valid return for Constant.GetValue).
12909 * statement.cs: Perform the analysis flow for the increment
12910 portion after the statement, because this will be the real flow of
12911 execution. Fixes #42385
12913 * codegen.cs (EmitContext.EmitArgument,
12914 EmitContext.EmitStoreArgument): New helper functions when the
12915 RemapToProxy flag is set.
12917 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
12920 Add support for remapping parameters.
12922 * iterators.cs: Propagate parameter values; Store parameter
12923 values in the proxy classes.
12925 2003-05-04 Miguel de Icaza <miguel@ximian.com>
12927 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
12928 need a proxy reference; I do not know what I was thinking
12930 * cs-parser.jay (constructor_initializer): catch another error,
12931 and display nice message.
12933 (field_declaration): catch void field declaration
12934 to flag a better error.
12936 * class.cs (MemberBase.CheckBase): Report an error instead of a
12937 warning if a new protected member is declared in a struct.
12938 (Field.Define): catch the error of readonly/volatile.
12940 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
12942 (FieldExpr.AddressOf): ditto. Catch error where the address of a
12943 volatile variable is taken
12945 2003-05-02 Miguel de Icaza <miguel@ximian.com>
12947 * statement.cs (Fixed.Resolve): Report an error if we are not in
12950 2003-05-01 Miguel de Icaza <miguel@ximian.com>
12952 * typemanager.cs: reuse the code that handles type clashes for
12953 delegates and enumerations.
12955 * class.cs (Report28): Always report.
12957 * expression.cs (EncodeAsAttribute): Allow nulls here.
12959 2003-04-28 Miguel de Icaza <miguel@ximian.com>
12961 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
12962 the functionality for testing whether an expression is valid for
12963 an attribute here. Also handle the case of arrays of elements
12966 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
12967 encoding a linear array into an array of objects that are suitable
12968 to be passed to an CustomAttributeBuilder.
12970 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
12972 * ecore.cs: (FieldExpr): Handle field remapping here.
12974 * iteratators.cs: Pass the instance variable (if the method is an
12975 instance method) to the constructors, so we can access the field
12976 variables on the class.
12978 TODO: Test this with structs. I think the THIS variable on
12979 structs might have to be a pointer, and not a refenrece
12981 2003-04-27 Miguel de Icaza <miguel@ximian.com>
12983 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
12984 local variables to fields in a proxy class.
12986 * iterators.cs (PopulateProxy): Rename our internal fields to
12988 Create a <THIS> field if we are an instance method, so we can
12989 reference our parent container variables.
12990 (MapVariable): Called back from the EmitContext code to enter a
12991 new variable to field mapping into the proxy class (we just create
12995 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
12996 for using the remapped locals to fields.
12998 I placed the code here, because that gives the same semantics to
12999 local variables, and only changes the Emit code.
13001 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
13002 statements inside iterators.
13003 (VariableInfo): Add a FieldBuilder for the cases when we are
13004 remapping local variables to fields in a proxy class
13006 * ecore.cs (SimpleNameResolve): Avoid testing two times for
13007 current_block != null.
13009 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
13010 not cope with strings, as it has been moved to the
13011 TableSwitchEmit. Fixed bug in switch generation.
13013 * expression.cs (New.DoResolve): Provide more context for the user
13014 when reporting an error.
13016 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
13019 * expression.cs (MemberAccess.DoResolve): When we get a type back,
13020 check the permissions for it. Note than in a type-resolution
13021 context the check was already present in DeclSpace.ResolveType,
13022 but was missing from the MemberAccess.
13024 (ArrayCreation.CheckIndices): warn if the user has
13025 more nested levels of expressions, but there are no more
13026 dimensions specified. Avoids crash on bug 41906.
13028 2003-04-26 Miguel de Icaza <miguel@ximian.com>
13030 * statement.cs (Block): replace Implicit bool, for a generic
13032 New flag: `Unchecked'. This is used during the EmitMeta phase
13033 (which is out-of-line with the regular Resolve/Emit process for a
13034 statement, as this is done ahead of time, but still gets a chance
13035 to call constant resolve).
13037 (Block.Flags): new enum for adding a new flag.
13039 (Block.EmitMeta): track the state of unchecked.
13041 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
13042 to enable constant resolution to work there as well.
13044 2003-04-22 Miguel de Icaza <miguel@ximian.com>
13046 * typemanager.cs (ienumerable_type): Also look up
13047 System.Collections.IEnumerable.
13049 2003-04-21 Miguel de Icaza <miguel@ximian.com>
13051 TODO: Test more than one conditional per method.
13053 * class.cs (Indexer.Define): Report the location where the user is
13054 referencing the unsupported feature.
13056 (MethodData): Overload the use of `conditionals' to
13057 minimize the creation of needless ArrayLists. This saves roughly
13058 212kb on my machine.
13060 (Method): Implement the new IIteratorContainer interface.
13061 (Method.SetYields): Implement the method by setting the ModFlags
13062 to contain METHOD_YIELDS.
13064 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
13065 which just got set to null.
13067 * iterators.cs: New file.
13069 (Yield, YieldBreak): New statements.
13071 * statement.cs (Return.Resolve): Flag an error if we are used in
13072 an iterator method.
13074 * codegen.cs (InIterator): New flag set if the code is being
13075 compiled in an iterator method.
13077 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
13078 internal modifier, and we just use it to avoid adding extra
13079 fields, as this is seldom used.
13081 * cs-parser.jay: Add yield_statement (yield and yield break).
13083 * driver.cs: New flag -v2 to turn on version 2 features.
13085 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
13086 hashtable when v2 is enabled.
13088 2003-04-20 Miguel de Icaza <miguel@ximian.com>
13090 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
13091 there is already a namespace defined with this name.
13093 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
13094 people upgraded their corlibs.
13096 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
13097 always use fully qualified types, no need to use the compiler
13100 (TypeManager.IsNamespace): Use binarysearch.
13102 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
13103 AddDelegate): I did not quite use the new IsValid API properly: I
13104 have to pass the short-name and the fullname. I was passing only
13105 the basename instead of the fullname sometimes.
13107 (TypeContainer.DefineType): call NamespaceClash.
13109 * interface.cs (Interface.DefineType): use NamespaceClash before
13112 * delegate.cs (Delegate.DefineType): use NamespaceClash before
13115 * enum.cs: (Enum.DefineType): use NamespaceClash before
13118 * typemanager.cs (: 3-line patch that gives us some tasty 11%
13119 speed increase. First, use the negative_hits cache when we get a
13120 negative. Second, add the type with its full original name
13121 instead of the new . and + encoded name (reflection uses + to
13122 separate type from a nested type). Use LookupTypeReflection
13123 directly which bypasses the type->name hashtable (that we already
13124 know does not contain the type.
13126 * decl.cs (DeclSpace.ResolveTypeExpr): track the
13127 location/container type.
13129 * driver.cs: When passing utf8, use directly the UTF8Encoding.
13131 2003-04-19 Miguel de Icaza <miguel@ximian.com>
13133 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
13135 * delegate.cs (NewDelegate.Resolve): Test whether an instance
13136 method is being referenced in the method group from a static
13137 context, and report error 120 if so.
13139 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
13142 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
13143 is created, we create the A namespace).
13145 * cs-parser.jay: A namespace also introduces a DeclarationFound.
13148 2003-04-18 Miguel de Icaza <miguel@ximian.com>
13150 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
13151 invocation to ModuleBuilder.GetType with the same values will
13152 return a new type instance, so we need to cache its return
13155 * expression.cs (Binary.ResolveOperator): Only allow the compare
13156 operators on enums if they are of the same type.
13158 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
13159 types of ValueType on their own case. Before we were giving them
13160 the same treatment as objects.
13162 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
13163 fullname. Short name is used to compare against container name.
13164 Fullname is used to check against defined namespace names.
13166 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
13167 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
13169 (Method.CheckBase): Call parent.
13170 (MemberBase.CheckBase): Check for protected members on sealed
13172 (PropertyBase.CheckBase): Call parent.
13173 (Field.Define): Call parent.
13175 * report.cs: Negative error codes are now mapped to 8000 - code,
13176 so that the display is render more nicely.
13178 * typemanager.cs: Do not use try/catch, instead report a regular
13181 (GetPointerType, GetReferenceType): These methods provide
13182 mechanisms to obtain the T* and T& from a T. We had the code
13183 previously scattered around the code base, and it also used
13184 TypeManager.LookupType that would go through plenty of caches.
13185 This one goes directly to the type source.
13187 In some places we did the Type.GetType followed by
13188 ModuleBuilder.GetType, but not in others, so this unifies the
13189 processing as well.
13191 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
13192 statements now that we have namespace information.
13194 * typemanager.cs (IsNamespace): New method, returns whether the
13195 string presented is a namespace or not.
13197 (ComputeNamespaces): New public entry point, computes the list of
13198 available namespaces, using the GetNamespaces API call in Mono, or
13199 the slower version in MS.NET.
13201 Now before we start the semantic analysis phase, we have a
13202 complete list of namespaces including everything that the user has
13205 Deleted old code to cache namespaces in .nsc files.
13207 2003-04-17 Miguel de Icaza <miguel@ximian.com>
13209 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
13210 class/struct location definition Location for the implicit
13211 constructor location.
13213 (Operator.Define): Use the location of the operator for the
13214 implicit Method definition.
13216 (Constructor.Emit): use the constructor location for the implicit
13217 base initializer constructor.
13219 * ecore.cs: Remove ITypeExpression. This interface is now gone,
13220 and the Expression class now contains two new methods:
13222 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
13223 isolate type lookup from the rest of the resolution process.
13225 Since we use Expressions to hold type definitions due to the way
13226 we parse the input we have historically overloaded Resolve to
13227 perform the Type lookups if a special flag is passed. Now this is
13228 eliminated and two methods take their place.
13230 The differences in the two methods between xStep and xTerminal is
13231 that xStep is involved in our current lookup system that uses
13232 SimpleNames to compose a name, while xTerminal is used just to
13233 catch the case where the simplename lookup failed.
13235 2003-04-16 Miguel de Icaza <miguel@ximian.com>
13237 * expression.cs (ResolveMemberAccess): Remove redundant code.
13238 TypeExpr expressions are always born fully resolved.
13240 * interface.cs (PopulateMethod): Do not lookup the types twice.
13241 We were doing it once during SemanticAnalysis and once during
13244 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
13245 in local variable type definitions, were being returned as a
13246 SimpleName (we decomposed everything into a string), that is
13247 because primary_expression was being used instead of a type in the
13248 grammar (reduce/reduce conflicts).
13250 The part that was wrong is that we converted the expression into a
13251 string (an oversimplification in one hand, compounded with primary
13252 expressions doing string concatenation).
13258 Would return "A.B.C[]" as a SimpleName. This stopped things like
13259 using clauses from working on this particular context. And a type
13260 was being matched directly against "A.B.C[]".
13262 We now use the correct approach, and allow for ComposedCast to be
13263 part of the unary expression. So the "A.B.C []" become a composed
13264 cast of "A.B.C" (as a nested group of MemberAccess with a
13265 SimpleName at the end) plus the rank composition "[]".
13269 2003-04-10 Miguel de Icaza <miguel@ximian.com>
13271 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
13272 for the access level checking.
13274 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
13275 `TypeContainer container', because I kept getting confused when I
13276 was debugging this code.
13278 * expression.cs (Indexers): Instead of tracking getters/setters,
13279 we now track them in parallel. We create one arraylist less, but
13280 most importantly it is possible now for the LValue code to find a
13281 matching get for a set.
13283 (IndexerAccess.DoResolveLValue): Update the code.
13284 GetIndexersForType has been modified already to extract all the
13285 indexers from a type. The code assumed it did not.
13287 Also make the code set the correct return type for the indexer.
13288 This was fixed a long time ago for properties, but was missing for
13289 indexers. It used to be void_type.
13291 (Binary.Emit): Test first for doubles instead of
13292 floats, as they are more common.
13294 (Binary.EmitBranchable): Use the .un version of the branch opcodes
13295 when dealing with floats and the <=, >= operators. This fixes bug
13298 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
13299 to load the array value by emitting a load on the foreach variable
13300 type. This was incorrect.
13302 We now emit the code to load an element using the the array
13303 variable type, and then we emit the conversion operator.
13307 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
13309 * attribute.cs: Avoid allocation of ArrayLists in the common case.
13311 2003-04-09 Miguel de Icaza <miguel@ximian.com>
13313 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
13314 test for protection before we test for signatures.
13316 (MethodSignature.ToString): implement.
13318 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
13319 to the case where we reduced into a LongConstant.
13321 * decl.cs (CheckAccessLevel): If the type is an array, we can not
13322 depend on whether the information is acurrate, because the
13323 Microsoft runtime will always claim that the array type is public,
13324 regardless of the real state.
13326 If the type is a pointer, another problem happens: the type is
13327 reported as non-public in Microsoft.
13329 In both cases we have to call CheckAccessLevel recursively with
13330 the underlying type as the argument to be tested.
13332 2003-04-08 Miguel de Icaza <miguel@ximian.com>
13334 * assign.cs (Assign.Emit): If we are dealing with a compound
13335 assignment expression, we should use the code path that stores the
13336 intermediate result in a temporary value. This fixes #40903.
13338 *expression.cs (Indirection.ToString): Provide ToString method for
13341 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
13343 * class.cs: Null out fields holding references to Block objects so
13344 they can be garbage collected.
13346 * expression.cs (OverloadResolve): Remove unused local.
13348 2003-04-07 Martin Baulig <martin@ximian.com>
13350 * codegen.cs (EmitContext.CurrentFile): New public field.
13351 (EmitContext.Mark): Use the CurrentFile to check whether the
13352 location is in the correct file.
13353 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
13355 2003-04-07 Martin Baulig <martin@ximian.com>
13357 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
13359 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
13360 location. [FIXME: The location argument which gets passed to this
13361 method is sometimes wrong!]
13363 2003-04-07 Nick Drochak <ndrochak@gol.com>
13365 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
13367 2003-04-07 Miguel de Icaza <miguel@ximian.com>
13369 * expression.cs (Indirection.EmitAssign): We were using the
13370 temporary, but returning immediately instead of continuing the
13373 2003-04-06 Martin Baulig <martin@ximian.com>
13375 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
13376 if it's a nested child, but also deriving from the outer class.
13379 * typemanager.cs (IsNestedChildOf): Make this work if it's a
13380 nested child, but also deriving from the outer class. See
13382 (FilterWithClosure): We may access private members of the outer
13383 class if we're a nested child and deriving from the outer class.
13384 (RealMemberLookup): Only set `closure_private_ok' if the
13385 `original_bf' contained BindingFlags.NonPublic.
13387 2003-04-05 Martin Baulig <martin@ximian.com>
13389 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
13391 2003-04-02 Miguel de Icaza <miguel@ximian.com>
13393 * class.cs (Event.Define): Do not allow abstract events to have
13396 2003-04-01 Miguel de Icaza <miguel@ximian.com>
13398 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
13399 block in event declarations.
13401 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
13402 value type, get its address.
13404 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
13405 leaving a class on the stack instead of a boolean value (int
13406 0/1). Change the code so we compare against null, and then the
13407 result against zero.
13409 * class.cs (TypeContainer.GetClassBases): We were checking for the
13410 parent class being sealed too late.
13412 * expression.cs (Binary.Emit): For <= and >= when dealing with
13413 floating point values, use cgt.un and clt.un instead of cgt and
13416 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
13418 * statement.cs: Apply the same optimization as MS: skip the
13419 GetEnumerator returning an IEnumerator, and use the one returning a
13420 CharEnumerator instead. This allows us to avoid the try-finally block
13423 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
13425 * cs-parser.jay: Attributes cannot be applied to
13426 namespaces. Fixes #40473
13428 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13431 (Add*): check if the name is valid using the full name for constants,
13432 fields, properties and events.
13434 2003-03-28 Miguel de Icaza <miguel@ximian.com>
13436 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
13437 char constants to be part of the enumeration.
13439 * expression.cs (Conditional.DoResolve): Add support for operator
13440 true. Implements the missing functionality from 14.12
13442 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
13443 operator true/false as required by the spec.
13445 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
13446 implicit conversion to boolean.
13448 * statement.cs (Statement.ResolveBoolean): A boolean expression is
13449 also one where the type implements `operator true'.
13451 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
13452 get an expression that will invoke operator true based on an
13455 (GetConversionOperators): Removed the hack that called op_True
13458 (Expression.ResolveBoolean): Move this from Statement.
13460 2003-03-17 Miguel de Icaza <miguel@ximian.com>
13462 * ecore.cs (FieldExpr): do not allow initialization of initonly
13463 fields on derived classes
13465 2003-03-13 Martin Baulig <martin@ximian.com>
13467 * statement.cs (Block.Emit): Call ig.BeginScope() and
13468 ig.EndScope() when compiling with debugging info; call
13469 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
13471 2003-03-08 Miguel de Icaza <miguel@ximian.com>
13473 * expression.cs (Indexers): Do not construct immediately, allow
13474 for new members to be appended as we go. Fixes 38143
13476 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13478 * expression.cs: save/restore context when resolving an unchecked
13481 2003-03-05 Miguel de Icaza <miguel@ximian.com>
13483 * cfold.cs: Catch division by zero in modulus operator during
13486 2003-03-03 Miguel de Icaza <miguel@ximian.com>
13488 * interface.cs (Interface.DefineMembers): Avoid defining members
13491 2003-02-27 Miguel de Icaza <miguel@ximian.com>
13493 * driver.cs: handle the +/- options for -noconfig
13495 * statement.cs (Unckeched.Resolve): Also track the state of
13496 unchecked in the Resolve phase.
13498 2003-02-27 Martin Baulig <martin@ximian.com>
13500 * ecore.cs (Expression.MemberLookup): Don't create a
13501 MethodGroupExpr for something which is not a method. Fixes #38291.
13503 2003-02-25 Miguel de Icaza <miguel@ximian.com>
13505 * class.cs (MemberBase.CheckParameters): Also check that the type
13506 is unmanaged if it is a pointer.
13508 * expression.cs (SizeOf.Resolve): Add location information.
13510 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
13511 a managed type is declared.
13513 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
13514 parameter modifiers as well. Fixes bug 38606
13516 * class.cs: Very sad. Am backing out the speed up changes
13517 introduced by the ArrayList -> Array in the TypeContainer, as they
13518 were not actually that much faster, and introduced a bug (no error
13519 reports on duplicated methods).
13521 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
13522 source first, this will guarantee that we have a valid expression
13523 before calling in lower levels functions that will require a
13524 resolved object. Then use this original_source in the
13525 target.ResolveLValue instead of the original source that was
13528 Another change. Use target.Resolve instead of LValueResolve.
13529 Although we are resolving for LValues, we will let the Assign code
13530 take care of that (it will be called again from Resolve). This
13531 basically allows code like this:
13533 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
13534 class Y { void A (X x) { x [0] += o; }
13536 The problem was that the indexer was trying to resolve for
13537 set_Item (idx, object o) and never finding one. The real set_Item
13538 was set_Item (idx, X). By delaying the process we get the right
13543 2003-02-23 Martin Baulig <martin@ximian.com>
13545 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
13546 while calling DoEmit ().
13548 * codegen.cs (EmitContext.Mark): Don't mark locations in other
13549 source files; if you use the #line directive inside a method, the
13550 compiler stops emitting line numbers for the debugger until it
13551 reaches the end of the method or another #line directive which
13552 restores the original file.
13554 2003-02-23 Martin Baulig <martin@ximian.com>
13556 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
13558 2003-02-23 Martin Baulig <martin@ximian.com>
13560 * statement.cs (Block.AddChildVariableNames): We need to call this
13561 recursively, not just for our immediate children.
13563 2003-02-23 Martin Baulig <martin@ximian.com>
13565 * class.cs (Event.Define): Always make the field private, like csc does.
13567 * typemanager.cs (TypeManager.RealMemberLookup): Make events
13568 actually work, fixes bug #37521.
13570 2003-02-23 Miguel de Icaza <miguel@ximian.com>
13572 * delegate.cs: When creating the various temporary "Parameters"
13573 classes, make sure that we call the ComputeAndDefineParameterTypes
13574 on those new parameters (just like we do with the formal ones), to
13575 allow them to be resolved in the context of the DeclSpace.
13577 This fixes the bug that Dick observed in Bugzilla #38530.
13579 2003-02-22 Miguel de Icaza <miguel@ximian.com>
13581 * expression.cs (ResolveMemberAccess): When resolving a constant,
13582 do not attempt to pull a constant if the value was not able to
13583 generate a valid constant.
13585 * const.cs (LookupConstantValue): Do not report more errors than required.
13587 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13589 * expression.cs: fixes bug #38328.
13591 2003-02-18 Miguel de Icaza <miguel@ximian.com>
13593 * class.cs: Changed all the various members that can be part of a
13594 class from being an ArrayList to be an Array of the right type.
13595 During the DefineType type_list, interface_list, delegate_list and
13596 enum_list are turned into types, interfaces, delegates and enums
13599 And during the member population, indexer_list, event_list,
13600 constant_list, field_list, instance_constructor_list, method_list,
13601 operator_list and property_list are turned into their real arrays.
13603 Although we could probably perform this operation earlier, for
13604 good error reporting we need to keep the lists and remove the
13605 lists for longer than required.
13607 This optimization was triggered by Paolo profiling the compiler
13608 speed on the output of `gen-sample-program.pl' perl script.
13610 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
13611 not crash in methods like MemberLookupFailed that use this field.
13613 This problem arises when the compiler fails to resolve a type
13614 during interface type definition for example.
13616 2003-02-18 Miguel de Icaza <miguel@ximian.com>
13618 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
13619 inherit from System.Object, so we have to stop at null, not only
13620 when reaching System.Object.
13622 2003-02-17 Miguel de Icaza <miguel@ximian.com>
13624 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
13625 DeclaredOnly because the parent indexer might have had a different
13626 name, but did not loop until the top of the hierarchy was reached.
13628 The problem this one fixes is 35492: when a class implemented an
13629 indexer from an interface, we were getting the interface method
13630 (which was abstract) and we were flagging an error (can not invoke
13633 This also keeps bug 33089 functioning, and test-148 functioning.
13635 * typemanager.cs (IsSpecialMethod): The correct way of figuring
13636 out if a method is special is to see if it is declared in a
13637 property or event, or whether it is one of the predefined operator
13638 names. This should fix correctly #36804.
13640 2003-02-15 Miguel de Icaza <miguel@ximian.com>
13642 The goal here is to remove the dependency on EmptyCast.Peel ().
13643 Killing it completely.
13645 The problem is that currently in a number of places where
13646 constants are expected, we have to "probe" for an EmptyCast, and
13647 Peel, which is not the correct thing to do, as this will be
13648 repetitive and will likely lead to errors.
13650 The idea is to remove any EmptyCasts that are used in casts that
13651 can be reduced to constants, so we only have to cope with
13654 This bug hunt was triggered by Bug 37363 and the desire to remove
13655 the duplicate pattern where we were "peeling" emptycasts to check
13656 whether they were constants. Now constants will always be
13659 * ecore.cs: Use an enumconstant here instead of wrapping with
13662 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
13663 throwing me off. By handling this we can get rid of a few hacks.
13665 * statement.cs (Switch): Removed Peel() code.
13667 2003-02-14 Miguel de Icaza <miguel@ximian.com>
13669 * class.cs: Location information for error 508
13671 * expression.cs (New.DoResolve): Add a guard against double
13672 resolution of an expression.
13674 The New DoResolve might be called twice when initializing field
13675 expressions (see EmitFieldInitializers, the call to
13676 GetInitializerExpression will perform a resolve on the expression,
13677 and later the assign will trigger another resolution
13679 This leads to bugs (#37014)
13681 * delegate.cs: The signature for EndInvoke should contain any ref
13682 or out parameters as well. We were not doing this in the past.
13684 * class.cs (Field.Define): Do not overwrite the type definition
13685 inside the `volatile' group. Turns out that volatile enumerations
13686 were changing the type here to perform a validity test, which
13689 2003-02-12 Miguel de Icaza <miguel@ximian.com>
13691 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
13692 and structs, we do not want to load the instance variable
13694 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
13695 enum_type has to be handled like an object reference (implicit
13696 conversions exists from this to object), but the regular IsClass
13697 and IsValueType tests will never return true for this one.
13699 Also we use TypeManager.IsValueType instead of type.IsValueType,
13700 just for consistency with the rest of the code (this is only
13701 needed if we ever use the construct exposed by test-180.cs inside
13702 corlib, which we dont today).
13704 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
13706 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
13709 2003-02-09 Martin Baulig <martin@ximian.com>
13711 * namespace.cs (Namespace..ctor): Added SourceFile argument.
13712 (Namespace.DefineNamespaces): New static public method; this is
13713 called when we're compiling with debugging to add all namespaces
13714 to the symbol file.
13716 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
13717 pass it to the Namespace's .ctor.
13719 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
13720 and MethodBase arguments; pass the namespace ID to the symwriter;
13721 pass the MethodBase instead of the token to the symwriter.
13722 (SymbolWriter.DefineNamespace): New method to add a namespace to
13725 2003-02-09 Martin Baulig <martin@ximian.com>
13727 * symbolwriter.cs: New file. This is a wrapper around
13728 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
13729 methods here in near future.
13731 2003-02-09 Martin Baulig <martin@ximian.com>
13733 * codegen.cs (EmitContext.Mark): Just pass the arguments to
13734 ILGenerator.MarkSequencePoint() which are actually used by the
13737 2003-02-09 Martin Baulig <martin@ximian.com>
13739 * location.cs (SourceFile): New public sealed class. This
13740 contains the name and an index which is used in the location's token.
13741 (Location): Reserve an appropriate number of bits in the token for
13742 the source file instead of walking over that list, this gives us a
13743 really huge performance improvement when compiling with debugging.
13745 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
13746 `SourceFile' argument instead of a string.
13747 (Driver.ProcessFile): Add all the files via Location.AddFile(),
13748 but don't parse/tokenize here, we need to generate the list of all
13749 source files before we do that.
13750 (Driver.ProcessFiles): New static function. Parses/tokenizes all
13753 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
13754 instead of a string.
13756 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
13759 2003-02-09 Martin Baulig <martin@ximian.com>
13761 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
13762 filename on `#line default'.
13764 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
13766 * statement.cs: don't clear the pinned var when the fixed statement
13767 returns from the method (fixes bug#37752).
13769 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
13771 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
13774 2003-02-07 Martin Baulig <martin@ximian.com>
13776 * driver.cs: Removed the `--debug-args' command line argument.
13778 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
13779 automatically by the AsssemblyBuilder.
13780 (CodeGen.InitializeSymbolWriter): We don't need to call any
13781 initialization function on the symbol writer anymore. This method
13782 doesn't take any arguments.
13784 2003-02-03 Miguel de Icaza <miguel@ximian.com>
13786 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
13787 from referenced assemblies as well.
13789 2003-02-02 Martin Baulig <martin@ximian.com>
13791 * class.cs (MethodData.Emit): Generate debugging info for external methods.
13793 2003-02-02 Martin Baulig <martin@ximian.com>
13795 * class.cs (Constructor.Emit): Open the symbol writer before
13796 emitting the constructor initializer.
13797 (ConstructorInitializer.Emit): Call ec.Mark() to allow
13798 single-stepping through constructor initializers.
13800 2003-01-30 Miguel de Icaza <miguel@ximian.com>
13802 * class.cs: Handle error 549: do not allow virtual methods in
13805 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
13807 * decl.cs: Check access levels when resolving types
13809 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
13811 * statement.cs: Add parameters and locals set in catch blocks that might
13812 return to set vector
13814 2003-01-29 Miguel de Icaza <miguel@ximian.com>
13816 * class.cs (Operator): Set the SpecialName flags for operators.
13818 * expression.cs (Invocation.DoResolve): Only block calls to
13819 accessors and operators on SpecialName methods.
13821 (Cast.TryReduce): Handle conversions from char constants.
13824 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
13826 * statement.cs: small memory and time optimization in FlowBranching.
13828 2003-01-28 Pedro Mart <yoros@wanadoo.es>
13830 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
13831 problem that the last fix but in the other sid (Set).
13833 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
13834 access when there is no indexer in the hierarchy.
13836 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
13838 * class.cs: Combine some if statements.
13840 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13842 * driver.cs: fixed bug #37187.
13844 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
13846 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
13847 any indexer, it's needed to build a list with all the indexers in the
13848 hierarchy (AllGetters), else we have problems. Fixes #35653.
13850 2003-01-23 Miguel de Icaza <miguel@ximian.com>
13852 * class.cs (MethodData.Define): It is wrong for an interface
13853 implementation to be static in both cases: explicit and implicit.
13854 We were only handling this in one case.
13856 Improve the if situation there to not have negations.
13858 * class.cs (Field.Define): Turns out that we do not need to check
13859 the unsafe bit on field definition, only on usage. Remove the test.
13861 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13863 * driver.cs: use assembly.Location instead of Codebase (the latest
13864 patch made mcs fail when using MS assemblies).
13866 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
13868 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
13869 get the path to *corlib.dll.
13871 2003-01-21 Nick Drochak <ndrochak@gol.com>
13875 * typemanager.cs: Remove compiler warnings
13877 2003-01-20 Duncan Mak <duncan@ximian.com>
13879 * AssemblyInfo.cs: Bump the version number to 0.19.
13881 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13883 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
13885 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
13887 * class.cs (Constructor::Emit): Emit debugging info for constructors.
13889 2003-01-17 Miguel de Icaza <miguel@ximian.com>
13891 * cs-parser.jay: Small fix: we were not comparing the constructor
13892 name correctly. Thanks to Zoltan for the initial pointer.
13894 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
13896 * cs-tokenizer.cs: Set file name when specified with #line
13898 2003-01-15 Miguel de Icaza <miguel@ximian.com>
13900 * cs-parser.jay: Only perform the constructor checks here if we
13901 are named like the class; This will help provider a better
13902 error. The constructor path is taken when a type definition is
13903 not found, but most likely the user forgot to add the type, so
13904 report that rather than the constructor error.
13906 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
13908 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
13911 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
13913 * cs-parser.jay: Add cleanup call.
13915 2003-01-13 Duncan Mak <duncan@ximian.com>
13917 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
13918 consistent with other methods.
13920 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
13922 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
13924 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
13926 * attribute.cs: only set GuidAttr to true when we have a
13929 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13933 * typemanager.cs: fixes to allow mcs compile corlib with the new
13934 Type.IsSubclassOf fix.
13936 2003-01-08 Miguel de Icaza <miguel@ximian.com>
13938 * expression.cs (LocalVariableReference.DoResolve): Classify a
13939 constant as a value, not as a variable. Also, set the type for
13942 * cs-parser.jay (fixed_statement): take a type instead of a
13943 pointer_type, so we can produce a better error message later.
13945 * statement.cs (Fixed.Resolve): Flag types that are not pointers
13948 (For.DoEmit): Make inifinite loops have a
13949 non-conditional branch back.
13951 (Fixed.DoEmit): First populate the pinned variables, then emit the
13952 statement, then clear the variables. Before I was emitting the
13953 code once for each fixed piece.
13956 2003-01-08 Martin Baulig <martin@ximian.com>
13958 * statement.cs (FlowBranching.MergeChild): A break in a
13959 SWITCH_SECTION does not leave a loop. Fixes #36155.
13961 2003-01-08 Martin Baulig <martin@ximian.com>
13963 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
13964 lives in the same number space than `param_map'. Fixes #36154.
13966 2003-01-07 Miguel de Icaza <miguel@ximian.com>
13968 * cs-parser.jay (constructor_declaration): Set the
13969 Constructor.ModFlags before probing for it. This makes the
13970 compiler report 514, 515 and 132 (the code was there, but got
13973 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
13974 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
13975 (GotoCase.Resolve): Set `Returns' to ALWAYS.
13977 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
13979 * enum.cs: create the enum static fields using the enum type.
13981 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
13983 * class.cs: don't try to create the ParamBuilder for the return
13984 type if it's not needed (and handle it breaking for the ms runtime
13987 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
13989 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
13991 2002-12-29 Miguel de Icaza <miguel@ximian.com>
13993 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
13994 the command. This showed up while compiling the JANET source
13995 code, which used \r as its only newline separator.
13997 2002-12-28 Miguel de Icaza <miguel@ximian.com>
13999 * class.cs (Method.Define): If we are an operator (because it
14000 reuses our code), then set the SpecialName and HideBySig. #36128
14002 2002-12-22 Miguel de Icaza <miguel@ximian.com>
14004 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
14005 exception, report error 120 `object reference required'.
14007 * driver.cs: Add --pause option, used during to measure the size
14008 of the process as it goes with --timestamp.
14010 * expression.cs (Invocation.DoResolve): Do not allow methods with
14011 SpecialName to be invoked.
14013 2002-12-21 Miguel de Icaza <miguel@ximian.com>
14015 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
14016 number before adding it.
14018 2002-12-21 Ravi Pratap <ravi@ximian.com>
14020 * ecore.cs (StandardImplicitConversion): When in an unsafe
14021 context, we allow conversion between void * to any other pointer
14022 type. This fixes bug #35973.
14024 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
14026 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
14027 is not thrown when extensionless outputs are used
14029 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14031 * rootcontext.cs: fixed compilation of corlib.
14033 2002-12-19 Miguel de Icaza <miguel@ximian.com>
14035 * attribute.cs (Attributes.Contains): Add new method.
14037 * class.cs (MethodCore.LabelParameters): if the parameter is an
14038 `out' parameter, check that no attribute `[In]' has been passed.
14040 * enum.cs: Handle the `value__' name in an enumeration.
14042 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
14044 * decl.cs: Added special case to allow overrides on "protected
14047 2002-12-18 Ravi Pratap <ravi@ximian.com>
14049 * attribute.cs (Attributes.AddAttributeSection): Rename to this
14050 since it makes much more sense.
14052 (Attributes.ctor): Don't require a Location parameter.
14054 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
14056 * attribute.cs (ApplyAttributes): Remove extra Location parameters
14057 since we already have that information per attribute.
14059 * everywhere : make appropriate changes.
14061 * class.cs (LabelParameters): Write the code which actually
14062 applies attributes to the return type. We can't do this on the MS
14063 .NET runtime so we flag a warning in the case an exception is
14066 2002-12-18 Miguel de Icaza <miguel@ximian.com>
14068 * const.cs: Handle implicit null conversions here too.
14070 2002-12-17 Ravi Pratap <ravi@ximian.com>
14072 * class.cs (MethodCore.LabelParameters): Remove the extra
14073 Type [] parameter since it is completely unnecessary. Instead
14074 pass in the method's attributes so that we can extract
14075 the "return" attribute.
14077 2002-12-17 Miguel de Icaza <miguel@ximian.com>
14079 * cs-parser.jay (parse): Use Report.Error to flag errors instead
14080 of ignoring it and letting the compile continue.
14082 * typemanager.cs (ChangeType): use an extra argument to return an
14083 error condition instead of throwing an exception.
14085 2002-12-15 Miguel de Icaza <miguel@ximian.com>
14087 * expression.cs (Unary.TryReduce): mimic the code for the regular
14088 code path. Perform an implicit cast in the cases where we can
14089 implicitly convert to one of the integral types, and then reduce
14090 based on that constant. This fixes bug #35483.
14092 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14094 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
14096 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14098 * namespace.cs: fixed bug #35489.
14100 2002-12-12 Miguel de Icaza <miguel@ximian.com>
14102 * class.cs: Remove some dead code.
14104 * cs-parser.jay: Estimate the number of methods needed
14105 (RootContext.MethodCount);
14107 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
14108 numbers instead of StringBuilders.
14110 * support.cs (PtrHashtable): Add constructor with initial size;
14111 We can now reduce reallocations of the method table.
14113 2002-12-10 Ravi Pratap <ravi@ximian.com>
14115 * attribute.cs (ApplyAttributes): Keep track of the emitted
14116 attributes on a per-target basis. This fixes bug #35413.
14118 2002-12-10 Miguel de Icaza <miguel@ximian.com>
14120 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
14121 default to the Windows 1252 encoding.
14123 (UnixParseOption): Support version, thanks to Alp for the missing
14126 * AssemblyInfo.cs: Add nice assembly information.
14128 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
14131 * cs-parser.jay: Allow a trailing comma before the close bracked
14132 in the attribute_section production.
14134 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
14135 address of the instance was being taken, I will take this out,
14136 because we take the address of the object immediately here.
14138 2002-12-09 Ravi Pratap <ravi@ximian.com>
14140 * typemanager.cs (AreMultipleAllowed): Take care of the most
14141 obvious case where attribute type is not in the current assembly -
14144 2002-12-08 Miguel de Icaza <miguel@ximian.com>
14146 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
14147 definitions, instead of doing that afterwards.
14149 Also we use a nice little hack, depending on the constructor, we
14150 know if we are a "composed" name or a simple name. Hence, we
14151 avoid the IndexOf test, and we avoid
14153 * codegen.cs: Add code to assist in a bug reporter to track down
14154 the source of a compiler crash.
14156 2002-12-07 Ravi Pratap <ravi@ximian.com>
14158 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
14159 types have been emitted for a given element and flag an error
14160 if something which does not have AllowMultiple set is used more
14163 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
14164 attribute types and their corresponding AllowMultiple properties
14166 (AreMultipleAllowed): Check the property for a given type.
14168 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
14169 property in the case we have a TypeContainer.
14171 (Attributes.AddAttribute): Detect duplicates and just skip on
14172 adding them. This trivial fix catches a pretty gross error in our
14173 attribute emission - global attributes were being emitted twice!
14175 Bugzilla bug #33187 is now fixed.
14177 2002-12-06 Miguel de Icaza <miguel@ximian.com>
14179 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
14180 instead of pp_and).
14182 * expression.cs (Binary.ResolveOperator): I can only use the
14183 Concat (string, string, string) and Concat (string, string,
14184 string, string) if the child is actually a concatenation of
14187 2002-12-04 Miguel de Icaza <miguel@ximian.com>
14189 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
14190 context where we need a 2-character lookahead.
14192 * pending.cs (PendingImplementation): Rework so we can keep track
14193 of interface types all the time, and flag those which were
14194 implemented by parents as optional.
14196 2002-12-03 Miguel de Icaza <miguel@ximian.com>
14198 * expression.cs (Binary.ResolveOperator): Use
14199 String.Concat(string,string,string) or
14200 String.Concat(string,string,string,string) when possible.
14202 * typemanager: More helper methods.
14205 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
14207 * pending.cs: remove the bogus return from GetMissingInterfaces()
14208 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
14210 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14212 * namespace.cs: avoid duplicated 'using xxx' being added to
14213 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
14214 when we get more than one 'using' statement for the same namespace.
14215 Report a CS0105 warning for it.
14217 2002-11-30 Miguel de Icaza <miguel@ximian.com>
14219 * cs-tokenizer.cs (consume_identifier): use read directly, instead
14220 of calling getChar/putback, uses internal knowledge of it.
14222 (xtoken): Reorder tokenizer so most common patterns are checked
14223 first. This reduces the compilation time in another 5% (from 8.11s
14224 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
14226 The parsing time is 22% of the compilation in mcs, and from that
14227 64% is spent on the tokenization process.
14229 I tried using a binary search for keywords, but this is slower
14230 than the hashtable. Another option would be to do a couple of
14233 * Not use a StringBuilder, instead use an array of chars,
14234 with a set value. Notice that this way we could catch
14235 the 645 error without having to do it *afterwards*.
14237 * We could write a hand-parser to avoid the hashtable
14238 compares altogether.
14240 The identifier consumption process takes 37% of the tokenization
14241 time. Another 15% is spent on is_number. 56% of the time spent
14242 on is_number is spent on Int64.Parse:
14244 * We could probably choose based on the string length to
14245 use Int32.Parse or Int64.Parse and avoid all the 64-bit
14248 Another 3% is spend on wrapping `xtoken' in the `token' function.
14250 Handle 0xa0 as whitespace (#34752)
14252 2002-11-26 Miguel de Icaza <miguel@ximian.com>
14254 * typemanager.cs (IsCLRType): New routine to tell whether a type
14255 is one of the builtin types.
14257 Maybe it needs to use TypeCodes to be faster. Maybe we could use
14258 typecode in more places instead of doing pointer comparissions.
14259 We could leverage some knowledge about the way the typecodes are
14262 New code to cache namespaces in assemblies, it is currently not
14263 invoked, to be used soon.
14265 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
14267 * expression.cs (Binary.ResolveOperator): specially handle
14268 strings, and do not perform user-defined operator overloading for
14271 2002-11-24 Miguel de Icaza <miguel@ximian.com>
14273 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
14274 internalcall as it is a pretty simple operation; Avoid whenever
14275 possible to call Char.IsLetter.
14277 (consume_identifier): Cut by half the number of
14278 hashtable calls by merging the is_keyword and GetKeyword behavior.
14280 Do not short-circuit, because if we do, we
14281 report errors (ie, #if false && true would produce an invalid
14285 2002-11-24 Martin Baulig <martin@ximian.com>
14287 * expression.cs (Cast.TryReduce): If we're in checked syntax,
14288 check constant ranges and report a CS0221. Fixes #33186.
14290 2002-11-24 Martin Baulig <martin@ximian.com>
14292 * cs-parser.jay: Make this work for uninitialized variable
14293 declarations in the `for' initializer. Fixes #32416.
14295 2002-11-24 Martin Baulig <martin@ximian.com>
14297 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
14298 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
14300 2002-11-24 Martin Baulig <martin@ximian.com>
14302 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
14303 argument; if true, we also check for user-defined conversions.
14304 This is only needed if both arguments are of a user-defined type.
14305 Fixes #30443, added test-175.cs.
14306 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
14308 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
14310 2002-11-24 Martin Baulig <martin@ximian.com>
14312 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
14313 function to get the store opcode.
14314 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
14315 only emit the Ldelema if the store opcode is Stobj. You must run
14316 both test-34 and test-167 to test this. Fixes #34529.
14318 2002-11-23 Martin Baulig <martin@ximian.com>
14320 * ecore.cs (Expression.MemberLookup): Added additional
14321 `qualifier_type' argument which is used when we're being called
14322 from MemberAccess.DoResolve() and null if we're called from a
14324 (Expression.MemberLookupFailed): New method to report errors; this
14325 does the CS1540 check and reports the correct error message.
14327 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
14328 argument for the CS1540 check and redone the way how we're dealing
14329 with private members. See the comment in the source code for details.
14330 (FilterWithClosure): Reverted this back to revision 1.197; renamed
14331 `closure_start_type' to `closure_qualifier_type' and check whether
14332 it's not null. It was not this filter being broken, it was just
14333 being called with the wrong arguments.
14335 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
14336 and pass it the correct `qualifier_type'; this also does the error
14339 2002-11-22 Miguel de Icaza <miguel@ximian.com>
14341 * expression.cs (Invocation.EmitParams): If the we are dealing
14342 with a non-built-in value type, load its address as well.
14344 (ArrayCreation): Use a a pretty constant instead
14345 of the hardcoded value 2. Use 6 instead of 2 for the number of
14346 static initializers.
14348 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
14349 because they are not really value types, just glorified integers.
14351 * driver.cs: Do not append .exe, the CSC compiler does not do it.
14353 * ecore.cs: Remove redundant code for enumerations, make them use
14354 the same code path as everything else, fixes the casting issue
14355 with enumerations in Windows.Forms.
14357 * attribute.cs: Do only cast to string if it is a string, the
14358 validation happens later.
14360 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
14361 people upgrade their corlibs.
14363 * ecore.cs: Oops, enumerations were not following the entire code path
14365 2002-11-21 Miguel de Icaza <miguel@ximian.com>
14367 * typemanager.cs (FilterWithClosure): Commented out the test for
14368 1540 in typemanager.cs, as it has problems when accessing
14369 protected methods from a parent class (see test-174.cs).
14371 * attribute.cs (Attribute.ValidateGuid): new method.
14372 (Attribute.Resolve): Use above.
14374 2002-11-19 Miguel de Icaza <miguel@ximian.com>
14376 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
14378 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
14379 handling for enumerations, as we only needed the TypeContainer
14380 functionality to begin with (this is required for the fix below to
14381 work for enums that reference constants in a container class for
14384 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
14386 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
14387 a valid TypeBuilder to perform lookups on.o
14389 * class.cs (InheritableMemberSignatureCompare): Use true in the
14390 call to GetGetMethod and GetSetMethod, because we are comparing
14391 the signature, and we need to get the methods *even* if they are
14394 (PropertyBase.CheckBase): ditto.
14396 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
14397 GotoCase.Resolve): Use Peel on EmpytCasts.
14399 * ecore.cs (EmptyCast): drop child, add Peel method.
14401 2002-11-17 Martin Baulig <martin@ximian.com>
14403 * ecore.cs (EmptyCast.Child): New public property.
14405 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
14406 label resolved to an EmptyCast. Fixes #34162.
14407 (GotoCase.Resolve): Likewise.
14408 (Block.EmitMeta): Likewise.
14410 2002-11-17 Martin Baulig <martin@ximian.com>
14412 * expression.cs (Invocation.BetterConversion): Prefer int over
14413 uint; short over ushort; long over ulong for integer literals.
14414 Use ImplicitConversionExists instead of StandardConversionExists
14415 since we also need to check for user-defined implicit conversions.
14416 Fixes #34165. Added test-173.cs.
14418 2002-11-16 Martin Baulig <martin@ximian.com>
14420 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
14421 with the `true' and `false' literals. Fixes #33151.
14423 2002-11-16 Martin Baulig <martin@ximian.com>
14425 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
14426 October 22nd; don't do the cs1540 check for static members.
14428 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
14429 now using our own filter here and doing the cs1540 check again.
14431 2002-11-16 Martin Baulig <martin@ximian.com>
14433 * support.cs (InternalParameters): Don't crash if we don't have
14434 any fixed parameters. Fixes #33532.
14436 2002-11-16 Martin Baulig <martin@ximian.com>
14438 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
14439 when looking up static methods to make this work on Windows.
14442 2002-11-16 Martin Baulig <martin@ximian.com>
14444 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
14445 a setter rather than using PropertyInfo.CanWrite.
14447 2002-11-15 Nick Drochak <ndrochak@gol.com>
14449 * class.cs: Allow acces to block member by subclasses. Fixes build
14452 2002-11-14 Martin Baulig <martin@ximian.com>
14454 * class.cs (Constructor.Emit): Added the extern/block check.
14457 2002-11-14 Martin Baulig <martin@ximian.com>
14459 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
14460 iteration while looking for indexers, this is needed because the
14461 indexer may have a different name in our base classes. Fixed the
14462 error reporting (no indexers at all, not get accessor, no
14463 overloaded match). Fixes bug #33089.
14464 (IndexerAccess.DoResolveLValue): Likewise.
14466 2002-11-14 Martin Baulig <martin@ximian.com>
14468 * class.cs (PropertyBase.CheckBase): Make this work for multiple
14469 indexers. Fixes the first part of bug #33089.
14470 (MethodSignature.InheritableMemberSignatureCompare): Added support
14473 2002-11-13 Ravi Pratap <ravi@ximian.com>
14475 * attribute.cs (Attribute.Resolve): Catch the
14476 NullReferenceException and report it since it isn't supposed to
14479 2002-11-12 Miguel de Icaza <miguel@ximian.com>
14481 * expression.cs (Binary.EmitBranchable): Also handle the cases for
14482 LogicalOr and LogicalAnd that can benefit from recursively
14483 handling EmitBranchable. The code now should be nice for Paolo.
14485 2002-11-08 Miguel de Icaza <miguel@ximian.com>
14487 * typemanager.cs (LookupType): Added a negative-hit hashtable for
14488 the Type lookups, as we perform quite a number of lookups on
14489 non-Types. This can be removed once we can deterministically tell
14490 whether we have a type or a namespace in advance.
14492 But this might require special hacks from our corlib.
14496 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
14497 and double which avoids a conversion from an integer to a double.
14499 * expression.cs: tiny optimization, avoid calling IsConstant,
14500 because it effectively performs the lookup twice.
14502 2002-11-06 Miguel de Icaza <miguel@ximian.com>
14504 But a bogus return here to keep the semantics of the old code
14505 until the Mono runtime is fixed.
14507 * pending.cs (GetMissingInterfaces): New method used to remove all
14508 the interfaces that are already implemented by our parent
14509 classes from the list of pending methods.
14511 * interface.cs: Add checks for calls after ResolveTypeExpr.
14513 2002-11-05 Miguel de Icaza <miguel@ximian.com>
14515 * class.cs (Class.Emit): Report warning 67: event not used if the
14516 warning level is beyond 3.
14518 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
14519 being a NullLiteral.
14521 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
14524 * class.cs (TypeContainer.GetClassBases): Cover a missing code
14525 path that might fail if a type can not be resolved.
14527 * expression.cs (Binary.Emit): Emit unsigned versions of the
14530 * driver.cs: use error 5.
14532 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
14534 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
14536 2002-11-01 Miguel de Icaza <miguel@ximian.com>
14538 * cs-parser.jay (switch_section): A beautiful patch from Martin
14539 Baulig that fixed 33094.
14541 2002-10-31 Miguel de Icaza <miguel@ximian.com>
14543 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
14544 Check whether the base is abstract and report an error if so.
14546 * expression.cs (IndexerAccess.DoResolveLValue,
14547 IndexerAccess.DoResolve): ditto.
14549 (Invocation.DoResolve): ditto.
14551 (Invocation.FullMethodDesc): Improve the report string.
14553 * statement.cs (Block): Eliminate IsVariableDefined as it is
14554 basically just a wrapper for GetVariableInfo.
14556 * ecore.cs (SimpleName): Use new
14558 * support.cs (ReflectionParamter.ParameterType): We unwrap the
14559 type, as we return the actual parameter ref/unref state on a
14562 2002-10-30 Miguel de Icaza <miguel@ximian.com>
14564 * support.cs: Return proper flags REF/OUT fixing the previous
14567 * expression.cs: Reverted last patch, that was wrong. Is_ref is
14568 not used to mean `ref' but `ref or out' in ParameterReference
14570 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
14571 full type signature instead of calling TypeManger.CSharpName
14574 * support.cs (InternalParameters.ParameterDesc): Do not compare
14575 directly to the modflags, because REF/OUT will actually be bitsets
14578 * delegate.cs (VerifyMethod): Check also the modifiers.
14580 * cs-tokenizer.cs: Fix bug where floating point values with an
14581 exponent where a sign was missing was ignored.
14583 * driver.cs: Allow multiple assemblies to be specified in a single
14586 2002-10-28 Miguel de Icaza <miguel@ximian.com>
14588 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
14589 because identifiers after a parenthesis would end up in this kind
14590 of production, and we needed to desamiguate it for having casts
14593 (UserDefinedType *) xxx
14595 2002-10-24 Miguel de Icaza <miguel@ximian.com>
14597 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
14598 we should set on the Bindingflags.NonPublic, but not turn on
14599 private_ok. private_ok controls whether a Private member is
14600 returned (this is chekced on the filter routine), while the
14601 BindingFlags.NonPublic just controls whether private/protected
14602 will be allowed. This fixes the problem part of the problem of
14603 private properties being allowed to be used in derived classes.
14605 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
14606 so we can call the children DoResolveLValue method (this will
14607 properly signal errors on lvalue assignments to base properties)
14609 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
14610 getter are null, and we have a property info, we know that this
14611 happened because the lookup failed, so we report an error 122 for
14612 protection level violation.
14614 We also silently return if setter and getter are null in the
14615 resolve functions, this condition only happens if we have flagged
14616 the error before. This is the other half of the problem.
14618 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
14619 not have accessibility information, that is why we were returning
14620 true in the filter function in typemanager.cs.
14622 To properly report 122 (property is inaccessible because of its
14623 protection level) correctly, we report this error in ResolveAccess
14624 by failing if both the setter and the getter are lacking (ie, the
14627 DoResolve and DoLResolve have been modified to check for both
14628 setter/getter being null and returning silently, the reason being
14629 that I did not want to put the knowledge about this error in upper
14632 int old = Report.Errors;
14633 x = new PropertyExpr (...);
14634 if (old != Report.Errors)
14639 So the property expr is returned, but it is invalid, so the error
14640 will be flagged during the resolve process.
14642 * class.cs: Remove InheritablePropertySignatureCompare from the
14643 class, as we no longer depend on the property signature to compute
14644 whether it is possible to implement a method or not.
14646 The reason is that calling PropertyInfo.GetGetMethod will return
14647 null (in .NET, in Mono it works, and we should change this), in
14648 cases where the Get Method does not exist in that particular
14653 class X { public virtual int A { get { return 1; } } }
14655 class Z : Y { public override int A { get { return 2; } } }
14657 Would fail in Z because the parent (Y) would not have the property
14658 defined. So we avoid this completely now (because the alternative
14659 fix was ugly and slow), and we now depend exclusively on the
14662 (PropertyBase.CheckBase): Use a method-base mechanism to find our
14663 reference method, instead of using the property.
14665 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
14666 routines are gone now.
14668 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
14669 names, they were incorrectly named.
14671 * cs-tokenizer.cs: Return are more gentle token on failure.
14673 * pending.cs (PendingImplementation.InterfaceMethod): This routine
14674 had an out-of-sync index variable, which caused it to remove from
14675 the list of pending methods the wrong method sometimes.
14677 2002-10-22 Miguel de Icaza <miguel@ximian.com>
14679 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
14680 CanWrite, because those refer to this particular instance of the
14681 property, and do not take into account the fact that we can
14682 override single members of a property.
14684 Constructor requires an EmitContext. The resolution process does
14685 not happen here, but we need to compute the accessors before,
14686 because the resolution does not always happen for properties.
14688 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
14689 subclass, before we did not update this flag, but we did update
14692 (GetAccessors): Drop this routine, as it did not work in the
14693 presence of partially overwritten set/get methods.
14695 Notice that this broke the cs1540 detection, but that will require
14698 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14702 * driver.cs: issue a warning instead of an error if we don't support
14703 debugging for the platform. Also ignore a couple of errors that may
14704 arise when trying to write the symbols. Undo my previous patch.
14706 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14708 * driver.cs: ignore /debug switch except for Unix platforms.
14710 2002-10-23 Nick Drochak <ndrochak@gol.com>
14712 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
14714 2002-10-21 Miguel de Icaza <miguel@ximian.com>
14716 * driver.cs: Do not make mcs-debug conditional, so we do not break
14717 builds that use it.
14719 * statement.cs (UsageVector.MergeChildren): I would like Martin to
14720 review this patch. But basically after all the children variables
14721 have been merged, the value of "Breaks" was not being set to
14722 new_breaks for Switch blocks. I think that it should be set after
14723 it has executed. Currently I set this to the value of new_breaks,
14724 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
14725 conservative, but I do not understand this code very well.
14727 I did not break anything in the build, so that is good ;-)
14729 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
14731 2002-10-20 Mark Crichton <crichton@gimp.org>
14733 * cfold.cs: Fixed compile blocker. Really fixed it this time.
14735 2002-10-20 Nick Drochak <ndrochak@gol.com>
14737 * cfold.cs: Fixed compile blocker.
14739 2002-10-20 Miguel de Icaza <miguel@ximian.com>
14741 * driver.cs: I was chekcing the key, not the file.
14743 2002-10-19 Ravi Pratap <ravi@ximian.com>
14745 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
14746 message that we were generating - we just need to silently return
14749 2002-10-19 Miguel de Icaza <miguel@ximian.com>
14751 * class.cs (Event.Define): Change my previous commit, as this
14752 breaks the debugger. This is a temporary hack, as it seems like
14753 the compiler is generating events incorrectly to begin with.
14755 * expression.cs (Binary.ResolveOperator): Added support for
14756 "U operator - (E x, E y)"
14758 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
14761 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
14762 init-only variables, but this path did not take into account that
14763 there might be also instance readonly variables. Correct this
14766 This fixes bug 32253
14768 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
14771 * driver.cs: Change the extension for modules to `netmodule'
14773 * cs-parser.jay: Improved slightly the location tracking for
14774 the debugger symbols.
14776 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
14777 modifiers that were specified instead of the hardcoded value
14778 (FamAndAssem). This was basically ignoring the static modifier,
14779 and others. Fixes 32429.
14781 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
14782 fixed a bug in the process (32476)
14784 * expression.cs (ArrayAccess.EmitAssign): Patch from
14785 hwang_rob@yahoo.ca that fixes bug 31834.3
14787 2002-10-18 Miguel de Icaza <miguel@ximian.com>
14789 * driver.cs: Make the module extension .netmodule.
14791 2002-10-16 Miguel de Icaza <miguel@ximian.com>
14793 * driver.cs: Report an error if the resource file is not found
14794 instead of crashing.
14796 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
14797 false, like Emit does.
14799 2002-10-16 Nick Drochak <ndrochak@gol.com>
14801 * typemanager.cs: Remove unused private member. Also reported mcs
14802 bug to report this as a warning like csc.
14804 2002-10-15 Martin Baulig <martin@gnome.org>
14806 * statement.cs (Statement.Emit): Made this a virtual method; emits
14807 the line number info and calls DoEmit().
14808 (Statement.DoEmit): New protected abstract method, formerly knows
14809 as Statement.Emit().
14811 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
14813 2002-10-11 Miguel de Icaza <miguel@ximian.com>
14815 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
14816 have fixed a remaining problem: not every AddXXXX was adding a
14817 fully qualified name.
14819 Now everyone registers a fully qualified name in the DeclSpace as
14820 being defined instead of the partial name.
14822 Downsides: we are slower than we need to be due to the excess
14823 copies and the names being registered this way.
14825 The reason for this is that we currently depend (on the corlib
14826 bootstrap for instance) that types are fully qualified, because
14827 we dump all the types in the namespace, and we should really have
14828 types inserted into the proper namespace, so we can only store the
14829 basenames in the defined_names array.
14831 2002-10-10 Martin Baulig <martin@gnome.org>
14833 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
14834 from bug #31834, see the bug report for a testcase which is
14837 2002-10-10 Martin Baulig <martin@gnome.org>
14839 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
14840 flow analysis code for this.
14842 * statement.cs (Do, While, For): Tell the flow analysis code about
14844 (FlowBranching.UsageVector): Added support for infinite loops.
14845 (Block.Resolve): Moved the dead code elimination here and use flow
14848 2002-10-09 Miguel de Icaza <miguel@ximian.com>
14850 * class.cs (Field.Define): Catch cycles on struct type
14853 * typemanager.cs (IsUnmanagedtype): Do not recursively check
14854 fields if the fields are static. We only need to check instance
14857 * expression.cs (As.DoResolve): Test for reference type.
14859 * statement.cs (Using.ResolveExpression): Use
14860 ConvertImplicitRequired, not ConvertImplicit which reports an
14862 (Using.ResolveLocalVariableDecls): ditto.
14864 * expression.cs (Binary.ResolveOperator): Report errors in a few
14865 places where we had to.
14867 * typemanager.cs (IsUnmanagedtype): Finish implementation.
14869 2002-10-08 Miguel de Icaza <miguel@ximian.com>
14871 * expression.cs: Use StoreFromPtr instead of extracting the type
14872 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
14874 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
14875 an enumeration value to a System.Enum, but System.Enum is not a
14876 value type, but an class type, so we need to box.
14878 (Expression.ConvertExplicit): One codepath could return
14879 errors but not flag them. Fix this. Fixes #31853
14881 * parameter.cs (Resolve): Do not allow void as a parameter type.
14883 2002-10-06 Martin Baulig <martin@gnome.org>
14885 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
14886 if it's a class type and not a struct. Fixes #31815.
14888 2002-10-06 Martin Baulig <martin@gnome.org>
14890 * statement.cs: Reworked the flow analysis code a bit to make it
14891 usable for dead code elimination.
14893 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14895 * cs-parser.jay: allow empty source files. Fixes bug #31781.
14897 2002-10-04 Miguel de Icaza <miguel@ximian.com>
14899 * expression.cs (ComposedCast.DoResolveType): A quick workaround
14900 to fix the test 165, will investigate deeper.
14902 2002-10-04 Martin Baulig <martin@gnome.org>
14904 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
14905 finally blocks actually work.
14906 (Try.Resolve): We don't need to create a sibling for `finally' if
14907 there is no finally block.
14909 2002-10-04 Martin Baulig <martin@gnome.org>
14911 * class.cs (Constructor.Define): The default accessibility for a
14912 non-default constructor is private, not public.
14914 2002-10-04 Miguel de Icaza <miguel@ximian.com>
14916 * class.cs (Constructor): Make AllowedModifiers public, add
14919 * cs-parser.jay: Perform the modifiers test here, as the
14920 constructor for the Constructor class usually receives a zero
14921 because of the way we create it (first we create, later we
14922 customize, and we were never checking the modifiers).
14924 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
14925 is a version of LookupTypeReflection that includes the type-name
14926 cache. This can be used as a fast path for functions that know
14927 the fully qualified name and are only calling into *.GetType() to
14928 obtain a composed type.
14930 This is also used by TypeManager.LookupType during its type
14933 (LookupType): We now also track the real type name, as sometimes
14934 we can get a quey for the real type name from things like
14935 ComposedCast. This fixes bug 31422.
14937 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
14938 complete type fullname, it does not have to go through the type
14939 resolution system to obtain the composed version of the type (for
14940 obtaining arrays or pointers).
14942 (Conditional.Emit): Use the EmitBoolExpression to
14943 generate nicer code, as requested by Paolo.
14945 (ArrayCreation.CheckIndices): Use the patch from
14946 hwang_rob@yahoo.ca to validate the array initializers.
14948 2002-10-03 Miguel de Icaza <miguel@ximian.com>
14950 * class.cs (ConstructorInitializer.Emit): simplify code by using
14951 Invocation.EmitCall, and at the same time, fix the bugs in calling
14952 parent constructors that took variable arguments.
14954 * ecore.cs (Expression.ConvertNumericExplicit,
14955 Expression.ImplicitNumericConversion): Remove the code that
14956 manually wrapped decimal (InternalTypeConstructor call is now gone
14959 * expression.cs (Cast.TryReduce): Also handle decimal types when
14960 trying to perform a constant fold on the type.
14962 * typemanager.cs (IsUnmanagedtype): Partially implemented.
14964 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
14965 that only turned off an error report, and did nothing else.
14967 2002-10-02 Miguel de Icaza <miguel@ximian.com>
14969 * driver.cs: Handle and ignore /fullpaths
14971 2002-10-01 Miguel de Icaza <miguel@ximian.com>
14973 * expression.cs (Binary.ResolveOperator): Catch the case where
14974 DoNumericPromotions returns true,
14976 (Binary.DoNumericPromotions): Simplify the code, and the tests.
14978 2002-09-27 Miguel de Icaza <miguel@ximian.com>
14980 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
14983 2002-09-26 Miguel de Icaza <miguel@ximian.com>
14985 * ecore.cs (ConvertNumericExplicit): It is not enough that the
14986 conversion exists, but it is also required that the conversion be
14987 performed. This manifested in "(Type64Enum) 2".
14989 * class.cs (TypeManager.AddMethod): The fix is not to change
14990 AddEnum, because that one was using a fully qualified name (every
14991 DeclSpace derivative does), but to change the AddMethod routine
14992 that was using an un-namespaced name. This now correctly reports
14993 the duplicated name.
14995 Revert patch until I can properly fix it. The issue
14996 is that we have a shared Type space across all namespaces
14997 currently, which is wrong.
14999 Options include making the Namespace a DeclSpace, and merge
15000 current_namespace/current_container in the parser.
15002 2002-09-25 Miguel de Icaza <miguel@ximian.com>
15004 * cs-parser.jay: Improve error reporting when we get a different
15005 kind of expression in local_variable_type and
15006 local_variable_pointer_type.
15008 Propagate this to avoid missleading errors being reported.
15010 * ecore.cs (ImplicitReferenceConversion): treat
15011 TypeManager.value_type as a target just like object_type. As
15016 Is valid, and needs to result in the int 1 being boxed before it
15017 is assigned to the value type v.
15019 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
15020 to validate the enumeration name.
15022 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
15023 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
15024 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
15026 * ecore.cs (TryImplicitIntConversion): When doing an
15027 implicit-enumeration-conversion, check if the type is 64-bits and
15028 perform a conversion before passing to EnumConstant.
15030 2002-09-23 Miguel de Icaza <miguel@ximian.com>
15032 * decl.cs (Error_AmbiguousTypeReference); New routine used to
15033 report ambiguous type references. Unlike the MS version, we
15034 report what the ambiguity is. Innovation at work ;-)
15036 (DeclSpace.FindType): Require a location argument to
15037 display when we display an ambiguous error.
15039 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
15041 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
15043 * expression.cs (EmitDynamicInitializers): Apply patch from
15044 hwang_rob@yahoo.ca that fixes the order in which we emit our
15047 2002-09-21 Martin Baulig <martin@gnome.org>
15049 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
15050 delegate takes no arguments.
15052 2002-09-20 Miguel de Icaza <miguel@ximian.com>
15054 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
15057 * expression.cs: Extract the underlying type.
15059 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
15061 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
15063 2002-09-19 Miguel de Icaza <miguel@ximian.com>
15065 * class.cs (TypeContainer.DefineType): We can not use the nice
15066 PackingSize with the size set to 1 DefineType method, because it
15067 will not allow us to define the interfaces that the struct
15070 This completes the fixing of bug 27287
15072 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
15073 means also structs. This fixes part of the problem.
15074 (Expresion.ImplicitReferenceConversionExists): ditto.
15076 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
15077 error if there were no errors reported during the type lookup
15078 process, to avoid duplicates or redundant errors. Without this
15079 you would get an ambiguous errors plus a type not found. We have
15080 beaten the user enough with the first error.
15082 (DeclSparce.FindType): Emit a warning if we have an ambiguous
15085 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
15086 during the resolution process, stop the lookup, this avoids
15087 repeated error reports (same error twice).
15089 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
15091 * typemanager.cs (LookupType): Redo the type lookup code to match
15092 the needs of System.Reflection.
15094 The issue is that System.Reflection requires references to nested
15095 types to begin with a "+" sign instead of a dot. So toplevel
15096 types look like: "NameSpace.TopLevelClass", and nested ones look
15097 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
15100 2002-09-19 Martin Baulig <martin@gnome.org>
15102 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
15103 says that a method always returns or always throws an exception,
15104 don't report the CS0161.
15106 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
15107 set `Returns = new_returns'.
15109 2002-09-19 Martin Baulig <martin@gnome.org>
15111 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
15112 to an enum constant, check for a CS0176.
15114 2002-09-18 Miguel de Icaza <miguel@ximian.com>
15116 * class.cs (TypeContainer.CheckPairedOperators): Now we check
15117 for operators that must be in pairs and report errors.
15119 * ecore.cs (SimpleName.DoResolveType): During the initial type
15120 resolution process, when we define types recursively, we must
15121 check first for types in our current scope before we perform
15122 lookups in the enclosing scopes.
15124 * expression.cs (MakeByteBlob): Handle Decimal blobs.
15126 (Invocation.VerifyArgumentsCompat): Call
15127 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
15128 I thought we were supposed to always call this, but there are a
15129 few places in the code where we dont do it.
15131 2002-09-17 Miguel de Icaza <miguel@ximian.com>
15133 * driver.cs: Add support in -linkres and -resource to specify the
15134 name of the identifier.
15136 2002-09-16 Miguel de Icaza <miguel@ximian.com>
15138 * ecore.cs (StandardConversionExists): Sync with the conversion
15139 code: allow anything-* to void* conversions.
15141 (FindMostSpecificSource): Use an Expression argument
15142 instead of a Type, because we might be handed over a Literal which
15143 gets a few more implicit conversions that plain types do not. So
15144 this information was being lost.
15146 Also, we drop the temporary type-holder expression when not
15149 2002-09-17 Martin Baulig <martin@gnome.org>
15151 * class.cs (PropertyBase.CheckBase): Don't check the base class if
15152 this is an explicit interface implementation.
15154 2002-09-17 Martin Baulig <martin@gnome.org>
15156 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
15157 different `IndexerName' attributes.
15159 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
15160 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
15161 virtual CommonResolve().
15163 2002-09-16 Miguel de Icaza <miguel@ximian.com>
15165 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
15166 and convert that to the UnderlyingType.
15168 * statement.cs (Foreach.Resolve): Indexers are just like variables
15169 or PropertyAccesses.
15171 * cs-tokenizer.cs (consume_string): Track line numbers and columns
15172 inside quoted strings, we were not doing this before.
15174 2002-09-16 Martin Baulig <martin@gnome.org>
15176 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
15177 resolve it. This is needed for the definite assignment check of the
15178 instance expression, fixes bug #29846.
15179 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
15181 2002-09-16 Nick Drochak <ndrochak@gol.com>
15183 * parameter.cs: Fix compile error. Cannot reference static member
15184 from an instance object. Is this an mcs bug?
15186 2002-09-14 Martin Baulig <martin@gnome.org>
15188 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
15189 multiple times. Fixes bug #30295, added test-166.cs.
15191 2002-09-14 Martin Baulig <martin@gnome.org>
15193 * statement.cs (Block.Emit): Don't emit unreachable code.
15194 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
15195 `break' statements.
15196 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
15198 2002-09-14 Martin Baulig <martin@gnome.org>
15200 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
15203 2002-09-14 Martin Baulig <martin@gnome.org>
15205 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
15206 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
15207 be false on the ms runtime.
15209 2002-09-13 Martin Baulig <martin@gnome.org>
15211 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
15212 the CS0038 error message.
15214 2002-09-12 Miguel de Icaza <miguel@ximian.com>
15216 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
15217 constant inside, return it.
15219 2002-09-12 Martin Baulig <martin@gnome.org>
15221 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
15222 implicit conversion can be done between enum types.
15224 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
15225 check whether an implicit conversion to the current enum's UnderlyingType
15226 exists and report an error if not.
15228 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
15229 without debugging support.
15231 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
15232 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
15234 2002-09-12 Martin Baulig <martin@gnome.org>
15236 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
15238 * ecore.cs (IMemberExpr.DeclaringType): New property.
15239 (SimpleName.SimpleNameResolve): Check whether we're accessing a
15240 nonstatic member of an outer type (CS0038).
15242 2002-09-11 Miguel de Icaza <miguel@ximian.com>
15244 * driver.cs: Activate the using-error detector at warning level
15245 4 (at least for MS-compatible APIs).
15247 * namespace.cs (VerifyUsing): Small buglett fix.
15249 * pending.cs (PendingImplementation): pass the container pointer.
15251 * interface.cs (GetMethods): Allow for recursive definition. Long
15252 term, I would like to move every type to support recursive
15253 definitions, not the current ordering mechanism that we have right
15256 The situation is this: Attributes are handled before interfaces,
15257 so we can apply attributes to interfaces. But some attributes
15258 implement interfaces, we will now handle the simple cases
15259 (recursive definitions will just get an error).
15261 * parameter.cs: Only invalidate types at the end if we fail to
15264 2002-09-09 Martin Baulig <martin@gnome.org>
15266 * ecore.cs (PropertyExpr.Emit): Also check for
15267 TypeManager.system_int_array_get_length so this'll also work when
15268 compiling corlib. Fixes #30003.
15270 2002-09-09 Martin Baulig <martin@gnome.org>
15272 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
15273 and throw an exception if we can't get the type's size. Fixed #30040,
15276 2002-09-09 Martin Baulig <martin@gnome.org>
15278 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
15280 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
15281 context. Fixes bug #30027.
15283 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
15284 virtual functions. Fixes bug #30043, added test-164.cs.
15286 2002-09-08 Ravi Pratap <ravi@ximian.com>
15288 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
15290 2002-09-08 Nick Drochak <ndrochak@gol.com>
15292 * driver.cs: Use an object to get the windows codepage since it's not a
15295 2002-09-08 Miguel de Icaza <miguel@ximian.com>
15297 * statement.cs (For.Emit): for infinite loops (test == null)
15298 return whether there is a break inside, not always "true".
15300 * namespace.cs (UsingEntry): New struct to hold the name of the
15301 using definition, the location where it is defined, and whether it
15302 has been used in a successful type lookup.
15304 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
15309 2002-09-06 Ravi Pratap <ravi@ximian.com>
15311 * attribute.cs : Fix incorrect code which relied on catching
15312 a NullReferenceException to detect a null being passed in
15313 where an object was expected.
15315 2002-09-06 Miguel de Icaza <miguel@ximian.com>
15317 * statement.cs (Try): flag the catch variable as assigned
15319 * expression.cs (Cast): Simplified by using ResolveType instead of
15320 manually resolving.
15322 * statement.cs (Catch): Fix bug by using ResolveType.
15324 2002-09-06 Ravi Pratap <ravi@ximian.com>
15326 * expression.cs (BetterConversion): Special case for when we have
15327 a NullLiteral as the argument and we have to choose between string
15328 and object types - we choose string the way csc does.
15330 * attribute.cs (Attribute.Resolve): Catch the
15331 NullReferenceException and report error #182 since the Mono
15332 runtime no more has the bug and having this exception raised means
15333 we tried to select a constructor which takes an object and is
15336 2002-09-05 Ravi Pratap <ravi@ximian.com>
15338 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
15339 message (1502, 1503) when we can't locate a method after overload
15340 resolution. This is much more informative and closes the bug
15343 * interface.cs (PopulateMethod): Return if there are no argument
15344 types. Fixes a NullReferenceException bug.
15346 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
15347 expressions too. Previously we were checking only in one place for
15348 positional arguments leaving out named arguments.
15350 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
15351 type to the enum type is not allowed. Remove code corresponding to
15354 (ConvertNumericExplicit): Allow explicit conversions from
15355 the underlying type to enum type. This precisely follows the spec
15356 and closes a bug filed by Gonzalo.
15358 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15361 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
15363 2002-09-03 Miguel de Icaza <miguel@ximian.com>
15365 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
15366 it was important that we stored the right value after the
15367 reduction in `converted'.
15369 2002-09-04 Martin Baulig <martin@gnome.org>
15371 * location.cs (Location.SymbolDocument): Use full pathnames for the
15374 2002-08-30 Miguel de Icaza <miguel@ximian.com>
15376 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
15377 of the expression resolve mechanism, because that will catch the
15378 SimpleName error failures.
15380 (Conditional): If we can not resolve the
15381 expression, return, do not crash.
15383 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15386 (location): display token name instead of its number.
15388 2002-08-28 Martin Baulig <martin@gnome.org>
15390 * expression.cs (Binary.ResolveOperator): Don't silently return
15391 but return an error if an operator cannot be applied between two
15394 2002-08-28 Martin Baulig <martin@gnome.org>
15396 * class.cs (Constructor.Define): Set the permission attributes
15397 correctly instead of making all constructors public.
15399 2002-08-28 Martin Baulig <martin@gnome.org>
15401 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
15402 for private members before reporting a CS0103; if we find anything,
15405 2002-08-28 Martin Baulig <martin@gnome.org>
15407 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
15408 to check whether `closure_start_type == closure_invocation_type',
15409 we also need to check whether `m.DeclaringType == closure_invocation_type'
15410 before bypassing the permission checks. We might be accessing
15411 protected/private members from the base class.
15412 (TypeManager.RealMemberLookup): Only set private_ok if private
15413 members were requested via BindingFlags.NonPublic.
15415 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
15417 * expression.cs (MemberAccess.ResolveMemberAccess): Set
15418 MethodGroupExpr.IsExplicitImpl if appropriate.
15419 (Invocation.DoResolve): Don't report the CS0120 for explicit
15420 interface implementations.
15422 2002-08-27 Martin Baulig <martin@gnome.org>
15424 * expression.cs (Invocation.DoResolve): If this is a static
15425 method and we don't have an InstanceExpression, we must report
15428 2002-08-25 Martin Baulig <martin@gnome.org>
15430 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
15431 `==' between a valuetype and an object.
15433 2002-08-25 Miguel de Icaza <miguel@ximian.com>
15435 * ecore.cs (TypeExpr): Provide a ToString method.
15437 2002-08-24 Martin Baulig <martin@gnome.org>
15439 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
15440 now called proggie.dbg and it's a binary file.
15442 2002-08-23 Martin Baulig <martin@gnome.org>
15444 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
15446 2002-08-23 Martin Baulig <martin@gnome.org>
15448 * struct.cs (MyStructInfo.ctor): Make this work with empty
15449 structs; it's not allowed to use foreach() on null.
15451 2002-08-23 Martin Baulig <martin@gnome.org>
15453 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
15454 writer the full pathname of the generated assembly.
15456 2002-08-23 Martin Baulig <martin@gnome.org>
15458 * statements.cs (FlowBranching.UsageVector.MergeChildren):
15459 A `finally' block never returns or breaks; improved handling of
15462 2002-08-23 Martin Baulig <martin@gnome.org>
15464 * statement.cs (Throw.Resolve): Allow `throw null'.
15466 2002-08-23 Martin Baulig <martin@gnome.org>
15468 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
15469 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
15470 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
15471 MemberLookup would return a wrong event if this is an explicit
15472 interface implementation and the class has an event with the same
15475 2002-08-23 Martin Baulig <martin@gnome.org>
15477 * statement.cs (Block.AddChildVariableNames): New public method.
15478 (Block.AddChildVariableName): Likewise.
15479 (Block.IsVariableNameUsedInChildBlock): Likewise.
15480 (Block.AddVariable): Check whether a variable name has already
15481 been used in a child block.
15483 * cs-parser.jay (declare_local_variables): Mark all variable names
15484 from the current block as being used in a child block in the
15487 2002-08-23 Martin Baulig <martin@gnome.org>
15489 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
15490 find the symbol writer.
15492 * driver.cs: csc also allows the arguments to /define being
15493 separated by commas, not only by semicolons.
15495 2002-08-23 Martin Baulig <martin@gnome.org>
15497 * interface.cs (Interface.GetMembers): Added static check for events.
15499 2002-08-15 Martin Baulig <martin@gnome.org>
15501 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
15502 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
15504 * ecore.cs (Expression.MemberLookup): Added documentation and explained
15505 why the MethodData.EmitDestructor() change was necessary.
15507 2002-08-20 Martin Baulig <martin@gnome.org>
15509 * class.cs (TypeContainer.FindMembers): Added static check for events.
15511 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
15513 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
15514 use Type.GetEvents(), not Type.FindMembers().
15516 2002-08-20 Martin Baulig <martin@gnome.org>
15518 * decl.cs (MemberCache): Added a special method cache which will
15519 be used for method-only searched. This ensures that a method
15520 search will return a MethodInfo with the correct ReflectedType for
15523 2002-08-20 Martin Baulig <martin@gnome.org>
15525 * decl.cs (DeclSpace.FindMembers): Made this public.
15527 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15529 * delegate.cs: fixed build on windows.
15530 [FIXME: Filed as bug #29150: MCS must report these errors.]
15532 2002-08-19 Ravi Pratap <ravi@ximian.com>
15534 * ecore.cs (StandardConversionExists): Return a false
15535 if we are trying to convert the void type to anything else
15536 since that is not allowed.
15538 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
15539 we flag error 70 in the event an event is trying to be accessed
15540 directly from outside the declaring type.
15542 2002-08-20 Martin Baulig <martin@gnome.org>
15544 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
15545 MemberCache from typemanager.cs to decl.cs.
15547 2002-08-19 Martin Baulig <martin@gnome.org>
15549 * class.cs (TypeContainer): Implement IMemberContainer.
15550 (TypeContainer.DefineMembers): Create the MemberCache.
15551 (TypeContainer.FindMembers): Do better BindingFlags checking; only
15552 return public members if BindingFlags.Public was given, check
15553 whether members are static.
15555 2002-08-16 Martin Baulig <martin@gnome.org>
15557 * decl.cs (DeclSpace.Define): Splitted this in Define and
15558 DefineMembers. DefineMembers is called first and initializes the
15561 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
15562 DefineMembers() on all our DeclSpaces.
15564 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
15565 but call DefineMembers() on all nested interfaces. We call their
15566 Define() in our new Define() function.
15568 * interface.cs (Interface): Implement IMemberContainer.
15569 (Interface.Define): Moved all code except the attribute stuf to
15571 (Interface.DefineMembers): Initialize the member cache.
15573 * typemanager.cs (IMemberFinder): Removed this interface, we don't
15574 need this anymore since we can use MemberCache.FindMembers directly.
15576 2002-08-19 Martin Baulig <martin@gnome.org>
15578 * typemanager.cs (MemberCache): When creating the cache for an
15579 interface type, add all inherited members.
15580 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
15581 to `out bool used_cache' and documented it.
15582 (TypeManager.MemberLookup): If we already used the cache in the first
15583 iteration, we don't need to do the interfaces check.
15585 2002-08-19 Martin Baulig <martin@gnome.org>
15587 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
15588 here from IMemberFinder and don't implement this interface anymore.
15589 (DeclSpace.MemberCache): Moved here from IMemberFinder.
15591 * typemanager.cs (IMemberFinder): This interface is now only used by
15592 classes which actually support the member cache.
15593 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
15594 since we only put DeclSpaces into this Hashtable.
15595 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
15596 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
15598 2002-08-16 Martin Baulig <martin@gnome.org>
15600 * typemanager.cs (ICachingMemberFinder): Removed.
15601 (IMemberFinder.MemberCache): New property.
15602 (TypeManager.FindMembers): Merged this with RealFindMembers().
15603 This function will never be called from TypeManager.MemberLookup()
15604 so we can't use the cache here, just the IMemberFinder.
15605 (TypeManager.MemberLookup_FindMembers): Check whether the
15606 IMemberFinder has a MemberCache and call the cache's FindMembers
15608 (MemberCache): Rewrote larger parts of this yet another time and
15609 cleaned it up a bit.
15611 2002-08-15 Miguel de Icaza <miguel@ximian.com>
15613 * driver.cs (LoadArgs): Support quoting.
15615 (Usage): Show the CSC-like command line arguments.
15617 Improved a few error messages.
15619 2002-08-15 Martin Baulig <martin@gnome.org>
15621 * typemanager.cs (IMemberContainer.Type): New property.
15622 (IMemberContainer.IsInterface): New property.
15624 The following changes are conditional to BROKEN_RUNTIME, which is
15625 defined at the top of the file.
15627 * typemanager.cs (MemberCache.MemberCache): Don't add the base
15628 class'es members, but add all members from TypeHandle.ObjectType
15629 if we're an interface.
15630 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
15631 is the current type.
15632 (MemberCache.CacheEntry.Container): Removed this field.
15633 (TypeHandle.GetMembers): Include inherited members.
15635 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15637 * typemanager.cs: fixed compilation and added a comment on a field that
15640 2002-08-15 Martin Baulig <martin@gnome.org>
15642 * class.cs (ConstructorInitializer.Resolve): In the
15643 Expression.MemberLookup call, use the queried_type as
15646 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
15647 declared' attribute, it's always true.
15648 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
15649 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
15650 temporary wrapper for FindMembers which tells MemberLookup whether
15651 members from the base classes are included in the return value.
15652 This will go away soon.
15653 (TypeManager.MemberLookup): Use this temporary hack here; once the
15654 new MemberCache is completed, we don't need to do the DeclaredOnly
15655 looping here anymore since the MemberCache will take care of this.
15656 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
15657 (MemberCache): When creating the MemberCache for a class, get
15658 members from the current class and all its base classes.
15659 (MemberCache.CacheEntry.Container): New field. This is a
15660 temporary hack until the Mono runtime is fixed to distinguish
15661 between ReflectedType and DeclaringType. It allows us to use MCS
15662 with both the MS runtime and the unfixed Mono runtime without
15663 problems and without accecting performance.
15664 (MemberCache.SearchMembers): The DeclaredOnly looping from
15665 TypeManager.MemberLookup is now done here.
15667 2002-08-14 Martin Baulig <martin@gnome.org>
15669 * statement.cs (MyStructInfo.MyStructInfo): Don't call
15670 Type.GetFields on dynamic types but get the fields from the
15671 corresponding TypeContainer.
15672 (MyStructInfo.GetStructInfo): Added check for enum types.
15674 * typemanager.cs (MemberList.IsSynchronized): Implemented.
15675 (MemberList.SyncRoot): Implemented.
15676 (TypeManager.FilterWithClosure): No need to check permissions if
15677 closure_start_type == closure_invocation_type, don't crash if
15678 closure_invocation_type is null.
15680 2002-08-13 Martin Baulig <martin@gnome.org>
15682 Rewrote TypeContainer.FindMembers to use a member cache. This
15683 gives us a speed increase of about 35% for the self-hosting MCS
15684 build and of about 15-20% for the class libs (both on GNU/Linux).
15686 * report.cs (Timer): New class to get enhanced profiling. This
15687 whole class is "TIMER" conditional since it remarkably slows down
15690 * class.cs (MemberList): New class. This is an IList wrapper
15691 which we're now using instead of passing MemberInfo[]'s around to
15692 avoid copying this array unnecessarily.
15693 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
15694 (ICachingMemberFinder, IMemberContainer): New interface.
15695 (TypeManager.FilterWithClosure): If `criteria' is null, the name
15696 has already been checked, otherwise use it for the name comparision.
15697 (TypeManager.FindMembers): Renamed to RealMemberFinder and
15698 provided wrapper which tries to use ICachingMemberFinder.FindMembers
15699 if possible. Returns a MemberList, not a MemberInfo [].
15700 (TypeHandle): New class, implements IMemberContainer. We create
15701 one instance of this class per type, it contains a MemberCache
15702 which is used to do the member lookups.
15703 (MemberCache): New class. Each instance of this class contains
15704 all members of a type and a name-based hash table.
15705 (MemberCache.FindMembers): This is our new member lookup
15706 function. First, it looks up all members of the requested name in
15707 the hash table. Then, it walks this list and sorts out all
15708 applicable members and returns them.
15710 2002-08-13 Martin Baulig <martin@gnome.org>
15712 In addition to a nice code cleanup, this gives us a performance
15713 increase of about 1.4% on GNU/Linux - not much, but it's already
15714 half a second for the self-hosting MCS compilation.
15716 * typemanager.cs (IMemberFinder): New interface. It is used by
15717 TypeManager.FindMembers to call FindMembers on a TypeContainer,
15718 Enum, Delegate or Interface.
15719 (TypeManager.finder_to_member_finder): New PtrHashtable.
15720 (TypeManager.finder_to_container): Removed.
15721 (TypeManager.finder_to_delegate): Removed.
15722 (TypeManager.finder_to_interface): Removed.
15723 (TypeManager.finder_to_enum): Removed.
15725 * interface.cs (Interface): Implement IMemberFinder.
15727 * delegate.cs (Delegate): Implement IMemberFinder.
15729 * enum.cs (Enum): Implement IMemberFinder.
15731 * class.cs (TypeContainer): Implement IMemberFinder.
15733 2002-08-12 Martin Baulig <martin@gnome.org>
15735 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
15737 2002-08-12 Martin Baulig <martin@gnome.org>
15739 * ecore.cs (ITypeExpression): New interface for expressions which
15741 (TypeExpression): Renamed to TypeLookupExpression.
15742 (Expression.DoResolve): If we're doing a types-only lookup, the
15743 expression must implement the ITypeExpression interface and we
15744 call DoResolveType() on it.
15745 (SimpleName): Implement the new ITypeExpression interface.
15746 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
15747 hack, the situation that we're only looking up types can't happen
15748 anymore when this method is called. Moved the type lookup code to
15749 DoResolveType() and call it.
15750 (SimpleName.DoResolveType): This ITypeExpression interface method
15751 is now doing the types-only lookup.
15752 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
15753 (ResolveFlags): Added MaskExprClass.
15755 * expression.cs (MemberAccess): Implement the ITypeExpression
15757 (MemberAccess.DoResolve): Added support for a types-only lookup
15758 when we're called via ITypeExpression.DoResolveType().
15759 (ComposedCast): Implement the ITypeExpression interface.
15761 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
15762 Expression.Resolve() with ResolveFlags.Type instead.
15764 2002-08-12 Martin Baulig <martin@gnome.org>
15766 * interface.cs (Interface.Define): Apply attributes.
15768 * attribute.cs (Attribute.ApplyAttributes): Added support for
15769 interface attributes.
15771 2002-08-11 Martin Baulig <martin@gnome.org>
15773 * statement.cs (Block.Emit): Only check the "this" variable if we
15774 do not always throw an exception.
15776 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
15777 whether the property has a set accessor.
15779 2002-08-11 Martin Baulig <martin@gnome.org>
15781 Added control flow analysis support for structs.
15783 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
15784 with control flow analysis turned off.
15785 (IVariable): New interface.
15786 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
15787 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
15788 (FieldExpr.DoResolve): Resolve the instance expression with flow
15789 analysis turned off and do the definite assignment check after the
15790 resolving when we know what the expression will resolve to.
15792 * expression.cs (LocalVariableReference, ParameterReference):
15793 Implement the new IVariable interface, only call the flow analysis
15794 code if ec.DoFlowAnalysis is true.
15795 (This): Added constructor which takes a Block argument. Implement
15796 the new IVariable interface.
15797 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
15798 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
15799 This does the definite assignment checks for struct members.
15801 * class.cs (Constructor.Emit): If this is a non-static `struct'
15802 constructor which doesn't have any initializer, call
15803 Block.AddThisVariable() to tell the flow analysis code that all
15804 struct elements must be initialized before control returns from
15807 * statement.cs (MyStructInfo): New public class.
15808 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
15809 argument to this indexer. If non-zero, check an individual struct
15810 member, not the whole struct.
15811 (FlowBranching.CheckOutParameters): Check struct members.
15812 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
15813 overloaded versions of these methods which take an additional
15814 `int field_idx' argument to check struct members.
15815 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
15816 overloaded versions of these methods which take an additional
15817 `string field_name' argument to check struct member.s
15818 (VariableInfo): Implement the IVariable interface.
15819 (VariableInfo.StructInfo): New public property. Returns the
15820 MyStructInfo instance of the variable if it's a struct or null.
15821 (Block.AddThisVariable): New public method. This is called from
15822 Constructor.Emit() for non-static `struct' constructor which do
15823 not have any initializer. It creates a special variable for the
15824 "this" instance variable which will be checked by the flow
15825 analysis code to ensure that all of the struct's fields are
15826 initialized before control returns from the constructor.
15827 (UsageVector): Added support for struct members. If a
15828 variable/parameter is a struct with N members, we reserve a slot
15829 in the usage vector for each member. A struct is considered fully
15830 initialized if either the struct itself (slot 0) or all its
15831 members are initialized.
15833 2002-08-08 Martin Baulig <martin@gnome.org>
15835 * driver.cs (Driver.MainDriver): Only report an error CS5001
15836 if there were no compilation errors.
15838 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
15839 `UnsafeContext' property to determine whether the parent is in
15840 unsafe context rather than checking the parent's ModFlags:
15841 classes nested in an unsafe class are unsafe as well.
15843 2002-08-08 Martin Baulig <martin@gnome.org>
15845 * statement.cs (UsageVector.MergeChildren): Distinguish between
15846 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
15847 we return. Added test17() and test18() to test-154.cs.
15849 2002-08-08 Martin Baulig <martin@gnome.org>
15851 * typemanager.cs (TypeManager.FilterWithClosure): If we have
15852 Family access, make sure the invoking type isn't a subclass of the
15853 queried type (that'd be a CS1540).
15855 * ecore.cs (Expression.MemberLookup): Added overloaded version of
15856 this method which takes an additional `Type invocation_type'.
15858 * expression.cs (BaseAccess.DoResolve): Use the base type as
15859 invocation and query type.
15860 (MemberAccess.DoResolve): If the lookup failed and we're about to
15861 report a CS0122, try a lookup with the ec.ContainerType - if this
15862 succeeds, we must report a CS1540.
15864 2002-08-08 Martin Baulig <martin@gnome.org>
15866 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
15867 (MethodGroupExpr): Implement the IMemberExpr interface.
15869 * expression (MemberAccess.ResolveMemberAccess): No need to have
15870 any special code for MethodGroupExprs anymore, they're now
15873 2002-08-08 Martin Baulig <martin@gnome.org>
15875 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
15876 Family, FamANDAssem and FamORAssem permissions.
15877 (TypeManager.IsSubclassOrNestedChildOf): New public method.
15879 2002-08-08 Martin Baulig <martin@gnome.org>
15881 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
15882 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
15885 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
15887 * driver.cs: implemented /resource option to embed managed resources.
15889 2002-08-07 Martin Baulig <martin@gnome.org>
15891 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
15892 (FieldBase.HasFieldInitializer): New public property.
15893 (FieldBase.GetInitializerExpression): New public method. Resolves and
15894 returns the field initializer and makes sure it is only resolved once.
15895 (TypeContainer.EmitFieldInitializers): Call
15896 FieldBase.GetInitializerExpression to get the initializer, this ensures
15897 that it isn't resolved multiple times.
15899 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
15900 the resolving process (SimpleName/MemberLookup) that we're currently
15901 emitting a field initializer (which must not access any instance members,
15902 this is an error CS0236).
15904 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
15905 argument, if the `IsFieldInitializer' flag is set, we must report and
15906 error CS0236 and not an error CS0120.
15908 2002-08-07 Martin Baulig <martin@gnome.org>
15910 * ecore.cs (IMemberExpr): New public interface.
15911 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
15912 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
15913 if the expression is an IMemberExpr.
15915 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
15916 to be null, implicitly default to `this' if we're non-static in
15917 this case. Simplified the code a lot by using the new IMemberExpr
15918 interface. Also fixed bug #28176 here.
15920 2002-08-06 Martin Baulig <martin@gnome.org>
15922 * cs-parser.jay (SimpleLookup): Removed. We need to create
15923 ParameterReferences during semantic analysis so that we can do a
15924 type-only search when resolving Cast, TypeOf and SizeOf.
15925 (block): Pass the `current_local_parameters' to the Block's
15928 * class.cs (ConstructorInitializer): Added `Parameters parameters'
15929 argument to the constructor.
15930 (ConstructorInitializer.Resolve): Create a temporary implicit
15931 block with the parameters.
15933 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
15934 references here if we aren't doing a type-only search.
15936 * statement.cs (Block): Added constructor which takes a
15937 `Parameters parameters' argument.
15938 (Block.Parameters): New public property.
15940 * support.cs (InternalParameters.Parameters): Renamed `parameters'
15941 to `Parameters' and made it public readonly.
15943 2002-08-06 Martin Baulig <martin@gnome.org>
15945 * ecore.cs (Expression.Warning): Made this public as well.
15947 * report.cs (Report.Debug): Print the contents of collections.
15949 2002-08-06 Martin Baulig <martin@gnome.org>
15951 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
15952 used to tell Resolve() which kinds of expressions it may return.
15953 (Expression.Resolve): Added overloaded version of this method which
15954 takes a `ResolveFlags flags' argument. This can be used to tell
15955 Resolve() which kinds of expressions it may return. Reports a
15957 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
15958 ResolveFlags.SimpleName.
15959 (Expression.Error118): Added overloaded version of this method which
15960 takes a `ResolveFlags flags' argument. It uses the flags to determine
15961 which kinds of expressions are allowed.
15963 * expression.cs (Argument.ResolveMethodGroup): New public method.
15964 Resolves an argument, but allows a MethodGroup to be returned.
15965 This is used when invoking a delegate.
15967 * TODO: Updated a bit.
15969 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15971 Fixed compilation with csc.
15973 * ecore.cs: Expression.Error made public. Is this correct? Should
15974 Warning be made public too?
15976 * expression.cs: use ea.Location instead of ea.loc.
15977 [FIXME: Filed as bug #28607: MCS must report these errors.]
15979 2002-08-06 Martin Baulig <martin@gnome.org>
15981 * ecore.cs (Expression.loc): Moved the location here instead of
15982 duplicating it in all derived classes.
15983 (Expression.Location): New public property.
15984 (Expression.Error, Expression.Warning): Made them non-static and
15985 removed the location argument.
15986 (Expression.Warning): Added overloaded version which takes an
15987 `int level' argument.
15988 (Expression.Error118): Make this non-static and removed the
15989 expression and location arguments.
15990 (TypeExpr): Added location argument to the constructor.
15992 * expression.cs (StaticCallExpr): Added location argument to
15994 (Indirection, PointerArithmetic): Likewise.
15995 (CheckedExpr, UnCheckedExpr): Likewise.
15996 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
15997 (StringPtr): Likewise.
16000 2002-08-05 Martin Baulig <martin@gnome.org>
16002 * expression.cs (BaseAccess.DoResolve): Actually report errors.
16004 * assign.cs (Assign.DoResolve): Check whether the source
16005 expression is a value or variable.
16007 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
16008 while resolving the corresponding blocks.
16010 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
16011 an error, don't silently return null.
16013 * statement.cs (Block.AddVariable): Do the error reporting here
16014 and distinguish between CS0128 and CS0136.
16015 (Block.DoResolve): Report all unused labels (warning CS0164).
16016 (LabeledStatement): Pass the location to the constructor.
16017 (LabeledStatement.HasBeenReferenced): New property.
16018 (LabeledStatement.Resolve): Set it to true here.
16020 * statement.cs (Return.Emit): Return success even after reporting
16021 a type mismatch error (CS0126 or CS0127), this is what csc does and
16022 it avoids confusing the users with any consecutive errors.
16024 2002-08-05 Martin Baulig <martin@gnome.org>
16026 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
16028 * const.cs (Const.LookupConstantValue): Catch circular definitions.
16030 * expression.cs (MemberAccess.DoResolve): Silently return if an
16031 error has already been reported.
16033 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
16034 error has already been reported.
16036 2002-08-05 Martin Baulig <martin@gnome.org>
16038 * statement.cs (UsageVector): Only initialize the `parameters'
16039 vector if we actually have any "out" parameters.
16041 2002-08-05 Martin Baulig <martin@gnome.org>
16043 * expression.cs (Binary.ResolveOperator): When combining delegates,
16044 they must have the same type.
16046 2002-08-05 Martin Baulig <martin@gnome.org>
16048 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
16049 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
16050 work with the ms runtime and we also don't need it: if we're a
16051 PropertyBuilder and not in the `indexer_arguments' hash, then we
16052 are a property and not an indexer.
16054 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
16055 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
16056 since the latter one doesn't work with the ms runtime.
16058 2002-08-03 Martin Baulig <martin@gnome.org>
16060 Fixed bugs #27998 and #22735.
16062 * class.cs (Method.IsOperator): New public field.
16063 (Method.CheckBase): Report CS0111 if there's already a method
16064 with the same parameters in the current class. Report CS0508 when
16065 attempting to change the return type of an inherited method.
16066 (MethodData.Emit): Report CS0179 if a method doesn't have a body
16067 and it's not marked abstract or extern.
16068 (PropertyBase): New abstract base class for Property and Indexer.
16069 (PropertyBase.CheckBase): Moved here from Property and made it work
16071 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
16072 the same so we can reuse it there.
16073 (Property, Indexer): Derive from PropertyBase.
16074 (MethodSignature.inheritable_property_signature_filter): New delegate
16075 to find properties and indexers.
16077 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
16078 argument and improved error reporting.
16080 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
16081 EmptyReadOnlyParameters and made it a property.
16083 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
16084 version of this method which takes a `PropertyInfo indexer'.
16085 (TypeManager.RegisterIndexer): New method.
16087 * class.cs: Added myself as author of this file :-)
16089 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
16091 * class.cs: fixed compilation on windoze.
16093 2002-08-03 Martin Baulig <martin@gnome.org>
16095 * interface.cs (Interface.GetInterfaceBases): Check whether all
16096 base interfaces are at least as accessible than the current one.
16098 * class.cs (TypeContainer.GetClassBases): Check whether base types
16099 are at least as accessible than the current type.
16100 (TypeContainer.AsAccessible): Implemented and made non-static.
16101 (MemberBase.CheckParameters): Report errors if the accessibility
16104 * delegate.cs (Delegate.Delegate): The default visibility is
16105 internal for top-level types and private for nested types.
16106 (Delegate.Define): Report errors if the accessibility checks fail.
16108 * enum.cs (Enum.Enum): The default visibility is internal for
16109 top-level types and private for nested types.
16110 (Enum.DefineType): Compute the correct visibility.
16112 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
16113 function which takes a `bool is_toplevel' instead of a TypeContainer.
16115 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
16118 2002-08-02 Martin Baulig <martin@gnome.org>
16120 * expression.cs (LocalVariableReferenc): Added constructor which
16121 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
16122 (LocalVariableReference.IsReadOnly): New property.
16123 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
16124 variable is readonly, use our own readonly flag to do this; you can
16125 use the new constructor to get a writable reference to a read-only
16128 * cs-parser.jay (foreach_statement, using_statement): Get a writable
16129 reference to the local variable.
16131 2002-08-01 Miguel de Icaza <miguel@ximian.com>
16133 * rootcontext.cs (ResolveCore): Also include System.Exception
16135 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
16136 we reach an EmptyStatement.
16138 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
16141 * expression.cs (Binary.ResolveOperator): Check error result in
16144 use brtrue/brfalse directly and avoid compares to null.
16146 2002-08-02 Martin Baulig <martin@gnome.org>
16148 * class.cs (TypeContainer.Define): Define all nested interfaces here.
16149 Fixes bug #28407, added test-155.cs.
16151 2002-08-01 Martin Baulig <martin@gnome.org>
16153 * class.cs (Event.EmitDefaultMethod): Make this work with static
16154 events. Fixes #28311, added verify-3.cs.
16156 2002-08-01 Martin Baulig <martin@gnome.org>
16158 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
16159 `is_disposable' fields.
16160 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
16161 `hm.is_disposable' if we're using the collection pattern.
16162 (Foreach.EmitCollectionForeach): Use the correct type for the
16163 enumerator's local variable, only emit the try/finally block if
16164 necessary (fixes #27713).
16166 2002-08-01 Martin Baulig <martin@gnome.org>
16168 * ecore.cs (Expression.report118): Renamed to Error118 and made
16171 * statement.cs (Throw.Resolve): Check whether the expression is of
16172 the correct type (CS0118) and whether the type derives from
16173 System.Exception (CS0155).
16174 (Catch.Resolve): New method. Do the type lookup here and check
16175 whether it derives from System.Exception (CS0155).
16176 (Catch.CatchType, Catch.IsGeneral): New public properties.
16178 * typemanager.cs (TypeManager.exception_type): Added.
16180 2002-07-31 Miguel de Icaza <miguel@ximian.com>
16182 * driver.cs: Updated About function.
16184 2002-07-31 Martin Baulig <martin@gnome.org>
16186 Implemented Control Flow Analysis.
16188 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
16189 (EmitContext.CurrentBranching): Added.
16190 (EmitContext.StartFlowBranching): Added.
16191 (EmitContext.EndFlowBranching): Added.
16192 (EmitContext.KillFlowBranching): Added.
16193 (EmitContext.IsVariableAssigned): Added.
16194 (EmitContext.SetVariableAssigned): Added.
16195 (EmitContext.IsParameterAssigned): Added.
16196 (EmitContext.SetParameterAssigned): Added.
16197 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
16198 Added control flow analysis stuff here.
16200 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
16201 resolve the expression as lvalue.
16202 (LocalVariableReference.DoResolve): Check whether the variable has
16203 already been assigned.
16204 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
16205 the parameter as assigned here.
16206 (ParameterReference.DoResolve): Check whether the parameter has already
16208 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
16209 expression as lvalue.
16211 * statement.cs (FlowBranching): New class for the flow analysis code.
16212 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
16213 (LabeledStatement.IsDefined): New public property.
16214 (LabeledStatement.AddUsageVector): New public method to tell flow
16215 analyis that the label may be reached via a forward jump.
16216 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
16218 (VariableInfo.Number): New public field. This is used by flow analysis
16219 to number all locals of a block.
16220 (Block.CountVariables): New public property. This is the number of
16221 local variables in this block (including the locals from all parent
16223 (Block.EmitMeta): Number all the variables.
16225 * statement.cs: Added flow analysis support to all classes.
16227 2002-07-31 Martin Baulig <martin@gnome.org>
16229 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
16230 To get debugging messages, compile mcs with /define:MCS_DEBUG and
16231 then use this argument.
16233 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
16235 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
16236 use this to specify /define options.
16238 2002-07-29 Martin Baulig <martin@gnome.org>
16240 * statement.cs (Fixed): Moved all code that does variable lookups
16241 and resolvings from Emit to Resolve.
16243 * statement.cs (For): Moved all code that does variable lookups
16244 and resolvings from Emit to Resolve.
16246 * statement.cs (Using): Moved all code that does variable lookups
16247 and resolvings from Emit to Resolve.
16249 2002-07-29 Martin Baulig <martin@gnome.org>
16251 * attribute.cs (Attribute.Resolve): Explicitly catch a
16252 System.NullReferenceException when creating the
16253 CustromAttributeBuilder and report a different warning message.
16255 2002-07-29 Martin Baulig <martin@gnome.org>
16257 * support.cs (ParameterData.ParameterName): Added method to
16258 get the name of a parameter.
16260 * typemanager.cs (TypeManager.IsValueType): New public method.
16262 2002-07-29 Martin Baulig <martin@gnome.org>
16264 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
16265 is a flag which specifies that it's either ref or out.
16266 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
16267 the out parameter to `out Parameter.Modifier mod', also set the
16268 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
16270 * support.cs (InternalParameters.ParameterModifier): Distinguish
16271 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
16272 Parameter.Modifier.ISBYREF flag if it's either ref or out.
16274 * expression.cs (Argument.GetParameterModifier): Distinguish
16275 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
16276 Parameter.Modifier.ISBYREF flag if it's either ref or out.
16278 2002-07-29 Martin Baulig <martin@gnome.org>
16280 * expression.cs (ParameterReference.ParameterReference): Added
16281 `Location loc' argument to the constructor.
16283 * cs-parser.jay: Pass location to ParameterReference.
16285 2002-07-28 Miguel de Icaza <miguel@ximian.com>
16287 * statement.cs (Try): Initialize the location.
16289 * cs-parser.jay: pass location to Try.
16291 * expression.cs (Unary.Reduce): Change the prototype to return
16292 whether a constant fold could be performed or not. The result is
16293 returned in an out parameters. In the case of Indirection and
16294 AddressOf, we want to perform the full tests.
16296 2002-07-26 Miguel de Icaza <miguel@ximian.com>
16298 * statement.cs (Statement.Emit): Flag dead code.
16300 2002-07-27 Andrew Birkett <andy@nobugs.org>
16302 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
16304 2002-07-27 Martin Baulig <martin@gnome.org>
16306 * class.cs (MethodData.Define): Put back call to
16307 TypeManager.AddMethod(), accidentally commented this out.
16309 * report.cs (Debug): New public method to print debugging information,
16310 this is `[Conditional ("DEBUG")]'.
16312 2002-07-26 Martin Baulig <martin@gnome.org>
16314 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
16315 (switch_statement): Push the current_block to the switch_stack and
16316 pop it again when we're done with the switch.
16317 (switch_section): The new block is a child of the current_block.
16318 Fixes bug #24007, added test-152.cs.
16320 2002-07-27 Martin Baulig <martin@gnome.org>
16322 * expression.cs (Invocation.EmitArguments): When calling a varargs
16323 function with only its fixed arguments, we need to pass an empty
16326 2002-07-27 Martin Baulig <martin@gnome.org>
16328 Mono 0.13 has been released.
16330 2002-07-25 Miguel de Icaza <miguel@ximian.com>
16332 * driver.cs: Rename --resource to --linkres, because that is what
16333 we do currently, we dont support --resource yet.
16335 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
16337 2002-07-25 Martin Baulig <martin@gnome.org>
16339 * class.cs (MethodData): New public class. This is a `method builder'
16340 class for a method or one accessor of a Property/Indexer/Event.
16341 (MethodData.GetMethodFlags): Moved here from MemberBase.
16342 (MethodData.ApplyAttributes): Likewise.
16343 (MethodData.ApplyObsoleteAttribute): Likewise.
16344 (MethodData.ApplyConditionalAttribute): Likewise.
16345 (MethodData.ApplyDllImportAttribute): Likewise.
16346 (MethodData.CheckAbstractAndExternal): Likewise.
16347 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
16348 (MethodData.Emit): Formerly known as Method.Emit().
16349 (MemberBase): Moved everything which was specific to a single
16350 accessor/method to MethodData.
16351 (Method): Create a new MethodData and call Define() and Emit() on it.
16352 (Property, Indexer, Event): Create a new MethodData objects for each
16353 accessor and call Define() and Emit() on them.
16355 2002-07-25 Martin Baulig <martin@gnome.org>
16357 Made MethodCore derive from MemberBase to reuse the code from there.
16358 MemberBase now also checks for attributes.
16360 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
16361 (MemberBase.GetMethodFlags): Moved here from class Method and marked
16363 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
16364 `CallingConventions cc' and `Attributes opt_attrs' arguments.
16365 (MemberBase.ApplyAttributes): New virtual method; applies the
16366 attributes to a method or accessor.
16367 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
16368 (MemberBase.ApplyConditionalAttribute): Likewise.
16369 (MemberBase.ApplyDllImportAttribute): Likewise.
16370 (MemberBase.CheckAbstractAndExternal): Likewise.
16371 (MethodCore.ParameterTypes): This is now a property instead of a
16372 method, it's initialized from DoDefineParameters().
16373 (MethodCore.ParameterInfo): Removed the set accessor.
16374 (MethodCore.DoDefineParameters): New protected virtual method to
16375 initialize ParameterTypes and ParameterInfo.
16376 (Method.GetReturnType): We can now simply return the MemberType.
16377 (Method.GetMethodFlags): Override the MemberBase version and add
16378 the conditional flags.
16379 (Method.CheckBase): Moved some code from Define() here, call
16380 DoDefineParameters() here.
16381 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
16382 here to avoid some larger code duplication.
16383 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
16384 ensure that abstract and external accessors don't declare a body.
16386 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
16387 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
16388 lookup in the attribute's parent classes, so we need to abort as soon
16389 as we found the first match.
16390 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
16391 the attribute has no arguments.
16393 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
16396 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
16398 * cs-parser.jay: reverted previous patch.
16400 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
16402 * cs-parser.jay: fixed bug #22119.
16404 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
16406 * attribute.cs: fixed compilation. The error was:
16407 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
16408 be assigned to before control leaves the current method."
16409 [FIXME: Filed as bug #28186: MCS must report this error.]
16411 2002-07-25 Martin Baulig <martin@gnome.org>
16413 * attribute.cs (Attribute.Conditional_GetConditionName): New static
16414 method to pull the condition name ouf of a Conditional attribute.
16415 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
16416 the obsolete message and error flag out of an Obsolete attribute.
16418 * class.cs (Method.GetMethodFlags): New public method to get the
16419 TypeManager.MethodFlags for this method.
16420 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
16422 (Method.Define): Get and apply the Obsolete and Conditional attributes;
16423 if we're overriding a virtual function, set the new private variable
16424 `parent_method'; call the new TypeManager.AddMethod().
16426 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
16427 the MethodBuilder and the Method in a PtrHashtable.
16428 (TypeManager.builder_to_method): Added for this purpose.
16429 (TypeManager.MethodFlags): Added IsObsoleteError.
16430 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
16431 Obsolete and Conditional arguments in MethodBuilders. If we discover
16432 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
16433 the message from the attribute.
16435 2002-07-24 Martin Baulig <martin@gnome.org>
16437 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
16438 preprocessor directives, ensure that the argument to #define/#undef is
16439 exactly one identifier and that it's actually an identifier.
16441 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
16444 2002-07-24 Martin Baulig <martin@gnome.org>
16446 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
16447 initialize it to TypeManager.object_type in the constructor.
16448 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
16449 of the `hm.get_current' method if we're using the collection pattern.
16450 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
16451 for the explicit conversion to make it work when we're using the collection
16452 pattern and the `Current' property has a different return type than `object'.
16455 2002-07-24 Martin Baulig <martin@gnome.org>
16457 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
16458 does not match, but don't report any errors. This method is called in
16459 order for all methods in a MethodGroupExpr until a matching method is
16460 found, so we don't want to bail out if the first method doesn't match.
16461 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
16462 matches, report the 123. Fixes #28070.
16464 2002-07-24 Martin Baulig <martin@gnome.org>
16466 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
16467 TypeManager.TypeToCoreType() to the top of the method so the
16468 following equality checks will work. Fixes #28107.
16470 2002-07-24 Martin Baulig <martin@gnome.org>
16472 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
16473 operand is of type uint, and the other operand is of type sbyte,
16474 short or int, the operands are converted to type long." -
16475 Actually do what this comment already told us. Fixes bug #28106,
16478 2002-07-24 Martin Baulig <martin@gnome.org>
16480 * class.cs (MethodBase): New abstract class. This is now a base
16481 class for Property, Indexer and Event to avoid some code duplication
16482 in their Define() and DefineMethods() methods.
16483 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
16484 generic methods for Define() and DefineMethods().
16485 (FieldBase): Derive from MemberBase, not MemberCore.
16486 (Property): Derive from MemberBase, not MemberCore.
16487 (Property.DefineMethod): Moved all the code from this method to the
16488 new MethodBase.DefineAccessor(), just call it with appropriate
16490 (Property.Define): Call the new Property.DoDefine(), this does some
16491 sanity checks and we don't need to duplicate the code everywhere.
16492 (Event): Derive from MemberBase, not MemberCore.
16493 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
16494 accessors, this will also make them work with interface events.
16495 (Indexer): Derive from MemberBase, not MemberCore.
16496 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
16497 (Indexer.Define): Use the new MethodBase functions.
16499 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
16500 argument to the constructor.
16501 (Interface.FindMembers): Added support for interface events.
16502 (Interface.PopluateEvent): Implemented.
16504 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
16506 2002-07-22 Miguel de Icaza <miguel@ximian.com>
16508 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
16509 but this is required to check for a method name being the same as
16510 the containing class.
16514 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
16516 * interface.cs: initialize variable.
16518 2002-07-23 Martin Baulig <martin@gnome.org>
16520 Implemented the IndexerName attribute in interfaces.
16522 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
16523 name if this is an explicit interface implementation.
16524 (Indexer.InterfaceIndexerName): New public variable. If we're
16525 implementing an interface indexer, this is the IndexerName in that
16526 interface. Otherwise, it's the IndexerName.
16527 (Indexer.DefineMethod): If we're implementing interface indexer,
16528 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
16529 and Pending.ImplementIndexer methods.
16530 (Indexer.Define): Also define the PropertyBuilder if we're
16531 implementing an interface indexer and this is neither an explicit
16532 interface implementation nor do the IndexerName match the one in
16535 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
16536 If a method is defined here, then we always need to create a proxy
16537 for it. This is used when implementing interface indexers.
16538 (Pending.IsInterfaceIndexer): New public method.
16539 (Pending.ImplementIndexer): New public method.
16540 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
16541 This is used when implementing interface indexers to define a proxy
16543 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
16544 define a proxy if necessary.
16546 * interface.cs (Interface.IndexerName): New public variable.
16547 (Interface.PopulateIndexer): Set the IndexerName.
16548 (Interface.DefineIndexers): New private method. Populate all the
16549 indexers and make sure their IndexerNames match.
16551 * typemanager.cs (IndexerPropertyName): Added support for interface
16554 2002-07-22 Martin Baulig <martin@gnome.org>
16556 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
16557 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
16558 ret if HasReturnLabel.
16559 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
16562 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
16563 and set the ec.LoopBeginTryCatchLevel.
16564 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
16565 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
16566 the current ec.TryCatchLevel, the branch goes out of an exception
16567 block. In this case, we need to use Leave and not Br.
16569 2002-07-22 Martin Baulig <martin@gnome.org>
16571 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
16572 block unless the block does not always return or it is contained in
16573 another try { ... } catch { ... } block. Fixes bug #26506.
16574 Added verify-1.cs to the test suite.
16576 2002-07-22 Martin Baulig <martin@gnome.org>
16578 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
16579 then we do not always return. Fixes bug #24985.
16581 2002-07-22 Martin Baulig <martin@gnome.org>
16583 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
16584 lookup on a per-class level; ie. walk up the class hierarchy until we
16585 found at least one applicable method, then choose the best among them.
16586 Fixes bug #24463 and test-29.cs.
16588 2002-07-22 Martin Baulig <martin@gnome.org>
16590 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
16591 return types of the methods. The return type is not part of the
16592 signature and we must not check it to make the `new' modifier work.
16593 Fixes bug #27999, also added test-147.cs.
16594 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
16596 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
16597 on the method's return type.
16599 2002-07-21 Martin Baulig <martin@gnome.org>
16601 * assign.cs: Make this work if the rightmost source is a constant and
16602 we need to do an implicit type conversion. Also adding a few more tests
16603 to test-38.cs which should have caught this.
16605 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
16606 target in the makefile for this. The makefile.gnu is primarily intended
16607 for end-users who don't want to debug the compiler.
16609 2002-07-21 Martin Baulig <martin@gnome.org>
16611 * assign.cs: Improved the Assign class so it can now handle embedded
16612 assignments (X = Y = Z = something). As a side-effect this'll now also
16613 consume less local variables. test-38.cs now passes with MCS, added
16614 a few new test cases to that test.
16616 2002-07-20 Martin Baulig <martin@gnome.org>
16618 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
16619 instructions. Fixes bug #27977, also added test-146.cs.
16621 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
16623 * cs-tokenizer.cs: fixed getHex ().
16625 2002-07-19 Martin Baulig <martin@gnome.org>
16627 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
16628 not Type.GetType() to lookup the array type. This is needed when
16629 we're constructing an array of a user-defined type.
16630 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
16631 single-dimensional arrays, but also for single-dimensial arrays of
16634 2002-07-19 Martin Baulig <martin@gnome.org>
16636 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
16637 this function is called, it's not allowed to share LocalBuilders
16638 among ILGenerators.
16640 2002-07-19 Martin Baulig <martin@gnome.org>
16642 * expression.cs (Argument.Resolve): Report an error 118 when trying
16643 to pass a type as argument.
16645 2002-07-18 Martin Baulig <martin@gnome.org>
16647 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
16648 Conv_R_Un for the signed `long' type.
16650 2002-07-15 Miguel de Icaza <miguel@ximian.com>
16652 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
16653 `expr' for the temporary result, as that will fail if we do
16654 multiple resolves on the same expression.
16656 2002-07-05 Miguel de Icaza <miguel@ximian.com>
16658 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
16659 ec.TypeContainer for looking up aliases.
16661 * class.cs (TypeContainer): Remove LookupAlias from here.
16663 * decl.cs (DeclSpace); Move here.
16665 2002-07-01 Miguel de Icaza <miguel@ximian.com>
16667 * class.cs (FindMembers): Only call filter if the constructor
16668 bulider is not null.
16670 Also handle delegates in `NestedTypes' now. Now we will perform
16671 type lookups using the standard resolution process. This also
16674 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
16675 This uses Expressions (the limited kind that can be parsed by the
16676 tree) instead of strings.
16678 * expression.cs (ComposedCast.ToString): Implement, used to flag
16679 errors since now we have to render expressions.
16681 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
16684 * ecore.cs (SimpleName.ToString): ditto.
16686 * cs-parser.jay: Instead of using strings to assemble types, use
16687 Expressions to assemble the type (using SimpleName, ComposedCast,
16688 MemberAccess). This should fix the type lookups in declarations,
16689 because we were using a different code path for this.
16691 * statement.cs (Block.Resolve): Continue processing statements
16692 even when there is an error.
16694 2002-07-17 Miguel de Icaza <miguel@ximian.com>
16696 * class.cs (Event.Define): Also remove the `remove' method from
16697 the list of pending items.
16699 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
16700 generate more compact code.
16702 2002-07-17 Martin Baulig <martin@gnome.org>
16704 * const.cs (Const.LookupConstantValue): Add support for constant
16705 `unchecked' and `checked' expressions.
16706 Also adding test case test-140.cs for this.
16708 2002-07-17 Martin Baulig <martin@gnome.org>
16710 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
16711 check whether mi.ReturnType implements the IEnumerator interface; the
16712 `==' and the IsAssignableFrom() will fail in this situation.
16714 2002-07-16 Ravi Pratap <ravi@ximian.com>
16716 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
16719 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
16721 * expression.cs: fixed bug #27811.
16723 2002-07-14 Miguel de Icaza <miguel@ximian.com>
16725 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
16726 Molaro: when we are a ref, the value already contains a pointer
16727 value, do not take the address of it.
16729 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
16730 * removed mb-parser.jay and mb-tokenizer.cs
16732 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
16734 * expression.cs: check against the building corlib void type.
16736 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
16738 * ecore.cs: fix for valuetype static readonly fields: when
16739 initializing them, we need their address, not the address of a copy.
16741 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
16743 * typemanager.cs: register also enum_type in corlib.
16745 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
16747 * class.cs: allow calling this (but not base) initializers in structs.
16749 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
16751 * ecore.cs: make sure we compare against the building base types
16754 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
16756 * typemanager.cs: fix TypeToCoreType() to handle void and object
16757 (corlib gets no more typerefs after this change).
16759 2002-07-12 Miguel de Icaza <miguel@ximian.com>
16761 * expression.cs (ArrayCreation.EmitArrayArguments): use
16762 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
16764 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
16765 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
16766 array indexes, the runtime actually forbids them.
16768 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
16769 for array arguments here.
16771 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
16772 instead of the default for ValueTypes.
16774 (New.DoEmit): Use IsValueType instead of
16775 IsSubclassOf (value_type)
16776 (New.DoResolve): ditto.
16777 (Invocation.EmitCall): ditto.
16779 * assign.cs (Assign): ditto.
16781 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
16782 Statements *are* currently doing part of their resolution during
16785 Expressions do always resolve during resolve, but statements are
16786 only required to propagate resolution to their children.
16788 2002-07-11 Miguel de Icaza <miguel@ximian.com>
16790 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
16792 (LoadAssembly): Do not add the dll if it is already specified
16794 (MainDriver): Add the System directory to the link path at the end,
16795 after all the other -L arguments.
16797 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
16798 wrong opcode for loading bytes and bools (ldelem.i1 instead of
16799 ldelem.u1) and using the opposite for sbytes.
16801 This fixes Digger, and we can finally run it.
16803 * driver.cs (UnixParseOption): Move the option parsing here.
16804 (CSCParseOption): Implement CSC-like parsing of options.
16806 We now support both modes of operation, the old Unix way, and the
16807 new CSC-like way. This should help those who wanted to make cross
16808 platform makefiles.
16810 The only thing broken is that /r:, /reference: and /lib: are not
16811 implemented, because I want to make those have the same semantics
16812 as the CSC compiler has, and kill once and for all the confussion
16813 around this. Will be doing this tomorrow.
16815 * statement.cs (Unsafe.Resolve): The state is checked during
16816 resolve, not emit, so we have to set the flags for IsUnsfe here.
16818 2002-07-10 Miguel de Icaza <miguel@ximian.com>
16820 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
16821 not catch the Error_ObjectRefRequired in SimpleName (as it is
16822 possible to have a class/instance variable name that later gets
16823 deambiguated), we have to check this here.
16825 2002-07-10 Ravi Pratap <ravi@ximian.com>
16827 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
16828 make static and put into Expression.
16830 (Event.Define): Register the private field of the event with the
16831 TypeManager so that GetFieldFromEvent can get at it.
16833 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
16834 keep track of the private field associated with an event which
16837 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
16840 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
16842 2002-07-10 Miguel de Icaza <miguel@ximian.com>
16844 * expression.cs (Binary.EmitBranchable): this routine emits the
16845 Binary expression in a branchable context. This basically means:
16846 we need to branch somewhere, not just get the value on the stack.
16848 This works together with Statement.EmitBoolExpression.
16850 * statement.cs (Statement.EmitBoolExpression): Use
16853 2002-07-09 Miguel de Icaza <miguel@ximian.com>
16855 * statement.cs (For): Reduce the number of jumps in loops.
16857 (For): Implement loop inversion for the For statement.
16859 (Break): We can be breaking out of a Try/Catch controlled section
16860 (foreach might have an implicit try/catch clause), so we need to
16861 use Leave instead of Br.
16863 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
16864 now). If the instace expression supports IMemoryLocation, we use
16865 the AddressOf method from the IMemoryLocation to extract the
16866 address instead of emitting the instance.
16868 This showed up with `This', as we were emitting the instance
16869 always (Emit) instead of the Address of This. Particularly
16870 interesting when This is a value type, as we dont want the Emit
16871 effect (which was to load the object).
16873 2002-07-08 Miguel de Icaza <miguel@ximian.com>
16875 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
16877 * statement.cs (Checked): Set the CheckedState during the resolve
16878 process too, as the ConvCast operations track the checked state on
16879 the resolve process, and not emit.
16881 * cs-parser.jay (namespace_member_declaration): Flag that we have
16882 found a declaration when we do. This is used to flag error 1529
16884 * driver.cs: Report ok when we display the help only.
16886 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
16888 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
16890 2002-07-04 Miguel de Icaza <miguel@ximian.com>
16892 * cs-tokenizer.cs (define): We also have to track locally the
16893 defines. AllDefines is just used for the Conditional Attribute,
16894 but we also need the local defines for the current source code.
16896 2002-07-03 Miguel de Icaza <miguel@ximian.com>
16898 * statement.cs (While, For, Do): These loops can exit through a
16899 Break statement, use this information to tell whether the
16900 statement is the last piece of code.
16902 (Break): Flag that we break.
16904 * codegen.cs (EmitContexts): New `Breaks' state variable.
16906 2002-07-03 Martin Baulig <martin@gnome.org>
16908 * class.cs (TypeContainer.MethodModifiersValid): Allow override
16909 modifiers in method declarations in structs. Otherwise, you won't
16910 be able to override things like Object.Equals().
16912 2002-07-02 Miguel de Icaza <miguel@ximian.com>
16914 * class.cs (Method, Property, Indexer): Do not allow the public
16915 modifier to be used in explicit interface implementations.
16917 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
16918 override modifiers in method declarations in structs
16920 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
16922 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
16923 integer or real overflow, report an error
16925 2002-07-02 Martin Baulig <martin@gnome.org>
16927 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
16928 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
16929 to tell the runtime about our newly created System.Object and
16930 System.ValueType types.
16932 2002-07-02 Miguel de Icaza <miguel@ximian.com>
16934 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
16935 struct instead of Ldarg/Starg.
16937 2002-07-02 Martin Baulig <martin@gnome.org>
16939 * expression.cs (Indirection.Indirection): Call
16940 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
16942 2002-07-02 Martin Baulig <martin@gnome.org>
16944 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
16945 ValueType, call TypeManager.TypeToCoreType() on it.
16946 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
16947 the OpCodes.Newarr argument.
16949 2002-07-02 Martin Baulig <martin@gnome.org>
16951 * expression.cs (Invocation.EmitCall): When compiling corlib,
16952 replace all calls to the system's System.Array type to calls to
16953 the newly created one.
16955 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
16956 System.Array methods.
16957 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
16958 from the system's System.Array type which must be replaced.
16960 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
16962 * typemanager.cs: load unverifiable_code_ctor so we can build
16963 corlib using the correct type. Avoid using GetTypeCode() with
16965 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
16966 TypeManager.object_type to allow building corlib.
16968 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
16970 * ecore.cs: handle System.Enum separately in LoadFromPtr().
16972 2002-07-01 Martin Baulig <martin@gnome.org>
16974 * class.cs: Make the last change actually work, we need to check
16975 whether `ifaces != null' to avoid a crash.
16977 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
16979 * class.cs: when we build structs without fields that implement
16980 interfaces, we need to add the interfaces separately, since there is
16981 no API to both set the size and add the interfaces at type creation
16984 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
16986 * expression.cs: the dimension arguments to the array constructors
16987 need to be converted if they are a long.
16989 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
16991 * class.cs: don't emit ldarg.0 if there is no parent constructor
16992 (fixes showstopper for corlib).
16994 2002-06-29 Martin Baulig <martin@gnome.org>
16996 MCS now compiles corlib on GNU/Linux :-)
16998 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
16999 ie. check for MethodImplOptions.InternalCall.
17001 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
17002 and TypeManager.attribute_type are null, so we must explicitly check
17003 whether parent is not null to find out whether it's an attribute type.
17004 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
17005 and SetBuilder, not only if the property is neither abstract nor external.
17006 This is necessary to set the MethodImplOptions on the accessor methods.
17007 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
17008 SetBuilder, see Property.Emit().
17010 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
17011 populate "System.Object", "System.ValueType" and "System.Attribute" since
17012 they've already been populated from BootCorlib_PopulateCoreTypes().
17014 2002-06-29 Martin Baulig <martin@gnome.org>
17016 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
17017 is the NullLiteral, we also need to make sure that target_type is not
17020 2002-06-29 Martin Baulig <martin@gnome.org>
17022 * rootcontext.cs (RootContext.ResolveCore): We must initialize
17023 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
17024 before calling BootstrapCorlib_ResolveDelegate ().
17026 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
17028 * statement.cs: fixed build-breaker. All tests passed ok.
17030 2002-06-27 Martin Baulig <martin@gnome.org>
17032 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
17033 for System.Decimal when compiling corlib.
17035 2002-06-27 Martin Baulig <martin@gnome.org>
17037 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
17038 switch blocks which contain nothing but a default clause.
17040 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
17042 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
17044 2002-06-27 Martin Baulig <martin@gnome.org>
17046 * ecore.cs (PropertyExpr.PropertyExpr): Call
17047 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
17049 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
17050 is already a TypeBuilder.
17052 2002-06-27 Martin Baulig <martin@gnome.org>
17054 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
17055 `target_type == TypeManager.array_type', not IsAssignableFrom() in
17056 the "from an array-type to System.Array" case. This makes it work
17057 when compiling corlib.
17059 2002-06-27 Martin Baulig <martin@gnome.org>
17061 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
17062 non-static PropertyExpr, set its InstanceExpression. This makes
17063 the `ICollection.Count' property work in System/Array.cs.
17065 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
17067 * driver.cs: Made error handling more consistent. Errors now
17068 tracked by Report class, so many methods which used to return int
17069 now return void. Main() now prints success/failure and
17070 errors/warnings message.
17072 Renamed '--probe' compiler argument to '--expect-error'. Removed
17073 the magic number return values (123 and 124). Now, if the
17074 expected error occurs, the compiler exits with success (exit value
17075 0). If the compilation completes without seeing that particular
17076 error, the compiler exits with failure (exit value 1). The
17077 makefile in mcs/errors has been changed to handle the new behaviour.
17079 * report.cs: Made 'expected error' number a property and renamed
17080 it from 'Probe' to 'ExpectedError'.
17082 * genericparser.cs: Removed error handling support, since it is
17083 now all done by Report class.
17085 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
17086 class, so parse() no longer returns an int.
17088 * namespace.cs: Use Report.Error instead of GenericParser.error
17090 2002-06-22 Miguel de Icaza <miguel@ximian.com>
17092 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
17093 TypeContainer.AddOperator): At the front of the list put the
17094 explicit implementations, so they get resolved/defined first.
17096 2002-06-21 Miguel de Icaza <miguel@ximian.com>
17098 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
17099 interface type is implemented by this TypeContainer. Used during
17100 explicit interface implementation.
17102 (Property.Define, Indexer.Define, Method.Define): Validate that
17103 the given interface in the explicit implementation is one of the
17104 base classes for the containing type.
17106 Also if we are explicitly implementing an interface, but there is
17107 no match in the pending implementation table, report an error.
17109 (Property.Define): Only define the property if we are
17110 not explicitly implementing a property from an interface. Use the
17111 correct name also for those properties (the same CSC uses,
17112 although that is really not needed).
17114 (Property.Emit): Do not emit attributes for explicitly implemented
17115 properties, as there is no TypeBuilder.
17117 (Indexer.Emit): ditto.
17119 Hiding then means that we do not really *implement* a pending
17120 implementation, which makes code fail.
17122 2002-06-22 Martin Baulig <martin@gnome.org>
17124 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
17125 the return value of Object.GetType(). [FIXME: we need to do this whenever
17126 we get a type back from the reflection library].
17128 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
17130 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
17132 2002-06-20 Miguel de Icaza <miguel@ximian.com>
17134 * attribute.cs: Return null if we can not look up the type.
17136 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
17137 the interface types found.
17139 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
17140 interface types found.
17142 * typemanager.cs (GetInterfaces): Make this routine returns alll
17143 the interfaces and work around the lame differences between
17144 System.Type and System.Reflection.Emit.TypeBuilder in the results
17145 result for GetInterfaces.
17147 (ExpandInterfaces): Given an array of interface types, expand and
17148 eliminate repeated ocurrences of an interface. This expands in
17149 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
17152 2002-06-21 Martin Baulig <martin@gnome.org>
17154 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
17157 2002-06-21 Martin Baulig <martin@gnome.org>
17159 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
17160 and called with one of the core types, return the corresponding typebuilder for
17163 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
17166 2002-06-21 Martin Baulig <martin@gnome.org>
17168 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
17169 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
17170 (Expression.ConvertReferenceExplicit): Likewise.
17172 * expression.cs (ElementAccess.DoResolve): Likewise.
17173 (ElementAccess.DoResolveLValue): Likewise.
17175 2002-06-10 Martin Baulig <martin@gnome.org>
17177 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
17178 add the "value" parameter to the parameter list.
17180 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
17183 2002-06-19 Miguel de Icaza <miguel@ximian.com>
17185 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
17186 the argument to an int, uint, long or ulong, per the spec. Also
17187 catch negative constants in array creation.
17189 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
17191 * class.cs: do not allow the same interface to appear twice in
17192 the definition list.
17194 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
17196 * ecore.cs: don't use ldlen with System.Array.
17198 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
17200 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
17202 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
17204 * modifiers.cs: produce correct field attributes for protected
17205 internal. Easy fix so miguel can work on ther harder stuff:-)
17207 2002-06-18 Miguel de Icaza <miguel@ximian.com>
17209 * pending.cs: New file. Move the code from class.cs here.
17210 Support clearning the pending flag for all methods (when not doing
17211 explicit interface implementation).
17213 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
17215 * rootcontext.cs: added a couple more types needed to bootstrap.
17217 2002-06-17 Miguel de Icaza <miguel@ximian.com>
17219 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
17220 constructor in the type, instead of any constructor in the type
17221 hierarchy. Thanks to Paolo for finding this bug (it showed up as
17222 a bug in the Mono runtime when applying the params attribute).
17224 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
17225 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
17227 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
17229 * expression.cs (Unary.ResolveOperator): Use TypeManager
17230 to resolve the type.
17232 2002-06-13 Ravi Pratap <ravi@ximian.com>
17234 * cs-parser.jay (enum_member_declaration): Pass in the attributes
17237 * enum.cs (AddEnumMember): Add support to store the attributes associated
17238 with each member too.
17240 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
17241 field builders too - this takes care of the enum member case.
17243 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
17245 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
17246 address-of operator on both value types and pointers.
17248 2002-06-10 Martin Baulig <martin@gnome.org>
17250 * interface.cs (Interface.PopulateIndexer): Add the indexer's
17251 PropertyBuilder to the `property_builders' list.
17253 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
17254 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
17255 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
17256 find any indexers which are inherited from an interface.
17258 2002-06-09 Martin Baulig <martin@gnome.org>
17260 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
17261 the same type as the constant if necessary. There's also a test-130.cs
17264 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
17266 * typemanager.cs (TypeManager.ChangeType): Previously known as
17267 Enum.ChangeEnumType().
17269 2002-06-09 Martin Baulig <martin@gnome.org>
17271 * expression.cs (Cast.TryReduce): Added support for consts.
17273 2002-06-08 Ravi Pratap <ravi@ximian.com>
17275 * class.cs (Accessor): Hold attributes information so we can pass
17278 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
17279 Modify to pass in attributes attached to the methods.
17281 (add_accessor_declaration, remove_accessor_declaration): Ditto.
17283 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
17284 to handle the Accessor kind :-)
17286 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
17288 2002-06-08 Martin Baulig <martin@gnome.org>
17290 * expression.cs (Unary.TryReduceNegative): Added support for
17293 2002-06-08 Martin Baulig <martin@gnome.org>
17295 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
17296 name can't be found in the `defined_names' - the caller will do a
17297 MemberLookup in this case and thus find methods in System.Enum
17298 such as Enum.IsDefined().
17300 2002-06-08 Martin Baulig <martin@gnome.org>
17302 * enum.cs (Enum.ChangeEnumType): This is a custom version of
17303 Convert.ChangeType() which works with TypeBuilder created types.
17304 (Enum.LookupEnumValue, Enum.Define): Use it here.
17306 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
17307 `TypeBuilder.BaseType != null' check.
17308 (TypeContainer.FindMembers): Only lookup parent members if we
17309 actually have a parent.
17310 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
17311 (ConstructorInitializer.Resolve): Likewise.
17313 * interface.cs (Interface.FindMembers): Added
17314 `TypeBuilder.BaseType != null' check.
17316 * rootcontext.cs (RootContext.ResolveCore): Added
17317 "System.Runtime.CompilerServices.IndexerNameAttribute" to
17318 classes_second_stage.
17320 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
17321 debug_type and trace_type when compiling with --nostdlib.
17323 2002-06-07 Martin Baulig <martin@gnome.org>
17325 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
17326 (AddField): Set it to true when adding a non-static field.
17327 (DefineType): Use `have_nonstatic_fields' to find out whether we
17328 have non-static fields, not `Fields != null'.
17330 2002-06-02 Miguel de Icaza <miguel@ximian.com>
17332 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
17333 dereferencing a null on the static-field code path)
17335 2002-05-30 Martin Baulig <martin@gnome.org>
17337 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
17338 to take command line arguments. Use reflection to call the new
17339 custom `Initialize' function on the symbol writer and pass it the
17340 command line arguments.
17342 * driver.cs (--debug-args): New command line argument to pass command
17343 line arguments to the symbol writer.
17345 2002-05-28 Miguel de Icaza <miguel@ximian.com>
17347 * assign.cs (DoResolve): Forgot to do the implicit conversion to
17348 the target type for indexers and properties. Thanks to Joe for
17351 2002-05-27 Miguel de Icaza <miguel@ximian.com>
17353 * typemanager.cs (MethodFlags): returns the method flags
17354 (Obsolete/ShouldIgnore) that control warning emission and whether
17355 the invocation should be made, or ignored.
17357 * expression.cs (Invocation.Emit): Remove previous hack, we should
17358 not do this on matching a base type, we should do this based on an attribute
17360 Only emit calls to System.Diagnostics.Debug and
17361 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
17362 on the command line.
17364 * rootcontext.cs: Global settings for tracing and debugging.
17366 * cs-tokenizer.cs (define): New utility function to track
17367 defines. Set the global settings for TRACE and DEBUG if found.
17369 2002-05-25 Ravi Pratap <ravi@ximian.com>
17371 * interface.cs (Populate*): Pass in the TypeContainer as well as
17372 the DeclSpace as parameters so that we can create EmitContexts and
17373 then use that to apply attributes etc.
17375 (PopulateMethod, PopulateEvent, PopulateProperty)
17376 (PopulateIndexer): Apply attributes everywhere.
17378 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
17381 (ApplyAttributes): Update accordingly.
17383 We now apply interface attributes for all members too.
17385 2002-05-26 Miguel de Icaza <miguel@ximian.com>
17387 * class.cs (Indexer.Define); Correctly check if we are explicit
17388 implementation (instead of checking the Name for a ".", we
17389 directly look up if the InterfaceType was specified).
17391 Delay the creation of the PropertyBuilder.
17393 Only create the PropertyBuilder if we are not an explicit
17394 interface implementation. This means that explicit interface
17395 implementation members do not participate in regular function
17396 lookups, and hence fixes another major ambiguity problem in
17397 overload resolution (that was the visible effect).
17399 (DefineMethod): Return whether we are doing an interface
17402 * typemanager.cs: Temporary hack until we get attributes in
17403 interfaces (Ravi is working on that) and we get IndexerName
17404 support in interfaces.
17406 * interface.cs: Register the indexers as properties.
17408 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
17409 warning, I have verified that this is a bug in the .NET runtime
17410 (JavaScript suffers of the same problem).
17412 * typemanager.cs (MemberLookup): When looking up members for
17413 interfaces, the parent of an interface is the implicit
17414 System.Object (so we succeed in searches of Object methods in an
17415 interface method invocation. Example: IEnumerable x; x.ToString
17418 2002-05-25 Miguel de Icaza <miguel@ximian.com>
17420 * class.cs (Event): Events should also register if they do
17421 implement the methods that an interface requires.
17423 * typemanager.cs (MemberLookup); use the new GetInterfaces
17426 (GetInterfaces): The code used to lookup interfaces for a type is
17427 used in more than one place, factor it here.
17429 * driver.cs: Track the errors at the bottom of the file, we kept
17432 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
17433 instance if the method we are calling is static!
17435 2002-05-24 Miguel de Icaza <miguel@ximian.com>
17437 * attribute.cs (ApplyAttributes): Make this function filter out
17438 the IndexerName attribute (as that attribute in reality is never
17439 applied) and return the string constant for the IndexerName
17442 * class.cs (TypeContainer.Emit): Validate that all the indexers
17443 have the same IndexerName attribute, and if so, set the
17444 DefaultName attribute on the class.
17446 * typemanager.cs: The return value might contain other stuff (not
17447 only methods). For instance, consider a method with an "Item"
17448 property and an Item method.
17450 * class.cs: If there is a problem with the parameter types,
17453 2002-05-24 Ravi Pratap <ravi@ximian.com>
17455 * ecore.cs (ImplicitConversionExists): Wrapper function which also
17456 looks at user defined conversion after making a call to
17457 StandardConversionExists - we need this for overload resolution.
17459 * expression.cs : Update accordingly the various method calls.
17461 This fixes 2 bugs filed against implicit user defined conversions
17463 2002-05-22 Miguel de Icaza <miguel@ximian.com>
17465 * statement.cs: Track the result of the assignment.
17467 2002-05-21 Miguel de Icaza <miguel@ximian.com>
17469 * expression.cs (MemberAccess): Improved error reporting for
17470 inaccessible members.
17472 2002-05-22 Martin Baulig <martin@gnome.org>
17474 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
17475 itself with debugging support.
17477 2002-05-22 Martin Baulig <martin@gnome.org>
17479 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
17480 Removed, this isn't needed anymore.
17482 2002-05-20 Martin Baulig <martin@gnome.org>
17484 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
17485 be underlying type for an enum.
17487 2002-05-20 Miguel de Icaza <miguel@ximian.com>
17489 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
17490 that splits out the loading of just the core types.
17492 * rootcontext.cs (ResolveCore): Split the struct resolution in
17493 two, so we can load the enumeration underlying types before any
17496 * expression.cs (Is): Bandaid until we fix properly Switch (see
17497 bug #24985 for details).
17499 * typemanager.cs (ImplementsInterface): The hashtable will contain
17500 a null if there are no interfaces implemented.
17502 2002-05-18 Miguel de Icaza <miguel@ximian.com>
17504 * cs-parser.jay (indexer_declarator): It is fine to have array
17507 2002-05-17 Miguel de Icaza <miguel@ximian.com>
17509 * typemanager.cs: (RegisterBuilder): New function used to register
17510 TypeBuilders that implement interfaces. Since
17511 TypeBuilder.GetInterfaces (as usual) does not work with lame
17513 (AddUserType): register interfaces.
17515 (ImplementsInterface): Use the builder_to_ifaces hash if we are
17516 dealing with TypeBuilder. Also, arrays are showing up as
17517 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
17518 methods can not be invoked on them!
17520 * ecore.cs (ExplicitReferenceConversionExists): Made public.
17521 (ImplicitReferenceConversionExists): Split out from
17522 StandardConversionExists.
17524 * expression.cs (As): We were only implementing one of the three
17525 cases for the as operator. We now implement them all.
17526 (Is): Implement the various other cases for Is as well.
17528 * typemanager.cs (CACHE): New define used to control if we want or
17529 not the FindMembers cache. Seems to have a negative impact on
17530 performance currently
17532 (MemberLookup): Nested types have full acess to
17533 enclosing type members
17535 Remove code that coped with instance/static returns for events, we
17536 now catch this in RealFindMembers.
17538 (RealFindMembers): only perform static lookup if the instance
17539 lookup did not return a type or an event.
17541 2002-05-17 Miguel de Icaza <miguel@ximian.com>
17543 * assign.cs (CompoundAssign): We pass more semantic information
17544 now to Compound Assignments than we did before: now we have all
17545 the information at hand, and now we resolve the target *before* we
17546 do the expression expansion, which allows the "CacheValue" method
17547 to have the effect we intended (before, a [x] += 1 would generate
17548 two differen ArrayAccess expressions from the ElementAccess,
17549 during the resolution process).
17551 (CompoundAssign.DoResolve): Resolve target and original_source here.
17553 2002-05-16 Miguel de Icaza <miguel@ximian.com>
17555 * expression.cs (ArrayAccess): dropped debugging information.
17557 * typemanager.cs: Small bug fix: I was always returning i_members,
17558 instead of one of i_members or s_members (depending on which had
17561 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
17562 method is invoked before any code generation takes place, and it
17563 is a mechanism to inform that the expression will be invoked more
17564 than once, and that the method should use temporary values to
17565 avoid having side effects
17567 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
17569 * ecore.cs (Expression.CacheTemporaries): Provide empty default
17572 * expression.cs (Indirection, ArrayAccess): Add support for
17573 CacheTemporaries in these two bad boys.
17575 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
17576 ldobj or ldind_ref.
17577 (StoreFromPtr): Handle stobj as well.
17579 * expression.cs (UnaryMutator): Share more code.
17581 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
17582 down: I was not tracking the Filter function as well, which
17583 was affecting the results of the cache.
17585 2002-05-15 Miguel de Icaza <miguel@ximian.com>
17587 * attribute.cs: Remove the hack to handle the CharSet property on
17590 2002-05-14 Miguel de Icaza <miguel@ximian.com>
17592 * attribute.cs (DoResolve): More uglyness, we now only try to
17593 resolve the attribute partially, to extract the CharSet
17594 information (only if we are a StructLayout attribute). Otherwise
17596 (GetExtraTypeInfo): Add some code to conditionally kill in the
17597 future this. I am more and more convinced that the .NET
17598 framework has special code to handle the attribute setting on
17601 * expression.cs (IsParamsMethodApplicable): Revert my previous
17602 foreach change here, it was wrong.
17604 2002-05-13 Miguel de Icaza <miguel@ximian.com>
17606 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
17607 (pp_expr): do not abort on unknown input, just return.
17608 (eval): abort if there are pending chars.
17610 * attribute.cs (Attribute.Resolve): Positional parameters are
17611 optional. Deal with that case.
17613 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
17614 the Ansi/Unicode/Auto information for the type.
17616 (TypeContainer.DefineType): instantiate the EmitContext here, as
17617 we will be using it during the type definition (to resolve
17618 attributes) and during the emit phase.
17620 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
17621 to pull type information out of the attributes
17623 (Attribute.Resolve): track the constructor builder, and allow for
17624 multiple invocations (structs and classes will use this).
17626 * ecore.cs (MemberLookupFinal): new version with all the
17627 parameters customizable.
17629 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
17630 constructors. Return if the result value is null (as the error
17631 would have been flagged already by MemberLookupFinal)
17633 Do not allow instances of abstract classes or interfaces to be
17636 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
17637 We have to compare the assembly property here when dealing with
17638 FamANDAssem and Assembly access modifiers, because we might be
17639 creating an assembly from *modules* (that means that we are not
17640 getting TypeBuilders for types defined in other modules that are
17641 part of this assembly).
17643 (Method.Emit): If the method is marked abstract and has a body,
17646 (TypeContainer.DefineMembers): If both the defined member and the
17647 parent name match are methods, then do not emit any warnings: let
17648 the Method.Define routine take care of flagging warnings. But if
17649 there is a mismatch (method overrides something else, or method is
17650 overriwritten by something, then emit warning).
17652 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
17653 set to null, this means `do not check for the return type on the
17656 (Method.Define): set the return type for the method signature to
17657 null, so that we get methods with the same name and parameters and
17658 different return types. This is used to flag warning 114 (you are
17659 hiding a method, and you probably want to use the new/override
17662 * typemanager.cs (MemberLookup): Implemented proper access
17663 control, closing a long standing set of bug reports. The problem
17664 was that the Framework only has two bits: Public and NonPublic,
17665 and NonPublic includes private and protected methods, but we need
17666 to enforce the FamANDAssem, FamOrAssem and Family.
17668 2002-05-11 Miguel de Icaza <miguel@ximian.com>
17670 * statement.cs (GotoCase): Return true: Ammounts to giving up
17671 knowledge on whether we return or not, and letting the other case
17672 be responsible for it.
17674 2002-05-10 Miguel de Icaza <miguel@ximian.com>
17676 * driver.cs: Do not load directories for each file processed, only
17677 do it if there is a pattern.
17679 * ecore.cs: Report readonly assigns here as well, as we might have
17680 been resolved only by MemberAccess.
17682 (SimpleName.SimpleNameResolve): Also be useful for LValue
17683 resolution. We need this to propagate assign to local readonly variables
17685 * typemanager.cs: Use a ptrhashtable for the criteria, because we
17686 do not want to reuse potential criteria memory.
17688 * class.cs (MyEventBuilder): Set reflected_type;
17690 * ecore.cs (Constantify): Added support for constifying bools.
17692 (RootContext.LookupType): Added a cache for values looked up in
17693 the declaration space.
17695 * typemanager.cs (FindMembers): Now is a front-end to
17696 RealFindMembers, and provides a two-level hashtable-based cache to
17699 15% performance improvement: from 22.5 to 19.2 seconds.
17701 * expression.cs (IsParamsMethodApplicable): use foreach.
17702 (Invocation.DoResolve): ditto.
17703 (New.DoResolve): ditto.
17704 (ArrayCreation.DoResolve): ditto.
17706 * ecore.cs (FindMostEncompassingType): use foreach.
17708 * delegate.cs (NewDelegate.DoResolve): Use foreach
17710 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
17711 (RemoveMethods): use foreach.
17713 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
17714 nested foreach statements instead of for, and also break out of
17715 the inner loop once a match is found.
17717 (Invocation.OverloadResolve): Use foreach, simplify the code.
17719 2002-05-08 Miguel de Icaza <miguel@ximian.com>
17721 * cfold.cs (BinaryFold): During an enumeration evaluation context,
17722 we actually unwrap the expression to allow for extra information
17725 * expression.cs: Use Shr_Un on unsigned operations.
17727 2002-05-08 Ravi Pratap <ravi@ximian.com>
17729 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
17730 applicable operators was not being considered correctly. This closes
17731 the bug Miguel reported.
17733 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
17735 * attribute.cs: check that the type derives from System.Attribute
17736 and report the correct error in that case (moved the duplicate code to
17737 its own method, too).
17739 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
17741 * attribute.cs: lookup attribute type name as the spec says: first the
17742 bare attribute name and then name + "Attribute" (nant compiles with
17743 mcs after this fix).
17745 2002-05-07 Miguel de Icaza <miguel@ximian.com>
17747 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
17748 Because of the way we parse things, we should try to see if a
17749 UIntConstant can fit in an integer.
17751 2002-05-07 Ravi Pratap <ravi@ximian.com>
17753 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
17754 when we are in an explicit context.
17756 (ConvertReferenceExplicit): When converting from Iface type S to Class
17757 T make sure the rules are implemented as an OR.
17759 * parameter.cs (ParameterType): Make it a property for now although the
17760 purpose really isn't anything immediate.
17762 * expression.cs (Is*Applicable): Do better checking on the parameter type
17763 of a ref/out parameter. The ones from the system assemblies are already
17764 marked with the correct type so we don't need to do any correction.
17766 * ecore.cs (StandardConversionExists): Conversion from Interface types to
17767 the object type is standard too so include that.
17769 2002-05-06 Miguel de Icaza <miguel@ximian.com>
17771 * ecore.cs (StandardConversionExists): Augment with missing code:
17772 deal with IntConstant, LongConstants and Enumerations.
17774 * assign.cs: Report the error, instead of failing silently
17776 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
17777 typecontainer that they are declared, because the
17778 typecontainer/namespace will have the list of using clauses that
17779 need to be applied.
17781 Assembly Attributes were escaping the normal registration
17784 (EmitCode): Apply attributes within an EmitContext that represents
17785 the container they were declared on.
17787 * cs-parser.jay: Track bases for structs. How did I get this wrong?
17789 2002-05-06 Ravi Pratap <ravi@ximian.com>
17791 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
17792 Revamp completely - make much cleaner as we now operate only
17795 (FindMostSpecificSource, FindMostSpecificTarget): New methods
17796 to implement the logic detailed in the spec more correctly.
17798 (UserDefinedConversion): Update accordingly.
17800 2002-05-06 Miguel de Icaza <miguel@ximian.com>
17802 * statement.cs: Return flow analysis information up.
17804 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
17807 (token): Do not consume an extra character before calling
17810 2002-05-06 Piers Haken <piersh@friskit.com>
17812 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
17814 2002-05-06 Miguel de Icaza <miguel@ximian.com>
17816 * class.cs (Constructor.Emit): Set the IsStatic flag in the
17817 EmitContext during the instance constructor initializer
17818 resolution, to stop access to instance variables.
17820 This is mandated by the spec, last paragraph of the `constructor
17821 initializers' section.
17823 2002-05-05 Miguel de Icaza <miguel@ximian.com>
17825 * cs-parser.jay, class.cs (Accessor): new class used to represent
17826 an accessor (get or set). In the past we used `null' to represent
17827 a missing accessor. But this is ambiguous because there was no
17828 way to tell in abstract indexers/properties if one of them was
17831 Now there is a way of addressing that.
17833 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
17834 instead of FindMembers.
17836 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
17837 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
17839 * attribute.cs: Treat indexers and properties as the same in terms
17840 of applying attributes
17842 * ecore.cs (FindMostEncompassedType): Use statically initialized
17843 EmptyExpressions()s like we do elsewhere to avoid creating useless
17844 objects (and we take this out of the tight loop).
17846 (GetConversionOperators): Move the code to extract the actual
17847 operators to a separate routine to clean things up.
17849 2002-05-04 Miguel de Icaza <miguel@ximian.com>
17851 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
17852 events are always registered FieldBuilders.
17854 * class.cs (FieldBase): New class shared by Fields
17856 * delegate.cs: If we are a toplevel delegate, use our full name.
17857 If we are a nested delegate, then only use our tail name.
17859 2002-05-02 Ravi Pratap <ravi@ximian.com>
17861 * expression.cs (IsApplicable): Ensure that we add the "&" to
17862 ref/out types before comparing it with the type of the argument.
17864 (IsParamsMethodApplicable): Ditto.
17866 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
17869 * delegate.cs : Handle the case when we have more than one applicable
17870 method. Flag an error only when we finish checking all.
17872 2002-05-02 Miguel de Icaza <miguel@ximian.com>
17874 * expression.cs: Add support for boolean static initializers.
17876 2002-05-01 Miguel de Icaza <miguel@ximian.com>
17878 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
17880 * parameter.cs (ComputeParameterTypes,
17881 ComputeAndDefineParameterTypes): Better error handling: now we
17882 clear the `types' cache if we fail during any of the type lookups.
17883 We also return the status code correctly to our caller
17885 * delegate.cs: If we fail to define a delegate, abort the extra
17888 * expression.cs (Binary.ResolveOperator): for
17889 operator==(object,object) and operator !=(object, object) we also
17890 have to verify that there is an implicit conversion from one to
17893 (ArrayAccess.DoResolve): Array Access can operate on
17896 2002-04-30 Miguel de Icaza <miguel@ximian.com>
17898 * assign.cs (CompoundAssign): A new class used as a "flag" that
17899 the assignment actually is happening as part of a compound
17900 assignment operator.
17902 During compound assignment, a few new rules exist to enable things
17909 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
17910 to the type of x) if y is implicitly convertible to the type of x,
17911 and the operator is a builtin operator and the return type of the
17912 operator is explicitly convertible to the type of x.
17914 * rootcontext.cs: Reset warning level to 2. 4 catches various
17915 "interesting" features in mcs, we must clean this up at some
17916 point, but currently am trying to kill other bugs ;-)
17918 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
17919 in container classes as well.
17921 * expression.cs (Binary.ResolveOperator): Handle string case
17922 before anything else (as operator overloading does emit an error
17923 before doing anything else).
17925 This code could go away when we move to a table driven model, but
17926 i could not come up with a good plan last night.
17928 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
17930 * typemanager.cs (CSharpName): reimplementation using regex.
17931 * class.cs: added null check for fields in Emit
17932 * rootcontext.cs: set warninglevel to 4
17934 2002-04-29 Miguel de Icaza <miguel@ximian.com>
17936 * typemanager.cs (CSharpName): reimplemented with Lupus
17939 2002-04-28 Miguel de Icaza <miguel@ximian.com>
17941 * statement.cs (If): correclty implement Resolve, because we were
17942 not catching sem errors in there. The same process is needed
17944 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
17947 (Statement.Warning_DeadCodeFound): Factorize code.
17948 (While): Report dead code here too.
17950 (Statement): Added Resolve virtual method to allow
17951 for resolution split from the emit code.
17953 2002-04-26 Miguel de Icaza <miguel@ximian.com>
17955 * statement.cs (EmitBoolExpression): No longer try to resolve the
17957 (MakeBoolean): New utility function that resolve, implicitly
17958 converts to boolean and tags the expression.
17961 (If, Do): Implement dead code elimination.
17962 (While): Implement loop inversion
17964 (Do, While, For, If): Resolve the expression prior to calling our
17967 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
17970 - added method Report28 (warning: program has more than one entry point)
17971 - added method IsEntryPoint, implements paragraph 10.1 of the spec
17972 - modified method Method.Define, the part at the end of the method
17974 * rootcontext.cs: added static public Location EntryPointLocation;
17976 * ../errors/cs0028.cs : Add test case for the above warning.
17979 - modified method CSharpName to allow arrays of primitive type to
17980 be printed nicely (e.g. instead of System.Int32[][] it now prints
17982 - added method CSharpSignature: returns the signature of a method
17983 in string format to be used in reporting errors, warnings, etc.
17985 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
17988 2002-04-26 Ravi Pratap <ravi@ximian.com>
17990 * delegate.cs (Define): Fix extremely silly bug where I was
17991 setting the type of the 'object' parameter of the BeginInvoke
17992 method to System.IAsyncResult instead of System.Object ;-)
17994 2002-04-26 Miguel de Icaza <miguel@ximian.com>
17996 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
17999 (Constructor.Emit): return if we fail to initialize the
18000 constructor. Another door closed!
18002 * expression.cs (New.DoResolve): Improve error message (from -6 to
18003 1501). Use DeclaredOnly lookup to find the exact constructor.
18005 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
18006 loop. This is useful.
18008 * cs-parser.jay: Adjust the default parameters so that destructors
18009 have the proper signature.
18011 2002-04-26 Martin Baulig <martin@gnome.org>
18013 * driver.cs (LoadAssembly): If `assembly' contains any characters
18014 which are only valid in path names and not in assembly names
18015 (currently slash, backslash and point), use Assembly.LoadFrom ()
18016 instead of Assembly.Load () on the `assembly' (before iteration
18017 over the link_paths).
18019 2002-04-26 Martin Baulig <martin@gnome.org>
18021 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
18023 2002-04-25 Miguel de Icaza <miguel@ximian.com>
18025 * class.cs (Property): use the new typemanager.MemberLookup
18027 (TypeContainer.MemberLookup): Implement using the
18028 TypeManager.MemberLookup now.
18030 * typemanager.cs: Make MemberLookup a function of the TypeManager,
18031 and return MemberInfos, so that these can be used without an
18032 EmitContext (what we had before).
18034 2002-04-24 Miguel de Icaza <miguel@ximian.com>
18036 * expression.cs: Fix the case where the argument to params if the
18037 type of the params. I omitted handling this before. Fixed
18039 2002-04-22 Miguel de Icaza <miguel@ximian.com>
18041 * driver.cs: Call BootCorlib_PopulateCoreType
18043 * class.cs (Property.CheckBase): Check for properties only, not
18046 * interface.cs: Temporary hack: try/catch around the
18047 CustomAttributeBuilder, because I am getting an exception that I
18050 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
18051 types whose definitions are required to be there (attributes are
18052 defined before standard types).
18054 Compute definitions as we boot the various types, as they are used
18055 immediately (value_type class will need object_type, but if we do
18056 not initialize object_type, we will pass a null, which will let
18057 the runtime pick the System.Object from the existing corlib, which
18058 is not what we want).
18060 2002-04-22 Patrik Torstensson <totte@labs2.com>
18062 * cs-tokenizer.cs: fixed a number of trim() issues.
18064 2002-04-22 Ravi Pratap <ravi@ximian.com>
18066 * expression.cs (Argument.Type): Ensure that we return the correct
18067 type when we have out or ref parameters [in which case we
18070 2002-04-22 Miguel de Icaza <miguel@ximian.com>
18072 * class.cs (Property, Indexer): Allow extern modifier in there.
18074 * typemanager.cs (InitBaseTypes): Initializes object_type and
18075 value_type, since those will be used early on during the bootstrap
18076 process to compile corlib.
18078 (InitCoreTypes): Move code from here to InitBaseTypes.
18080 2002-04-21 Miguel de Icaza <miguel@ximian.com>
18082 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
18083 single-dimension arrays as using the ldlen opcode.
18085 Daniel Lewis discovered this optimization.
18087 * typemanager.cs: Add signature for System.Array::get_Length
18089 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
18091 * statement.cs: report the error when the foreach does not apply to an
18092 array nor a collection.
18094 2002-04-19 Miguel de Icaza <miguel@ximian.com>
18096 * expression.cs: Add implicit conversions to the operator ~.
18098 * constant.cs (DecimalConstant.Emit): Emit decimal value.
18100 * typemanager.cs: Locate the decimal constructor.
18102 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
18104 * attribute.cs: use the new property of TypeOf.
18105 * expression.cs: added 'get' property around typearg.
18107 These changes fix a build breaker reported by NickD. Is this the
18108 correct way to fix? If not, please, revert my changes and make it
18111 2002-04-17 Miguel de Icaza <miguel@ximian.com>
18113 * attribute.cs: Add support for typeof in attribute invocations.
18114 I am not sure that this is right though.
18116 2002-04-14 Duncan Mak <duncan@ximian.com>
18118 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
18119 Binary.Operator.Division case.
18121 2002-04-13 Ravi Pratap <ravi@ximian.com>
18123 * class.cs (DefineType): Ensure that we do a proper check on
18124 attribute types and also register it with the TypeManager.
18126 (TypeContainer.Targets): The default for attribute types is
18127 AttributeTargets.All.
18129 * attribute.cs (ApplyAttributes): Registering the attribute type
18130 is done elsewhere, not when we discover we have a Usage attribute.
18132 2002-04-12 Ravi Pratap <ravi@ximian.com>
18134 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
18135 and get rid of is_delegate parameter.
18137 * everywhere : update.
18139 2002-04-12 Ravi Pratap <ravi@ximian.com>
18141 * cs-parser.jay (compilation_unit): Revamp completely to use
18142 some new ideas that I got from Rhys' grammar to solve the problems
18143 with assembly level attributes.
18145 (outer_declaration): New grammar production.
18147 (attribute_sections): Add.
18149 (opt_attributes): Base on attribute_sections
18151 (namespace_declaration): Allow opt_attributes to tackle the case
18152 when we have assembly level attributes - we are clever in this
18155 * attribute.cs (ApplyAttributes): Do not worry about assembly
18156 attributes in the non-global context.
18158 * rootcontext.cs (AddGlobalAttributes): Go back to using this
18159 instead of SetGlobalAttributes.
18161 * class.cs, rootcontext.cs : Ensure we define and generate
18162 attribute types before anything else.
18164 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
18165 and flag the new error -20 for the case when the attribute type
18166 does not have valid targets specified. csc does not catch this.
18168 * ../errors/errors.txt : update for error # -20
18170 2002-04-11 Ravi Pratap <ravi@ximian.com>
18172 * support.cs (InternalParameters.ParameterModifier): Do some null
18173 checking and return sane values.
18175 * class.cs (Method.Define): If we are a PInvoke method, ensure
18176 that we are static and extern. Report error # 601
18178 * ../errors/cs0601.cs : Add test case for the above error.
18180 2002-04-07 Ravi Pratap <ravi@ximian.com>
18182 * rootcontext.cs (attribute_types): We need to keep type of
18183 all attribute types separately and emit code for them first.
18185 (RegisterAttribute) : Implement.
18187 * class.cs (DefineType): Check if the current Type is a custom
18188 attribute type and register it accordingly.
18190 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
18191 adding the first attribute twice and rename to
18193 (SetGlobalAttributes): this.
18195 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
18198 * attribute.cs (ApplyAttributes): Take an additional argument telling us
18199 if we are processing global arguments. Hmm, I am unsure of this.
18201 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
18203 * expression.cs: added static array of strings to avoid calling
18204 Enum.ToString () for Operator in Binary. Significant recover of
18207 2002-04-10 Miguel de Icaza <miguel@ximian.com>
18209 * class.cs (FindMembers): Allow the Builders of the various
18210 members to be null. If they are skip them. This only happens
18211 during the PInvoke declaration.
18213 2002-04-09 Miguel de Icaza <miguel@ximian.com>
18215 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
18216 failure, so we do not keep going afterwards.
18218 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
18219 wanted to pass `false' as the `is_delegate' argument. If this is
18220 the case, why not use delegate_type == null to mean `is_delegate =
18221 false' and anything else as is_delegate = true.
18223 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
18225 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
18226 code for the section, not the beginning of the tests.
18228 2002-04-08 Miguel de Icaza <miguel@ximian.com>
18230 * cfold.cs: Handle operator + (Enum x, Underlying x)
18232 * expression.cs (Binary): same. Warn about errors where we have
18233 Enum/Enum in operator + as well.
18235 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
18238 - added support for switch(bool)
18239 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
18240 - add TableSwitchEmit() to handle table-based switch statements
18242 2002-04-05 Ravi Pratap <ravi@ximian.com>
18244 * expression.cs (Invocation.OverloadResolve): Factor out code which
18245 does parameter compatibility checking with arguments so that we can
18246 re-use the code even from Delegate.VerifyApplicability
18248 (VerifyArgumentsCompat): Move above code here.
18250 * delegate.cs (VerifyApplicability): Get rid of duplicate code
18251 and instead make a call to the above method.
18253 2002-03-31 Ravi Pratap <ravi@ximian.com>
18255 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
18256 We use it to keep track of classes which are attribute types.
18258 2002-04-02 Miguel de Icaza <miguel@ximian.com>
18260 * delegate.cs (Delegate.Define): Correctly define the types in the
18261 presence of fixed and array parameters.
18263 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
18266 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
18267 include NonPublic after the first iteration.
18269 * class.cs (Indexer.CheckBase): Only check if both parents are
18272 * cs-parser.jay (accessor_body): If empty, set to null.
18274 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
18275 same code path here to resolve constants names that we did have in
18276 MemberAccess.DoResolve. There is too much code duplicated here.
18278 2002-04-01 Miguel de Icaza <miguel@ximian.com>
18280 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
18282 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
18285 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
18286 tokens, numbers and strings.
18288 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
18291 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
18292 asyncronous parameters and the regular parameters.
18294 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
18295 specify the target directory.
18297 * expression.cs: (This.DoResolve): Simplify
18298 (As.Emit): Optimize, do not generate IsInst if the expression is
18299 always of the given type.
18301 (Is.DoResolve): Bug fix, we were reporting both always/never for
18304 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
18305 creating too many unnecessary arrays.
18307 2002-03-31 Miguel de Icaza <miguel@ximian.com>
18309 * class.cs (EmitFieldInitializer): Use Assign expression to assign
18310 fields instead of rolling our own initializer. Takes care of all
18311 implicit conversions, and drops unnecessary static checks/argument.
18313 2002-03-31 Dick Porter <dick@ximian.com>
18315 * driver.cs: use the GetDirectories() return values properly, and
18316 use "/" as path separator.
18318 2002-03-30 Miguel de Icaza <miguel@ximian.com>
18320 * expression.cs (Unary): Optimize - - expr into expr.
18321 (Binary): Optimize a + (-b) into a -b.
18323 * codegen.cs (CodeGen): Made all methods static.
18325 2002-03-29 Miguel de Icaza <miguel@ximian.com>
18329 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
18330 TypeBuilder property.
18332 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
18335 * tree.cs: Removed the various RecordXXXX, and replaced with a
18336 single RecordDecl. Removed all the accessor methods, and just
18337 left a single access point Type
18339 * enum.cs: Rename DefineEnum to DefineType.
18341 * decl.cs: New abstract method `DefineType' used to unify the
18342 Defines for Enumerations, Interfaces, TypeContainers and
18345 (FindType): Moved LookupInterfaceOrClass here. Moved the
18346 LookupBaseClasses method that used to live in class.cs and
18347 interface.cs here, and renamed to FindType.
18349 * delegate.cs: Implement DefineType. Take advantage of the
18350 refactored pattern for locating the parent builder without taking
18351 the parent_builder argument (which we know does not work if we are
18352 nested, and triggering a toplevel definition).
18354 2002-03-28 Miguel de Icaza <miguel@ximian.com>
18356 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
18357 accessibility of a member has changed during override and report
18360 * class.cs (Method.Define, Property.Define): Only complain on
18361 overrides if the method is private, any other accessibility is
18362 fine (and since we just checked the permission is the same, we are
18365 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
18366 and elif are processed always. The other pre-processing
18367 directives are only processed if we are "taking" the path
18369 2002-03-29 Martin Baulig <martin@gnome.org>
18371 * class.cs (Method.Emit): Only emit symbolic debugging info if the
18372 current location is not Null.
18374 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
18375 a separate method so we can profile it.
18377 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
18378 `span.Seconds' are just seconds, but no minutes or hours.
18379 (MainDriver): Profile the CodeGen.SaveSymbols calls.
18381 2002-03-28 Miguel de Icaza <miguel@ximian.com>
18383 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
18384 Remove the gratuitous set of Final:
18386 // If an interface implementation, then we can set Final.
18387 if (((flags & MethodAttributes.Abstract) == 0) &&
18388 implementing.DeclaringType.IsInterface)
18389 flags |= MethodAttributes.Final;
18391 I do not know what I was smoking when I used that.
18394 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
18395 step into fixing the name resolution issues for delegates and
18396 unifying the toplevel name resolution.
18398 2002-03-28 Martin Baulig <martin@gnome.org>
18400 * class.cs (Method.Emit): If we have a symbol writer, call its
18401 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
18402 tell it about the current method.
18404 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
18405 writer that we're going to emit the first byte of IL code for a new
18406 statement (a new source line).
18407 (EmitContext.EmitTopBlock): If we have a symbol writer, call
18408 EmitContext.Mark() before emitting any code.
18410 * location.cs (SymbolDocument): Return null when we're Null.
18412 * statement.cs (Statement): Moved the `Location loc' variable here.
18413 (Statement.EmitBoolExpression): If we have a symbol writer, call
18414 ec.Mark() before emitting any code to tell it that we're at the
18415 beginning of a new statement.
18416 (StatementExpression): Added `Location' argument to the constructor.
18417 (Block): Added public readonly variable `StartLocation' and public
18418 variable `EndLocation'. The latter is to be set using SetEndLocation().
18419 (Block): Added constructor which takes a start and end location.
18420 (Block.SetEndLocation): New method. This sets the end location.
18421 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
18422 local variables we create.
18423 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
18424 each statement and do also mark the begin and end of the block.
18426 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
18427 tell it the current lexer.Location, use Location.Null for the end of the
18429 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
18430 current block, set its end location using SetEndLocation().
18431 (statement_expression): StatementExpression constructor now takes the
18432 lexer.Location as additional argument.
18433 (for_statement, declare_local_variables): Likewise.
18434 (declare_local_variables): When creating a new implicit block, use the
18435 new Block constructor and pass it the lexer.Location.
18437 2002-03-28 Miguel de Icaza <miguel@ximian.com>
18439 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
18440 members also on the parent interfaces recursively.
18442 2002-03-27 Miguel de Icaza <miguel@ximian.com>
18444 * report.cs: Use new formats, since Gonzalo finished the missing
18447 * expression.cs (Binary.ResolveOperator): added missing operator|
18448 operator& and operator^ for bool/bool.
18450 * cs-parser.jay: CheckDef now takes a Location argument that is
18451 used to report errors more precisly (instead of reporting the end
18452 of a definition, we try to track something which is a lot closer
18453 to the source of the problem).
18455 * cs-tokenizer.cs: Track global token use, so we can properly flag
18456 the use of #define/#undef after the first token has been seen.
18458 Also, rename the reportXXXX to Error_DescriptiveName
18460 * decl.cs (DeclSpace.IsTopLevel): Move property here from
18461 TypeContainer, so that Enum and Interface can use this too.
18463 * class.cs (TypeContainer.LookupInterfaceOrClass,
18464 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
18465 `builder' argument. Typically this was used to pass the parent
18466 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
18469 The problem is that a nested class could trigger the definition of
18470 a toplevel class, and the builder would be obviously wrong in that
18473 So we drop this argument, and we compute dynamically the
18474 TypeBuilder/ModuleBuilder (the correct information was available
18475 to us anyways from DeclSpace.Parent)
18477 * interface.cs (Interface.DefineInterface): Drop builder
18478 parameter cleanup like class.cs
18480 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
18483 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
18486 (Try.Emit): Propagate the returns value from the statement.
18488 (Return.Emit): Even if we are leavning
18490 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
18492 * modifiers.cs: Fix the computation of MethodAttributes flags.
18494 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
18496 * driver.cs: allow compilation of files that start with '/'.
18497 Add a default case when checking the argument of --target.
18499 2002-03-25 Miguel de Icaza <miguel@ximian.com>
18501 * interface.cs: Implement the same search algorithm for types in
18502 the interface code.
18504 * delegate.cs: Do not allow multiple definition.
18506 * Recovered ChangeLog that got accidentally amputated
18508 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
18510 * rootcontext.cs: Load manually enum to allow core classes to
18511 contain enumerations.
18513 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
18514 Update to new static methods in TypeManager.
18516 * typemanager.cs (GetMethod, GetConstructor): Use our
18517 implementation of FindMembers to find the members, since during
18518 corlib compilation, the types are TypeBuilders and GetMethod and
18519 GetConstructor do not work.
18521 Make all methods in TypeManager static.
18523 (InitCodeHelpers): Split the functionality from
18524 the InitCodeTypes function.
18526 * driver.cs: Call InitCodeHelpers after we have populated the
18529 * cs-parser.jay (delegate_declaration): we did not used to compute
18530 the delegate name correctly for void delegates.
18532 2002-03-24 Miguel de Icaza <miguel@ximian.com>
18534 * rootcontext.cs (RootContext): Init the interface_resolve_order
18535 and type_container_resolve_order always.
18537 (ResolveCore, BootstrapCorlib_ResolveClass,
18538 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
18539 compiler when compiling with --nostdlib
18541 * class.cs (TypeContainer.DefineType): Check that our parent is
18542 not null. This test is most important when we are bootstraping
18545 * codegen.cs: Split out the symbol writing code.
18547 2002-03-25 Martin Baulig <martin@gnome.org>
18549 * driver.cs (-g): Made -g an alias for --debug.
18551 2002-03-24 Martin Baulig <martin@gnome.org>
18553 * codegen.cs (SymbolWriter): New public variable. Returns the
18554 current symbol writer.
18555 (CodeGen): Added `bool want_debugging_support' argument to the
18556 constructor. If true, tell the ModuleBuild that we want debugging
18557 support and ask it for the ISymbolWriter.
18558 (Save): If we have a symbol writer, call it's Close() method after
18559 saving the assembly.
18561 * driver.c (--debug): New command line argument to create a
18562 debugger information file.
18564 * location.cs (SymbolDocument): New public property. Returns an
18565 ISymbolDocumentWriter object for the current source file or null
18566 if we don't have a symbol writer.
18568 2002-03-21 Miguel de Icaza <miguel@ximian.com>
18570 * driver.cs (LoadAssembly): Correctly return when all the paths
18571 have been tried and not before.
18573 * statement.cs (Switch.Emit): return the actual coverage for this
18574 statement (returns/not-returns)
18576 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
18577 switch of the statement if we are the last switch section. That
18578 kills two problems: try/catch problems (we used to emit an empty
18579 nop at the end) and switch statements where all branches would
18582 2002-03-19 Miguel de Icaza <miguel@ximian.com>
18584 * driver.cs: Add default assemblies (the equivalent to the
18585 Microsoft CSC.RSP file)
18587 * cs-tokenizer.cs: When updating `cols and setting it to zero,
18588 also update tokens_seen and set it to false.
18590 * driver.cs: Implement --recurse for Mike.
18592 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
18593 correctly splitting out the paths.
18595 2002-03-18 Miguel de Icaza <miguel@ximian.com>
18597 * interface.cs (Interface.PopulateProperty): Instead of using
18598 `parent' as the declaration space for the set parameters, use
18601 * support.cs (InternalParameters): InternalParameters constructor
18602 takes a DeclSpace instead of a TypeContainer.
18604 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
18605 types are being initialized, load the address of it before calling
18608 (New): Provide a mechanism to disable the generation of local
18609 value type temporaries when the caller will be providing us with
18610 an address to store it.
18612 (ArrayCreation.EmitDynamicInitializers): Use it.
18614 2002-03-17 Miguel de Icaza <miguel@ximian.com>
18616 * expression.cs (Invocation.EmitArguments): Only probe for array
18617 property if there is more than one argument. Sorry about that.
18619 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
18620 empty param arrays.
18622 * class.cs (Method.LabelParameters): Fix incorrect code path that
18623 prevented the `ParamArrayAttribute' from being applied to the
18626 2002-03-16 Miguel de Icaza <miguel@ximian.com>
18628 * support.cs (ReflectionParameters): Correctly compute whether the
18629 last argument is a params array. Fixes the problem with
18632 * typemanager.cs: Make the assemblies array always be non-null
18633 (empty, but non-null)
18635 * tree.cs (RecordDecl): New function that abstracts the recording
18636 of names. This reports error 101, and provides a pointer to the
18637 previous declaration. Fixes a crash in the compiler.
18639 * cs-parser.jay (constructor_declaration): Update to new grammar,
18640 and provide a constructor_body that can be empty.
18642 2002-03-15 Miguel de Icaza <miguel@ximian.com>
18644 * driver.cs: Add support for --resources.
18646 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
18647 Make all types for the various array helper methods be integer.
18649 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
18650 CheckState to ConvCast.
18652 (ConvCast): Now it takes a `checked' state argument, to avoid
18653 depending on the emit context for the conversion, and just using
18654 the resolve time setting.
18656 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
18657 instead of Invocation.EmitArguments. We do not emit the original
18658 arguments, instead we emit those which have been converted to
18659 unsigned int expressions.
18661 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
18663 * codegen.cs: ditto.
18665 * expression.cs (LocalVariableReference): Drop the use of the
18666 Store function that depended on the variable index.
18668 * statement.cs (VariableInfo): Drop the `Idx' property from this
18669 class, as this is not taking into account the indexes for
18670 temporaries tat we generate during the execution, getting the
18673 * class.cs: First emit class initializers, then call the parent
18676 * expression.cs (Binary): Fix opcode emision.
18677 (UnaryMutator.EmitCode): Support checked code generation
18679 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
18680 matches for events for both the Static and Instance scans,
18681 pointing to the same element. Fix that.
18683 2002-03-14 Miguel de Icaza <miguel@ximian.com>
18685 * rootcontext.cs (ResolveTree): Always set the
18686 interface_resolve_order, because nested interfaces will be calling
18689 * class.cs (GetInterfaceOrClass): Track the same resolution
18690 process used by TypeManager.LookupType. This fixes the nested
18691 type lookups in class declarations (separate path from
18694 (TypeContainer.DefineType): Also define nested interfaces.
18695 (TypeContainer.RegisterOrder): New public function used to
18696 register the order in which child interfaces need to be closed.
18698 Nested interfaces need to be closed after their parents have been
18701 * interface.cs (InterfaceAttr): Put all the logic for computing
18702 the interface attribute here.
18704 (DefineInterface): Register our interface order with the
18705 RootContext or with the TypeContainer depending on the case.
18707 2002-03-12 Miguel de Icaza <miguel@ximian.com>
18709 * cs-parser.jay: rework foreach statement to work with the new
18710 changes to the policy on SimpleNames.
18712 * report.cs: support Stacktrace on warnings as well.
18714 * makefile: drop --unsafe and /unsafe from the compile.
18716 2002-03-13 Ravi Pratap <ravi@ximian.com>
18718 * ecore.cs (StandardConversionExists): Modify to take an Expression
18719 as the first parameter. Ensure we do null -> reference type conversion
18722 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
18723 temporary Expression objects.
18725 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
18727 * interface.cs: workaround bug in method overloading resolution
18728 (there is already a bugzilla bug for it).
18730 2002-03-12 Miguel de Icaza <miguel@ximian.com>
18732 We could also solve this problem by having a separate path for
18733 performing type lookups, instead of DoResolve, we could have a
18734 ResolveType entry point, and only participating pieces of the
18735 production (simplename, deref, array) would implement this.
18737 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
18738 signal SimpleName to only resolve type names and not attempt to
18739 resolve anything else.
18741 * expression.cs (Cast): Set the flag.
18743 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
18745 * class.cs: Only report 108 if there is no `new' modifier.
18747 * cs-parser.jay: rework foreach statement to work with the new
18748 changes to the policy on SimpleNames.
18750 * report.cs: support Stacktrace on warnings as well.
18752 * makefile: drop --unsafe and /unsafe from the compile.
18754 2002-03-11 Miguel de Icaza <miguel@ximian.com>
18756 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
18757 lookups here, instead of doing that at parse time. This means
18758 that our grammar will not introduce `LocalVariableReferences' as
18759 expressions at this point. That solves the problem of code like
18763 static void Main ()
18767 This is only half the fix. The full fix requires parameters to
18768 also be handled in this way.
18770 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
18771 makes the use more obvious of the DeclSpace. The
18772 ec.TypeContainer.TypeBuilder is now only used to pull the
18773 TypeBuilder for it.
18775 My theory is that I can get rid of the TypeBuilder completely from
18776 the EmitContext, and have typecasts where it is used (from
18777 DeclSpace to where it matters).
18779 The only pending problem is that the code that implements Aliases
18780 is on TypeContainer, and probably should go in DeclSpace.
18782 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
18783 lookups here, instead of doing that at parse time. This means
18784 that our grammar will not introduce `LocalVariableReferences' as
18785 expressions at this point. That solves the problem of code like
18789 static void Main ()
18793 This is only half the fix. The full fix requires parameters to
18794 also be handled in this way.
18796 * class.cs (Property.DefineMethod): When implementing an interface
18797 method, set newslot, when implementing an abstract method, do not
18798 set the flag (before we tried never setting it, or always setting
18799 it, which is the difference).
18800 (Indexer.DefineMethod): same.
18801 (Method.DefineMethod): same.
18803 * ecore.cs: Only set the status used flag if we get back a Field.
18805 * attribute.cs: Temporary hack, so Paolo can keep working.
18807 2002-03-08 Ravi Pratap <ravi@ximian.com>
18809 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
18810 the unmanaged type in the case we have a MarshalAs attribute.
18812 (Resolve): Handle the case when we are parsing the special MarshalAs
18813 attribute [we need to store the unmanaged type to use later]
18815 * typemanager.cs (marshal_as_attr_type): Built in type for the
18816 MarshalAs Attribute.
18818 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
18819 on parameters and accordingly set the marshalling info.
18821 2002-03-09 Miguel de Icaza <miguel@ximian.com>
18823 * class.cs: Optimizing slightly by removing redundant code after
18824 we switched to the `NoTypes' return value.
18825 (Property.DefineMethod): use NoTypes here too.
18827 This fixes the bug I introduced in my last batch of changes.
18829 2002-03-05 Ravi Pratap <ravi@ximian.com>
18831 * tree.cs (RecordEnum): Add. We now keep track of enums too.
18833 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
18834 Enums since those are types too.
18836 * cs-parser.jay (enum_declaration): Record enums as we parse them.
18838 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
18839 thanks to a call during the lookup process.
18841 2002-03-07 Miguel de Icaza <miguel@ximian.com>
18843 * statement.cs (Foreach): Lots of work to accomodate a particular
18844 kind of foreach statement that I had not kept in mind. It is
18845 possible to have foreachs on classes that provide a GetEnumerator
18846 method that return objects that implement the "pattern" for using
18847 a foreach, there is no need to support GetEnumerator
18850 This is needed to compile nant.
18852 * decl.cs: Only report 114 if the member is not `Finalize' and if
18853 the warning level is at least 2.
18855 * class.cs: Moved the compare function from Method to
18858 (MethodSignature.InheritableMemberSignatureCompare): Add new
18859 filter function that is used to extract inheritable methods from a
18862 (Method.Define): Use the new `inheritable_method_signature_filter'
18865 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
18868 2002-03-06 Miguel de Icaza <miguel@ximian.com>
18870 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
18872 * cs-parser.jay: Add opt_semicolon to the interface declaration.
18874 * expression.cs: Pass location information to
18875 ConvertImplicitStandard.
18877 * class.cs: Added debugging code to track return values from
18880 2002-03-05 Miguel de Icaza <miguel@ximian.com>
18882 * expression.cs (Is.DoResolve): If either side of the `is' is an
18883 interface, do not flag the warning.
18885 * ecore.cs (ImplicitReferenceConversion): We need a separate test
18888 * report.cs: Allow for --fatal to be used with --probe.
18890 * typemanager.cs (NoTypes): Move the definition for the empty Type
18893 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
18895 (TypeContainer.DefineProxy): New function used to proxy to parent
18896 implementations when implementing interfaces.
18897 (TypeContainer.ParentImplements): used to lookup if our parent
18898 implements a public function that is required by an interface.
18899 (TypeContainer.VerifyPendingMethods): Hook this up.
18901 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
18902 `modules' and `assemblies' arraylists into arrays. We only grow
18903 these are the very early start up of the program, so this improves
18904 the speedof LookupType (nicely measured).
18906 * expression.cs (MakeByteBlob): Replaced unsafe code with
18907 BitConverter, as suggested by Paolo.
18909 * cfold.cs (ConstantFold.Binary): Special case: perform constant
18910 folding of string concatenation, but if either side is a string,
18911 and the other is not, then return null, and let the runtime use
18912 the concatenation on the string plus the object (using
18913 `Object.ToString').
18915 2002-03-04 Miguel de Icaza <miguel@ximian.com>
18917 Constant Folding has been implemented now.
18919 * expression.cs (Unary.Reduce): Do not throw an exception, catch
18920 the error instead on types that are not supported in one's
18923 * constant.cs (Constant and all children): New set of functions to
18924 perform implict and explicit conversions.
18926 * ecore.cs (EnumConstant): Implement the new functions to perform
18927 conversion by proxying to the child expression.
18929 * codegen.cs: (ConstantCheckState): Constant evaluation has its
18930 own separate setting that can not be turned off from the command
18931 line using --unchecked or --checked and is only controlled using
18932 the checked/unchecked statements and expressions. This setting is
18933 used by the constant folder to flag errors.
18935 * expression.cs (CheckedExpr, UncheckedExpr): Set the
18936 ConstantCheckState as well.
18938 During Resolve, they also have to flag the state, because the
18939 constant folder runs completely in the Resolve phase.
18941 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
18944 2002-03-01 Miguel de Icaza <miguel@ximian.com>
18946 * cfold.cs: New file, this file contains the constant folder.
18948 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
18949 argument to track whether we are using the resulting address to
18950 load or store a value and provide better error messages.
18952 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
18953 new AddressOf arguments.
18955 * statement.cs (Foreach.EmitCollectionForeach): Update
18957 * expression.cs (Argument.Emit): Call AddressOf with proper
18958 arguments to track usage.
18960 (New.DoEmit): Call AddressOf with new arguments.
18962 (Unary.Emit): Adjust AddressOf call.
18964 2002-03-01 Ravi Pratap <ravi@ximian.com>
18966 * cs-parser.jay (member_access): Change the case for pre-defined types
18967 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
18970 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
18973 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
18974 essentially like methods and apply attributes like MethodImplOptions to them too.
18976 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
18979 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
18980 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
18983 * Update code everywhere accordingly.
18985 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
18987 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
18989 2002-02-28 Ravi Pratap <ravi@ximian.com>
18991 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
18992 try performing lookups against those instead of jumping straight into using
18993 the 'using' clauses.
18995 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
18997 (LookupType): Perform lookups in implicit parents too.
18999 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
19000 sequence as RootContext.LookupType.
19002 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
19003 the various cases of namespace lookups into this method.
19005 2002-03-01 Miguel de Icaza <miguel@ximian.com>
19007 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
19008 in positional arguments)
19010 * class.cs (Operator): Update the AllowedModifiers to contain
19013 * cs-parser.jay: Update operator declaration to allow for the
19014 operator body to be empty.
19016 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
19019 2002-02-27 Miguel de Icaza <miguel@ximian.com>
19021 * class.cs (Method.Emit): Label parameters.
19023 * driver.cs: Return 1 or 0 as the program exit code.
19025 2002-02-26 Miguel de Icaza <miguel@ximian.com>
19027 * expression.cs: Special case the `null' object when trying to
19028 auto-compute the type, as anything can be explicitly converted to
19031 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
19032 spotting this Paolo.
19034 (Expression.ImplicitNumericConversion): Perform comparissions of
19035 the type using the underlying type in the case of an enumeration
19036 rather than using the enumeration type for the compare.
19038 Cope with the underlying == type case, which is not possible to
19041 (Expression.ConvertNumericExplicit): Perform comparissions of
19042 the type using the underlying type in the case of an enumeration
19043 rather than using the enumeration type for the compare.
19045 * driver.cs: If the user does not supply an extension, assume .exe
19047 * cs-parser.jay (if_statement): Rewrote so that we can track the
19048 location for the if statement.
19050 * expression.cs (Binary.ConstantFold): Only concat strings when
19051 the operation is "+", not everything ;-)
19053 * statement.cs (Statement.EmitBoolExpression): Take a location
19055 (If, While, Do): Track location.
19057 * expression.cs (Binary.ResolveOperator): In the object + string
19058 case, I was missing a call to ConvertImplicit
19060 2002-02-25 Ravi Pratap <ravi@ximian.com>
19062 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
19063 Location arguments. Ensure we use RootContext.LookupType to do our work
19064 and not try to do a direct Type.GetType and ModuleBuilder.GetType
19066 * interface.cs (PopulateMethod): Handle the type of the parameter being
19069 * expression.cs (Invocation.BetterFunction): Handle the case when we
19070 have a params method with no fixed arguments and a call is made with no
19073 2002-02-25 Miguel de Icaza <miguel@ximian.com>
19075 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
19076 the verbatim-string-literal
19078 * support.cs (InternalParameters.ParameterModifier): handle null
19080 (InternalParameters.ParameterType): ditto.
19082 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
19083 duplicating the name of the variable parameter.
19084 (GetParameterByName): Fix bug where we were not looking up array
19085 paramters if they were the only present (thanks Paolo!).
19086 (GetParameterInfo): We only have an empty set of types if both
19087 fixed and array are set to null.
19088 (GetParameterInfo-idx): Handle FixedParameter == null
19090 * cs-parser.jay: Handle the case where there is no catch
19091 statements (missing null test).
19093 2002-02-22 Miguel de Icaza <miguel@ximian.com>
19095 * driver.cs (MainDriver): Be conservative on our command line
19098 Catch DirectoryNotFoundException when calling GetFiles.
19100 (SplitPathAndPattern): Used to split the input specification into
19101 a path and a pattern that we can feed to Directory.GetFiles.
19103 2002-02-21 Miguel de Icaza <miguel@ximian.com>
19105 * statement.cs (Fixed): Implement the last case of the Fixed
19106 statement (string handling).
19108 * expression.cs (StringPtr): New class used to return a char * to
19109 a string; Used by the Fixed statement.
19111 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
19113 * expression.cs (Binary.ResolveOperator): Remove redundant
19114 MemberLookup pn parent type.
19115 Optimize union call, we do not need a union if the types are the same.
19116 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
19119 Specialize the use of MemberLookup everywhere, instead of using
19120 the default settings.
19122 (StackAlloc): Implement stackalloc keyword.
19124 * cs-parser.jay: Add rule to parse stackalloc.
19126 * driver.cs: Handle /h, /help, /?
19128 * expression.cs (MakeByteBlob): Removed the hacks we had in place
19129 before we supported unsafe code.
19131 * makefile: add --unsafe to the self compilation of mcs.
19133 2002-02-20 Miguel de Icaza <miguel@ximian.com>
19135 * expression.cs (PointerArithmetic): New class that is used to
19136 perform pointer arithmetic.
19137 (Binary.Resolve): Handle pointer arithmetic
19138 Handle pointer comparission.
19139 (ArrayPtr): Utility expression class that is used to take the
19140 address of an array.
19142 (ElementAccess): Implement array access for pointers
19144 * statement.cs (Fixed): Implement fixed statement for arrays, we
19145 are missing one more case before we are done.
19147 * expression.cs (Indirection): Implement EmitAssign and set the
19148 ExprClass to Variable. This allows pointer dereferences to be
19149 treated as variables, and to have values assigned to them.
19151 * ecore.cs (Expression.StoreFromPtr): New utility function to
19152 store values dereferencing.
19154 2002-02-20 Ravi Pratap <ravi@ximian.com>
19156 * expression.cs (Binary.ResolveOperator): Ensure that we are
19157 not trying to operate on a void type - this fixes the reported
19160 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
19161 the parent implementation is sealed.
19163 * ../errors/cs0239.cs : Add.
19165 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
19167 * typemanager.cs (unverifiable_code_type): Corresponds to
19168 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
19169 which have unsafe code in them.
19171 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
19174 2002-02-19 Miguel de Icaza <miguel@ximian.com>
19176 * cs-tokenizer.cs: Add support for @"litreal strings"
19178 Make tokenizer accept pre-processor directives
19179 on any column (remove the old C-like limitation).
19181 * rootcontext.cs (EmitCode): Emit any global attributes.
19182 (AddGlobalAttributes): Used to keep track of assembly attributes.
19184 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
19186 * cs-parser.jay: Add support for global attributes.
19188 2002-02-17 Miguel de Icaza <miguel@ximian.com>
19190 * expression.cs (Indirection): New helper class. Unary will
19191 create Indirection classes to be able to implement the
19192 IMemoryLocation interface on it.
19194 2002-02-16 Miguel de Icaza <miguel@ximian.com>
19196 * cs-parser.jay (fixed_statement): reference the right statement.
19198 * statement.cs (Fixed.Emit): Finish implementing the fixed
19199 statement for the &x case.
19201 2002-02-14 Miguel de Icaza <miguel@ximian.com>
19203 * class.cs (Property.Define, Method.Define): Remove newslot when
19206 * modifiers.cs: My use of NewSlot when `Abstract' was set was
19207 wrong. NewSlot should only be used if the `new' keyword is present.
19209 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
19210 locating our system dir. Sorry about this.
19212 2002-02-13 Miguel de Icaza <miguel@ximian.com>
19214 * driver.cs (GetSystemDir): Compute correctly the location of our
19215 system assemblies. I was using the compiler directory instead of
19216 the library directory.
19218 2002-02-13 Ravi Pratap <ravi@ximian.com>
19220 * expression.cs (BetterFunction): Put back in what Miguel commented out
19221 since it is the correct fix. The problem is elsewhere ;-)
19223 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
19224 parameters of the parms method are themselves compatible or not !
19226 (StandardConversionExists): Fix very dangerous bug where we were forgetting
19227 to check that a class implements an interface before saying that an implicit
19228 conversion was allowed. Use ImplementsInterface to do the checking.
19230 2002-02-13 Miguel de Icaza <miguel@ximian.com>
19232 * class.cs (Method.Define): Track whether we are an explicit
19233 implementation or not. And only call DefineMethodOverride if we
19234 are an explicit implementation.
19236 (Property.DefineMethod): Ditto.
19238 2002-02-11 Ravi Pratap <ravi@ximian.com>
19240 * expression.cs (BetterFunction): Catch hideous bug which was
19241 preventing us from detecting ambiguous calls due to implicit casts i.e
19244 2002-01-29 Miguel de Icaza <miguel@ximian.com>
19246 * support.cs (Pair): Remove un-needed method. I figured why I was
19247 getting the error in cs-parser.jay, the variable in a foreach loop
19248 is readonly, and the compiler does not really treat this as a variable.
19250 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
19251 instead of EQUALS in grammar.
19253 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
19255 * expression.cs (Unary.DoResolve): Check whether the argument is
19258 2002-01-28 Miguel de Icaza <miguel@ximian.com>
19260 * support.cs: Api for Pair to set a value. Despite the fact that
19261 the variables are public the MS C# compiler refuses to compile
19262 code that accesses the field if the variable is part of a foreach
19265 * statement.cs (Fixed): Begin implementation of the fixed
19268 (Block.AddVariable): Return the VariableInfo on success and null
19269 on failure instead of true/false.
19271 * cs-parser.jay (foreach): Catch errors on variables already
19272 defined (we were ignoring this value before) and properly unwind
19273 the block hierarchy
19275 (fixed_statement): grammar for the fixed statement.
19277 2002-01-25 Miguel de Icaza <miguel@ximian.com>
19279 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
19280 pointer types to be incretemented.
19282 (SizeOf): Implement.
19284 * cs-parser.jay (pointer_member_access): Implement
19285 expr->IDENTIFIER production.
19287 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
19288 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
19291 (Unary): Implement indirection.
19293 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
19294 use in non-unsafe context).
19296 (SimpleName.DoResolve): Check for pointers in field access on safe
19299 (Expression.LoadFromPtr): Factor the load-indirect code in this
19300 function. This was duplicated in UnboxCast and ParameterReference
19302 2002-01-24 Miguel de Icaza <miguel@ximian.com>
19304 * expression.cs (ComposedCast): report an error if a pointer cast
19305 is used in a safe region.
19307 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
19308 pointer type casts in unsafe context.
19310 * codegen.cs (EmitContext): Set up IsUnsafe.
19312 * cs-parser.jay (non_expression_type): Add productions for pointer
19315 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
19316 code. We should not use force into static mode if the method is
19317 not virtual. Fixes bug in MIS
19319 * statement.cs (Do.Emit, While.Emit, For.Emit,
19320 Statement.EmitBoolExpression): Add support to Do and While to
19321 propagate infinite loop as `I do return' semantics.
19323 Improve the For case to also test for boolean constants.
19325 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
19326 to the list of attributes we can add.
19328 Remove `EmitContext' argument.
19330 * class.cs (Method.Define): Apply parameter attributes.
19331 (Constructor.Define): Apply parameter attributes.
19332 (MethodCore.LabelParameters): Move here the core of labeling
19335 * support.cs (ReflectionParameters.ParameterModifier,
19336 InternalParameters.ParameterModifier): Use IsByRef on the type and
19337 only return the OUT bit for these parameters instead of in/out/ref
19340 This is because I miss-understood things. The ParameterInfo.IsIn
19341 and IsOut represent whether the parameter has the [In] and [Out]
19344 2002-01-22 Miguel de Icaza <miguel@ximian.com>
19346 * ecore.cs (FieldExpr.Emit): Release temporaries.
19348 * assign.cs (LocalTemporary.Release): new function.
19350 * codegen.cs (EmitContext.GetTemporaryStorage,
19351 EmitContext.FreeTemporaryStorage): Rework the way we deal with
19352 temporary storage. Now we can "put back" localbuilders when we
19355 2002-01-21 Miguel de Icaza <miguel@ximian.com>
19357 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
19358 need to make a copy of the variable to generate verifiable code.
19360 2002-01-19 Miguel de Icaza <miguel@ximian.com>
19362 * driver.cs: Compute dynamically the system directory.
19364 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
19365 Slower, but more generally useful. Used by the abstract
19366 registering implementation.
19368 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
19369 the rules for the special rule on Type/instances. First check if
19370 we have the same name, and if so, try that special static path
19371 rather than the instance path.
19373 2002-01-18 Miguel de Icaza <miguel@ximian.com>
19375 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
19378 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
19379 Enum, ValueType, Delegate or Array for non-corlib compiles.
19381 * cs-tokenizer.cs: Catch long identifiers (645)
19383 * typemanager.cs (IndexerPropetyName): Ravi never tested this
19386 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
19387 fix, we were returning too early, so we were not registering
19388 pending methods from abstract classes.
19390 Do not register pending methods if the class is abstract.
19392 * expression.cs (Conditional.DoResolve): Report circular implicit
19393 conversions when we neecd to compute it for conditional
19396 (Is.DoResolve): If the expression is always of the provided type,
19397 flag warning 183. If the expression can not ever be of the
19398 provided type flag warning 184.
19400 * class.cs: Catch 169 as well.
19402 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
19405 2002-01-18 Nick Drochak <ndrochak@gol.com>
19407 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
19409 2002-01-17 Miguel de Icaza <miguel@ximian.com>
19411 * interface.cs: (PopulateMethod): Check for pointers being defined
19412 only if the unsafe context is active.
19413 (PopulateProperty): ditto.
19414 (PopulateIndexer): ditto.
19416 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
19417 specified. If pointers are present, make sure that they are
19418 present in an unsafe context.
19419 (Constructor, Constructor.Define): ditto.
19420 (Field, Field.Define): ditto.
19421 (Property, Property.Define): ditto.
19422 (Event, Event.Define): ditto.
19424 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
19425 hashtable if there are classes or structs defined.
19427 * expression.cs (LocalVariableReference.DoResolve): Simplify this
19428 code, as the constant resolution moved.
19430 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
19431 the metadata, so we can flag error 133.
19433 * decl.cs (MemberCore.UnsafeOK): New function to test that a
19434 pointer is being declared in an unsafe context.
19436 2002-01-16 Miguel de Icaza <miguel@ximian.com>
19438 * modifiers.cs (Modifiers.Check): Require a Location argument.
19439 Report error 227 for Unsafe use.
19441 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
19443 * statement.cs (For.Emit): If the test is null, then report that
19444 we do `return', as we wont reach anything afterwards.
19446 (Switch.SwitchGoverningType): Track the expression that matched
19449 * driver.cs: Allow negative numbers as an error code to flag.
19451 * cs-parser.jay: Handle 1551.
19453 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
19455 2002-01-15 Miguel de Icaza <miguel@ximian.com>
19457 * cs-parser.jay: Report 1518 (type declaration can only contain
19458 class, struct, interface, enum or delegate)
19460 (switch_label): Report 1523 (keywords `case' or `default' must
19463 (opt_switch_sections): Report 1522 (empty switch)
19465 * driver.cs: Report 1515 (response file specified multiple times)
19466 Report 1516 (Source file specified multiple times).
19468 * expression.cs (Argument.Resolve): Signal 1510
19470 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
19471 access not allowed in static code)
19473 2002-01-11 Ravi Pratap <ravi@ximian.com>
19475 * typemanager.cs (IsPointerType): Utility method which we are going
19478 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
19479 the object type, so we take care of that.
19481 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
19483 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
19484 added to non-params parameters :-)
19486 * typemanager.cs (CSharpName): Include 'void' type too.
19488 (void_ptr_type): Include in the set of core types.
19490 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
19493 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
19496 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
19497 completely forgotten about it.
19499 2002-01-10 Ravi Pratap <ravi@ximian.com>
19501 * cs-parser.jay (pointer_type): Add. This begins our implementation
19502 of parsing rules for unsafe code.
19504 (unsafe_statement): Implement.
19506 (embedded_statement): Modify to include the above.
19508 * statement.cs (Unsafe): Implement new class for unsafe blocks.
19510 * codegen.cs (EmitContext.InUnsafe): Add. This determines
19511 if the current context is an unsafe one.
19513 * cs-parser.jay (local_variable_pointer_type): Since local variable types
19514 are handled differently, we need separate rules for them.
19516 (local_variable_declaration): Update to use local_variable_pointer_type
19517 to allow variable declarations of unmanaged pointer types.
19519 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
19520 in unsafe contexts.
19522 * ../errors/cs0214.cs : Add.
19524 2002-01-16 Nick Drochak <ndrochak@gol.com>
19526 * makefile: remove 'response' file when cleaning.
19528 2002-01-15 Miguel de Icaza <miguel@ximian.com>
19530 * cs-parser.jay: Report 1524.
19532 2002-01-14 Miguel de Icaza <miguel@ximian.com>
19534 * typemanager.cs (RegisterMethod): drop checking if we have
19535 registered this from here
19537 2002-01-12 Miguel de Icaza <miguel@ximian.com>
19539 * class.cs (Method.EmitDestructor): Implement calling our base
19542 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
19543 value of InFinally.
19545 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
19546 this routine and will wrap the call in a try/catch block. Deal
19549 2002-01-11 Miguel de Icaza <miguel@ximian.com>
19551 * ecore.cs (Expression.MemberLookup): instead of taking a
19552 parameter `same_type' that was used to tell whether we could
19553 access private members we compute our containing type from the
19556 (FieldExpr): Added partial support for volatile fields. This does
19557 not work for volatile fields exposed from assemblies, as I can not
19558 figure out how to extract the modreq from it.
19560 Updated all the source files to use this.
19562 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
19563 because it is referenced by MemberLookup very often.
19565 2002-01-09 Ravi Pratap <ravi@ximian.com>
19567 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
19568 TypeBuilder.GetCustomAttributes to retrieve what we need.
19570 Get rid of redundant default_member_attr_type as this is the same as
19571 default_member_type which already exists.
19573 * interface.cs, attribute.cs : Update accordingly.
19575 2002-01-08 Miguel de Icaza <miguel@ximian.com>
19577 * typemanager.cs: Enable IndexerPropertyName again. It does not
19578 work for TYpeBuilders though. Ravi, can you please fix this?
19580 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
19582 * expression.cs (Argument.Emit): Handle the case of ref objects
19583 being passed to ref functions;
19585 (ParameterReference.EmitLoad): Loads the content of the pointer
19586 without dereferencing.
19588 2002-01-07 Miguel de Icaza <miguel@ximian.com>
19590 * cs-tokenizer.cs: Implemented the pre-processing expressions.
19592 2002-01-08 Ravi Pratap <ravi@ximian.com>
19594 * class.cs (Indexer.DefineMethod): Incorporate the interface
19595 type in the name of the method if we are doing explicit interface
19598 * expression.cs (ConversionExists): Remove as it is completely obsolete.
19600 (BetterConversion): Fix extremely trivial bug where we were referring to
19601 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
19604 * ../errors/bug16.cs : Add although we have fixed it.
19606 2002-01-07 Miguel de Icaza <miguel@ximian.com>
19608 * expression.cs (BaseIndexer): Begin implementation.
19610 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
19612 * cs-parser.jay (indexer_declarator): Use qualified_identifier
19613 production directly to remove a shift/reduce, and implement
19614 explicit interface implementation.
19616 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
19617 after a floating point suffix.
19619 * expression.cs (DoNumericPromotions): Improved the conversion for
19620 uint/uint. If we have a constant, we avoid doing a typecast to a
19623 * class.cs (Indexer): Implement explicit interface implementation
19626 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
19628 * class.cs: make the default instance constructor public and hidebysig.
19630 2001-01-03 Ravi Pratap <ravi@ximian.com>
19632 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
19633 so we can call it from elsewhere.
19635 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
19636 we emit it internally if the class has a defined indexer; otherwise the user
19637 emits it by decorating the class definition with the DefaultMemberAttribute.
19639 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
19640 attribute is not used on a type which defines an indexer.
19642 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
19643 character when we skip whitespace.
19645 * ../errors/cs0646.cs : Add.
19647 2002-01-03 Miguel de Icaza <miguel@ximian.com>
19649 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
19652 * makefile: Add practical target `mcs3.exe' which builds the third
19653 generation compiler.
19655 * expression.cs (New): Fix structures constructor calling.
19657 * class.cs (Property, Method, Indexer): Emit Final flag on the
19658 method if we are an interface implementation and we are not
19661 * ecore.cs (PropertyExpr): New public field `IsBase', tells
19662 whether this property is referencing a `base' method.
19664 * expression.cs (Invocation.EmitCall): take an extra argument:
19665 is_base, this is used to determine whether the `call' or
19666 `callvirt' opcode should be used.
19669 * delegate.cs: update EmitCall.
19671 * class.cs (Method.Define): Set NewSlot for the cases where we are
19672 not implementing an interface method.
19674 (Property.Define): ditto.
19676 2002-01-02 Miguel de Icaza <miguel@ximian.com>
19678 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
19679 'r'. Allows mcs to parse itself fully.
19681 2002-01-02 Ravi Pratap <ravi@ximian.com>
19683 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
19684 of the number of initializers that require the InitializeArray method.
19686 (CheckIndices): Store the Expression in all cases - not the plain value. Also
19687 update the above field where necessary.
19689 (MakeByteBlob): Update accordingly.
19691 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
19694 (EmitDynamicInitializers): Update in accordance with the new optimization.
19696 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
19697 same OpCode applies.
19699 * cs-parser.jay : Fix some glaring errors I introduced.
19701 2002-01-01 Ravi Pratap <ravi@ximian.com>
19703 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
19704 so that we can check for name clashes there too.
19706 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
19707 for interface indexers.
19709 * interfaces.cs (Define): Emit the default member attribute.
19711 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
19712 variable was being referred to while setting the value ;-)
19714 2002-01-01 Miguel de Icaza <miguel@ximian.com>
19716 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
19717 byte-by-byte information when we know the data is zero.
19719 Make the block always a multiple of 4, because
19720 DefineInitializedData has a bug.
19722 * assign.cs: Fix, we should assign from the temporary, not from
19725 * expression.cs (MakeByteBlob): Fix my incorrect code.
19727 2001-12-31 Miguel de Icaza <miguel@ximian.com>
19729 * typemanager.cs (EnumToUnderlying): This function is used to get
19730 the underlying type from an enumeration, because it does not
19733 * constant.cs: Use the I4_S form for values between -128 and 127.
19735 * statement.cs (Block.LookupLabel): Looks up a label.
19736 (Block): Drop support for labeled blocks.
19738 (LabeledStatement): New kind of statement that represents a label
19741 (Goto): Finally implement this bad boy.
19743 * cs-parser.jay: Update to reflect new mechanism to implement
19746 2001-12-30 Miguel de Icaza <miguel@ximian.com>
19748 * codegen.cs (EmitContext.This): a codegen property that keeps the
19749 a single instance of this instead of creating many different this
19752 * delegate.cs (Delegate.DoResolve): Update to use the property;
19754 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
19756 * expression.cs (BaseAccess.DoResolve): Ditto.
19758 2001-12-29 Ravi Pratap <ravi@ximian.com>
19760 * typemanager.cs (methodimpl_attr_type): Add to hold the type
19761 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
19763 (InitCoreTypes): Update accordingly.
19765 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
19766 so we can quickly store the state.
19768 (ApplyAttributes): Set the correct implementation flags
19769 for InternalCall methods.
19771 2001-12-29 Miguel de Icaza <miguel@ximian.com>
19773 * expression.cs (EmitCall): if a method is not virtual, then do
19774 not use callvirt on it.
19776 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
19777 user defined stuff) requires the use of stobj, which takes an
19778 address on the stack instead of an array and an index. So emit
19779 the Ldelema operation for it.
19781 (EmitStoreOpcode): Use stobj for valuetypes.
19783 (UnaryMutator.EmitCode): Use the right 1 value depending on
19784 whether we are dealing with int64/uint64, float or doubles.
19786 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
19787 constructors that I implemented last night.
19789 (Constructor.IsDefault): Fix to work properly for static
19792 * cs-parser.jay (CheckDef): report method signature errors.
19793 Update error number 103 to be 132.
19795 * decl.cs: New AdditionResult enumeration value: MethodExists.
19796 Although we do this check for methods later on in the semantic
19797 analysis, catching repeated default constructors is so easy that
19798 we catch these here.
19800 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
19803 (ParameterReference.EmitAssign, Emit): handle
19806 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
19807 (ArrayAccess.EmitStoreOpcode): ditto.
19809 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
19811 * expression.cs (MakeByteBlob): Complete all the missing types
19812 (uint, short, ushort, byte, sbyte)
19814 * class.cs: Only init instance field initializers on instance
19817 Rename `constructors' to instance_constructors.
19819 (TypeContainer.AddConstructor): Only add constructors to the list
19820 if it is not static.
19822 Make sure that we handle default_static_constructor independently
19823 everywhere where we handle instance_constructors
19825 2001-12-28 Miguel de Icaza <miguel@ximian.com>
19827 * class.cs: Do not lookup or create a base initializer for a
19828 static constructor.
19830 (ConstructorInitializer.Resolve): use the proper type to lookup
19833 * cs-parser.jay: Report error 1585 (modifiers between type and name).
19835 * enum.cs, interface.cs: Remove CloseType, this is taken care by
19838 * decl.cs: CloseType is now an virtual method, the default
19839 implementation just closes this type.
19841 2001-12-28 Ravi Pratap <ravi@ximian.com>
19843 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
19844 to PreserveSig by default. Also emit HideBySig on such methods.
19846 Basically, set the defaults to standard values.
19848 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
19849 argument, if candidate is better, it can't be worse than the best !
19851 (Invocation): Re-write bits to differentiate between methods being
19852 applicable in their expanded form and their normal form - for params
19855 Get rid of use_standard everywhere as only standard conversions are allowed
19856 in overload resolution.
19858 More spec conformance.
19860 2001-12-27 Miguel de Icaza <miguel@ximian.com>
19862 * driver.cs: Add --timestamp, to see where the compiler spends
19865 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
19866 `this' in static code.
19868 (SimpleName.DoResolve): Implement in terms of a helper function
19869 that allows static-references to be passed upstream to
19872 (Expression.ResolveWithSimpleName): Resolve specially simple
19873 names when called by MemberAccess to implement the special
19876 (Expression.ImplicitReferenceConversion): Handle conversions from
19877 Null to reference types before others, as Null's type is
19880 * expression.cs (Invocation.EmitCall): Handle the special case of
19881 calling methods declared on a reference type from a ValueType
19882 (Base classes System.Object and System.Enum)
19884 (MemberAccess.Resolve): Only perform lookups on Enumerations if
19885 the left hand side is a TypeExpr, not on every enumeration.
19887 (Binary.Resolve): If types are reference types, then do a cast to
19888 object on operators != and == of both arguments.
19890 * typemanager.cs (FindMembers): Extract instance and static
19891 members if requested.
19893 * interface.cs (PopulateProperty): Use void_type instead of null
19894 as the return type for the setter method.
19896 (PopulateIndexer): ditto.
19898 2001-12-27 Ravi Pratap <ravi@ximian.com>
19900 * support.cs (ReflectionParameters): Fix minor bug where we
19901 were examining the wrong parameter for the ParamArray attribute.
19903 Cope with requests for the type of the parameter at position
19904 greater than the params parameter's. We now return the element
19905 type of the params array as that makes more sense.
19907 * expression.cs (Invocation.IsParamsMethodApplicable): Update
19908 accordingly as we no longer have to extract the element type
19911 (Invocation.OverloadResolve): Update.
19913 2001-12-27 Miguel de Icaza <miguel@ximian.com>
19915 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
19916 against IEnumerator, test whether the return value is a descendant
19917 of the IEnumerator interface.
19919 * class.cs (Indexer.Define): Use an auxiliary method to implement
19920 the other bits of the method definition. Begin support for
19921 explicit interface implementation.
19923 (Property.DefineMethod): Use TypeManager.void_type instead of null
19924 for an empty return value.
19926 2001-12-26 Miguel de Icaza <miguel@ximian.com>
19928 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
19929 dealing with a FieldExpr which is composed of a FieldBuilder, in
19930 the code path we did extract the constant, but we should have
19931 obtained the underlying value to be able to cast it (otherwise we
19932 end up in an infinite loop, this is what Ravi was running into).
19934 (ArrayCreation.UpdateIndices): Arrays might be empty.
19936 (MemberAccess.ResolveMemberAccess): Add support for section
19937 14.5.4.1 that deals with the special case of E.I when E is a type
19938 and something else, that I can be a reference to a static member.
19940 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
19941 handle a particular array type to create byte blobs, it is just
19942 something we dont generate byteblobs for.
19944 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
19947 * location.cs (Push): remove the key from the hashtable that we
19948 are about to add. This happens for empty files.
19950 * driver.cs: Dispose files after we have parsed them.
19952 (tokenize): new function that only runs the tokenizer on its
19953 input, for speed testing.
19955 2001-12-26 Ravi Pratap <ravi@ximian.com>
19957 * class.cs (Event.Define): Define the private field only if there
19958 are no accessors defined.
19960 * expression.cs (ResolveMemberAccess): If there is no associated
19961 field with the event, that means we have an event defined with its
19962 own accessors and we should flag error cs0070 since transforming
19963 ourselves into a field is not valid in that case.
19965 * ecore.cs (SimpleName.DoResolve): Same as above.
19967 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
19968 and charset to sane values.
19970 2001-12-25 Ravi Pratap <ravi@ximian.com>
19972 * assign.cs (DoResolve): Perform check on events only if they
19973 are being accessed outside the declaring type.
19975 * cs-parser.jay (event_declarations): Update rules to correctly
19976 set the type of the implicit parameter etc.
19978 (add_accessor, remove_accessor): Set current local parameters.
19980 * expression.cs (Binary): For delegate addition and subtraction,
19981 cast the return value from the method into the appropriate delegate
19984 2001-12-24 Ravi Pratap <ravi@ximian.com>
19986 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
19987 of these as the workaround is unnecessary.
19989 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
19990 delegate data - none of that is needed at all.
19992 Re-write bits to extract the instance expression and the delegate method
19995 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
19998 * attribute.cs (ApplyAttributes): New method to take care of common tasks
19999 of attaching attributes instead of duplicating code everywhere.
20001 * everywhere : Update code to do attribute emission using the above method.
20003 2001-12-23 Miguel de Icaza <miguel@ximian.com>
20005 * expression.cs (IsParamsMethodApplicable): if there are not
20006 parameters, return immediately.
20008 * ecore.cs: The 0 literal can be implicity converted to an enum
20011 (SimpleName.DoResolve): First lookup the type, then lookup the
20014 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
20015 want to get its address. If the InstanceExpression is not
20016 addressable, store the result in a temporary variable, then get
20019 * codegen.cs: Only display 219 errors on warning level or above.
20021 * expression.cs (ArrayAccess): Make it implement the
20022 IMemoryLocation interface.
20024 (Binary.DoResolve): handle the operator == (object a, object b)
20025 and operator != (object a, object b) without incurring into a
20026 BoxedCast (because 5 != o should never be performed).
20028 Handle binary enumerator operators.
20030 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
20031 value type, otherwise use Ldelem_ref.
20033 Use precomputed names;
20035 (AddressOf): Implement address of
20037 * cs-parser.jay (labeled_statement): Fix recursive block
20038 addition by reworking the production.
20040 * expression.cs (New.DoEmit): New has a special case:
20042 If we are dealing with a ValueType, we have a few
20043 situations to deal with:
20045 * The target of New is a ValueType variable, that is
20046 easy, we just pass this as the variable reference
20048 * The target of New is being passed as an argument,
20049 to a boxing operation or a function that takes a
20052 In this case, we need to create a temporary variable
20053 that is the argument of New.
20056 2001-12-23 Ravi Pratap <ravi@ximian.com>
20058 * rootcontext.cs (LookupType): Check that current_type is not null before
20059 going about looking at nested types.
20061 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
20062 not implement the IAssignMethod interface any more.
20064 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
20065 where we tranform them into FieldExprs if they are being resolved from within
20066 the declaring type.
20068 * ecore.cs (SimpleName.DoResolve): Do the same here.
20070 * assign.cs (DoResolve, Emit): Clean up code considerably.
20072 * ../errors/bug10.cs : Add.
20074 * ../errors/cs0070.cs : Add.
20076 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
20078 * assign.cs : Get rid of EventIsLocal everywhere.
20080 2001-12-23 Miguel de Icaza <miguel@ximian.com>
20082 * ecore.cs (ConvertIntLiteral): finished the implementation.
20084 * statement.cs (SwitchLabel): Convert the value we are using as a
20085 key before looking up the table.
20087 2001-12-22 Miguel de Icaza <miguel@ximian.com>
20089 * codegen.cs (EmitTopBlock): Require a Location argument now.
20091 * cs-parser.jay (constructor_declarator): We need to setup
20092 current_local_parameters before we parse the
20093 opt_constructor_initializer, to allow the variables to be bound
20094 to the constructor arguments.
20096 * rootcontext.cs (LookupType): First lookup nested classes in our
20097 class and our parents before we go looking outside our class.
20099 * expression.cs (ConstantFold): Extract/debox the values at the
20102 * rootcontext.cs (EmitCode): Resolve the constants first before we
20103 resolve the types. This is not really needed, but it helps debugging.
20105 * statement.cs: report location.
20107 * cs-parser.jay: pass location to throw statement.
20109 * driver.cs: Small bug fix.
20111 * report.cs: Updated format to be 4-zero filled digits.
20113 2001-12-22 Ravi Pratap <ravi@ximian.com>
20115 * expression.cs (CheckIndices): Fix minor bug where the wrong
20116 variable was being referred to ;-)
20118 (DoEmit): Do not call EmitStaticInitializers when the
20119 underlying type is System.Object.
20121 2001-12-21 Ravi Pratap <ravi@ximian.com>
20123 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
20124 and do the usual workaround for SRE.
20126 * class.cs (MyEventBuilder.EventType): New member to get at the type
20127 of the event, quickly.
20129 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
20131 * assign.cs (Assign.DoResolve): Handle the case when the target
20132 is an EventExpr and perform the necessary checks.
20134 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
20137 (SimpleName.MemberStaticCheck): Include check for EventExpr.
20139 (EventExpr): Set the type in the constructor itself since we
20140 are meant to be born fully resolved.
20142 (EventExpr.Define): Revert code I wrote earlier.
20144 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
20145 instance expression is null. The instance expression is a This in that case
20146 or a null, depending on whether it is a static method or not.
20148 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
20149 refers to more than one method.
20151 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
20152 and accordingly flag errors.
20154 2001-12-21 Miguel de Icaza <miguel@ximian.com>
20156 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
20158 2001-12-22 Miguel de Icaza <miguel@ximian.com>
20160 * location.cs (ToString): Provide useful rutine.
20162 2001-12-21 Miguel de Icaza <miguel@ximian.com>
20164 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
20165 objects, return the actual integral boxed.
20167 * statement.cs (SwitchLabel): define an ILLabel for each
20170 (Switch.CheckSwitch): If the value is a Literal, extract
20171 the underlying literal.
20173 Also in the unused hashtable we had, add the SwitchLabel so we can
20174 quickly look this value up.
20176 * constant.cs: Implement a bunch of new constants. Rewrite
20177 Literal based on this. Made changes everywhere to adapt to this.
20179 * expression.cs (Expression.MakeByteBlob): Optimize routine by
20180 dereferencing array only once, and also copes with enumrations.
20182 bytes are two bytes wide, not one.
20184 (Cast): Perform constant conversions.
20186 * ecore.cs (TryImplicitIntConversion): Return literals instead of
20187 wrappers to the literals here.
20189 * expression.cs (DoNumericPromotions): long literals can converted
20190 to ulong implicity (this is taken care of elsewhere, but I was
20191 missing this spot).
20193 * ecore.cs (Expression.Literalize): Make the return type Literal,
20194 to improve type checking.
20196 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
20198 2001-12-20 Miguel de Icaza <miguel@ximian.com>
20200 * literal.cs: Revert code from ravi that checked the bounds. The
20201 bounds are sane by the definition of the type itself.
20203 * typemanager.cs: Fix implementation of ImplementsInterface. We
20204 need to actually look up in our parent hierarchy for interfaces
20207 * const.cs: Use the underlying type for enumerations
20209 * delegate.cs: Compute the basename for the delegate creation,
20210 that should fix the delegate test case, and restore the correct
20211 Type Lookup semantics in rootcontext
20213 * rootcontext.cs: Revert Ravi's last patch. The correct way of
20214 referencing a nested type with the Reflection API is using the "+"
20217 * cs-parser.jay: Do not require EOF token at the end.
20219 2001-12-20 Ravi Pratap <ravi@ximian.com>
20221 * rootcontext.cs (LookupType): Concatenate type names with
20222 a '.' instead of a '+' The test suite passes again.
20224 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
20225 field of the enumeration.
20227 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
20228 the case when the member is an EventExpr.
20230 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
20231 static has an associated instance expression.
20233 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
20235 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
20237 * class.cs (Event.Define): Register event and perform appropriate checks
20240 We define the Add and Remove methods even if the use provides none because
20241 in that case, we provide default implementations ourselves.
20243 Define a private field of the type of the event. This is done by the CSC compiler
20244 and we should be doing it too ;-)
20246 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
20247 More methods we use in code we generate.
20249 (multicast_delegate_type, delegate_type): Two separate types since the distinction
20252 (InitCoreTypes): Update accordingly for the above.
20254 * class.cs (Event.Emit): Generate code for default accessors that we provide
20256 (EmitDefaultMethod): Do the job in the above.
20258 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
20261 2001-12-20 Miguel de Icaza <miguel@ximian.com>
20263 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
20264 builders even if we were missing one.
20266 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
20267 pass the Basename as our class name instead of the Name. The
20268 basename will be correctly composed for us.
20270 * parameter.cs (Paramters): Now takes a Location argument.
20272 * decl.cs (DeclSpace.LookupType): Removed convenience function and
20273 make all the code call directly LookupType in RootContext and take
20274 this chance to pass the Location information everywhere.
20276 * Everywhere: pass Location information.
20278 2001-12-19 Miguel de Icaza <miguel@ximian.com>
20280 * class.cs (Constructor.Define): Updated way of detecting the
20281 length of the parameters.
20283 (TypeContainer.DefineType): Use basename as the type name for
20286 (TypeContainer.Define): Do not recursively define types here, as
20287 definition is taken care in order by the RootContext.
20289 * tree.cs: Keep track of namespaces in a per-file basis.
20291 * parameter.cs (Parameter.ComputeSignature): Update to use
20294 (Parameters.GetSignature): ditto.
20296 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
20297 instead of a TypeContainer.
20299 (Interface.SemanticAnalysis): Use `this' instead of our parent to
20300 resolve names. Because we need to be resolve in our context, not
20303 * driver.cs: Implement response files.
20305 * class.cs (TypeContainer.DefineType): If we are defined, do not
20306 redefine ourselves.
20308 (Event.Emit): Emit the code for add/remove handlers.
20309 (Event.Define): Save the MethodBuilders for add/remove.
20311 * typemanager.cs: Use pair here too.
20313 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
20314 DictionaryEntry requires the first argument to be non-null.
20316 (enum_declaration): Compute full name for registering the
20319 (delegate_declaration): Instead of using
20320 formal_parameter_list, use opt_formal_parameter_list as the list
20323 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
20324 (EventParsing): New property that controls whether `add' and
20325 `remove' are returned as tokens or identifiers (for events);
20327 2001-12-19 Ravi Pratap <ravi@ximian.com>
20329 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
20330 use MyEventBuilder only and let it wrap the real builder for us.
20332 (MyEventBuilder): Revamp constructor etc.
20334 Implement all operations that we perform on EventBuilder in precisely the same
20337 (FindMembers): Update to use the EventBuilder member.
20339 (Event.Emit): Update accordingly.
20341 2001-12-18 Ravi Pratap <ravi@ximian.com>
20343 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
20344 by calling the appropriate methods.
20346 (GetCustomAttributes): Make stubs as they cannot possibly do anything
20349 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
20351 2001-12-17 Ravi Pratap <ravi@ximian.com>
20353 * delegate.cs (Delegate.Populate): Check that the return type
20354 and various parameters types are indeed accessible.
20356 * class.cs (Constructor.Define): Same here.
20358 (Field.Define): Ditto.
20360 (Event.Define): Ditto.
20362 (Operator.Define): Check that the underlying Method defined itself
20363 correctly - so it's MethodBuilder should not be null.
20365 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
20366 expression happens to be null.
20368 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
20369 members but as of now we don't seem to be able to do anything really useful with it.
20371 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
20372 not the EventBuilder.
20374 2001-12-18 Miguel de Icaza <miguel@ximian.com>
20376 * cs-tokenizer.cs: Add support for defines.
20377 Add support for #if, #elif, #else, #endif
20379 (eval_var): evaluates a variable.
20380 (eval): stubbed for evaluating functions.
20382 * cs-parser.jay: Pass the defines information
20384 * driver.cs: Add --define command line option.
20386 * decl.cs: Move MemberCore here.
20388 Make it the base class for DeclSpace. This allows us to catch and
20389 report 108 and 109 for everything now.
20391 * class.cs (TypeContainer.Define): Extract all the members
20392 before populating and emit the warning 108 (new keyword required
20393 to override) instead of having each member implement this.
20395 (MemberCore.Define): New abstract method, we will be using this in
20396 the warning reporting engine in Populate.
20398 (Operator.Define): Adjust to new MemberCore protocol.
20400 * const.cs (Const): This does not derive from Expression, it is a
20401 temporary object we use to create fields, it is a MemberCore.
20403 * class.cs (Method.Define): Allow the entry point to be in a
20406 * driver.cs: Rewrite the argument handler to clean it up a bit.
20408 * rootcontext.cs: Made it just an auxiliary namespace feature by
20409 making everything static.
20411 * driver.cs: Adapt code to use RootContext type name instead of
20414 * delegate.cs: Remove RootContext argument.
20416 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
20419 * class.cs (Event.Define): The lookup can fail.
20421 * cs-tokenizer.cs: Begin implementation of pre-procesor.
20423 * expression.cs: Resolve the this instance before invoking the code.
20425 2001-12-17 Miguel de Icaza <miguel@ximian.com>
20427 * cs-parser.jay: Add a production in element_access that allows
20428 the thing to become a "type" reference. This way we can parse
20429 things like "(string [])" as a type.
20431 Note that this still does not handle the more complex rules of
20435 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
20437 * ecore.cs: (CopyNewMethods): new utility function used to
20438 assemble the list of methods from running FindMembers.
20440 (MemberLookup): Rework FindMembers so that
20442 2001-12-16 Miguel de Icaza <miguel@ximian.com>
20444 * class.cs (TypeContainer): Remove Delegates who fail to be
20447 * delegate.cs (Populate): Verify that we dont get null return
20448 values. TODO: Check for AsAccessible.
20450 * cs-parser.jay: Use basename to emit error 574 (destructor should
20451 have the same name as container class), not the full name.
20453 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
20454 possible representation.
20456 Also implements integer type suffixes U and L.
20458 2001-12-15 Miguel de Icaza <miguel@ximian.com>
20460 * expression.cs (ArrayCreation.DoResolve): We need to do the
20461 argument resolution *always*.
20463 * decl.cs: Make this hold the namespace. Hold the root context as
20465 (LookupType): Move here.
20467 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
20469 * location.cs (Row, Name): Fixed the code, it was always returning
20470 references to the first file.
20472 * interface.cs: Register properties defined through interfaces.
20474 * driver.cs: Add support for globbing on the command line
20476 * class.cs (Field): Make it derive from MemberCore as well.
20479 2001-12-15 Ravi Pratap <ravi@ximian.com>
20481 * class.cs (Event::Define): Check that the type of the event is a delegate
20482 type else flag error #66.
20484 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
20487 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
20488 values of EntryPoint, CharSet etc etc.
20490 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
20492 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
20493 be null and we should ignore this. I am not sure if this is really clean. Apparently,
20494 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
20495 which needs this to do its work.
20497 * ../errors/cs0066.cs : Add.
20499 2001-12-14 Miguel de Icaza <miguel@ximian.com>
20501 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
20504 * class.cs: (MethodSignature.MethodSignature): Removed hack that
20505 clears out the parameters field.
20506 (MemberSignatureCompare): Cleanup
20508 (MemberCore): New base class used to share code between MethodCore
20511 (RegisterRequiredImplementations) BindingFlags.Public requires
20512 either BindingFlags.Instace or Static. Use instance here.
20514 (Property): Refactored code to cope better with the full spec.
20516 * parameter.cs (GetParameterInfo): Return an empty array instead
20519 * class.cs (Property): Abstract or extern properties have no bodies.
20521 * parameter.cs (GetParameterInfo): return a zero-sized array.
20523 * class.cs (TypeContainer.MethodModifiersValid): Move all the
20524 method modifier validation to the typecontainer so we can reuse
20525 this on properties.
20527 (MethodCore.ParameterTypes): return an empty sized array of types.
20529 (Property.Define): Test property modifier validity.
20531 Add tests for sealed/override too.
20533 (Method.Emit): abstract or extern methods have no bodies.
20535 2001-12-14 Ravi Pratap <ravi@ximian.com>
20537 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
20540 (Method::Define, ::Emit): Modify accordingly.
20542 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
20544 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
20546 * makefile: Pass in /unsafe.
20548 2001-12-13 Miguel de Icaza <miguel@ximian.com>
20550 * class.cs (MakeKey): Kill routine.
20552 * class.cs (TypeContainer.Define): Correctly define explicit
20553 method implementations (they require the full interface name plus
20556 * typemanager.cs: Deply the PtrHashtable here and stop using the
20557 lame keys. Things work so much better.
20559 This of course broke everyone who depended on `RegisterMethod' to
20560 do the `test for existance' test. This has to be done elsewhere.
20562 * support.cs (PtrHashtable): A hashtable that avoid comparing with
20563 the object stupid Equals method (because, that like fails all over
20564 the place). We still do not use it.
20566 * class.cs (TypeContainer.SetRequiredInterface,
20567 TypeContainer.RequireMethods): Killed these two routines and moved
20568 all the functionality to RegisterRequiredImplementations.
20570 (TypeContainer.RegisterRequiredImplementations): This routine now
20571 registers all the implementations required in an array for the
20572 interfaces and abstract methods. We use an array of structures
20573 which can be computed ahead of time to reduce memory usage and we
20574 also assume that lookups are cheap as most classes will not
20575 implement too many interfaces.
20577 We also avoid creating too many MethodSignatures.
20579 (TypeContainer.IsInterfaceMethod): Update and optionally does not
20580 clear the "pending" bit if we find that there are problems with
20583 (TypeContainer.VerifyPendingMethods): Update to report errors of
20584 methods that look like implementations but are not.
20586 (TypeContainer.Define): Add support for explicit interface method
20589 2001-12-12 Miguel de Icaza <miguel@ximian.com>
20591 * typemanager.cs: Keep track of the parameters here instead of
20592 being a feature of the TypeContainer.
20594 * class.cs: Drop the registration of parameters here, as
20595 InterfaceMethods are also interface declarations.
20597 * delegate.cs: Register methods with the TypeManager not only with
20598 the TypeContainer. This code was buggy.
20600 * interface.cs: Full registation here.
20602 2001-12-11 Miguel de Icaza <miguel@ximian.com>
20604 * expression.cs: Remove reducer for binary expressions, it can not
20607 * const.cs: Put here the code that used to go into constant.cs
20609 * constant.cs: Put here the code for constants, this is a new base
20610 class for Literals.
20612 * literal.cs: Make Literal derive from Constant.
20614 2001-12-09 Miguel de Icaza <miguel@ximian.com>
20616 * statement.cs (Return.Emit): Report error 157 if the user
20617 attempts to return from a finally block.
20619 (Return.Emit): Instead of emitting a return, jump to the end of
20622 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
20623 LocalBuilder to store the result of the function. ReturnLabel is
20624 the target where we jump.
20627 2001-12-09 Radek Doulik <rodo@ximian.com>
20629 * cs-parser.jay: remember alias in current namespace
20631 * ecore.cs (SimpleName::DoResolve): use aliases for types or
20634 * class.cs (LookupAlias): lookup alias in my_namespace
20636 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
20638 (LookupAlias): lookup alias in this and if needed in parent
20641 2001-12-08 Miguel de Icaza <miguel@ximian.com>
20645 * rootcontext.cs: (ModuleBuilder) Made static, first step into
20646 making things static. I need this to avoid passing the
20647 TypeContainer when calling ParameterType.
20649 * support.cs (InternalParameters.ParameterType): Remove ugly hack
20650 that did string manipulation to compute the type and then call
20651 GetType. Use Parameter.ParameterType instead.
20653 * cs-tokenizer.cs: Consume the suffix for floating values.
20655 * expression.cs (ParameterReference): figure out whether this is a
20656 reference parameter or not. Kill an extra variable by computing
20657 the arg_idx during emission.
20659 * parameter.cs (Parameters.GetParameterInfo): New overloaded
20660 function that returns whether a parameter is an out/ref value or not.
20662 (Parameter.ParameterType): The type of the parameter (base,
20663 without ref/out applied).
20665 (Parameter.Resolve): Perform resolution here.
20666 (Parameter.ExternalType): The full type (with ref/out applied).
20668 * statement.cs (Using.Emit, Using.EmitExpression): Implement
20669 support for expressions on the using statement.
20671 2001-12-07 Miguel de Icaza <miguel@ximian.com>
20673 * statement.cs (Using.EmitLocalVariableDecls): Split the
20674 localvariable handling of the using statement.
20676 (Block.EmitMeta): Keep track of variable count across blocks. We
20677 were reusing slots on separate branches of blocks.
20679 (Try.Emit): Emit the general code block, we were not emitting it.
20681 Check the type of the declaration to be an IDisposable or
20682 something that can be implicity converted to it.
20684 Emit conversions if required.
20686 * ecore.cs (EmptyExpression): New utility class.
20687 (Expression.ImplicitConversionExists): New utility function.
20689 2001-12-06 Miguel de Icaza <miguel@ximian.com>
20691 * statement.cs (Using): Implement.
20693 * expression.cs (LocalVariableReference): Support read only variables.
20695 * statement.cs: Remove the explicit emit for the Leave opcode.
20696 (VariableInfo): Add a readonly field.
20698 2001-12-05 Miguel de Icaza <miguel@ximian.com>
20700 * ecore.cs (ConvCast): new class used to encapsulate the various
20701 explicit integer conversions that works in both checked and
20702 unchecked contexts.
20704 (Expression.ConvertNumericExplicit): Use new ConvCast class to
20705 properly generate the overflow opcodes.
20707 2001-12-04 Miguel de Icaza <miguel@ximian.com>
20709 * statement.cs: The correct type for the EmptyExpression is the
20710 element_type, not the variable type. Ravi pointed this out.
20712 2001-12-04 Ravi Pratap <ravi@ximian.com>
20714 * class.cs (Method::Define): Handle PInvoke methods specially
20715 by using DefinePInvokeMethod instead of the usual one.
20717 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
20718 above to do the task of extracting information and defining the method.
20720 2001-12-04 Ravi Pratap <ravi@ximian.com>
20722 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
20723 of the condition for string type.
20725 (Emit): Move that here.
20727 (ArrayCreation::CheckIndices): Keep string literals in their expression
20730 (EmitDynamicInitializers): Handle strings appropriately.
20732 2001-12-04 Miguel de Icaza <miguel@ximian.com>
20734 * codegen.cs (EmitContext): Replace multiple variables with a
20735 single pointer to the current Switch statement.
20737 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
20740 2001-12-03 Miguel de Icaza <miguel@ximian.com>
20744 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
20747 (Foreach.Emit): Foreach on arrays was not setting
20748 up the loop variables (for break/continue).
20750 (GotoCase): Semi-implented.
20752 2001-12-03 Ravi Pratap <ravi@ximian.com>
20754 * attribute.cs (CheckAttribute): Handle system attributes by using
20755 Attribute.GetAttributes to examine information we need.
20757 (GetValidPlaces): Same here.
20759 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
20761 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
20763 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
20765 (Method::Define): Set appropriate flags if we have a DllImport attribute.
20767 (Method::Emit): Handle the case when we are a PInvoke method.
20769 2001-12-03 Miguel de Icaza <miguel@ximian.com>
20771 * expression.cs: Use ResolveWithSimpleName on compound names.
20773 2001-12-02 Ravi Pratap <ravi@ximian.com>
20775 * constant.cs (EmitConstant): Make sure we resolve the associated expression
20776 before trying to reduce it.
20778 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
20780 * constant.cs (LookupConstantValue): Implement.
20782 (EmitConstant): Use the above in emitting the constant.
20784 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
20785 that are user-defined by doing a LookupConstantValue on them.
20787 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
20790 2001-11-29 Miguel de Icaza <miguel@ximian.com>
20792 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
20794 (BaseAccess.DoResolve): Implement.
20796 (MemberAccess.DoResolve): Split this routine into a
20797 ResolveMemberAccess routine that can be used independently
20799 2001-11-28 Miguel de Icaza <miguel@ximian.com>
20801 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
20802 As that share bits of the implementation. Is returns a boolean,
20803 while As returns the Type that is being probed.
20805 2001-12-01 Ravi Pratap <ravi@ximian.com>
20807 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
20808 instead of a Literal - much easier.
20810 (EnumInTransit): Remove - utterly useless :-)
20812 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
20814 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
20816 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
20817 chain when we have no associated expression.
20819 2001-11-30 Ravi Pratap <ravi@ximian.com>
20821 * constant.cs (Define): Use Location while reporting the errror.
20823 Also emit a warning when 'new' is used and there is no inherited
20826 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
20829 (LookupEnumValue): Implement to lookup an enum member's value and define it
20832 (Populate): Re-write accordingly to use the above routine.
20834 2001-11-27 Miguel de Icaza <miguel@ximian.com>
20836 * expression.cs (This): Fix prototype for DoResolveLValue to
20837 override the base class DoResolveLValue.
20839 * cs-parser.cs: Report errors cs574 and cs575 (destructor
20842 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
20843 (we need to load the address of the field here). This fixes
20846 (FieldExpr.DoResolveLValue): Call the DoResolve
20847 function to initialize the Instance expression.
20849 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
20850 correctly the GetEnumerator operation on a value type.
20852 * cs-parser.jay: Add more simple parsing error catches.
20854 * statement.cs (Switch): Add support for string switches.
20855 Handle null specially.
20857 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
20859 2001-11-28 Ravi Pratap <ravi@ximian.com>
20861 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
20863 (declare_local_constant): New helper function.
20865 * statement.cs (AddConstant): Keep a separate record of constants
20867 (IsConstant): Implement to determine if a variable is a constant.
20869 (GetConstantExpression): Implement.
20871 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
20873 * statement.cs (IsVariableDefined): Re-write.
20875 2001-11-27 Ravi Pratap <ravi@ximian.com>
20877 * class.cs (TypeContainer::FindMembers): Look for constants
20878 in the case when we are looking for MemberTypes.Field
20880 * expression.cs (MemberAccess::DoResolve): Check that in the
20881 case we are a FieldExpr and a Literal, we are not being accessed
20882 by an instance reference.
20884 * cs-parser.jay (local_constant_declaration): Implement.
20886 (declaration_statement): Implement for constant declarations.
20888 2001-11-26 Miguel de Icaza <miguel@ximian.com>
20890 * statement.cs (Switch): Catch double defaults.
20892 (Switch): More work on the switch() statement
20893 implementation. It works for integral values now, need to finish
20897 2001-11-24 Miguel de Icaza <miguel@ximian.com>
20899 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
20900 integer literals into other integer literals. To be used by
20903 2001-11-24 Ravi Pratap <ravi@ximian.com>
20905 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
20908 (EmitDynamicInitializers): Cope with the above since we extract data
20909 directly from ArrayData now.
20911 (ExpectInitializers): Keep track of whether initializers are mandatory
20914 (Bounds): Make it a hashtable to prevent the same dimension being
20915 recorded for every element in that dimension.
20917 (EmitDynamicInitializers): Fix bug which prevented the Set array method
20920 Also fix bug which was causing the indices to be emitted in the reverse
20923 2001-11-24 Miguel de Icaza <miguel@ximian.com>
20925 * expression.cs (ArrayCreation): Implement the bits that Ravi left
20926 unfinished. They do not work, because the underlying code is
20929 2001-11-22 Miguel de Icaza <miguel@ximian.com>
20931 * cs-parser.jay: Remove bogus fixme.
20933 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
20934 on Switch statement.
20936 2001-11-23 Ravi Pratap <ravi@ximian.com>
20938 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
20941 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
20942 parameter. Apparently, any expression is allowed.
20944 (ValidateInitializers): Update accordingly.
20946 (CheckIndices): Fix some tricky bugs thanks to recursion.
20948 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
20949 I was being completely brain-dead.
20951 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
20952 and re-write acordingly.
20954 (DelegateInvocation): Re-write accordingly.
20956 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
20958 (MakeByteBlob): Handle types more correctly.
20960 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
20961 initialization from expressions but it is incomplete because I am a complete
20964 2001-11-22 Miguel de Icaza <miguel@ximian.com>
20966 * statement.cs (If.Emit): Fix a bug that generated incorrect code
20967 on If. Basically, we have to return `true' (ie, we do return to
20968 our caller) only if both branches of the if return.
20970 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
20971 short-circuit operators, handle them as short circuit operators.
20973 (Cast.DoResolve): Resolve type.
20974 (Cast.Cast): Take an expression as the target type.
20976 * cs-parser.jay (cast_expression): Remove old hack that only
20977 allowed a limited set of types to be handled. Now we take a
20978 unary_expression and we resolve to a type during semantic
20981 Use the grammar productions from Rhys to handle casts (this is
20982 not complete like Rhys syntax yet, we fail to handle that corner
20983 case that C# has regarding (-x), but we will get there.
20985 2001-11-22 Ravi Pratap <ravi@ximian.com>
20987 * class.cs (EmitFieldInitializer): Take care of the case when we have a
20988 field which is an array type.
20990 * cs-parser.jay (declare_local_variables): Support array initialization too.
20992 * typemanager.cs (MakeKey): Implement.
20994 (everywhere): Use the above appropriately.
20996 * cs-parser.jay (for_statement): Update for array initialization while
20997 declaring variables.
20999 * ecore.cs : The error message was correct, it's the variable's names that
21000 were misleading ;-) Make the code more readable.
21002 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
21003 the correct type etc.
21005 (ConvertExplicit): Handle Enum types by examining the underlying type.
21007 2001-11-21 Ravi Pratap <ravi@ximian.com>
21009 * parameter.cs (GetCallingConvention): Always return
21010 CallingConventions.Standard for now.
21012 2001-11-22 Miguel de Icaza <miguel@ximian.com>
21014 * expression.cs (Binary.ResolveOperator): Update the values of `l'
21015 and `r' after calling DoNumericPromotions.
21017 * ecore.cs: Fix error message (the types were in the wrong order).
21019 * statement.cs (Foreach.ProbeCollectionType): Need to pass
21020 BindingFlags.Instance as well
21022 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
21023 implicit int literal conversion in an empty cast so that we
21024 propagate the right type upstream.
21026 (UnboxCast): new class used to unbox value types.
21027 (Expression.ConvertExplicit): Add explicit type conversions done
21030 (Expression.ImplicitNumericConversion): Oops, forgot to test for
21031 the target type before applying the implicit LongLiterals to ULong
21034 2001-11-21 Miguel de Icaza <miguel@ximian.com>
21036 * cs-parser.jay (for_statement): Reworked the way For works: now
21037 we declare manually any variables that are introduced in
21038 for_initializer to solve the problem of having out-of-band code
21039 emition (that is what got for broken).
21041 (declaration_statement): Perform the actual variable declaration
21042 that used to be done in local_variable_declaration here.
21044 (local_variable_declaration): Do not declare anything, just pass
21045 the information on a DictionaryEntry
21047 2001-11-20 Ravi Pratap <ravi@ximian.com>
21049 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
21050 re-write of the logic to now make it recursive.
21052 (UpdateIndices): Re-write accordingly.
21054 Store element data in a separate ArrayData list in the above methods.
21056 (MakeByteBlob): Implement to dump the array data into a byte array.
21058 2001-11-19 Ravi Pratap <ravi@ximian.com>
21060 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
21063 * constant.cs (Define): Implement.
21065 (EmitConstant): Re-write fully.
21067 Pass in location info.
21069 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
21072 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
21073 DictionaryEntry since we need location info too.
21075 (constant_declaration): Update accordingly.
21077 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
21078 code into another method : UpdateIndices.
21080 2001-11-18 Ravi Pratap <ravi@ximian.com>
21082 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
21083 some type checking etc.
21085 2001-11-17 Ravi Pratap <ravi@ximian.com>
21087 * expression.cs (ArrayCreation::ValidateInitializers): Implement
21088 bits to provide dimension info if the user skips doing that.
21090 Update second constructor to store the rank correctly.
21092 2001-11-16 Ravi Pratap <ravi@ximian.com>
21094 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
21095 and try to implement.
21097 * ../errors/cs0150.cs : Add.
21099 * ../errors/cs0178.cs : Add.
21101 2001-11-16 Miguel de Icaza <miguel@ximian.com>
21103 * statement.cs: Implement foreach on multi-dimensional arrays.
21105 * parameter.cs (Parameters.GetParameterByName): Also lookup the
21106 name of the params argument.
21108 * expression.cs: Use EmitStoreOpcode to get the right opcode while
21109 initializing the array.
21111 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
21112 we can use this elsewhere.
21114 * statement.cs: Finish implementation of foreach for single
21117 * cs-parser.jay: Use an out-of-band stack to pass information
21118 around, I wonder why I need this.
21120 foreach_block: Make the new foreach_block the current_block.
21122 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
21123 function used to return a static Parameters structure. Used for
21124 empty parameters, as those are created very frequently.
21126 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
21128 2001-11-15 Ravi Pratap <ravi@ximian.com>
21130 * interface.cs : Default modifier is private, not public. The
21131 make verify test passes again.
21133 2001-11-15 Ravi Pratap <ravi@ximian.com>
21135 * support.cs (ReflectionParameters): Fix logic to determine
21136 whether the last parameter is a params one. Test 9 passes again.
21138 * delegate.cs (Populate): Register the builders we define with
21139 RegisterParameterForBuilder. Test 19 passes again.
21141 * cs-parser.jay (property_declaration): Reference $6 instead
21142 of $$ to get at the location.
21144 (indexer_declaration): Similar stuff.
21146 (attribute): Ditto.
21148 * class.cs (Property): Register parameters for the Get and Set methods
21149 if they exist. Test 23 passes again.
21151 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
21152 call to EmitArguments as we are sure there aren't any params arguments.
21153 Test 32 passes again.
21155 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
21156 IndexOutOfRangeException.
21158 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
21159 Test 33 now passes again.
21161 2001-11-15 Miguel de Icaza <miguel@ximian.com>
21163 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
21164 broke a bunch of things. Will have to come up with a better way
21165 of tracking locations.
21167 * statement.cs: Implemented foreach for single dimension arrays.
21169 2001-11-09 Miguel de Icaza <miguel@ximian.com>
21171 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
21172 an error. This removes the lookup from the critical path.
21174 * cs-parser.jay: Removed use of temporary_loc, which is completely
21177 2001-11-14 Miguel de Icaza <miguel@ximian.com>
21179 * support.cs (ReflectionParameters.ParameterModifier): Report
21180 whether the argument is a PARAMS argument or not.
21182 * class.cs: Set the attribute `ParamArrayAttribute' on the
21183 parameter argument.
21185 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
21186 and cons_param_array_attribute (ConstructorInfo for
21187 ParamArrayAttribute).,
21189 * codegen.cs: Emit the return using the `Return' statement, that
21190 way we can report the error correctly for missing return values.
21192 * class.cs (Method.Emit): Clean up.
21194 * expression.cs (Argument.Resolve): Take another argument: the
21195 location where this argument is used. Notice that this is not
21196 part of the "Argument" class as to reduce the size of the
21197 structure (we know the approximate location anyways).
21199 Test if the argument is a variable-reference, if not, then
21200 complain with a 206.
21202 (Argument.Emit): Emit addresses of variables.
21204 (Argument.FullDesc): Simplify.
21206 (Invocation.DoResolve): Update for Argument.Resolve.
21208 (ElementAccess.DoResolve): ditto.
21210 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
21211 method should be virtual, as this method is always virtual.
21213 (NewDelegate.DoResolve): Update for Argument.Resolve.
21215 * class.cs (ConstructorInitializer.DoResolve): ditto.
21217 * attribute.cs (Attribute.Resolve): ditto.
21219 2001-11-13 Miguel de Icaza <miguel@ximian.com>
21221 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
21223 * expression.cs (ParameterReference): Drop IStackStorage and implement
21224 IAssignMethod instead.
21226 (LocalVariableReference): ditto.
21228 * ecore.cs (FieldExpr): Drop IStackStorage and implement
21229 IAssignMethod instead.
21231 2001-11-13 Miguel de Icaza <miguel@ximian.com>
21233 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
21234 enumerations that are used in heavily used structures derive from
21235 byte in a laughable and pathetic attempt to reduce memory usage.
21236 This is the kind of pre-optimzations that you should not do at
21237 home without adult supervision.
21239 * expression.cs (UnaryMutator): New class, used to handle ++ and
21240 -- separatedly from the other unary operators. Cleans up the
21241 code, and kills the ExpressionStatement dependency in Unary.
21243 (Unary): Removed `method' and `Arguments' from this class, making
21244 it smaller, and moving it all to SimpleCall, so I can reuse this
21245 code in other locations and avoid creating a lot of transient data
21246 strucutres when not required.
21248 * cs-parser.jay: Adjust for new changes.
21250 2001-11-11 Miguel de Icaza <miguel@ximian.com>
21252 * enum.cs (Enum.Populate): If there is a failure during
21255 * cs-parser.jay (opt_enum_base): we used to catch type errors
21256 here, but this is really incorrect. The type error should be
21257 catched during semantic analysis.
21259 2001-12-11 Ravi Pratap <ravi@ximian.com>
21261 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
21262 current_local_parameters as expected since I, in my stupidity, had forgotten
21265 * attribute.cs (GetValidPlaces): Fix stupid bug.
21267 * class.cs (Method::Emit): Perform check on applicability of attributes.
21269 (Constructor::Emit): Ditto.
21271 (Field::Emit): Ditto.
21273 (Field.Location): Store location information.
21275 (Property, Event, Indexer, Operator): Ditto.
21277 * cs-parser.jay (field_declaration): Pass in location for each field.
21279 * ../errors/cs0592.cs : Add.
21281 2001-11-12 Ravi Pratap <ravi@ximian.com>
21283 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
21285 (InitCoreTypes): Update accordingly.
21287 (RegisterAttrType, LookupAttr): Implement.
21289 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
21290 info about the same.
21292 (Resolve): Update to populate the above as necessary.
21294 (Error592): Helper.
21296 (GetValidPlaces): Helper to the above.
21298 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
21300 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
21302 2001-11-12 Ravi Pratap <ravi@ximian.com>
21304 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
21306 * ../errors/cs0617.cs : Add.
21308 2001-11-11 Ravi Pratap <ravi@ximian.com>
21310 * enum.cs (Emit): Rename to Populate to be more consistent with what
21311 we expect it to do and when exactly it is called.
21313 * class.cs, rootcontext.cs : Update accordingly.
21315 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
21316 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
21318 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
21320 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
21321 of a fieldinfo using the above, when dealing with a FieldBuilder.
21323 2001-11-10 Ravi Pratap <ravi@ximian.com>
21325 * ../errors/cs0031.cs : Add.
21327 * ../errors/cs1008.cs : Add.
21329 * ../errrors/cs0543.cs : Add.
21331 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
21334 (FindMembers): Implement.
21336 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
21337 enums and delegates too.
21339 (enum_types): Rename to builder_to_enum.
21341 (delegate_types): Rename to builder_to_delegate.
21343 * delegate.cs (FindMembers): Implement.
21345 2001-11-09 Ravi Pratap <ravi@ximian.com>
21347 * typemanager.cs (IsEnumType): Implement.
21349 * enum.cs (Emit): Re-write parts to account for the underlying type
21350 better and perform checking etc.
21352 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
21353 of the underlying type.
21355 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
21358 * enum.cs (error31): Helper to report error #31.
21360 * cs-parser.jay (enum_declaration): Store location of each member too.
21362 * enum.cs (member_to_location): New hashtable.
21364 (AddEnumMember): Update location hashtable.
21366 (Emit): Use the location of each member while reporting errors.
21368 2001-11-09 Miguel de Icaza <miguel@ximian.com>
21370 * cs-parser.jay: A for_initializer if is a
21371 local_variable_declaration really ammount to have an implicit
21372 block with the variable declaration and no initializer for for.
21374 * statement.cs (For.Emit): Cope with null initializers.
21376 This fixes the infinite loop on for initializers.
21378 2001-11-08 Miguel de Icaza <miguel@ximian.com>
21380 * enum.cs: More cleanup.
21382 * ecore.cs: Remove dead code.
21384 * class.cs (Property.Emit): More simplification.
21385 (Event.Emit): ditto.
21387 Reworked to have less levels of indentation.
21389 2001-11-08 Ravi Pratap <ravi@ximian.com>
21391 * class.cs (Property): Emit attributes.
21401 * enum.cs (Emit): Ditto.
21403 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
21406 * class.cs (Field, Event, etc.): Move attribute generation into the
21407 Emit method everywhere.
21409 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
21410 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
21411 as we had no way of defining nested enums !
21413 * rootcontext.cs : Adjust code accordingly.
21415 * typemanager.cs (AddEnumType): To keep track of enum types separately.
21417 2001-11-07 Ravi Pratap <ravi@ximian.com>
21419 * expression.cs (EvalConstantExpression): Move into ecore.cs
21421 * enum.cs (Enum): Rename some members and make them public and readonly
21422 according to our convention.
21424 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
21427 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
21429 (Enum::Emit): Write a simple version for now which doesn't try to compute
21430 expressions. I shall modify this to be more robust in just a while.
21432 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
21434 (TypeContainer::CloseType): Create the Enum types too.
21436 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
21438 * expression.cs (EvalConstantExpression): Get rid of completely.
21440 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
21441 user-defined values and other cases.
21443 (IsValidEnumLiteral): Helper function.
21445 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
21446 out there in the case we had a literal FieldExpr.
21448 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
21450 (Literalize): Revamp a bit to take two arguments.
21452 (EnumLiteral): New class which derives from Literal to wrap enum literals.
21454 2001-11-06 Ravi Pratap <ravi@ximian.com>
21456 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
21458 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
21460 (Resolve): Use the above to ensure we have proper initializers.
21462 2001-11-05 Ravi Pratap <ravi@ximian.com>
21464 * expression.cs (Expression::EvalConstantExpression): New method to
21465 evaluate constant expressions.
21467 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
21469 2001-11-07 Miguel de Icaza <miguel@ximian.com>
21471 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
21474 (Binary.ResolveOperator): Handle operator != (object a, object b)
21475 and operator == (object a, object b);
21477 (Binary.DoNumericPromotions): Indicate whether the numeric
21478 promotion was possible.
21480 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
21483 Made the ArrayAccess implement interface IAssignMethod instead of
21484 IStackStore as the order in which arguments are passed reflects
21487 * assign.cs: Instead of using expr.ExprClass to select the way of
21488 assinging, probe for the IStackStore/IAssignMethod interfaces.
21490 * typemanager.cs: Load InitializeArray definition.
21492 * rootcontext.cs (RootContext.MakeStaticData): Used to define
21493 static data that can be used to initialize arrays.
21495 2001-11-05 Miguel de Icaza <miguel@ximian.com>
21497 * expression.cs: Handle operator== and operator!= for booleans.
21499 (Conditioal.Reduce): Implement reducer for the ?: operator.
21501 (Conditional.Resolve): Implement dead code elimination.
21503 (Binary.Resolve): Catch string literals and return a new
21504 concatenated string.
21506 (Unary.Reduce): Implement reduction of unary expressions.
21508 * ecore.cs: Split out the expression core handling here.
21510 (Expression.Reduce): New method used to perform constant folding
21511 and CSE. This is needed to support constant-expressions.
21513 * statement.cs (Statement.EmitBoolExpression): Pass true and false
21514 targets, and optimize for !x.
21516 2001-11-04 Ravi Pratap <ravi@ximian.com>
21518 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
21519 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
21520 set custom atttributes.
21522 * literal.cs (Literal::GetValue): New abstract method to return the actual
21523 value of the literal, cast as an object.
21525 (*Literal): Implement GetValue method.
21527 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
21528 expressions to the arraylist but objects of type Argument.
21530 * class.cs (TypeContainer::Emit): Emit our attributes too.
21532 (Method::Emit, Constructor::Emit): Ditto.
21534 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
21535 to be ignoring earlier.
21537 2001-11-03 Ravi Pratap <ravi@ximian.com>
21539 * attribute.cs (AttributeSection::Define): Implement to do the business
21540 of constructing a CustomAttributeBuilder.
21542 (Attribute): New trivial class. Increases readability of code.
21544 * cs-parser.jay : Update accordingly.
21546 (positional_argument_list, named_argument_list, named_argument): New rules
21548 (attribute_arguments): Use the above so that we are more correct.
21550 2001-11-02 Ravi Pratap <ravi@ximian.com>
21552 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
21553 to perform all checks for a method with a params parameter.
21555 (Invocation::OverloadResolve): Update to use the above method and therefore
21556 cope correctly with params method invocations.
21558 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
21561 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
21562 constructors in our parent too because we can't afford to miss out on
21565 * attribute.cs (AttributeSection): New name for the class Attribute
21567 Other trivial changes to improve readability.
21569 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
21570 use the new class names.
21572 2001-11-01 Ravi Pratap <ravi@ximian.com>
21574 * class.cs (Method::Define): Complete definition for params types too
21576 (Indexer::Define): Ditto.
21578 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
21579 Cope everywhere with a request for info about the array parameter.
21581 2001-11-01 Ravi Pratap <ravi@ximian.com>
21583 * tree.cs (RecordNamespace): Fix up to check for the correct key.
21585 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
21586 local_variable_type to extract the string corresponding to the type.
21588 (local_variable_type): Fixup the action to use the new helper method.
21590 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
21593 * expression.cs : Clean out code which uses the above.
21595 2001-10-31 Ravi Pratap <ravi@ximian.com>
21597 * typemanager.cs (RegisterMethod): Check if we already have an existing key
21598 and bale out if necessary by returning a false.
21600 (RegisterProperty): Ditto.
21602 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
21603 and print out appropriate error messages.
21605 * interface.cs (everywhere): Ditto.
21607 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
21608 location to constructor.
21610 * class.cs (Property, Event, Indexer): Update accordingly.
21612 * ../errors/cs111.cs : Added.
21614 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
21615 of a method, as laid down by the spec.
21617 (Invocation::OverloadResolve): Use the above method.
21619 2001-10-31 Ravi Pratap <ravi@ximian.com>
21621 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
21622 now take a TypeContainer and a Parameters object.
21624 (ParameterData): Modify return type of ParameterModifier method to be
21625 Parameter.Modifier and not a string.
21627 (ReflectionParameters, InternalParameters): Update accordingly.
21629 * expression.cs (Argument::GetParameterModifier): Same here.
21631 * support.cs (InternalParameters::ParameterType): Find a better way of determining
21632 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
21633 symbol in it at all so maybe this is only for now.
21635 2001-10-30 Ravi Pratap <ravi@ximian.com>
21637 * support.cs (InternalParameters): Constructor now takes an extra argument
21638 which is the actual Parameters class.
21640 (ParameterDesc): Update to provide info on ref/out modifiers.
21642 * class.cs (everywhere): Update call to InternalParameters to pass in
21643 the second argument too.
21645 * support.cs (ParameterData): Add ParameterModifier, which is a method
21646 to return the modifier info [ref/out etc]
21648 (InternalParameters, ReflectionParameters): Implement the above.
21650 * expression.cs (Argument::ParameterModifier): Similar function to return
21651 info about the argument's modifiers.
21653 (Invocation::OverloadResolve): Update to take into account matching modifiers
21656 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
21657 a new SetFormalParameters object which we pass to InternalParameters.
21659 2001-10-30 Ravi Pratap <ravi@ximian.com>
21661 * expression.cs (NewArray): Merge into the ArrayCreation class.
21663 2001-10-29 Ravi Pratap <ravi@ximian.com>
21665 * expression.cs (NewArray): Merge classes NewBuiltinArray and
21666 NewUserdefinedArray into one as there wasn't much of a use in having
21669 * expression.cs (Argument): Change field's name to ArgType from Type.
21671 (Type): New readonly property which returns the proper type, taking into
21672 account ref/out modifiers.
21674 (everywhere): Adjust code accordingly for the above.
21676 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
21677 whether we are emitting for a ref or out parameter.
21679 * expression.cs (Argument::Emit): Use the above field to set the state.
21681 (LocalVariableReference::Emit): Update to honour the flag and emit the
21684 * parameter.cs (Attributes): Set the correct flags for ref parameters.
21686 * expression.cs (Argument::FullDesc): New function to provide a full desc.
21688 * support.cs (ParameterData): Add method ParameterDesc to the interface.
21690 (ReflectionParameters, InternalParameters): Implement the above method.
21692 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
21695 (Invocation::FullMethodDesc): Ditto.
21697 2001-10-29 Miguel de Icaza <miguel@ximian.com>
21699 * cs-parser.jay: Add extra production for the second form of array
21702 * expression.cs (ArrayCreation): Update to reflect the above
21705 * Small changes to prepare for Array initialization.
21707 2001-10-28 Miguel de Icaza <miguel@ximian.com>
21709 * typemanager.cs (ImplementsInterface): interface might be null;
21710 Deal with this problem;
21712 Also, we do store negative hits on the cache (null values), so use
21713 this instead of calling t.GetInterfaces on the type everytime.
21715 2001-10-28 Ravi Pratap <ravi@ximian.com>
21717 * typemanager.cs (IsBuiltinType): New method to help determine the same.
21719 * expression.cs (New::DoResolve): Get rid of array creation code and instead
21720 split functionality out into different classes.
21722 (New::FormArrayType): Move into NewBuiltinArray.
21724 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
21727 (NewBuiltinArray): New class to handle creation of built-in arrays.
21729 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
21730 account creation of one-dimensional arrays.
21732 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
21734 (NewUserdefinedArray::DoResolve): Implement.
21736 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
21738 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
21739 we maintain inside the TypeManager. This is necessary to perform lookups on the
21742 (LookupType): Update to perform GetType on the module builders too.
21744 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
21746 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
21748 2001-10-23 Ravi Pratap <ravi@ximian.com>
21750 * expression.cs (New::DoResolve): Implement guts of array creation.
21752 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
21754 2001-10-27 Miguel de Icaza <miguel@ximian.com>
21756 * expression.cs: Fix bug I introduced lsat night that broke
21759 (Expression.Resolve): Report a 246 error (can not resolve name)
21760 if we find a SimpleName in the stream.
21762 (Expression.ResolveLValue): Ditto.
21764 (Expression.ResolveWithSimpleName): This function is a variant of
21765 ResolveName, this one allows SimpleNames to be returned without a
21766 warning. The only consumer of SimpleNames is MemberAccess
21768 2001-10-26 Miguel de Icaza <miguel@ximian.com>
21770 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
21771 might arrive here. I have my doubts that this is correct.
21773 * statement.cs (Lock): Implement lock statement.
21775 * cs-parser.jay: Small fixes to support `lock' and `using'
21777 * cs-tokenizer.cs: Remove extra space
21779 * driver.cs: New flag --checked, allows to turn on integer math
21782 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
21783 Threading.Monitor.Exit
21785 2001-10-23 Miguel de Icaza <miguel@ximian.com>
21787 * expression.cs (IndexerAccess::DoResolveLValue): Set the
21788 Expression Class to be IndexerAccess.
21790 Notice that Indexer::DoResolve sets the eclass to Value.
21792 2001-10-22 Miguel de Icaza <miguel@ximian.com>
21794 * class.cs (TypeContainer::Emit): Emit code for indexers.
21796 * assign.cs (IAssignMethod): New interface implemented by Indexers
21797 and Properties for handling assignment.
21799 (Assign::Emit): Simplify and reuse code.
21801 * expression.cs (IndexerAccess, PropertyExpr): Implement
21802 IAssignMethod, clean up old code.
21804 2001-10-22 Ravi Pratap <ravi@ximian.com>
21806 * typemanager.cs (ImplementsInterface): New method to determine if a type
21807 implements a given interface. Provides a nice cache too.
21809 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
21812 (ConvertReferenceExplicit): Ditto.
21814 * delegate.cs (Delegate::Populate): Update to define the parameters on the
21815 various methods, with correct names etc.
21817 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
21818 Operator.UnaryNegation.
21820 * cs-parser.jay (operator_declarator): Be a little clever in the case where
21821 we have a unary plus or minus operator.
21823 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
21826 * everywhere : update accordingly.
21828 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
21831 * class.cs (Method::Define): For the case where we are implementing a method
21832 inherited from an interface, we need to set the MethodAttributes.Final flag too.
21833 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
21835 2001-10-21 Ravi Pratap <ravi@ximian.com>
21837 * interface.cs (FindMembers): Implement to work around S.R.E
21840 * typemanager.cs (IsInterfaceType): Implement.
21842 (FindMembers): Update to handle interface types too.
21844 * expression.cs (ImplicitReferenceConversion): Re-write bits which
21845 use IsAssignableFrom as that is not correct - it doesn't work.
21847 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
21848 and accordingly override EmitStatement.
21850 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
21851 using the correct logic :-)
21853 2001-10-19 Ravi Pratap <ravi@ximian.com>
21855 * ../errors/cs-11.cs : Add to demonstrate error -11
21857 2001-10-17 Miguel de Icaza <miguel@ximian.com>
21859 * assign.cs (Assign::Resolve): Resolve right hand side first, and
21860 then pass this as a hint to ResolveLValue.
21862 * expression.cs (FieldExpr): Add Location information
21864 (FieldExpr::LValueResolve): Report assignment to readonly
21867 (Expression::ExprClassFromMemberInfo): Pass location information.
21869 (Expression::ResolveLValue): Add new method that resolves an
21872 (Expression::DoResolveLValue): Default invocation calls
21875 (Indexers): New class used to keep track of indexers in a given
21878 (IStackStore): Renamed from LValue, as it did not really describe
21879 what this did. Also ResolveLValue is gone from this interface and
21880 now is part of Expression.
21882 (ElementAccess): Depending on the element access type
21884 * typemanager.cs: Add `indexer_name_type' as a Core type
21885 (System.Runtime.CompilerServices.IndexerNameAttribute)
21887 * statement.cs (Goto): Take a location.
21889 2001-10-18 Ravi Pratap <ravi@ximian.com>
21891 * delegate.cs (Delegate::VerifyDelegate): New method to verify
21892 if two delegates are compatible.
21894 (NewDelegate::DoResolve): Update to take care of the case when
21895 we instantiate a delegate from another delegate.
21897 * typemanager.cs (FindMembers): Don't even try to look up members
21898 of Delegate types for now.
21900 2001-10-18 Ravi Pratap <ravi@ximian.com>
21902 * delegate.cs (NewDelegate): New class to take care of delegate
21905 * expression.cs (New): Split the delegate related code out into
21906 the NewDelegate class.
21908 * delegate.cs (DelegateInvocation): New class to handle delegate
21911 * expression.cs (Invocation): Split out delegate related code into
21912 the DelegateInvocation class.
21914 2001-10-17 Ravi Pratap <ravi@ximian.com>
21916 * expression.cs (New::DoResolve): Implement delegate creation fully
21917 and according to the spec.
21919 (New::DoEmit): Update to handle delegates differently.
21921 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
21922 because of which we were printing out arguments in reverse order !
21924 * delegate.cs (VerifyMethod): Implement to check if the given method
21925 matches the delegate.
21927 (FullDelegateDesc): Implement.
21929 (VerifyApplicability): Implement.
21931 * expression.cs (Invocation::DoResolve): Update to accordingly handle
21932 delegate invocations too.
21934 (Invocation::Emit): Ditto.
21936 * ../errors/cs1593.cs : Added.
21938 * ../errors/cs1594.cs : Added.
21940 * delegate.cs (InstanceExpression, TargetMethod): New properties.
21942 2001-10-16 Ravi Pratap <ravi@ximian.com>
21944 * typemanager.cs (intptr_type): Core type for System.IntPtr
21946 (InitCoreTypes): Update for the same.
21948 (iasyncresult_type, asynccallback_type): Ditto.
21950 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
21953 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
21956 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
21957 the builders for the 4 members of a delegate type :-)
21959 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
21962 * expression.cs (New::DoResolve): Implement guts for delegate creation.
21964 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
21966 2001-10-15 Miguel de Icaza <miguel@ximian.com>
21968 * statement.cs (Break::Emit): Implement.
21969 (Continue::Emit): Implement.
21971 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
21972 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
21973 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
21974 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
21977 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
21978 properties that track the label for the current loop (begin of the
21979 loop and end of the loop).
21981 2001-10-15 Ravi Pratap <ravi@ximian.com>
21983 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
21984 use of emitting anything at all.
21986 * class.cs, rootcontext.cs : Get rid of calls to the same.
21988 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
21990 (Populate): Define the constructor correctly and set the implementation
21993 * typemanager.cs (delegate_types): New hashtable to hold delegates that
21996 (AddDelegateType): Implement.
21998 (IsDelegateType): Implement helper method.
22000 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
22002 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
22003 and accordingly handle it.
22005 * delegate.cs (Populate): Take TypeContainer argument.
22006 Implement bits to define the Invoke method. However, I still haven't figured out
22007 how to take care of the native int bit :-(
22009 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
22010 Qualify the name of the delegate, not its return type !
22012 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
22015 (StandardConversionExists): Checking for array types turns out to be recursive.
22017 (ConvertReferenceExplicit): Implement array conversion.
22019 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
22021 2001-10-12 Ravi Pratap <ravi@ximian.com>
22023 * cs-parser.jay (delegate_declaration): Store the fully qualified
22024 name as it is a type declaration.
22026 * delegate.cs (ReturnType, Name): Rename members to these. Make them
22029 (DefineDelegate): Renamed from Define. Does the same thing essentially,
22030 as TypeContainer::DefineType.
22032 (Populate): Method in which all the definition of the various methods (Invoke)
22035 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
22038 (CloseDelegate): Finally creates the delegate.
22040 * class.cs (TypeContainer::DefineType): Update to define delegates.
22041 (Populate, Emit and CloseType): Do the same thing here too.
22043 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
22044 delegates in all these operations.
22046 2001-10-14 Miguel de Icaza <miguel@ximian.com>
22048 * expression.cs: LocalTemporary: a new expression used to
22049 reference a temporary that has been created.
22051 * assign.cs: Handle PropertyAccess back here, so that we can
22052 provide the proper semantic access to properties.
22054 * expression.cs (Expression::ConvertReferenceExplicit): Implement
22055 a few more explicit conversions.
22057 * modifiers.cs: `NEW' modifier maps to HideBySig.
22059 * expression.cs (PropertyExpr): Make this into an
22060 ExpressionStatement, and support the EmitStatement code path.
22062 Perform get/set error checking, clean up the interface.
22064 * assign.cs: recognize PropertyExprs as targets, and if so, turn
22065 them into toplevel access objects.
22067 2001-10-12 Miguel de Icaza <miguel@ximian.com>
22069 * expression.cs: PropertyExpr::PropertyExpr: use work around the
22072 * typemanager.cs: Keep track here of our PropertyBuilders again to
22073 work around lameness in SRE.
22075 2001-10-11 Miguel de Icaza <miguel@ximian.com>
22077 * expression.cs (LValue::LValueResolve): New method in the
22078 interface, used to perform a second resolution pass for LValues.
22080 (This::DoResolve): Catch the use of this in static methods.
22082 (This::LValueResolve): Implement.
22084 (This::Store): Remove warning, assigning to `this' in structures
22087 (Invocation::Emit): Deal with invocation of
22088 methods on value types. We need to pass the address to structure
22089 methods rather than the object itself. (The equivalent code to
22090 emit "this" for structures leaves the entire structure on the
22091 stack instead of a pointer to it).
22093 (ParameterReference::DoResolve): Compute the real index for the
22094 argument based on whether the method takes or not a `this' pointer
22095 (ie, the method is static).
22097 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
22098 value types returned from functions when we need to invoke a
22099 method on the sturcture.
22102 2001-10-11 Ravi Pratap <ravi@ximian.com>
22104 * class.cs (TypeContainer::DefineType): Method to actually do the business of
22105 defining the type in the Modulebuilder or Typebuilder. This is to take
22106 care of nested types which need to be defined on the TypeBuilder using
22107 DefineNestedMethod.
22109 (TypeContainer::GetClassBases): Implement. Essentially the code from the
22110 methods in RootContext, only ported to be part of TypeContainer.
22112 (TypeContainer::GetInterfaceOrClass): Ditto.
22114 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
22116 * interface.cs (Interface::DefineInterface): New method. Does exactly
22117 what RootContext.CreateInterface did earlier, only it takes care of nested types
22120 (Interface::GetInterfaces): Move from RootContext here and port.
22122 (Interface::GetInterfaceByName): Same here.
22124 * rootcontext.cs (ResolveTree): Re-write.
22126 (PopulateTypes): Re-write.
22128 * class.cs (TypeContainer::Populate): Populate nested types too.
22129 (TypeContainer::Emit): Emit nested members too.
22131 * typemanager.cs (AddUserType): Do not make use of the FullName property,
22132 instead just use the name argument passed in as it is already fully
22135 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
22136 to TypeContainer mapping to see if a type is user-defined.
22138 * class.cs (TypeContainer::CloseType): Implement.
22140 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
22141 the default constructor.
22143 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
22146 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
22148 * interface.cs (CloseType): Create the type here.
22150 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
22153 Remove all the methods which are now in TypeContainer.
22155 2001-10-10 Ravi Pratap <ravi@ximian.com>
22157 * delegate.cs (Define): Re-write bits to define the delegate
22160 2001-10-10 Miguel de Icaza <miguel@ximian.com>
22162 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
22164 * expression.cs (ImplicitReferenceConversion): handle null as well
22165 as a source to convert to any reference type.
22167 * statement.cs (Return): Perform any implicit conversions to
22168 expected return type.
22170 Validate use of return statement.
22172 * codegen.cs (EmitContext): Pass the expected return type here.
22174 * class.cs (Method, Constructor, Property): Pass expected return
22175 type to EmitContext.
22177 2001-10-09 Miguel de Icaza <miguel@ximian.com>
22179 * expression.cs: Make DoResolve take an EmitContext instead of a
22182 Replaced `l' and `location' for `loc', for consistency.
22184 (Error, Warning): Remove unneeded Tc argument.
22186 * assign.cs, literal.cs, constant.cs: Update to new calling
22189 * codegen.cs: EmitContext now contains a flag indicating whether
22190 code is being generated in a static method or not.
22192 * cs-parser.jay: DecomposeQI, new function that replaces the old
22193 QualifiedIdentifier. Now we always decompose the assembled
22194 strings from qualified_identifier productions into a group of
22197 2001-10-08 Miguel de Icaza <miguel@ximian.com>
22199 * rootcontext.cs: Deal with field-less struct types correctly now
22200 by passing the size option to Define Type.
22202 * class.cs: Removed hack that created one static field.
22204 2001-10-07 Miguel de Icaza <miguel@ximian.com>
22206 * statement.cs: Moved most of the code generation here.
22208 2001-10-09 Ravi Pratap <ravi@ximian.com>
22210 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
22213 (ElementAccess): Remove useless bits for now - keep checks as the spec
22216 2001-10-08 Ravi Pratap <ravi@ximian.com>
22218 * expression.cs (ElementAccess::DoResolve): Remove my crap code
22219 and start performing checks according to the spec.
22221 2001-10-07 Ravi Pratap <ravi@ximian.com>
22223 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
22224 rank_specifiers instead.
22226 (rank_specifiers): Change the order in which the rank specifiers are stored
22228 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
22230 * expression.cs (ElementAccess): Implement the LValue interface too.
22232 2001-10-06 Ravi Pratap <ravi@ximian.com>
22234 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
22235 except that user defined conversions are not included.
22237 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
22238 perform the conversion of the return type, if necessary.
22240 (New::DoResolve): Check whether we are creating an array or an object
22241 and accordingly do the needful.
22243 (New::Emit): Same here.
22245 (New::DoResolve): Implement guts of array creation.
22247 (New::FormLookupType): Helper function.
22249 2001-10-07 Miguel de Icaza <miguel@ximian.com>
22251 * codegen.cs: Removed most of the code generation here, and move the
22252 corresponding code generation bits to the statement classes.
22254 Added support for try/catch/finalize and throw.
22256 * cs-parser.jay: Added support for try/catch/finalize.
22258 * class.cs: Catch static methods having the flags override,
22259 virtual or abstract.
22261 * expression.cs (UserCast): This user cast was not really doing
22262 what it was supposed to do. Which is to be born in fully resolved
22263 state. Parts of the resolution were being performed at Emit time!
22267 2001-10-05 Miguel de Icaza <miguel@ximian.com>
22269 * expression.cs: Implicity convert the result from UserCast.
22271 2001-10-05 Ravi Pratap <ravi@ximian.com>
22273 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
22274 prevented it from working correctly.
22276 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
22277 merely ConvertImplicit.
22279 2001-10-05 Miguel de Icaza <miguel@ximian.com>
22281 * typemanager.cs: Make the LookupTypeContainer function static,
22282 and not per-instance.
22284 * class.cs: Make static FindMembers (the one that takes a Type
22287 * codegen.cs: Add EmitForeach here.
22289 * cs-parser.jay: Make foreach a toplevel object instead of the
22290 inline expansion, as we need to perform semantic analysis on it.
22292 2001-10-05 Ravi Pratap <ravi@ximian.com>
22294 * expression.cs (Expression::ImplicitUserConversion): Rename to
22295 UserDefinedConversion.
22297 (Expression::UserDefinedConversion): Take an extra argument specifying
22298 whether we look for explicit user conversions too.
22300 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
22302 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
22304 (ExplicitUserConversion): Make it a call to UserDefinedConversion
22305 with the appropriate arguments.
22307 * cs-parser.jay (cast_expression): Record location too.
22309 * expression.cs (Cast): Record location info.
22311 (Expression::ConvertExplicit): Take location argument.
22313 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
22314 to determine if we are doing explicit conversions.
22316 (UserCast::Emit): Update accordingly.
22318 (Expression::ConvertExplicit): Report an error if everything fails.
22320 * ../errors/cs0030.cs : Add.
22322 2001-10-04 Miguel de Icaza <miguel@ximian.com>
22324 * modifiers.cs: If the ABSTRACT keyword is present, also set the
22325 virtual and newslot bits.
22327 * class.cs (TypeContainer::RegisterRequiredImplementations):
22328 Record methods we need.
22330 (TypeContainer::MakeKey): Helper function to make keys for
22331 MethodBases, since the Methodbase key is useless.
22333 (TypeContainer::Populate): Call RegisterRequiredImplementations
22334 before defining the methods.
22336 Create a mapping for method_builders_to_methods ahead of time
22337 instead of inside a tight loop.
22339 (::RequireMethods): Accept an object as the data to set into the
22340 hashtable so we can report interface vs abstract method mismatch.
22342 2001-10-03 Miguel de Icaza <miguel@ximian.com>
22344 * report.cs: Make all of it static.
22346 * rootcontext.cs: Drop object_type and value_type computations, as
22347 we have those in the TypeManager anyways.
22349 Drop report instance variable too, now it is a global.
22351 * driver.cs: Use try/catch on command line handling.
22353 Add --probe option to debug the error reporting system with a test
22356 * report.cs: Add support for exiting program when a probe
22357 condition is reached.
22359 2001-10-03 Ravi Pratap <ravi@ximian.com>
22361 * expression.cs (Binary::DoNumericPromotions): Fix the case when
22362 we do a forcible conversion regardless of type, to check if
22363 ForceConversion returns a null.
22365 (Binary::error19): Use location to report error.
22367 (Unary::error23): Use location here too.
22369 * ../errors/cs0019.cs : Check in.
22371 * ../errors/cs0023.cs : Check in.
22373 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
22374 case of a non-null MethodInfo object with a length of 0 !
22376 (Binary::ResolveOperator): Flag error if overload resolution fails to find
22377 an applicable member - according to the spec :-)
22378 Also fix logic to find members in base types.
22380 (Unary::ResolveOperator): Same here.
22382 (Unary::report23): Change name to error23 and make first argument a TypeContainer
22383 as I was getting thoroughly confused between this and error19 :-)
22385 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
22386 (::FindMostEncompassedType): Implement.
22387 (::FindMostEncompassingType): Implement.
22388 (::StandardConversionExists): Implement.
22390 (UserImplicitCast): Re-vamp. We now need info about most specific
22391 source and target types so that we can do the necessary conversions.
22393 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
22394 mathematical union with no duplicates.
22396 2001-10-03 Miguel de Icaza <miguel@ximian.com>
22398 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
22399 in order from base classes to child classes, so that we can in
22400 child classes look up in our parent for method names and
22401 attributes (required for handling abstract, virtual, new, override
22402 constructs: we need to instrospect our base class, and if we dont
22403 populate the classes in order, the introspection might be
22404 incorrect. For example, a method could query its parent before
22405 the parent has any methods and would determine that the parent has
22406 no abstract methods (while it could have had them)).
22408 (RootContext::CreateType): Record the order in which we define the
22411 2001-10-02 Miguel de Icaza <miguel@ximian.com>
22413 * class.cs (TypeContainer::Populate): Also method definitions can
22414 fail now, keep track of this.
22416 (TypeContainer::FindMembers): Implement support for
22417 DeclaredOnly/noDeclaredOnly flag.
22419 (Constructor::Emit) Return the ConstructorBuilder.
22421 (Method::Emit) Return the MethodBuilder.
22422 Check for abstract or virtual methods to be public.
22424 * rootcontext.cs (RootContext::CreateType): Register all the
22425 abstract methods required for the class to be complete and the
22426 interface methods that must be implemented.
22428 * cs-parser.jay: Report error 501 (method requires body if it is
22429 not marked abstract or extern).
22431 * expression.cs (TypeOf::Emit): Implement.
22433 * typemanager.cs: runtime_handle_type, new global type.
22435 * class.cs (Property::Emit): Generate code for properties.
22437 2001-10-02 Ravi Pratap <ravi@ximian.com>
22439 * expression.cs (Unary::ResolveOperator): Find operators on base type
22440 too - we now conform exactly to the spec.
22442 (Binary::ResolveOperator): Same here.
22444 * class.cs (Operator::Define): Fix minor quirk in the tests.
22446 * ../errors/cs0215.cs : Added.
22448 * ../errors/cs0556.cs : Added.
22450 * ../errors/cs0555.cs : Added.
22452 2001-10-01 Miguel de Icaza <miguel@ximian.com>
22454 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
22455 single integer which is really efficient
22457 2001-10-01 Ravi Pratap <ravi@ximian.com>
22459 * expression.cs (Expression::ImplicitUserConversion): Use location
22460 even in the case when we are examining True operators.
22462 * class.cs (Operator::Define): Perform extensive checks to conform
22463 with the rules for operator overloading in the spec.
22465 * expression.cs (Expression::ImplicitReferenceConversion): Implement
22466 some of the other conversions mentioned in the spec.
22468 * typemanager.cs (array_type): New static member for the System.Array built-in
22471 (cloneable_interface): For System.ICloneable interface.
22473 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
22474 we start resolving the tree and populating types.
22476 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
22478 2001-10-01 Miguel de Icaza <miguel@ximian.com>
22480 * expression.cs (Expression::ExprClassFromMemberInfo,
22481 Expression::Literalize): Create literal expressions from
22482 FieldInfos which are literals.
22484 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
22485 type casts, because they were wrong. The test suite in tests
22488 (ImplicitNumericConversion): ushort to ulong requires a widening
22491 Int32 constant to long requires widening cast as well.
22493 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
22494 for integers because the type on the stack is not i4.
22496 2001-09-30 Miguel de Icaza <miguel@ximian.com>
22498 * expression.cs (report118): require location argument.
22500 * parameter.cs: Do not dereference potential null value.
22502 * class.cs: Catch methods that lack the `new' keyword when
22503 overriding a name. Report warnings when `new' is used without
22504 anything being there to override.
22506 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
22508 * class.cs: Only add constructor to hashtable if it is non-null
22509 (as now constructors can fail on define).
22511 (TypeManager, Class, Struct): Take location arguments.
22513 Catch field instance initialization in structs as errors.
22515 accepting_filter: a new filter for FindMembers that is static so
22516 that we dont create an instance per invocation.
22518 (Constructor::Define): Catch errors where a struct constructor is
22521 * cs-parser.jay: Pass location information for various new
22524 * delegate.cs (Delegate): take a location argument.
22526 * driver.cs: Do not call EmitCode if there were problesm in the
22527 Definition of the types, as many Builders wont be there.
22529 * decl.cs (Decl::Decl): Require a location argument.
22531 * cs-tokenizer.cs: Handle properly hex constants that can not fit
22532 into integers, and find the most appropiate integer for it.
22534 * literal.cs: Implement ULongLiteral.
22536 * rootcontext.cs: Provide better information about the location of
22537 failure when CreateType fails.
22539 2001-09-29 Miguel de Icaza <miguel@ximian.com>
22541 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
22544 * expression.cs (Binary::CheckShiftArguments): Add missing type
22546 (Binary::ResolveOperator): Add type to the logical and and logical
22547 or, Bitwise And/Or and Exclusive Or code paths, it was missing
22550 (Binary::DoNumericPromotions): In the case where either argument
22551 is ulong (and most signed types combined with ulong cause an
22552 error) perform implicit integer constant conversions as well.
22554 2001-09-28 Miguel de Icaza <miguel@ximian.com>
22556 * expression.cs (UserImplicitCast): Method should always be
22558 (Invocation::BetterConversion): Simplified test for IntLiteral.
22560 (Expression::ImplicitNumericConversion): Split this routine out.
22561 Put the code that performs implicit constant integer conversions
22564 (Expression::Resolve): Become a wrapper around DoResolve so we can
22565 check eclass and type being set after resolve.
22567 (Invocation::Badness): Remove this dead function
22569 (Binary::ResolveOperator): Do not compute the expensive argumnets
22570 unless we have a union for it.
22572 (Probe::Emit): Is needs to do an isinst and then
22573 compare against null.
22575 (::CanConvert): Added Location argument. If the Location argument
22576 is null (Location.Null), then we do not report errors. This is
22577 used by the `probe' mechanism of the Explicit conversion. We do
22578 not want to generate an error for something that the user
22579 explicitly requested to be casted. But the pipeline for an
22580 explicit cast first tests for potential implicit casts.
22582 So for now, if the Location is null, it means `Probe only' to
22583 avoid adding another argument. Might have to revise this
22586 (ClassCast): New class used to type cast objects into arbitrary
22587 classes (used in Explicit Reference Conversions).
22589 Implement `as' as well.
22591 Reverted all the patches from Ravi below: they were broken:
22593 * The use of `level' as a mechanism to stop recursive
22594 invocations is wrong. That was there just to catch the
22595 bug with a strack trace but not as a way of addressing
22598 To fix the problem we have to *understand* what is going
22599 on and the interactions and come up with a plan, not
22600 just get things going.
22602 * The use of the type conversion cache that I proposed
22603 last night had an open topic: How does this work across
22604 protection domains. A user defined conversion might not
22605 be public in the location where we are applying the
22606 conversion, a different conversion might be selected
22607 (ie, private A->B (better) but public B->A (worse),
22608 inside A, A->B applies, but outside it, B->A will
22611 * On top of that (ie, even if the above is solved),
22612 conversions in a cache need to be abstract. Ie, `To
22613 convert from an Int to a Short use an OpcodeCast', not
22614 `To convert from an Int to a Short use the OpcodeCast on
22615 the variable 5' (which is what this patch was doing).
22617 2001-09-28 Ravi Pratap <ravi@ximian.com>
22619 * expression.cs (Invocation::ConversionExists): Re-write to use
22620 the conversion cache
22622 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
22623 cache all conversions done, not just user-defined ones.
22625 (Invocation::BetterConversion): The real culprit. Use ConversionExists
22626 to determine if a conversion exists instead of acutually trying to
22627 perform the conversion. It's faster too.
22629 (Expression::ConvertExplicit): Modify to use ConversionExists to check
22630 and only then attempt the implicit conversion.
22632 2001-09-28 Ravi Pratap <ravi@ximian.com>
22634 * expression.cs (ConvertImplicit): Use a cache for conversions
22635 already found. Check level of recursion and bail out if necessary.
22637 2001-09-28 Miguel de Icaza <miguel@ximian.com>
22639 * typemanager.cs (string_concat_string_string, string_concat_object_object):
22640 Export standard methods that we expect for string operations.
22642 * statement.cs (Block::UsageWarning): Track usage of variables and
22643 report the errors for not used variables.
22645 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
22648 2001-09-27 Miguel de Icaza <miguel@ximian.com>
22650 * codegen.cs: remove unnneded code
22652 * expression.cs: Removed BuiltinTypeAccess class
22654 Fix the order in which implicit conversions are
22657 The previous fixed dropped support for boxed conversions (adding a
22658 test to the test suite now)
22660 (UserImplicitCast::CanConvert): Remove test for source being null,
22661 that code is broken. We should not feed a null to begin with, if
22662 we do, then we should track the bug where the problem originates
22663 and not try to cover it up here.
22665 Return a resolved expression of type UserImplicitCast on success
22666 rather than true/false. Ravi: this is what I was talking about,
22667 the pattern is to use a static method as a "constructor" for
22670 Also, do not create arguments until the very last minute,
22671 otherwise we always create the arguments even for lookups that
22672 will never be performed.
22674 (UserImplicitCast::Resolve): Eliminate, objects of type
22675 UserImplicitCast are born in a fully resolved state.
22677 * typemanager.cs (InitCoreTypes): Init also value_type
22678 (System.ValueType).
22680 * expression.cs (Cast::Resolve): First resolve the child expression.
22682 (LValue): Add new method AddressOf to be used by
22685 Change the argument of Store to take an EmitContext instead of an
22686 ILGenerator, because things like FieldExpr need to be able to call
22687 their children expression to generate the instance code.
22689 (Expression::Error, Expression::Warning): Sugar functions for
22692 (Expression::MemberLookup): Accept a TypeContainer instead of a
22693 Report as the first argument.
22695 (Expression::ResolvePrimary): Killed. I still want to improve
22696 this as currently the code is just not right.
22698 (Expression::ResolveMemberAccess): Simplify, but it is still
22701 (Unary::Resolve): Catch errors in AddressOf operators.
22703 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
22704 index to a byte for the short-version, or the compiler will choose
22705 the wrong Emit call, which generates the wrong data.
22707 (ParameterReference::Emit, ::Store): same.
22709 (FieldExpr::AddressOf): Implement.
22711 * typemanager.cs: TypeManager: made public variable instead of
22714 * driver.cs: document --fatal.
22716 * report.cs (ErrorMessage, WarningMessage): new names for the old
22717 Error and Warning classes.
22719 * cs-parser.jay (member_access): Turn built-in access to types
22720 into a normal simplename
22722 2001-09-27 Ravi Pratap <ravi@ximian.com>
22724 * expression.cs (Invocation::BetterConversion): Fix to cope
22725 with q being null, since this was introducing a bug.
22727 * expression.cs (ConvertImplicit): Do built-in conversions first.
22729 2001-09-27 Ravi Pratap <ravi@ximian.com>
22731 * expression.cs (UserImplicitCast::Resolve): Fix bug.
22733 2001-09-27 Ravi Pratap <ravi@ximian.com>
22735 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
22736 I had introduced long ago (what's new ?).
22738 * expression.cs (UserImplicitCast::CanConvert): Static method to do
22739 the work of all the checking.
22740 (ConvertImplicit): Call CanConvert and only then create object if necessary.
22741 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
22743 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
22744 that is the right way.
22746 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
22747 overloading resolution. Use everywhere instead of cutting and pasting code.
22749 (Binary::ResolveOperator): Use MakeUnionSet.
22751 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
22752 we have to convert to bool types. Not complete yet.
22754 2001-09-27 Miguel de Icaza <miguel@ximian.com>
22756 * typemanager.cs (TypeManager::CSharpName): support ushort.
22758 * expression.cs (Expression::TryImplicitIntConversion): Attempts
22759 to provide an expression that performsn an implicit constant int
22760 conversion (section 6.1.6).
22761 (Expression::ConvertImplicitRequired): Reworked to include
22762 implicit constant expression conversions.
22764 (Expression::ConvertNumericExplicit): Finished.
22766 (Invocation::Emit): If InstanceExpression is null, then it means
22767 that we perform a call on this.
22769 2001-09-26 Miguel de Icaza <miguel@ximian.com>
22771 * expression.cs (Unary::Emit): Remove some dead code.
22772 (Probe): Implement Resolve and Emit for `is'.
22773 (Expression::ConvertImplicitRequired): Attempt to do constant
22774 expression conversions here. Maybe should be moved to
22775 ConvertImplicit, but I am not sure.
22776 (Expression::ImplicitLongConstantConversionPossible,
22777 Expression::ImplicitIntConstantConversionPossible): New functions
22778 that tell whether is it possible to apply an implicit constant
22779 expression conversion.
22781 (ConvertNumericExplicit): Started work on explicit numeric
22784 * cs-parser.jay: Update operator constants.
22786 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
22787 (Parameters::GetSignature): Hook up VerifyArgs here.
22788 (Parameters::VerifyArgs): Verifies that no two arguments have the
22791 * class.cs (Operator): Update the operator names to reflect the
22792 ones that the spec expects (as we are just stringizing the
22795 * expression.cs (Unary::ResolveOperator): Fix bug: Use
22796 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
22797 previous usage did only work for our methods.
22798 (Expression::ConvertImplicit): Handle decimal implicit numeric
22799 conversions as well.
22800 (Expression::InternalTypeConstructor): Used to invoke constructors
22801 on internal types for default promotions.
22803 (Unary::Emit): Implement special handling for the pre/post
22804 increment/decrement for overloaded operators, as they need to have
22805 the same semantics as the other operators.
22807 (Binary::ResolveOperator): ditto.
22808 (Invocation::ConversionExists): ditto.
22809 (UserImplicitCast::Resolve): ditto.
22811 2001-09-26 Ravi Pratap <ravi@ximian.com>
22813 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
22814 operator, return after emitting body. Regression tests pass again !
22816 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
22817 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
22818 (Invocation::OverloadResolve): Ditto.
22819 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
22821 * everywhere : update calls to the above methods accordingly.
22823 2001-09-26 Miguel de Icaza <miguel@ximian.com>
22825 * assign.cs (Assign): Make it inherit from ExpressionStatement.
22827 * expression.cs (ExpressionStatement): New base class used for
22828 expressions that can appear in statements, so that we can provide
22829 an alternate path to generate expression that do not leave a value
22832 (Expression::Emit, and all the derivatives): We no longer return
22833 whether a value is left on the stack or not. Every expression
22834 after being emitted leaves a single value on the stack.
22836 * codegen.cs (EmitContext::EmitStatementExpression): Use the
22837 facilties of ExpressionStatement if possible.
22839 * cs-parser.jay: Update statement_expression.
22841 2001-09-25 Miguel de Icaza <miguel@ximian.com>
22843 * driver.cs: Change the wording of message
22845 2001-09-25 Ravi Pratap <ravi@ximian.com>
22847 * expression.cs (Binary::ResolveOperator): Had forgottten to set
22848 the type of the expression to the return type of the method if
22849 we have an overloaded operator match ! The regression tests pass again !
22850 (Unary::ResolveOperator): Ditto.
22852 * expression.cs (Invocation::ConversionExists): Correct the member lookup
22853 to find "op_Implicit", not "implicit" ;-)
22854 (UserImplicitCast): New class to take care of user-defined implicit conversions.
22855 (ConvertImplicit, ForceConversion): Take TypeContainer argument
22857 * everywhere : Correct calls to the above accordingly.
22859 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
22860 (ConvertImplicit): Do user-defined conversion if it exists.
22862 2001-09-24 Miguel de Icaza <miguel@ximian.com>
22864 * assign.cs: track location.
22865 (Resolve): Use implicit conversions on assignment.
22867 * literal.cs: Oops. Not good, Emit of short access values should
22868 pass (Bytes) or the wrong argument will be selected.
22870 * expression.cs (Unary::Emit): Emit code for -expr.
22872 (Unary::ResolveOperator): Handle `Substract' for non-constants
22873 (substract from zero from the non-constants).
22874 Deal with Doubles as well.
22876 (Expression::ConvertImplicitRequired): New routine that reports an
22877 error if no implicit conversion exists.
22879 (Invocation::OverloadResolve): Store the converted implicit
22880 expressions if we make them
22882 2001-09-24 Ravi Pratap <ravi@ximian.com>
22884 * class.cs (ConstructorInitializer): Take a Location argument.
22885 (ConstructorBaseInitializer): Same here.
22886 (ConstructorThisInitializer): Same here.
22888 * cs-parser.jay : Update all calls accordingly.
22890 * expression.cs (Unary, Binary, New): Take location argument.
22891 Update accordingly everywhere.
22893 * cs-parser.jay : Update all calls to the above to take a location
22896 * class.cs : Ditto.
22898 2001-09-24 Ravi Pratap <ravi@ximian.com>
22900 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
22901 (Invocation::BetterConversion): Same here
22902 (Invocation::ConversionExists): Ditto.
22904 (Invocation::ConversionExists): Implement.
22906 2001-09-22 Ravi Pratap <ravi@ximian.com>
22908 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
22909 Also take an additional TypeContainer argument.
22911 * All over : Pass in TypeContainer as argument to OverloadResolve.
22913 * typemanager.cs (CSharpName): Update to check for the string type and return
22916 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
22919 2001-09-21 Ravi Pratap <ravi@ximian.com>
22921 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
22922 (Invocation::BetterFunction): Implement.
22923 (Invocation::BetterConversion): Implement.
22924 (Invocation::ConversionExists): Skeleton, no implementation yet.
22926 Okay, things work fine !
22928 2001-09-21 Miguel de Icaza <miguel@ximian.com>
22930 * typemanager.cs: declare and load enum_type, delegate_type and
22933 * expression.cs (Expression::Emit): Now emit returns a value that
22934 tells whether a value is left on the stack or not. This strategy
22935 might be reveted tomorrow with a mechanism that would address
22936 multiple assignments.
22937 (Expression::report118): Utility routine to report mismatches on
22940 (Unary::Report23): Report impossible type/operator combination
22943 (Unary::IsIncrementableNumber): Whether the type can be
22944 incremented or decremented with add.
22945 (Unary::ResolveOperator): Also allow enumerations to be bitwise
22947 (Unary::ResolveOperator): Implement ++, !, ~,
22949 (Invocation::Emit): Deal with new Emit convetion.
22951 * All Expression derivatives: Updated their Emit method to return
22952 whether they leave values on the stack or not.
22954 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
22955 stack for expressions that are statements.
22957 2001-09-20 Miguel de Icaza <miguel@ximian.com>
22959 * expression.cs (LValue): New interface. Must be implemented by
22961 (LocalVariableReference, ParameterReference, FieldExpr): Implement
22964 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
22965 interface for generating code, simplifies the code.
22967 2001-09-20 Ravi Pratap <ravi@ximian.com>
22969 * expression.cs (everywhere): Comment out return statements in ::Resolve
22970 methods to avoid the warnings.
22972 2001-09-20 Miguel de Icaza <miguel@ximian.com>
22974 * driver.cs (parse): Report error 2001 if we can not open the
22977 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
22980 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
22983 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
22984 otherwise nested blocks end up with the same index.
22986 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
22988 * expression.cs: Instead of having FIXMEs in the Resolve
22989 functions, throw exceptions so it is obvious that we are facing a
22992 * cs-parser.jay (invocation_expression): Pass Location information.
22994 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
22995 Use a basename for those routines because .NET does not like paths
22998 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
23001 2001-09-19 Miguel de Icaza <miguel@ximian.com>
23003 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
23004 are loading the correct data types (throws an exception if not).
23005 (TypeManager::InitCoreTypes): Use CoreLookupType
23007 * expression.cs (Unary::ResolveOperator): return the child
23008 expression for expressions which are just +expr.
23009 (Unary::ResolveOperator): Return negative literals for -LITERAL
23010 expressions (otherwise they are Unary {Literal}).
23011 (Invocation::Badness): Take into account `Implicit constant
23012 expression conversions'.
23014 * literal.cs (LongLiteral): Implement long literal class.
23015 (IntLiteral): export the `Value' of the intliteral.
23017 2001-09-19 Ravi Pratap <ravi@ximian.com>
23019 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
23021 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
23022 instead of 'Operator'
23024 * expression.cs (Binary::ResolveOperator): Update accordingly.
23025 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
23028 * cs-parser.jay (unary_expression): Update to use the new names.
23030 * gen-treedump.cs (GetUnary): Same here.
23032 * expression.cs (Unary::Resolve): Implement.
23033 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
23034 operators are found instead of making noise ;-)
23035 (Unary::ResolveOperator): New method to do precisely the same thing which
23036 Binary::ResolveOperator does for Binary expressions.
23037 (Unary.method, .Arguments): Add.
23038 (Unary::OperName): Implement.
23039 (Unary::ForceConversion): Copy and Paste !
23041 * class.cs (Operator::Define): Fix a small bug for the case when we have
23044 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
23045 for the inbuilt operators. Only overloading works for now ;-)
23047 2001-09-18 Miguel de Icaza <miguel@ximian.com>
23049 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
23050 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
23052 * expression.cs (This::Emit): Implement.
23053 (This::Resolve): Implement.
23054 (TypeOf:Resolve): Implement.
23055 (Expression::ResolveSimpleName): Add an implicit this to instance
23057 (MemberAccess::Resolve): Deal with Parameters and Fields.
23058 Bind instance variable to Field expressions.
23059 (FieldExpr::Instance): New field used to track the expression that
23060 represents the object instance.
23061 (FieldExpr::Resolve): Track potential errors from MemberLookup not
23063 (FieldExpr::Emit): Implement.
23065 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
23066 the last instruction contains a return opcode to avoid generating
23067 the last `ret' instruction (this generates correct code, and it is
23068 nice to pass the peverify output).
23070 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
23071 initializer for static and instance variables.
23072 (Constructor::Emit): Allow initializer to be null in the case of
23073 static constructors. Only emit initializer for instance
23076 (TypeContainer::FindMembers): Return a null array if there are no
23079 Also fix the code for the MemberTypes.Method branch, as it was not
23080 scanning that for operators (or tried to access null variables before).
23082 * assign.cs (Assign::Emit): Handle instance and static fields.
23086 * driver.cs: Stop compilation if there are parse errors.
23088 * cs-parser.jay (constructor_declaration): Provide default base
23089 initializer for non-static constructors.
23090 (constructor_declarator): Do not provide a default base
23091 initializers if none was specified.
23092 Catch the fact that constructors should not have parameters.
23094 * class.cs: Do not emit parent class initializers for static
23095 constructors, that should be flagged as an error.
23097 2001-09-18 Ravi Pratap <ravi@ximian.com>
23099 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
23100 Move back code into TypeContainer::Populate.
23102 2001-09-18 Ravi Pratap <ravi@ximian.com>
23104 * class.cs (TypeContainer::AddConstructor): Fix the check to
23105 compare against Name, not Basename.
23106 (Operator::OpType): Change Plus and Minus to Add and Subtract.
23108 * cs-parser.jay : Update accordingly.
23110 * class.cs (TypeContainer::FindMembers): For the case where we are searching
23111 for methods, don't forget to look into the operators too.
23112 (RegisterMethodBuilder): Helper method to take care of this for
23113 methods, constructors and operators.
23114 (Operator::Define): Completely revamp.
23115 (Operator.OperatorMethod, MethodName): New fields.
23116 (TypeContainer::Populate): Move the registering of builders into
23117 RegisterMethodBuilder.
23118 (Operator::Emit): Re-write.
23120 * expression.cs (Binary::Emit): Comment out code path to emit method
23121 invocation stuff for the case when we have a user defined operator. I am
23122 just not able to get it right !
23124 2001-09-17 Miguel de Icaza <miguel@ximian.com>
23126 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
23129 (Expression::MemberLookup): Provide a version that allows to
23130 specify the MemberTypes and BindingFlags.
23132 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
23133 so it was not fetching variable information from outer blocks.
23135 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
23136 Beforefieldinit as it was buggy.
23138 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
23139 that Ravi put here.
23141 * class.cs (Constructor::Emit): Only emit if block is not null.
23142 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
23143 deal with this by semantically definining it as if the user had
23146 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
23147 constructors as we now "emit" them at a higher level.
23149 (TypeContainer::DefineDefaultConstructor): Used to define the
23150 default constructors if none was provided.
23152 (ConstructorInitializer): Add methods Resolve and Emit.
23154 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
23156 2001-09-17 Ravi Pratap <ravi@ximian.com>
23158 * class.cs (TypeContainer::EmitDefaultConstructor): Register
23159 the default constructor builder with our hashtable for methodbuilders
23162 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
23163 and argument_count is 0 in which case we have a match.
23164 (Binary::ResolveOperator): More null checking and miscellaneous coding
23167 2001-09-17 Ravi Pratap <ravi@ximian.com>
23169 * rootcontext.cs (IsNameSpace): Compare against null.
23171 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
23173 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
23174 and Unary::Operator.
23176 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
23179 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
23180 we have overloaded operators.
23181 (Binary::ResolveOperator): Implement the part which does the operator overload
23184 * class.cs (Operator::Emit): Implement.
23185 (TypeContainer::Emit): Emit the operators we have too.
23187 * expression.cs (Binary::Emit): Update to emit the appropriate code for
23188 the case when we have a user-defined operator.
23190 2001-09-17 Miguel de Icaza <miguel@ximian.com>
23192 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
23194 2001-09-16 Ravi Pratap <ravi@ximian.com>
23196 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
23197 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
23198 (Constructor::Emit): Implement.
23199 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
23200 if we have no work to do.
23201 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
23204 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
23205 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
23207 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
23210 2001-09-15 Ravi Pratap <ravi@ximian.com>
23212 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
23214 (Tree::RecordNamespace): Method to do what the name says ;-)
23215 (Tree::Namespaces): Property to get at the namespaces hashtable.
23217 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
23220 * rootcontext.cs (IsNamespace): Fixed it :-)
23222 2001-09-14 Miguel de Icaza <miguel@ximian.com>
23224 * class.cs (TypeContainer::FindMembers): Add support for
23226 (MethodCore): New class that encapsulates both the shared aspects
23227 of a Constructor and a Method.
23228 (Method, Constructor): Factored pieces into MethodCore.
23230 * driver.cs: Added --fatal which makes errors throw exceptions.
23231 Load System assembly as well as part of the standard library.
23233 * report.cs: Allow throwing exceptions on errors for debugging.
23235 * modifiers.cs: Do not use `parent', instead use the real type
23236 container to evaluate permission settings.
23238 * class.cs: Put Ravi's patch back in. He is right, and we will
23239 have to cope with the
23241 2001-09-14 Ravi Pratap <ravi@ximian.com>
23243 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
23244 FamORAssem, not FamANDAssem.
23246 2001-09-14 Miguel de Icaza <miguel@ximian.com>
23248 * driver.cs: Added --parse option that only parses its input files
23251 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
23252 incorrect. IsTopLevel is not used to tell whether an object is
23253 root_types or not (that can be achieved by testing this ==
23254 root_types). But to see if this is a top-level *class* (not
23255 necessarly our "toplevel" container).
23257 2001-09-14 Ravi Pratap <ravi@ximian.com>
23259 * enum.cs (Enum::Define): Modify to call the Lookup method on the
23260 parent instead of a direct call to GetType.
23262 2001-09-14 Ravi Pratap <ravi@ximian.com>
23264 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
23265 Modifiers.TypeAttr. This should just be a call to that method.
23267 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
23268 object so that we can determine if we are top-level or not.
23270 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
23273 * enum.cs (Enum::Define): Ditto.
23275 * modifiers.cs (FieldAttr): Re-write.
23277 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
23278 (TypeContainer::HaveStaticConstructor): New property to provide access
23279 to precisely that info.
23281 * modifiers.cs (MethodAttr): Re-write.
23282 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
23284 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
23285 of top-level types as claimed.
23287 2001-09-13 Miguel de Icaza <miguel@ximian.com>
23289 * expression.cs (MemberLookup): Fruitless attempt to lookup
23290 constructors. Maybe I need to emit default constructors? That
23291 might be it (currently .NET emits this for me automatically).
23292 (Invocation::OverloadResolve): Cope with Arguments == null.
23293 (Invocation::EmitArguments): new function, shared by the new
23294 constructor and us.
23295 (Invocation::Emit): Handle static and instance methods. Emit
23296 proper call instruction for virtual or non-virtual invocations.
23297 (New::Emit): Implement.
23298 (New::Resolve): Implement.
23299 (MemberAccess:Resolve): Implement.
23300 (MethodGroupExpr::InstanceExpression): used conforming to the spec
23301 to track instances.
23302 (FieldExpr::Resolve): Set type.
23304 * support.cs: Handle empty arguments.
23306 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
23307 SimpleLookup): Auxiliary routines to help parse a qualifier
23310 Update qualifier_identifier rule.
23312 * codegen.cs: Removed debugging messages.
23314 * class.cs: Make this a global thing, this acts just as a "key" to
23315 objects that we might have around.
23317 (Populate): Only initialize method_builders_to_methods once.
23319 * expression.cs (PropertyExpr): Initialize type from the
23322 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
23323 Resolve pattern. Attempt to implicitly convert value to boolean.
23326 * expression.cs: Set the type for the int32/int32 argument case.
23327 (Binary::ResolveOperator): Set the return type to boolean for
23328 comparission operators
23330 * typemanager.cs: Remove debugging print code.
23332 (Invocation::Resolve): resolve type.
23334 * class.cs: Allocate a MemberInfo of the correct size, as the code
23335 elsewhere depends on the test to reflect the correct contents.
23337 (Method::) Keep track of parameters, due to System.Reflection holes
23339 (TypeContainer::Populate): Keep track of MethodBuilders to Method
23342 (TypeContainer::FindMembers): Use ArrayList and then copy an array
23343 of the exact size and return that.
23345 (Class::LookupMethodByBuilder): New function that maps
23346 MethodBuilders to its methods. Required to locate the information
23347 on methods because System.Reflection bit us again.
23349 * support.cs: New file, contains an interface ParameterData and
23350 two implementations: ReflectionParameters and InternalParameters
23351 used to access Parameter information. We will need to grow this
23354 * expression.cs (Invocation::GetParameterData): implement a cache
23355 and a wrapper around the ParameterData creation for methods.
23356 (Invocation::OverloadResolve): Use new code.
23358 2001-09-13 Ravi Pratap <ravi@ximian.com>
23360 * class.cs (TypeContainer::EmitField): Remove and move into
23361 (Field::Define): here and modify accordingly.
23362 (Field.FieldBuilder): New member.
23363 (TypeContainer::Populate): Update accordingly.
23364 (TypeContainer::FindMembers): Implement.
23366 2001-09-13 Miguel de Icaza <miguel@ximian.com>
23368 * statement.cs: (VariableInfo::VariableType): New field to be
23369 initialized with the full type once it is resolved.
23371 2001-09-12 Miguel de Icaza <miguel@ximian.com>
23373 * parameter.cs (GetParameterInfo): Use a type cache to compute
23374 things only once, and to reuse this information
23376 * expression.cs (LocalVariableReference::Emit): Implement.
23377 (OpcodeCast::Emit): fix.
23379 (ParameterReference::Resolve): Implement.
23380 (ParameterReference::Emit): Implement.
23382 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
23383 that are expressions need to stay as Expressions.
23385 * typemanager.cs (CSharpName): Returns the C# name of a type if
23388 * expression.cs (Expression::ConvertImplicit): New function that
23389 implements implicit type conversions.
23391 (Expression::ImplicitReferenceConversion): Implements implicit
23392 reference conversions.
23394 (EmptyCast): New type for transparent casts.
23396 (OpcodeCast): New type for casts of types that are performed with
23397 a sequence of bytecodes.
23399 (BoxedCast): New type used for casting value types into reference
23400 types. Emits a box opcode.
23402 (Binary::DoNumericPromotions): Implements numeric promotions of
23403 and computation of the Binary::Type.
23405 (Binary::EmitBranchable): Optimization.
23407 (Binary::Emit): Implement code emission for expressions.
23409 * typemanager.cs (TypeManager): Added two new core types: sbyte
23412 2001-09-12 Ravi Pratap <ravi@ximian.com>
23414 * class.cs (TypeContainer::FindMembers): Method which does exactly
23415 what Type.FindMembers does, only we don't have to use reflection. No
23416 implementation yet.
23418 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
23419 typecontainer objects as we need to get at them.
23420 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
23422 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
23423 typecontainer object.
23425 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
23426 of just a Report object.
23428 2001-09-11 Ravi Pratap <ravi@ximian.com>
23430 * class.cs (Event::Define): Go back to using the prefixes "add_" and
23432 (TypeContainer::Populate): Now define the delegates of the type too.
23433 (TypeContainer.Delegates): Property to access the list of delegates defined
23436 * delegates.cs (Delegate::Define): Implement partially.
23438 * modifiers.cs (TypeAttr): Handle more flags.
23440 2001-09-11 Ravi Pratap <ravi@ximian.com>
23442 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
23444 (Operator::Define): Re-write logic to get types by using the LookupType method
23445 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
23446 (Indexer::Define): Ditto.
23447 (Event::Define): Ditto.
23448 (Property::Define): Ditto.
23450 2001-09-10 Ravi Pratap <ravi@ximian.com>
23452 * class.cs (TypeContainer::Populate): Now define operators too.
23453 (TypeContainer.Operators): New property to access the list of operators
23455 (Operator.OperatorMethodBuilder): New member to hold the method builder
23456 for the operator we are defining.
23457 (Operator::Define): Implement.
23459 2001-09-10 Ravi Pratap <ravi@ximian.com>
23461 * class.cs (Event::Define): Make the prefixes of the accessor methods
23462 addOn_ and removeOn_
23464 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
23465 of the location being passed in too. Ideally, this should go later since all
23466 error reporting should be done through the Report object.
23468 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
23469 (Populate): Iterate thru the indexers we have and define them too.
23470 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
23471 for the get and set accessors.
23472 (Indexer::Define): Implement.
23474 2001-09-09 Miguel de Icaza <miguel@ximian.com>
23476 * expression.cs (Binary::Resolve): Beginning of it. I scratched
23477 my previous implementation, did not work.
23479 * typemanager.cs: Add a couple of missing types (the longs).
23481 * literal.cs: Use TypeManager.bool_type instead of getting it.
23483 * expression.cs (EventExpr): New kind of expressions.
23484 (Expressio::ExprClassFromMemberInfo): finish
23486 2001-09-08 Miguel de Icaza <miguel@ximian.com>
23488 * assign.cs: Emit stores to static fields differently.
23490 2001-09-08 Ravi Pratap <ravi@ximian.com>
23492 * Merge in changes and adjust code to tackle conflicts. Backed out my
23493 code in Assign::Resolve ;-)
23495 2001-09-08 Ravi Pratap <ravi@ximian.com>
23497 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
23498 instead Report.Error and also pass in the location.
23499 (CSharpParser::Lexer): New readonly property to return the reference
23500 to the Tokenizer object.
23501 (declare_local_variables): Use Report.Error with location instead of plain
23505 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
23506 (Operator.CheckBinaryOperator): Ditto.
23508 * cs-parser.jay (operator_declarator): Update accordingly.
23510 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
23511 (CheckBinaryOperator): Same here.
23513 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
23514 on the name without any prefixes of namespace names etc. This is because we
23515 already might have something already fully qualified like
23516 'System.Console.WriteLine'
23518 * assign.cs (Resolve): Begin implementation. Stuck ;-)
23520 2001-09-07 Ravi Pratap <ravi@ximian.com>
23522 * cs-tokenizer.cs (location): Return a string which also contains
23525 * expression.cs (ElementAccess): New class for expressions of the
23526 type 'element access.'
23527 (BaseAccess): New class for expressions of the type 'base access.'
23528 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
23531 * cs-parser.jay (element_access): Implement action.
23532 (base_access): Implement actions.
23533 (checked_expression, unchecked_expression): Implement.
23535 * cs-parser.jay (local_variable_type): Correct and implement.
23536 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
23538 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
23540 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
23541 name and the specifiers.
23543 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
23545 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
23546 making them all public ;-)
23548 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
23551 2001-09-07 Miguel de Icaza <miguel@ximian.com>
23553 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
23555 (FieldExpr, PropertyExprs): New resolved expressions.
23556 (SimpleName::MemberStaticCheck): Perform static checks for access
23557 to non-static fields on static methods. Maybe this should be
23558 generalized for MemberAccesses.
23559 (SimpleName::ResolveSimpleName): More work on simple name
23562 * cs-parser.jay (primary_expression/qualified_identifier): track
23563 the parameter index.
23565 * codegen.cs (CodeGen::Save): Catch save exception, report error.
23566 (EmitContext::EmitBoolExpression): Chain to expression generation
23567 instead of temporary hack.
23568 (::EmitStatementExpression): Put generic expression code generation.
23570 * assign.cs (Assign::Emit): Implement variable assignments to
23571 local variables, parameters and fields.
23573 2001-09-06 Miguel de Icaza <miguel@ximian.com>
23575 * statement.cs (Block::GetVariableInfo): New method, returns the
23576 VariableInfo for a variable name in a block.
23577 (Block::GetVariableType): Implement in terms of GetVariableInfo
23579 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
23580 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
23582 2001-09-06 Ravi Pratap <ravi@ximian.com>
23584 * cs-parser.jay (operator_declaration): Continue on my quest : update
23585 to take attributes argument.
23586 (event_declaration): Ditto.
23587 (enum_declaration): Ditto.
23588 (indexer_declaration): Ditto.
23590 * class.cs (Operator::Operator): Update constructor accordingly.
23591 (Event::Event): Ditto.
23593 * delegate.cs (Delegate::Delegate): Same here.
23595 * enum.cs (Enum::Enum): Same here.
23597 2001-09-05 Ravi Pratap <ravi@ximian.com>
23599 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
23601 * ../tests/cs0658.cs : New file to demonstrate error 0658.
23603 * attribute.cs (Attributes): New class to encapsulate all attributes which were
23604 being passed around as an arraylist.
23605 (Attributes::AddAttribute): Method to add attribute sections.
23607 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
23608 (struct_declaration): Update accordingly.
23609 (constant_declaration): Update.
23610 (field_declaration): Update.
23611 (method_header): Update.
23612 (fixed_parameter): Update.
23613 (parameter_array): Ditto.
23614 (property_declaration): Ditto.
23615 (destructor_declaration): Ditto.
23617 * class.cs (Struct::Struct): Update constructors accordingly.
23618 (Class::Class): Ditto.
23619 (Field::Field): Ditto.
23620 (Method::Method): Ditto.
23621 (Property::Property): Ditto.
23622 (TypeContainer::OptAttribute): update property's return type.
23624 * interface.cs (Interface.opt_attributes): New member.
23625 (Interface::Interface): Update to take the extra Attributes argument.
23627 * parameter.cs (Parameter::Parameter): Ditto.
23629 * constant.cs (Constant::Constant): Ditto.
23631 * interface.cs (InterfaceMemberBase): New OptAttributes field.
23632 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
23633 the attributes as a parameter.
23634 (InterfaceProperty): Update constructor call.
23635 (InterfaceEvent): Ditto.
23636 (InterfaceMethod): Ditto.
23637 (InterfaceIndexer): Ditto.
23639 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
23640 pass the attributes too.
23641 (interface_event_declaration): Ditto.
23642 (interface_property_declaration): Ditto.
23643 (interface_method_declaration): Ditto.
23644 (interface_declaration): Ditto.
23646 2001-09-05 Miguel de Icaza <miguel@ximian.com>
23648 * class.cs (Method::Define): Track the "static Main" definition to
23649 create an entry point.
23651 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
23652 EntryPoint if we find it.
23654 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
23655 (EmitContext::ig): Make this variable public.
23657 * driver.cs: Make the default output file be the first file name
23658 with the .exe extension.
23660 Detect empty compilations
23662 Handle various kinds of output targets. Handle --target and
23663 rename -t to --dumper.
23665 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
23666 methods inherited from Expression return now an Expression. This
23667 will is used during the tree rewriting as we resolve them during
23670 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
23671 the spec. Missing entirely is the information about
23672 accessability of elements of it.
23674 (Expression::ExprClassFromMemberInfo): New constructor for
23675 Expressions that creates a fully initialized Expression based on
23676 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
23679 (Invocation::Resolve): Begin implementing resolution of invocations.
23681 * literal.cs (StringLiteral): Implement Emit.
23683 2001-09-05 Ravi Pratap <ravi@ximian.com>
23685 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
23688 2001-09-04 Ravi Pratap <ravi@ximian.com>
23690 * cs-parser.jay (attribute_arguments): Implement actions.
23691 (attribute): Fix bug in production. Implement action.
23692 (attribute_list): Implement.
23693 (attribute_target): Implement.
23694 (attribute_target_specifier, opt_target_specifier): Implement
23695 (CheckAttributeTarget): New method to check if the attribute target
23697 (attribute_section): Implement.
23698 (opt_attributes): Implement.
23700 * attribute.cs : New file to handle attributes.
23701 (Attribute): Class to hold attribute info.
23703 * cs-parser.jay (opt_attribute_target_specifier): Remove production
23704 (attribute_section): Modify production to use 2 different rules to
23705 achieve the same thing. 1 s/r conflict down !
23706 Clean out commented, useless, non-reducing dimension_separator rules.
23708 * class.cs (TypeContainer.attributes): New member to hold list
23709 of attributes for a type.
23710 (Struct::Struct): Modify to take one more argument, the attribute list.
23711 (Class::Class): Ditto.
23712 (Field::Field): Ditto.
23713 (Method::Method): Ditto.
23714 (Property::Property): Ditto.
23716 * cs-parser.jay (struct_declaration): Update constructor call to
23717 pass in the attributes too.
23718 (class_declaration): Ditto.
23719 (constant_declaration): Ditto.
23720 (field_declaration): Ditto.
23721 (method_header): Ditto.
23722 (fixed_parameter): Ditto.
23723 (parameter_array): Ditto.
23724 (property_declaration): Ditto.
23726 * constant.cs (Constant::Constant): Update constructor similarly.
23727 Use System.Collections.
23729 * parameter.cs (Parameter::Parameter): Update as above.
23731 2001-09-02 Ravi Pratap <ravi@ximian.com>
23733 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
23734 (TypeContainer.delegates): New member to hold list of delegates.
23736 * cs-parser.jay (delegate_declaration): Implement the action correctly
23737 this time as I seem to be on crack ;-)
23739 2001-09-02 Miguel de Icaza <miguel@ximian.com>
23741 * rootcontext.cs (RootContext::IsNamespace): new function, used to
23742 tell whether an identifier represents a namespace.
23744 * expression.cs (NamespaceExpr): A namespace expression, used only
23745 temporarly during expression resolution.
23746 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
23747 utility functions to resolve names on expressions.
23749 2001-09-01 Miguel de Icaza <miguel@ximian.com>
23751 * codegen.cs: Add hook for StatementExpressions.
23753 * class.cs: Fix inverted test for static flag in methods.
23755 2001-09-02 Ravi Pratap <ravi@ximian.com>
23757 * class.cs (Operator::CheckUnaryOperator): Correct error number used
23758 to make it coincide with MS' number.
23759 (Operator::CheckBinaryOperator): Ditto.
23761 * ../errors/errors.txt : Remove error numbers added earlier.
23763 * ../errors/cs1019.cs : Test case for error # 1019
23765 * ../errros/cs1020.cs : Test case for error # 1020
23767 * cs-parser.jay : Clean out commented cruft.
23768 (dimension_separators, dimension_separator): Comment out. Ostensibly not
23769 used anywhere - non-reducing rule.
23770 (namespace_declarations): Non-reducing rule - comment out.
23772 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
23773 with TypeContainer::AddEnum.
23775 * delegate.cs : New file for delegate handling classes.
23776 (Delegate): Class for declaring delegates.
23778 * makefile : Update.
23780 * cs-parser.jay (delegate_declaration): Implement.
23782 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
23784 * class.cs (Event::Define): Implement.
23785 (Event.EventBuilder): New member.
23787 * class.cs (TypeContainer::Populate): Update to define all enums and events
23789 (Events): New property for the events arraylist we hold. Shouldn't we move to using
23790 readonly fields for all these cases ?
23792 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
23794 * class.cs (Property): Revamp to use the convention of making fields readonly.
23795 Accordingly modify code elsewhere.
23797 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
23798 the Define method of the Property class.
23800 * class.cs : Clean up applied patch and update references to variables etc. Fix
23802 (TypeContainer::Populate): Update to define all the properties we have. Also
23803 define all enumerations.
23805 * enum.cs (Define): Implement.
23807 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
23809 * cs-parser.jay (overloadable_operator): The semantic value is an
23810 enum of the Operator class.
23811 (operator_declarator): Implement actions.
23812 (operator_declaration): Implement.
23814 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
23815 validity of definitions.
23816 (Operator::CheckBinaryOperator): Static method to check for binary operators
23817 (TypeContainer::AddOperator): New method to add an operator to a type.
23819 * cs-parser.jay (indexer_declaration): Added line to actually call the
23820 AddIndexer method so it gets added ;-)
23822 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
23823 already taken care of by the MS compiler ?
23825 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
23827 * class.cs (Operator): New class for operator declarations.
23828 (Operator::OpType): Enum for the various operators.
23830 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
23832 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
23833 ostensibly handle this in semantic analysis.
23835 * cs-parser.jay (general_catch_clause): Comment out
23836 (specific_catch_clauses, specific_catch_clause): Ditto.
23837 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
23838 (catch_args, opt_catch_args): New productions.
23839 (catch_clause): Rewrite to use the new productions above
23840 (catch_clauses): Modify accordingly.
23841 (opt_catch_clauses): New production to use in try_statement
23842 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
23843 and re-write the code in the actions to extract the specific and
23844 general catch clauses by being a little smart ;-)
23846 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
23847 Hooray, try and catch statements parse fine !
23849 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
23851 * statement.cs (Block::GetVariableType): Fix logic to extract the type
23852 string from the hashtable of variables.
23854 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
23855 I end up making that mistake ;-)
23856 (catch_clauses): Fixed gross error which made Key and Value of the
23857 DictionaryEntry the same : $1 !!
23859 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
23861 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
23863 * cs-parser.jay (event_declaration): Correct to remove the semicolon
23864 when the add and remove accessors are specified.
23866 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
23868 * cs-parser.jay (IndexerDeclaration): New helper class to hold
23869 information about indexer_declarator.
23870 (indexer_declarator): Implement actions.
23871 (parsing_indexer): New local boolean used to keep track of whether
23872 we are parsing indexers or properties. This is necessary because
23873 implicit_parameters come into picture even for the get accessor in the
23874 case of an indexer.
23875 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
23877 * class.cs (Indexer): New class for indexer declarations.
23878 (TypeContainer::AddIndexer): New method to add an indexer to a type.
23879 (TypeContainer::indexers): New member to hold list of indexers for the
23882 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
23884 * cs-parser.jay (add_accessor_declaration): Implement action.
23885 (remove_accessor_declaration): Implement action.
23886 (event_accessors_declaration): Implement
23887 (variable_declarators): swap statements for first rule - trivial.
23889 * class.cs (Event): New class to hold information about event
23891 (TypeContainer::AddEvent): New method to add an event to a type
23892 (TypeContainer::events): New member to hold list of events.
23894 * cs-parser.jay (event_declaration): Implement actions.
23896 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
23898 * cs-parser.jay (dim_separators): Implement. Make it a string
23899 concatenating all the commas together, just as they appear.
23900 (opt_dim_separators): Modify accordingly
23901 (rank_specifiers): Update accordingly. Basically do the same
23902 thing - instead, collect the brackets here.
23903 (opt_rank_sepcifiers): Modify accordingly.
23904 (array_type): Modify to actually return the complete type string
23905 instead of ignoring the rank_specifiers.
23906 (expression_list): Implement to collect the expressions
23907 (variable_initializer): Implement. We make it a list of expressions
23908 essentially so that we can handle the array_initializer case neatly too.
23909 (variable_initializer_list): Implement.
23910 (array_initializer): Make it a list of variable_initializers
23911 (opt_array_initializer): Modify accordingly.
23913 * expression.cs (New::NType): Add enumeration to help us
23914 keep track of whether we have an object/delegate creation
23915 or an array creation.
23916 (New:NewType, New::Rank, New::Indices, New::Initializers): New
23917 members to hold data about array creation.
23918 (New:New): Modify to update NewType
23919 (New:New): New Overloaded contructor for the array creation
23922 * cs-parser.jay (array_creation_expression): Implement to call
23923 the overloaded New constructor.
23925 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
23927 * class.cs (TypeContainer::Constructors): Return member
23928 constructors instead of returning null.
23930 2001-08-26 Miguel de Icaza <miguel@ximian.com>
23932 * typemanager.cs (InitCoreTypes): Initialize the various core
23933 types after we have populated the type manager with the user
23934 defined types (this distinction will be important later while
23935 compiling corlib.dll)
23937 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
23938 on Expression Classification. Now all expressions have a method
23939 `Resolve' and a method `Emit'.
23941 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
23942 generation from working. Also add some temporary debugging
23945 2001-08-24 Miguel de Icaza <miguel@ximian.com>
23947 * codegen.cs: Lots of code generation pieces. This is only the
23948 beginning, will continue tomorrow with more touches of polish. We
23949 handle the fundamentals of if, while, do, for, return. Others are
23950 trickier and I need to start working on invocations soon.
23952 * gen-treedump.cs: Bug fix, use s.Increment here instead of
23955 * codegen.cs (EmitContext): New struct, used during code
23956 emission to keep a context. Most of the code generation will be
23959 * cs-parser.jay: Add embedded blocks to the list of statements of
23960 this block. So code generation proceeds in a top down fashion.
23962 2001-08-23 Miguel de Icaza <miguel@ximian.com>
23964 * statement.cs: Add support for multiple child blocks.
23966 2001-08-22 Miguel de Icaza <miguel@ximian.com>
23968 * codegen.cs (EmitCode): New function, will emit the code for a
23969 Block of code given a TypeContainer and its ILGenerator.
23971 * statement.cs (Block): Standard public readonly optimization.
23972 (Block::Block constructors): Link children.
23973 (Block::Child): Child Linker.
23974 (Block::EmitVariables): Emits IL variable declarations.
23976 * class.cs: Drop support for MethodGroups here, delay until
23978 (Method::): Applied the same simplification that I did before, and
23979 move from Properties to public readonly fields.
23980 (Method::ParameterTypes): Returns the parameter types for the
23981 function, and implements a cache that will be useful later when I
23982 do error checking and the semantic analysis on the methods is
23984 (Constructor::GetCallingConvention): Renamed from CallingConvetion
23985 and made a method, optional argument tells whether this is a class
23986 or a structure to apply the `has-this' bit.
23987 (Method::GetCallingConvention): Implement, returns the calling
23989 (Method::Define): Defines the type, a second pass is performed
23990 later to populate the methods.
23992 (Constructor::ParameterTypes): implement a cache similar to the
23993 one on Method::ParameterTypes, useful later when we do semantic
23996 (TypeContainer::EmitMethod): New method. Emits methods.
23998 * expression.cs: Removed MethodGroup class from here.
24000 * parameter.cs (Parameters::GetCallingConvention): new method.
24002 2001-08-21 Miguel de Icaza <miguel@ximian.com>
24004 * class.cs (TypeContainer::Populate): Drop RootContext from the
24007 (Constructor::CallingConvention): Returns the calling convention.
24008 (Constructor::ParameterTypes): Returns the constructor parameter
24011 (TypeContainer::AddConstructor): Keep track of default constructor
24012 and the default static constructor.
24014 (Constructor::) Another class that starts using `public readonly'
24015 instead of properties.
24017 (Constructor::IsDefault): Whether this is a default constructor.
24019 (Field::) use readonly public fields instead of properties also.
24021 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
24022 track of static constructors; If none is used, turn on
24023 BeforeFieldInit in the TypeAttributes.
24025 * cs-parser.jay (opt_argument_list): now the return can be null
24026 for the cases where there are no arguments.
24028 (constructor_declarator): If there is no implicit `base' or
24029 `this', then invoke the default parent constructor.
24031 * modifiers.cs (MethodAttr): New static function maps a set of
24032 modifiers flags into a MethodAttributes enum
24033 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
24034 MethodAttr, TypeAttr to represent the various mappings where the
24035 modifiers are used.
24036 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
24038 2001-08-19 Miguel de Icaza <miguel@ximian.com>
24040 * parameter.cs (GetParameterInfo): Fix bug where there would be no
24043 * interface.cs (PopulateIndexer): Implemented the code generator
24044 for interface indexers.
24046 2001-08-17 Miguel de Icaza <miguel@ximian.com>
24048 * interface.cs (InterfaceMemberBase): Now we track the new status
24051 (PopulateProperty): Implement property population. Woohoo! Got
24052 Methods and Properties going today.
24054 Removed all the properties for interfaces, and replaced them with
24055 `public readonly' fields.
24057 2001-08-16 Miguel de Icaza <miguel@ximian.com>
24059 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
24060 initialize their hashtables/arraylists only when they are needed
24061 instead of doing this always.
24063 * parameter.cs: Handle refs and out parameters.
24065 * cs-parser.jay: Use an ArrayList to construct the arguments
24066 instead of the ParameterCollection, and then cast that to a
24069 * parameter.cs: Drop the use of ParameterCollection and use
24070 instead arrays of Parameters.
24072 (GetParameterInfo): Use the Type, not the Name when resolving
24075 2001-08-13 Miguel de Icaza <miguel@ximian.com>
24077 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
24078 and instead use public readonly fields.
24080 * class.cs: Put back walking code for type containers.
24082 2001-08-11 Miguel de Icaza <miguel@ximian.com>
24084 * class.cs (MakeConstant): Code to define constants.
24086 * rootcontext.cs (LookupType): New function. Used to locate types
24089 2001-08-08 Miguel de Icaza <miguel@ximian.com>
24091 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
24092 this System.Reflection code is. Kudos to Microsoft
24094 * typemanager.cs: Implement a type cache and avoid loading all
24095 types at boot time. Wrap in LookupType the internals. This made
24096 the compiler so much faster. Wow. I rule!
24098 * driver.cs: Make sure we always load mscorlib first (for
24099 debugging purposes, nothing really important).
24101 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
24102 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
24104 * rootcontext.cs: Lookup types on their namespace; Lookup types
24105 on namespaces that have been imported using the `using' keyword.
24107 * class.cs (TypeContainer::TypeAttr): Virtualize.
24108 (Class::TypeAttr): Return attributes suitable for this bad boy.
24109 (Struct::TypeAttr): ditto.
24110 Handle nested classes.
24111 (TypeContainer::) Remove all the type visiting code, it is now
24112 replaced with the rootcontext.cs code
24114 * rootcontext.cs (GetClassBases): Added support for structs.
24116 2001-08-06 Miguel de Icaza <miguel@ximian.com>
24118 * interface.cs, statement.cs, class.cs, parameter.cs,
24119 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
24120 Drop use of TypeRefs, and use strings instead.
24122 2001-08-04 Miguel de Icaza <miguel@ximian.com>
24126 * class.cs (Struct::Struct): set the SEALED flags after
24127 checking the modifiers.
24128 (TypeContainer::TypeAttr): new property, returns the
24129 TypeAttributes for a class.
24131 * cs-parser.jay (type_list): Oops, list production was creating a
24132 new list of base types.
24134 * rootcontext.cs (StdLib): New property.
24135 (GetInterfaceTypeByName): returns an interface by type name, and
24136 encapsulates error handling here.
24137 (GetInterfaces): simplified.
24138 (ResolveTree): Encapsulated all the tree resolution here.
24139 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
24142 * driver.cs: Add support for --nostdlib, to avoid loading the
24143 default assemblies.
24144 (Main): Do not put tree resolution here.
24146 * rootcontext.cs: Beginning of the class resolution.
24148 2001-08-03 Miguel de Icaza <miguel@ximian.com>
24150 * rootcontext.cs: Provide better error reporting.
24152 * cs-parser.jay (interface_base): set our $$ to be interfaces.
24154 * rootcontext.cs (CreateInterface): Handle the case where there
24155 are no parent interfaces.
24157 (CloseTypes): Routine to flush types at the end.
24158 (CreateInterface): Track types.
24159 (GetInterfaces): Returns an array of Types from the list of
24160 defined interfaces.
24162 * typemanager.c (AddUserType): Mechanism to track user types (puts
24163 the type on the global type hash, and allows us to close it at the
24166 2001-08-02 Miguel de Icaza <miguel@ximian.com>
24168 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
24169 RecordInterface instead.
24171 * cs-parser.jay: Updated to reflect changes above.
24173 * decl.cs (Definition): Keep track of the TypeBuilder type that
24174 represents this type here. Not sure we will use it in the long
24175 run, but wont hurt for now.
24177 * driver.cs: Smaller changes to accomodate the new code.
24179 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
24182 * rootcontext.cs (CreateInterface): New method, used to create
24183 the System.TypeBuilder type for interfaces.
24184 (ResolveInterfaces): new entry point to resolve the interface
24186 (CodeGen): Property, used to keep track of the code generator.
24188 2001-07-26 Miguel de Icaza <miguel@ximian.com>
24190 * cs-parser.jay: Add a second production for delegate_declaration
24193 (enum_body): Put an opt_comma here instead of putting it on
24194 enum_body or enum_member_declarations so we can handle trailing
24195 commas on enumeration members. Gets rid of a shift/reduce.
24197 (type_list): Need a COMMA in the middle.
24199 (indexer_declaration): Tell tokenizer to recognize get/set
24201 * Remove old targets.
24203 * Re-add the parser target.
24205 2001-07-13 Simon Cozens <simon@simon-cozens.org>
24207 * cs-parser.jay: Add precendence rules for a number of operators
24208 ot reduce the number of shift/reduce conflicts in the grammar.
24210 2001-07-17 Miguel de Icaza <miguel@ximian.com>
24212 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
24215 Get rid of old crufty code.
24217 * rootcontext.cs: Use this to keep track of the parsed
24218 representation and the defined types available to the program.
24220 * gen-treedump.cs: adjust for new convention.
24222 * type.cs: Split out the type manager, and the assembly builder
24225 * typemanager.cs: the type manager will live here now.
24227 * cil-codegen.cs: And the code generator here.
24229 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
24231 * makefile: Fixed up for easy making.
24233 2001-07-13 Simon Cozens <simon@simon-cozens.org>
24235 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
24238 (unary_expression): Expand pre_increment_expression and
24239 post_decrement_expression to reduce a shift/reduce.
24241 2001-07-11 Simon Cozens
24243 * cs-tokenizer.cs: Hex numbers should begin with a 0.
24245 Improve allow_keyword_as_indent name.
24247 2001-06-19 Miguel de Icaza <miguel@ximian.com>
24249 * Adjustments for Beta2.
24251 2001-06-13 Miguel de Icaza <miguel@ximian.com>
24253 * decl.cs: Added `Define' abstract method.
24254 (InTransit): new property, used to catch recursive definitions.
24256 * interface.cs: Implement `Define'.
24258 * modifiers.cs: Map Modifiers.constants to
24259 System.Reflection.TypeAttribute flags.
24261 * class.cs: Keep track of types and user-defined types.
24262 (BuilderInit): New method for creating an assembly
24263 (ResolveType): New function to launch the resolution process, only
24264 used by interfaces for now.
24266 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
24267 that are inserted into the name space.
24269 2001-06-08 Miguel de Icaza <miguel@ximian.com>
24271 * ARGH. I have screwed up my tree so many times due to the use of
24272 rsync rather than using CVS. Going to fix this at once.
24274 * driver.cs: Objetify driver. Load assemblies, use assemblies to
24277 2001-06-07 Miguel de Icaza <miguel@ximian.com>
24279 * Experiment successful: Use System.Type rather that our own
24282 2001-05-25 Miguel de Icaza <miguel@ximian.com>
24284 * cs-parser.jay: Removed nsAliases from here.
24286 Use new namespaces, handle `using XXX;'
24288 * namespace.cs: Reimplemented namespace handling, use a recursive
24289 definition of the class. Now we can keep track of using clauses
24290 and catch invalid using clauses.
24292 2001-05-24 Miguel de Icaza <miguel@ximian.com>
24294 * gen-treedump.cs: Adapted for all the renaming.
24296 * expression.cs (Expression): this class now has a Type property
24297 which returns an expression Type.
24299 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
24300 `Type', as this has a different meaning now in the base
24302 2001-05-22 Miguel de Icaza <miguel@ximian.com>
24304 * interface.cs, class.cs: Removed from all the sources the
24305 references to signature computation, as we can not do method
24306 signature computation during the parsing time, as we are not
24307 trying to solve at that point distinguishing:
24311 void a (NS.Blah x) {}
24314 Which depending on the context might be valid or not, as we do not
24315 know if Blah is the same thing as NS.Blah at that point.
24317 * Redid everything so the code uses TypeRefs now instead of
24318 Types. TypeRefs are just temporary type placeholders, that need
24319 to be resolved. They initially have a pointer to a string and the
24320 current scope in which they are used. This is used later by the
24321 compiler to resolve the reference to an actual Type.
24323 * DeclSpace is no longer a CIR.Type, and neither are
24324 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
24325 are all DeclSpaces, but no Types.
24327 * type.cs (TypeRefManager): This implements the TypeRef manager,
24328 which keeps track of all the types that need to be resolved after
24329 the parsing has finished.
24331 2001-05-13 Miguel de Icaza <miguel@ximian.com>
24333 * ARGH. We are going to have to store `foreach' as a class rather
24334 than resolving it, as we need to verify error 1579 after name
24335 resolution. *OR* we could keep a flag that says `This request to
24336 IEnumerator comes from a foreach statement' which we can then use
24337 to generate the error.
24339 2001-05-10 Miguel de Icaza <miguel@ximian.com>
24341 * class.cs (TypeContainer.AddMethod): we now add methods to the
24342 MethodGroup instead of the method hashtable.
24344 * expression.cs: Add MethodGroup abstraction, which gets us one
24345 step closer to the specification in the way we handle method
24348 * cs-parser.jay (primary_expression): qualified_identifier now
24349 tried to match up an identifier to a local variable reference or
24350 to a parameter reference.
24352 current_local_parameters is now a parser global variable that
24353 points to the current parameters for the block, used during name
24356 (property_declaration): Now creates an implicit `value' argument to
24359 2001-05-09 Miguel de Icaza <miguel@ximian.com>
24361 * parameter.cs: Do not use `param' arguments as part of the
24362 signature, per the spec.
24364 2001-05-08 Miguel de Icaza <miguel@ximian.com>
24366 * decl.cs: Base class for classes, structs and interfaces. This
24367 is the "Declaration Space"
24369 * cs-parser.jay: Use CheckDef for checking declaration errors
24370 instead of having one on each function.
24372 * class.cs: Factor out some code for handling error handling in
24373 accordance to the "Declarations" section in the "Basic Concepts"
24374 chapter in the ECMA C# spec.
24376 * interface.cs: Make all interface member classes derive from
24377 InterfaceMemberBase.
24379 2001-05-07 Miguel de Icaza <miguel@ximian.com>
24381 * Many things: all interfaces are parsed and generated in
24382 gen-treedump. Support for member variables, constructors,
24383 destructors, properties, constants is there.
24385 Beginning of the IL backend, but very little done, just there for
24388 2001-04-29 Miguel de Icaza <miguel@ximian.com>
24390 * cs-parser.jay: Fix labeled statement.
24392 * cs-tokenizer.cs (escape): Escape " and ' always.
24393 ref_line, ref_name: keep track of the line/filename as instructed
24394 by #line by the compiler.
24397 2001-04-27 Miguel de Icaza <miguel@ximian.com>
24399 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
24400 to match the values in System.CodeDOM.
24402 Divid renamed to Divide.
24404 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
24406 (Statements.set): remove.
24408 * System.CodeDOM/CodeCatchClause.cs: always have a valid
24411 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
24412 falseStatements always have valid values.
24414 * cs-parser.jay: Use System.CodeDOM now.