1 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
3 * doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and
4 just use TypeExpr.Type. This fixes bug #74595 when merged to gmcs.
6 2005-04-13 Raja R Harinath <rharinath@novell.com>
9 * ecore.cs (PropertyExpr.InstanceResolve): Handle a case of
10 IdenticalNameAndTypeName here.
11 (EventExpr.InstanceResolve): Likewise.
13 2005-04-13 Marek Safar <marek.safar@seznam.cz>
15 C# 2.0 DefaultCharSetAttribute implementation
17 * attribute.cs (Attribute.ResolveAsTypeStep): New protected method
18 which allows us to set GlobalNamespace for every resolve.
19 (Attribute.ResolveArguments): Cut from Resolve.
20 (Attribute.GetCharSetValue): Returns CharSet named argument.
21 (Attribute.DefinePInvokeMethod): Gets default charset from
23 (GlobalAttribute.ResolveAsTypeStep): Override.
24 (GlobalAttribute.ResolveArguments): Override.
26 * class.cs (TypeAttr): Is protected.
28 * codegen.cs (ModuleClass.DefaultCharSet): New member.
29 (ModuleClass.DefaultCharSetType): New memeber.
30 (ModuleClass.ResolveAttributes): Resolves DefaultCharSetAttribute.
32 * decl.cs (Decl.TypeAttr): New protected virtual. Returns default
35 * delegate.cs (TypeAttr): Override.
36 (Delegate.DefineType): Use this TypeAttr.
38 * driver.cs (Driver.MainDriver): Call Module.ResolveAttributes
39 at very early stage (before types are defined) to resolve model
40 module attributes. It will probably not work with corlib but it
43 * enum.cs (Enum.TypeAttr): New protected virtual. Returns default
46 * typemanager.cs (default_charset_type): New type.
48 2005-04-13 Raja R Harinath <rharinath@novell.com>
50 * decl.cs (MemberCache.AddMethods): Don't warn if
51 System.Object.Finalize has buggy MethodAttributes.
53 * typemanager.cs (IsUnmanagedType): Restore !IsValueType check
56 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
58 * doc.cs : detect ambiguous reference to overloaded members.
59 Fixed bug #71603. MS 1.1 csc does not detect it.
61 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
63 * doc.cs : delegates must not be referenced with parameters.
66 2005-04-12 Miguel de Icaza <miguel@novell.com>
68 * typemanager.cs (IsUnmanagedType): Arrays are allowed.
70 2005-04-10 Miguel de Icaza <miguel@novell.com>
72 * driver.cs (MainDriver): Stop processing if the CLS stage found
75 (CompilerCallableEntryPoint.InvokeCompiler): Always
76 reset after execution; Take a TextWriter argument for the
79 * report.cs: Use the error stream instead of hardcoding stderr.
81 2005-04-09 Miguel de Icaza <miguel@novell.com>
83 * class.cs: Reduce code paths to test, too small of an
84 optimization to make it worth the extra testing. Always perform
87 2005-04-08 Raja R Harinath <rharinath@novell.com>
90 * class.cs (OperatorArrayList.CheckPairedOperators): Skip
91 operators that had errors reported on them.
93 2005-04-08 Marek Safar <marek.safar@seznam.cz>
95 * attribute.cs (Attribute.IsValidArgumentType): Test valid named
97 (Attribute.Resolve): Add named argument type checking.
99 * class.cs (FixedField.Define): Use IsPrimitiveType
101 * expression.cs (Binary.ResolveOperator): Reflect IsCLRType renaming.
103 * iterators.cs (Iterator.DefineIterator): Add check for arglist and
104 unsafe parameter types.
106 * statement.cs (Using.ResolveExpression): Add better error description.
108 * typemanager.cs (IsCLRType): Renamed to IsPrimitiveType.
110 2005-04-08 Raja R Harinath <rharinath@novell.com>
113 * attribute.cs (Attribute.GetAttributeUsage): Resolve
114 AttributeUsageAttribute in the emitcontext of the attribute class,
115 not in the emitcontext of the attributable entity it was attached to.
116 * cs-parser.jay: Use 'current_class', not 'current_container',
117 when creating a GlobalAttribute.
119 2005-04-08 Alp Toker <alp@atoker.com>
121 * pending.cs: The fix to #58413 failed to compile methods implementing
122 interfaces with/without params modifiers and vice versa, even though
123 params modifiers aren't part of the signature. Make the modifier check
124 less strict as in csc.
126 2005-04-07 Abin Thomas <projectmonokochi@rediffmail.com>
127 Anoob V E <projectmonokochi@rediffmail.com>
128 Harilal P R <projectmonokochi@rediffmail.com>
131 * pending.cs (TypeAndMethods.mods): New. Store the parameter
132 modifiers of pending methods.
133 (PendingImplementation.PendingImplementation): Initialize it.
134 Add Parameter.Modifier [][] mods and initialize it with ParameterData.
135 (PendingImplementation.InterFaceMethod): Repalce Type[] argument
136 with ParameterData. Add check for modifiers.
137 * class.cs (MethodData.Define): Update to changes.
139 2005-04-07 Raja R Harinath <rharinath@novell.com>
141 * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat.
143 2005-04-07 Marek Safar <marek.safar@seznam.cz>
145 * class.cs (PropertyMethod.Define): Check private accessor in abstract
148 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't allow RequiredAttribute
151 * typemanager.cs: Registered RequiredAttributeAttribute.
153 2005-04-06 Marek Safar <marek.safar@seznam.cz>
155 * class.cs (VerifyMembers): Doesn't need EmitContext argument.
156 Warning CS0169 is back at level 3.
157 (IMethodData.SetMemberIsUsed): New method.
159 * decl.cs (IsUsed): New value; moved from FieldBase.Status
160 (SetMemberIsUsed, IsUsed): New methods, encapsulate IsUsed.
162 * delegate.cs (ResolveMethodGroupExpr): Call SetMemberIsUsed.
164 * ecore.cs (FieldExpr.ResolveMemberAccess): Call SetMemberIsUsed for
166 (PropertyExpr.ResolveAccessors): Call SetMemberIsUsed when delegate
169 * expression.cs (OverloadResolve): Call SetMemberIsUsed. when method
172 * rootcontext.cs (RootContext.EmitCode): Call VerifyMembers in extra run
173 to avoid the problems with nested types.
175 2005-04-05 Abin Thomas <projectmonokochi@rediffmail.com>
176 Anoob V.E <projectmonokochi@rediffmail.com>
177 Harilal P.R <projectmonokochi@rediffmail.com>
178 Raja R Harinath <rharinath@novell.com>
181 * delegate.cs (Define): Emit ParamArrayAttribute for 'params'
183 * typemanager (GetConstructor): Make public.
185 2005-04-05 John Luke <john.luke@gmail.com>
186 Raja R Harinath <rharinath@novell.com>
189 * typemanager.cs (IsUnmanagedType): Check non-public fields of a
190 struct too. Return false quicker in a few cases.
191 (VerifyUnManaged): Use it.
193 2005-04-05 Raja R Harinath <rharinath@novell.com>
196 * statement.cs (Block.Resolve): Initialize 'unreachable' to false,
197 not 'unreachable_seen'.
199 2005-04-04 Marek Safar <marek.safar@seznam.cz>
201 * attribute.cs (Attribute.GetValue): Removed unused.
203 * codegen.cs (CodeGen.TrimExt): Removed unused.
205 * cs-parser.jay (output): Removed unused.
207 * cs-tokenizer.cs (hex_digits): Removed unused.
209 * enum.cs (MapToInternalType, GetEnumeratorName): Removed unused.
211 * expression.cs (Indirection.LoadExprValue): Removed unused.
212 (ArrayCreation.ExpressionToArrayArgument): Removed unused.
214 * iterators.cs (Iterator.param_types): Removed unused.
216 * statement.cs (Goto.block): Removed unused.
217 (ToplevelBlock.did): Removed unused.
218 (Switch.ResolveConstantSwitch): Removed unused.
220 2005-04-01 Ben Maurer <bmaurer@ximian.com>
222 * rootcontext.cs: Allow mcs to bootstrap with the compilation
225 2005-04-01 Raja R Harinath <rharinath@novell.com>
227 Fix #74232 and cs0208-3.cs.
228 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0208 check.
229 * typemanager.cs (IsUnmanagedType): Don't allow 'object' as an
230 unmanaged type. Don't use FieldBuilders when 't' is a
231 TypeBuilder. Use ModFlags and MemberType fields.
232 * class.cs (MemberBase.member_type): Rename from MemberType.
233 (MemberBase.MemberType): New property. Determines member_type on
235 (MemberBase.DoDefine): Don't initialize MemberType here.
236 (FieldMember.Define): Likewise.
238 2005-04-01 Marek Safar <marek.safar@seznam.cz>
241 * class.cs (Event.Emit): Call Add/Remove emit even for interfaces.
242 Attributes are emitted there.
244 2005-04-01 Raja R Harinath <rharinath@novell.com>
246 * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
247 keyword in 'partial enum' too.
248 * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
250 Report from Kamil Skalski <nazgul@omega.pl>.
253 * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
254 have partial containers too.
256 * ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning
257 in block' checks to Block.CheckInvariantMeaningInBlock.
258 * statement.cs (Block.GetKnownVariableInfo): Make private.
259 (Block.IsVariableUsedInChildBlock): Remove.
260 (Block.IsVariableUsedInBlock): Likewise.
261 (Block.CheckInvariantMeaningInBlock): New. Show location of
262 conflicting declaration.
263 (Block.AddVariable): Make error messages less long-winded and more
264 specific. Show location of conflicting declaration.
265 * parameter.cs (Parameters.Location): New readonly property.
267 2005-03-31 Raja R Harinath <rharinath@novell.com>
269 Clean up semantics of invoking ResolveMemberAccess.
270 * ecore.cs (SimpleName.DoSimpleNameResolve): If a MemberExpression
271 can have an instance, ensure that we pass in a non-TypeExpression
272 to ResolveMemberAccess. Tighten up IdenticalNameAndTypeName checks.
273 (MemberExpr.DoSimpleNameResolve): Remove type_is_inferred
274 argument. Update to changes and simplify.
275 (FieldExpr.Emitinstance): Remove CS0120 check.
276 (PropertyExpr.EmitInstance): Likewise.
277 * expression.cs (Argument.Resolve): Likewise.
278 (Invocation.DoResolve): Update to changes in semantics of
281 2005-03-31 Marek Safar <marek.safar@seznam.cz>
284 * class.cs (AbstractPropertyEventMethod.EmitMethod): Enable emit method
287 * decl.cs (MemberCache.AddMethods): Fix infinite loop.
289 2005-03-31 Raja R Harinath <rharinath@novell.com>
291 Fix difference in behaviour with commandline invocation.
292 * driver.cs (Driver.Reset): New.
293 (CompilerCallableEntryPoint): Call it.
295 * statement.cs (If.Resolve): Avoid spurious "uninitialized
296 variable" warnings if the boolean expression failed to resolve.
298 2005-03-30 Sebastien Pouliot <sebastien@ximian.com>
300 * attribute.cs: Fix the union of several permissions when some of them
301 are unrestricted (so the result isn't an unrestricted permission set).
304 2005-03-30 Raja R Harinath <rharinath@novell.com>
306 * ecore.cs (MemberExpr): New class. Convert from interface
308 (MemberExpr.ResolveMemberAccess): Refactor and move here from
309 MemberAccess.ResolveMemberAccess. Tighten up pre-conditions and
311 (MethodGroupExpr, FieldExpr, PropertyExpr, EventExpr): Update.
312 (MethodGroupExpr.IsExplicitImpl): Remove.
313 (Expression.GetFieldFromEvent): Remove.
314 (SimpleName.MemberStaticCheck): Remove.
315 (SimpleName.DoSimpleNameResolve): Update to changes.
316 * expression.cs (MemberAccess.ResolveMemberAccess): Refactor.
317 (MemberAccess.IdenticalNameAndTypeName): Remove.
318 (MemberAccess.error176): Move to MemberExpr.
319 (MemberAccess.DoResolve): Update to changes.
320 (BaseAccess.DoResolve): Likewise.
322 2005-03-30 Marek Safar <marek.safar@seznam.cz>
324 C# 2.0 Conditional attribute class implementation
326 * attribute.cs (AttributeTester.IsAttributeExcluded): New method.
327 Analyzes class whether it has attribute which has ConditionalAttribute
328 and its condition is not defined.
330 * class.cs (Class.ApplyAttributeBuilder): Add IsAttributeExcluded check.
331 (Class.IsExcluded): New method. Search for at least one defined
332 condition in ConditionalAttribute of attribute class.
334 2005-03-30 Raja R Harinath <rharinath@novell.com>
336 * ecore.cs (PropertyExpr): Derive from Expression, not
338 (PropertyExpr.EmitStatement): Remove.
340 2005-03-29 Raja R Harinath <rharinath@novell.com>
343 * expression.cs (MemberAccess.ResolveMemberAccess): Allow the
344 internal field "value__" of an enum be private. The examples for
345 "value__" that I found on MSDN all used FieldAttributes.Private.
347 * decl.cs (MemberCache.AddMethods): Use C# terminology in warning.
348 Don't mention IL method attribute names.
350 Fix #47991. Remove a TODO.
351 * statement.cs (Block.Toplevel): Make into a field.
352 (Block.Parameters): Move into ToplevelBlock.
353 (Block.known_variables): Rename from child_variable_names.
354 (Block.Block): Remove variants that take Parameters. Initialize
355 'Toplevel' with the immediately surrounding toplevel block.
356 (Block.AddKnownVariable): Rename from AddChildVariableName. Add a
358 (Block.GetKnownVariableInfo): New.
359 (Block.IsVariableNameUsedInChildBlock): Update.
360 (Block.IsVariableNameUsedInBlock): New. Checks if a name is used in
361 the block, even though it may not be in scope.
362 (Block.AddVariable): Remove Parameters parameter. Use
363 Toplevel.Parameters instead.
364 (Block.AddConstant): Remove Parameters parameter.
365 (Block.GetParameterReference): Update to use Toplevel.Parameters.
366 (Block.IsParamaterReference): Likewise.
367 (Block.IsLocalParameter): Likewise. Simplify a lot.
368 (ToplevelBlock.Parameters): New. Moved from Block.
369 (ToplevelBlock.ToplevelBlock): Update to changes. Always
370 initialize Parameters to a non-null value.
371 * cs-parser.jay: Update to changes.
372 * ecore.cs (SimpleName.SimpleNameResolve): Emit cs0136 error for
373 simple names that mean different things in the same block. Use
374 Block.IsVariableNameUsedInBlock.
376 2005-03-28 Raja R Harinath <rharinath@novell.com>
378 * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer.
379 (TypeHandle.TypeHandle): Use LookupMemberCache rather than
380 GetTypeHandle. It is possible for a reflected type to derive from
381 a TypeBuilder (e.g., int[] derives from the TypeBuilder
382 System.Array during mscorlib compilation).
383 * decl.cs (MemberCache.MemberCache): If the base cache doesn't
384 contain a method_hash, don't create one either. Don't create a
385 deep copy of the base cache's method_hash.
386 (MemberCache.SetupCache): Rename back from DeepCopy.
387 (MemberCache.AddMethods): Rewrite, now that method_hash isn't
388 already initialized. If we see an override function, add its
389 underlying base virtual function to the member_hash too.
391 * enum.cs (Enum.LookupEnumValue): Remove debugging code.
393 2005-03-26 Raja R Harinath <harinath@acm.org>
396 * assign.cs (Assign.DoResolve): When the RHS of an assignment
397 fails to resolve, ensure that the LHS is still resolved as an
400 2005-03-25 Raja R Harinath <harinath@acm.org>
402 * enum.cs (Enum.DefineType): Set ec.InEnumContext and
404 (Enum.current_ec): Remove.
405 (Enum.LookupEnumValue): Remove EmitContext argument.
406 Just uses the one created during DefineType.
407 (Enum.FindMembers): Update.
408 * expression.cs (MemberAccess.DoResolve): Update.
410 2005-03-22 Marek Safar <marek.safar@seznam.cz>
412 * assign.cs (Assign.DoResolve): Check for CS1717 when
413 source and target are same (uses Equals).
415 * expression.cs (LocalVariableReference, ParameterReference,
416 This): Implemented Equals, GetHashCode.
418 * statement.cs (Block.GetParameterReference): Removed useless
421 2005-03-22 Raja R Harinath <rharinath@novell.com>
424 * statement.cs (Block.AddVariable): Ensure that we skip implicit
425 blocks before deciding whether the error is cs0136 or cs0128.
427 * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
428 (using_alias_directive, using_namespace_directive): Pass
429 MemberName, not an expression to Namespace.UsingAlias and
431 (MakeName): Use the MemberName of the namespace.
432 * namespace.cs (Namespace.MemberName): New.
433 (UsingEntry.UsingEntry): Take a MemberName, not an expression.
434 (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
436 * decl.cs (MemberName.Name): Make readonly.
437 (MemberName.FromDotted): New "constructor".
438 (MemberName.Equals, MemberName.GetHashCode): Implement overrides.
439 (MemberCore.Name): Compute from MemberName on demand.
440 (MemberCore.SetMemberName): Provide a way to change the
442 (MemberCore.AddToContainer): Don't take a fullname parameter.
443 * class.cs (TypeContainer.AddToMemberContainer): Don't add the
444 fully qualified name of the container to the member name.
445 (TypeContainer.AddToTypeContainer): Use a fully qualified name
446 only if the type is a member of the root container.
447 (TypeContainer.AddMethod, TypeContainer.AddProperty): Use
448 MemberName.Left rather than searching for an embedded ".".
449 (PartialContainer.CreatePart): Update to changes in RootContext.
450 (MemberBase.ShortName): Turn into a property. Use
451 MemberCore.SetMemberName.
452 (MemberBase.ExplicitInterfaceName): Remove.
453 (MemberBase.UpdateMemberName): Remove.
454 (AbstractPropertyEventMethod.UpdateName): Use SetMemberName.
455 (PropertyBase.SetMemberName): New override.
456 * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key.
458 (Tree.AllDecls): Rename from Decls.
459 * attribute.cs, enum.cs, report.cs: Update to changes.
460 * driver.cs (MainDriver): Use MemberName.FromDotted on
461 RootContext.MainClass.
463 2005-03-21 Marek Safar <marek.safar@seznam.cz>
465 * class.cs (FixedField.Define): Check for CS1664 and more sanity
468 * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708.
470 2005-03-18 Marek Safar <marek.safar@seznam.cz>
472 * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
473 property accessor modifiers.
475 * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
476 fixed buffer attribute (CS1716).
477 (PropertyMethod.HasCustomAccessModifier): When property accessor
480 * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
482 (PropertyExpr.DoResolveLValue): Add CS0272.
484 2005-03-17 Miguel de Icaza <miguel@novell.com>
486 * convert.cs: When converting to a pointer, use the proper Conv.U
487 or Conv.I depending on the source data type.
489 * cs-tokenizer.cs: Make the size for large decimal constants,
492 2005-03-17 Martin Baulig <martin@ximian.com>
494 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
495 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
497 2005-03-17 Martin Baulig <martin@ximian.com>
499 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
500 to bool so we can return an error condition.
501 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
504 2005-03-16 Zoltan Varga <vargaz@freemail.hu>
506 * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping
509 2005-03-16 Raja R Harinath <rharinath@novell.com>
511 Remove TypeManager.LookupType and TypeManager.LookupTypeDirect.
512 Refactor to avoid traversing the list of assemblies, and to avoid
513 string concatenation.
514 * typemanager.cs (guid_attr_type): Remove.
515 (negative_hits, pointers, references): Remove hashes.
517 (GetConstructedType): New. Uses type_hash to handle constructed
518 types (arrays, references, pointers).
519 (GetReferenceType, GetPointerType): Use it.
520 (GetNestedType): New. Uses type_hash to handle nested types of
522 (LookupType, LookupTypeDirect): Remove.
523 (CoreLookupType): Inline parts of old LookupTypeDirect code. Use
524 'types' hash and LookupTypeReflection directly.
525 (params_string, params_object): Use GetConstructedType.
526 * namespace.cs (Namespace.cached_types): New. Cache of reflected
528 (Namespace.Lookup): Use cached_types.
529 (NamespaceEntry.LookupNamespaceOrType): Inline the functionality
530 provided by old TypeManager.LookupType.
531 * rootcontext.cs (MakeFQN): Remove.
532 * decl.cs (DeclSpace.MakeFQN): Likewise.
533 (DeclSpace.LookupType): Use TypeManager.GetNestedType.
534 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
535 TypeManager.GetConstructedType.
536 * tree.cs (decl_ns_hash, LookupByNamespace): Remove.
538 2005-03-15 Marek Safar <marek.safar@seznam.cz>
540 * class.cs (MethodCore.CheckBase): Report CS1715 for properties and
543 * cs-parser.jay: Reports CS1527 for any namespace element.
545 * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
548 * expression.cs (ParameterReference.IsAssigned): Changed error to
550 (Error_WrongNumArguments): Moved CS0245 detection here.
552 * statement.cs (Return.Resolve): Add CS1622 report.
554 2005-03-11 Marek Safar <marek.safar@seznam.cz>
556 * class.cs (StaticClass.DefineContainerMembers): Added CS0720.
558 2005-03-11 Zoltan Varga <vargaz@freemail.hu>
560 * attribute.cs expression.cs: Get rid of some allocations.
562 2004-03-11 Atsushi Enomoto <atsushi@ximian.com>
564 * doc.cs : just eliminate the latest change.
566 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
568 * doc.cs : commented out the latest change. It breaks xml-030.cs
570 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
572 * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will
573 fail. So invoke CreateType() in FindDocumentedType().
575 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
577 * cs-tokenizer.cs : added IsKeyword().
578 * doc.cs : Detect keyword incorrectly used as identifier.
579 Allow identifiers prefixed by @.
581 2005-03-10 Marek Safar <marek.safar@seznam.cz>
583 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
584 It caused exception in namespace resolving (again!).
586 * class.cs (Class.ctor): Removed exit.
587 (PropertyMethod.ctor): ditto.
589 * codegen.cs (Codegen.Reset): Reset static data.
590 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
592 * cs-tokenizer.cs (Cleanup): Removed.
594 * driver.cs (GetSystemDir): Rewrote to one line command.
595 It caused problem with unloaded dynamic modules.
596 (UnixParseOption): Removed Exit.
597 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
598 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
599 Now can be mcs used as library.
601 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
604 * location.cs (Reset): Reset static data.
606 * namespace.cs (Reset): Reset static data.
608 * report.cs (Report.Reset): Reset static data.
610 * rootcontext.cs (RootContext.Reset): Reset static data.
612 * tree.cs (RootTypes.ctor): Use Location.Null
614 * typemanager.cs (TypeManager.Reset): Reset static data.
615 (CoreLookupType): Removed Exit.
616 (TypeHandle.Reset): Reset static data.
618 2005-03-10 Raja R Harinath <rharinath@novell.com>
621 * typemanager.cs (ComputeNamespaces): Import namespaces from
622 referenced modules too.
624 2005-03-09 Raja R Harinath <rharinath@novell.com>
626 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
629 2005-03-09 Raja R Harinath <rharinath@novell.com>
631 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
632 enclosing DeclSpace. This ensures that a name-lookup populates
633 more caches and there are fewer 'TypeExpression's. Carve out
634 nested type lookup into ...
635 (LookupNestedTypeInHierarchy): ... this.
637 2005-03-09 Raja R Harinath <rharinath@novell.com>
639 Clean up a few partial-class semantics.
640 Fixes test-357.cs and cs1618-2.cs.
641 * cs-parser.jay (struct_declaration): Use 'current_class' as
642 parent of newly-created struct. Remove call to Register ().
643 Use 'pop_current_class' to complete handing the current struct.
644 (interface_declaration): Likewise.
645 (class_declaration): Likewise.
646 (enum_declaration): Use 'current_class' as parent of newly created
648 (delegate_declaration): Likewise.
649 (pop_current_class): New function. This is used to handle closing
650 up the 'current_class' and 'current_container', and pointing them
651 to the enclosing class/container.
652 (CSharpParser): Initialize 'current_class' too.
653 * decl.cs (MemberCore): Add check for invariant: a partial
654 container is not a parsed entity, and thus does not enclose any
656 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
657 (DeclSpace.BaseTypeExpr): Use it.
658 (DeclSpace.LookupType): Add check for invariant.
659 * class.cs (TypeContainer): Add check for invariant: a nested
660 class should have the same NamespaceEntry as its enclosing class.
661 (TypeContainer.EmitFieldInitializers): Make virtual.
662 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
664 (TypeContainer.Register): Remove.
665 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
666 null. Use TypeResolveEmitContext for resolving base types and
667 interfaces. Move initialization of Parts.TypeBuilder here from
669 (TypeContainer.DefineNestedTypes): ... here.
670 (PartialContainer): Take a Namespace not a NamespaceEntry.
671 (PartialContainer.Create): Don't use Register. Call the
672 appropriate Add... function directly.
673 (ClassPart): Take both the PartialContainer and the enclosing
674 class as constructor arguments.
675 (ClassPart.EmitFieldInitializers): Override.
676 (ClassPart.PartFindNestedTypes): Remove.
677 (FieldBase.GetInitializerExpression): Resolve the initializer
678 expression in the emit context of the enclosing class.
679 * tree.cs (RootTypes): Remove Register ().
681 2005-03-08 Marek Safar <marek.safar@seznam.cz>
683 * cs-parser.jay: Removed CS0134.
685 * driver.cs: Removed CS1901.
687 * expression.cs (SizeOf.DoResolve): Don't report CS0233
688 for predefined types.
690 2005-03-07 Duncan Mak <duncan@novell.com>
692 * codegen.cs (Save): Catch UnauthorizedAccessException as
693 well. Fixes bug #73454.
695 2005-03-07 Marek Safar <marek.safar@seznam.cz>
697 * cs-tokenizer.cs (xtoken): Add CS1035.
699 * class.cs (MethodData.Define): Add CS0683.
700 (FieldMember.ctor): Add CS0681.
702 2005-03-07 Raja R Harinath <rharinath@novell.com>
704 * ecore.cs (SimpleName.DoResolve): Rename from
705 SimpleName.DoResolveAllowStatic.
706 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
707 Pass 'intermediate' flag to MemberStaticCheck.
708 (SimpleName.MemberStaticCheck): Skip "static check" only in case
709 of "intermediate" lookups via MemberAccess.
710 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
711 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
713 2005-03-07 Raja R Harinath <rharinath@novell.com>
716 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
717 slipped in because of variable names that are identical to a
718 builtin type's BCL equivalent ('string String;', 'int Int32;').
719 (PropertyExpr.EmitInstance): Likewise.
721 2005-03-04 Marek Safar <marek.safar@seznam.cz>
723 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
725 * report.cs (warning_ignore_table): Made public.
727 2005-03-04 Raja R Harinath <rharinath@novell.com>
730 * class.cs (MethodData.Emit): Pass 'container' to
731 container.GetObsoleteAttribute instead of 'container.Parent'.
733 2005-03-03 Marek Safar <marek.safar@seznam.cz>
735 * cs-parser.jay: Add 1534 error test.
737 * iterators.cs (Yield.CheckContext): Add error 1629.
738 (Iterator.ctor): Save unsafe modifier.
739 (MoveNextMethod.DoEmit): Restore unsafe context.
741 * namespace.cs (UsingAlias): Better error message.
743 2005-03-03 Dan Winship <danw@novell.com>
745 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
746 the warning message [#73219]
748 2005-03-03 Raja R Harinath <rharinath@novell.com>
750 Fix compile with MCS 1.0.0.0.
751 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
752 w_restore to not depend on string constant folding.
754 2005-03-03 Raja R Harinath <rharinath@novell.com>
756 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
757 CS0246 check to users who passed 'silent = false'.
758 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
760 (SimpleName.SimpleNameResolve): Update.
761 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
762 (MemberAccess.IdenticalNameAndTypeName): Update.
763 * doc.cs (FindDocumentedTypeNonArray): Update.
765 2005-03-03 Raja R Harinath <rharinath@novell.com>
767 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
768 * parameters.cs (ComputeAndDefineParameters): Remove.
769 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
770 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
771 Use GetParameterInfo.
773 2005-03-02 Marek Safar <marek.safar@seznam.cz>
775 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
777 2005-03-02 Raja R Harinath <rharinath@novell.com>
779 Unify DeclSpace.LookupType and DeclSpace.FindType.
780 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
781 is in charge of defining nested types on demand.
782 (DeclSpace.LookupType): Use it when the current_type is a
783 TypeBuilder. Use LookupTypeDirect for reflected types.
784 (DeclSpace.FindType): Remove.
785 (DeclSpace.LookupInterfaceOrClass): Likewise.
786 (DeclSpace.DefineTypeAndParents): Likewise.
787 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
788 DeclSpace.LookupType.
789 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
790 * typemanager.cs (LookupType): Simplify.
791 (AddUserType): Remove type from negative_hits.
792 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
793 * class.cs (TypeContainer.FindMembers): Move handling of nested
795 (TypeContainer.FindMembers_NestedTypes): ... here.
796 (TypeContainer.FindNestedType): Implement override.
797 (ClassPart.FindNestedType): Delegate to PartialContainer.
798 (ClassPart.PartFindNestedType): Looks up the nested types of the
801 2005-03-02 Martin Baulig <martin@ximian.com>
803 * class.cs (TypeContainer.DoDefineMembers): We also need a default
804 static constructor in static classes.
806 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
808 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
809 sizeParamIndex is not specified.
811 2005-03-01 Marek Safar <marek.safar@seznam.cz>
814 * report.cs (WarningMessage.IsEnabled): Missing null check.
816 2005-02-28 Marek Safar <marek.safar@seznam.cz>
818 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
819 in the fields and not in the properties.
821 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
823 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
826 2005-02-28 Marek Safar <marek.safar@seznam.cz>
828 * attribute.cs: Small refactoring (improved robustness).
829 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
830 (ValidateGuid): Removed.
831 (Resolve): Removed referenced to above mentioned.
832 (GetAttributeUsage): Made private and changed to work without
834 (GetIndexerAttributeValue): Don't crash.
835 (GetConditionalAttributeValue): Ditto.
836 (GetClsCompliantAttributeValue): Ditto.
837 (ExtractSecurityPermissionSet): All attributes exceptions are
839 (GetPropertyValue): New helper.
840 (GetMethodImplOptions): New method.
841 (DefinePInvokeMethod): Reuse common code. Implemented handling of
842 some missing properties.
844 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
845 (Method.ApplyAttributeBuilder): Updated.
847 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
850 2005-02-28 Raja R Harinath <rharinath@novell.com>
853 * report.cs (Report.SymbolRelatedToPreviousError): Handle
854 non-simple types (array, pointer, reference).
856 2005-02-28 Marek Safar <marek.safar@seznam.cz>
858 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
860 * class.cs (MethodCore.IsDuplicateImplementation): Special error
862 (Method.CheckBase): Catch wrong destructor here.
863 (MethodData.Define): Add errors 550, 668.
865 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
867 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
869 * pending.cs (VerifyPendingMethods): Add error 551.
871 * typemanager.cs (CSharpName): Next error report helper.
873 2005-02-25 Marek Safar <marek.safar@seznam.cz>
875 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
876 attributes. Removed useless attribute double check.
877 It saves almost 2MBs for corlib.
879 2005-02-25 Raja R Harinath <rharinath@novell.com>
882 * statement.cs (ExpressionStatement.Resolve): Make robust to being
883 called twice in case of error.
885 2005-02-23 Chris Toshok <toshok@ximian.com>
887 Fix compiler portions of #72827.
888 * statement.cs (Block.Emit): call Begin/EndScope on the
889 EmitContext instead of the ILGenerator.
891 * codegen.cs (EmitContext.BeginScope): new method, call
892 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
894 (EmitContext.BeginScope): same, but EndScope and CloseScope
896 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
897 offset and call the superclass's OpenScope(int) with it.
898 (SymbolWriter.CloseScope): get the current il
899 offset and call superclass's CloseScope(int) with it.
901 2005-02-23 Marek Safar <marek.safar@seznam.cz>
903 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
904 CS1677 for out and ref as well.
906 * class.cs (Method.Define): Add error CS1599 detection.
908 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
910 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
912 * delegate.cs (Delegate.Define): Add error CS1599 detection.
914 * support.cs.cs (ModifierDesc): New helper method.
916 2005-02-23 Raja R Harinath <rharinath@novell.com>
917 Abin Thomas <projectmonokochi@rediffmail.com>
918 Anoob V E <projectmonokochi@rediffmail.com>
919 Harilal P R <projectmonokochi@rediffmail.com>
922 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
923 MemberLookup (used for error reporting) actually returns a result.
924 Fix error report number (122, not 112).
926 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
927 Anoob V E <projectmonokochi@rediffmail.com>
928 Harilal P R <projectmonokochi@rediffmail.com>
931 * pending.cs (PendingImplementation.GetAbstractMethods):
932 Find NonPublic members too.
934 2005-02-22 Marek Safar <marek.safar@seznam.cz>
936 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
939 * class.cs (MethodCore.CheckMethodAgainstBase):
940 Add error 239 report.
942 2005-02-21 Raja R Harinath <rharinath@novell.com>
945 * expression.cs (Invocation.IsApplicable): Make public.
946 (Invocation.IsParamsMethodApplicable): Likewise.
947 * delegate.cs (Delegate.VerifyApplicability): Don't use
948 Invocation.VerifyArgumentCompat for parameter applicability
949 testing. Use Invocation.IsApplicable and
950 Invocation.IsParamsMethodApplicable.
952 2005-02-21 Marek Safar <marek.safar@seznam.cz>
954 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
956 * class.cs (Operator.Define): Add error 217 report.
958 2005-02-21 Raja R Harinath <rharinath@novell.com>
960 * namespace.cs (UsingEntry.Resolve): Undo change below.
962 2005-02-21 Raja R Harinath <rharinath@novell.com>
965 * ecore.cs (Expression.MemberLookupFailed): Add argument to
966 disable the error message when the extended MemberLookup also
968 (Expression.MemberLookupFinal): Update.
969 (SimpleName.DoSimpleNameResolve): Update.
970 * expression.cs (MemberAccess.ResolveNamespaceOrType):
971 Don't use MemberLookupFinal.
972 (New.DoResolve): Update.
973 (BaseAccess.CommonResolve): Update.
975 2005-02-21 Raja R Harinath <rharinath@novell.com>
978 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
979 occured previously, don't resolve again.
981 2005-02-21 Marek Safar <marek.safar@seznam.cz>
984 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
985 argument. Call ResolveAttributeUsage for unresolved.
986 when types doesn't match ctor arguments.
988 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
989 for nested attribute classes.
990 (Class.attribute_usage): Removed.
991 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
994 * ecore.cs (IsAttribute): Removed.
996 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
998 * rootcontext.cs (RegisterAttribute): Removed, attributes are
1000 (attribute_types): Removed.
1001 (EmitCode): Global attributes are emited as the latest.
1003 2005-02-18 Marek Safar <marek.safar@seznam.cz>
1005 * class.cs (EmitFieldInitializers): Don't emit field initializer
1006 for default values when optimilization is on.
1008 * constant.cs (Constant.IsDefaultValue): New property.
1010 * driver.cs: Add /optimize handling.
1014 * literal.cs: Implement new IsDefaultValue property.
1016 * rootcontext.cs (Optimize): New field, holds /optimize option.
1018 2005-02-18 Raja R Harinath <rharinath@novell.com>
1020 Fix crasher in re-opened #72347.
1021 * namespace.cs (Namespace.Lookup): Return null if
1022 DeclSpace.DefineType returns null.
1025 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
1027 2005-02-18 Raja R Harinath <rharinath@novell.com>
1029 Fix remainder of #63202. Change semantics of DoResolveLValue: it
1030 now returns null if it cannot resolve to an lvalue.
1031 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
1032 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
1033 returned null. Remove check for SimpleName.
1034 (EventExpr.DoResolveLValue): New.
1035 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
1036 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
1038 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
1040 (Unary.ResolveOperator): Move CS0211 check ...
1041 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
1043 (Unary.DoResolveLValue): Simplify.
1044 (AddressOf.DoResolveLValue): New.
1045 (ArrayAccess.DoResolveLValue): New.
1047 2005-02-16 Marek Safar <marek.safar@seznam.cz>
1049 * attribute.cs (Attribute.Resolve): Add arguments casting for
1050 when types doesn't match ctor arguments.
1052 2005-02-16 Raja R Harinath <rharinath@novell.com>
1054 Fix parts of #63202.
1055 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
1056 lookup of operator in base type. Ensure that all checks happen
1057 when the operator resolves to an "op_..." method.
1059 2005-02-15 Raja R Harinath <rharinath@novell.com>
1062 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
1063 'ignore_cs0104' parameter. Pass it to ...
1064 (NamespaceEntry.Lookup): ... this.
1065 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
1066 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
1067 (TypeLookupExpression.DoResolveAsTypeStep): Update.
1068 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
1069 Update. Request that cs0104 errors be ignored.
1070 (ComposedCast.ResolveAsTypeStep): Update.
1072 2005-02-14 Raja R Harinath <rharinath@novell.com>
1075 * expression.cs (Invocation.BetterFunction): Remove support for
1076 comparing virtual functions and their overrides.
1077 (Invocation.IsOverride): New.
1078 (Invocation.OverloadResolve): Don't consider 'override' functions
1079 during candidate selection. Store them in a lookaside list.
1080 If the selected method is a 'virtual' function, use the list to
1081 find any overrides that are closer to the LHS type.
1083 2005-02-14 Marek Safar <marek.safar@seznam.cz>
1085 * expression.cs (New.DoResolve): Add complex core type reduction.
1086 (New.Constantify): Converts complex core type syntax like 'new int ()'
1089 2005-02-14 Raja R Harinath <rharinath@novell.com>
1091 * decl.cs (EntryType.EntryType): New constructor to create an
1092 updated copy of a cache entry.
1093 (MemberCache.AddMethods): Use it.
1094 (MemberCache.ClearDeclaredOnly): Remove.
1095 (MemberCache.MemberCache): Update.
1097 2005-02-11 Miguel de Icaza <miguel@novell.com>
1099 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
1100 variable. This one is represents the actual low-level declaration
1101 of the method, as opposed to the semantic level `IsStatic'.
1103 An anonymous method which is hosted into a static method might be
1104 actually an instance method. IsStatic would reflect the
1105 container, while MethodIsStatic represents the actual code
1108 * expression.cs (ParameterReference): Use the new MethodIsStatic
1109 instead of IsStatic.
1111 * anonymous.cs (AnonymousMethod.Compatible): Pass the
1112 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
1113 set on the current EmitContext.
1115 * expression.cs (Cast): Overload DoResolveLValue so we can pass
1116 resolve our casted expression as an LValue. This triggers the
1117 proper LValue processing that is later required by Assign.
1121 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
1123 2005-02-11 Marek Safar <marek.safar@seznam.cz>
1125 C# 2.0 Fixed buffer implementation
1127 * anonymous.cs: Update after RegisterHelperClass renaming.
1129 * attribute.cs (AttributeTester.fixed_buffer_cache):
1130 Cache of external fixed buffers.
1131 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
1132 implementation if field is fixed buffer else null.
1135 (TypeContainer.AddField): Accept FieldMember instead of Field.
1136 (FieldBase.IsFieldClsCompliant): Extracted code from
1137 VerifyClsCompliance descendant customization.
1138 (FixedField): New class handles fixed buffer fields.
1139 (FixedFieldExternal): Keeps information about imported fixed
1141 (IFixedField): Make access to internal or external fixed buffer
1144 * cs-parser.jay: Add fixed buffer parsing.
1146 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
1149 * expression.cs (Indirection): Extended implementation to accept
1151 (PointerArithmetic.Emit): Get element from fixed buffer as well.
1152 (ElementAccess.MakePointerAccess): Get type as parameter.
1153 (DoResolve): Add fixed buffer field expression conversion.
1154 (DoResolveLValue): Ditto.
1155 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
1156 (ArrayPtr): Derives from FixedBufferPtr.
1157 (ArrayPtr.Emit): Add extra emit for array elements.
1159 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
1161 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
1162 for compiler generated types.
1163 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
1165 * statement.cs (Fixed): Refactored to be easier add fixed buffer
1166 and consume less memory.
1167 (Fixed.Resolve): Add fixed buffer case.
1169 * typemanager.cs (compiler_generated_attr_ctor,
1170 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
1171 (HasElementType): Add our own implementation to work on every
1174 2005-02-11 Miguel de Icaza <miguel@novell.com>
1176 * anonymous.cs (CaptureContext): Track whether `this' has been
1179 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
1180 only captured `this' if it was implicitly done (instance
1181 methods/variables were used).
1183 * codegen.cs (EmitContext.CaptureThis): New method to flag that
1184 `this' must be captured.
1186 2005-01-30 Miguel de Icaza <miguel@novell.com>
1188 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
1189 is null it means that there has been no need to capture anything,
1190 so we just create a sibling.
1192 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
1194 Just a partial fix. The other half is fairly elusive.
1196 2005-02-10 Raja R Harinath <rharinath@novell.com>
1198 Fix #52586, cs0121-4.cs.
1199 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
1200 and return a hashtable.
1201 (MemberCache.ClearDeclaredOnly): New.
1202 (MemberCache.MemberCache): Update to change. Make a deep copy of
1203 the method_hash of a base type too.
1204 (MemberCache.AddMethods): Adapt to having a deep copy of the base
1205 type methods. Overwrite entries with the same MethodHandle so
1206 that the ReflectedType is correct. The process leaves in base
1207 virtual functions and their overrides as distinct entries.
1208 (CacheEntry): Now a class instead of a struct. It shouldn't alter
1209 matters since it was boxed in a ArrayList before.
1210 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
1212 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
1213 case of a virtual function and its override (choose the overload
1215 (Invocation.OverloadResolve): Avoid 'override' members during
1216 'applicable_type' calculation.
1218 2005-02-09 Raja R Harinath <rharinath@novell.com>
1220 Combine two near-redundant caches.
1221 * typemanager.cs (method_params): Rename from method_internal_params.
1222 (TypeManager.GetParameterData): New. Replace
1223 Invocation.GetParameterData.
1224 (TypeManager.LookupParametersByBuilder): Remove.
1225 * expression.cs (Invocation.method_parameter_cache): Remove.
1226 (Invocation.GetParameterData): Remove.
1228 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
1231 2005-02-08 Raja R Harinath <rharinath@novell.com>
1234 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
1235 TypeManager.multicast_delegate_type is null, resolve it by looking
1236 up "System.MulticastDelegate".
1237 * rootcontext.cs (RootContext.ResolveCore): Simplify.
1239 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
1240 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
1241 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
1244 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
1245 (LabeledStatement.AddReference): New. Set 'referenced'.
1246 (Goto.Resolve): Use it.
1248 2005-02-05 John Luke <john.luke@gmail.com>
1250 * driver.cs: remove duplicate -doc line in Usage ()
1252 2005-02-04 Raja R Harinath <rharinath@novell.com>
1254 * location.cs (Location.AddFile): Fix CS2002 error report.
1256 2005-02-02 Martin Baulig <martin@ximian.com>
1258 * delegate.cs (Delegate.DefineType): Report an internal error if
1259 TypeManager.multicast_delegate_type is null. See bug #72015 for
1262 2005-02-02 Raja R Harinath <rharinath@novell.com>
1264 Fix a crasher in a variant of #31984.
1265 * const.cs (Constant.CheckBase): New override that defers the
1266 new-or-override check in case the base type hasn't been populated
1268 (Constant.Define): Ensure the new-or-override check is performed.
1270 2005-02-01 Duncan Mak <duncan@ximian.com>
1272 * const.cs (LookupConstantValue): Check that `ce' is not null
1273 before calling GetValue ().
1275 2005-02-01 Raja R Harinath <rharinath@novell.com>
1277 Fix test-334.cs (#69519).
1278 * cs-parser.jay (using_alias_directive): Pass in an expression to
1279 NamespaceEntry.UsingAlias.
1280 (using_namespace_directive): Pass in an expression to
1281 NamespaceEntry.Using.
1282 (namespace_name): Don't flatten to a string.
1283 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
1284 (NamespaceEntry.AliasEntry.Resolve): Lookup using
1286 (NamespaceEntry.UsingEntry): Likewise.
1287 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
1289 (NamespaceEntry.LookupForUsing): Remove.
1290 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
1292 (NamespaceEntry.Lookup): Remove support for dotted names.
1294 2005-02-01 Raja R Harinath <rharinath@novell.com>
1296 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
1298 (NamespaceEntry.ImplicitParent): Compute on demand.
1299 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
1300 parallels the current.
1301 (NamespaceEntry.LookupForUsing): Use it.
1302 (NamespaceEntry.Lookup): If the current namespace-entry is
1303 implicit, don't search aliases and using tables.
1305 2005-02-01 Raja R Harinath <rharinath@novell.com>
1308 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
1310 (TypeContainer.BaseCache): Compute on demand.
1311 (TypeContainer.FindMembers): Define constants and types if they're
1312 not already created.
1313 (FieldMember.Define): Move resetting of ec.InUnsafe before error
1315 * const.cs (Constant.Define): Make idempotent.
1317 2005-01-29 Miguel de Icaza <miguel@novell.com>
1319 * pending.cs: Produce better code (no nops produced by using Ldarg
1322 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
1323 i - 1' it should be arg + 1.
1327 2005-01-28 Raja R Harinath <rharinath@novell.com>
1329 * attribute.cs (Attribute.CheckAttributeType): Make private
1331 (Attribute.ResolveType): Make virtual.
1332 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
1333 handling of RootContext.Tree.Types.
1335 2005-01-27 Raja R Harinath <rharinath@novell.com>
1337 Update attribute-handling to use the SimpleName/MemberAccess
1339 * cs-parser.jay (attribute): Pass in an expression to the
1340 constructors of Attribute and GlobalAttribute.
1341 * attribute.cs (Attribute): Take an expression for the name.
1342 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
1343 passed in attribute name expression.
1344 (Attribute.CheckAttributeType): Use it.
1345 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
1346 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
1347 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
1348 argument to prevent error messages if the lookup fails.
1350 2005-01-27 Marek Safar <marek.safar@seznam.cz>
1352 * expression.cs (Indirection): Implemented IVariable interface
1353 to support indirection in AddressOf operator.
1354 (PointerArithmetic.Emit): Add optimalization for case where
1355 result can be precomputed.
1357 2005-01-26 Martin Baulig <martin@ximian.com>
1359 * class.cs (TypeContainer.AttributeTargets): Return the correct
1360 AttributeTargets depending on our `Kind' instead of throwing an
1361 exception; fixes #71632.
1363 2005-01-26 Marek Safar <marek.safar@seznam.cz>
1366 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
1369 2005-01-25 Raja R Harinath <rharinath@novell.com>
1372 * expression.cs (MemberAccess.DoResolve): Don't complain with
1373 cs0572 when the LHS of a member access has identical name and type
1376 2005-01-25 Marek Safar <marek.safar@seznam.cz>
1379 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
1381 Create custom PermissionSet only for PermissionSetAttribute.
1383 2005-01-24 Marek Safar <marek.safar@seznam.cz>
1386 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
1387 delegates in static class.
1389 2005-01-24 Martin Baulig <martin@ximian.com>
1391 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
1392 merging an implicit block, just use its reachability.
1394 * statement.cs (Block.Resolve): Make the unreachable code check
1395 work wrt. implicit blocks; see test-337 from #63842.
1397 2005-01-21 Alp Toker <alp@atoker.com>
1399 * cs-parser.jay: destructor_declaration's container is PartialContainer
1400 not Class when partial types are used, so use Kind prop instead of
1403 2005-01-22 Miguel de Icaza <miguel@ximian.com>
1405 * cs-parser.jay: Improve error reporting when an interface
1408 2005-01-20 Dick Porter <dick@ximian.com>
1410 * support.cs: SeekableStreamReader fix from Sandor Dobos
1411 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
1412 chars are read. Fixes bug 70369.
1414 2005-01-20 Raja R Harinath <rharinath@novell.com>
1416 * cs-parser.jay (catch_clause): Simplify current_block handling
1419 2005-01-17 Miguel de Icaza <miguel@ximian.com>
1421 * convert.cs (ImplicitStandardConversionExists): Synchronize the
1422 code with ImplicitStandardConversion to handle the implicit
1423 conversion of method groups into valid delegate invocations.
1425 The problem is that in parameter handling we were using this code
1426 path. Fixes bug #64698
1428 2005-01-19 Raja R Harinath <rharinath@novell.com>
1430 * cs-parser.jay: Fix several infelicities.
1431 - Avoid assigning to the parser value stack. Code like
1432 '$3 = null' is unclean. Synthesize a value for the code block
1434 - Avoid using oob_stack for storing location information. Use ...
1435 (_mark_): ... this. New (empty) rule. Saves the current location
1437 (foreach_statement): Avoid using oob_stack for current_block
1438 handling. Use technique used in for_statement and
1439 using_statement. Synthesize a value for the code block to store
1440 additional intermediate information.
1442 2005-01-13 Miguel de Icaza <miguel@ximian.com>
1444 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
1445 of a different type is only allowed to private fields of a
1446 containing type, not on fields of a base class.
1448 See test-174.cs and error cs0122-9.cs
1450 2005-01-13 Raja R Harinath <rharinath@novell.com>
1452 Fix test-335.cs (bug #58126).
1453 * cs-parser.jay (argument): Split out non-expression parts of the
1454 rule into 'non_simple_argument'.
1455 (invocation_expression): Support parenthesized invocations with
1456 multiple arguments, and with single non-simple arguments.
1458 2005-01-13 Raja R Harinath <rharinath@novell.com>
1460 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
1463 2005-01-12 Raja R Harinath <rharinath@novell.com>
1465 Fix cs0038-1.cs, cs1640-6.cs.
1466 * ecore.cs (Expression.Resolve): Remove special-case for
1467 SimpleName in error-handling.
1468 (Expression.almostMatchedMembers): Relax access permission to
1470 (Expression.MemberLookupFailed): Handle duplicates in
1471 almostMatchedMembers list.
1472 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
1473 * expression.cs (New.DoResolve): Report CS1540 for more cases.
1474 * typemanager.cs (GetFullNameSignature): Use the MethodBase
1475 overload if the passed in MemberInfo is a MethodBase.
1477 2005-01-12 Marek Safar <marek.safar@seznam.cz>
1480 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
1481 for non-CAS & merge permission sets properly.
1483 2005-01-11 Raja R Harinath <rharinath@novell.com>
1485 Improve standard-compliance of simple name and member access
1486 resolution. Fixes bugs #52697, #57200, #67520, #69519.
1487 * ecore.cs (FullNamedExpression): New abstract base class
1488 for Namespaces and TypeExpressions.
1489 (ResolveFlags.SimpleName): Remove.
1490 (SimpleName): Remove support for dotted names.
1491 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
1492 DeclSpace.FindType and DeclSpace.LookupType.
1493 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
1494 (Expression.ExprClassName): Make member function.
1495 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
1496 a namespace. Remove creation of dotted "SimpleName"s.
1497 (MemberAccess.DoResolve): Likewise.
1498 * decl.cs (DeclSpace.Cache): Make private.
1499 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
1500 (DeclSpace.FindType): Update.
1501 (DeclSpace.LookupType): Move here from RootContext. Return a
1502 FullNamedExpression.
1503 * namespace.cs (Namespace): Derive from FullNamedExpression
1504 so that it can be part of expression resolution.
1505 (Namespace.Lookup): Return an FullNamedExpression.
1506 (NamespaceEntry.LookupAlias): Lookup aliases only in current
1508 * rootcontext.cs (NamespaceLookup): Remove.
1509 (LookupType): Move to DeclSpace.
1510 * attribute.cs (CheckAttributeType): Update.
1511 * doc.cs (FindDocumentedType): Remove allowAlias argument.
1512 (FindDocumentedTypeNonArray): Likewise.
1514 2005-01-11 Raja R Harinath <rharinath@novell.com>
1516 Fix cs0509.cs, cs1632.cs.
1517 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
1518 is the same as IsInterface.
1519 (TypeContainer.GetClassBases): Likewise.
1520 * statement.cs (LabeledStatement.ig): New field.
1521 (LabeledStatement.LabelTarget): Save ILGenerator which created the
1523 (LabeledStatement.DoEmit): Check that the label was created with
1524 the same ILGenerator.
1526 2005-01-10 Marek Safar <marek.safar@seznam.cz>
1529 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
1530 accessors to its properties.
1532 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
1533 from accessors to property.
1535 2005-01-10 Marek Safar <marek.safar@seznam.cz>
1538 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
1541 2005-01-08 Miguel de Icaza <miguel@ximian.com>
1543 * attribute.cs: Check for null and empty strings.
1545 I have lost another battle to Paolo.
1547 2005-01-07 Marek Safar <marek.safar@seznam.cz>
1550 * class.cs (PropertyMethod): Set Parent field in ctors.
1551 (SetMethod.InternalParameters): Add unsafe switch hack.
1552 Override MarkForDuplicationCheck where it is appropriate.
1554 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
1555 It says whether container allows members with the same name.
1557 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
1558 Removed is_method parameter.
1560 2005-01-06 Duncan Mak <duncan@ximian.com>
1562 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
1563 because the previous change led to incorrect reporting of CS1032
1564 ("Cannot define/undefine preprocessor symbols after first token in
1565 file"). Instead of using `tokens_seen' as the only flag that
1566 triggers CS1040, introduce `comments_seen'. This new flag is used
1567 to signify having seen comments on the current line, so it is
1568 unset after a newline.
1570 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
1572 * doc.cs : When searching for a type, find nested type too.
1573 This fixes bug #71040.
1575 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
1578 - Warn missing member comment on those classes which also does not
1579 have doc comments. Fixed bug #71041.
1580 - Don't warn missing doc comment on default constructor.
1583 2005-01-06 Duncan Mak <duncan@ximian.com>
1585 * cs-tokenizer.cs (xtoken): After handling traditional C-style
1586 comments, set `tokens_seen' to true. This allows us to detect
1587 misplaced preprocessor directives (i.e. not at the beginning of
1588 the a line, nor after whitespaces). In that case, report error
1589 CS1040. This fixes bug #56460.
1591 * cs-parser.jay (interface_member_declaration): Add checks for
1592 IsExplicitImpl, and report CS0541 error if an interface member is
1593 defined as an explicit interface declaration.
1595 2005-01-06 Marek Safar <marek.safar@seznam.cz>
1598 * class.cs (PropertyMethod): Set Parent field in ctors.
1599 (SetMethod.InternalParameters): Add unsafe switch hack.
1601 * decl.cs (MemberCore.Parent): Cannot be readonly.
1603 2005-01-06 Raja R Harinath <rharinath@novell.com>
1605 * decl.cs (DeclSpace.ResolveType): Remove.
1606 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
1607 Merge in code from ...
1608 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
1609 * class.cs, enum.cs: Update to changes.
1611 2005-01-06 Miguel de Icaza <miguel@ximian.com>
1613 * anonymous.cs: Ensure that we init the scope of our parent if it
1614 has not been initialized yet.
1616 2004-12-30 Duncan Mak <duncan@ximian.com>
1618 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
1619 if field.FieldBuilder is null. Fixes #70758.
1621 * convert.cs: Fixed some typos and updated some of the comments.
1622 (ImplicitStandardConversionExists):
1623 (TryImplicitIntConversion): If `target_type' is an interface and
1624 the type of `ic' implements this interface, return true or a new
1625 BoxedCast instead of null. This fixes #70468.
1627 2004-12-29 Duncan Mak <duncan@ximian.com>
1629 * expression.cs (Argument.Emit): Check that Expr is
1630 IMemoryLocation before casting to it, and report CS1510 otherwise.
1634 2004-12-21 Ben Maurer <bmaurer@ximian.com>
1636 * statement.cs (Block.ThisVariable): remove the recursion here, to
1637 make the --profile more sane.
1639 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
1641 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
1642 assembly, by JB Evain.
1644 2004-12-17 Raja R Harinath <rharinath@novell.com>
1646 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
1647 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
1648 "parent" refers to enclosing type/class. "base" refers to superclass.
1650 2004-12-17 Raja R Harinath <rharinath@novell.com>
1652 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
1653 Ensure that we only have GlobalAttributes.
1654 * attribute.cs (Attribute.Emit): Make non-virtual.
1655 (GlobalAttribute.Emit): Remove.
1656 (Attribute.Resolve): Make virtual.
1657 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
1658 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
1659 the argument. Don't create one.
1660 (Attribute.GetObsoleteAttribute): Likewise.
1661 (Attribute.GetClsCompliantAttributeValue): Likewise.
1662 * class.cs, decl.cs: Update to changes.
1664 2004-12-17 Marek Safar <marek.safar@seznam.cz>
1666 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
1668 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
1670 * statement.cs (Foreach.Resolve): Add error 186 report.
1672 2004-12-16 Marek Safar <marek.safar@seznam.cz>
1674 * expression.cs (Conditional.DoResolve): Add warning 429.
1676 * statement.cs (If.Resolve): Add warning 665.
1678 2004-12-16 Raja R Harinath <rharinath@novell.com>
1680 New invariant: RootContext.Tree.Types.NamespaceEntry == null
1681 except when in the parser, and in GlobalAttribute.
1682 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
1683 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
1684 RootContext.Tree.Types.NamespaceEntry once work is done.
1685 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
1686 and resets RootContext.Tree.Types.NamespaceEntry.
1688 2004-12-15 Marek Safar <marek.safar@seznam.cz>
1690 * cs-parser.jay: Don't create a block for every variable.
1692 2004-12-14 Miguel de Icaza <miguel@ximian.com>
1694 * location.cs: Provide extra information.
1696 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
1697 variables from the captured environment, it is the ldarg_0.
1699 2004-12-14 Marek Safar <marek.safar@seznam.cz>
1701 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
1704 * class.cs: Changed warning level for 169 to avoid developer
1705 displeasure from warning flooding. It will be changed back when they
1706 fix most of current BCL warnings.
1708 * RootContext.cs: Pushed default WarningLevel to 3.
1710 * statement.cs: Removed unused variable.
1712 2004-12-14 Marek Safar <marek.safar@seznam.cz>
1714 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
1715 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
1716 Add error 502 report.
1717 (StaticClass.DefineType): Add error 441 report.
1718 (Class.AllowedModifiersProp): New virtual property as temporary
1719 extension to AllowedModifiers.
1720 (Class.DefineType): Add error 418 report. Moved ModFlags check here
1721 to share implementation with StaticClass and don't call virtual
1724 * driver.cs (MainDriver): Add error 1558 test.
1726 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
1727 report. Moved error 36 test here.
1729 * statement.cs (Throw.Resolve): Add error 724 report.
1731 * typemanager.cs: Add out_attribute_type core type.
1733 2004-12-13 Marek Safar <marek.safar@seznam.cz>
1735 * class.cs (TypeContainer.VerifyClsCompliance): Add error
1737 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
1739 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
1742 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
1744 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
1745 Add error 3023 report.
1746 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
1748 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
1751 2004-12-12 John Luke <john.luke@gmail.com>
1753 * driver.cs (AddArgs): take -- into account when
1754 adding arguments, fixes bug 65710
1756 2004-12-12 Martin Baulig <martin@ximian.com>
1758 * expression.cs (Unary.TryReduceNegative): Added support for
1759 SByteConstant and ByteConstant.
1760 (Unary.Reduce): Check error values from TryReduceNegative().
1762 2004-12-10 Marek Safar <marek.safar@seznam.cz>
1764 * attributes.cs (Attribute.Resolve): Avoid multiple error report
1765 and report exception as error 182.
1767 2004-12-10 Raja R Harinath <rharinath@novell.com>
1769 * driver.cs (Main): Fix message when there are warnings.
1771 2004-12-09 Miguel de Icaza <miguel@ximian.com>
1773 * delegate.cs: Fixed my fix from yesterday, sorry about that.
1775 2004-12-09 Marek Safar <marek.safar@seznam.cz>
1777 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
1778 Reduced number of warnings.
1780 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
1782 2004-12-08 Miguel de Icaza <miguel@ximian.com>
1784 * driver.cs: Removed message.
1786 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
1788 2004-12-08 <vargaz@freemail.hu>
1790 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
1792 2004-12-08 Martin Baulig <martin@ximian.com>
1794 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
1795 instead of a CS3002 for properties and indexer.
1797 2004-12-08 Martin Baulig <martin@ximian.com>
1799 * decl.cs (MemberName.ToString): Make this work again.
1801 2004-12-08 Marek Safar <marek.safar@seznam.cz>
1803 * attribute.cs (Resolve): Add error 591 detection.
1805 * class.cs (FieldMember.Define): Add error 1547 detection.
1806 (Indexer.Define): Add error 620 detection.
1807 (Operator.Define): Add error 590 detection.
1809 * ecore.cs: Missing argument for error 79.
1811 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
1814 2004-12-07 Marek Safar <marek.safar@seznam.cz>
1817 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
1820 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
1822 * cs-parser.jay : handle doc comments on implicit/explicit operators.
1823 Some operator comments were suppressed.
1824 * doc.cs : Implicit/explicit operator name in doc comments are like
1825 "op_Explicit(type)~returnType", so added suffix handling.
1827 2004-12-07 Martin Baulig <martin@ximian.com>
1830 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
1831 (MemberCore.GetClsCompliantAttributeValue): Likewise.
1832 (DeclSpace.ec): New protected field; store the EmitContext here.
1833 (DeclSpace.EmitContext): New public property; moved here from
1835 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
1838 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
1839 (Enum.Emit): Don't create a new EmitContext.
1841 * delegate.cs (Delegate.DefineType): Always create the
1844 * iterators.cs (Iterators.DefineIterator): Create a new
1845 EmitContext and store it in `ec'.
1847 2004-08-24 Martin Baulig <martin@ximian.com>
1850 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
1851 this for accessibility checks.
1852 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
1853 IsNestedFamilyAccessible.
1854 (TypeManager.IsSubclassOf): New method, do what the name actually
1857 2004-12-06 Raja R Harinath <rharinath@novell.com>
1859 Fix crash on cs0657-17.cs.
1860 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
1861 Use RootContext.Tree.Types, not 'new RootTypes ()'.
1862 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
1863 the case where the NamespaceEntry gets overwritten.
1865 2004-12-06 Marek Safar <marek.safar@seznam.cz>
1867 Fixed #69195, #56821
1868 * ecore.cs (ResolveBoolean): Tiny refactoring.
1870 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
1871 of right expression resolving when left is false constant and
1872 operator is LogicalAnd OR true constant and operator is LogicalOr.
1874 * statement.cs (ResolveUnreachable): Always reports warning.
1876 2004-12-05 Miguel de Icaza <miguel@ximian.com>
1878 * class.cs: Distinguish between 1721 and 1722 (just a little help
1879 for the programmer).
1881 2004-12-03 Miguel de Icaza <miguel@ximian.com>
1883 * delegate.cs: Only allow this on new versions of the language.
1885 2004-12-02 Duncan Mak <duncan@ximian.com>
1887 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
1889 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
1890 here as a static method. Take an additional bool out parameter
1891 `must_do_cs1540_check' for signaling to InstanceResolve.
1892 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
1893 member field from PropertyExpr class and made it an argument of
1895 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
1896 check for MarshalByRefObject, and report CS0122 instead of CS1540.
1897 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
1898 and `remove_accessor' as well as InstanceResolve: report CS0122
1903 2004-12-03 Raja R Harinath <rharinath@novell.com>
1905 Fix test-327.cs, test-328.cs, and put in early infrastructure
1906 for eventually fixing #52697.
1907 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
1908 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
1910 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
1911 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
1912 (VerifyUsing, error246): Update.
1913 * rootcontext.cs (RootContext.NamespaceLookup): Just use
1914 'NamespaceEntry.LookupNamespaceOrType'.
1916 2004-12-03 Martin Baulig <martin@ximian.com>
1918 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
1919 method as our child, call AnonymousMethod.Compatible() on it.
1921 2004-12-03 Raja R Harinath <rharinath@novell.com>
1923 Disable XML documentation support in 'basic' profile.
1924 * decl.cs, class.cs [BOOTSTRAP_WITH_OLDLIB]: Don't import System.Xml.
1925 Redirect XmlElement to System.Object.
1926 * driver.cs, enum.cs, rootcontext.cs: Don't reference System.Xml.
1927 * doc.cs [BOOTSTRAP_WITH_OLDLIB]: Disable compile.
1928 * mcs.exe.sources: Add doc-bootstrap.cs.
1929 * doc-bootstrap.cs: New file. Contains empty stub implementation
1932 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
1934 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
1935 comments are allowed.
1937 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
1939 * delegate.cs: Add checks for subtypes in paramaters and return values
1940 in VerifyMethod () to add support for Covariance/Contravariance
1943 2004-12-02 Miguel de Icaza <miguel@ximian.com>
1945 * report.cs: Remove extra closing parenthesis.
1947 * convert.cs (Error_CannotImplicitConversion): If the name of the
1948 types are the same, provide some extra information.
1950 * class.cs (FieldBase): Use an unused bit field from the field to
1951 encode the `has_offset' property from the FieldMember. This saves
1952 a couple of Ks on bootstrap compilation.
1954 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
1955 method as our child, return the AnonymousMethod resolved
1958 * expression.cs (New.DoResolve): Allow return values from
1959 NewDelegate to also include AnonymousMethods.
1963 2004-12-02 Marek Safar <marek.safar@seznam.cz>
1966 * attribute.cs (Resolve): Improved implementation of params
1967 attribute arguments.
1969 * support.cs (ParameterData): Add HasParams to be faster.
1971 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
1973 all things are for /doc support:
1975 * doc.cs: new file that supports XML documentation generation.
1976 * mcs.exe.sources: added doc.cs.
1978 Handle /doc command line option.
1979 Report error 2006 instead of 5 for missing file name for /doc.
1980 Generate XML documentation when required, after type resolution.
1982 Added support for picking up documentation (/// and /** ... */),
1983 including a new XmlCommentState enumeration.
1985 Added lines to fill Documentation element for field, constant,
1986 property, indexer, method, constructor, destructor, operator, event
1987 and class, struct, interface, delegate, enum.
1988 Added lines to warn incorrect comment.
1990 Added Documentation field (passed only when /doc was specified).
1992 Added DocComment, DocCommentHeader, GenerateDocComment() and
1993 OnGenerateDocComment() and some supporting private members for
1994 /doc feature to MemberCore.
1996 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
1998 Added overriden DocCommentHeader.
2000 Added overriden DocCommentHeader and GenerateDocComment().
2002 2004-12-01 Miguel de Icaza <miguel@ximian.com>
2004 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
2005 unwrapping the enumeration values, chain to
2006 DoConstantNumericPromotions again, so we can promote things to the
2007 fundamental types (takes care of enums that are bytes, sbytes).
2011 2004-12-01 Raja R Harinath <rharinath@novell.com>
2013 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
2014 Fix long-standing bug in type-lookup. Use FindType instead of
2015 LookupType when ec.ResolvingTypeTree.
2016 (Attribute.ResolveType, Attribute.Resolve)
2017 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
2019 (Attributes.Search): Remove internal version. Update.
2020 (Attributes.SearchMulti): Update.
2021 (Attributes.GetClsCompliantAttribute): Remove.
2022 (Attributes.GetIndexerNameAttribute): Remove.
2023 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
2024 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
2025 * class.cs (Indexer.Define): Likewise.
2027 2004-12-01 Marek Safar <marek.safar@seznam.cz>
2030 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
2031 MarshallByReference members access.
2033 * expression.cs: Use CheckMarshallByRefAccess;
2034 Better error CS0197 message.
2036 * report.cs: Print whole related error message.
2038 2004-11-30 Raja R Harinath <rharinath@novell.com>
2040 * Makefile (mcs.exe) [PROFILE=default]: Keep a copy of mcs.exe in
2041 the current directory to help debugging.
2043 2004-11-29 Marek Safar <marek.safar@seznam.cz>
2045 * class (GetClassBases): Better error 60 report.
2046 (EventProperty): Disabled warning 67 detection.
2048 2004-11-29 Marek Safar <marek.safar@seznam.cz>
2051 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
2053 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
2056 2004-11-29 Marek Safar <marek.safar@seznam.cz>
2059 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
2061 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
2063 2004-11-26 Miguel de Icaza <miguel@ximian.com>
2065 * attribute.cs (Attribute.Resolve): Refine error reporting and
2066 report a cs0117 if the identifier does not exist, to distinguish
2067 from 0617 which is a miss-use of the actual identifier.
2069 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
2070 between cs0070 and cs0079.
2072 * class.cs (MemberBase.DoDefine): When reporting a wrong
2073 accessibility level, we use MethodCore to compare instead of
2074 Method (this was a regression in some refactoring effort).
2076 So now we correctly report cs0056 again.
2078 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
2079 testing the target_type (which was known to be object_type) and
2080 not the source type (which is anonymous_method).
2082 Fixed reporting of error cs1660.
2084 * expression.cs (UserCast.Source): Expose the underlying cast.
2086 * statement.cs (Switch.SwitchGoverningType): Sort the list of
2087 allowed types to find a match to int32 first (most common).
2089 In addition, it ignores any ImplicitUserConversions that did an
2090 internal implicit conversion (as the switch statement allows only
2091 one integral conversion to exist).
2093 * class.cs (PartialContainer.Create): rename `name' to
2094 `member_name' for clarity. Then replace the string calls with a
2095 call to MemberName.GetPartialName, as now using
2096 MemberName.ToString is an error (this is due to the side effects
2097 it had, that were fixed in the past).
2099 This will restore the error reporting on a number of partial class
2100 errors that were missusing this (and getting an exception as a
2101 results, which is now just a plain textual warning, because
2102 yyparse debug output would crash otherwise).
2104 2004-11-26 Raja R Harinath <rharinath@novell.com>
2106 * Makefile (PROGRAM_INSTALL_DIR): Remove.
2108 2004-11-25 Ben Maurer <bmaurer@ximian.com>
2110 * rootcontext.cs (LookupType): Make sure to cache lookups that
2111 don't give us a negative result. This saves about 5% of corlib
2114 2004-11-25 Miguel de Icaza <miguel@ximian.com>
2116 * report.cs (AbstractMessage.Print): messages are sent to stderr
2118 * class.cs (TypeContainer.GetClassBases): It is an error to have a
2119 non-interface in the list of interfaces (at this point, either
2120 parent was properly set, or a base class is being listed in the
2121 interfaces section).
2123 This flags error 1722, and resolves the crash from bug 69259.
2125 2004-11-25 Ben Maurer <bmaurer@ximian.com>
2127 * statement.cs (Using.EmitExpressionFinally): make this work right
2128 for valuetypes. Fixes 69926.
2130 2004-11-25 Miguel de Icaza <miguel@ximian.com>
2132 * const.cs (Const.ChangeType): Cope with the "0 literal can be
2133 converted to an enum" here, before we try to change the underlying
2134 type. This code exists, but it is a different code path than the
2135 one used while encoding constants.
2137 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
2138 old bug: when converting from the null literal to a pointer,
2139 return an EmptyCast, not the NullLiteral.
2141 This fixes #69921, the recent null_type changes probably made this
2144 (ImplicitReferenceConversionExists): In addition, resynchronized
2145 the code here, so it matches the same code in
2146 ImplicitReferenceConversionExists for the `from any class-type S
2147 to any interface-type T'.
2150 2004-11-25 Marek Safar <marek.safar@seznam.cz>
2152 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
2154 2004-11-24 Miguel de Icaza <miguel@ximian.com>
2156 * cs-parser.jay: Use verbosity accordingly.
2158 2004-11-24 Marek Safar <marek.safar@seznam.cz>
2160 * expression.cs (Unary.ResolveOperator): Do not report warning;
2161 AddressOf reads from variable.
2163 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
2165 2004-11-24 Marek Safar <marek.safar@seznam.cz>
2169 * attribute.cs (Attributable): Removed CheckTargets.
2170 (Attributes.Emit): Explicit attribute targets are tested here.
2172 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
2173 not enabled for interfaces.
2175 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
2176 (GetAssemblyName): Ouch next bug there.
2178 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
2180 * expression.cs: Error 275 added.
2182 2004-11-23 Marek Safar <marek.safar@seznam.cz>
2184 Fix bug #69177 (Implemented decimal constant support)
2186 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
2187 (BinaryFold): Add DecimalConstant.
2189 * const.cs (Define): Decimal constant
2191 (ChangeType): Add decimal type handling.
2192 (LookupConstantValue): Don't set value for decimal type but
2193 emit DecimalConstantAttribute. Needed for constant optimization.
2195 * constant.cs (ToDecimal): New method.
2196 (ConvertToDecimal): New method.
2197 (IntConstant): Implemented ConvertToDecimal.
2198 (DecimalConstant.Emit): Emit optimized version for decimals in
2201 * expression.cs (ResolveOperator): Changed order of constant
2202 reduction to work correctly with native types which have
2203 overloaded operators.
2204 (ResolveMemberAccess): Extract constant value from attribute
2207 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
2209 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
2210 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
2211 (ChangeType): Decimal is special.
2212 (TypeToCoreType): Add decimal type.
2214 2004-11-22 Marek Safar <marek.safar@seznam.cz>
2216 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
2219 2004-11-22 Marek Safar <marek.safar@seznam.cz>
2221 * class.cs (EventField.ApplyAttributeBuilder): Fix error
2224 2004-11-19 Marek Safar <marek.safar@seznam.cz>
2226 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
2228 * pending.cs (PendingImplementation): Grab only interfaces.
2230 2004-11-19 Marek Safar <marek.safar@seznam.cz>
2232 * statement.cs (ForeachHelperMethods): Add location member and
2233 error 202 detection.
2235 2004-11-19 Raja R Harinath <rharinath@novell.com>
2237 * Makefile (EXTRA_DISTFILES): Remove mcs.exe.config. It's
2238 automatically handled by executable.make.
2239 (PROGRAM): Make profile-specific.
2241 2004-11-18 Marek Safar <marek.safar@seznam.cz>
2243 * expression.cs (DoResolveBase): Fixed wrong warning for out
2246 2004-11-18 Martin Baulig <martin@ximian.com>
2248 Merged latest changes into gmcs. Please keep this comment in
2249 here, it makes it easier for me to see what changed in MCS since
2250 the last time I merged.
2252 2004-11-17 Raja R Harinath <rharinath@novell.com>
2254 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
2255 (TypeHandle.GetMemberCache): New.
2256 (TypeHandle.TypeHandle): Update.
2257 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
2258 (TypeManager.LookupParentInterfacesCache):
2259 Rename from LookupInterfaceCache. Optimize slightly.
2260 (TypeManager.MemberLookup_FindMembers): Update.
2261 * decl.cs (MemberCache.MemberCache): Set Container to null in the
2263 (AddCacheContents): Rename from AddHashtable.
2264 * class.cs (TypeContainer.parent_container): Remove.
2265 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
2266 (TypeContainer.DoDefineMembers): Don't initialize it.
2267 Update to name changes.
2269 2004-11-17 Miguel de Icaza <miguel@ximian.com>
2271 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
2272 that factors the code to check access modifiers on override.
2274 (PropertyBase): Use the code here.
2276 Patch from Lluis S'anchez, fixes bug #69361.
2278 2004-11-15 Miguel de Icaza <miguel@ximian.com>
2280 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
2281 routine that is used to report the use of a captured variable
2282 whose address has been taken.
2284 There are two checks: one when variables are being captured and
2285 the other check is when the address of a variable is taken.
2287 (because an anonymous methods might be resolved before *or* after
2288 the address has been taken) and
2290 * expression.cs (Conditional.DoResolve): Remove the special
2291 casing that Martin added to trueExpr and falseExpr being both
2292 NullLiteral. We get the right behavior now just by introducing
2293 the null_type into the compiler.
2295 * convert.cs (ExplicitConversion): Change the code to use
2296 null_type instead of testing `expr is NullLiteral'.
2297 (ImplicitConversionStandard): use null_type too.
2298 (ImplicitReferenceConversionExists): use null_type too.
2299 (ImplicitReferenceConversion): use null_type too.
2301 * literal.cs: The type of `NullLiteral' is now null_type instead
2303 (Resolve): Set the type here.
2305 * typemanager.cs: Introduce null_type.
2307 2004-11-17 Martin Baulig <martin@ximian.com>
2309 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
2310 direction, like FindMembers() does. Fixes #69546, testcase is in
2313 2004-11-16 Martin Baulig <martin@ximian.com>
2315 This is based on a patch from Marek Safar, see bug #69082.
2316 Fixes bugs #63705 and #67130.
2318 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
2319 method; create a MemberCache for an interface type and cache the
2322 * decl.cs (IMemberContainer.ParentContainer): Removed.
2323 (IMemberContainer.ParentCache): New property.
2324 (MemberCache.SetupCacheForInterface): Removed.
2325 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
2326 to create a cache for an interface's "parent".
2328 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
2331 2004-11-16 Martin Baulig <martin@ximian.com>
2333 Merged back from gmcs; these changes already went into gmcs a
2334 couple of weeks ago.
2337 (TypeManager.AddUserType): Removed the `ifaces' argument.
2338 (TypeManager.RegisterBuilder): Take a `Type []' instead of a
2340 (TypeManager.AddUserInterface): Removed.
2341 (TypeManager.ExpandInterfaces): Return a `Type []' instead of a
2343 (TypeManager.GetInterfaces): Likewise.
2344 (TypeManager.GetExplicitInterfaces): Likewise.
2346 * ecore.cs (TypeExpr.GetInterfaces): Removed.
2348 * class.cs (TypeContainer.base_class_type): Replaced with `ptype'.
2349 (TypeContainer.base_inteface_types): Replaced with `ifaces'.
2351 2004-11-14 Ben Maurer <bmaurer@ximian.com>
2353 * statement.cs: Avoid adding bools to a hashtable.
2355 2004-11-07 Miguel de Icaza <miguel@ximian.com>
2357 * expression.cs (Invocation.OverloadResolve): Flag error if we are
2358 calling an unsafe method from a safe location.
2360 2004-11-06 Marek Safar <marek.safar@seznam.cz>
2363 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
2365 2004-11-06 Miguel de Icaza <miguel@ximian.com>
2367 * namespace.cs (VerifyUsing): use GetPartialName instead of
2370 2004-11-05 Miguel de Icaza <miguel@ximian.com>
2372 * statement.cs (Return.Resolve): Fix regression in typo: if
2373 `in_exc', we have to request a NeedReturnLabel, this was a typo
2374 introduced in the anonymous method check-in. Fixes #69131.
2376 * Indexers were using the ShortName when defining themselves,
2377 causing a regression in the compiler bootstrap when applying the
2378 patch from 2004-11-02 (first part), now they use their full name
2379 and the bug is gone.
2381 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
2383 * driver.cs: Strip the path from the names of embedded resources. Fixes
2386 2004-11-04 Raja R Harinath <rharinath@novell.com>
2388 Fix error message regression: cs0104-2.cs.
2389 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
2390 (AliasEntry.Resolve): Update.
2391 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
2393 (RootContext.LookupType): Update.
2395 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
2397 * cs-parser.jay: Add support for handling accessor modifiers
2398 * class: Add support port accessor modifiers and error checking,
2399 define PropertyMethod.Define as virtual (not abstract anymore)
2400 * ecore.cs: Add checking for proeprties access with access modifiers
2401 * iterators.cs: Modify Accessor constructor call based in the modified
2403 2004-11-02 Ben Maurer <bmaurer@ximian.com>
2405 * expression.cs (StringConcat): Handle being called twice,
2406 as when we have a concat in a field init with more than two
2409 2004-11-02 Miguel de Icaza <miguel@ximian.com>
2411 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
2412 special case explicit implementations, we should always produce
2413 the .property or .event declaration.
2415 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
2416 since it will not return correct data if people use this
2417 unresolved in the presence of using statements (see test-313).
2419 * class.cs (MethodData.Define): If we are an explicit interface
2420 implementation, set the method name to the full name of the
2421 interface plus the name of the method.
2423 Notice that using the method.MethodName.GetFullName() does not
2424 work, as it will only contain the name as declared on the source
2425 file (it can be a shorthand in the presence of using statements)
2426 and not the fully qualifed type name, for example:
2430 class D : ICloneable {
2431 object ICloneable.Clone () {
2435 Would produce a method called `ICloneable.Clone' instead of
2436 `System.ICloneable.Clone'.
2438 * namespace.cs (Alias.Resolve): Use GetPartialName.
2440 2004-11-01 Marek Safar <marek.safar@seznam.cz>
2442 * cs-parser.jay: Add error 1055 report.
2444 2004-11-01 Miguel de Icaza <miguel@ximian.com>
2446 * assign.cs (Assign.DoResolve): Only do the transform of
2447 assignment into a New if the types are compatible, if not, fall
2448 through and let the implicit code deal with the errors and with
2449 the necessary conversions.
2451 2004-11-01 Marek Safar <marek.safar@seznam.cz>
2453 * cs-parser.jay: Add error 1031 report.
2455 * cs-tokenizer.cs: Add location for error 1038.
2457 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2459 * cs-parser.jay: Add error 1016 report.
2461 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2463 * cs-parser.jay: Add errors 1575,1611 report.
2465 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2467 * cs-parser.jay: Add error 1001 report.
2469 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2472 * attribute.cs (GetMarshal): Add method argument for
2473 caller identification.
2475 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
2476 agument for GetMarshal and RuntimeMissingSupport.
2478 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2480 * attribute.cs (ExtractSecurityPermissionSet): Removed
2481 TypeManager.code_access_permission_type.
2483 * typemanager.cs: Removed TypeManager.code_access_permission_type.
2485 2004-10-27 Miguel de Icaza <miguel@ximian.com>
2487 * expression.cs (LocalVariableReference.DoResolveLValue): Check
2488 for obsolete use of a variable here. Fixes regression on errors
2489 cs0619-25 and cs0619-26.
2491 2004-10-27 Marek Safar <marek.safar@seznam.cz>
2493 Fix #62358, implemented security attribute encoding.
2495 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
2496 Tests permitted SecurityAction for assembly or other types.
2497 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
2498 data from SecurityPermissionAttribute to PermisionSet class.
2500 * class.cs (ApplyAttributeBuilder): Added special handling
2501 for System.Security.Permissions.SecurityAttribute based types.
2503 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
2504 special handling for System.Security.Permissions.SecurityAttribute
2507 * enum.cs (ApplyAttributeBuilder): Added special handling
2508 for System.Security.Permissions.SecurityAttribute based types.
2510 * parameter.cs (ApplyAttributeBuilder): Added special handling
2511 for System.Security.Permissions.SecurityAttribute based types.
2513 * rootcontext.cs: Next 2 core types.
2515 * typemanager.cs (TypeManager.security_permission_attr_type):
2516 Built in type for the SecurityPermission Attribute.
2517 (code_access_permission_type): Build in type.
2519 2004-10-17 Miguel de Icaza <miguel@ximian.com>
2521 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
2522 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
2523 all of this information into
2524 EmitContext.EmitCapturedVariableInstance.
2526 * codegen.cs (EmitCapturedVariableInstance): move here the
2527 funcionality of emitting an ldarg.0 in the presence of a
2528 remapping. This centralizes the instance emit code.
2530 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
2531 then emit a load of this: it means that we have reached the
2532 topmost ScopeInfo: the one that contains the pointer to the
2533 instance of the class hosting the anonymous method.
2535 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
2536 captures to the topmost CaptureContext.
2538 2004-10-12 Miguel de Icaza <miguel@ximian.com>
2540 * expression.cs (LocalVariableReference): Move the knowledge about
2541 the iterators into codegen's EmitCapturedVariableInstance.
2543 2004-10-11 Miguel de Icaza <miguel@ximian.com>
2545 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
2546 all code paths return a value from an anonymous method (it is the
2547 same as the 161 error, but for anonymous methods).
2549 2004-10-08 Miguel de Icaza <miguel@ximian.com>
2551 The introduction of anonymous methods in the compiler changed
2552 various ways of doing things in the compiler. The most
2553 significant one is the hard split between the resolution phase
2554 and the emission phases of the compiler.
2556 For instance, routines that referenced local variables no
2557 longer can safely create temporary variables during the
2558 resolution phase: they must do so from the emission phase,
2559 since the variable might have been "captured", hence access to
2560 it can not be done with the local-variable operations from the runtime.
2564 (Block.Flags): New flag `IsTopLevel' to indicate that this block
2565 is a toplevel block.
2567 (ToplevelBlock): A new kind of Block, these are the blocks that
2568 are created by the parser for all toplevel method bodies. These
2569 include methods, accessors and anonymous methods.
2571 These contain some extra information not found in regular blocks:
2572 A pointer to an optional CaptureContext (for tracking captured
2573 local variables and parameters). A pointer to the parent
2576 (Return.Resolve): Catch missmatches when returning a value from an
2577 anonymous method (error 1662).
2578 Invoke NeedReturnLabel from the Resolve phase instead of the emit
2581 (Break.Resolve): ditto.
2583 (SwitchLabel): instead of defining the labels during the
2584 resolution phase, we now turned the public ILLabel and ILLabelCode
2585 labels into methods called GetILLabelCode() and GetILLabel() that
2586 only define the label during the Emit phase.
2588 (GotoCase): Track the SwitchLabel instead of the computed label
2589 (its contained therein). Emit the code by using
2590 SwitchLabel.GetILLabelCode ().
2592 (LocalInfo.Flags.Captured): A new flag has been introduce to track
2593 whether the Local has been captured or not.
2595 (LocalInfo.IsCaptured): New property, used to tell whether the
2596 local has been captured.
2598 * anonymous.cs: Vastly updated to contain the anonymous method
2601 The main classes here are: CaptureContext which tracks any
2602 captured information for a toplevel block and ScopeInfo used to
2603 track the activation frames for various local variables.
2605 Each toplevel block has an optional capture context associated
2606 with it. When a method contains an anonymous method both the
2607 toplevel method and the anonymous method will create a capture
2608 context. When variables or parameters are captured, they are
2609 recorded on the CaptureContext that owns them, for example:
2613 MyDelegate d = delegate {
2618 Here `a' will be recorded as captured on the toplevel
2619 CapturedContext, the inner captured context will not have anything
2620 (it will only have data if local variables or parameters from it
2621 are captured in a nested anonymous method.
2623 The ScopeInfo is used to track the activation frames for local
2624 variables, for example:
2626 for (int i = 0; i < 10; i++)
2627 for (int j = 0; j < 10; j++){
2628 MyDelegate d = delegate {
2633 At runtime this captures a single captured variable `i', but it
2634 captures 10 different versions of the variable `j'. The variable
2635 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
2636 recorded on a child.
2638 The toplevel ScopeInfo will also track information like the `this'
2639 pointer if instance variables were referenced (this is necessary
2640 as the anonymous method lives inside a nested class in the host
2641 type of the method).
2643 (AnonymousMethod): Expanded to track the Toplevel, implement
2644 `AnonymousMethod.Compatible' to tell whether an anonymous method
2645 can be converted to a target delegate type.
2647 The routine now also produces the anonymous method content
2649 (AnonymousDelegate): A helper class that derives from
2650 DelegateCreation, this is used to generate the code necessary to
2651 produce the delegate for the anonymous method that was created.
2653 * assign.cs: API adjustments for new changes in
2654 Convert.ImplicitStandardConversionExists.
2656 * class.cs: Adjustments to cope with the fact that now toplevel
2657 blocks are of type `ToplevelBlock'.
2659 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
2660 insteda of standard blocks.
2662 Flag errors if params arguments are passed to anonymous methods.
2664 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
2665 `CurrentAnonymousMethod' which points to the current Anonymous
2666 Method. The variable points to the AnonymousMethod class that
2667 holds the code being compiled. It is set in the new EmitContext
2668 created for the anonymous method.
2670 (EmitContext.Phase): Introduce a variable and an enumeration to
2671 assist in enforcing some rules about when and where we are allowed
2672 to invoke certain methods (EmitContext.NeedsReturnLabel is the
2673 only one that enfonces this right now).
2675 (EmitContext.HaveCaptureInfo): new helper method that returns
2676 whether we have a CapturedContext initialized.
2678 (EmitContext.CaptureVariable): New method used to register that a
2679 LocalInfo must be flagged for capturing.
2681 (EmitContext.CapturedParameter): New method used to register that a
2682 parameters must be flagged for capturing.
2684 (EmitContext.CapturedField): New method used to register that a
2685 field must be flagged for capturing.
2687 (EmitContext.HaveCapturedVariables,
2688 EmitContext.HaveCapturedFields): Return whether there are captured
2689 variables or fields.
2691 (EmitContext.EmitMethodHostInstance): This is used to emit the
2692 instance for the anonymous method. The instance might be null
2693 (static methods), this (for anonymous methods that capture nothing
2694 and happen to live side-by-side with the current method body) or a
2695 more complicated expression if the method has a CaptureContext.
2697 (EmitContext.EmitTopBlock): Routine that drives the emission of
2698 code: it will first resolve the top block, then emit any metadata
2699 and then emit the code. The split is done so that we can extract
2700 any anonymous methods and flag any captured variables/parameters.
2702 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
2703 during this phase, the ILGenerator should not be used as labels
2704 and local variables declared here might not be accessible to any
2705 code that is part of an anonymous method.
2707 Exceptions to this include the temporary variables that are
2708 created by some statements internally for holding temporary
2711 (EmitContext.EmitMeta): New routine, in charge of emitting all the
2714 (EmitContext.TemporaryReturn): This method is typically called
2715 from the Emit phase, and its the only place where we allow the
2716 ReturnLabel to be defined other than the EmitMeta. The reason is
2717 that otherwise we would have to duplicate a lot of logic in the
2718 Resolve phases of various methods that today is on the Emit
2721 (EmitContext.NeedReturnLabel): This no longer creates the label,
2722 as the ILGenerator is not valid during the resolve phase.
2724 (EmitContext.EmitThis): Extended the knowledge in this class to
2725 work in anonymous methods in addition to iterators.
2727 (EmitContext.EmitCapturedVariableInstance): This emits whatever
2728 code is necessary on the stack to access the instance to a local
2729 variable (the variable will be accessed as a field).
2731 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
2732 EmitContext.EmitAddressOfParameter): Routines to support
2733 parameters (not completed at this point).
2735 Removals: Removed RemapLocal and RemapLocalLValue. We probably
2736 will also remove the parameters.
2738 * convert.cs (Convert): Define a `ConstantEC' which points to a
2739 null. This is just to prefity some code that uses
2740 ImplicitStandardConversion code and do not have an EmitContext
2743 The idea is to flag explicitly that at that point in time, it is
2744 known that the conversion will not trigger the delegate checking
2745 code in implicit conversions (which requires a valid
2748 Everywhere: pass new EmitContext parameter since
2749 ImplicitStandardConversionExists now requires it to check for
2750 anonymous method conversions.
2752 (Convert.ImplicitStandardConversionExists): If the type of an
2753 expression is the anonymous_method_type, and the type is a
2754 delegate, we invoke the AnonymousMethod.Compatible method to check
2755 whether an implicit conversion is possible.
2757 (Convert.ImplicitConversionStandard): Only do implicit method
2758 group conversions if the language level is not ISO_1.
2760 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
2761 MethodInfo for the Invoke method. used by Delegate and
2764 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
2765 method conversions if the target type is a delegate.
2767 Removed extra debugging nops.
2769 (LocalVariableReference): Turn the `local_info' into a public
2772 Add `prepared' field, the same hack used for FieldExprs to cope
2773 with composed assignments, as Local variables do not necessarily
2774 operate purely on the stack as they used to: they can be captured
2777 Add `temp' for a temporary result, like fields.
2779 Refactor DoResolve and DoResolveLValue into DoResolveBase.
2781 It now copes with Local variables that are captured and emits the
2782 proper instance variable to load it from a field in the captured
2785 (ParameterReference.DoResolveBase): During the resolve phase,
2786 capture parameters if we are in an anonymous method.
2788 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
2789 anonymous method, use the EmitContext helper routines to emit the
2790 parameter reference.
2792 * iterators.cs: Set RemapToProxy to true/false during the
2795 * parameters.cs (GetParameterByName): New helper method.
2797 * typemanager.cs (anonymous_method_type) a new type that
2798 represents an anonyous method. This is always an internal type,
2799 used as a fencepost to test against the anonymous-methodness of an
2802 2004-10-20 Marek Safar <marek.safar@seznam.cz>
2804 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
2806 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
2808 2004-10-18 Martin Baulig <martin@ximian.com>
2810 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
2811 `Type' directly, but call ResolveType() on it.
2812 (Catch.Resolve): Likewise.
2813 (Foreach.Resolve): Likewise.
2815 2004-10-18 Martin Baulig <martin@ximian.com>
2817 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
2818 `Type' directly, but call ResolveType() on it.
2819 (Probe.DoResolve): Likewise.
2820 (ArrayCreation.LookupType): Likewise.
2821 (TypeOf.DoResolve): Likewise.
2822 (SizeOf.DoResolve): Likewise.
2824 2004-10-18 Martin Baulig <martin@ximian.com>
2826 * expression.cs (Invocation.BetterFunction): Put back
2827 TypeManager.TypeToCoreType().
2829 2004-10-18 Raja R Harinath <rharinath@novell.com>
2831 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
2834 2004-10-18 Martin Baulig <martin@ximian.com>
2836 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
2837 `Type' directly, but call ResolveType() on it.
2839 2004-10-18 Martin Baulig <martin@ximian.com>
2841 * class.cs (FieldMember.Define): Don't access the TypeExpr's
2842 `Type' directly, but call ResolveType() on it.
2843 (MemberBase.DoDefine): Likewise.
2845 * expression.cs (New.DoResolve): Don't access the TypeExpr's
2846 `Type' directly, but call ResolveType() on it.
2847 (ComposedCast.DoResolveAsTypeStep): Likewise.
2849 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
2850 `Type' directly, but call ResolveType() on it.
2852 2004-10-17 John Luke <john.luke@gmail.com>
2854 * class.cs (Operator.GetSignatureForError): use CSharpName
2856 * parameter.cs (Parameter.GetSignatureForError): Returns
2857 correct name even if was not defined.
2859 2004-10-13 Raja R Harinath <rharinath@novell.com>
2862 * class.cs (TypeContainer.EmitContext): New property.
2863 (DefineNestedTypes): Create an emitcontext for each part.
2864 (MethodCore.DoDefineParameters): Use container's emitcontext.
2865 Pass type array to InternalParameters.
2866 (MemberBase.DoDefine): Use container's emitcontext.
2867 (FieldMember.Define): Likewise.
2868 (Event.Define): Likewise.
2869 (SetMethod.GetParameterInfo): Change argument to EmitContext.
2870 Pass type array to InternalParameters.
2871 (SetIndexerMethod.GetParameterInfo): Likewise.
2872 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
2873 * delegate.cs (Define): Pass emitcontext to
2874 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
2875 array to InternalParameters.
2876 * expression.cs (ParameterReference.DoResolveBase): Pass
2877 emitcontext to GetParameterInfo.
2878 (ComposedCast.DoResolveAsTypeStep): Remove check on
2879 ec.ResolvingTypeTree.
2880 * parameter.cs (Parameter.Resolve): Change argument to
2881 EmitContext. Use ResolveAsTypeTerminal.
2882 (Parameter.GetSignature): Change argument to EmitContext.
2883 (Parameters.ComputeSignature): Likewise.
2884 (Parameters.ComputeParameterTypes): Likewise.
2885 (Parameters.GetParameterInfo): Likewise.
2886 (Parameters.ComputeAndDefineParameterTypes): Likewise.
2887 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
2888 * support.cs (InternalParameters..ctor): Remove variant that takes
2890 * typemanager.cs (system_intptr_expr): New.
2891 (InitExpressionTypes): Initialize it.
2893 2004-10-12 Chris Toshok <toshok@ximian.com>
2895 * cs-parser.jay: fix location for try_statement and catch_clause.
2897 2004-10-11 Martin Baulig <martin@ximian.com>
2899 * report.cs: Don't make --fatal abort on warnings, we have
2900 -warnaserror for that.
2902 2004-10-07 Raja R Harinath <rharinath@novell.com>
2904 More DeclSpace.ResolveType avoidance.
2905 * decl.cs (MemberCore.InUnsafe): New property.
2906 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
2907 with newly created EmitContext.
2908 (FieldMember.Define): Likewise.
2909 * delegate.cs (Delegate.Define): Likewise.
2910 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
2911 only if normal name-lookup fails.
2912 (TypeExpr.DoResolve): Enable error-checking.
2913 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
2914 (SizeOf.DoResolve): Likewise.
2915 (ComposedCast.DoResolveAsTypeStep): Likewise.
2916 (StackAlloc.DoResolve): Likewise.
2917 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
2918 (Block.Unsafe): New property.
2919 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
2920 (Unsafe): Set 'unsafe' flag of contained block.
2921 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
2922 (Fixed.Resolve): Likewise.
2923 (Catch.Resolve): Likewise.
2924 (Using.ResolveLocalVariableDecls): Likewise.
2925 (Foreach.Resolve): Likewise.
2927 2004-10-05 John Luke <john.luke@gmail.com>
2929 * cs-parser.jay: add location to error CS0175
2931 2004-10-04 Miguel de Icaza <miguel@ximian.com>
2933 * ecore.cs (Expression.Constantity): Add support for turning null
2936 * const.cs (Const.Define): Allow constants to be reference types
2937 as long as the value is Null.
2939 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
2941 * namespace.cs (NamespaceEntry.Using): No matter which warning
2942 level is set, check if this namespace name has already been added.
2944 2004-10-03 Ben Maurer <bmaurer@ximian.com>
2946 * expression.cs: reftype [!=]= null should always use br[true,false].
2949 2004-10-03 Marek Safar <marek.safar@seznam.cz>
2952 * attribute.cs: Enum conversion moved to
2953 GetAttributeArgumentExpression to be applied to the all
2956 2004-10-01 Raja R Harinath <rharinath@novell.com>
2958 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
2959 * class.c (TypeContainer.DefineType): Flag error if
2960 base types aren't accessible due to access permissions.
2961 * decl.cs (DeclSpace.ResolveType): Move logic to
2962 Expression.ResolveAsTypeTerminal.
2963 (DeclSpace.ResolveTypeExpr): Thin layer over
2964 Expression.ResolveAsTypeTerminal.
2965 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
2966 Refactor code into NestedAccess. Use it.
2967 (DeclSpace.NestedAccess): New.
2968 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
2969 argument to silence errors. Check access permissions.
2970 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
2971 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
2972 (Cast.DoResolve): Likewise.
2973 (New.DoResolve): Likewise.
2974 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
2975 (TypeOf.DoResolve): Likewise.
2977 * expression.cs (Invocation.BetterConversion): Return the Type of
2978 the better conversion. Implement section 14.4.2.3 more faithfully.
2979 (Invocation.BetterFunction): Make boolean. Make correspondence to
2980 section 14.4.2.2 explicit.
2981 (Invocation.OverloadResolve): Update.
2982 (Invocation): Remove is_base field.
2983 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
2984 (Invocation.Emit): Likewise.
2986 2004-09-27 Raja R Harinath <rharinath@novell.com>
2988 * README: Update to changes.
2990 2004-09-24 Marek Safar <marek.safar@seznam.cz>
2992 * cs-parser.jay: Reverted 642 warning fix.
2994 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2997 * decl.cs (FindMemberWithSameName): Indexer can have more than
3000 2004-09-23 Marek Safar <marek.safar@seznam.cz>
3002 * expression.cs (LocalVariableReference.DoResolveLValue):
3003 Do not report warning 219 for out values.
3004 (EmptyExpression.Null): New member to avoid extra allocations.
3006 2004-09-23 Marek Safar <marek.safar@seznam.cz>
3008 * cs-parser.jay: Fix wrong warning 642 report.
3010 * cs-tokenizer.cs (CheckNextToken): New helper;
3011 Inspect next character if is same as expected.
3013 2004-09-23 Martin Baulig <martin@ximian.com>
3015 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
3016 (Convert.ImplicitReferenceConversionExists): Likewise.
3018 2004-09-23 Marek Safar <marek.safar@seznam.cz>
3020 * class.cs (Operator.Define): Add error 448 and 559 report.
3022 2004-09-22 Marek Safar <marek.safar@seznam.cz>
3024 * class.cs (MemberBase.IsTypePermitted): New protected
3025 method for checking error CS0610.
3027 2004-09-22 Marek Safar <marek.safar@seznam.cz>
3029 * class.cs (TypeContainer.HasExplicitLayout): New property
3030 Returns whether container has StructLayout attribute set Explicit.
3031 (FieldMember): New abstract class for consts and fields.
3032 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
3033 (Field): Reuse FieldMember.
3035 * const.cs (Const): Reuse FieldMember.
3037 * rootcontext.cs: EmitConstants call moved to class.
3039 2004-09-22 Martin Baulig <martin@ximian.com>
3041 Thanks to Peter Sestoft for this bug report.
3043 * expression.cs (Conditional): If both the `trueExpr' and the
3044 `falseExpr' is a NullLiteral, return a NullLiteral.
3046 2004-09-22 Martin Baulig <martin@ximian.com>
3048 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
3049 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
3050 for the "get_Current" call.
3052 2004-09-22 Martin Baulig <martin@ximian.com>
3054 Marek and me just fixed one of our oldest bugs: #28562 :-)
3056 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
3058 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
3059 we're an EnumConstant, just return that.
3060 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
3061 an EnumConstant. In this case, we need to use GetValueAsEnumType()
3062 to get the value which'll actually be written into the attribute.
3063 However, we have to use GetValue() to access the attribute's value
3066 2004-09-22 Marek Safar <marek.safar@seznam.cz>
3068 * constant.cs (Constant.IsNegative): New abstract property
3071 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
3072 (StackAlloc.DoResolve): Reused IsNegative.
3074 2004-09-21 Martin Baulig <martin@ximian.com>
3076 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
3077 if we're used in an iterator, we may be called from different
3080 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
3081 we actually have an exception block.
3083 2004-09-20 John Luke <jluke@cfl.rr.com>
3085 * class.cs, cs-parser.jay: Improve the error report for 1520:
3086 report the actual line where the error happens, not where the
3089 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
3090 Pass location information that was available elsewhere.
3092 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
3094 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
3095 runtime to delay sign assemblies.
3097 2004-09-19 Miguel de Icaza <miguel@ximian.com>
3099 * cs-parser.jay: Do not report the stack trace, this is barely
3102 2004-08-22 John Luke <john.luke@gmail.com>
3104 * driver.cs : check that a resource id is not already used
3105 before adding it, report CS1508 if it is, bug #63637
3107 2004-09-19 Miguel de Icaza <miguel@ximian.com>
3109 * ecore.cs: Removed dead code.
3111 2004-09-18 Marek Safar <marek.safar@seznam.cz>
3113 * class.cs: Do not report warning CS0067 on the interfaces.
3115 2004-09-16 Marek Safar <marek.safar@seznam.cz>
3117 * cs-parser.jay: Add error 504 report.
3119 2004-09-16 Marek Safar <marek.safar@seznam.cz>
3121 * rootcontext.cs: WarningLevel is 4 by default now.
3123 * statement.cs (Fixed.Resolve): Do not null
3126 2004-09-16 Marek Safar <marek.safar@seznam.cz>
3129 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
3130 deep search when property is not virtual.
3131 (PropertyExpr.ResolveAccessors): Make one call for both
3134 2004-09-15 Marek Safar <marek.safar@seznam.cz>
3137 * statement.cs: Error 152 report constains also location.
3139 2004-09-15 Marek Safar <marek.safar@seznam.cz>
3142 * const.cs: Explicitly set constant as static.
3144 2004-09-15 Marek Safar <marek.safar@seznam.cz>
3147 * cs-parser.jay: Add error 1017 report.
3149 2004-09-15 Marek Safar <marek.safar@seznam.cz>
3151 Fixed bug #59980, #64224
3152 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
3154 * typemanager.cs (IsSpecialMethod): Simplified
3156 2004-09-14 Marek Safar <marek.safar@seznam.cz>
3158 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
3159 condition with better params.
3161 2004-09-14 Marek Safar <marek.safar@seznam.cz>
3164 * attribute.cs (Resolve): Property has to have both
3167 2004-09-14 Martin Baulig <martin@ximian.com>
3169 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
3171 2004-09-14 Marek Safar <marek.safar@seznam.cz>
3174 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
3175 called and is obsolete then this member suppress message
3176 when call is inside next [Obsolete] method or type.
3178 * expression.cs: Use TestObsoleteMethodUsage member.
3180 2004-09-14 Martin Baulig <martin@ximian.com>
3182 * cs-parser.jay: Sync a bit with the GMCS version.
3184 2004-09-14 Martin Baulig <martin@ximian.com>
3186 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
3187 (CSharpParser.yacc_verbose_flag): New public field.
3189 * genericparser.cs: Removed.
3191 2004-09-14 Raja R Harinath <rharinath@novell.com>
3193 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
3195 2004-09-13 Marek Safar <marek.safar@seznam.cz>
3197 * class.cs (MethodCore.CheckBase): Fix bug #65757.
3199 2004-09-10 Martin Baulig <martin@ximian.com>
3201 Backported my MemberName changes from GMCS into MCS.
3203 - we are now using a special `MemberName' class instead of using
3204 strings; in GMCS, the `MemberName' also contains the type
3207 - changed the grammar rules a bit:
3208 * the old `member_name' is now a `namespace_or_type_name':
3209 The rule is that we use `namespace_or_type_name' everywhere
3210 where we expect either a "member name" (GetEnumerator) or a
3211 "member name" with an explicit interface name
3212 (IEnumerable.GetEnumerator).
3213 In GMCS, the explicit interface name may include type arguments
3214 (IEnumerable<T>.GetEnumerator).
3215 * we use `member_name' instead of just `IDENTIFIER' for
3217 The rule is that we use `member_name' wherever a member may
3218 have type parameters in GMCS.
3220 * decl.cs (MemberName): New public class.
3221 (MemberCore.MemberName): New public readonly field.
3222 (MemberCore.ctor): Take a `MemberName' argument, not a string.
3223 (DeclSpace): Likewise.
3225 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
3226 * enum.cs (Enum.ctor): Likewise.
3228 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
3230 (AliasEntry.ctor): Take a MemberName, not an Expression.
3231 (AliasEntry.UsingAlias): Likewise.
3233 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
3234 (IMethodData.MemberName): Changed type from string to MemberName.
3235 (MemberBase.ExplicitInterfaceName): Likewise.
3236 (AbstractPropertyEventMethod.SetupName): Make this private.
3237 (AbstractPropertyEventMethod.ctor): Added `string prefix'
3238 argument; compute the member name here.
3239 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
3240 on the `member.MemberName' and the `prefix'.
3242 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
3244 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
3245 thus, we get a `MemberName' instead of a `string'. These
3246 declarations may have type parameters in GMCS.
3247 (interface_method_declaration, delegate_declaration): Likewise.
3248 (class_declaration, interface_declaration): Likewise.
3249 (method_header): Use `namespace_or_type_name' instead of
3250 `member_name'. We may be an explicit interface implementation.
3251 (property_declaration, event_declaration): Likewise.
3252 (member_name): This is now just an `IDENTIFIER', not a
3253 `namespace_or_type_name'.
3254 (type_name, interface_type): Removed.
3255 (namespace_or_type_name): Return a MemberName, not an Expression.
3256 (primary_expression): Use `member_name' instead of `IDENTIFIER';
3257 call GetTypeExpression() on the MemberName to get an expression.
3258 (IndexerDeclaration.interface_type): Changed type from string to
3260 (MakeName): Operate on MemberName's instead of string's.
3262 2004-09-13 Raja R Harinath <rharinath@novell.com>
3265 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
3266 (NamespaceEntry.Lookup): Add new argument to flag if we want the
3267 lookup to avoid symbols introduced by 'using'.
3268 * rootcontext.cs (NamespaceLookup): Update.
3270 2004-09-12 Marek Safar <marek.safar@seznam.cz>
3272 * class.cs (TypeContainer.DoDefineMembers): Do not call
3273 DefineDefaultConstructor for static classes.
3275 2004-09-12 Marek Safar <marek.safar@seznam.cz>
3277 * attribute.cs (Attribute.Resolve): Add error 653 report.
3279 * class.cs (Class.ApplyAttributeBuilder): Add error 641
3281 (Method.ApplyAttributeBuilder): Add error 685 report.
3282 (Operator.Define): Add error 564 report.
3284 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
3286 * expression.cs (Invocation.DoResolve): Add error
3289 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
3292 2004-09-11 Marek Safar <marek.safar@seznam.cz>
3294 * class.cs (ConstructorInitializer.Resolve):
3295 Wrong error number (515->516).
3297 2004-09-11 Marek Safar <marek.safar@seznam.cz>
3299 * class.cs (Indexer.Define): Add error 631 report.
3301 2004-09-11 Marek Safar <marek.safar@seznam.cz>
3303 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
3305 2004-09-11 Marek Safar <marek.safar@seznam.cz>
3307 * expression.cs (Probe.DoResolve): Add error CS0241 report.
3309 2004-09-10 Marek Safar <marek.safar@seznam.cz>
3311 * cs-parser.jay: Added error CS0241 report.
3313 2004-09-10 Raja R Harinath <rharinath@novell.com>
3315 * cs-parser.jay (fixed_statement): Introduce a scope for the
3316 declaration in the 'fixed' statement.
3318 2004-09-09 Marek Safar <marek.safar@seznam.cz>
3320 * cs-parser.jay: Added CS0230 error report.
3322 2004-09-09 Marek Safar <marek.safar@seznam.cz>
3324 * cs-parser.jay: Added errors CS0231 and CS0257 report.
3326 2004-09-09 Marek Safar <marek.safar@seznam.cz>
3328 * expression.cs (Argument.Resolve): Added error CS0192 and
3331 2004-09-09 Marek Safar <marek.safar@seznam.cz>
3333 C# 2.0 #pragma warning feature
3335 * cs-tokenizer.cs (PreProcessPragma): New method;
3336 Handles #pragma directive.
3338 * report.cs (WarningRegions): New class; Support
3339 class for #pragma warning directive. It tests whether
3340 warning is enabled for a given line.
3342 2004-09-08 Miguel de Icaza <miguel@ximian.com>
3344 * const.cs: Add more descriptive error report, tahnks to
3347 2004-09-08 Marek Safar <marek.safar@seznam.cz>
3349 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
3351 2004-09-07 Miguel de Icaza <miguel@ximian.com>
3353 * expression.cs: Apply patch from Ben: Remove dead code from
3354 ArrayCreation, and remove the TurnintoConstant call in const.cs,
3355 as that code just threw an exception anwyays.
3357 * const.cs: Remove the call to the turnintoconstant, for details
3360 * literal.cs: The type of the null-literal is the null type; So
3361 we use a placeholder type (literal.cs:System.Null, defined here)
3364 * expression.cs (Conditional.DoResolve): Remove some old code that
3365 is no longer needed, conversions have been fixed.
3367 (ArrayCreationExpression.DoResolve): Return false if we fail to
3368 resolve the inner expression.
3370 2004-09-07 Raja R Harinath <rharinath@novell.com>
3373 * cs-parser.jay (delegate_declaration): Record a delegate
3374 declaration as a type declaration.
3375 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
3377 2004-09-06 Miguel de Icaza <miguel@ximian.com>
3379 * parameter.cs: Do not crash if the type can not be resolved.
3381 * expression.cs: Report errors with unsafe pointers, fixes #64896
3383 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
3385 * expression.cs: Pointer arith always needs to do a conv.i
3386 if the operand is a long. fix 65320
3388 2004-09-04 Marek Safar <marek.safar@seznam.cz>
3390 Fixed cs0619-37.cs, cs0619-38.cs
3392 * enum.cs (GetObsoleteAttribute): Removed.
3394 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
3395 on Enum member is double staged. The first is tested member
3398 2004-09-04 Marek Safar <marek.safar@seznam.cz>
3400 Fixed #56986, #63631, #65231
3402 * class.cs: (TypeContainer.AddToMemberContainer): New method,
3403 adds member to name container.
3404 (TypeContainer.AddToTypeContainer): New method, adds type to
3406 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
3407 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
3408 AddOperator): Simplified by reusing AddToMemberContainer.
3409 (TypeContainer.UserDefinedStaticConstructor): Changed to property
3411 (Method.CheckForDuplications): Fixed implementation to test all
3413 (MemberBase): Detection whether member is explicit interface
3414 implementation is now in constructor.
3415 (MemberBase.UpdateMemberName): Handles IndexerName.
3416 (Accessor): Changed to keep also location information.
3417 (AbstractPropertyEventMethod): Is derived from MemberCore.
3418 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
3419 will be emited or not.
3420 (PropertyBase.AreAccessorsDuplicateImplementation):
3421 Tests whether accessors are not in collision with some method.
3422 (Operator): Is derived from MethodCore to simplify common
3425 * decl.cs (Flags.TestMethodDuplication): Test for duplication
3427 (DeclSpace.AddToContainer): Adds the member to defined_names
3428 table. It tests for duplications and enclosing name conflicts.
3430 * enum.cs (EnumMember): Clean up to reuse the base structures
3432 2004-09-03 Martin Baulig <martin@ximian.com>
3434 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
3435 into TypeContainer, to make partial classes work again.
3437 2004-09-03 Martin Baulig <martin@ximian.com>
3439 * rootcontext.cs (RootContext.V2): Removed.
3441 2004-03-23 Martin Baulig <martin@ximian.com>
3443 * expression.cs (Invocation.OverloadResolve): Added `bool
3444 may_fail' argument and use it instead of the Location.IsNull() hack.
3446 2004-09-03 Martin Baulig <martin@ximian.com>
3448 Merged latest changes into gmcs. Please keep this comment in
3449 here, it makes it easier for me to see what changed in MCS since
3450 the last time I merged.
3452 2004-09-03 Raja R Harinath <rharinath@novell.com>
3455 * expression.cs (BetterConversion): Don't allow either conversion
3456 to be null. Remove redundant implicit conversion test when 'q ==
3457 null' -- when this function is invoked, we already know that the
3458 implicit conversion exists.
3459 (BetterFunction): Assume that 'best' is non-null. Remove
3460 redundant reimplementation of IsApplicable when 'best' is null.
3461 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
3462 number of arguments.
3463 (IsAncestralType): Extract from OverloadResolve.
3464 (OverloadResolve): Make robust to the MethodGroupExpr being
3465 unsorted. Implement all the logic of Section 14.5.5.1, and
3466 support overloading of methods from multiple applicable types.
3467 Clean up logic somewhat. Don't pass null methods to BetterFunction.
3469 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
3470 (RealError, Warning): Append type of report to related symbol.
3472 2004-09-03 Marek Safar <marek.safar@seznam.cz>
3474 * enum.cs: Fixed CLS-Compliance checks for enum members.
3475 Error tests cs3008-8.cs, cs3014-8.cs
3477 2004-09-02 Marek Safar <marek.safar@seznam.cz>
3479 Fixed bug #62342, #63102
3480 * class.cs: ImplementIndexer uses member.IsExplicitImpl
3481 like ImplementMethod.
3483 2004-09-02 Marek Safar <marek.safar@seznam.cz>
3485 * attribute.cs (Attribute.GetAttributeArgumentExpression):
3488 2004-09-02 Martin Baulig <martin@ximian.com>
3490 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
3491 TypeManager.GetArgumentTypes() rather than calling GetParameters()
3494 2004-09-01 Marek Safar <marek.safar@seznam.cz>
3496 C# 2.0 Static classes implemented
3498 * class.cs (TypeContainer): instance_constructors,
3499 initialized_fields, initialized_static_fields,
3500 default_constructor, base_inteface_types are protected to be
3501 accessible from StaticClass.
3502 (TypeContainer.DefineDefaultConstructor): New virtual method
3503 for custom default constructor generating
3504 (StaticClass): New class to handle "Static classes" feature.
3506 * cs-parser.jay: Handle static keyword on class like instance
3509 * driver.cs: Added "/langversion" command line switch with two
3510 options (iso-1, default).
3512 2004-08-31 Marek Safar <marek.safar@seznam.cz>
3514 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
3516 2004-08-31 Miguel de Icaza <miguel@ximian.com>
3518 * delegate.cs: Style.
3520 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
3522 * delegate.cs: Add seperate instance expr field for miguel.
3524 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
3526 * PointerArithmetic (Resolve): make sure we are not doing
3527 pointer arith on void*. Also, make sure we are resolved
3528 by not setting eclass until resolve.
3530 All callers: Make sure that PointerArithmetic gets resolved.
3532 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
3534 * ArrayCreation (LookupType): If the type does not resolve
3535 to an array, give an error.
3537 2004-08-27 Marek Safar <marek.safar@seznam.cz>
3539 * statement.cs (Try.Resolve): Fixed bug #64222
3541 2004-08-27 Martin Baulig <martin@ximian.com>
3544 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
3547 2004-08-26 Marek Safar <marek.safar@seznam.cz>
3549 * ecore.cs (Constantify): Get underlying type via
3550 System.Enum.GetUnderlyingType to avoid StackOverflow on the
3551 Windows in special cases.
3553 2004-08-26 Marek Safar <marek.safar@seznam.cz>
3555 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
3556 for obtaining also private methods.
3557 (GetRemoveMethod): Used GetRemoveMethod (true)
3558 for obtaining also private methods.
3560 2004-08-24 Martin Baulig <martin@ximian.com>
3562 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
3563 MethodAttributes.HideBySig for operators.
3565 2004-08-23 Martin Baulig <martin@ximian.com>
3567 Back to the old error reporting system :-)
3569 * report.cs (Message): Removed.
3570 (Report.MessageData, ErrorData, WarningData): Removed.
3571 (Report.Error, Warning): Back to the old system.
3573 2004-08-23 Martin Baulig <martin@ximian.com>
3575 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
3577 * class.cs (TypeContainer.ParentContainer): New public virtual
3578 method; replaces the explicit interface implementation.
3579 (ClassPart.ParentContainer): Override.
3581 2004-08-23 Martin Baulig <martin@ximian.com>
3583 * statement.cs (Switch): Added support for constant switches; see
3584 #59428 or test-285.cs.
3586 2004-08-22 Marek Safar <marek.safar@seznam.cz>
3589 * statement.cs (GetEnumeratorFilter): Removed useless
3590 logic because C# specs is strict. GetEnumerator must be
3593 2004-08-22 Martin Baulig <martin@ximian.com>
3595 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
3596 a switch and may break, reset the barrier. Fixes #59867.
3598 2004-08-22 Marek Safar <marek.safar@seznam.cz>
3600 CLS-Compliance speed up (~5% for corlib)
3602 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
3603 New method. Tests container for CLS-Compliant names
3605 * class.cs (TypeContainer.VerifyClsName): New method.
3606 Checks whether container name is CLS Compliant.
3607 (Constructor): Implements IMethodData.
3609 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
3610 low-case table for CLS Compliance test.
3611 (MemberCache.VerifyClsParameterConflict): New method.
3612 Checks method parameters for CS3006 error.
3614 * enum.cs (EnumMember): Is derived from MemberCore.
3615 (Enum.VerifyClsName): Optimized for better performance.
3617 2004-08-06 Marek Safar <marek.safar@seznam.cz>
3619 * report.cs: Renamed Error_T to Error and changed all
3622 2004-08-06 Marek Safar <marek.safar@seznam.cz>
3624 * class.cs (TypeContainer.IndexerArrayList): New inner class
3625 container for indexers.
3626 (TypeContainer.DefaultIndexerName): New constant for default
3627 indexer name. Replaced all "Item" with this constant.
3628 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
3630 * typemanager.cs (TypeManager.default_member_ctor): Cache here
3631 DefaultMemberAttribute constructor.
3633 2004-08-05 Martin Baulig <martin@ximian.com>
3635 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
3638 2004-08-05 Marek Safar <marek.safar@seznam.cz>
3640 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
3641 multi platforms problem.
3643 * compiler.csproj: Included shared files.
3645 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3647 Fix bug 60333, 55971 in the more general way
3648 * attribute.cs (Attribute.GetAttributeArgumentExpression):
3649 Added arg_type argument for constant conversion.
3650 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
3652 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3655 * class.cs (TypeContainer ): New inner classes MethodArrayList,
3656 OperatorArrayList, MethodCoreArrayList for typecontainer
3657 containers. Changed class member types to these new types.
3658 (MethodArrayList.DefineMembers): Added test for CS0659.
3660 2004-08-04 Miguel de Icaza <miguel@ximian.com>
3662 * cfold.cs: Synchronize the folding with the code in expression.cs
3663 Binary.DoNumericPromotions for uint operands.
3665 * attribute.cs: Revert patch from Raja, it introduced a regression
3666 while building Blam-1.2.1 (hard to isolate a test case).
3668 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3672 (TypeContainer.Define): Renamed to DefineContainerMembers because of
3674 (MethodCore.parent_method): New member. The method we're overriding
3675 if this is an override method.
3676 (MethodCore.CheckBase): Moved from Method class and made common.
3677 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
3679 (MethodCore.CheckForDuplications): New abstract method. For custom
3680 member duplication search in a container
3681 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
3682 method and its return type.
3683 (Event.conflict_symbol): New member. Symbol with same name in the
3687 (MemberCache.FindMemberWithSameName): New method. The method
3688 is looking for conflict with inherited symbols.
3690 2004-08-04 Martin Baulig <martin@ximian.com>
3692 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
3694 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
3696 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3698 * report.cs (Message): New enum for better error, warning reference in
3700 (MessageData): New inner abstract class. It generally handles printing of
3701 error and warning messages.
3702 Removed unused Error, Warning, Message methods.
3704 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3706 Fix for cs0592-8.cs test
3708 (Attributable.ValidAttributeTargets): Made public.
3709 (Attribute.ExplicitTarget): New member for explicit target value.
3710 (Attribute.CheckTargets): Now we translate explicit attribute
3711 target to Target here.
3713 2004-08-03 Ben Maurer <bmaurer@ximian.com>
3715 * ecore.cs (MethodGroupExpr): new IsBase property.
3717 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
3719 * delegate.cs (DelegateCreation): store a MethodGroupExpr
3720 rather than an instance expr.
3722 (DelegateCreation.Emit): Use the method group rather than
3723 the instance expression. Also, if you have base.Foo as the
3724 method for a delegate, make sure to emit ldftn, not ldftnvirt.
3726 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
3728 (NewDelegate.DoResolve): Only check for the existance of Invoke
3729 if the method is going to be needed. Use MethodGroupExpr.
3731 (NewDelegate.Emit): Remove, DelegateCreation implements this.
3733 * expression.cs: For pointer arith., make sure to use
3734 the size of the type, not the size of the pointer to
3737 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3740 * class.cs (Class): Added error CS0502 test.
3742 2004-08-03 John Luke <jluke@cfl.rr.com>
3743 Raja R Harinath <rharinath@novell.com>
3746 * attribute.cs (Attribute.complained_before): New flag.
3747 (Attribute.ResolveType, Attribute.Resolve),
3748 (Attribute.DefinePInvokeMethod): Set it.
3749 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
3751 2004-08-03 Martin Baulig <martin@ximian.com>
3753 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
3754 use a user-defined operator; we still need to do numeric
3755 promotions in case one argument is a builtin type and the other
3756 one has an implicit conversion to that type. Fixes #62322.
3758 2004-08-02 Martin Baulig <martin@ximian.com>
3760 * statement.cs (LocalInfo.Flags): Added `IsThis'.
3761 (LocalInfo.IsThis): New public property.
3762 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
3764 2004-08-01 Martin Baulig <martin@ximian.com>
3766 * class.cs (TypeContainer.GetClassBases): Don't set the default
3767 here since we may get called from GetPartialBases().
3768 (TypeContainer.DefineType): If GetClassBases() didn't return a
3769 parent, use the default one.
3771 2004-07-30 Duncan Mak <duncan@ximian.com>
3773 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
3775 2004-07-30 Martin Baulig <martin@ximian.com>
3777 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
3779 * class.cs (SourceMethod): New public class, derive from the
3780 symbol writer's ISourceMethod.
3781 (Method): Use the new symbol writer API.
3783 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
3784 as argument and use the new symbol writer.
3787 (SourceFile): Implement the symbol writer's ISourceFile.
3788 (Location.SymbolDocument): Removed.
3789 (Location.SourceFile): New public property.
3791 * symbolwriter.cs: Use the new symbol writer API.
3793 2004-07-30 Raja R Harinath <rharinath@novell.com>
3795 * Makefile (install-local): Remove. Functionality moved to
3798 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
3800 * Makefile: Install mcs.exe.config file together with mcs.exe.
3801 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
3802 correct runtime version.
3804 2004-07-25 Martin Baulig <martin@ximian.com>
3807 (TypeContainer.RegisterOrder): Removed, this was unused.
3808 (TypeContainer, interface_order): Removed.
3809 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
3810 TypeContainer as argument since we can also be called with a
3811 `PartialContainer' for a partial class/struct/interface.
3812 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
3813 of checking whether we're an `Interface' - we could be a
3815 (PartialContainer.Register): Override; call
3816 AddClass()/AddStruct()/AddInterface() on our parent.
3818 * cs-parser.jay (interface_member_declaration): Add things to the
3819 `current_container', not the `current_class'.
3821 * rootcontext.cs (RegisterOrder): The overloaded version which
3822 takes an `Interface' was unused, removed.
3824 * typemanager.cs (TypeManager.LookupInterface): Return a
3825 `TypeContainer', not an `Interface'.
3826 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
3827 contain a `PartialContainer' for an interface, so check it's
3828 `Kind' to figure out what it is.
3830 2004-07-25 Martin Baulig <martin@ximian.com>
3832 * class.cs (Class.DefaultTypeAttributes): New public constant.
3833 (Struct.DefaultTypeAttributes): Likewise.
3834 (Interface.DefaultTypeAttributes): Likewise.
3835 (PartialContainer.TypeAttr): Override this and add the
3836 DefaultTypeAttributes.
3838 2004-07-25 Martin Baulig <martin@ximian.com>
3840 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
3841 we can just use the `Parent' field instead.
3843 2004-07-25 Martin Baulig <martin@ximian.com>
3845 * class.cs (TypeContainer.Emit): Renamed to EmitType().
3847 2004-07-25 Martin Baulig <martin@ximian.com>
3849 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
3850 our parts before defining any methods.
3851 (TypeContainer.VerifyImplements): Make this virtual.
3852 (ClassPart.VerifyImplements): Override and call VerifyImplements()
3853 on our PartialContainer.
3855 2004-07-25 Martin Baulig <martin@ximian.com>
3857 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
3859 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
3860 argument, we can just use the `Parent' field instead.
3863 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
3864 (MemberBase.DoDefine): Likewise.
3866 2004-07-24 Martin Baulig <martin@ximian.com>
3868 * decl.cs (MemberCore.Parent): New public field.
3869 (DeclSpace.Parent): Moved to MemberCore.
3871 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
3872 (MemberBase.ctor): Added TypeContainer argument, pass it to our
3874 (FieldBase, Field, Operator): Likewise.
3875 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
3876 (EventField, Event): Likewise.
3878 2004-07-23 Martin Baulig <martin@ximian.com>
3880 * class.cs (PartialContainer): New public class.
3881 (ClassPart): New public class.
3882 (TypeContainer): Added support for partial classes.
3883 (TypeContainer.GetClassBases): Splitted some of the functionality
3884 out into GetNormalBases() and GetPartialBases().
3886 * cs-tokenizer.cs (Token.PARTIAL): New token.
3887 (Tokenizer.consume_identifier): Added some hacks to recognize
3888 `partial', but only if it's immediately followed by `class',
3889 `struct' or `interface'.
3891 * cs-parser.jay: Added support for partial clases.
3893 2004-07-23 Martin Baulig <martin@ximian.com>
3895 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
3896 a `DeclSpace' and also made it readonly.
3897 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
3898 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
3899 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
3901 * cs-parser.jay: Pass the `current_class', not the
3902 `current_container' (at the moment, this is still the same thing)
3903 to a new Method, Property, Event, Indexer or Constructor.
3905 2004-07-23 Martin Baulig <martin@ximian.com>
3907 * cs-parser.jay (CSharpParser): Added a new `current_class' field
3908 and removed the `current_interface' one.
3909 (struct_declaration, class_declaration, interface_declaration):
3910 Set `current_class' to the newly created class/struct/interface;
3911 set their `Bases' and call Register() before parsing their body.
3913 2004-07-23 Martin Baulig <martin@ximian.com>
3915 * class.cs (Kind): New public enum.
3916 (TypeContainer): Made this class abstract.
3917 (TypeContainer.Kind): New public readonly field.
3918 (TypeContainer.CheckDef): New public method; moved here from
3920 (TypeContainer.Register): New public abstract method.
3921 (TypeContainer.GetPendingImplementations): New public abstract
3923 (TypeContainer.GetClassBases): Removed the `is_class' and
3924 `is_iface' parameters.
3925 (TypeContainer.DefineNestedTypes): Formerly known as
3927 (ClassOrStruct): Made this class abstract.
3929 * tree.cs (RootTypes): New public type.
3931 2004-07-20 Martin Baulig <martin@ximian.com>
3933 * tree.cs (Tree.RecordNamespace): Removed.
3934 (Tree.Namespaces): Removed.
3936 * rootcontext.cs (RootContext.IsNamespace): Removed.
3938 * cs-parser.jay (namespace_declaration): Just create a new
3939 NamespaceEntry here.
3941 2004-07-20 Martin Baulig <martin@ximian.com>
3943 * statement.cs (ExceptionStatement): New abstract class. This is
3944 now used as a base class for everyone who's using `finally'.
3945 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
3946 our local variables before using them.
3948 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
3949 virtual method. This is used by Yield.Resolve() to "steal" an
3950 outer block's `finally' clauses.
3951 (FlowBranchingException): The .ctor now takes an ExceptionStatement
3954 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
3955 version which takes an ExceptionStatement. This version must be
3956 used to create exception branchings.
3959 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
3960 (Iterator.EmitMoveNext): Added exception support; protect the
3961 block with a `fault' clause, properly handle 'finally' clauses.
3962 (Iterator.EmitDispose): Run all the `finally' clauses here.
3964 2004-07-20 Martin Baulig <martin@ximian.com>
3966 * iterator.cs: This is the first of a set of changes in the
3967 iterator code. Match the spec more closely: if we're an
3968 IEnumerable, then GetEnumerator() must be called. The first time
3969 GetEnumerator() is called, it returns the current instance; all
3970 subsequent invocations (if any) must create a copy.
3972 2004-07-19 Miguel de Icaza <miguel@ximian.com>
3974 * expression.cs: Resolve the constant expression before returning
3977 2004-07-19 Martin Baulig <martin@ximian.com>
3979 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
3980 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
3981 the return type of the new EmitContext.
3983 2004-07-18 Martin Baulig <martin@ximian.com>
3985 * class.cs (Property.Define): Fix iterators.
3987 * iterators.cs (Iterator.Define): Moved the
3988 `container.AddInterator (this)' call here from the .ctor; only do
3989 it if we resolved successfully.
3991 2004-07-17 Miguel de Icaza <miguel@ximian.com>
3993 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
3994 `true' for preprocessing directives that we parse. The return
3995 value indicates whether we should return to regular tokenizing or
3996 not, not whether it was parsed successfully.
3998 In the past if we were in: #if false ... #line #endif, we would
3999 resume parsing after `#line'. See bug 61604.
4001 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
4002 building: IsEnumType should return true only for enums, not for
4003 enums or System.Enum itself. This fixes #61593.
4005 Likely what happened is that corlib was wrong: mcs depended on
4006 this bug in some places. The bug got fixed, we had to add the
4007 hack, which caused bug 61593.
4009 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
4010 that was a workaround for the older conditions.
4012 2004-07-16 Ben Maurer <bmaurer@ximian.com>
4014 * assign.cs: IAssignMethod has a new interface, as documented
4015 inline. All assignment code now uses this new api.
4017 * ecore.cs, expression.cs: All classes which implement
4018 IAssignMethod now use the new interface.
4020 * expression.cs (Invocation): add a hack to EmitCall so that
4021 IndexerAccess can be the target of a compound assignment without
4022 evaluating its arguments twice.
4024 * statement.cs: Handle changes in Invocation api.
4026 2004-07-16 Martin Baulig <martin@ximian.com>
4028 * iterators.cs: Rewrote this. We're now using one single Proxy
4029 class for both the IEnumerable and the IEnumerator interface and
4030 `Iterator' derives from Class so we can use the high-level API.
4032 * class.cs (TypeContainer.AddIterator): New method.
4033 (TypeContainer.DoDefineType): New protected virtual method, which
4034 is called from DefineType().
4035 (TypeContainer.DoDefineMembers): Call DefineType() and
4036 DefineMembers() on all our iterators.
4037 (TypeContainer.Emit): Call Emit() on all our iterators.
4038 (TypeContainer.CloseType): Call CloseType() on all our iterators.
4040 * codegen.cs (EmitContext.CurrentIterator): New public field.
4042 2004-07-15 Martin Baulig <martin@ximian.com>
4045 (TypeManager.not_supported_exception_type): New type.
4047 2004-07-14 Martin Baulig <martin@ximian.com>
4049 * iterators.cs: Use real error numbers.
4051 2004-07-14 Martin Baulig <martin@ximian.com>
4053 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
4054 requires this to be a System.Collection.IEnumerable and not a
4055 class implementing that interface.
4056 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
4058 2004-07-13 Marek Safar <marek.safar@seznam.cz>
4060 * class.cs: Fixed previous fix, it broke some error tests.
4062 2004-07-12 Martin Baulig <martin@ximian.com>
4064 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
4067 2004-07-09 Miguel de Icaza <miguel@ximian.com>
4069 * assign.cs (LocalTemporary): Add new argument: is_address,If
4070 `is_address' is true, then the value that we store is the address
4071 to the real value, and not the value itself.
4073 * ecore.cs (PropertyExpr): use the new local temporary
4074 stuff to allow us to handle X.Y += z (where X is a struct)
4076 2004-07-08 Martin Baulig <martin@ximian.com>
4078 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
4079 not always return, just like we're doing in Using.Resolve().
4081 2004-07-07 Miguel de Icaza <miguel@ximian.com>
4083 * cs-parser.jay (fixed_statement): flag this as Pinned.
4085 2004-07-06 Miguel de Icaza <miguel@ximian.com>
4087 * typemanager.cs (TypeManager): Removed MakePinned method, this
4088 mechanism is replaced with the .NET 2.x compatible mechanism of
4089 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
4091 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
4092 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
4093 `IsFixed' property which has a different meaning.
4095 2004-07-02 Raja R Harinath <rharinath@novell.com>
4097 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
4098 visible from inside a nested class, not just the names of the
4099 immediately enclosing class.
4102 2004-06-24 Raja R Harinath <rharinath@novell.com>
4104 * expression.cs (BetterConversion): Remove buggy special-case
4105 handling of "implicit constant expression conversions". At this
4106 point, we already know that the conversion is possible -- we're
4107 only checking to see which is better.
4109 2004-06-24 Marek Safar <marek.safar@seznam.cz>
4111 * cs-parser.jay: Added error CS0210 test.
4113 2004-06-24 Marek Safar <marek.safar@seznam.cz>
4115 * cs-parser.jay: Added error CS0134 test.
4117 2004-06-24 Marek Safar <marek.safar@seznam.cz>
4120 * cs-parser.jay: Added error CS0145 test.
4122 2004-06-24 Marek Safar <marek.safar@seznam.cz>
4124 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
4126 2004-06-23 Ben Maurer <bmaurer@ximian.com>
4128 * expression.cs (StackAlloc.Resolve): The argument may not
4129 be a constant; deal with this case.
4131 2004-06-23 Marek Safar <marek.safar@seznam.cz>
4133 * attribute.cs (IndexerName_GetIndexerName): Renamed to
4134 GetIndexerAttributeValue.
4135 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
4137 * class.cs (Indexer.Define): Added error tests for CS0415,
4140 2004-06-23 Miguel de Icaza <miguel@ximian.com>
4142 * attribute.cs (Attribute.Resolve): Keep field code in sync with
4145 2004-06-23 Martin Baulig <martin@ximian.com>
4147 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
4148 neither return nor throw, reset the barrier as well. Fixes #60457.
4150 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
4152 * class.cs : EventAttributes is now set to None by default.
4153 This fixes bug #60459.
4155 2004-06-18 Marek Safar <marek.safar@seznam.cz>
4158 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
4159 Don't throw exception but return null (it's sufficient now).
4161 2004-06-18 Marek Safar <marek.safar@seznam.cz>
4163 * typemanager.cs (GetArgumentTypes): Faster implementation.
4165 2004-06-18 Martin Baulig <martin@ximian.com>
4167 * attribute.cs (Attribute.Resolve): Check whether we're an
4168 EmptyCast which a Constant child. Fixes #60333.
4170 2004-06-17 Ben Maurer <bmaurer@ximian.com>
4172 * statement.cs (EmitCollectionForeach): Account for the fact that
4173 not all valuetypes are in areas which we can take the address of.
4174 For these variables, we store to a temporary variable. Also, make
4175 sure that we dont emit a `callvirt' on a valuetype method.
4177 2004-06-15 Marek Safar <marek.safar@seznam.cz>
4179 * expression.cs (StackAlloc.DoReSolve): Added test for
4180 negative parameter (CS0247).
4182 2004-06-15 Marek Safar <marek.safar@seznam.cz>
4185 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
4187 2004-06-15 Marek Safar <marek.safar@seznam.cz>
4190 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
4193 2004-06-14 Marek Safar <marek.safar@seznam.cz>
4195 Fix bug #58254 & cs1555.cs, cs1556.cs
4196 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
4198 2004-06-14 Marek Safar <marek.safar@seznam.cz>
4200 * cs-parser.jay: Added error CS1669 test for indexers.
4202 2004-06-11 Martin Baulig <martin@ximian.com>
4204 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
4205 call this twice: for params and varargs methods.
4207 2004-06-11 Marek Safar <marek.safar@seznam.cz>
4210 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
4212 2004-06-11 Marek Safar <marek.safar@seznam.cz>
4214 * attribute.cs (Attribute.GetValidTargets): Made public.
4217 (AbstractPropertyEventMethod): New class for better code sharing.
4218 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
4220 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
4222 2004-06-11 Raja R Harinath <rharinath@novell.com>
4225 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
4226 that the call to Resolve is part of a MemberAccess.
4227 (Expression.Resolve): Use it for SimpleName resolution.
4228 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
4229 Add 'intermediate' boolean argument.
4230 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
4231 error message when the SimpleName can be resolved ambiguously
4232 between an expression and a type.
4233 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
4235 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
4236 call on the left-side.
4238 2004-06-11 Marek Safar <marek.safar@seznam.cz>
4241 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
4243 2004-06-11 Marek Safar <marek.safar@seznam.cz>
4245 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
4247 2004-06-11 Martin Baulig <martin@ximian.com>
4249 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
4250 varargs methods if applicable.
4252 2004-06-11 Martin Baulig <martin@ximian.com>
4254 * expression.cs (Invocation.EmitCall): Don't use
4255 `method.CallingConvention == CallingConventions.VarArgs' since the
4256 method could also have `CallingConventions.HasThis'.
4258 2004-06-11 Marek Safar <marek.safar@seznam.cz>
4260 * class.cs (Event.GetSignatureForError): Implemented.
4261 Fixed crash in error test cs3010.cs
4263 2004-06-10 Miguel de Icaza <miguel@ximian.com>
4265 * cs-tokenizer.cs: Change the way we track __arglist to be
4266 consistent with the other keywords.
4268 2004-06-09 Miguel de Icaza <miguel@ximian.com>
4270 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
4273 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
4275 * codegen.cs: Check that all referenced assemblies have a strongname
4276 before strongnaming the compiled assembly. If not report error CS1577.
4277 Fix bug #56563. Patch by Jackson Harper.
4278 * typemanager.cs: Added a method to return all referenced assemblies.
4279 Fix bug #56563. Patch by Jackson Harper.
4281 2004-06-08 Marek Safar <marek.safar@seznam.cz>
4284 (Method.ApplyAttributeBuilder): Moved and added conditional
4285 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
4288 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
4290 2004-06-08 Marek Safar <marek.safar@seznam.cz>
4293 * class.cs: (EventField.attribute_targets): Changed default target.
4295 2004-06-08 Martin Baulig <martin@ximian.com>
4297 * expression.cs (Invocation.EmitCall): Enable varargs methods.
4299 2004-06-08 Martin Baulig <martin@ximian.com>
4301 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
4303 2004-06-07 Martin Baulig <martin@ximian.com>
4305 Added support for varargs methods.
4307 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
4310 * cs-parser.jay: Added support for `__arglist'.
4312 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
4314 * expression.cs (Argument.AType): Added `ArgList'.
4315 (Invocation): Added support for varargs methods.
4316 (ArglistAccess): New public class.
4317 (Arglist): New public class.
4319 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
4321 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
4322 a method's top-level block if the method has varargs.
4324 * support.cs (ReflectionParameters, InternalParameters): Added
4325 support for varargs methods.
4327 2004-06-07 Miguel de Icaza <miguel@ximian.com>
4329 * class.cs: Provide location in indexer error report.
4331 * driver.cs: Use standard names.
4333 * namespace.cs: Catch the use of using after a namespace has been
4334 declared also on using aliases.
4336 2004-06-03 Raja R Harinath <rharinath@novell.com>
4339 * typemanager.cs (closure_private_ok, closure_invocation_type)
4340 (closure_qualifier_type, closure_invocation_assembly)
4341 (FilterWithClosure): Move to ...
4342 (Closure): New internal nested class.
4343 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
4344 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
4345 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
4346 (MemberLookup, MemberLookupFailed): Use it.
4347 * expression.cs (New.DoResolve): Treat the lookup for the
4348 constructor as being qualified by the 'new'ed type.
4349 (Indexers.GetIndexersForTypeOrInterface): Update.
4351 2004-06-03 Marek Safar <marek.safar@seznam.cz>
4354 (GetConditionalAttributeValue): New method. Returns
4355 condition of ConditionalAttribute.
4356 (SearchMulti): New method. Returns all attributes of type 't'.
4357 Use it when attribute is AllowMultiple = true.
4358 (IsConditionalMethodExcluded): New method.
4361 (Method.IsExcluded): Implemented. Returns true if method has conditional
4362 attribute and the conditions is not defined (method is excluded).
4363 (IMethodData): Extended interface for ConditionalAttribute support.
4364 (PropertyMethod.IsExcluded): Implemented.
4367 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
4370 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
4373 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
4375 * expression.cs (ArrayCreationExpression): Make this just an
4376 `expression'. It can't be a statement, so the code here was
4379 2004-06-02 Marek Safar <marek.safar@seznam.cz>
4382 * typemanager.cs (GetFullNameSignature): New method for
4385 2004-06-02 Marek Safar <marek.safar@seznam.cz>
4388 * class.cs (MemberBase.GetSignatureForError): New virtual method.
4389 Use this method when MethodBuilder is null.
4390 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
4391 Added test for error CS0626 (MONO reports error for this situation).
4392 (IMethodData.GetSignatureForError): Extended interface.
4394 2004-06-01 Marek Safar <marek.safar@seznam.cz>
4397 (AttributeTester.GetObsoleteAttribute): Returns instance of
4398 ObsoleteAttribute when type is obsolete.
4401 (TypeContainer.VerifyObsoleteAttribute): Override.
4402 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
4403 (MethodCode.VerifyObsoleteAttribute): Override.
4404 (MemberBase.VerifyObsoleteAttribute): Override.
4407 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
4408 and report proper error.
4411 Delegate.VerifyObsoleteAttribute): Override.
4414 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
4415 and report proper error.
4416 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
4419 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
4423 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
4424 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
4425 Added test for ObsoleteAttribute.
4428 (Catch): Derived from Statement.
4430 2004-06-01 Marek Safar <marek.safar@seznam.cz>
4432 Fixed bug #59071 & cs0160.cs
4434 * statement.cs (Try.Resolve): Check here whether order of catch
4435 clauses matches their dependencies.
4437 2004-05-31 Miguel de Icaza <miguel@ximian.com>
4439 * Reverted patch to namespace.cs (Use lookuptypedirect). This
4440 caused a regression: #59343. Referencing nested classes from an
4441 assembly stopped working.
4443 2004-05-31 Martin Baulig <martin@ximian.com>
4445 MCS is now frozen for beta 2.
4447 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4449 * convert.cs: add a trivial cache for overload operator resolution.
4451 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4453 * decl.cs: If possible, use lookuptypedirect here. We can only do
4454 this if there is no `.' after the namespace. Avoids using
4455 LookupType, which does lots of slow processing.
4456 (FindNestedType) New method, does what it says :-).
4457 * namespace.cs: use LookupTypeDirect.
4458 * rootcontext.cs: use membercache, if possible.
4459 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
4461 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4464 According to the spec,
4466 In a member access of the form E.I, if E is a single identifier,
4467 and if the meaning of E as a simple-name (§7.5.2) is a constant,
4468 field, property, localvariable, or parameter with the same type as
4469 the meaning of E as a type-name (§3.8), then both possible
4470 meanings of E are permitted.
4472 We did not check that E as a simple-name had the same type as E as
4475 This trivial check gives us 5-7% on bootstrap time.
4477 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4479 * expression.cs (Invocation.OverloadResolve): Avoid the
4480 use of hashtables and boxing here by allocating on demand.
4482 2004-05-30 Martin Baulig <martin@ximian.com>
4484 * rootcontext.cs (RootContext.LookupType): Don't cache things if
4485 we're doing a silent lookup. Don't try to lookup nested types in
4486 TypeManager.object_type (thanks to Ben Maurer).
4488 2004-05-30 Martin Baulig <martin@ximian.com>
4490 Committing a patch from Ben Maurer.
4492 * rootcontext.cs (RootContext.LookupType): Cache negative results.
4494 2004-05-29 Martin Baulig <martin@ximian.com>
4496 * class.cs (IMethodData.ShouldIgnore): New method.
4498 * typemanager.cs (TypeManager.MethodFlags): Don't take a
4499 `Location' argument, we don't need it anywhere. Use
4500 `IMethodData.ShouldIgnore ()' instead of
4501 `MethodData.GetMethodFlags ()'.
4502 (TypeManager.AddMethod): Removed.
4503 (TypeManager.AddMethod2): Renamed to AddMethod.
4505 2004-05-29 Martin Baulig <martin@ximian.com>
4507 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
4509 * convert.cs (Convert.ImplicitReferenceConversion): If we're
4510 converting from a class type S to an interface type and we already
4511 have an object on the stack, don't box it again. Fixes #52578.
4513 2004-05-29 Martin Baulig <martin@ximian.com>
4515 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
4516 Added support for `params' parameters. Fixes #59267.
4518 2004-05-29 Martin Baulig <martin@ximian.com>
4520 * literal.cs (NullPointer): Provide a private .ctor which sets
4521 `type' to TypeManager.object_type. Fixes #59048.
4523 2004-05-29 Martin Baulig <martin@ximian.com>
4525 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
4526 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
4528 * ecore.cs (EventExpr.instance_expr): Make the field private.
4530 2004-05-26 Marek Safar <marek.safar@seznam.cz>
4532 Fixed bug #50080 & cs0214-2.cs
4533 * expression.cs (Cast.DoResolve): Check unsafe context here.
4535 * statement.cs (Resolve.DoResolve): Likewise.
4537 2004-05-26 Martin Baulig <martin@ximian.com>
4539 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
4541 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
4542 (RootContext.LookupType): Pass down the `silent' flag.
4544 2004-05-25 Martin Baulig <martin@ximian.com>
4547 (MethodGroupExpr.IdenticalTypeName): New public property.
4548 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
4549 expression actually refers to a type.
4551 2004-05-25 Martin Baulig <martin@ximian.com>
4553 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
4554 for #56176 and made it actually work.
4556 2004-05-25 Martin Baulig <martin@ximian.com>
4558 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
4559 (FieldExpr, PropertyExpr): Override and implement
4560 CacheTemporaries. Fixes #52279.
4562 2004-05-25 Miguel de Icaza <miguel@ximian.com>
4564 * location.cs: In the new compiler listing a file twice is a
4565 warning, not an error.
4567 2004-05-24 Martin Baulig <martin@ximian.com>
4569 * enum.cs (Enum.DefineType): For the `BaseType' to be a
4570 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
4572 2004-05-24 Martin Baulig <martin@ximian.com>
4574 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
4575 walking the `using' list. Fixes #53921.
4577 2004-05-24 Martin Baulig <martin@ximian.com>
4579 * const.cs (Const.LookupConstantValue): Added support for
4580 EmptyCast's; fixes #55251.
4582 2004-05-24 Martin Baulig <martin@ximian.com>
4584 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
4585 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
4586 which does the CS0135 check. The reason is that we first need to
4587 check whether the variable actually exists.
4589 2004-05-24 Martin Baulig <martin@ximian.com>
4591 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
4592 than RootContext.LookupType() to find the explicit interface
4595 2004-05-24 Raja R Harinath <rharinath@novell.com>
4597 * Makefile: Simplify. Use executable.make.
4598 * mcs.exe.sources: New file. List of sources of mcs.exe.
4600 2004-05-24 Anders Carlsson <andersca@gnome.org>
4604 Use the invariant culture when doing String.Compare for CLS case
4607 2004-05-23 Martin Baulig <martin@ximian.com>
4609 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
4610 don't have any dots. Fixes #52622, added cs0246-8.cs.
4612 * namespace.cs (NamespaceEntry.Lookup): Likewise.
4614 2004-05-23 Marek Safar <marek.safar@seznam.cz>
4616 * class.cs (MemberBase.Define): Reuse MemberType member for
4617 resolved type. Other methods can use it too.
4619 2004-05-23 Martin Baulig <martin@ximian.com>
4621 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
4622 the variable also exists in the current block (otherwise, we need
4623 to report a CS0103). Fixes #58670.
4625 2004-05-23 Martin Baulig <martin@ximian.com>
4627 * flowanalysis.cs (Reachability.Reachable): Compute this
4628 on-the-fly rather than storing it as a field.
4630 2004-05-23 Martin Baulig <martin@ximian.com>
4632 * flowanalysis.cs (Reachability.And): Manually compute the
4633 resulting `barrier' from the reachability.
4635 2004-05-23 Marek Safar <marek.safar@seznam.cz>
4638 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
4639 instance of ObsoleteAttribute when symbol is obsolete.
4642 (IMethodData): Extended interface for ObsoleteAttribute support.
4644 2004-05-22 Marek Safar <marek.safar@seznam.cz>
4646 * attribute.cs: Fix bug #55970
4648 2004-05-22 Marek Safar <marek.safar@seznam.cz>
4652 (GetObsoleteAttribute): New method. Creates the instance of
4654 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
4655 ObsoleteAttribute when member is obsolete.
4656 (AttributeTester.Report_ObsoleteMessage): Common method for
4657 Obsolete error/warning reporting.
4660 (TypeContainer.base_classs_type): New member for storing parent type.
4663 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
4664 for this MemberCore.
4666 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4668 * attribute.cs, const.cs: Fix bug #58590
4670 2004-05-21 Martin Baulig <martin@ximian.com>
4672 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
4673 out parameters if the end of the method is unreachable. Fixes
4676 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4678 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
4679 Hari was right, why extra method.
4681 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4683 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
4685 2004-05-20 Martin Baulig <martin@ximian.com>
4687 Merged this back from gmcs to keep the differences to a minumum.
4689 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
4690 instead of a Declspace.
4691 (Attribute.ResolveType): Likewise.
4692 (Attributes.Search): Likewise.
4693 (Attributes.Contains): Likewise.
4694 (Attributes.GetClsCompliantAttribute): Likewise.
4696 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
4698 (MethodData.ApplyAttributes): Take an EmitContext instead of a
4701 2004-05-19 Marek Safar <marek.safar@seznam.cz>
4703 Fix bug #58688 (MCS does not report error when the same attribute
4706 * attribute.cs (Attribute.Emit): Distinction between null and default.
4708 2004-05-19 Raja R Harinath <rharinath@novell.com>
4710 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
4711 of a top-level attribute without an attribute target.
4712 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
4714 (Attribute.Conditional_GetConditionName),
4715 (Attribute.Obsolete_GetObsoleteMessage): Update.
4716 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
4717 part of ScanForIndexerName.
4718 (Attribute.CanIgnoreInvalidAttribute): New function.
4719 (Attribute.ScanForIndexerName): Move to ...
4720 (Attributes.ScanForIndexerName): ... here.
4721 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
4722 (Attributes.Search): New internal variant that can choose not to
4723 complain if types aren't resolved. The original signature now
4725 (Attributes.GetClsCompliantAttribute): Use internal variant, with
4726 complaints suppressed.
4727 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
4728 only if it not useful.
4729 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
4730 top-level for attributes that are shared between the assembly
4731 and a top-level class.
4732 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
4733 * class.cs: Update to reflect changes.
4734 (DefineIndexers): Fuse loops.
4735 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
4736 a couple more variants of attribute names.
4738 2004-05-18 Marek Safar <marek.safar@seznam.cz>
4740 Fix bug #52585 (Implemented explicit attribute declaration)
4743 (Attributable.ValidAttributeTargets): New abstract method. It gets
4744 list of valid attribute targets for explicit target declaration.
4745 (Attribute.Target): It holds target itself.
4746 (AttributeSection): Removed.
4747 (Attribute.CheckTargets): New method. It checks whether attribute
4748 target is valid for the current element.
4751 (EventProperty): New class. For events that are declared like
4752 property (with add and remove accessors).
4753 (EventField): New class. For events that are declared like field.
4756 * cs-parser.jay: Implemented explicit attribute target declaration.
4758 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
4759 Override ValidAttributeTargets.
4762 (ReturnParameter): Class for applying custom attributes on
4764 (ParameterAtribute): New class. Class for applying custom
4765 attributes on the parameter type.
4767 2004-05-17 Miguel de Icaza <miguel@ximian.com>
4769 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
4772 (Method): Allow UNSAFE here.
4774 * modifiers.cs: Support unsafe reporting.
4776 2004-05-17 Marek Safar <marek.safar@seznam.cz>
4778 * decl.cs: Fix bug #58478.
4780 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4782 * statement.cs: When checking for unreachable code on an EmptyStatement,
4783 set the location. Fixes bug #58488.
4785 2004-05-13 Miguel de Icaza <miguel@ximian.com>
4787 * driver.cs: Add -pkg handling.
4789 From Gonzalo: UseShelLExecute=false
4791 2004-05-12 Marek Safar <marek.safar@seznam.cz>
4794 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
4796 (Attribute.IsClsCompliaceRequired): Moved to base for better
4798 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
4799 when attribute is AttributeUsageAttribute.
4800 (Attribute.GetValidTargets): Simplified.
4801 (Attribute.GetAttributeUsage): New method returns AttributeUsage
4802 attribute for this type.
4803 (Attribute.ApplyAttributes): Method renamed to Emit and make
4805 (GlobalAttributeSection): New class for special handling of global
4806 attributes (assembly, module).
4807 (AttributeSection.Emit): New method.
4809 * class.cs: Implemented Attributable abstract methods.
4810 (MethodCore.LabelParameters): Moved to Parameter class.
4811 (Accessor): Is back simple class.
4812 (PropertyMethod): Implemented Attributable abstract class.
4813 (DelegateMethod): Implemented Attributable abstract class.
4814 (Event): New constructor for disctintion between normal Event
4815 and Event with accessors.
4817 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
4819 * codegen.cs, const.cs, decl.cs, delegate.cs:
4820 (CommonAssemblyModulClass): Implemented Attributable abstract class
4823 * enum.cs: Implement IAttributeSupport interface.
4824 (EnumMember): New class for emum members. Implemented Attributable
4828 (ParameterBase): Is abstract.
4829 (ReturnParameter): New class for easier [return:] attribute handling.
4831 * typemanager.cs: Removed builder_to_attr.
4833 2004-05-11 Raja R Harinath <rharinath@novell.com>
4836 * attribute.cs (Attribute.GetPositionalValue): New function.
4837 * class.cs (TypeContainer.VerifyMembers): New function.
4838 (TypeContainer.Emit): Use it.
4839 (ClassOrStruct): New base class for Class and Struct.
4840 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
4841 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
4843 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
4844 then each non-static field should have a FieldOffset attribute.
4845 Otherwise, none of the fields should have a FieldOffset attribute.
4846 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
4847 and FieldOffset attributes.
4848 * typemanager.cs (TypeManager.struct_layout_attribute_type)
4849 (TypeManager.field_offset_attribute_type): New core types.
4850 (TypeManager.InitCoreTypes): Initialize them.
4852 2004-05-11 Michal Moskal <malekith@pld-linux.org>
4854 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
4855 Return correct type.
4858 2004-05-09 Miguel de Icaza <miguel@ximian.com>
4860 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
4861 be implicitly converted to ulong.
4863 * expression.cs: The logic for allowing operator &, | and ^ worked
4864 was wrong, it worked before because we did not report an error in
4865 an else branch. Fixes 57895.
4867 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
4868 allow volatile fields to be reference types.
4870 2004-05-07 Miguel de Icaza <miguel@ximian.com>
4872 * driver.cs: Add support for /debug-
4874 2004-05-07 Raja R Harinath <rharinath@novell.com>
4876 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
4877 Add a 'complain' parameter to silence errors.
4878 (Attribute.Resolve): Update to changes. Put in sanity check to catch
4879 silently overlooked type-resolutions.
4880 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
4882 (Attributes.Search): New function.
4883 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
4884 (Attributes.GetAttributeFullName): Remove hack.
4885 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
4886 Update to reflect changes.
4887 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
4888 Use Attributes.Search instead of nested loops.
4890 2004-05-07 Marek Safar <marek.safar@seznam.cz>
4893 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
4894 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
4895 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
4897 * report.cs: (Report.Warning): Renamed to Warning_T because of
4898 parameter collision.
4900 2004-05-05 Raja R Harinath <rharinath@novell.com>
4902 * expression.cs (MemberAccess.ResolveMemberAccess):
4903 Exit with non-zero status after Report.Error.
4904 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
4906 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
4908 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
4910 * support.cs: Don't hang when the file is empty.
4912 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
4914 * support.cs: In SeekableStreamReader, compute the preamble size of the
4915 underlying stream. Position changes should take into account that initial
4918 2004-05-03 Todd Berman <tberman@sevenl.net>
4920 * driver.cs: remove unused GetSysVersion function.
4922 2004-05-03 Todd Berman <tberman@sevenl.net>
4924 * driver.cs: Remove the hack from saturday, as well as the hack
4925 from jackson (LoadAssemblyFromGac), also adds the CWD to the
4926 link_paths to get that bit proper.
4928 2004-05-01 Todd Berman <tberman@sevenl.net>
4930 * driver.cs: Try a LoadFrom before a Load, this checks the current
4931 path. This is currently a bug in mono that is be fixed, however, this
4932 provides a workaround for now. This will be removed when the bug
4935 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
4937 * CryptoConvert.cs: Updated to latest version. Fix issue with
4938 incomplete key pairs (#57941).
4940 2004-05-01 Todd Berman <tberman@sevenl.net>
4942 * driver.cs: Remove '.' from path_chars, now System.* loads properly
4945 2004-04-30 Jackson Harper <jackson@ximian.com>
4947 * codegen.cs: Open keys readonly.
4949 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4951 * typemanager.cs: don't report cyclic struct layout when a struct
4952 contains 2 or more fields of the same type. Failed for Pango.AttrShape
4953 which has 2 Pango.Rectangle fields.
4955 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
4957 * expression.cs: Handle IntPtr comparisons with IL code
4958 rather than a method call.
4960 2004-04-29 Martin Baulig <martin@ximian.com>
4962 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
4963 the list of PropertyInfo's in class hierarchy and find the
4964 accessor. Fixes #56013.
4966 2004-04-29 Martin Baulig <martin@ximian.com>
4968 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
4970 2004-04-29 Martin Baulig <martin@ximian.com>
4972 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
4974 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
4976 2004-04-29 Martin Baulig <martin@ximian.com>
4978 * class.cs (ConstructorInitializer.Resolve): Check whether the
4979 parent .ctor is accessible. Fixes #52146.
4981 2004-04-29 Martin Baulig <martin@ximian.com>
4983 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
4985 * statement.cs (Using.EmitLocalVariableDecls): Use
4986 TypeManager.idisposable_type, not typeof (IDisposable).
4987 (Foreach.EmitCollectionForeach): Added support for valuetypes.
4989 2004-04-29 Martin Baulig <martin@ximian.com>
4991 * class.cs (Event.Define): Don't emit the field and don't set
4992 RTSpecialName and SpecialName for events on interfaces. Fixes
4995 2004-04-29 Raja R Harinath <rharinath@novell.com>
4997 Refactor Attribute.ApplyAttributes.
4998 * attribute.cs (Attributable): New base class for objects that can
4999 have Attributes applied on them.
5000 (Attribute): Make AttributeUsage fields public.
5001 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
5002 (Attribute.IsInternalCall): New property.
5003 (Attribute.UsageAttr): Convert to a public read-only property.
5004 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
5005 (Attribute.ResolveType, Attribute.Resolve)
5006 (Attribute.ScanForIndexerName): Update to reflect changes.
5007 (Attribute.CheckAttributeTarget): Re-format.
5008 (Attribute.ApplyAttributes): Refactor, to various
5009 Attributable.ApplyAttributeBuilder methods.
5010 * decl.cs (MemberCore): Make Attributable.
5011 * class.cs (Accessor): Make Attributable.
5012 (MethodData.ApplyAttributes): Use proper attribute types, not
5014 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
5015 (TypeContainer.ApplyAttributeBuilder)
5016 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
5017 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
5018 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
5019 (Operator.ApplyAttributeBuilder): New factored-out methods.
5020 * const.cs (Const.ApplyAttributeBuilder): Likewise.
5021 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
5022 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
5023 * parameter.cs (ParameterBase): New Attributable base class
5024 that can also represent Return types.
5025 (Parameter): Update to the changes.
5027 2004-04-29 Jackson Harper <jackson@ximian.com>
5029 * driver.cs: Prefer the corlib system version when looking for
5030 assemblies in the GAC. This is still a hack, but its a better hack
5033 2004-04-29 Marek Safar <marek.safar@seznam.cz>
5035 * decl.cs, enum.cs: Improved error 3005 reporting.
5037 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
5038 (related_symbols): New private member for list of symbols
5039 related to reported error/warning.
5041 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
5043 2004-04-29 Martin Baulig <martin@ximian.com>
5045 * ecore.cs (Expression.Constantify): If we're an enum and
5046 TypeManager.TypeToCoreType() doesn't give us another type, use
5047 t.UnderlyingSystemType. Fixes #56178.
5049 2004-04-29 Martin Baulig <martin@ximian.com>
5051 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
5052 interfaces and for each interface, only add members directly
5053 declared in that interface. Fixes #53255.
5055 2004-04-28 Martin Baulig <martin@ximian.com>
5057 * expression.cs (ConditionalLogicalOperator): Use a temporary
5058 variable for `left' to avoid that we evaluate it more than once;
5061 2004-04-28 Martin Baulig <martin@ximian.com>
5063 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
5066 2004-04-28 Martin Baulig <martin@ximian.com>
5068 * statement.cs (LocalInfo.Resolve): Check whether the type is not
5071 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
5072 whether the type is not void (CS1547).
5074 2004-04-28 Martin Baulig <martin@ximian.com>
5076 * expression.cs (Unary.DoResolveLValue): Override this and report
5077 CS0131 for anything but Operator.Indirection.
5079 2004-04-28 Martin Baulig <martin@ximian.com>
5081 Committing a patch from Ben Maurer; see bug #50820.
5083 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
5086 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
5089 2004-04-28 Martin Baulig <martin@ximian.com>
5091 Committing a patch from Ben Maurer; see bug #50820.
5093 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
5096 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
5099 2004-04-28 Martin Baulig <martin@ximian.com>
5101 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
5102 (Block.AddLabel): Call DoLookupLabel() to only search in the
5105 2004-04-28 Martin Baulig <martin@ximian.com>
5107 * cfold.cs (ConstantFold.BinaryFold): Added special support for
5108 comparing StringConstants and NullLiterals in Equality and Inequality.
5110 2004-04-28 Jackson Harper <jackson@ximian.com>
5112 * driver.cs: Attempt to load referenced assemblies from the
5113 GAC. This is the quick and dirty version of this method that
5114 doesnt take into account versions and just takes the first
5115 canidate found. Will be good enough for now as we will not have more
5116 then one version installed into the GAC until I update this method.
5118 2004-04-28 Martin Baulig <martin@ximian.com>
5120 * typemanager.cs (TypeManager.CheckStructCycles): New public
5121 static method to check for cycles in the struct layout.
5123 * rootcontext.cs (RootContext.PopulateTypes): Call
5124 TypeManager.CheckStructCycles() for each TypeContainer.
5125 [Note: We only need to visit each type once.]
5127 2004-04-28 Martin Baulig <martin@ximian.com>
5129 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
5131 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
5132 success and added `out object value'. Use a `bool resolved' field
5133 to check whether we've already been called rather than
5134 `ConstantValue != null' since this breaks for NullLiterals.
5136 2004-04-28 Raja R Harinath <rharinath@novell.com>
5138 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
5139 setting of this flag, since the 'set' method may be non-public.
5141 2004-04-28 Raja R Harinath <rharinath@novell.com>
5143 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
5144 check on current_vector.Block.
5146 2004-04-27 Martin Baulig <martin@ximian.com>
5148 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
5149 a field initializer. Fixes #56459.
5151 2004-04-27 Martin Baulig <martin@ximian.com>
5153 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
5154 we're not attempting to use an indexer. Fixes #52154.
5156 2004-04-27 Martin Baulig <martin@ximian.com>
5158 * statement.cs (Return): Don't create a return label if we don't
5159 need it; reverts my change from January 20th. Thanks to Ben
5162 2004-04-27 Martin Baulig <martin@ximian.com>
5164 According to the spec, `goto' can only leave a nested scope, but
5167 * statement.cs (Block.LookupLabel): Only lookup in the current
5168 block, don't recurse into parent or child blocks.
5169 (Block.AddLabel): Check in parent and child blocks, report
5170 CS0140/CS0158 if we find a duplicate.
5171 (Block): Removed this indexer for label lookups.
5172 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
5173 this already does the error reporting for us.
5176 (FlowBranching.UsageVector.Block): New public variable; may be null.
5177 (FlowBranching.CreateSibling): Added `Block' argument.
5178 (FlowBranching.LookupLabel): New public virtual method. Lookup a
5179 label for the target of a `goto' and check whether we're not
5180 leaving a `finally'.
5182 2004-04-27 Martin Baulig <martin@ximian.com>
5184 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
5185 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
5188 2004-04-27 Martin Baulig <martin@ximian.com>
5190 * statement.cs (Block.AddLabel): Also check for implicit blocks
5191 and added a CS0158 check.
5193 2004-04-27 Martin Baulig <martin@ximian.com>
5195 * flowanalysis.cs (FlowBranchingLoop): New class.
5196 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
5197 UsageVector's instead of an ArrayList.
5198 (FlowBranching.Label): Likewise.
5199 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
5200 (FlowBranching.AddBreakVector): New method.
5202 2004-04-27 Miguel de Icaza <miguel@ximian.com>
5204 * attribute.cs: Small regression fix: only convert the type if we
5205 the type is different, fixes System.Drawing build.
5207 2004-04-27 Martin Baulig <martin@ximian.com>
5209 * attribute.cs (Attribute.Resolve): If we have a constant value
5210 for a named field or property, implicity convert it to the correct
5213 2004-04-27 Raja R Harinath <rharinath@novell.com>
5215 * statement.cs (Block.Block): Implicit blocks share
5216 'child_variable_names' fields with parent blocks.
5217 (Block.AddChildVariableNames): Remove.
5218 (Block.AddVariable): Mark variable as "used by a child block" in
5219 every surrounding block.
5220 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
5221 been used in a child block, complain about violation of "Invariant
5222 meaning in blocks" rule.
5223 * cs-parser.jay (declare_local_variables): Don't use
5224 AddChildVariableNames.
5225 (foreach_statement): Don't create an implicit block: 'foreach'
5228 2004-04-23 Miguel de Icaza <miguel@ximian.com>
5230 * convert.cs (ImplicitNumericConversion): 0 is also positive when
5231 converting from 0L to ulong. Fixes 57522.
5233 2004-04-22 Marek Safar <marek.safar@seznam.cz>
5235 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
5236 derived class hides via 'new' keyword field from base class (test-242.cs).
5237 TODO: Handle this in the more general way.
5239 * class.cs (CheckBase): Ditto.
5241 2004-04-22 Marek Safar <marek.safar@seznam.cz>
5243 * decl.cs (caching_flags): New member for storing cached values
5245 (MemberCore.Flags): New enum where bit flags for caching_flags
5247 (MemberCore.cls_compliance): Moved to caching_flags.
5248 (DeclSpace.Created): Moved to caching_flags.
5250 * class.cs: Use caching_flags instead of DeclSpace.Created
5252 2004-04-21 Miguel de Icaza <miguel@ximian.com>
5254 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
5255 if we are only a derived class, not a nested class.
5257 * typemanager.cs: Same as above, but do this at the MemberLookup
5258 level (used by field and methods, properties are handled in
5259 PropertyExpr). Allow for the qualified access if we are a nested
5262 2004-04-21 Marek Safar <marek.safar@seznam.cz>
5264 * class.cs: Refactoring.
5265 (IMethodData): New inteface; Holds links to parent members
5266 to avoid member duplication (reduced memory allocation).
5267 (Method): Implemented IMethodData interface.
5268 (PropertyBase): New inner classes for get/set methods.
5269 (PropertyBase.PropertyMethod): Implemented IMethodData interface
5270 (Event): New inner classes for add/remove methods.
5271 (Event.DelegateMethod): Implemented IMethodData interface.
5273 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
5274 EmitContext (related to class.cs refactoring).
5276 2004-04-21 Raja R Harinath <rharinath@novell.com>
5278 * delegate.cs (Delegate.VerifyApplicability): If the number of
5279 arguments are the same as the number of parameters, first try to
5280 verify applicability ignoring any 'params' modifier on the last
5284 2004-04-16 Raja R Harinath <rharinath@novell.com>
5286 * class.cs (TypeContainer.AddIndexer): Use
5287 'ExplicitInterfaceName' to determine if interface name was
5288 explicitly specified. 'InterfaceType' is not initialized at this time.
5289 (TypeContainer.DefineIndexers): Remove use of temporary list. The
5290 Indexers array is already in the required order. Initialize
5291 'IndexerName' only if there are normal indexers.
5292 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
5293 (TypeContainer.Emit): Emit DefaultMember attribute only if
5294 IndexerName is initialized.
5297 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
5299 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
5302 2004-04-15 Raja R Harinath <rharinath@novell.com>
5304 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
5308 * attribute.cs (Attribute.Resolve): Check for duplicate named
5312 2004-04-15 Miguel de Icaza <miguel@ximian.com>
5314 * iterators.cs (MarkYield): track whether we are in an exception,
5315 and generate code accordingly. Use a temporary value to store the
5316 result for our state.
5318 I had ignored a bit the interaction of try/catch with iterators
5319 since their behavior was not entirely obvious, but now it is
5320 possible to verify that our behavior is the same as MS .NET 2.0
5324 2004-04-14 Miguel de Icaza <miguel@ximian.com>
5326 * iterators.cs: Avoid creating temporaries if there is no work to
5329 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
5330 Enumerations, use TypeManager.EnumToUnderlying and call
5333 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
5336 (This.Emit): Use EmitContext.EmitThis to emit our
5339 (This.EmitAssign): Ditto.
5341 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
5342 codepaths, we will move all the functionality into
5345 (FieldExpr.EmitAssign): Ditto.
5347 This fixes several hidden bugs that I uncovered while doing a code
5348 review of this today.
5350 * codegen.cs (EmitThis): reworked so the semantics are more clear
5351 and also support value types "this" instances.
5353 * iterators.cs: Changed so that for iterators in value types, we
5354 do not pass the value type as a parameter.
5356 Initialization of the enumerator helpers is now done in the caller
5357 instead of passing the parameters to the constructors and having
5358 the constructor set the fields.
5360 The fields have now `assembly' visibility instead of private.
5362 2004-04-11 Miguel de Icaza <miguel@ximian.com>
5364 * expression.cs (Argument.Resolve): Check if fields passed as ref
5365 or out are contained in a MarshalByRefObject.
5367 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
5368 another compiler type.
5370 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
5372 * class.cs (Indexer.Define): use the new name checking method.
5373 Also, return false on an error.
5374 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
5375 (is_identifier_[start/part]_character): make static.
5377 2004-04-10 Miguel de Icaza <miguel@ximian.com>
5379 * expression.cs (Binary.ResolveOperator): Do no append strings
5380 twice: since we can be invoked more than once (array evaluation)
5381 on the same concatenation, take care of this here. Based on a fix
5382 from Ben (bug #56454)
5384 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
5386 * codegen.cs: Fix another case where CS1548 must be reported (when
5387 delay-sign isn't specified and no private is available #56564). Fix
5388 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
5389 error when MCS is used on the MS runtime and we need to delay-sign
5390 (which seems unsupported by AssemblyBuilder - see #56621).
5392 2004-04-08 Marek Safar <marek.safar@seznam.cz>
5394 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
5395 (TypeManager.ComputeNamespaces): Faster implementation for
5398 * compiler.csproj: Updated AssemblyName to mcs.
5400 2004-04-07 Miguel de Icaza <miguel@ximian.com>
5402 * rootcontext.cs: Add new types to the boot resolution.
5404 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
5405 MulticastDelegate is not allowed.
5407 * typemanager.cs: Add new types to lookup: System.TypedReference
5410 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
5411 check for TypedReference or ArgIterator, they are not allowed.
5413 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
5414 makes us properly catch 1510 in some conditions (see bug 56016 for
5417 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
5419 * CryptoConvert.cs: update from corlib version
5422 2004-04-05 Miguel de Icaza <miguel@ximian.com>
5424 * class.cs (Indexer.Define): Check indexername declaration
5426 2004-04-05 Marek Safar <marek.safar@seznam.cz>
5428 * attribute.cs (IsClsCompliant): Fixed problem with handling
5429 all three states (compliant, not-compliant, undetected).
5431 2004-03-30 Marek Safar <marek.safar@seznam.cz>
5433 * attribute.cs (Attribute): Location is now public.
5434 (Resolve): Store resolved arguments (pos_values) in attribute class.
5435 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
5436 (GetClsCompliantAttributeValue): New method that gets
5437 CLSCompliantAttribute value.
5438 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
5439 if exists else null.
5440 (AttributeTester): New class for CLS-Compliant verification routines.
5442 * class.cs (Emit): Add CLS-Compliant verification.
5443 (Method.GetSignatureForError): Implemented.
5444 (Constructor.GetSignatureForError): Implemented
5445 (Constructor.HasCompliantArgs): Returns if constructor has
5446 CLS-Compliant arguments.
5447 (Constructor.Emit): Override.
5448 (Construcor.IsIdentifierClsCompliant): New method; For constructors
5449 is needed to test only parameters.
5450 (FieldBase.GetSignatureForError): Implemented.
5451 (TypeContainer): New member for storing base interfaces.
5452 (TypeContainer.FindMembers): Search in base interfaces too.
5454 * codegen.cs (GetClsComplianceAttribute): New method that gets
5455 assembly or module CLSCompliantAttribute value.
5456 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
5458 (ModuleClass.Emit): Add error 3012 test.
5460 * const.cs (Emit): Override and call base for CLS-Compliant tests.
5462 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
5463 state for all decl types.
5464 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
5465 if CLS-Compliant tests are required.
5466 (IsClsCompliaceRequired): New method. Analyze whether code
5467 must be CLS-Compliant.
5468 (IsExposedFromAssembly): New method. Returns true when MemberCore
5469 is exposed from assembly.
5470 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
5471 value or gets cached value.
5472 (HasClsCompliantAttribute): New method. Returns true if MemberCore
5473 is explicitly marked with CLSCompliantAttribute.
5474 (IsIdentifierClsCompliant): New abstract method. This method is
5475 used to testing error 3005.
5476 (IsIdentifierAndParamClsCompliant): New method. Common helper method
5477 for identifier and parameters CLS-Compliant testing.
5478 (VerifyClsCompliance): New method. The main virtual method for
5479 CLS-Compliant verifications.
5480 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
5481 null. I don't know why is null (too many public members !).
5482 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
5483 and get value of first CLSCompliantAttribute that found.
5485 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
5486 (VerifyClsCompliance): Override and add extra tests.
5488 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
5489 clscheck- disable CLS-Compliant verification event if assembly is has
5490 CLSCompliantAttribute(true).
5492 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
5493 ApllyAttribute is now called in emit section as in the other cases.
5494 Possible future Emit integration.
5495 (IsIdentifierClsCompliant): New override.
5496 (VerifyClsCompliance): New override.
5497 (GetEnumeratorName): Returns full enum name.
5499 * parameter.cs (GetSignatureForError): Implemented.
5501 * report.cs (WarningData): New struct for Warning message information.
5502 (LocationOfPreviousError): New method.
5503 (Warning): New method. Reports warning based on the warning table.
5504 (Error_T): New method. Reports error based on the error table.
5506 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
5507 verifications are done here.
5509 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
5511 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
5512 CLSCompliantAttribute.
5513 (all_imported_types): New member holds all imported types from other
5515 (LoadAllImportedTypes): New method fills static table with exported types
5516 from all referenced assemblies.
5517 (Modules): New property returns all assembly modules.
5519 2004-03-30 Miguel de Icaza <miguel@ximian.com>
5521 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
5522 throwing a parser error.
5524 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
5525 which removes the hardcoded get_/set_ prefixes for properties, as
5526 IL allows for the properties to be named something else.
5530 * expression.cs: Do not override operand before we know if it is
5533 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5535 * typemanager.cs: support for pinned variables.
5537 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5539 * decl.cs, typemanager.cs: Avoid using an arraylist
5540 as a buffer if there is only one result set.
5542 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5544 * expression.cs: Make sure you cant call a static method
5545 with an instance expression, bug #56174.
5547 2004-03-29 Miguel de Icaza <miguel@ximian.com>
5549 * class.cs (IsDuplicateImplementation): Improve error reporting to
5550 flag 663 (method only differs in parameter modifier).
5552 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
5553 in preprocessor directives.
5555 * location.cs (LookupFile): Allow for the empty path.
5557 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
5558 better approach for some of that patch, but its failing with the
5559 CharSet enumeration. For now try/catch will do.
5561 * typemanager.cs: Do not crash if a struct does not have fields.
5564 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5566 * expression.cs: cs0213, cant fix a fixed expression.
5569 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5571 * cs-parser.jay: detect invalid embeded statements gracefully.
5574 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5576 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
5579 the invocation type may not be a subclass of the tye of the item/
5580 The type of the item must be a subclass of the invocation item.
5585 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
5587 * attribute.cs: Added methods to get a string and a bool from an
5588 attribute. Required to information from AssemblyKeyFileAttribute,
5589 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
5590 * codegen.cs: Modified AssemblyName creation to include support for
5591 strongnames. Catch additional exceptions to report them as CS1548.
5592 * compiler.csproj: Updated include CryptoConvert.cs.
5593 * compiler.csproj.user: Removed file - user specific configuration.
5594 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
5595 Mono.Security assembly. The original class is maintained and tested in
5596 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
5597 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
5598 like CSC 8.0 (C# v2) supports.
5599 * Makefile: Added CryptoConvert.cs to mcs sources.
5600 * rootcontext.cs: Added new options for strongnames.
5602 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
5604 * driver.cs: For --expect-error, report error code `2'
5605 if the program compiled with no errors, error code `1' if
5606 it compiled with an error other than the one expected.
5608 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
5610 * compiler.csproj: Updated for Visual Studio .NET 2003.
5611 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
5612 * compiler.sln: Updated for Visual Studio .NET 2003.
5614 2004-03-24 Ravi Pratap M <ravi@ximian.com>
5616 * expression.cs: Fix bug #47234. We basically need to apply the
5617 rule that we prefer the conversion of null to a reference type
5618 when faced with a conversion to 'object' (csc behaviour).
5620 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5622 * statement.cs: Shorter form for foreach, eliminates
5623 a local variable. r=Martin.
5625 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5627 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
5628 checks if we can use brtrue/brfalse to test for 0.
5629 * expression.cs: use the above in the test for using brtrue/brfalse.
5632 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5634 * expression.cs: Rewrite string concat stuff. Benefits:
5636 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
5637 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
5638 rather than a concat chain.
5640 * typemanager.cs: Add lookups for more concat overloads.
5642 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5644 * expression.cs: Emit shorter il code for array init.
5661 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
5663 * statement.cs: Before, two switch blocks would be merged if the
5664 total size of the blocks (end_item - begin_item + 1) was less than
5665 two times the combined sizes of the blocks.
5667 Now, it will only merge if after the merge at least half of the
5672 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
5674 * class.cs : csc build fix for GetMethods(). See bug #52503.
5676 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
5678 * expression.cs: Make sure fp comparisons work with NaN.
5679 This fixes bug #54303. Mig approved this patch a long
5680 time ago, but we were not able to test b/c the runtime
5683 2004-03-19 Miguel de Icaza <miguel@ximian.com>
5685 * ecore.cs (TypExpr.GetHashCode): implement this overload.
5687 2004-03-19 Martin Baulig <martin@ximian.com>
5689 * class.cs (MemberCore.IsDuplicateImplementation): Report the
5690 error here and not in our caller.
5692 2004-03-19 Martin Baulig <martin@ximian.com>
5694 * interface.cs: Completely killed this file.
5695 (Interface): We're now a TypeContainer and live in class.cs.
5697 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
5698 argument; we're now also called for interfaces.
5699 (TypeContainer.DefineMembers): Allow this method being called
5701 (TypeContainer.GetMethods): New public method; formerly known as
5702 Interface.GetMethod(). This is used by PendingImplementation.
5703 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
5704 it's now private and non-static.
5705 (Interface): Moved this here; it's now implemented similar to
5707 (Method, Property, Event, Indexer): Added `bool is_interface'
5708 argument to their .ctor's.
5709 (MemberBase.IsInterface): New public field.
5711 * cs-parser.jay: Create normal Method, Property, Event, Indexer
5712 instances instead of InterfaceMethod, InterfaceProperty, etc.
5713 (opt_interface_base): Removed; we now use `opt_class_base' instead.
5714 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
5716 2004-03-19 Martin Baulig <martin@ximian.com>
5718 * class.cs (MethodCore.IsDuplicateImplementation): New private
5719 method which does the CS0111 checking.
5720 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
5721 Use IsDuplicateImplementation().
5723 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
5725 * decl.cs (FindMemberToOverride): New method to find the correct
5726 method or property to override in the base class.
5728 - Make Method/Property use the above method to find the
5729 version in the base class.
5730 - Remove the InheritableMemberSignatureCompare as it is now
5733 This patch makes large code bases much faster to compile, as it is
5734 O(n) rather than O(n^2) to do this validation.
5736 Also, it fixes bug 52458 which is that nested classes are not
5737 taken into account when finding the base class member.
5739 Reviewed/Approved by Martin.
5741 2004-03-17 Marek Safar <marek.safar@seznam.cz>
5743 * interface.cs: In all interface classes removed redundant
5744 member initialization.
5746 2004-03-16 Martin Baulig <martin@ximian.com>
5748 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
5750 2004-03-15 Miguel de Icaza <miguel@ximian.com>
5752 * decl.cs (DefineTypeAndParents): New helper method to define a
5753 type's containers before the type itself is defined; This is a
5754 bug exposed by the recent changes to Windows.Forms when an
5755 implemented interface was defined inside a class that had not been
5758 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
5760 (Check): Loop correctly to report errors modifiers
5761 (UNSAFE was not in the loop, since it was the same as TOP).
5763 * interface.cs: Every interface member now takes a ModFlags,
5764 instead of a "is_new" bool, which we set on the base MemberCore.
5766 Every place where we called "UnsafeOk" in the interface, now we
5767 call the proper member (InterfaceMethod.UnsafeOK) instead to get
5768 the unsafe settings from the member declaration instead of the
5769 container interface.
5771 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
5773 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
5774 `set_indexer_name' to the pending bits (one per type).
5776 We fixed a bug today that was picking the wrong method to
5777 override, since for properties the existing InterfaceMethod code
5778 basically ignored the method name. Now we make sure that the
5779 method name is one of the valid indexer names.
5781 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
5783 * support.cs (SeekableStreamReader): Keep track of stream byte
5784 positions and don't mix them with character offsets to the buffer.
5786 Patch from Gustavo Giráldez
5788 2004-03-15 Marek Safar <marek.safar@seznam.cz>
5790 * interface.cs (InterfaceSetGetBase): Removed double member
5791 initialization, base class does it as well.
5793 2004-03-13 Martin Baulig <martin@ximian.com>
5795 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
5796 when compiling corlib.
5798 2004-03-13 Miguel de Icaza <miguel@ximian.com>
5800 * convert.cs (ExplicitConversion): We were reporting an error on
5801 certain conversions (object_type source to a value type, when the
5802 expression was `null') before we had a chance to pass it through
5803 the user defined conversions.
5805 * driver.cs: Replace / and \ in resource specifications to dots.
5808 * class.cs: Add check for duplicate operators. Fixes 52477
5810 2004-03-11 Miguel de Icaza <miguel@ximian.com>
5812 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
5813 that are in the middle of the statements, not only at the end.
5816 * class.cs (TypeContainer.AddField): No longer set the
5817 `HaveStaticConstructor' flag, now we call it
5818 `UserDefineStaticConstructor' to diferentiate the slightly
5819 semantic difference.
5821 The situation is that we were not adding BeforeFieldInit (from
5822 Modifiers.TypeAttr) to classes that could have it.
5823 BeforeFieldInit should be set to classes that have no static
5828 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
5830 And most importantly Zoltan's comment:
5832 http://bugzilla.ximian.com/show_bug.cgi?id=44229
5834 "I think beforefieldinit means 'it's ok to initialize the type sometime
5835 before its static fields are used', i.e. initialization does not need
5836 to be triggered by the first access to the type. Setting this flag
5837 helps the JIT to compile better code, since it can run the static
5838 constructor at JIT time, and does not need to generate code to call it
5839 (possibly lots of times) at runtime. Unfortunately, mcs does not set
5840 this flag for lots of classes like String.
5842 csc sets this flag if the type does not have an explicit static
5843 constructor. The reasoning seems to be that if there are only static
5844 initalizers for a type, and no static constructor, then the programmer
5845 does not care when this initialization happens, so beforefieldinit
5848 This bug prevents the AOT compiler from being usable, since it
5849 generates so many calls to mono_runtime_class_init that the AOT code
5850 is much slower than the JITted code. The JITted code is faster,
5851 because it does not generate these calls if the vtable is type is
5852 already initialized, which is true in the majority of cases. But the
5853 AOT compiler can't do this."
5855 2004-03-10 Miguel de Icaza <miguel@ximian.com>
5857 * class.cs (MethodData.Emit): Refactor the code so symbolic
5858 information is generated for destructors; For some reasons we
5859 were taking a code path that did not generate symbolic information
5862 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
5864 * class.cs: Create a Constructor.CheckBase method that
5865 takes care of all validation type code. The method
5866 contains some code that was moved from Define.
5868 It also includes new code that checks for duplicate ctors.
5869 This fixes bug #55148.
5871 2004-03-09 Joshua Tauberer <tauberer@for.net>
5873 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
5874 a { ... }-style array creation invokes EmitStaticInitializers
5875 which is not good for reference-type arrays. String, decimal
5876 and now null constants (NullCast) are not counted toward
5877 static initializers.
5879 2004-03-05 Martin Baulig <martin@ximian.com>
5881 * location.cs (SourceFile.HasLineDirective): New public field;
5882 specifies whether the file contains or is referenced by a "#line"
5884 (Location.DefineSymbolDocuments): Ignore source files which
5885 either contain or are referenced by a "#line" directive.
5887 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
5889 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
5890 direct access to our parent, so check the method inline there.
5892 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
5894 * expression.cs (Invocation.EmitCall): Miguel's last commit
5895 caused a regression. If you had:
5900 In Foo the implict this would be null.
5902 2004-02-27 Miguel de Icaza <miguel@ximian.com>
5904 * expression.cs (Invocation.EmitCall): If the method is not
5905 virtual, do not emit a CallVirt to it, use Call.
5907 * typemanager.cs (GetFullNameSignature): Improve the method to
5908 cope with ".ctor" and replace it with the type name.
5910 * class.cs (ConstructorInitializer.Resolve): Now the method takes
5911 as an argument the ConstructorBuilder where it is being defined,
5912 to catch the recursive constructor invocations.
5914 2004-02-26 Miguel de Icaza <miguel@ximian.com>
5916 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
5917 routines to check if a type is an enumerable/enumerator allow
5918 classes that implement the IEnumerable or IEnumerator interfaces.
5920 * class.cs (Property, Operator): Implement IIteratorContainer, and
5921 implement SetYields.
5923 (Property.Define): Do the block swapping for get_methods in the
5924 context of iterators. We need to check if Properties also
5925 include indexers or not.
5927 (Operator): Assign the Block before invoking the
5928 OperatorMethod.Define, so we can trigger the Iterator code
5931 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
5932 Property and Operator classes are not created when we parse the
5933 declarator but until we have the block completed, so we use a
5934 singleton SimpleIteratorContainer.Simple to flag whether the
5935 SetYields has been invoked.
5937 We propagate this setting then to the Property or the Operator to
5938 allow the `yield' to function.
5940 2004-02-25 Marek Safar <marek.safar@seznam.cz>
5942 * codegen.cs: Implemented attribute support for modules.
5943 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
5944 Assembly/Module functionality.
5946 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
5947 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
5948 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
5950 2004-02-16 Marek Safar <marek.safar@seznam.cz>
5952 * interface.cs (FindMembers): The operation is performed on all base
5953 interfaces and not only on the first. It is required for future CLS Compliance patch.
5955 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
5957 * statement.cs, codegen.cs:
5958 This patch deals with patterns such as:
5960 public class List : IEnumerable {
5962 public MyEnumerator GetEnumerator () {
5963 return new MyEnumerator(this);
5966 IEnumerator IEnumerable.GetEnumerator () {
5970 public struct MyEnumerator : IEnumerator {
5975 Before, there were a few things we did wrong:
5976 1) we would emit callvirt on a struct, which is illegal
5977 2) we emited ldarg when we needed to emit ldarga
5978 3) we would mistakenly call the interface methods on an enumerator
5979 type that derived from IEnumerator and was in another assembly. For example:
5981 public class MyEnumerator : IEnumerator
5983 Would have the interface methods called, even if there were public impls of the
5984 method. In a struct, this lead to invalid IL code.
5986 2004-02-11 Marek Safar <marek.safar@seznam.cz>
5988 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
5991 * delegate.cs (Define): Fixed crash when delegate type is undefined.
5993 2004-02-11 Miguel de Icaza <miguel@ximian.com>
5995 * cs-parser.jay: Fix small regression: we were not testing V2
5996 compiler features correctly.
5998 * interface.cs: If the emit context is null, then create one
6000 2004-02-09 Marek Safar <marek.safar@seznam.cz>
6002 * decl.cs (GetSignatureForError): New virtual method to get full name
6005 * attribute.cs (IAttributeSupport): New interface for attribute setting.
6006 Now it is possible to rewrite ApplyAttributes method to be less if/else.
6008 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
6009 Duplicated members and code in these classes has been removed.
6010 Better encapsulation in these classes.
6012 2004-02-07 Miguel de Icaza <miguel@ximian.com>
6014 * assign.cs (Assign.DoResolve): When dealing with compound
6015 assignments, there is a new rule in ECMA C# 2.4 (might have been
6016 there before, but it is documented here) that states that in:
6020 If b is of type int, and the `op' is a shift-operator, then the
6021 above is evaluated as:
6025 * expression.cs (Binary.ResolveOperator): Instead of testing for
6026 int/uint/long/ulong, try to implicitly convert to any of those
6027 types and use that in pointer arithmetic.
6029 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
6030 method to print information for from the type, not from the
6031 null-method we were given.
6033 2004-02-01 Duncan Mak <duncan@ximian.com>
6035 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
6036 parsing for cmd, fixes bug #53694.
6038 2004-02-04 Marek Safar <marek.safar@seznam.cz>
6040 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
6041 in the member name duplication tests. Property and operator name duplication
6042 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
6044 2004-02-03 Marek Safar <marek.safar@seznam.cz>
6046 * interface.cs (PopulateMethod): Fixed crash when interface method
6047 returns not existing type (error test cs0246-3.cs).
6049 2004-02-02 Ravi Pratap M <ravi@ximian.com>
6051 * cs-parser.jay (interface_accessors): Re-write actions to also
6052 store attributes attached to get and set methods. Fix spelling
6055 (inteface_property_declaration): Modify accordingly.
6057 (InterfaceAccessorInfo): New helper class to store information to pass
6058 around between rules that use interface_accessors.
6060 * interface.cs (Emit): Apply attributes on the get and set
6061 accessors of properties and indexers too.
6063 * attribute.cs (ApplyAttributes): Modify accordingly to use the
6064 right MethodBuilder when applying attributes to the get and set accessors.
6066 2004-01-31 Miguel de Icaza <miguel@ximian.com>
6068 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
6070 2004-01-26 Miguel de Icaza <miguel@ximian.com>
6072 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
6074 2004-01-25 Miguel de Icaza <miguel@ximian.com>
6076 * cs-parser.jay: Remove YIELD token, instead use the new grammar
6077 changes that treat `yield' specially when present before `break'
6080 * cs-tokenizer.cs: yield is no longer a keyword.
6082 2004-01-23 Marek Safar <marek.safar@seznam.cz>
6084 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
6085 setting for default constructors.
6086 For default constructors are almost every time set wrong Modifier. The
6087 generated IL code has been alright. But inside mcs this values was
6088 wrong and this was reason why several of my CLS Compliance tests
6091 2004-01-22 Martin Baulig <martin@ximian.com>
6093 * cs-parser.jay (namespace_or_type_name): Return an Expression,
6094 not a QualifiedIdentifier. This is what `type_name_expression'
6095 was previously doing.
6096 (type_name_expression): Removed; the code is now in
6097 `namespace_or_type_name'.
6098 (qualified_identifier): Removed, use `namespace_or_type_name'
6100 (QualifiedIdentifier): Removed this class.
6102 2004-01-22 Martin Baulig <martin@ximian.com>
6104 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
6105 not a string as alias name.
6107 2004-01-21 Miguel de Icaza <miguel@ximian.com>
6109 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
6110 #52730 bug, and instead compute correctly the need to use a
6111 temporary variable when requesting an address based on the
6112 static/instace modified of the field and the constructor.
6114 2004-01-21 Martin Baulig <martin@ximian.com>
6116 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
6117 class and namespace before looking up aliases. Fixes #52517.
6119 2004-01-21 Martin Baulig <martin@ximian.com>
6121 * flowanalysis.cs (UsageVector.Merge): Allow variables being
6122 assinged in a 'try'; fixes exception4.cs.
6124 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6125 * class.cs : Implemented parameter-less constructor for TypeContainer
6127 * decl.cs: Attributes are now stored here. New property OptAttributes
6129 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
6131 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
6133 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6135 * typemanager.cs (CSharpSignature): Now reports also inner class name.
6136 (CSharpSignature): New method for indexer and property signature.
6138 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6140 * pending.cs (IsVirtualFilter): Faster implementation.
6142 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6144 * typemanager.cs: Avoid inclusion of same assembly more than once.
6146 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6148 * cs-parser.jay: Fixed problem where the last assembly attribute
6149 has been applied also to following declaration (class, struct, etc.)
6151 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6153 * class.cs: Added error CS0538, CS0539 reporting.
6154 Fixed crash on Microsoft runtime when field type is void.
6156 * cs-parser.jay: Added error CS0537 reporting.
6158 * pending.cs: Added error CS0535 reporting.
6159 Improved error report for errors CS0536, CS0534.
6161 2004-01-20 Miguel de Icaza <miguel@ximian.com>
6163 Merge a few bits from the Anonymous Method MCS tree.
6165 * statement.cs (ToplevelBlock): New class for toplevel methods,
6166 will hold anonymous methods, lifted variables.
6168 * cs-parser.jay: Create toplevel blocks for delegates and for
6169 regular blocks of code.
6171 2004-01-20 Martin Baulig <martin@ximian.com>
6173 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
6174 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
6175 and `NeedExplicitReturn'; added `IsLastStatement'.
6176 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
6177 have a `ReturnLabel' or we're not unreachable.
6179 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
6180 child's reachability; don't just override ours with it. Fixes
6181 #58058 (lluis's example).
6182 (FlowBranching): Added public InTryOrCatch(), InCatch(),
6183 InFinally(), InLoop(), InSwitch() and
6184 BreakCrossesTryCatchBoundary() methods.
6186 * statement.cs (Return): Do all error checking in Resolve().
6187 Unless we are the last statement in a top-level block, always
6188 create a return label and jump to it.
6189 (Break, Continue): Do all error checking in Resolve(); also make
6190 sure we aren't leaving a `finally'.
6191 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
6192 statement in a top-level block.
6193 (Block.Flags): Added `IsDestructor'.
6194 (Block.IsDestructor): New public property.
6196 2004-01-20 Martin Baulig <martin@ximian.com>
6198 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
6200 2004-01-20 Martin Baulig <martin@ximian.com>
6202 * statement.cs (Statement.ResolveUnreachable): New public method.
6203 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
6204 (Block.Resolve): Resolve unreachable statements.
6206 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
6208 * expression.cs: We need to fix the case where we do
6209 not have a temp variable here.
6211 * assign.cs: Only expression compound assignments need
6212 temporary variables.
6214 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
6216 * flowanalysis.cs: Reduce memory allocation in a few ways:
6217 - A block with no variables should not allocate a bit
6219 - A method with no out parameters does not need any tracking
6220 for assignment of the parameters, so we need not allocate
6223 public readonly Type[] VariableTypes;
6224 public readonly string[] VariableNames;
6225 Are redundant. The data is already stored in the variable
6226 map, so we need not allocate another array for it.
6227 - We need to add alot of checks for if (params | locals) == null
6228 due to the first two changes.
6230 2004-01-18 Miguel de Icaza <miguel@ximian.com>
6232 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
6233 implement IMemoryLocation, we store a copy on a local variable and
6234 take the address of it. Patch from Benjamin Jemlich
6236 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
6237 to use a special "type_name_expression" rule which reduces the
6238 number of "QualifiedIdentifier" classes created, and instead
6239 directly creates MemberAccess expressions.
6241 2004-01-17 Miguel de Icaza <miguel@ximian.com>
6243 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
6244 that fixes #52853. Null literal assignment to ValueType
6246 * class.cs (MethodData.Emit): Instead of checking the name of the
6247 method to determine if its a destructor, create a new derived
6248 class from Method called Destructor, and test for that.
6250 * cs-parser.jay: Create a Destructor object instead of a Method.
6252 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
6256 2004-01-16 Miguel de Icaza <miguel@ximian.com>
6258 * expression.cs (Binary.ResolveOperator): Perform an implicit
6259 conversion from MethodGroups to their delegate types on the
6262 * delegate.cs: Introduce a new class DelegateCreation that is the
6263 base class for `NewDelegate' and `ImplicitDelegateCreation',
6264 factor some code in here.
6266 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
6267 conversion from MethodGroups to compatible delegate types.
6269 * ecore.cs (Expression.Resolve): Do not flag error 654
6270 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
6271 we allow conversions from MethodGroups to delegate types now.
6273 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
6274 assignments in v2 either.
6276 2004-01-10 Miguel de Icaza <miguel@ximian.com>
6278 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
6279 static read-only fields in ctors.
6281 Applied patch from Benjamin Jemlich
6283 * expression.cs (UnaryMutator): Avoid leaking local variables.
6285 2004-01-09 Miguel de Icaza <miguel@ximian.com>
6287 * cs-tokenizer.cs (IsCastToken): Allow the various native types
6288 here to return true, as they can be used like this:
6292 Fixed 49836 and all the other dups
6294 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
6296 * driver.cs: Implement /win32res and /win32icon.
6298 2004-01-08 Miguel de Icaza <miguel@ximian.com>
6300 * cs-parser.jay: Add a rule to improve error handling for the
6301 common mistake of placing modifiers after the type.
6303 2004-01-07 Miguel de Icaza <miguel@ximian.com>
6305 * cs-parser.jay (interface_event_declaration): Catch
6306 initialization of events on interfaces, and report cs0068
6308 * cs-parser.jay (interface_event_declaration): Catch
6309 initialization of events.
6311 * ecore.cs: Better report missing constructors.
6313 * expression.cs (Binary.ResolveOperator): My previous bug fix had
6314 the error reporting done in the wrong place. Fix.
6316 * expression.cs (Binary.ResolveOperator): Catch the
6317 operator + (E x, E y) error earlier, and later allow for implicit
6318 conversions in operator +/- (E e, U x) from U to the underlying
6321 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
6322 52596, if the container class is abstract, the default constructor
6323 is protected otherwise its public (before, we were always public).
6325 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
6328 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
6329 Jemlich that fixes bug #52597, MCS was generating invalid code for
6330 idisposable structs. Thanks to Ben for following up with this
6333 2004-01-06 Miguel de Icaza <miguel@ximian.com>
6335 * driver.cs: Allow assemblies without code to be generated, fixes
6338 2004-01-07 Nick Drochak <ndrochak@gol.com>
6340 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
6342 2004-01-05 Miguel de Icaza <miguel@ximian.com>
6344 * cs-parser.jay: Add rules to improve error reporting if fields or
6345 methods are declared at the namespace level (error 116)
6347 * Add rules to catch event add/remove
6349 2004-01-04 David Sheldon <dave-mono@earth.li>
6351 * expression.cs: Added matching ")" to error message for
6354 2004-01-03 Todd Berman <tberman@gentoo.org>
6356 * ecore.cs, attribute.cs:
6357 Applying fix from #52429.
6359 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6361 * ecore.cs, expression.cs, statement.cs:
6362 Total rewrite of how we handle branching. We
6363 now handle complex boolean expressions with fewer
6364 jumps. As well if (x == 0) no longer emits a ceq.
6366 if (x is Foo) is much faster now, because we generate
6369 Overall, we get a pretty big improvement on our benchmark
6370 tests. The code we generate is smaller and more readable.
6372 I did a full two-stage bootstrap. The patch was reviewed
6373 by Martin and Miguel.
6375 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6377 * cs-parser.jay: Make primary_expression not take a QI.
6378 we dont need this because the member_access rule covers
6379 us here. So we replace the rule with just IDENTIFIER.
6381 This has two good effects. First, we remove a s/r conflict.
6382 Second, we allocate many fewer QualifiedIdentifier objects.
6384 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6386 * attribute.cs: Handle MarshalAs attributes as pseudo, and
6387 set the correct information via SRE. This prevents
6388 hanging on the MS runtime. Fixes #29374.
6390 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6392 * convert.cs: correctly handle conversions to value types
6393 from Enum and ValueType as unboxing conversions.
6395 Fixes bug #52569. Patch by Benjamin Jemlich.
6397 2004-01-02 Ravi Pratap <ravi@ximian.com>
6399 * expression.cs (BetterConversion): Prefer int -> uint
6400 over int -> ulong (csc's behaviour). This fixed bug #52046.
6402 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
6404 * decl.cs (MemberCache.FindMembers): now returns a
6407 * typemanager.cs: In general, go with with ^^.
6408 (CopyNewMethods): take an IList.
6409 (RealMemberLookup): Only allocate an arraylist
6410 if we copy from two sets of methods.
6412 This change basically does two things:
6413 1) Fewer array lists allocated due to CopyNewMethods.
6414 2) the explicit cast in MemberList costed ALOT.
6416 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
6418 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
6419 a hashtable to avoid needless string allocations when an identifier is
6420 used more than once (the common case).
6422 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6424 * pending.cs: MS's TypeBuilder.GetInterfaces ()
6425 is broken, it will not return anything. So, we
6426 have to use the information we have in mcs to
6429 * typemanager.cs: Add a cache for GetInterfaces,
6430 since this will now be used more often (due to ^^)
6432 (GetExplicitInterfaces) New method that gets the
6433 declared, not effective, interfaces on a type
6434 builder (eg, if you have interface IFoo, interface
6435 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
6438 This patch makes MCS able to bootstrap itself on
6441 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6443 * expression.cs: Remove the Nop's that Miguel put
6446 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6448 * report.cs, codegen.cs: Give the real stack trace to
6449 the error when an exception is thrown.
6451 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6453 * decl.cs: only allocate hashtables for ifaces if
6456 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6458 * expression.cs: fix the error from cs0121-2.cs
6459 (a parent interface has two child interfaces that
6460 have a function with the same name and 0 params
6461 and the function is called through the parent).
6463 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
6465 * class.cs, rootcontext.cs, typmanager.cs: do not
6468 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
6470 * codegen.cs: remove stack for the ec flow branching.
6471 It is already a linked list, so no need.
6473 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
6475 * Makefile: Allow custom profiler here.
6477 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6479 * typemanager.cs (LookupType):
6480 - Use a static char [], because split takes
6481 a param array for args, so it was allocating
6483 - Do not store true in a hashtable, it boxes.
6485 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6487 * flowanalysis.cs: bytify common enums.
6489 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6491 * modifiers.cs: Add a new set of flags for the
6492 flags allowed on explicit interface impls.
6493 * cs-parser.jay: catch the use of modifiers in
6494 interfaces correctly.
6495 * class.cs: catch private void IFoo.Blah ().
6497 All related to bug #50572.
6499 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6501 * decl.cs: Rewrite the consistant accessability checking.
6502 Accessability is not linear, it must be implemented in
6503 a tableish way. Fixes #49704.
6505 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6507 * expression.cs: Handle negation in a checked context.
6508 We must use subtraction from zero. Fixes #38674.
6510 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
6512 * class.cs: Ignore static void main in DLLs.
6513 * rootcontext.cs: Handle the target type here,
6514 since we are have to access it from class.cs
6515 * driver.cs: account for the above.
6517 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
6519 * report.cs: Give line numbers and files if available.
6521 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
6523 * driver.cs: Implement /addmodule.
6525 * typemanager.cs: Change 'modules' field so it now contains Modules not
6528 2003-12-20 Martin Baulig <martin@ximian.com>
6530 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
6531 (FieldBase.IsAssigned): Removed this field.
6532 (FieldBase.SetAssigned): New public method.
6533 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
6535 2003-12-20 Martin Baulig <martin@ximian.com>
6537 * expression.cs (LocalVariableReference.DoResolve): Don't set
6538 `vi.Used' if we're called from DoResolveLValue().
6540 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
6541 returns the usage vector it just merged into the current one -
6542 pass this one to UsageWarning().
6543 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
6544 of the `EmitContext', don't call this recursively on our children.
6546 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
6548 * driver.cs: Implement /target:module.
6550 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
6552 * support.cs (CharArrayHashtable): New helper class.
6554 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
6555 char arrays, not strings, so we can avoid creating a string in
6556 consume_identifier if the identifier is a keyword.
6558 2003-12-16 Martin Baulig <martin@ximian.com>
6560 * statement.cs (LocalInfo.Assigned): Removed this property.
6561 (LocalInfo.Flags): Removed `Assigned'.
6562 (LocalInfo.IsAssigned): New public method; takes the EmitContext
6563 and uses flow analysis.
6564 (Block.UsageWarning): Made this method private.
6565 (Block.Resolve): Call UsageWarning() if appropriate.
6567 * expression.cs (LocalVariableReference.DoResolve): Always set
6568 LocalInfo.Used here.
6570 2003-12-13 Martin Baulig <martin@ximian.com>
6572 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
6573 any value here; we're now using flow analysis to figure out
6574 whether a statement/block returns a value.
6576 2003-12-13 Martin Baulig <martin@ximian.com>
6578 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
6580 (FlowBranching.MergeFinally): Don't call
6581 `branching.CheckOutParameters()' here, this is called in
6583 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
6584 when adding the `finally' vector.
6586 2003-12-13 Martin Baulig <martin@ximian.com>
6589 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
6590 actually work and also fix #48962.
6592 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
6594 * decl.cs: Do not check System.Object for nested types,
6595 since we know it does not have any. Big bang for buck:
6600 corlib: 17.99 seconds
6604 corlib: 17.39 seconds
6606 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
6608 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
6609 time we are returning 0 members, so we save alot here.
6611 2003-12-11 Martin Baulig <martin@ximian.com>
6613 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
6614 `MergeChild()', also just take the `FlowBranching' as argument;
6615 call Merge() on it and return the result.
6616 (FlowBranching.Merge): We don't need to do anything if we just
6619 2003-12-11 Martin Baulig <martin@ximian.com>
6621 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
6622 them in an `ArrayList' to reduce memory usage. Thanks to Ben
6623 Maurer for this idea.
6625 2003-12-11 Martin Baulig <martin@ximian.com>
6627 * flowanalysis.cs (MergeResult): This class is now gone; we now
6628 use the `UsageVector' for this. The reason for this is that if a
6629 branching just has one sibling, we don't need to "merge" them at
6630 all - that's the next step to do.
6631 (FlowBranching.Merge): We now return a `UsageVector' instead of a
6634 2003-12-11 Martin Baulig <martin@ximian.com>
6636 Reworked flow analyis and made it more precise and bug-free. The
6637 most important change is that we're now using a special `Reachability'
6638 class instead of having "magic" meanings of `FlowReturns'. I'll
6639 do some more cleanups and optimizations and also add some more
6640 documentation this week.
6642 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
6643 largely reworked this class.
6644 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
6645 the new `Reachability' class instead of having "magic" values here.
6646 (FlowBranching): We're now using an instance of `Reachability'
6647 instead of having separate `Returns', `Breaks' etc. fields.
6649 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
6650 based on flow analysis; ignore the return value of block.Emit ().
6652 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
6654 * driver.cs typemanager.cs: Find the mono extensions to corlib even
6655 if they are private.
6657 2003-12-09 Martin Baulig <martin@ximian.com>
6659 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
6660 call them directly on the UsageVector.
6662 2003-12-09 Martin Baulig <martin@ximian.com>
6664 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
6665 Changed return type from `FlowReturns' to `Reachability'.
6667 2003-12-09 Martin Baulig <martin@ximian.com>
6669 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
6670 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
6671 `Reachable' fields with a single `Reachability' one.
6673 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6675 * class.cs (FindMembers): Remove foreach's.
6688 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6693 This patch does a few things:
6694 1. EmptyStatement is now a singleton, so it is never reallocated.
6695 2. All blah is EmptyStatement constructs have been changed to
6696 blah == EmptyStatement.Value, which is much faster and valid
6697 now that EmptyStatement is a singleton.
6698 3. When resolving a block, rather than allocating a new array for
6699 the non-empty statements, empty statements are replaced with
6700 EmptyStatement.Value
6701 4. Some recursive functions have been made non-recursive.
6702 Mainly the performance impact is from (3), however (1) and (2) are needed for
6703 this to work. (4) does not make a big difference in normal situations, however
6704 it makes the profile look saner.
6709 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6710 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6711 Total memory allocated: 56397 KB
6714 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
6715 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
6716 Total memory allocated: 55666 KB
6718 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6720 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
6721 than the hashtable in a hashtable version
6723 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
6724 we always end up concating a string. This results in a huge perf
6725 loss, because many strings have to be tracked by the GC. In this
6726 patch, we first use a hashtable that works with two keys, so that
6727 the strings do not need to be concat'ed.
6738 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6740 * Makefile: Add a new target `do-time' that does a quick and simple
6741 profile, leaving easy to parse output.
6743 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
6745 * codegen.cs (Init): Create the dynamic assembly with
6746 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
6748 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
6750 * support.cs: Make the PtrHashtable use only one
6751 instance of its comparer.
6753 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
6755 * typemanager.cs: Fix lookup of GetNamespaces.
6757 2003-11-29 Miguel de Icaza <miguel@ximian.com>
6759 * expression.cs: Removed redundant line.
6761 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
6762 ArrayLists, use for loops with bounds.
6764 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
6767 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
6768 arraylists, use for loop with bounds.
6770 The above three changes give us a 0.071 second performance
6771 improvement out of 3.294 seconds down to 3.223. On my machine
6772 the above changes reduced the memory usage by 1,387 KB during
6775 * cs-parser.jay (QualifiedIdentifier): New class used to represent
6776 QualifiedIdentifiers. Before we created a new string through
6777 concatenation, and mostly later on, the result would be
6778 manipulated by DecomposeQI through string manipulation.
6780 This reduced the compiler memory usage for bootstrapping from
6781 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
6782 compile times in 0.05 seconds.
6784 2003-11-28 Dick Porter <dick@ximian.com>
6786 * support.cs: Do string compares with the Invariant culture.
6794 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
6795 the comparison is done with the Invariant culture.
6797 2003-11-27 Miguel de Icaza <miguel@ximian.com>
6799 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
6800 GetEnumerator method.
6802 (ProbeCollectionType): Iterate starting at the most specific type
6803 upwards looking for a GetEnumerator
6805 * expression.cs: Shift count can be up to 31 for int/uint and 63
6808 2003-11-26 Miguel de Icaza <miguel@ximian.com>
6810 * statement.cs (Block.LookupLabel): Also look for the label on the
6811 children blocks. Use a hash table to keep track of visited
6814 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
6815 we actually did transform the other operand, otherwise fall back
6816 to the common codepath that casts to long.
6818 * cs-tokenizer.cs: Use the same code pattern as the int case.
6819 Maybe I should do the parsing myself, and avoid depending on the
6820 Parse routines to get this done.
6822 2003-11-25 Miguel de Icaza <miguel@ximian.com>
6824 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
6825 which fixes bug 51347. This time test it.
6827 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
6828 attributes for example can not tell the difference between these.
6829 The difference was only a syntax feature of the language.
6831 * attribute.cs: Apply attributes to delegates.
6833 * delegate.cs: Call the apply attributes method.
6835 2003-11-24 Miguel de Icaza <miguel@ximian.com>
6837 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
6838 comparing 0 vs Byte.MinValue, not the value
6840 (ImplicitConversionRequired): When reporting a conversion error,
6841 use error 31 to print out the constant error instead of the
6844 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
6845 which fixes bug 51347.
6847 2003-11-22 Miguel de Icaza <miguel@ximian.com>
6849 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
6850 which fixes the -warnaserror command line option.
6852 2003-11-21 Miguel de Icaza <miguel@ximian.com>
6854 * cfold.cs (DoNumericPromotions): During constant folding of
6855 additions on UIntConstant, special case intconstants with
6856 IntConstants like we do on the expression binary operator.
6858 2003-11-12 Miguel de Icaza <miguel@ximian.com>
6860 * convert.cs (ImplicitReferenceConversion): We were missing a case
6861 (System.Enum are not value types or class types, so we need to
6862 classify them separatedly).
6864 * driver.cs: We do not support error 2007.
6866 2003-11-12 Jackson Harper <jackson@ximian.com>
6868 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
6869 system directory. Also use the full file name so users can
6870 libraries names mscorlib-o-tron.dll in a non system dir.
6872 2003-11-10 Martin Baulig <martin@ximian.com>
6874 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
6875 (TypeManager.InitCoreTypes): Initialize them here, but instead of
6876 calling `ResolveType()' on them, directly assign their `Type'.
6878 2003-11-08 Martin Baulig <martin@ximian.com>
6880 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
6881 return value and the `out parent' parameter.
6882 (TypeContainer.DefineType): Moved the CS0644 check into
6883 GetClassBases(). Don't pass the interface types to the
6884 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
6885 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
6887 * ecore.cs (TypeExpr.IsAttribute): New property.
6888 (TypeExpr.GetInterfaces): New method.
6890 * interface.cs (Interface.GetInterfaceTypeByName): Return a
6891 TypeExpr instead of a Type.
6892 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
6893 (Interface.DefineType): Don't pass the interface types to the
6894 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
6895 them later and then call `TypeBulider.AddInterfaceImplementation()'.
6897 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
6898 instead of a `Type[]'.
6899 (TypeManager.RegisterBuilder): Likewise.
6900 (TypeManager.AddUserInterface): Likewise.
6901 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
6902 `Type[]' and also return a `TypeExpr[]'.
6903 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
6905 2003-11-08 Martin Baulig <martin@ximian.com>
6907 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
6910 2003-11-08 Martin Baulig <martin@ximian.com>
6912 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
6913 TypeManager.ResolveExpressionTypes().
6915 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
6916 instead of an Expression.
6917 (TypeExpr): This is now an abstract base class for `TypeExpression'.
6918 (TypeExpression): New public class; formerly known as `TypeExpr'.
6920 * expression.cs (ComposedCast): Derive from TypeExpr.
6922 * typemanager.cs (TypeManager.system_*_expr): These are now
6923 TypExpr's instead of Expression's.
6924 (TypeManager.ResolveExpressionTypes): New public static function;
6925 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
6928 2003-11-06 Miguel de Icaza <miguel@ximian.com>
6930 * expression.cs (New.DoResolve): Do not dereference value that
6931 might be a null return.
6933 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
6934 sure that the constant value has the right type. Fixes an
6935 unreported bug, similar to 50425.
6937 * const.cs (Const.LookupConstantValue): Call
6938 ImplicitStandardConversionExists before doing a conversion to
6939 avoid havng the TypeManager.ChangeType do conversions.
6941 Reduced the number of casts used
6943 (Const.ChangeType): New routine to enable reuse of the constant
6944 type changing code from statement.
6946 * typemanager.cs (ChangeType): Move common initialization to
6947 static global variables.
6951 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
6952 every value type to go through, even if it was void. Fix that.
6954 * cs-tokenizer.cs: Use is_identifier_start_character on the start
6955 character of the define, and the is_identifier_part_character for
6956 the rest of the string.
6958 2003-11-05 Miguel de Icaza <miguel@ximian.com>
6960 * expression.cs (UnaryMutator.EmitCode): When I updated
6961 LocalVariableReference.DoResolve, I overdid it, and dropped an
6962 optimization done on local variable references.
6964 2003-11-04 Miguel de Icaza <miguel@ximian.com>
6966 * ecore.cs: Convert the return from Ldlen into an int.
6968 2003-10-20 Miguel de Icaza <miguel@ximian.com>
6970 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
6971 the accessibility, this is a special case for toplevel non-public
6972 classes (internal for instance).
6974 2003-10-20 Nick Drochak <ndrochak@gol.com>
6976 * ecore.cs: Fix typo and build. Needed another right paren.
6978 2003-10-19 Miguel de Icaza <miguel@ximian.com>
6980 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
6981 `internal' case regular and protected, but not allowing protected
6982 to be evaluated later. Bug 49840
6984 2003-10-15 Miguel de Icaza <miguel@ximian.com>
6986 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
6987 to kb.Nlast, and not the kb.nFirst to isolate the switch
6990 Extract the underlying type, so enumerations of long/ulong are
6991 treated like long/ulong.
6993 2003-10-14 Miguel de Icaza <miguel@ximian.com>
6995 * expression.cs (New): Overload the meaning of RequestedType to
6996 track the possible creation of the NewDelegate type, since
6997 DoResolve is invoked more than once for new constructors on field
7000 See bugs: #48800 and #37014
7002 * cs-parser.jay (declare_local_constants): Take an arraylist
7003 instead of a single constant.
7005 (local_constant_declaration): It should take a
7006 constant_declarators, not a constant_declarator. Fixes 49487
7008 * convert.cs: Fix error report.
7010 2003-10-13 Jackson Harper <jackson@ximian.com>
7012 * typemanager.cs (TypeToCoreType): Add float and double this fixes
7015 2003-10-09 Martin Baulig <martin@ximian.com>
7017 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
7019 (MethodCore.DoDefineParameters): Removed the TypeContainer
7020 argument; use the DeclSpace which was passed to the .ctor instead.
7021 (MethodCore.CheckParameter): Take a DeclSpace instead of a
7022 TypeContainer; we only need a DeclSpace here.
7024 2003-10-09 Martin Baulig <martin@ximian.com>
7026 * class.cs (MethodData): Added additional `DeclSpace ds' argument
7028 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
7029 EmitContext's .ctor.
7031 2003-10-09 Martin Baulig <martin@ximian.com>
7033 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
7034 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
7035 AsAccessible(), moved them as well.
7037 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
7039 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
7041 * cs-parser.jay : Renamed yyName to yyNames related to jay.
7043 2003-10-07 Miguel de Icaza <miguel@ximian.com>
7045 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
7046 generation for >=, as spotted by Paolo, bug 48679.
7047 Patch from David Waite.
7049 * cs-tokenizer.cs: Add handling for #pragma.
7051 * cs-parser.jay: Allow for both yield and yield return in the
7052 syntax. The anti-cobolization of C# fight will go on!
7054 * class.cs (TypeBuilder.DefineType): Catch error condition here
7055 (Parent.DefineType erroring out and returning null).
7057 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
7058 coping with enumerations variables, we were mistakenly processing
7059 them as a regular value type instead of built-in types. Fixes the
7062 * typemanager.cs (IsBuiltinOrEnum): New method.
7064 2003-09-30 Miguel de Icaza <miguel@ximian.com>
7066 * cs-parser.jay: Upgrade: yield now needs the return clause.
7068 2003-09-19 Martin Baulig <martin@ximian.com>
7070 * decl.cs (MemberCache.SetupCacheForInterface): Take a
7071 `MemberCache parent' argument. Normally, an interface doesn't
7072 have a parent type except System.Object, but we use this in gmcs
7073 for generic type parameters.
7075 2003-09-18 Martin Baulig <martin@ximian.com>
7077 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
7078 on `type.IsInterface'; don't check whether the type has a parent
7079 to determine whether it's an interface.
7081 2003-09-15 Martin Baulig <martin@ximian.com>
7083 * class.cs (TypeContainer.DefineType): Added an error flag to
7084 avoid reporting duplicate CS0146's ("class definition is
7087 * driver.cs (Driver.MainDriver): Abort if
7088 RootContext.ResolveTree() reported any errors.
7090 2003-09-07 Martin Baulig <martin@ximian.com>
7092 * report.cs (Error, Warning): Added overloaded versions which take
7093 a `params object[] args' and call String.Format().
7095 2003-09-07 Martin Baulig <martin@ximian.com>
7097 * decl.cs (DeclSpace..ctor): Don't call
7098 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
7099 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
7100 (DeclSpace.RecordDecl): New method.
7102 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
7104 2003-09-02 Ravi Pratap <ravi@ximian.com>
7106 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
7107 value attributes to be applied to ParameterBuilders.
7109 * class.cs (MethodCore.LabelParameters): Make static and more
7110 generic so that it can be used from other places - like interface
7111 methods, for instance.
7113 * interface.cs (Interface.Emit): Call LabelParameters before
7114 emitting attributes on the InterfaceMethod.
7116 2003-08-26 Martin Baulig <martin@ximian.com>
7118 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
7119 resolving aliases; fixes #47927.
7121 2003-08-26 Martin Baulig <martin@ximian.com>
7123 * statement.cs (Using.DoResolve): This is internally emitting a
7124 try/finally clause, so we need to set ec.NeedExplicitReturn if we
7125 do not always return. Fixes #47681.
7127 2003-08-26 Martin Baulig <martin@ximian.com>
7129 * decl.cs (MemberCore): Moved WarningNotHiding(),
7130 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
7132 (AdditionResult): Make this nested in DeclSpace.
7133 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
7134 argument; call NamespaceEntry.Define() unless we're nested in a
7137 * namespace.cs (Namespace.DefineName): New public function. This
7138 is called from DeclSpace's .ctor to add
7139 (Namespace.Lookup): Include DeclSpaces in the lookup.
7141 * class.cs (Operator): Derive from MemberBase, not MemberCore.
7143 * const.cs (Const): Derive from MemberBase, not MemberCore.
7145 2003-08-25 Martin Baulig <martin@ximian.com>
7147 * convert.cs (Convert.ExplicitReferenceConversion): When
7148 converting from an interface type to a class, unbox if the target
7149 type is a struct type. Fixes #47822.
7151 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7153 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
7156 2003-08-22 Martin Baulig <martin@ximian.com>
7158 * class.cs (TypeManager.DefineType): When defining a nested type,
7159 call DefineType() on our parent; fixes #47801.
7161 2003-08-22 Martin Baulig <martin@ximian.com>
7163 * class.cs (MethodData.Define): While checking if a method is an
7164 interface implementation, improve the test a bit more to fix #47654.
7166 2003-08-22 Martin Baulig <martin@ximian.com>
7168 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
7169 correctly; fixes #47722.
7171 2003-08-22 Martin Baulig <martin@ximian.com>
7173 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
7174 LocalVariableReference, ensure it's not read-only. Fixes #47536.
7176 * statement.cs (Fixed.DoResolve): Make all variables read-only.
7178 2003-08-22 Martin Baulig <martin@ximian.com>
7180 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
7181 can only be assigned in static constructors. Fixes #47161.
7183 2003-08-22 Martin Baulig <martin@ximian.com>
7185 Rewrote and improved the flow analysis code.
7187 * flowbranching.cs (FlowBranching): Make this class abstract.
7188 (FlowBranching.CreateBranching): New static function to create a
7190 (FlowBranchingBlock, FlowBranchingException): New classes.
7191 (FlowBranching.UsageVector.Type): New public readonly field.
7192 (FlowBranching.UsageVector.Breaks): Removed the setter.
7193 (FlowBranching.UsageVector.Returns): Removed the setter.
7194 (FlowBranching.UsageVector): Added Break(), Return(),
7195 NeverReachable() and Throw() methods to modify the reachability.
7196 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
7197 done by FlowBranching.Merge().
7198 (FlowBranching.UsageVector.MergeChild): New method; merges the
7199 merge result into the current vector.
7200 (FlowBranching.Merge): New abstract method to merge a branching.
7202 2003-08-12 Martin Baulig <martin@ximian.com>
7204 * expression.cs (Indirection.CacheTemporaries): Create the
7205 LocalTemporary with the pointer type, not its element type.
7207 2003-08-10 Miguel de Icaza <miguel@ximian.com>
7209 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
7210 token was a keyword or not.
7212 Add `error' options where an IDENTIFIER was expected; Provide
7213 CheckToken and CheckIdentifierToken convenience error reporting
7216 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
7218 * decl.cs: Rename `NamespaceEntry Namespace' public field into
7219 NameSpaceEntry NameSpaceEntry.
7221 (LookupInterfaceOrClass): Avoid creating a full qualified name
7222 from namespace and name: avoid doing lookups when we know the
7223 namespace is non-existant. Use new Tree.LookupByNamespace which
7224 looks up DeclSpaces based on their namespace, name pair.
7226 * driver.cs: Provide a new `parser verbose' to display the
7227 exception thrown during parsing. This is turned off by default
7228 now, so the output of a failure from mcs is more graceful.
7230 * namespace.cs: Track all the namespaces defined in a hashtable
7233 (IsNamespace): New method
7235 2003-08-09 Miguel de Icaza <miguel@ximian.com>
7237 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
7238 we know that we need to concatenate (full typename can never be
7243 * statement.cs: Use a bitfield; Do not initialize to null things
7244 which are done by the constructor by default.
7246 * cs-parser.jay: bug fix, parameter was 4, not 3.
7248 * expression.cs: Just use the property;
7250 * statement.cs: No need for GetVariableInfo method.
7252 2003-08-08 Martin Baulig <martin@ximian.com>
7254 * flowanalysis.cs (FlowReturns): This is now nested in the
7255 `FlowBranching' class.
7256 (MyBitVector): Moved this here from statement.cs.
7257 (FlowBranching.SiblingType): New enum type.
7258 (FlowBranching.CreateSibling): Added `SiblingType' argument.
7260 2003-08-07 Martin Baulig <martin@ximian.com>
7262 * flowanalysis.cs (FlowBranchingType): This is now nested in the
7263 `FlowBranching' class and called `BranchingType'.
7265 2003-08-07 Martin Baulig <martin@ximian.com>
7267 * flowanalysis.cs: Moved all the control flow analysis code into
7270 2003-08-07 Martin Baulig <martin@ximian.com>
7272 * assign.cs (Assign.DoResolve): `target' must either be an
7273 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
7276 2003-08-07 Miguel de Icaza <miguel@ximian.com>
7278 * expression.cs (BinaryMethod): This kind of expression is created by the
7279 Binary class if it determines that the operator has to be handled
7282 (BinaryDelegate): This kind of expression is created if we are
7283 dealing with a + or - operator on delegates.
7285 (Binary): remove method, argumetns, and DelegateOperator: when
7286 dealing with methods,
7288 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
7290 * statement.cs (Block): use bitfields for the three extra booleans
7291 we had in use. Remove unused topblock parameter.
7293 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
7295 * assign.cs: Drop extra unneeded tests.
7297 2003-08-06 Miguel de Icaza <miguel@ximian.com>
7299 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
7301 * statement.cs (Foreach): Use VariableStorage instead of
7304 * codegen.cs (VariableStorage): New class used by clients that
7305 require a variable stored: locals or fields for variables that
7306 need to live across yield.
7308 Maybe provide a convenience api for EmitThis+EmitLoad?
7310 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
7313 2003-08-05 Miguel de Icaza <miguel@ximian.com>
7315 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
7316 RemapParameterLValue): New methods that are used to turn a
7317 precomputed FieldInfo into an expression like this:
7321 The idea is to use this instead of making LocalVariableReference
7322 have more than one meaning.
7324 * cs-parser.jay: Add error production to BASE.
7326 * ecore.cs: Deal with TypeManager.GetField returning null, which
7327 is now a valid return value.
7329 (FieldExprNoAddress): New expression for Fields whose address can
7332 * expression.cs (LocalVariableReference): During the resolve
7333 phases, create new expressions if we are in a remapping context.
7334 Remove code that dealt with remapping here.
7336 (ParameterReference): same.
7338 (ProxyInstance): New expression, like the `This' expression, but
7339 it is born fully resolved. We know what we are doing, so remove
7340 the errors that are targeted to user-provided uses of `this'.
7342 * statement.cs (Foreach): our variable is now stored as an
7343 Expression; During resolution, follow the protocol, dont just
7344 assume it will return this.
7346 2003-08-06 Martin Baulig <martin@ximian.com>
7348 * support.cs (SeekableStreamReader.cs): New public class.
7350 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
7351 SeekableStreamReader instead of the normal StreamReader.
7353 2003-08-04 Martin Baulig <martin@ximian.com>
7355 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
7356 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
7357 deambiguate casts and delegate invocations.
7358 (parenthesized_expression): Use the new tokens to ensure this is
7359 not a cast of method invocation.
7361 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
7362 when reading a `)' and Deambiguate_CloseParens () was previously
7365 * expression.cs (ParenthesizedExpression): New class. This is
7366 just used for the CS0075 test.
7367 (Binary.DoResolve): Check for CS0075.
7369 2003-07-29 Ravi Pratap <ravi@ximian.com>
7371 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
7372 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
7373 reference comparison.
7375 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
7376 examine the ReturnType for equality - this is necessary in the
7377 cases of implicit and explicit operators whose signature also
7378 includes the return type.
7380 2003-07-26 Miguel de Icaza <miguel@ximian.com>
7382 * namespace.cs: Cache the result of the namespace computation,
7383 instead of computing it every time.
7385 2003-07-24 Miguel de Icaza <miguel@ximian.com>
7387 * decl.cs: Use a global arraylist that we reuse over invocations
7388 to avoid excesive memory consumption. Reduces memory usage on an
7389 mcs compile by one meg (45 average).
7391 * typemanager.cs (LookupTypeReflection): In .NET pointers are
7392 private, work around that.
7394 2003-07-23 Miguel de Icaza <miguel@ximian.com>
7396 * literal.cs (IntLiteral): Define Zero and One static literals.
7398 * cs-parser.jay (integer_literal): use static literals to reduce
7399 memory usage for the most used literals (0, 1 and -1). 211kb
7400 reduced in memory usage.
7402 Replace all calls to `new ArrayList' with `new
7403 ArrayList(4)' which is a good average number for most allocations,
7404 and also requires only 16 bytes of memory for its buffer by
7407 This reduced MCS memory usage in seven megabytes for the RSS after
7410 2003-07-28 Ravi Pratap <ravi@ximian.com>
7412 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
7413 handle params methods the correct way by forming only one
7414 applicable set with params and normal methods in them. Earlier we
7415 were looking at params methods only if we found no normal methods
7416 which was not the correct thing to do.
7418 (Invocation.BetterFunction): Take separate arguments indicating
7419 when candidate and the best method are params methods in their
7422 This fixes bugs #43367 and #46199.
7424 * attribute.cs: Documentation updates.
7426 (CheckAttribute): Rename to CheckAttributeTarget.
7427 (GetValidPlaces): Rename to GetValidTargets.
7429 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
7430 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
7434 2003-07-28 Martin Baulig <martin@ximian.com>
7436 * class.cs (TypeContainer.DefineMembers): Use the base type's full
7437 name when looking up the base class of a nested class. Fixes #46977.
7439 2003-07-26 Martin Baulig <martin@ximian.com>
7441 * expression.cs (Indexers.Indexer): New nested struct; contains
7442 getter, setter and the indexer's type.
7443 (Indexers.Properties): This is now an ArrayList of
7445 (IndexerAccess.DoResolveLValue): Correctly set the type if the
7446 indexer doesn't have any getters.
7448 * assign.cs (Assign.DoResolve): Also do the implicit conversions
7449 for embedded property and indexer assignments.
7451 2003-07-26 Martin Baulig <martin@ximian.com>
7453 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
7454 preprocessor directive is not the first non-whitespace character
7457 2003-07-26 Martin Baulig <martin@ximian.com>
7459 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
7460 namespace parsing, follow the spec more closely.
7462 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
7463 NamespaceEntry.Lookup().
7465 2003-07-25 Martin Baulig <martin@ximian.com>
7467 * MethodCore.cs (OverridesSomething): New public field; it's set
7468 from TypeContainer.DefineMembers if this method overrides
7469 something (which doesn't need to be a method). Fix #39462.
7471 2003-07-25 Ravi Pratap <ravi@ximian.com>
7473 * typemanager.cs (GetMembers): Ensure that the list of members is
7474 reversed. This keeps things in sync.
7476 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
7477 find an AttributeUsage attribute.
7479 * expression.cs (Invocation.OverloadResolve): Perform the check
7480 which disallows Invoke to be directly called on a Delegate.
7482 (Error_InvokeOnDelegate): Report error cs1533.
7484 2003-07-25 Martin Baulig <martin@ximian.com>
7486 * expression.cs (Indexers.GetIndexersForType): Only look in the
7487 interface hierarchy if the requested type is already an
7488 interface. Fixes #46788 while keeping #46502 fixed.
7490 2003-07-25 Martin Baulig <martin@ximian.com>
7492 * class.cs (TypeContainer.DefineMembers): Check whether all
7493 readonly fields have been assigned and report warning CS0649 if
7496 * statement.cs (LocalInfo.IsFixed): Always return true if this is
7499 2003-07-24 Ravi Pratap <ravi@ximian.com>
7501 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
7502 returned from GetMethods to make things consistent with the
7503 assumptions MCS makes about ordering of methods.
7505 This should comprehensively fix bug #45127 and it does :-)
7507 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
7508 ordering is actually reverse.
7510 * Clean up some debug messages I left lying around.
7512 * interface.cs (Populate*): Get rid of code which emits attributes
7513 since the stage in which we emit attributes is the 'Emit' stage,
7514 not the define stage.
7516 (Emit): Move attribute emission for interface members here.
7518 2003-07-22 Ravi Pratap <ravi@ximian.com>
7520 * expression.cs (Invocation.OverloadResolve): Follow the spec more
7521 closely: we eliminate methods in base types when we have an
7522 applicable method in a top-level type.
7524 Please see section 14.5.5.1 for an exact description of what goes
7527 This fixes bug #45127 and a host of other related to corlib compilation.
7529 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
7530 array is the method corresponding to the top-level type (this is
7531 because of the changes made to icall.c) so we change this
7534 (MethodGroupExpr.Name): This too.
7536 * typemanager.cs (GetElementType): New method which does the right
7537 thing when compiling corlib.
7539 * everywhere: Make use of the above in the relevant places.
7541 2003-07-22 Martin Baulig <martin@ximian.com>
7543 * cs-parser.jay (invocation_expression): Moved
7544 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
7545 `cast_expression', but create a InvocationOrCast which later
7546 resolves to either an Invocation or a Cast.
7548 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
7549 method; call this before EmitStatement() to make sure that this
7550 expression can be used as a statement.
7552 * expression.cs (InvocationOrCast): New class; resolves to either
7553 an Invocation or a Cast.
7555 * statement.cs (StatementExpression): Call ResolveStatement() on
7556 the ExpressionStatement before emitting it.
7558 2003-07-21 Martin Baulig <martin@ximian.com>
7560 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
7561 `ref' and `out' attributes match; fixes #46220.
7562 (MemberAccess.ResolveMemberAccess): You can't reference a type
7563 through an expression; fixes #33180.
7564 (Indexers.GetIndexersForType): Don't return the indexers from
7565 interfaces the class implements; fixes #46502.
7567 2003-07-21 Martin Baulig <martin@ximian.com>
7569 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
7570 CS0661 checks; fixes bug #30442.
7572 2003-07-21 Martin Baulig <martin@ximian.com>
7574 * decl.cs (AdditionResult): Added `Error'.
7576 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
7578 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
7579 makes cs0031.cs actually work.
7581 2003-07-20 Martin Baulig <martin@ximian.com>
7583 * namespace.cs: Fixed that bug which caused a crash when compiling
7586 2003-07-20 Miguel de Icaza <miguel@ximian.com>
7588 * typemanager.cs (LookupTypeReflection): Never expose types which
7589 are NotPublic, NestedPrivate, NestedAssembly, or
7590 NestedFamANDAssem. We used to return these, and later do a check
7591 that would report a meaningful error, but the problem is that we
7592 would not get the real match, if there was a name override.
7594 2003-07-18 Miguel de Icaza <miguel@ximian.com>
7596 * namespace.cs (Namespace, Name): Do not compute the namespace
7597 name dynamically, compute it in the constructor. This reduced
7598 memory usage by 1697 KB.
7600 * driver.cs: Use --pause to pause at the end.
7602 2003-07-17 Peter Williams <peter@newton.cx>
7604 * Makefile: Change the name of the test target so that it doesn't
7605 conflict with the recursive test target.
7607 2003-07-17 Miguel de Icaza <miguel@ximian.com>
7609 * expression.cs (LocalVariableReference.Emit, EmitAssign,
7610 AddressOf): Do not use EmitThis, that was wrong, use the actual
7613 2003-07-15 Miguel de Icaza <miguel@ximian.com>
7615 * class.cs (MethodData.Define): While checking if a method is an
7616 interface implementation, improve the test: If we are not public
7617 (use new test here: use the computed MethodAttributes directly,
7618 instead of the parsed modifier flags) check if the `implementing'
7619 method comes from an interface or not.
7621 * pending.cs (VerifyPendingMethods): Slightly better error
7624 * makefile: add test target that does the mcs bootstrap.
7626 2003-07-16 Ravi Pratap <ravi@ximian.com>
7628 * interface.cs (Define): Do nothing here since there are no
7629 members to populate etc. Move the attribute emission out of here
7630 since this was just totally the wrong place to put it. Attribute
7631 application happens during the 'Emit' phase, not in the 'Define'
7634 (Emit): Add this method and move the attribute emission here
7636 * rootcontext.cs (EmitCode): Call the Emit method on interface
7639 2003-07-14 Ravi Pratap M <ravi@ximian.com>
7641 * expression.cs (OverloadResolve): Report error only if Location
7642 is not 'Null' which means that there was a probe going on.
7644 2003-07-14 Martin Baulig <martin@ximian.com>
7646 * expression.cs (ConditionalLogicalOperator): New public class to
7647 implement user defined conditional logical operators.
7648 This is section 14.11.2 in the spec and bug #40505.
7650 2003-07-14 Martin Baulig <martin@ximian.com>
7652 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
7654 2003-07-14 Martin Baulig <martin@ximian.com>
7656 * codegen.cs (EmitContext.InFixedInitializer): New public field.
7658 * ecore.cs (IVariable.VerifyFixed): New interface method.
7660 * expression.cs (Unary.ResolveOperator): When resolving the `&'
7661 operator, check whether the variable is actually fixed. Fixes bug
7662 #36055. Set a variable definitely assigned when taking its
7663 address as required by the spec.
7665 * statement.cs (LocalInfo.IsFixed): New field.
7666 (LocalInfo.MakePinned): Set `IsFixed' to true.
7668 2003-07-14 Ravi Pratap M <ravi@ximian.com>
7670 * attribute.cs (Attribute.Resolve): While doing a Member lookup
7671 for .ctors, ensure that we only ask for members declared in the
7672 attribute type (BindingFlags.DeclaredOnly).
7676 * expression.cs (Error_WrongNumArguments): Report error 1501
7677 correctly the way CSC does.
7679 2003-07-13 Martin Baulig <martin@ximian.com>
7681 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
7682 lookup on the fully qualified name, to make things like "X.X" work
7683 where "X.X" is a fully qualified type name, but we also have a
7684 namespace "X" in the using list. Fixes #41975.
7686 2003-07-13 Martin Baulig <martin@ximian.com>
7688 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
7689 function. If we're a CompoundAssign, we need to create an embedded
7690 CompoundAssign, not an embedded Assign.
7691 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
7694 2003-07-13 Martin Baulig <martin@ximian.com>
7696 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
7697 work to fix bug #46088.
7699 2003-07-13 Ravi Pratap <ravi@ximian.com>
7701 * class.cs (Operator.Emit): Do not emit attributes here - it is
7702 taken care of by the Method class that we delegate too. This takes
7705 2003-07-10 Martin Baulig <martin@ximian.com>
7707 * expression.cs (TypeOfVoid): New class.
7708 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
7710 2003-07-10 Martin Baulig <martin@ximian.com>
7712 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
7715 2003-07-10 Martin Baulig <martin@ximian.com>
7717 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
7718 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
7720 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
7722 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
7724 2003-07-10 Martin Baulig <martin@ximian.com>
7726 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
7727 of decimal. Fixes #42850.
7729 NOTE: I also fixed the created byte blob, but this doesn't work on
7730 the MS runtime and csc never produces any byte blobs for decimal
7733 2003-07-10 Martin Baulig <martin@ximian.com>
7735 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
7736 structs; fixes #32068.
7737 (Block.AddChildVariableNames): Fixed #44302.
7739 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7741 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
7743 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7745 * attribute.cs: And this test is onger needed.
7747 2003-07-08 Martin Baulig <martin@ximian.com>
7749 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
7750 inaccessible types. Fixes #36313.
7752 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
7754 * namespace.cs (NamespaceEntry): Create implicit entries for all
7755 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
7756 implicit entries for N1.N2 and N1.
7758 2003-07-08 Martin Baulig <martin@ximian.com>
7760 Rewrote the handling of namespaces to fix a lot of the issues
7761 wrt. `using' aliases etc.
7763 * namespace.cs (Namespace): Splitted this class into a
7764 per-assembly `Namespace' and a per-file `NamespaceEntry'.
7766 * typemanager.cs (TypeManager.IsNamespace): Removed.
7767 (TypeManager.ComputeNamespaces): Only compute namespaces from
7768 loaded assemblies here, not the namespaces from the assembly we're
7769 currently compiling.
7771 2003-07-08 Martin Baulig <martin@ximian.com>
7773 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
7775 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7777 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
7780 I thought about the memory savings here, but LookupTypeReflection
7781 is used under already very constrained scenarios. Compiling
7782 corlib or mcs only exposes one hit, so it would not really reduce
7783 any memory consumption.
7785 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7787 * typemanager.cs: fixes bug #45889 by only adding public types from
7788 other assemblies to the list of known types.
7790 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7792 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
7793 on the type we resolved.
7795 2003-07-05 Martin Baulig <martin@ximian.com>
7797 * pending.cs (PendingImplementation.ParentImplements): Don't
7798 create the proxy if the parent is abstract.
7800 * class.cs (TypeContainer.DefineIndexers): Process explicit
7801 interface implementations first. Fixes #37714.
7803 2003-07-04 Miguel de Icaza <miguel@ximian.com>
7805 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
7806 defined recursively; but since we modify the input parameters
7807 (left is set to `this' temporarily), we reset this value if the
7808 left_is_explicit is false, which gives the original semantics to
7811 * literal.cs (NullPointer): new class used to represent a null
7812 literal in a pointer context.
7814 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
7815 type is a pointer, use a NullPointer object instead of a
7816 NullLiteral. Closes 43687
7818 (ExplicitConversion): Convert pointer values using
7819 the conv opcode to the proper type.
7821 * ecore.cs (New): change ValueTypeVariable property into a method,
7822 that returns whether the valuetype is suitable for being used.
7824 * expression.cs (Binary.DoNumericPromotions): Only return if we
7825 the int constant was a valid uint, and we can return both left and
7826 right as uints. If not, we continue processing, to trigger the
7827 type conversion. This fixes 39018.
7829 * statement.cs (Block.EmitMeta): During constant resolution, set
7830 the CurrentBlock property on the emitcontext, so that we resolve
7831 constants propertly.
7833 2003-07-02 Martin Baulig <martin@ximian.com>
7835 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
7836 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
7838 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
7839 than emitting it here.
7841 * statement.cs: Fixed some more flow analysis bugs.
7843 2003-07-02 Martin Baulig <martin@ximian.com>
7845 * class.cs (MethodData.Define): When implementing interface
7846 methods, set Final unless we're Virtual.
7848 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
7849 check work for interface methods.
7851 2003-07-01 Martin Baulig <martin@ximian.com>
7853 * ecore.cs (EmitContext.This): Replaced this property with a
7854 GetThis() method which takes a Location argument. This ensures
7855 that we get the correct error location for a CS0188.
7857 2003-07-01 Miguel de Icaza <miguel@ximian.com>
7859 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
7860 ImplicitStandardConversion.
7862 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
7864 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
7866 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
7869 2003-06-30 Miguel de Icaza <miguel@ximian.com>
7871 * class.cs (Constructor.Define): Turn off initlocals for unsafe
7874 (MethodData.Define): Turn off initlocals for unsafe methods.
7876 2003-06-29 Miguel de Icaza <miguel@ximian.com>
7878 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
7879 complete; Fixes #37521.
7881 * delegate.cs: Use Modifiers.TypeAttr to compute the
7882 TypeAttributes, instead of rolling our own. This makes the flags
7883 correct for the delegates.
7885 2003-06-28 Miguel de Icaza <miguel@ximian.com>
7887 * class.cs (Constructor.Define): Set the private flag for static
7888 constructors as well.
7890 * cs-parser.jay (statement_expression): Set the return value to
7891 null, to avoid a crash when we catch an error.
7893 2003-06-24 Miguel de Icaza <miguel@ximian.com>
7895 * cs-parser.jay: Applied patch from Jackson that adds support for
7896 extern and unsafe modifiers to destructor declarations.
7898 * expression.cs: Report error 21 if the user is trying to index a
7901 * driver.cs: Add an error message, suggested by the bug report.
7903 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
7904 if we do not have a ": this ()" constructor initializer. Fixes 45149
7906 2003-06-14 Miguel de Icaza <miguel@ximian.com>
7908 * namespace.cs: Add some information to reduce FAQs.
7910 2003-06-13 Miguel de Icaza <miguel@ximian.com>
7912 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
7913 underlying enumeration types. Fixes #43915.
7915 * expression.cs: Treat ushort/short as legal values to be used in
7918 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
7920 * delegate.cs: transfer custom attributes for paramenters from
7921 the delegate declaration to Invoke and BeginInvoke.
7923 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
7925 * attribute.cs: handle custom marshalers and emit marshal info
7928 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
7930 * makefile.gnu: Added anonymous.cs to the compiler sources.
7932 2003-05-28 Miguel de Icaza <miguel@ximian.com>
7934 * iterators.cs: Change the name of the proxy class to include two
7937 * cs-parser.jay: Update grammar to include anonymous methods.
7939 * anonymous.cs: new file.
7941 2003-05-27 Miguel de Icaza <miguel@ximian.com>
7943 * class.cs (Field.Define): Add missing test for pointers and
7946 2003-05-27 Ravi Pratap <ravi@ximian.com>
7948 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
7949 we use the stobj opcode.
7951 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
7952 since it wasn't the correct fix.
7954 It still is puzzling that we are required to use stobj for IntPtr
7955 which seems to be a ValueType.
7957 2003-05-26 Miguel de Icaza <miguel@ximian.com>
7959 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
7960 during regular simple name resolution. Now, the trick is that
7961 instead of returning for processing the simplename, we do a
7962 TypeManager.LookupType (ie, a rooted lookup as opposed to a
7963 contextual lookup type). If a match is found, return that, if
7964 not, return for further composition.
7966 This fixes long-standing 30485.
7968 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
7969 using the address to initialize an object, do an Stobj instead of
7970 using the regular Stelem.
7972 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
7973 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
7974 Because if we are a BaseIndexerAccess that value will be true.
7977 * statement.cs (GotoCase.Resolve): Return after reporting an
7978 error, do not attempt to continue.
7980 * expression.cs (PointerArithmetic.Emit): If our operand is a
7981 long, convert our constants to match the operand before
7982 multiplying. Convert to I type before adding. Fixes 43670.
7984 2003-05-14 Ravi Pratap <ravi@ximian.com>
7986 * enum.cs (ImplicitConversionExists) : Rename to
7987 ImplicitEnumConversionExists to remove ambiguity.
7989 * ecore.cs (NullCast): New type of cast expression class which
7990 basically is very similar to EmptyCast with the difference being
7991 it still is a constant since it is used only to cast a null to
7995 * convert.cs (ImplicitReferenceConversion): When casting a null
7996 literal, we return a NullCast.
7998 * literal.cs (NullLiteralTyped): Remove - I don't see why this
7999 should be around anymore.
8001 The renaming (reported was slightly wrong). Corrections:
8003 ConvertImplicitStandard -> ImplicitConversionStandard
8004 ConvertExplicitStandard -> ExplicitConversionStandard
8006 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
8007 before passing them in !
8009 * convert.cs (ImplicitConversionStandard): When comparing for
8010 equal expr and target types, ensure that expr is not a
8013 In general, we must not be checking (expr_type ==
8014 target_type) in the top level conversion methods
8015 (ImplicitConversion, ExplicitConversion etc). This checking is
8016 done in the methods that they delegate to.
8018 2003-05-20 Miguel de Icaza <miguel@ximian.com>
8020 * convert.cs: Move Error_CannotConvertType,
8021 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
8022 ImplicitNumericConversion, ImplicitConversionExists,
8023 ImplicitUserConversionExists, StandardConversionExists,
8024 FindMostEncompassedType, FindMostSpecificSource,
8025 FindMostSpecificTarget, ImplicitUserConversion,
8026 ExplicitUserConversion, GetConversionOperators,
8027 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
8028 TryImplicitIntConversion, Error_CannotConvertImplicit,
8029 ConvertImplicitRequired, ConvertNumericExplicit,
8030 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
8031 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
8034 Perform the following renames:
8036 StandardConversionExists -> ImplicitStandardConversionExists
8037 ConvertImplicit -> ImplicitConversion
8038 ConvertImplicitStandard -> ImplicitStandardConversion
8039 TryImplicitIntConversion -> ImplicitIntConversion
8040 ConvertImplicitRequired -> ImplicitConversionRequired
8041 ConvertNumericExplicit -> ExplicitNumericConversion
8042 ConvertReferenceExplicit -> ExplicitReferenceConversion
8043 ConvertExplicit -> ExplicitConversion
8044 ConvertExplicitStandard -> ExplicitStandardConversion
8046 2003-05-19 Martin Baulig <martin@ximian.com>
8048 * statement.cs (TypeInfo.StructInfo): Made this type protected.
8049 (TypeInfo): Added support for structs having structs as fields.
8051 * ecore.cs (FieldExpr): Implement IVariable.
8052 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
8053 VariableInfo for the field.
8055 2003-05-18 Martin Baulig <martin@ximian.com>
8057 * expression.cs (This.DoResolve): Report a CS0027 if we're
8058 emitting a field initializer.
8060 2003-05-18 Martin Baulig <martin@ximian.com>
8062 * expression.cs (This.ResolveBase): New public function.
8063 (This.DoResolve): Check for CS0188.
8065 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
8068 * ecore.cs (MethodGroupExpr.DoResolve): Set the
8069 `instance_expression' to null if we don't have any non-static
8072 2003-05-18 Martin Baulig <martin@ximian.com>
8074 Reworked the way how local variables and parameters are handled by
8075 the flow analysis code.
8077 * statement.cs (TypeInfo, VariableMap): New public classes.
8078 (VariableInfo): New public class. This is now responsible for
8079 checking whether a variable has been assigned. It is used for
8080 parameters and local variables.
8081 (Block.EmitMeta): Take the InternalParameters as argument; compute
8082 the layout of the flow vectors here.
8083 (Block.LocalMap, Block.ParameterMap): New public properties.
8084 (FlowBranching): The .ctor doesn't get the InternalParameters
8085 anymore since Block.EmitMeta() now computes the layout of the flow
8087 (MyStructInfo): This class is now known as `StructInfo' and nested
8088 in `TypeInfo'; we don't access this directly anymore.
8090 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
8091 property and removed IsAssigned(), IsFieldAssigned(),
8092 SetAssigned() and SetFieldAssigned(); we now call them on the
8093 VariableInfo so we don't need to duplicate this code everywhere.
8095 * expression.cs (ParameterReference): Added `Block block' argument
8097 (LocalVariableReference, ParameterReference, This): The new
8098 VariableInfo class is now responsible for all the definite
8101 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
8102 IsParameterAssigned, SetParameterAssigned): Removed.
8104 2003-05-18 Martin Baulig <martin@ximian.com>
8106 * typemanager.cs (InitCoreTypes): Try calling
8107 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
8108 the 3-args-version. Corlib now also needs our `void_type'.
8109 (GetMethod): Added overloaded version which takes an optional
8110 `bool report_errors' to allow lookups of optional methods.
8112 2003-05-12 Martin Baulig <martin@ximian.com>
8114 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
8115 only used for locals and not for parameters.
8117 2003-05-12 Miguel de Icaza <miguel@ximian.com>
8119 * support.cs (InternalParameters.ParameterType): Return the
8120 ExternalType of the parameter.
8122 * parameter.cs (Parameter.ExternalType): drop the two arguments,
8125 2003-05-11 Miguel de Icaza <miguel@ximian.com>
8127 * class.cs (MethodData.Define): Do not set the `newslot' on
8128 interface members, if they are also flagged as "override".
8130 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
8131 better code for ++i and i++. This only works for static fields
8132 and local variables.
8134 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
8135 want to pull the DeclSpace out of the builder_to_declspace instead
8136 of the TypeBuilder (like in TypeContainer.FindMembers).
8138 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
8139 instead of LookupTypeContainer. Fixes the crash on .NET for
8140 looking up interface members.
8142 * const.cs: Create our own emit context during the Definition
8143 stage, so that constants are evaluated in the proper context, when
8144 a recursive definition happens.
8146 2003-05-11 Martin Baulig <martin@ximian.com>
8148 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
8149 new block for a switch section.
8150 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
8151 the adding/lookup in the switch block. Fixes #39828.
8153 2003-05-09 Miguel de Icaza <miguel@ximian.com>
8155 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
8156 functionality: I needed to convert the data after I had performed
8157 the add/sub operation into the operands type size.
8159 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
8160 pass the type for the box operation, otherwise the resulting
8161 object would have been of type object.
8163 (BoxedCast): Add constructor to specify the type to box as.
8165 2003-05-07 Miguel de Icaza <miguel@ximian.com>
8167 * iterators.cs: I was reusing the `count' variable inadvertently,
8168 take steps to not allow this to happen.
8170 2003-05-06 Miguel de Icaza <miguel@ximian.com>
8172 * attribute.cs (Attribute.Resolve): Params attributes are encoded
8173 by creating an array at the point where the params starts and
8174 putting all those arguments there, then adjusting the size of the
8177 2003-05-05 Miguel de Icaza <miguel@ximian.com>
8179 * expression.cs (New.AddressOf): Implement interface
8180 IMemoryLocation. This is used when the `new' operator is used in
8181 the context of an invocation to a method on a value type.
8183 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
8186 * namespace.cs: Also check the using aliases here.
8188 * driver.cs: Move the test for using validity after the types have
8189 been entered, so we do a single pass that also includes the using
8192 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
8193 in the regular case. CreateSiblingForFinally is doing extra
8196 * attribute.cs (GetAttributeArgumentExpression): Store the result
8197 on an out value, and use the return value to indicate failure
8198 instead of using null (which is a valid return for Constant.GetValue).
8200 * statement.cs: Perform the analysis flow for the increment
8201 portion after the statement, because this will be the real flow of
8202 execution. Fixes #42385
8204 * codegen.cs (EmitContext.EmitArgument,
8205 EmitContext.EmitStoreArgument): New helper functions when the
8206 RemapToProxy flag is set.
8208 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
8211 Add support for remapping parameters.
8213 * iterators.cs: Propagate parameter values; Store parameter
8214 values in the proxy classes.
8216 2003-05-04 Miguel de Icaza <miguel@ximian.com>
8218 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
8219 need a proxy reference; I do not know what I was thinking
8221 * cs-parser.jay (constructor_initializer): catch another error,
8222 and display nice message.
8224 (field_declaration): catch void field declaration
8225 to flag a better error.
8227 * class.cs (MemberBase.CheckBase): Report an error instead of a
8228 warning if a new protected member is declared in a struct.
8229 (Field.Define): catch the error of readonly/volatile.
8231 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
8233 (FieldExpr.AddressOf): ditto. Catch error where the address of a
8234 volatile variable is taken
8236 2003-05-02 Miguel de Icaza <miguel@ximian.com>
8238 * statement.cs (Fixed.Resolve): Report an error if we are not in
8241 2003-05-01 Miguel de Icaza <miguel@ximian.com>
8243 * typemanager.cs: reuse the code that handles type clashes for
8244 delegates and enumerations.
8246 * class.cs (Report28): Always report.
8248 * expression.cs (EncodeAsAttribute): Allow nulls here.
8250 2003-04-28 Miguel de Icaza <miguel@ximian.com>
8252 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
8253 the functionality for testing whether an expression is valid for
8254 an attribute here. Also handle the case of arrays of elements
8257 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
8258 encoding a linear array into an array of objects that are suitable
8259 to be passed to an CustomAttributeBuilder.
8261 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
8263 * ecore.cs: (FieldExpr): Handle field remapping here.
8265 * iteratators.cs: Pass the instance variable (if the method is an
8266 instance method) to the constructors, so we can access the field
8267 variables on the class.
8269 TODO: Test this with structs. I think the THIS variable on
8270 structs might have to be a pointer, and not a refenrece
8272 2003-04-27 Miguel de Icaza <miguel@ximian.com>
8274 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
8275 local variables to fields in a proxy class.
8277 * iterators.cs (PopulateProxy): Rename our internal fields to
8279 Create a <THIS> field if we are an instance method, so we can
8280 reference our parent container variables.
8281 (MapVariable): Called back from the EmitContext code to enter a
8282 new variable to field mapping into the proxy class (we just create
8286 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
8287 for using the remapped locals to fields.
8289 I placed the code here, because that gives the same semantics to
8290 local variables, and only changes the Emit code.
8292 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
8293 statements inside iterators.
8294 (VariableInfo): Add a FieldBuilder for the cases when we are
8295 remapping local variables to fields in a proxy class
8297 * ecore.cs (SimpleNameResolve): Avoid testing two times for
8298 current_block != null.
8300 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
8301 not cope with strings, as it has been moved to the
8302 TableSwitchEmit. Fixed bug in switch generation.
8304 * expression.cs (New.DoResolve): Provide more context for the user
8305 when reporting an error.
8307 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
8310 * expression.cs (MemberAccess.DoResolve): When we get a type back,
8311 check the permissions for it. Note than in a type-resolution
8312 context the check was already present in DeclSpace.ResolveType,
8313 but was missing from the MemberAccess.
8315 (ArrayCreation.CheckIndices): warn if the user has
8316 more nested levels of expressions, but there are no more
8317 dimensions specified. Avoids crash on bug 41906.
8319 2003-04-26 Miguel de Icaza <miguel@ximian.com>
8321 * statement.cs (Block): replace Implicit bool, for a generic
8323 New flag: `Unchecked'. This is used during the EmitMeta phase
8324 (which is out-of-line with the regular Resolve/Emit process for a
8325 statement, as this is done ahead of time, but still gets a chance
8326 to call constant resolve).
8328 (Block.Flags): new enum for adding a new flag.
8330 (Block.EmitMeta): track the state of unchecked.
8332 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
8333 to enable constant resolution to work there as well.
8335 2003-04-22 Miguel de Icaza <miguel@ximian.com>
8337 * typemanager.cs (ienumerable_type): Also look up
8338 System.Collections.IEnumerable.
8340 2003-04-21 Miguel de Icaza <miguel@ximian.com>
8342 TODO: Test more than one conditional per method.
8344 * class.cs (Indexer.Define): Report the location where the user is
8345 referencing the unsupported feature.
8347 (MethodData): Overload the use of `conditionals' to
8348 minimize the creation of needless ArrayLists. This saves roughly
8349 212kb on my machine.
8351 (Method): Implement the new IIteratorContainer interface.
8352 (Method.SetYields): Implement the method by setting the ModFlags
8353 to contain METHOD_YIELDS.
8355 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
8356 which just got set to null.
8358 * iterators.cs: New file.
8360 (Yield, YieldBreak): New statements.
8362 * statement.cs (Return.Resolve): Flag an error if we are used in
8365 * codegen.cs (InIterator): New flag set if the code is being
8366 compiled in an iterator method.
8368 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
8369 internal modifier, and we just use it to avoid adding extra
8370 fields, as this is seldom used.
8372 * cs-parser.jay: Add yield_statement (yield and yield break).
8374 * driver.cs: New flag -v2 to turn on version 2 features.
8376 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
8377 hashtable when v2 is enabled.
8379 2003-04-20 Miguel de Icaza <miguel@ximian.com>
8381 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
8382 there is already a namespace defined with this name.
8384 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
8385 people upgraded their corlibs.
8387 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
8388 always use fully qualified types, no need to use the compiler
8391 (TypeManager.IsNamespace): Use binarysearch.
8393 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
8394 AddDelegate): I did not quite use the new IsValid API properly: I
8395 have to pass the short-name and the fullname. I was passing only
8396 the basename instead of the fullname sometimes.
8398 (TypeContainer.DefineType): call NamespaceClash.
8400 * interface.cs (Interface.DefineType): use NamespaceClash before
8403 * delegate.cs (Delegate.DefineType): use NamespaceClash before
8406 * enum.cs: (Enum.DefineType): use NamespaceClash before
8409 * typemanager.cs (: 3-line patch that gives us some tasty 11%
8410 speed increase. First, use the negative_hits cache when we get a
8411 negative. Second, add the type with its full original name
8412 instead of the new . and + encoded name (reflection uses + to
8413 separate type from a nested type). Use LookupTypeReflection
8414 directly which bypasses the type->name hashtable (that we already
8415 know does not contain the type.
8417 * decl.cs (DeclSpace.ResolveTypeExpr): track the
8418 location/container type.
8420 * driver.cs: When passing utf8, use directly the UTF8Encoding.
8422 2003-04-19 Miguel de Icaza <miguel@ximian.com>
8424 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
8426 * delegate.cs (NewDelegate.Resolve): Test whether an instance
8427 method is being referenced in the method group from a static
8428 context, and report error 120 if so.
8430 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
8433 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
8434 is created, we create the A namespace).
8436 * cs-parser.jay: A namespace also introduces a DeclarationFound.
8439 2003-04-18 Miguel de Icaza <miguel@ximian.com>
8441 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
8442 invocation to ModuleBuilder.GetType with the same values will
8443 return a new type instance, so we need to cache its return
8446 * expression.cs (Binary.ResolveOperator): Only allow the compare
8447 operators on enums if they are of the same type.
8449 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
8450 types of ValueType on their own case. Before we were giving them
8451 the same treatment as objects.
8453 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
8454 fullname. Short name is used to compare against container name.
8455 Fullname is used to check against defined namespace names.
8457 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
8458 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
8460 (Method.CheckBase): Call parent.
8461 (MemberBase.CheckBase): Check for protected members on sealed
8463 (PropertyBase.CheckBase): Call parent.
8464 (Field.Define): Call parent.
8466 * report.cs: Negative error codes are now mapped to 8000 - code,
8467 so that the display is render more nicely.
8469 * typemanager.cs: Do not use try/catch, instead report a regular
8472 (GetPointerType, GetReferenceType): These methods provide
8473 mechanisms to obtain the T* and T& from a T. We had the code
8474 previously scattered around the code base, and it also used
8475 TypeManager.LookupType that would go through plenty of caches.
8476 This one goes directly to the type source.
8478 In some places we did the Type.GetType followed by
8479 ModuleBuilder.GetType, but not in others, so this unifies the
8482 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
8483 statements now that we have namespace information.
8485 * typemanager.cs (IsNamespace): New method, returns whether the
8486 string presented is a namespace or not.
8488 (ComputeNamespaces): New public entry point, computes the list of
8489 available namespaces, using the GetNamespaces API call in Mono, or
8490 the slower version in MS.NET.
8492 Now before we start the semantic analysis phase, we have a
8493 complete list of namespaces including everything that the user has
8496 Deleted old code to cache namespaces in .nsc files.
8498 2003-04-17 Miguel de Icaza <miguel@ximian.com>
8500 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
8501 class/struct location definition Location for the implicit
8502 constructor location.
8504 (Operator.Define): Use the location of the operator for the
8505 implicit Method definition.
8507 (Constructor.Emit): use the constructor location for the implicit
8508 base initializer constructor.
8510 * ecore.cs: Remove ITypeExpression. This interface is now gone,
8511 and the Expression class now contains two new methods:
8513 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
8514 isolate type lookup from the rest of the resolution process.
8516 Since we use Expressions to hold type definitions due to the way
8517 we parse the input we have historically overloaded Resolve to
8518 perform the Type lookups if a special flag is passed. Now this is
8519 eliminated and two methods take their place.
8521 The differences in the two methods between xStep and xTerminal is
8522 that xStep is involved in our current lookup system that uses
8523 SimpleNames to compose a name, while xTerminal is used just to
8524 catch the case where the simplename lookup failed.
8526 2003-04-16 Miguel de Icaza <miguel@ximian.com>
8528 * expression.cs (ResolveMemberAccess): Remove redundant code.
8529 TypeExpr expressions are always born fully resolved.
8531 * interface.cs (PopulateMethod): Do not lookup the types twice.
8532 We were doing it once during SemanticAnalysis and once during
8535 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
8536 in local variable type definitions, were being returned as a
8537 SimpleName (we decomposed everything into a string), that is
8538 because primary_expression was being used instead of a type in the
8539 grammar (reduce/reduce conflicts).
8541 The part that was wrong is that we converted the expression into a
8542 string (an oversimplification in one hand, compounded with primary
8543 expressions doing string concatenation).
8549 Would return "A.B.C[]" as a SimpleName. This stopped things like
8550 using clauses from working on this particular context. And a type
8551 was being matched directly against "A.B.C[]".
8553 We now use the correct approach, and allow for ComposedCast to be
8554 part of the unary expression. So the "A.B.C []" become a composed
8555 cast of "A.B.C" (as a nested group of MemberAccess with a
8556 SimpleName at the end) plus the rank composition "[]".
8560 2003-04-10 Miguel de Icaza <miguel@ximian.com>
8562 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
8563 for the access level checking.
8565 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
8566 `TypeContainer container', because I kept getting confused when I
8567 was debugging this code.
8569 * expression.cs (Indexers): Instead of tracking getters/setters,
8570 we now track them in parallel. We create one arraylist less, but
8571 most importantly it is possible now for the LValue code to find a
8572 matching get for a set.
8574 (IndexerAccess.DoResolveLValue): Update the code.
8575 GetIndexersForType has been modified already to extract all the
8576 indexers from a type. The code assumed it did not.
8578 Also make the code set the correct return type for the indexer.
8579 This was fixed a long time ago for properties, but was missing for
8580 indexers. It used to be void_type.
8582 (Binary.Emit): Test first for doubles instead of
8583 floats, as they are more common.
8585 (Binary.EmitBranchable): Use the .un version of the branch opcodes
8586 when dealing with floats and the <=, >= operators. This fixes bug
8589 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
8590 to load the array value by emitting a load on the foreach variable
8591 type. This was incorrect.
8593 We now emit the code to load an element using the the array
8594 variable type, and then we emit the conversion operator.
8598 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
8600 * attribute.cs: Avoid allocation of ArrayLists in the common case.
8602 2003-04-09 Miguel de Icaza <miguel@ximian.com>
8604 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
8605 test for protection before we test for signatures.
8607 (MethodSignature.ToString): implement.
8609 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
8610 to the case where we reduced into a LongConstant.
8612 * decl.cs (CheckAccessLevel): If the type is an array, we can not
8613 depend on whether the information is acurrate, because the
8614 Microsoft runtime will always claim that the array type is public,
8615 regardless of the real state.
8617 If the type is a pointer, another problem happens: the type is
8618 reported as non-public in Microsoft.
8620 In both cases we have to call CheckAccessLevel recursively with
8621 the underlying type as the argument to be tested.
8623 2003-04-08 Miguel de Icaza <miguel@ximian.com>
8625 * assign.cs (Assign.Emit): If we are dealing with a compound
8626 assignment expression, we should use the code path that stores the
8627 intermediate result in a temporary value. This fixes #40903.
8629 *expression.cs (Indirection.ToString): Provide ToString method for
8632 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
8634 * class.cs: Null out fields holding references to Block objects so
8635 they can be garbage collected.
8637 * expression.cs (OverloadResolve): Remove unused local.
8639 2003-04-07 Martin Baulig <martin@ximian.com>
8641 * codegen.cs (EmitContext.CurrentFile): New public field.
8642 (EmitContext.Mark): Use the CurrentFile to check whether the
8643 location is in the correct file.
8644 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
8646 2003-04-07 Martin Baulig <martin@ximian.com>
8648 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
8650 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
8651 location. [FIXME: The location argument which gets passed to this
8652 method is sometimes wrong!]
8654 2003-04-07 Nick Drochak <ndrochak@gol.com>
8656 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
8658 2003-04-07 Miguel de Icaza <miguel@ximian.com>
8660 * expression.cs (Indirection.EmitAssign): We were using the
8661 temporary, but returning immediately instead of continuing the
8664 2003-04-06 Martin Baulig <martin@ximian.com>
8666 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
8667 if it's a nested child, but also deriving from the outer class.
8670 * typemanager.cs (IsNestedChildOf): Make this work if it's a
8671 nested child, but also deriving from the outer class. See
8673 (FilterWithClosure): We may access private members of the outer
8674 class if we're a nested child and deriving from the outer class.
8675 (RealMemberLookup): Only set `closure_private_ok' if the
8676 `original_bf' contained BindingFlags.NonPublic.
8678 2003-04-05 Martin Baulig <martin@ximian.com>
8680 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
8682 2003-04-02 Miguel de Icaza <miguel@ximian.com>
8684 * class.cs (Event.Define): Do not allow abstract events to have
8687 2003-04-01 Miguel de Icaza <miguel@ximian.com>
8689 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
8690 block in event declarations.
8692 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
8693 value type, get its address.
8695 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
8696 leaving a class on the stack instead of a boolean value (int
8697 0/1). Change the code so we compare against null, and then the
8698 result against zero.
8700 * class.cs (TypeContainer.GetClassBases): We were checking for the
8701 parent class being sealed too late.
8703 * expression.cs (Binary.Emit): For <= and >= when dealing with
8704 floating point values, use cgt.un and clt.un instead of cgt and
8707 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
8709 * statement.cs: Apply the same optimization as MS: skip the
8710 GetEnumerator returning an IEnumerator, and use the one returning a
8711 CharEnumerator instead. This allows us to avoid the try-finally block
8714 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
8716 * cs-parser.jay: Attributes cannot be applied to
8717 namespaces. Fixes #40473
8719 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8722 (Add*): check if the name is valid using the full name for constants,
8723 fields, properties and events.
8725 2003-03-28 Miguel de Icaza <miguel@ximian.com>
8727 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
8728 char constants to be part of the enumeration.
8730 * expression.cs (Conditional.DoResolve): Add support for operator
8731 true. Implements the missing functionality from 14.12
8733 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
8734 operator true/false as required by the spec.
8736 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
8737 implicit conversion to boolean.
8739 * statement.cs (Statement.ResolveBoolean): A boolean expression is
8740 also one where the type implements `operator true'.
8742 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
8743 get an expression that will invoke operator true based on an
8746 (GetConversionOperators): Removed the hack that called op_True
8749 (Expression.ResolveBoolean): Move this from Statement.
8751 2003-03-17 Miguel de Icaza <miguel@ximian.com>
8753 * ecore.cs (FieldExpr): do not allow initialization of initonly
8754 fields on derived classes
8756 2003-03-13 Martin Baulig <martin@ximian.com>
8758 * statement.cs (Block.Emit): Call ig.BeginScope() and
8759 ig.EndScope() when compiling with debugging info; call
8760 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
8762 2003-03-08 Miguel de Icaza <miguel@ximian.com>
8764 * expression.cs (Indexers): Do not construct immediately, allow
8765 for new members to be appended as we go. Fixes 38143
8767 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8769 * expression.cs: save/restore context when resolving an unchecked
8772 2003-03-05 Miguel de Icaza <miguel@ximian.com>
8774 * cfold.cs: Catch division by zero in modulus operator during
8777 2003-03-03 Miguel de Icaza <miguel@ximian.com>
8779 * interface.cs (Interface.DefineMembers): Avoid defining members
8782 2003-02-27 Miguel de Icaza <miguel@ximian.com>
8784 * driver.cs: handle the +/- options for -noconfig
8786 * statement.cs (Unckeched.Resolve): Also track the state of
8787 unchecked in the Resolve phase.
8789 2003-02-27 Martin Baulig <martin@ximian.com>
8791 * ecore.cs (Expression.MemberLookup): Don't create a
8792 MethodGroupExpr for something which is not a method. Fixes #38291.
8794 2003-02-25 Miguel de Icaza <miguel@ximian.com>
8796 * class.cs (MemberBase.CheckParameters): Also check that the type
8797 is unmanaged if it is a pointer.
8799 * expression.cs (SizeOf.Resolve): Add location information.
8801 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
8802 a managed type is declared.
8804 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
8805 parameter modifiers as well. Fixes bug 38606
8807 * class.cs: Very sad. Am backing out the speed up changes
8808 introduced by the ArrayList -> Array in the TypeContainer, as they
8809 were not actually that much faster, and introduced a bug (no error
8810 reports on duplicated methods).
8812 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
8813 source first, this will guarantee that we have a valid expression
8814 before calling in lower levels functions that will require a
8815 resolved object. Then use this original_source in the
8816 target.ResolveLValue instead of the original source that was
8819 Another change. Use target.Resolve instead of LValueResolve.
8820 Although we are resolving for LValues, we will let the Assign code
8821 take care of that (it will be called again from Resolve). This
8822 basically allows code like this:
8824 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
8825 class Y { void A (X x) { x [0] += o; }
8827 The problem was that the indexer was trying to resolve for
8828 set_Item (idx, object o) and never finding one. The real set_Item
8829 was set_Item (idx, X). By delaying the process we get the right
8834 2003-02-23 Martin Baulig <martin@ximian.com>
8836 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
8837 while calling DoEmit ().
8839 * codegen.cs (EmitContext.Mark): Don't mark locations in other
8840 source files; if you use the #line directive inside a method, the
8841 compiler stops emitting line numbers for the debugger until it
8842 reaches the end of the method or another #line directive which
8843 restores the original file.
8845 2003-02-23 Martin Baulig <martin@ximian.com>
8847 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
8849 2003-02-23 Martin Baulig <martin@ximian.com>
8851 * statement.cs (Block.AddChildVariableNames): We need to call this
8852 recursively, not just for our immediate children.
8854 2003-02-23 Martin Baulig <martin@ximian.com>
8856 * class.cs (Event.Define): Always make the field private, like csc does.
8858 * typemanager.cs (TypeManager.RealMemberLookup): Make events
8859 actually work, fixes bug #37521.
8861 2003-02-23 Miguel de Icaza <miguel@ximian.com>
8863 * delegate.cs: When creating the various temporary "Parameters"
8864 classes, make sure that we call the ComputeAndDefineParameterTypes
8865 on those new parameters (just like we do with the formal ones), to
8866 allow them to be resolved in the context of the DeclSpace.
8868 This fixes the bug that Dick observed in Bugzilla #38530.
8870 2003-02-22 Miguel de Icaza <miguel@ximian.com>
8872 * expression.cs (ResolveMemberAccess): When resolving a constant,
8873 do not attempt to pull a constant if the value was not able to
8874 generate a valid constant.
8876 * const.cs (LookupConstantValue): Do not report more errors than required.
8878 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8880 * expression.cs: fixes bug #38328.
8882 2003-02-18 Miguel de Icaza <miguel@ximian.com>
8884 * class.cs: Changed all the various members that can be part of a
8885 class from being an ArrayList to be an Array of the right type.
8886 During the DefineType type_list, interface_list, delegate_list and
8887 enum_list are turned into types, interfaces, delegates and enums
8890 And during the member population, indexer_list, event_list,
8891 constant_list, field_list, instance_constructor_list, method_list,
8892 operator_list and property_list are turned into their real arrays.
8894 Although we could probably perform this operation earlier, for
8895 good error reporting we need to keep the lists and remove the
8896 lists for longer than required.
8898 This optimization was triggered by Paolo profiling the compiler
8899 speed on the output of `gen-sample-program.pl' perl script.
8901 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
8902 not crash in methods like MemberLookupFailed that use this field.
8904 This problem arises when the compiler fails to resolve a type
8905 during interface type definition for example.
8907 2003-02-18 Miguel de Icaza <miguel@ximian.com>
8909 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
8910 inherit from System.Object, so we have to stop at null, not only
8911 when reaching System.Object.
8913 2003-02-17 Miguel de Icaza <miguel@ximian.com>
8915 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
8916 DeclaredOnly because the parent indexer might have had a different
8917 name, but did not loop until the top of the hierarchy was reached.
8919 The problem this one fixes is 35492: when a class implemented an
8920 indexer from an interface, we were getting the interface method
8921 (which was abstract) and we were flagging an error (can not invoke
8924 This also keeps bug 33089 functioning, and test-148 functioning.
8926 * typemanager.cs (IsSpecialMethod): The correct way of figuring
8927 out if a method is special is to see if it is declared in a
8928 property or event, or whether it is one of the predefined operator
8929 names. This should fix correctly #36804.
8931 2003-02-15 Miguel de Icaza <miguel@ximian.com>
8933 The goal here is to remove the dependency on EmptyCast.Peel ().
8934 Killing it completely.
8936 The problem is that currently in a number of places where
8937 constants are expected, we have to "probe" for an EmptyCast, and
8938 Peel, which is not the correct thing to do, as this will be
8939 repetitive and will likely lead to errors.
8941 The idea is to remove any EmptyCasts that are used in casts that
8942 can be reduced to constants, so we only have to cope with
8945 This bug hunt was triggered by Bug 37363 and the desire to remove
8946 the duplicate pattern where we were "peeling" emptycasts to check
8947 whether they were constants. Now constants will always be
8950 * ecore.cs: Use an enumconstant here instead of wrapping with
8953 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
8954 throwing me off. By handling this we can get rid of a few hacks.
8956 * statement.cs (Switch): Removed Peel() code.
8958 2003-02-14 Miguel de Icaza <miguel@ximian.com>
8960 * class.cs: Location information for error 508
8962 * expression.cs (New.DoResolve): Add a guard against double
8963 resolution of an expression.
8965 The New DoResolve might be called twice when initializing field
8966 expressions (see EmitFieldInitializers, the call to
8967 GetInitializerExpression will perform a resolve on the expression,
8968 and later the assign will trigger another resolution
8970 This leads to bugs (#37014)
8972 * delegate.cs: The signature for EndInvoke should contain any ref
8973 or out parameters as well. We were not doing this in the past.
8975 * class.cs (Field.Define): Do not overwrite the type definition
8976 inside the `volatile' group. Turns out that volatile enumerations
8977 were changing the type here to perform a validity test, which
8980 2003-02-12 Miguel de Icaza <miguel@ximian.com>
8982 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
8983 and structs, we do not want to load the instance variable
8985 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
8986 enum_type has to be handled like an object reference (implicit
8987 conversions exists from this to object), but the regular IsClass
8988 and IsValueType tests will never return true for this one.
8990 Also we use TypeManager.IsValueType instead of type.IsValueType,
8991 just for consistency with the rest of the code (this is only
8992 needed if we ever use the construct exposed by test-180.cs inside
8993 corlib, which we dont today).
8995 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
8997 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
9000 2003-02-09 Martin Baulig <martin@ximian.com>
9002 * namespace.cs (Namespace..ctor): Added SourceFile argument.
9003 (Namespace.DefineNamespaces): New static public method; this is
9004 called when we're compiling with debugging to add all namespaces
9007 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
9008 pass it to the Namespace's .ctor.
9010 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
9011 and MethodBase arguments; pass the namespace ID to the symwriter;
9012 pass the MethodBase instead of the token to the symwriter.
9013 (SymbolWriter.DefineNamespace): New method to add a namespace to
9016 2003-02-09 Martin Baulig <martin@ximian.com>
9018 * symbolwriter.cs: New file. This is a wrapper around
9019 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
9020 methods here in near future.
9022 2003-02-09 Martin Baulig <martin@ximian.com>
9024 * codegen.cs (EmitContext.Mark): Just pass the arguments to
9025 ILGenerator.MarkSequencePoint() which are actually used by the
9028 2003-02-09 Martin Baulig <martin@ximian.com>
9030 * location.cs (SourceFile): New public sealed class. This
9031 contains the name and an index which is used in the location's token.
9032 (Location): Reserve an appropriate number of bits in the token for
9033 the source file instead of walking over that list, this gives us a
9034 really huge performance improvement when compiling with debugging.
9036 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
9037 `SourceFile' argument instead of a string.
9038 (Driver.ProcessFile): Add all the files via Location.AddFile(),
9039 but don't parse/tokenize here, we need to generate the list of all
9040 source files before we do that.
9041 (Driver.ProcessFiles): New static function. Parses/tokenizes all
9044 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
9045 instead of a string.
9047 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
9050 2003-02-09 Martin Baulig <martin@ximian.com>
9052 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
9053 filename on `#line default'.
9055 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
9057 * statement.cs: don't clear the pinned var when the fixed statement
9058 returns from the method (fixes bug#37752).
9060 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
9062 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
9065 2003-02-07 Martin Baulig <martin@ximian.com>
9067 * driver.cs: Removed the `--debug-args' command line argument.
9069 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
9070 automatically by the AsssemblyBuilder.
9071 (CodeGen.InitializeSymbolWriter): We don't need to call any
9072 initialization function on the symbol writer anymore. This method
9073 doesn't take any arguments.
9075 2003-02-03 Miguel de Icaza <miguel@ximian.com>
9077 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
9078 from referenced assemblies as well.
9080 2003-02-02 Martin Baulig <martin@ximian.com>
9082 * class.cs (MethodData.Emit): Generate debugging info for external methods.
9084 2003-02-02 Martin Baulig <martin@ximian.com>
9086 * class.cs (Constructor.Emit): Open the symbol writer before
9087 emitting the constructor initializer.
9088 (ConstructorInitializer.Emit): Call ec.Mark() to allow
9089 single-stepping through constructor initializers.
9091 2003-01-30 Miguel de Icaza <miguel@ximian.com>
9093 * class.cs: Handle error 549: do not allow virtual methods in
9096 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
9098 * decl.cs: Check access levels when resolving types
9100 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
9102 * statement.cs: Add parameters and locals set in catch blocks that might
9103 return to set vector
9105 2003-01-29 Miguel de Icaza <miguel@ximian.com>
9107 * class.cs (Operator): Set the SpecialName flags for operators.
9109 * expression.cs (Invocation.DoResolve): Only block calls to
9110 accessors and operators on SpecialName methods.
9112 (Cast.TryReduce): Handle conversions from char constants.
9115 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
9117 * statement.cs: small memory and time optimization in FlowBranching.
9119 2003-01-28 Pedro Mart <yoros@wanadoo.es>
9121 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
9122 problem that the last fix but in the other sid (Set).
9124 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
9125 access when there is no indexer in the hierarchy.
9127 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
9129 * class.cs: Combine some if statements.
9131 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9133 * driver.cs: fixed bug #37187.
9135 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
9137 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
9138 any indexer, it's needed to build a list with all the indexers in the
9139 hierarchy (AllGetters), else we have problems. Fixes #35653.
9141 2003-01-23 Miguel de Icaza <miguel@ximian.com>
9143 * class.cs (MethodData.Define): It is wrong for an interface
9144 implementation to be static in both cases: explicit and implicit.
9145 We were only handling this in one case.
9147 Improve the if situation there to not have negations.
9149 * class.cs (Field.Define): Turns out that we do not need to check
9150 the unsafe bit on field definition, only on usage. Remove the test.
9152 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9154 * driver.cs: use assembly.Location instead of Codebase (the latest
9155 patch made mcs fail when using MS assemblies).
9157 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
9159 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
9160 get the path to *corlib.dll.
9162 2003-01-21 Nick Drochak <ndrochak@gol.com>
9166 * typemanager.cs: Remove compiler warnings
9168 2003-01-20 Duncan Mak <duncan@ximian.com>
9170 * AssemblyInfo.cs: Bump the version number to 0.19.
9172 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9174 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
9176 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
9178 * class.cs (Constructor::Emit): Emit debugging info for constructors.
9180 2003-01-17 Miguel de Icaza <miguel@ximian.com>
9182 * cs-parser.jay: Small fix: we were not comparing the constructor
9183 name correctly. Thanks to Zoltan for the initial pointer.
9185 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
9187 * cs-tokenizer.cs: Set file name when specified with #line
9189 2003-01-15 Miguel de Icaza <miguel@ximian.com>
9191 * cs-parser.jay: Only perform the constructor checks here if we
9192 are named like the class; This will help provider a better
9193 error. The constructor path is taken when a type definition is
9194 not found, but most likely the user forgot to add the type, so
9195 report that rather than the constructor error.
9197 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
9199 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
9202 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
9204 * cs-parser.jay: Add cleanup call.
9206 2003-01-13 Duncan Mak <duncan@ximian.com>
9208 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
9209 consistent with other methods.
9211 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
9213 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
9215 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
9217 * attribute.cs: only set GuidAttr to true when we have a
9220 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9224 * typemanager.cs: fixes to allow mcs compile corlib with the new
9225 Type.IsSubclassOf fix.
9227 2003-01-08 Miguel de Icaza <miguel@ximian.com>
9229 * expression.cs (LocalVariableReference.DoResolve): Classify a
9230 constant as a value, not as a variable. Also, set the type for
9233 * cs-parser.jay (fixed_statement): take a type instead of a
9234 pointer_type, so we can produce a better error message later.
9236 * statement.cs (Fixed.Resolve): Flag types that are not pointers
9239 (For.DoEmit): Make inifinite loops have a
9240 non-conditional branch back.
9242 (Fixed.DoEmit): First populate the pinned variables, then emit the
9243 statement, then clear the variables. Before I was emitting the
9244 code once for each fixed piece.
9247 2003-01-08 Martin Baulig <martin@ximian.com>
9249 * statement.cs (FlowBranching.MergeChild): A break in a
9250 SWITCH_SECTION does not leave a loop. Fixes #36155.
9252 2003-01-08 Martin Baulig <martin@ximian.com>
9254 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
9255 lives in the same number space than `param_map'. Fixes #36154.
9257 2003-01-07 Miguel de Icaza <miguel@ximian.com>
9259 * cs-parser.jay (constructor_declaration): Set the
9260 Constructor.ModFlags before probing for it. This makes the
9261 compiler report 514, 515 and 132 (the code was there, but got
9264 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
9265 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
9266 (GotoCase.Resolve): Set `Returns' to ALWAYS.
9268 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
9270 * enum.cs: create the enum static fields using the enum type.
9272 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
9274 * class.cs: don't try to create the ParamBuilder for the return
9275 type if it's not needed (and handle it breaking for the ms runtime
9278 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
9280 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
9282 2002-12-29 Miguel de Icaza <miguel@ximian.com>
9284 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
9285 the command. This showed up while compiling the JANET source
9286 code, which used \r as its only newline separator.
9288 2002-12-28 Miguel de Icaza <miguel@ximian.com>
9290 * class.cs (Method.Define): If we are an operator (because it
9291 reuses our code), then set the SpecialName and HideBySig. #36128
9293 2002-12-22 Miguel de Icaza <miguel@ximian.com>
9295 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
9296 exception, report error 120 `object reference required'.
9298 * driver.cs: Add --pause option, used during to measure the size
9299 of the process as it goes with --timestamp.
9301 * expression.cs (Invocation.DoResolve): Do not allow methods with
9302 SpecialName to be invoked.
9304 2002-12-21 Miguel de Icaza <miguel@ximian.com>
9306 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
9307 number before adding it.
9309 2002-12-21 Ravi Pratap <ravi@ximian.com>
9311 * ecore.cs (StandardImplicitConversion): When in an unsafe
9312 context, we allow conversion between void * to any other pointer
9313 type. This fixes bug #35973.
9315 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
9317 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
9318 is not thrown when extensionless outputs are used
9320 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9322 * rootcontext.cs: fixed compilation of corlib.
9324 2002-12-19 Miguel de Icaza <miguel@ximian.com>
9326 * attribute.cs (Attributes.Contains): Add new method.
9328 * class.cs (MethodCore.LabelParameters): if the parameter is an
9329 `out' parameter, check that no attribute `[In]' has been passed.
9331 * enum.cs: Handle the `value__' name in an enumeration.
9333 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
9335 * decl.cs: Added special case to allow overrides on "protected
9338 2002-12-18 Ravi Pratap <ravi@ximian.com>
9340 * attribute.cs (Attributes.AddAttributeSection): Rename to this
9341 since it makes much more sense.
9343 (Attributes.ctor): Don't require a Location parameter.
9345 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
9347 * attribute.cs (ApplyAttributes): Remove extra Location parameters
9348 since we already have that information per attribute.
9350 * everywhere : make appropriate changes.
9352 * class.cs (LabelParameters): Write the code which actually
9353 applies attributes to the return type. We can't do this on the MS
9354 .NET runtime so we flag a warning in the case an exception is
9357 2002-12-18 Miguel de Icaza <miguel@ximian.com>
9359 * const.cs: Handle implicit null conversions here too.
9361 2002-12-17 Ravi Pratap <ravi@ximian.com>
9363 * class.cs (MethodCore.LabelParameters): Remove the extra
9364 Type [] parameter since it is completely unnecessary. Instead
9365 pass in the method's attributes so that we can extract
9366 the "return" attribute.
9368 2002-12-17 Miguel de Icaza <miguel@ximian.com>
9370 * cs-parser.jay (parse): Use Report.Error to flag errors instead
9371 of ignoring it and letting the compile continue.
9373 * typemanager.cs (ChangeType): use an extra argument to return an
9374 error condition instead of throwing an exception.
9376 2002-12-15 Miguel de Icaza <miguel@ximian.com>
9378 * expression.cs (Unary.TryReduce): mimic the code for the regular
9379 code path. Perform an implicit cast in the cases where we can
9380 implicitly convert to one of the integral types, and then reduce
9381 based on that constant. This fixes bug #35483.
9383 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9385 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
9387 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9389 * namespace.cs: fixed bug #35489.
9391 2002-12-12 Miguel de Icaza <miguel@ximian.com>
9393 * class.cs: Remove some dead code.
9395 * cs-parser.jay: Estimate the number of methods needed
9396 (RootContext.MethodCount);
9398 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
9399 numbers instead of StringBuilders.
9401 * support.cs (PtrHashtable): Add constructor with initial size;
9402 We can now reduce reallocations of the method table.
9404 2002-12-10 Ravi Pratap <ravi@ximian.com>
9406 * attribute.cs (ApplyAttributes): Keep track of the emitted
9407 attributes on a per-target basis. This fixes bug #35413.
9409 2002-12-10 Miguel de Icaza <miguel@ximian.com>
9411 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
9412 default to the Windows 1252 encoding.
9414 (UnixParseOption): Support version, thanks to Alp for the missing
9417 * AssemblyInfo.cs: Add nice assembly information.
9419 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
9422 * cs-parser.jay: Allow a trailing comma before the close bracked
9423 in the attribute_section production.
9425 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
9426 address of the instance was being taken, I will take this out,
9427 because we take the address of the object immediately here.
9429 2002-12-09 Ravi Pratap <ravi@ximian.com>
9431 * typemanager.cs (AreMultipleAllowed): Take care of the most
9432 obvious case where attribute type is not in the current assembly -
9435 2002-12-08 Miguel de Icaza <miguel@ximian.com>
9437 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
9438 definitions, instead of doing that afterwards.
9440 Also we use a nice little hack, depending on the constructor, we
9441 know if we are a "composed" name or a simple name. Hence, we
9442 avoid the IndexOf test, and we avoid
9444 * codegen.cs: Add code to assist in a bug reporter to track down
9445 the source of a compiler crash.
9447 2002-12-07 Ravi Pratap <ravi@ximian.com>
9449 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
9450 types have been emitted for a given element and flag an error
9451 if something which does not have AllowMultiple set is used more
9454 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
9455 attribute types and their corresponding AllowMultiple properties
9457 (AreMultipleAllowed): Check the property for a given type.
9459 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
9460 property in the case we have a TypeContainer.
9462 (Attributes.AddAttribute): Detect duplicates and just skip on
9463 adding them. This trivial fix catches a pretty gross error in our
9464 attribute emission - global attributes were being emitted twice!
9466 Bugzilla bug #33187 is now fixed.
9468 2002-12-06 Miguel de Icaza <miguel@ximian.com>
9470 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
9473 * expression.cs (Binary.ResolveOperator): I can only use the
9474 Concat (string, string, string) and Concat (string, string,
9475 string, string) if the child is actually a concatenation of
9478 2002-12-04 Miguel de Icaza <miguel@ximian.com>
9480 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
9481 context where we need a 2-character lookahead.
9483 * pending.cs (PendingImplementation): Rework so we can keep track
9484 of interface types all the time, and flag those which were
9485 implemented by parents as optional.
9487 2002-12-03 Miguel de Icaza <miguel@ximian.com>
9489 * expression.cs (Binary.ResolveOperator): Use
9490 String.Concat(string,string,string) or
9491 String.Concat(string,string,string,string) when possible.
9493 * typemanager: More helper methods.
9496 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
9498 * pending.cs: remove the bogus return from GetMissingInterfaces()
9499 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
9501 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9503 * namespace.cs: avoid duplicated 'using xxx' being added to
9504 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
9505 when we get more than one 'using' statement for the same namespace.
9506 Report a CS0105 warning for it.
9508 2002-11-30 Miguel de Icaza <miguel@ximian.com>
9510 * cs-tokenizer.cs (consume_identifier): use read directly, instead
9511 of calling getChar/putback, uses internal knowledge of it.
9513 (xtoken): Reorder tokenizer so most common patterns are checked
9514 first. This reduces the compilation time in another 5% (from 8.11s
9515 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
9517 The parsing time is 22% of the compilation in mcs, and from that
9518 64% is spent on the tokenization process.
9520 I tried using a binary search for keywords, but this is slower
9521 than the hashtable. Another option would be to do a couple of
9524 * Not use a StringBuilder, instead use an array of chars,
9525 with a set value. Notice that this way we could catch
9526 the 645 error without having to do it *afterwards*.
9528 * We could write a hand-parser to avoid the hashtable
9529 compares altogether.
9531 The identifier consumption process takes 37% of the tokenization
9532 time. Another 15% is spent on is_number. 56% of the time spent
9533 on is_number is spent on Int64.Parse:
9535 * We could probably choose based on the string length to
9536 use Int32.Parse or Int64.Parse and avoid all the 64-bit
9539 Another 3% is spend on wrapping `xtoken' in the `token' function.
9541 Handle 0xa0 as whitespace (#34752)
9543 2002-11-26 Miguel de Icaza <miguel@ximian.com>
9545 * typemanager.cs (IsCLRType): New routine to tell whether a type
9546 is one of the builtin types.
9548 Maybe it needs to use TypeCodes to be faster. Maybe we could use
9549 typecode in more places instead of doing pointer comparissions.
9550 We could leverage some knowledge about the way the typecodes are
9553 New code to cache namespaces in assemblies, it is currently not
9554 invoked, to be used soon.
9556 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
9558 * expression.cs (Binary.ResolveOperator): specially handle
9559 strings, and do not perform user-defined operator overloading for
9562 2002-11-24 Miguel de Icaza <miguel@ximian.com>
9564 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
9565 internalcall as it is a pretty simple operation; Avoid whenever
9566 possible to call Char.IsLetter.
9568 (consume_identifier): Cut by half the number of
9569 hashtable calls by merging the is_keyword and GetKeyword behavior.
9571 Do not short-circuit, because if we do, we
9572 report errors (ie, #if false && true would produce an invalid
9576 2002-11-24 Martin Baulig <martin@ximian.com>
9578 * expression.cs (Cast.TryReduce): If we're in checked syntax,
9579 check constant ranges and report a CS0221. Fixes #33186.
9581 2002-11-24 Martin Baulig <martin@ximian.com>
9583 * cs-parser.jay: Make this work for uninitialized variable
9584 declarations in the `for' initializer. Fixes #32416.
9586 2002-11-24 Martin Baulig <martin@ximian.com>
9588 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
9589 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
9591 2002-11-24 Martin Baulig <martin@ximian.com>
9593 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
9594 argument; if true, we also check for user-defined conversions.
9595 This is only needed if both arguments are of a user-defined type.
9596 Fixes #30443, added test-175.cs.
9597 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
9599 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
9601 2002-11-24 Martin Baulig <martin@ximian.com>
9603 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
9604 function to get the store opcode.
9605 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
9606 only emit the Ldelema if the store opcode is Stobj. You must run
9607 both test-34 and test-167 to test this. Fixes #34529.
9609 2002-11-23 Martin Baulig <martin@ximian.com>
9611 * ecore.cs (Expression.MemberLookup): Added additional
9612 `qualifier_type' argument which is used when we're being called
9613 from MemberAccess.DoResolve() and null if we're called from a
9615 (Expression.MemberLookupFailed): New method to report errors; this
9616 does the CS1540 check and reports the correct error message.
9618 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
9619 argument for the CS1540 check and redone the way how we're dealing
9620 with private members. See the comment in the source code for details.
9621 (FilterWithClosure): Reverted this back to revision 1.197; renamed
9622 `closure_start_type' to `closure_qualifier_type' and check whether
9623 it's not null. It was not this filter being broken, it was just
9624 being called with the wrong arguments.
9626 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
9627 and pass it the correct `qualifier_type'; this also does the error
9630 2002-11-22 Miguel de Icaza <miguel@ximian.com>
9632 * expression.cs (Invocation.EmitParams): If the we are dealing
9633 with a non-built-in value type, load its address as well.
9635 (ArrayCreation): Use a a pretty constant instead
9636 of the hardcoded value 2. Use 6 instead of 2 for the number of
9637 static initializers.
9639 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
9640 because they are not really value types, just glorified integers.
9642 * driver.cs: Do not append .exe, the CSC compiler does not do it.
9644 * ecore.cs: Remove redundant code for enumerations, make them use
9645 the same code path as everything else, fixes the casting issue
9646 with enumerations in Windows.Forms.
9648 * attribute.cs: Do only cast to string if it is a string, the
9649 validation happens later.
9651 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
9652 people upgrade their corlibs.
9654 * ecore.cs: Oops, enumerations were not following the entire code path
9656 2002-11-21 Miguel de Icaza <miguel@ximian.com>
9658 * typemanager.cs (FilterWithClosure): Commented out the test for
9659 1540 in typemanager.cs, as it has problems when accessing
9660 protected methods from a parent class (see test-174.cs).
9662 * attribute.cs (Attribute.ValidateGuid): new method.
9663 (Attribute.Resolve): Use above.
9665 2002-11-19 Miguel de Icaza <miguel@ximian.com>
9667 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
9669 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
9670 handling for enumerations, as we only needed the TypeContainer
9671 functionality to begin with (this is required for the fix below to
9672 work for enums that reference constants in a container class for
9675 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
9677 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
9678 a valid TypeBuilder to perform lookups on.o
9680 * class.cs (InheritableMemberSignatureCompare): Use true in the
9681 call to GetGetMethod and GetSetMethod, because we are comparing
9682 the signature, and we need to get the methods *even* if they are
9685 (PropertyBase.CheckBase): ditto.
9687 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
9688 GotoCase.Resolve): Use Peel on EmpytCasts.
9690 * ecore.cs (EmptyCast): drop child, add Peel method.
9692 2002-11-17 Martin Baulig <martin@ximian.com>
9694 * ecore.cs (EmptyCast.Child): New public property.
9696 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
9697 label resolved to an EmptyCast. Fixes #34162.
9698 (GotoCase.Resolve): Likewise.
9699 (Block.EmitMeta): Likewise.
9701 2002-11-17 Martin Baulig <martin@ximian.com>
9703 * expression.cs (Invocation.BetterConversion): Prefer int over
9704 uint; short over ushort; long over ulong for integer literals.
9705 Use ImplicitConversionExists instead of StandardConversionExists
9706 since we also need to check for user-defined implicit conversions.
9707 Fixes #34165. Added test-173.cs.
9709 2002-11-16 Martin Baulig <martin@ximian.com>
9711 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
9712 with the `true' and `false' literals. Fixes #33151.
9714 2002-11-16 Martin Baulig <martin@ximian.com>
9716 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
9717 October 22nd; don't do the cs1540 check for static members.
9719 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
9720 now using our own filter here and doing the cs1540 check again.
9722 2002-11-16 Martin Baulig <martin@ximian.com>
9724 * support.cs (InternalParameters): Don't crash if we don't have
9725 any fixed parameters. Fixes #33532.
9727 2002-11-16 Martin Baulig <martin@ximian.com>
9729 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
9730 when looking up static methods to make this work on Windows.
9733 2002-11-16 Martin Baulig <martin@ximian.com>
9735 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
9736 a setter rather than using PropertyInfo.CanWrite.
9738 2002-11-15 Nick Drochak <ndrochak@gol.com>
9740 * class.cs: Allow acces to block member by subclasses. Fixes build
9743 2002-11-14 Martin Baulig <martin@ximian.com>
9745 * class.cs (Constructor.Emit): Added the extern/block check.
9748 2002-11-14 Martin Baulig <martin@ximian.com>
9750 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
9751 iteration while looking for indexers, this is needed because the
9752 indexer may have a different name in our base classes. Fixed the
9753 error reporting (no indexers at all, not get accessor, no
9754 overloaded match). Fixes bug #33089.
9755 (IndexerAccess.DoResolveLValue): Likewise.
9757 2002-11-14 Martin Baulig <martin@ximian.com>
9759 * class.cs (PropertyBase.CheckBase): Make this work for multiple
9760 indexers. Fixes the first part of bug #33089.
9761 (MethodSignature.InheritableMemberSignatureCompare): Added support
9764 2002-11-13 Ravi Pratap <ravi@ximian.com>
9766 * attribute.cs (Attribute.Resolve): Catch the
9767 NullReferenceException and report it since it isn't supposed to
9770 2002-11-12 Miguel de Icaza <miguel@ximian.com>
9772 * expression.cs (Binary.EmitBranchable): Also handle the cases for
9773 LogicalOr and LogicalAnd that can benefit from recursively
9774 handling EmitBranchable. The code now should be nice for Paolo.
9776 2002-11-08 Miguel de Icaza <miguel@ximian.com>
9778 * typemanager.cs (LookupType): Added a negative-hit hashtable for
9779 the Type lookups, as we perform quite a number of lookups on
9780 non-Types. This can be removed once we can deterministically tell
9781 whether we have a type or a namespace in advance.
9783 But this might require special hacks from our corlib.
9787 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
9788 and double which avoids a conversion from an integer to a double.
9790 * expression.cs: tiny optimization, avoid calling IsConstant,
9791 because it effectively performs the lookup twice.
9793 2002-11-06 Miguel de Icaza <miguel@ximian.com>
9795 But a bogus return here to keep the semantics of the old code
9796 until the Mono runtime is fixed.
9798 * pending.cs (GetMissingInterfaces): New method used to remove all
9799 the interfaces that are already implemented by our parent
9800 classes from the list of pending methods.
9802 * interface.cs: Add checks for calls after ResolveTypeExpr.
9804 2002-11-05 Miguel de Icaza <miguel@ximian.com>
9806 * class.cs (Class.Emit): Report warning 67: event not used if the
9807 warning level is beyond 3.
9809 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
9810 being a NullLiteral.
9812 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
9815 * class.cs (TypeContainer.GetClassBases): Cover a missing code
9816 path that might fail if a type can not be resolved.
9818 * expression.cs (Binary.Emit): Emit unsigned versions of the
9821 * driver.cs: use error 5.
9823 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
9825 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
9827 2002-11-01 Miguel de Icaza <miguel@ximian.com>
9829 * cs-parser.jay (switch_section): A beautiful patch from Martin
9830 Baulig that fixed 33094.
9832 2002-10-31 Miguel de Icaza <miguel@ximian.com>
9834 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
9835 Check whether the base is abstract and report an error if so.
9837 * expression.cs (IndexerAccess.DoResolveLValue,
9838 IndexerAccess.DoResolve): ditto.
9840 (Invocation.DoResolve): ditto.
9842 (Invocation.FullMethodDesc): Improve the report string.
9844 * statement.cs (Block): Eliminate IsVariableDefined as it is
9845 basically just a wrapper for GetVariableInfo.
9847 * ecore.cs (SimpleName): Use new
9849 * support.cs (ReflectionParamter.ParameterType): We unwrap the
9850 type, as we return the actual parameter ref/unref state on a
9853 2002-10-30 Miguel de Icaza <miguel@ximian.com>
9855 * support.cs: Return proper flags REF/OUT fixing the previous
9858 * expression.cs: Reverted last patch, that was wrong. Is_ref is
9859 not used to mean `ref' but `ref or out' in ParameterReference
9861 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
9862 full type signature instead of calling TypeManger.CSharpName
9865 * support.cs (InternalParameters.ParameterDesc): Do not compare
9866 directly to the modflags, because REF/OUT will actually be bitsets
9869 * delegate.cs (VerifyMethod): Check also the modifiers.
9871 * cs-tokenizer.cs: Fix bug where floating point values with an
9872 exponent where a sign was missing was ignored.
9874 * driver.cs: Allow multiple assemblies to be specified in a single
9877 2002-10-28 Miguel de Icaza <miguel@ximian.com>
9879 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
9880 because identifiers after a parenthesis would end up in this kind
9881 of production, and we needed to desamiguate it for having casts
9884 (UserDefinedType *) xxx
9886 2002-10-24 Miguel de Icaza <miguel@ximian.com>
9888 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
9889 we should set on the Bindingflags.NonPublic, but not turn on
9890 private_ok. private_ok controls whether a Private member is
9891 returned (this is chekced on the filter routine), while the
9892 BindingFlags.NonPublic just controls whether private/protected
9893 will be allowed. This fixes the problem part of the problem of
9894 private properties being allowed to be used in derived classes.
9896 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
9897 so we can call the children DoResolveLValue method (this will
9898 properly signal errors on lvalue assignments to base properties)
9900 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
9901 getter are null, and we have a property info, we know that this
9902 happened because the lookup failed, so we report an error 122 for
9903 protection level violation.
9905 We also silently return if setter and getter are null in the
9906 resolve functions, this condition only happens if we have flagged
9907 the error before. This is the other half of the problem.
9909 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
9910 not have accessibility information, that is why we were returning
9911 true in the filter function in typemanager.cs.
9913 To properly report 122 (property is inaccessible because of its
9914 protection level) correctly, we report this error in ResolveAccess
9915 by failing if both the setter and the getter are lacking (ie, the
9918 DoResolve and DoLResolve have been modified to check for both
9919 setter/getter being null and returning silently, the reason being
9920 that I did not want to put the knowledge about this error in upper
9923 int old = Report.Errors;
9924 x = new PropertyExpr (...);
9925 if (old != Report.Errors)
9930 So the property expr is returned, but it is invalid, so the error
9931 will be flagged during the resolve process.
9933 * class.cs: Remove InheritablePropertySignatureCompare from the
9934 class, as we no longer depend on the property signature to compute
9935 whether it is possible to implement a method or not.
9937 The reason is that calling PropertyInfo.GetGetMethod will return
9938 null (in .NET, in Mono it works, and we should change this), in
9939 cases where the Get Method does not exist in that particular
9944 class X { public virtual int A { get { return 1; } } }
9946 class Z : Y { public override int A { get { return 2; } } }
9948 Would fail in Z because the parent (Y) would not have the property
9949 defined. So we avoid this completely now (because the alternative
9950 fix was ugly and slow), and we now depend exclusively on the
9953 (PropertyBase.CheckBase): Use a method-base mechanism to find our
9954 reference method, instead of using the property.
9956 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
9957 routines are gone now.
9959 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
9960 names, they were incorrectly named.
9962 * cs-tokenizer.cs: Return are more gentle token on failure.
9964 * pending.cs (PendingImplementation.InterfaceMethod): This routine
9965 had an out-of-sync index variable, which caused it to remove from
9966 the list of pending methods the wrong method sometimes.
9968 2002-10-22 Miguel de Icaza <miguel@ximian.com>
9970 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
9971 CanWrite, because those refer to this particular instance of the
9972 property, and do not take into account the fact that we can
9973 override single members of a property.
9975 Constructor requires an EmitContext. The resolution process does
9976 not happen here, but we need to compute the accessors before,
9977 because the resolution does not always happen for properties.
9979 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
9980 subclass, before we did not update this flag, but we did update
9983 (GetAccessors): Drop this routine, as it did not work in the
9984 presence of partially overwritten set/get methods.
9986 Notice that this broke the cs1540 detection, but that will require
9989 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9993 * driver.cs: issue a warning instead of an error if we don't support
9994 debugging for the platform. Also ignore a couple of errors that may
9995 arise when trying to write the symbols. Undo my previous patch.
9997 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9999 * driver.cs: ignore /debug switch except for Unix platforms.
10001 2002-10-23 Nick Drochak <ndrochak@gol.com>
10003 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
10005 2002-10-21 Miguel de Icaza <miguel@ximian.com>
10007 * driver.cs: Do not make mcs-debug conditional, so we do not break
10008 builds that use it.
10010 * statement.cs (UsageVector.MergeChildren): I would like Martin to
10011 review this patch. But basically after all the children variables
10012 have been merged, the value of "Breaks" was not being set to
10013 new_breaks for Switch blocks. I think that it should be set after
10014 it has executed. Currently I set this to the value of new_breaks,
10015 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
10016 conservative, but I do not understand this code very well.
10018 I did not break anything in the build, so that is good ;-)
10020 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
10022 2002-10-20 Mark Crichton <crichton@gimp.org>
10024 * cfold.cs: Fixed compile blocker. Really fixed it this time.
10026 2002-10-20 Nick Drochak <ndrochak@gol.com>
10028 * cfold.cs: Fixed compile blocker.
10030 2002-10-20 Miguel de Icaza <miguel@ximian.com>
10032 * driver.cs: I was chekcing the key, not the file.
10034 2002-10-19 Ravi Pratap <ravi@ximian.com>
10036 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
10037 message that we were generating - we just need to silently return
10040 2002-10-19 Miguel de Icaza <miguel@ximian.com>
10042 * class.cs (Event.Define): Change my previous commit, as this
10043 breaks the debugger. This is a temporary hack, as it seems like
10044 the compiler is generating events incorrectly to begin with.
10046 * expression.cs (Binary.ResolveOperator): Added support for
10047 "U operator - (E x, E y)"
10049 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
10052 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
10053 init-only variables, but this path did not take into account that
10054 there might be also instance readonly variables. Correct this
10057 This fixes bug 32253
10059 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
10062 * driver.cs: Change the extension for modules to `netmodule'
10064 * cs-parser.jay: Improved slightly the location tracking for
10065 the debugger symbols.
10067 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
10068 modifiers that were specified instead of the hardcoded value
10069 (FamAndAssem). This was basically ignoring the static modifier,
10070 and others. Fixes 32429.
10072 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
10073 fixed a bug in the process (32476)
10075 * expression.cs (ArrayAccess.EmitAssign): Patch from
10076 hwang_rob@yahoo.ca that fixes bug 31834.3
10078 2002-10-18 Miguel de Icaza <miguel@ximian.com>
10080 * driver.cs: Make the module extension .netmodule.
10082 2002-10-16 Miguel de Icaza <miguel@ximian.com>
10084 * driver.cs: Report an error if the resource file is not found
10085 instead of crashing.
10087 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
10088 false, like Emit does.
10090 2002-10-16 Nick Drochak <ndrochak@gol.com>
10092 * typemanager.cs: Remove unused private member. Also reported mcs
10093 bug to report this as a warning like csc.
10095 2002-10-15 Martin Baulig <martin@gnome.org>
10097 * statement.cs (Statement.Emit): Made this a virtual method; emits
10098 the line number info and calls DoEmit().
10099 (Statement.DoEmit): New protected abstract method, formerly knows
10100 as Statement.Emit().
10102 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
10104 2002-10-11 Miguel de Icaza <miguel@ximian.com>
10106 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
10107 have fixed a remaining problem: not every AddXXXX was adding a
10108 fully qualified name.
10110 Now everyone registers a fully qualified name in the DeclSpace as
10111 being defined instead of the partial name.
10113 Downsides: we are slower than we need to be due to the excess
10114 copies and the names being registered this way.
10116 The reason for this is that we currently depend (on the corlib
10117 bootstrap for instance) that types are fully qualified, because
10118 we dump all the types in the namespace, and we should really have
10119 types inserted into the proper namespace, so we can only store the
10120 basenames in the defined_names array.
10122 2002-10-10 Martin Baulig <martin@gnome.org>
10124 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
10125 from bug #31834, see the bug report for a testcase which is
10128 2002-10-10 Martin Baulig <martin@gnome.org>
10130 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
10131 flow analysis code for this.
10133 * statement.cs (Do, While, For): Tell the flow analysis code about
10135 (FlowBranching.UsageVector): Added support for infinite loops.
10136 (Block.Resolve): Moved the dead code elimination here and use flow
10139 2002-10-09 Miguel de Icaza <miguel@ximian.com>
10141 * class.cs (Field.Define): Catch cycles on struct type
10144 * typemanager.cs (IsUnmanagedtype): Do not recursively check
10145 fields if the fields are static. We only need to check instance
10148 * expression.cs (As.DoResolve): Test for reference type.
10150 * statement.cs (Using.ResolveExpression): Use
10151 ConvertImplicitRequired, not ConvertImplicit which reports an
10153 (Using.ResolveLocalVariableDecls): ditto.
10155 * expression.cs (Binary.ResolveOperator): Report errors in a few
10156 places where we had to.
10158 * typemanager.cs (IsUnmanagedtype): Finish implementation.
10160 2002-10-08 Miguel de Icaza <miguel@ximian.com>
10162 * expression.cs: Use StoreFromPtr instead of extracting the type
10163 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
10165 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
10166 an enumeration value to a System.Enum, but System.Enum is not a
10167 value type, but an class type, so we need to box.
10169 (Expression.ConvertExplicit): One codepath could return
10170 errors but not flag them. Fix this. Fixes #31853
10172 * parameter.cs (Resolve): Do not allow void as a parameter type.
10174 2002-10-06 Martin Baulig <martin@gnome.org>
10176 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
10177 if it's a class type and not a struct. Fixes #31815.
10179 2002-10-06 Martin Baulig <martin@gnome.org>
10181 * statement.cs: Reworked the flow analysis code a bit to make it
10182 usable for dead code elimination.
10184 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10186 * cs-parser.jay: allow empty source files. Fixes bug #31781.
10188 2002-10-04 Miguel de Icaza <miguel@ximian.com>
10190 * expression.cs (ComposedCast.DoResolveType): A quick workaround
10191 to fix the test 165, will investigate deeper.
10193 2002-10-04 Martin Baulig <martin@gnome.org>
10195 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
10196 finally blocks actually work.
10197 (Try.Resolve): We don't need to create a sibling for `finally' if
10198 there is no finally block.
10200 2002-10-04 Martin Baulig <martin@gnome.org>
10202 * class.cs (Constructor.Define): The default accessibility for a
10203 non-default constructor is private, not public.
10205 2002-10-04 Miguel de Icaza <miguel@ximian.com>
10207 * class.cs (Constructor): Make AllowedModifiers public, add
10210 * cs-parser.jay: Perform the modifiers test here, as the
10211 constructor for the Constructor class usually receives a zero
10212 because of the way we create it (first we create, later we
10213 customize, and we were never checking the modifiers).
10215 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
10216 is a version of LookupTypeReflection that includes the type-name
10217 cache. This can be used as a fast path for functions that know
10218 the fully qualified name and are only calling into *.GetType() to
10219 obtain a composed type.
10221 This is also used by TypeManager.LookupType during its type
10224 (LookupType): We now also track the real type name, as sometimes
10225 we can get a quey for the real type name from things like
10226 ComposedCast. This fixes bug 31422.
10228 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
10229 complete type fullname, it does not have to go through the type
10230 resolution system to obtain the composed version of the type (for
10231 obtaining arrays or pointers).
10233 (Conditional.Emit): Use the EmitBoolExpression to
10234 generate nicer code, as requested by Paolo.
10236 (ArrayCreation.CheckIndices): Use the patch from
10237 hwang_rob@yahoo.ca to validate the array initializers.
10239 2002-10-03 Miguel de Icaza <miguel@ximian.com>
10241 * class.cs (ConstructorInitializer.Emit): simplify code by using
10242 Invocation.EmitCall, and at the same time, fix the bugs in calling
10243 parent constructors that took variable arguments.
10245 * ecore.cs (Expression.ConvertNumericExplicit,
10246 Expression.ImplicitNumericConversion): Remove the code that
10247 manually wrapped decimal (InternalTypeConstructor call is now gone
10250 * expression.cs (Cast.TryReduce): Also handle decimal types when
10251 trying to perform a constant fold on the type.
10253 * typemanager.cs (IsUnmanagedtype): Partially implemented.
10255 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
10256 that only turned off an error report, and did nothing else.
10258 2002-10-02 Miguel de Icaza <miguel@ximian.com>
10260 * driver.cs: Handle and ignore /fullpaths
10262 2002-10-01 Miguel de Icaza <miguel@ximian.com>
10264 * expression.cs (Binary.ResolveOperator): Catch the case where
10265 DoNumericPromotions returns true,
10267 (Binary.DoNumericPromotions): Simplify the code, and the tests.
10269 2002-09-27 Miguel de Icaza <miguel@ximian.com>
10271 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
10274 2002-09-26 Miguel de Icaza <miguel@ximian.com>
10276 * ecore.cs (ConvertNumericExplicit): It is not enough that the
10277 conversion exists, but it is also required that the conversion be
10278 performed. This manifested in "(Type64Enum) 2".
10280 * class.cs (TypeManager.AddMethod): The fix is not to change
10281 AddEnum, because that one was using a fully qualified name (every
10282 DeclSpace derivative does), but to change the AddMethod routine
10283 that was using an un-namespaced name. This now correctly reports
10284 the duplicated name.
10286 Revert patch until I can properly fix it. The issue
10287 is that we have a shared Type space across all namespaces
10288 currently, which is wrong.
10290 Options include making the Namespace a DeclSpace, and merge
10291 current_namespace/current_container in the parser.
10293 2002-09-25 Miguel de Icaza <miguel@ximian.com>
10295 * cs-parser.jay: Improve error reporting when we get a different
10296 kind of expression in local_variable_type and
10297 local_variable_pointer_type.
10299 Propagate this to avoid missleading errors being reported.
10301 * ecore.cs (ImplicitReferenceConversion): treat
10302 TypeManager.value_type as a target just like object_type. As
10307 Is valid, and needs to result in the int 1 being boxed before it
10308 is assigned to the value type v.
10310 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
10311 to validate the enumeration name.
10313 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
10314 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
10315 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
10317 * ecore.cs (TryImplicitIntConversion): When doing an
10318 implicit-enumeration-conversion, check if the type is 64-bits and
10319 perform a conversion before passing to EnumConstant.
10321 2002-09-23 Miguel de Icaza <miguel@ximian.com>
10323 * decl.cs (Error_AmbiguousTypeReference); New routine used to
10324 report ambiguous type references. Unlike the MS version, we
10325 report what the ambiguity is. Innovation at work ;-)
10327 (DeclSpace.FindType): Require a location argument to
10328 display when we display an ambiguous error.
10330 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
10332 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
10334 * expression.cs (EmitDynamicInitializers): Apply patch from
10335 hwang_rob@yahoo.ca that fixes the order in which we emit our
10338 2002-09-21 Martin Baulig <martin@gnome.org>
10340 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
10341 delegate takes no arguments.
10343 2002-09-20 Miguel de Icaza <miguel@ximian.com>
10345 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
10348 * expression.cs: Extract the underlying type.
10350 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
10352 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
10354 2002-09-19 Miguel de Icaza <miguel@ximian.com>
10356 * class.cs (TypeContainer.DefineType): We can not use the nice
10357 PackingSize with the size set to 1 DefineType method, because it
10358 will not allow us to define the interfaces that the struct
10361 This completes the fixing of bug 27287
10363 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
10364 means also structs. This fixes part of the problem.
10365 (Expresion.ImplicitReferenceConversionExists): ditto.
10367 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
10368 error if there were no errors reported during the type lookup
10369 process, to avoid duplicates or redundant errors. Without this
10370 you would get an ambiguous errors plus a type not found. We have
10371 beaten the user enough with the first error.
10373 (DeclSparce.FindType): Emit a warning if we have an ambiguous
10376 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
10377 during the resolution process, stop the lookup, this avoids
10378 repeated error reports (same error twice).
10380 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
10382 * typemanager.cs (LookupType): Redo the type lookup code to match
10383 the needs of System.Reflection.
10385 The issue is that System.Reflection requires references to nested
10386 types to begin with a "+" sign instead of a dot. So toplevel
10387 types look like: "NameSpace.TopLevelClass", and nested ones look
10388 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
10391 2002-09-19 Martin Baulig <martin@gnome.org>
10393 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
10394 says that a method always returns or always throws an exception,
10395 don't report the CS0161.
10397 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
10398 set `Returns = new_returns'.
10400 2002-09-19 Martin Baulig <martin@gnome.org>
10402 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
10403 to an enum constant, check for a CS0176.
10405 2002-09-18 Miguel de Icaza <miguel@ximian.com>
10407 * class.cs (TypeContainer.CheckPairedOperators): Now we check
10408 for operators that must be in pairs and report errors.
10410 * ecore.cs (SimpleName.DoResolveType): During the initial type
10411 resolution process, when we define types recursively, we must
10412 check first for types in our current scope before we perform
10413 lookups in the enclosing scopes.
10415 * expression.cs (MakeByteBlob): Handle Decimal blobs.
10417 (Invocation.VerifyArgumentsCompat): Call
10418 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
10419 I thought we were supposed to always call this, but there are a
10420 few places in the code where we dont do it.
10422 2002-09-17 Miguel de Icaza <miguel@ximian.com>
10424 * driver.cs: Add support in -linkres and -resource to specify the
10425 name of the identifier.
10427 2002-09-16 Miguel de Icaza <miguel@ximian.com>
10429 * ecore.cs (StandardConversionExists): Sync with the conversion
10430 code: allow anything-* to void* conversions.
10432 (FindMostSpecificSource): Use an Expression argument
10433 instead of a Type, because we might be handed over a Literal which
10434 gets a few more implicit conversions that plain types do not. So
10435 this information was being lost.
10437 Also, we drop the temporary type-holder expression when not
10440 2002-09-17 Martin Baulig <martin@gnome.org>
10442 * class.cs (PropertyBase.CheckBase): Don't check the base class if
10443 this is an explicit interface implementation.
10445 2002-09-17 Martin Baulig <martin@gnome.org>
10447 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
10448 different `IndexerName' attributes.
10450 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
10451 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
10452 virtual CommonResolve().
10454 2002-09-16 Miguel de Icaza <miguel@ximian.com>
10456 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
10457 and convert that to the UnderlyingType.
10459 * statement.cs (Foreach.Resolve): Indexers are just like variables
10460 or PropertyAccesses.
10462 * cs-tokenizer.cs (consume_string): Track line numbers and columns
10463 inside quoted strings, we were not doing this before.
10465 2002-09-16 Martin Baulig <martin@gnome.org>
10467 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
10468 resolve it. This is needed for the definite assignment check of the
10469 instance expression, fixes bug #29846.
10470 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
10472 2002-09-16 Nick Drochak <ndrochak@gol.com>
10474 * parameter.cs: Fix compile error. Cannot reference static member
10475 from an instance object. Is this an mcs bug?
10477 2002-09-14 Martin Baulig <martin@gnome.org>
10479 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
10480 multiple times. Fixes bug #30295, added test-166.cs.
10482 2002-09-14 Martin Baulig <martin@gnome.org>
10484 * statement.cs (Block.Emit): Don't emit unreachable code.
10485 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
10486 `break' statements.
10487 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
10489 2002-09-14 Martin Baulig <martin@gnome.org>
10491 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
10494 2002-09-14 Martin Baulig <martin@gnome.org>
10496 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
10497 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
10498 be false on the ms runtime.
10500 2002-09-13 Martin Baulig <martin@gnome.org>
10502 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
10503 the CS0038 error message.
10505 2002-09-12 Miguel de Icaza <miguel@ximian.com>
10507 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
10508 constant inside, return it.
10510 2002-09-12 Martin Baulig <martin@gnome.org>
10512 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
10513 implicit conversion can be done between enum types.
10515 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
10516 check whether an implicit conversion to the current enum's UnderlyingType
10517 exists and report an error if not.
10519 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
10520 without debugging support.
10522 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
10523 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
10525 2002-09-12 Martin Baulig <martin@gnome.org>
10527 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
10529 * ecore.cs (IMemberExpr.DeclaringType): New property.
10530 (SimpleName.SimpleNameResolve): Check whether we're accessing a
10531 nonstatic member of an outer type (CS0038).
10533 2002-09-11 Miguel de Icaza <miguel@ximian.com>
10535 * driver.cs: Activate the using-error detector at warning level
10536 4 (at least for MS-compatible APIs).
10538 * namespace.cs (VerifyUsing): Small buglett fix.
10540 * pending.cs (PendingImplementation): pass the container pointer.
10542 * interface.cs (GetMethods): Allow for recursive definition. Long
10543 term, I would like to move every type to support recursive
10544 definitions, not the current ordering mechanism that we have right
10547 The situation is this: Attributes are handled before interfaces,
10548 so we can apply attributes to interfaces. But some attributes
10549 implement interfaces, we will now handle the simple cases
10550 (recursive definitions will just get an error).
10552 * parameter.cs: Only invalidate types at the end if we fail to
10555 2002-09-09 Martin Baulig <martin@gnome.org>
10557 * ecore.cs (PropertyExpr.Emit): Also check for
10558 TypeManager.system_int_array_get_length so this'll also work when
10559 compiling corlib. Fixes #30003.
10561 2002-09-09 Martin Baulig <martin@gnome.org>
10563 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
10564 and throw an exception if we can't get the type's size. Fixed #30040,
10567 2002-09-09 Martin Baulig <martin@gnome.org>
10569 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
10571 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
10572 context. Fixes bug #30027.
10574 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
10575 virtual functions. Fixes bug #30043, added test-164.cs.
10577 2002-09-08 Ravi Pratap <ravi@ximian.com>
10579 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
10581 2002-09-08 Nick Drochak <ndrochak@gol.com>
10583 * driver.cs: Use an object to get the windows codepage since it's not a
10586 2002-09-08 Miguel de Icaza <miguel@ximian.com>
10588 * statement.cs (For.Emit): for infinite loops (test == null)
10589 return whether there is a break inside, not always "true".
10591 * namespace.cs (UsingEntry): New struct to hold the name of the
10592 using definition, the location where it is defined, and whether it
10593 has been used in a successful type lookup.
10595 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
10600 2002-09-06 Ravi Pratap <ravi@ximian.com>
10602 * attribute.cs : Fix incorrect code which relied on catching
10603 a NullReferenceException to detect a null being passed in
10604 where an object was expected.
10606 2002-09-06 Miguel de Icaza <miguel@ximian.com>
10608 * statement.cs (Try): flag the catch variable as assigned
10610 * expression.cs (Cast): Simplified by using ResolveType instead of
10611 manually resolving.
10613 * statement.cs (Catch): Fix bug by using ResolveType.
10615 2002-09-06 Ravi Pratap <ravi@ximian.com>
10617 * expression.cs (BetterConversion): Special case for when we have
10618 a NullLiteral as the argument and we have to choose between string
10619 and object types - we choose string the way csc does.
10621 * attribute.cs (Attribute.Resolve): Catch the
10622 NullReferenceException and report error #182 since the Mono
10623 runtime no more has the bug and having this exception raised means
10624 we tried to select a constructor which takes an object and is
10627 2002-09-05 Ravi Pratap <ravi@ximian.com>
10629 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
10630 message (1502, 1503) when we can't locate a method after overload
10631 resolution. This is much more informative and closes the bug
10634 * interface.cs (PopulateMethod): Return if there are no argument
10635 types. Fixes a NullReferenceException bug.
10637 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
10638 expressions too. Previously we were checking only in one place for
10639 positional arguments leaving out named arguments.
10641 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
10642 type to the enum type is not allowed. Remove code corresponding to
10645 (ConvertNumericExplicit): Allow explicit conversions from
10646 the underlying type to enum type. This precisely follows the spec
10647 and closes a bug filed by Gonzalo.
10649 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10652 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
10654 2002-09-03 Miguel de Icaza <miguel@ximian.com>
10656 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
10657 it was important that we stored the right value after the
10658 reduction in `converted'.
10660 2002-09-04 Martin Baulig <martin@gnome.org>
10662 * location.cs (Location.SymbolDocument): Use full pathnames for the
10665 2002-08-30 Miguel de Icaza <miguel@ximian.com>
10667 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
10668 of the expression resolve mechanism, because that will catch the
10669 SimpleName error failures.
10671 (Conditional): If we can not resolve the
10672 expression, return, do not crash.
10674 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10677 (location): display token name instead of its number.
10679 2002-08-28 Martin Baulig <martin@gnome.org>
10681 * expression.cs (Binary.ResolveOperator): Don't silently return
10682 but return an error if an operator cannot be applied between two
10685 2002-08-28 Martin Baulig <martin@gnome.org>
10687 * class.cs (Constructor.Define): Set the permission attributes
10688 correctly instead of making all constructors public.
10690 2002-08-28 Martin Baulig <martin@gnome.org>
10692 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
10693 for private members before reporting a CS0103; if we find anything,
10696 2002-08-28 Martin Baulig <martin@gnome.org>
10698 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
10699 to check whether `closure_start_type == closure_invocation_type',
10700 we also need to check whether `m.DeclaringType == closure_invocation_type'
10701 before bypassing the permission checks. We might be accessing
10702 protected/private members from the base class.
10703 (TypeManager.RealMemberLookup): Only set private_ok if private
10704 members were requested via BindingFlags.NonPublic.
10706 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
10708 * expression.cs (MemberAccess.ResolveMemberAccess): Set
10709 MethodGroupExpr.IsExplicitImpl if appropriate.
10710 (Invocation.DoResolve): Don't report the CS0120 for explicit
10711 interface implementations.
10713 2002-08-27 Martin Baulig <martin@gnome.org>
10715 * expression.cs (Invocation.DoResolve): If this is a static
10716 method and we don't have an InstanceExpression, we must report
10719 2002-08-25 Martin Baulig <martin@gnome.org>
10721 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
10722 `==' between a valuetype and an object.
10724 2002-08-25 Miguel de Icaza <miguel@ximian.com>
10726 * ecore.cs (TypeExpr): Provide a ToString method.
10728 2002-08-24 Martin Baulig <martin@gnome.org>
10730 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
10731 now called proggie.dbg and it's a binary file.
10733 2002-08-23 Martin Baulig <martin@gnome.org>
10735 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
10737 2002-08-23 Martin Baulig <martin@gnome.org>
10739 * struct.cs (MyStructInfo.ctor): Make this work with empty
10740 structs; it's not allowed to use foreach() on null.
10742 2002-08-23 Martin Baulig <martin@gnome.org>
10744 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
10745 writer the full pathname of the generated assembly.
10747 2002-08-23 Martin Baulig <martin@gnome.org>
10749 * statements.cs (FlowBranching.UsageVector.MergeChildren):
10750 A `finally' block never returns or breaks; improved handling of
10753 2002-08-23 Martin Baulig <martin@gnome.org>
10755 * statement.cs (Throw.Resolve): Allow `throw null'.
10757 2002-08-23 Martin Baulig <martin@gnome.org>
10759 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
10760 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
10761 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
10762 MemberLookup would return a wrong event if this is an explicit
10763 interface implementation and the class has an event with the same
10766 2002-08-23 Martin Baulig <martin@gnome.org>
10768 * statement.cs (Block.AddChildVariableNames): New public method.
10769 (Block.AddChildVariableName): Likewise.
10770 (Block.IsVariableNameUsedInChildBlock): Likewise.
10771 (Block.AddVariable): Check whether a variable name has already
10772 been used in a child block.
10774 * cs-parser.jay (declare_local_variables): Mark all variable names
10775 from the current block as being used in a child block in the
10778 2002-08-23 Martin Baulig <martin@gnome.org>
10780 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
10781 find the symbol writer.
10783 * driver.cs: csc also allows the arguments to /define being
10784 separated by commas, not only by semicolons.
10786 2002-08-23 Martin Baulig <martin@gnome.org>
10788 * interface.cs (Interface.GetMembers): Added static check for events.
10790 2002-08-15 Martin Baulig <martin@gnome.org>
10792 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
10793 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
10795 * ecore.cs (Expression.MemberLookup): Added documentation and explained
10796 why the MethodData.EmitDestructor() change was necessary.
10798 2002-08-20 Martin Baulig <martin@gnome.org>
10800 * class.cs (TypeContainer.FindMembers): Added static check for events.
10802 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
10804 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
10805 use Type.GetEvents(), not Type.FindMembers().
10807 2002-08-20 Martin Baulig <martin@gnome.org>
10809 * decl.cs (MemberCache): Added a special method cache which will
10810 be used for method-only searched. This ensures that a method
10811 search will return a MethodInfo with the correct ReflectedType for
10814 2002-08-20 Martin Baulig <martin@gnome.org>
10816 * decl.cs (DeclSpace.FindMembers): Made this public.
10818 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10820 * delegate.cs: fixed build on windows.
10821 [FIXME: Filed as bug #29150: MCS must report these errors.]
10823 2002-08-19 Ravi Pratap <ravi@ximian.com>
10825 * ecore.cs (StandardConversionExists): Return a false
10826 if we are trying to convert the void type to anything else
10827 since that is not allowed.
10829 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
10830 we flag error 70 in the event an event is trying to be accessed
10831 directly from outside the declaring type.
10833 2002-08-20 Martin Baulig <martin@gnome.org>
10835 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
10836 MemberCache from typemanager.cs to decl.cs.
10838 2002-08-19 Martin Baulig <martin@gnome.org>
10840 * class.cs (TypeContainer): Implement IMemberContainer.
10841 (TypeContainer.DefineMembers): Create the MemberCache.
10842 (TypeContainer.FindMembers): Do better BindingFlags checking; only
10843 return public members if BindingFlags.Public was given, check
10844 whether members are static.
10846 2002-08-16 Martin Baulig <martin@gnome.org>
10848 * decl.cs (DeclSpace.Define): Splitted this in Define and
10849 DefineMembers. DefineMembers is called first and initializes the
10852 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
10853 DefineMembers() on all our DeclSpaces.
10855 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
10856 but call DefineMembers() on all nested interfaces. We call their
10857 Define() in our new Define() function.
10859 * interface.cs (Interface): Implement IMemberContainer.
10860 (Interface.Define): Moved all code except the attribute stuf to
10862 (Interface.DefineMembers): Initialize the member cache.
10864 * typemanager.cs (IMemberFinder): Removed this interface, we don't
10865 need this anymore since we can use MemberCache.FindMembers directly.
10867 2002-08-19 Martin Baulig <martin@gnome.org>
10869 * typemanager.cs (MemberCache): When creating the cache for an
10870 interface type, add all inherited members.
10871 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
10872 to `out bool used_cache' and documented it.
10873 (TypeManager.MemberLookup): If we already used the cache in the first
10874 iteration, we don't need to do the interfaces check.
10876 2002-08-19 Martin Baulig <martin@gnome.org>
10878 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
10879 here from IMemberFinder and don't implement this interface anymore.
10880 (DeclSpace.MemberCache): Moved here from IMemberFinder.
10882 * typemanager.cs (IMemberFinder): This interface is now only used by
10883 classes which actually support the member cache.
10884 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
10885 since we only put DeclSpaces into this Hashtable.
10886 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
10887 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
10889 2002-08-16 Martin Baulig <martin@gnome.org>
10891 * typemanager.cs (ICachingMemberFinder): Removed.
10892 (IMemberFinder.MemberCache): New property.
10893 (TypeManager.FindMembers): Merged this with RealFindMembers().
10894 This function will never be called from TypeManager.MemberLookup()
10895 so we can't use the cache here, just the IMemberFinder.
10896 (TypeManager.MemberLookup_FindMembers): Check whether the
10897 IMemberFinder has a MemberCache and call the cache's FindMembers
10899 (MemberCache): Rewrote larger parts of this yet another time and
10900 cleaned it up a bit.
10902 2002-08-15 Miguel de Icaza <miguel@ximian.com>
10904 * driver.cs (LoadArgs): Support quoting.
10906 (Usage): Show the CSC-like command line arguments.
10908 Improved a few error messages.
10910 2002-08-15 Martin Baulig <martin@gnome.org>
10912 * typemanager.cs (IMemberContainer.Type): New property.
10913 (IMemberContainer.IsInterface): New property.
10915 The following changes are conditional to BROKEN_RUNTIME, which is
10916 defined at the top of the file.
10918 * typemanager.cs (MemberCache.MemberCache): Don't add the base
10919 class'es members, but add all members from TypeHandle.ObjectType
10920 if we're an interface.
10921 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
10922 is the current type.
10923 (MemberCache.CacheEntry.Container): Removed this field.
10924 (TypeHandle.GetMembers): Include inherited members.
10926 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10928 * typemanager.cs: fixed compilation and added a comment on a field that
10931 2002-08-15 Martin Baulig <martin@gnome.org>
10933 * class.cs (ConstructorInitializer.Resolve): In the
10934 Expression.MemberLookup call, use the queried_type as
10937 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
10938 declared' attribute, it's always true.
10939 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
10940 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
10941 temporary wrapper for FindMembers which tells MemberLookup whether
10942 members from the base classes are included in the return value.
10943 This will go away soon.
10944 (TypeManager.MemberLookup): Use this temporary hack here; once the
10945 new MemberCache is completed, we don't need to do the DeclaredOnly
10946 looping here anymore since the MemberCache will take care of this.
10947 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
10948 (MemberCache): When creating the MemberCache for a class, get
10949 members from the current class and all its base classes.
10950 (MemberCache.CacheEntry.Container): New field. This is a
10951 temporary hack until the Mono runtime is fixed to distinguish
10952 between ReflectedType and DeclaringType. It allows us to use MCS
10953 with both the MS runtime and the unfixed Mono runtime without
10954 problems and without accecting performance.
10955 (MemberCache.SearchMembers): The DeclaredOnly looping from
10956 TypeManager.MemberLookup is now done here.
10958 2002-08-14 Martin Baulig <martin@gnome.org>
10960 * statement.cs (MyStructInfo.MyStructInfo): Don't call
10961 Type.GetFields on dynamic types but get the fields from the
10962 corresponding TypeContainer.
10963 (MyStructInfo.GetStructInfo): Added check for enum types.
10965 * typemanager.cs (MemberList.IsSynchronized): Implemented.
10966 (MemberList.SyncRoot): Implemented.
10967 (TypeManager.FilterWithClosure): No need to check permissions if
10968 closure_start_type == closure_invocation_type, don't crash if
10969 closure_invocation_type is null.
10971 2002-08-13 Martin Baulig <martin@gnome.org>
10973 Rewrote TypeContainer.FindMembers to use a member cache. This
10974 gives us a speed increase of about 35% for the self-hosting MCS
10975 build and of about 15-20% for the class libs (both on GNU/Linux).
10977 * report.cs (Timer): New class to get enhanced profiling. This
10978 whole class is "TIMER" conditional since it remarkably slows down
10981 * class.cs (MemberList): New class. This is an IList wrapper
10982 which we're now using instead of passing MemberInfo[]'s around to
10983 avoid copying this array unnecessarily.
10984 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
10985 (ICachingMemberFinder, IMemberContainer): New interface.
10986 (TypeManager.FilterWithClosure): If `criteria' is null, the name
10987 has already been checked, otherwise use it for the name comparision.
10988 (TypeManager.FindMembers): Renamed to RealMemberFinder and
10989 provided wrapper which tries to use ICachingMemberFinder.FindMembers
10990 if possible. Returns a MemberList, not a MemberInfo [].
10991 (TypeHandle): New class, implements IMemberContainer. We create
10992 one instance of this class per type, it contains a MemberCache
10993 which is used to do the member lookups.
10994 (MemberCache): New class. Each instance of this class contains
10995 all members of a type and a name-based hash table.
10996 (MemberCache.FindMembers): This is our new member lookup
10997 function. First, it looks up all members of the requested name in
10998 the hash table. Then, it walks this list and sorts out all
10999 applicable members and returns them.
11001 2002-08-13 Martin Baulig <martin@gnome.org>
11003 In addition to a nice code cleanup, this gives us a performance
11004 increase of about 1.4% on GNU/Linux - not much, but it's already
11005 half a second for the self-hosting MCS compilation.
11007 * typemanager.cs (IMemberFinder): New interface. It is used by
11008 TypeManager.FindMembers to call FindMembers on a TypeContainer,
11009 Enum, Delegate or Interface.
11010 (TypeManager.finder_to_member_finder): New PtrHashtable.
11011 (TypeManager.finder_to_container): Removed.
11012 (TypeManager.finder_to_delegate): Removed.
11013 (TypeManager.finder_to_interface): Removed.
11014 (TypeManager.finder_to_enum): Removed.
11016 * interface.cs (Interface): Implement IMemberFinder.
11018 * delegate.cs (Delegate): Implement IMemberFinder.
11020 * enum.cs (Enum): Implement IMemberFinder.
11022 * class.cs (TypeContainer): Implement IMemberFinder.
11024 2002-08-12 Martin Baulig <martin@gnome.org>
11026 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
11028 2002-08-12 Martin Baulig <martin@gnome.org>
11030 * ecore.cs (ITypeExpression): New interface for expressions which
11032 (TypeExpression): Renamed to TypeLookupExpression.
11033 (Expression.DoResolve): If we're doing a types-only lookup, the
11034 expression must implement the ITypeExpression interface and we
11035 call DoResolveType() on it.
11036 (SimpleName): Implement the new ITypeExpression interface.
11037 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
11038 hack, the situation that we're only looking up types can't happen
11039 anymore when this method is called. Moved the type lookup code to
11040 DoResolveType() and call it.
11041 (SimpleName.DoResolveType): This ITypeExpression interface method
11042 is now doing the types-only lookup.
11043 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
11044 (ResolveFlags): Added MaskExprClass.
11046 * expression.cs (MemberAccess): Implement the ITypeExpression
11048 (MemberAccess.DoResolve): Added support for a types-only lookup
11049 when we're called via ITypeExpression.DoResolveType().
11050 (ComposedCast): Implement the ITypeExpression interface.
11052 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
11053 Expression.Resolve() with ResolveFlags.Type instead.
11055 2002-08-12 Martin Baulig <martin@gnome.org>
11057 * interface.cs (Interface.Define): Apply attributes.
11059 * attribute.cs (Attribute.ApplyAttributes): Added support for
11060 interface attributes.
11062 2002-08-11 Martin Baulig <martin@gnome.org>
11064 * statement.cs (Block.Emit): Only check the "this" variable if we
11065 do not always throw an exception.
11067 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
11068 whether the property has a set accessor.
11070 2002-08-11 Martin Baulig <martin@gnome.org>
11072 Added control flow analysis support for structs.
11074 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
11075 with control flow analysis turned off.
11076 (IVariable): New interface.
11077 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
11078 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
11079 (FieldExpr.DoResolve): Resolve the instance expression with flow
11080 analysis turned off and do the definite assignment check after the
11081 resolving when we know what the expression will resolve to.
11083 * expression.cs (LocalVariableReference, ParameterReference):
11084 Implement the new IVariable interface, only call the flow analysis
11085 code if ec.DoFlowAnalysis is true.
11086 (This): Added constructor which takes a Block argument. Implement
11087 the new IVariable interface.
11088 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
11089 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
11090 This does the definite assignment checks for struct members.
11092 * class.cs (Constructor.Emit): If this is a non-static `struct'
11093 constructor which doesn't have any initializer, call
11094 Block.AddThisVariable() to tell the flow analysis code that all
11095 struct elements must be initialized before control returns from
11098 * statement.cs (MyStructInfo): New public class.
11099 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
11100 argument to this indexer. If non-zero, check an individual struct
11101 member, not the whole struct.
11102 (FlowBranching.CheckOutParameters): Check struct members.
11103 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
11104 overloaded versions of these methods which take an additional
11105 `int field_idx' argument to check struct members.
11106 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
11107 overloaded versions of these methods which take an additional
11108 `string field_name' argument to check struct member.s
11109 (VariableInfo): Implement the IVariable interface.
11110 (VariableInfo.StructInfo): New public property. Returns the
11111 MyStructInfo instance of the variable if it's a struct or null.
11112 (Block.AddThisVariable): New public method. This is called from
11113 Constructor.Emit() for non-static `struct' constructor which do
11114 not have any initializer. It creates a special variable for the
11115 "this" instance variable which will be checked by the flow
11116 analysis code to ensure that all of the struct's fields are
11117 initialized before control returns from the constructor.
11118 (UsageVector): Added support for struct members. If a
11119 variable/parameter is a struct with N members, we reserve a slot
11120 in the usage vector for each member. A struct is considered fully
11121 initialized if either the struct itself (slot 0) or all its
11122 members are initialized.
11124 2002-08-08 Martin Baulig <martin@gnome.org>
11126 * driver.cs (Driver.MainDriver): Only report an error CS5001
11127 if there were no compilation errors.
11129 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
11130 `UnsafeContext' property to determine whether the parent is in
11131 unsafe context rather than checking the parent's ModFlags:
11132 classes nested in an unsafe class are unsafe as well.
11134 2002-08-08 Martin Baulig <martin@gnome.org>
11136 * statement.cs (UsageVector.MergeChildren): Distinguish between
11137 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
11138 we return. Added test17() and test18() to test-154.cs.
11140 2002-08-08 Martin Baulig <martin@gnome.org>
11142 * typemanager.cs (TypeManager.FilterWithClosure): If we have
11143 Family access, make sure the invoking type isn't a subclass of the
11144 queried type (that'd be a CS1540).
11146 * ecore.cs (Expression.MemberLookup): Added overloaded version of
11147 this method which takes an additional `Type invocation_type'.
11149 * expression.cs (BaseAccess.DoResolve): Use the base type as
11150 invocation and query type.
11151 (MemberAccess.DoResolve): If the lookup failed and we're about to
11152 report a CS0122, try a lookup with the ec.ContainerType - if this
11153 succeeds, we must report a CS1540.
11155 2002-08-08 Martin Baulig <martin@gnome.org>
11157 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
11158 (MethodGroupExpr): Implement the IMemberExpr interface.
11160 * expression (MemberAccess.ResolveMemberAccess): No need to have
11161 any special code for MethodGroupExprs anymore, they're now
11164 2002-08-08 Martin Baulig <martin@gnome.org>
11166 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
11167 Family, FamANDAssem and FamORAssem permissions.
11168 (TypeManager.IsSubclassOrNestedChildOf): New public method.
11170 2002-08-08 Martin Baulig <martin@gnome.org>
11172 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
11173 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
11176 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
11178 * driver.cs: implemented /resource option to embed managed resources.
11180 2002-08-07 Martin Baulig <martin@gnome.org>
11182 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
11183 (FieldBase.HasFieldInitializer): New public property.
11184 (FieldBase.GetInitializerExpression): New public method. Resolves and
11185 returns the field initializer and makes sure it is only resolved once.
11186 (TypeContainer.EmitFieldInitializers): Call
11187 FieldBase.GetInitializerExpression to get the initializer, this ensures
11188 that it isn't resolved multiple times.
11190 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
11191 the resolving process (SimpleName/MemberLookup) that we're currently
11192 emitting a field initializer (which must not access any instance members,
11193 this is an error CS0236).
11195 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
11196 argument, if the `IsFieldInitializer' flag is set, we must report and
11197 error CS0236 and not an error CS0120.
11199 2002-08-07 Martin Baulig <martin@gnome.org>
11201 * ecore.cs (IMemberExpr): New public interface.
11202 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
11203 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
11204 if the expression is an IMemberExpr.
11206 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
11207 to be null, implicitly default to `this' if we're non-static in
11208 this case. Simplified the code a lot by using the new IMemberExpr
11209 interface. Also fixed bug #28176 here.
11211 2002-08-06 Martin Baulig <martin@gnome.org>
11213 * cs-parser.jay (SimpleLookup): Removed. We need to create
11214 ParameterReferences during semantic analysis so that we can do a
11215 type-only search when resolving Cast, TypeOf and SizeOf.
11216 (block): Pass the `current_local_parameters' to the Block's
11219 * class.cs (ConstructorInitializer): Added `Parameters parameters'
11220 argument to the constructor.
11221 (ConstructorInitializer.Resolve): Create a temporary implicit
11222 block with the parameters.
11224 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
11225 references here if we aren't doing a type-only search.
11227 * statement.cs (Block): Added constructor which takes a
11228 `Parameters parameters' argument.
11229 (Block.Parameters): New public property.
11231 * support.cs (InternalParameters.Parameters): Renamed `parameters'
11232 to `Parameters' and made it public readonly.
11234 2002-08-06 Martin Baulig <martin@gnome.org>
11236 * ecore.cs (Expression.Warning): Made this public as well.
11238 * report.cs (Report.Debug): Print the contents of collections.
11240 2002-08-06 Martin Baulig <martin@gnome.org>
11242 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
11243 used to tell Resolve() which kinds of expressions it may return.
11244 (Expression.Resolve): Added overloaded version of this method which
11245 takes a `ResolveFlags flags' argument. This can be used to tell
11246 Resolve() which kinds of expressions it may return. Reports a
11248 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
11249 ResolveFlags.SimpleName.
11250 (Expression.Error118): Added overloaded version of this method which
11251 takes a `ResolveFlags flags' argument. It uses the flags to determine
11252 which kinds of expressions are allowed.
11254 * expression.cs (Argument.ResolveMethodGroup): New public method.
11255 Resolves an argument, but allows a MethodGroup to be returned.
11256 This is used when invoking a delegate.
11258 * TODO: Updated a bit.
11260 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11262 Fixed compilation with csc.
11264 * ecore.cs: Expression.Error made public. Is this correct? Should
11265 Warning be made public too?
11267 * expression.cs: use ea.Location instead of ea.loc.
11268 [FIXME: Filed as bug #28607: MCS must report these errors.]
11270 2002-08-06 Martin Baulig <martin@gnome.org>
11272 * ecore.cs (Expression.loc): Moved the location here instead of
11273 duplicating it in all derived classes.
11274 (Expression.Location): New public property.
11275 (Expression.Error, Expression.Warning): Made them non-static and
11276 removed the location argument.
11277 (Expression.Warning): Added overloaded version which takes an
11278 `int level' argument.
11279 (Expression.Error118): Make this non-static and removed the
11280 expression and location arguments.
11281 (TypeExpr): Added location argument to the constructor.
11283 * expression.cs (StaticCallExpr): Added location argument to
11285 (Indirection, PointerArithmetic): Likewise.
11286 (CheckedExpr, UnCheckedExpr): Likewise.
11287 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
11288 (StringPtr): Likewise.
11291 2002-08-05 Martin Baulig <martin@gnome.org>
11293 * expression.cs (BaseAccess.DoResolve): Actually report errors.
11295 * assign.cs (Assign.DoResolve): Check whether the source
11296 expression is a value or variable.
11298 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
11299 while resolving the corresponding blocks.
11301 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
11302 an error, don't silently return null.
11304 * statement.cs (Block.AddVariable): Do the error reporting here
11305 and distinguish between CS0128 and CS0136.
11306 (Block.DoResolve): Report all unused labels (warning CS0164).
11307 (LabeledStatement): Pass the location to the constructor.
11308 (LabeledStatement.HasBeenReferenced): New property.
11309 (LabeledStatement.Resolve): Set it to true here.
11311 * statement.cs (Return.Emit): Return success even after reporting
11312 a type mismatch error (CS0126 or CS0127), this is what csc does and
11313 it avoids confusing the users with any consecutive errors.
11315 2002-08-05 Martin Baulig <martin@gnome.org>
11317 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
11319 * const.cs (Const.LookupConstantValue): Catch circular definitions.
11321 * expression.cs (MemberAccess.DoResolve): Silently return if an
11322 error has already been reported.
11324 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
11325 error has already been reported.
11327 2002-08-05 Martin Baulig <martin@gnome.org>
11329 * statement.cs (UsageVector): Only initialize the `parameters'
11330 vector if we actually have any "out" parameters.
11332 2002-08-05 Martin Baulig <martin@gnome.org>
11334 * expression.cs (Binary.ResolveOperator): When combining delegates,
11335 they must have the same type.
11337 2002-08-05 Martin Baulig <martin@gnome.org>
11339 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
11340 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
11341 work with the ms runtime and we also don't need it: if we're a
11342 PropertyBuilder and not in the `indexer_arguments' hash, then we
11343 are a property and not an indexer.
11345 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
11346 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
11347 since the latter one doesn't work with the ms runtime.
11349 2002-08-03 Martin Baulig <martin@gnome.org>
11351 Fixed bugs #27998 and #22735.
11353 * class.cs (Method.IsOperator): New public field.
11354 (Method.CheckBase): Report CS0111 if there's already a method
11355 with the same parameters in the current class. Report CS0508 when
11356 attempting to change the return type of an inherited method.
11357 (MethodData.Emit): Report CS0179 if a method doesn't have a body
11358 and it's not marked abstract or extern.
11359 (PropertyBase): New abstract base class for Property and Indexer.
11360 (PropertyBase.CheckBase): Moved here from Property and made it work
11362 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
11363 the same so we can reuse it there.
11364 (Property, Indexer): Derive from PropertyBase.
11365 (MethodSignature.inheritable_property_signature_filter): New delegate
11366 to find properties and indexers.
11368 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
11369 argument and improved error reporting.
11371 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
11372 EmptyReadOnlyParameters and made it a property.
11374 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
11375 version of this method which takes a `PropertyInfo indexer'.
11376 (TypeManager.RegisterIndexer): New method.
11378 * class.cs: Added myself as author of this file :-)
11380 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11382 * class.cs: fixed compilation on windoze.
11384 2002-08-03 Martin Baulig <martin@gnome.org>
11386 * interface.cs (Interface.GetInterfaceBases): Check whether all
11387 base interfaces are at least as accessible than the current one.
11389 * class.cs (TypeContainer.GetClassBases): Check whether base types
11390 are at least as accessible than the current type.
11391 (TypeContainer.AsAccessible): Implemented and made non-static.
11392 (MemberBase.CheckParameters): Report errors if the accessibility
11395 * delegate.cs (Delegate.Delegate): The default visibility is
11396 internal for top-level types and private for nested types.
11397 (Delegate.Define): Report errors if the accessibility checks fail.
11399 * enum.cs (Enum.Enum): The default visibility is internal for
11400 top-level types and private for nested types.
11401 (Enum.DefineType): Compute the correct visibility.
11403 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
11404 function which takes a `bool is_toplevel' instead of a TypeContainer.
11406 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
11409 2002-08-02 Martin Baulig <martin@gnome.org>
11411 * expression.cs (LocalVariableReferenc): Added constructor which
11412 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
11413 (LocalVariableReference.IsReadOnly): New property.
11414 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
11415 variable is readonly, use our own readonly flag to do this; you can
11416 use the new constructor to get a writable reference to a read-only
11419 * cs-parser.jay (foreach_statement, using_statement): Get a writable
11420 reference to the local variable.
11422 2002-08-01 Miguel de Icaza <miguel@ximian.com>
11424 * rootcontext.cs (ResolveCore): Also include System.Exception
11426 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
11427 we reach an EmptyStatement.
11429 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
11432 * expression.cs (Binary.ResolveOperator): Check error result in
11435 use brtrue/brfalse directly and avoid compares to null.
11437 2002-08-02 Martin Baulig <martin@gnome.org>
11439 * class.cs (TypeContainer.Define): Define all nested interfaces here.
11440 Fixes bug #28407, added test-155.cs.
11442 2002-08-01 Martin Baulig <martin@gnome.org>
11444 * class.cs (Event.EmitDefaultMethod): Make this work with static
11445 events. Fixes #28311, added verify-3.cs.
11447 2002-08-01 Martin Baulig <martin@gnome.org>
11449 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
11450 `is_disposable' fields.
11451 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
11452 `hm.is_disposable' if we're using the collection pattern.
11453 (Foreach.EmitCollectionForeach): Use the correct type for the
11454 enumerator's local variable, only emit the try/finally block if
11455 necessary (fixes #27713).
11457 2002-08-01 Martin Baulig <martin@gnome.org>
11459 * ecore.cs (Expression.report118): Renamed to Error118 and made
11462 * statement.cs (Throw.Resolve): Check whether the expression is of
11463 the correct type (CS0118) and whether the type derives from
11464 System.Exception (CS0155).
11465 (Catch.Resolve): New method. Do the type lookup here and check
11466 whether it derives from System.Exception (CS0155).
11467 (Catch.CatchType, Catch.IsGeneral): New public properties.
11469 * typemanager.cs (TypeManager.exception_type): Added.
11471 2002-07-31 Miguel de Icaza <miguel@ximian.com>
11473 * driver.cs: Updated About function.
11475 2002-07-31 Martin Baulig <martin@gnome.org>
11477 Implemented Control Flow Analysis.
11479 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
11480 (EmitContext.CurrentBranching): Added.
11481 (EmitContext.StartFlowBranching): Added.
11482 (EmitContext.EndFlowBranching): Added.
11483 (EmitContext.KillFlowBranching): Added.
11484 (EmitContext.IsVariableAssigned): Added.
11485 (EmitContext.SetVariableAssigned): Added.
11486 (EmitContext.IsParameterAssigned): Added.
11487 (EmitContext.SetParameterAssigned): Added.
11488 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
11489 Added control flow analysis stuff here.
11491 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
11492 resolve the expression as lvalue.
11493 (LocalVariableReference.DoResolve): Check whether the variable has
11494 already been assigned.
11495 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
11496 the parameter as assigned here.
11497 (ParameterReference.DoResolve): Check whether the parameter has already
11499 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
11500 expression as lvalue.
11502 * statement.cs (FlowBranching): New class for the flow analysis code.
11503 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
11504 (LabeledStatement.IsDefined): New public property.
11505 (LabeledStatement.AddUsageVector): New public method to tell flow
11506 analyis that the label may be reached via a forward jump.
11507 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
11509 (VariableInfo.Number): New public field. This is used by flow analysis
11510 to number all locals of a block.
11511 (Block.CountVariables): New public property. This is the number of
11512 local variables in this block (including the locals from all parent
11514 (Block.EmitMeta): Number all the variables.
11516 * statement.cs: Added flow analysis support to all classes.
11518 2002-07-31 Martin Baulig <martin@gnome.org>
11520 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
11521 To get debugging messages, compile mcs with /define:MCS_DEBUG and
11522 then use this argument.
11524 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
11526 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
11527 use this to specify /define options.
11529 2002-07-29 Martin Baulig <martin@gnome.org>
11531 * statement.cs (Fixed): Moved all code that does variable lookups
11532 and resolvings from Emit to Resolve.
11534 * statement.cs (For): Moved all code that does variable lookups
11535 and resolvings from Emit to Resolve.
11537 * statement.cs (Using): Moved all code that does variable lookups
11538 and resolvings from Emit to Resolve.
11540 2002-07-29 Martin Baulig <martin@gnome.org>
11542 * attribute.cs (Attribute.Resolve): Explicitly catch a
11543 System.NullReferenceException when creating the
11544 CustromAttributeBuilder and report a different warning message.
11546 2002-07-29 Martin Baulig <martin@gnome.org>
11548 * support.cs (ParameterData.ParameterName): Added method to
11549 get the name of a parameter.
11551 * typemanager.cs (TypeManager.IsValueType): New public method.
11553 2002-07-29 Martin Baulig <martin@gnome.org>
11555 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
11556 is a flag which specifies that it's either ref or out.
11557 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
11558 the out parameter to `out Parameter.Modifier mod', also set the
11559 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
11561 * support.cs (InternalParameters.ParameterModifier): Distinguish
11562 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
11563 Parameter.Modifier.ISBYREF flag if it's either ref or out.
11565 * expression.cs (Argument.GetParameterModifier): Distinguish
11566 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
11567 Parameter.Modifier.ISBYREF flag if it's either ref or out.
11569 2002-07-29 Martin Baulig <martin@gnome.org>
11571 * expression.cs (ParameterReference.ParameterReference): Added
11572 `Location loc' argument to the constructor.
11574 * cs-parser.jay: Pass location to ParameterReference.
11576 2002-07-28 Miguel de Icaza <miguel@ximian.com>
11578 * statement.cs (Try): Initialize the location.
11580 * cs-parser.jay: pass location to Try.
11582 * expression.cs (Unary.Reduce): Change the prototype to return
11583 whether a constant fold could be performed or not. The result is
11584 returned in an out parameters. In the case of Indirection and
11585 AddressOf, we want to perform the full tests.
11587 2002-07-26 Miguel de Icaza <miguel@ximian.com>
11589 * statement.cs (Statement.Emit): Flag dead code.
11591 2002-07-27 Andrew Birkett <andy@nobugs.org>
11593 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
11595 2002-07-27 Martin Baulig <martin@gnome.org>
11597 * class.cs (MethodData.Define): Put back call to
11598 TypeManager.AddMethod(), accidentally commented this out.
11600 * report.cs (Debug): New public method to print debugging information,
11601 this is `[Conditional ("DEBUG")]'.
11603 2002-07-26 Martin Baulig <martin@gnome.org>
11605 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
11606 (switch_statement): Push the current_block to the switch_stack and
11607 pop it again when we're done with the switch.
11608 (switch_section): The new block is a child of the current_block.
11609 Fixes bug #24007, added test-152.cs.
11611 2002-07-27 Martin Baulig <martin@gnome.org>
11613 * expression.cs (Invocation.EmitArguments): When calling a varargs
11614 function with only its fixed arguments, we need to pass an empty
11617 2002-07-27 Martin Baulig <martin@gnome.org>
11619 Mono 0.13 has been released.
11621 2002-07-25 Miguel de Icaza <miguel@ximian.com>
11623 * driver.cs: Rename --resource to --linkres, because that is what
11624 we do currently, we dont support --resource yet.
11626 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
11628 2002-07-25 Martin Baulig <martin@gnome.org>
11630 * class.cs (MethodData): New public class. This is a `method builder'
11631 class for a method or one accessor of a Property/Indexer/Event.
11632 (MethodData.GetMethodFlags): Moved here from MemberBase.
11633 (MethodData.ApplyAttributes): Likewise.
11634 (MethodData.ApplyObsoleteAttribute): Likewise.
11635 (MethodData.ApplyConditionalAttribute): Likewise.
11636 (MethodData.ApplyDllImportAttribute): Likewise.
11637 (MethodData.CheckAbstractAndExternal): Likewise.
11638 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
11639 (MethodData.Emit): Formerly known as Method.Emit().
11640 (MemberBase): Moved everything which was specific to a single
11641 accessor/method to MethodData.
11642 (Method): Create a new MethodData and call Define() and Emit() on it.
11643 (Property, Indexer, Event): Create a new MethodData objects for each
11644 accessor and call Define() and Emit() on them.
11646 2002-07-25 Martin Baulig <martin@gnome.org>
11648 Made MethodCore derive from MemberBase to reuse the code from there.
11649 MemberBase now also checks for attributes.
11651 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
11652 (MemberBase.GetMethodFlags): Moved here from class Method and marked
11654 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
11655 `CallingConventions cc' and `Attributes opt_attrs' arguments.
11656 (MemberBase.ApplyAttributes): New virtual method; applies the
11657 attributes to a method or accessor.
11658 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
11659 (MemberBase.ApplyConditionalAttribute): Likewise.
11660 (MemberBase.ApplyDllImportAttribute): Likewise.
11661 (MemberBase.CheckAbstractAndExternal): Likewise.
11662 (MethodCore.ParameterTypes): This is now a property instead of a
11663 method, it's initialized from DoDefineParameters().
11664 (MethodCore.ParameterInfo): Removed the set accessor.
11665 (MethodCore.DoDefineParameters): New protected virtual method to
11666 initialize ParameterTypes and ParameterInfo.
11667 (Method.GetReturnType): We can now simply return the MemberType.
11668 (Method.GetMethodFlags): Override the MemberBase version and add
11669 the conditional flags.
11670 (Method.CheckBase): Moved some code from Define() here, call
11671 DoDefineParameters() here.
11672 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
11673 here to avoid some larger code duplication.
11674 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
11675 ensure that abstract and external accessors don't declare a body.
11677 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
11678 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
11679 lookup in the attribute's parent classes, so we need to abort as soon
11680 as we found the first match.
11681 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
11682 the attribute has no arguments.
11684 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
11687 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11689 * cs-parser.jay: reverted previous patch.
11691 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11693 * cs-parser.jay: fixed bug #22119.
11695 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11697 * attribute.cs: fixed compilation. The error was:
11698 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
11699 be assigned to before control leaves the current method."
11700 [FIXME: Filed as bug #28186: MCS must report this error.]
11702 2002-07-25 Martin Baulig <martin@gnome.org>
11704 * attribute.cs (Attribute.Conditional_GetConditionName): New static
11705 method to pull the condition name ouf of a Conditional attribute.
11706 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
11707 the obsolete message and error flag out of an Obsolete attribute.
11709 * class.cs (Method.GetMethodFlags): New public method to get the
11710 TypeManager.MethodFlags for this method.
11711 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
11713 (Method.Define): Get and apply the Obsolete and Conditional attributes;
11714 if we're overriding a virtual function, set the new private variable
11715 `parent_method'; call the new TypeManager.AddMethod().
11717 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
11718 the MethodBuilder and the Method in a PtrHashtable.
11719 (TypeManager.builder_to_method): Added for this purpose.
11720 (TypeManager.MethodFlags): Added IsObsoleteError.
11721 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
11722 Obsolete and Conditional arguments in MethodBuilders. If we discover
11723 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
11724 the message from the attribute.
11726 2002-07-24 Martin Baulig <martin@gnome.org>
11728 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
11729 preprocessor directives, ensure that the argument to #define/#undef is
11730 exactly one identifier and that it's actually an identifier.
11732 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
11735 2002-07-24 Martin Baulig <martin@gnome.org>
11737 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
11738 initialize it to TypeManager.object_type in the constructor.
11739 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
11740 of the `hm.get_current' method if we're using the collection pattern.
11741 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
11742 for the explicit conversion to make it work when we're using the collection
11743 pattern and the `Current' property has a different return type than `object'.
11746 2002-07-24 Martin Baulig <martin@gnome.org>
11748 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
11749 does not match, but don't report any errors. This method is called in
11750 order for all methods in a MethodGroupExpr until a matching method is
11751 found, so we don't want to bail out if the first method doesn't match.
11752 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
11753 matches, report the 123. Fixes #28070.
11755 2002-07-24 Martin Baulig <martin@gnome.org>
11757 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
11758 TypeManager.TypeToCoreType() to the top of the method so the
11759 following equality checks will work. Fixes #28107.
11761 2002-07-24 Martin Baulig <martin@gnome.org>
11763 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
11764 operand is of type uint, and the other operand is of type sbyte,
11765 short or int, the operands are converted to type long." -
11766 Actually do what this comment already told us. Fixes bug #28106,
11769 2002-07-24 Martin Baulig <martin@gnome.org>
11771 * class.cs (MethodBase): New abstract class. This is now a base
11772 class for Property, Indexer and Event to avoid some code duplication
11773 in their Define() and DefineMethods() methods.
11774 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
11775 generic methods for Define() and DefineMethods().
11776 (FieldBase): Derive from MemberBase, not MemberCore.
11777 (Property): Derive from MemberBase, not MemberCore.
11778 (Property.DefineMethod): Moved all the code from this method to the
11779 new MethodBase.DefineAccessor(), just call it with appropriate
11781 (Property.Define): Call the new Property.DoDefine(), this does some
11782 sanity checks and we don't need to duplicate the code everywhere.
11783 (Event): Derive from MemberBase, not MemberCore.
11784 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
11785 accessors, this will also make them work with interface events.
11786 (Indexer): Derive from MemberBase, not MemberCore.
11787 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
11788 (Indexer.Define): Use the new MethodBase functions.
11790 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
11791 argument to the constructor.
11792 (Interface.FindMembers): Added support for interface events.
11793 (Interface.PopluateEvent): Implemented.
11795 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
11797 2002-07-22 Miguel de Icaza <miguel@ximian.com>
11799 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
11800 but this is required to check for a method name being the same as
11801 the containing class.
11805 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11807 * interface.cs: initialize variable.
11809 2002-07-23 Martin Baulig <martin@gnome.org>
11811 Implemented the IndexerName attribute in interfaces.
11813 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
11814 name if this is an explicit interface implementation.
11815 (Indexer.InterfaceIndexerName): New public variable. If we're
11816 implementing an interface indexer, this is the IndexerName in that
11817 interface. Otherwise, it's the IndexerName.
11818 (Indexer.DefineMethod): If we're implementing interface indexer,
11819 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
11820 and Pending.ImplementIndexer methods.
11821 (Indexer.Define): Also define the PropertyBuilder if we're
11822 implementing an interface indexer and this is neither an explicit
11823 interface implementation nor do the IndexerName match the one in
11826 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
11827 If a method is defined here, then we always need to create a proxy
11828 for it. This is used when implementing interface indexers.
11829 (Pending.IsInterfaceIndexer): New public method.
11830 (Pending.ImplementIndexer): New public method.
11831 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
11832 This is used when implementing interface indexers to define a proxy
11834 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
11835 define a proxy if necessary.
11837 * interface.cs (Interface.IndexerName): New public variable.
11838 (Interface.PopulateIndexer): Set the IndexerName.
11839 (Interface.DefineIndexers): New private method. Populate all the
11840 indexers and make sure their IndexerNames match.
11842 * typemanager.cs (IndexerPropertyName): Added support for interface
11845 2002-07-22 Martin Baulig <martin@gnome.org>
11847 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
11848 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
11849 ret if HasReturnLabel.
11850 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
11853 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
11854 and set the ec.LoopBeginTryCatchLevel.
11855 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
11856 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
11857 the current ec.TryCatchLevel, the branch goes out of an exception
11858 block. In this case, we need to use Leave and not Br.
11860 2002-07-22 Martin Baulig <martin@gnome.org>
11862 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
11863 block unless the block does not always return or it is contained in
11864 another try { ... } catch { ... } block. Fixes bug #26506.
11865 Added verify-1.cs to the test suite.
11867 2002-07-22 Martin Baulig <martin@gnome.org>
11869 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
11870 then we do not always return. Fixes bug #24985.
11872 2002-07-22 Martin Baulig <martin@gnome.org>
11874 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
11875 lookup on a per-class level; ie. walk up the class hierarchy until we
11876 found at least one applicable method, then choose the best among them.
11877 Fixes bug #24463 and test-29.cs.
11879 2002-07-22 Martin Baulig <martin@gnome.org>
11881 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
11882 return types of the methods. The return type is not part of the
11883 signature and we must not check it to make the `new' modifier work.
11884 Fixes bug #27999, also added test-147.cs.
11885 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
11887 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
11888 on the method's return type.
11890 2002-07-21 Martin Baulig <martin@gnome.org>
11892 * assign.cs: Make this work if the rightmost source is a constant and
11893 we need to do an implicit type conversion. Also adding a few more tests
11894 to test-38.cs which should have caught this.
11896 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
11897 target in the makefile for this. The makefile.gnu is primarily intended
11898 for end-users who don't want to debug the compiler.
11900 2002-07-21 Martin Baulig <martin@gnome.org>
11902 * assign.cs: Improved the Assign class so it can now handle embedded
11903 assignments (X = Y = Z = something). As a side-effect this'll now also
11904 consume less local variables. test-38.cs now passes with MCS, added
11905 a few new test cases to that test.
11907 2002-07-20 Martin Baulig <martin@gnome.org>
11909 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
11910 instructions. Fixes bug #27977, also added test-146.cs.
11912 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11914 * cs-tokenizer.cs: fixed getHex ().
11916 2002-07-19 Martin Baulig <martin@gnome.org>
11918 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
11919 not Type.GetType() to lookup the array type. This is needed when
11920 we're constructing an array of a user-defined type.
11921 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
11922 single-dimensional arrays, but also for single-dimensial arrays of
11925 2002-07-19 Martin Baulig <martin@gnome.org>
11927 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
11928 this function is called, it's not allowed to share LocalBuilders
11929 among ILGenerators.
11931 2002-07-19 Martin Baulig <martin@gnome.org>
11933 * expression.cs (Argument.Resolve): Report an error 118 when trying
11934 to pass a type as argument.
11936 2002-07-18 Martin Baulig <martin@gnome.org>
11938 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
11939 Conv_R_Un for the signed `long' type.
11941 2002-07-15 Miguel de Icaza <miguel@ximian.com>
11943 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
11944 `expr' for the temporary result, as that will fail if we do
11945 multiple resolves on the same expression.
11947 2002-07-05 Miguel de Icaza <miguel@ximian.com>
11949 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
11950 ec.TypeContainer for looking up aliases.
11952 * class.cs (TypeContainer): Remove LookupAlias from here.
11954 * decl.cs (DeclSpace); Move here.
11956 2002-07-01 Miguel de Icaza <miguel@ximian.com>
11958 * class.cs (FindMembers): Only call filter if the constructor
11959 bulider is not null.
11961 Also handle delegates in `NestedTypes' now. Now we will perform
11962 type lookups using the standard resolution process. This also
11965 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
11966 This uses Expressions (the limited kind that can be parsed by the
11967 tree) instead of strings.
11969 * expression.cs (ComposedCast.ToString): Implement, used to flag
11970 errors since now we have to render expressions.
11972 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
11975 * ecore.cs (SimpleName.ToString): ditto.
11977 * cs-parser.jay: Instead of using strings to assemble types, use
11978 Expressions to assemble the type (using SimpleName, ComposedCast,
11979 MemberAccess). This should fix the type lookups in declarations,
11980 because we were using a different code path for this.
11982 * statement.cs (Block.Resolve): Continue processing statements
11983 even when there is an error.
11985 2002-07-17 Miguel de Icaza <miguel@ximian.com>
11987 * class.cs (Event.Define): Also remove the `remove' method from
11988 the list of pending items.
11990 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
11991 generate more compact code.
11993 2002-07-17 Martin Baulig <martin@gnome.org>
11995 * const.cs (Const.LookupConstantValue): Add support for constant
11996 `unchecked' and `checked' expressions.
11997 Also adding test case test-140.cs for this.
11999 2002-07-17 Martin Baulig <martin@gnome.org>
12001 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
12002 check whether mi.ReturnType implements the IEnumerator interface; the
12003 `==' and the IsAssignableFrom() will fail in this situation.
12005 2002-07-16 Ravi Pratap <ravi@ximian.com>
12007 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
12010 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12012 * expression.cs: fixed bug #27811.
12014 2002-07-14 Miguel de Icaza <miguel@ximian.com>
12016 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
12017 Molaro: when we are a ref, the value already contains a pointer
12018 value, do not take the address of it.
12020 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
12021 * removed mb-parser.jay and mb-tokenizer.cs
12023 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
12025 * expression.cs: check against the building corlib void type.
12027 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
12029 * ecore.cs: fix for valuetype static readonly fields: when
12030 initializing them, we need their address, not the address of a copy.
12032 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
12034 * typemanager.cs: register also enum_type in corlib.
12036 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
12038 * class.cs: allow calling this (but not base) initializers in structs.
12040 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
12042 * ecore.cs: make sure we compare against the building base types
12045 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
12047 * typemanager.cs: fix TypeToCoreType() to handle void and object
12048 (corlib gets no more typerefs after this change).
12050 2002-07-12 Miguel de Icaza <miguel@ximian.com>
12052 * expression.cs (ArrayCreation.EmitArrayArguments): use
12053 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
12055 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
12056 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
12057 array indexes, the runtime actually forbids them.
12059 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
12060 for array arguments here.
12062 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
12063 instead of the default for ValueTypes.
12065 (New.DoEmit): Use IsValueType instead of
12066 IsSubclassOf (value_type)
12067 (New.DoResolve): ditto.
12068 (Invocation.EmitCall): ditto.
12070 * assign.cs (Assign): ditto.
12072 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
12073 Statements *are* currently doing part of their resolution during
12076 Expressions do always resolve during resolve, but statements are
12077 only required to propagate resolution to their children.
12079 2002-07-11 Miguel de Icaza <miguel@ximian.com>
12081 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
12083 (LoadAssembly): Do not add the dll if it is already specified
12085 (MainDriver): Add the System directory to the link path at the end,
12086 after all the other -L arguments.
12088 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
12089 wrong opcode for loading bytes and bools (ldelem.i1 instead of
12090 ldelem.u1) and using the opposite for sbytes.
12092 This fixes Digger, and we can finally run it.
12094 * driver.cs (UnixParseOption): Move the option parsing here.
12095 (CSCParseOption): Implement CSC-like parsing of options.
12097 We now support both modes of operation, the old Unix way, and the
12098 new CSC-like way. This should help those who wanted to make cross
12099 platform makefiles.
12101 The only thing broken is that /r:, /reference: and /lib: are not
12102 implemented, because I want to make those have the same semantics
12103 as the CSC compiler has, and kill once and for all the confussion
12104 around this. Will be doing this tomorrow.
12106 * statement.cs (Unsafe.Resolve): The state is checked during
12107 resolve, not emit, so we have to set the flags for IsUnsfe here.
12109 2002-07-10 Miguel de Icaza <miguel@ximian.com>
12111 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
12112 not catch the Error_ObjectRefRequired in SimpleName (as it is
12113 possible to have a class/instance variable name that later gets
12114 deambiguated), we have to check this here.
12116 2002-07-10 Ravi Pratap <ravi@ximian.com>
12118 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
12119 make static and put into Expression.
12121 (Event.Define): Register the private field of the event with the
12122 TypeManager so that GetFieldFromEvent can get at it.
12124 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
12125 keep track of the private field associated with an event which
12128 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
12131 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
12133 2002-07-10 Miguel de Icaza <miguel@ximian.com>
12135 * expression.cs (Binary.EmitBranchable): this routine emits the
12136 Binary expression in a branchable context. This basically means:
12137 we need to branch somewhere, not just get the value on the stack.
12139 This works together with Statement.EmitBoolExpression.
12141 * statement.cs (Statement.EmitBoolExpression): Use
12144 2002-07-09 Miguel de Icaza <miguel@ximian.com>
12146 * statement.cs (For): Reduce the number of jumps in loops.
12148 (For): Implement loop inversion for the For statement.
12150 (Break): We can be breaking out of a Try/Catch controlled section
12151 (foreach might have an implicit try/catch clause), so we need to
12152 use Leave instead of Br.
12154 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
12155 now). If the instace expression supports IMemoryLocation, we use
12156 the AddressOf method from the IMemoryLocation to extract the
12157 address instead of emitting the instance.
12159 This showed up with `This', as we were emitting the instance
12160 always (Emit) instead of the Address of This. Particularly
12161 interesting when This is a value type, as we dont want the Emit
12162 effect (which was to load the object).
12164 2002-07-08 Miguel de Icaza <miguel@ximian.com>
12166 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
12168 * statement.cs (Checked): Set the CheckedState during the resolve
12169 process too, as the ConvCast operations track the checked state on
12170 the resolve process, and not emit.
12172 * cs-parser.jay (namespace_member_declaration): Flag that we have
12173 found a declaration when we do. This is used to flag error 1529
12175 * driver.cs: Report ok when we display the help only.
12177 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
12179 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
12181 2002-07-04 Miguel de Icaza <miguel@ximian.com>
12183 * cs-tokenizer.cs (define): We also have to track locally the
12184 defines. AllDefines is just used for the Conditional Attribute,
12185 but we also need the local defines for the current source code.
12187 2002-07-03 Miguel de Icaza <miguel@ximian.com>
12189 * statement.cs (While, For, Do): These loops can exit through a
12190 Break statement, use this information to tell whether the
12191 statement is the last piece of code.
12193 (Break): Flag that we break.
12195 * codegen.cs (EmitContexts): New `Breaks' state variable.
12197 2002-07-03 Martin Baulig <martin@gnome.org>
12199 * class.cs (TypeContainer.MethodModifiersValid): Allow override
12200 modifiers in method declarations in structs. Otherwise, you won't
12201 be able to override things like Object.Equals().
12203 2002-07-02 Miguel de Icaza <miguel@ximian.com>
12205 * class.cs (Method, Property, Indexer): Do not allow the public
12206 modifier to be used in explicit interface implementations.
12208 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
12209 override modifiers in method declarations in structs
12211 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
12213 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
12214 integer or real overflow, report an error
12216 2002-07-02 Martin Baulig <martin@gnome.org>
12218 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
12219 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
12220 to tell the runtime about our newly created System.Object and
12221 System.ValueType types.
12223 2002-07-02 Miguel de Icaza <miguel@ximian.com>
12225 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
12226 struct instead of Ldarg/Starg.
12228 2002-07-02 Martin Baulig <martin@gnome.org>
12230 * expression.cs (Indirection.Indirection): Call
12231 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
12233 2002-07-02 Martin Baulig <martin@gnome.org>
12235 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
12236 ValueType, call TypeManager.TypeToCoreType() on it.
12237 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
12238 the OpCodes.Newarr argument.
12240 2002-07-02 Martin Baulig <martin@gnome.org>
12242 * expression.cs (Invocation.EmitCall): When compiling corlib,
12243 replace all calls to the system's System.Array type to calls to
12244 the newly created one.
12246 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
12247 System.Array methods.
12248 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
12249 from the system's System.Array type which must be replaced.
12251 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
12253 * typemanager.cs: load unverifiable_code_ctor so we can build
12254 corlib using the correct type. Avoid using GetTypeCode() with
12256 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
12257 TypeManager.object_type to allow building corlib.
12259 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
12261 * ecore.cs: handle System.Enum separately in LoadFromPtr().
12263 2002-07-01 Martin Baulig <martin@gnome.org>
12265 * class.cs: Make the last change actually work, we need to check
12266 whether `ifaces != null' to avoid a crash.
12268 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
12270 * class.cs: when we build structs without fields that implement
12271 interfaces, we need to add the interfaces separately, since there is
12272 no API to both set the size and add the interfaces at type creation
12275 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
12277 * expression.cs: the dimension arguments to the array constructors
12278 need to be converted if they are a long.
12280 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
12282 * class.cs: don't emit ldarg.0 if there is no parent constructor
12283 (fixes showstopper for corlib).
12285 2002-06-29 Martin Baulig <martin@gnome.org>
12287 MCS now compiles corlib on GNU/Linux :-)
12289 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
12290 ie. check for MethodImplOptions.InternalCall.
12292 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
12293 and TypeManager.attribute_type are null, so we must explicitly check
12294 whether parent is not null to find out whether it's an attribute type.
12295 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
12296 and SetBuilder, not only if the property is neither abstract nor external.
12297 This is necessary to set the MethodImplOptions on the accessor methods.
12298 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
12299 SetBuilder, see Property.Emit().
12301 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
12302 populate "System.Object", "System.ValueType" and "System.Attribute" since
12303 they've already been populated from BootCorlib_PopulateCoreTypes().
12305 2002-06-29 Martin Baulig <martin@gnome.org>
12307 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
12308 is the NullLiteral, we also need to make sure that target_type is not
12311 2002-06-29 Martin Baulig <martin@gnome.org>
12313 * rootcontext.cs (RootContext.ResolveCore): We must initialize
12314 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
12315 before calling BootstrapCorlib_ResolveDelegate ().
12317 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12319 * statement.cs: fixed build-breaker. All tests passed ok.
12321 2002-06-27 Martin Baulig <martin@gnome.org>
12323 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
12324 for System.Decimal when compiling corlib.
12326 2002-06-27 Martin Baulig <martin@gnome.org>
12328 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
12329 switch blocks which contain nothing but a default clause.
12331 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
12333 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
12335 2002-06-27 Martin Baulig <martin@gnome.org>
12337 * ecore.cs (PropertyExpr.PropertyExpr): Call
12338 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
12340 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
12341 is already a TypeBuilder.
12343 2002-06-27 Martin Baulig <martin@gnome.org>
12345 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
12346 `target_type == TypeManager.array_type', not IsAssignableFrom() in
12347 the "from an array-type to System.Array" case. This makes it work
12348 when compiling corlib.
12350 2002-06-27 Martin Baulig <martin@gnome.org>
12352 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
12353 non-static PropertyExpr, set its InstanceExpression. This makes
12354 the `ICollection.Count' property work in System/Array.cs.
12356 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
12358 * driver.cs: Made error handling more consistent. Errors now
12359 tracked by Report class, so many methods which used to return int
12360 now return void. Main() now prints success/failure and
12361 errors/warnings message.
12363 Renamed '--probe' compiler argument to '--expect-error'. Removed
12364 the magic number return values (123 and 124). Now, if the
12365 expected error occurs, the compiler exits with success (exit value
12366 0). If the compilation completes without seeing that particular
12367 error, the compiler exits with failure (exit value 1). The
12368 makefile in mcs/errors has been changed to handle the new behaviour.
12370 * report.cs: Made 'expected error' number a property and renamed
12371 it from 'Probe' to 'ExpectedError'.
12373 * genericparser.cs: Removed error handling support, since it is
12374 now all done by Report class.
12376 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
12377 class, so parse() no longer returns an int.
12379 * namespace.cs: Use Report.Error instead of GenericParser.error
12381 2002-06-22 Miguel de Icaza <miguel@ximian.com>
12383 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
12384 TypeContainer.AddOperator): At the front of the list put the
12385 explicit implementations, so they get resolved/defined first.
12387 2002-06-21 Miguel de Icaza <miguel@ximian.com>
12389 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
12390 interface type is implemented by this TypeContainer. Used during
12391 explicit interface implementation.
12393 (Property.Define, Indexer.Define, Method.Define): Validate that
12394 the given interface in the explicit implementation is one of the
12395 base classes for the containing type.
12397 Also if we are explicitly implementing an interface, but there is
12398 no match in the pending implementation table, report an error.
12400 (Property.Define): Only define the property if we are
12401 not explicitly implementing a property from an interface. Use the
12402 correct name also for those properties (the same CSC uses,
12403 although that is really not needed).
12405 (Property.Emit): Do not emit attributes for explicitly implemented
12406 properties, as there is no TypeBuilder.
12408 (Indexer.Emit): ditto.
12410 Hiding then means that we do not really *implement* a pending
12411 implementation, which makes code fail.
12413 2002-06-22 Martin Baulig <martin@gnome.org>
12415 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
12416 the return value of Object.GetType(). [FIXME: we need to do this whenever
12417 we get a type back from the reflection library].
12419 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
12421 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
12423 2002-06-20 Miguel de Icaza <miguel@ximian.com>
12425 * attribute.cs: Return null if we can not look up the type.
12427 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
12428 the interface types found.
12430 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
12431 interface types found.
12433 * typemanager.cs (GetInterfaces): Make this routine returns alll
12434 the interfaces and work around the lame differences between
12435 System.Type and System.Reflection.Emit.TypeBuilder in the results
12436 result for GetInterfaces.
12438 (ExpandInterfaces): Given an array of interface types, expand and
12439 eliminate repeated ocurrences of an interface. This expands in
12440 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
12443 2002-06-21 Martin Baulig <martin@gnome.org>
12445 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
12448 2002-06-21 Martin Baulig <martin@gnome.org>
12450 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
12451 and called with one of the core types, return the corresponding typebuilder for
12454 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
12457 2002-06-21 Martin Baulig <martin@gnome.org>
12459 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
12460 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
12461 (Expression.ConvertReferenceExplicit): Likewise.
12463 * expression.cs (ElementAccess.DoResolve): Likewise.
12464 (ElementAccess.DoResolveLValue): Likewise.
12466 2002-06-10 Martin Baulig <martin@gnome.org>
12468 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
12469 add the "value" parameter to the parameter list.
12471 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
12474 2002-06-19 Miguel de Icaza <miguel@ximian.com>
12476 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
12477 the argument to an int, uint, long or ulong, per the spec. Also
12478 catch negative constants in array creation.
12480 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
12482 * class.cs: do not allow the same interface to appear twice in
12483 the definition list.
12485 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
12487 * ecore.cs: don't use ldlen with System.Array.
12489 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
12491 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
12493 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
12495 * modifiers.cs: produce correct field attributes for protected
12496 internal. Easy fix so miguel can work on ther harder stuff:-)
12498 2002-06-18 Miguel de Icaza <miguel@ximian.com>
12500 * pending.cs: New file. Move the code from class.cs here.
12501 Support clearning the pending flag for all methods (when not doing
12502 explicit interface implementation).
12504 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
12506 * rootcontext.cs: added a couple more types needed to bootstrap.
12508 2002-06-17 Miguel de Icaza <miguel@ximian.com>
12510 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
12511 constructor in the type, instead of any constructor in the type
12512 hierarchy. Thanks to Paolo for finding this bug (it showed up as
12513 a bug in the Mono runtime when applying the params attribute).
12515 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
12516 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
12518 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
12520 * expression.cs (Unary.ResolveOperator): Use TypeManager
12521 to resolve the type.
12523 2002-06-13 Ravi Pratap <ravi@ximian.com>
12525 * cs-parser.jay (enum_member_declaration): Pass in the attributes
12528 * enum.cs (AddEnumMember): Add support to store the attributes associated
12529 with each member too.
12531 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
12532 field builders too - this takes care of the enum member case.
12534 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
12536 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
12537 address-of operator on both value types and pointers.
12539 2002-06-10 Martin Baulig <martin@gnome.org>
12541 * interface.cs (Interface.PopulateIndexer): Add the indexer's
12542 PropertyBuilder to the `property_builders' list.
12544 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
12545 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
12546 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
12547 find any indexers which are inherited from an interface.
12549 2002-06-09 Martin Baulig <martin@gnome.org>
12551 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
12552 the same type as the constant if necessary. There's also a test-130.cs
12555 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
12557 * typemanager.cs (TypeManager.ChangeType): Previously known as
12558 Enum.ChangeEnumType().
12560 2002-06-09 Martin Baulig <martin@gnome.org>
12562 * expression.cs (Cast.TryReduce): Added support for consts.
12564 2002-06-08 Ravi Pratap <ravi@ximian.com>
12566 * class.cs (Accessor): Hold attributes information so we can pass
12569 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
12570 Modify to pass in attributes attached to the methods.
12572 (add_accessor_declaration, remove_accessor_declaration): Ditto.
12574 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
12575 to handle the Accessor kind :-)
12577 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
12579 2002-06-08 Martin Baulig <martin@gnome.org>
12581 * expression.cs (Unary.TryReduceNegative): Added support for
12584 2002-06-08 Martin Baulig <martin@gnome.org>
12586 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
12587 name can't be found in the `defined_names' - the caller will do a
12588 MemberLookup in this case and thus find methods in System.Enum
12589 such as Enum.IsDefined().
12591 2002-06-08 Martin Baulig <martin@gnome.org>
12593 * enum.cs (Enum.ChangeEnumType): This is a custom version of
12594 Convert.ChangeType() which works with TypeBuilder created types.
12595 (Enum.LookupEnumValue, Enum.Define): Use it here.
12597 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
12598 `TypeBuilder.BaseType != null' check.
12599 (TypeContainer.FindMembers): Only lookup parent members if we
12600 actually have a parent.
12601 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
12602 (ConstructorInitializer.Resolve): Likewise.
12604 * interface.cs (Interface.FindMembers): Added
12605 `TypeBuilder.BaseType != null' check.
12607 * rootcontext.cs (RootContext.ResolveCore): Added
12608 "System.Runtime.CompilerServices.IndexerNameAttribute" to
12609 classes_second_stage.
12611 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
12612 debug_type and trace_type when compiling with --nostdlib.
12614 2002-06-07 Martin Baulig <martin@gnome.org>
12616 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
12617 (AddField): Set it to true when adding a non-static field.
12618 (DefineType): Use `have_nonstatic_fields' to find out whether we
12619 have non-static fields, not `Fields != null'.
12621 2002-06-02 Miguel de Icaza <miguel@ximian.com>
12623 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
12624 dereferencing a null on the static-field code path)
12626 2002-05-30 Martin Baulig <martin@gnome.org>
12628 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
12629 to take command line arguments. Use reflection to call the new
12630 custom `Initialize' function on the symbol writer and pass it the
12631 command line arguments.
12633 * driver.cs (--debug-args): New command line argument to pass command
12634 line arguments to the symbol writer.
12636 2002-05-28 Miguel de Icaza <miguel@ximian.com>
12638 * assign.cs (DoResolve): Forgot to do the implicit conversion to
12639 the target type for indexers and properties. Thanks to Joe for
12642 2002-05-27 Miguel de Icaza <miguel@ximian.com>
12644 * typemanager.cs (MethodFlags): returns the method flags
12645 (Obsolete/ShouldIgnore) that control warning emission and whether
12646 the invocation should be made, or ignored.
12648 * expression.cs (Invocation.Emit): Remove previous hack, we should
12649 not do this on matching a base type, we should do this based on an attribute
12651 Only emit calls to System.Diagnostics.Debug and
12652 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
12653 on the command line.
12655 * rootcontext.cs: Global settings for tracing and debugging.
12657 * cs-tokenizer.cs (define): New utility function to track
12658 defines. Set the global settings for TRACE and DEBUG if found.
12660 2002-05-25 Ravi Pratap <ravi@ximian.com>
12662 * interface.cs (Populate*): Pass in the TypeContainer as well as
12663 the DeclSpace as parameters so that we can create EmitContexts and
12664 then use that to apply attributes etc.
12666 (PopulateMethod, PopulateEvent, PopulateProperty)
12667 (PopulateIndexer): Apply attributes everywhere.
12669 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
12672 (ApplyAttributes): Update accordingly.
12674 We now apply interface attributes for all members too.
12676 2002-05-26 Miguel de Icaza <miguel@ximian.com>
12678 * class.cs (Indexer.Define); Correctly check if we are explicit
12679 implementation (instead of checking the Name for a ".", we
12680 directly look up if the InterfaceType was specified).
12682 Delay the creation of the PropertyBuilder.
12684 Only create the PropertyBuilder if we are not an explicit
12685 interface implementation. This means that explicit interface
12686 implementation members do not participate in regular function
12687 lookups, and hence fixes another major ambiguity problem in
12688 overload resolution (that was the visible effect).
12690 (DefineMethod): Return whether we are doing an interface
12693 * typemanager.cs: Temporary hack until we get attributes in
12694 interfaces (Ravi is working on that) and we get IndexerName
12695 support in interfaces.
12697 * interface.cs: Register the indexers as properties.
12699 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
12700 warning, I have verified that this is a bug in the .NET runtime
12701 (JavaScript suffers of the same problem).
12703 * typemanager.cs (MemberLookup): When looking up members for
12704 interfaces, the parent of an interface is the implicit
12705 System.Object (so we succeed in searches of Object methods in an
12706 interface method invocation. Example: IEnumerable x; x.ToString
12709 2002-05-25 Miguel de Icaza <miguel@ximian.com>
12711 * class.cs (Event): Events should also register if they do
12712 implement the methods that an interface requires.
12714 * typemanager.cs (MemberLookup); use the new GetInterfaces
12717 (GetInterfaces): The code used to lookup interfaces for a type is
12718 used in more than one place, factor it here.
12720 * driver.cs: Track the errors at the bottom of the file, we kept
12723 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
12724 instance if the method we are calling is static!
12726 2002-05-24 Miguel de Icaza <miguel@ximian.com>
12728 * attribute.cs (ApplyAttributes): Make this function filter out
12729 the IndexerName attribute (as that attribute in reality is never
12730 applied) and return the string constant for the IndexerName
12733 * class.cs (TypeContainer.Emit): Validate that all the indexers
12734 have the same IndexerName attribute, and if so, set the
12735 DefaultName attribute on the class.
12737 * typemanager.cs: The return value might contain other stuff (not
12738 only methods). For instance, consider a method with an "Item"
12739 property and an Item method.
12741 * class.cs: If there is a problem with the parameter types,
12744 2002-05-24 Ravi Pratap <ravi@ximian.com>
12746 * ecore.cs (ImplicitConversionExists): Wrapper function which also
12747 looks at user defined conversion after making a call to
12748 StandardConversionExists - we need this for overload resolution.
12750 * expression.cs : Update accordingly the various method calls.
12752 This fixes 2 bugs filed against implicit user defined conversions
12754 2002-05-22 Miguel de Icaza <miguel@ximian.com>
12756 * statement.cs: Track the result of the assignment.
12758 2002-05-21 Miguel de Icaza <miguel@ximian.com>
12760 * expression.cs (MemberAccess): Improved error reporting for
12761 inaccessible members.
12763 2002-05-22 Martin Baulig <martin@gnome.org>
12765 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
12766 itself with debugging support.
12768 2002-05-22 Martin Baulig <martin@gnome.org>
12770 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
12771 Removed, this isn't needed anymore.
12773 2002-05-20 Martin Baulig <martin@gnome.org>
12775 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
12776 be underlying type for an enum.
12778 2002-05-20 Miguel de Icaza <miguel@ximian.com>
12780 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
12781 that splits out the loading of just the core types.
12783 * rootcontext.cs (ResolveCore): Split the struct resolution in
12784 two, so we can load the enumeration underlying types before any
12787 * expression.cs (Is): Bandaid until we fix properly Switch (see
12788 bug #24985 for details).
12790 * typemanager.cs (ImplementsInterface): The hashtable will contain
12791 a null if there are no interfaces implemented.
12793 2002-05-18 Miguel de Icaza <miguel@ximian.com>
12795 * cs-parser.jay (indexer_declarator): It is fine to have array
12798 2002-05-17 Miguel de Icaza <miguel@ximian.com>
12800 * typemanager.cs: (RegisterBuilder): New function used to register
12801 TypeBuilders that implement interfaces. Since
12802 TypeBuilder.GetInterfaces (as usual) does not work with lame
12804 (AddUserType): register interfaces.
12806 (ImplementsInterface): Use the builder_to_ifaces hash if we are
12807 dealing with TypeBuilder. Also, arrays are showing up as
12808 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
12809 methods can not be invoked on them!
12811 * ecore.cs (ExplicitReferenceConversionExists): Made public.
12812 (ImplicitReferenceConversionExists): Split out from
12813 StandardConversionExists.
12815 * expression.cs (As): We were only implementing one of the three
12816 cases for the as operator. We now implement them all.
12817 (Is): Implement the various other cases for Is as well.
12819 * typemanager.cs (CACHE): New define used to control if we want or
12820 not the FindMembers cache. Seems to have a negative impact on
12821 performance currently
12823 (MemberLookup): Nested types have full acess to
12824 enclosing type members
12826 Remove code that coped with instance/static returns for events, we
12827 now catch this in RealFindMembers.
12829 (RealFindMembers): only perform static lookup if the instance
12830 lookup did not return a type or an event.
12832 2002-05-17 Miguel de Icaza <miguel@ximian.com>
12834 * assign.cs (CompoundAssign): We pass more semantic information
12835 now to Compound Assignments than we did before: now we have all
12836 the information at hand, and now we resolve the target *before* we
12837 do the expression expansion, which allows the "CacheValue" method
12838 to have the effect we intended (before, a [x] += 1 would generate
12839 two differen ArrayAccess expressions from the ElementAccess,
12840 during the resolution process).
12842 (CompoundAssign.DoResolve): Resolve target and original_source here.
12844 2002-05-16 Miguel de Icaza <miguel@ximian.com>
12846 * expression.cs (ArrayAccess): dropped debugging information.
12848 * typemanager.cs: Small bug fix: I was always returning i_members,
12849 instead of one of i_members or s_members (depending on which had
12852 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
12853 method is invoked before any code generation takes place, and it
12854 is a mechanism to inform that the expression will be invoked more
12855 than once, and that the method should use temporary values to
12856 avoid having side effects
12858 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
12860 * ecore.cs (Expression.CacheTemporaries): Provide empty default
12863 * expression.cs (Indirection, ArrayAccess): Add support for
12864 CacheTemporaries in these two bad boys.
12866 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
12867 ldobj or ldind_ref.
12868 (StoreFromPtr): Handle stobj as well.
12870 * expression.cs (UnaryMutator): Share more code.
12872 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
12873 down: I was not tracking the Filter function as well, which
12874 was affecting the results of the cache.
12876 2002-05-15 Miguel de Icaza <miguel@ximian.com>
12878 * attribute.cs: Remove the hack to handle the CharSet property on
12881 2002-05-14 Miguel de Icaza <miguel@ximian.com>
12883 * attribute.cs (DoResolve): More uglyness, we now only try to
12884 resolve the attribute partially, to extract the CharSet
12885 information (only if we are a StructLayout attribute). Otherwise
12887 (GetExtraTypeInfo): Add some code to conditionally kill in the
12888 future this. I am more and more convinced that the .NET
12889 framework has special code to handle the attribute setting on
12892 * expression.cs (IsParamsMethodApplicable): Revert my previous
12893 foreach change here, it was wrong.
12895 2002-05-13 Miguel de Icaza <miguel@ximian.com>
12897 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
12898 (pp_expr): do not abort on unknown input, just return.
12899 (eval): abort if there are pending chars.
12901 * attribute.cs (Attribute.Resolve): Positional parameters are
12902 optional. Deal with that case.
12904 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
12905 the Ansi/Unicode/Auto information for the type.
12907 (TypeContainer.DefineType): instantiate the EmitContext here, as
12908 we will be using it during the type definition (to resolve
12909 attributes) and during the emit phase.
12911 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
12912 to pull type information out of the attributes
12914 (Attribute.Resolve): track the constructor builder, and allow for
12915 multiple invocations (structs and classes will use this).
12917 * ecore.cs (MemberLookupFinal): new version with all the
12918 parameters customizable.
12920 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
12921 constructors. Return if the result value is null (as the error
12922 would have been flagged already by MemberLookupFinal)
12924 Do not allow instances of abstract classes or interfaces to be
12927 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
12928 We have to compare the assembly property here when dealing with
12929 FamANDAssem and Assembly access modifiers, because we might be
12930 creating an assembly from *modules* (that means that we are not
12931 getting TypeBuilders for types defined in other modules that are
12932 part of this assembly).
12934 (Method.Emit): If the method is marked abstract and has a body,
12937 (TypeContainer.DefineMembers): If both the defined member and the
12938 parent name match are methods, then do not emit any warnings: let
12939 the Method.Define routine take care of flagging warnings. But if
12940 there is a mismatch (method overrides something else, or method is
12941 overriwritten by something, then emit warning).
12943 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
12944 set to null, this means `do not check for the return type on the
12947 (Method.Define): set the return type for the method signature to
12948 null, so that we get methods with the same name and parameters and
12949 different return types. This is used to flag warning 114 (you are
12950 hiding a method, and you probably want to use the new/override
12953 * typemanager.cs (MemberLookup): Implemented proper access
12954 control, closing a long standing set of bug reports. The problem
12955 was that the Framework only has two bits: Public and NonPublic,
12956 and NonPublic includes private and protected methods, but we need
12957 to enforce the FamANDAssem, FamOrAssem and Family.
12959 2002-05-11 Miguel de Icaza <miguel@ximian.com>
12961 * statement.cs (GotoCase): Return true: Ammounts to giving up
12962 knowledge on whether we return or not, and letting the other case
12963 be responsible for it.
12965 2002-05-10 Miguel de Icaza <miguel@ximian.com>
12967 * driver.cs: Do not load directories for each file processed, only
12968 do it if there is a pattern.
12970 * ecore.cs: Report readonly assigns here as well, as we might have
12971 been resolved only by MemberAccess.
12973 (SimpleName.SimpleNameResolve): Also be useful for LValue
12974 resolution. We need this to propagate assign to local readonly variables
12976 * typemanager.cs: Use a ptrhashtable for the criteria, because we
12977 do not want to reuse potential criteria memory.
12979 * class.cs (MyEventBuilder): Set reflected_type;
12981 * ecore.cs (Constantify): Added support for constifying bools.
12983 (RootContext.LookupType): Added a cache for values looked up in
12984 the declaration space.
12986 * typemanager.cs (FindMembers): Now is a front-end to
12987 RealFindMembers, and provides a two-level hashtable-based cache to
12990 15% performance improvement: from 22.5 to 19.2 seconds.
12992 * expression.cs (IsParamsMethodApplicable): use foreach.
12993 (Invocation.DoResolve): ditto.
12994 (New.DoResolve): ditto.
12995 (ArrayCreation.DoResolve): ditto.
12997 * ecore.cs (FindMostEncompassingType): use foreach.
12999 * delegate.cs (NewDelegate.DoResolve): Use foreach
13001 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
13002 (RemoveMethods): use foreach.
13004 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
13005 nested foreach statements instead of for, and also break out of
13006 the inner loop once a match is found.
13008 (Invocation.OverloadResolve): Use foreach, simplify the code.
13010 2002-05-08 Miguel de Icaza <miguel@ximian.com>
13012 * cfold.cs (BinaryFold): During an enumeration evaluation context,
13013 we actually unwrap the expression to allow for extra information
13016 * expression.cs: Use Shr_Un on unsigned operations.
13018 2002-05-08 Ravi Pratap <ravi@ximian.com>
13020 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
13021 applicable operators was not being considered correctly. This closes
13022 the bug Miguel reported.
13024 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
13026 * attribute.cs: check that the type derives from System.Attribute
13027 and report the correct error in that case (moved the duplicate code to
13028 its own method, too).
13030 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
13032 * attribute.cs: lookup attribute type name as the spec says: first the
13033 bare attribute name and then name + "Attribute" (nant compiles with
13034 mcs after this fix).
13036 2002-05-07 Miguel de Icaza <miguel@ximian.com>
13038 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
13039 Because of the way we parse things, we should try to see if a
13040 UIntConstant can fit in an integer.
13042 2002-05-07 Ravi Pratap <ravi@ximian.com>
13044 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
13045 when we are in an explicit context.
13047 (ConvertReferenceExplicit): When converting from Iface type S to Class
13048 T make sure the rules are implemented as an OR.
13050 * parameter.cs (ParameterType): Make it a property for now although the
13051 purpose really isn't anything immediate.
13053 * expression.cs (Is*Applicable): Do better checking on the parameter type
13054 of a ref/out parameter. The ones from the system assemblies are already
13055 marked with the correct type so we don't need to do any correction.
13057 * ecore.cs (StandardConversionExists): Conversion from Interface types to
13058 the object type is standard too so include that.
13060 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13062 * ecore.cs (StandardConversionExists): Augment with missing code:
13063 deal with IntConstant, LongConstants and Enumerations.
13065 * assign.cs: Report the error, instead of failing silently
13067 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
13068 typecontainer that they are declared, because the
13069 typecontainer/namespace will have the list of using clauses that
13070 need to be applied.
13072 Assembly Attributes were escaping the normal registration
13075 (EmitCode): Apply attributes within an EmitContext that represents
13076 the container they were declared on.
13078 * cs-parser.jay: Track bases for structs. How did I get this wrong?
13080 2002-05-06 Ravi Pratap <ravi@ximian.com>
13082 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
13083 Revamp completely - make much cleaner as we now operate only
13086 (FindMostSpecificSource, FindMostSpecificTarget): New methods
13087 to implement the logic detailed in the spec more correctly.
13089 (UserDefinedConversion): Update accordingly.
13091 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13093 * statement.cs: Return flow analysis information up.
13095 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
13098 (token): Do not consume an extra character before calling
13101 2002-05-06 Piers Haken <piersh@friskit.com>
13103 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
13105 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13107 * class.cs (Constructor.Emit): Set the IsStatic flag in the
13108 EmitContext during the instance constructor initializer
13109 resolution, to stop access to instance variables.
13111 This is mandated by the spec, last paragraph of the `constructor
13112 initializers' section.
13114 2002-05-05 Miguel de Icaza <miguel@ximian.com>
13116 * cs-parser.jay, class.cs (Accessor): new class used to represent
13117 an accessor (get or set). In the past we used `null' to represent
13118 a missing accessor. But this is ambiguous because there was no
13119 way to tell in abstract indexers/properties if one of them was
13122 Now there is a way of addressing that.
13124 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
13125 instead of FindMembers.
13127 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
13128 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
13130 * attribute.cs: Treat indexers and properties as the same in terms
13131 of applying attributes
13133 * ecore.cs (FindMostEncompassedType): Use statically initialized
13134 EmptyExpressions()s like we do elsewhere to avoid creating useless
13135 objects (and we take this out of the tight loop).
13137 (GetConversionOperators): Move the code to extract the actual
13138 operators to a separate routine to clean things up.
13140 2002-05-04 Miguel de Icaza <miguel@ximian.com>
13142 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
13143 events are always registered FieldBuilders.
13145 * class.cs (FieldBase): New class shared by Fields
13147 * delegate.cs: If we are a toplevel delegate, use our full name.
13148 If we are a nested delegate, then only use our tail name.
13150 2002-05-02 Ravi Pratap <ravi@ximian.com>
13152 * expression.cs (IsApplicable): Ensure that we add the "&" to
13153 ref/out types before comparing it with the type of the argument.
13155 (IsParamsMethodApplicable): Ditto.
13157 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
13160 * delegate.cs : Handle the case when we have more than one applicable
13161 method. Flag an error only when we finish checking all.
13163 2002-05-02 Miguel de Icaza <miguel@ximian.com>
13165 * expression.cs: Add support for boolean static initializers.
13167 2002-05-01 Miguel de Icaza <miguel@ximian.com>
13169 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
13171 * parameter.cs (ComputeParameterTypes,
13172 ComputeAndDefineParameterTypes): Better error handling: now we
13173 clear the `types' cache if we fail during any of the type lookups.
13174 We also return the status code correctly to our caller
13176 * delegate.cs: If we fail to define a delegate, abort the extra
13179 * expression.cs (Binary.ResolveOperator): for
13180 operator==(object,object) and operator !=(object, object) we also
13181 have to verify that there is an implicit conversion from one to
13184 (ArrayAccess.DoResolve): Array Access can operate on
13187 2002-04-30 Miguel de Icaza <miguel@ximian.com>
13189 * assign.cs (CompoundAssign): A new class used as a "flag" that
13190 the assignment actually is happening as part of a compound
13191 assignment operator.
13193 During compound assignment, a few new rules exist to enable things
13200 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
13201 to the type of x) if y is implicitly convertible to the type of x,
13202 and the operator is a builtin operator and the return type of the
13203 operator is explicitly convertible to the type of x.
13205 * rootcontext.cs: Reset warning level to 2. 4 catches various
13206 "interesting" features in mcs, we must clean this up at some
13207 point, but currently am trying to kill other bugs ;-)
13209 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
13210 in container classes as well.
13212 * expression.cs (Binary.ResolveOperator): Handle string case
13213 before anything else (as operator overloading does emit an error
13214 before doing anything else).
13216 This code could go away when we move to a table driven model, but
13217 i could not come up with a good plan last night.
13219 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
13221 * typemanager.cs (CSharpName): reimplementation using regex.
13222 * class.cs: added null check for fields in Emit
13223 * rootcontext.cs: set warninglevel to 4
13225 2002-04-29 Miguel de Icaza <miguel@ximian.com>
13227 * typemanager.cs (CSharpName): reimplemented with Lupus
13230 2002-04-28 Miguel de Icaza <miguel@ximian.com>
13232 * statement.cs (If): correclty implement Resolve, because we were
13233 not catching sem errors in there. The same process is needed
13235 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
13238 (Statement.Warning_DeadCodeFound): Factorize code.
13239 (While): Report dead code here too.
13241 (Statement): Added Resolve virtual method to allow
13242 for resolution split from the emit code.
13244 2002-04-26 Miguel de Icaza <miguel@ximian.com>
13246 * statement.cs (EmitBoolExpression): No longer try to resolve the
13248 (MakeBoolean): New utility function that resolve, implicitly
13249 converts to boolean and tags the expression.
13252 (If, Do): Implement dead code elimination.
13253 (While): Implement loop inversion
13255 (Do, While, For, If): Resolve the expression prior to calling our
13258 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
13261 - added method Report28 (warning: program has more than one entry point)
13262 - added method IsEntryPoint, implements paragraph 10.1 of the spec
13263 - modified method Method.Define, the part at the end of the method
13265 * rootcontext.cs: added static public Location EntryPointLocation;
13267 * ../errors/cs0028.cs : Add test case for the above warning.
13270 - modified method CSharpName to allow arrays of primitive type to
13271 be printed nicely (e.g. instead of System.Int32[][] it now prints
13273 - added method CSharpSignature: returns the signature of a method
13274 in string format to be used in reporting errors, warnings, etc.
13276 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
13279 2002-04-26 Ravi Pratap <ravi@ximian.com>
13281 * delegate.cs (Define): Fix extremely silly bug where I was
13282 setting the type of the 'object' parameter of the BeginInvoke
13283 method to System.IAsyncResult instead of System.Object ;-)
13285 2002-04-26 Miguel de Icaza <miguel@ximian.com>
13287 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
13290 (Constructor.Emit): return if we fail to initialize the
13291 constructor. Another door closed!
13293 * expression.cs (New.DoResolve): Improve error message (from -6 to
13294 1501). Use DeclaredOnly lookup to find the exact constructor.
13296 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
13297 loop. This is useful.
13299 * cs-parser.jay: Adjust the default parameters so that destructors
13300 have the proper signature.
13302 2002-04-26 Martin Baulig <martin@gnome.org>
13304 * driver.cs (LoadAssembly): If `assembly' contains any characters
13305 which are only valid in path names and not in assembly names
13306 (currently slash, backslash and point), use Assembly.LoadFrom ()
13307 instead of Assembly.Load () on the `assembly' (before iteration
13308 over the link_paths).
13310 2002-04-26 Martin Baulig <martin@gnome.org>
13312 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
13314 2002-04-25 Miguel de Icaza <miguel@ximian.com>
13316 * class.cs (Property): use the new typemanager.MemberLookup
13318 (TypeContainer.MemberLookup): Implement using the
13319 TypeManager.MemberLookup now.
13321 * typemanager.cs: Make MemberLookup a function of the TypeManager,
13322 and return MemberInfos, so that these can be used without an
13323 EmitContext (what we had before).
13325 2002-04-24 Miguel de Icaza <miguel@ximian.com>
13327 * expression.cs: Fix the case where the argument to params if the
13328 type of the params. I omitted handling this before. Fixed
13330 2002-04-22 Miguel de Icaza <miguel@ximian.com>
13332 * driver.cs: Call BootCorlib_PopulateCoreType
13334 * class.cs (Property.CheckBase): Check for properties only, not
13337 * interface.cs: Temporary hack: try/catch around the
13338 CustomAttributeBuilder, because I am getting an exception that I
13341 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
13342 types whose definitions are required to be there (attributes are
13343 defined before standard types).
13345 Compute definitions as we boot the various types, as they are used
13346 immediately (value_type class will need object_type, but if we do
13347 not initialize object_type, we will pass a null, which will let
13348 the runtime pick the System.Object from the existing corlib, which
13349 is not what we want).
13351 2002-04-22 Patrik Torstensson <totte@labs2.com>
13353 * cs-tokenizer.cs: fixed a number of trim() issues.
13355 2002-04-22 Ravi Pratap <ravi@ximian.com>
13357 * expression.cs (Argument.Type): Ensure that we return the correct
13358 type when we have out or ref parameters [in which case we
13361 2002-04-22 Miguel de Icaza <miguel@ximian.com>
13363 * class.cs (Property, Indexer): Allow extern modifier in there.
13365 * typemanager.cs (InitBaseTypes): Initializes object_type and
13366 value_type, since those will be used early on during the bootstrap
13367 process to compile corlib.
13369 (InitCoreTypes): Move code from here to InitBaseTypes.
13371 2002-04-21 Miguel de Icaza <miguel@ximian.com>
13373 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
13374 single-dimension arrays as using the ldlen opcode.
13376 Daniel Lewis discovered this optimization.
13378 * typemanager.cs: Add signature for System.Array::get_Length
13380 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13382 * statement.cs: report the error when the foreach does not apply to an
13383 array nor a collection.
13385 2002-04-19 Miguel de Icaza <miguel@ximian.com>
13387 * expression.cs: Add implicit conversions to the operator ~.
13389 * constant.cs (DecimalConstant.Emit): Emit decimal value.
13391 * typemanager.cs: Locate the decimal constructor.
13393 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13395 * attribute.cs: use the new property of TypeOf.
13396 * expression.cs: added 'get' property around typearg.
13398 These changes fix a build breaker reported by NickD. Is this the
13399 correct way to fix? If not, please, revert my changes and make it
13402 2002-04-17 Miguel de Icaza <miguel@ximian.com>
13404 * attribute.cs: Add support for typeof in attribute invocations.
13405 I am not sure that this is right though.
13407 2002-04-14 Duncan Mak <duncan@ximian.com>
13409 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
13410 Binary.Operator.Division case.
13412 2002-04-13 Ravi Pratap <ravi@ximian.com>
13414 * class.cs (DefineType): Ensure that we do a proper check on
13415 attribute types and also register it with the TypeManager.
13417 (TypeContainer.Targets): The default for attribute types is
13418 AttributeTargets.All.
13420 * attribute.cs (ApplyAttributes): Registering the attribute type
13421 is done elsewhere, not when we discover we have a Usage attribute.
13423 2002-04-12 Ravi Pratap <ravi@ximian.com>
13425 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
13426 and get rid of is_delegate parameter.
13428 * everywhere : update.
13430 2002-04-12 Ravi Pratap <ravi@ximian.com>
13432 * cs-parser.jay (compilation_unit): Revamp completely to use
13433 some new ideas that I got from Rhys' grammar to solve the problems
13434 with assembly level attributes.
13436 (outer_declaration): New grammar production.
13438 (attribute_sections): Add.
13440 (opt_attributes): Base on attribute_sections
13442 (namespace_declaration): Allow opt_attributes to tackle the case
13443 when we have assembly level attributes - we are clever in this
13446 * attribute.cs (ApplyAttributes): Do not worry about assembly
13447 attributes in the non-global context.
13449 * rootcontext.cs (AddGlobalAttributes): Go back to using this
13450 instead of SetGlobalAttributes.
13452 * class.cs, rootcontext.cs : Ensure we define and generate
13453 attribute types before anything else.
13455 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
13456 and flag the new error -20 for the case when the attribute type
13457 does not have valid targets specified. csc does not catch this.
13459 * ../errors/errors.txt : update for error # -20
13461 2002-04-11 Ravi Pratap <ravi@ximian.com>
13463 * support.cs (InternalParameters.ParameterModifier): Do some null
13464 checking and return sane values.
13466 * class.cs (Method.Define): If we are a PInvoke method, ensure
13467 that we are static and extern. Report error # 601
13469 * ../errors/cs0601.cs : Add test case for the above error.
13471 2002-04-07 Ravi Pratap <ravi@ximian.com>
13473 * rootcontext.cs (attribute_types): We need to keep type of
13474 all attribute types separately and emit code for them first.
13476 (RegisterAttribute) : Implement.
13478 * class.cs (DefineType): Check if the current Type is a custom
13479 attribute type and register it accordingly.
13481 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
13482 adding the first attribute twice and rename to
13484 (SetGlobalAttributes): this.
13486 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
13489 * attribute.cs (ApplyAttributes): Take an additional argument telling us
13490 if we are processing global arguments. Hmm, I am unsure of this.
13492 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13494 * expression.cs: added static array of strings to avoid calling
13495 Enum.ToString () for Operator in Binary. Significant recover of
13498 2002-04-10 Miguel de Icaza <miguel@ximian.com>
13500 * class.cs (FindMembers): Allow the Builders of the various
13501 members to be null. If they are skip them. This only happens
13502 during the PInvoke declaration.
13504 2002-04-09 Miguel de Icaza <miguel@ximian.com>
13506 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
13507 failure, so we do not keep going afterwards.
13509 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
13510 wanted to pass `false' as the `is_delegate' argument. If this is
13511 the case, why not use delegate_type == null to mean `is_delegate =
13512 false' and anything else as is_delegate = true.
13514 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
13516 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
13517 code for the section, not the beginning of the tests.
13519 2002-04-08 Miguel de Icaza <miguel@ximian.com>
13521 * cfold.cs: Handle operator + (Enum x, Underlying x)
13523 * expression.cs (Binary): same. Warn about errors where we have
13524 Enum/Enum in operator + as well.
13526 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
13529 - added support for switch(bool)
13530 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
13531 - add TableSwitchEmit() to handle table-based switch statements
13533 2002-04-05 Ravi Pratap <ravi@ximian.com>
13535 * expression.cs (Invocation.OverloadResolve): Factor out code which
13536 does parameter compatibility checking with arguments so that we can
13537 re-use the code even from Delegate.VerifyApplicability
13539 (VerifyArgumentsCompat): Move above code here.
13541 * delegate.cs (VerifyApplicability): Get rid of duplicate code
13542 and instead make a call to the above method.
13544 2002-03-31 Ravi Pratap <ravi@ximian.com>
13546 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
13547 We use it to keep track of classes which are attribute types.
13549 2002-04-02 Miguel de Icaza <miguel@ximian.com>
13551 * delegate.cs (Delegate.Define): Correctly define the types in the
13552 presence of fixed and array parameters.
13554 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
13557 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
13558 include NonPublic after the first iteration.
13560 * class.cs (Indexer.CheckBase): Only check if both parents are
13563 * cs-parser.jay (accessor_body): If empty, set to null.
13565 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
13566 same code path here to resolve constants names that we did have in
13567 MemberAccess.DoResolve. There is too much code duplicated here.
13569 2002-04-01 Miguel de Icaza <miguel@ximian.com>
13571 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
13573 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
13576 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
13577 tokens, numbers and strings.
13579 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
13582 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
13583 asyncronous parameters and the regular parameters.
13585 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
13586 specify the target directory.
13588 * expression.cs: (This.DoResolve): Simplify
13589 (As.Emit): Optimize, do not generate IsInst if the expression is
13590 always of the given type.
13592 (Is.DoResolve): Bug fix, we were reporting both always/never for
13595 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
13596 creating too many unnecessary arrays.
13598 2002-03-31 Miguel de Icaza <miguel@ximian.com>
13600 * class.cs (EmitFieldInitializer): Use Assign expression to assign
13601 fields instead of rolling our own initializer. Takes care of all
13602 implicit conversions, and drops unnecessary static checks/argument.
13604 2002-03-31 Dick Porter <dick@ximian.com>
13606 * driver.cs: use the GetDirectories() return values properly, and
13607 use "/" as path separator.
13609 2002-03-30 Miguel de Icaza <miguel@ximian.com>
13611 * expression.cs (Unary): Optimize - - expr into expr.
13612 (Binary): Optimize a + (-b) into a -b.
13614 * codegen.cs (CodeGen): Made all methods static.
13616 2002-03-29 Miguel de Icaza <miguel@ximian.com>
13620 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
13621 TypeBuilder property.
13623 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
13626 * tree.cs: Removed the various RecordXXXX, and replaced with a
13627 single RecordDecl. Removed all the accessor methods, and just
13628 left a single access point Type
13630 * enum.cs: Rename DefineEnum to DefineType.
13632 * decl.cs: New abstract method `DefineType' used to unify the
13633 Defines for Enumerations, Interfaces, TypeContainers and
13636 (FindType): Moved LookupInterfaceOrClass here. Moved the
13637 LookupBaseClasses method that used to live in class.cs and
13638 interface.cs here, and renamed to FindType.
13640 * delegate.cs: Implement DefineType. Take advantage of the
13641 refactored pattern for locating the parent builder without taking
13642 the parent_builder argument (which we know does not work if we are
13643 nested, and triggering a toplevel definition).
13645 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13647 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
13648 accessibility of a member has changed during override and report
13651 * class.cs (Method.Define, Property.Define): Only complain on
13652 overrides if the method is private, any other accessibility is
13653 fine (and since we just checked the permission is the same, we are
13656 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
13657 and elif are processed always. The other pre-processing
13658 directives are only processed if we are "taking" the path
13660 2002-03-29 Martin Baulig <martin@gnome.org>
13662 * class.cs (Method.Emit): Only emit symbolic debugging info if the
13663 current location is not Null.
13665 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
13666 a separate method so we can profile it.
13668 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
13669 `span.Seconds' are just seconds, but no minutes or hours.
13670 (MainDriver): Profile the CodeGen.SaveSymbols calls.
13672 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13674 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
13675 Remove the gratuitous set of Final:
13677 // If an interface implementation, then we can set Final.
13678 if (((flags & MethodAttributes.Abstract) == 0) &&
13679 implementing.DeclaringType.IsInterface)
13680 flags |= MethodAttributes.Final;
13682 I do not know what I was smoking when I used that.
13685 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
13686 step into fixing the name resolution issues for delegates and
13687 unifying the toplevel name resolution.
13689 2002-03-28 Martin Baulig <martin@gnome.org>
13691 * class.cs (Method.Emit): If we have a symbol writer, call its
13692 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
13693 tell it about the current method.
13695 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
13696 writer that we're going to emit the first byte of IL code for a new
13697 statement (a new source line).
13698 (EmitContext.EmitTopBlock): If we have a symbol writer, call
13699 EmitContext.Mark() before emitting any code.
13701 * location.cs (SymbolDocument): Return null when we're Null.
13703 * statement.cs (Statement): Moved the `Location loc' variable here.
13704 (Statement.EmitBoolExpression): If we have a symbol writer, call
13705 ec.Mark() before emitting any code to tell it that we're at the
13706 beginning of a new statement.
13707 (StatementExpression): Added `Location' argument to the constructor.
13708 (Block): Added public readonly variable `StartLocation' and public
13709 variable `EndLocation'. The latter is to be set using SetEndLocation().
13710 (Block): Added constructor which takes a start and end location.
13711 (Block.SetEndLocation): New method. This sets the end location.
13712 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
13713 local variables we create.
13714 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
13715 each statement and do also mark the begin and end of the block.
13717 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
13718 tell it the current lexer.Location, use Location.Null for the end of the
13720 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
13721 current block, set its end location using SetEndLocation().
13722 (statement_expression): StatementExpression constructor now takes the
13723 lexer.Location as additional argument.
13724 (for_statement, declare_local_variables): Likewise.
13725 (declare_local_variables): When creating a new implicit block, use the
13726 new Block constructor and pass it the lexer.Location.
13728 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13730 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
13731 members also on the parent interfaces recursively.
13733 2002-03-27 Miguel de Icaza <miguel@ximian.com>
13735 * report.cs: Use new formats, since Gonzalo finished the missing
13738 * expression.cs (Binary.ResolveOperator): added missing operator|
13739 operator& and operator^ for bool/bool.
13741 * cs-parser.jay: CheckDef now takes a Location argument that is
13742 used to report errors more precisly (instead of reporting the end
13743 of a definition, we try to track something which is a lot closer
13744 to the source of the problem).
13746 * cs-tokenizer.cs: Track global token use, so we can properly flag
13747 the use of #define/#undef after the first token has been seen.
13749 Also, rename the reportXXXX to Error_DescriptiveName
13751 * decl.cs (DeclSpace.IsTopLevel): Move property here from
13752 TypeContainer, so that Enum and Interface can use this too.
13754 * class.cs (TypeContainer.LookupInterfaceOrClass,
13755 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
13756 `builder' argument. Typically this was used to pass the parent
13757 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
13760 The problem is that a nested class could trigger the definition of
13761 a toplevel class, and the builder would be obviously wrong in that
13764 So we drop this argument, and we compute dynamically the
13765 TypeBuilder/ModuleBuilder (the correct information was available
13766 to us anyways from DeclSpace.Parent)
13768 * interface.cs (Interface.DefineInterface): Drop builder
13769 parameter cleanup like class.cs
13771 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
13774 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
13777 (Try.Emit): Propagate the returns value from the statement.
13779 (Return.Emit): Even if we are leavning
13781 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
13783 * modifiers.cs: Fix the computation of MethodAttributes flags.
13785 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
13787 * driver.cs: allow compilation of files that start with '/'.
13788 Add a default case when checking the argument of --target.
13790 2002-03-25 Miguel de Icaza <miguel@ximian.com>
13792 * interface.cs: Implement the same search algorithm for types in
13793 the interface code.
13795 * delegate.cs: Do not allow multiple definition.
13797 * Recovered ChangeLog that got accidentally amputated
13799 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
13801 * rootcontext.cs: Load manually enum to allow core classes to
13802 contain enumerations.
13804 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
13805 Update to new static methods in TypeManager.
13807 * typemanager.cs (GetMethod, GetConstructor): Use our
13808 implementation of FindMembers to find the members, since during
13809 corlib compilation, the types are TypeBuilders and GetMethod and
13810 GetConstructor do not work.
13812 Make all methods in TypeManager static.
13814 (InitCodeHelpers): Split the functionality from
13815 the InitCodeTypes function.
13817 * driver.cs: Call InitCodeHelpers after we have populated the
13820 * cs-parser.jay (delegate_declaration): we did not used to compute
13821 the delegate name correctly for void delegates.
13823 2002-03-24 Miguel de Icaza <miguel@ximian.com>
13825 * rootcontext.cs (RootContext): Init the interface_resolve_order
13826 and type_container_resolve_order always.
13828 (ResolveCore, BootstrapCorlib_ResolveClass,
13829 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
13830 compiler when compiling with --nostdlib
13832 * class.cs (TypeContainer.DefineType): Check that our parent is
13833 not null. This test is most important when we are bootstraping
13836 * codegen.cs: Split out the symbol writing code.
13838 2002-03-25 Martin Baulig <martin@gnome.org>
13840 * driver.cs (-g): Made -g an alias for --debug.
13842 2002-03-24 Martin Baulig <martin@gnome.org>
13844 * codegen.cs (SymbolWriter): New public variable. Returns the
13845 current symbol writer.
13846 (CodeGen): Added `bool want_debugging_support' argument to the
13847 constructor. If true, tell the ModuleBuild that we want debugging
13848 support and ask it for the ISymbolWriter.
13849 (Save): If we have a symbol writer, call it's Close() method after
13850 saving the assembly.
13852 * driver.c (--debug): New command line argument to create a
13853 debugger information file.
13855 * location.cs (SymbolDocument): New public property. Returns an
13856 ISymbolDocumentWriter object for the current source file or null
13857 if we don't have a symbol writer.
13859 2002-03-21 Miguel de Icaza <miguel@ximian.com>
13861 * driver.cs (LoadAssembly): Correctly return when all the paths
13862 have been tried and not before.
13864 * statement.cs (Switch.Emit): return the actual coverage for this
13865 statement (returns/not-returns)
13867 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
13868 switch of the statement if we are the last switch section. That
13869 kills two problems: try/catch problems (we used to emit an empty
13870 nop at the end) and switch statements where all branches would
13873 2002-03-19 Miguel de Icaza <miguel@ximian.com>
13875 * driver.cs: Add default assemblies (the equivalent to the
13876 Microsoft CSC.RSP file)
13878 * cs-tokenizer.cs: When updating `cols and setting it to zero,
13879 also update tokens_seen and set it to false.
13881 * driver.cs: Implement --recurse for Mike.
13883 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
13884 correctly splitting out the paths.
13886 2002-03-18 Miguel de Icaza <miguel@ximian.com>
13888 * interface.cs (Interface.PopulateProperty): Instead of using
13889 `parent' as the declaration space for the set parameters, use
13892 * support.cs (InternalParameters): InternalParameters constructor
13893 takes a DeclSpace instead of a TypeContainer.
13895 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
13896 types are being initialized, load the address of it before calling
13899 (New): Provide a mechanism to disable the generation of local
13900 value type temporaries when the caller will be providing us with
13901 an address to store it.
13903 (ArrayCreation.EmitDynamicInitializers): Use it.
13905 2002-03-17 Miguel de Icaza <miguel@ximian.com>
13907 * expression.cs (Invocation.EmitArguments): Only probe for array
13908 property if there is more than one argument. Sorry about that.
13910 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
13911 empty param arrays.
13913 * class.cs (Method.LabelParameters): Fix incorrect code path that
13914 prevented the `ParamArrayAttribute' from being applied to the
13917 2002-03-16 Miguel de Icaza <miguel@ximian.com>
13919 * support.cs (ReflectionParameters): Correctly compute whether the
13920 last argument is a params array. Fixes the problem with
13923 * typemanager.cs: Make the assemblies array always be non-null
13924 (empty, but non-null)
13926 * tree.cs (RecordDecl): New function that abstracts the recording
13927 of names. This reports error 101, and provides a pointer to the
13928 previous declaration. Fixes a crash in the compiler.
13930 * cs-parser.jay (constructor_declaration): Update to new grammar,
13931 and provide a constructor_body that can be empty.
13933 2002-03-15 Miguel de Icaza <miguel@ximian.com>
13935 * driver.cs: Add support for --resources.
13937 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
13938 Make all types for the various array helper methods be integer.
13940 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
13941 CheckState to ConvCast.
13943 (ConvCast): Now it takes a `checked' state argument, to avoid
13944 depending on the emit context for the conversion, and just using
13945 the resolve time setting.
13947 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
13948 instead of Invocation.EmitArguments. We do not emit the original
13949 arguments, instead we emit those which have been converted to
13950 unsigned int expressions.
13952 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
13954 * codegen.cs: ditto.
13956 * expression.cs (LocalVariableReference): Drop the use of the
13957 Store function that depended on the variable index.
13959 * statement.cs (VariableInfo): Drop the `Idx' property from this
13960 class, as this is not taking into account the indexes for
13961 temporaries tat we generate during the execution, getting the
13964 * class.cs: First emit class initializers, then call the parent
13967 * expression.cs (Binary): Fix opcode emision.
13968 (UnaryMutator.EmitCode): Support checked code generation
13970 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
13971 matches for events for both the Static and Instance scans,
13972 pointing to the same element. Fix that.
13974 2002-03-14 Miguel de Icaza <miguel@ximian.com>
13976 * rootcontext.cs (ResolveTree): Always set the
13977 interface_resolve_order, because nested interfaces will be calling
13980 * class.cs (GetInterfaceOrClass): Track the same resolution
13981 process used by TypeManager.LookupType. This fixes the nested
13982 type lookups in class declarations (separate path from
13985 (TypeContainer.DefineType): Also define nested interfaces.
13986 (TypeContainer.RegisterOrder): New public function used to
13987 register the order in which child interfaces need to be closed.
13989 Nested interfaces need to be closed after their parents have been
13992 * interface.cs (InterfaceAttr): Put all the logic for computing
13993 the interface attribute here.
13995 (DefineInterface): Register our interface order with the
13996 RootContext or with the TypeContainer depending on the case.
13998 2002-03-12 Miguel de Icaza <miguel@ximian.com>
14000 * cs-parser.jay: rework foreach statement to work with the new
14001 changes to the policy on SimpleNames.
14003 * report.cs: support Stacktrace on warnings as well.
14005 * makefile: drop --unsafe and /unsafe from the compile.
14007 2002-03-13 Ravi Pratap <ravi@ximian.com>
14009 * ecore.cs (StandardConversionExists): Modify to take an Expression
14010 as the first parameter. Ensure we do null -> reference type conversion
14013 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
14014 temporary Expression objects.
14016 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
14018 * interface.cs: workaround bug in method overloading resolution
14019 (there is already a bugzilla bug for it).
14021 2002-03-12 Miguel de Icaza <miguel@ximian.com>
14023 We could also solve this problem by having a separate path for
14024 performing type lookups, instead of DoResolve, we could have a
14025 ResolveType entry point, and only participating pieces of the
14026 production (simplename, deref, array) would implement this.
14028 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
14029 signal SimpleName to only resolve type names and not attempt to
14030 resolve anything else.
14032 * expression.cs (Cast): Set the flag.
14034 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
14036 * class.cs: Only report 108 if there is no `new' modifier.
14038 * cs-parser.jay: rework foreach statement to work with the new
14039 changes to the policy on SimpleNames.
14041 * report.cs: support Stacktrace on warnings as well.
14043 * makefile: drop --unsafe and /unsafe from the compile.
14045 2002-03-11 Miguel de Icaza <miguel@ximian.com>
14047 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
14048 lookups here, instead of doing that at parse time. This means
14049 that our grammar will not introduce `LocalVariableReferences' as
14050 expressions at this point. That solves the problem of code like
14054 static void Main ()
14058 This is only half the fix. The full fix requires parameters to
14059 also be handled in this way.
14061 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
14062 makes the use more obvious of the DeclSpace. The
14063 ec.TypeContainer.TypeBuilder is now only used to pull the
14064 TypeBuilder for it.
14066 My theory is that I can get rid of the TypeBuilder completely from
14067 the EmitContext, and have typecasts where it is used (from
14068 DeclSpace to where it matters).
14070 The only pending problem is that the code that implements Aliases
14071 is on TypeContainer, and probably should go in DeclSpace.
14073 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
14074 lookups here, instead of doing that at parse time. This means
14075 that our grammar will not introduce `LocalVariableReferences' as
14076 expressions at this point. That solves the problem of code like
14080 static void Main ()
14084 This is only half the fix. The full fix requires parameters to
14085 also be handled in this way.
14087 * class.cs (Property.DefineMethod): When implementing an interface
14088 method, set newslot, when implementing an abstract method, do not
14089 set the flag (before we tried never setting it, or always setting
14090 it, which is the difference).
14091 (Indexer.DefineMethod): same.
14092 (Method.DefineMethod): same.
14094 * ecore.cs: Only set the status used flag if we get back a Field.
14096 * attribute.cs: Temporary hack, so Paolo can keep working.
14098 2002-03-08 Ravi Pratap <ravi@ximian.com>
14100 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
14101 the unmanaged type in the case we have a MarshalAs attribute.
14103 (Resolve): Handle the case when we are parsing the special MarshalAs
14104 attribute [we need to store the unmanaged type to use later]
14106 * typemanager.cs (marshal_as_attr_type): Built in type for the
14107 MarshalAs Attribute.
14109 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
14110 on parameters and accordingly set the marshalling info.
14112 2002-03-09 Miguel de Icaza <miguel@ximian.com>
14114 * class.cs: Optimizing slightly by removing redundant code after
14115 we switched to the `NoTypes' return value.
14116 (Property.DefineMethod): use NoTypes here too.
14118 This fixes the bug I introduced in my last batch of changes.
14120 2002-03-05 Ravi Pratap <ravi@ximian.com>
14122 * tree.cs (RecordEnum): Add. We now keep track of enums too.
14124 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
14125 Enums since those are types too.
14127 * cs-parser.jay (enum_declaration): Record enums as we parse them.
14129 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
14130 thanks to a call during the lookup process.
14132 2002-03-07 Miguel de Icaza <miguel@ximian.com>
14134 * statement.cs (Foreach): Lots of work to accomodate a particular
14135 kind of foreach statement that I had not kept in mind. It is
14136 possible to have foreachs on classes that provide a GetEnumerator
14137 method that return objects that implement the "pattern" for using
14138 a foreach, there is no need to support GetEnumerator
14141 This is needed to compile nant.
14143 * decl.cs: Only report 114 if the member is not `Finalize' and if
14144 the warning level is at least 2.
14146 * class.cs: Moved the compare function from Method to
14149 (MethodSignature.InheritableMemberSignatureCompare): Add new
14150 filter function that is used to extract inheritable methods from a
14153 (Method.Define): Use the new `inheritable_method_signature_filter'
14156 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
14159 2002-03-06 Miguel de Icaza <miguel@ximian.com>
14161 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
14163 * cs-parser.jay: Add opt_semicolon to the interface declaration.
14165 * expression.cs: Pass location information to
14166 ConvertImplicitStandard.
14168 * class.cs: Added debugging code to track return values from
14171 2002-03-05 Miguel de Icaza <miguel@ximian.com>
14173 * expression.cs (Is.DoResolve): If either side of the `is' is an
14174 interface, do not flag the warning.
14176 * ecore.cs (ImplicitReferenceConversion): We need a separate test
14179 * report.cs: Allow for --fatal to be used with --probe.
14181 * typemanager.cs (NoTypes): Move the definition for the empty Type
14184 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
14186 (TypeContainer.DefineProxy): New function used to proxy to parent
14187 implementations when implementing interfaces.
14188 (TypeContainer.ParentImplements): used to lookup if our parent
14189 implements a public function that is required by an interface.
14190 (TypeContainer.VerifyPendingMethods): Hook this up.
14192 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
14193 `modules' and `assemblies' arraylists into arrays. We only grow
14194 these are the very early start up of the program, so this improves
14195 the speedof LookupType (nicely measured).
14197 * expression.cs (MakeByteBlob): Replaced unsafe code with
14198 BitConverter, as suggested by Paolo.
14200 * cfold.cs (ConstantFold.Binary): Special case: perform constant
14201 folding of string concatenation, but if either side is a string,
14202 and the other is not, then return null, and let the runtime use
14203 the concatenation on the string plus the object (using
14204 `Object.ToString').
14206 2002-03-04 Miguel de Icaza <miguel@ximian.com>
14208 Constant Folding has been implemented now.
14210 * expression.cs (Unary.Reduce): Do not throw an exception, catch
14211 the error instead on types that are not supported in one's
14214 * constant.cs (Constant and all children): New set of functions to
14215 perform implict and explicit conversions.
14217 * ecore.cs (EnumConstant): Implement the new functions to perform
14218 conversion by proxying to the child expression.
14220 * codegen.cs: (ConstantCheckState): Constant evaluation has its
14221 own separate setting that can not be turned off from the command
14222 line using --unchecked or --checked and is only controlled using
14223 the checked/unchecked statements and expressions. This setting is
14224 used by the constant folder to flag errors.
14226 * expression.cs (CheckedExpr, UncheckedExpr): Set the
14227 ConstantCheckState as well.
14229 During Resolve, they also have to flag the state, because the
14230 constant folder runs completely in the Resolve phase.
14232 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
14235 2002-03-01 Miguel de Icaza <miguel@ximian.com>
14237 * cfold.cs: New file, this file contains the constant folder.
14239 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
14240 argument to track whether we are using the resulting address to
14241 load or store a value and provide better error messages.
14243 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
14244 new AddressOf arguments.
14246 * statement.cs (Foreach.EmitCollectionForeach): Update
14248 * expression.cs (Argument.Emit): Call AddressOf with proper
14249 arguments to track usage.
14251 (New.DoEmit): Call AddressOf with new arguments.
14253 (Unary.Emit): Adjust AddressOf call.
14255 2002-03-01 Ravi Pratap <ravi@ximian.com>
14257 * cs-parser.jay (member_access): Change the case for pre-defined types
14258 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
14261 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
14264 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
14265 essentially like methods and apply attributes like MethodImplOptions to them too.
14267 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
14270 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
14271 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
14274 * Update code everywhere accordingly.
14276 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
14278 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
14280 2002-02-28 Ravi Pratap <ravi@ximian.com>
14282 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
14283 try performing lookups against those instead of jumping straight into using
14284 the 'using' clauses.
14286 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
14288 (LookupType): Perform lookups in implicit parents too.
14290 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
14291 sequence as RootContext.LookupType.
14293 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
14294 the various cases of namespace lookups into this method.
14296 2002-03-01 Miguel de Icaza <miguel@ximian.com>
14298 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
14299 in positional arguments)
14301 * class.cs (Operator): Update the AllowedModifiers to contain
14304 * cs-parser.jay: Update operator declaration to allow for the
14305 operator body to be empty.
14307 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
14310 2002-02-27 Miguel de Icaza <miguel@ximian.com>
14312 * class.cs (Method.Emit): Label parameters.
14314 * driver.cs: Return 1 or 0 as the program exit code.
14316 2002-02-26 Miguel de Icaza <miguel@ximian.com>
14318 * expression.cs: Special case the `null' object when trying to
14319 auto-compute the type, as anything can be explicitly converted to
14322 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
14323 spotting this Paolo.
14325 (Expression.ImplicitNumericConversion): Perform comparissions of
14326 the type using the underlying type in the case of an enumeration
14327 rather than using the enumeration type for the compare.
14329 Cope with the underlying == type case, which is not possible to
14332 (Expression.ConvertNumericExplicit): Perform comparissions of
14333 the type using the underlying type in the case of an enumeration
14334 rather than using the enumeration type for the compare.
14336 * driver.cs: If the user does not supply an extension, assume .exe
14338 * cs-parser.jay (if_statement): Rewrote so that we can track the
14339 location for the if statement.
14341 * expression.cs (Binary.ConstantFold): Only concat strings when
14342 the operation is "+", not everything ;-)
14344 * statement.cs (Statement.EmitBoolExpression): Take a location
14346 (If, While, Do): Track location.
14348 * expression.cs (Binary.ResolveOperator): In the object + string
14349 case, I was missing a call to ConvertImplicit
14351 2002-02-25 Ravi Pratap <ravi@ximian.com>
14353 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
14354 Location arguments. Ensure we use RootContext.LookupType to do our work
14355 and not try to do a direct Type.GetType and ModuleBuilder.GetType
14357 * interface.cs (PopulateMethod): Handle the type of the parameter being
14360 * expression.cs (Invocation.BetterFunction): Handle the case when we
14361 have a params method with no fixed arguments and a call is made with no
14364 2002-02-25 Miguel de Icaza <miguel@ximian.com>
14366 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
14367 the verbatim-string-literal
14369 * support.cs (InternalParameters.ParameterModifier): handle null
14371 (InternalParameters.ParameterType): ditto.
14373 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
14374 duplicating the name of the variable parameter.
14375 (GetParameterByName): Fix bug where we were not looking up array
14376 paramters if they were the only present (thanks Paolo!).
14377 (GetParameterInfo): We only have an empty set of types if both
14378 fixed and array are set to null.
14379 (GetParameterInfo-idx): Handle FixedParameter == null
14381 * cs-parser.jay: Handle the case where there is no catch
14382 statements (missing null test).
14384 2002-02-22 Miguel de Icaza <miguel@ximian.com>
14386 * driver.cs (MainDriver): Be conservative on our command line
14389 Catch DirectoryNotFoundException when calling GetFiles.
14391 (SplitPathAndPattern): Used to split the input specification into
14392 a path and a pattern that we can feed to Directory.GetFiles.
14394 2002-02-21 Miguel de Icaza <miguel@ximian.com>
14396 * statement.cs (Fixed): Implement the last case of the Fixed
14397 statement (string handling).
14399 * expression.cs (StringPtr): New class used to return a char * to
14400 a string; Used by the Fixed statement.
14402 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
14404 * expression.cs (Binary.ResolveOperator): Remove redundant
14405 MemberLookup pn parent type.
14406 Optimize union call, we do not need a union if the types are the same.
14407 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
14410 Specialize the use of MemberLookup everywhere, instead of using
14411 the default settings.
14413 (StackAlloc): Implement stackalloc keyword.
14415 * cs-parser.jay: Add rule to parse stackalloc.
14417 * driver.cs: Handle /h, /help, /?
14419 * expression.cs (MakeByteBlob): Removed the hacks we had in place
14420 before we supported unsafe code.
14422 * makefile: add --unsafe to the self compilation of mcs.
14424 2002-02-20 Miguel de Icaza <miguel@ximian.com>
14426 * expression.cs (PointerArithmetic): New class that is used to
14427 perform pointer arithmetic.
14428 (Binary.Resolve): Handle pointer arithmetic
14429 Handle pointer comparission.
14430 (ArrayPtr): Utility expression class that is used to take the
14431 address of an array.
14433 (ElementAccess): Implement array access for pointers
14435 * statement.cs (Fixed): Implement fixed statement for arrays, we
14436 are missing one more case before we are done.
14438 * expression.cs (Indirection): Implement EmitAssign and set the
14439 ExprClass to Variable. This allows pointer dereferences to be
14440 treated as variables, and to have values assigned to them.
14442 * ecore.cs (Expression.StoreFromPtr): New utility function to
14443 store values dereferencing.
14445 2002-02-20 Ravi Pratap <ravi@ximian.com>
14447 * expression.cs (Binary.ResolveOperator): Ensure that we are
14448 not trying to operate on a void type - this fixes the reported
14451 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
14452 the parent implementation is sealed.
14454 * ../errors/cs0239.cs : Add.
14456 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
14458 * typemanager.cs (unverifiable_code_type): Corresponds to
14459 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
14460 which have unsafe code in them.
14462 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
14465 2002-02-19 Miguel de Icaza <miguel@ximian.com>
14467 * cs-tokenizer.cs: Add support for @"litreal strings"
14469 Make tokenizer accept pre-processor directives
14470 on any column (remove the old C-like limitation).
14472 * rootcontext.cs (EmitCode): Emit any global attributes.
14473 (AddGlobalAttributes): Used to keep track of assembly attributes.
14475 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
14477 * cs-parser.jay: Add support for global attributes.
14479 2002-02-17 Miguel de Icaza <miguel@ximian.com>
14481 * expression.cs (Indirection): New helper class. Unary will
14482 create Indirection classes to be able to implement the
14483 IMemoryLocation interface on it.
14485 2002-02-16 Miguel de Icaza <miguel@ximian.com>
14487 * cs-parser.jay (fixed_statement): reference the right statement.
14489 * statement.cs (Fixed.Emit): Finish implementing the fixed
14490 statement for the &x case.
14492 2002-02-14 Miguel de Icaza <miguel@ximian.com>
14494 * class.cs (Property.Define, Method.Define): Remove newslot when
14497 * modifiers.cs: My use of NewSlot when `Abstract' was set was
14498 wrong. NewSlot should only be used if the `new' keyword is present.
14500 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
14501 locating our system dir. Sorry about this.
14503 2002-02-13 Miguel de Icaza <miguel@ximian.com>
14505 * driver.cs (GetSystemDir): Compute correctly the location of our
14506 system assemblies. I was using the compiler directory instead of
14507 the library directory.
14509 2002-02-13 Ravi Pratap <ravi@ximian.com>
14511 * expression.cs (BetterFunction): Put back in what Miguel commented out
14512 since it is the correct fix. The problem is elsewhere ;-)
14514 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
14515 parameters of the parms method are themselves compatible or not !
14517 (StandardConversionExists): Fix very dangerous bug where we were forgetting
14518 to check that a class implements an interface before saying that an implicit
14519 conversion was allowed. Use ImplementsInterface to do the checking.
14521 2002-02-13 Miguel de Icaza <miguel@ximian.com>
14523 * class.cs (Method.Define): Track whether we are an explicit
14524 implementation or not. And only call DefineMethodOverride if we
14525 are an explicit implementation.
14527 (Property.DefineMethod): Ditto.
14529 2002-02-11 Ravi Pratap <ravi@ximian.com>
14531 * expression.cs (BetterFunction): Catch hideous bug which was
14532 preventing us from detecting ambiguous calls due to implicit casts i.e
14535 2002-01-29 Miguel de Icaza <miguel@ximian.com>
14537 * support.cs (Pair): Remove un-needed method. I figured why I was
14538 getting the error in cs-parser.jay, the variable in a foreach loop
14539 is readonly, and the compiler does not really treat this as a variable.
14541 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
14542 instead of EQUALS in grammar.
14544 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
14546 * expression.cs (Unary.DoResolve): Check whether the argument is
14549 2002-01-28 Miguel de Icaza <miguel@ximian.com>
14551 * support.cs: Api for Pair to set a value. Despite the fact that
14552 the variables are public the MS C# compiler refuses to compile
14553 code that accesses the field if the variable is part of a foreach
14556 * statement.cs (Fixed): Begin implementation of the fixed
14559 (Block.AddVariable): Return the VariableInfo on success and null
14560 on failure instead of true/false.
14562 * cs-parser.jay (foreach): Catch errors on variables already
14563 defined (we were ignoring this value before) and properly unwind
14564 the block hierarchy
14566 (fixed_statement): grammar for the fixed statement.
14568 2002-01-25 Miguel de Icaza <miguel@ximian.com>
14570 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
14571 pointer types to be incretemented.
14573 (SizeOf): Implement.
14575 * cs-parser.jay (pointer_member_access): Implement
14576 expr->IDENTIFIER production.
14578 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
14579 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
14582 (Unary): Implement indirection.
14584 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
14585 use in non-unsafe context).
14587 (SimpleName.DoResolve): Check for pointers in field access on safe
14590 (Expression.LoadFromPtr): Factor the load-indirect code in this
14591 function. This was duplicated in UnboxCast and ParameterReference
14593 2002-01-24 Miguel de Icaza <miguel@ximian.com>
14595 * expression.cs (ComposedCast): report an error if a pointer cast
14596 is used in a safe region.
14598 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
14599 pointer type casts in unsafe context.
14601 * codegen.cs (EmitContext): Set up IsUnsafe.
14603 * cs-parser.jay (non_expression_type): Add productions for pointer
14606 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
14607 code. We should not use force into static mode if the method is
14608 not virtual. Fixes bug in MIS
14610 * statement.cs (Do.Emit, While.Emit, For.Emit,
14611 Statement.EmitBoolExpression): Add support to Do and While to
14612 propagate infinite loop as `I do return' semantics.
14614 Improve the For case to also test for boolean constants.
14616 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
14617 to the list of attributes we can add.
14619 Remove `EmitContext' argument.
14621 * class.cs (Method.Define): Apply parameter attributes.
14622 (Constructor.Define): Apply parameter attributes.
14623 (MethodCore.LabelParameters): Move here the core of labeling
14626 * support.cs (ReflectionParameters.ParameterModifier,
14627 InternalParameters.ParameterModifier): Use IsByRef on the type and
14628 only return the OUT bit for these parameters instead of in/out/ref
14631 This is because I miss-understood things. The ParameterInfo.IsIn
14632 and IsOut represent whether the parameter has the [In] and [Out]
14635 2002-01-22 Miguel de Icaza <miguel@ximian.com>
14637 * ecore.cs (FieldExpr.Emit): Release temporaries.
14639 * assign.cs (LocalTemporary.Release): new function.
14641 * codegen.cs (EmitContext.GetTemporaryStorage,
14642 EmitContext.FreeTemporaryStorage): Rework the way we deal with
14643 temporary storage. Now we can "put back" localbuilders when we
14646 2002-01-21 Miguel de Icaza <miguel@ximian.com>
14648 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
14649 need to make a copy of the variable to generate verifiable code.
14651 2002-01-19 Miguel de Icaza <miguel@ximian.com>
14653 * driver.cs: Compute dynamically the system directory.
14655 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
14656 Slower, but more generally useful. Used by the abstract
14657 registering implementation.
14659 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
14660 the rules for the special rule on Type/instances. First check if
14661 we have the same name, and if so, try that special static path
14662 rather than the instance path.
14664 2002-01-18 Miguel de Icaza <miguel@ximian.com>
14666 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
14669 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
14670 Enum, ValueType, Delegate or Array for non-corlib compiles.
14672 * cs-tokenizer.cs: Catch long identifiers (645)
14674 * typemanager.cs (IndexerPropetyName): Ravi never tested this
14677 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
14678 fix, we were returning too early, so we were not registering
14679 pending methods from abstract classes.
14681 Do not register pending methods if the class is abstract.
14683 * expression.cs (Conditional.DoResolve): Report circular implicit
14684 conversions when we neecd to compute it for conditional
14687 (Is.DoResolve): If the expression is always of the provided type,
14688 flag warning 183. If the expression can not ever be of the
14689 provided type flag warning 184.
14691 * class.cs: Catch 169 as well.
14693 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
14696 2002-01-18 Nick Drochak <ndrochak@gol.com>
14698 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
14700 2002-01-17 Miguel de Icaza <miguel@ximian.com>
14702 * interface.cs: (PopulateMethod): Check for pointers being defined
14703 only if the unsafe context is active.
14704 (PopulateProperty): ditto.
14705 (PopulateIndexer): ditto.
14707 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
14708 specified. If pointers are present, make sure that they are
14709 present in an unsafe context.
14710 (Constructor, Constructor.Define): ditto.
14711 (Field, Field.Define): ditto.
14712 (Property, Property.Define): ditto.
14713 (Event, Event.Define): ditto.
14715 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
14716 hashtable if there are classes or structs defined.
14718 * expression.cs (LocalVariableReference.DoResolve): Simplify this
14719 code, as the constant resolution moved.
14721 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
14722 the metadata, so we can flag error 133.
14724 * decl.cs (MemberCore.UnsafeOK): New function to test that a
14725 pointer is being declared in an unsafe context.
14727 2002-01-16 Miguel de Icaza <miguel@ximian.com>
14729 * modifiers.cs (Modifiers.Check): Require a Location argument.
14730 Report error 227 for Unsafe use.
14732 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
14734 * statement.cs (For.Emit): If the test is null, then report that
14735 we do `return', as we wont reach anything afterwards.
14737 (Switch.SwitchGoverningType): Track the expression that matched
14740 * driver.cs: Allow negative numbers as an error code to flag.
14742 * cs-parser.jay: Handle 1551.
14744 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
14746 2002-01-15 Miguel de Icaza <miguel@ximian.com>
14748 * cs-parser.jay: Report 1518 (type declaration can only contain
14749 class, struct, interface, enum or delegate)
14751 (switch_label): Report 1523 (keywords `case' or `default' must
14754 (opt_switch_sections): Report 1522 (empty switch)
14756 * driver.cs: Report 1515 (response file specified multiple times)
14757 Report 1516 (Source file specified multiple times).
14759 * expression.cs (Argument.Resolve): Signal 1510
14761 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
14762 access not allowed in static code)
14764 2002-01-11 Ravi Pratap <ravi@ximian.com>
14766 * typemanager.cs (IsPointerType): Utility method which we are going
14769 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
14770 the object type, so we take care of that.
14772 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
14774 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
14775 added to non-params parameters :-)
14777 * typemanager.cs (CSharpName): Include 'void' type too.
14779 (void_ptr_type): Include in the set of core types.
14781 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
14784 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
14787 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
14788 completely forgotten about it.
14790 2002-01-10 Ravi Pratap <ravi@ximian.com>
14792 * cs-parser.jay (pointer_type): Add. This begins our implementation
14793 of parsing rules for unsafe code.
14795 (unsafe_statement): Implement.
14797 (embedded_statement): Modify to include the above.
14799 * statement.cs (Unsafe): Implement new class for unsafe blocks.
14801 * codegen.cs (EmitContext.InUnsafe): Add. This determines
14802 if the current context is an unsafe one.
14804 * cs-parser.jay (local_variable_pointer_type): Since local variable types
14805 are handled differently, we need separate rules for them.
14807 (local_variable_declaration): Update to use local_variable_pointer_type
14808 to allow variable declarations of unmanaged pointer types.
14810 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
14811 in unsafe contexts.
14813 * ../errors/cs0214.cs : Add.
14815 2002-01-16 Nick Drochak <ndrochak@gol.com>
14817 * makefile: remove 'response' file when cleaning.
14819 2002-01-15 Miguel de Icaza <miguel@ximian.com>
14821 * cs-parser.jay: Report 1524.
14823 2002-01-14 Miguel de Icaza <miguel@ximian.com>
14825 * typemanager.cs (RegisterMethod): drop checking if we have
14826 registered this from here
14828 2002-01-12 Miguel de Icaza <miguel@ximian.com>
14830 * class.cs (Method.EmitDestructor): Implement calling our base
14833 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
14834 value of InFinally.
14836 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
14837 this routine and will wrap the call in a try/catch block. Deal
14840 2002-01-11 Miguel de Icaza <miguel@ximian.com>
14842 * ecore.cs (Expression.MemberLookup): instead of taking a
14843 parameter `same_type' that was used to tell whether we could
14844 access private members we compute our containing type from the
14847 (FieldExpr): Added partial support for volatile fields. This does
14848 not work for volatile fields exposed from assemblies, as I can not
14849 figure out how to extract the modreq from it.
14851 Updated all the source files to use this.
14853 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
14854 because it is referenced by MemberLookup very often.
14856 2002-01-09 Ravi Pratap <ravi@ximian.com>
14858 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
14859 TypeBuilder.GetCustomAttributes to retrieve what we need.
14861 Get rid of redundant default_member_attr_type as this is the same as
14862 default_member_type which already exists.
14864 * interface.cs, attribute.cs : Update accordingly.
14866 2002-01-08 Miguel de Icaza <miguel@ximian.com>
14868 * typemanager.cs: Enable IndexerPropertyName again. It does not
14869 work for TYpeBuilders though. Ravi, can you please fix this?
14871 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
14873 * expression.cs (Argument.Emit): Handle the case of ref objects
14874 being passed to ref functions;
14876 (ParameterReference.EmitLoad): Loads the content of the pointer
14877 without dereferencing.
14879 2002-01-07 Miguel de Icaza <miguel@ximian.com>
14881 * cs-tokenizer.cs: Implemented the pre-processing expressions.
14883 2002-01-08 Ravi Pratap <ravi@ximian.com>
14885 * class.cs (Indexer.DefineMethod): Incorporate the interface
14886 type in the name of the method if we are doing explicit interface
14889 * expression.cs (ConversionExists): Remove as it is completely obsolete.
14891 (BetterConversion): Fix extremely trivial bug where we were referring to
14892 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
14895 * ../errors/bug16.cs : Add although we have fixed it.
14897 2002-01-07 Miguel de Icaza <miguel@ximian.com>
14899 * expression.cs (BaseIndexer): Begin implementation.
14901 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
14903 * cs-parser.jay (indexer_declarator): Use qualified_identifier
14904 production directly to remove a shift/reduce, and implement
14905 explicit interface implementation.
14907 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
14908 after a floating point suffix.
14910 * expression.cs (DoNumericPromotions): Improved the conversion for
14911 uint/uint. If we have a constant, we avoid doing a typecast to a
14914 * class.cs (Indexer): Implement explicit interface implementation
14917 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
14919 * class.cs: make the default instance constructor public and hidebysig.
14921 2001-01-03 Ravi Pratap <ravi@ximian.com>
14923 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
14924 so we can call it from elsewhere.
14926 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
14927 we emit it internally if the class has a defined indexer; otherwise the user
14928 emits it by decorating the class definition with the DefaultMemberAttribute.
14930 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
14931 attribute is not used on a type which defines an indexer.
14933 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
14934 character when we skip whitespace.
14936 * ../errors/cs0646.cs : Add.
14938 2002-01-03 Miguel de Icaza <miguel@ximian.com>
14940 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
14943 * makefile: Add practical target `mcs3.exe' which builds the third
14944 generation compiler.
14946 * expression.cs (New): Fix structures constructor calling.
14948 * class.cs (Property, Method, Indexer): Emit Final flag on the
14949 method if we are an interface implementation and we are not
14952 * ecore.cs (PropertyExpr): New public field `IsBase', tells
14953 whether this property is referencing a `base' method.
14955 * expression.cs (Invocation.EmitCall): take an extra argument:
14956 is_base, this is used to determine whether the `call' or
14957 `callvirt' opcode should be used.
14960 * delegate.cs: update EmitCall.
14962 * class.cs (Method.Define): Set NewSlot for the cases where we are
14963 not implementing an interface method.
14965 (Property.Define): ditto.
14967 2002-01-02 Miguel de Icaza <miguel@ximian.com>
14969 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
14970 'r'. Allows mcs to parse itself fully.
14972 2002-01-02 Ravi Pratap <ravi@ximian.com>
14974 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
14975 of the number of initializers that require the InitializeArray method.
14977 (CheckIndices): Store the Expression in all cases - not the plain value. Also
14978 update the above field where necessary.
14980 (MakeByteBlob): Update accordingly.
14982 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
14985 (EmitDynamicInitializers): Update in accordance with the new optimization.
14987 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
14988 same OpCode applies.
14990 * cs-parser.jay : Fix some glaring errors I introduced.
14992 2002-01-01 Ravi Pratap <ravi@ximian.com>
14994 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
14995 so that we can check for name clashes there too.
14997 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
14998 for interface indexers.
15000 * interfaces.cs (Define): Emit the default member attribute.
15002 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
15003 variable was being referred to while setting the value ;-)
15005 2002-01-01 Miguel de Icaza <miguel@ximian.com>
15007 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
15008 byte-by-byte information when we know the data is zero.
15010 Make the block always a multiple of 4, because
15011 DefineInitializedData has a bug.
15013 * assign.cs: Fix, we should assign from the temporary, not from
15016 * expression.cs (MakeByteBlob): Fix my incorrect code.
15018 2001-12-31 Miguel de Icaza <miguel@ximian.com>
15020 * typemanager.cs (EnumToUnderlying): This function is used to get
15021 the underlying type from an enumeration, because it does not
15024 * constant.cs: Use the I4_S form for values between -128 and 127.
15026 * statement.cs (Block.LookupLabel): Looks up a label.
15027 (Block): Drop support for labeled blocks.
15029 (LabeledStatement): New kind of statement that represents a label
15032 (Goto): Finally implement this bad boy.
15034 * cs-parser.jay: Update to reflect new mechanism to implement
15037 2001-12-30 Miguel de Icaza <miguel@ximian.com>
15039 * codegen.cs (EmitContext.This): a codegen property that keeps the
15040 a single instance of this instead of creating many different this
15043 * delegate.cs (Delegate.DoResolve): Update to use the property;
15045 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
15047 * expression.cs (BaseAccess.DoResolve): Ditto.
15049 2001-12-29 Ravi Pratap <ravi@ximian.com>
15051 * typemanager.cs (methodimpl_attr_type): Add to hold the type
15052 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
15054 (InitCoreTypes): Update accordingly.
15056 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
15057 so we can quickly store the state.
15059 (ApplyAttributes): Set the correct implementation flags
15060 for InternalCall methods.
15062 2001-12-29 Miguel de Icaza <miguel@ximian.com>
15064 * expression.cs (EmitCall): if a method is not virtual, then do
15065 not use callvirt on it.
15067 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
15068 user defined stuff) requires the use of stobj, which takes an
15069 address on the stack instead of an array and an index. So emit
15070 the Ldelema operation for it.
15072 (EmitStoreOpcode): Use stobj for valuetypes.
15074 (UnaryMutator.EmitCode): Use the right 1 value depending on
15075 whether we are dealing with int64/uint64, float or doubles.
15077 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
15078 constructors that I implemented last night.
15080 (Constructor.IsDefault): Fix to work properly for static
15083 * cs-parser.jay (CheckDef): report method signature errors.
15084 Update error number 103 to be 132.
15086 * decl.cs: New AdditionResult enumeration value: MethodExists.
15087 Although we do this check for methods later on in the semantic
15088 analysis, catching repeated default constructors is so easy that
15089 we catch these here.
15091 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
15094 (ParameterReference.EmitAssign, Emit): handle
15097 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
15098 (ArrayAccess.EmitStoreOpcode): ditto.
15100 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
15102 * expression.cs (MakeByteBlob): Complete all the missing types
15103 (uint, short, ushort, byte, sbyte)
15105 * class.cs: Only init instance field initializers on instance
15108 Rename `constructors' to instance_constructors.
15110 (TypeContainer.AddConstructor): Only add constructors to the list
15111 if it is not static.
15113 Make sure that we handle default_static_constructor independently
15114 everywhere where we handle instance_constructors
15116 2001-12-28 Miguel de Icaza <miguel@ximian.com>
15118 * class.cs: Do not lookup or create a base initializer for a
15119 static constructor.
15121 (ConstructorInitializer.Resolve): use the proper type to lookup
15124 * cs-parser.jay: Report error 1585 (modifiers between type and name).
15126 * enum.cs, interface.cs: Remove CloseType, this is taken care by
15129 * decl.cs: CloseType is now an virtual method, the default
15130 implementation just closes this type.
15132 2001-12-28 Ravi Pratap <ravi@ximian.com>
15134 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
15135 to PreserveSig by default. Also emit HideBySig on such methods.
15137 Basically, set the defaults to standard values.
15139 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
15140 argument, if candidate is better, it can't be worse than the best !
15142 (Invocation): Re-write bits to differentiate between methods being
15143 applicable in their expanded form and their normal form - for params
15146 Get rid of use_standard everywhere as only standard conversions are allowed
15147 in overload resolution.
15149 More spec conformance.
15151 2001-12-27 Miguel de Icaza <miguel@ximian.com>
15153 * driver.cs: Add --timestamp, to see where the compiler spends
15156 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
15157 `this' in static code.
15159 (SimpleName.DoResolve): Implement in terms of a helper function
15160 that allows static-references to be passed upstream to
15163 (Expression.ResolveWithSimpleName): Resolve specially simple
15164 names when called by MemberAccess to implement the special
15167 (Expression.ImplicitReferenceConversion): Handle conversions from
15168 Null to reference types before others, as Null's type is
15171 * expression.cs (Invocation.EmitCall): Handle the special case of
15172 calling methods declared on a reference type from a ValueType
15173 (Base classes System.Object and System.Enum)
15175 (MemberAccess.Resolve): Only perform lookups on Enumerations if
15176 the left hand side is a TypeExpr, not on every enumeration.
15178 (Binary.Resolve): If types are reference types, then do a cast to
15179 object on operators != and == of both arguments.
15181 * typemanager.cs (FindMembers): Extract instance and static
15182 members if requested.
15184 * interface.cs (PopulateProperty): Use void_type instead of null
15185 as the return type for the setter method.
15187 (PopulateIndexer): ditto.
15189 2001-12-27 Ravi Pratap <ravi@ximian.com>
15191 * support.cs (ReflectionParameters): Fix minor bug where we
15192 were examining the wrong parameter for the ParamArray attribute.
15194 Cope with requests for the type of the parameter at position
15195 greater than the params parameter's. We now return the element
15196 type of the params array as that makes more sense.
15198 * expression.cs (Invocation.IsParamsMethodApplicable): Update
15199 accordingly as we no longer have to extract the element type
15202 (Invocation.OverloadResolve): Update.
15204 2001-12-27 Miguel de Icaza <miguel@ximian.com>
15206 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
15207 against IEnumerator, test whether the return value is a descendant
15208 of the IEnumerator interface.
15210 * class.cs (Indexer.Define): Use an auxiliary method to implement
15211 the other bits of the method definition. Begin support for
15212 explicit interface implementation.
15214 (Property.DefineMethod): Use TypeManager.void_type instead of null
15215 for an empty return value.
15217 2001-12-26 Miguel de Icaza <miguel@ximian.com>
15219 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
15220 dealing with a FieldExpr which is composed of a FieldBuilder, in
15221 the code path we did extract the constant, but we should have
15222 obtained the underlying value to be able to cast it (otherwise we
15223 end up in an infinite loop, this is what Ravi was running into).
15225 (ArrayCreation.UpdateIndices): Arrays might be empty.
15227 (MemberAccess.ResolveMemberAccess): Add support for section
15228 14.5.4.1 that deals with the special case of E.I when E is a type
15229 and something else, that I can be a reference to a static member.
15231 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
15232 handle a particular array type to create byte blobs, it is just
15233 something we dont generate byteblobs for.
15235 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
15238 * location.cs (Push): remove the key from the hashtable that we
15239 are about to add. This happens for empty files.
15241 * driver.cs: Dispose files after we have parsed them.
15243 (tokenize): new function that only runs the tokenizer on its
15244 input, for speed testing.
15246 2001-12-26 Ravi Pratap <ravi@ximian.com>
15248 * class.cs (Event.Define): Define the private field only if there
15249 are no accessors defined.
15251 * expression.cs (ResolveMemberAccess): If there is no associated
15252 field with the event, that means we have an event defined with its
15253 own accessors and we should flag error cs0070 since transforming
15254 ourselves into a field is not valid in that case.
15256 * ecore.cs (SimpleName.DoResolve): Same as above.
15258 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
15259 and charset to sane values.
15261 2001-12-25 Ravi Pratap <ravi@ximian.com>
15263 * assign.cs (DoResolve): Perform check on events only if they
15264 are being accessed outside the declaring type.
15266 * cs-parser.jay (event_declarations): Update rules to correctly
15267 set the type of the implicit parameter etc.
15269 (add_accessor, remove_accessor): Set current local parameters.
15271 * expression.cs (Binary): For delegate addition and subtraction,
15272 cast the return value from the method into the appropriate delegate
15275 2001-12-24 Ravi Pratap <ravi@ximian.com>
15277 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
15278 of these as the workaround is unnecessary.
15280 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
15281 delegate data - none of that is needed at all.
15283 Re-write bits to extract the instance expression and the delegate method
15286 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
15289 * attribute.cs (ApplyAttributes): New method to take care of common tasks
15290 of attaching attributes instead of duplicating code everywhere.
15292 * everywhere : Update code to do attribute emission using the above method.
15294 2001-12-23 Miguel de Icaza <miguel@ximian.com>
15296 * expression.cs (IsParamsMethodApplicable): if there are not
15297 parameters, return immediately.
15299 * ecore.cs: The 0 literal can be implicity converted to an enum
15302 (SimpleName.DoResolve): First lookup the type, then lookup the
15305 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
15306 want to get its address. If the InstanceExpression is not
15307 addressable, store the result in a temporary variable, then get
15310 * codegen.cs: Only display 219 errors on warning level or above.
15312 * expression.cs (ArrayAccess): Make it implement the
15313 IMemoryLocation interface.
15315 (Binary.DoResolve): handle the operator == (object a, object b)
15316 and operator != (object a, object b) without incurring into a
15317 BoxedCast (because 5 != o should never be performed).
15319 Handle binary enumerator operators.
15321 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
15322 value type, otherwise use Ldelem_ref.
15324 Use precomputed names;
15326 (AddressOf): Implement address of
15328 * cs-parser.jay (labeled_statement): Fix recursive block
15329 addition by reworking the production.
15331 * expression.cs (New.DoEmit): New has a special case:
15333 If we are dealing with a ValueType, we have a few
15334 situations to deal with:
15336 * The target of New is a ValueType variable, that is
15337 easy, we just pass this as the variable reference
15339 * The target of New is being passed as an argument,
15340 to a boxing operation or a function that takes a
15343 In this case, we need to create a temporary variable
15344 that is the argument of New.
15347 2001-12-23 Ravi Pratap <ravi@ximian.com>
15349 * rootcontext.cs (LookupType): Check that current_type is not null before
15350 going about looking at nested types.
15352 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
15353 not implement the IAssignMethod interface any more.
15355 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
15356 where we tranform them into FieldExprs if they are being resolved from within
15357 the declaring type.
15359 * ecore.cs (SimpleName.DoResolve): Do the same here.
15361 * assign.cs (DoResolve, Emit): Clean up code considerably.
15363 * ../errors/bug10.cs : Add.
15365 * ../errors/cs0070.cs : Add.
15367 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
15369 * assign.cs : Get rid of EventIsLocal everywhere.
15371 2001-12-23 Miguel de Icaza <miguel@ximian.com>
15373 * ecore.cs (ConvertIntLiteral): finished the implementation.
15375 * statement.cs (SwitchLabel): Convert the value we are using as a
15376 key before looking up the table.
15378 2001-12-22 Miguel de Icaza <miguel@ximian.com>
15380 * codegen.cs (EmitTopBlock): Require a Location argument now.
15382 * cs-parser.jay (constructor_declarator): We need to setup
15383 current_local_parameters before we parse the
15384 opt_constructor_initializer, to allow the variables to be bound
15385 to the constructor arguments.
15387 * rootcontext.cs (LookupType): First lookup nested classes in our
15388 class and our parents before we go looking outside our class.
15390 * expression.cs (ConstantFold): Extract/debox the values at the
15393 * rootcontext.cs (EmitCode): Resolve the constants first before we
15394 resolve the types. This is not really needed, but it helps debugging.
15396 * statement.cs: report location.
15398 * cs-parser.jay: pass location to throw statement.
15400 * driver.cs: Small bug fix.
15402 * report.cs: Updated format to be 4-zero filled digits.
15404 2001-12-22 Ravi Pratap <ravi@ximian.com>
15406 * expression.cs (CheckIndices): Fix minor bug where the wrong
15407 variable was being referred to ;-)
15409 (DoEmit): Do not call EmitStaticInitializers when the
15410 underlying type is System.Object.
15412 2001-12-21 Ravi Pratap <ravi@ximian.com>
15414 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
15415 and do the usual workaround for SRE.
15417 * class.cs (MyEventBuilder.EventType): New member to get at the type
15418 of the event, quickly.
15420 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
15422 * assign.cs (Assign.DoResolve): Handle the case when the target
15423 is an EventExpr and perform the necessary checks.
15425 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
15428 (SimpleName.MemberStaticCheck): Include check for EventExpr.
15430 (EventExpr): Set the type in the constructor itself since we
15431 are meant to be born fully resolved.
15433 (EventExpr.Define): Revert code I wrote earlier.
15435 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
15436 instance expression is null. The instance expression is a This in that case
15437 or a null, depending on whether it is a static method or not.
15439 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
15440 refers to more than one method.
15442 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
15443 and accordingly flag errors.
15445 2001-12-21 Miguel de Icaza <miguel@ximian.com>
15447 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
15449 2001-12-22 Miguel de Icaza <miguel@ximian.com>
15451 * location.cs (ToString): Provide useful rutine.
15453 2001-12-21 Miguel de Icaza <miguel@ximian.com>
15455 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
15456 objects, return the actual integral boxed.
15458 * statement.cs (SwitchLabel): define an ILLabel for each
15461 (Switch.CheckSwitch): If the value is a Literal, extract
15462 the underlying literal.
15464 Also in the unused hashtable we had, add the SwitchLabel so we can
15465 quickly look this value up.
15467 * constant.cs: Implement a bunch of new constants. Rewrite
15468 Literal based on this. Made changes everywhere to adapt to this.
15470 * expression.cs (Expression.MakeByteBlob): Optimize routine by
15471 dereferencing array only once, and also copes with enumrations.
15473 bytes are two bytes wide, not one.
15475 (Cast): Perform constant conversions.
15477 * ecore.cs (TryImplicitIntConversion): Return literals instead of
15478 wrappers to the literals here.
15480 * expression.cs (DoNumericPromotions): long literals can converted
15481 to ulong implicity (this is taken care of elsewhere, but I was
15482 missing this spot).
15484 * ecore.cs (Expression.Literalize): Make the return type Literal,
15485 to improve type checking.
15487 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
15489 2001-12-20 Miguel de Icaza <miguel@ximian.com>
15491 * literal.cs: Revert code from ravi that checked the bounds. The
15492 bounds are sane by the definition of the type itself.
15494 * typemanager.cs: Fix implementation of ImplementsInterface. We
15495 need to actually look up in our parent hierarchy for interfaces
15498 * const.cs: Use the underlying type for enumerations
15500 * delegate.cs: Compute the basename for the delegate creation,
15501 that should fix the delegate test case, and restore the correct
15502 Type Lookup semantics in rootcontext
15504 * rootcontext.cs: Revert Ravi's last patch. The correct way of
15505 referencing a nested type with the Reflection API is using the "+"
15508 * cs-parser.jay: Do not require EOF token at the end.
15510 2001-12-20 Ravi Pratap <ravi@ximian.com>
15512 * rootcontext.cs (LookupType): Concatenate type names with
15513 a '.' instead of a '+' The test suite passes again.
15515 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
15516 field of the enumeration.
15518 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
15519 the case when the member is an EventExpr.
15521 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
15522 static has an associated instance expression.
15524 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
15526 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
15528 * class.cs (Event.Define): Register event and perform appropriate checks
15531 We define the Add and Remove methods even if the use provides none because
15532 in that case, we provide default implementations ourselves.
15534 Define a private field of the type of the event. This is done by the CSC compiler
15535 and we should be doing it too ;-)
15537 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
15538 More methods we use in code we generate.
15540 (multicast_delegate_type, delegate_type): Two separate types since the distinction
15543 (InitCoreTypes): Update accordingly for the above.
15545 * class.cs (Event.Emit): Generate code for default accessors that we provide
15547 (EmitDefaultMethod): Do the job in the above.
15549 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
15552 2001-12-20 Miguel de Icaza <miguel@ximian.com>
15554 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
15555 builders even if we were missing one.
15557 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
15558 pass the Basename as our class name instead of the Name. The
15559 basename will be correctly composed for us.
15561 * parameter.cs (Paramters): Now takes a Location argument.
15563 * decl.cs (DeclSpace.LookupType): Removed convenience function and
15564 make all the code call directly LookupType in RootContext and take
15565 this chance to pass the Location information everywhere.
15567 * Everywhere: pass Location information.
15569 2001-12-19 Miguel de Icaza <miguel@ximian.com>
15571 * class.cs (Constructor.Define): Updated way of detecting the
15572 length of the parameters.
15574 (TypeContainer.DefineType): Use basename as the type name for
15577 (TypeContainer.Define): Do not recursively define types here, as
15578 definition is taken care in order by the RootContext.
15580 * tree.cs: Keep track of namespaces in a per-file basis.
15582 * parameter.cs (Parameter.ComputeSignature): Update to use
15585 (Parameters.GetSignature): ditto.
15587 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
15588 instead of a TypeContainer.
15590 (Interface.SemanticAnalysis): Use `this' instead of our parent to
15591 resolve names. Because we need to be resolve in our context, not
15594 * driver.cs: Implement response files.
15596 * class.cs (TypeContainer.DefineType): If we are defined, do not
15597 redefine ourselves.
15599 (Event.Emit): Emit the code for add/remove handlers.
15600 (Event.Define): Save the MethodBuilders for add/remove.
15602 * typemanager.cs: Use pair here too.
15604 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
15605 DictionaryEntry requires the first argument to be non-null.
15607 (enum_declaration): Compute full name for registering the
15610 (delegate_declaration): Instead of using
15611 formal_parameter_list, use opt_formal_parameter_list as the list
15614 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
15615 (EventParsing): New property that controls whether `add' and
15616 `remove' are returned as tokens or identifiers (for events);
15618 2001-12-19 Ravi Pratap <ravi@ximian.com>
15620 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
15621 use MyEventBuilder only and let it wrap the real builder for us.
15623 (MyEventBuilder): Revamp constructor etc.
15625 Implement all operations that we perform on EventBuilder in precisely the same
15628 (FindMembers): Update to use the EventBuilder member.
15630 (Event.Emit): Update accordingly.
15632 2001-12-18 Ravi Pratap <ravi@ximian.com>
15634 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
15635 by calling the appropriate methods.
15637 (GetCustomAttributes): Make stubs as they cannot possibly do anything
15640 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
15642 2001-12-17 Ravi Pratap <ravi@ximian.com>
15644 * delegate.cs (Delegate.Populate): Check that the return type
15645 and various parameters types are indeed accessible.
15647 * class.cs (Constructor.Define): Same here.
15649 (Field.Define): Ditto.
15651 (Event.Define): Ditto.
15653 (Operator.Define): Check that the underlying Method defined itself
15654 correctly - so it's MethodBuilder should not be null.
15656 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
15657 expression happens to be null.
15659 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
15660 members but as of now we don't seem to be able to do anything really useful with it.
15662 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
15663 not the EventBuilder.
15665 2001-12-18 Miguel de Icaza <miguel@ximian.com>
15667 * cs-tokenizer.cs: Add support for defines.
15668 Add support for #if, #elif, #else, #endif
15670 (eval_var): evaluates a variable.
15671 (eval): stubbed for evaluating functions.
15673 * cs-parser.jay: Pass the defines information
15675 * driver.cs: Add --define command line option.
15677 * decl.cs: Move MemberCore here.
15679 Make it the base class for DeclSpace. This allows us to catch and
15680 report 108 and 109 for everything now.
15682 * class.cs (TypeContainer.Define): Extract all the members
15683 before populating and emit the warning 108 (new keyword required
15684 to override) instead of having each member implement this.
15686 (MemberCore.Define): New abstract method, we will be using this in
15687 the warning reporting engine in Populate.
15689 (Operator.Define): Adjust to new MemberCore protocol.
15691 * const.cs (Const): This does not derive from Expression, it is a
15692 temporary object we use to create fields, it is a MemberCore.
15694 * class.cs (Method.Define): Allow the entry point to be in a
15697 * driver.cs: Rewrite the argument handler to clean it up a bit.
15699 * rootcontext.cs: Made it just an auxiliary namespace feature by
15700 making everything static.
15702 * driver.cs: Adapt code to use RootContext type name instead of
15705 * delegate.cs: Remove RootContext argument.
15707 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
15710 * class.cs (Event.Define): The lookup can fail.
15712 * cs-tokenizer.cs: Begin implementation of pre-procesor.
15714 * expression.cs: Resolve the this instance before invoking the code.
15716 2001-12-17 Miguel de Icaza <miguel@ximian.com>
15718 * cs-parser.jay: Add a production in element_access that allows
15719 the thing to become a "type" reference. This way we can parse
15720 things like "(string [])" as a type.
15722 Note that this still does not handle the more complex rules of
15726 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
15728 * ecore.cs: (CopyNewMethods): new utility function used to
15729 assemble the list of methods from running FindMembers.
15731 (MemberLookup): Rework FindMembers so that
15733 2001-12-16 Miguel de Icaza <miguel@ximian.com>
15735 * class.cs (TypeContainer): Remove Delegates who fail to be
15738 * delegate.cs (Populate): Verify that we dont get null return
15739 values. TODO: Check for AsAccessible.
15741 * cs-parser.jay: Use basename to emit error 574 (destructor should
15742 have the same name as container class), not the full name.
15744 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
15745 possible representation.
15747 Also implements integer type suffixes U and L.
15749 2001-12-15 Miguel de Icaza <miguel@ximian.com>
15751 * expression.cs (ArrayCreation.DoResolve): We need to do the
15752 argument resolution *always*.
15754 * decl.cs: Make this hold the namespace. Hold the root context as
15756 (LookupType): Move here.
15758 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
15760 * location.cs (Row, Name): Fixed the code, it was always returning
15761 references to the first file.
15763 * interface.cs: Register properties defined through interfaces.
15765 * driver.cs: Add support for globbing on the command line
15767 * class.cs (Field): Make it derive from MemberCore as well.
15770 2001-12-15 Ravi Pratap <ravi@ximian.com>
15772 * class.cs (Event::Define): Check that the type of the event is a delegate
15773 type else flag error #66.
15775 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
15778 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
15779 values of EntryPoint, CharSet etc etc.
15781 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
15783 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
15784 be null and we should ignore this. I am not sure if this is really clean. Apparently,
15785 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
15786 which needs this to do its work.
15788 * ../errors/cs0066.cs : Add.
15790 2001-12-14 Miguel de Icaza <miguel@ximian.com>
15792 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
15795 * class.cs: (MethodSignature.MethodSignature): Removed hack that
15796 clears out the parameters field.
15797 (MemberSignatureCompare): Cleanup
15799 (MemberCore): New base class used to share code between MethodCore
15802 (RegisterRequiredImplementations) BindingFlags.Public requires
15803 either BindingFlags.Instace or Static. Use instance here.
15805 (Property): Refactored code to cope better with the full spec.
15807 * parameter.cs (GetParameterInfo): Return an empty array instead
15810 * class.cs (Property): Abstract or extern properties have no bodies.
15812 * parameter.cs (GetParameterInfo): return a zero-sized array.
15814 * class.cs (TypeContainer.MethodModifiersValid): Move all the
15815 method modifier validation to the typecontainer so we can reuse
15816 this on properties.
15818 (MethodCore.ParameterTypes): return an empty sized array of types.
15820 (Property.Define): Test property modifier validity.
15822 Add tests for sealed/override too.
15824 (Method.Emit): abstract or extern methods have no bodies.
15826 2001-12-14 Ravi Pratap <ravi@ximian.com>
15828 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
15831 (Method::Define, ::Emit): Modify accordingly.
15833 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
15835 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
15837 * makefile: Pass in /unsafe.
15839 2001-12-13 Miguel de Icaza <miguel@ximian.com>
15841 * class.cs (MakeKey): Kill routine.
15843 * class.cs (TypeContainer.Define): Correctly define explicit
15844 method implementations (they require the full interface name plus
15847 * typemanager.cs: Deply the PtrHashtable here and stop using the
15848 lame keys. Things work so much better.
15850 This of course broke everyone who depended on `RegisterMethod' to
15851 do the `test for existance' test. This has to be done elsewhere.
15853 * support.cs (PtrHashtable): A hashtable that avoid comparing with
15854 the object stupid Equals method (because, that like fails all over
15855 the place). We still do not use it.
15857 * class.cs (TypeContainer.SetRequiredInterface,
15858 TypeContainer.RequireMethods): Killed these two routines and moved
15859 all the functionality to RegisterRequiredImplementations.
15861 (TypeContainer.RegisterRequiredImplementations): This routine now
15862 registers all the implementations required in an array for the
15863 interfaces and abstract methods. We use an array of structures
15864 which can be computed ahead of time to reduce memory usage and we
15865 also assume that lookups are cheap as most classes will not
15866 implement too many interfaces.
15868 We also avoid creating too many MethodSignatures.
15870 (TypeContainer.IsInterfaceMethod): Update and optionally does not
15871 clear the "pending" bit if we find that there are problems with
15874 (TypeContainer.VerifyPendingMethods): Update to report errors of
15875 methods that look like implementations but are not.
15877 (TypeContainer.Define): Add support for explicit interface method
15880 2001-12-12 Miguel de Icaza <miguel@ximian.com>
15882 * typemanager.cs: Keep track of the parameters here instead of
15883 being a feature of the TypeContainer.
15885 * class.cs: Drop the registration of parameters here, as
15886 InterfaceMethods are also interface declarations.
15888 * delegate.cs: Register methods with the TypeManager not only with
15889 the TypeContainer. This code was buggy.
15891 * interface.cs: Full registation here.
15893 2001-12-11 Miguel de Icaza <miguel@ximian.com>
15895 * expression.cs: Remove reducer for binary expressions, it can not
15898 * const.cs: Put here the code that used to go into constant.cs
15900 * constant.cs: Put here the code for constants, this is a new base
15901 class for Literals.
15903 * literal.cs: Make Literal derive from Constant.
15905 2001-12-09 Miguel de Icaza <miguel@ximian.com>
15907 * statement.cs (Return.Emit): Report error 157 if the user
15908 attempts to return from a finally block.
15910 (Return.Emit): Instead of emitting a return, jump to the end of
15913 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
15914 LocalBuilder to store the result of the function. ReturnLabel is
15915 the target where we jump.
15918 2001-12-09 Radek Doulik <rodo@ximian.com>
15920 * cs-parser.jay: remember alias in current namespace
15922 * ecore.cs (SimpleName::DoResolve): use aliases for types or
15925 * class.cs (LookupAlias): lookup alias in my_namespace
15927 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
15929 (LookupAlias): lookup alias in this and if needed in parent
15932 2001-12-08 Miguel de Icaza <miguel@ximian.com>
15936 * rootcontext.cs: (ModuleBuilder) Made static, first step into
15937 making things static. I need this to avoid passing the
15938 TypeContainer when calling ParameterType.
15940 * support.cs (InternalParameters.ParameterType): Remove ugly hack
15941 that did string manipulation to compute the type and then call
15942 GetType. Use Parameter.ParameterType instead.
15944 * cs-tokenizer.cs: Consume the suffix for floating values.
15946 * expression.cs (ParameterReference): figure out whether this is a
15947 reference parameter or not. Kill an extra variable by computing
15948 the arg_idx during emission.
15950 * parameter.cs (Parameters.GetParameterInfo): New overloaded
15951 function that returns whether a parameter is an out/ref value or not.
15953 (Parameter.ParameterType): The type of the parameter (base,
15954 without ref/out applied).
15956 (Parameter.Resolve): Perform resolution here.
15957 (Parameter.ExternalType): The full type (with ref/out applied).
15959 * statement.cs (Using.Emit, Using.EmitExpression): Implement
15960 support for expressions on the using statement.
15962 2001-12-07 Miguel de Icaza <miguel@ximian.com>
15964 * statement.cs (Using.EmitLocalVariableDecls): Split the
15965 localvariable handling of the using statement.
15967 (Block.EmitMeta): Keep track of variable count across blocks. We
15968 were reusing slots on separate branches of blocks.
15970 (Try.Emit): Emit the general code block, we were not emitting it.
15972 Check the type of the declaration to be an IDisposable or
15973 something that can be implicity converted to it.
15975 Emit conversions if required.
15977 * ecore.cs (EmptyExpression): New utility class.
15978 (Expression.ImplicitConversionExists): New utility function.
15980 2001-12-06 Miguel de Icaza <miguel@ximian.com>
15982 * statement.cs (Using): Implement.
15984 * expression.cs (LocalVariableReference): Support read only variables.
15986 * statement.cs: Remove the explicit emit for the Leave opcode.
15987 (VariableInfo): Add a readonly field.
15989 2001-12-05 Miguel de Icaza <miguel@ximian.com>
15991 * ecore.cs (ConvCast): new class used to encapsulate the various
15992 explicit integer conversions that works in both checked and
15993 unchecked contexts.
15995 (Expression.ConvertNumericExplicit): Use new ConvCast class to
15996 properly generate the overflow opcodes.
15998 2001-12-04 Miguel de Icaza <miguel@ximian.com>
16000 * statement.cs: The correct type for the EmptyExpression is the
16001 element_type, not the variable type. Ravi pointed this out.
16003 2001-12-04 Ravi Pratap <ravi@ximian.com>
16005 * class.cs (Method::Define): Handle PInvoke methods specially
16006 by using DefinePInvokeMethod instead of the usual one.
16008 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
16009 above to do the task of extracting information and defining the method.
16011 2001-12-04 Ravi Pratap <ravi@ximian.com>
16013 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
16014 of the condition for string type.
16016 (Emit): Move that here.
16018 (ArrayCreation::CheckIndices): Keep string literals in their expression
16021 (EmitDynamicInitializers): Handle strings appropriately.
16023 2001-12-04 Miguel de Icaza <miguel@ximian.com>
16025 * codegen.cs (EmitContext): Replace multiple variables with a
16026 single pointer to the current Switch statement.
16028 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
16031 2001-12-03 Miguel de Icaza <miguel@ximian.com>
16035 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
16038 (Foreach.Emit): Foreach on arrays was not setting
16039 up the loop variables (for break/continue).
16041 (GotoCase): Semi-implented.
16043 2001-12-03 Ravi Pratap <ravi@ximian.com>
16045 * attribute.cs (CheckAttribute): Handle system attributes by using
16046 Attribute.GetAttributes to examine information we need.
16048 (GetValidPlaces): Same here.
16050 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
16052 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
16054 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
16056 (Method::Define): Set appropriate flags if we have a DllImport attribute.
16058 (Method::Emit): Handle the case when we are a PInvoke method.
16060 2001-12-03 Miguel de Icaza <miguel@ximian.com>
16062 * expression.cs: Use ResolveWithSimpleName on compound names.
16064 2001-12-02 Ravi Pratap <ravi@ximian.com>
16066 * constant.cs (EmitConstant): Make sure we resolve the associated expression
16067 before trying to reduce it.
16069 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
16071 * constant.cs (LookupConstantValue): Implement.
16073 (EmitConstant): Use the above in emitting the constant.
16075 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
16076 that are user-defined by doing a LookupConstantValue on them.
16078 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
16081 2001-11-29 Miguel de Icaza <miguel@ximian.com>
16083 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
16085 (BaseAccess.DoResolve): Implement.
16087 (MemberAccess.DoResolve): Split this routine into a
16088 ResolveMemberAccess routine that can be used independently
16090 2001-11-28 Miguel de Icaza <miguel@ximian.com>
16092 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
16093 As that share bits of the implementation. Is returns a boolean,
16094 while As returns the Type that is being probed.
16096 2001-12-01 Ravi Pratap <ravi@ximian.com>
16098 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
16099 instead of a Literal - much easier.
16101 (EnumInTransit): Remove - utterly useless :-)
16103 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
16105 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
16107 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
16108 chain when we have no associated expression.
16110 2001-11-30 Ravi Pratap <ravi@ximian.com>
16112 * constant.cs (Define): Use Location while reporting the errror.
16114 Also emit a warning when 'new' is used and there is no inherited
16117 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
16120 (LookupEnumValue): Implement to lookup an enum member's value and define it
16123 (Populate): Re-write accordingly to use the above routine.
16125 2001-11-27 Miguel de Icaza <miguel@ximian.com>
16127 * expression.cs (This): Fix prototype for DoResolveLValue to
16128 override the base class DoResolveLValue.
16130 * cs-parser.cs: Report errors cs574 and cs575 (destructor
16133 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
16134 (we need to load the address of the field here). This fixes
16137 (FieldExpr.DoResolveLValue): Call the DoResolve
16138 function to initialize the Instance expression.
16140 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
16141 correctly the GetEnumerator operation on a value type.
16143 * cs-parser.jay: Add more simple parsing error catches.
16145 * statement.cs (Switch): Add support for string switches.
16146 Handle null specially.
16148 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
16150 2001-11-28 Ravi Pratap <ravi@ximian.com>
16152 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
16154 (declare_local_constant): New helper function.
16156 * statement.cs (AddConstant): Keep a separate record of constants
16158 (IsConstant): Implement to determine if a variable is a constant.
16160 (GetConstantExpression): Implement.
16162 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
16164 * statement.cs (IsVariableDefined): Re-write.
16166 2001-11-27 Ravi Pratap <ravi@ximian.com>
16168 * class.cs (TypeContainer::FindMembers): Look for constants
16169 in the case when we are looking for MemberTypes.Field
16171 * expression.cs (MemberAccess::DoResolve): Check that in the
16172 case we are a FieldExpr and a Literal, we are not being accessed
16173 by an instance reference.
16175 * cs-parser.jay (local_constant_declaration): Implement.
16177 (declaration_statement): Implement for constant declarations.
16179 2001-11-26 Miguel de Icaza <miguel@ximian.com>
16181 * statement.cs (Switch): Catch double defaults.
16183 (Switch): More work on the switch() statement
16184 implementation. It works for integral values now, need to finish
16188 2001-11-24 Miguel de Icaza <miguel@ximian.com>
16190 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
16191 integer literals into other integer literals. To be used by
16194 2001-11-24 Ravi Pratap <ravi@ximian.com>
16196 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
16199 (EmitDynamicInitializers): Cope with the above since we extract data
16200 directly from ArrayData now.
16202 (ExpectInitializers): Keep track of whether initializers are mandatory
16205 (Bounds): Make it a hashtable to prevent the same dimension being
16206 recorded for every element in that dimension.
16208 (EmitDynamicInitializers): Fix bug which prevented the Set array method
16211 Also fix bug which was causing the indices to be emitted in the reverse
16214 2001-11-24 Miguel de Icaza <miguel@ximian.com>
16216 * expression.cs (ArrayCreation): Implement the bits that Ravi left
16217 unfinished. They do not work, because the underlying code is
16220 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16222 * cs-parser.jay: Remove bogus fixme.
16224 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
16225 on Switch statement.
16227 2001-11-23 Ravi Pratap <ravi@ximian.com>
16229 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
16232 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
16233 parameter. Apparently, any expression is allowed.
16235 (ValidateInitializers): Update accordingly.
16237 (CheckIndices): Fix some tricky bugs thanks to recursion.
16239 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
16240 I was being completely brain-dead.
16242 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
16243 and re-write acordingly.
16245 (DelegateInvocation): Re-write accordingly.
16247 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
16249 (MakeByteBlob): Handle types more correctly.
16251 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
16252 initialization from expressions but it is incomplete because I am a complete
16255 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16257 * statement.cs (If.Emit): Fix a bug that generated incorrect code
16258 on If. Basically, we have to return `true' (ie, we do return to
16259 our caller) only if both branches of the if return.
16261 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
16262 short-circuit operators, handle them as short circuit operators.
16264 (Cast.DoResolve): Resolve type.
16265 (Cast.Cast): Take an expression as the target type.
16267 * cs-parser.jay (cast_expression): Remove old hack that only
16268 allowed a limited set of types to be handled. Now we take a
16269 unary_expression and we resolve to a type during semantic
16272 Use the grammar productions from Rhys to handle casts (this is
16273 not complete like Rhys syntax yet, we fail to handle that corner
16274 case that C# has regarding (-x), but we will get there.
16276 2001-11-22 Ravi Pratap <ravi@ximian.com>
16278 * class.cs (EmitFieldInitializer): Take care of the case when we have a
16279 field which is an array type.
16281 * cs-parser.jay (declare_local_variables): Support array initialization too.
16283 * typemanager.cs (MakeKey): Implement.
16285 (everywhere): Use the above appropriately.
16287 * cs-parser.jay (for_statement): Update for array initialization while
16288 declaring variables.
16290 * ecore.cs : The error message was correct, it's the variable's names that
16291 were misleading ;-) Make the code more readable.
16293 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
16294 the correct type etc.
16296 (ConvertExplicit): Handle Enum types by examining the underlying type.
16298 2001-11-21 Ravi Pratap <ravi@ximian.com>
16300 * parameter.cs (GetCallingConvention): Always return
16301 CallingConventions.Standard for now.
16303 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16305 * expression.cs (Binary.ResolveOperator): Update the values of `l'
16306 and `r' after calling DoNumericPromotions.
16308 * ecore.cs: Fix error message (the types were in the wrong order).
16310 * statement.cs (Foreach.ProbeCollectionType): Need to pass
16311 BindingFlags.Instance as well
16313 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
16314 implicit int literal conversion in an empty cast so that we
16315 propagate the right type upstream.
16317 (UnboxCast): new class used to unbox value types.
16318 (Expression.ConvertExplicit): Add explicit type conversions done
16321 (Expression.ImplicitNumericConversion): Oops, forgot to test for
16322 the target type before applying the implicit LongLiterals to ULong
16325 2001-11-21 Miguel de Icaza <miguel@ximian.com>
16327 * cs-parser.jay (for_statement): Reworked the way For works: now
16328 we declare manually any variables that are introduced in
16329 for_initializer to solve the problem of having out-of-band code
16330 emition (that is what got for broken).
16332 (declaration_statement): Perform the actual variable declaration
16333 that used to be done in local_variable_declaration here.
16335 (local_variable_declaration): Do not declare anything, just pass
16336 the information on a DictionaryEntry
16338 2001-11-20 Ravi Pratap <ravi@ximian.com>
16340 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
16341 re-write of the logic to now make it recursive.
16343 (UpdateIndices): Re-write accordingly.
16345 Store element data in a separate ArrayData list in the above methods.
16347 (MakeByteBlob): Implement to dump the array data into a byte array.
16349 2001-11-19 Ravi Pratap <ravi@ximian.com>
16351 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
16354 * constant.cs (Define): Implement.
16356 (EmitConstant): Re-write fully.
16358 Pass in location info.
16360 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
16363 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
16364 DictionaryEntry since we need location info too.
16366 (constant_declaration): Update accordingly.
16368 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
16369 code into another method : UpdateIndices.
16371 2001-11-18 Ravi Pratap <ravi@ximian.com>
16373 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
16374 some type checking etc.
16376 2001-11-17 Ravi Pratap <ravi@ximian.com>
16378 * expression.cs (ArrayCreation::ValidateInitializers): Implement
16379 bits to provide dimension info if the user skips doing that.
16381 Update second constructor to store the rank correctly.
16383 2001-11-16 Ravi Pratap <ravi@ximian.com>
16385 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
16386 and try to implement.
16388 * ../errors/cs0150.cs : Add.
16390 * ../errors/cs0178.cs : Add.
16392 2001-11-16 Miguel de Icaza <miguel@ximian.com>
16394 * statement.cs: Implement foreach on multi-dimensional arrays.
16396 * parameter.cs (Parameters.GetParameterByName): Also lookup the
16397 name of the params argument.
16399 * expression.cs: Use EmitStoreOpcode to get the right opcode while
16400 initializing the array.
16402 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
16403 we can use this elsewhere.
16405 * statement.cs: Finish implementation of foreach for single
16408 * cs-parser.jay: Use an out-of-band stack to pass information
16409 around, I wonder why I need this.
16411 foreach_block: Make the new foreach_block the current_block.
16413 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
16414 function used to return a static Parameters structure. Used for
16415 empty parameters, as those are created very frequently.
16417 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
16419 2001-11-15 Ravi Pratap <ravi@ximian.com>
16421 * interface.cs : Default modifier is private, not public. The
16422 make verify test passes again.
16424 2001-11-15 Ravi Pratap <ravi@ximian.com>
16426 * support.cs (ReflectionParameters): Fix logic to determine
16427 whether the last parameter is a params one. Test 9 passes again.
16429 * delegate.cs (Populate): Register the builders we define with
16430 RegisterParameterForBuilder. Test 19 passes again.
16432 * cs-parser.jay (property_declaration): Reference $6 instead
16433 of $$ to get at the location.
16435 (indexer_declaration): Similar stuff.
16437 (attribute): Ditto.
16439 * class.cs (Property): Register parameters for the Get and Set methods
16440 if they exist. Test 23 passes again.
16442 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
16443 call to EmitArguments as we are sure there aren't any params arguments.
16444 Test 32 passes again.
16446 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
16447 IndexOutOfRangeException.
16449 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
16450 Test 33 now passes again.
16452 2001-11-15 Miguel de Icaza <miguel@ximian.com>
16454 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
16455 broke a bunch of things. Will have to come up with a better way
16456 of tracking locations.
16458 * statement.cs: Implemented foreach for single dimension arrays.
16460 2001-11-09 Miguel de Icaza <miguel@ximian.com>
16462 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
16463 an error. This removes the lookup from the critical path.
16465 * cs-parser.jay: Removed use of temporary_loc, which is completely
16468 2001-11-14 Miguel de Icaza <miguel@ximian.com>
16470 * support.cs (ReflectionParameters.ParameterModifier): Report
16471 whether the argument is a PARAMS argument or not.
16473 * class.cs: Set the attribute `ParamArrayAttribute' on the
16474 parameter argument.
16476 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
16477 and cons_param_array_attribute (ConstructorInfo for
16478 ParamArrayAttribute).,
16480 * codegen.cs: Emit the return using the `Return' statement, that
16481 way we can report the error correctly for missing return values.
16483 * class.cs (Method.Emit): Clean up.
16485 * expression.cs (Argument.Resolve): Take another argument: the
16486 location where this argument is used. Notice that this is not
16487 part of the "Argument" class as to reduce the size of the
16488 structure (we know the approximate location anyways).
16490 Test if the argument is a variable-reference, if not, then
16491 complain with a 206.
16493 (Argument.Emit): Emit addresses of variables.
16495 (Argument.FullDesc): Simplify.
16497 (Invocation.DoResolve): Update for Argument.Resolve.
16499 (ElementAccess.DoResolve): ditto.
16501 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
16502 method should be virtual, as this method is always virtual.
16504 (NewDelegate.DoResolve): Update for Argument.Resolve.
16506 * class.cs (ConstructorInitializer.DoResolve): ditto.
16508 * attribute.cs (Attribute.Resolve): ditto.
16510 2001-11-13 Miguel de Icaza <miguel@ximian.com>
16512 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
16514 * expression.cs (ParameterReference): Drop IStackStorage and implement
16515 IAssignMethod instead.
16517 (LocalVariableReference): ditto.
16519 * ecore.cs (FieldExpr): Drop IStackStorage and implement
16520 IAssignMethod instead.
16522 2001-11-13 Miguel de Icaza <miguel@ximian.com>
16524 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
16525 enumerations that are used in heavily used structures derive from
16526 byte in a laughable and pathetic attempt to reduce memory usage.
16527 This is the kind of pre-optimzations that you should not do at
16528 home without adult supervision.
16530 * expression.cs (UnaryMutator): New class, used to handle ++ and
16531 -- separatedly from the other unary operators. Cleans up the
16532 code, and kills the ExpressionStatement dependency in Unary.
16534 (Unary): Removed `method' and `Arguments' from this class, making
16535 it smaller, and moving it all to SimpleCall, so I can reuse this
16536 code in other locations and avoid creating a lot of transient data
16537 strucutres when not required.
16539 * cs-parser.jay: Adjust for new changes.
16541 2001-11-11 Miguel de Icaza <miguel@ximian.com>
16543 * enum.cs (Enum.Populate): If there is a failure during
16546 * cs-parser.jay (opt_enum_base): we used to catch type errors
16547 here, but this is really incorrect. The type error should be
16548 catched during semantic analysis.
16550 2001-12-11 Ravi Pratap <ravi@ximian.com>
16552 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
16553 current_local_parameters as expected since I, in my stupidity, had forgotten
16556 * attribute.cs (GetValidPlaces): Fix stupid bug.
16558 * class.cs (Method::Emit): Perform check on applicability of attributes.
16560 (Constructor::Emit): Ditto.
16562 (Field::Emit): Ditto.
16564 (Field.Location): Store location information.
16566 (Property, Event, Indexer, Operator): Ditto.
16568 * cs-parser.jay (field_declaration): Pass in location for each field.
16570 * ../errors/cs0592.cs : Add.
16572 2001-11-12 Ravi Pratap <ravi@ximian.com>
16574 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
16576 (InitCoreTypes): Update accordingly.
16578 (RegisterAttrType, LookupAttr): Implement.
16580 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
16581 info about the same.
16583 (Resolve): Update to populate the above as necessary.
16585 (Error592): Helper.
16587 (GetValidPlaces): Helper to the above.
16589 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
16591 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
16593 2001-11-12 Ravi Pratap <ravi@ximian.com>
16595 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
16597 * ../errors/cs0617.cs : Add.
16599 2001-11-11 Ravi Pratap <ravi@ximian.com>
16601 * enum.cs (Emit): Rename to Populate to be more consistent with what
16602 we expect it to do and when exactly it is called.
16604 * class.cs, rootcontext.cs : Update accordingly.
16606 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
16607 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
16609 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
16611 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
16612 of a fieldinfo using the above, when dealing with a FieldBuilder.
16614 2001-11-10 Ravi Pratap <ravi@ximian.com>
16616 * ../errors/cs0031.cs : Add.
16618 * ../errors/cs1008.cs : Add.
16620 * ../errrors/cs0543.cs : Add.
16622 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
16625 (FindMembers): Implement.
16627 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
16628 enums and delegates too.
16630 (enum_types): Rename to builder_to_enum.
16632 (delegate_types): Rename to builder_to_delegate.
16634 * delegate.cs (FindMembers): Implement.
16636 2001-11-09 Ravi Pratap <ravi@ximian.com>
16638 * typemanager.cs (IsEnumType): Implement.
16640 * enum.cs (Emit): Re-write parts to account for the underlying type
16641 better and perform checking etc.
16643 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
16644 of the underlying type.
16646 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
16649 * enum.cs (error31): Helper to report error #31.
16651 * cs-parser.jay (enum_declaration): Store location of each member too.
16653 * enum.cs (member_to_location): New hashtable.
16655 (AddEnumMember): Update location hashtable.
16657 (Emit): Use the location of each member while reporting errors.
16659 2001-11-09 Miguel de Icaza <miguel@ximian.com>
16661 * cs-parser.jay: A for_initializer if is a
16662 local_variable_declaration really ammount to have an implicit
16663 block with the variable declaration and no initializer for for.
16665 * statement.cs (For.Emit): Cope with null initializers.
16667 This fixes the infinite loop on for initializers.
16669 2001-11-08 Miguel de Icaza <miguel@ximian.com>
16671 * enum.cs: More cleanup.
16673 * ecore.cs: Remove dead code.
16675 * class.cs (Property.Emit): More simplification.
16676 (Event.Emit): ditto.
16678 Reworked to have less levels of indentation.
16680 2001-11-08 Ravi Pratap <ravi@ximian.com>
16682 * class.cs (Property): Emit attributes.
16692 * enum.cs (Emit): Ditto.
16694 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
16697 * class.cs (Field, Event, etc.): Move attribute generation into the
16698 Emit method everywhere.
16700 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
16701 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
16702 as we had no way of defining nested enums !
16704 * rootcontext.cs : Adjust code accordingly.
16706 * typemanager.cs (AddEnumType): To keep track of enum types separately.
16708 2001-11-07 Ravi Pratap <ravi@ximian.com>
16710 * expression.cs (EvalConstantExpression): Move into ecore.cs
16712 * enum.cs (Enum): Rename some members and make them public and readonly
16713 according to our convention.
16715 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
16718 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
16720 (Enum::Emit): Write a simple version for now which doesn't try to compute
16721 expressions. I shall modify this to be more robust in just a while.
16723 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
16725 (TypeContainer::CloseType): Create the Enum types too.
16727 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
16729 * expression.cs (EvalConstantExpression): Get rid of completely.
16731 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
16732 user-defined values and other cases.
16734 (IsValidEnumLiteral): Helper function.
16736 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
16737 out there in the case we had a literal FieldExpr.
16739 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
16741 (Literalize): Revamp a bit to take two arguments.
16743 (EnumLiteral): New class which derives from Literal to wrap enum literals.
16745 2001-11-06 Ravi Pratap <ravi@ximian.com>
16747 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
16749 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
16751 (Resolve): Use the above to ensure we have proper initializers.
16753 2001-11-05 Ravi Pratap <ravi@ximian.com>
16755 * expression.cs (Expression::EvalConstantExpression): New method to
16756 evaluate constant expressions.
16758 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
16760 2001-11-07 Miguel de Icaza <miguel@ximian.com>
16762 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
16765 (Binary.ResolveOperator): Handle operator != (object a, object b)
16766 and operator == (object a, object b);
16768 (Binary.DoNumericPromotions): Indicate whether the numeric
16769 promotion was possible.
16771 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
16774 Made the ArrayAccess implement interface IAssignMethod instead of
16775 IStackStore as the order in which arguments are passed reflects
16778 * assign.cs: Instead of using expr.ExprClass to select the way of
16779 assinging, probe for the IStackStore/IAssignMethod interfaces.
16781 * typemanager.cs: Load InitializeArray definition.
16783 * rootcontext.cs (RootContext.MakeStaticData): Used to define
16784 static data that can be used to initialize arrays.
16786 2001-11-05 Miguel de Icaza <miguel@ximian.com>
16788 * expression.cs: Handle operator== and operator!= for booleans.
16790 (Conditioal.Reduce): Implement reducer for the ?: operator.
16792 (Conditional.Resolve): Implement dead code elimination.
16794 (Binary.Resolve): Catch string literals and return a new
16795 concatenated string.
16797 (Unary.Reduce): Implement reduction of unary expressions.
16799 * ecore.cs: Split out the expression core handling here.
16801 (Expression.Reduce): New method used to perform constant folding
16802 and CSE. This is needed to support constant-expressions.
16804 * statement.cs (Statement.EmitBoolExpression): Pass true and false
16805 targets, and optimize for !x.
16807 2001-11-04 Ravi Pratap <ravi@ximian.com>
16809 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
16810 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
16811 set custom atttributes.
16813 * literal.cs (Literal::GetValue): New abstract method to return the actual
16814 value of the literal, cast as an object.
16816 (*Literal): Implement GetValue method.
16818 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
16819 expressions to the arraylist but objects of type Argument.
16821 * class.cs (TypeContainer::Emit): Emit our attributes too.
16823 (Method::Emit, Constructor::Emit): Ditto.
16825 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
16826 to be ignoring earlier.
16828 2001-11-03 Ravi Pratap <ravi@ximian.com>
16830 * attribute.cs (AttributeSection::Define): Implement to do the business
16831 of constructing a CustomAttributeBuilder.
16833 (Attribute): New trivial class. Increases readability of code.
16835 * cs-parser.jay : Update accordingly.
16837 (positional_argument_list, named_argument_list, named_argument): New rules
16839 (attribute_arguments): Use the above so that we are more correct.
16841 2001-11-02 Ravi Pratap <ravi@ximian.com>
16843 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
16844 to perform all checks for a method with a params parameter.
16846 (Invocation::OverloadResolve): Update to use the above method and therefore
16847 cope correctly with params method invocations.
16849 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
16852 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
16853 constructors in our parent too because we can't afford to miss out on
16856 * attribute.cs (AttributeSection): New name for the class Attribute
16858 Other trivial changes to improve readability.
16860 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
16861 use the new class names.
16863 2001-11-01 Ravi Pratap <ravi@ximian.com>
16865 * class.cs (Method::Define): Complete definition for params types too
16867 (Indexer::Define): Ditto.
16869 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
16870 Cope everywhere with a request for info about the array parameter.
16872 2001-11-01 Ravi Pratap <ravi@ximian.com>
16874 * tree.cs (RecordNamespace): Fix up to check for the correct key.
16876 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
16877 local_variable_type to extract the string corresponding to the type.
16879 (local_variable_type): Fixup the action to use the new helper method.
16881 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
16884 * expression.cs : Clean out code which uses the above.
16886 2001-10-31 Ravi Pratap <ravi@ximian.com>
16888 * typemanager.cs (RegisterMethod): Check if we already have an existing key
16889 and bale out if necessary by returning a false.
16891 (RegisterProperty): Ditto.
16893 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
16894 and print out appropriate error messages.
16896 * interface.cs (everywhere): Ditto.
16898 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
16899 location to constructor.
16901 * class.cs (Property, Event, Indexer): Update accordingly.
16903 * ../errors/cs111.cs : Added.
16905 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
16906 of a method, as laid down by the spec.
16908 (Invocation::OverloadResolve): Use the above method.
16910 2001-10-31 Ravi Pratap <ravi@ximian.com>
16912 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
16913 now take a TypeContainer and a Parameters object.
16915 (ParameterData): Modify return type of ParameterModifier method to be
16916 Parameter.Modifier and not a string.
16918 (ReflectionParameters, InternalParameters): Update accordingly.
16920 * expression.cs (Argument::GetParameterModifier): Same here.
16922 * support.cs (InternalParameters::ParameterType): Find a better way of determining
16923 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
16924 symbol in it at all so maybe this is only for now.
16926 2001-10-30 Ravi Pratap <ravi@ximian.com>
16928 * support.cs (InternalParameters): Constructor now takes an extra argument
16929 which is the actual Parameters class.
16931 (ParameterDesc): Update to provide info on ref/out modifiers.
16933 * class.cs (everywhere): Update call to InternalParameters to pass in
16934 the second argument too.
16936 * support.cs (ParameterData): Add ParameterModifier, which is a method
16937 to return the modifier info [ref/out etc]
16939 (InternalParameters, ReflectionParameters): Implement the above.
16941 * expression.cs (Argument::ParameterModifier): Similar function to return
16942 info about the argument's modifiers.
16944 (Invocation::OverloadResolve): Update to take into account matching modifiers
16947 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
16948 a new SetFormalParameters object which we pass to InternalParameters.
16950 2001-10-30 Ravi Pratap <ravi@ximian.com>
16952 * expression.cs (NewArray): Merge into the ArrayCreation class.
16954 2001-10-29 Ravi Pratap <ravi@ximian.com>
16956 * expression.cs (NewArray): Merge classes NewBuiltinArray and
16957 NewUserdefinedArray into one as there wasn't much of a use in having
16960 * expression.cs (Argument): Change field's name to ArgType from Type.
16962 (Type): New readonly property which returns the proper type, taking into
16963 account ref/out modifiers.
16965 (everywhere): Adjust code accordingly for the above.
16967 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
16968 whether we are emitting for a ref or out parameter.
16970 * expression.cs (Argument::Emit): Use the above field to set the state.
16972 (LocalVariableReference::Emit): Update to honour the flag and emit the
16975 * parameter.cs (Attributes): Set the correct flags for ref parameters.
16977 * expression.cs (Argument::FullDesc): New function to provide a full desc.
16979 * support.cs (ParameterData): Add method ParameterDesc to the interface.
16981 (ReflectionParameters, InternalParameters): Implement the above method.
16983 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
16986 (Invocation::FullMethodDesc): Ditto.
16988 2001-10-29 Miguel de Icaza <miguel@ximian.com>
16990 * cs-parser.jay: Add extra production for the second form of array
16993 * expression.cs (ArrayCreation): Update to reflect the above
16996 * Small changes to prepare for Array initialization.
16998 2001-10-28 Miguel de Icaza <miguel@ximian.com>
17000 * typemanager.cs (ImplementsInterface): interface might be null;
17001 Deal with this problem;
17003 Also, we do store negative hits on the cache (null values), so use
17004 this instead of calling t.GetInterfaces on the type everytime.
17006 2001-10-28 Ravi Pratap <ravi@ximian.com>
17008 * typemanager.cs (IsBuiltinType): New method to help determine the same.
17010 * expression.cs (New::DoResolve): Get rid of array creation code and instead
17011 split functionality out into different classes.
17013 (New::FormArrayType): Move into NewBuiltinArray.
17015 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
17018 (NewBuiltinArray): New class to handle creation of built-in arrays.
17020 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
17021 account creation of one-dimensional arrays.
17023 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
17025 (NewUserdefinedArray::DoResolve): Implement.
17027 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
17029 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
17030 we maintain inside the TypeManager. This is necessary to perform lookups on the
17033 (LookupType): Update to perform GetType on the module builders too.
17035 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
17037 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
17039 2001-10-23 Ravi Pratap <ravi@ximian.com>
17041 * expression.cs (New::DoResolve): Implement guts of array creation.
17043 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
17045 2001-10-27 Miguel de Icaza <miguel@ximian.com>
17047 * expression.cs: Fix bug I introduced lsat night that broke
17050 (Expression.Resolve): Report a 246 error (can not resolve name)
17051 if we find a SimpleName in the stream.
17053 (Expression.ResolveLValue): Ditto.
17055 (Expression.ResolveWithSimpleName): This function is a variant of
17056 ResolveName, this one allows SimpleNames to be returned without a
17057 warning. The only consumer of SimpleNames is MemberAccess
17059 2001-10-26 Miguel de Icaza <miguel@ximian.com>
17061 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
17062 might arrive here. I have my doubts that this is correct.
17064 * statement.cs (Lock): Implement lock statement.
17066 * cs-parser.jay: Small fixes to support `lock' and `using'
17068 * cs-tokenizer.cs: Remove extra space
17070 * driver.cs: New flag --checked, allows to turn on integer math
17073 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
17074 Threading.Monitor.Exit
17076 2001-10-23 Miguel de Icaza <miguel@ximian.com>
17078 * expression.cs (IndexerAccess::DoResolveLValue): Set the
17079 Expression Class to be IndexerAccess.
17081 Notice that Indexer::DoResolve sets the eclass to Value.
17083 2001-10-22 Miguel de Icaza <miguel@ximian.com>
17085 * class.cs (TypeContainer::Emit): Emit code for indexers.
17087 * assign.cs (IAssignMethod): New interface implemented by Indexers
17088 and Properties for handling assignment.
17090 (Assign::Emit): Simplify and reuse code.
17092 * expression.cs (IndexerAccess, PropertyExpr): Implement
17093 IAssignMethod, clean up old code.
17095 2001-10-22 Ravi Pratap <ravi@ximian.com>
17097 * typemanager.cs (ImplementsInterface): New method to determine if a type
17098 implements a given interface. Provides a nice cache too.
17100 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
17103 (ConvertReferenceExplicit): Ditto.
17105 * delegate.cs (Delegate::Populate): Update to define the parameters on the
17106 various methods, with correct names etc.
17108 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
17109 Operator.UnaryNegation.
17111 * cs-parser.jay (operator_declarator): Be a little clever in the case where
17112 we have a unary plus or minus operator.
17114 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
17117 * everywhere : update accordingly.
17119 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
17122 * class.cs (Method::Define): For the case where we are implementing a method
17123 inherited from an interface, we need to set the MethodAttributes.Final flag too.
17124 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
17126 2001-10-21 Ravi Pratap <ravi@ximian.com>
17128 * interface.cs (FindMembers): Implement to work around S.R.E
17131 * typemanager.cs (IsInterfaceType): Implement.
17133 (FindMembers): Update to handle interface types too.
17135 * expression.cs (ImplicitReferenceConversion): Re-write bits which
17136 use IsAssignableFrom as that is not correct - it doesn't work.
17138 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
17139 and accordingly override EmitStatement.
17141 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
17142 using the correct logic :-)
17144 2001-10-19 Ravi Pratap <ravi@ximian.com>
17146 * ../errors/cs-11.cs : Add to demonstrate error -11
17148 2001-10-17 Miguel de Icaza <miguel@ximian.com>
17150 * assign.cs (Assign::Resolve): Resolve right hand side first, and
17151 then pass this as a hint to ResolveLValue.
17153 * expression.cs (FieldExpr): Add Location information
17155 (FieldExpr::LValueResolve): Report assignment to readonly
17158 (Expression::ExprClassFromMemberInfo): Pass location information.
17160 (Expression::ResolveLValue): Add new method that resolves an
17163 (Expression::DoResolveLValue): Default invocation calls
17166 (Indexers): New class used to keep track of indexers in a given
17169 (IStackStore): Renamed from LValue, as it did not really describe
17170 what this did. Also ResolveLValue is gone from this interface and
17171 now is part of Expression.
17173 (ElementAccess): Depending on the element access type
17175 * typemanager.cs: Add `indexer_name_type' as a Core type
17176 (System.Runtime.CompilerServices.IndexerNameAttribute)
17178 * statement.cs (Goto): Take a location.
17180 2001-10-18 Ravi Pratap <ravi@ximian.com>
17182 * delegate.cs (Delegate::VerifyDelegate): New method to verify
17183 if two delegates are compatible.
17185 (NewDelegate::DoResolve): Update to take care of the case when
17186 we instantiate a delegate from another delegate.
17188 * typemanager.cs (FindMembers): Don't even try to look up members
17189 of Delegate types for now.
17191 2001-10-18 Ravi Pratap <ravi@ximian.com>
17193 * delegate.cs (NewDelegate): New class to take care of delegate
17196 * expression.cs (New): Split the delegate related code out into
17197 the NewDelegate class.
17199 * delegate.cs (DelegateInvocation): New class to handle delegate
17202 * expression.cs (Invocation): Split out delegate related code into
17203 the DelegateInvocation class.
17205 2001-10-17 Ravi Pratap <ravi@ximian.com>
17207 * expression.cs (New::DoResolve): Implement delegate creation fully
17208 and according to the spec.
17210 (New::DoEmit): Update to handle delegates differently.
17212 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
17213 because of which we were printing out arguments in reverse order !
17215 * delegate.cs (VerifyMethod): Implement to check if the given method
17216 matches the delegate.
17218 (FullDelegateDesc): Implement.
17220 (VerifyApplicability): Implement.
17222 * expression.cs (Invocation::DoResolve): Update to accordingly handle
17223 delegate invocations too.
17225 (Invocation::Emit): Ditto.
17227 * ../errors/cs1593.cs : Added.
17229 * ../errors/cs1594.cs : Added.
17231 * delegate.cs (InstanceExpression, TargetMethod): New properties.
17233 2001-10-16 Ravi Pratap <ravi@ximian.com>
17235 * typemanager.cs (intptr_type): Core type for System.IntPtr
17237 (InitCoreTypes): Update for the same.
17239 (iasyncresult_type, asynccallback_type): Ditto.
17241 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
17244 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
17247 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
17248 the builders for the 4 members of a delegate type :-)
17250 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
17253 * expression.cs (New::DoResolve): Implement guts for delegate creation.
17255 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
17257 2001-10-15 Miguel de Icaza <miguel@ximian.com>
17259 * statement.cs (Break::Emit): Implement.
17260 (Continue::Emit): Implement.
17262 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
17263 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
17264 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
17265 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
17268 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
17269 properties that track the label for the current loop (begin of the
17270 loop and end of the loop).
17272 2001-10-15 Ravi Pratap <ravi@ximian.com>
17274 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
17275 use of emitting anything at all.
17277 * class.cs, rootcontext.cs : Get rid of calls to the same.
17279 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
17281 (Populate): Define the constructor correctly and set the implementation
17284 * typemanager.cs (delegate_types): New hashtable to hold delegates that
17287 (AddDelegateType): Implement.
17289 (IsDelegateType): Implement helper method.
17291 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
17293 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
17294 and accordingly handle it.
17296 * delegate.cs (Populate): Take TypeContainer argument.
17297 Implement bits to define the Invoke method. However, I still haven't figured out
17298 how to take care of the native int bit :-(
17300 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
17301 Qualify the name of the delegate, not its return type !
17303 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
17306 (StandardConversionExists): Checking for array types turns out to be recursive.
17308 (ConvertReferenceExplicit): Implement array conversion.
17310 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
17312 2001-10-12 Ravi Pratap <ravi@ximian.com>
17314 * cs-parser.jay (delegate_declaration): Store the fully qualified
17315 name as it is a type declaration.
17317 * delegate.cs (ReturnType, Name): Rename members to these. Make them
17320 (DefineDelegate): Renamed from Define. Does the same thing essentially,
17321 as TypeContainer::DefineType.
17323 (Populate): Method in which all the definition of the various methods (Invoke)
17326 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
17329 (CloseDelegate): Finally creates the delegate.
17331 * class.cs (TypeContainer::DefineType): Update to define delegates.
17332 (Populate, Emit and CloseType): Do the same thing here too.
17334 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
17335 delegates in all these operations.
17337 2001-10-14 Miguel de Icaza <miguel@ximian.com>
17339 * expression.cs: LocalTemporary: a new expression used to
17340 reference a temporary that has been created.
17342 * assign.cs: Handle PropertyAccess back here, so that we can
17343 provide the proper semantic access to properties.
17345 * expression.cs (Expression::ConvertReferenceExplicit): Implement
17346 a few more explicit conversions.
17348 * modifiers.cs: `NEW' modifier maps to HideBySig.
17350 * expression.cs (PropertyExpr): Make this into an
17351 ExpressionStatement, and support the EmitStatement code path.
17353 Perform get/set error checking, clean up the interface.
17355 * assign.cs: recognize PropertyExprs as targets, and if so, turn
17356 them into toplevel access objects.
17358 2001-10-12 Miguel de Icaza <miguel@ximian.com>
17360 * expression.cs: PropertyExpr::PropertyExpr: use work around the
17363 * typemanager.cs: Keep track here of our PropertyBuilders again to
17364 work around lameness in SRE.
17366 2001-10-11 Miguel de Icaza <miguel@ximian.com>
17368 * expression.cs (LValue::LValueResolve): New method in the
17369 interface, used to perform a second resolution pass for LValues.
17371 (This::DoResolve): Catch the use of this in static methods.
17373 (This::LValueResolve): Implement.
17375 (This::Store): Remove warning, assigning to `this' in structures
17378 (Invocation::Emit): Deal with invocation of
17379 methods on value types. We need to pass the address to structure
17380 methods rather than the object itself. (The equivalent code to
17381 emit "this" for structures leaves the entire structure on the
17382 stack instead of a pointer to it).
17384 (ParameterReference::DoResolve): Compute the real index for the
17385 argument based on whether the method takes or not a `this' pointer
17386 (ie, the method is static).
17388 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
17389 value types returned from functions when we need to invoke a
17390 method on the sturcture.
17393 2001-10-11 Ravi Pratap <ravi@ximian.com>
17395 * class.cs (TypeContainer::DefineType): Method to actually do the business of
17396 defining the type in the Modulebuilder or Typebuilder. This is to take
17397 care of nested types which need to be defined on the TypeBuilder using
17398 DefineNestedMethod.
17400 (TypeContainer::GetClassBases): Implement. Essentially the code from the
17401 methods in RootContext, only ported to be part of TypeContainer.
17403 (TypeContainer::GetInterfaceOrClass): Ditto.
17405 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
17407 * interface.cs (Interface::DefineInterface): New method. Does exactly
17408 what RootContext.CreateInterface did earlier, only it takes care of nested types
17411 (Interface::GetInterfaces): Move from RootContext here and port.
17413 (Interface::GetInterfaceByName): Same here.
17415 * rootcontext.cs (ResolveTree): Re-write.
17417 (PopulateTypes): Re-write.
17419 * class.cs (TypeContainer::Populate): Populate nested types too.
17420 (TypeContainer::Emit): Emit nested members too.
17422 * typemanager.cs (AddUserType): Do not make use of the FullName property,
17423 instead just use the name argument passed in as it is already fully
17426 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
17427 to TypeContainer mapping to see if a type is user-defined.
17429 * class.cs (TypeContainer::CloseType): Implement.
17431 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
17432 the default constructor.
17434 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
17437 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
17439 * interface.cs (CloseType): Create the type here.
17441 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
17444 Remove all the methods which are now in TypeContainer.
17446 2001-10-10 Ravi Pratap <ravi@ximian.com>
17448 * delegate.cs (Define): Re-write bits to define the delegate
17451 2001-10-10 Miguel de Icaza <miguel@ximian.com>
17453 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
17455 * expression.cs (ImplicitReferenceConversion): handle null as well
17456 as a source to convert to any reference type.
17458 * statement.cs (Return): Perform any implicit conversions to
17459 expected return type.
17461 Validate use of return statement.
17463 * codegen.cs (EmitContext): Pass the expected return type here.
17465 * class.cs (Method, Constructor, Property): Pass expected return
17466 type to EmitContext.
17468 2001-10-09 Miguel de Icaza <miguel@ximian.com>
17470 * expression.cs: Make DoResolve take an EmitContext instead of a
17473 Replaced `l' and `location' for `loc', for consistency.
17475 (Error, Warning): Remove unneeded Tc argument.
17477 * assign.cs, literal.cs, constant.cs: Update to new calling
17480 * codegen.cs: EmitContext now contains a flag indicating whether
17481 code is being generated in a static method or not.
17483 * cs-parser.jay: DecomposeQI, new function that replaces the old
17484 QualifiedIdentifier. Now we always decompose the assembled
17485 strings from qualified_identifier productions into a group of
17488 2001-10-08 Miguel de Icaza <miguel@ximian.com>
17490 * rootcontext.cs: Deal with field-less struct types correctly now
17491 by passing the size option to Define Type.
17493 * class.cs: Removed hack that created one static field.
17495 2001-10-07 Miguel de Icaza <miguel@ximian.com>
17497 * statement.cs: Moved most of the code generation here.
17499 2001-10-09 Ravi Pratap <ravi@ximian.com>
17501 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
17504 (ElementAccess): Remove useless bits for now - keep checks as the spec
17507 2001-10-08 Ravi Pratap <ravi@ximian.com>
17509 * expression.cs (ElementAccess::DoResolve): Remove my crap code
17510 and start performing checks according to the spec.
17512 2001-10-07 Ravi Pratap <ravi@ximian.com>
17514 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
17515 rank_specifiers instead.
17517 (rank_specifiers): Change the order in which the rank specifiers are stored
17519 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
17521 * expression.cs (ElementAccess): Implement the LValue interface too.
17523 2001-10-06 Ravi Pratap <ravi@ximian.com>
17525 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
17526 except that user defined conversions are not included.
17528 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
17529 perform the conversion of the return type, if necessary.
17531 (New::DoResolve): Check whether we are creating an array or an object
17532 and accordingly do the needful.
17534 (New::Emit): Same here.
17536 (New::DoResolve): Implement guts of array creation.
17538 (New::FormLookupType): Helper function.
17540 2001-10-07 Miguel de Icaza <miguel@ximian.com>
17542 * codegen.cs: Removed most of the code generation here, and move the
17543 corresponding code generation bits to the statement classes.
17545 Added support for try/catch/finalize and throw.
17547 * cs-parser.jay: Added support for try/catch/finalize.
17549 * class.cs: Catch static methods having the flags override,
17550 virtual or abstract.
17552 * expression.cs (UserCast): This user cast was not really doing
17553 what it was supposed to do. Which is to be born in fully resolved
17554 state. Parts of the resolution were being performed at Emit time!
17558 2001-10-05 Miguel de Icaza <miguel@ximian.com>
17560 * expression.cs: Implicity convert the result from UserCast.
17562 2001-10-05 Ravi Pratap <ravi@ximian.com>
17564 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
17565 prevented it from working correctly.
17567 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
17568 merely ConvertImplicit.
17570 2001-10-05 Miguel de Icaza <miguel@ximian.com>
17572 * typemanager.cs: Make the LookupTypeContainer function static,
17573 and not per-instance.
17575 * class.cs: Make static FindMembers (the one that takes a Type
17578 * codegen.cs: Add EmitForeach here.
17580 * cs-parser.jay: Make foreach a toplevel object instead of the
17581 inline expansion, as we need to perform semantic analysis on it.
17583 2001-10-05 Ravi Pratap <ravi@ximian.com>
17585 * expression.cs (Expression::ImplicitUserConversion): Rename to
17586 UserDefinedConversion.
17588 (Expression::UserDefinedConversion): Take an extra argument specifying
17589 whether we look for explicit user conversions too.
17591 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
17593 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
17595 (ExplicitUserConversion): Make it a call to UserDefinedConversion
17596 with the appropriate arguments.
17598 * cs-parser.jay (cast_expression): Record location too.
17600 * expression.cs (Cast): Record location info.
17602 (Expression::ConvertExplicit): Take location argument.
17604 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
17605 to determine if we are doing explicit conversions.
17607 (UserCast::Emit): Update accordingly.
17609 (Expression::ConvertExplicit): Report an error if everything fails.
17611 * ../errors/cs0030.cs : Add.
17613 2001-10-04 Miguel de Icaza <miguel@ximian.com>
17615 * modifiers.cs: If the ABSTRACT keyword is present, also set the
17616 virtual and newslot bits.
17618 * class.cs (TypeContainer::RegisterRequiredImplementations):
17619 Record methods we need.
17621 (TypeContainer::MakeKey): Helper function to make keys for
17622 MethodBases, since the Methodbase key is useless.
17624 (TypeContainer::Populate): Call RegisterRequiredImplementations
17625 before defining the methods.
17627 Create a mapping for method_builders_to_methods ahead of time
17628 instead of inside a tight loop.
17630 (::RequireMethods): Accept an object as the data to set into the
17631 hashtable so we can report interface vs abstract method mismatch.
17633 2001-10-03 Miguel de Icaza <miguel@ximian.com>
17635 * report.cs: Make all of it static.
17637 * rootcontext.cs: Drop object_type and value_type computations, as
17638 we have those in the TypeManager anyways.
17640 Drop report instance variable too, now it is a global.
17642 * driver.cs: Use try/catch on command line handling.
17644 Add --probe option to debug the error reporting system with a test
17647 * report.cs: Add support for exiting program when a probe
17648 condition is reached.
17650 2001-10-03 Ravi Pratap <ravi@ximian.com>
17652 * expression.cs (Binary::DoNumericPromotions): Fix the case when
17653 we do a forcible conversion regardless of type, to check if
17654 ForceConversion returns a null.
17656 (Binary::error19): Use location to report error.
17658 (Unary::error23): Use location here too.
17660 * ../errors/cs0019.cs : Check in.
17662 * ../errors/cs0023.cs : Check in.
17664 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
17665 case of a non-null MethodInfo object with a length of 0 !
17667 (Binary::ResolveOperator): Flag error if overload resolution fails to find
17668 an applicable member - according to the spec :-)
17669 Also fix logic to find members in base types.
17671 (Unary::ResolveOperator): Same here.
17673 (Unary::report23): Change name to error23 and make first argument a TypeContainer
17674 as I was getting thoroughly confused between this and error19 :-)
17676 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
17677 (::FindMostEncompassedType): Implement.
17678 (::FindMostEncompassingType): Implement.
17679 (::StandardConversionExists): Implement.
17681 (UserImplicitCast): Re-vamp. We now need info about most specific
17682 source and target types so that we can do the necessary conversions.
17684 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
17685 mathematical union with no duplicates.
17687 2001-10-03 Miguel de Icaza <miguel@ximian.com>
17689 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
17690 in order from base classes to child classes, so that we can in
17691 child classes look up in our parent for method names and
17692 attributes (required for handling abstract, virtual, new, override
17693 constructs: we need to instrospect our base class, and if we dont
17694 populate the classes in order, the introspection might be
17695 incorrect. For example, a method could query its parent before
17696 the parent has any methods and would determine that the parent has
17697 no abstract methods (while it could have had them)).
17699 (RootContext::CreateType): Record the order in which we define the
17702 2001-10-02 Miguel de Icaza <miguel@ximian.com>
17704 * class.cs (TypeContainer::Populate): Also method definitions can
17705 fail now, keep track of this.
17707 (TypeContainer::FindMembers): Implement support for
17708 DeclaredOnly/noDeclaredOnly flag.
17710 (Constructor::Emit) Return the ConstructorBuilder.
17712 (Method::Emit) Return the MethodBuilder.
17713 Check for abstract or virtual methods to be public.
17715 * rootcontext.cs (RootContext::CreateType): Register all the
17716 abstract methods required for the class to be complete and the
17717 interface methods that must be implemented.
17719 * cs-parser.jay: Report error 501 (method requires body if it is
17720 not marked abstract or extern).
17722 * expression.cs (TypeOf::Emit): Implement.
17724 * typemanager.cs: runtime_handle_type, new global type.
17726 * class.cs (Property::Emit): Generate code for properties.
17728 2001-10-02 Ravi Pratap <ravi@ximian.com>
17730 * expression.cs (Unary::ResolveOperator): Find operators on base type
17731 too - we now conform exactly to the spec.
17733 (Binary::ResolveOperator): Same here.
17735 * class.cs (Operator::Define): Fix minor quirk in the tests.
17737 * ../errors/cs0215.cs : Added.
17739 * ../errors/cs0556.cs : Added.
17741 * ../errors/cs0555.cs : Added.
17743 2001-10-01 Miguel de Icaza <miguel@ximian.com>
17745 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
17746 single integer which is really efficient
17748 2001-10-01 Ravi Pratap <ravi@ximian.com>
17750 * expression.cs (Expression::ImplicitUserConversion): Use location
17751 even in the case when we are examining True operators.
17753 * class.cs (Operator::Define): Perform extensive checks to conform
17754 with the rules for operator overloading in the spec.
17756 * expression.cs (Expression::ImplicitReferenceConversion): Implement
17757 some of the other conversions mentioned in the spec.
17759 * typemanager.cs (array_type): New static member for the System.Array built-in
17762 (cloneable_interface): For System.ICloneable interface.
17764 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
17765 we start resolving the tree and populating types.
17767 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
17769 2001-10-01 Miguel de Icaza <miguel@ximian.com>
17771 * expression.cs (Expression::ExprClassFromMemberInfo,
17772 Expression::Literalize): Create literal expressions from
17773 FieldInfos which are literals.
17775 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
17776 type casts, because they were wrong. The test suite in tests
17779 (ImplicitNumericConversion): ushort to ulong requires a widening
17782 Int32 constant to long requires widening cast as well.
17784 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
17785 for integers because the type on the stack is not i4.
17787 2001-09-30 Miguel de Icaza <miguel@ximian.com>
17789 * expression.cs (report118): require location argument.
17791 * parameter.cs: Do not dereference potential null value.
17793 * class.cs: Catch methods that lack the `new' keyword when
17794 overriding a name. Report warnings when `new' is used without
17795 anything being there to override.
17797 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
17799 * class.cs: Only add constructor to hashtable if it is non-null
17800 (as now constructors can fail on define).
17802 (TypeManager, Class, Struct): Take location arguments.
17804 Catch field instance initialization in structs as errors.
17806 accepting_filter: a new filter for FindMembers that is static so
17807 that we dont create an instance per invocation.
17809 (Constructor::Define): Catch errors where a struct constructor is
17812 * cs-parser.jay: Pass location information for various new
17815 * delegate.cs (Delegate): take a location argument.
17817 * driver.cs: Do not call EmitCode if there were problesm in the
17818 Definition of the types, as many Builders wont be there.
17820 * decl.cs (Decl::Decl): Require a location argument.
17822 * cs-tokenizer.cs: Handle properly hex constants that can not fit
17823 into integers, and find the most appropiate integer for it.
17825 * literal.cs: Implement ULongLiteral.
17827 * rootcontext.cs: Provide better information about the location of
17828 failure when CreateType fails.
17830 2001-09-29 Miguel de Icaza <miguel@ximian.com>
17832 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
17835 * expression.cs (Binary::CheckShiftArguments): Add missing type
17837 (Binary::ResolveOperator): Add type to the logical and and logical
17838 or, Bitwise And/Or and Exclusive Or code paths, it was missing
17841 (Binary::DoNumericPromotions): In the case where either argument
17842 is ulong (and most signed types combined with ulong cause an
17843 error) perform implicit integer constant conversions as well.
17845 2001-09-28 Miguel de Icaza <miguel@ximian.com>
17847 * expression.cs (UserImplicitCast): Method should always be
17849 (Invocation::BetterConversion): Simplified test for IntLiteral.
17851 (Expression::ImplicitNumericConversion): Split this routine out.
17852 Put the code that performs implicit constant integer conversions
17855 (Expression::Resolve): Become a wrapper around DoResolve so we can
17856 check eclass and type being set after resolve.
17858 (Invocation::Badness): Remove this dead function
17860 (Binary::ResolveOperator): Do not compute the expensive argumnets
17861 unless we have a union for it.
17863 (Probe::Emit): Is needs to do an isinst and then
17864 compare against null.
17866 (::CanConvert): Added Location argument. If the Location argument
17867 is null (Location.Null), then we do not report errors. This is
17868 used by the `probe' mechanism of the Explicit conversion. We do
17869 not want to generate an error for something that the user
17870 explicitly requested to be casted. But the pipeline for an
17871 explicit cast first tests for potential implicit casts.
17873 So for now, if the Location is null, it means `Probe only' to
17874 avoid adding another argument. Might have to revise this
17877 (ClassCast): New class used to type cast objects into arbitrary
17878 classes (used in Explicit Reference Conversions).
17880 Implement `as' as well.
17882 Reverted all the patches from Ravi below: they were broken:
17884 * The use of `level' as a mechanism to stop recursive
17885 invocations is wrong. That was there just to catch the
17886 bug with a strack trace but not as a way of addressing
17889 To fix the problem we have to *understand* what is going
17890 on and the interactions and come up with a plan, not
17891 just get things going.
17893 * The use of the type conversion cache that I proposed
17894 last night had an open topic: How does this work across
17895 protection domains. A user defined conversion might not
17896 be public in the location where we are applying the
17897 conversion, a different conversion might be selected
17898 (ie, private A->B (better) but public B->A (worse),
17899 inside A, A->B applies, but outside it, B->A will
17902 * On top of that (ie, even if the above is solved),
17903 conversions in a cache need to be abstract. Ie, `To
17904 convert from an Int to a Short use an OpcodeCast', not
17905 `To convert from an Int to a Short use the OpcodeCast on
17906 the variable 5' (which is what this patch was doing).
17908 2001-09-28 Ravi Pratap <ravi@ximian.com>
17910 * expression.cs (Invocation::ConversionExists): Re-write to use
17911 the conversion cache
17913 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
17914 cache all conversions done, not just user-defined ones.
17916 (Invocation::BetterConversion): The real culprit. Use ConversionExists
17917 to determine if a conversion exists instead of acutually trying to
17918 perform the conversion. It's faster too.
17920 (Expression::ConvertExplicit): Modify to use ConversionExists to check
17921 and only then attempt the implicit conversion.
17923 2001-09-28 Ravi Pratap <ravi@ximian.com>
17925 * expression.cs (ConvertImplicit): Use a cache for conversions
17926 already found. Check level of recursion and bail out if necessary.
17928 2001-09-28 Miguel de Icaza <miguel@ximian.com>
17930 * typemanager.cs (string_concat_string_string, string_concat_object_object):
17931 Export standard methods that we expect for string operations.
17933 * statement.cs (Block::UsageWarning): Track usage of variables and
17934 report the errors for not used variables.
17936 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
17939 2001-09-27 Miguel de Icaza <miguel@ximian.com>
17941 * codegen.cs: remove unnneded code
17943 * expression.cs: Removed BuiltinTypeAccess class
17945 Fix the order in which implicit conversions are
17948 The previous fixed dropped support for boxed conversions (adding a
17949 test to the test suite now)
17951 (UserImplicitCast::CanConvert): Remove test for source being null,
17952 that code is broken. We should not feed a null to begin with, if
17953 we do, then we should track the bug where the problem originates
17954 and not try to cover it up here.
17956 Return a resolved expression of type UserImplicitCast on success
17957 rather than true/false. Ravi: this is what I was talking about,
17958 the pattern is to use a static method as a "constructor" for
17961 Also, do not create arguments until the very last minute,
17962 otherwise we always create the arguments even for lookups that
17963 will never be performed.
17965 (UserImplicitCast::Resolve): Eliminate, objects of type
17966 UserImplicitCast are born in a fully resolved state.
17968 * typemanager.cs (InitCoreTypes): Init also value_type
17969 (System.ValueType).
17971 * expression.cs (Cast::Resolve): First resolve the child expression.
17973 (LValue): Add new method AddressOf to be used by
17976 Change the argument of Store to take an EmitContext instead of an
17977 ILGenerator, because things like FieldExpr need to be able to call
17978 their children expression to generate the instance code.
17980 (Expression::Error, Expression::Warning): Sugar functions for
17983 (Expression::MemberLookup): Accept a TypeContainer instead of a
17984 Report as the first argument.
17986 (Expression::ResolvePrimary): Killed. I still want to improve
17987 this as currently the code is just not right.
17989 (Expression::ResolveMemberAccess): Simplify, but it is still
17992 (Unary::Resolve): Catch errors in AddressOf operators.
17994 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
17995 index to a byte for the short-version, or the compiler will choose
17996 the wrong Emit call, which generates the wrong data.
17998 (ParameterReference::Emit, ::Store): same.
18000 (FieldExpr::AddressOf): Implement.
18002 * typemanager.cs: TypeManager: made public variable instead of
18005 * driver.cs: document --fatal.
18007 * report.cs (ErrorMessage, WarningMessage): new names for the old
18008 Error and Warning classes.
18010 * cs-parser.jay (member_access): Turn built-in access to types
18011 into a normal simplename
18013 2001-09-27 Ravi Pratap <ravi@ximian.com>
18015 * expression.cs (Invocation::BetterConversion): Fix to cope
18016 with q being null, since this was introducing a bug.
18018 * expression.cs (ConvertImplicit): Do built-in conversions first.
18020 2001-09-27 Ravi Pratap <ravi@ximian.com>
18022 * expression.cs (UserImplicitCast::Resolve): Fix bug.
18024 2001-09-27 Ravi Pratap <ravi@ximian.com>
18026 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
18027 I had introduced long ago (what's new ?).
18029 * expression.cs (UserImplicitCast::CanConvert): Static method to do
18030 the work of all the checking.
18031 (ConvertImplicit): Call CanConvert and only then create object if necessary.
18032 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
18034 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
18035 that is the right way.
18037 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
18038 overloading resolution. Use everywhere instead of cutting and pasting code.
18040 (Binary::ResolveOperator): Use MakeUnionSet.
18042 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
18043 we have to convert to bool types. Not complete yet.
18045 2001-09-27 Miguel de Icaza <miguel@ximian.com>
18047 * typemanager.cs (TypeManager::CSharpName): support ushort.
18049 * expression.cs (Expression::TryImplicitIntConversion): Attempts
18050 to provide an expression that performsn an implicit constant int
18051 conversion (section 6.1.6).
18052 (Expression::ConvertImplicitRequired): Reworked to include
18053 implicit constant expression conversions.
18055 (Expression::ConvertNumericExplicit): Finished.
18057 (Invocation::Emit): If InstanceExpression is null, then it means
18058 that we perform a call on this.
18060 2001-09-26 Miguel de Icaza <miguel@ximian.com>
18062 * expression.cs (Unary::Emit): Remove some dead code.
18063 (Probe): Implement Resolve and Emit for `is'.
18064 (Expression::ConvertImplicitRequired): Attempt to do constant
18065 expression conversions here. Maybe should be moved to
18066 ConvertImplicit, but I am not sure.
18067 (Expression::ImplicitLongConstantConversionPossible,
18068 Expression::ImplicitIntConstantConversionPossible): New functions
18069 that tell whether is it possible to apply an implicit constant
18070 expression conversion.
18072 (ConvertNumericExplicit): Started work on explicit numeric
18075 * cs-parser.jay: Update operator constants.
18077 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
18078 (Parameters::GetSignature): Hook up VerifyArgs here.
18079 (Parameters::VerifyArgs): Verifies that no two arguments have the
18082 * class.cs (Operator): Update the operator names to reflect the
18083 ones that the spec expects (as we are just stringizing the
18086 * expression.cs (Unary::ResolveOperator): Fix bug: Use
18087 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
18088 previous usage did only work for our methods.
18089 (Expression::ConvertImplicit): Handle decimal implicit numeric
18090 conversions as well.
18091 (Expression::InternalTypeConstructor): Used to invoke constructors
18092 on internal types for default promotions.
18094 (Unary::Emit): Implement special handling for the pre/post
18095 increment/decrement for overloaded operators, as they need to have
18096 the same semantics as the other operators.
18098 (Binary::ResolveOperator): ditto.
18099 (Invocation::ConversionExists): ditto.
18100 (UserImplicitCast::Resolve): ditto.
18102 2001-09-26 Ravi Pratap <ravi@ximian.com>
18104 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
18105 operator, return after emitting body. Regression tests pass again !
18107 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
18108 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
18109 (Invocation::OverloadResolve): Ditto.
18110 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
18112 * everywhere : update calls to the above methods accordingly.
18114 2001-09-26 Miguel de Icaza <miguel@ximian.com>
18116 * assign.cs (Assign): Make it inherit from ExpressionStatement.
18118 * expression.cs (ExpressionStatement): New base class used for
18119 expressions that can appear in statements, so that we can provide
18120 an alternate path to generate expression that do not leave a value
18123 (Expression::Emit, and all the derivatives): We no longer return
18124 whether a value is left on the stack or not. Every expression
18125 after being emitted leaves a single value on the stack.
18127 * codegen.cs (EmitContext::EmitStatementExpression): Use the
18128 facilties of ExpressionStatement if possible.
18130 * cs-parser.jay: Update statement_expression.
18132 2001-09-25 Miguel de Icaza <miguel@ximian.com>
18134 * driver.cs: Change the wording of message
18136 2001-09-25 Ravi Pratap <ravi@ximian.com>
18138 * expression.cs (Binary::ResolveOperator): Had forgottten to set
18139 the type of the expression to the return type of the method if
18140 we have an overloaded operator match ! The regression tests pass again !
18141 (Unary::ResolveOperator): Ditto.
18143 * expression.cs (Invocation::ConversionExists): Correct the member lookup
18144 to find "op_Implicit", not "implicit" ;-)
18145 (UserImplicitCast): New class to take care of user-defined implicit conversions.
18146 (ConvertImplicit, ForceConversion): Take TypeContainer argument
18148 * everywhere : Correct calls to the above accordingly.
18150 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
18151 (ConvertImplicit): Do user-defined conversion if it exists.
18153 2001-09-24 Miguel de Icaza <miguel@ximian.com>
18155 * assign.cs: track location.
18156 (Resolve): Use implicit conversions on assignment.
18158 * literal.cs: Oops. Not good, Emit of short access values should
18159 pass (Bytes) or the wrong argument will be selected.
18161 * expression.cs (Unary::Emit): Emit code for -expr.
18163 (Unary::ResolveOperator): Handle `Substract' for non-constants
18164 (substract from zero from the non-constants).
18165 Deal with Doubles as well.
18167 (Expression::ConvertImplicitRequired): New routine that reports an
18168 error if no implicit conversion exists.
18170 (Invocation::OverloadResolve): Store the converted implicit
18171 expressions if we make them
18173 2001-09-24 Ravi Pratap <ravi@ximian.com>
18175 * class.cs (ConstructorInitializer): Take a Location argument.
18176 (ConstructorBaseInitializer): Same here.
18177 (ConstructorThisInitializer): Same here.
18179 * cs-parser.jay : Update all calls accordingly.
18181 * expression.cs (Unary, Binary, New): Take location argument.
18182 Update accordingly everywhere.
18184 * cs-parser.jay : Update all calls to the above to take a location
18187 * class.cs : Ditto.
18189 2001-09-24 Ravi Pratap <ravi@ximian.com>
18191 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
18192 (Invocation::BetterConversion): Same here
18193 (Invocation::ConversionExists): Ditto.
18195 (Invocation::ConversionExists): Implement.
18197 2001-09-22 Ravi Pratap <ravi@ximian.com>
18199 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
18200 Also take an additional TypeContainer argument.
18202 * All over : Pass in TypeContainer as argument to OverloadResolve.
18204 * typemanager.cs (CSharpName): Update to check for the string type and return
18207 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
18210 2001-09-21 Ravi Pratap <ravi@ximian.com>
18212 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
18213 (Invocation::BetterFunction): Implement.
18214 (Invocation::BetterConversion): Implement.
18215 (Invocation::ConversionExists): Skeleton, no implementation yet.
18217 Okay, things work fine !
18219 2001-09-21 Miguel de Icaza <miguel@ximian.com>
18221 * typemanager.cs: declare and load enum_type, delegate_type and
18224 * expression.cs (Expression::Emit): Now emit returns a value that
18225 tells whether a value is left on the stack or not. This strategy
18226 might be reveted tomorrow with a mechanism that would address
18227 multiple assignments.
18228 (Expression::report118): Utility routine to report mismatches on
18231 (Unary::Report23): Report impossible type/operator combination
18234 (Unary::IsIncrementableNumber): Whether the type can be
18235 incremented or decremented with add.
18236 (Unary::ResolveOperator): Also allow enumerations to be bitwise
18238 (Unary::ResolveOperator): Implement ++, !, ~,
18240 (Invocation::Emit): Deal with new Emit convetion.
18242 * All Expression derivatives: Updated their Emit method to return
18243 whether they leave values on the stack or not.
18245 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
18246 stack for expressions that are statements.
18248 2001-09-20 Miguel de Icaza <miguel@ximian.com>
18250 * expression.cs (LValue): New interface. Must be implemented by
18252 (LocalVariableReference, ParameterReference, FieldExpr): Implement
18255 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
18256 interface for generating code, simplifies the code.
18258 2001-09-20 Ravi Pratap <ravi@ximian.com>
18260 * expression.cs (everywhere): Comment out return statements in ::Resolve
18261 methods to avoid the warnings.
18263 2001-09-20 Miguel de Icaza <miguel@ximian.com>
18265 * driver.cs (parse): Report error 2001 if we can not open the
18268 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
18271 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
18274 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
18275 otherwise nested blocks end up with the same index.
18277 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
18279 * expression.cs: Instead of having FIXMEs in the Resolve
18280 functions, throw exceptions so it is obvious that we are facing a
18283 * cs-parser.jay (invocation_expression): Pass Location information.
18285 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
18286 Use a basename for those routines because .NET does not like paths
18289 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
18292 2001-09-19 Miguel de Icaza <miguel@ximian.com>
18294 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
18295 are loading the correct data types (throws an exception if not).
18296 (TypeManager::InitCoreTypes): Use CoreLookupType
18298 * expression.cs (Unary::ResolveOperator): return the child
18299 expression for expressions which are just +expr.
18300 (Unary::ResolveOperator): Return negative literals for -LITERAL
18301 expressions (otherwise they are Unary {Literal}).
18302 (Invocation::Badness): Take into account `Implicit constant
18303 expression conversions'.
18305 * literal.cs (LongLiteral): Implement long literal class.
18306 (IntLiteral): export the `Value' of the intliteral.
18308 2001-09-19 Ravi Pratap <ravi@ximian.com>
18310 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
18312 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
18313 instead of 'Operator'
18315 * expression.cs (Binary::ResolveOperator): Update accordingly.
18316 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
18319 * cs-parser.jay (unary_expression): Update to use the new names.
18321 * gen-treedump.cs (GetUnary): Same here.
18323 * expression.cs (Unary::Resolve): Implement.
18324 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
18325 operators are found instead of making noise ;-)
18326 (Unary::ResolveOperator): New method to do precisely the same thing which
18327 Binary::ResolveOperator does for Binary expressions.
18328 (Unary.method, .Arguments): Add.
18329 (Unary::OperName): Implement.
18330 (Unary::ForceConversion): Copy and Paste !
18332 * class.cs (Operator::Define): Fix a small bug for the case when we have
18335 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
18336 for the inbuilt operators. Only overloading works for now ;-)
18338 2001-09-18 Miguel de Icaza <miguel@ximian.com>
18340 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
18341 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
18343 * expression.cs (This::Emit): Implement.
18344 (This::Resolve): Implement.
18345 (TypeOf:Resolve): Implement.
18346 (Expression::ResolveSimpleName): Add an implicit this to instance
18348 (MemberAccess::Resolve): Deal with Parameters and Fields.
18349 Bind instance variable to Field expressions.
18350 (FieldExpr::Instance): New field used to track the expression that
18351 represents the object instance.
18352 (FieldExpr::Resolve): Track potential errors from MemberLookup not
18354 (FieldExpr::Emit): Implement.
18356 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
18357 the last instruction contains a return opcode to avoid generating
18358 the last `ret' instruction (this generates correct code, and it is
18359 nice to pass the peverify output).
18361 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
18362 initializer for static and instance variables.
18363 (Constructor::Emit): Allow initializer to be null in the case of
18364 static constructors. Only emit initializer for instance
18367 (TypeContainer::FindMembers): Return a null array if there are no
18370 Also fix the code for the MemberTypes.Method branch, as it was not
18371 scanning that for operators (or tried to access null variables before).
18373 * assign.cs (Assign::Emit): Handle instance and static fields.
18377 * driver.cs: Stop compilation if there are parse errors.
18379 * cs-parser.jay (constructor_declaration): Provide default base
18380 initializer for non-static constructors.
18381 (constructor_declarator): Do not provide a default base
18382 initializers if none was specified.
18383 Catch the fact that constructors should not have parameters.
18385 * class.cs: Do not emit parent class initializers for static
18386 constructors, that should be flagged as an error.
18388 2001-09-18 Ravi Pratap <ravi@ximian.com>
18390 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
18391 Move back code into TypeContainer::Populate.
18393 2001-09-18 Ravi Pratap <ravi@ximian.com>
18395 * class.cs (TypeContainer::AddConstructor): Fix the check to
18396 compare against Name, not Basename.
18397 (Operator::OpType): Change Plus and Minus to Add and Subtract.
18399 * cs-parser.jay : Update accordingly.
18401 * class.cs (TypeContainer::FindMembers): For the case where we are searching
18402 for methods, don't forget to look into the operators too.
18403 (RegisterMethodBuilder): Helper method to take care of this for
18404 methods, constructors and operators.
18405 (Operator::Define): Completely revamp.
18406 (Operator.OperatorMethod, MethodName): New fields.
18407 (TypeContainer::Populate): Move the registering of builders into
18408 RegisterMethodBuilder.
18409 (Operator::Emit): Re-write.
18411 * expression.cs (Binary::Emit): Comment out code path to emit method
18412 invocation stuff for the case when we have a user defined operator. I am
18413 just not able to get it right !
18415 2001-09-17 Miguel de Icaza <miguel@ximian.com>
18417 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
18420 (Expression::MemberLookup): Provide a version that allows to
18421 specify the MemberTypes and BindingFlags.
18423 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
18424 so it was not fetching variable information from outer blocks.
18426 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
18427 Beforefieldinit as it was buggy.
18429 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
18430 that Ravi put here.
18432 * class.cs (Constructor::Emit): Only emit if block is not null.
18433 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
18434 deal with this by semantically definining it as if the user had
18437 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
18438 constructors as we now "emit" them at a higher level.
18440 (TypeContainer::DefineDefaultConstructor): Used to define the
18441 default constructors if none was provided.
18443 (ConstructorInitializer): Add methods Resolve and Emit.
18445 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
18447 2001-09-17 Ravi Pratap <ravi@ximian.com>
18449 * class.cs (TypeContainer::EmitDefaultConstructor): Register
18450 the default constructor builder with our hashtable for methodbuilders
18453 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
18454 and argument_count is 0 in which case we have a match.
18455 (Binary::ResolveOperator): More null checking and miscellaneous coding
18458 2001-09-17 Ravi Pratap <ravi@ximian.com>
18460 * rootcontext.cs (IsNameSpace): Compare against null.
18462 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
18464 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
18465 and Unary::Operator.
18467 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
18470 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
18471 we have overloaded operators.
18472 (Binary::ResolveOperator): Implement the part which does the operator overload
18475 * class.cs (Operator::Emit): Implement.
18476 (TypeContainer::Emit): Emit the operators we have too.
18478 * expression.cs (Binary::Emit): Update to emit the appropriate code for
18479 the case when we have a user-defined operator.
18481 2001-09-17 Miguel de Icaza <miguel@ximian.com>
18483 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
18485 2001-09-16 Ravi Pratap <ravi@ximian.com>
18487 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
18488 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
18489 (Constructor::Emit): Implement.
18490 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
18491 if we have no work to do.
18492 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
18495 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
18496 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
18498 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
18501 2001-09-15 Ravi Pratap <ravi@ximian.com>
18503 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
18505 (Tree::RecordNamespace): Method to do what the name says ;-)
18506 (Tree::Namespaces): Property to get at the namespaces hashtable.
18508 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
18511 * rootcontext.cs (IsNamespace): Fixed it :-)
18513 2001-09-14 Miguel de Icaza <miguel@ximian.com>
18515 * class.cs (TypeContainer::FindMembers): Add support for
18517 (MethodCore): New class that encapsulates both the shared aspects
18518 of a Constructor and a Method.
18519 (Method, Constructor): Factored pieces into MethodCore.
18521 * driver.cs: Added --fatal which makes errors throw exceptions.
18522 Load System assembly as well as part of the standard library.
18524 * report.cs: Allow throwing exceptions on errors for debugging.
18526 * modifiers.cs: Do not use `parent', instead use the real type
18527 container to evaluate permission settings.
18529 * class.cs: Put Ravi's patch back in. He is right, and we will
18530 have to cope with the
18532 2001-09-14 Ravi Pratap <ravi@ximian.com>
18534 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
18535 FamORAssem, not FamANDAssem.
18537 2001-09-14 Miguel de Icaza <miguel@ximian.com>
18539 * driver.cs: Added --parse option that only parses its input files
18542 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
18543 incorrect. IsTopLevel is not used to tell whether an object is
18544 root_types or not (that can be achieved by testing this ==
18545 root_types). But to see if this is a top-level *class* (not
18546 necessarly our "toplevel" container).
18548 2001-09-14 Ravi Pratap <ravi@ximian.com>
18550 * enum.cs (Enum::Define): Modify to call the Lookup method on the
18551 parent instead of a direct call to GetType.
18553 2001-09-14 Ravi Pratap <ravi@ximian.com>
18555 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
18556 Modifiers.TypeAttr. This should just be a call to that method.
18558 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
18559 object so that we can determine if we are top-level or not.
18561 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
18564 * enum.cs (Enum::Define): Ditto.
18566 * modifiers.cs (FieldAttr): Re-write.
18568 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
18569 (TypeContainer::HaveStaticConstructor): New property to provide access
18570 to precisely that info.
18572 * modifiers.cs (MethodAttr): Re-write.
18573 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
18575 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
18576 of top-level types as claimed.
18578 2001-09-13 Miguel de Icaza <miguel@ximian.com>
18580 * expression.cs (MemberLookup): Fruitless attempt to lookup
18581 constructors. Maybe I need to emit default constructors? That
18582 might be it (currently .NET emits this for me automatically).
18583 (Invocation::OverloadResolve): Cope with Arguments == null.
18584 (Invocation::EmitArguments): new function, shared by the new
18585 constructor and us.
18586 (Invocation::Emit): Handle static and instance methods. Emit
18587 proper call instruction for virtual or non-virtual invocations.
18588 (New::Emit): Implement.
18589 (New::Resolve): Implement.
18590 (MemberAccess:Resolve): Implement.
18591 (MethodGroupExpr::InstanceExpression): used conforming to the spec
18592 to track instances.
18593 (FieldExpr::Resolve): Set type.
18595 * support.cs: Handle empty arguments.
18597 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
18598 SimpleLookup): Auxiliary routines to help parse a qualifier
18601 Update qualifier_identifier rule.
18603 * codegen.cs: Removed debugging messages.
18605 * class.cs: Make this a global thing, this acts just as a "key" to
18606 objects that we might have around.
18608 (Populate): Only initialize method_builders_to_methods once.
18610 * expression.cs (PropertyExpr): Initialize type from the
18613 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
18614 Resolve pattern. Attempt to implicitly convert value to boolean.
18617 * expression.cs: Set the type for the int32/int32 argument case.
18618 (Binary::ResolveOperator): Set the return type to boolean for
18619 comparission operators
18621 * typemanager.cs: Remove debugging print code.
18623 (Invocation::Resolve): resolve type.
18625 * class.cs: Allocate a MemberInfo of the correct size, as the code
18626 elsewhere depends on the test to reflect the correct contents.
18628 (Method::) Keep track of parameters, due to System.Reflection holes
18630 (TypeContainer::Populate): Keep track of MethodBuilders to Method
18633 (TypeContainer::FindMembers): Use ArrayList and then copy an array
18634 of the exact size and return that.
18636 (Class::LookupMethodByBuilder): New function that maps
18637 MethodBuilders to its methods. Required to locate the information
18638 on methods because System.Reflection bit us again.
18640 * support.cs: New file, contains an interface ParameterData and
18641 two implementations: ReflectionParameters and InternalParameters
18642 used to access Parameter information. We will need to grow this
18645 * expression.cs (Invocation::GetParameterData): implement a cache
18646 and a wrapper around the ParameterData creation for methods.
18647 (Invocation::OverloadResolve): Use new code.
18649 2001-09-13 Ravi Pratap <ravi@ximian.com>
18651 * class.cs (TypeContainer::EmitField): Remove and move into
18652 (Field::Define): here and modify accordingly.
18653 (Field.FieldBuilder): New member.
18654 (TypeContainer::Populate): Update accordingly.
18655 (TypeContainer::FindMembers): Implement.
18657 2001-09-13 Miguel de Icaza <miguel@ximian.com>
18659 * statement.cs: (VariableInfo::VariableType): New field to be
18660 initialized with the full type once it is resolved.
18662 2001-09-12 Miguel de Icaza <miguel@ximian.com>
18664 * parameter.cs (GetParameterInfo): Use a type cache to compute
18665 things only once, and to reuse this information
18667 * expression.cs (LocalVariableReference::Emit): Implement.
18668 (OpcodeCast::Emit): fix.
18670 (ParameterReference::Resolve): Implement.
18671 (ParameterReference::Emit): Implement.
18673 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
18674 that are expressions need to stay as Expressions.
18676 * typemanager.cs (CSharpName): Returns the C# name of a type if
18679 * expression.cs (Expression::ConvertImplicit): New function that
18680 implements implicit type conversions.
18682 (Expression::ImplicitReferenceConversion): Implements implicit
18683 reference conversions.
18685 (EmptyCast): New type for transparent casts.
18687 (OpcodeCast): New type for casts of types that are performed with
18688 a sequence of bytecodes.
18690 (BoxedCast): New type used for casting value types into reference
18691 types. Emits a box opcode.
18693 (Binary::DoNumericPromotions): Implements numeric promotions of
18694 and computation of the Binary::Type.
18696 (Binary::EmitBranchable): Optimization.
18698 (Binary::Emit): Implement code emission for expressions.
18700 * typemanager.cs (TypeManager): Added two new core types: sbyte
18703 2001-09-12 Ravi Pratap <ravi@ximian.com>
18705 * class.cs (TypeContainer::FindMembers): Method which does exactly
18706 what Type.FindMembers does, only we don't have to use reflection. No
18707 implementation yet.
18709 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
18710 typecontainer objects as we need to get at them.
18711 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
18713 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
18714 typecontainer object.
18716 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
18717 of just a Report object.
18719 2001-09-11 Ravi Pratap <ravi@ximian.com>
18721 * class.cs (Event::Define): Go back to using the prefixes "add_" and
18723 (TypeContainer::Populate): Now define the delegates of the type too.
18724 (TypeContainer.Delegates): Property to access the list of delegates defined
18727 * delegates.cs (Delegate::Define): Implement partially.
18729 * modifiers.cs (TypeAttr): Handle more flags.
18731 2001-09-11 Ravi Pratap <ravi@ximian.com>
18733 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
18735 (Operator::Define): Re-write logic to get types by using the LookupType method
18736 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
18737 (Indexer::Define): Ditto.
18738 (Event::Define): Ditto.
18739 (Property::Define): Ditto.
18741 2001-09-10 Ravi Pratap <ravi@ximian.com>
18743 * class.cs (TypeContainer::Populate): Now define operators too.
18744 (TypeContainer.Operators): New property to access the list of operators
18746 (Operator.OperatorMethodBuilder): New member to hold the method builder
18747 for the operator we are defining.
18748 (Operator::Define): Implement.
18750 2001-09-10 Ravi Pratap <ravi@ximian.com>
18752 * class.cs (Event::Define): Make the prefixes of the accessor methods
18753 addOn_ and removeOn_
18755 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
18756 of the location being passed in too. Ideally, this should go later since all
18757 error reporting should be done through the Report object.
18759 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
18760 (Populate): Iterate thru the indexers we have and define them too.
18761 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
18762 for the get and set accessors.
18763 (Indexer::Define): Implement.
18765 2001-09-09 Miguel de Icaza <miguel@ximian.com>
18767 * expression.cs (Binary::Resolve): Beginning of it. I scratched
18768 my previous implementation, did not work.
18770 * typemanager.cs: Add a couple of missing types (the longs).
18772 * literal.cs: Use TypeManager.bool_type instead of getting it.
18774 * expression.cs (EventExpr): New kind of expressions.
18775 (Expressio::ExprClassFromMemberInfo): finish
18777 2001-09-08 Miguel de Icaza <miguel@ximian.com>
18779 * assign.cs: Emit stores to static fields differently.
18781 2001-09-08 Ravi Pratap <ravi@ximian.com>
18783 * Merge in changes and adjust code to tackle conflicts. Backed out my
18784 code in Assign::Resolve ;-)
18786 2001-09-08 Ravi Pratap <ravi@ximian.com>
18788 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
18789 instead Report.Error and also pass in the location.
18790 (CSharpParser::Lexer): New readonly property to return the reference
18791 to the Tokenizer object.
18792 (declare_local_variables): Use Report.Error with location instead of plain
18796 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
18797 (Operator.CheckBinaryOperator): Ditto.
18799 * cs-parser.jay (operator_declarator): Update accordingly.
18801 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
18802 (CheckBinaryOperator): Same here.
18804 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
18805 on the name without any prefixes of namespace names etc. This is because we
18806 already might have something already fully qualified like
18807 'System.Console.WriteLine'
18809 * assign.cs (Resolve): Begin implementation. Stuck ;-)
18811 2001-09-07 Ravi Pratap <ravi@ximian.com>
18813 * cs-tokenizer.cs (location): Return a string which also contains
18816 * expression.cs (ElementAccess): New class for expressions of the
18817 type 'element access.'
18818 (BaseAccess): New class for expressions of the type 'base access.'
18819 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
18822 * cs-parser.jay (element_access): Implement action.
18823 (base_access): Implement actions.
18824 (checked_expression, unchecked_expression): Implement.
18826 * cs-parser.jay (local_variable_type): Correct and implement.
18827 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
18829 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
18831 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
18832 name and the specifiers.
18834 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
18836 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
18837 making them all public ;-)
18839 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
18842 2001-09-07 Miguel de Icaza <miguel@ximian.com>
18844 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
18846 (FieldExpr, PropertyExprs): New resolved expressions.
18847 (SimpleName::MemberStaticCheck): Perform static checks for access
18848 to non-static fields on static methods. Maybe this should be
18849 generalized for MemberAccesses.
18850 (SimpleName::ResolveSimpleName): More work on simple name
18853 * cs-parser.jay (primary_expression/qualified_identifier): track
18854 the parameter index.
18856 * codegen.cs (CodeGen::Save): Catch save exception, report error.
18857 (EmitContext::EmitBoolExpression): Chain to expression generation
18858 instead of temporary hack.
18859 (::EmitStatementExpression): Put generic expression code generation.
18861 * assign.cs (Assign::Emit): Implement variable assignments to
18862 local variables, parameters and fields.
18864 2001-09-06 Miguel de Icaza <miguel@ximian.com>
18866 * statement.cs (Block::GetVariableInfo): New method, returns the
18867 VariableInfo for a variable name in a block.
18868 (Block::GetVariableType): Implement in terms of GetVariableInfo
18870 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
18871 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
18873 2001-09-06 Ravi Pratap <ravi@ximian.com>
18875 * cs-parser.jay (operator_declaration): Continue on my quest : update
18876 to take attributes argument.
18877 (event_declaration): Ditto.
18878 (enum_declaration): Ditto.
18879 (indexer_declaration): Ditto.
18881 * class.cs (Operator::Operator): Update constructor accordingly.
18882 (Event::Event): Ditto.
18884 * delegate.cs (Delegate::Delegate): Same here.
18886 * enum.cs (Enum::Enum): Same here.
18888 2001-09-05 Ravi Pratap <ravi@ximian.com>
18890 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
18892 * ../tests/cs0658.cs : New file to demonstrate error 0658.
18894 * attribute.cs (Attributes): New class to encapsulate all attributes which were
18895 being passed around as an arraylist.
18896 (Attributes::AddAttribute): Method to add attribute sections.
18898 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
18899 (struct_declaration): Update accordingly.
18900 (constant_declaration): Update.
18901 (field_declaration): Update.
18902 (method_header): Update.
18903 (fixed_parameter): Update.
18904 (parameter_array): Ditto.
18905 (property_declaration): Ditto.
18906 (destructor_declaration): Ditto.
18908 * class.cs (Struct::Struct): Update constructors accordingly.
18909 (Class::Class): Ditto.
18910 (Field::Field): Ditto.
18911 (Method::Method): Ditto.
18912 (Property::Property): Ditto.
18913 (TypeContainer::OptAttribute): update property's return type.
18915 * interface.cs (Interface.opt_attributes): New member.
18916 (Interface::Interface): Update to take the extra Attributes argument.
18918 * parameter.cs (Parameter::Parameter): Ditto.
18920 * constant.cs (Constant::Constant): Ditto.
18922 * interface.cs (InterfaceMemberBase): New OptAttributes field.
18923 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
18924 the attributes as a parameter.
18925 (InterfaceProperty): Update constructor call.
18926 (InterfaceEvent): Ditto.
18927 (InterfaceMethod): Ditto.
18928 (InterfaceIndexer): Ditto.
18930 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
18931 pass the attributes too.
18932 (interface_event_declaration): Ditto.
18933 (interface_property_declaration): Ditto.
18934 (interface_method_declaration): Ditto.
18935 (interface_declaration): Ditto.
18937 2001-09-05 Miguel de Icaza <miguel@ximian.com>
18939 * class.cs (Method::Define): Track the "static Main" definition to
18940 create an entry point.
18942 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
18943 EntryPoint if we find it.
18945 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
18946 (EmitContext::ig): Make this variable public.
18948 * driver.cs: Make the default output file be the first file name
18949 with the .exe extension.
18951 Detect empty compilations
18953 Handle various kinds of output targets. Handle --target and
18954 rename -t to --dumper.
18956 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
18957 methods inherited from Expression return now an Expression. This
18958 will is used during the tree rewriting as we resolve them during
18961 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
18962 the spec. Missing entirely is the information about
18963 accessability of elements of it.
18965 (Expression::ExprClassFromMemberInfo): New constructor for
18966 Expressions that creates a fully initialized Expression based on
18967 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
18970 (Invocation::Resolve): Begin implementing resolution of invocations.
18972 * literal.cs (StringLiteral): Implement Emit.
18974 2001-09-05 Ravi Pratap <ravi@ximian.com>
18976 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
18979 2001-09-04 Ravi Pratap <ravi@ximian.com>
18981 * cs-parser.jay (attribute_arguments): Implement actions.
18982 (attribute): Fix bug in production. Implement action.
18983 (attribute_list): Implement.
18984 (attribute_target): Implement.
18985 (attribute_target_specifier, opt_target_specifier): Implement
18986 (CheckAttributeTarget): New method to check if the attribute target
18988 (attribute_section): Implement.
18989 (opt_attributes): Implement.
18991 * attribute.cs : New file to handle attributes.
18992 (Attribute): Class to hold attribute info.
18994 * cs-parser.jay (opt_attribute_target_specifier): Remove production
18995 (attribute_section): Modify production to use 2 different rules to
18996 achieve the same thing. 1 s/r conflict down !
18997 Clean out commented, useless, non-reducing dimension_separator rules.
18999 * class.cs (TypeContainer.attributes): New member to hold list
19000 of attributes for a type.
19001 (Struct::Struct): Modify to take one more argument, the attribute list.
19002 (Class::Class): Ditto.
19003 (Field::Field): Ditto.
19004 (Method::Method): Ditto.
19005 (Property::Property): Ditto.
19007 * cs-parser.jay (struct_declaration): Update constructor call to
19008 pass in the attributes too.
19009 (class_declaration): Ditto.
19010 (constant_declaration): Ditto.
19011 (field_declaration): Ditto.
19012 (method_header): Ditto.
19013 (fixed_parameter): Ditto.
19014 (parameter_array): Ditto.
19015 (property_declaration): Ditto.
19017 * constant.cs (Constant::Constant): Update constructor similarly.
19018 Use System.Collections.
19020 * parameter.cs (Parameter::Parameter): Update as above.
19022 2001-09-02 Ravi Pratap <ravi@ximian.com>
19024 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
19025 (TypeContainer.delegates): New member to hold list of delegates.
19027 * cs-parser.jay (delegate_declaration): Implement the action correctly
19028 this time as I seem to be on crack ;-)
19030 2001-09-02 Miguel de Icaza <miguel@ximian.com>
19032 * rootcontext.cs (RootContext::IsNamespace): new function, used to
19033 tell whether an identifier represents a namespace.
19035 * expression.cs (NamespaceExpr): A namespace expression, used only
19036 temporarly during expression resolution.
19037 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
19038 utility functions to resolve names on expressions.
19040 2001-09-01 Miguel de Icaza <miguel@ximian.com>
19042 * codegen.cs: Add hook for StatementExpressions.
19044 * class.cs: Fix inverted test for static flag in methods.
19046 2001-09-02 Ravi Pratap <ravi@ximian.com>
19048 * class.cs (Operator::CheckUnaryOperator): Correct error number used
19049 to make it coincide with MS' number.
19050 (Operator::CheckBinaryOperator): Ditto.
19052 * ../errors/errors.txt : Remove error numbers added earlier.
19054 * ../errors/cs1019.cs : Test case for error # 1019
19056 * ../errros/cs1020.cs : Test case for error # 1020
19058 * cs-parser.jay : Clean out commented cruft.
19059 (dimension_separators, dimension_separator): Comment out. Ostensibly not
19060 used anywhere - non-reducing rule.
19061 (namespace_declarations): Non-reducing rule - comment out.
19063 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
19064 with TypeContainer::AddEnum.
19066 * delegate.cs : New file for delegate handling classes.
19067 (Delegate): Class for declaring delegates.
19069 * makefile : Update.
19071 * cs-parser.jay (delegate_declaration): Implement.
19073 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
19075 * class.cs (Event::Define): Implement.
19076 (Event.EventBuilder): New member.
19078 * class.cs (TypeContainer::Populate): Update to define all enums and events
19080 (Events): New property for the events arraylist we hold. Shouldn't we move to using
19081 readonly fields for all these cases ?
19083 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
19085 * class.cs (Property): Revamp to use the convention of making fields readonly.
19086 Accordingly modify code elsewhere.
19088 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
19089 the Define method of the Property class.
19091 * class.cs : Clean up applied patch and update references to variables etc. Fix
19093 (TypeContainer::Populate): Update to define all the properties we have. Also
19094 define all enumerations.
19096 * enum.cs (Define): Implement.
19098 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
19100 * cs-parser.jay (overloadable_operator): The semantic value is an
19101 enum of the Operator class.
19102 (operator_declarator): Implement actions.
19103 (operator_declaration): Implement.
19105 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
19106 validity of definitions.
19107 (Operator::CheckBinaryOperator): Static method to check for binary operators
19108 (TypeContainer::AddOperator): New method to add an operator to a type.
19110 * cs-parser.jay (indexer_declaration): Added line to actually call the
19111 AddIndexer method so it gets added ;-)
19113 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
19114 already taken care of by the MS compiler ?
19116 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
19118 * class.cs (Operator): New class for operator declarations.
19119 (Operator::OpType): Enum for the various operators.
19121 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
19123 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
19124 ostensibly handle this in semantic analysis.
19126 * cs-parser.jay (general_catch_clause): Comment out
19127 (specific_catch_clauses, specific_catch_clause): Ditto.
19128 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
19129 (catch_args, opt_catch_args): New productions.
19130 (catch_clause): Rewrite to use the new productions above
19131 (catch_clauses): Modify accordingly.
19132 (opt_catch_clauses): New production to use in try_statement
19133 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
19134 and re-write the code in the actions to extract the specific and
19135 general catch clauses by being a little smart ;-)
19137 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
19138 Hooray, try and catch statements parse fine !
19140 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19142 * statement.cs (Block::GetVariableType): Fix logic to extract the type
19143 string from the hashtable of variables.
19145 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
19146 I end up making that mistake ;-)
19147 (catch_clauses): Fixed gross error which made Key and Value of the
19148 DictionaryEntry the same : $1 !!
19150 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19152 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
19154 * cs-parser.jay (event_declaration): Correct to remove the semicolon
19155 when the add and remove accessors are specified.
19157 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19159 * cs-parser.jay (IndexerDeclaration): New helper class to hold
19160 information about indexer_declarator.
19161 (indexer_declarator): Implement actions.
19162 (parsing_indexer): New local boolean used to keep track of whether
19163 we are parsing indexers or properties. This is necessary because
19164 implicit_parameters come into picture even for the get accessor in the
19165 case of an indexer.
19166 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
19168 * class.cs (Indexer): New class for indexer declarations.
19169 (TypeContainer::AddIndexer): New method to add an indexer to a type.
19170 (TypeContainer::indexers): New member to hold list of indexers for the
19173 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
19175 * cs-parser.jay (add_accessor_declaration): Implement action.
19176 (remove_accessor_declaration): Implement action.
19177 (event_accessors_declaration): Implement
19178 (variable_declarators): swap statements for first rule - trivial.
19180 * class.cs (Event): New class to hold information about event
19182 (TypeContainer::AddEvent): New method to add an event to a type
19183 (TypeContainer::events): New member to hold list of events.
19185 * cs-parser.jay (event_declaration): Implement actions.
19187 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
19189 * cs-parser.jay (dim_separators): Implement. Make it a string
19190 concatenating all the commas together, just as they appear.
19191 (opt_dim_separators): Modify accordingly
19192 (rank_specifiers): Update accordingly. Basically do the same
19193 thing - instead, collect the brackets here.
19194 (opt_rank_sepcifiers): Modify accordingly.
19195 (array_type): Modify to actually return the complete type string
19196 instead of ignoring the rank_specifiers.
19197 (expression_list): Implement to collect the expressions
19198 (variable_initializer): Implement. We make it a list of expressions
19199 essentially so that we can handle the array_initializer case neatly too.
19200 (variable_initializer_list): Implement.
19201 (array_initializer): Make it a list of variable_initializers
19202 (opt_array_initializer): Modify accordingly.
19204 * expression.cs (New::NType): Add enumeration to help us
19205 keep track of whether we have an object/delegate creation
19206 or an array creation.
19207 (New:NewType, New::Rank, New::Indices, New::Initializers): New
19208 members to hold data about array creation.
19209 (New:New): Modify to update NewType
19210 (New:New): New Overloaded contructor for the array creation
19213 * cs-parser.jay (array_creation_expression): Implement to call
19214 the overloaded New constructor.
19216 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
19218 * class.cs (TypeContainer::Constructors): Return member
19219 constructors instead of returning null.
19221 2001-08-26 Miguel de Icaza <miguel@ximian.com>
19223 * typemanager.cs (InitCoreTypes): Initialize the various core
19224 types after we have populated the type manager with the user
19225 defined types (this distinction will be important later while
19226 compiling corlib.dll)
19228 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
19229 on Expression Classification. Now all expressions have a method
19230 `Resolve' and a method `Emit'.
19232 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
19233 generation from working. Also add some temporary debugging
19236 2001-08-24 Miguel de Icaza <miguel@ximian.com>
19238 * codegen.cs: Lots of code generation pieces. This is only the
19239 beginning, will continue tomorrow with more touches of polish. We
19240 handle the fundamentals of if, while, do, for, return. Others are
19241 trickier and I need to start working on invocations soon.
19243 * gen-treedump.cs: Bug fix, use s.Increment here instead of
19246 * codegen.cs (EmitContext): New struct, used during code
19247 emission to keep a context. Most of the code generation will be
19250 * cs-parser.jay: Add embedded blocks to the list of statements of
19251 this block. So code generation proceeds in a top down fashion.
19253 2001-08-23 Miguel de Icaza <miguel@ximian.com>
19255 * statement.cs: Add support for multiple child blocks.
19257 2001-08-22 Miguel de Icaza <miguel@ximian.com>
19259 * codegen.cs (EmitCode): New function, will emit the code for a
19260 Block of code given a TypeContainer and its ILGenerator.
19262 * statement.cs (Block): Standard public readonly optimization.
19263 (Block::Block constructors): Link children.
19264 (Block::Child): Child Linker.
19265 (Block::EmitVariables): Emits IL variable declarations.
19267 * class.cs: Drop support for MethodGroups here, delay until
19269 (Method::): Applied the same simplification that I did before, and
19270 move from Properties to public readonly fields.
19271 (Method::ParameterTypes): Returns the parameter types for the
19272 function, and implements a cache that will be useful later when I
19273 do error checking and the semantic analysis on the methods is
19275 (Constructor::GetCallingConvention): Renamed from CallingConvetion
19276 and made a method, optional argument tells whether this is a class
19277 or a structure to apply the `has-this' bit.
19278 (Method::GetCallingConvention): Implement, returns the calling
19280 (Method::Define): Defines the type, a second pass is performed
19281 later to populate the methods.
19283 (Constructor::ParameterTypes): implement a cache similar to the
19284 one on Method::ParameterTypes, useful later when we do semantic
19287 (TypeContainer::EmitMethod): New method. Emits methods.
19289 * expression.cs: Removed MethodGroup class from here.
19291 * parameter.cs (Parameters::GetCallingConvention): new method.
19293 2001-08-21 Miguel de Icaza <miguel@ximian.com>
19295 * class.cs (TypeContainer::Populate): Drop RootContext from the
19298 (Constructor::CallingConvention): Returns the calling convention.
19299 (Constructor::ParameterTypes): Returns the constructor parameter
19302 (TypeContainer::AddConstructor): Keep track of default constructor
19303 and the default static constructor.
19305 (Constructor::) Another class that starts using `public readonly'
19306 instead of properties.
19308 (Constructor::IsDefault): Whether this is a default constructor.
19310 (Field::) use readonly public fields instead of properties also.
19312 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
19313 track of static constructors; If none is used, turn on
19314 BeforeFieldInit in the TypeAttributes.
19316 * cs-parser.jay (opt_argument_list): now the return can be null
19317 for the cases where there are no arguments.
19319 (constructor_declarator): If there is no implicit `base' or
19320 `this', then invoke the default parent constructor.
19322 * modifiers.cs (MethodAttr): New static function maps a set of
19323 modifiers flags into a MethodAttributes enum
19324 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
19325 MethodAttr, TypeAttr to represent the various mappings where the
19326 modifiers are used.
19327 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
19329 2001-08-19 Miguel de Icaza <miguel@ximian.com>
19331 * parameter.cs (GetParameterInfo): Fix bug where there would be no
19334 * interface.cs (PopulateIndexer): Implemented the code generator
19335 for interface indexers.
19337 2001-08-17 Miguel de Icaza <miguel@ximian.com>
19339 * interface.cs (InterfaceMemberBase): Now we track the new status
19342 (PopulateProperty): Implement property population. Woohoo! Got
19343 Methods and Properties going today.
19345 Removed all the properties for interfaces, and replaced them with
19346 `public readonly' fields.
19348 2001-08-16 Miguel de Icaza <miguel@ximian.com>
19350 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
19351 initialize their hashtables/arraylists only when they are needed
19352 instead of doing this always.
19354 * parameter.cs: Handle refs and out parameters.
19356 * cs-parser.jay: Use an ArrayList to construct the arguments
19357 instead of the ParameterCollection, and then cast that to a
19360 * parameter.cs: Drop the use of ParameterCollection and use
19361 instead arrays of Parameters.
19363 (GetParameterInfo): Use the Type, not the Name when resolving
19366 2001-08-13 Miguel de Icaza <miguel@ximian.com>
19368 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
19369 and instead use public readonly fields.
19371 * class.cs: Put back walking code for type containers.
19373 2001-08-11 Miguel de Icaza <miguel@ximian.com>
19375 * class.cs (MakeConstant): Code to define constants.
19377 * rootcontext.cs (LookupType): New function. Used to locate types
19380 2001-08-08 Miguel de Icaza <miguel@ximian.com>
19382 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
19383 this System.Reflection code is. Kudos to Microsoft
19385 * typemanager.cs: Implement a type cache and avoid loading all
19386 types at boot time. Wrap in LookupType the internals. This made
19387 the compiler so much faster. Wow. I rule!
19389 * driver.cs: Make sure we always load mscorlib first (for
19390 debugging purposes, nothing really important).
19392 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
19393 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
19395 * rootcontext.cs: Lookup types on their namespace; Lookup types
19396 on namespaces that have been imported using the `using' keyword.
19398 * class.cs (TypeContainer::TypeAttr): Virtualize.
19399 (Class::TypeAttr): Return attributes suitable for this bad boy.
19400 (Struct::TypeAttr): ditto.
19401 Handle nested classes.
19402 (TypeContainer::) Remove all the type visiting code, it is now
19403 replaced with the rootcontext.cs code
19405 * rootcontext.cs (GetClassBases): Added support for structs.
19407 2001-08-06 Miguel de Icaza <miguel@ximian.com>
19409 * interface.cs, statement.cs, class.cs, parameter.cs,
19410 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
19411 Drop use of TypeRefs, and use strings instead.
19413 2001-08-04 Miguel de Icaza <miguel@ximian.com>
19417 * class.cs (Struct::Struct): set the SEALED flags after
19418 checking the modifiers.
19419 (TypeContainer::TypeAttr): new property, returns the
19420 TypeAttributes for a class.
19422 * cs-parser.jay (type_list): Oops, list production was creating a
19423 new list of base types.
19425 * rootcontext.cs (StdLib): New property.
19426 (GetInterfaceTypeByName): returns an interface by type name, and
19427 encapsulates error handling here.
19428 (GetInterfaces): simplified.
19429 (ResolveTree): Encapsulated all the tree resolution here.
19430 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
19433 * driver.cs: Add support for --nostdlib, to avoid loading the
19434 default assemblies.
19435 (Main): Do not put tree resolution here.
19437 * rootcontext.cs: Beginning of the class resolution.
19439 2001-08-03 Miguel de Icaza <miguel@ximian.com>
19441 * rootcontext.cs: Provide better error reporting.
19443 * cs-parser.jay (interface_base): set our $$ to be interfaces.
19445 * rootcontext.cs (CreateInterface): Handle the case where there
19446 are no parent interfaces.
19448 (CloseTypes): Routine to flush types at the end.
19449 (CreateInterface): Track types.
19450 (GetInterfaces): Returns an array of Types from the list of
19451 defined interfaces.
19453 * typemanager.c (AddUserType): Mechanism to track user types (puts
19454 the type on the global type hash, and allows us to close it at the
19457 2001-08-02 Miguel de Icaza <miguel@ximian.com>
19459 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
19460 RecordInterface instead.
19462 * cs-parser.jay: Updated to reflect changes above.
19464 * decl.cs (Definition): Keep track of the TypeBuilder type that
19465 represents this type here. Not sure we will use it in the long
19466 run, but wont hurt for now.
19468 * driver.cs: Smaller changes to accomodate the new code.
19470 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
19473 * rootcontext.cs (CreateInterface): New method, used to create
19474 the System.TypeBuilder type for interfaces.
19475 (ResolveInterfaces): new entry point to resolve the interface
19477 (CodeGen): Property, used to keep track of the code generator.
19479 2001-07-26 Miguel de Icaza <miguel@ximian.com>
19481 * cs-parser.jay: Add a second production for delegate_declaration
19484 (enum_body): Put an opt_comma here instead of putting it on
19485 enum_body or enum_member_declarations so we can handle trailing
19486 commas on enumeration members. Gets rid of a shift/reduce.
19488 (type_list): Need a COMMA in the middle.
19490 (indexer_declaration): Tell tokenizer to recognize get/set
19492 * Remove old targets.
19494 * Re-add the parser target.
19496 2001-07-13 Simon Cozens <simon@simon-cozens.org>
19498 * cs-parser.jay: Add precendence rules for a number of operators
19499 ot reduce the number of shift/reduce conflicts in the grammar.
19501 2001-07-17 Miguel de Icaza <miguel@ximian.com>
19503 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
19506 Get rid of old crufty code.
19508 * rootcontext.cs: Use this to keep track of the parsed
19509 representation and the defined types available to the program.
19511 * gen-treedump.cs: adjust for new convention.
19513 * type.cs: Split out the type manager, and the assembly builder
19516 * typemanager.cs: the type manager will live here now.
19518 * cil-codegen.cs: And the code generator here.
19520 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
19522 * makefile: Fixed up for easy making.
19524 2001-07-13 Simon Cozens <simon@simon-cozens.org>
19526 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
19529 (unary_expression): Expand pre_increment_expression and
19530 post_decrement_expression to reduce a shift/reduce.
19532 2001-07-11 Simon Cozens
19534 * cs-tokenizer.cs: Hex numbers should begin with a 0.
19536 Improve allow_keyword_as_indent name.
19538 2001-06-19 Miguel de Icaza <miguel@ximian.com>
19540 * Adjustments for Beta2.
19542 2001-06-13 Miguel de Icaza <miguel@ximian.com>
19544 * decl.cs: Added `Define' abstract method.
19545 (InTransit): new property, used to catch recursive definitions.
19547 * interface.cs: Implement `Define'.
19549 * modifiers.cs: Map Modifiers.constants to
19550 System.Reflection.TypeAttribute flags.
19552 * class.cs: Keep track of types and user-defined types.
19553 (BuilderInit): New method for creating an assembly
19554 (ResolveType): New function to launch the resolution process, only
19555 used by interfaces for now.
19557 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
19558 that are inserted into the name space.
19560 2001-06-08 Miguel de Icaza <miguel@ximian.com>
19562 * ARGH. I have screwed up my tree so many times due to the use of
19563 rsync rather than using CVS. Going to fix this at once.
19565 * driver.cs: Objetify driver. Load assemblies, use assemblies to
19568 2001-06-07 Miguel de Icaza <miguel@ximian.com>
19570 * Experiment successful: Use System.Type rather that our own
19573 2001-05-25 Miguel de Icaza <miguel@ximian.com>
19575 * cs-parser.jay: Removed nsAliases from here.
19577 Use new namespaces, handle `using XXX;'
19579 * namespace.cs: Reimplemented namespace handling, use a recursive
19580 definition of the class. Now we can keep track of using clauses
19581 and catch invalid using clauses.
19583 2001-05-24 Miguel de Icaza <miguel@ximian.com>
19585 * gen-treedump.cs: Adapted for all the renaming.
19587 * expression.cs (Expression): this class now has a Type property
19588 which returns an expression Type.
19590 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
19591 `Type', as this has a different meaning now in the base
19593 2001-05-22 Miguel de Icaza <miguel@ximian.com>
19595 * interface.cs, class.cs: Removed from all the sources the
19596 references to signature computation, as we can not do method
19597 signature computation during the parsing time, as we are not
19598 trying to solve at that point distinguishing:
19602 void a (NS.Blah x) {}
19605 Which depending on the context might be valid or not, as we do not
19606 know if Blah is the same thing as NS.Blah at that point.
19608 * Redid everything so the code uses TypeRefs now instead of
19609 Types. TypeRefs are just temporary type placeholders, that need
19610 to be resolved. They initially have a pointer to a string and the
19611 current scope in which they are used. This is used later by the
19612 compiler to resolve the reference to an actual Type.
19614 * DeclSpace is no longer a CIR.Type, and neither are
19615 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
19616 are all DeclSpaces, but no Types.
19618 * type.cs (TypeRefManager): This implements the TypeRef manager,
19619 which keeps track of all the types that need to be resolved after
19620 the parsing has finished.
19622 2001-05-13 Miguel de Icaza <miguel@ximian.com>
19624 * ARGH. We are going to have to store `foreach' as a class rather
19625 than resolving it, as we need to verify error 1579 after name
19626 resolution. *OR* we could keep a flag that says `This request to
19627 IEnumerator comes from a foreach statement' which we can then use
19628 to generate the error.
19630 2001-05-10 Miguel de Icaza <miguel@ximian.com>
19632 * class.cs (TypeContainer.AddMethod): we now add methods to the
19633 MethodGroup instead of the method hashtable.
19635 * expression.cs: Add MethodGroup abstraction, which gets us one
19636 step closer to the specification in the way we handle method
19639 * cs-parser.jay (primary_expression): qualified_identifier now
19640 tried to match up an identifier to a local variable reference or
19641 to a parameter reference.
19643 current_local_parameters is now a parser global variable that
19644 points to the current parameters for the block, used during name
19647 (property_declaration): Now creates an implicit `value' argument to
19650 2001-05-09 Miguel de Icaza <miguel@ximian.com>
19652 * parameter.cs: Do not use `param' arguments as part of the
19653 signature, per the spec.
19655 2001-05-08 Miguel de Icaza <miguel@ximian.com>
19657 * decl.cs: Base class for classes, structs and interfaces. This
19658 is the "Declaration Space"
19660 * cs-parser.jay: Use CheckDef for checking declaration errors
19661 instead of having one on each function.
19663 * class.cs: Factor out some code for handling error handling in
19664 accordance to the "Declarations" section in the "Basic Concepts"
19665 chapter in the ECMA C# spec.
19667 * interface.cs: Make all interface member classes derive from
19668 InterfaceMemberBase.
19670 2001-05-07 Miguel de Icaza <miguel@ximian.com>
19672 * Many things: all interfaces are parsed and generated in
19673 gen-treedump. Support for member variables, constructors,
19674 destructors, properties, constants is there.
19676 Beginning of the IL backend, but very little done, just there for
19679 2001-04-29 Miguel de Icaza <miguel@ximian.com>
19681 * cs-parser.jay: Fix labeled statement.
19683 * cs-tokenizer.cs (escape): Escape " and ' always.
19684 ref_line, ref_name: keep track of the line/filename as instructed
19685 by #line by the compiler.
19688 2001-04-27 Miguel de Icaza <miguel@ximian.com>
19690 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
19691 to match the values in System.CodeDOM.
19693 Divid renamed to Divide.
19695 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
19697 (Statements.set): remove.
19699 * System.CodeDOM/CodeCatchClause.cs: always have a valid
19702 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
19703 falseStatements always have valid values.
19705 * cs-parser.jay: Use System.CodeDOM now.