1 2005-05-06 Martin Baulig <martin@ximian.com>
4 (Attributable.IsClsComplianceRequired): Fix typo in the method name.
5 (AttributeTester.AnalyzeTypeCompliance): Add generics support.
7 2005-05-04 Martin Baulig <martin@ximian.com>
9 * ecore.cs (FieldExpr.DoResolveLValue): Always call fb.SetAssigned().
11 2005-05-04 Martin Baulig <martin@ximian.com>
15 * statement.cs (Switch.SimpleSwitchEmit): Always emit the default
16 section at the end; make things work if `default' is not the last
19 2005-05-04 Martin Baulig <martin@ximian.com>
23 * statement.cs (Switch): Replaced the `got_default' field with a
24 `default_section' one.
25 (Switch.CheckSwitch): Set `default_section' here.
26 (Switch.Resolve): If we're a constant switch and the constant is
27 not found, use the default section.
29 2005-05-03 Martin Baulig <martin@ximian.com>
31 * expression.cs (ArrayAccess.EmitGetLength): New public method.
33 * statement.cs (Foreach.ArrayForeach): New nested class.
34 (Foreach.TemporaryVariable): New nested class.
35 (Foreach.EmitArrayForeach): Removed; this is now in the new
38 2005-05-02 Martin Baulig <martin@ximian.com>
42 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
43 Also `And' the locals if the old vector is null.
44 (FlowBranching.UsageVector.BitVector.And): Allow `vector' being
45 null; in this case we basically reset all the variables.
47 2005-05-02 Martin Baulig <martin@ximian.com>
51 * flowanalysis.cs (FlowBranching.UsageVector.MergeBreakOrigins):
52 Added `FlowBranching branching' argument; always `and' the
53 variables instead of `or'ing them unless we're an infinite loop.
55 * statement.cs (While.Resolve): Create a new sibling unless we're
58 2005-05-02 Martin Baulig <martin@ximian.com>
62 * class.cs (ConstructorInitializer.Resolve): Added `Block block'
63 arguments; use it instead of creating a new TopLevelBlock.
64 (Constructor.Emit): Call `block.ResolveMeta ()' before resolving
65 our ConstructorInitializer.
68 (TopLevelBlock.TopLevelBranching): New public property.
69 (TopLevelBlock.ResolveMeta): New public method; call ResolveMeta()
70 and create our `TopLevelBranching'.
72 * codegen.cs (EmitContext.ResolveTopBlock): If we're not an
73 anonymous method host, use `block.TopLevelBranching' rather than
74 creating a new branching.
76 2005-04-20 Miguel de Icaza <miguel@novell.com>
78 * anonymous.cs (ScopeInfo.AddChild): when adding a new child to
79 a ScopeInfo, if any of the current children is a child of the new
80 entry, move those children there.
82 2005-04-30 Martin Baulig <martin@ximian.com>
84 * statement.cs (Switch.SimpleSwitchEmit): Reset `default_at_end'
85 at the beginning of a SwitchSection. Fix #73335.
87 2005-04-27 Marek Safar <marek.safar@seznam.cz>
90 * class.cs (EmitFieldInitializers): Use FieldExpr in initializer.
92 * ecore.cs (FieldExpr): Add a new ctor with in_initializer.
93 (FieldExpr.DoResolve): Obsolete members are ignored for field
96 2005-04-26 Marek Safar <marek.safar@seznam.cz>
98 * attribute.cs (AreOverloadedMethodParamsClsCompliant): Add array
101 * class.cs (Interface.VerifyClsCompliance): Add base interfaces
103 (Field.VerifyClsCompliance): Volatile fields are not compliant.
105 * decl.cs (MemberCache.VerifyClsParameterConflict): Add array of
108 2005-04-25 Ben Maurer <bmaurer@ximian.com>
110 * cs-parser.jay: Use the prefered version of -unsafe in error
113 2005-04-22 Marek Safar <marek.safar@seznam.cz>
115 * driver.cs (CompilerCallableEntryPoint.Invoke): Reset under any
118 2005-04-20 John Luke <john.luke@gmail.com>
120 * driver.cs: fix typo in error message, --outout to --output
122 2005-04-30 Martin Baulig <martin@ximian.com>
124 * attribute.cs (Attribute.CheckSecurityActionValidity): Correctly
125 handle the .NET 2.x security attributes.
127 2005-04-30 Martin Baulig <martin@ximian.com>
130 (TypeManager.ExpandInterfaces): Don't add things twice.
133 (TypeContainer.VerifyClsCompliance): Allow generic instances.
135 2005-04-29 Martin Baulig <martin@ximian.com>
137 * generic.cs (Constraints.ResolveTypes): Expand interfaces.
139 * anonymous.cs: Added support for anonymous generic methods.
141 2005-04-29 Martin Baulig <martin@ximian.com>
143 * typemanager.cs (TypeManager.GetInterfaces): Correctly handle
146 2005-04-29 Martin Baulig <martin@ximian.com>
148 * generic.cs (TypeManager.HasConstructorConstraint): Removed.
150 * expression.cs (New.DoResolve): Fix the CS0304 check.
152 2005-04-29 Martin Baulig <martin@ximian.com>
154 * typemanager.cs (TypeManager.GetFullName): Updated to the new
157 * class.cs (MethodCore.IsDuplicateImplementation): If we're an
158 explicit interface implementation, compare the interface types.
159 (MethodData.Define): Use the new naming scheme from the latest
161 (MemberBase.DoDefineBase): Resolve `InterfaceType' here.
163 * decl.cs (MemberName.GetMemberName): Removed.
164 (MemberName.MethodName, FullName): New properties.
166 2005-04-25 Raja R Harinath <rharinath@novell.com>
168 * gmcs.exe.config: Update v2.0.40607 -> v2.0.50215.
170 2005-04-22 Martin Baulig <martin@ximian.com>
172 * generic.cs (GenericMethod): Create the EmitContext in the
173 `Define()'; in `Define(MethodBuilder)', create the type parameters
174 before calling `Define()'. Fixes #73933.
176 2005-04-22 Martin Baulig <martin@ximian.com>
179 (Constraints.Resolve): Make things work wrt. the new type lookup system.
180 (ConstructedType.ResolveAsTypeTerminal): Don't override this.
182 * ecore.cs (Expression.ResolveAsTypeTerminal): If `te' is a
183 ConstructedType, check its constraints.
185 2005-04-20 Marek Safar <marek.safar@seznam.cz>
187 * codegen.cs (InRefOutArgumentResolving): New field.
189 * ecore.cs (FieldExpr.DoResolve): Check for assigning to readonly
190 fields outside contructor.
192 * expression.cs (Argument.Resolve): Set InRefOutArgumentResolving.
194 2005-04-19 Miguel de Icaza <miguel@novell.com>
196 * anonymous.cs (CaptureContext.EmitParameterInstance): The
197 parameter code was not completed ever, so it was not as up-to-date
198 as local variables. Must finish it.
200 The bug fix was to compare the Toplevel of the block, not the
201 current block. Thanks for Ben for pointing this out.
203 2005-04-19 Raja R Harinath <rharinath@novell.com>
205 * decl.cs (AddMethods): Use the declaring type of the problem
206 method to determine if we want to squash a warning.
208 2005-04-19 Marek Safar <marek.safar@seznam.cz>
210 * attribute.cs: Removed debug output.
212 * decl.cs (MemberCache.AddMethods): Fixed Finalize ignoring.
214 * driver.cs (Driver.parse): Synchronize parser ErrorOutput with
217 2005-04-18 Marek Safar <marek.safar@seznam.cz>
220 * class.cs (TypeContainer.CircularDepException) New nested
222 (GetPartialBases, GetNormalBases, GetClassBases): Removed error.
223 (TypeContainer.DefineType): Removed error, reset InTransit before
225 (Class.DefineType): Throw exception when is in Transit.
226 Catch exception and report error.
227 (Struct.DefineType): Throw exception when is in Transit.
228 Catch exception and report error.
229 (Interface.DefineType): Throw exception when is in Transit.
230 Catch exception and report error.
232 * codegen.cs: Add InCatch,InFinally to EmitContext to easily
233 handle nested exception handlers.
235 * flowanalysis.cs (InTryWithCatch): New method, search for try with
238 * iterators.cs (Yield.CheckContext): Add CS1626 report. Updated
239 InFinally and InCatch storage.
241 * statement.cs (Throw.Resolve): Use InCatch, InFinally from ec.
242 (Catch.Resolve): Set and Restore ec.InCatch.
243 (Try.Resolve): Set and Restore ec.InFinally.
244 (Try.HasCatch): True when try has catch.
246 2005-04-17 Atsushi Enomoto <atsushi@ximian.com>
248 * doc.cs : In some cases FilterName returns MonoEvent and MonoField
249 for the same event member, so exclude such cases from warning 419.
252 2005-04-16 Miguel de Icaza <miguel@novell.com>
254 * expression.cs (Binary.ResolveOperator): Apply patch from John
255 Luke to fix bug 59864: operators &, | and ^ on enumerations
256 require that the same enum type on both sides.
258 * driver.cs: Add warnings to old flag usage, this is to assist
259 people who produce Makefiles and hope that the Makefiles will be
262 * class.cs (TypeContainer.EmitType): Moved the definition of the
263 special $PRIVATE$ field from the resolve phase to the Emit phase.
264 During resolve we do not know if we are a struct with
265 HasExplicitLayout, we know this only after the attributes for the
268 Set the FieldOffset to zero on the dummy field that we create for
269 the class. Fixes 74590.
271 2005-04-16 Raja R Harinath <rharinath@novell.com>
274 * ecore.cs (PropertyExpr.resolved): New.
275 (DoResolve): Use it to handle a case of double resolution here.
276 Handle a case of identical-name-and-type-name.
277 * expression.cs (ArrayCreation.CheckIndices): Avoid double
278 resolution by storing the results of expression resolution back
279 into the "probes" array.
281 2005-04-15 Raja R Harinath <rharinath@novell.com>
283 Fix cs0208-7.cs and cs0208-8.cs.
284 * typemanager.cs (IsUnmanagedType): Arrays are not allowed
285 (cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve
286 error reporting to point out the reason a struct is not unmanaged.
288 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
290 * doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and
291 just use TypeExpr.Type. This fixes bug #74595 when merged to gmcs.
293 2005-04-13 Raja R Harinath <rharinath@novell.com>
296 * ecore.cs (PropertyExpr.InstanceResolve): Handle a case of
297 IdenticalNameAndTypeName here.
298 (EventExpr.InstanceResolve): Likewise.
300 2005-04-13 Marek Safar <marek.safar@seznam.cz>
302 C# 2.0 DefaultCharSetAttribute implementation
304 * attribute.cs (Attribute.ResolveAsTypeStep): New protected method
305 which allows us to set GlobalNamespace for every resolve.
306 (Attribute.ResolveArguments): Cut from Resolve.
307 (Attribute.GetCharSetValue): Returns CharSet named argument.
308 (Attribute.DefinePInvokeMethod): Gets default charset from
310 (GlobalAttribute.ResolveAsTypeStep): Override.
311 (GlobalAttribute.ResolveArguments): Override.
313 * class.cs (TypeAttr): Is protected.
315 * codegen.cs (ModuleClass.DefaultCharSet): New member.
316 (ModuleClass.DefaultCharSetType): New memeber.
317 (ModuleClass.ResolveAttributes): Resolves DefaultCharSetAttribute.
319 * decl.cs (Decl.TypeAttr): New protected virtual. Returns default
322 * delegate.cs (TypeAttr): Override.
323 (Delegate.DefineType): Use this TypeAttr.
325 * driver.cs (Driver.MainDriver): Call Module.ResolveAttributes
326 at very early stage (before types are defined) to resolve model
327 module attributes. It will probably not work with corlib but it
330 * enum.cs (Enum.TypeAttr): New protected virtual. Returns default
333 * typemanager.cs (default_charset_type): New type.
335 2005-04-13 Raja R Harinath <rharinath@novell.com>
337 * decl.cs (MemberCache.AddMethods): Don't warn if
338 System.Object.Finalize has buggy MethodAttributes.
340 * typemanager.cs (IsUnmanagedType): Restore !IsValueType check
343 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
345 * doc.cs : detect ambiguous reference to overloaded members.
346 Fixed bug #71603. MS 1.1 csc does not detect it.
348 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
350 * doc.cs : delegates must not be referenced with parameters.
353 2005-04-12 Miguel de Icaza <miguel@novell.com>
355 * typemanager.cs (IsUnmanagedType): Arrays are allowed.
357 2005-04-10 Miguel de Icaza <miguel@novell.com>
359 * driver.cs (MainDriver): Stop processing if the CLS stage found
362 (CompilerCallableEntryPoint.InvokeCompiler): Always
363 reset after execution; Take a TextWriter argument for the
366 * report.cs: Use the error stream instead of hardcoding stderr.
368 2005-04-09 Miguel de Icaza <miguel@novell.com>
370 * class.cs: Reduce code paths to test, too small of an
371 optimization to make it worth the extra testing. Always perform
374 2005-04-08 Raja R Harinath <rharinath@novell.com>
377 * class.cs (OperatorArrayList.CheckPairedOperators): Skip
378 operators that had errors reported on them.
380 2005-04-08 Marek Safar <marek.safar@seznam.cz>
382 * attribute.cs (Attribute.IsValidArgumentType): Test valid named
384 (Attribute.Resolve): Add named argument type checking.
386 * class.cs (FixedField.Define): Use IsPrimitiveType
388 * expression.cs (Binary.ResolveOperator): Reflect IsCLRType renaming.
390 * iterators.cs (Iterator.DefineIterator): Add check for arglist and
391 unsafe parameter types.
393 * statement.cs (Using.ResolveExpression): Add better error description.
395 * typemanager.cs (IsCLRType): Renamed to IsPrimitiveType.
397 2005-04-08 Raja R Harinath <rharinath@novell.com>
400 * attribute.cs (Attribute.GetAttributeUsage): Resolve
401 AttributeUsageAttribute in the emitcontext of the attribute class,
402 not in the emitcontext of the attributable entity it was attached to.
403 * cs-parser.jay: Use 'current_class', not 'current_container',
404 when creating a GlobalAttribute.
406 2005-04-08 Alp Toker <alp@atoker.com>
408 * pending.cs: The fix to #58413 failed to compile methods implementing
409 interfaces with/without params modifiers and vice versa, even though
410 params modifiers aren't part of the signature. Make the modifier check
411 less strict as in csc.
413 2005-04-07 Abin Thomas <projectmonokochi@rediffmail.com>
414 Anoob V E <projectmonokochi@rediffmail.com>
415 Harilal P R <projectmonokochi@rediffmail.com>
418 * pending.cs (TypeAndMethods.mods): New. Store the parameter
419 modifiers of pending methods.
420 (PendingImplementation.PendingImplementation): Initialize it.
421 Add Parameter.Modifier [][] mods and initialize it with ParameterData.
422 (PendingImplementation.InterFaceMethod): Repalce Type[] argument
423 with ParameterData. Add check for modifiers.
424 * class.cs (MethodData.Define): Update to changes.
426 2005-04-07 Raja R Harinath <rharinath@novell.com>
428 * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat.
430 2005-04-07 Marek Safar <marek.safar@seznam.cz>
432 * class.cs (PropertyMethod.Define): Check private accessor in abstract
435 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't allow RequiredAttribute
438 * typemanager.cs: Registered RequiredAttributeAttribute.
440 2005-04-06 Marek Safar <marek.safar@seznam.cz>
442 * class.cs (VerifyMembers): Doesn't need EmitContext argument.
443 Warning CS0169 is back at level 3.
444 (IMethodData.SetMemberIsUsed): New method.
446 * decl.cs (IsUsed): New value; moved from FieldBase.Status
447 (SetMemberIsUsed, IsUsed): New methods, encapsulate IsUsed.
449 * delegate.cs (ResolveMethodGroupExpr): Call SetMemberIsUsed.
451 * ecore.cs (FieldExpr.ResolveMemberAccess): Call SetMemberIsUsed for
453 (PropertyExpr.ResolveAccessors): Call SetMemberIsUsed when delegate
456 * expression.cs (OverloadResolve): Call SetMemberIsUsed. when method
459 * rootcontext.cs (RootContext.EmitCode): Call VerifyMembers in extra run
460 to avoid the problems with nested types.
462 2005-04-05 Abin Thomas <projectmonokochi@rediffmail.com>
463 Anoob V.E <projectmonokochi@rediffmail.com>
464 Harilal P.R <projectmonokochi@rediffmail.com>
465 Raja R Harinath <rharinath@novell.com>
468 * delegate.cs (Define): Emit ParamArrayAttribute for 'params'
470 * typemanager (GetConstructor): Make public.
472 2005-04-05 John Luke <john.luke@gmail.com>
473 Raja R Harinath <rharinath@novell.com>
476 * typemanager.cs (IsUnmanagedType): Check non-public fields of a
477 struct too. Return false quicker in a few cases.
478 (VerifyUnManaged): Use it.
480 2005-04-05 Raja R Harinath <rharinath@novell.com>
483 * statement.cs (Block.Resolve): Initialize 'unreachable' to false,
484 not 'unreachable_seen'.
486 2005-04-04 Marek Safar <marek.safar@seznam.cz>
488 * attribute.cs (Attribute.GetValue): Removed unused.
490 * codegen.cs (CodeGen.TrimExt): Removed unused.
492 * cs-parser.jay (output): Removed unused.
494 * cs-tokenizer.cs (hex_digits): Removed unused.
496 * enum.cs (MapToInternalType, GetEnumeratorName): Removed unused.
498 * expression.cs (Indirection.LoadExprValue): Removed unused.
499 (ArrayCreation.ExpressionToArrayArgument): Removed unused.
501 * iterators.cs (Iterator.param_types): Removed unused.
503 * statement.cs (Goto.block): Removed unused.
504 (ToplevelBlock.did): Removed unused.
505 (Switch.ResolveConstantSwitch): Removed unused.
507 2005-04-01 Ben Maurer <bmaurer@ximian.com>
509 * rootcontext.cs: Allow mcs to bootstrap with the compilation
512 2005-04-19 Martin Baulig <martin@ximian.com>
514 Merged r42462 from MCS and made it work for GMCS.
516 * class.cs (MethodCore.ds): Moved this field to `MemberBase'.
518 * generic.cs (GenericMethod.Define): Removed `return_type' argument.
520 2005-04-01 Raja R Harinath <rharinath@novell.com>
522 Fix #74232 and cs0208-3.cs.
523 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0208 check.
524 * typemanager.cs (IsUnmanagedType): Don't allow 'object' as an
525 unmanaged type. Don't use FieldBuilders when 't' is a
526 TypeBuilder. Use ModFlags and MemberType fields.
527 * class.cs (MemberBase.member_type): Rename from MemberType.
528 (MemberBase.MemberType): New property. Determines member_type on
530 (MemberBase.DoDefine): Don't initialize MemberType here.
531 (FieldMember.Define): Likewise.
533 2005-04-01 Marek Safar <marek.safar@seznam.cz>
536 * class.cs (Event.Emit): Call Add/Remove emit even for interfaces.
537 Attributes are emitted there.
539 2005-04-01 Raja R Harinath <rharinath@novell.com>
541 * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
542 keyword in 'partial enum' too.
543 * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
545 Report from Kamil Skalski <nazgul@omega.pl>.
548 * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
549 have partial containers too.
551 * ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning
552 in block' checks to Block.CheckInvariantMeaningInBlock.
553 * statement.cs (Block.GetKnownVariableInfo): Make private.
554 (Block.IsVariableUsedInChildBlock): Remove.
555 (Block.IsVariableUsedInBlock): Likewise.
556 (Block.CheckInvariantMeaningInBlock): New. Show location of
557 conflicting declaration.
558 (Block.AddVariable): Make error messages less long-winded and more
559 specific. Show location of conflicting declaration.
560 * parameter.cs (Parameters.Location): New readonly property.
562 2005-03-31 Raja R Harinath <rharinath@novell.com>
564 Clean up semantics of invoking ResolveMemberAccess.
565 * ecore.cs (SimpleName.DoSimpleNameResolve): If a MemberExpression
566 can have an instance, ensure that we pass in a non-TypeExpression
567 to ResolveMemberAccess. Tighten up IdenticalNameAndTypeName checks.
568 (MemberExpr.DoSimpleNameResolve): Remove type_is_inferred
569 argument. Update to changes and simplify.
570 (FieldExpr.Emitinstance): Remove CS0120 check.
571 (PropertyExpr.EmitInstance): Likewise.
572 * expression.cs (Argument.Resolve): Likewise.
573 (Invocation.DoResolve): Update to changes in semantics of
576 2005-03-31 Marek Safar <marek.safar@seznam.cz>
579 * class.cs (AbstractPropertyEventMethod.EmitMethod): Enable emit method
582 * decl.cs (MemberCache.AddMethods): Fix infinite loop.
584 2005-03-31 Raja R Harinath <rharinath@novell.com>
586 Fix difference in behaviour with commandline invocation.
587 * driver.cs (Driver.Reset): New.
588 (CompilerCallableEntryPoint): Call it.
590 * statement.cs (If.Resolve): Avoid spurious "uninitialized
591 variable" warnings if the boolean expression failed to resolve.
593 2005-03-30 Sebastien Pouliot <sebastien@ximian.com>
595 * attribute.cs: Fix the union of several permissions when some of them
596 are unrestricted (so the result isn't an unrestricted permission set).
599 2005-03-30 Raja R Harinath <rharinath@novell.com>
601 * ecore.cs (MemberExpr): New class. Convert from interface
603 (MemberExpr.ResolveMemberAccess): Refactor and move here from
604 MemberAccess.ResolveMemberAccess. Tighten up pre-conditions and
606 (MethodGroupExpr, FieldExpr, PropertyExpr, EventExpr): Update.
607 (MethodGroupExpr.IsExplicitImpl): Remove.
608 (Expression.GetFieldFromEvent): Remove.
609 (SimpleName.MemberStaticCheck): Remove.
610 (SimpleName.DoSimpleNameResolve): Update to changes.
611 * expression.cs (MemberAccess.ResolveMemberAccess): Refactor.
612 (MemberAccess.IdenticalNameAndTypeName): Remove.
613 (MemberAccess.error176): Move to MemberExpr.
614 (MemberAccess.DoResolve): Update to changes.
615 (BaseAccess.DoResolve): Likewise.
617 2005-03-30 Marek Safar <marek.safar@seznam.cz>
619 C# 2.0 Conditional attribute class implementation
621 * attribute.cs (AttributeTester.IsAttributeExcluded): New method.
622 Analyzes class whether it has attribute which has ConditionalAttribute
623 and its condition is not defined.
625 * class.cs (Class.ApplyAttributeBuilder): Add IsAttributeExcluded check.
626 (Class.IsExcluded): New method. Search for at least one defined
627 condition in ConditionalAttribute of attribute class.
629 2005-03-30 Raja R Harinath <rharinath@novell.com>
631 * ecore.cs (PropertyExpr): Derive from Expression, not
633 (PropertyExpr.EmitStatement): Remove.
635 2005-03-29 Raja R Harinath <rharinath@novell.com>
638 * expression.cs (MemberAccess.ResolveMemberAccess): Allow the
639 internal field "value__" of an enum be private. The examples for
640 "value__" that I found on MSDN all used FieldAttributes.Private.
642 * decl.cs (MemberCache.AddMethods): Use C# terminology in warning.
643 Don't mention IL method attribute names.
645 Fix #47991. Remove a TODO.
646 * statement.cs (Block.Toplevel): Make into a field.
647 (Block.Parameters): Move into ToplevelBlock.
648 (Block.known_variables): Rename from child_variable_names.
649 (Block.Block): Remove variants that take Parameters. Initialize
650 'Toplevel' with the immediately surrounding toplevel block.
651 (Block.AddKnownVariable): Rename from AddChildVariableName. Add a
653 (Block.GetKnownVariableInfo): New.
654 (Block.IsVariableNameUsedInChildBlock): Update.
655 (Block.IsVariableNameUsedInBlock): New. Checks if a name is used in
656 the block, even though it may not be in scope.
657 (Block.AddVariable): Remove Parameters parameter. Use
658 Toplevel.Parameters instead.
659 (Block.AddConstant): Remove Parameters parameter.
660 (Block.GetParameterReference): Update to use Toplevel.Parameters.
661 (Block.IsParamaterReference): Likewise.
662 (Block.IsLocalParameter): Likewise. Simplify a lot.
663 (ToplevelBlock.Parameters): New. Moved from Block.
664 (ToplevelBlock.ToplevelBlock): Update to changes. Always
665 initialize Parameters to a non-null value.
666 * cs-parser.jay: Update to changes.
667 * ecore.cs (SimpleName.SimpleNameResolve): Emit cs0136 error for
668 simple names that mean different things in the same block. Use
669 Block.IsVariableNameUsedInBlock.
671 2005-03-28 Raja R Harinath <rharinath@novell.com>
673 * enum.cs (Enum.LookupEnumValue): Remove debugging code.
675 2005-03-26 Raja R Harinath <harinath@acm.org>
678 * assign.cs (Assign.DoResolve): When the RHS of an assignment
679 fails to resolve, ensure that the LHS is still resolved as an
682 2005-03-25 Raja R Harinath <harinath@acm.org>
684 * enum.cs (Enum.DefineType): Set ec.InEnumContext and
686 (Enum.current_ec): Remove.
687 (Enum.LookupEnumValue): Remove EmitContext argument.
688 Just uses the one created during DefineType.
689 (Enum.FindMembers): Update.
690 * expression.cs (MemberAccess.DoResolve): Update.
692 2005-03-22 Marek Safar <marek.safar@seznam.cz>
694 * assign.cs (Assign.DoResolve): Check for CS1717 when
695 source and target are same (uses Equals).
697 * expression.cs (LocalVariableReference, ParameterReference,
698 This): Implemented Equals, GetHashCode.
700 * statement.cs (Block.GetParameterReference): Removed useless
703 2005-03-22 Raja R Harinath <rharinath@novell.com>
706 * statement.cs (Block.AddVariable): Ensure that we skip implicit
707 blocks before deciding whether the error is cs0136 or cs0128.
709 * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
710 (using_alias_directive, using_namespace_directive): Pass
711 MemberName, not an expression to Namespace.UsingAlias and
713 (MakeName): Use the MemberName of the namespace.
714 * namespace.cs (Namespace.MemberName): New.
715 (UsingEntry.UsingEntry): Take a MemberName, not an expression.
716 (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
718 * decl.cs (MemberName.Name): Make readonly.
719 (MemberName.FromDotted): New "constructor".
720 (MemberName.Equals, MemberName.GetHashCode): Implement overrides.
721 (MemberCore.Name): Compute from MemberName on demand.
722 (MemberCore.SetMemberName): Provide a way to change the
724 (MemberCore.AddToContainer): Don't take a fullname parameter.
725 * class.cs (TypeContainer.AddToMemberContainer): Don't add the
726 fully qualified name of the container to the member name.
727 (TypeContainer.AddToTypeContainer): Use a fully qualified name
728 only if the type is a member of the root container.
729 (TypeContainer.AddMethod, TypeContainer.AddProperty): Use
730 MemberName.Left rather than searching for an embedded ".".
731 (PartialContainer.CreatePart): Update to changes in RootContext.
732 (MemberBase.ShortName): Turn into a property. Use
733 MemberCore.SetMemberName.
734 (MemberBase.ExplicitInterfaceName): Remove.
735 (MemberBase.UpdateMemberName): Remove.
736 (AbstractPropertyEventMethod.UpdateName): Use SetMemberName.
737 (PropertyBase.SetMemberName): New override.
738 * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key.
740 (Tree.AllDecls): Rename from Decls.
741 * attribute.cs, enum.cs, report.cs: Update to changes.
742 * driver.cs (MainDriver): Use MemberName.FromDotted on
743 RootContext.MainClass.
745 2005-03-21 Marek Safar <marek.safar@seznam.cz>
747 * class.cs (FixedField.Define): Check for CS1664 and more sanity
750 * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708.
752 2005-03-18 Marek Safar <marek.safar@seznam.cz>
754 * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
755 property accessor modifiers.
757 * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
758 fixed buffer attribute (CS1716).
759 (PropertyMethod.HasCustomAccessModifier): When property accessor
762 * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
764 (PropertyExpr.DoResolveLValue): Add CS0272.
766 2005-03-17 Miguel de Icaza <miguel@novell.com>
768 * convert.cs: When converting to a pointer, use the proper Conv.U
769 or Conv.I depending on the source data type.
771 * cs-tokenizer.cs: Make the size for large decimal constants,
774 2005-03-17 Martin Baulig <martin@ximian.com>
776 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
777 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
779 2005-03-17 Martin Baulig <martin@ximian.com>
781 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
782 to bool so we can return an error condition.
783 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
786 2005-03-16 Zoltan Varga <vargaz@freemail.hu>
788 * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping
791 2005-03-16 Raja R Harinath <rharinath@novell.com>
793 Remove TypeManager.LookupType and TypeManager.LookupTypeDirect.
794 Refactor to avoid traversing the list of assemblies, and to avoid
795 string concatenation.
796 * typemanager.cs (guid_attr_type): Remove.
797 (negative_hits, pointers, references): Remove hashes.
799 (GetConstructedType): New. Uses type_hash to handle constructed
800 types (arrays, references, pointers).
801 (GetReferenceType, GetPointerType): Use it.
802 (GetNestedType): New. Uses type_hash to handle nested types of
804 (LookupType, LookupTypeDirect): Remove.
805 (CoreLookupType): Inline parts of old LookupTypeDirect code. Use
806 'types' hash and LookupTypeReflection directly.
807 (params_string, params_object): Use GetConstructedType.
808 * namespace.cs (Namespace.cached_types): New. Cache of reflected
810 (Namespace.Lookup): Use cached_types.
811 (NamespaceEntry.LookupNamespaceOrType): Inline the functionality
812 provided by old TypeManager.LookupType.
813 * rootcontext.cs (MakeFQN): Remove.
814 * decl.cs (DeclSpace.MakeFQN): Likewise.
815 (DeclSpace.LookupType): Use TypeManager.GetNestedType.
816 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
817 TypeManager.GetConstructedType.
818 * tree.cs (decl_ns_hash, LookupByNamespace): Remove.
820 2005-04-16 Zoltan Varga <vargaz@freemail.hu>
822 * cs-parser.jay: Fix build.
824 2005-03-15 Marek Safar <marek.safar@seznam.cz>
826 * class.cs (TypeContainer.CircularDepException) New nested
827 (MethodCore.CheckBase): Report CS1715 for properties and indexers.
829 * cs-parser.jay: Reports CS1527 for any namespace element.
831 * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
834 * expression.cs (ParameterReference.IsAssigned): Changed error to
836 (Error_WrongNumArguments): Moved CS0245 detection here.
838 * statement.cs (Return.Resolve): Add CS1622 report.
840 2005-03-11 Marek Safar <marek.safar@seznam.cz>
842 * class.cs (StaticClass.DefineContainerMembers): Added CS0720.
844 2005-03-11 Zoltan Varga <vargaz@freemail.hu>
846 * attribute.cs expression.cs: Get rid of some allocations.
848 2004-03-11 Atsushi Enomoto <atsushi@ximian.com>
850 * doc.cs : just eliminate the latest change.
852 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
854 * doc.cs : commented out the latest change. It breaks xml-030.cs
856 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
858 * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will
859 fail. So invoke CreateType() in FindDocumentedType().
861 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
863 * cs-tokenizer.cs : added IsKeyword().
864 * doc.cs : Detect keyword incorrectly used as identifier.
865 Allow identifiers prefixed by @.
867 2005-03-10 Marek Safar <marek.safar@seznam.cz>
869 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
870 It caused exception in namespace resolving (again!).
872 * class.cs (Class.ctor): Removed exit.
873 (PropertyMethod.ctor): ditto.
875 * codegen.cs (Codegen.Reset): Reset static data.
876 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
878 * cs-tokenizer.cs (Cleanup): Removed.
880 * driver.cs (GetSystemDir): Rewrote to one line command.
881 It caused problem with unloaded dynamic modules.
882 (UnixParseOption): Removed Exit.
883 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
884 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
885 Now can be mcs used as library.
887 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
890 * location.cs (Reset): Reset static data.
892 * namespace.cs (Reset): Reset static data.
894 * report.cs (Report.Reset): Reset static data.
896 * rootcontext.cs (RootContext.Reset): Reset static data.
898 * tree.cs (RootTypes.ctor): Use Location.Null
900 * typemanager.cs (TypeManager.Reset): Reset static data.
901 (CoreLookupType): Removed Exit.
902 (TypeHandle.Reset): Reset static data.
904 2005-03-10 Raja R Harinath <rharinath@novell.com>
907 * typemanager.cs (ComputeNamespaces): Import namespaces from
908 referenced modules too.
910 2005-03-09 Raja R Harinath <rharinath@novell.com>
912 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
915 2005-03-09 Raja R Harinath <rharinath@novell.com>
917 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
918 enclosing DeclSpace. This ensures that a name-lookup populates
919 more caches and there are fewer 'TypeExpression's. Carve out
920 nested type lookup into ...
921 (LookupNestedTypeInHierarchy): ... this.
923 2005-04-15 Martin Baulig <martin@ximian.com>
925 Merged r41590 from MCS and make it work in the generics land.
927 * generic.cs (TypeParameter.UpdateConstraints): Removed the
930 * class.cs (PartialContainer.UpdateConstraints): Removed.
931 (PartialContainer.CheckConstraints): Removed.
932 (PartialContainer.SetParameterInfo): Store the constraints here.
933 (PartialContainer.DefineTypeParameters): New public method;
934 resolve the type parameter's constraints here. Note that the
935 PartialContainer doesn't have an EmitContext anymore, so we must
936 do this in the ClassPart.
938 2005-03-09 Raja R Harinath <rharinath@novell.com>
940 Clean up a few partial-class semantics.
941 Fixes test-357.cs and cs1618-2.cs.
942 * cs-parser.jay (struct_declaration): Use 'current_class' as
943 parent of newly-created struct. Remove call to Register ().
944 Use 'pop_current_class' to complete handing the current struct.
945 (interface_declaration): Likewise.
946 (class_declaration): Likewise.
947 (enum_declaration): Use 'current_class' as parent of newly created
949 (delegate_declaration): Likewise.
950 (pop_current_class): New function. This is used to handle closing
951 up the 'current_class' and 'current_container', and pointing them
952 to the enclosing class/container.
953 (CSharpParser): Initialize 'current_class' too.
954 * decl.cs (MemberCore): Add check for invariant: a partial
955 container is not a parsed entity, and thus does not enclose any
957 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
958 (DeclSpace.BaseTypeExpr): Use it.
959 (DeclSpace.LookupType): Add check for invariant.
960 * class.cs (TypeContainer): Add check for invariant: a nested
961 class should have the same NamespaceEntry as its enclosing class.
962 (TypeContainer.EmitFieldInitializers): Make virtual.
963 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
965 (TypeContainer.Register): Remove.
966 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
967 null. Use TypeResolveEmitContext for resolving base types and
968 interfaces. Move initialization of Parts.TypeBuilder here from
970 (TypeContainer.DefineNestedTypes): ... here.
971 (PartialContainer): Take a Namespace not a NamespaceEntry.
972 (PartialContainer.Create): Don't use Register. Call the
973 appropriate Add... function directly.
974 (ClassPart): Take both the PartialContainer and the enclosing
975 class as constructor arguments.
976 (ClassPart.EmitFieldInitializers): Override.
977 (ClassPart.PartFindNestedTypes): Remove.
978 (FieldBase.GetInitializerExpression): Resolve the initializer
979 expression in the emit context of the enclosing class.
980 * tree.cs (RootTypes): Remove Register ().
982 2005-03-08 Marek Safar <marek.safar@seznam.cz>
984 * cs-parser.jay: Removed CS0134.
986 * driver.cs: Removed CS1901.
988 * expression.cs (SizeOf.DoResolve): Don't report CS0233
989 for predefined types.
991 2005-03-07 Duncan Mak <duncan@novell.com>
993 * codegen.cs (Save): Catch UnauthorizedAccessException as
994 well. Fixes bug #73454.
996 2005-03-07 Marek Safar <marek.safar@seznam.cz>
998 * cs-tokenizer.cs (xtoken): Add CS1035.
1000 * class.cs (MethodData.Define): Add CS0683.
1001 (FieldMember.ctor): Add CS0681.
1003 2005-03-07 Raja R Harinath <rharinath@novell.com>
1005 * ecore.cs (SimpleName.DoResolve): Rename from
1006 SimpleName.DoResolveAllowStatic.
1007 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
1008 Pass 'intermediate' flag to MemberStaticCheck.
1009 (SimpleName.MemberStaticCheck): Skip "static check" only in case
1010 of "intermediate" lookups via MemberAccess.
1011 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
1012 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
1014 2005-03-07 Raja R Harinath <rharinath@novell.com>
1017 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
1018 slipped in because of variable names that are identical to a
1019 builtin type's BCL equivalent ('string String;', 'int Int32;').
1020 (PropertyExpr.EmitInstance): Likewise.
1022 2005-03-04 Marek Safar <marek.safar@seznam.cz>
1024 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
1026 * report.cs (warning_ignore_table): Made public.
1028 2005-03-04 Raja R Harinath <rharinath@novell.com>
1031 * class.cs (MethodData.Emit): Pass 'container' to
1032 container.GetObsoleteAttribute instead of 'container.Parent'.
1034 2005-03-03 Marek Safar <marek.safar@seznam.cz>
1036 * cs-parser.jay: Add 1534 error test.
1038 * iterators.cs (Yield.CheckContext): Add error 1629.
1039 (Iterator.ctor): Save unsafe modifier.
1040 (MoveNextMethod.DoEmit): Restore unsafe context.
1042 * namespace.cs (UsingAlias): Better error message.
1044 2005-03-03 Dan Winship <danw@novell.com>
1046 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
1047 the warning message [#73219]
1049 2005-03-03 Raja R Harinath <rharinath@novell.com>
1051 Fix compile with MCS 1.0.0.0.
1052 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
1053 w_restore to not depend on string constant folding.
1055 2005-03-03 Raja R Harinath <rharinath@novell.com>
1057 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
1058 CS0246 check to users who passed 'silent = false'.
1059 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
1061 (SimpleName.SimpleNameResolve): Update.
1062 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
1063 (MemberAccess.IdenticalNameAndTypeName): Update.
1064 * doc.cs (FindDocumentedTypeNonArray): Update.
1066 2005-03-03 Raja R Harinath <rharinath@novell.com>
1068 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
1069 * parameters.cs (ComputeAndDefineParameters): Remove.
1070 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
1071 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
1072 Use GetParameterInfo.
1074 2005-03-02 Marek Safar <marek.safar@seznam.cz>
1076 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
1078 2005-03-02 Raja R Harinath <rharinath@novell.com>
1080 Unify DeclSpace.LookupType and DeclSpace.FindType.
1081 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
1082 is in charge of defining nested types on demand.
1083 (DeclSpace.LookupType): Use it when the current_type is a
1084 TypeBuilder. Use LookupTypeDirect for reflected types.
1085 (DeclSpace.FindType): Remove.
1086 (DeclSpace.LookupInterfaceOrClass): Likewise.
1087 (DeclSpace.DefineTypeAndParents): Likewise.
1088 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
1089 DeclSpace.LookupType.
1090 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
1091 * typemanager.cs (LookupType): Simplify.
1092 (AddUserType): Remove type from negative_hits.
1093 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
1094 * class.cs (TypeContainer.FindMembers): Move handling of nested
1096 (TypeContainer.FindMembers_NestedTypes): ... here.
1097 (TypeContainer.FindNestedType): Implement override.
1098 (ClassPart.FindNestedType): Delegate to PartialContainer.
1099 (ClassPart.PartFindNestedType): Looks up the nested types of the
1102 2005-04-14 Martin Baulig <martin@ximian.com>
1104 * generic.cs (ConstructedType): Moved all the type lookup and
1105 nested class logic into SimpleName.
1106 (ConstructedType.ResolveConstructedType): Our underlying type is
1107 already fully resolved; all the type lookup stuff is in
1110 * ecore.cs (SimpleName.ResolveAsTypeStep): Resolve nested
1111 constructed types here instead of in ConstructedType.
1113 * decl.cs (MemberName.GetTypeExpression): Always create a
1114 SimpleName, not a ConstructedType.
1115 (DeclSpace.ResolveNestedType): Removed; this is now in SimpleName.
1117 2005-03-02 Martin Baulig <martin@ximian.com>
1119 * class.cs (TypeContainer.DoDefineMembers): We also need a default
1120 static constructor in static classes.
1122 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
1124 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
1125 sizeParamIndex is not specified.
1127 2005-03-01 Marek Safar <marek.safar@seznam.cz>
1130 * report.cs (WarningMessage.IsEnabled): Missing null check.
1132 2005-02-28 Marek Safar <marek.safar@seznam.cz>
1134 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
1135 in the fields and not in the properties.
1137 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
1139 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
1142 2005-02-28 Marek Safar <marek.safar@seznam.cz>
1144 * attribute.cs: Small refactoring (improved robustness).
1145 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
1146 (ValidateGuid): Removed.
1147 (Resolve): Removed referenced to above mentioned.
1148 (GetAttributeUsage): Made private and changed to work without
1150 (GetIndexerAttributeValue): Don't crash.
1151 (GetConditionalAttributeValue): Ditto.
1152 (GetClsCompliantAttributeValue): Ditto.
1153 (ExtractSecurityPermissionSet): All attributes exceptions are
1155 (GetPropertyValue): New helper.
1156 (GetMethodImplOptions): New method.
1157 (DefinePInvokeMethod): Reuse common code. Implemented handling of
1158 some missing properties.
1160 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
1161 (Method.ApplyAttributeBuilder): Updated.
1163 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
1166 2005-02-28 Raja R Harinath <rharinath@novell.com>
1169 * report.cs (Report.SymbolRelatedToPreviousError): Handle
1170 non-simple types (array, pointer, reference).
1172 2005-02-28 Marek Safar <marek.safar@seznam.cz>
1174 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
1176 * class.cs (MethodCore.IsDuplicateImplementation): Special error
1178 (Method.CheckBase): Catch wrong destructor here.
1179 (MethodData.Define): Add errors 550, 668.
1181 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
1183 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
1185 * pending.cs (VerifyPendingMethods): Add error 551.
1187 * typemanager.cs (CSharpName): Next error report helper.
1189 2005-02-25 Marek Safar <marek.safar@seznam.cz>
1191 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
1192 attributes. Removed useless attribute double check.
1193 It saves almost 2MBs for corlib.
1195 2005-02-25 Raja R Harinath <rharinath@novell.com>
1198 * statement.cs (ExpressionStatement.Resolve): Make robust to being
1199 called twice in case of error.
1201 2005-02-23 Chris Toshok <toshok@ximian.com>
1203 Fix compiler portions of #72827.
1204 * statement.cs (Block.Emit): call Begin/EndScope on the
1205 EmitContext instead of the ILGenerator.
1207 * codegen.cs (EmitContext.BeginScope): new method, call
1208 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
1210 (EmitContext.BeginScope): same, but EndScope and CloseScope
1212 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
1213 offset and call the superclass's OpenScope(int) with it.
1214 (SymbolWriter.CloseScope): get the current il
1215 offset and call superclass's CloseScope(int) with it.
1217 2005-02-23 Marek Safar <marek.safar@seznam.cz>
1219 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
1220 CS1677 for out and ref as well.
1222 * class.cs (Method.Define): Add error CS1599 detection.
1224 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
1226 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
1228 * delegate.cs (Delegate.Define): Add error CS1599 detection.
1230 * support.cs.cs (ModifierDesc): New helper method.
1232 2005-02-23 Raja R Harinath <rharinath@novell.com>
1233 Abin Thomas <projectmonokochi@rediffmail.com>
1234 Anoob V E <projectmonokochi@rediffmail.com>
1235 Harilal P R <projectmonokochi@rediffmail.com>
1238 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
1239 MemberLookup (used for error reporting) actually returns a result.
1240 Fix error report number (122, not 112).
1242 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
1243 Anoob V E <projectmonokochi@rediffmail.com>
1244 Harilal P R <projectmonokochi@rediffmail.com>
1247 * pending.cs (PendingImplementation.GetAbstractMethods):
1248 Find NonPublic members too.
1250 2005-02-22 Marek Safar <marek.safar@seznam.cz>
1252 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
1255 * class.cs (MethodCore.CheckMethodAgainstBase):
1256 Add error 239 report.
1258 2005-02-21 Marek Safar <marek.safar@seznam.cz>
1260 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
1262 * class.cs (Operator.Define): Add error 217 report.
1264 2005-02-21 Raja R Harinath <rharinath@novell.com>
1267 * expression.cs (Invocation.IsApplicable): Make public.
1268 (Invocation.IsParamsMethodApplicable): Likewise.
1269 * delegate.cs (Delegate.VerifyApplicability): Don't use
1270 Invocation.VerifyArgumentCompat for parameter applicability
1271 testing. Use Invocation.IsApplicable and
1272 Invocation.IsParamsMethodApplicable.
1274 2005-02-21 Marek Safar <marek.safar@seznam.cz>
1276 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
1278 * class.cs (Operator.Define): Add error 217 report.
1280 2005-02-21 Raja R Harinath <rharinath@novell.com>
1282 * namespace.cs (UsingEntry.Resolve): Undo change below.
1284 2005-02-21 Raja R Harinath <rharinath@novell.com>
1287 * ecore.cs (Expression.MemberLookupFailed): Add argument to
1288 disable the error message when the extended MemberLookup also
1290 (Expression.MemberLookupFinal): Update.
1291 (SimpleName.DoSimpleNameResolve): Update.
1292 * expression.cs (MemberAccess.ResolveNamespaceOrType):
1293 Don't use MemberLookupFinal.
1294 (New.DoResolve): Update.
1295 (BaseAccess.CommonResolve): Update.
1297 2005-02-21 Raja R Harinath <rharinath@novell.com>
1300 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
1301 occured previously, don't resolve again.
1303 2005-02-21 Marek Safar <marek.safar@seznam.cz>
1306 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
1307 argument. Call ResolveAttributeUsage for unresolved.
1308 when types doesn't match ctor arguments.
1310 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
1311 for nested attribute classes.
1312 (Class.attribute_usage): Removed.
1313 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
1314 for attribute class.
1316 * ecore.cs (IsAttribute): Removed.
1318 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
1320 * rootcontext.cs (RegisterAttribute): Removed, attributes are
1322 (attribute_types): Removed.
1323 (EmitCode): Global attributes are emited as the latest.
1325 2005-02-18 Marek Safar <marek.safar@seznam.cz>
1327 * class.cs (EmitFieldInitializers): Don't emit field initializer
1328 for default values when optimilization is on.
1330 * constant.cs (Constant.IsDefaultValue): New property.
1332 * driver.cs: Add /optimize handling.
1336 * literal.cs: Implement new IsDefaultValue property.
1338 * rootcontext.cs (Optimize): New field, holds /optimize option.
1340 2005-02-18 Raja R Harinath <rharinath@novell.com>
1342 Fix crasher in re-opened #72347.
1343 * namespace.cs (Namespace.Lookup): Return null if
1344 DeclSpace.DefineType returns null.
1347 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
1349 2005-02-18 Raja R Harinath <rharinath@novell.com>
1351 Fix remainder of #63202. Change semantics of DoResolveLValue: it
1352 now returns null if it cannot resolve to an lvalue.
1353 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
1354 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
1355 returned null. Remove check for SimpleName.
1356 (EventExpr.DoResolveLValue): New.
1357 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
1358 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
1360 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
1362 (Unary.ResolveOperator): Move CS0211 check ...
1363 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
1365 (Unary.DoResolveLValue): Simplify.
1366 (AddressOf.DoResolveLValue): New.
1367 (ArrayAccess.DoResolveLValue): New.
1369 2005-02-16 Marek Safar <marek.safar@seznam.cz>
1371 * attribute.cs (Attribute.Resolve): Add arguments casting for
1372 when types doesn't match ctor arguments.
1374 2005-02-16 Raja R Harinath <rharinath@novell.com>
1376 Fix parts of #63202.
1377 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
1378 lookup of operator in base type. Ensure that all checks happen
1379 when the operator resolves to an "op_..." method.
1381 2005-02-15 Raja R Harinath <rharinath@novell.com>
1384 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
1385 'ignore_cs0104' parameter. Pass it to ...
1386 (NamespaceEntry.Lookup): ... this.
1387 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
1388 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
1389 (TypeLookupExpression.DoResolveAsTypeStep): Update.
1390 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
1391 Update. Request that cs0104 errors be ignored.
1392 (ComposedCast.ResolveAsTypeStep): Update.
1394 2005-02-14 Raja R Harinath <rharinath@novell.com>
1397 * expression.cs (Invocation.BetterFunction): Remove support for
1398 comparing virtual functions and their overrides.
1399 (Invocation.IsOverride): New.
1400 (Invocation.OverloadResolve): Don't consider 'override' functions
1401 during candidate selection. Store them in a lookaside list.
1402 If the selected method is a 'virtual' function, use the list to
1403 find any overrides that are closer to the LHS type.
1405 2005-02-14 Marek Safar <marek.safar@seznam.cz>
1407 * expression.cs (New.DoResolve): Add complex core type reduction.
1408 (New.Constantify): Converts complex core type syntax like 'new int ()'
1411 2005-02-14 Raja R Harinath <rharinath@novell.com>
1413 * decl.cs (EntryType.EntryType): New constructor to create an
1414 updated copy of a cache entry.
1415 (MemberCache.AddMethods): Use it.
1416 (MemberCache.ClearDeclaredOnly): Remove.
1417 (MemberCache.MemberCache): Update.
1419 2005-02-11 Miguel de Icaza <miguel@novell.com>
1421 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
1422 variable. This one is represents the actual low-level declaration
1423 of the method, as opposed to the semantic level `IsStatic'.
1425 An anonymous method which is hosted into a static method might be
1426 actually an instance method. IsStatic would reflect the
1427 container, while MethodIsStatic represents the actual code
1430 * expression.cs (ParameterReference): Use the new MethodIsStatic
1431 instead of IsStatic.
1433 * anonymous.cs (AnonymousMethod.Compatible): Pass the
1434 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
1435 set on the current EmitContext.
1437 * expression.cs (Cast): Overload DoResolveLValue so we can pass
1438 resolve our casted expression as an LValue. This triggers the
1439 proper LValue processing that is later required by Assign.
1443 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
1445 2005-02-11 Marek Safar <marek.safar@seznam.cz>
1447 C# 2.0 Fixed buffer implementation
1449 * anonymous.cs: Update after RegisterHelperClass renaming.
1451 * attribute.cs (AttributeTester.fixed_buffer_cache):
1452 Cache of external fixed buffers.
1453 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
1454 implementation if field is fixed buffer else null.
1457 (TypeContainer.AddField): Accept FieldMember instead of Field.
1458 (FieldBase.IsFieldClsCompliant): Extracted code from
1459 VerifyClsCompliance descendant customization.
1460 (FixedField): New class handles fixed buffer fields.
1461 (FixedFieldExternal): Keeps information about imported fixed
1463 (IFixedField): Make access to internal or external fixed buffer
1466 * cs-parser.jay: Add fixed buffer parsing.
1468 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
1471 * expression.cs (Indirection): Extended implementation to accept
1473 (PointerArithmetic.Emit): Get element from fixed buffer as well.
1474 (ElementAccess.MakePointerAccess): Get type as parameter.
1475 (DoResolve): Add fixed buffer field expression conversion.
1476 (DoResolveLValue): Ditto.
1477 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
1478 (ArrayPtr): Derives from FixedBufferPtr.
1479 (ArrayPtr.Emit): Add extra emit for array elements.
1481 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
1483 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
1484 for compiler generated types.
1485 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
1487 * statement.cs (Fixed): Refactored to be easier add fixed buffer
1488 and consume less memory.
1489 (Fixed.Resolve): Add fixed buffer case.
1491 * typemanager.cs (compiler_generated_attr_ctor,
1492 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
1493 (HasElementType): Add our own implementation to work on every
1496 2005-02-11 Miguel de Icaza <miguel@novell.com>
1498 * anonymous.cs (CaptureContext): Track whether `this' has been
1501 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
1502 only captured `this' if it was implicitly done (instance
1503 methods/variables were used).
1505 * codegen.cs (EmitContext.CaptureThis): New method to flag that
1506 `this' must be captured.
1508 2005-01-30 Miguel de Icaza <miguel@novell.com>
1510 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
1511 is null it means that there has been no need to capture anything,
1512 so we just create a sibling.
1514 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
1516 Just a partial fix. The other half is fairly elusive.
1518 2005-02-10 Raja R Harinath <rharinath@novell.com>
1520 Fix #52586, cs0121-4.cs.
1521 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
1522 and return a hashtable.
1523 (MemberCache.ClearDeclaredOnly): New.
1524 (MemberCache.MemberCache): Update to change. Make a deep copy of
1525 the method_hash of a base type too.
1526 (MemberCache.AddMethods): Adapt to having a deep copy of the base
1527 type methods. Overwrite entries with the same MethodHandle so
1528 that the ReflectedType is correct. The process leaves in base
1529 virtual functions and their overrides as distinct entries.
1530 (CacheEntry): Now a class instead of a struct. It shouldn't alter
1531 matters since it was boxed in a ArrayList before.
1532 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
1534 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
1535 case of a virtual function and its override (choose the overload
1537 (Invocation.OverloadResolve): Avoid 'override' members during
1538 'applicable_type' calculation.
1540 2005-03-28 Raja R Harinath <rharinath@novell.com>
1542 * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer.
1543 (TypeHandle.TypeHandle): Use LookupMemberCache rather than
1544 GetTypeHandle. It is possible for a reflected type to derive from
1545 a TypeBuilder (e.g., int[] derives from the TypeBuilder
1546 System.Array during mscorlib compilation).
1547 * decl.cs (MemberCache.MemberCache): If the base cache doesn't
1548 contain a method_hash, don't create one either. Don't create a
1549 deep copy of the base cache's method_hash.
1550 (MemberCache.SetupCache): Rename back from DeepCopy.
1551 (MemberCache.AddMethods): Rewrite, now that method_hash isn't
1552 already initialized. If we see an override function, add its
1553 underlying base virtual function to the member_hash too.
1555 2005-02-09 Raja R Harinath <rharinath@novell.com>
1557 Combine two near-redundant caches.
1558 * typemanager.cs (method_params): Rename from method_internal_params.
1559 (TypeManager.GetParameterData): New. Replace
1560 Invocation.GetParameterData.
1561 (TypeManager.LookupParametersByBuilder): Remove.
1562 * expression.cs (Invocation.method_parameter_cache): Remove.
1563 (Invocation.GetParameterData): Remove.
1565 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
1568 2005-02-08 Raja R Harinath <rharinath@novell.com>
1571 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
1572 TypeManager.multicast_delegate_type is null, resolve it by looking
1573 up "System.MulticastDelegate".
1574 * rootcontext.cs (RootContext.ResolveCore): Simplify.
1576 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
1577 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
1578 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
1581 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
1582 (LabeledStatement.AddReference): New. Set 'referenced'.
1583 (Goto.Resolve): Use it.
1585 2005-02-05 John Luke <john.luke@gmail.com>
1587 * driver.cs: remove duplicate -doc line in Usage ()
1589 2005-02-04 Raja R Harinath <rharinath@novell.com>
1591 * location.cs (Location.AddFile): Fix CS2002 error report.
1593 2005-02-02 Martin Baulig <martin@ximian.com>
1595 * delegate.cs (Delegate.DefineType): Report an internal error if
1596 TypeManager.multicast_delegate_type is null. See bug #72015 for
1599 2005-02-02 Raja R Harinath <rharinath@novell.com>
1601 Fix a crasher in a variant of #31984.
1602 * const.cs (Constant.CheckBase): New override that defers the
1603 new-or-override check in case the base type hasn't been populated
1605 (Constant.Define): Ensure the new-or-override check is performed.
1607 2005-02-01 Duncan Mak <duncan@ximian.com>
1609 * const.cs (LookupConstantValue): Check that `ce' is not null
1610 before calling GetValue ().
1612 2005-02-01 Raja R Harinath <rharinath@novell.com>
1614 Fix test-334.cs (#69519).
1615 * cs-parser.jay (using_alias_directive): Pass in an expression to
1616 NamespaceEntry.UsingAlias.
1617 (using_namespace_directive): Pass in an expression to
1618 NamespaceEntry.Using.
1619 (namespace_name): Don't flatten to a string.
1620 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
1621 (NamespaceEntry.AliasEntry.Resolve): Lookup using
1623 (NamespaceEntry.UsingEntry): Likewise.
1624 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
1626 (NamespaceEntry.LookupForUsing): Remove.
1627 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
1629 (NamespaceEntry.Lookup): Remove support for dotted names.
1631 2005-02-01 Raja R Harinath <rharinath@novell.com>
1633 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
1635 (NamespaceEntry.ImplicitParent): Compute on demand.
1636 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
1637 parallels the current.
1638 (NamespaceEntry.LookupForUsing): Use it.
1639 (NamespaceEntry.Lookup): If the current namespace-entry is
1640 implicit, don't search aliases and using tables.
1642 2005-02-01 Raja R Harinath <rharinath@novell.com>
1645 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
1647 (TypeContainer.BaseCache): Compute on demand.
1648 (TypeContainer.FindMembers): Define constants and types if they're
1649 not already created.
1650 (FieldMember.Define): Move resetting of ec.InUnsafe before error
1652 * const.cs (Constant.Define): Make idempotent.
1654 2005-01-29 Miguel de Icaza <miguel@novell.com>
1656 * pending.cs: Produce better code (no nops produced by using Ldarg
1659 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
1660 i - 1' it should be arg + 1.
1664 2005-01-28 Raja R Harinath <rharinath@novell.com>
1666 * attribute.cs (Attribute.CheckAttributeType): Make private
1668 (Attribute.ResolveType): Make virtual.
1669 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
1670 handling of RootContext.Tree.Types.
1672 2005-01-27 Raja R Harinath <rharinath@novell.com>
1674 Update attribute-handling to use the SimpleName/MemberAccess
1676 * cs-parser.jay (attribute): Pass in an expression to the
1677 constructors of Attribute and GlobalAttribute.
1678 * attribute.cs (Attribute): Take an expression for the name.
1679 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
1680 passed in attribute name expression.
1681 (Attribute.CheckAttributeType): Use it.
1682 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
1683 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
1684 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
1685 argument to prevent error messages if the lookup fails.
1687 2005-01-27 Marek Safar <marek.safar@seznam.cz>
1689 * expression.cs (Indirection): Implemented IVariable interface
1690 to support indirection in AddressOf operator.
1691 (PointerArithmetic.Emit): Add optimalization for case where
1692 result can be precomputed.
1694 2005-01-26 Martin Baulig <martin@ximian.com>
1696 * class.cs (TypeContainer.AttributeTargets): Return the correct
1697 AttributeTargets depending on our `Kind' instead of throwing an
1698 exception; fixes #71632.
1700 2005-01-26 Marek Safar <marek.safar@seznam.cz>
1703 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
1706 2005-03-17 Martin Baulig <martin@ximian.com>
1708 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
1709 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
1711 2005-03-17 Martin Baulig <martin@ximian.com>
1713 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
1714 to bool so we can return an error condition.
1715 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
1718 2005-03-17 Martin Baulig <martin@ximian.com>
1720 * generic.cs (TypeMananager.IsIEnumerable): New public method.
1722 * convert.cs (Convert.ImplicitReferenceConversion(Exists)): Allow
1723 converting from an array-type of T to `IEnumerable<T>'.
1725 2005-03-16 Martin Baulig <martin@ximian.com>
1727 * generic.cs (Nullable.Unwrap): Implement IAssignMethod.
1728 (Nullable.LiftedUnaryMutator): New public class.
1730 * expression.cs (UnaryMutator.DoResolve): Added support for
1733 2005-03-14 Martin Baulig <martin@ximian.com>
1735 * generic.cs (Nullable.NullCoalescingOperator): Implemented.
1737 2005-03-14 Martin Baulig <martin@ximian.com>
1739 * generic.cs (Nullable.LiftedBinaryOperator): Added support for
1740 the comparision operators `<', `>', `<=' and `>='.
1742 2005-03-13 Martin Baulig <martin@ximian.com>
1745 (Nullable.NullLiteral): Renamed to `Nullable.NullableLiteral' to
1746 avoid confusion with the `NullLiteral'.
1747 (Nullable.LiftedBinaryOperator): Correctly implement `==' and '!='.
1749 2005-03-13 Martin Baulig <martin@ximian.com>
1751 * expression.cs (Binary.ResolveOperator): For `==' and `!=', allow
1752 comparing arbitrary types with the null literal.
1754 2005-03-13 Martin Baulig <martin@ximian.com>
1756 * generic.cs (Nullable.LiftedBinaryOperator): Add support for the
1757 boolean operators '&&', '||', '&' and '|'.
1758 (Nullable.OperatorTrueOrFalse): New public class.
1760 * ecore.cs (Expression.GetOperatorTrue/False): Return an `Expression'
1761 instead of a `StaticCallExpr'; added support for nullables.
1763 2005-03-10 Martin Baulig <martin@ximian.com>
1766 (ArrayAccess.EmitDynamicInitializers): Use `etype.IsValueType'
1767 rather than `etype.IsSubclassOf (TypeManager.value_type)'.
1769 2005-03-07 Martin Baulig <martin@ximian.com>
1771 * generic.cs (Nullable.Unwrap): Implement IMemoryLocation and make
1772 it work if `expr' is not an IMemoryLocation.
1773 (Nullable.Lifted): Implement IMemoryLocation.
1774 (Nullable.LiftedConversion.ResolveUnderlying): Use the correct
1777 2005-03-05 Martin Baulig <martin@ximian.com>
1779 * generic.cs (Nullable.Unwrap, Wrap): New protected classes.
1780 (Nullable.Lifted): New abstract class; rewrote the lifted conversions.
1781 (Nullable): Added support for lifted unary and binary operators.
1783 * expression.cs (Unary.DoResolve): Added support for nullable types.
1784 (Binary.DoResolve): Likewise.
1785 (Conditional.DoResolve): Likewise.
1787 2005-03-02 Martin Baulig <martin@ximian.com>
1789 * decl.cs (DeclSpace.SetParameterInfo): Make this virtual.
1791 * class.cs (ClassPart.SetParameterInfo): Override this.
1792 (PartialContainer.SetParameterInfo): Override this.
1793 (TypeContainer.CheckConstraints): New protected method.
1794 (PartialContainer.CheckConstraints): Override this and check
1795 whether the same contraints were specified in all parts of a
1796 partial generic type definition.
1797 (PartialContainer.UpdateConstraints): New public method.
1799 * generic.cs (TypeParameter.UpdateConstraints): New public method.
1801 2005-03-02 Martin Baulig <martin@ximian.com>
1803 Committing a patch from Carlos Alberto Cortez to fix #72887.
1805 * convert.cs (Convert.ExplicitReferenceConversionExists): Allow
1806 casts from `T []' to `int []'.
1808 2005-03-02 Martin Baulig <martin@ximian.com>
1810 * generic.cs (TypeManager.IsEqual): Make this symmetric.
1812 * expression.cs (Binary.ResolveOperator): When resolving a
1813 BinaryDelegate, use `TypeManager.IsEqual (l, r)' rather than just
1814 `=='. Fixes #71866. See gen-127.cs.
1816 2005-03-02 Martin Baulig <martin@ximian.com>
1818 * class.cs (TypeContainer.DoDefineMembers): We also need a default
1819 static constructor in static classes.
1821 2005-03-02 Martin Baulig <martin@ximian.com>
1824 (NullableType.Name, NullableType.FullName): Add a "?" to the name.
1825 (Nullable.LiftedConversion): Added support for user-defined
1828 * cs-tokenizer.cs (Tokenizer.PutbackCloseParens): New public method.
1830 * cs-parser.jay: Use ComposedCast everywhere instead of
1831 NullableType, so we don't need to check for NullableType
1833 (conditional_expression): Added `INTERR CLOSE_PARENS' rule for the
1834 case where we'll be resolved into a `parenthesized_expression_0'
1838 (Convert.UserDefinedConversion): Added nullable conversions.
1840 2005-02-28 Martin Baulig <martin@ximian.com>
1842 * generic.cs (TypeManager.IsNullableType): New static method.
1843 (Nullable): New abstract class.
1844 (Nullable.NullLiteral): New public class.
1845 (Nullable.LiftedConversion): New public class.
1847 * cs-parser.jay (non_expression_type): Changed `builtin_types' to
1848 `builtin_types opt_nullable'.
1851 (Convert.ImplicitConversionStandard): Added nullable conversions.
1852 (Convert.ExplicitConversionStandard): Likewise.
1853 (Convert.ExplicitConversion): Likewise.
1855 2005-02-26 Martin Baulig <martin@ximian.com>
1857 * expression.cs (ComposedCast.DoResolveAsTypeStep): Allow `dim' to
1858 begin with a "?", for instance "?[]". Don't do a type lookup if
1861 2005-02-25 Martin Baulig <martin@ximian.com>
1863 The first part of Nullable Types :-)
1865 * generic.cs (NullableType): New public class.
1866 (NullCoalescingOperator): New public class.
1867 (TypeArguments.Resolve): Add a CS0306 check.
1869 * cs-parser.jay (opt_error_modifier): Removed, this was unused.
1870 (opt_nullable): New rule.
1871 (type): Added `opt_nullable' to `namespace_or_type_name',
1872 `builtin_types' and `pointer_type'.
1873 (array_type): Added `opt_nullable'.
1874 (opt_rank_specifier_or_nullable): New rule; this is the
1875 combination of `opt_rank_specifier' and `opt_nullable'.
1876 (opt_error): New rule; catch errors here.
1877 (nullable_type_or_conditional): New rule; we use this to check for
1878 nullable and still detect the conditional operator.
1879 (local_variable_type): Use `opt_rank_specifier_or_nullable'
1880 instead `opt_rank_specifier'.
1882 * expression.cs (ComposedCast.DoResolveAsTypeStep): Added support
1885 2005-02-24 Martin Baulig <martin@ximian.com>
1887 * README, README.Changes: Removed; they're old and obsolete.
1889 2005-02-22 Martin Baulig <martin@ximian.com>
1891 * generic.cs (TypeParameter.Resolve): If resolving the constraints
1892 returned an error, set `constraints' to null to avoid a crash
1894 (TypeParameter.ResolveType): Likewise.
1896 2005-02-22 Martin Baulig <martin@ximian.com>
1899 (Constraints.ResolveTypes): Protect against being called twice.
1900 (Constraints.CheckInterfaceMethod): Don't call ResolveTypes().
1901 (TypeParameter.ResolveType): New public method; calls
1902 constraints.ResolveTypes().
1903 (TypeParameter.DefineType): Moved constraints.ResolveType() out
1904 into the new ResolveType().
1905 (GenericMethod.Define): Call ResolveType() on all our
1908 2005-02-21 Martin Baulig <martin@ximian.com>
1911 (TypeManager.generic_nullable_type): New static public field.
1912 (TypeManager.InitGenericCoreType): Lookup "System.Nullable`1".
1915 (RootContext.ResolveCore): Resolve "System.Nullable`1".
1917 2005-02-15 Martin Baulig <martin@ximian.com>
1919 * generic.cs (ConstructedType.Constraints): Correctly check
1920 constraints if the argument type is a type parameter; fixes
1923 2005-02-02 Martin Baulig <martin@ximian.com>
1925 * delegate.cs (Delegate.DefineType): Report an internal error if
1926 TypeManager.multicast_delegate_type is null. See bug #72015 for
1929 2005-01-29 Miguel de Icaza <miguel@novell.com>
1931 * pending.cs: Produce better code (no nops produced by using Ldarg
1934 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
1935 i - 1' it should be arg + 1.
1939 2005-01-26 Martin Baulig <martin@ximian.com>
1941 * cs-parser.jay (indexer_declarator): Don't report an error if we
1942 have type parameters since we can be an explicit interface
1943 implementation; fixes #71449.
1945 2005-01-26 Martin Baulig <martin@ximian.com>
1947 * class.cs (TypeContainer.AttributeTargets): Return the correct
1948 AttributeTargets depending on our `Kind' instead of throwing an
1949 exception; fixes #71632.
1951 2005-01-26 Martin Baulig <martin@ximian.com>
1953 * delegate.cs (Delegate.DefineType): Correctly define our type
1954 parameters. Fixes #71483.
1956 2005-01-25 Raja R Harinath <rharinath@novell.com>
1959 * expression.cs (MemberAccess.DoResolve): Don't complain with
1960 cs0572 when the LHS of a member access has identical name and type
1963 2005-01-25 Marek Safar <marek.safar@seznam.cz>
1966 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
1968 Create custom PermissionSet only for PermissionSetAttribute.
1970 2005-01-24 Marek Safar <marek.safar@seznam.cz>
1973 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
1974 delegates in static class.
1976 2005-01-24 Martin Baulig <martin@ximian.com>
1978 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
1979 merging an implicit block, just use its reachability.
1981 * statement.cs (Block.Resolve): Make the unreachable code check
1982 work wrt. implicit blocks; see test-337 from #63842.
1984 2005-01-21 Alp Toker <alp@atoker.com>
1986 * cs-parser.jay: destructor_declaration's container is PartialContainer
1987 not Class when partial types are used, so use Kind prop instead of
1990 2005-01-22 Miguel de Icaza <miguel@ximian.com>
1992 * cs-parser.jay: Improve error reporting when an interface
1995 2005-01-20 Dick Porter <dick@ximian.com>
1997 * support.cs: SeekableStreamReader fix from Sandor Dobos
1998 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
1999 chars are read. Fixes bug 70369.
2001 2005-01-20 Raja R Harinath <rharinath@novell.com>
2003 * cs-parser.jay (catch_clause): Simplify current_block handling
2006 2005-01-17 Miguel de Icaza <miguel@ximian.com>
2008 * convert.cs (ImplicitStandardConversionExists): Synchronize the
2009 code with ImplicitStandardConversion to handle the implicit
2010 conversion of method groups into valid delegate invocations.
2012 The problem is that in parameter handling we were using this code
2013 path. Fixes bug #64698
2015 2005-01-19 Raja R Harinath <rharinath@novell.com>
2017 * cs-parser.jay: Fix several infelicities.
2018 - Avoid assigning to the parser value stack. Code like
2019 '$3 = null' is unclean. Synthesize a value for the code block
2021 - Avoid using oob_stack for storing location information. Use ...
2022 (_mark_): ... this. New (empty) rule. Saves the current location
2024 (foreach_statement): Avoid using oob_stack for current_block
2025 handling. Use technique used in for_statement and
2026 using_statement. Synthesize a value for the code block to store
2027 additional intermediate information.
2029 2005-01-13 Miguel de Icaza <miguel@ximian.com>
2031 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
2032 of a different type is only allowed to private fields of a
2033 containing type, not on fields of a base class.
2035 See test-174.cs and error cs0122-9.cs
2037 2005-01-13 Raja R Harinath <rharinath@novell.com>
2039 Fix test-335.cs (bug #58126).
2040 * cs-parser.jay (argument): Split out non-expression parts of the
2041 rule into 'non_simple_argument'.
2042 (invocation_expression): Support parenthesized invocations with
2043 multiple arguments, and with single non-simple arguments.
2045 2005-01-13 Raja R Harinath <rharinath@novell.com>
2047 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
2050 2005-01-12 Raja R Harinath <rharinath@novell.com>
2052 Fix cs0038-1.cs, cs1640-6.cs.
2053 * ecore.cs (Expression.Resolve): Remove special-case for
2054 SimpleName in error-handling.
2055 (Expression.almostMatchedMembers): Relax access permission to
2057 (Expression.MemberLookupFailed): Handle duplicates in
2058 almostMatchedMembers list.
2059 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
2060 * expression.cs (New.DoResolve): Report CS1540 for more cases.
2061 * typemanager.cs (GetFullNameSignature): Use the MethodBase
2062 overload if the passed in MemberInfo is a MethodBase.
2064 2005-01-25 Martin Baulig <martin@ximian.com>
2067 (DocUtil.emptyParamList): Removed; use `Type.EmptyTypes' instead.
2069 2005-01-12 Marek Safar <marek.safar@seznam.cz>
2072 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
2073 for non-CAS & merge permission sets properly.
2075 2005-01-11 Raja R Harinath <rharinath@novell.com>
2077 Improve standard-compliance of simple name and member access
2078 resolution. Fixes bugs #52697, #57200, #67520, #69519.
2079 * ecore.cs (FullNamedExpression): New abstract base class
2080 for Namespaces and TypeExpressions.
2081 (ResolveFlags.SimpleName): Remove.
2082 (SimpleName): Remove support for dotted names.
2083 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
2084 DeclSpace.FindType and DeclSpace.LookupType.
2085 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
2086 (Expression.ExprClassName): Make member function.
2087 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
2088 a namespace. Remove creation of dotted "SimpleName"s.
2089 (MemberAccess.DoResolve): Likewise.
2090 * decl.cs (DeclSpace.Cache): Make private.
2091 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
2092 (DeclSpace.FindType): Update.
2093 (DeclSpace.LookupType): Move here from RootContext. Return a
2094 FullNamedExpression.
2095 * namespace.cs (Namespace): Derive from FullNamedExpression
2096 so that it can be part of expression resolution.
2097 (Namespace.Lookup): Return an FullNamedExpression.
2098 (NamespaceEntry.LookupAlias): Lookup aliases only in current
2100 * rootcontext.cs (NamespaceLookup): Remove.
2101 (LookupType): Move to DeclSpace.
2102 * attribute.cs (CheckAttributeType): Update.
2103 * doc.cs (FindDocumentedType): Remove allowAlias argument.
2104 (FindDocumentedTypeNonArray): Likewise.
2106 2005-01-11 Raja R Harinath <rharinath@novell.com>
2108 Fix cs0509.cs, cs1632.cs.
2109 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
2110 is the same as IsInterface.
2111 (TypeContainer.GetClassBases): Likewise.
2112 * statement.cs (LabeledStatement.ig): New field.
2113 (LabeledStatement.LabelTarget): Save ILGenerator which created the
2115 (LabeledStatement.DoEmit): Check that the label was created with
2116 the same ILGenerator.
2118 2005-01-10 Marek Safar <marek.safar@seznam.cz>
2121 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
2122 accessors to its properties.
2124 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
2125 from accessors to property.
2127 2005-01-10 Marek Safar <marek.safar@seznam.cz>
2130 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
2133 2005-01-08 Miguel de Icaza <miguel@ximian.com>
2135 * attribute.cs: Check for null and empty strings.
2137 I have lost another battle to Paolo.
2139 2005-01-07 Marek Safar <marek.safar@seznam.cz>
2142 * class.cs (PropertyMethod): Set Parent field in ctors.
2143 (SetMethod.InternalParameters): Add unsafe switch hack.
2144 Override MarkForDuplicationCheck where it is appropriate.
2146 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
2147 It says whether container allows members with the same name.
2149 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
2150 Removed is_method parameter.
2152 2005-01-06 Duncan Mak <duncan@ximian.com>
2154 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
2155 because the previous change led to incorrect reporting of CS1032
2156 ("Cannot define/undefine preprocessor symbols after first token in
2157 file"). Instead of using `tokens_seen' as the only flag that
2158 triggers CS1040, introduce `comments_seen'. This new flag is used
2159 to signify having seen comments on the current line, so it is
2160 unset after a newline.
2162 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
2164 * doc.cs : When searching for a type, find nested type too.
2165 This fixes bug #71040.
2167 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
2170 - Warn missing member comment on those classes which also does not
2171 have doc comments. Fixed bug #71041.
2172 - Don't warn missing doc comment on default constructor.
2175 2005-01-06 Duncan Mak <duncan@ximian.com>
2177 * cs-tokenizer.cs (xtoken): After handling traditional C-style
2178 comments, set `tokens_seen' to true. This allows us to detect
2179 misplaced preprocessor directives (i.e. not at the beginning of
2180 the a line, nor after whitespaces). In that case, report error
2181 CS1040. This fixes bug #56460.
2183 * cs-parser.jay (interface_member_declaration): Add checks for
2184 IsExplicitImpl, and report CS0541 error if an interface member is
2185 defined as an explicit interface declaration.
2187 2005-01-06 Marek Safar <marek.safar@seznam.cz>
2190 * class.cs (PropertyMethod): Set Parent field in ctors.
2191 (SetMethod.InternalParameters): Add unsafe switch hack.
2193 * decl.cs (MemberCore.Parent): Cannot be readonly.
2195 2005-01-06 Raja R Harinath <rharinath@novell.com>
2197 * decl.cs (DeclSpace.ResolveType): Remove.
2198 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
2199 Merge in code from ...
2200 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
2201 * class.cs, enum.cs: Update to changes.
2203 2005-01-06 Miguel de Icaza <miguel@ximian.com>
2205 * anonymous.cs: Ensure that we init the scope of our parent if it
2206 has not been initialized yet.
2208 2004-12-30 Duncan Mak <duncan@ximian.com>
2210 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
2211 if field.FieldBuilder is null. Fixes #70758.
2213 * convert.cs: Fixed some typos and updated some of the comments.
2214 (ImplicitStandardConversionExists):
2215 (TryImplicitIntConversion): If `target_type' is an interface and
2216 the type of `ic' implements this interface, return true or a new
2217 BoxedCast instead of null. This fixes #70468.
2219 2004-12-29 Duncan Mak <duncan@ximian.com>
2221 * expression.cs (Argument.Emit): Check that Expr is
2222 IMemoryLocation before casting to it, and report CS1510 otherwise.
2226 2004-12-21 Ben Maurer <bmaurer@ximian.com>
2228 * statement.cs (Block.ThisVariable): remove the recursion here, to
2229 make the --profile more sane.
2231 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
2233 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
2234 assembly, by JB Evain.
2236 2004-12-17 Raja R Harinath <rharinath@novell.com>
2238 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
2239 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
2240 "parent" refers to enclosing type/class. "base" refers to superclass.
2242 2004-12-17 Raja R Harinath <rharinath@novell.com>
2244 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
2245 Ensure that we only have GlobalAttributes.
2246 * attribute.cs (Attribute.Emit): Make non-virtual.
2247 (GlobalAttribute.Emit): Remove.
2248 (Attribute.Resolve): Make virtual.
2249 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
2250 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
2251 the argument. Don't create one.
2252 (Attribute.GetObsoleteAttribute): Likewise.
2253 (Attribute.GetClsCompliantAttributeValue): Likewise.
2254 * class.cs, decl.cs: Update to changes.
2256 2004-12-17 Marek Safar <marek.safar@seznam.cz>
2258 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
2260 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
2262 * statement.cs (Foreach.Resolve): Add error 186 report.
2264 2004-12-16 Marek Safar <marek.safar@seznam.cz>
2266 * expression.cs (Conditional.DoResolve): Add warning 429.
2268 * statement.cs (If.Resolve): Add warning 665.
2270 2004-12-16 Raja R Harinath <rharinath@novell.com>
2272 New invariant: RootContext.Tree.Types.NamespaceEntry == null
2273 except when in the parser, and in GlobalAttribute.
2274 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
2275 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
2276 RootContext.Tree.Types.NamespaceEntry once work is done.
2277 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
2278 and resets RootContext.Tree.Types.NamespaceEntry.
2280 2004-12-15 Marek Safar <marek.safar@seznam.cz>
2282 * cs-parser.jay: Don't create a block for every variable.
2284 2004-12-14 Miguel de Icaza <miguel@ximian.com>
2286 * location.cs: Provide extra information.
2288 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
2289 variables from the captured environment, it is the ldarg_0.
2291 2004-12-14 Marek Safar <marek.safar@seznam.cz>
2293 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
2296 * class.cs: Changed warning level for 169 to avoid developer
2297 displeasure from warning flooding. It will be changed back when they
2298 fix most of current BCL warnings.
2300 * RootContext.cs: Pushed default WarningLevel to 3.
2302 * statement.cs: Removed unused variable.
2304 2004-12-14 Marek Safar <marek.safar@seznam.cz>
2306 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
2307 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
2308 Add error 502 report.
2309 (StaticClass.DefineType): Add error 441 report.
2310 (Class.AllowedModifiersProp): New virtual property as temporary
2311 extension to AllowedModifiers.
2312 (Class.DefineType): Add error 418 report. Moved ModFlags check here
2313 to share implementation with StaticClass and don't call virtual
2316 * driver.cs (MainDriver): Add error 1558 test.
2318 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
2319 report. Moved error 36 test here.
2321 * statement.cs (Throw.Resolve): Add error 724 report.
2323 * typemanager.cs: Add out_attribute_type core type.
2325 2004-12-13 Marek Safar <marek.safar@seznam.cz>
2327 * class.cs (TypeContainer.VerifyClsCompliance): Add error
2329 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
2331 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
2334 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
2336 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
2337 Add error 3023 report.
2338 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
2340 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
2343 2004-12-12 John Luke <john.luke@gmail.com>
2345 * driver.cs (AddArgs): take -- into account when
2346 adding arguments, fixes bug 65710
2348 2004-12-12 Martin Baulig <martin@ximian.com>
2350 * expression.cs (Unary.TryReduceNegative): Added support for
2351 SByteConstant and ByteConstant.
2352 (Unary.Reduce): Check error values from TryReduceNegative().
2354 2004-12-10 Marek Safar <marek.safar@seznam.cz>
2356 * attributes.cs (Attribute.Resolve): Avoid multiple error report
2357 and report exception as error 182.
2359 2004-12-10 Raja R Harinath <rharinath@novell.com>
2361 * driver.cs (Main): Fix message when there are warnings.
2363 2004-12-09 Miguel de Icaza <miguel@ximian.com>
2365 * delegate.cs: Fixed my fix from yesterday, sorry about that.
2367 2004-12-09 Marek Safar <marek.safar@seznam.cz>
2369 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
2370 Reduced number of warnings.
2372 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
2374 2004-12-08 Miguel de Icaza <miguel@ximian.com>
2376 * driver.cs: Removed message.
2378 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
2380 2004-12-08 <vargaz@freemail.hu>
2382 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
2384 2004-12-08 Martin Baulig <martin@ximian.com>
2386 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
2387 instead of a CS3002 for properties and indexer.
2389 2004-12-08 Martin Baulig <martin@ximian.com>
2391 * decl.cs (MemberName.ToString): Make this work again.
2393 2004-12-08 Marek Safar <marek.safar@seznam.cz>
2395 * attribute.cs (Resolve): Add error 591 detection.
2397 * class.cs (FieldMember.Define): Add error 1547 detection.
2398 (Indexer.Define): Add error 620 detection.
2399 (Operator.Define): Add error 590 detection.
2401 * ecore.cs: Missing argument for error 79.
2403 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
2406 2004-12-07 Marek Safar <marek.safar@seznam.cz>
2409 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
2412 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
2414 * cs-parser.jay : handle doc comments on implicit/explicit operators.
2415 Some operator comments were suppressed.
2416 * doc.cs : Implicit/explicit operator name in doc comments are like
2417 "op_Explicit(type)~returnType", so added suffix handling.
2419 2005-01-21 Alp Toker <alp@atoker.com>
2421 * cs-parser.jay: destructor_declaration's container is PartialContainer
2422 not Class when partial types are used, so use Kind prop instead of 'is'.
2424 2004-12-12 Martin Baulig <martin@ximian.com>
2426 * expression.cs (Unary.TryReduceNegative): Added support for
2427 SByteConstant and ByteConstant.
2428 (Unary.Reduce): Check error values from TryReduceNegative().
2430 2004-12-11 Martin Baulig <martin@ximian.com>
2432 * support.cs (ReflectionParameters.ParameterName): If we have a
2433 `gpd', call `ParameterName' on it.
2435 * parameter.cs (Parameter.GetParameterAttributes): New static method.
2437 * pending.cs (PendingImplementation.DefineProxy): Call
2438 DefineParameter() for all of the MethodBuilder's arguments.
2440 2004-12-09 Martin Baulig <martin@ximian.com>
2442 * doc.cs (DocUtil): Make this a static class.
2444 2004-12-09 Martin Baulig <martin@ximian.com>
2446 * expression.cs (Invocation.InferType): Moved the type inference
2447 implementation into TypeManager.
2449 * generics.cs (TypeManager): Moved the type inference
2450 implementation here.
2452 2004-12-09 Martin Baulig <martin@ximian.com>
2454 * typemanager.cs (TypeManager): Make this a partial class.
2457 (TypeManager): Move the generics part of `TypeManager' here.
2459 2004-12-08 Martin Baulig <martin@ximian.com>
2461 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
2462 instead of a CS3002 for properties and indexer. Added CS3024
2463 check for generic interfaces.
2465 * attributes.cs (AttributeTester.AnalyzeTypeCompliance): Generic
2466 instances are not CLS-compliant.
2468 2004-12-08 Martin Baulig <martin@ximian.com>
2471 (void_pointer_expression): New rule for `void*', `void**' etc.
2472 (typeof_expression): Add `void_pointer_expression'; fixes #66846.
2474 2004-12-08 Martin Baulig <martin@ximian.com>
2476 * expression.cs (Invocation.InferType): Removed the hack for
2477 MethodCore.MayUnify().
2479 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Make
2482 * class.cs (MethodCore.MayUnify): Use
2483 TypeManager.MayBecomeEqualGenericTypes().
2485 2004-12-08 Martin Baulig <martin@ximian.com>
2487 * expression.cs (Is.DoResolve, As.DoResolve): If we're a type
2488 parameter, box it. Fixes #69233.
2490 2004-12-08 Martin Baulig <martin@ximian.com>
2492 * generic.cs (ConstructedType.CheckConstraints): Valuetypes always
2493 have the ctor constraint. Fixes #68326.
2495 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
2497 * cs-parser.jay : interface comment was not consumed because of
2498 extra opt_semicolon before doc handling.
2500 2004-12-03 Raja R Harinath <rharinath@novell.com>
2502 Fix test-327.cs, test-328.cs, and put in early infrastructure
2503 for eventually fixing #52697.
2504 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
2505 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
2507 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
2508 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
2509 (VerifyUsing, error246): Update.
2510 * rootcontext.cs (RootContext.NamespaceLookup): Just use
2511 'NamespaceEntry.LookupNamespaceOrType'.
2513 2004-12-07 Martin Baulig <martin@ximian.com>
2515 * driver.cs: Call it "BETA SOFTWARE" :-)
2517 2004-12-06 Raja R Harinath <rharinath@novell.com>
2519 Fix crash on cs0657-17.cs.
2520 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
2521 Use RootContext.Tree.Types, not 'new RootTypes ()'.
2522 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
2523 the case where the NamespaceEntry gets overwritten.
2525 2004-12-06 Marek Safar <marek.safar@seznam.cz>
2527 Fixed #69195, #56821
2528 * ecore.cs (ResolveBoolean): Tiny refactoring.
2530 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
2531 of right expression resolving when left is false constant and
2532 operator is LogicalAnd OR true constant and operator is LogicalOr.
2534 * statement.cs (ResolveUnreachable): Always reports warning.
2536 2004-12-05 Miguel de Icaza <miguel@ximian.com>
2538 * class.cs: Distinguish between 1721 and 1722 (just a little help
2539 for the programmer).
2541 2004-12-03 Miguel de Icaza <miguel@ximian.com>
2543 * delegate.cs: Only allow this on new versions of the language.
2545 2004-12-02 Duncan Mak <duncan@ximian.com>
2547 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
2549 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
2550 here as a static method. Take an additional bool out parameter
2551 `must_do_cs1540_check' for signaling to InstanceResolve.
2552 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
2553 member field from PropertyExpr class and made it an argument of
2555 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
2556 check for MarshalByRefObject, and report CS0122 instead of CS1540.
2557 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
2558 and `remove_accessor' as well as InstanceResolve: report CS0122
2563 2004-12-07 Martin Baulig <martin@ximian.com>
2565 * decl.cs (DeclSpace.AddToContainer): Report correct errors CS0694
2566 and CS0692 where appropriate.
2568 2004-12-06 Martin Baulig <martin@ximian.com>
2570 * class.cs (MethodCore.MayUnify): Moved the CS0408 check here from
2571 IsDuplicateImplementation() and improved it.
2573 * expression.cs (Invocation.InferTypeArguments): Added
2574 `Type[] inferred_class_types' argument (for MethodCore.MayUnify)
2575 and removed the "ref" modifier from `infered_types'.
2577 * decl.cs (MemberName.ToString): Removed the exception.
2579 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
2581 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
2582 comments are allowed.
2584 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
2586 * delegate.cs: Add checks for subtypes in paramaters and return values
2587 in VerifyMethod () to add support for Covariance/Contravariance
2590 2004-12-02 Miguel de Icaza <miguel@ximian.com>
2592 * report.cs: Remove extra closing parenthesis.
2594 * convert.cs (Error_CannotImplicitConversion): If the name of the
2595 types are the same, provide some extra information.
2597 2004-12-02 Marek Safar <marek.safar@seznam.cz>
2600 * attribute.cs (Resolve): Improved implementation of params
2601 attribute arguments.
2603 * support.cs (ParameterData): Add HasParams to be faster.
2605 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
2607 all things are for /doc support:
2609 * doc.cs: new file that supports XML documentation generation.
2610 * mcs.exe.sources: added doc.cs.
2612 Handle /doc command line option.
2613 Report error 2006 instead of 5 for missing file name for /doc.
2614 Generate XML documentation when required, after type resolution.
2616 Added support for picking up documentation (/// and /** ... */),
2617 including a new XmlCommentState enumeration.
2619 Added lines to fill Documentation element for field, constant,
2620 property, indexer, method, constructor, destructor, operator, event
2621 and class, struct, interface, delegate, enum.
2622 Added lines to warn incorrect comment.
2624 Added Documentation field (passed only when /doc was specified).
2626 Added DocComment, DocCommentHeader, GenerateDocComment() and
2627 OnGenerateDocComment() and some supporting private members for
2628 /doc feature to MemberCore.
2630 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
2632 Added overriden DocCommentHeader.
2634 Added overriden DocCommentHeader and GenerateDocComment().
2636 2004-12-01 Miguel de Icaza <miguel@ximian.com>
2638 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
2639 unwrapping the enumeration values, chain to
2640 DoConstantNumericPromotions again, so we can promote things to the
2641 fundamental types (takes care of enums that are bytes, sbytes).
2645 2004-12-01 Raja R Harinath <rharinath@novell.com>
2647 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
2648 Fix long-standing bug in type-lookup. Use FindType instead of
2649 LookupType when ec.ResolvingTypeTree.
2650 (Attribute.ResolveType, Attribute.Resolve)
2651 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
2653 (Attributes.Search): Remove internal version. Update.
2654 (Attributes.SearchMulti): Update.
2655 (Attributes.GetClsCompliantAttribute): Remove.
2656 (Attributes.GetIndexerNameAttribute): Remove.
2657 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
2658 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
2659 * class.cs (Indexer.Define): Likewise.
2661 2004-12-01 Marek Safar <marek.safar@seznam.cz>
2664 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
2665 MarshallByReference members access.
2667 * expression.cs: Use CheckMarshallByRefAccess;
2668 Better error CS0197 message.
2670 * report.cs: Print whole related error message.
2672 2004-11-29 Marek Safar <marek.safar@seznam.cz>
2674 * class (GetClassBases): Better error 60 report.
2675 (EventProperty): Disabled warning 67 detection.
2677 2004-11-29 Marek Safar <marek.safar@seznam.cz>
2680 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
2682 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
2685 2004-11-29 Marek Safar <marek.safar@seznam.cz>
2688 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
2690 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
2692 2004-11-26 Miguel de Icaza <miguel@ximian.com>
2694 * attribute.cs (Attribute.Resolve): Refine error reporting and
2695 report a cs0117 if the identifier does not exist, to distinguish
2696 from 0617 which is a miss-use of the actual identifier.
2698 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
2699 between cs0070 and cs0079.
2701 * class.cs (MemberBase.DoDefine): When reporting a wrong
2702 accessibility level, we use MethodCore to compare instead of
2703 Method (this was a regression in some refactoring effort).
2705 So now we correctly report cs0056 again.
2707 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
2708 testing the target_type (which was known to be object_type) and
2709 not the source type (which is anonymous_method).
2711 Fixed reporting of error cs1660.
2713 * expression.cs (UserCast.Source): Expose the underlying cast.
2715 * statement.cs (Switch.SwitchGoverningType): Sort the list of
2716 allowed types to find a match to int32 first (most common).
2718 In addition, it ignores any ImplicitUserConversions that did an
2719 internal implicit conversion (as the switch statement allows only
2720 one integral conversion to exist).
2722 * class.cs (PartialContainer.Create): rename `name' to
2723 `member_name' for clarity. Then replace the string calls with a
2724 call to MemberName.GetPartialName, as now using
2725 MemberName.ToString is an error (this is due to the side effects
2726 it had, that were fixed in the past).
2728 This will restore the error reporting on a number of partial class
2729 errors that were missusing this (and getting an exception as a
2730 results, which is now just a plain textual warning, because
2731 yyparse debug output would crash otherwise).
2733 2004-11-26 Raja R Harinath <rharinath@novell.com>
2735 * Makefile (PROGRAM_INSTALL_DIR): Remove.
2737 2004-11-25 Ben Maurer <bmaurer@ximian.com>
2739 * rootcontext.cs (LookupType): Make sure to cache lookups that
2740 don't give us a negative result. This saves about 5% of corlib
2743 2004-11-25 Miguel de Icaza <miguel@ximian.com>
2745 * report.cs (AbstractMessage.Print): messages are sent to stderr
2747 * class.cs (TypeContainer.GetClassBases): It is an error to have a
2748 non-interface in the list of interfaces (at this point, either
2749 parent was properly set, or a base class is being listed in the
2750 interfaces section).
2752 This flags error 1722, and resolves the crash from bug 69259.
2754 2004-11-25 Ben Maurer <bmaurer@ximian.com>
2756 * statement.cs (Using.EmitExpressionFinally): make this work right
2757 for valuetypes. Fixes 69926.
2759 2004-11-25 Miguel de Icaza <miguel@ximian.com>
2761 * const.cs (Const.ChangeType): Cope with the "0 literal can be
2762 converted to an enum" here, before we try to change the underlying
2763 type. This code exists, but it is a different code path than the
2764 one used while encoding constants.
2766 (ImplicitReferenceConversionExists): In addition, resynchronized
2767 the code here, so it matches the same code in
2768 ImplicitReferenceConversionExists for the `from any class-type S
2769 to any interface-type T'.
2771 2004-11-25 Marek Safar <marek.safar@seznam.cz>
2773 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
2775 2004-11-24 Miguel de Icaza <miguel@ximian.com>
2777 * cs-parser.jay: Use verbosity accordingly.
2779 2004-11-24 Marek Safar <marek.safar@seznam.cz>
2781 * expression.cs (Unary.ResolveOperator): Do not report warning;
2782 AddressOf reads from variable.
2784 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
2786 2004-11-24 Marek Safar <marek.safar@seznam.cz>
2790 * attribute.cs (Attributable): Removed CheckTargets.
2791 (Attributes.Emit): Explicit attribute targets are tested here.
2793 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
2794 not enabled for interfaces.
2796 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
2797 (GetAssemblyName): Ouch next bug there.
2799 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
2801 * expression.cs: Error 275 added.
2803 2004-11-23 Marek Safar <marek.safar@seznam.cz>
2805 Fix bug #69177 (Implemented decimal constant support)
2807 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
2808 (BinaryFold): Add DecimalConstant.
2810 * const.cs (Define): Decimal constant
2812 (ChangeType): Add decimal type handling.
2813 (LookupConstantValue): Don't set value for decimal type but
2814 emit DecimalConstantAttribute. Needed for constant optimization.
2816 * constant.cs (ToDecimal): New method.
2817 (ConvertToDecimal): New method.
2818 (IntConstant): Implemented ConvertToDecimal.
2819 (DecimalConstant.Emit): Emit optimized version for decimals in
2822 * expression.cs (ResolveOperator): Changed order of constant
2823 reduction to work correctly with native types which have
2824 overloaded operators.
2825 (ResolveMemberAccess): Extract constant value from attribute
2828 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
2830 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
2831 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
2832 (ChangeType): Decimal is special.
2833 (TypeToCoreType): Add decimal type.
2835 2004-11-22 Marek Safar <marek.safar@seznam.cz>
2837 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
2840 2004-11-22 Marek Safar <marek.safar@seznam.cz>
2842 * class.cs (EventField.ApplyAttributeBuilder): Fix error
2845 2004-11-19 Marek Safar <marek.safar@seznam.cz>
2847 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
2849 * pending.cs (PendingImplementation): Grab only interfaces.
2851 2004-11-19 Marek Safar <marek.safar@seznam.cz>
2853 * statement.cs (ForeachHelperMethods): Add location member and
2854 error 202 detection.
2856 2004-11-18 Marek Safar <marek.safar@seznam.cz>
2858 * expression.cs (DoResolveBase): Fixed wrong warning for out
2861 2004-12-04 Martin Baulig <martin@ximian.com>
2863 * convert.cs (Convert.TypeParameter_to_Null): Use the constraints
2864 to check whether the conversion is ok.
2866 * typemanager.cs (TypeManager.GetTypeArguments): Just return
2867 `Type.EmptyTypes' if we're not a generic TypeContainer.
2869 2004-11-25 Miguel de Icaza <miguel@ximian.com>
2871 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
2872 old bug: when converting from the null literal to a pointer,
2873 return an EmptyCast, not the NullLiteral.
2875 This fixes #69921, the recent null_type changes probably made this
2878 2004-12-03 Martin Baulig <martin@ximian.com>
2880 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
2881 method as our child, call AnonymousMethod.Compatible() on it.
2883 2004-12-02 Miguel de Icaza <miguel@ximian.com>
2885 * class.cs (FieldBase): Use an unused bit field from the field to
2886 encode the `has_offset' property from the FieldMember. This saves
2887 a couple of Ks on bootstrap compilation.
2889 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
2890 method as our child, return the AnonymousMethod resolved
2893 * expression.cs (New.DoResolve): Allow return values from
2894 NewDelegate to also include AnonymousMethods.
2898 2004-11-29 Raja R Harinath <rharinath@novell.com>
2900 * decl.cs (MemberCore.MemberName): Remove readonly to fix an error
2902 * rootcontext.cs (ResolveCore::interfaces_first_stage): Add
2903 System.Runtime.InteropServices._Exception, since it's a base
2904 interface of the core type System.Exception in the net_2_0 profile.
2906 2004-11-27 Martin Baulig <martin@ximian.com>
2908 * ecore.cs (Expression.StoreFromPtr): Use `stobj' for generic parameters.
2910 2004-11-26 Raja R Harinath <rharinath@novell.com>
2912 * Makefile: Convert to use executable.make.
2913 * gmcs.exe.sources: New.
2915 2004-11-25 Martin Baulig <martin@ximian.com>
2917 * expression.cs (Invocation.InferType): Added support for byref types.
2919 2004-11-25 Martin Baulig <martin@ximian.com>
2921 * statement.cs (Foreach.FetchMethodMoveNext): Wrap `mi.ReturnType'
2922 in TypeManager.TypeToCoreType().
2924 2004-11-25 Martin Baulig <martin@ximian.com>
2926 * iterators.cs (Iterator.DoDefineMembers): Override and lookup the
2927 "Dispose" method from the `current_type'.
2928 (Iterator.EmitMoveNext): Use the `dispose_method' we looked up in
2929 DoDefineMembers() instead of using the MethodBuilder; this is
2930 required for generic iterators.
2932 * class.cs (TypeContainer.DoDefineMembers): Make this virtual.
2934 2004-11-24 Martin Baulig <martin@ximian.com>
2936 * ecore.cs (Expression.LoadFromPtr): Use `ldobj' for generic parameters.
2938 2004-11-20 Martin Baulig <martin@ximian.com>
2940 * expression.cs (Invocation.InferType): Correctly infer generic
2941 instances; see gen-103.cs.
2942 (Invocation.InferTypeArguments): If a generic method doesn't have
2943 any unbound type parameters, we don't need to infer anything.
2945 2004-11-19 Raja R Harinath <rharinath@novell.com>
2947 * Makefile (gmcs.exe): Update to new location of bootstrap mcs.exe.
2949 2004-11-17 Raja R Harinath <rharinath@novell.com>
2951 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
2952 (TypeHandle.GetMemberCache): New.
2953 (TypeHandle.TypeHandle): Update.
2954 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
2955 (TypeManager.LookupParentInterfacesCache):
2956 Rename from LookupInterfaceCache. Optimize slightly.
2957 (TypeManager.MemberLookup_FindMembers): Update.
2958 * decl.cs (MemberCache.MemberCache): Set Container to null in the
2960 (AddCacheContents): Rename from AddHashtable.
2961 * class.cs (TypeContainer.parent_container): Remove.
2962 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
2963 (TypeContainer.DoDefineMembers): Don't initialize it.
2964 Update to name changes.
2966 2004-11-17 Miguel de Icaza <miguel@ximian.com>
2968 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
2969 that factors the code to check access modifiers on override.
2971 (PropertyBase): Use the code here.
2973 Patch from Lluis S'anchez, fixes bug #69361.
2975 2004-11-15 Miguel de Icaza <miguel@ximian.com>
2977 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
2978 routine that is used to report the use of a captured variable
2979 whose address has been taken.
2981 There are two checks: one when variables are being captured and
2982 the other check is when the address of a variable is taken.
2984 (because an anonymous methods might be resolved before *or* after
2985 the address has been taken) and
2987 * expression.cs (Conditional.DoResolve): Remove the special
2988 casing that Martin added to trueExpr and falseExpr being both
2989 NullLiteral. We get the right behavior now just by introducing
2990 the null_type into the compiler.
2992 * convert.cs (ExplicitConversion): Change the code to use
2993 null_type instead of testing `expr is NullLiteral'.
2994 (ImplicitConversionStandard): use null_type too.
2995 (ImplicitReferenceConversionExists): use null_type too.
2996 (ImplicitReferenceConversion): use null_type too.
2998 * literal.cs: The type of `NullLiteral' is now null_type instead
3000 (Resolve): Set the type here.
3002 * typemanager.cs: Introduce null_type.
3004 2004-11-18 Martin Baulig <martin@ximian.com>
3007 (RootContext.LookupType): Return a `Type', not a `TypeExpr'.
3009 2004-11-18 Martin Baulig <martin@ximian.com>
3011 * ecore.cs (TypeExpr.DoResolveAsTypeStep): Make this protected.
3013 2004-11-18 Martin Baulig <martin@ximian.com>
3015 * generic.cs (Constraints.Resolve): Take an `EmitContext' instead
3016 of a `DeclSpace'. If one of our constraints is a `ConstructedType',
3017 call ResolveConstructedType() on it to resolve it without checking
3019 (Constraints.ResolveTypes): Check them here.
3020 (ConstructedType.DoResolveAsTypeStep): Fully resolve ourselves,
3021 but don't check constraints.
3022 (ConstructedType.ResolveAsTypeTerminal): Override this and also
3023 check constraints here.
3024 (ConstructedType.ResolveConstructedType): New public method. This
3025 is called from DoResolveAsTypeStep() and Constraints.Resolve() to
3026 resolve ourselves without checking constraints.
3028 * ecore.cs (Expression.ResolveAsTypeTerminal): Make this virtual.
3030 2004-11-18 Martin Baulig <martin@ximian.com>
3033 (DeclSpace.CurrentType): Changed type from `TypeExpr' to `Type'.
3035 * delegate.cs (Delegate.DefineType): Always create the EmitContext.
3037 2004-11-18 Martin Baulig <martin@ximian.com>
3039 * ecore.cs (TypeExpr.ResolveType): Removed.
3040 (Expression.ResolveAsTypeTerminal): We always return a fully
3041 resolved `TypeExpr', so we can just access its `Type'.
3043 * class.cs (TypeContainer.DefineType): Resolve `CurrentType' here.
3045 2004-11-17 Martin Baulig <martin@ximian.com>
3047 * ecore.cs (IAlias.Type): Replaced with ResolveAsType() to make
3048 sure we don't return any unresolved TypeExpr's.
3049 (TypeAliasExpression): The .ctor now takes an `IAlias' instead of
3051 (Expression.ResolveAsTypeTerminal): Make sure `te.Type != null'.
3053 * expression.cs (MemberAccess.ResolveAsTypeStep): Don't return any
3054 unresolved `ConstructedType's.
3056 2004-11-17 Martin Baulig <martin@ximian.com>
3058 * ecore.cs (TypeExpr.ResolveType): Don't make this virtual.
3060 2004-11-17 Martin Baulig <martin@ximian.com>
3063 (Expression.ResolveAsTypeTerminal): Removed the `bool silent' argument.
3065 * decl.cs (DeclSpace.ResolveType): Removed.
3066 (DeclSpace.ResolveTypeExpr): Removed the `bool silent' argument.
3068 2004-11-17 Martin Baulig <martin@ximian.com>
3070 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
3071 direction, like FindMembers() does. Fixes #69546, testcase is in
3074 2004-11-16 Martin Baulig <martin@ximian.com>
3076 This is based on a patch from Marek Safar, see bug #69082.
3077 Fixes bugs #63705 and #67130.
3079 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
3080 method; create a MemberCache for an interface type and cache the
3083 * decl.cs (IMemberContainer.ParentContainer): Removed.
3084 (IMemberContainer.ParentCache): New property.
3085 (MemberCache.SetupCacheForInterface): Removed.
3086 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
3087 to create a cache for an interface's "parent".
3089 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
3092 2004-11-14 Ben Maurer <bmaurer@ximian.com>
3094 * statement.cs: Avoid adding bools to a hashtable.
3096 2004-11-15 Martin Baulig <martin@ximian.com>
3098 * decl.cs (MemberName.GetPartialName): Removed, use GetTypeName() instead.
3100 2004-11-11 Martin Baulig <martin@ximian.com>
3102 * typemanager.cs (TypeManager.GetMethodName): New method.
3104 * class.cs (MethodData.Define): Include the generic arity in the
3105 name of an explicit interface; also add it to the method name.
3107 * pending.cs (PendingImplementation.InterfaceMethod): The method
3108 name now includes the generic arity.
3110 2004-11-07 Miguel de Icaza <miguel@ximian.com>
3112 * expression.cs (Invocation.OverloadResolve): Flag error if we are
3113 calling an unsafe method from a safe location.
3115 2004-11-06 Marek Safar <marek.safar@seznam.cz>
3118 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
3120 2004-11-06 Miguel de Icaza <miguel@ximian.com>
3122 * namespace.cs (VerifyUsing): use GetPartialName instead of
3125 2004-11-05 Miguel de Icaza <miguel@ximian.com>
3127 * statement.cs (Return.Resolve): Fix regression in typo: if
3128 `in_exc', we have to request a NeedReturnLabel, this was a typo
3129 introduced in the anonymous method check-in. Fixes #69131.
3131 * Indexers were using the ShortName when defining themselves,
3132 causing a regression in the compiler bootstrap when applying the
3133 patch from 2004-11-02 (first part), now they use their full name
3134 and the bug is gone.
3136 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
3138 * driver.cs: Strip the path from the names of embedded resources. Fixes
3141 2004-11-04 Raja R Harinath <rharinath@novell.com>
3143 Fix error message regression: cs0104-2.cs.
3144 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
3145 (AliasEntry.Resolve): Update.
3146 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
3148 (RootContext.LookupType): Update.
3150 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
3152 * cs-parser.jay: Add support for handling accessor modifiers
3153 * class: Add support port accessor modifiers and error checking,
3154 define PropertyMethod.Define as virtual (not abstract anymore)
3155 * ecore.cs: Add checking for proeprties access with access modifiers
3156 * iterators.cs: Modify Accessor constructor call based in the modified
3158 2004-11-02 Ben Maurer <bmaurer@ximian.com>
3160 * expression.cs (StringConcat): Handle being called twice,
3161 as when we have a concat in a field init with more than two
3164 2004-11-02 Miguel de Icaza <miguel@ximian.com>
3166 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
3167 special case explicit implementations, we should always produce
3168 the .property or .event declaration.
3170 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
3171 since it will not return correct data if people use this
3172 unresolved in the presence of using statements (see test-313).
3174 * class.cs (MethodData.Define): If we are an explicit interface
3175 implementation, set the method name to the full name of the
3176 interface plus the name of the method.
3178 Notice that using the method.MethodName.GetFullName() does not
3179 work, as it will only contain the name as declared on the source
3180 file (it can be a shorthand in the presence of using statements)
3181 and not the fully qualifed type name, for example:
3185 class D : ICloneable {
3186 object ICloneable.Clone () {
3190 Would produce a method called `ICloneable.Clone' instead of
3191 `System.ICloneable.Clone'.
3193 * namespace.cs (Alias.Resolve): Use GetPartialName.
3195 2004-11-01 Marek Safar <marek.safar@seznam.cz>
3197 * cs-parser.jay: Add error 1055 report.
3199 2004-11-01 Miguel de Icaza <miguel@ximian.com>
3201 * assign.cs (Assign.DoResolve): Only do the transform of
3202 assignment into a New if the types are compatible, if not, fall
3203 through and let the implicit code deal with the errors and with
3204 the necessary conversions.
3206 2004-11-01 Marek Safar <marek.safar@seznam.cz>
3208 * cs-parser.jay: Add error 1031 report.
3210 * cs-tokenizer.cs: Add location for error 1038.
3212 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3214 * cs-parser.jay: Add error 1016 report.
3216 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3218 * cs-parser.jay: Add errors 1575,1611 report.
3220 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3222 * cs-parser.jay: Add error 1001 report.
3224 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3227 * attribute.cs (GetMarshal): Add method argument for
3228 caller identification.
3230 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
3231 agument for GetMarshal and RuntimeMissingSupport.
3233 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3235 * attribute.cs (ExtractSecurityPermissionSet): Removed
3236 TypeManager.code_access_permission_type.
3238 * typemanager.cs: Removed TypeManager.code_access_permission_type.
3240 2004-10-27 Miguel de Icaza <miguel@ximian.com>
3242 * expression.cs (LocalVariableReference.DoResolveLValue): Check
3243 for obsolete use of a variable here. Fixes regression on errors
3244 cs0619-25 and cs0619-26.
3246 2004-10-27 Marek Safar <marek.safar@seznam.cz>
3248 Fix #62358, implemented security attribute encoding.
3250 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
3251 Tests permitted SecurityAction for assembly or other types.
3252 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
3253 data from SecurityPermissionAttribute to PermisionSet class.
3255 * class.cs (ApplyAttributeBuilder): Added special handling
3256 for System.Security.Permissions.SecurityAttribute based types.
3258 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
3259 special handling for System.Security.Permissions.SecurityAttribute
3262 * enum.cs (ApplyAttributeBuilder): Added special handling
3263 for System.Security.Permissions.SecurityAttribute based types.
3265 * parameter.cs (ApplyAttributeBuilder): Added special handling
3266 for System.Security.Permissions.SecurityAttribute based types.
3268 * rootcontext.cs: Next 2 core types.
3270 * typemanager.cs (TypeManager.security_permission_attr_type):
3271 Built in type for the SecurityPermission Attribute.
3272 (code_access_permission_type): Build in type.
3274 2004-10-17 Miguel de Icaza <miguel@ximian.com>
3276 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
3277 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
3278 all of this information into
3279 EmitContext.EmitCapturedVariableInstance.
3281 * codegen.cs (EmitCapturedVariableInstance): move here the
3282 funcionality of emitting an ldarg.0 in the presence of a
3283 remapping. This centralizes the instance emit code.
3285 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
3286 then emit a load of this: it means that we have reached the
3287 topmost ScopeInfo: the one that contains the pointer to the
3288 instance of the class hosting the anonymous method.
3290 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
3291 captures to the topmost CaptureContext.
3293 2004-10-12 Miguel de Icaza <miguel@ximian.com>
3295 * expression.cs (LocalVariableReference): Move the knowledge about
3296 the iterators into codegen's EmitCapturedVariableInstance.
3298 2004-10-11 Miguel de Icaza <miguel@ximian.com>
3300 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
3301 all code paths return a value from an anonymous method (it is the
3302 same as the 161 error, but for anonymous methods).
3304 2004-10-08 Miguel de Icaza <miguel@ximian.com>
3306 The introduction of anonymous methods in the compiler changed
3307 various ways of doing things in the compiler. The most
3308 significant one is the hard split between the resolution phase
3309 and the emission phases of the compiler.
3311 For instance, routines that referenced local variables no
3312 longer can safely create temporary variables during the
3313 resolution phase: they must do so from the emission phase,
3314 since the variable might have been "captured", hence access to
3315 it can not be done with the local-variable operations from the runtime.
3319 (Block.Flags): New flag `IsTopLevel' to indicate that this block
3320 is a toplevel block.
3322 (ToplevelBlock): A new kind of Block, these are the blocks that
3323 are created by the parser for all toplevel method bodies. These
3324 include methods, accessors and anonymous methods.
3326 These contain some extra information not found in regular blocks:
3327 A pointer to an optional CaptureContext (for tracking captured
3328 local variables and parameters). A pointer to the parent
3331 (Return.Resolve): Catch missmatches when returning a value from an
3332 anonymous method (error 1662).
3333 Invoke NeedReturnLabel from the Resolve phase instead of the emit
3336 (Break.Resolve): ditto.
3338 (SwitchLabel): instead of defining the labels during the
3339 resolution phase, we now turned the public ILLabel and ILLabelCode
3340 labels into methods called GetILLabelCode() and GetILLabel() that
3341 only define the label during the Emit phase.
3343 (GotoCase): Track the SwitchLabel instead of the computed label
3344 (its contained therein). Emit the code by using
3345 SwitchLabel.GetILLabelCode ().
3347 (LocalInfo.Flags.Captured): A new flag has been introduce to track
3348 whether the Local has been captured or not.
3350 (LocalInfo.IsCaptured): New property, used to tell whether the
3351 local has been captured.
3353 * anonymous.cs: Vastly updated to contain the anonymous method
3356 The main classes here are: CaptureContext which tracks any
3357 captured information for a toplevel block and ScopeInfo used to
3358 track the activation frames for various local variables.
3360 Each toplevel block has an optional capture context associated
3361 with it. When a method contains an anonymous method both the
3362 toplevel method and the anonymous method will create a capture
3363 context. When variables or parameters are captured, they are
3364 recorded on the CaptureContext that owns them, for example:
3368 MyDelegate d = delegate {
3373 Here `a' will be recorded as captured on the toplevel
3374 CapturedContext, the inner captured context will not have anything
3375 (it will only have data if local variables or parameters from it
3376 are captured in a nested anonymous method.
3378 The ScopeInfo is used to track the activation frames for local
3379 variables, for example:
3381 for (int i = 0; i < 10; i++)
3382 for (int j = 0; j < 10; j++){
3383 MyDelegate d = delegate {
3388 At runtime this captures a single captured variable `i', but it
3389 captures 10 different versions of the variable `j'. The variable
3390 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
3391 recorded on a child.
3393 The toplevel ScopeInfo will also track information like the `this'
3394 pointer if instance variables were referenced (this is necessary
3395 as the anonymous method lives inside a nested class in the host
3396 type of the method).
3398 (AnonymousMethod): Expanded to track the Toplevel, implement
3399 `AnonymousMethod.Compatible' to tell whether an anonymous method
3400 can be converted to a target delegate type.
3402 The routine now also produces the anonymous method content
3404 (AnonymousDelegate): A helper class that derives from
3405 DelegateCreation, this is used to generate the code necessary to
3406 produce the delegate for the anonymous method that was created.
3408 * assign.cs: API adjustments for new changes in
3409 Convert.ImplicitStandardConversionExists.
3411 * class.cs: Adjustments to cope with the fact that now toplevel
3412 blocks are of type `ToplevelBlock'.
3414 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
3415 insteda of standard blocks.
3417 Flag errors if params arguments are passed to anonymous methods.
3419 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
3420 `CurrentAnonymousMethod' which points to the current Anonymous
3421 Method. The variable points to the AnonymousMethod class that
3422 holds the code being compiled. It is set in the new EmitContext
3423 created for the anonymous method.
3425 (EmitContext.Phase): Introduce a variable and an enumeration to
3426 assist in enforcing some rules about when and where we are allowed
3427 to invoke certain methods (EmitContext.NeedsReturnLabel is the
3428 only one that enfonces this right now).
3430 (EmitContext.HaveCaptureInfo): new helper method that returns
3431 whether we have a CapturedContext initialized.
3433 (EmitContext.CaptureVariable): New method used to register that a
3434 LocalInfo must be flagged for capturing.
3436 (EmitContext.CapturedParameter): New method used to register that a
3437 parameters must be flagged for capturing.
3439 (EmitContext.CapturedField): New method used to register that a
3440 field must be flagged for capturing.
3442 (EmitContext.HaveCapturedVariables,
3443 EmitContext.HaveCapturedFields): Return whether there are captured
3444 variables or fields.
3446 (EmitContext.EmitMethodHostInstance): This is used to emit the
3447 instance for the anonymous method. The instance might be null
3448 (static methods), this (for anonymous methods that capture nothing
3449 and happen to live side-by-side with the current method body) or a
3450 more complicated expression if the method has a CaptureContext.
3452 (EmitContext.EmitTopBlock): Routine that drives the emission of
3453 code: it will first resolve the top block, then emit any metadata
3454 and then emit the code. The split is done so that we can extract
3455 any anonymous methods and flag any captured variables/parameters.
3457 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
3458 during this phase, the ILGenerator should not be used as labels
3459 and local variables declared here might not be accessible to any
3460 code that is part of an anonymous method.
3462 Exceptions to this include the temporary variables that are
3463 created by some statements internally for holding temporary
3466 (EmitContext.EmitMeta): New routine, in charge of emitting all the
3469 (EmitContext.TemporaryReturn): This method is typically called
3470 from the Emit phase, and its the only place where we allow the
3471 ReturnLabel to be defined other than the EmitMeta. The reason is
3472 that otherwise we would have to duplicate a lot of logic in the
3473 Resolve phases of various methods that today is on the Emit
3476 (EmitContext.NeedReturnLabel): This no longer creates the label,
3477 as the ILGenerator is not valid during the resolve phase.
3479 (EmitContext.EmitThis): Extended the knowledge in this class to
3480 work in anonymous methods in addition to iterators.
3482 (EmitContext.EmitCapturedVariableInstance): This emits whatever
3483 code is necessary on the stack to access the instance to a local
3484 variable (the variable will be accessed as a field).
3486 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
3487 EmitContext.EmitAddressOfParameter): Routines to support
3488 parameters (not completed at this point).
3490 Removals: Removed RemapLocal and RemapLocalLValue. We probably
3491 will also remove the parameters.
3493 * convert.cs (Convert): Define a `ConstantEC' which points to a
3494 null. This is just to prefity some code that uses
3495 ImplicitStandardConversion code and do not have an EmitContext
3498 The idea is to flag explicitly that at that point in time, it is
3499 known that the conversion will not trigger the delegate checking
3500 code in implicit conversions (which requires a valid
3503 Everywhere: pass new EmitContext parameter since
3504 ImplicitStandardConversionExists now requires it to check for
3505 anonymous method conversions.
3507 (Convert.ImplicitStandardConversionExists): If the type of an
3508 expression is the anonymous_method_type, and the type is a
3509 delegate, we invoke the AnonymousMethod.Compatible method to check
3510 whether an implicit conversion is possible.
3512 (Convert.ImplicitConversionStandard): Only do implicit method
3513 group conversions if the language level is not ISO_1.
3515 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
3516 MethodInfo for the Invoke method. used by Delegate and
3519 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
3520 method conversions if the target type is a delegate.
3522 Removed extra debugging nops.
3524 (LocalVariableReference): Turn the `local_info' into a public
3527 Add `prepared' field, the same hack used for FieldExprs to cope
3528 with composed assignments, as Local variables do not necessarily
3529 operate purely on the stack as they used to: they can be captured
3532 Add `temp' for a temporary result, like fields.
3534 Refactor DoResolve and DoResolveLValue into DoResolveBase.
3536 It now copes with Local variables that are captured and emits the
3537 proper instance variable to load it from a field in the captured
3540 (ParameterReference.DoResolveBase): During the resolve phase,
3541 capture parameters if we are in an anonymous method.
3543 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
3544 anonymous method, use the EmitContext helper routines to emit the
3545 parameter reference.
3547 * iterators.cs: Set RemapToProxy to true/false during the
3550 * parameters.cs (GetParameterByName): New helper method.
3552 * typemanager.cs (anonymous_method_type) a new type that
3553 represents an anonyous method. This is always an internal type,
3554 used as a fencepost to test against the anonymous-methodness of an
3557 2004-10-20 Marek Safar <marek.safar@seznam.cz>
3559 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
3561 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
3563 2004-11-10 Martin Baulig <martin@ximian.com>
3565 * expression.cs (Invocation.BetterFunction): If two methods have
3566 equal parameter types, but only one of them is generic, the
3567 non-generic one wins.
3568 (New.DoResolve): Don't set `is_struct' to false if we're a generic
3569 instance; just use `Type.IsValueType' to determine whether
3570 something is a struct or not.
3571 (MemberAccess.DoResolveAsTypeStep): Don't modify the `args' field,
3572 so we can be called multiple times.
3574 2004-11-10 Martin Baulig <martin@ximian.com>
3576 * generic.cs (TypeParameter.DefineConstraints): New public method.
3577 (TypeParameter.CheckAccessLevel): Override this and return true.
3578 (ConstructedType.ResolveType): Renamed to DoResolveType(), don't
3579 override ResolveType() anymore.
3580 (ConstructedType.DoResolveAsTypeStep): Call DoResolveType() here.
3582 2004-11-10 Martin Baulig <martin@ximian.com>
3584 * rootcontext.cs (RootContext.LookupType): If we're a nested type,
3585 call DeclSpace.ResolveNestedType() on it.
3587 2004-11-10 Martin Baulig <martin@ximian.com>
3589 * support.cs (ReflectionParameters.ParameterModifier): If `gpd' is
3590 non-null, call ParameterModifier() on it.
3592 2004-11-10 Martin Baulig <martin@ximian.com>
3595 (Iterators): Added `current_type' and `this_type' fields.
3596 (Iterators.DefineIterator): Create a new EmitContext and store it
3597 in `ec'; compute `this_type'.
3599 2004-11-10 Martin Baulig <martin@ximian.com>
3602 (TypeManager.IsPrivateAccessible): New public method.
3603 (Closure.Filter): Use IsPrivateAccessible() instead of IsEqual().
3605 2004-11-10 Martin Baulig <martin@ximian.com>
3607 * class.cs (TypeContainer.DefineType): Call
3608 TypeBuilder.DefineGenericParameters() before resolving the type
3610 (MethodData.parent_method): New protected field.
3611 (MethodData..ctor): Added `MethodInfo parent_method' argument.
3612 (MethodData.Define): Compute `parent_method'.
3615 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
3616 (MemberCore.GetClsCompliantAttributeValue): Likewise.
3617 (DeclSpace.ec): New protected field; store the EmitContext here.
3618 (DeclSpace.EmitContext): New public property.
3619 (DeclSpace.ResolveType): Un-comment from the [Obsolte] attribute.
3620 (DeclSpace.ResolveNestedType): New public method.
3621 (DeclSpace.ResolveTypeExpr): Just call ResolveAsTypeTerminal() here.
3622 (DeclSpace.NestedAccessible): Added `Type tb' argument.
3623 (DeclSpace.FamilyAccessible): Likewise.
3624 (DeclSpace.FindType): Call ResolveNestedType() for nested types.
3625 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
3628 * delegate.cs (Delegate.Define): Store the EmitContext in the `ec'
3631 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
3632 (Enum.Emit): Don't create a new EmitContext.
3634 2004-10-18 Martin Baulig <martin@ximian.com>
3636 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
3637 `Type' directly, but call ResolveType() on it.
3638 (Catch.Resolve): Likewise.
3639 (Foreach.Resolve): Likewise.
3641 2004-10-18 Martin Baulig <martin@ximian.com>
3643 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
3644 `Type' directly, but call ResolveType() on it.
3645 (Probe.DoResolve): Likewise.
3646 (ArrayCreation.LookupType): Likewise.
3647 (TypeOf.DoResolve): Likewise.
3648 (SizeOf.DoResolve): Likewise.
3650 2004-10-18 Raja R Harinath <rharinath@novell.com>
3652 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
3655 2004-10-17 John Luke <john.luke@gmail.com>
3657 * class.cs (Operator.GetSignatureForError): use CSharpName
3659 * parameter.cs (Parameter.GetSignatureForError): Returns
3660 correct name even if was not defined.
3662 2004-10-13 Raja R Harinath <rharinath@novell.com>
3665 * class.cs (TypeContainer.EmitContext): New property.
3666 (DefineNestedTypes): Create an emitcontext for each part.
3667 (MethodCore.DoDefineParameters): Use container's emitcontext.
3668 Pass type array to InternalParameters.
3669 (MemberBase.DoDefine): Use container's emitcontext.
3670 (FieldMember.Define): Likewise.
3671 (Event.Define): Likewise.
3672 (SetMethod.GetParameterInfo): Change argument to EmitContext.
3673 Pass type array to InternalParameters.
3674 (SetIndexerMethod.GetParameterInfo): Likewise.
3675 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
3676 * delegate.cs (Define): Pass emitcontext to
3677 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
3678 array to InternalParameters.
3679 * expression.cs (ParameterReference.DoResolveBase): Pass
3680 emitcontext to GetParameterInfo.
3681 (ComposedCast.DoResolveAsTypeStep): Remove check on
3682 ec.ResolvingTypeTree.
3683 * parameter.cs (Parameter.Resolve): Change argument to
3684 EmitContext. Use ResolveAsTypeTerminal.
3685 (Parameter.GetSignature): Change argument to EmitContext.
3686 (Parameters.ComputeSignature): Likewise.
3687 (Parameters.ComputeParameterTypes): Likewise.
3688 (Parameters.GetParameterInfo): Likewise.
3689 (Parameters.ComputeAndDefineParameterTypes): Likewise.
3690 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
3691 * support.cs (InternalParameters..ctor): Remove variant that takes
3693 * typemanager.cs (system_intptr_expr): New.
3694 (InitExpressionTypes): Initialize it.
3696 2004-10-12 Chris Toshok <toshok@ximian.com>
3698 * cs-parser.jay: fix location for try_statement and catch_clause.
3700 2004-10-18 Martin Baulig <martin@ximian.com>
3702 * class.cs (FieldMember.Define): Don't access the TypeExpr's
3703 `Type' directly, but call ResolveType() on it.
3704 (MemberBase.DoDefine): Likewise.
3706 * expression.cs (New.DoResolve): Don't access the TypeExpr's
3707 `Type' directly, but call ResolveType() on it.
3708 (ComposedCast.DoResolveAsTypeStep): Likewise.
3710 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
3711 `Type' directly, but call ResolveType() on it.
3713 2004-10-17 John Luke <john.luke@gmail.com>
3715 * class.cs (Operator.GetSignatureForError): use CSharpName
3717 * parameter.cs (Parameter.GetSignatureForError): Returns
3718 correct name even if was not defined.
3720 2004-10-13 Raja R Harinath <rharinath@novell.com>
3723 * class.cs (TypeContainer.EmitContext): New property.
3724 (DefineNestedTypes): Create an emitcontext for each part.
3725 (MethodCore.DoDefineParameters): Use container's emitcontext.
3726 Pass type array to InternalParameters.
3727 (MemberBase.DoDefine): Use container's emitcontext.
3728 (FieldMember.Define): Likewise.
3729 (Event.Define): Likewise.
3730 (SetMethod.GetParameterInfo): Change argument to EmitContext.
3731 Pass type array to InternalParameters.
3732 (SetIndexerMethod.GetParameterInfo): Likewise.
3733 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
3734 * delegate.cs (Define): Pass emitcontext to
3735 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
3736 array to InternalParameters.
3737 * expression.cs (ParameterReference.DoResolveBase): Pass
3738 emitcontext to GetParameterInfo.
3739 (ComposedCast.DoResolveAsTypeStep): Remove check on
3740 ec.ResolvingTypeTree.
3741 * parameter.cs (Parameter.Resolve): Change argument to
3742 EmitContext. Use ResolveAsTypeTerminal.
3743 (Parameter.GetSignature): Change argument to EmitContext.
3744 (Parameters.ComputeSignature): Likewise.
3745 (Parameters.ComputeParameterTypes): Likewise.
3746 (Parameters.GetParameterInfo): Likewise.
3747 (Parameters.ComputeAndDefineParameterTypes): Likewise.
3748 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
3749 * support.cs (InternalParameters..ctor): Remove variant that takes
3751 * typemanager.cs (system_intptr_expr): New.
3752 (InitExpressionTypes): Initialize it.
3754 2004-10-12 Chris Toshok <toshok@ximian.com>
3756 * cs-parser.jay: fix location for try_statement and catch_clause.
3758 2004-10-07 Raja R Harinath <rharinath@novell.com>
3760 More DeclSpace.ResolveType avoidance.
3761 * decl.cs (MemberCore.InUnsafe): New property.
3762 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
3763 with newly created EmitContext.
3764 (FieldMember.Define): Likewise.
3765 * delegate.cs (Delegate.Define): Likewise.
3766 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
3767 only if normal name-lookup fails.
3768 (TypeExpr.DoResolve): Enable error-checking.
3769 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
3770 (SizeOf.DoResolve): Likewise.
3771 (ComposedCast.DoResolveAsTypeStep): Likewise.
3772 (StackAlloc.DoResolve): Likewise.
3773 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
3774 (Block.Unsafe): New property.
3775 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
3776 (Unsafe): Set 'unsafe' flag of contained block.
3777 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
3778 (Fixed.Resolve): Likewise.
3779 (Catch.Resolve): Likewise.
3780 (Using.ResolveLocalVariableDecls): Likewise.
3781 (Foreach.Resolve): Likewise.
3783 2004-10-05 John Luke <john.luke@gmail.com>
3785 * cs-parser.jay: add location to error CS0175
3787 2004-10-04 Miguel de Icaza <miguel@ximian.com>
3789 * ecore.cs (Expression.Constantity): Add support for turning null
3792 * const.cs (Const.Define): Allow constants to be reference types
3793 as long as the value is Null.
3795 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
3797 * namespace.cs (NamespaceEntry.Using): No matter which warning
3798 level is set, check if this namespace name has already been added.
3800 2004-10-03 Ben Maurer <bmaurer@ximian.com>
3802 * expression.cs: reftype [!=]= null should always use br[true,false].
3805 2004-10-03 Marek Safar <marek.safar@seznam.cz>
3808 * attribute.cs: Enum conversion moved to
3809 GetAttributeArgumentExpression to be applied to the all
3812 2004-10-01 Raja R Harinath <rharinath@novell.com>
3814 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
3815 * class.c (TypeContainer.DefineType): Flag error if
3816 base types aren't accessible due to access permissions.
3817 * decl.cs (DeclSpace.ResolveType): Move logic to
3818 Expression.ResolveAsTypeTerminal.
3819 (DeclSpace.ResolveTypeExpr): Thin layer over
3820 Expression.ResolveAsTypeTerminal.
3821 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
3822 Refactor code into NestedAccess. Use it.
3823 (DeclSpace.NestedAccess): New.
3824 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
3825 argument to silence errors. Check access permissions.
3826 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
3827 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
3828 (Cast.DoResolve): Likewise.
3829 (New.DoResolve): Likewise.
3830 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
3831 (TypeOf.DoResolve): Likewise.
3833 * expression.cs (Invocation.BetterConversion): Return the Type of
3834 the better conversion. Implement section 14.4.2.3 more faithfully.
3835 (Invocation.BetterFunction): Make boolean. Make correspondence to
3836 section 14.4.2.2 explicit.
3837 (Invocation.OverloadResolve): Update.
3838 (Invocation): Remove is_base field.
3839 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
3840 (Invocation.Emit): Likewise.
3842 2004-09-24 Marek Safar <marek.safar@seznam.cz>
3844 * cs-parser.jay: Reverted 642 warning fix.
3846 2004-09-23 Marek Safar <marek.safar@seznam.cz>
3849 * decl.cs (FindMemberWithSameName): Indexer can have more than
3852 2004-09-23 Marek Safar <marek.safar@seznam.cz>
3854 * expression.cs (LocalVariableReference.DoResolveLValue):
3855 Do not report warning 219 for out values.
3856 (EmptyExpression.Null): New member to avoid extra allocations.
3858 2004-09-23 Marek Safar <marek.safar@seznam.cz>
3860 * cs-parser.jay: Fix wrong warning 642 report.
3862 * cs-tokenizer.cs (CheckNextToken): New helper;
3863 Inspect next character if is same as expected.
3865 2004-09-23 Martin Baulig <martin@ximian.com>
3867 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
3868 (Convert.ImplicitReferenceConversionExists): Likewise.
3870 2004-11-09 Raja R Harinath <rharinath@novell.com>
3872 * Makefile (DISTFILES): Comment out a few missing files.
3874 2004-10-29 Raja R Harinath <rharinath@novell.com>
3876 * Makefile (bootstrap_libs,bootstrap_libfiles): New.
3877 (bootstrap-libs): New target. Invokes the net_2_0_bootstrap profile.
3878 (gmcs.exe): Invoke bootstrap-libs.
3879 (clean-local): Clean the net_2_0_bootstrap profile too.
3880 (PROGRAM_INSTALL_DIR): New.
3881 (install-local): Use it.
3883 2004-10-13 Martin Baulig <martin@ximian.com>
3885 * generic.cs (TypeManager.InflatedConstraints): New nested class.
3886 (TypeParameter.DefineType): If we're a method type parameter and
3887 that method is overriding something, "inflate" its constraints.
3889 2004-10-12 Martin Baulig <martin@ximian.com>
3891 * expression.cs (MemberAccess.DoResolve): If we're a SimpleName
3892 and have type arguments, create and resolve a ConstructedType.
3894 2004-10-12 Martin Baulig <martin@ximian.com>
3896 * decl.cs (MemberCache.FindMemberToOverride): Use
3897 TypeManager.IsEqual() to compare the parameters and Type.Equals()
3898 to compare the invocationType.
3900 * typemanager.cs (TypeManager.IsEqual): Added support for arrays.
3901 When comparing two type parameters, only do the signature-only
3902 comparision for method type parameters.
3904 2004-10-11 Martin Baulig <martin@ximian.com>
3906 * report.cs: Don't make --fatal abort on warnings, we have
3907 -warnaserror for that.
3909 2004-10-11 Martin Baulig <martin@ximian.com>
3912 (TypeManager.IsEqualGenericType): Removed, use IsEqual() instead.
3913 (TypeManager.IsEqual): Call ourself recursively instead of using
3916 2004-10-11 Martin Baulig <martin@ximian.com>
3918 * class.cs (TypeContainer.DefineType): Only call TypeParameter.Define()
3919 on our own type parameters, not on the ones we inherit from a containing
3922 * expression.cs (Invocation.InferType): Use `==', not `Equals()' for
3925 * generic.cs (TypeParameter.Define): We may only be called once.
3927 * pending.cs (Pending.InterfaceMethod): Call TypeManager.Real_IsEqual()
3928 instead of TypeManager.IsEqual().
3930 2004-09-28 Martin Baulig <martin@ximian.com>
3933 (GenericConstraints.EffectiveBaseClass): New public property.
3934 (TypeParameter.GenericConstraints): New public property.
3935 (ConstructedType.CheckConstraints): Improved.
3937 * convert.cs (Convert.TypeParam_EffectiveBaseType): New private method.
3938 (Convert.TypeParameterConversion): New private method; use this in
3939 ImplicitReferenceConversion() and ImplicitReferenceConversionExists()
3940 for all conversions related to type parameters.
3942 2004-09-24 Martin Baulig <martin@ximian.com>
3944 * convert.cs (Convert.ImplicitReferenceConversion): Added implicit
3945 type parameter conversions for type parameters which are known to
3948 2004-09-24 Martin Baulig <martin@ximian.com>
3950 * generic.cs (GenericConstraints): Added `IsReferenceType' and
3951 `IsValueType' properties.
3953 * support.cs (ReflectionConstraints): Use
3954 Type.GetGenericParameterConstraints() instead of the old hack.
3956 2004-09-24 Martin Baulig <martin@ximian.com>
3958 * generic.cs (GenericConstraints): Moved here and made it an
3961 * support.cs (GenericConstraints): Moved to generic.cs.
3963 2004-09-24 Martin Baulig <martin@ximian.com>
3966 (ReflectionConstraints): Un-nested this class and made it public.
3969 (TypeManager.GetTypeParameterConstraints): New public method.
3970 (TypeManager.HasConstructorConstraint): Use the attributes.
3972 2004-09-24 Martin Baulig <martin@ximian.com>
3974 * support.cs (GenericConstraints): Replaced `HasConstructor',
3975 `IsReferenceType' and `IsValueType' with `Attributes'.
3976 (ReflectionParameters.ReflectionConstraints): Removed the Create()
3977 method and made the .ctor public.
3979 * generic.cs (Constraints.Attributes): New public property.
3980 (Constraints): Renamed `HasConstructor' -> `HasConstructorConstraint',
3981 `IsReferenceType' -> `HasReferenceTypeConstraint' and
3982 `IsValueType' -> `HasValueTypeConstraint'.
3984 2004-09-23 Martin Baulig <martin@ximian.com>
3986 * generic.cs (Constraints): Reflect latest runtime changes.
3988 2004-09-23 Martin Baulig <martin@ximian.com>
3990 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
3991 (Convert.ImplicitReferenceConversionExists): Likewise.
3993 2004-09-23 Marek Safar <marek.safar@seznam.cz>
3995 * class.cs (Operator.Define): Add error 448 and 559 report.
3997 2004-09-22 Marek Safar <marek.safar@seznam.cz>
3999 * class.cs (MemberBase.IsTypePermitted): New protected
4000 method for checking error CS0610.
4002 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4004 * class.cs (TypeContainer.HasExplicitLayout): New property
4005 Returns whether container has StructLayout attribute set Explicit.
4006 (FieldMember): New abstract class for consts and fields.
4007 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
4008 (Field): Reuse FieldMember.
4010 * const.cs (Const): Reuse FieldMember.
4012 * rootcontext.cs: EmitConstants call moved to class.
4014 2004-09-22 Martin Baulig <martin@ximian.com>
4016 Marek and me just fixed one of our oldest bugs: #28562 :-)
4018 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
4020 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
4021 we're an EnumConstant, just return that.
4022 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
4023 an EnumConstant. In this case, we need to use GetValueAsEnumType()
4024 to get the value which'll actually be written into the attribute.
4025 However, we have to use GetValue() to access the attribute's value
4028 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4030 * constant.cs (Constant.IsNegative): New abstract property
4033 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
4034 (StackAlloc.DoResolve): Reused IsNegative.
4036 2004-09-22 Martin Baulig <martin@ximian.com>
4038 * typemanager.cs (TypeManager.LookupGenericTypeContainer): New
4039 public method; like LookupTypeContainer, but also works for
4042 * report.cs (Report.SymbolRelatedToPreviousError): Use
4043 TypeManager.LookupGenericTypeContainer().
4045 2004-09-22 Martin Baulig <martin@ximian.com>
4047 Thanks to Peter Sestoft for this bug report.
4049 * expression.cs (Conditional): If both the `trueExpr' and the
4050 `falseExpr' is a NullLiteral, return a NullLiteral.
4052 2004-09-22 Martin Baulig <martin@ximian.com>
4054 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
4055 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
4056 for the "get_Current" call.
4058 2004-09-21 Martin Baulig <martin@ximian.com>
4060 * convert.cs (Convert.ImplicitReferenceConversion): When
4061 converting to an interface type, first check whether we're
4062 converting from a reference type.
4064 2004-09-14 Martin Baulig <martin@ximian.com>
4066 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
4068 2004-09-14 Marek Safar <marek.safar@seznam.cz>
4071 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
4072 called and is obsolete then this member suppress message
4073 when call is inside next [Obsolete] method or type.
4075 * expression.cs: Use TestObsoleteMethodUsage member.
4077 2004-09-14 Martin Baulig <martin@ximian.com>
4079 * genericparser.cs: Removed.
4081 2004-09-13 Marek Safar <marek.safar@seznam.cz>
4083 * class.cs (MethodCore.CheckBase): Fix bug #65757.
4085 2004-09-12 Marek Safar <marek.safar@seznam.cz>
4087 * attribute.cs (Attribute.Resolve): Add error 653 report.
4089 * class.cs (Class.ApplyAttributeBuilder): Add error 641
4091 (Method.ApplyAttributeBuilder): Add error 685 report.
4092 (Operator.Define): Add error 564 report.
4094 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
4096 * expression.cs (Invocation.DoResolve): Add error
4099 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
4102 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4104 * class.cs (ConstructorInitializer.Resolve):
4105 Wrong error number (515->516).
4107 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4109 * class.cs (Indexer.Define): Add error 631 report.
4111 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4113 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
4115 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4117 * expression.cs (Probe.DoResolve): Add error CS0241 report.
4119 2004-09-10 Marek Safar <marek.safar@seznam.cz>
4121 * cs-parser.jay: Added error CS0241 report.
4123 2004-09-10 Raja R Harinath <rharinath@novell.com>
4125 * cs-parser.jay (fixed_statement): Introduce a scope for the
4126 declaration in the 'fixed' statement.
4128 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4130 * cs-parser.jay: Added CS0230 error report.
4132 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4134 * cs-parser.jay: Added errors CS0231 and CS0257 report.
4136 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4138 * expression.cs (Argument.Resolve): Added error CS0192 and
4141 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4143 C# 2.0 #pragma warning feature
4145 * cs-tokenizer.cs (PreProcessPragma): New method;
4146 Handles #pragma directive.
4148 * report.cs (WarningRegions): New class; Support
4149 class for #pragma warning directive. It tests whether
4150 warning is enabled for a given line.
4152 2004-09-08 Miguel de Icaza <miguel@ximian.com>
4154 * const.cs: Add more descriptive error report, tahnks to
4157 2004-09-08 Marek Safar <marek.safar@seznam.cz>
4159 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
4161 2004-09-07 Miguel de Icaza <miguel@ximian.com>
4163 * expression.cs: Apply patch from Ben: Remove dead code from
4164 ArrayCreation, and remove the TurnintoConstant call in const.cs,
4165 as that code just threw an exception anwyays.
4167 * const.cs: Remove the call to the turnintoconstant, for details
4170 * literal.cs: The type of the null-literal is the null type; So
4171 we use a placeholder type (literal.cs:System.Null, defined here)
4174 * expression.cs (Conditional.DoResolve): Remove some old code that
4175 is no longer needed, conversions have been fixed.
4177 (ArrayCreationExpression.DoResolve): Return false if we fail to
4178 resolve the inner expression.
4180 2004-09-07 Raja R Harinath <rharinath@novell.com>
4183 * cs-parser.jay (delegate_declaration): Record a delegate
4184 declaration as a type declaration.
4185 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
4187 2004-09-06 Miguel de Icaza <miguel@ximian.com>
4189 * parameter.cs: Do not crash if the type can not be resolved.
4191 * expression.cs: Report errors with unsafe pointers, fixes #64896
4193 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
4195 * expression.cs: Pointer arith always needs to do a conv.i
4196 if the operand is a long. fix 65320
4198 2004-09-04 Marek Safar <marek.safar@seznam.cz>
4200 Fixed cs0619-37.cs, cs0619-38.cs
4202 * enum.cs (GetObsoleteAttribute): Removed.
4204 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
4205 on Enum member is double staged. The first is tested member
4208 2004-09-04 Marek Safar <marek.safar@seznam.cz>
4210 Fixed #56986, #63631, #65231
4212 * class.cs: (TypeContainer.AddToMemberContainer): New method,
4213 adds member to name container.
4214 (TypeContainer.AddToTypeContainer): New method, adds type to
4216 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
4217 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
4218 AddOperator): Simplified by reusing AddToMemberContainer.
4219 (TypeContainer.UserDefinedStaticConstructor): Changed to property
4221 (Method.CheckForDuplications): Fixed implementation to test all
4223 (MemberBase): Detection whether member is explicit interface
4224 implementation is now in constructor.
4225 (MemberBase.UpdateMemberName): Handles IndexerName.
4226 (Accessor): Changed to keep also location information.
4227 (AbstractPropertyEventMethod): Is derived from MemberCore.
4228 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
4229 will be emited or not.
4230 (PropertyBase.AreAccessorsDuplicateImplementation):
4231 Tests whether accessors are not in collision with some method.
4232 (Operator): Is derived from MethodCore to simplify common
4235 * decl.cs (Flags.TestMethodDuplication): Test for duplication
4237 (DeclSpace.AddToContainer): Adds the member to defined_names
4238 table. It tests for duplications and enclosing name conflicts.
4240 * enum.cs (EnumMember): Clean up to reuse the base structures
4242 2004-09-03 Martin Baulig <martin@ximian.com>
4244 Merged latest changes into gmcs. Please keep this comment in
4245 here, it makes it easier for me to see what changed in MCS since
4246 the last time I merged.
4248 2004-09-03 Martin Baulig <martin@ximian.com>
4250 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
4251 into TypeContainer, to make partial classes work again.
4253 2004-09-03 Martin Baulig <martin@ximian.com>
4255 * rootcontext.cs (RootContext.V2): Removed.
4257 2004-03-23 Martin Baulig <martin@ximian.com>
4259 * expression.cs (Invocation.OverloadResolve): Added `bool
4260 may_fail' argument and use it instead of the Location.IsNull() hack.
4262 2004-09-09 Martin Baulig <martin@ximian.com>
4264 * cs-parser.jay (namespace_declaration): Fixed CS0134 reporting.
4266 2004-09-09 Martin Baulig <martin@ximian.com>
4268 * generic.cs (TypeParameter.DefineType): Added support for
4269 explicit interface methods.
4271 2004-09-09 Martin Baulig <martin@ximian.com>
4273 * README.Changes: New document. Started to list important changes
4274 between MCS and GMCS here.
4276 2004-09-08 Martin Baulig <martin@ximian.com>
4279 (TypeContainer.CheckRecursiveDefinition): New protected method.
4280 (TypeContainer.DefineType): Move the CS0146 check into
4281 CheckRecursiveDefinition().
4283 2004-09-06 Martin Baulig <martin@ximian.com>
4285 * generic.cs (ConstructedType.CheckConstraints): Allow builtin
4286 types for the constructor constraint.
4288 2004-09-03 Martin Baulig <martin@ximian.com>
4290 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
4291 into TypeContainer, to make partial classes work again.
4293 2004-09-03 Martin Baulig <martin@ximian.com>
4295 * rootcontext.cs (RootContext.V2): Removed.
4297 2004-03-23 Martin Baulig <martin@ximian.com>
4299 * expression.cs (Invocation.OverloadResolve): Added `bool
4300 may_fail' argument and use it instead of the Location.IsNull() hack.
4302 2004-09-03 Martin Baulig <martin@ximian.com>
4304 Merged latest changes into gmcs. Please keep this comment in
4305 here, it makes it easier for me to see what changed in MCS since
4306 the last time I merged.
4308 2004-09-03 Raja R Harinath <rharinath@novell.com>
4311 * expression.cs (BetterConversion): Don't allow either conversion
4312 to be null. Remove redundant implicit conversion test when 'q ==
4313 null' -- when this function is invoked, we already know that the
4314 implicit conversion exists.
4315 (BetterFunction): Assume that 'best' is non-null. Remove
4316 redundant reimplementation of IsApplicable when 'best' is null.
4317 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
4318 number of arguments.
4319 (IsAncestralType): Extract from OverloadResolve.
4320 (OverloadResolve): Make robust to the MethodGroupExpr being
4321 unsorted. Implement all the logic of Section 14.5.5.1, and
4322 support overloading of methods from multiple applicable types.
4323 Clean up logic somewhat. Don't pass null methods to BetterFunction.
4325 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
4326 (RealError, Warning): Append type of report to related symbol.
4328 2004-09-03 Marek Safar <marek.safar@seznam.cz>
4330 * enum.cs: Fixed CLS-Compliance checks for enum members.
4331 Error tests cs3008-8.cs, cs3014-8.cs
4333 2004-09-02 Marek Safar <marek.safar@seznam.cz>
4335 Fixed bug #62342, #63102
4336 * class.cs: ImplementIndexer uses member.IsExplicitImpl
4337 like ImplementMethod.
4339 2004-09-02 Marek Safar <marek.safar@seznam.cz>
4341 * attribute.cs (Attribute.GetAttributeArgumentExpression):
4344 2004-09-02 Martin Baulig <martin@ximian.com>
4346 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
4347 TypeManager.GetArgumentTypes() rather than calling GetParameters()
4350 2004-09-01 Marek Safar <marek.safar@seznam.cz>
4352 C# 2.0 Static classes implemented
4354 * class.cs (TypeContainer): instance_constructors,
4355 initialized_fields, initialized_static_fields,
4356 default_constructor, base_inteface_types are protected to be
4357 accessible from StaticClass.
4358 (TypeContainer.DefineDefaultConstructor): New virtual method
4359 for custom default constructor generating
4360 (StaticClass): New class to handle "Static classes" feature.
4362 * cs-parser.jay: Handle static keyword on class like instance
4365 * driver.cs: Added "/langversion" command line switch with two
4366 options (iso-1, default).
4368 2004-08-31 Marek Safar <marek.safar@seznam.cz>
4370 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
4372 2004-08-31 Miguel de Icaza <miguel@ximian.com>
4374 * delegate.cs: Style.
4376 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
4378 * delegate.cs: Add seperate instance expr field for miguel.
4380 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
4382 * PointerArithmetic (Resolve): make sure we are not doing
4383 pointer arith on void*. Also, make sure we are resolved
4384 by not setting eclass until resolve.
4386 All callers: Make sure that PointerArithmetic gets resolved.
4388 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
4390 * ArrayCreation (LookupType): If the type does not resolve
4391 to an array, give an error.
4393 2004-08-27 Marek Safar <marek.safar@seznam.cz>
4395 * statement.cs (Try.Resolve): Fixed bug #64222
4397 2004-08-27 Martin Baulig <martin@ximian.com>
4400 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
4403 2004-08-26 Marek Safar <marek.safar@seznam.cz>
4405 * ecore.cs (Constantify): Get underlying type via
4406 System.Enum.GetUnderlyingType to avoid StackOverflow on the
4407 Windows in special cases.
4409 2004-08-26 Marek Safar <marek.safar@seznam.cz>
4411 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
4412 for obtaining also private methods.
4413 (GetRemoveMethod): Used GetRemoveMethod (true)
4414 for obtaining also private methods.
4416 2004-09-02 Martin Baulig <martin@ximian.com>
4418 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
4419 TypeManager.GetArgumentTypes() rather than calling GetParameters()
4422 2004-08-27 Martin Baulig <martin@ximian.com>
4425 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
4428 2004-08-25 Martin Baulig <martin@ximian.com>
4430 * support.cs (ReflectionParameters..ctor): If this is a generic
4431 method, retrieve and store its type parameters.
4432 (InternalParameters..ctor): Added `TypeParameter[]' argument.
4433 (ReflectionParameters.GenericConstraints): The argument specifies
4434 the type parameter, not the method parameter.
4435 (InternalParameters.GenericConstraints): Likewise.
4437 * generic.cs (TypeParameter.DefineType): Correctly handle
4438 constraints wrt. generic methods in interfaces and their
4441 2004-08-24 Martin Baulig <martin@ximian.com>
4443 * generic.cs (TypeParameter.IsSubclassOf): New public method.
4444 (Constraints.IsSubclassOf): New internal method.
4446 * typemanager.cs (TypeManager.FindMembers): Added special support
4447 for GenericTypeParameterBuilder's.
4448 (TypeManager.IsSubclassOf, IsFamilyAccessible): Added support for
4451 2004-08-24 Martin Baulig <martin@ximian.com>
4454 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
4455 this for accessibility checks.
4456 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
4457 IsNestedFamilyAccessible.
4458 (TypeManager.IsSubclassOf): New method, do what the name actually
4461 2004-08-24 Martin Baulig <martin@ximian.com>
4463 * expression.cs (MemberAccess.DoResolve): When resolving ourselves
4464 as a SimpleName, include the generic arity.
4466 2004-08-24 Martin Baulig <martin@ximian.com>
4468 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
4469 MethodAttributes.HideBySig for operators.
4471 2004-08-23 Martin Baulig <martin@ximian.com>
4473 Back to the old error reporting system :-)
4475 * report.cs (Message): Removed.
4476 (Report.MessageData, ErrorData, WarningData): Removed.
4477 (Report.Error, Warning): Back to the old system.
4479 2004-08-23 Martin Baulig <martin@ximian.com>
4481 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
4483 * class.cs (TypeContainer.ParentContainer): New public virtual
4484 method; replaces the explicit interface implementation.
4485 (ClassPart.ParentContainer): Override.
4487 2004-08-23 Martin Baulig <martin@ximian.com>
4489 * statement.cs (Switch): Added support for constant switches; see
4490 #59428 or test-285.cs.
4492 2004-08-22 Marek Safar <marek.safar@seznam.cz>
4495 * statement.cs (GetEnumeratorFilter): Removed useless
4496 logic because C# specs is strict. GetEnumerator must be
4499 2004-08-22 Martin Baulig <martin@ximian.com>
4501 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
4502 a switch and may break, reset the barrier. Fixes #59867.
4504 2004-08-22 Marek Safar <marek.safar@seznam.cz>
4506 CLS-Compliance speed up (~5% for corlib)
4508 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
4509 New method. Tests container for CLS-Compliant names
4511 * class.cs (TypeContainer.VerifyClsName): New method.
4512 Checks whether container name is CLS Compliant.
4513 (Constructor): Implements IMethodData.
4515 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
4516 low-case table for CLS Compliance test.
4517 (MemberCache.VerifyClsParameterConflict): New method.
4518 Checks method parameters for CS3006 error.
4520 * enum.cs (EnumMember): Is derived from MemberCore.
4521 (Enum.VerifyClsName): Optimized for better performance.
4523 2004-08-06 Marek Safar <marek.safar@seznam.cz>
4525 * report.cs: Renamed Error_T to Error and changed all
4528 2004-08-06 Marek Safar <marek.safar@seznam.cz>
4530 * class.cs (TypeContainer.IndexerArrayList): New inner class
4531 container for indexers.
4532 (TypeContainer.DefaultIndexerName): New constant for default
4533 indexer name. Replaced all "Item" with this constant.
4534 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
4536 * typemanager.cs (TypeManager.default_member_ctor): Cache here
4537 DefaultMemberAttribute constructor.
4539 2004-08-05 Martin Baulig <martin@ximian.com>
4541 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
4544 2004-08-05 Marek Safar <marek.safar@seznam.cz>
4546 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
4547 multi platforms problem.
4549 * compiler.csproj: Included shared files.
4551 2004-08-04 Marek Safar <marek.safar@seznam.cz>
4553 Fix bug 60333, 55971 in the more general way
4554 * attribute.cs (Attribute.GetAttributeArgumentExpression):
4555 Added arg_type argument for constant conversion.
4556 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
4558 2004-08-04 Marek Safar <marek.safar@seznam.cz>
4561 * class.cs (TypeContainer ): New inner classes MethodArrayList,
4562 OperatorArrayList, MethodCoreArrayList for typecontainer
4563 containers. Changed class member types to these new types.
4564 (MethodArrayList.DefineMembers): Added test for CS0659.
4566 2004-08-04 Miguel de Icaza <miguel@ximian.com>
4568 * cfold.cs: Synchronize the folding with the code in expression.cs
4569 Binary.DoNumericPromotions for uint operands.
4571 * attribute.cs: Revert patch from Raja, it introduced a regression
4572 while building Blam-1.2.1 (hard to isolate a test case).
4574 2004-08-04 Marek Safar <marek.safar@seznam.cz>
4578 (TypeContainer.Define): Renamed to DefineContainerMembers because of
4580 (MethodCore.parent_method): New member. The method we're overriding
4581 if this is an override method.
4582 (MethodCore.CheckBase): Moved from Method class and made common.
4583 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
4585 (MethodCore.CheckForDuplications): New abstract method. For custom
4586 member duplication search in a container
4587 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
4588 method and its return type.
4589 (Event.conflict_symbol): New member. Symbol with same name in the
4593 (MemberCache.FindMemberWithSameName): New method. The method
4594 is looking for conflict with inherited symbols.
4596 2004-08-04 Martin Baulig <martin@ximian.com>
4598 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
4600 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
4602 2004-08-03 Marek Safar <marek.safar@seznam.cz>
4604 * report.cs (Message): New enum for better error, warning reference in
4606 (MessageData): New inner abstract class. It generally handles printing of
4607 error and warning messages.
4608 Removed unused Error, Warning, Message methods.
4610 2004-08-03 Marek Safar <marek.safar@seznam.cz>
4612 Fix for cs0592-8.cs test
4614 (Attributable.ValidAttributeTargets): Made public.
4615 (Attribute.ExplicitTarget): New member for explicit target value.
4616 (Attribute.CheckTargets): Now we translate explicit attribute
4617 target to Target here.
4619 2004-08-03 Ben Maurer <bmaurer@ximian.com>
4621 * ecore.cs (MethodGroupExpr): new IsBase property.
4623 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
4625 * delegate.cs (DelegateCreation): store a MethodGroupExpr
4626 rather than an instance expr.
4628 (DelegateCreation.Emit): Use the method group rather than
4629 the instance expression. Also, if you have base.Foo as the
4630 method for a delegate, make sure to emit ldftn, not ldftnvirt.
4632 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
4634 (NewDelegate.DoResolve): Only check for the existance of Invoke
4635 if the method is going to be needed. Use MethodGroupExpr.
4637 (NewDelegate.Emit): Remove, DelegateCreation implements this.
4639 * expression.cs: For pointer arith., make sure to use
4640 the size of the type, not the size of the pointer to
4643 2004-08-03 Marek Safar <marek.safar@seznam.cz>
4646 * class.cs (Class): Added error CS0502 test.
4648 2004-08-03 John Luke <jluke@cfl.rr.com>
4649 Raja R Harinath <rharinath@novell.com>
4652 * attribute.cs (Attribute.complained_before): New flag.
4653 (Attribute.ResolveType, Attribute.Resolve),
4654 (Attribute.DefinePInvokeMethod): Set it.
4655 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
4657 2004-08-03 Martin Baulig <martin@ximian.com>
4659 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
4660 use a user-defined operator; we still need to do numeric
4661 promotions in case one argument is a builtin type and the other
4662 one has an implicit conversion to that type. Fixes #62322.
4664 2004-08-18 Martin Baulig <martin@ximian.com>
4666 * class.cs (Method.Define): Use the correct method name when
4667 creating the MethodBuilder for a generic method.
4669 2004-08-17 Martin Baulig <martin@ximian.com>
4671 * generic.cs (Constraints): Support type parameter constraints.
4673 2004-08-16 Martin Baulig <martin@ximian.com>
4675 * cs-tokenizer.cs (Tokenizer.TypeOfParsing): New public property.
4676 (Token.GENERIC_DIMENSION): New token; this is returned if we
4677 encounter an unbound generic type in a typeof() expression.
4679 * cs-parser.jay (opt_type_argument_list): Added GENERIC_DIMENSION;
4680 this token is only generated while parsing a typeof() expression.
4681 (typeof_expression): Removed the old unbound_type hack.
4683 * generic.cs (TypeArguments.IsUnbound): New public property.
4685 * decl.cs (MemberName): Added support for unbound types.
4687 2004-08-14 Martin Baulig <martin@ximian.com>
4690 (TypeManager.IsEqualGenericInstance): New static method.
4691 (TypeManager.IsSubclassOrNestedChildOf, IsSubclassOf): This is
4692 just used to check accessibility, so follow the rules of 26.1.6.
4694 * expression.cs (MemberAccess.ResolveAsTypeStep): Return a
4695 ConstructedType instead of a TypeExpression if we have type arguments.
4697 * cs-parser.jay (typeof_expression): Support unbound generic types.
4699 * ecore.cs (UnboundTypeExpression): New public class.
4701 2004-08-12 Martin Baulig <martin@ximian.com>
4703 * typemanager.cs (TypeManager.IsNestedChildOf): Use
4704 TypeManager.IsEqual() rather than `=='.
4706 * decl.cs (DeclSpace.CheckAccessLevel): Use `tb.FullName' for
4707 generic instances as well.
4709 2004-08-12 Martin Baulig <martin@ximian.com>
4711 * expression.cs (Invocation.InferType): We can only infer method
4712 type parameters. Fixes #62647.
4714 2004-08-11 Martin Baulig <martin@ximian.com>
4716 * class.cs (TypeContainer.DefineType): Create the TypeBuilder
4717 before resolving the base classes.
4719 2004-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4721 * Makefile: install .mdb file too.
4723 2004-08-05 Martin Baulig <martin@ximian.com>
4725 * ecore.cs (FieldExpr.DoResolveLValue): If we're resolving a field
4726 initializer, the current type is just the TypeBuilder, not the
4727 instantiated generic type.
4728 (FieldExpr.IsFieldInitializer): New public property.
4730 2004-08-04 Martin Baulig <martin@ximian.com>
4732 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
4734 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
4736 2004-08-03 Martin Baulig <martin@ximian.com>
4738 * class.cs (MethodData.Define): If we're an explicit
4739 implementation, remove the generic arity from the type name.
4741 2004-08-03 Martin Baulig <martin@ximian.com>
4743 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
4744 use a user-defined operator; we still need to do numeric
4745 promotions in case one argument is a builtin type and the other
4746 one has an implicit conversion to that type. Fixes #62322.
4748 2004-08-02 Martin Baulig <martin@ximian.com>
4750 * class.cs (TypeContainer.ifaces): Make this a `Type[]', not a
4752 (TypeContainer.GetClassBases): Return the unexpanded list of
4753 interfaces; we expand them later.
4754 (TypeContainer.DefineType): After creating the TypeBuilder, call
4755 TypeManager.ExpandInterfaces() to get an expanded and resolved
4758 * ecore.cs (TypeExpr.GetInterfaces): Removed
4760 * generics.cs (Constraints.InterfaceConstraints): Remove.
4761 (TypeParameter.DefineType): Call TypeManager.RegisterBuilder() to
4762 register the interface constraints.
4765 (TypeManager.AddUserType): Removed the `ifaces' argument.
4766 (TypeManager.AddTypeParameter): Likewise.
4767 (TypeManager.AddUserInterface): Removed, was unused.
4768 (TypeManager.RegisterBuilder): Take a `Type[]' instead of a
4769 `TypeExpr[]' array for the interfaces.
4770 (TypeManager.ExpandInterfaces): Call this after the TypeBuilder
4771 has been defined, returns a list of the resolved interfaces types.
4772 (TypeManager.GetInterfaces): Return a `Type[]', not a `TypeExpr[]'.
4773 (TypeManager.GetExplicitInterfaces): Likewise.
4775 2004-08-02 Martin Baulig <martin@ximian.com>
4777 * expression.cs (Invocation.EmitCall): If we're invoking a method
4778 on a type parameter, use the new `Constrained' prefix opcode.
4780 2004-08-02 Martin Baulig <martin@ximian.com>
4782 * statement.cs (LocalInfo.Flags): Added `IsThis'.
4783 (LocalInfo.IsThis): New public property.
4784 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
4786 2004-08-01 Martin Baulig <martin@ximian.com>
4788 * class.cs (TypeContainer.GetClassBases): Don't set the default
4789 here since we may get called from GetPartialBases().
4790 (TypeContainer.DefineType): If GetClassBases() didn't return a
4791 parent, use the default one.
4793 2004-07-30 Martin Baulig <martin@ximian.com>
4795 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
4797 * class.cs (SourceMethod): New public class, derive from the
4798 symbol writer's ISourceMethod.
4799 (Method): Use the new symbol writer API.
4801 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
4802 as argument and use the new symbol writer.
4805 (SourceFile): Implement the symbol writer's ISourceFile.
4806 (Location.SymbolDocument): Removed.
4807 (Location.SourceFile): New public property.
4809 * symbolwriter.cs: Use the new symbol writer API.
4811 2004-07-30 Raja R Harinath <rharinath@novell.com>
4813 * Makefile (install-local): Remove. Functionality moved to
4816 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
4818 * Makefile: Install mcs.exe.config file together with mcs.exe.
4819 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
4820 correct runtime version.
4822 2004-07-25 Martin Baulig <martin@ximian.com>
4825 (TypeContainer.RegisterOrder): Removed, this was unused.
4826 (TypeContainer, interface_order): Removed.
4827 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
4828 TypeContainer as argument since we can also be called with a
4829 `PartialContainer' for a partial class/struct/interface.
4830 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
4831 of checking whether we're an `Interface' - we could be a
4833 (PartialContainer.Register): Override; call
4834 AddClass()/AddStruct()/AddInterface() on our parent.
4836 * cs-parser.jay (interface_member_declaration): Add things to the
4837 `current_container', not the `current_class'.
4839 * rootcontext.cs (RegisterOrder): The overloaded version which
4840 takes an `Interface' was unused, removed.
4842 * typemanager.cs (TypeManager.LookupInterface): Return a
4843 `TypeContainer', not an `Interface'.
4844 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
4845 contain a `PartialContainer' for an interface, so check it's
4846 `Kind' to figure out what it is.
4848 2004-07-25 Martin Baulig <martin@ximian.com>
4850 * class.cs (Class.DefaultTypeAttributes): New public constant.
4851 (Struct.DefaultTypeAttributes): Likewise.
4852 (Interface.DefaultTypeAttributes): Likewise.
4853 (PartialContainer.TypeAttr): Override this and add the
4854 DefaultTypeAttributes.
4856 2004-07-25 Martin Baulig <martin@ximian.com>
4858 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
4859 we can just use the `Parent' field instead.
4861 2004-07-25 Martin Baulig <martin@ximian.com>
4863 * class.cs (TypeContainer.Emit): Renamed to EmitType().
4865 2004-07-25 Martin Baulig <martin@ximian.com>
4867 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
4868 our parts before defining any methods.
4869 (TypeContainer.VerifyImplements): Make this virtual.
4870 (ClassPart.VerifyImplements): Override and call VerifyImplements()
4871 on our PartialContainer.
4873 2004-07-25 Martin Baulig <martin@ximian.com>
4875 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
4877 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
4878 argument, we can just use the `Parent' field instead.
4881 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
4882 (MemberBase.DoDefine): Likewise.
4884 2004-07-24 Martin Baulig <martin@ximian.com>
4886 * decl.cs (MemberCore.Parent): New public field.
4887 (DeclSpace.Parent): Moved to MemberCore.
4889 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
4890 (MemberBase.ctor): Added TypeContainer argument, pass it to our
4892 (FieldBase, Field, Operator): Likewise.
4893 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
4894 (EventField, Event): Likewise.
4896 2004-07-23 Martin Baulig <martin@ximian.com>
4898 * class.cs (PartialContainer): New public class.
4899 (ClassPart): New public class.
4900 (TypeContainer): Added support for partial classes.
4901 (TypeContainer.GetClassBases): Splitted some of the functionality
4902 out into GetNormalBases() and GetPartialBases().
4904 * cs-tokenizer.cs (Token.PARTIAL): New token.
4905 (Tokenizer.consume_identifier): Added some hacks to recognize
4906 `partial', but only if it's immediately followed by `class',
4907 `struct' or `interface'.
4909 * cs-parser.jay: Added support for partial clases.
4911 2004-07-23 Martin Baulig <martin@ximian.com>
4913 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
4914 a `DeclSpace' and also made it readonly.
4915 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
4916 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
4917 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
4919 * cs-parser.jay: Pass the `current_class', not the
4920 `current_container' (at the moment, this is still the same thing)
4921 to a new Method, Property, Event, Indexer or Constructor.
4923 2004-07-23 Martin Baulig <martin@ximian.com>
4925 * cs-parser.jay (CSharpParser): Added a new `current_class' field
4926 and removed the `current_interface' one.
4927 (struct_declaration, class_declaration, interface_declaration):
4928 Set `current_class' to the newly created class/struct/interface;
4929 set their `Bases' and call Register() before parsing their body.
4931 2004-07-23 Martin Baulig <martin@ximian.com>
4933 * class.cs (Kind): New public enum.
4934 (TypeContainer): Made this class abstract.
4935 (TypeContainer.Kind): New public readonly field.
4936 (TypeContainer.CheckDef): New public method; moved here from
4938 (TypeContainer.Register): New public abstract method.
4939 (TypeContainer.GetPendingImplementations): New public abstract
4941 (TypeContainer.GetClassBases): Removed the `is_class' and
4942 `is_iface' parameters.
4943 (TypeContainer.DefineNestedTypes): Formerly known as
4945 (ClassOrStruct): Made this class abstract.
4947 * tree.cs (RootTypes): New public type.
4949 2004-07-20 Martin Baulig <martin@ximian.com>
4951 * tree.cs (Tree.RecordNamespace): Removed.
4952 (Tree.Namespaces): Removed.
4954 * rootcontext.cs (RootContext.IsNamespace): Removed.
4956 * cs-parser.jay (namespace_declaration): Just create a new
4957 NamespaceEntry here.
4959 2004-07-21 Lluis Sanchez Gual <lluis@novell.com>
4961 * Makefile: Install gmcs.exe.config file together with gmcs.exe.
4962 * gmcs.exe.config: Renamed from mcs.exe.config. Added supportedRuntime
4963 entry to make sure it runs in the correct runtime version.
4965 2004-07-18 Martin Baulig <martin@ximian.com>
4967 * generic.cs (ConstructedType.CheckConstraints): Improved
4968 constraints checking.
4970 2004-07-18 Martin Baulig <martin@ximian.com>
4972 * expression.cs (Invocation.BetterMethod): Call
4973 TypeManager.TypeToCoreType() on all types and removed my previous
4974 hack; we're already doig the right thing here.
4976 2004-07-17 Martin Baulig <martin@ximian.com>
4978 * decl.cs (MemberName.MakeName): Create the "class`1" names here.
4980 2004-07-16 Martin Baulig <martin@ximian.com>
4982 * iterators.cs: Added generics support.
4984 2004-07-16 Martin Baulig <martin@ximian.com>
4986 * iterators.cs: Rewrote this. We're now using one single Proxy
4987 class for both the IEnumerable and the IEnumerator interface and
4988 `Iterator' derives from Class so we can use the high-level API.
4990 * class.cs (TypeContainer.AddIterator): New method.
4991 (TypeContainer.DoDefineType): New protected virtual method, which
4992 is called from DefineType().
4993 (TypeContainer.DoDefineMembers): Call DefineType() and
4994 DefineMembers() on all our iterators.
4995 (TypeContainer.Emit): Call Emit() on all our iterators.
4996 (TypeContainer.CloseType): Call CloseType() on all our iterators.
4998 * codegen.cs (EmitContext.CurrentIterator): New public field.
5000 2004-07-15 Martin Baulig <martin@ximian.com>
5003 (TypeManager.not_supported_exception_type): New type.
5005 2004-07-14 Martin Baulig <martin@ximian.com>
5008 (TypeManager.generic_ienumerable_type): New type.
5009 (TypeManager.generic_ienumerator_type): New type.
5012 (RootContext.interfaces_first_stage): Added
5013 "System.Collections.Generic.IEnumerator`1" and
5014 "System.Collections.Generic.IEnumerable`1".
5016 2004-07-14 Martin Baulig <martin@ximian.com>
5018 * iterators.cs: Use real error numbers.
5020 2004-07-14 Martin Baulig <martin@ximian.com>
5022 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
5023 requires this to be a System.Collection.IEnumerable and not a
5024 class implementing that interface.
5025 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
5027 2004-07-13 Marek Safar <marek.safar@seznam.cz>
5029 * class.cs: Fixed previous fix, it broke some error tests.
5031 2004-07-12 Martin Baulig <martin@ximian.com>
5033 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
5036 2004-07-14 Martin Baulig <martin@ximian.com>
5038 * decl.cs, expression.cs, generic.cs: Use a backqoute (`) and not
5039 an exclamation mark (!) for the generic arity to reflect the
5040 latest spec changes; ie. use "System.Collections.Generic.IList`1".
5042 2004-07-13 Martin Baulig <martin@ximian.com>
5044 * cs-tokenizer.cs (Tokenizer.parse_less_than): Allow array rank
5045 specifiers being part of a type argument.
5047 2004-07-13 Martin Baulig <martin@ximian.com>
5049 * expression.cs (MemberAccess.ResolveAsTypeStep): Use the full `!'
5050 name for generic types.
5052 2004-07-13 Martin Baulig <martin@ximian.com>
5054 * assign.cs (Assign.DoResolve): Moved the CS0131 check up a little
5057 2004-07-09 Miguel de Icaza <miguel@ximian.com>
5059 * assign.cs (LocalTemporary): Add new argument: is_address,If
5060 `is_address' is true, then the value that we store is the address
5061 to the real value, and not the value itself.
5063 * ecore.cs (PropertyExpr): use the new local temporary
5064 stuff to allow us to handle X.Y += z (where X is a struct)
5066 2004-07-08 Martin Baulig <martin@ximian.com>
5068 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
5069 not always return, just like we're doing in Using.Resolve().
5071 2004-07-07 Miguel de Icaza <miguel@ximian.com>
5073 * cs-parser.jay (fixed_statement): flag this as Pinned.
5075 2004-07-06 Miguel de Icaza <miguel@ximian.com>
5077 * typemanager.cs (TypeManager): Removed MakePinned method, this
5078 mechanism is replaced with the .NET 2.x compatible mechanism of
5079 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
5081 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
5082 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
5083 `IsFixed' property which has a different meaning.
5085 2004-07-02 Raja R Harinath <rharinath@novell.com>
5087 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
5088 visible from inside a nested class, not just the names of the
5089 immediately enclosing class.
5092 2004-06-24 Raja R Harinath <rharinath@novell.com>
5094 * expression.cs (BetterConversion): Remove buggy special-case
5095 handling of "implicit constant expression conversions". At this
5096 point, we already know that the conversion is possible -- we're
5097 only checking to see which is better.
5099 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5101 * cs-parser.jay: Added error CS0210 test.
5103 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5105 * cs-parser.jay: Added error CS0134 test.
5107 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5110 * cs-parser.jay: Added error CS0145 test.
5112 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5114 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
5116 2004-06-23 Ben Maurer <bmaurer@ximian.com>
5118 * expression.cs (StackAlloc.Resolve): The argument may not
5119 be a constant; deal with this case.
5121 2004-06-23 Marek Safar <marek.safar@seznam.cz>
5123 * attribute.cs (IndexerName_GetIndexerName): Renamed to
5124 GetIndexerAttributeValue.
5125 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
5127 * class.cs (Indexer.Define): Added error tests for CS0415,
5130 2004-06-23 Miguel de Icaza <miguel@ximian.com>
5132 * attribute.cs (Attribute.Resolve): Keep field code in sync with
5135 2004-06-23 Martin Baulig <martin@ximian.com>
5137 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
5138 neither return nor throw, reset the barrier as well. Fixes #60457.
5140 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
5142 * class.cs : EventAttributes is now set to None by default.
5143 This fixes bug #60459.
5145 2004-06-18 Marek Safar <marek.safar@seznam.cz>
5148 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
5149 Don't throw exception but return null (it's sufficient now).
5151 2004-06-18 Marek Safar <marek.safar@seznam.cz>
5153 * typemanager.cs (GetArgumentTypes): Faster implementation.
5155 2004-06-18 Martin Baulig <martin@ximian.com>
5157 * attribute.cs (Attribute.Resolve): Check whether we're an
5158 EmptyCast which a Constant child. Fixes #60333.
5160 2004-06-17 Ben Maurer <bmaurer@ximian.com>
5162 * statement.cs (EmitCollectionForeach): Account for the fact that
5163 not all valuetypes are in areas which we can take the address of.
5164 For these variables, we store to a temporary variable. Also, make
5165 sure that we dont emit a `callvirt' on a valuetype method.
5167 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5169 * expression.cs (StackAlloc.DoReSolve): Added test for
5170 negative parameter (CS0247).
5172 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5175 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
5177 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5180 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
5183 2004-06-14 Marek Safar <marek.safar@seznam.cz>
5185 Fix bug #58254 & cs1555.cs, cs1556.cs
5186 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
5188 2004-06-14 Marek Safar <marek.safar@seznam.cz>
5190 * cs-parser.jay: Added error CS1669 test for indexers.
5192 2004-06-18 Martin Baulig <martin@ximian.com>
5194 * generics.cs (GenericMethod.ctor): Don't take an Attributes
5195 argument. Fixes #60441.
5197 2004-06-16 Ben Maurer <bmaurer@ximian.com>
5198 * ecore.cs (MethodGroupExpr.Name): Revert Martin's patch.
5199 The name needs to have the actual name of the method in order
5200 for other tests (such as the one in OverloadResolve for Invoke
5201 on a delegate) to work. As well, it does not really help
5202 error reporting because the method group had multiple methods.
5203 * Makefile: Remove MCS_DEBUG, you can enable with the DEBUG_FLAGS.
5204 Make profiling work.
5206 2004-06-13 Martin Baulig <martin@ximian.com>
5208 * cs-parser.jay: Don't allow generic attributes.
5210 2004-06-13 Martin Baulig <martin@ximian.com>
5212 * class.cs (MemberBase.DoDefineBase): New protected method.
5213 (MemberBase.DoDefine): Compute the `flags' in the new
5214 DoDefineBase() which must be called first.
5215 (Method.Define): Call DoDefineBase() first so we have the flags
5216 when defining the generic method.
5218 * cs-parser.jay (interface_method_declaration): Support generic methods.
5220 2004-06-13 Martin Baulig <martin@ximian.com>
5222 * decl.cs (TypeName): Removed.
5223 (MemberName): Removed TypeName and MemberNow; now we just have
5226 * cs-parser.jay: Don't distinguish between type arguments and type
5227 parameters in the grammar and simplified the rules a bit. The
5228 reduce/reduce conflicts are now gone (except the one we inherited
5231 2004-06-11 Martin Baulig <martin@ximian.com>
5233 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
5234 call this twice: for params and varargs methods.
5236 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5239 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
5241 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5243 * attribute.cs (Attribute.GetValidTargets): Made public.
5246 (AbstractPropertyEventMethod): New class for better code sharing.
5247 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
5249 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
5251 2004-06-09 Martin Baulig <martin@ximian.com>
5253 * cs-parser.jay: Removed a reduce/reduce conflict.
5255 2004-06-03 Martin Baulig <martin@ximian.com>
5257 * generic.cs (ConstructedType.GetMemberAccess): Renamed to
5258 GetSimpleName() and return a SimpleName.
5260 * ecore.cs (SimpleName.Arguments): New public field.
5261 (SimpleName): Added overloaded ctor which takes an additional
5262 TypeArguments argument.
5263 (SimpleName.SimpleNameResolve): Added support for generic methods.
5264 (MethodGroupExpr.ResolveGeneric): New public method. The code was
5265 formerly in MemberAccess.DoResolve(), but we also need it in
5266 SimpleNameResolve().
5268 * expression.cs (MemberAccess.DoResolve): Use the new
5269 MethodGroupExpr.ResolveGeneric().
5271 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5273 * decl.cs: If possible, use lookuptypedirect here. We can only do
5274 this if there is no `.' after the namespace. Avoids using
5275 LookupType, which does lots of slow processing.
5276 (FindNestedType) New method, does what it says :-).
5277 * namespace.cs: use LookupTypeDirect.
5278 * rootcontext.cs: use membercache, if possible.
5279 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
5281 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5284 According to the spec,
5286 In a member access of the form E.I, if E is a single identifier,
5287 and if the meaning of E as a simple-name (§7.5.2) is a constant,
5288 field, property, localvariable, or parameter with the same type as
5289 the meaning of E as a type-name (§3.8), then both possible
5290 meanings of E are permitted.
5292 We did not check that E as a simple-name had the same type as E as
5295 This trivial check gives us 5-7% on bootstrap time.
5297 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5299 * expression.cs (Invocation.OverloadResolve): Avoid the
5300 use of hashtables and boxing here by allocating on demand.
5302 2004-05-30 Martin Baulig <martin@ximian.com>
5304 * rootcontext.cs (RootContext.LookupType): Don't cache things if
5305 we're doing a silent lookup. Don't try to lookup nested types in
5306 TypeManager.object_type (thanks to Ben Maurer).
5308 2004-05-30 Martin Baulig <martin@ximian.com>
5310 Committing a patch from Ben Maurer.
5312 * rootcontext.cs (RootContext.LookupType): Cache negative results.
5314 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5316 * convert.cs: add a trivial cache for overload operator resolution.
5318 2004-05-31 Marek Safar <marek.safar@seznam.cz>
5321 (AttributeTester.GetObsoleteAttribute): Returns instance of
5322 ObsoleteAttribute when type is obsolete.
5325 (TypeContainer.VerifyObsoleteAttribute): Override.
5326 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
5327 (MethodCode.VerifyObsoleteAttribute): Override.
5328 (MemberBase.VerifyObsoleteAttribute): Override.
5331 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
5332 and report proper error.
5335 (Delegate.VerifyObsoleteAttribute): Override.
5338 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
5339 and report proper error.
5340 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
5343 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
5347 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
5348 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
5349 Added test for ObsoleteAttribute.
5352 (Catch): Derived from Statement.
5354 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5356 * decl.cs: If possible, use lookuptypedirect here. We can only do
5357 this if there is no `.' after the namespace. Avoids using
5358 LookupType, which does lots of slow processing.
5359 (FindNestedType) New method, does what it says :-).
5360 * namespace.cs: use LookupTypeDirect.
5361 * rootcontext.cs: use membercache, if possible.
5362 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
5364 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5367 According to the spec,
5369 In a member access of the form E.I, if E is a single identifier,
5370 and if the meaning of E as a simple-name (§7.5.2) is a constant,
5371 field, property, localvariable, or parameter with the same type as
5372 the meaning of E as a type-name (§3.8), then both possible
5373 meanings of E are permitted.
5375 We did not check that E as a simple-name had the same type as E as
5378 This trivial check gives us 5-7% on bootstrap time.
5380 2004-05-30 Marek Safar <marek.safar@seznam.cz>
5382 Fixed bug #59071 & cs0160.cs
5383 * statement.cs (Try.Resolve): Check here whether order of catch
5384 clauses matches their dependencies.
5386 2004-05-30 Marek Safar <marek.safar@seznam.cz>
5389 * ecore.cs (SimpleName.SimpleNameResolve): Added test for
5392 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5394 * expression.cs (Invocation.OverloadResolve): Avoid the
5395 use of hashtables and boxing here by allocating on demand.
5397 2004-05-30 Martin Baulig <martin@ximian.com>
5399 * rootcontext.cs (RootContext.LookupType): Don't cache things if
5400 we're doing a silent lookup. Don't try to lookup nested types in
5401 TypeManager.object_type (thanks to Ben Maurer).
5403 2004-05-30 Martin Baulig <martin@ximian.com>
5405 Committing a patch from Ben Maurer.
5407 * rootcontext.cs (RootContext.LookupType): Cache negative results.
5409 2004-05-29 Martin Baulig <martin@ximian.com>
5411 * class.cs (IMethodData.ShouldIgnore): New method.
5413 * typemanager.cs (TypeManager.MethodFlags): Don't take a
5414 `Location' argument, we don't need it anywhere. Use
5415 `IMethodData.ShouldIgnore ()' instead of
5416 `MethodData.GetMethodFlags ()'.
5417 (TypeManager.AddMethod): Removed.
5418 (TypeManager.AddMethod2): Renamed to AddMethod.
5420 2004-05-29 Martin Baulig <martin@ximian.com>
5422 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
5424 * convert.cs (Convert.ImplicitReferenceConversion): If we're
5425 converting from a class type S to an interface type and we already
5426 have an object on the stack, don't box it again. Fixes #52578.
5428 2004-05-29 Martin Baulig <martin@ximian.com>
5430 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
5431 Added support for `params' parameters. Fixes #59267.
5433 2004-05-29 Martin Baulig <martin@ximian.com>
5435 * literal.cs (NullPointer): Provide a private .ctor which sets
5436 `type' to TypeManager.object_type. Fixes #59048.
5438 2004-05-29 Martin Baulig <martin@ximian.com>
5440 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
5441 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
5443 * ecore.cs (EventExpr.instance_expr): Make the field private.
5445 2004-05-26 Marek Safar <marek.safar@seznam.cz>
5447 Fixed bug #50080 & cs0214-2.cs
5448 * expression.cs (Cast.DoResolve): Check unsafe context here.
5450 * statement.cs (Resolve.DoResolve): Likewise.
5452 2004-05-26 Martin Baulig <martin@ximian.com>
5454 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
5456 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
5457 (RootContext.LookupType): Pass down the `silent' flag.
5459 2004-05-25 Martin Baulig <martin@ximian.com>
5462 (MethodGroupExpr.IdenticalTypeName): New public property.
5463 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
5464 expression actually refers to a type.
5466 2004-05-25 Martin Baulig <martin@ximian.com>
5468 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
5469 for #56176 and made it actually work.
5471 2004-05-25 Martin Baulig <martin@ximian.com>
5473 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
5474 (FieldExpr, PropertyExpr): Override and implement
5475 CacheTemporaries. Fixes #52279.
5477 2004-05-25 Miguel de Icaza <miguel@ximian.com>
5479 * location.cs: In the new compiler listing a file twice is a
5480 warning, not an error.
5482 2004-05-24 Martin Baulig <martin@ximian.com>
5484 * enum.cs (Enum.DefineType): For the `BaseType' to be a
5485 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
5487 2004-05-24 Martin Baulig <martin@ximian.com>
5489 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
5490 walking the `using' list. Fixes #53921.
5492 2004-05-24 Martin Baulig <martin@ximian.com>
5494 * const.cs (Const.LookupConstantValue): Added support for
5495 EmptyCast's; fixes #55251.
5497 2004-05-24 Martin Baulig <martin@ximian.com>
5499 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
5500 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
5501 which does the CS0135 check. The reason is that we first need to
5502 check whether the variable actually exists.
5504 2004-05-24 Martin Baulig <martin@ximian.com>
5506 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
5507 than RootContext.LookupType() to find the explicit interface
5510 2004-05-24 Raja R Harinath <rharinath@novell.com>
5512 * Makefile: Simplify. Use executable.make.
5513 * mcs.exe.sources: New file. List of sources of mcs.exe.
5515 2004-05-24 Anders Carlsson <andersca@gnome.org>
5519 Use the invariant culture when doing String.Compare for CLS case
5522 2004-05-23 Martin Baulig <martin@ximian.com>
5524 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
5525 don't have any dots. Fixes #52622, added cs0246-8.cs.
5527 * namespace.cs (NamespaceEntry.Lookup): Likewise.
5529 2004-05-23 Marek Safar <marek.safar@seznam.cz>
5531 * class.cs (MemberBase.Define): Reuse MemberType member for
5532 resolved type. Other methods can use it too.
5534 2004-05-23 Martin Baulig <martin@ximian.com>
5536 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
5537 the variable also exists in the current block (otherwise, we need
5538 to report a CS0103). Fixes #58670.
5540 2004-05-23 Martin Baulig <martin@ximian.com>
5542 * flowanalysis.cs (Reachability.Reachable): Compute this
5543 on-the-fly rather than storing it as a field.
5545 2004-05-23 Martin Baulig <martin@ximian.com>
5547 * flowanalysis.cs (Reachability.And): Manually compute the
5548 resulting `barrier' from the reachability.
5550 2004-05-23 Marek Safar <marek.safar@seznam.cz>
5553 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
5554 instance of ObsoleteAttribute when symbol is obsolete.
5557 (IMethodData): Extended interface for ObsoleteAttribute support.
5559 2004-05-22 Marek Safar <marek.safar@seznam.cz>
5561 * attribute.cs: Fix bug #55970
5563 2004-05-22 Marek Safar <marek.safar@seznam.cz>
5567 (GetObsoleteAttribute): New method. Creates the instance of
5569 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
5570 ObsoleteAttribute when member is obsolete.
5571 (AttributeTester.Report_ObsoleteMessage): Common method for
5572 Obsolete error/warning reporting.
5575 (TypeContainer.base_classs_type): New member for storing parent type.
5578 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
5579 for this MemberCore.
5581 2004-05-21 Marek Safar <marek.safar@seznam.cz>
5583 * attribute.cs, const.cs: Fix bug #58590
5585 2004-05-21 Martin Baulig <martin@ximian.com>
5587 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
5588 out parameters if the end of the method is unreachable. Fixes
5591 2004-05-21 Marek Safar <marek.safar@seznam.cz>
5593 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
5594 Hari was right, why extra method.
5596 2004-05-21 Marek Safar <marek.safar@seznam.cz>
5598 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
5600 2004-05-20 Martin Baulig <martin@ximian.com>
5602 * delegate.cs: Convert this file to Unix mode - like the original
5605 2004-05-20 Martin Baulig <martin@ximian.com>
5607 * attribute.cs: Convert this file to Unix mode - like the original
5610 2004-05-19 Marek Safar <marek.safar@seznam.cz>
5612 Fix bug #58688 (MCS does not report error when the same attribute
5615 * attribute.cs (Attribute.Emit): Distinction between null and default.
5617 2004-05-19 Raja R Harinath <rharinath@novell.com>
5619 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
5620 of a top-level attribute without an attribute target.
5621 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
5623 (Attribute.Conditional_GetConditionName),
5624 (Attribute.Obsolete_GetObsoleteMessage): Update.
5625 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
5626 part of ScanForIndexerName.
5627 (Attribute.CanIgnoreInvalidAttribute): New function.
5628 (Attribute.ScanForIndexerName): Move to ...
5629 (Attributes.ScanForIndexerName): ... here.
5630 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
5631 (Attributes.Search): New internal variant that can choose not to
5632 complain if types aren't resolved. The original signature now
5634 (Attributes.GetClsCompliantAttribute): Use internal variant, with
5635 complaints suppressed.
5636 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
5637 only if it not useful.
5638 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
5639 top-level for attributes that are shared between the assembly
5640 and a top-level class.
5641 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
5642 * class.cs: Update to reflect changes.
5643 (DefineIndexers): Fuse loops.
5644 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
5645 a couple more variants of attribute names.
5647 2004-05-18 Marek Safar <marek.safar@seznam.cz>
5649 Fix bug #52585 (Implemented explicit attribute declaration)
5652 (Attributable.ValidAttributeTargets): New abstract method. It gets
5653 list of valid attribute targets for explicit target declaration.
5654 (Attribute.Target): It holds target itself.
5655 (AttributeSection): Removed.
5656 (Attribute.CheckTargets): New method. It checks whether attribute
5657 target is valid for the current element.
5660 (EventProperty): New class. For events that are declared like
5661 property (with add and remove accessors).
5662 (EventField): New class. For events that are declared like field.
5665 * cs-parser.jay: Implemented explicit attribute target declaration.
5667 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
5668 Override ValidAttributeTargets.
5671 (ReturnParameter): Class for applying custom attributes on
5673 (ParameterAtribute): New class. Class for applying custom
5674 attributes on the parameter type.
5676 2004-05-17 Miguel de Icaza <miguel@ximian.com>
5678 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
5681 (Method): Allow UNSAFE here.
5683 * modifiers.cs: Support unsafe reporting.
5685 2004-05-17 Marek Safar <marek.safar@seznam.cz>
5687 * decl.cs: Fix bug #58478.
5689 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5691 * statement.cs: When checking for unreachable code on an EmptyStatement,
5692 set the location. Fixes bug #58488.
5694 2004-05-13 Miguel de Icaza <miguel@ximian.com>
5696 * driver.cs: Add -pkg handling.
5698 From Gonzalo: UseShelLExecute=false
5700 2004-05-12 Marek Safar <marek.safar@seznam.cz>
5703 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
5705 (Attribute.IsClsCompliaceRequired): Moved to base for better
5707 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
5708 when attribute is AttributeUsageAttribute.
5709 (Attribute.GetValidTargets): Simplified.
5710 (Attribute.GetAttributeUsage): New method returns AttributeUsage
5711 attribute for this type.
5712 (Attribute.ApplyAttributes): Method renamed to Emit and make
5714 (GlobalAttributeSection): New class for special handling of global
5715 attributes (assembly, module).
5716 (AttributeSection.Emit): New method.
5718 * class.cs: Implemented Attributable abstract methods.
5719 (MethodCore.LabelParameters): Moved to Parameter class.
5720 (Accessor): Is back simple class.
5721 (PropertyMethod): Implemented Attributable abstract class.
5722 (DelegateMethod): Implemented Attributable abstract class.
5723 (Event): New constructor for disctintion between normal Event
5724 and Event with accessors.
5726 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
5728 * codegen.cs, const.cs, decl.cs, delegate.cs:
5729 (CommonAssemblyModulClass): Implemented Attributable abstract class
5732 * enum.cs: Implement IAttributeSupport interface.
5733 (EnumMember): New class for emum members. Implemented Attributable
5737 (ParameterBase): Is abstract.
5738 (ReturnParameter): New class for easier [return:] attribute handling.
5740 * typemanager.cs: Removed builder_to_attr.
5742 2004-05-11 Raja R Harinath <rharinath@novell.com>
5745 * attribute.cs (Attribute.GetPositionalValue): New function.
5746 * class.cs (TypeContainer.VerifyMembers): New function.
5747 (TypeContainer.Emit): Use it.
5748 (ClassOrStruct): New base class for Class and Struct.
5749 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
5750 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
5752 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
5753 then each non-static field should have a FieldOffset attribute.
5754 Otherwise, none of the fields should have a FieldOffset attribute.
5755 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
5756 and FieldOffset attributes.
5757 * typemanager.cs (TypeManager.struct_layout_attribute_type)
5758 (TypeManager.field_offset_attribute_type): New core types.
5759 (TypeManager.InitCoreTypes): Initialize them.
5761 2004-05-11 Michal Moskal <malekith@pld-linux.org>
5763 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
5764 Return correct type.
5767 2004-05-09 Miguel de Icaza <miguel@ximian.com>
5769 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
5770 be implicitly converted to ulong.
5772 * expression.cs: The logic for allowing operator &, | and ^ worked
5773 was wrong, it worked before because we did not report an error in
5774 an else branch. Fixes 57895.
5776 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
5777 allow volatile fields to be reference types.
5779 2004-05-07 Miguel de Icaza <miguel@ximian.com>
5781 * driver.cs: Add support for /debug-
5783 2004-05-07 Raja R Harinath <rharinath@novell.com>
5785 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
5786 Add a 'complain' parameter to silence errors.
5787 (Attribute.Resolve): Update to changes. Put in sanity check to catch
5788 silently overlooked type-resolutions.
5789 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
5791 (Attributes.Search): New function.
5792 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
5793 (Attributes.GetAttributeFullName): Remove hack.
5794 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
5795 Update to reflect changes.
5796 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
5797 Use Attributes.Search instead of nested loops.
5799 2004-05-07 Marek Safar <marek.safar@seznam.cz>
5802 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
5803 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
5804 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
5806 * report.cs: (Report.Warning): Renamed to Warning_T because of
5807 parameter collision.
5809 2004-05-05 Raja R Harinath <rharinath@novell.com>
5811 * expression.cs (MemberAccess.ResolveMemberAccess):
5812 Exit with non-zero status after Report.Error.
5813 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
5815 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
5817 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
5819 * support.cs: Don't hang when the file is empty.
5821 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
5823 * support.cs: In SeekableStreamReader, compute the preamble size of the
5824 underlying stream. Position changes should take into account that initial
5827 2004-05-03 Todd Berman <tberman@sevenl.net>
5829 * driver.cs: remove unused GetSysVersion function.
5831 2004-05-03 Todd Berman <tberman@sevenl.net>
5833 * driver.cs: Remove the hack from saturday, as well as the hack
5834 from jackson (LoadAssemblyFromGac), also adds the CWD to the
5835 link_paths to get that bit proper.
5837 2004-05-01 Todd Berman <tberman@sevenl.net>
5839 * driver.cs: Try a LoadFrom before a Load, this checks the current
5840 path. This is currently a bug in mono that is be fixed, however, this
5841 provides a workaround for now. This will be removed when the bug
5844 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
5846 * CryptoConvert.cs: Updated to latest version. Fix issue with
5847 incomplete key pairs (#57941).
5849 2004-05-01 Todd Berman <tberman@sevenl.net>
5851 * driver.cs: Remove '.' from path_chars, now System.* loads properly
5854 2004-04-30 Jackson Harper <jackson@ximian.com>
5856 * codegen.cs: Open keys readonly.
5858 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5860 * typemanager.cs: don't report cyclic struct layout when a struct
5861 contains 2 or more fields of the same type. Failed for Pango.AttrShape
5862 which has 2 Pango.Rectangle fields.
5864 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
5866 * expression.cs: Handle IntPtr comparisons with IL code
5867 rather than a method call.
5869 2004-04-29 Martin Baulig <martin@ximian.com>
5871 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
5872 the list of PropertyInfo's in class hierarchy and find the
5873 accessor. Fixes #56013.
5875 2004-04-29 Martin Baulig <martin@ximian.com>
5877 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
5879 2004-04-29 Martin Baulig <martin@ximian.com>
5881 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
5883 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
5885 2004-04-29 Martin Baulig <martin@ximian.com>
5887 * class.cs (ConstructorInitializer.Resolve): Check whether the
5888 parent .ctor is accessible. Fixes #52146.
5890 2004-04-29 Martin Baulig <martin@ximian.com>
5892 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
5894 * statement.cs (Using.EmitLocalVariableDecls): Use
5895 TypeManager.idisposable_type, not typeof (IDisposable).
5896 (Foreach.EmitCollectionForeach): Added support for valuetypes.
5898 2004-04-29 Martin Baulig <martin@ximian.com>
5900 * class.cs (Event.Define): Don't emit the field and don't set
5901 RTSpecialName and SpecialName for events on interfaces. Fixes
5904 2004-04-29 Raja R Harinath <rharinath@novell.com>
5906 Refactor Attribute.ApplyAttributes.
5907 * attribute.cs (Attributable): New base class for objects that can
5908 have Attributes applied on them.
5909 (Attribute): Make AttributeUsage fields public.
5910 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
5911 (Attribute.IsInternalCall): New property.
5912 (Attribute.UsageAttr): Convert to a public read-only property.
5913 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
5914 (Attribute.ResolveType, Attribute.Resolve)
5915 (Attribute.ScanForIndexerName): Update to reflect changes.
5916 (Attribute.CheckAttributeTarget): Re-format.
5917 (Attribute.ApplyAttributes): Refactor, to various
5918 Attributable.ApplyAttributeBuilder methods.
5919 * decl.cs (MemberCore): Make Attributable.
5920 * class.cs (Accessor): Make Attributable.
5921 (MethodData.ApplyAttributes): Use proper attribute types, not
5923 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
5924 (TypeContainer.ApplyAttributeBuilder)
5925 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
5926 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
5927 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
5928 (Operator.ApplyAttributeBuilder): New factored-out methods.
5929 * const.cs (Const.ApplyAttributeBuilder): Likewise.
5930 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
5931 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
5932 * parameter.cs (ParameterBase): New Attributable base class
5933 that can also represent Return types.
5934 (Parameter): Update to the changes.
5936 2004-04-29 Jackson Harper <jackson@ximian.com>
5938 * driver.cs: Prefer the corlib system version when looking for
5939 assemblies in the GAC. This is still a hack, but its a better hack
5942 2004-04-29 Marek Safar <marek.safar@seznam.cz>
5944 * decl.cs, enum.cs: Improved error 3005 reporting.
5946 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
5947 (related_symbols): New private member for list of symbols
5948 related to reported error/warning.
5950 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
5952 2004-04-29 Martin Baulig <martin@ximian.com>
5954 * ecore.cs (Expression.Constantify): If we're an enum and
5955 TypeManager.TypeToCoreType() doesn't give us another type, use
5956 t.UnderlyingSystemType. Fixes #56178.
5958 2004-04-29 Martin Baulig <martin@ximian.com>
5960 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
5961 interfaces and for each interface, only add members directly
5962 declared in that interface. Fixes #53255.
5964 2004-04-28 Martin Baulig <martin@ximian.com>
5966 * expression.cs (ConditionalLogicalOperator): Use a temporary
5967 variable for `left' to avoid that we evaluate it more than once;
5970 2004-04-28 Martin Baulig <martin@ximian.com>
5972 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
5975 2004-04-28 Martin Baulig <martin@ximian.com>
5977 * statement.cs (LocalInfo.Resolve): Check whether the type is not
5980 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
5981 whether the type is not void (CS1547).
5983 2004-04-28 Martin Baulig <martin@ximian.com>
5985 * expression.cs (Unary.DoResolveLValue): Override this and report
5986 CS0131 for anything but Operator.Indirection.
5988 2004-04-28 Martin Baulig <martin@ximian.com>
5990 Committing a patch from Ben Maurer; see bug #50820.
5992 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
5995 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
5998 2004-04-28 Martin Baulig <martin@ximian.com>
6000 Committing a patch from Ben Maurer; see bug #50820.
6002 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
6005 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
6008 2004-04-28 Martin Baulig <martin@ximian.com>
6010 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
6011 (Block.AddLabel): Call DoLookupLabel() to only search in the
6014 2004-04-28 Martin Baulig <martin@ximian.com>
6016 * cfold.cs (ConstantFold.BinaryFold): Added special support for
6017 comparing StringConstants and NullLiterals in Equality and Inequality.
6019 2004-04-28 Jackson Harper <jackson@ximian.com>
6021 * driver.cs: Attempt to load referenced assemblies from the
6022 GAC. This is the quick and dirty version of this method that
6023 doesnt take into account versions and just takes the first
6024 canidate found. Will be good enough for now as we will not have more
6025 then one version installed into the GAC until I update this method.
6027 2004-04-28 Martin Baulig <martin@ximian.com>
6029 * typemanager.cs (TypeManager.CheckStructCycles): New public
6030 static method to check for cycles in the struct layout.
6032 * rootcontext.cs (RootContext.PopulateTypes): Call
6033 TypeManager.CheckStructCycles() for each TypeContainer.
6034 [Note: We only need to visit each type once.]
6036 2004-04-28 Martin Baulig <martin@ximian.com>
6038 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
6040 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
6041 success and added `out object value'. Use a `bool resolved' field
6042 to check whether we've already been called rather than
6043 `ConstantValue != null' since this breaks for NullLiterals.
6045 2004-04-28 Raja R Harinath <rharinath@novell.com>
6047 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
6048 setting of this flag, since the 'set' method may be non-public.
6050 2004-04-28 Raja R Harinath <rharinath@novell.com>
6052 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
6053 check on current_vector.Block.
6055 2004-04-27 Martin Baulig <martin@ximian.com>
6057 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
6058 a field initializer. Fixes #56459.
6060 2004-04-27 Martin Baulig <martin@ximian.com>
6062 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
6063 we're not attempting to use an indexer. Fixes #52154.
6065 2004-04-27 Martin Baulig <martin@ximian.com>
6067 * statement.cs (Return): Don't create a return label if we don't
6068 need it; reverts my change from January 20th. Thanks to Ben
6071 2004-04-27 Martin Baulig <martin@ximian.com>
6073 According to the spec, `goto' can only leave a nested scope, but
6076 * statement.cs (Block.LookupLabel): Only lookup in the current
6077 block, don't recurse into parent or child blocks.
6078 (Block.AddLabel): Check in parent and child blocks, report
6079 CS0140/CS0158 if we find a duplicate.
6080 (Block): Removed this indexer for label lookups.
6081 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
6082 this already does the error reporting for us.
6085 (FlowBranching.UsageVector.Block): New public variable; may be null.
6086 (FlowBranching.CreateSibling): Added `Block' argument.
6087 (FlowBranching.LookupLabel): New public virtual method. Lookup a
6088 label for the target of a `goto' and check whether we're not
6089 leaving a `finally'.
6091 2004-04-27 Martin Baulig <martin@ximian.com>
6093 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
6094 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
6097 2004-04-27 Martin Baulig <martin@ximian.com>
6099 * statement.cs (Block.AddLabel): Also check for implicit blocks
6100 and added a CS0158 check.
6102 2004-04-27 Martin Baulig <martin@ximian.com>
6104 * flowanalysis.cs (FlowBranchingLoop): New class.
6105 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
6106 UsageVector's instead of an ArrayList.
6107 (FlowBranching.Label): Likewise.
6108 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
6109 (FlowBranching.AddBreakVector): New method.
6111 2004-04-27 Miguel de Icaza <miguel@ximian.com>
6113 * attribute.cs: Small regression fix: only convert the type if we
6114 the type is different, fixes System.Drawing build.
6116 2004-04-27 Martin Baulig <martin@ximian.com>
6118 * attribute.cs (Attribute.Resolve): If we have a constant value
6119 for a named field or property, implicity convert it to the correct
6122 2004-04-27 Raja R Harinath <rharinath@novell.com>
6124 * statement.cs (Block.Block): Implicit blocks share
6125 'child_variable_names' fields with parent blocks.
6126 (Block.AddChildVariableNames): Remove.
6127 (Block.AddVariable): Mark variable as "used by a child block" in
6128 every surrounding block.
6129 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
6130 been used in a child block, complain about violation of "Invariant
6131 meaning in blocks" rule.
6132 * cs-parser.jay (declare_local_variables): Don't use
6133 AddChildVariableNames.
6134 (foreach_statement): Don't create an implicit block: 'foreach'
6137 2004-04-23 Miguel de Icaza <miguel@ximian.com>
6139 * convert.cs (ImplicitNumericConversion): 0 is also positive when
6140 converting from 0L to ulong. Fixes 57522.
6142 2004-04-22 Marek Safar <marek.safar@seznam.cz>
6144 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
6145 derived class hides via 'new' keyword field from base class (test-242.cs).
6146 TODO: Handle this in the more general way.
6148 * class.cs (CheckBase): Ditto.
6150 2004-04-22 Marek Safar <marek.safar@seznam.cz>
6152 * decl.cs (caching_flags): New member for storing cached values
6154 (MemberCore.Flags): New enum where bit flags for caching_flags
6156 (MemberCore.cls_compliance): Moved to caching_flags.
6157 (DeclSpace.Created): Moved to caching_flags.
6159 * class.cs: Use caching_flags instead of DeclSpace.Created
6161 2004-04-21 Miguel de Icaza <miguel@ximian.com>
6163 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
6164 if we are only a derived class, not a nested class.
6166 * typemanager.cs: Same as above, but do this at the MemberLookup
6167 level (used by field and methods, properties are handled in
6168 PropertyExpr). Allow for the qualified access if we are a nested
6171 2004-04-21 Marek Safar <marek.safar@seznam.cz>
6173 * class.cs: Refactoring.
6174 (IMethodData): New inteface; Holds links to parent members
6175 to avoid member duplication (reduced memory allocation).
6176 (Method): Implemented IMethodData interface.
6177 (PropertyBase): New inner classes for get/set methods.
6178 (PropertyBase.PropertyMethod): Implemented IMethodData interface
6179 (Event): New inner classes for add/remove methods.
6180 (Event.DelegateMethod): Implemented IMethodData interface.
6182 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
6183 EmitContext (related to class.cs refactoring).
6185 2004-04-21 Raja R Harinath <rharinath@novell.com>
6187 * delegate.cs (Delegate.VerifyApplicability): If the number of
6188 arguments are the same as the number of parameters, first try to
6189 verify applicability ignoring any 'params' modifier on the last
6193 2004-04-08 Martin Baulig <martin@ximian.com>
6195 Merged latest changes into gmcs. Please keep this comment in
6196 here, it makes it easier for me to see what changed in MCS since
6197 the last time I merged.
6199 2004-04-16 Raja R Harinath <rharinath@novell.com>
6201 * class.cs (TypeContainer.AddIndexer): Use
6202 'ExplicitInterfaceName' to determine if interface name was
6203 explicitly specified. 'InterfaceType' is not initialized at this time.
6204 (TypeContainer.DefineIndexers): Remove use of temporary list. The
6205 Indexers array is already in the required order. Initialize
6206 'IndexerName' only if there are normal indexers.
6207 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
6208 (TypeContainer.Emit): Emit DefaultMember attribute only if
6209 IndexerName is initialized.
6212 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
6214 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
6217 2004-04-15 Raja R Harinath <rharinath@novell.com>
6219 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
6223 * attribute.cs (Attribute.Resolve): Check for duplicate named
6227 2004-04-15 Miguel de Icaza <miguel@ximian.com>
6229 * iterators.cs (MarkYield): track whether we are in an exception,
6230 and generate code accordingly. Use a temporary value to store the
6231 result for our state.
6233 I had ignored a bit the interaction of try/catch with iterators
6234 since their behavior was not entirely obvious, but now it is
6235 possible to verify that our behavior is the same as MS .NET 2.0
6239 2004-04-14 Miguel de Icaza <miguel@ximian.com>
6241 * iterators.cs: Avoid creating temporaries if there is no work to
6244 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
6245 Enumerations, use TypeManager.EnumToUnderlying and call
6248 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
6251 (This.Emit): Use EmitContext.EmitThis to emit our
6254 (This.EmitAssign): Ditto.
6256 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
6257 codepaths, we will move all the functionality into
6260 (FieldExpr.EmitAssign): Ditto.
6262 This fixes several hidden bugs that I uncovered while doing a code
6263 review of this today.
6265 * codegen.cs (EmitThis): reworked so the semantics are more clear
6266 and also support value types "this" instances.
6268 * iterators.cs: Changed so that for iterators in value types, we
6269 do not pass the value type as a parameter.
6271 Initialization of the enumerator helpers is now done in the caller
6272 instead of passing the parameters to the constructors and having
6273 the constructor set the fields.
6275 The fields have now `assembly' visibility instead of private.
6277 2004-04-11 Miguel de Icaza <miguel@ximian.com>
6279 * expression.cs (Argument.Resolve): Check if fields passed as ref
6280 or out are contained in a MarshalByRefObject.
6282 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
6283 another compiler type.
6285 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
6287 * class.cs (Indexer.Define): use the new name checking method.
6288 Also, return false on an error.
6289 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
6290 (is_identifier_[start/part]_character): make static.
6292 2004-04-10 Miguel de Icaza <miguel@ximian.com>
6294 * expression.cs (Binary.ResolveOperator): Do no append strings
6295 twice: since we can be invoked more than once (array evaluation)
6296 on the same concatenation, take care of this here. Based on a fix
6297 from Ben (bug #56454)
6299 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
6301 * codegen.cs: Fix another case where CS1548 must be reported (when
6302 delay-sign isn't specified and no private is available #56564). Fix
6303 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
6304 error when MCS is used on the MS runtime and we need to delay-sign
6305 (which seems unsupported by AssemblyBuilder - see #56621).
6307 2004-04-08 Marek Safar <marek.safar@seznam.cz>
6309 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
6310 (TypeManager.ComputeNamespaces): Faster implementation for
6313 * compiler.csproj: Updated AssemblyName to mcs.
6315 2004-05-11 Jackson Harper <jackson@ximian.com>
6317 * Makefile: Preserve MONO_PATH
6319 2004-05-11 Jackson Harper <jackson@ximian.com>
6321 * Makefile: Use mono and mcs to build gmcs
6323 2004-05-03 Miguel de Icaza <miguel@ximian.com>
6325 * codegen.cs: Add patch from Robert Shade
6326 <rshade@dvsconsulting.com>, use FileAccess.Read on the keyfile, to
6329 2004-05-02 Sebastien Pouliot <sebastien@ximian.com>
6331 * CryptoConvert.cs: Updated to latest version. Fix issue with
6332 incomplete key pairs (#57941).
6334 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
6336 * codegen.cs: Fix another case where CS1548 must be reported (when
6337 delay-sign isn't specified and no private is available #56564). Fix
6338 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
6339 error when MCS is used on the MS runtime and we need to delay-sign
6340 (which seems unsupported by AssemblyBuilder - see #56621).
6342 2004-04-29 Jackson Harper <jackson@ximian.com>
6344 * Makefile: Set MONO_PATH to use the bootstrap corlib
6345 * driver.cs: Check the GAC for referenced assemblies.
6347 2004-04-29 Martin Baulig <martin@ximian.com>
6349 * Makefile (gmcs.exe): Set MONO_PATH to use `../class/lib/net_2_0'.
6351 2004-04-07 Martin Baulig <martin@ximian.com>
6353 * expression.cs (Binary.ResolveOperator): Added special case for
6354 Equality/Inequality between a type parameter and a null literal.
6356 2004-04-07 Martin Baulig <martin@ximian.com>
6358 * convert.cs: Check null literal -> type parameter conversions.
6360 2004-04-07 Martin Baulig <martin@ximian.com>
6362 * generic.cs (ConstructedType.CheckConstraints): Enforce the
6363 `class' and `struct' constraints.
6365 2004-04-07 Martin Baulig <martin@ximian.com>
6367 * generic.cs (SpecialConstraint): New public enum.
6368 (Constraints.Resolve): Added support for the `class' and `struct'
6371 * cs-parser.jay (type_parameter_constraint): Added support for the
6372 `class' and `struct' constraints.
6374 2004-04-07 Martin Baulig <martin@ximian.com>
6376 * support.cs (GenericConstraints): Replaced `Types' by
6377 `ClassConstraint' and `InterfaceConstraints'; added
6378 `HasClassConstraint'.
6380 2004-04-07 Martin Baulig <martin@ximian.com>
6383 (Constraints.InterfaceConstraints): New public property.
6384 (Constraints.Types): Make this property public
6385 (TypeParameter): Implement IMemberContainer.
6386 (TypeParameter.Define): Take a `GenericTypeParameterBuilder'
6387 instead of a TypeBuilder/MethodBuilder; pass the interface
6388 constraints to TypeManager.AddTypeParameter().
6389 (TypeParameter.DefineType): Just take an EmitContext and no
6390 TypeBuilder/MethodBuilder. Use the new public API.
6392 * typemanager.cs (TypeManager.AddTypeParameter): Added
6393 `TypeExpr[]' argument; add the interfaces to the
6394 `builder_to_ifaces' hash.
6395 (TypeManager.LookupMemberContainer): For
6396 GenericTypeParameterBuilders, get the TypeParameter from the
6397 `builder_to_type_param'.
6398 (TypeManager.FindMembers): For GenericTypeParameterBuilders, get
6399 the TypeParameter and call FindMembers on it.
6401 2004-04-07 Martin Baulig <martin@ximian.com>
6404 (MethodCore.GenericMethod): Moved this field here from Method.
6405 (MethodCore.IsDuplicateImplementation): Take the number of type
6406 parameters into account if we're a generic method.
6408 * expression.cs (Invocation.InferTypeArguments): Don't return true
6409 if `arguments' is null; we still need to check whether we actually
6410 don't need to infer anything in this case.
6411 (MemberAccess): Merged the functionality from GenericMemberAccess
6414 * generic.cs (GenericMemberAccess): Removed.
6416 2004-04-05 Martin Baulig <martin@ximian.com>
6418 * decl.cs (MemberCore): For generic classes, interfaces and
6419 structs, `Name' now includes the number of type parameters
6421 (DeclSpace.FindType): Removed the `num_type_args' argument; we now
6422 encode the number of type arguments in the type name.
6424 * expression.cs (Expression.MemberLookup): Removed the
6425 `num_type_args' argument; we now encode the number of type
6426 arguments in the type name.
6428 * ecore.cs (SimpleName): Encode the number of type arguments in
6429 the type name itself.
6431 * generic.cs (ConstructedType): Likewise.
6433 * tree.cs (Tree.RecordDecl): Take a `string' instead of a
6434 `MemberName'; we now include the number of type parameters in the
6437 * typemanager.cs (TypeManager.CheckGeneric): Removed.
6438 (TypeManager.MemberLookup): Removed the
6439 `num_type_args' argument; we now encode the number of type
6440 arguments in the type name.
6442 2004-04-03 Martin Baulig <martin@ximian.com>
6444 * decl.cs (MemberCore.ctor): Take a MemberName instead of a sting.
6445 (MemberCore.MemberName): Moved here from MemberBase.
6446 (DeclSpace.SetParameterInfo): Just take the constraints as an
6447 ArrayList; we already have the type parameters in our
6448 `MemberName'; also do the CS0080 reporting here.
6450 * cs-parser.jay (struct_declaration): Use `member_name' instead of
6451 `IDENTIFIER opt_type_parameter_list'; when constructing our
6452 `MemberName', it'll already include our type parameters.
6453 (class_declaration, interface_declaration): Likewise.
6454 (delegate_declaration): Likewise.
6455 (MakeName): Take a MemberName and return a MemberName.
6456 The following two changes are required to avoid shift/reduce conflicts:
6457 (member_name): Don't include a TypeName anymore; ie. this is now
6458 just 'IDENTIFIER opt_type_parameter_list'.
6459 (property_declaration, event_declaration): Use a
6460 `namespace_or_type_name' instead of a `member_name'.
6462 2004-04-03 Martin Baulig <martin@ximian.com>
6464 * decl.cs (MemberName): Renamed to `TypeName' and created a new
6466 (TypeName): Formerly known as MemberName.
6468 * namespace.cs (NamespaceEntry.UsingAlias): Take a `TypeName'
6469 instead of a `MemberName'.
6471 * cs-parser.jay (namespace_or_type_name): Create a TypeName.
6472 (member_name): New rule; create a MemberName.
6474 2004-04-02 Martin Baulig <martin@ximian.com>
6476 * namespace.cs (NamespaceEntry.VerifyUsing): Added error checking
6477 (CS0305 and CS0308).
6479 2004-04-02 Martin Baulig <martin@ximian.com>
6481 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Added
6482 support for nested types.
6484 2004-04-02 Martin Baulig <martin@ximian.com>
6486 * ecore.cs (IAlias): New public interface.
6487 (TypeExpr, TypeExpression): Implement IAlias.
6488 (TypeAliasExpression): New public class.
6490 * namespace.cs (Namespace): Implement IAlias.
6491 (Namespace.Lookup): Return an IAlias instead on an object.
6492 (Namespace.DefineName): Take an IAlias instead of an object.
6493 (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
6495 (NamespaceEntry.UsingAlias): Take a Membername instead of an
6497 (NamespaceEntry.LookupAlias): Return an IAlias instead on an
6499 (NamespaceEntry.Lookup): Likewise.
6501 * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
6504 * decl.cs (DeclSpace): Implement IAlias.
6505 (DeclSpace.LookupAlias): Return an IAlias instead of a string.
6507 * generic.cs (ConstructedType): Improved error checking.
6509 2004-04-02 Martin Baulig <martin@ximian.com>
6511 * convert.cs: Added type parameter conversions.
6514 (UnboxCast.Emit): Emit an `unbox.any' for type params.
6515 (ClassCast.Emit): If the source type is a type parameter, box it.
6516 If the target type is a type parameter, emit an `unbox.any'
6517 instead of a `classcast'.1
6519 2004-04-01 Martin Baulig <martin@ximian.com>
6521 * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
6523 2004-04-01 Martin Baulig <martin@ximian.com>
6525 * generic.cs (ConstructedType.CheckConstraints): Use
6526 Convert.ImplicitStandardConversionExists(); user-defined implicit
6527 conversions are not allowed according to the spec.
6529 2004-03-30 Martin Baulig <martin@ximian.com>
6531 * expression.cs (New): Added support for type parameters.
6534 (TypeManager.activator_type): New public static field.
6535 (TypeManager.activator_create_instance): Likewise.
6537 2004-03-30 Martin Baulig <martin@ximian.com>
6539 * typemanager.cs (TypeManager.HasConstructorConstraint): New
6542 2004-03-30 Martin Baulig <martin@ximian.com>
6544 * generic.cs (ConstructedType.CheckConstraints): Actually follow
6545 the spec here: the argument type must be convertible to the
6548 2004-03-30 Martin Baulig <martin@ximian.com>
6551 (TypeParameter.Define, TypeParameter.DefineMethod): Call
6552 TypeManager.AddTypeParameter().
6553 (ConstructedType.CheckConstraints): Re-enable this and actually
6554 check whether we have a constructor constraint.
6557 (TypeManager.builder_to_type_param): New static field.
6558 (TypeManager.AddTypeParameter): New static method.
6559 (TypeManager.LookupTypeParameter): New public method.
6561 2004-03-30 Martin Baulig <martin@ximian.com>
6563 * generic.cs (TypeParameter.DefineType): Return a boolean and use
6564 the new API to actually define the constructor constraint.
6567 (TypeManager.new_constraint_attr_type): New static field.
6568 (TypeManager.InitCoreTypes): Initialize it.
6570 2004-03-30 Martin Baulig <martin@ximian.com>
6572 * generic.cs (Constraints): Completed error checking, use correct
6575 2004-03-29 Martin Baulig <martin@ximian.com>
6577 * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
6579 * expression.cs (Invocation.InferTypeArguments): Added overloaded
6580 public version which takes a `ParameterData pd' instead of an
6583 2004-03-29 Martin Baulig <martin@ximian.com>
6585 * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
6588 2004-03-29 Martin Baulig <martin@ximian.com>
6590 * expression.cs (Argument.ResolveMethodGroup): If we're a
6591 ConstructedType, call GetMemberAccess() on it.
6593 2004-03-29 Martin Baulig <martin@ximian.com>
6595 * class.cs (MethodBase.CheckGenericOverride): New abstract method.
6596 (MethodCore.CheckGenericOverride): When overriding a generic
6597 method, check whether the constraints match.
6599 * support.cs (GenericConstraints): New public interface.
6600 (ParameterData.GenericConstraints): New public method.
6602 * parameter.cs (Parameter.Resolve): Check whether we're a generic
6603 method parameter and compute our constraints if appropriate.
6604 (Parameter.GenericConstraints): New public property.
6606 * generic.cs (Constraints): Implement GenericConstraints.
6608 2004-03-29 Martin Baulig <martin@ximian.com>
6610 * decl.cs (MemberCache.FindMemberToOverride): Use
6611 `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
6613 2004-03-29 Martin Baulig <martin@ximian.com>
6615 * generic.cs (GenericMethod.Define): Resolve our type parameters.
6617 2004-03-29 Martin Baulig <martin@ximian.com>
6619 * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
6620 not allowed on non-generic declarations").
6622 2004-03-29 Martin Baulig <martin@ximian.com>
6624 * expression.cs (Invocation.InferTypeArguments): Added overloaded
6625 public version of this method.
6627 * class.cs (MethodCore.IsDuplicateImplementation): Use
6628 Invocation.InferTypeArguments() to check this.
6630 2004-03-29 Martin Baulig <martin@ximian.com>
6632 * convert.cs: Use TypeManager.IsDelegateType() instead of
6633 comparing types correctly.
6635 2004-03-29 Martin Baulig <martin@ximian.com>
6637 * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
6638 types directly to make it work for generic instances.
6640 * typemanager.cs (TypeManager.IsSubclassOf): New static method.
6642 2004-03-29 Martin Baulig <martin@ximian.com>
6644 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
6647 2004-03-24 Martin Baulig <martin@ximian.com>
6649 * decl.cs (DeclSpace.FindType): Also use
6650 TypeManager.CheckGeneric() for types from the using clauses.
6652 2004-03-23 Martin Baulig <martin@ximian.com>
6654 * expression.cs (Invocation.OverloadResolve): Added `bool
6655 may_fail' argument and use it instead of the Location.IsNull() hack.
6657 2004-03-23 Martin Baulig <martin@ximian.com>
6659 * expression.cs (Invocation.InferType): Use correct type inference
6662 2004-03-23 Martin Baulig <martin@ximian.com>
6664 * ecore.cs (MethodGroupExpr.Name): Use
6665 TypeManager.CSharpSignature() instead of just the name.
6667 * expression.cs (Invocation.OverloadResolve): Provide better error
6669 (Invocation.DoResolve): OverloadResolve() never returns null
6670 without reporting an error, so removed the error -6 reporting here.
6672 2004-03-23 Martin Baulig <martin@ximian.com>
6674 * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
6677 * cs-parser.jay (delegate_declaration): Support generic delegates.
6679 * delegate.cs: Support generic delegates.
6681 2004-03-22 Martin Baulig <martin@ximian.com>
6683 * expression.cs (Invocation.InferParamsTypeArguments): New static
6684 method; does type inference for params arguments.
6686 2004-03-21 Martin Baulig <martin@ximian.com>
6688 * typemanager.cs (TypeManager.IsGenericMethod): New public static
6689 method; checks whether a method is a generic method.
6691 * expression.cs (Invocation.InferTypeArguments): New static method;
6692 infer type arguments for generic method invocation.
6694 * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
6695 property; we set this to true if we're resolving a generic method
6696 invocation and the user specified type arguments, ie. we're not
6697 doing type inference.
6699 2004-03-20 Martin Baulig <martin@ximian.com>
6701 * class.cs (MethodData.DeclaringType): New public property.
6702 (MethodData.Define): Set DeclaringType here.
6703 (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
6704 instead of OperatorMethodBuilder.DeclaringType.
6706 2004-03-20 Martin Baulig <martin@ximian.com>
6708 * cs-tokenizer.cs (xtoken): Return a special
6709 Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
6711 * cs-parser.jay (default_value_expression): Switch to the new
6714 2004-03-19 Martin Baulig <martin@ximian.com>
6716 * decl.cs (MemberName): New class. We use this to "construct"
6717 namespace_or_type_name's.
6719 * generics.cs (TypeArguments.GetDeclarations): New public method;
6720 returns the type arguments as a string[] and reports a CS0081 if
6721 one of them is not an identifier.
6723 * class.cs (MemberBase): The .ctor now takes the name as a
6724 MemberName instead of a string.
6725 (MemberBase.ExplicitInterfaceName): Changed type from string to
6727 (MemberBase.DoDefine): If we're an explicit implementation, the
6728 InterfaceType may be a generic instance.
6730 * cs-parser.jay (namespace_or_type_name): Return a MemberName.
6731 (namespace_name): Call MemberName.GetName () to transform the
6732 MemberName into a string and ensure we don't have any type
6734 (type_name): Call MemberName.GetTypeExpression() to transfrom the
6735 MemberName into an expression.
6736 (method_header): Use namespace_or_type_name instead of member_name.
6738 2004-04-07 Miguel de Icaza <miguel@ximian.com>
6740 * rootcontext.cs: Add new types to the boot resolution.
6742 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
6743 MulticastDelegate is not allowed.
6745 * typemanager.cs: Add new types to lookup: System.TypedReference
6748 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
6749 check for TypedReference or ArgIterator, they are not allowed.
6751 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
6752 makes us properly catch 1510 in some conditions (see bug 56016 for
6755 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
6757 * CryptoConvert.cs: update from corlib version
6760 2004-04-05 Miguel de Icaza <miguel@ximian.com>
6762 * class.cs (Indexer.Define): Check indexername declaration
6764 2004-04-05 Marek Safar <marek.safar@seznam.cz>
6766 * attribute.cs (IsClsCompliant): Fixed problem with handling
6767 all three states (compliant, not-compliant, undetected).
6769 2004-03-30 Marek Safar <marek.safar@seznam.cz>
6771 * attribute.cs (Attribute): Location is now public.
6772 (Resolve): Store resolved arguments (pos_values) in attribute class.
6773 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
6774 (GetClsCompliantAttributeValue): New method that gets
6775 CLSCompliantAttribute value.
6776 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
6777 if exists else null.
6778 (AttributeTester): New class for CLS-Compliant verification routines.
6780 * class.cs (Emit): Add CLS-Compliant verification.
6781 (Method.GetSignatureForError): Implemented.
6782 (Constructor.GetSignatureForError): Implemented
6783 (Constructor.HasCompliantArgs): Returns if constructor has
6784 CLS-Compliant arguments.
6785 (Constructor.Emit): Override.
6786 (Construcor.IsIdentifierClsCompliant): New method; For constructors
6787 is needed to test only parameters.
6788 (FieldBase.GetSignatureForError): Implemented.
6789 (TypeContainer): New member for storing base interfaces.
6790 (TypeContainer.FindMembers): Search in base interfaces too.
6792 * codegen.cs (GetClsComplianceAttribute): New method that gets
6793 assembly or module CLSCompliantAttribute value.
6794 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
6796 (ModuleClass.Emit): Add error 3012 test.
6798 * const.cs (Emit): Override and call base for CLS-Compliant tests.
6800 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
6801 state for all decl types.
6802 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
6803 if CLS-Compliant tests are required.
6804 (IsClsCompliaceRequired): New method. Analyze whether code
6805 must be CLS-Compliant.
6806 (IsExposedFromAssembly): New method. Returns true when MemberCore
6807 is exposed from assembly.
6808 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
6809 value or gets cached value.
6810 (HasClsCompliantAttribute): New method. Returns true if MemberCore
6811 is explicitly marked with CLSCompliantAttribute.
6812 (IsIdentifierClsCompliant): New abstract method. This method is
6813 used to testing error 3005.
6814 (IsIdentifierAndParamClsCompliant): New method. Common helper method
6815 for identifier and parameters CLS-Compliant testing.
6816 (VerifyClsCompliance): New method. The main virtual method for
6817 CLS-Compliant verifications.
6818 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
6819 null. I don't know why is null (too many public members !).
6820 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
6821 and get value of first CLSCompliantAttribute that found.
6823 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
6824 (VerifyClsCompliance): Override and add extra tests.
6826 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
6827 clscheck- disable CLS-Compliant verification event if assembly is has
6828 CLSCompliantAttribute(true).
6830 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
6831 ApllyAttribute is now called in emit section as in the other cases.
6832 Possible future Emit integration.
6833 (IsIdentifierClsCompliant): New override.
6834 (VerifyClsCompliance): New override.
6835 (GetEnumeratorName): Returns full enum name.
6837 * parameter.cs (GetSignatureForError): Implemented.
6839 * report.cs (WarningData): New struct for Warning message information.
6840 (LocationOfPreviousError): New method.
6841 (Warning): New method. Reports warning based on the warning table.
6842 (Error_T): New method. Reports error based on the error table.
6844 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
6845 verifications are done here.
6847 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
6849 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
6850 CLSCompliantAttribute.
6851 (all_imported_types): New member holds all imported types from other
6853 (LoadAllImportedTypes): New method fills static table with exported types
6854 from all referenced assemblies.
6855 (Modules): New property returns all assembly modules.
6857 2004-03-30 Miguel de Icaza <miguel@ximian.com>
6859 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
6860 throwing a parser error.
6862 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
6863 which removes the hardcoded get_/set_ prefixes for properties, as
6864 IL allows for the properties to be named something else.
6868 * expression.cs: Do not override operand before we know if it is
6871 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
6873 * typemanager.cs: support for pinned variables.
6875 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
6877 * decl.cs, typemanager.cs: Avoid using an arraylist
6878 as a buffer if there is only one result set.
6880 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
6882 * expression.cs: Make sure you cant call a static method
6883 with an instance expression, bug #56174.
6885 2004-03-29 Miguel de Icaza <miguel@ximian.com>
6887 * class.cs (IsDuplicateImplementation): Improve error reporting to
6888 flag 663 (method only differs in parameter modifier).
6890 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
6891 in preprocessor directives.
6893 * location.cs (LookupFile): Allow for the empty path.
6895 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
6896 better approach for some of that patch, but its failing with the
6897 CharSet enumeration. For now try/catch will do.
6899 * typemanager.cs: Do not crash if a struct does not have fields.
6902 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
6904 * expression.cs: cs0213, cant fix a fixed expression.
6907 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
6909 * cs-parser.jay: detect invalid embeded statements gracefully.
6912 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
6914 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
6917 the invocation type may not be a subclass of the tye of the item/
6918 The type of the item must be a subclass of the invocation item.
6923 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
6925 * attribute.cs: Added methods to get a string and a bool from an
6926 attribute. Required to information from AssemblyKeyFileAttribute,
6927 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
6928 * codegen.cs: Modified AssemblyName creation to include support for
6929 strongnames. Catch additional exceptions to report them as CS1548.
6930 * compiler.csproj: Updated include CryptoConvert.cs.
6931 * compiler.csproj.user: Removed file - user specific configuration.
6932 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
6933 Mono.Security assembly. The original class is maintained and tested in
6934 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
6935 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
6936 like CSC 8.0 (C# v2) supports.
6937 * Makefile: Added CryptoConvert.cs to mcs sources.
6938 * rootcontext.cs: Added new options for strongnames.
6940 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
6942 * driver.cs: For --expect-error, report error code `2'
6943 if the program compiled with no errors, error code `1' if
6944 it compiled with an error other than the one expected.
6946 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
6948 * compiler.csproj: Updated for Visual Studio .NET 2003.
6949 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
6950 * compiler.sln: Updated for Visual Studio .NET 2003.
6952 2004-03-24 Ravi Pratap M <ravi@ximian.com>
6954 * expression.cs: Fix bug #47234. We basically need to apply the
6955 rule that we prefer the conversion of null to a reference type
6956 when faced with a conversion to 'object' (csc behaviour).
6958 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
6960 * statement.cs: Shorter form for foreach, eliminates
6961 a local variable. r=Martin.
6963 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
6965 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
6966 checks if we can use brtrue/brfalse to test for 0.
6967 * expression.cs: use the above in the test for using brtrue/brfalse.
6970 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
6972 * expression.cs: Rewrite string concat stuff. Benefits:
6974 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
6975 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
6976 rather than a concat chain.
6978 * typemanager.cs: Add lookups for more concat overloads.
6980 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
6982 * expression.cs: Emit shorter il code for array init.
6999 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
7001 * statement.cs: Before, two switch blocks would be merged if the
7002 total size of the blocks (end_item - begin_item + 1) was less than
7003 two times the combined sizes of the blocks.
7005 Now, it will only merge if after the merge at least half of the
7010 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
7012 * class.cs : csc build fix for GetMethods(). See bug #52503.
7014 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
7016 * expression.cs: Make sure fp comparisons work with NaN.
7017 This fixes bug #54303. Mig approved this patch a long
7018 time ago, but we were not able to test b/c the runtime
7021 2004-03-19 Miguel de Icaza <miguel@ximian.com>
7023 * ecore.cs (TypExpr.GetHashCode): implement this overload.
7025 2004-03-19 Martin Baulig <martin@ximian.com>
7027 * class.cs (MemberCore.IsDuplicateImplementation): Check whether
7028 two overloads may unify for some type parameter substitutions and
7029 report a CS0408 if appropriate.
7031 2004-03-19 Martin Baulig <martin@ximian.com>
7033 * class.cs (MemberCore.IsDuplicateImplementation): Report the
7034 error here and not in our caller.
7036 2004-03-19 Martin Baulig <martin@ximian.com>
7038 * interface.cs: Completely killed this file.
7039 (Interface): We're now a TypeContainer and live in class.cs.
7041 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
7042 argument; we're now also called for interfaces.
7043 (TypeContainer.DefineMembers): Allow this method being called
7045 (TypeContainer.GetMethods): New public method; formerly known as
7046 Interface.GetMethod(). This is used by PendingImplementation.
7047 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
7048 it's now private and non-static.
7049 (Interface): Moved this here; it's now implemented similar to
7051 (Method, Property, Event, Indexer): Added `bool is_interface'
7052 argument to their .ctor's.
7053 (MemberBase.IsInterface): New public field.
7055 * cs-parser.jay: Create normal Method, Property, Event, Indexer
7056 instances instead of InterfaceMethod, InterfaceProperty, etc.
7057 (opt_interface_base): Removed; we now use `opt_class_base' instead.
7058 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
7060 2004-03-19 Martin Baulig <martin@ximian.com>
7062 * class.cs (MethodCore.IsDuplicateImplementation): New private
7063 method which does the CS0111 checking.
7064 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
7065 Use IsDuplicateImplementation().
7067 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
7069 * decl.cs (FindMemberToOverride): New method to find the correct
7070 method or property to override in the base class.
7072 - Make Method/Property use the above method to find the
7073 version in the base class.
7074 - Remove the InheritableMemberSignatureCompare as it is now
7077 This patch makes large code bases much faster to compile, as it is
7078 O(n) rather than O(n^2) to do this validation.
7080 Also, it fixes bug 52458 which is that nested classes are not
7081 taken into account when finding the base class member.
7083 Reviewed/Approved by Martin.
7085 2004-03-17 Martin Baulig <martin@ximian.com>
7087 * expression.cs (MemberAccess.DoResolve): Take the parent's number
7088 of type arguments into account; use the `real_num_type_args'
7089 approach like in DoResolveAsTypeStep().
7091 * generic.cs (GenericMemberAccess.DoResolve): Make this work for
7094 2004-03-17 Marek Safar <marek.safar@seznam.cz>
7096 * interface.cs: In all interface classes removed redundant
7097 member initialization.
7099 2004-03-16 Martin Baulig <martin@ximian.com>
7101 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
7103 2004-03-15 Miguel de Icaza <miguel@ximian.com>
7105 * decl.cs (DefineTypeAndParents): New helper method to define a
7106 type's containers before the type itself is defined; This is a
7107 bug exposed by the recent changes to Windows.Forms when an
7108 implemented interface was defined inside a class that had not been
7111 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
7113 (Check): Loop correctly to report errors modifiers
7114 (UNSAFE was not in the loop, since it was the same as TOP).
7116 * interface.cs: Every interface member now takes a ModFlags,
7117 instead of a "is_new" bool, which we set on the base MemberCore.
7119 Every place where we called "UnsafeOk" in the interface, now we
7120 call the proper member (InterfaceMethod.UnsafeOK) instead to get
7121 the unsafe settings from the member declaration instead of the
7122 container interface.
7124 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
7126 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
7127 `set_indexer_name' to the pending bits (one per type).
7129 We fixed a bug today that was picking the wrong method to
7130 override, since for properties the existing InterfaceMethod code
7131 basically ignored the method name. Now we make sure that the
7132 method name is one of the valid indexer names.
7134 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
7136 * support.cs (SeekableStreamReader): Keep track of stream byte
7137 positions and don't mix them with character offsets to the buffer.
7139 Patch from Gustavo Giráldez
7141 2004-03-15 Marek Safar <marek.safar@seznam.cz>
7143 * interface.cs (InterfaceSetGetBase): Removed double member
7144 initialization, base class does it as well.
7146 2004-03-13 Martin Baulig <martin@ximian.com>
7148 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
7149 when compiling corlib.
7151 2004-03-13 Miguel de Icaza <miguel@ximian.com>
7153 * convert.cs (ExplicitConversion): We were reporting an error on
7154 certain conversions (object_type source to a value type, when the
7155 expression was `null') before we had a chance to pass it through
7156 the user defined conversions.
7158 * driver.cs: Replace / and \ in resource specifications to dots.
7161 * class.cs: Add check for duplicate operators. Fixes 52477
7163 2004-03-11 Miguel de Icaza <miguel@ximian.com>
7165 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
7166 that are in the middle of the statements, not only at the end.
7169 * class.cs (TypeContainer.AddField): No longer set the
7170 `HaveStaticConstructor' flag, now we call it
7171 `UserDefineStaticConstructor' to diferentiate the slightly
7172 semantic difference.
7174 The situation is that we were not adding BeforeFieldInit (from
7175 Modifiers.TypeAttr) to classes that could have it.
7176 BeforeFieldInit should be set to classes that have no static
7181 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
7183 And most importantly Zoltan's comment:
7185 http://bugzilla.ximian.com/show_bug.cgi?id=44229
7187 "I think beforefieldinit means 'it's ok to initialize the type sometime
7188 before its static fields are used', i.e. initialization does not need
7189 to be triggered by the first access to the type. Setting this flag
7190 helps the JIT to compile better code, since it can run the static
7191 constructor at JIT time, and does not need to generate code to call it
7192 (possibly lots of times) at runtime. Unfortunately, mcs does not set
7193 this flag for lots of classes like String.
7195 csc sets this flag if the type does not have an explicit static
7196 constructor. The reasoning seems to be that if there are only static
7197 initalizers for a type, and no static constructor, then the programmer
7198 does not care when this initialization happens, so beforefieldinit
7201 This bug prevents the AOT compiler from being usable, since it
7202 generates so many calls to mono_runtime_class_init that the AOT code
7203 is much slower than the JITted code. The JITted code is faster,
7204 because it does not generate these calls if the vtable is type is
7205 already initialized, which is true in the majority of cases. But the
7206 AOT compiler can't do this."
7208 2004-03-10 Miguel de Icaza <miguel@ximian.com>
7210 * class.cs (MethodData.Emit): Refactor the code so symbolic
7211 information is generated for destructors; For some reasons we
7212 were taking a code path that did not generate symbolic information
7215 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
7217 * class.cs: Create a Constructor.CheckBase method that
7218 takes care of all validation type code. The method
7219 contains some code that was moved from Define.
7221 It also includes new code that checks for duplicate ctors.
7222 This fixes bug #55148.
7224 2004-03-09 Joshua Tauberer <tauberer@for.net>
7226 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
7227 a { ... }-style array creation invokes EmitStaticInitializers
7228 which is not good for reference-type arrays. String, decimal
7229 and now null constants (NullCast) are not counted toward
7230 static initializers.
7232 2004-03-05 Martin Baulig <martin@ximian.com>
7234 * location.cs (SourceFile.HasLineDirective): New public field;
7235 specifies whether the file contains or is referenced by a "#line"
7237 (Location.DefineSymbolDocuments): Ignore source files which
7238 either contain or are referenced by a "#line" directive.
7240 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
7242 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
7243 direct access to our parent, so check the method inline there.
7245 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
7247 * expression.cs (Invocation.EmitCall): Miguel's last commit
7248 caused a regression. If you had:
7253 In Foo the implict this would be null.
7255 2004-02-27 Miguel de Icaza <miguel@ximian.com>
7257 * expression.cs (Invocation.EmitCall): If the method is not
7258 virtual, do not emit a CallVirt to it, use Call.
7260 * typemanager.cs (GetFullNameSignature): Improve the method to
7261 cope with ".ctor" and replace it with the type name.
7263 * class.cs (ConstructorInitializer.Resolve): Now the method takes
7264 as an argument the ConstructorBuilder where it is being defined,
7265 to catch the recursive constructor invocations.
7267 2004-03-16 Martin Baulig <martin@ximian.com>
7269 * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
7270 ConstructedType, call ResolveType() on it to get the type rather
7271 than just using `expr.Type'.
7273 2004-03-16 Martin Baulig <martin@ximian.com>
7275 * generics.cs (ConstructedType.GetMemberAccess): Take the
7276 EmitContext instead on the TypeExpr and use
7277 ec.TypeContainer.CurrentType/ec.ContainerType.
7279 2004-03-16 Martin Baulig <martin@ximian.com>
7281 * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
7282 parameters before aliases.
7284 2004-03-16 Martin Baulig <martin@ximian.com>
7286 * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
7287 New oublic function; checks whether two generic instances may become
7288 equal under some instantiations (26.3.1).
7290 * class.cs (TypeContainer.Define): Call
7291 TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
7294 2004-03-16 Martin Baulig <martin@ximian.com>
7296 * class.cs (TypeContainer.GetClassBases): Moved
7297 Error_TypeParameterAsBase() here and also check whether the base
7298 class is not an attribute.
7300 2004-03-16 Martin Baulig <martin@ximian.com>
7302 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
7304 2004-03-16 Martin Baulig <martin@ximian.com>
7306 * class.cs (Error_TypeParameterAsBase): Use correct error number
7309 2004-03-16 Martin Baulig <martin@ximian.com>
7311 * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
7314 * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
7317 2004-03-15 Martin Baulig <martin@ximian.com>
7319 * typemanager.cs (TypeManager.GetFullName): New public method.
7320 (TypeManager.MemberLookup): Added `int_num_type_arguments'
7321 argument; only return members with the correct number of type
7323 (TypeManager.CheckGeneric): Allow -1 to bypass the check.
7324 (TypeManager.FilterWithClosure): Call CheckGeneric() to check
7325 whether the number of type arguments matches.
7327 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
7328 not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
7330 * expression.cs (MemberAccess): Added public `NumTypeArguments'
7331 field; it's set by the protected .ctor when we're actually a
7332 GenericMemberAccess.
7333 (MemberAccess.ResolveAsTypeStep): Compute the total number of type
7334 arguments and pass it to MemberLookupFinal ().
7336 * ecore.cs (Expression.MemberLookup): Added `int
7337 num_type_arguments' argument; only return members with the correct
7338 number of type arguments.
7339 (Expression.MemberLookupFailed): Check whether the MemberLookup
7340 failed because we did not have the correct number of type
7341 arguments; report CS0305 in this case.
7343 * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
7344 `e.ResolveAsTypeTerminal()' already did so.
7346 2004-03-15 Martin Baulig <martin@ximian.com>
7348 * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
7349 we're a ConstructedType; in this case, the caller must report an
7350 error (for instance CS0131).
7352 * generic.cs (TypeArguments): Added Location argument to the .ctor.
7353 (TypeArguments.Resolve): Actually report errors here.
7355 2004-03-15 Miguel de Icaza <miguel@ximian.com>
7357 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
7358 `set_indexer_name' to the pending bits (one per type).
7360 We fixed a bug today that was picking the wrong method to
7361 override, since for properties the existing InterfaceMethod code
7362 basically ignored the method name. Now we make sure that the
7363 method name is one of the valid indexer names.
7365 2004-03-15 Martin Baulig <martin@ximian.com>
7367 * typemanager.cs (TypeManager.IndexerPropertyName): Added support
7368 for generic instances.
7370 2004-03-13 Martin Baulig <martin@ximian.com>
7372 * class.cs (TypeContainer.DefineType): Call
7373 TypeManager.AddUserType() immediately after creating the
7374 TypeBuilder; pass all type parameters when creating the
7377 * decl.cs (DeclSpace.FindNestedType): New public method.
7378 (DeclSpace.FindType): Added `int num_type_args' argument; only
7379 return types with the correct number of type parameters.
7380 (DeclSpace.CountTypeParams): New public property.
7382 * ecore.cs (SimpleName.ctor): Added overloaded version which takes
7383 the number of type parameters; defaults to zero.
7385 * generic.cs (TypeArguments.Count): New public property.
7386 (ConstructedType.DoResolveAsTypeStep): First call
7387 ds.FindNestedType() to find out whether we're nested in the
7388 current generic type; in this case, we inherit all type parameters
7389 from the current class.
7391 * rootcontext.cs (RootContext.NamespaceLookup): Added `int
7392 num_type_args' argument.
7393 (RootContext.LookupType): Added overloaded version which takes the
7394 number of type arguments; only return types with the correct
7395 number of type arguments.
7397 * typemanager.cs (TypeManager.CheckGeneric): New public function;
7398 checks whether `Type t' has `int num_type_args'.
7400 2004-03-13 Martin Baulig <martin@ximian.com>
7402 * generic.cs (GenericMethod.DefineType): New method; calls
7403 DefineType() on all the type parameters.
7405 * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
7406 (MethodData.Define): If we're a generic method, call
7407 GenericMethod.DefineType() to define the type parameters.
7409 2004-03-10 Martin Baulig <martin@ximian.com>
7411 * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
7412 instead of IsAssignableFrom.
7414 2004-03-10 Martin Baulig <martin@ximian.com>
7416 * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
7418 * support.cs (ParameterData.HasArrayParameter): New property.
7419 (ReflectionParameters.ctor): Take a MethodBase instead of a
7420 ParameterInfo[]. If we have any type parameters, get the generic
7421 method definition and ask it whether we have variable arguments.
7423 2004-02-26 Miguel de Icaza <miguel@ximian.com>
7425 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
7426 routines to check if a type is an enumerable/enumerator allow
7427 classes that implement the IEnumerable or IEnumerator interfaces.
7429 * class.cs (Property, Operator): Implement IIteratorContainer, and
7430 implement SetYields.
7432 (Property.Define): Do the block swapping for get_methods in the
7433 context of iterators. We need to check if Properties also
7434 include indexers or not.
7436 (Operator): Assign the Block before invoking the
7437 OperatorMethod.Define, so we can trigger the Iterator code
7440 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
7441 Property and Operator classes are not created when we parse the
7442 declarator but until we have the block completed, so we use a
7443 singleton SimpleIteratorContainer.Simple to flag whether the
7444 SetYields has been invoked.
7446 We propagate this setting then to the Property or the Operator to
7447 allow the `yield' to function.
7449 2004-02-25 Marek Safar <marek.safar@seznam.cz>
7451 * codegen.cs: Implemented attribute support for modules.
7452 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
7453 Assembly/Module functionality.
7455 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
7456 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
7457 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
7459 2004-02-16 Marek Safar <marek.safar@seznam.cz>
7461 * interface.cs (FindMembers): The operation is performed on all base
7462 interfaces and not only on the first. It is required for future CLS Compliance patch.
7464 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
7466 * statement.cs, codegen.cs:
7467 This patch deals with patterns such as:
7469 public class List : IEnumerable {
7471 public MyEnumerator GetEnumerator () {
7472 return new MyEnumerator(this);
7475 IEnumerator IEnumerable.GetEnumerator () {
7479 public struct MyEnumerator : IEnumerator {
7484 Before, there were a few things we did wrong:
7485 1) we would emit callvirt on a struct, which is illegal
7486 2) we emited ldarg when we needed to emit ldarga
7487 3) we would mistakenly call the interface methods on an enumerator
7488 type that derived from IEnumerator and was in another assembly. For example:
7490 public class MyEnumerator : IEnumerator
7492 Would have the interface methods called, even if there were public impls of the
7493 method. In a struct, this lead to invalid IL code.
7495 2004-02-11 Marek Safar <marek.safar@seznam.cz>
7497 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
7500 * delegate.cs (Define): Fixed crash when delegate type is undefined.
7502 2004-02-11 Miguel de Icaza <miguel@ximian.com>
7504 * cs-parser.jay: Fix small regression: we were not testing V2
7505 compiler features correctly.
7507 * interface.cs: If the emit context is null, then create one
7509 2004-02-09 Marek Safar <marek.safar@seznam.cz>
7511 * decl.cs (GetSignatureForError): New virtual method to get full name
7514 * attribute.cs (IAttributeSupport): New interface for attribute setting.
7515 Now it is possible to rewrite ApplyAttributes method to be less if/else.
7517 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
7518 Duplicated members and code in these classes has been removed.
7519 Better encapsulation in these classes.
7521 2004-02-07 Miguel de Icaza <miguel@ximian.com>
7523 * assign.cs (Assign.DoResolve): When dealing with compound
7524 assignments, there is a new rule in ECMA C# 2.4 (might have been
7525 there before, but it is documented here) that states that in:
7529 If b is of type int, and the `op' is a shift-operator, then the
7530 above is evaluated as:
7534 * expression.cs (Binary.ResolveOperator): Instead of testing for
7535 int/uint/long/ulong, try to implicitly convert to any of those
7536 types and use that in pointer arithmetic.
7538 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
7539 method to print information for from the type, not from the
7540 null-method we were given.
7542 2004-02-01 Duncan Mak <duncan@ximian.com>
7544 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
7545 parsing for cmd, fixes bug #53694.
7547 2004-02-04 Marek Safar <marek.safar@seznam.cz>
7549 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
7550 in the member name duplication tests. Property and operator name duplication
7551 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
7553 2004-02-03 Marek Safar <marek.safar@seznam.cz>
7555 * interface.cs (PopulateMethod): Fixed crash when interface method
7556 returns not existing type (error test cs0246-3.cs).
7558 2004-02-02 Ravi Pratap M <ravi@ximian.com>
7560 * cs-parser.jay (interface_accessors): Re-write actions to also
7561 store attributes attached to get and set methods. Fix spelling
7564 (inteface_property_declaration): Modify accordingly.
7566 (InterfaceAccessorInfo): New helper class to store information to pass
7567 around between rules that use interface_accessors.
7569 * interface.cs (Emit): Apply attributes on the get and set
7570 accessors of properties and indexers too.
7572 * attribute.cs (ApplyAttributes): Modify accordingly to use the
7573 right MethodBuilder when applying attributes to the get and set accessors.
7575 2004-01-31 Miguel de Icaza <miguel@ximian.com>
7577 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
7579 2004-01-26 Miguel de Icaza <miguel@ximian.com>
7581 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
7583 2004-01-25 Miguel de Icaza <miguel@ximian.com>
7585 * cs-parser.jay: Remove YIELD token, instead use the new grammar
7586 changes that treat `yield' specially when present before `break'
7589 * cs-tokenizer.cs: yield is no longer a keyword.
7591 2004-01-23 Marek Safar <marek.safar@seznam.cz>
7593 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
7594 setting for default constructors.
7595 For default constructors are almost every time set wrong Modifier. The
7596 generated IL code has been alright. But inside mcs this values was
7597 wrong and this was reason why several of my CLS Compliance tests
7600 2004-02-27 Martin Baulig <martin@ximian.com>
7602 * generics.cs (ConstructedType.ResolveType): Make the nested type
7603 stuff actually work.
7605 2004-02-25 Martin Baulig <martin@ximian.com>
7607 * decl.cs (DeclSpace.CurrentTypeParameters): New protected
7608 property; returns the type parameters just from the current type,
7609 ie. with the ones from outer classes.
7610 (DeclSpace.LookupGeneric): First search in the current class, then
7612 (DeclSpace.initialize_type_params): When hiding a type parameter
7613 from an outer class, put it into the `type_param_list' anyways.
7615 * expression.cs (MemberAccess.expr): Made this field protected.
7617 * class.cs (TypeContainer.Define): The `CurrentType' just contains
7618 the type parameters from the current class.
7620 * generic.cs (ConstructedType.ResolveType): Support nested generic
7621 types by taking the type parameters which we inherit from outer
7622 classes into account.
7623 (GenericMemberAccess.ResolveAsTypeStep): Override this and added
7624 support for nested generic types.
7626 2004-02-23 Martin Baulig <martin@ximian.com>
7628 * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
7629 field and check whether we're nested inside a generic type.
7630 (DeclSpace.ResolveType): If we're resolving to a generic type
7631 definition, create a ConstructedType and return its resolved type.
7632 (DeclSpace.initialize_type_params): New private method;
7633 initializes the `type_param_list' field from the type parameters
7634 from this and all enclosing classes.
7635 (DeclSpace.TypeParameters): Call initialize_type_params() unless
7636 we're already initialized.
7638 2004-02-23 Martin Baulig <martin@ximian.com>
7640 * class.cs (Method.Define): Create the generic method before
7642 (Memberbase.DoDefine): Added DeclSpace argument (in addition to
7643 the TypeContainer one); we use this for generic methods.
7645 * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
7646 parent's TypeBuilder.
7648 2004-02-18 Martin Baulig <martin@ximian.com>
7650 * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
7651 to check for equality.
7653 2004-02-05 Martin Baulig <martin@ximian.com>
7655 * ecore.cs (FieldExpr.DoResolveLValue): If we have an
7656 `ec.TypeContainer.CurrentType', use it instead of
7657 `ec.ContainerType' to check whether we're in the type's ctor.
7659 2004-01-29 Martin Baulig <martin@ximian.com>
7661 * expression.cs (Invocation.DoResolve): If we're a
7662 `ConstructedType', then we're actually a generic method, so
7663 rewrite the expr as a GenericMemberAccess.
7665 * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
7666 here; manually parse it into a string.
7668 2004-01-28 Martin Baulig <martin@ximian.com>
7670 * typemanager.cs (TypeManager.IsEqual): New static method.
7671 (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
7672 check for equality instead of using `=='.
7674 2004-01-26 Martin Baulig <martin@ximian.com>
7676 * decl.cs (DeclSpace.CurrentType): New public field.
7678 * expression.cs (This.ResolveBase): If we have an
7679 `ec.TypeContainer.CurrentType', use it instead of
7682 * class.cs (TypeContainer.DefineType): If we're a generic type,
7683 create the `CurrentType' (unresolved).
7684 (TypeContainer.GenericType): New private field.
7685 (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
7686 it and store it in `GenericType' before creating the MemberCache.
7687 (TypeContainer.GetMembers): If we have a `GenericType', call
7688 TypeManager.FindMembers() on it.
7690 * interface.cs (Interface.GenericType): New private field.
7691 (Interface.DefineType): If we're a generic type, create the
7692 `CurrentType' (unresolved).
7693 (Interface.DefineMembers): If we have a `CurrentType', resolve it
7694 and store it in `GenericType' before creating the MemberCache.
7695 (Interface.GetMembers): If we have a `GenericType', call
7696 TypeManager.FindMembers() on it.
7698 2004-01-22 Martin Baulig <martin@ximian.com>
7700 * cs-parser.jay (namespace_or_type_name): Return an Expression,
7701 not a QualifiedIdentifier. This is what `type_name_expression'
7702 was previously doing.
7703 (type_name_expression): Removed; the code is now in
7704 `namespace_or_type_name'.
7705 (qualified_identifier): Removed, use `namespace_or_type_name'
7707 (QualifiedIdentifier): Removed this class.
7709 2004-01-22 Martin Baulig <martin@ximian.com>
7711 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
7712 not a string as alias name.
7714 2004-01-21 Miguel de Icaza <miguel@ximian.com>
7716 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
7717 #52730 bug, and instead compute correctly the need to use a
7718 temporary variable when requesting an address based on the
7719 static/instace modified of the field and the constructor.
7721 2004-01-21 Martin Baulig <martin@ximian.com>
7723 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
7724 class and namespace before looking up aliases. Fixes #52517.
7726 2004-01-21 Martin Baulig <martin@ximian.com>
7728 * flowanalysis.cs (UsageVector.Merge): Allow variables being
7729 assinged in a 'try'; fixes exception4.cs.
7731 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7732 * class.cs : Implemented parameter-less constructor for TypeContainer
7734 * decl.cs: Attributes are now stored here. New property OptAttributes
7736 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
7738 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
7740 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7742 * typemanager.cs (CSharpSignature): Now reports also inner class name.
7743 (CSharpSignature): New method for indexer and property signature.
7745 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7747 * pending.cs (IsVirtualFilter): Faster implementation.
7749 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7751 * typemanager.cs: Avoid inclusion of same assembly more than once.
7753 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7755 * cs-parser.jay: Fixed problem where the last assembly attribute
7756 has been applied also to following declaration (class, struct, etc.)
7758 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7760 * class.cs: Added error CS0538, CS0539 reporting.
7761 Fixed crash on Microsoft runtime when field type is void.
7763 * cs-parser.jay: Added error CS0537 reporting.
7765 * pending.cs: Added error CS0535 reporting.
7766 Improved error report for errors CS0536, CS0534.
7768 2004-01-20 Miguel de Icaza <miguel@ximian.com>
7770 Merge a few bits from the Anonymous Method MCS tree.
7772 * statement.cs (ToplevelBlock): New class for toplevel methods,
7773 will hold anonymous methods, lifted variables.
7775 * cs-parser.jay: Create toplevel blocks for delegates and for
7776 regular blocks of code.
7778 2004-01-20 Martin Baulig <martin@ximian.com>
7780 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
7781 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
7782 and `NeedExplicitReturn'; added `IsLastStatement'.
7783 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
7784 have a `ReturnLabel' or we're not unreachable.
7786 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
7787 child's reachability; don't just override ours with it. Fixes
7788 #58058 (lluis's example).
7789 (FlowBranching): Added public InTryOrCatch(), InCatch(),
7790 InFinally(), InLoop(), InSwitch() and
7791 BreakCrossesTryCatchBoundary() methods.
7793 * statement.cs (Return): Do all error checking in Resolve().
7794 Unless we are the last statement in a top-level block, always
7795 create a return label and jump to it.
7796 (Break, Continue): Do all error checking in Resolve(); also make
7797 sure we aren't leaving a `finally'.
7798 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
7799 statement in a top-level block.
7800 (Block.Flags): Added `IsDestructor'.
7801 (Block.IsDestructor): New public property.
7803 2004-01-20 Martin Baulig <martin@ximian.com>
7805 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
7807 2004-01-20 Martin Baulig <martin@ximian.com>
7809 * statement.cs (Statement.ResolveUnreachable): New public method.
7810 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
7811 (Block.Resolve): Resolve unreachable statements.
7813 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
7815 * expression.cs: We need to fix the case where we do
7816 not have a temp variable here.
7818 * assign.cs: Only expression compound assignments need
7819 temporary variables.
7821 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
7823 * flowanalysis.cs: Reduce memory allocation in a few ways:
7824 - A block with no variables should not allocate a bit
7826 - A method with no out parameters does not need any tracking
7827 for assignment of the parameters, so we need not allocate
7830 public readonly Type[] VariableTypes;
7831 public readonly string[] VariableNames;
7832 Are redundant. The data is already stored in the variable
7833 map, so we need not allocate another array for it.
7834 - We need to add alot of checks for if (params | locals) == null
7835 due to the first two changes.
7837 2004-01-18 Miguel de Icaza <miguel@ximian.com>
7839 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
7840 implement IMemoryLocation, we store a copy on a local variable and
7841 take the address of it. Patch from Benjamin Jemlich
7843 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
7844 to use a special "type_name_expression" rule which reduces the
7845 number of "QualifiedIdentifier" classes created, and instead
7846 directly creates MemberAccess expressions.
7848 2004-01-17 Miguel de Icaza <miguel@ximian.com>
7850 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
7851 that fixes #52853. Null literal assignment to ValueType
7853 * class.cs (MethodData.Emit): Instead of checking the name of the
7854 method to determine if its a destructor, create a new derived
7855 class from Method called Destructor, and test for that.
7857 * cs-parser.jay: Create a Destructor object instead of a Method.
7859 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
7863 2004-01-16 Miguel de Icaza <miguel@ximian.com>
7865 * expression.cs (Binary.ResolveOperator): Perform an implicit
7866 conversion from MethodGroups to their delegate types on the
7869 * delegate.cs: Introduce a new class DelegateCreation that is the
7870 base class for `NewDelegate' and `ImplicitDelegateCreation',
7871 factor some code in here.
7873 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
7874 conversion from MethodGroups to compatible delegate types.
7876 * ecore.cs (Expression.Resolve): Do not flag error 654
7877 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
7878 we allow conversions from MethodGroups to delegate types now.
7880 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
7881 assignments in v2 either.
7883 2004-01-10 Miguel de Icaza <miguel@ximian.com>
7885 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
7886 static read-only fields in ctors.
7888 Applied patch from Benjamin Jemlich
7890 * expression.cs (UnaryMutator): Avoid leaking local variables.
7892 2004-01-09 Miguel de Icaza <miguel@ximian.com>
7894 * cs-tokenizer.cs (IsCastToken): Allow the various native types
7895 here to return true, as they can be used like this:
7899 Fixed 49836 and all the other dups
7901 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
7903 * driver.cs: Implement /win32res and /win32icon.
7905 2004-01-08 Miguel de Icaza <miguel@ximian.com>
7907 * cs-parser.jay: Add a rule to improve error handling for the
7908 common mistake of placing modifiers after the type.
7910 2004-01-07 Miguel de Icaza <miguel@ximian.com>
7912 * cs-parser.jay (interface_event_declaration): Catch
7913 initialization of events on interfaces, and report cs0068
7915 * cs-parser.jay (interface_event_declaration): Catch
7916 initialization of events.
7918 * ecore.cs: Better report missing constructors.
7920 * expression.cs (Binary.ResolveOperator): My previous bug fix had
7921 the error reporting done in the wrong place. Fix.
7923 * expression.cs (Binary.ResolveOperator): Catch the
7924 operator + (E x, E y) error earlier, and later allow for implicit
7925 conversions in operator +/- (E e, U x) from U to the underlying
7928 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
7929 52596, if the container class is abstract, the default constructor
7930 is protected otherwise its public (before, we were always public).
7932 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
7935 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
7936 Jemlich that fixes bug #52597, MCS was generating invalid code for
7937 idisposable structs. Thanks to Ben for following up with this
7940 2004-01-06 Miguel de Icaza <miguel@ximian.com>
7942 * driver.cs: Allow assemblies without code to be generated, fixes
7945 2004-01-07 Nick Drochak <ndrochak@gol.com>
7947 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
7949 2004-01-05 Miguel de Icaza <miguel@ximian.com>
7951 * cs-parser.jay: Add rules to improve error reporting if fields or
7952 methods are declared at the namespace level (error 116)
7954 * Add rules to catch event add/remove
7956 2004-01-04 David Sheldon <dave-mono@earth.li>
7958 * expression.cs: Added matching ")" to error message for
7961 2004-01-03 Todd Berman <tberman@gentoo.org>
7963 * ecore.cs, attribute.cs:
7964 Applying fix from #52429.
7966 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
7968 * ecore.cs, expression.cs, statement.cs:
7969 Total rewrite of how we handle branching. We
7970 now handle complex boolean expressions with fewer
7971 jumps. As well if (x == 0) no longer emits a ceq.
7973 if (x is Foo) is much faster now, because we generate
7976 Overall, we get a pretty big improvement on our benchmark
7977 tests. The code we generate is smaller and more readable.
7979 I did a full two-stage bootstrap. The patch was reviewed
7980 by Martin and Miguel.
7982 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
7984 * cs-parser.jay: Make primary_expression not take a QI.
7985 we dont need this because the member_access rule covers
7986 us here. So we replace the rule with just IDENTIFIER.
7988 This has two good effects. First, we remove a s/r conflict.
7989 Second, we allocate many fewer QualifiedIdentifier objects.
7991 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
7993 * attribute.cs: Handle MarshalAs attributes as pseudo, and
7994 set the correct information via SRE. This prevents
7995 hanging on the MS runtime. Fixes #29374.
7997 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
7999 * convert.cs: correctly handle conversions to value types
8000 from Enum and ValueType as unboxing conversions.
8002 Fixes bug #52569. Patch by Benjamin Jemlich.
8004 2004-01-02 Ravi Pratap <ravi@ximian.com>
8006 * expression.cs (BetterConversion): Prefer int -> uint
8007 over int -> ulong (csc's behaviour). This fixed bug #52046.
8009 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
8011 * decl.cs (MemberCache.FindMembers): now returns a
8014 * typemanager.cs: In general, go with with ^^.
8015 (CopyNewMethods): take an IList.
8016 (RealMemberLookup): Only allocate an arraylist
8017 if we copy from two sets of methods.
8019 This change basically does two things:
8020 1) Fewer array lists allocated due to CopyNewMethods.
8021 2) the explicit cast in MemberList costed ALOT.
8023 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
8025 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
8026 a hashtable to avoid needless string allocations when an identifier is
8027 used more than once (the common case).
8029 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8031 * pending.cs: MS's TypeBuilder.GetInterfaces ()
8032 is broken, it will not return anything. So, we
8033 have to use the information we have in mcs to
8036 * typemanager.cs: Add a cache for GetInterfaces,
8037 since this will now be used more often (due to ^^)
8039 (GetExplicitInterfaces) New method that gets the
8040 declared, not effective, interfaces on a type
8041 builder (eg, if you have interface IFoo, interface
8042 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
8045 This patch makes MCS able to bootstrap itself on
8048 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8050 * expression.cs: Remove the Nop's that Miguel put
8053 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8055 * report.cs, codegen.cs: Give the real stack trace to
8056 the error when an exception is thrown.
8058 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8060 * decl.cs: only allocate hashtables for ifaces if
8063 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8065 * expression.cs: fix the error from cs0121-2.cs
8066 (a parent interface has two child interfaces that
8067 have a function with the same name and 0 params
8068 and the function is called through the parent).
8070 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
8072 * class.cs, rootcontext.cs, typmanager.cs: do not
8075 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
8077 * codegen.cs: remove stack for the ec flow branching.
8078 It is already a linked list, so no need.
8080 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
8082 * Makefile: Allow custom profiler here.
8084 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8086 * typemanager.cs (LookupType):
8087 - Use a static char [], because split takes
8088 a param array for args, so it was allocating
8090 - Do not store true in a hashtable, it boxes.
8092 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8094 * flowanalysis.cs: bytify common enums.
8096 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8098 * modifiers.cs: Add a new set of flags for the
8099 flags allowed on explicit interface impls.
8100 * cs-parser.jay: catch the use of modifiers in
8101 interfaces correctly.
8102 * class.cs: catch private void IFoo.Blah ().
8104 All related to bug #50572.
8106 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8108 * decl.cs: Rewrite the consistant accessability checking.
8109 Accessability is not linear, it must be implemented in
8110 a tableish way. Fixes #49704.
8112 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8114 * expression.cs: Handle negation in a checked context.
8115 We must use subtraction from zero. Fixes #38674.
8117 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8119 * class.cs: Ignore static void main in DLLs.
8120 * rootcontext.cs: Handle the target type here,
8121 since we are have to access it from class.cs
8122 * driver.cs: account for the above.
8124 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8126 * report.cs: Give line numbers and files if available.
8128 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
8130 * driver.cs: Implement /addmodule.
8132 * typemanager.cs: Change 'modules' field so it now contains Modules not
8135 2003-12-20 Martin Baulig <martin@ximian.com>
8137 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
8138 (FieldBase.IsAssigned): Removed this field.
8139 (FieldBase.SetAssigned): New public method.
8140 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
8142 2003-12-20 Martin Baulig <martin@ximian.com>
8144 * expression.cs (LocalVariableReference.DoResolve): Don't set
8145 `vi.Used' if we're called from DoResolveLValue().
8147 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
8148 returns the usage vector it just merged into the current one -
8149 pass this one to UsageWarning().
8150 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
8151 of the `EmitContext', don't call this recursively on our children.
8153 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
8155 * driver.cs: Implement /target:module.
8157 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
8159 * support.cs (CharArrayHashtable): New helper class.
8161 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
8162 char arrays, not strings, so we can avoid creating a string in
8163 consume_identifier if the identifier is a keyword.
8165 2003-12-16 Martin Baulig <martin@ximian.com>
8167 * statement.cs (LocalInfo.Assigned): Removed this property.
8168 (LocalInfo.Flags): Removed `Assigned'.
8169 (LocalInfo.IsAssigned): New public method; takes the EmitContext
8170 and uses flow analysis.
8171 (Block.UsageWarning): Made this method private.
8172 (Block.Resolve): Call UsageWarning() if appropriate.
8174 * expression.cs (LocalVariableReference.DoResolve): Always set
8175 LocalInfo.Used here.
8177 2003-12-13 Martin Baulig <martin@ximian.com>
8179 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
8180 any value here; we're now using flow analysis to figure out
8181 whether a statement/block returns a value.
8183 2003-12-13 Martin Baulig <martin@ximian.com>
8185 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
8187 (FlowBranching.MergeFinally): Don't call
8188 `branching.CheckOutParameters()' here, this is called in
8190 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
8191 when adding the `finally' vector.
8193 2003-12-13 Martin Baulig <martin@ximian.com>
8196 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
8197 actually work and also fix #48962.
8199 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
8201 * decl.cs: Do not check System.Object for nested types,
8202 since we know it does not have any. Big bang for buck:
8207 corlib: 17.99 seconds
8211 corlib: 17.39 seconds
8213 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
8215 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
8216 time we are returning 0 members, so we save alot here.
8218 2003-12-11 Martin Baulig <martin@ximian.com>
8220 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
8221 `MergeChild()', also just take the `FlowBranching' as argument;
8222 call Merge() on it and return the result.
8223 (FlowBranching.Merge): We don't need to do anything if we just
8226 2003-12-11 Martin Baulig <martin@ximian.com>
8228 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
8229 them in an `ArrayList' to reduce memory usage. Thanks to Ben
8230 Maurer for this idea.
8232 2003-12-11 Martin Baulig <martin@ximian.com>
8234 * flowanalysis.cs (MergeResult): This class is now gone; we now
8235 use the `UsageVector' for this. The reason for this is that if a
8236 branching just has one sibling, we don't need to "merge" them at
8237 all - that's the next step to do.
8238 (FlowBranching.Merge): We now return a `UsageVector' instead of a
8241 2003-12-11 Martin Baulig <martin@ximian.com>
8243 Reworked flow analyis and made it more precise and bug-free. The
8244 most important change is that we're now using a special `Reachability'
8245 class instead of having "magic" meanings of `FlowReturns'. I'll
8246 do some more cleanups and optimizations and also add some more
8247 documentation this week.
8249 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
8250 largely reworked this class.
8251 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
8252 the new `Reachability' class instead of having "magic" values here.
8253 (FlowBranching): We're now using an instance of `Reachability'
8254 instead of having separate `Returns', `Breaks' etc. fields.
8256 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
8257 based on flow analysis; ignore the return value of block.Emit ().
8259 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
8261 * driver.cs typemanager.cs: Find the mono extensions to corlib even
8262 if they are private.
8264 2003-12-09 Martin Baulig <martin@ximian.com>
8266 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
8267 call them directly on the UsageVector.
8269 2003-12-09 Martin Baulig <martin@ximian.com>
8271 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
8272 Changed return type from `FlowReturns' to `Reachability'.
8274 2003-12-09 Martin Baulig <martin@ximian.com>
8276 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
8277 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
8278 `Reachable' fields with a single `Reachability' one.
8280 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8282 * class.cs (FindMembers): Remove foreach's.
8295 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8300 This patch does a few things:
8301 1. EmptyStatement is now a singleton, so it is never reallocated.
8302 2. All blah is EmptyStatement constructs have been changed to
8303 blah == EmptyStatement.Value, which is much faster and valid
8304 now that EmptyStatement is a singleton.
8305 3. When resolving a block, rather than allocating a new array for
8306 the non-empty statements, empty statements are replaced with
8307 EmptyStatement.Value
8308 4. Some recursive functions have been made non-recursive.
8309 Mainly the performance impact is from (3), however (1) and (2) are needed for
8310 this to work. (4) does not make a big difference in normal situations, however
8311 it makes the profile look saner.
8316 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
8317 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
8318 Total memory allocated: 56397 KB
8321 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
8322 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
8323 Total memory allocated: 55666 KB
8325 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8327 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
8328 than the hashtable in a hashtable version
8330 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
8331 we always end up concating a string. This results in a huge perf
8332 loss, because many strings have to be tracked by the GC. In this
8333 patch, we first use a hashtable that works with two keys, so that
8334 the strings do not need to be concat'ed.
8345 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8347 * Makefile: Add a new target `do-time' that does a quick and simple
8348 profile, leaving easy to parse output.
8350 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
8352 * codegen.cs (Init): Create the dynamic assembly with
8353 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
8355 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
8357 * support.cs: Make the PtrHashtable use only one
8358 instance of its comparer.
8360 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
8362 * typemanager.cs: Fix lookup of GetNamespaces.
8364 2003-11-29 Miguel de Icaza <miguel@ximian.com>
8366 * expression.cs: Removed redundant line.
8368 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
8369 ArrayLists, use for loops with bounds.
8371 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
8374 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
8375 arraylists, use for loop with bounds.
8377 The above three changes give us a 0.071 second performance
8378 improvement out of 3.294 seconds down to 3.223. On my machine
8379 the above changes reduced the memory usage by 1,387 KB during
8382 * cs-parser.jay (QualifiedIdentifier): New class used to represent
8383 QualifiedIdentifiers. Before we created a new string through
8384 concatenation, and mostly later on, the result would be
8385 manipulated by DecomposeQI through string manipulation.
8387 This reduced the compiler memory usage for bootstrapping from
8388 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
8389 compile times in 0.05 seconds.
8391 2003-11-28 Dick Porter <dick@ximian.com>
8393 * support.cs: Do string compares with the Invariant culture.
8401 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
8402 the comparison is done with the Invariant culture.
8404 2003-11-27 Miguel de Icaza <miguel@ximian.com>
8406 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
8407 GetEnumerator method.
8409 (ProbeCollectionType): Iterate starting at the most specific type
8410 upwards looking for a GetEnumerator
8412 * expression.cs: Shift count can be up to 31 for int/uint and 63
8415 2003-11-26 Miguel de Icaza <miguel@ximian.com>
8417 * statement.cs (Block.LookupLabel): Also look for the label on the
8418 children blocks. Use a hash table to keep track of visited
8421 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
8422 we actually did transform the other operand, otherwise fall back
8423 to the common codepath that casts to long.
8425 * cs-tokenizer.cs: Use the same code pattern as the int case.
8426 Maybe I should do the parsing myself, and avoid depending on the
8427 Parse routines to get this done.
8429 2003-11-25 Miguel de Icaza <miguel@ximian.com>
8431 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
8432 which fixes bug 51347. This time test it.
8434 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
8435 attributes for example can not tell the difference between these.
8436 The difference was only a syntax feature of the language.
8438 * attribute.cs: Apply attributes to delegates.
8440 * delegate.cs: Call the apply attributes method.
8442 2003-11-24 Miguel de Icaza <miguel@ximian.com>
8444 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
8445 comparing 0 vs Byte.MinValue, not the value
8447 (ImplicitConversionRequired): When reporting a conversion error,
8448 use error 31 to print out the constant error instead of the
8451 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
8452 which fixes bug 51347.
8454 2003-11-22 Miguel de Icaza <miguel@ximian.com>
8456 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
8457 which fixes the -warnaserror command line option.
8459 2003-11-21 Miguel de Icaza <miguel@ximian.com>
8461 * cfold.cs (DoNumericPromotions): During constant folding of
8462 additions on UIntConstant, special case intconstants with
8463 IntConstants like we do on the expression binary operator.
8465 2003-11-12 Miguel de Icaza <miguel@ximian.com>
8467 * convert.cs (ImplicitReferenceConversion): We were missing a case
8468 (System.Enum are not value types or class types, so we need to
8469 classify them separatedly).
8471 * driver.cs: We do not support error 2007.
8473 2003-11-12 Jackson Harper <jackson@ximian.com>
8475 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
8476 system directory. Also use the full file name so users can
8477 libraries names mscorlib-o-tron.dll in a non system dir.
8479 2004-01-04 David Sheldon <dave-mono@earth.li>
8481 * expression.cs: Added matching ")" to error message for CS0077.
8483 2003-12-19 Martin Baulig <martin@ximian.com>
8485 * typemanager.cs (TypeManager.IsEqualGenericType): New public
8486 static method; see documentation in the method.
8487 (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
8489 * convert.cs (Convert.ImplicitReferenceConversion,
8490 Convert.ImplicitReferenceConversionExists): Add support for
8491 generic type declarations; see gen-36.cs.
8493 2003-12-19 Martin Baulig <martin@ximian.com>
8495 * pending.cs (Pending.InterfaceMethod): Use
8496 `Type.IsAssignableFrom()' instead of `=='.
8498 2003-12-18 Martin Baulig <martin@ximian.com>
8500 * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
8503 * convert.cs (Convert.ImplicitStandardConversionExists): Use
8504 `expr_type.Equals (target_type)' instead of `=='.
8506 2003-12-08 Martin Baulig <martin@ximian.com>
8508 * generics.cs (Constraints.Types): Removed.
8509 (Constraints.Resolve): Just resolve everything to TypeExpr's, not
8511 (Constraints.ResolveTypes): New public method; resolves the
8512 TypeExpr's to Type's.
8513 (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
8514 longer takes the constraints.
8515 (TypeParameter.DefineMethod): Likewise.
8516 (TypeParameter.DefineType): New public method. Calls
8517 `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
8520 2003-12-08 Martin Baulig <martin@ximian.com>
8522 * convert.cs (Convert.ImplicitConversionStandard): Use
8523 `expr_type.Equals (target_type)' instead of `=='.
8525 2003-12-08 Martin Baulig <martin@ximian.com>
8527 * typemanager.cs (TypeManager.GetReferenceType): Call
8528 `Type.MakeByRefType ()'.
8530 2003-12-08 Martin Baulig <martin@ximian.com>
8532 * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
8533 just has some special meaning in some situations. For instance,
8534 it is allowed to use `where' as the name of a variable etc.
8536 2003-12-04 Martin Baulig <martin@ximian.com>
8538 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
8539 `Type.MakeArrayType()' for array types.
8541 2003-11-18 Miguel de Icaza <miguel@ximian.com>
8543 * expression.cs (Invocation.VerifyArgumentsCompat): Remove
8546 (SizeOf.DoResolve): assign the `type_queried' field. This gets
8549 2003-11-16 Martin Baulig <martin@ximian.com>
8551 * codegen.cs (EmitContext.IsGeneric): Removed.
8553 * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
8554 ResolveGeneric() on the DeclSpace.
8556 2003-11-16 Martin Baulig <martin@ximian.com>
8558 * generic.cs (TypeArguments.Resolve):
8559 `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
8560 `ResolveType()' on it to get the Type.
8562 2003-11-15 Martin Baulig <martin@ximian.com>
8564 * generic.cs (ConstructedType.GetInterfaces): Override this.
8566 2003-11-14 Martin Baulig <martin@ximian.com>
8568 * interface.cs (Interface.DefineType): Define all type parameters
8569 before adding the interfaces we inherit.
8571 2003-11-11 Martin Baulig <martin@ximian.com>
8573 * generic.cs (ConstructedType.ResolveType): Always call
8574 `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
8576 2003-11-10 Martin Baulig <martin@ximian.com>
8578 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
8579 (TypeManager.InitCoreTypes): Initialize them here, but instead of
8580 calling `ResolveType()' on them, directly assign their `Type'.
8582 2003-11-08 Martin Baulig <martin@ximian.com>
8584 * generic.cs (ConstructedType): Override `IsClass' etc.
8586 2003-11-08 Martin Baulig <martin@ximian.com>
8588 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
8589 return value and the `out parent' parameter.
8590 (TypeContainer.DefineType): Moved the CS0644 check into
8591 GetClassBases(). Don't pass the interface types to the
8592 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
8593 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
8595 * ecore.cs (TypeExpr.IsAttribute): New property.
8596 (TypeExpr.GetInterfaces): New method.
8598 * interface.cs (Interface.GetInterfaceTypeByName): Return a
8599 TypeExpr instead of a Type.
8600 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
8601 (Interface.DefineType): Don't pass the interface types to the
8602 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
8603 them later and then call `TypeBulider.AddInterfaceImplementation()'.
8605 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
8606 instead of a `Type[]'.
8607 (TypeManager.RegisterBuilder): Likewise.
8608 (TypeManager.AddUserInterface): Likewise.
8609 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
8610 `Type[]' and also return a `TypeExpr[]'.
8611 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
8613 2003-11-08 Martin Baulig <martin@ximian.com>
8615 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
8618 2003-11-08 Martin Baulig <martin@ximian.com>
8620 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
8621 TypeManager.ResolveExpressionTypes().
8623 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
8624 instead of an Expression.
8625 (TypeExpr): This is now an abstract base class for `TypeExpression'.
8626 (TypeExpression): New public class; formerly known as `TypeExpr'.
8628 * expression.cs (ComposedCast): Derive from TypeExpr.
8630 * typemanager.cs (TypeManager.system_*_expr): These are now
8631 TypExpr's instead of Expression's.
8632 (TypeManager.ResolveExpressionTypes): New public static function;
8633 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
8636 2003-11-06 Miguel de Icaza <miguel@ximian.com>
8638 * expression.cs (New.DoResolve): Do not dereference value that
8639 might be a null return.
8641 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
8642 sure that the constant value has the right type. Fixes an
8643 unreported bug, similar to 50425.
8645 * const.cs (Const.LookupConstantValue): Call
8646 ImplicitStandardConversionExists before doing a conversion to
8647 avoid havng the TypeManager.ChangeType do conversions.
8649 Reduced the number of casts used
8651 (Const.ChangeType): New routine to enable reuse of the constant
8652 type changing code from statement.
8654 * typemanager.cs (ChangeType): Move common initialization to
8655 static global variables.
8659 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
8660 every value type to go through, even if it was void. Fix that.
8662 * cs-tokenizer.cs: Use is_identifier_start_character on the start
8663 character of the define, and the is_identifier_part_character for
8664 the rest of the string.
8666 2003-11-05 Miguel de Icaza <miguel@ximian.com>
8668 * expression.cs (UnaryMutator.EmitCode): When I updated
8669 LocalVariableReference.DoResolve, I overdid it, and dropped an
8670 optimization done on local variable references.
8672 2003-11-04 Miguel de Icaza <miguel@ximian.com>
8674 * ecore.cs: Convert the return from Ldlen into an int.
8676 2003-10-20 Miguel de Icaza <miguel@ximian.com>
8678 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
8679 the accessibility, this is a special case for toplevel non-public
8680 classes (internal for instance).
8682 2003-10-20 Nick Drochak <ndrochak@gol.com>
8684 * ecore.cs: Fix typo and build. Needed another right paren.
8686 2003-10-19 Miguel de Icaza <miguel@ximian.com>
8688 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
8689 `internal' case regular and protected, but not allowing protected
8690 to be evaluated later. Bug 49840
8692 2003-10-15 Miguel de Icaza <miguel@ximian.com>
8694 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
8695 to kb.Nlast, and not the kb.nFirst to isolate the switch
8698 Extract the underlying type, so enumerations of long/ulong are
8699 treated like long/ulong.
8701 2003-10-14 Miguel de Icaza <miguel@ximian.com>
8703 * expression.cs (New): Overload the meaning of RequestedType to
8704 track the possible creation of the NewDelegate type, since
8705 DoResolve is invoked more than once for new constructors on field
8708 See bugs: #48800 and #37014
8710 * cs-parser.jay (declare_local_constants): Take an arraylist
8711 instead of a single constant.
8713 (local_constant_declaration): It should take a
8714 constant_declarators, not a constant_declarator. Fixes 49487
8716 * convert.cs: Fix error report.
8718 2003-10-13 Jackson Harper <jackson@ximian.com>
8720 * typemanager.cs (TypeToCoreType): Add float and double this fixes
8723 2003-11-03 Martin Baulig <martin@ximian.com>
8725 * expression.cs (ArrayAccess.GetStoreOpcode): Added
8726 `out bool has_type_arg'; if set, we need to pass the type to
8728 (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
8729 Stelem_Any/Ldelem_Any for generic parameters.
8731 2003-11-02 Martin Baulig <martin@ximian.com>
8733 * expression.cs (Invocation.EmitCall): Use
8734 `TypeManager.IsValueType()' to check whether it's a value type.
8735 Don't set `struct_call' when calling a method on a type parameter.
8737 2003-11-02 Martin Baulig <martin@ximian.com>
8739 * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
8740 and removed the TypeBuilder argument.
8742 * typemanager.cs (TypeManager.IsValueType): Return
8743 `t.IsGenericParameter || t.IsValueType'.
8745 2003-10-25 Martin Baulig <martin@ximian.com>
8747 * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
8748 call ConstructedType.Resolve() on it.
8750 * generic.cs (ConstructedType.Resolve): Set `type' on success.
8752 2003-10-25 Martin Baulig <martin@ximian.com>
8754 * class.cs (TypeContainer.GetClassBases): Changed
8755 `out Type parent' into `out TypeExpr parent'. Moved CS0644 and
8756 CS8214 reporting here.
8757 (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
8758 instead of a `Type' for our parent. In case of a recursive
8759 declaration (see tests/gen-23.cs for an example), our parent is a
8760 ConstructedType and it doesn't have its type set. So, first
8761 create our own TypeBuilder, then call constructed.Resolve() to get
8762 the parent's type and finally TypeBuilder.SetParent() it.
8764 * ecore.cs (TypeExpr.Name): New public virtual property.
8767 (ConstructedType): We're now a TypeExpr and not just an Expression.
8768 (ConstructedType.ResolveAsTypeStep): Don't resolve our type
8769 arguments here; this is done later.
8770 (ConstructedType.Resolve): New public method to resolve the type
8771 arguments and bind them.
8773 2003-10-21 Martin Baulig <martin@ximian.com>
8775 * convert.cs: Use `TypeManager.IsValueType' instead of
8776 'type.IsValueType' everywhere.
8778 * typemanager.cs (TypeManager.IsValueType): Return true for type
8779 parameters. The reason for this is that we need to box a type
8780 parameter when converting it to a reference type.
8782 * cs-parser.jay: Added support for default value expressions.
8784 * generics.cs (DefaultValueExpression): New public class.
8786 2003-10-17 Martin Baulig <martin@ximian.com>
8788 * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
8789 TypeContainer so we can also use this for Interfaces.
8790 (TypeParameter.Resolve): Likewise.
8792 * interface.cs (Interface.DefineType): Added support for generic
8795 * cs-parser.jay: Added support for generic structs and interfaces.
8797 2003-10-17 Martin Baulig <martin@ximian.com>
8799 * generic.cs (GenericMemberAccess.DoResolve): We can now actually
8800 call generic methods :-)
8802 2003-10-16 Martin Baulig <martin@ximian.com>
8804 * cs-parser.jay (namespace_or_type_name): Only create a
8805 GenericMemberAccess if we actually have type arguments.
8807 2003-10-13 Martin Baulig <martin@ximian.com>
8809 * class.cs (Method.Define): If we're a generic method, call
8810 TypeBuilder.DefineGenericMethod () before resolving
8812 (MethodData): Added .ctor which takes an additional MethodBuilder
8813 argument; this is used for generic methods.
8814 (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
8815 we already have a MethodBuilder.
8817 2003-10-10 Martin Baulig <martin@ximian.com>
8819 * class.cs (Method): Added .ctor which takes a `GenericMethod'
8820 instead of a `DeclSpace'. This is used for generic methods.
8822 * cs-parser.jay (method_header): Added support for generic
8823 methods; create a `GenericMethod' instance and pass it to the
8824 `Method's .ctor; it'll be used as the `DeclSpace' to lookup
8825 parameters and locals.
8827 * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
8828 since we already have the location. Check whether we're a generic
8829 type declaration or a generic method and create the correct type
8832 * generic.cs (TypeParameter.DefineMethod): New public method.
8833 (GenericMethod): New public class; derives from DeclSpace and is
8834 used for generic methods.
8836 2003-10-09 Martin Baulig <martin@ximian.com>
8838 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
8840 (MethodCore.DoDefineParameters): Removed the TypeContainer
8841 argument; use the DeclSpace which was passed to the .ctor instead.
8842 (MethodCore.CheckParameter): Take a DeclSpace instead of a
8843 TypeContainer; we only need a DeclSpace here.
8845 2003-10-09 Martin Baulig <martin@ximian.com>
8847 * class.cs (MethodData): Added additional `DeclSpace ds' argument
8849 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
8850 EmitContext's .ctor.
8852 2003-10-09 Martin Baulig <martin@ximian.com>
8854 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
8855 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
8856 AsAccessible(), moved them as well.
8858 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
8860 2003-10-07 Miguel de Icaza <miguel@ximian.com>
8862 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
8863 generation for >=, as spotted by Paolo, bug 48679.
8864 Patch from David Waite.
8866 * cs-tokenizer.cs: Add handling for #pragma.
8868 * cs-parser.jay: Allow for both yield and yield return in the
8869 syntax. The anti-cobolization of C# fight will go on!
8871 * class.cs (TypeBuilder.DefineType): Catch error condition here
8872 (Parent.DefineType erroring out and returning null).
8874 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
8875 coping with enumerations variables, we were mistakenly processing
8876 them as a regular value type instead of built-in types. Fixes the
8879 * typemanager.cs (IsBuiltinOrEnum): New method.
8881 2003-09-30 Miguel de Icaza <miguel@ximian.com>
8883 * cs-parser.jay: Upgrade: yield now needs the return clause.
8885 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
8887 * cs-parser.jay : Renamed yyName to yyNames related to jay.
8889 2003-09-29 Martin Baulig <martin@ximian.com>
8891 * typemanager.cs (TypeManager.GetMethodFlags): Added support for
8892 inflated generic methods.
8894 * generics.cs (ConstructedType): Distinguish between open and
8895 closed constructed types; correctly resolve the arguments.
8897 2003-09-22 Martin Baulig <martin@ximian.com>
8899 * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
8900 all type arguments meet their constraints.
8902 2003-09-19 Martin Baulig <martin@ximian.com>
8904 * decl.cs (MemberCache.SetupCacheForInterface): Take a
8905 `MemberCache parent' argument. Normally, an interface doesn't
8906 have a parent type except System.Object, but we use this in gmcs
8907 for generic type parameters.
8909 2003-09-18 Martin Baulig <martin@ximian.com>
8911 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
8912 on `type.IsInterface'; don't check whether the type has a parent
8913 to determine whether it's an interface.
8915 2003-09-17 Martin Baulig <martin@ximian.com>
8917 * generic.cs (ConstructedType.ToString): Always use `name' as the
8920 2003-09-15 Martin Baulig <martin@ximian.com>
8922 * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
8924 * generic.cs (Constraints.Resolve): New public method; this is
8925 called to resolve the constraint types and to check whether all
8926 the constraints are correct.
8927 (Constraints.Types): New public property.
8928 (TypeParameter.Resolve): New public method; resolves all the
8931 * class.cs (TypeContainer.DefineType): Call
8932 TypeParameter.Resolve() before actually defining the type.
8934 2003-09-15 Martin Baulig <martin@ximian.com>
8936 * class.cs (TypeContainer.DefineType): Added an error flag to
8937 avoid reporting duplicate CS0146's ("class definition is
8940 * driver.cs (Driver.MainDriver): Abort if
8941 RootContext.ResolveTree() reported any errors.
8943 2003-09-07 Martin Baulig <martin@ximian.com>
8945 * report.cs (Error, Warning): Added overloaded versions which take
8946 a `params object[] args' and call String.Format().
8948 2003-09-07 Martin Baulig <martin@ximian.com>
8950 * decl.cs (DeclSpace..ctor): Don't call
8951 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
8952 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
8953 (DeclSpace.RecordDecl): New method.
8955 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
8957 2003-09-02 Ravi Pratap <ravi@ximian.com>
8959 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
8960 value attributes to be applied to ParameterBuilders.
8962 * class.cs (MethodCore.LabelParameters): Make static and more
8963 generic so that it can be used from other places - like interface
8964 methods, for instance.
8966 * interface.cs (Interface.Emit): Call LabelParameters before
8967 emitting attributes on the InterfaceMethod.
8969 2003-09-07 Martin Baulig <martin@ximian.com>
8971 * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
8972 if the number of type parameters doesn't match.
8974 2003-09-04 Martin Baulig <martin@ximian.com>
8976 * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
8977 for arrays of generic type params (ie. `!0[]').
8979 2003-09-04 Martin Baulig <martin@ximian.com>
8981 * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
8984 2003-09-04 Martin Baulig <martin@ximian.com>
8986 * decl.cs (DeclSpace.LookupGeneric): New method.
8987 (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
8990 * generic.cs (TypeParameterExpr): Take a TypeParameter as
8991 argument, not just a string.
8992 (TypeParameter.Define): New public method; this is called to
8993 actually define the generic parameter; after this, you can use the
8994 new `Type' property to get the type.
8996 2003-09-04 Martin Baulig <martin@ximian.com>
8998 * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
8999 is now an ArrayList; initialize the result of the `TypeParameters'
9001 (DeclSpace.GetGenericData): Removed.
9002 (DeclSpace.LookupGeneric): Temporarily removed; we need to
9003 implement this in a different way.
9004 (DeclSpace.GetTypeParameters): Removed; there's now a
9005 `TypeParameters' property.
9006 (DeclSpace.TypeParameters): New public property.
9008 * generic.cs (Constraints): Make this class public.
9009 (TypeParameter): New public class.
9011 2003-09-04 Martin Baulig <martin@ximian.com>
9013 * decl.cs (DeclSpace.GetTypeParameters): New method to return the
9016 * class.cs (TypeContainer.DefineType): Call
9017 TypeBuilder.DefineGenericParameter () on all generic parameters if
9018 this is a generic type.
9020 2003-08-28 Martin Baulig <martin@ximian.com>
9022 * sample-stack.il: Compile this with ilasm: "ilasm /dll
9025 * sample-hello.cs: Compile this with gmcs: "gmcs
9026 /r:sample-stack.dll sample-hello.cs".
9028 2003-08-28 Martin Baulig <martin@ximian.com>
9030 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
9031 the parameters to the generic type.
9033 2003-08-28 Martin Baulig <martin@ximian.com>
9035 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
9037 2003-08-28 Martin Baulig <martin@ximian.com>
9039 * cs-parser.jay (opt_type_argument_list): Use
9040 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
9041 (primary_expression): Replace `qualified_identifier' with `type_name'.
9042 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
9044 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
9045 parser to check whether it is syntactically a type parameter list;
9046 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
9049 2003-08-26 Martin Baulig <martin@ximian.com>
9051 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
9052 resolving aliases; fixes #47927.
9054 2003-08-26 Martin Baulig <martin@ximian.com>
9056 * statement.cs (Using.DoResolve): This is internally emitting a
9057 try/finally clause, so we need to set ec.NeedExplicitReturn if we
9058 do not always return. Fixes #47681.
9060 2003-08-26 Martin Baulig <martin@ximian.com>
9062 * decl.cs (MemberCore): Moved WarningNotHiding(),
9063 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
9065 (AdditionResult): Make this nested in DeclSpace.
9066 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
9067 argument; call NamespaceEntry.Define() unless we're nested in a
9070 * namespace.cs (Namespace.DefineName): New public function. This
9071 is called from DeclSpace's .ctor to add
9072 (Namespace.Lookup): Include DeclSpaces in the lookup.
9074 * class.cs (Operator): Derive from MemberBase, not MemberCore.
9076 * const.cs (Const): Derive from MemberBase, not MemberCore.
9078 2003-08-25 Martin Baulig <martin@ximian.com>
9080 * convert.cs (Convert.ExplicitReferenceConversion): When
9081 converting from an interface type to a class, unbox if the target
9082 type is a struct type. Fixes #47822.
9084 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9086 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
9089 2003-08-22 Martin Baulig <martin@ximian.com>
9091 * class.cs (TypeManager.DefineType): When defining a nested type,
9092 call DefineType() on our parent; fixes #47801.
9094 2003-08-22 Martin Baulig <martin@ximian.com>
9096 * class.cs (MethodData.Define): While checking if a method is an
9097 interface implementation, improve the test a bit more to fix #47654.
9099 2003-08-22 Martin Baulig <martin@ximian.com>
9101 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
9102 correctly; fixes #47722.
9104 2003-08-22 Martin Baulig <martin@ximian.com>
9106 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
9107 LocalVariableReference, ensure it's not read-only. Fixes #47536.
9109 * statement.cs (Fixed.DoResolve): Make all variables read-only.
9111 2003-08-22 Martin Baulig <martin@ximian.com>
9113 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
9114 can only be assigned in static constructors. Fixes #47161.
9116 2003-08-22 Martin Baulig <martin@ximian.com>
9118 Rewrote and improved the flow analysis code.
9120 * flowbranching.cs (FlowBranching): Make this class abstract.
9121 (FlowBranching.CreateBranching): New static function to create a
9123 (FlowBranchingBlock, FlowBranchingException): New classes.
9124 (FlowBranching.UsageVector.Type): New public readonly field.
9125 (FlowBranching.UsageVector.Breaks): Removed the setter.
9126 (FlowBranching.UsageVector.Returns): Removed the setter.
9127 (FlowBranching.UsageVector): Added Break(), Return(),
9128 NeverReachable() and Throw() methods to modify the reachability.
9129 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
9130 done by FlowBranching.Merge().
9131 (FlowBranching.UsageVector.MergeChild): New method; merges the
9132 merge result into the current vector.
9133 (FlowBranching.Merge): New abstract method to merge a branching.
9135 2003-08-12 Martin Baulig <martin@ximian.com>
9137 * expression.cs (Indirection.CacheTemporaries): Create the
9138 LocalTemporary with the pointer type, not its element type.
9140 2003-08-10 Miguel de Icaza <miguel@ximian.com>
9142 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
9143 token was a keyword or not.
9145 Add `error' options where an IDENTIFIER was expected; Provide
9146 CheckToken and CheckIdentifierToken convenience error reporting
9149 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
9151 * decl.cs: Rename `NamespaceEntry Namespace' public field into
9152 NameSpaceEntry NameSpaceEntry.
9154 (LookupInterfaceOrClass): Avoid creating a full qualified name
9155 from namespace and name: avoid doing lookups when we know the
9156 namespace is non-existant. Use new Tree.LookupByNamespace which
9157 looks up DeclSpaces based on their namespace, name pair.
9159 * driver.cs: Provide a new `parser verbose' to display the
9160 exception thrown during parsing. This is turned off by default
9161 now, so the output of a failure from mcs is more graceful.
9163 * namespace.cs: Track all the namespaces defined in a hashtable
9166 (IsNamespace): New method
9168 2003-08-09 Miguel de Icaza <miguel@ximian.com>
9170 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
9171 we know that we need to concatenate (full typename can never be
9176 * statement.cs: Use a bitfield; Do not initialize to null things
9177 which are done by the constructor by default.
9179 * cs-parser.jay: bug fix, parameter was 4, not 3.
9181 * expression.cs: Just use the property;
9183 * statement.cs: No need for GetVariableInfo method.
9185 2003-08-08 Martin Baulig <martin@ximian.com>
9187 * flowanalysis.cs (FlowReturns): This is now nested in the
9188 `FlowBranching' class.
9189 (MyBitVector): Moved this here from statement.cs.
9190 (FlowBranching.SiblingType): New enum type.
9191 (FlowBranching.CreateSibling): Added `SiblingType' argument.
9193 2003-08-07 Martin Baulig <martin@ximian.com>
9195 * flowanalysis.cs (FlowBranchingType): This is now nested in the
9196 `FlowBranching' class and called `BranchingType'.
9198 2003-08-07 Martin Baulig <martin@ximian.com>
9200 * flowanalysis.cs: Moved all the control flow analysis code into
9203 2003-08-07 Martin Baulig <martin@ximian.com>
9205 * assign.cs (Assign.DoResolve): `target' must either be an
9206 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
9209 2003-08-07 Miguel de Icaza <miguel@ximian.com>
9211 * expression.cs (BinaryMethod): This kind of expression is created by the
9212 Binary class if it determines that the operator has to be handled
9215 (BinaryDelegate): This kind of expression is created if we are
9216 dealing with a + or - operator on delegates.
9218 (Binary): remove method, argumetns, and DelegateOperator: when
9219 dealing with methods,
9221 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
9223 * statement.cs (Block): use bitfields for the three extra booleans
9224 we had in use. Remove unused topblock parameter.
9226 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
9228 * assign.cs: Drop extra unneeded tests.
9230 2003-08-06 Miguel de Icaza <miguel@ximian.com>
9232 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
9234 * statement.cs (Foreach): Use VariableStorage instead of
9237 * codegen.cs (VariableStorage): New class used by clients that
9238 require a variable stored: locals or fields for variables that
9239 need to live across yield.
9241 Maybe provide a convenience api for EmitThis+EmitLoad?
9243 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
9246 2003-08-05 Miguel de Icaza <miguel@ximian.com>
9248 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
9249 RemapParameterLValue): New methods that are used to turn a
9250 precomputed FieldInfo into an expression like this:
9254 The idea is to use this instead of making LocalVariableReference
9255 have more than one meaning.
9257 * cs-parser.jay: Add error production to BASE.
9259 * ecore.cs: Deal with TypeManager.GetField returning null, which
9260 is now a valid return value.
9262 (FieldExprNoAddress): New expression for Fields whose address can
9265 * expression.cs (LocalVariableReference): During the resolve
9266 phases, create new expressions if we are in a remapping context.
9267 Remove code that dealt with remapping here.
9269 (ParameterReference): same.
9271 (ProxyInstance): New expression, like the `This' expression, but
9272 it is born fully resolved. We know what we are doing, so remove
9273 the errors that are targeted to user-provided uses of `this'.
9275 * statement.cs (Foreach): our variable is now stored as an
9276 Expression; During resolution, follow the protocol, dont just
9277 assume it will return this.
9279 2003-08-06 Martin Baulig <martin@ximian.com>
9281 * support.cs (SeekableStreamReader.cs): New public class.
9283 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
9284 SeekableStreamReader instead of the normal StreamReader.
9286 2003-08-04 Martin Baulig <martin@ximian.com>
9288 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
9289 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
9290 deambiguate casts and delegate invocations.
9291 (parenthesized_expression): Use the new tokens to ensure this is
9292 not a cast of method invocation.
9294 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
9295 when reading a `)' and Deambiguate_CloseParens () was previously
9298 * expression.cs (ParenthesizedExpression): New class. This is
9299 just used for the CS0075 test.
9300 (Binary.DoResolve): Check for CS0075.
9302 2003-07-29 Ravi Pratap <ravi@ximian.com>
9304 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
9305 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
9306 reference comparison.
9308 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
9309 examine the ReturnType for equality - this is necessary in the
9310 cases of implicit and explicit operators whose signature also
9311 includes the return type.
9313 2003-07-26 Miguel de Icaza <miguel@ximian.com>
9315 * namespace.cs: Cache the result of the namespace computation,
9316 instead of computing it every time.
9318 2003-07-24 Miguel de Icaza <miguel@ximian.com>
9320 * decl.cs: Use a global arraylist that we reuse over invocations
9321 to avoid excesive memory consumption. Reduces memory usage on an
9322 mcs compile by one meg (45 average).
9324 * typemanager.cs (LookupTypeReflection): In .NET pointers are
9325 private, work around that.
9327 2003-07-23 Miguel de Icaza <miguel@ximian.com>
9329 * literal.cs (IntLiteral): Define Zero and One static literals.
9331 * cs-parser.jay (integer_literal): use static literals to reduce
9332 memory usage for the most used literals (0, 1 and -1). 211kb
9333 reduced in memory usage.
9335 Replace all calls to `new ArrayList' with `new
9336 ArrayList(4)' which is a good average number for most allocations,
9337 and also requires only 16 bytes of memory for its buffer by
9340 This reduced MCS memory usage in seven megabytes for the RSS after
9343 2003-07-28 Ravi Pratap <ravi@ximian.com>
9345 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
9346 handle params methods the correct way by forming only one
9347 applicable set with params and normal methods in them. Earlier we
9348 were looking at params methods only if we found no normal methods
9349 which was not the correct thing to do.
9351 (Invocation.BetterFunction): Take separate arguments indicating
9352 when candidate and the best method are params methods in their
9355 This fixes bugs #43367 and #46199.
9357 * attribute.cs: Documentation updates.
9359 (CheckAttribute): Rename to CheckAttributeTarget.
9360 (GetValidPlaces): Rename to GetValidTargets.
9362 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
9363 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
9367 2003-07-28 Miguel de Icaza <miguel@ximian.com>
9369 * codegen.cs: Compute IsGeneric correctly.
9371 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
9374 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
9375 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
9376 regressions, and I was chasing more bugs than I required.
9378 * interface.cs: Use expressions for base type names (like classes
9379 and structs have been doing for a while now), and resolve that.
9380 This patch should probably go into head as well.
9382 This makes it one less user of FindType.
9384 2003-07-24 Miguel de Icaza <miguel@ximian.com>
9386 This compiler can not self host currently. Need to fix that.
9388 * Makefile: compile to `gmcs.exe'
9390 * driver.cs: Turn on v2 by default on gmcs.
9392 * generic.cs (ConstructedType): Does no longer take a container
9393 type argument; That will be taken care of later.
9395 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
9396 Use SimpleName to resolve for now, so we can continue the work on
9397 the parser, until we get Type.GetType that understands generics.
9399 (ConstructedType.ToString): Implement
9401 (TypeArguments.Resolve): Resolve the child expressions as types.
9403 * cs-parser.jay: Rename interface_constraints to
9404 type_parameter_constraints
9406 (namespace_or_type_name): Only use constructed types for the basic
9407 construction, we will deal with identifier<...> later.
9409 (type/type_name): No longer call DecomposeQI, as
9410 namespace_or_type_name is always decoded now.
9412 2003-07-22 Ravi Pratap <ravi@ximian.com>
9414 * expression.cs (Invocation.OverloadResolve): Follow the spec more
9415 closely: we eliminate methods in base types when we have an
9416 applicable method in a top-level type.
9418 Please see section 14.5.5.1 for an exact description of what goes
9421 This fixes bug #45127 and a host of other related to corlib compilation.
9423 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
9424 array is the method corresponding to the top-level type (this is
9425 because of the changes made to icall.c) so we change this
9428 (MethodGroupExpr.Name): This too.
9430 * typemanager.cs (GetElementType): New method which does the right
9431 thing when compiling corlib.
9433 * everywhere: Make use of the above in the relevant places.
9435 2003-07-22 Martin Baulig <martin@ximian.com>
9437 * cs-parser.jay (invocation_expression): Moved
9438 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
9439 `cast_expression', but create a InvocationOrCast which later
9440 resolves to either an Invocation or a Cast.
9442 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
9443 method; call this before EmitStatement() to make sure that this
9444 expression can be used as a statement.
9446 * expression.cs (InvocationOrCast): New class; resolves to either
9447 an Invocation or a Cast.
9449 * statement.cs (StatementExpression): Call ResolveStatement() on
9450 the ExpressionStatement before emitting it.
9452 2003-07-21 Martin Baulig <martin@ximian.com>
9454 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
9455 `ref' and `out' attributes match; fixes #46220.
9456 (MemberAccess.ResolveMemberAccess): You can't reference a type
9457 through an expression; fixes #33180.
9458 (Indexers.GetIndexersForType): Don't return the indexers from
9459 interfaces the class implements; fixes #46502.
9461 2003-07-21 Martin Baulig <martin@ximian.com>
9463 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
9464 CS0661 checks; fixes bug #30442.
9466 2003-07-21 Martin Baulig <martin@ximian.com>
9468 * decl.cs (AdditionResult): Added `Error'.
9470 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
9472 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
9473 cs0031.cs actually work.
9475 2003-07-20 Miguel de Icaza <miguel@ximian.com>
9477 * cs-parser.jay (namespace_name): do not use
9478 namespace_or_type_name, use qualified_identifier, because
9479 namespace_or_type_name will soon return a composed expression
9480 instead of a string.
9482 (namespace_or_type_name): Instead of returning a string, now this
9483 production returns an expression.
9485 * codegen.cs (EmitContext): Setup IsGeneric property based on
9486 whether our DeclSpace is generic, our the method is generic.
9488 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
9489 the method is generic.
9491 * cs-parser.jay (type_arguments, opt_type_argument_list,
9492 type_parameters, type_parameter_list, opt_type_parameter_list,
9493 type_parameter,, opt_type_parameter_constraints_clauses,
9494 type_parameter_constraints_clauses,
9495 type_parameter_constraint_clause, type_parameter_constraint,
9496 interface_constraints): Add new production
9498 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
9499 DeclSpace is generic or not.
9501 (DeclSpace.SetParameterInfo): New routine, used to set the
9502 parameter info for a type.
9504 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
9505 returns a GenericTypeExpr
9507 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
9508 generic, lookup the generic argument.
9510 * attribute.cs: Do not allow TypeParameterExpressions in
9513 * class.cs: Do not allow the Main method to be defined in a
9516 * expression.cs (SizeOf): Do not allow generic types to be used as
9517 arguments to sizeof.
9519 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
9520 it: whether a type is generic or not. Only works for types we are
9521 currently building for now.
9523 2003-07-20 Martin Baulig <martin@ximian.com>
9525 * namespace.cs: Fixed that bug which caused a crash when compiling
9528 2003-07-20 Miguel de Icaza <miguel@ximian.com>
9530 * typemanager.cs (LookupTypeReflection): Never expose types which
9531 are NotPublic, NestedPrivate, NestedAssembly, or
9532 NestedFamANDAssem. We used to return these, and later do a check
9533 that would report a meaningful error, but the problem is that we
9534 would not get the real match, if there was a name override.
9536 2003-07-18 Miguel de Icaza <miguel@ximian.com>
9538 * namespace.cs (Namespace, Name): Do not compute the namespace
9539 name dynamically, compute it in the constructor. This reduced
9540 memory usage by 1697 KB.
9542 * driver.cs: Use --pause to pause at the end.
9544 2003-07-17 Peter Williams <peter@newton.cx>
9546 * Makefile: Change the name of the test target so that it doesn't
9547 conflict with the recursive test target.
9549 2003-07-17 Miguel de Icaza <miguel@ximian.com>
9551 * expression.cs (LocalVariableReference.Emit, EmitAssign,
9552 AddressOf): Do not use EmitThis, that was wrong, use the actual
9555 2003-07-15 Miguel de Icaza <miguel@ximian.com>
9557 * class.cs (MethodData.Define): While checking if a method is an
9558 interface implementation, improve the test: If we are not public
9559 (use new test here: use the computed MethodAttributes directly,
9560 instead of the parsed modifier flags) check if the `implementing'
9561 method comes from an interface or not.
9563 * pending.cs (VerifyPendingMethods): Slightly better error
9566 * makefile: add test target that does the mcs bootstrap.
9568 2003-07-16 Ravi Pratap <ravi@ximian.com>
9570 * interface.cs (Define): Do nothing here since there are no
9571 members to populate etc. Move the attribute emission out of here
9572 since this was just totally the wrong place to put it. Attribute
9573 application happens during the 'Emit' phase, not in the 'Define'
9576 (Emit): Add this method and move the attribute emission here
9578 * rootcontext.cs (EmitCode): Call the Emit method on interface
9581 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9583 * expression.cs (OverloadResolve): Report error only if Location
9584 is not 'Null' which means that there was a probe going on.
9586 2003-07-14 Martin Baulig <martin@ximian.com>
9588 * expression.cs (ConditionalLogicalOperator): New public class to
9589 implement user defined conditional logical operators.
9590 This is section 14.11.2 in the spec and bug #40505.
9592 2003-07-14 Martin Baulig <martin@ximian.com>
9594 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
9596 2003-07-14 Martin Baulig <martin@ximian.com>
9598 * codegen.cs (EmitContext.InFixedInitializer): New public field.
9600 * ecore.cs (IVariable.VerifyFixed): New interface method.
9602 * expression.cs (Unary.ResolveOperator): When resolving the `&'
9603 operator, check whether the variable is actually fixed. Fixes bug
9604 #36055. Set a variable definitely assigned when taking its
9605 address as required by the spec.
9607 * statement.cs (LocalInfo.IsFixed): New field.
9608 (LocalInfo.MakePinned): Set `IsFixed' to true.
9610 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9612 * attribute.cs (Attribute.Resolve): While doing a Member lookup
9613 for .ctors, ensure that we only ask for members declared in the
9614 attribute type (BindingFlags.DeclaredOnly).
9618 * expression.cs (Error_WrongNumArguments): Report error 1501
9619 correctly the way CSC does.
9621 2003-07-13 Martin Baulig <martin@ximian.com>
9623 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
9624 lookup on the fully qualified name, to make things like "X.X" work
9625 where "X.X" is a fully qualified type name, but we also have a
9626 namespace "X" in the using list. Fixes #41975.
9628 2003-07-13 Martin Baulig <martin@ximian.com>
9630 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
9631 function. If we're a CompoundAssign, we need to create an embedded
9632 CompoundAssign, not an embedded Assign.
9633 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
9636 2003-07-13 Martin Baulig <martin@ximian.com>
9638 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
9639 work to fix bug #46088.
9641 2003-07-13 Ravi Pratap <ravi@ximian.com>
9643 * class.cs (Operator.Emit): Do not emit attributes here - it is
9644 taken care of by the Method class that we delegate too. This takes
9647 2003-07-10 Martin Baulig <martin@ximian.com>
9649 * expression.cs (TypeOfVoid): New class.
9650 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
9652 2003-07-10 Martin Baulig <martin@ximian.com>
9654 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
9657 2003-07-10 Martin Baulig <martin@ximian.com>
9659 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
9660 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
9662 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
9664 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
9666 2003-07-10 Martin Baulig <martin@ximian.com>
9668 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
9669 of decimal. Fixes #42850.
9671 NOTE: I also fixed the created byte blob, but this doesn't work on
9672 the MS runtime and csc never produces any byte blobs for decimal
9675 2003-07-10 Martin Baulig <martin@ximian.com>
9677 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
9678 structs; fixes #32068.
9679 (Block.AddChildVariableNames): Fixed #44302.
9681 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9683 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
9685 2003-07-07 Miguel de Icaza <miguel@ximian.com>
9687 * attribute.cs: And this test is onger needed.
9689 2003-07-08 Martin Baulig <martin@ximian.com>
9691 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
9692 inaccessible types. Fixes #36313.
9694 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
9696 * namespace.cs (NamespaceEntry): Create implicit entries for all
9697 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
9698 implicit entries for N1.N2 and N1.
9700 2003-07-08 Martin Baulig <martin@ximian.com>
9702 Rewrote the handling of namespaces to fix a lot of the issues
9703 wrt. `using' aliases etc.
9705 * namespace.cs (Namespace): Splitted this class into a
9706 per-assembly `Namespace' and a per-file `NamespaceEntry'.
9708 * typemanager.cs (TypeManager.IsNamespace): Removed.
9709 (TypeManager.ComputeNamespaces): Only compute namespaces from
9710 loaded assemblies here, not the namespaces from the assembly we're
9711 currently compiling.
9713 2003-07-08 Martin Baulig <martin@ximian.com>
9715 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
9717 2003-07-07 Miguel de Icaza <miguel@ximian.com>
9719 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
9722 I thought about the memory savings here, but LookupTypeReflection
9723 is used under already very constrained scenarios. Compiling
9724 corlib or mcs only exposes one hit, so it would not really reduce
9725 any memory consumption.
9727 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9729 * typemanager.cs: fixes bug #45889 by only adding public types from
9730 other assemblies to the list of known types.
9732 2003-07-07 Miguel de Icaza <miguel@ximian.com>
9734 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
9735 on the type we resolved.
9737 2003-07-05 Martin Baulig <martin@ximian.com>
9739 * pending.cs (PendingImplementation.ParentImplements): Don't
9740 create the proxy if the parent is abstract.
9742 * class.cs (TypeContainer.DefineIndexers): Process explicit
9743 interface implementations first. Fixes #37714.
9745 2003-07-04 Miguel de Icaza <miguel@ximian.com>
9747 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
9748 defined recursively; but since we modify the input parameters
9749 (left is set to `this' temporarily), we reset this value if the
9750 left_is_explicit is false, which gives the original semantics to
9753 * literal.cs (NullPointer): new class used to represent a null
9754 literal in a pointer context.
9756 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
9757 type is a pointer, use a NullPointer object instead of a
9758 NullLiteral. Closes 43687
9760 (ExplicitConversion): Convert pointer values using
9761 the conv opcode to the proper type.
9763 * ecore.cs (New): change ValueTypeVariable property into a method,
9764 that returns whether the valuetype is suitable for being used.
9766 * expression.cs (Binary.DoNumericPromotions): Only return if we
9767 the int constant was a valid uint, and we can return both left and
9768 right as uints. If not, we continue processing, to trigger the
9769 type conversion. This fixes 39018.
9771 * statement.cs (Block.EmitMeta): During constant resolution, set
9772 the CurrentBlock property on the emitcontext, so that we resolve
9773 constants propertly.
9775 2003-07-02 Martin Baulig <martin@ximian.com>
9777 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
9778 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
9780 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
9781 than emitting it here.
9783 * statement.cs: Fixed some more flow analysis bugs.
9785 2003-07-02 Martin Baulig <martin@ximian.com>
9787 * class.cs (MethodData.Define): When implementing interface
9788 methods, set Final unless we're Virtual.
9790 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
9791 check work for interface methods.
9793 2003-07-01 Martin Baulig <martin@ximian.com>
9795 * ecore.cs (EmitContext.This): Replaced this property with a
9796 GetThis() method which takes a Location argument. This ensures
9797 that we get the correct error location for a CS0188.
9799 2003-07-01 Miguel de Icaza <miguel@ximian.com>
9801 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
9802 ImplicitStandardConversion.
9804 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
9806 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
9808 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
9811 2003-06-30 Miguel de Icaza <miguel@ximian.com>
9813 * class.cs (Constructor.Define): Turn off initlocals for unsafe
9816 (MethodData.Define): Turn off initlocals for unsafe methods.
9818 2003-06-29 Miguel de Icaza <miguel@ximian.com>
9820 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
9821 complete; Fixes #37521.
9823 * delegate.cs: Use Modifiers.TypeAttr to compute the
9824 TypeAttributes, instead of rolling our own. This makes the flags
9825 correct for the delegates.
9827 2003-06-28 Miguel de Icaza <miguel@ximian.com>
9829 * class.cs (Constructor.Define): Set the private flag for static
9830 constructors as well.
9832 * cs-parser.jay (statement_expression): Set the return value to
9833 null, to avoid a crash when we catch an error.
9835 2003-06-24 Miguel de Icaza <miguel@ximian.com>
9837 * cs-parser.jay: Applied patch from Jackson that adds support for
9838 extern and unsafe modifiers to destructor declarations.
9840 * expression.cs: Report error 21 if the user is trying to index a
9843 * driver.cs: Add an error message, suggested by the bug report.
9845 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
9846 if we do not have a ": this ()" constructor initializer. Fixes 45149
9848 2003-06-14 Miguel de Icaza <miguel@ximian.com>
9850 * namespace.cs: Add some information to reduce FAQs.
9852 2003-06-13 Miguel de Icaza <miguel@ximian.com>
9854 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
9855 underlying enumeration types. Fixes #43915.
9857 * expression.cs: Treat ushort/short as legal values to be used in
9860 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
9862 * delegate.cs: transfer custom attributes for paramenters from
9863 the delegate declaration to Invoke and BeginInvoke.
9865 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
9867 * attribute.cs: handle custom marshalers and emit marshal info
9870 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
9872 * makefile.gnu: Added anonymous.cs to the compiler sources.
9874 2003-05-28 Miguel de Icaza <miguel@ximian.com>
9876 * iterators.cs: Change the name of the proxy class to include two
9879 * cs-parser.jay: Update grammar to include anonymous methods.
9881 * anonymous.cs: new file.
9883 2003-05-27 Miguel de Icaza <miguel@ximian.com>
9885 * class.cs (Field.Define): Add missing test for pointers and
9888 2003-05-27 Ravi Pratap <ravi@ximian.com>
9890 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
9891 we use the stobj opcode.
9893 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
9894 since it wasn't the correct fix.
9896 It still is puzzling that we are required to use stobj for IntPtr
9897 which seems to be a ValueType.
9899 2003-05-26 Miguel de Icaza <miguel@ximian.com>
9901 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
9902 during regular simple name resolution. Now, the trick is that
9903 instead of returning for processing the simplename, we do a
9904 TypeManager.LookupType (ie, a rooted lookup as opposed to a
9905 contextual lookup type). If a match is found, return that, if
9906 not, return for further composition.
9908 This fixes long-standing 30485.
9910 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
9911 using the address to initialize an object, do an Stobj instead of
9912 using the regular Stelem.
9914 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
9915 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
9916 Because if we are a BaseIndexerAccess that value will be true.
9919 * statement.cs (GotoCase.Resolve): Return after reporting an
9920 error, do not attempt to continue.
9922 * expression.cs (PointerArithmetic.Emit): If our operand is a
9923 long, convert our constants to match the operand before
9924 multiplying. Convert to I type before adding. Fixes 43670.
9926 2003-05-14 Ravi Pratap <ravi@ximian.com>
9928 * enum.cs (ImplicitConversionExists) : Rename to
9929 ImplicitEnumConversionExists to remove ambiguity.
9931 * ecore.cs (NullCast): New type of cast expression class which
9932 basically is very similar to EmptyCast with the difference being
9933 it still is a constant since it is used only to cast a null to
9937 * convert.cs (ImplicitReferenceConversion): When casting a null
9938 literal, we return a NullCast.
9940 * literal.cs (NullLiteralTyped): Remove - I don't see why this
9941 should be around anymore.
9943 The renaming (reported was slightly wrong). Corrections:
9945 ConvertImplicitStandard -> ImplicitConversionStandard
9946 ConvertExplicitStandard -> ExplicitConversionStandard
9948 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
9949 before passing them in !
9951 * convert.cs (ImplicitConversionStandard): When comparing for
9952 equal expr and target types, ensure that expr is not a
9955 In general, we must not be checking (expr_type ==
9956 target_type) in the top level conversion methods
9957 (ImplicitConversion, ExplicitConversion etc). This checking is
9958 done in the methods that they delegate to.
9960 2003-05-20 Miguel de Icaza <miguel@ximian.com>
9962 * convert.cs: Move Error_CannotConvertType,
9963 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
9964 ImplicitNumericConversion, ImplicitConversionExists,
9965 ImplicitUserConversionExists, StandardConversionExists,
9966 FindMostEncompassedType, FindMostSpecificSource,
9967 FindMostSpecificTarget, ImplicitUserConversion,
9968 ExplicitUserConversion, GetConversionOperators,
9969 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
9970 TryImplicitIntConversion, Error_CannotConvertImplicit,
9971 ConvertImplicitRequired, ConvertNumericExplicit,
9972 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
9973 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
9976 Perform the following renames:
9978 StandardConversionExists -> ImplicitStandardConversionExists
9979 ConvertImplicit -> ImplicitConversion
9980 ConvertImplicitStandard -> ImplicitStandardConversion
9981 TryImplicitIntConversion -> ImplicitIntConversion
9982 ConvertImplicitRequired -> ImplicitConversionRequired
9983 ConvertNumericExplicit -> ExplicitNumericConversion
9984 ConvertReferenceExplicit -> ExplicitReferenceConversion
9985 ConvertExplicit -> ExplicitConversion
9986 ConvertExplicitStandard -> ExplicitStandardConversion
9988 2003-05-19 Martin Baulig <martin@ximian.com>
9990 * statement.cs (TypeInfo.StructInfo): Made this type protected.
9991 (TypeInfo): Added support for structs having structs as fields.
9993 * ecore.cs (FieldExpr): Implement IVariable.
9994 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
9995 VariableInfo for the field.
9997 2003-05-18 Martin Baulig <martin@ximian.com>
9999 * expression.cs (This.DoResolve): Report a CS0027 if we're
10000 emitting a field initializer.
10002 2003-05-18 Martin Baulig <martin@ximian.com>
10004 * expression.cs (This.ResolveBase): New public function.
10005 (This.DoResolve): Check for CS0188.
10007 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
10010 * ecore.cs (MethodGroupExpr.DoResolve): Set the
10011 `instance_expression' to null if we don't have any non-static
10014 2003-05-18 Martin Baulig <martin@ximian.com>
10016 Reworked the way how local variables and parameters are handled by
10017 the flow analysis code.
10019 * statement.cs (TypeInfo, VariableMap): New public classes.
10020 (VariableInfo): New public class. This is now responsible for
10021 checking whether a variable has been assigned. It is used for
10022 parameters and local variables.
10023 (Block.EmitMeta): Take the InternalParameters as argument; compute
10024 the layout of the flow vectors here.
10025 (Block.LocalMap, Block.ParameterMap): New public properties.
10026 (FlowBranching): The .ctor doesn't get the InternalParameters
10027 anymore since Block.EmitMeta() now computes the layout of the flow
10029 (MyStructInfo): This class is now known as `StructInfo' and nested
10030 in `TypeInfo'; we don't access this directly anymore.
10032 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
10033 property and removed IsAssigned(), IsFieldAssigned(),
10034 SetAssigned() and SetFieldAssigned(); we now call them on the
10035 VariableInfo so we don't need to duplicate this code everywhere.
10037 * expression.cs (ParameterReference): Added `Block block' argument
10039 (LocalVariableReference, ParameterReference, This): The new
10040 VariableInfo class is now responsible for all the definite
10043 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
10044 IsParameterAssigned, SetParameterAssigned): Removed.
10046 2003-05-18 Martin Baulig <martin@ximian.com>
10048 * typemanager.cs (InitCoreTypes): Try calling
10049 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
10050 the 3-args-version. Corlib now also needs our `void_type'.
10051 (GetMethod): Added overloaded version which takes an optional
10052 `bool report_errors' to allow lookups of optional methods.
10054 2003-05-12 Martin Baulig <martin@ximian.com>
10056 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
10057 only used for locals and not for parameters.
10059 2003-05-12 Miguel de Icaza <miguel@ximian.com>
10061 * support.cs (InternalParameters.ParameterType): Return the
10062 ExternalType of the parameter.
10064 * parameter.cs (Parameter.ExternalType): drop the two arguments,
10067 2003-05-11 Miguel de Icaza <miguel@ximian.com>
10069 * class.cs (MethodData.Define): Do not set the `newslot' on
10070 interface members, if they are also flagged as "override".
10072 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
10073 better code for ++i and i++. This only works for static fields
10074 and local variables.
10076 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
10077 want to pull the DeclSpace out of the builder_to_declspace instead
10078 of the TypeBuilder (like in TypeContainer.FindMembers).
10080 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
10081 instead of LookupTypeContainer. Fixes the crash on .NET for
10082 looking up interface members.
10084 * const.cs: Create our own emit context during the Definition
10085 stage, so that constants are evaluated in the proper context, when
10086 a recursive definition happens.
10088 2003-05-11 Martin Baulig <martin@ximian.com>
10090 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
10091 new block for a switch section.
10092 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
10093 the adding/lookup in the switch block. Fixes #39828.
10095 2003-05-09 Miguel de Icaza <miguel@ximian.com>
10097 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
10098 functionality: I needed to convert the data after I had performed
10099 the add/sub operation into the operands type size.
10101 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
10102 pass the type for the box operation, otherwise the resulting
10103 object would have been of type object.
10105 (BoxedCast): Add constructor to specify the type to box as.
10107 2003-05-07 Miguel de Icaza <miguel@ximian.com>
10109 * iterators.cs: I was reusing the `count' variable inadvertently,
10110 take steps to not allow this to happen.
10112 2003-05-06 Miguel de Icaza <miguel@ximian.com>
10114 * attribute.cs (Attribute.Resolve): Params attributes are encoded
10115 by creating an array at the point where the params starts and
10116 putting all those arguments there, then adjusting the size of the
10119 2003-05-05 Miguel de Icaza <miguel@ximian.com>
10121 * expression.cs (New.AddressOf): Implement interface
10122 IMemoryLocation. This is used when the `new' operator is used in
10123 the context of an invocation to a method on a value type.
10125 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
10128 * namespace.cs: Also check the using aliases here.
10130 * driver.cs: Move the test for using validity after the types have
10131 been entered, so we do a single pass that also includes the using
10134 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
10135 in the regular case. CreateSiblingForFinally is doing extra
10138 * attribute.cs (GetAttributeArgumentExpression): Store the result
10139 on an out value, and use the return value to indicate failure
10140 instead of using null (which is a valid return for Constant.GetValue).
10142 * statement.cs: Perform the analysis flow for the increment
10143 portion after the statement, because this will be the real flow of
10144 execution. Fixes #42385
10146 * codegen.cs (EmitContext.EmitArgument,
10147 EmitContext.EmitStoreArgument): New helper functions when the
10148 RemapToProxy flag is set.
10150 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
10153 Add support for remapping parameters.
10155 * iterators.cs: Propagate parameter values; Store parameter
10156 values in the proxy classes.
10158 2003-05-04 Miguel de Icaza <miguel@ximian.com>
10160 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
10161 need a proxy reference; I do not know what I was thinking
10163 * cs-parser.jay (constructor_initializer): catch another error,
10164 and display nice message.
10166 (field_declaration): catch void field declaration
10167 to flag a better error.
10169 * class.cs (MemberBase.CheckBase): Report an error instead of a
10170 warning if a new protected member is declared in a struct.
10171 (Field.Define): catch the error of readonly/volatile.
10173 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
10175 (FieldExpr.AddressOf): ditto. Catch error where the address of a
10176 volatile variable is taken
10178 2003-05-02 Miguel de Icaza <miguel@ximian.com>
10180 * statement.cs (Fixed.Resolve): Report an error if we are not in
10183 2003-05-01 Miguel de Icaza <miguel@ximian.com>
10185 * typemanager.cs: reuse the code that handles type clashes for
10186 delegates and enumerations.
10188 * class.cs (Report28): Always report.
10190 * expression.cs (EncodeAsAttribute): Allow nulls here.
10192 2003-04-28 Miguel de Icaza <miguel@ximian.com>
10194 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
10195 the functionality for testing whether an expression is valid for
10196 an attribute here. Also handle the case of arrays of elements
10199 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
10200 encoding a linear array into an array of objects that are suitable
10201 to be passed to an CustomAttributeBuilder.
10203 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
10205 * ecore.cs: (FieldExpr): Handle field remapping here.
10207 * iteratators.cs: Pass the instance variable (if the method is an
10208 instance method) to the constructors, so we can access the field
10209 variables on the class.
10211 TODO: Test this with structs. I think the THIS variable on
10212 structs might have to be a pointer, and not a refenrece
10214 2003-04-27 Miguel de Icaza <miguel@ximian.com>
10216 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
10217 local variables to fields in a proxy class.
10219 * iterators.cs (PopulateProxy): Rename our internal fields to
10221 Create a <THIS> field if we are an instance method, so we can
10222 reference our parent container variables.
10223 (MapVariable): Called back from the EmitContext code to enter a
10224 new variable to field mapping into the proxy class (we just create
10228 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
10229 for using the remapped locals to fields.
10231 I placed the code here, because that gives the same semantics to
10232 local variables, and only changes the Emit code.
10234 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
10235 statements inside iterators.
10236 (VariableInfo): Add a FieldBuilder for the cases when we are
10237 remapping local variables to fields in a proxy class
10239 * ecore.cs (SimpleNameResolve): Avoid testing two times for
10240 current_block != null.
10242 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
10243 not cope with strings, as it has been moved to the
10244 TableSwitchEmit. Fixed bug in switch generation.
10246 * expression.cs (New.DoResolve): Provide more context for the user
10247 when reporting an error.
10249 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
10252 * expression.cs (MemberAccess.DoResolve): When we get a type back,
10253 check the permissions for it. Note than in a type-resolution
10254 context the check was already present in DeclSpace.ResolveType,
10255 but was missing from the MemberAccess.
10257 (ArrayCreation.CheckIndices): warn if the user has
10258 more nested levels of expressions, but there are no more
10259 dimensions specified. Avoids crash on bug 41906.
10261 2003-04-26 Miguel de Icaza <miguel@ximian.com>
10263 * statement.cs (Block): replace Implicit bool, for a generic
10265 New flag: `Unchecked'. This is used during the EmitMeta phase
10266 (which is out-of-line with the regular Resolve/Emit process for a
10267 statement, as this is done ahead of time, but still gets a chance
10268 to call constant resolve).
10270 (Block.Flags): new enum for adding a new flag.
10272 (Block.EmitMeta): track the state of unchecked.
10274 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
10275 to enable constant resolution to work there as well.
10277 2003-04-22 Miguel de Icaza <miguel@ximian.com>
10279 * typemanager.cs (ienumerable_type): Also look up
10280 System.Collections.IEnumerable.
10282 2003-04-21 Miguel de Icaza <miguel@ximian.com>
10284 TODO: Test more than one conditional per method.
10286 * class.cs (Indexer.Define): Report the location where the user is
10287 referencing the unsupported feature.
10289 (MethodData): Overload the use of `conditionals' to
10290 minimize the creation of needless ArrayLists. This saves roughly
10291 212kb on my machine.
10293 (Method): Implement the new IIteratorContainer interface.
10294 (Method.SetYields): Implement the method by setting the ModFlags
10295 to contain METHOD_YIELDS.
10297 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
10298 which just got set to null.
10300 * iterators.cs: New file.
10302 (Yield, YieldBreak): New statements.
10304 * statement.cs (Return.Resolve): Flag an error if we are used in
10305 an iterator method.
10307 * codegen.cs (InIterator): New flag set if the code is being
10308 compiled in an iterator method.
10310 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
10311 internal modifier, and we just use it to avoid adding extra
10312 fields, as this is seldom used.
10314 * cs-parser.jay: Add yield_statement (yield and yield break).
10316 * driver.cs: New flag -v2 to turn on version 2 features.
10318 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
10319 hashtable when v2 is enabled.
10321 2003-04-20 Miguel de Icaza <miguel@ximian.com>
10323 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
10324 there is already a namespace defined with this name.
10326 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
10327 people upgraded their corlibs.
10329 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
10330 always use fully qualified types, no need to use the compiler
10333 (TypeManager.IsNamespace): Use binarysearch.
10335 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
10336 AddDelegate): I did not quite use the new IsValid API properly: I
10337 have to pass the short-name and the fullname. I was passing only
10338 the basename instead of the fullname sometimes.
10340 (TypeContainer.DefineType): call NamespaceClash.
10342 * interface.cs (Interface.DefineType): use NamespaceClash before
10345 * delegate.cs (Delegate.DefineType): use NamespaceClash before
10348 * enum.cs: (Enum.DefineType): use NamespaceClash before
10351 * typemanager.cs (: 3-line patch that gives us some tasty 11%
10352 speed increase. First, use the negative_hits cache when we get a
10353 negative. Second, add the type with its full original name
10354 instead of the new . and + encoded name (reflection uses + to
10355 separate type from a nested type). Use LookupTypeReflection
10356 directly which bypasses the type->name hashtable (that we already
10357 know does not contain the type.
10359 * decl.cs (DeclSpace.ResolveTypeExpr): track the
10360 location/container type.
10362 * driver.cs: When passing utf8, use directly the UTF8Encoding.
10364 2003-04-19 Miguel de Icaza <miguel@ximian.com>
10366 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
10368 * delegate.cs (NewDelegate.Resolve): Test whether an instance
10369 method is being referenced in the method group from a static
10370 context, and report error 120 if so.
10372 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
10375 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
10376 is created, we create the A namespace).
10378 * cs-parser.jay: A namespace also introduces a DeclarationFound.
10381 2003-04-18 Miguel de Icaza <miguel@ximian.com>
10383 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
10384 invocation to ModuleBuilder.GetType with the same values will
10385 return a new type instance, so we need to cache its return
10388 * expression.cs (Binary.ResolveOperator): Only allow the compare
10389 operators on enums if they are of the same type.
10391 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
10392 types of ValueType on their own case. Before we were giving them
10393 the same treatment as objects.
10395 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
10396 fullname. Short name is used to compare against container name.
10397 Fullname is used to check against defined namespace names.
10399 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
10400 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
10402 (Method.CheckBase): Call parent.
10403 (MemberBase.CheckBase): Check for protected members on sealed
10405 (PropertyBase.CheckBase): Call parent.
10406 (Field.Define): Call parent.
10408 * report.cs: Negative error codes are now mapped to 8000 - code,
10409 so that the display is render more nicely.
10411 * typemanager.cs: Do not use try/catch, instead report a regular
10414 (GetPointerType, GetReferenceType): These methods provide
10415 mechanisms to obtain the T* and T& from a T. We had the code
10416 previously scattered around the code base, and it also used
10417 TypeManager.LookupType that would go through plenty of caches.
10418 This one goes directly to the type source.
10420 In some places we did the Type.GetType followed by
10421 ModuleBuilder.GetType, but not in others, so this unifies the
10422 processing as well.
10424 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
10425 statements now that we have namespace information.
10427 * typemanager.cs (IsNamespace): New method, returns whether the
10428 string presented is a namespace or not.
10430 (ComputeNamespaces): New public entry point, computes the list of
10431 available namespaces, using the GetNamespaces API call in Mono, or
10432 the slower version in MS.NET.
10434 Now before we start the semantic analysis phase, we have a
10435 complete list of namespaces including everything that the user has
10438 Deleted old code to cache namespaces in .nsc files.
10440 2003-04-17 Miguel de Icaza <miguel@ximian.com>
10442 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
10443 class/struct location definition Location for the implicit
10444 constructor location.
10446 (Operator.Define): Use the location of the operator for the
10447 implicit Method definition.
10449 (Constructor.Emit): use the constructor location for the implicit
10450 base initializer constructor.
10452 * ecore.cs: Remove ITypeExpression. This interface is now gone,
10453 and the Expression class now contains two new methods:
10455 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
10456 isolate type lookup from the rest of the resolution process.
10458 Since we use Expressions to hold type definitions due to the way
10459 we parse the input we have historically overloaded Resolve to
10460 perform the Type lookups if a special flag is passed. Now this is
10461 eliminated and two methods take their place.
10463 The differences in the two methods between xStep and xTerminal is
10464 that xStep is involved in our current lookup system that uses
10465 SimpleNames to compose a name, while xTerminal is used just to
10466 catch the case where the simplename lookup failed.
10468 2003-04-16 Miguel de Icaza <miguel@ximian.com>
10470 * expression.cs (ResolveMemberAccess): Remove redundant code.
10471 TypeExpr expressions are always born fully resolved.
10473 * interface.cs (PopulateMethod): Do not lookup the types twice.
10474 We were doing it once during SemanticAnalysis and once during
10477 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
10478 in local variable type definitions, were being returned as a
10479 SimpleName (we decomposed everything into a string), that is
10480 because primary_expression was being used instead of a type in the
10481 grammar (reduce/reduce conflicts).
10483 The part that was wrong is that we converted the expression into a
10484 string (an oversimplification in one hand, compounded with primary
10485 expressions doing string concatenation).
10491 Would return "A.B.C[]" as a SimpleName. This stopped things like
10492 using clauses from working on this particular context. And a type
10493 was being matched directly against "A.B.C[]".
10495 We now use the correct approach, and allow for ComposedCast to be
10496 part of the unary expression. So the "A.B.C []" become a composed
10497 cast of "A.B.C" (as a nested group of MemberAccess with a
10498 SimpleName at the end) plus the rank composition "[]".
10502 2003-04-10 Miguel de Icaza <miguel@ximian.com>
10504 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
10505 for the access level checking.
10507 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
10508 `TypeContainer container', because I kept getting confused when I
10509 was debugging this code.
10511 * expression.cs (Indexers): Instead of tracking getters/setters,
10512 we now track them in parallel. We create one arraylist less, but
10513 most importantly it is possible now for the LValue code to find a
10514 matching get for a set.
10516 (IndexerAccess.DoResolveLValue): Update the code.
10517 GetIndexersForType has been modified already to extract all the
10518 indexers from a type. The code assumed it did not.
10520 Also make the code set the correct return type for the indexer.
10521 This was fixed a long time ago for properties, but was missing for
10522 indexers. It used to be void_type.
10524 (Binary.Emit): Test first for doubles instead of
10525 floats, as they are more common.
10527 (Binary.EmitBranchable): Use the .un version of the branch opcodes
10528 when dealing with floats and the <=, >= operators. This fixes bug
10531 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
10532 to load the array value by emitting a load on the foreach variable
10533 type. This was incorrect.
10535 We now emit the code to load an element using the the array
10536 variable type, and then we emit the conversion operator.
10540 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
10542 * attribute.cs: Avoid allocation of ArrayLists in the common case.
10544 2003-04-09 Miguel de Icaza <miguel@ximian.com>
10546 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
10547 test for protection before we test for signatures.
10549 (MethodSignature.ToString): implement.
10551 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
10552 to the case where we reduced into a LongConstant.
10554 * decl.cs (CheckAccessLevel): If the type is an array, we can not
10555 depend on whether the information is acurrate, because the
10556 Microsoft runtime will always claim that the array type is public,
10557 regardless of the real state.
10559 If the type is a pointer, another problem happens: the type is
10560 reported as non-public in Microsoft.
10562 In both cases we have to call CheckAccessLevel recursively with
10563 the underlying type as the argument to be tested.
10565 2003-04-08 Miguel de Icaza <miguel@ximian.com>
10567 * assign.cs (Assign.Emit): If we are dealing with a compound
10568 assignment expression, we should use the code path that stores the
10569 intermediate result in a temporary value. This fixes #40903.
10571 *expression.cs (Indirection.ToString): Provide ToString method for
10574 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
10576 * class.cs: Null out fields holding references to Block objects so
10577 they can be garbage collected.
10579 * expression.cs (OverloadResolve): Remove unused local.
10581 2003-04-07 Martin Baulig <martin@ximian.com>
10583 * codegen.cs (EmitContext.CurrentFile): New public field.
10584 (EmitContext.Mark): Use the CurrentFile to check whether the
10585 location is in the correct file.
10586 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
10588 2003-04-07 Martin Baulig <martin@ximian.com>
10590 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
10592 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
10593 location. [FIXME: The location argument which gets passed to this
10594 method is sometimes wrong!]
10596 2003-04-07 Nick Drochak <ndrochak@gol.com>
10598 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
10600 2003-04-07 Miguel de Icaza <miguel@ximian.com>
10602 * expression.cs (Indirection.EmitAssign): We were using the
10603 temporary, but returning immediately instead of continuing the
10606 2003-04-06 Martin Baulig <martin@ximian.com>
10608 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
10609 if it's a nested child, but also deriving from the outer class.
10612 * typemanager.cs (IsNestedChildOf): Make this work if it's a
10613 nested child, but also deriving from the outer class. See
10615 (FilterWithClosure): We may access private members of the outer
10616 class if we're a nested child and deriving from the outer class.
10617 (RealMemberLookup): Only set `closure_private_ok' if the
10618 `original_bf' contained BindingFlags.NonPublic.
10620 2003-04-05 Martin Baulig <martin@ximian.com>
10622 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
10623 probe if its a type parameter, and if so, flag an error.
10625 * decl.cs: Move here the SetParameterInfo code from class.cs.
10626 Handle IsGeneric here.
10628 Handle a variety of errors in the parameter info definition.
10630 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
10631 type parameters here.
10633 * cs-parser.jay (class_declaration): report errors for parameters
10636 2003-01-21 Miguel de Icaza <miguel@ximian.com>
10638 * generic.cs: New file, contains support code for generics.
10640 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
10641 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
10643 Update parser for the above removals.
10645 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
10646 now taken care of in the parser.
10648 2003-04-02 Miguel de Icaza <miguel@ximian.com>
10650 * class.cs (Event.Define): Do not allow abstract events to have
10653 2003-04-01 Miguel de Icaza <miguel@ximian.com>
10655 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
10656 block in event declarations.
10658 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
10659 value type, get its address.
10661 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
10662 leaving a class on the stack instead of a boolean value (int
10663 0/1). Change the code so we compare against null, and then the
10664 result against zero.
10666 * class.cs (TypeContainer.GetClassBases): We were checking for the
10667 parent class being sealed too late.
10669 * expression.cs (Binary.Emit): For <= and >= when dealing with
10670 floating point values, use cgt.un and clt.un instead of cgt and
10673 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
10675 * statement.cs: Apply the same optimization as MS: skip the
10676 GetEnumerator returning an IEnumerator, and use the one returning a
10677 CharEnumerator instead. This allows us to avoid the try-finally block
10680 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
10682 * cs-parser.jay: Attributes cannot be applied to
10683 namespaces. Fixes #40473
10685 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10688 (Add*): check if the name is valid using the full name for constants,
10689 fields, properties and events.
10691 2003-03-28 Miguel de Icaza <miguel@ximian.com>
10693 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
10694 char constants to be part of the enumeration.
10696 * expression.cs (Conditional.DoResolve): Add support for operator
10697 true. Implements the missing functionality from 14.12
10699 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
10700 operator true/false as required by the spec.
10702 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
10703 implicit conversion to boolean.
10705 * statement.cs (Statement.ResolveBoolean): A boolean expression is
10706 also one where the type implements `operator true'.
10708 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
10709 get an expression that will invoke operator true based on an
10712 (GetConversionOperators): Removed the hack that called op_True
10715 (Expression.ResolveBoolean): Move this from Statement.
10717 2003-03-17 Miguel de Icaza <miguel@ximian.com>
10719 * ecore.cs (FieldExpr): do not allow initialization of initonly
10720 fields on derived classes
10722 2003-03-13 Martin Baulig <martin@ximian.com>
10724 * statement.cs (Block.Emit): Call ig.BeginScope() and
10725 ig.EndScope() when compiling with debugging info; call
10726 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
10728 2003-03-08 Miguel de Icaza <miguel@ximian.com>
10730 * expression.cs (Indexers): Do not construct immediately, allow
10731 for new members to be appended as we go. Fixes 38143
10733 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10735 * expression.cs: save/restore context when resolving an unchecked
10738 2003-03-05 Miguel de Icaza <miguel@ximian.com>
10740 * cfold.cs: Catch division by zero in modulus operator during
10743 2003-03-03 Miguel de Icaza <miguel@ximian.com>
10745 * interface.cs (Interface.DefineMembers): Avoid defining members
10748 2003-02-27 Miguel de Icaza <miguel@ximian.com>
10750 * driver.cs: handle the +/- options for -noconfig
10752 * statement.cs (Unckeched.Resolve): Also track the state of
10753 unchecked in the Resolve phase.
10755 2003-02-27 Martin Baulig <martin@ximian.com>
10757 * ecore.cs (Expression.MemberLookup): Don't create a
10758 MethodGroupExpr for something which is not a method. Fixes #38291.
10760 2003-02-25 Miguel de Icaza <miguel@ximian.com>
10762 * class.cs (MemberBase.CheckParameters): Also check that the type
10763 is unmanaged if it is a pointer.
10765 * expression.cs (SizeOf.Resolve): Add location information.
10767 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
10768 a managed type is declared.
10770 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
10771 parameter modifiers as well. Fixes bug 38606
10773 * class.cs: Very sad. Am backing out the speed up changes
10774 introduced by the ArrayList -> Array in the TypeContainer, as they
10775 were not actually that much faster, and introduced a bug (no error
10776 reports on duplicated methods).
10778 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
10779 source first, this will guarantee that we have a valid expression
10780 before calling in lower levels functions that will require a
10781 resolved object. Then use this original_source in the
10782 target.ResolveLValue instead of the original source that was
10785 Another change. Use target.Resolve instead of LValueResolve.
10786 Although we are resolving for LValues, we will let the Assign code
10787 take care of that (it will be called again from Resolve). This
10788 basically allows code like this:
10790 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
10791 class Y { void A (X x) { x [0] += o; }
10793 The problem was that the indexer was trying to resolve for
10794 set_Item (idx, object o) and never finding one. The real set_Item
10795 was set_Item (idx, X). By delaying the process we get the right
10800 2003-02-23 Martin Baulig <martin@ximian.com>
10802 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
10803 while calling DoEmit ().
10805 * codegen.cs (EmitContext.Mark): Don't mark locations in other
10806 source files; if you use the #line directive inside a method, the
10807 compiler stops emitting line numbers for the debugger until it
10808 reaches the end of the method or another #line directive which
10809 restores the original file.
10811 2003-02-23 Martin Baulig <martin@ximian.com>
10813 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
10815 2003-02-23 Martin Baulig <martin@ximian.com>
10817 * statement.cs (Block.AddChildVariableNames): We need to call this
10818 recursively, not just for our immediate children.
10820 2003-02-23 Martin Baulig <martin@ximian.com>
10822 * class.cs (Event.Define): Always make the field private, like csc does.
10824 * typemanager.cs (TypeManager.RealMemberLookup): Make events
10825 actually work, fixes bug #37521.
10827 2003-02-23 Miguel de Icaza <miguel@ximian.com>
10829 * delegate.cs: When creating the various temporary "Parameters"
10830 classes, make sure that we call the ComputeAndDefineParameterTypes
10831 on those new parameters (just like we do with the formal ones), to
10832 allow them to be resolved in the context of the DeclSpace.
10834 This fixes the bug that Dick observed in Bugzilla #38530.
10836 2003-02-22 Miguel de Icaza <miguel@ximian.com>
10838 * expression.cs (ResolveMemberAccess): When resolving a constant,
10839 do not attempt to pull a constant if the value was not able to
10840 generate a valid constant.
10842 * const.cs (LookupConstantValue): Do not report more errors than required.
10844 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10846 * expression.cs: fixes bug #38328.
10848 2003-02-18 Miguel de Icaza <miguel@ximian.com>
10850 * class.cs: Changed all the various members that can be part of a
10851 class from being an ArrayList to be an Array of the right type.
10852 During the DefineType type_list, interface_list, delegate_list and
10853 enum_list are turned into types, interfaces, delegates and enums
10856 And during the member population, indexer_list, event_list,
10857 constant_list, field_list, instance_constructor_list, method_list,
10858 operator_list and property_list are turned into their real arrays.
10860 Although we could probably perform this operation earlier, for
10861 good error reporting we need to keep the lists and remove the
10862 lists for longer than required.
10864 This optimization was triggered by Paolo profiling the compiler
10865 speed on the output of `gen-sample-program.pl' perl script.
10867 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
10868 not crash in methods like MemberLookupFailed that use this field.
10870 This problem arises when the compiler fails to resolve a type
10871 during interface type definition for example.
10873 2003-02-18 Miguel de Icaza <miguel@ximian.com>
10875 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
10876 inherit from System.Object, so we have to stop at null, not only
10877 when reaching System.Object.
10879 2003-02-17 Miguel de Icaza <miguel@ximian.com>
10881 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
10882 DeclaredOnly because the parent indexer might have had a different
10883 name, but did not loop until the top of the hierarchy was reached.
10885 The problem this one fixes is 35492: when a class implemented an
10886 indexer from an interface, we were getting the interface method
10887 (which was abstract) and we were flagging an error (can not invoke
10890 This also keeps bug 33089 functioning, and test-148 functioning.
10892 * typemanager.cs (IsSpecialMethod): The correct way of figuring
10893 out if a method is special is to see if it is declared in a
10894 property or event, or whether it is one of the predefined operator
10895 names. This should fix correctly #36804.
10897 2003-02-15 Miguel de Icaza <miguel@ximian.com>
10899 The goal here is to remove the dependency on EmptyCast.Peel ().
10900 Killing it completely.
10902 The problem is that currently in a number of places where
10903 constants are expected, we have to "probe" for an EmptyCast, and
10904 Peel, which is not the correct thing to do, as this will be
10905 repetitive and will likely lead to errors.
10907 The idea is to remove any EmptyCasts that are used in casts that
10908 can be reduced to constants, so we only have to cope with
10911 This bug hunt was triggered by Bug 37363 and the desire to remove
10912 the duplicate pattern where we were "peeling" emptycasts to check
10913 whether they were constants. Now constants will always be
10916 * ecore.cs: Use an enumconstant here instead of wrapping with
10919 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
10920 throwing me off. By handling this we can get rid of a few hacks.
10922 * statement.cs (Switch): Removed Peel() code.
10924 2003-02-14 Miguel de Icaza <miguel@ximian.com>
10926 * class.cs: Location information for error 508
10928 * expression.cs (New.DoResolve): Add a guard against double
10929 resolution of an expression.
10931 The New DoResolve might be called twice when initializing field
10932 expressions (see EmitFieldInitializers, the call to
10933 GetInitializerExpression will perform a resolve on the expression,
10934 and later the assign will trigger another resolution
10936 This leads to bugs (#37014)
10938 * delegate.cs: The signature for EndInvoke should contain any ref
10939 or out parameters as well. We were not doing this in the past.
10941 * class.cs (Field.Define): Do not overwrite the type definition
10942 inside the `volatile' group. Turns out that volatile enumerations
10943 were changing the type here to perform a validity test, which
10946 2003-02-12 Miguel de Icaza <miguel@ximian.com>
10948 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
10949 and structs, we do not want to load the instance variable
10951 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
10952 enum_type has to be handled like an object reference (implicit
10953 conversions exists from this to object), but the regular IsClass
10954 and IsValueType tests will never return true for this one.
10956 Also we use TypeManager.IsValueType instead of type.IsValueType,
10957 just for consistency with the rest of the code (this is only
10958 needed if we ever use the construct exposed by test-180.cs inside
10959 corlib, which we dont today).
10961 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
10963 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
10966 2003-02-09 Martin Baulig <martin@ximian.com>
10968 * namespace.cs (Namespace..ctor): Added SourceFile argument.
10969 (Namespace.DefineNamespaces): New static public method; this is
10970 called when we're compiling with debugging to add all namespaces
10971 to the symbol file.
10973 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
10974 pass it to the Namespace's .ctor.
10976 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
10977 and MethodBase arguments; pass the namespace ID to the symwriter;
10978 pass the MethodBase instead of the token to the symwriter.
10979 (SymbolWriter.DefineNamespace): New method to add a namespace to
10982 2003-02-09 Martin Baulig <martin@ximian.com>
10984 * symbolwriter.cs: New file. This is a wrapper around
10985 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
10986 methods here in near future.
10988 2003-02-09 Martin Baulig <martin@ximian.com>
10990 * codegen.cs (EmitContext.Mark): Just pass the arguments to
10991 ILGenerator.MarkSequencePoint() which are actually used by the
10994 2003-02-09 Martin Baulig <martin@ximian.com>
10996 * location.cs (SourceFile): New public sealed class. This
10997 contains the name and an index which is used in the location's token.
10998 (Location): Reserve an appropriate number of bits in the token for
10999 the source file instead of walking over that list, this gives us a
11000 really huge performance improvement when compiling with debugging.
11002 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
11003 `SourceFile' argument instead of a string.
11004 (Driver.ProcessFile): Add all the files via Location.AddFile(),
11005 but don't parse/tokenize here, we need to generate the list of all
11006 source files before we do that.
11007 (Driver.ProcessFiles): New static function. Parses/tokenizes all
11010 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
11011 instead of a string.
11013 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
11016 2003-02-09 Martin Baulig <martin@ximian.com>
11018 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
11019 filename on `#line default'.
11021 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
11023 * statement.cs: don't clear the pinned var when the fixed statement
11024 returns from the method (fixes bug#37752).
11026 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
11028 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
11031 2003-02-07 Martin Baulig <martin@ximian.com>
11033 * driver.cs: Removed the `--debug-args' command line argument.
11035 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
11036 automatically by the AsssemblyBuilder.
11037 (CodeGen.InitializeSymbolWriter): We don't need to call any
11038 initialization function on the symbol writer anymore. This method
11039 doesn't take any arguments.
11041 2003-02-03 Miguel de Icaza <miguel@ximian.com>
11043 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
11044 from referenced assemblies as well.
11046 2003-02-02 Martin Baulig <martin@ximian.com>
11048 * class.cs (MethodData.Emit): Generate debugging info for external methods.
11050 2003-02-02 Martin Baulig <martin@ximian.com>
11052 * class.cs (Constructor.Emit): Open the symbol writer before
11053 emitting the constructor initializer.
11054 (ConstructorInitializer.Emit): Call ec.Mark() to allow
11055 single-stepping through constructor initializers.
11057 2003-01-30 Miguel de Icaza <miguel@ximian.com>
11059 * class.cs: Handle error 549: do not allow virtual methods in
11062 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
11064 * decl.cs: Check access levels when resolving types
11066 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
11068 * statement.cs: Add parameters and locals set in catch blocks that might
11069 return to set vector
11071 2003-01-29 Miguel de Icaza <miguel@ximian.com>
11073 * class.cs (Operator): Set the SpecialName flags for operators.
11075 * expression.cs (Invocation.DoResolve): Only block calls to
11076 accessors and operators on SpecialName methods.
11078 (Cast.TryReduce): Handle conversions from char constants.
11081 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
11083 * statement.cs: small memory and time optimization in FlowBranching.
11085 2003-01-28 Pedro Mart <yoros@wanadoo.es>
11087 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
11088 problem that the last fix but in the other sid (Set).
11090 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
11091 access when there is no indexer in the hierarchy.
11093 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
11095 * class.cs: Combine some if statements.
11097 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11099 * driver.cs: fixed bug #37187.
11101 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
11103 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
11104 any indexer, it's needed to build a list with all the indexers in the
11105 hierarchy (AllGetters), else we have problems. Fixes #35653.
11107 2003-01-23 Miguel de Icaza <miguel@ximian.com>
11109 * class.cs (MethodData.Define): It is wrong for an interface
11110 implementation to be static in both cases: explicit and implicit.
11111 We were only handling this in one case.
11113 Improve the if situation there to not have negations.
11115 * class.cs (Field.Define): Turns out that we do not need to check
11116 the unsafe bit on field definition, only on usage. Remove the test.
11118 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11120 * driver.cs: use assembly.Location instead of Codebase (the latest
11121 patch made mcs fail when using MS assemblies).
11123 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
11125 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
11126 get the path to *corlib.dll.
11128 2003-01-21 Nick Drochak <ndrochak@gol.com>
11132 * typemanager.cs: Remove compiler warnings
11134 2003-01-20 Duncan Mak <duncan@ximian.com>
11136 * AssemblyInfo.cs: Bump the version number to 0.19.
11138 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11140 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
11142 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
11144 * class.cs (Constructor::Emit): Emit debugging info for constructors.
11146 2003-01-17 Miguel de Icaza <miguel@ximian.com>
11148 * cs-parser.jay: Small fix: we were not comparing the constructor
11149 name correctly. Thanks to Zoltan for the initial pointer.
11151 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
11153 * cs-tokenizer.cs: Set file name when specified with #line
11155 2003-01-15 Miguel de Icaza <miguel@ximian.com>
11157 * cs-parser.jay: Only perform the constructor checks here if we
11158 are named like the class; This will help provider a better
11159 error. The constructor path is taken when a type definition is
11160 not found, but most likely the user forgot to add the type, so
11161 report that rather than the constructor error.
11163 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
11165 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
11168 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
11170 * cs-parser.jay: Add cleanup call.
11172 2003-01-13 Duncan Mak <duncan@ximian.com>
11174 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
11175 consistent with other methods.
11177 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
11179 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
11181 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
11183 * attribute.cs: only set GuidAttr to true when we have a
11186 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11190 * typemanager.cs: fixes to allow mcs compile corlib with the new
11191 Type.IsSubclassOf fix.
11193 2003-01-08 Miguel de Icaza <miguel@ximian.com>
11195 * expression.cs (LocalVariableReference.DoResolve): Classify a
11196 constant as a value, not as a variable. Also, set the type for
11199 * cs-parser.jay (fixed_statement): take a type instead of a
11200 pointer_type, so we can produce a better error message later.
11202 * statement.cs (Fixed.Resolve): Flag types that are not pointers
11205 (For.DoEmit): Make inifinite loops have a
11206 non-conditional branch back.
11208 (Fixed.DoEmit): First populate the pinned variables, then emit the
11209 statement, then clear the variables. Before I was emitting the
11210 code once for each fixed piece.
11213 2003-01-08 Martin Baulig <martin@ximian.com>
11215 * statement.cs (FlowBranching.MergeChild): A break in a
11216 SWITCH_SECTION does not leave a loop. Fixes #36155.
11218 2003-01-08 Martin Baulig <martin@ximian.com>
11220 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
11221 lives in the same number space than `param_map'. Fixes #36154.
11223 2003-01-07 Miguel de Icaza <miguel@ximian.com>
11225 * cs-parser.jay (constructor_declaration): Set the
11226 Constructor.ModFlags before probing for it. This makes the
11227 compiler report 514, 515 and 132 (the code was there, but got
11230 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
11231 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
11232 (GotoCase.Resolve): Set `Returns' to ALWAYS.
11234 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
11236 * enum.cs: create the enum static fields using the enum type.
11238 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
11240 * class.cs: don't try to create the ParamBuilder for the return
11241 type if it's not needed (and handle it breaking for the ms runtime
11244 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
11246 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
11248 2002-12-29 Miguel de Icaza <miguel@ximian.com>
11250 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
11251 the command. This showed up while compiling the JANET source
11252 code, which used \r as its only newline separator.
11254 2002-12-28 Miguel de Icaza <miguel@ximian.com>
11256 * class.cs (Method.Define): If we are an operator (because it
11257 reuses our code), then set the SpecialName and HideBySig. #36128
11259 2002-12-22 Miguel de Icaza <miguel@ximian.com>
11261 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
11262 exception, report error 120 `object reference required'.
11264 * driver.cs: Add --pause option, used during to measure the size
11265 of the process as it goes with --timestamp.
11267 * expression.cs (Invocation.DoResolve): Do not allow methods with
11268 SpecialName to be invoked.
11270 2002-12-21 Miguel de Icaza <miguel@ximian.com>
11272 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
11273 number before adding it.
11275 2002-12-21 Ravi Pratap <ravi@ximian.com>
11277 * ecore.cs (StandardImplicitConversion): When in an unsafe
11278 context, we allow conversion between void * to any other pointer
11279 type. This fixes bug #35973.
11281 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
11283 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
11284 is not thrown when extensionless outputs are used
11286 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11288 * rootcontext.cs: fixed compilation of corlib.
11290 2002-12-19 Miguel de Icaza <miguel@ximian.com>
11292 * attribute.cs (Attributes.Contains): Add new method.
11294 * class.cs (MethodCore.LabelParameters): if the parameter is an
11295 `out' parameter, check that no attribute `[In]' has been passed.
11297 * enum.cs: Handle the `value__' name in an enumeration.
11299 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
11301 * decl.cs: Added special case to allow overrides on "protected
11304 2002-12-18 Ravi Pratap <ravi@ximian.com>
11306 * attribute.cs (Attributes.AddAttributeSection): Rename to this
11307 since it makes much more sense.
11309 (Attributes.ctor): Don't require a Location parameter.
11311 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
11313 * attribute.cs (ApplyAttributes): Remove extra Location parameters
11314 since we already have that information per attribute.
11316 * everywhere : make appropriate changes.
11318 * class.cs (LabelParameters): Write the code which actually
11319 applies attributes to the return type. We can't do this on the MS
11320 .NET runtime so we flag a warning in the case an exception is
11323 2002-12-18 Miguel de Icaza <miguel@ximian.com>
11325 * const.cs: Handle implicit null conversions here too.
11327 2002-12-17 Ravi Pratap <ravi@ximian.com>
11329 * class.cs (MethodCore.LabelParameters): Remove the extra
11330 Type [] parameter since it is completely unnecessary. Instead
11331 pass in the method's attributes so that we can extract
11332 the "return" attribute.
11334 2002-12-17 Miguel de Icaza <miguel@ximian.com>
11336 * cs-parser.jay (parse): Use Report.Error to flag errors instead
11337 of ignoring it and letting the compile continue.
11339 * typemanager.cs (ChangeType): use an extra argument to return an
11340 error condition instead of throwing an exception.
11342 2002-12-15 Miguel de Icaza <miguel@ximian.com>
11344 * expression.cs (Unary.TryReduce): mimic the code for the regular
11345 code path. Perform an implicit cast in the cases where we can
11346 implicitly convert to one of the integral types, and then reduce
11347 based on that constant. This fixes bug #35483.
11349 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11351 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
11353 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11355 * namespace.cs: fixed bug #35489.
11357 2002-12-12 Miguel de Icaza <miguel@ximian.com>
11359 * class.cs: Remove some dead code.
11361 * cs-parser.jay: Estimate the number of methods needed
11362 (RootContext.MethodCount);
11364 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
11365 numbers instead of StringBuilders.
11367 * support.cs (PtrHashtable): Add constructor with initial size;
11368 We can now reduce reallocations of the method table.
11370 2002-12-10 Ravi Pratap <ravi@ximian.com>
11372 * attribute.cs (ApplyAttributes): Keep track of the emitted
11373 attributes on a per-target basis. This fixes bug #35413.
11375 2002-12-10 Miguel de Icaza <miguel@ximian.com>
11377 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
11378 default to the Windows 1252 encoding.
11380 (UnixParseOption): Support version, thanks to Alp for the missing
11383 * AssemblyInfo.cs: Add nice assembly information.
11385 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
11388 * cs-parser.jay: Allow a trailing comma before the close bracked
11389 in the attribute_section production.
11391 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
11392 address of the instance was being taken, I will take this out,
11393 because we take the address of the object immediately here.
11395 2002-12-09 Ravi Pratap <ravi@ximian.com>
11397 * typemanager.cs (AreMultipleAllowed): Take care of the most
11398 obvious case where attribute type is not in the current assembly -
11401 2002-12-08 Miguel de Icaza <miguel@ximian.com>
11403 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
11404 definitions, instead of doing that afterwards.
11406 Also we use a nice little hack, depending on the constructor, we
11407 know if we are a "composed" name or a simple name. Hence, we
11408 avoid the IndexOf test, and we avoid
11410 * codegen.cs: Add code to assist in a bug reporter to track down
11411 the source of a compiler crash.
11413 2002-12-07 Ravi Pratap <ravi@ximian.com>
11415 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
11416 types have been emitted for a given element and flag an error
11417 if something which does not have AllowMultiple set is used more
11420 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
11421 attribute types and their corresponding AllowMultiple properties
11423 (AreMultipleAllowed): Check the property for a given type.
11425 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
11426 property in the case we have a TypeContainer.
11428 (Attributes.AddAttribute): Detect duplicates and just skip on
11429 adding them. This trivial fix catches a pretty gross error in our
11430 attribute emission - global attributes were being emitted twice!
11432 Bugzilla bug #33187 is now fixed.
11434 2002-12-06 Miguel de Icaza <miguel@ximian.com>
11436 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
11437 instead of pp_and).
11439 * expression.cs (Binary.ResolveOperator): I can only use the
11440 Concat (string, string, string) and Concat (string, string,
11441 string, string) if the child is actually a concatenation of
11444 2002-12-04 Miguel de Icaza <miguel@ximian.com>
11446 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
11447 context where we need a 2-character lookahead.
11449 * pending.cs (PendingImplementation): Rework so we can keep track
11450 of interface types all the time, and flag those which were
11451 implemented by parents as optional.
11453 2002-12-03 Miguel de Icaza <miguel@ximian.com>
11455 * expression.cs (Binary.ResolveOperator): Use
11456 String.Concat(string,string,string) or
11457 String.Concat(string,string,string,string) when possible.
11459 * typemanager: More helper methods.
11462 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
11464 * pending.cs: remove the bogus return from GetMissingInterfaces()
11465 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
11467 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11469 * namespace.cs: avoid duplicated 'using xxx' being added to
11470 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
11471 when we get more than one 'using' statement for the same namespace.
11472 Report a CS0105 warning for it.
11474 2002-11-30 Miguel de Icaza <miguel@ximian.com>
11476 * cs-tokenizer.cs (consume_identifier): use read directly, instead
11477 of calling getChar/putback, uses internal knowledge of it.
11479 (xtoken): Reorder tokenizer so most common patterns are checked
11480 first. This reduces the compilation time in another 5% (from 8.11s
11481 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
11483 The parsing time is 22% of the compilation in mcs, and from that
11484 64% is spent on the tokenization process.
11486 I tried using a binary search for keywords, but this is slower
11487 than the hashtable. Another option would be to do a couple of
11490 * Not use a StringBuilder, instead use an array of chars,
11491 with a set value. Notice that this way we could catch
11492 the 645 error without having to do it *afterwards*.
11494 * We could write a hand-parser to avoid the hashtable
11495 compares altogether.
11497 The identifier consumption process takes 37% of the tokenization
11498 time. Another 15% is spent on is_number. 56% of the time spent
11499 on is_number is spent on Int64.Parse:
11501 * We could probably choose based on the string length to
11502 use Int32.Parse or Int64.Parse and avoid all the 64-bit
11505 Another 3% is spend on wrapping `xtoken' in the `token' function.
11507 Handle 0xa0 as whitespace (#34752)
11509 2002-11-26 Miguel de Icaza <miguel@ximian.com>
11511 * typemanager.cs (IsCLRType): New routine to tell whether a type
11512 is one of the builtin types.
11514 Maybe it needs to use TypeCodes to be faster. Maybe we could use
11515 typecode in more places instead of doing pointer comparissions.
11516 We could leverage some knowledge about the way the typecodes are
11519 New code to cache namespaces in assemblies, it is currently not
11520 invoked, to be used soon.
11522 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
11524 * expression.cs (Binary.ResolveOperator): specially handle
11525 strings, and do not perform user-defined operator overloading for
11528 2002-11-24 Miguel de Icaza <miguel@ximian.com>
11530 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
11531 internalcall as it is a pretty simple operation; Avoid whenever
11532 possible to call Char.IsLetter.
11534 (consume_identifier): Cut by half the number of
11535 hashtable calls by merging the is_keyword and GetKeyword behavior.
11537 Do not short-circuit, because if we do, we
11538 report errors (ie, #if false && true would produce an invalid
11542 2002-11-24 Martin Baulig <martin@ximian.com>
11544 * expression.cs (Cast.TryReduce): If we're in checked syntax,
11545 check constant ranges and report a CS0221. Fixes #33186.
11547 2002-11-24 Martin Baulig <martin@ximian.com>
11549 * cs-parser.jay: Make this work for uninitialized variable
11550 declarations in the `for' initializer. Fixes #32416.
11552 2002-11-24 Martin Baulig <martin@ximian.com>
11554 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
11555 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
11557 2002-11-24 Martin Baulig <martin@ximian.com>
11559 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
11560 argument; if true, we also check for user-defined conversions.
11561 This is only needed if both arguments are of a user-defined type.
11562 Fixes #30443, added test-175.cs.
11563 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
11565 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
11567 2002-11-24 Martin Baulig <martin@ximian.com>
11569 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
11570 function to get the store opcode.
11571 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
11572 only emit the Ldelema if the store opcode is Stobj. You must run
11573 both test-34 and test-167 to test this. Fixes #34529.
11575 2002-11-23 Martin Baulig <martin@ximian.com>
11577 * ecore.cs (Expression.MemberLookup): Added additional
11578 `qualifier_type' argument which is used when we're being called
11579 from MemberAccess.DoResolve() and null if we're called from a
11581 (Expression.MemberLookupFailed): New method to report errors; this
11582 does the CS1540 check and reports the correct error message.
11584 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
11585 argument for the CS1540 check and redone the way how we're dealing
11586 with private members. See the comment in the source code for details.
11587 (FilterWithClosure): Reverted this back to revision 1.197; renamed
11588 `closure_start_type' to `closure_qualifier_type' and check whether
11589 it's not null. It was not this filter being broken, it was just
11590 being called with the wrong arguments.
11592 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
11593 and pass it the correct `qualifier_type'; this also does the error
11596 2002-11-22 Miguel de Icaza <miguel@ximian.com>
11598 * expression.cs (Invocation.EmitParams): If the we are dealing
11599 with a non-built-in value type, load its address as well.
11601 (ArrayCreation): Use a a pretty constant instead
11602 of the hardcoded value 2. Use 6 instead of 2 for the number of
11603 static initializers.
11605 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
11606 because they are not really value types, just glorified integers.
11608 * driver.cs: Do not append .exe, the CSC compiler does not do it.
11610 * ecore.cs: Remove redundant code for enumerations, make them use
11611 the same code path as everything else, fixes the casting issue
11612 with enumerations in Windows.Forms.
11614 * attribute.cs: Do only cast to string if it is a string, the
11615 validation happens later.
11617 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
11618 people upgrade their corlibs.
11620 * ecore.cs: Oops, enumerations were not following the entire code path
11622 2002-11-21 Miguel de Icaza <miguel@ximian.com>
11624 * typemanager.cs (FilterWithClosure): Commented out the test for
11625 1540 in typemanager.cs, as it has problems when accessing
11626 protected methods from a parent class (see test-174.cs).
11628 * attribute.cs (Attribute.ValidateGuid): new method.
11629 (Attribute.Resolve): Use above.
11631 2002-11-19 Miguel de Icaza <miguel@ximian.com>
11633 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
11635 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
11636 handling for enumerations, as we only needed the TypeContainer
11637 functionality to begin with (this is required for the fix below to
11638 work for enums that reference constants in a container class for
11641 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
11643 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
11644 a valid TypeBuilder to perform lookups on.o
11646 * class.cs (InheritableMemberSignatureCompare): Use true in the
11647 call to GetGetMethod and GetSetMethod, because we are comparing
11648 the signature, and we need to get the methods *even* if they are
11651 (PropertyBase.CheckBase): ditto.
11653 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
11654 GotoCase.Resolve): Use Peel on EmpytCasts.
11656 * ecore.cs (EmptyCast): drop child, add Peel method.
11658 2002-11-17 Martin Baulig <martin@ximian.com>
11660 * ecore.cs (EmptyCast.Child): New public property.
11662 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
11663 label resolved to an EmptyCast. Fixes #34162.
11664 (GotoCase.Resolve): Likewise.
11665 (Block.EmitMeta): Likewise.
11667 2002-11-17 Martin Baulig <martin@ximian.com>
11669 * expression.cs (Invocation.BetterConversion): Prefer int over
11670 uint; short over ushort; long over ulong for integer literals.
11671 Use ImplicitConversionExists instead of StandardConversionExists
11672 since we also need to check for user-defined implicit conversions.
11673 Fixes #34165. Added test-173.cs.
11675 2002-11-16 Martin Baulig <martin@ximian.com>
11677 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
11678 with the `true' and `false' literals. Fixes #33151.
11680 2002-11-16 Martin Baulig <martin@ximian.com>
11682 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
11683 October 22nd; don't do the cs1540 check for static members.
11685 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
11686 now using our own filter here and doing the cs1540 check again.
11688 2002-11-16 Martin Baulig <martin@ximian.com>
11690 * support.cs (InternalParameters): Don't crash if we don't have
11691 any fixed parameters. Fixes #33532.
11693 2002-11-16 Martin Baulig <martin@ximian.com>
11695 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
11696 when looking up static methods to make this work on Windows.
11699 2002-11-16 Martin Baulig <martin@ximian.com>
11701 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
11702 a setter rather than using PropertyInfo.CanWrite.
11704 2002-11-15 Nick Drochak <ndrochak@gol.com>
11706 * class.cs: Allow acces to block member by subclasses. Fixes build
11709 2002-11-14 Martin Baulig <martin@ximian.com>
11711 * class.cs (Constructor.Emit): Added the extern/block check.
11714 2002-11-14 Martin Baulig <martin@ximian.com>
11716 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
11717 iteration while looking for indexers, this is needed because the
11718 indexer may have a different name in our base classes. Fixed the
11719 error reporting (no indexers at all, not get accessor, no
11720 overloaded match). Fixes bug #33089.
11721 (IndexerAccess.DoResolveLValue): Likewise.
11723 2002-11-14 Martin Baulig <martin@ximian.com>
11725 * class.cs (PropertyBase.CheckBase): Make this work for multiple
11726 indexers. Fixes the first part of bug #33089.
11727 (MethodSignature.InheritableMemberSignatureCompare): Added support
11730 2002-11-13 Ravi Pratap <ravi@ximian.com>
11732 * attribute.cs (Attribute.Resolve): Catch the
11733 NullReferenceException and report it since it isn't supposed to
11736 2002-11-12 Miguel de Icaza <miguel@ximian.com>
11738 * expression.cs (Binary.EmitBranchable): Also handle the cases for
11739 LogicalOr and LogicalAnd that can benefit from recursively
11740 handling EmitBranchable. The code now should be nice for Paolo.
11742 2002-11-08 Miguel de Icaza <miguel@ximian.com>
11744 * typemanager.cs (LookupType): Added a negative-hit hashtable for
11745 the Type lookups, as we perform quite a number of lookups on
11746 non-Types. This can be removed once we can deterministically tell
11747 whether we have a type or a namespace in advance.
11749 But this might require special hacks from our corlib.
11753 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
11754 and double which avoids a conversion from an integer to a double.
11756 * expression.cs: tiny optimization, avoid calling IsConstant,
11757 because it effectively performs the lookup twice.
11759 2002-11-06 Miguel de Icaza <miguel@ximian.com>
11761 But a bogus return here to keep the semantics of the old code
11762 until the Mono runtime is fixed.
11764 * pending.cs (GetMissingInterfaces): New method used to remove all
11765 the interfaces that are already implemented by our parent
11766 classes from the list of pending methods.
11768 * interface.cs: Add checks for calls after ResolveTypeExpr.
11770 2002-11-05 Miguel de Icaza <miguel@ximian.com>
11772 * class.cs (Class.Emit): Report warning 67: event not used if the
11773 warning level is beyond 3.
11775 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
11776 being a NullLiteral.
11778 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
11781 * class.cs (TypeContainer.GetClassBases): Cover a missing code
11782 path that might fail if a type can not be resolved.
11784 * expression.cs (Binary.Emit): Emit unsigned versions of the
11787 * driver.cs: use error 5.
11789 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
11791 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
11793 2002-11-01 Miguel de Icaza <miguel@ximian.com>
11795 * cs-parser.jay (switch_section): A beautiful patch from Martin
11796 Baulig that fixed 33094.
11798 2002-10-31 Miguel de Icaza <miguel@ximian.com>
11800 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
11801 Check whether the base is abstract and report an error if so.
11803 * expression.cs (IndexerAccess.DoResolveLValue,
11804 IndexerAccess.DoResolve): ditto.
11806 (Invocation.DoResolve): ditto.
11808 (Invocation.FullMethodDesc): Improve the report string.
11810 * statement.cs (Block): Eliminate IsVariableDefined as it is
11811 basically just a wrapper for GetVariableInfo.
11813 * ecore.cs (SimpleName): Use new
11815 * support.cs (ReflectionParamter.ParameterType): We unwrap the
11816 type, as we return the actual parameter ref/unref state on a
11819 2002-10-30 Miguel de Icaza <miguel@ximian.com>
11821 * support.cs: Return proper flags REF/OUT fixing the previous
11824 * expression.cs: Reverted last patch, that was wrong. Is_ref is
11825 not used to mean `ref' but `ref or out' in ParameterReference
11827 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
11828 full type signature instead of calling TypeManger.CSharpName
11831 * support.cs (InternalParameters.ParameterDesc): Do not compare
11832 directly to the modflags, because REF/OUT will actually be bitsets
11835 * delegate.cs (VerifyMethod): Check also the modifiers.
11837 * cs-tokenizer.cs: Fix bug where floating point values with an
11838 exponent where a sign was missing was ignored.
11840 * driver.cs: Allow multiple assemblies to be specified in a single
11843 2002-10-28 Miguel de Icaza <miguel@ximian.com>
11845 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
11846 because identifiers after a parenthesis would end up in this kind
11847 of production, and we needed to desamiguate it for having casts
11850 (UserDefinedType *) xxx
11852 2002-10-24 Miguel de Icaza <miguel@ximian.com>
11854 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
11855 we should set on the Bindingflags.NonPublic, but not turn on
11856 private_ok. private_ok controls whether a Private member is
11857 returned (this is chekced on the filter routine), while the
11858 BindingFlags.NonPublic just controls whether private/protected
11859 will be allowed. This fixes the problem part of the problem of
11860 private properties being allowed to be used in derived classes.
11862 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
11863 so we can call the children DoResolveLValue method (this will
11864 properly signal errors on lvalue assignments to base properties)
11866 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
11867 getter are null, and we have a property info, we know that this
11868 happened because the lookup failed, so we report an error 122 for
11869 protection level violation.
11871 We also silently return if setter and getter are null in the
11872 resolve functions, this condition only happens if we have flagged
11873 the error before. This is the other half of the problem.
11875 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
11876 not have accessibility information, that is why we were returning
11877 true in the filter function in typemanager.cs.
11879 To properly report 122 (property is inaccessible because of its
11880 protection level) correctly, we report this error in ResolveAccess
11881 by failing if both the setter and the getter are lacking (ie, the
11884 DoResolve and DoLResolve have been modified to check for both
11885 setter/getter being null and returning silently, the reason being
11886 that I did not want to put the knowledge about this error in upper
11889 int old = Report.Errors;
11890 x = new PropertyExpr (...);
11891 if (old != Report.Errors)
11896 So the property expr is returned, but it is invalid, so the error
11897 will be flagged during the resolve process.
11899 * class.cs: Remove InheritablePropertySignatureCompare from the
11900 class, as we no longer depend on the property signature to compute
11901 whether it is possible to implement a method or not.
11903 The reason is that calling PropertyInfo.GetGetMethod will return
11904 null (in .NET, in Mono it works, and we should change this), in
11905 cases where the Get Method does not exist in that particular
11910 class X { public virtual int A { get { return 1; } } }
11912 class Z : Y { public override int A { get { return 2; } } }
11914 Would fail in Z because the parent (Y) would not have the property
11915 defined. So we avoid this completely now (because the alternative
11916 fix was ugly and slow), and we now depend exclusively on the
11919 (PropertyBase.CheckBase): Use a method-base mechanism to find our
11920 reference method, instead of using the property.
11922 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
11923 routines are gone now.
11925 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
11926 names, they were incorrectly named.
11928 * cs-tokenizer.cs: Return are more gentle token on failure.
11930 * pending.cs (PendingImplementation.InterfaceMethod): This routine
11931 had an out-of-sync index variable, which caused it to remove from
11932 the list of pending methods the wrong method sometimes.
11934 2002-10-22 Miguel de Icaza <miguel@ximian.com>
11936 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
11937 CanWrite, because those refer to this particular instance of the
11938 property, and do not take into account the fact that we can
11939 override single members of a property.
11941 Constructor requires an EmitContext. The resolution process does
11942 not happen here, but we need to compute the accessors before,
11943 because the resolution does not always happen for properties.
11945 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
11946 subclass, before we did not update this flag, but we did update
11949 (GetAccessors): Drop this routine, as it did not work in the
11950 presence of partially overwritten set/get methods.
11952 Notice that this broke the cs1540 detection, but that will require
11955 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11959 * driver.cs: issue a warning instead of an error if we don't support
11960 debugging for the platform. Also ignore a couple of errors that may
11961 arise when trying to write the symbols. Undo my previous patch.
11963 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11965 * driver.cs: ignore /debug switch except for Unix platforms.
11967 2002-10-23 Nick Drochak <ndrochak@gol.com>
11969 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
11971 2002-10-21 Miguel de Icaza <miguel@ximian.com>
11973 * driver.cs: Do not make mcs-debug conditional, so we do not break
11974 builds that use it.
11976 * statement.cs (UsageVector.MergeChildren): I would like Martin to
11977 review this patch. But basically after all the children variables
11978 have been merged, the value of "Breaks" was not being set to
11979 new_breaks for Switch blocks. I think that it should be set after
11980 it has executed. Currently I set this to the value of new_breaks,
11981 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
11982 conservative, but I do not understand this code very well.
11984 I did not break anything in the build, so that is good ;-)
11986 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
11988 2002-10-20 Mark Crichton <crichton@gimp.org>
11990 * cfold.cs: Fixed compile blocker. Really fixed it this time.
11992 2002-10-20 Nick Drochak <ndrochak@gol.com>
11994 * cfold.cs: Fixed compile blocker.
11996 2002-10-20 Miguel de Icaza <miguel@ximian.com>
11998 * driver.cs: I was chekcing the key, not the file.
12000 2002-10-19 Ravi Pratap <ravi@ximian.com>
12002 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
12003 message that we were generating - we just need to silently return
12006 2002-10-19 Miguel de Icaza <miguel@ximian.com>
12008 * class.cs (Event.Define): Change my previous commit, as this
12009 breaks the debugger. This is a temporary hack, as it seems like
12010 the compiler is generating events incorrectly to begin with.
12012 * expression.cs (Binary.ResolveOperator): Added support for
12013 "U operator - (E x, E y)"
12015 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
12018 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
12019 init-only variables, but this path did not take into account that
12020 there might be also instance readonly variables. Correct this
12023 This fixes bug 32253
12025 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
12028 * driver.cs: Change the extension for modules to `netmodule'
12030 * cs-parser.jay: Improved slightly the location tracking for
12031 the debugger symbols.
12033 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
12034 modifiers that were specified instead of the hardcoded value
12035 (FamAndAssem). This was basically ignoring the static modifier,
12036 and others. Fixes 32429.
12038 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
12039 fixed a bug in the process (32476)
12041 * expression.cs (ArrayAccess.EmitAssign): Patch from
12042 hwang_rob@yahoo.ca that fixes bug 31834.3
12044 2002-10-18 Miguel de Icaza <miguel@ximian.com>
12046 * driver.cs: Make the module extension .netmodule.
12048 2002-10-16 Miguel de Icaza <miguel@ximian.com>
12050 * driver.cs: Report an error if the resource file is not found
12051 instead of crashing.
12053 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
12054 false, like Emit does.
12056 2002-10-16 Nick Drochak <ndrochak@gol.com>
12058 * typemanager.cs: Remove unused private member. Also reported mcs
12059 bug to report this as a warning like csc.
12061 2002-10-15 Martin Baulig <martin@gnome.org>
12063 * statement.cs (Statement.Emit): Made this a virtual method; emits
12064 the line number info and calls DoEmit().
12065 (Statement.DoEmit): New protected abstract method, formerly knows
12066 as Statement.Emit().
12068 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
12070 2002-10-11 Miguel de Icaza <miguel@ximian.com>
12072 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
12073 have fixed a remaining problem: not every AddXXXX was adding a
12074 fully qualified name.
12076 Now everyone registers a fully qualified name in the DeclSpace as
12077 being defined instead of the partial name.
12079 Downsides: we are slower than we need to be due to the excess
12080 copies and the names being registered this way.
12082 The reason for this is that we currently depend (on the corlib
12083 bootstrap for instance) that types are fully qualified, because
12084 we dump all the types in the namespace, and we should really have
12085 types inserted into the proper namespace, so we can only store the
12086 basenames in the defined_names array.
12088 2002-10-10 Martin Baulig <martin@gnome.org>
12090 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
12091 from bug #31834, see the bug report for a testcase which is
12094 2002-10-10 Martin Baulig <martin@gnome.org>
12096 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
12097 flow analysis code for this.
12099 * statement.cs (Do, While, For): Tell the flow analysis code about
12101 (FlowBranching.UsageVector): Added support for infinite loops.
12102 (Block.Resolve): Moved the dead code elimination here and use flow
12105 2002-10-09 Miguel de Icaza <miguel@ximian.com>
12107 * class.cs (Field.Define): Catch cycles on struct type
12110 * typemanager.cs (IsUnmanagedtype): Do not recursively check
12111 fields if the fields are static. We only need to check instance
12114 * expression.cs (As.DoResolve): Test for reference type.
12116 * statement.cs (Using.ResolveExpression): Use
12117 ConvertImplicitRequired, not ConvertImplicit which reports an
12119 (Using.ResolveLocalVariableDecls): ditto.
12121 * expression.cs (Binary.ResolveOperator): Report errors in a few
12122 places where we had to.
12124 * typemanager.cs (IsUnmanagedtype): Finish implementation.
12126 2002-10-08 Miguel de Icaza <miguel@ximian.com>
12128 * expression.cs: Use StoreFromPtr instead of extracting the type
12129 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
12131 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
12132 an enumeration value to a System.Enum, but System.Enum is not a
12133 value type, but an class type, so we need to box.
12135 (Expression.ConvertExplicit): One codepath could return
12136 errors but not flag them. Fix this. Fixes #31853
12138 * parameter.cs (Resolve): Do not allow void as a parameter type.
12140 2002-10-06 Martin Baulig <martin@gnome.org>
12142 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
12143 if it's a class type and not a struct. Fixes #31815.
12145 2002-10-06 Martin Baulig <martin@gnome.org>
12147 * statement.cs: Reworked the flow analysis code a bit to make it
12148 usable for dead code elimination.
12150 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12152 * cs-parser.jay: allow empty source files. Fixes bug #31781.
12154 2002-10-04 Miguel de Icaza <miguel@ximian.com>
12156 * expression.cs (ComposedCast.DoResolveType): A quick workaround
12157 to fix the test 165, will investigate deeper.
12159 2002-10-04 Martin Baulig <martin@gnome.org>
12161 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
12162 finally blocks actually work.
12163 (Try.Resolve): We don't need to create a sibling for `finally' if
12164 there is no finally block.
12166 2002-10-04 Martin Baulig <martin@gnome.org>
12168 * class.cs (Constructor.Define): The default accessibility for a
12169 non-default constructor is private, not public.
12171 2002-10-04 Miguel de Icaza <miguel@ximian.com>
12173 * class.cs (Constructor): Make AllowedModifiers public, add
12176 * cs-parser.jay: Perform the modifiers test here, as the
12177 constructor for the Constructor class usually receives a zero
12178 because of the way we create it (first we create, later we
12179 customize, and we were never checking the modifiers).
12181 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
12182 is a version of LookupTypeReflection that includes the type-name
12183 cache. This can be used as a fast path for functions that know
12184 the fully qualified name and are only calling into *.GetType() to
12185 obtain a composed type.
12187 This is also used by TypeManager.LookupType during its type
12190 (LookupType): We now also track the real type name, as sometimes
12191 we can get a quey for the real type name from things like
12192 ComposedCast. This fixes bug 31422.
12194 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
12195 complete type fullname, it does not have to go through the type
12196 resolution system to obtain the composed version of the type (for
12197 obtaining arrays or pointers).
12199 (Conditional.Emit): Use the EmitBoolExpression to
12200 generate nicer code, as requested by Paolo.
12202 (ArrayCreation.CheckIndices): Use the patch from
12203 hwang_rob@yahoo.ca to validate the array initializers.
12205 2002-10-03 Miguel de Icaza <miguel@ximian.com>
12207 * class.cs (ConstructorInitializer.Emit): simplify code by using
12208 Invocation.EmitCall, and at the same time, fix the bugs in calling
12209 parent constructors that took variable arguments.
12211 * ecore.cs (Expression.ConvertNumericExplicit,
12212 Expression.ImplicitNumericConversion): Remove the code that
12213 manually wrapped decimal (InternalTypeConstructor call is now gone
12216 * expression.cs (Cast.TryReduce): Also handle decimal types when
12217 trying to perform a constant fold on the type.
12219 * typemanager.cs (IsUnmanagedtype): Partially implemented.
12221 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
12222 that only turned off an error report, and did nothing else.
12224 2002-10-02 Miguel de Icaza <miguel@ximian.com>
12226 * driver.cs: Handle and ignore /fullpaths
12228 2002-10-01 Miguel de Icaza <miguel@ximian.com>
12230 * expression.cs (Binary.ResolveOperator): Catch the case where
12231 DoNumericPromotions returns true,
12233 (Binary.DoNumericPromotions): Simplify the code, and the tests.
12235 2002-09-27 Miguel de Icaza <miguel@ximian.com>
12237 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
12240 2002-09-26 Miguel de Icaza <miguel@ximian.com>
12242 * ecore.cs (ConvertNumericExplicit): It is not enough that the
12243 conversion exists, but it is also required that the conversion be
12244 performed. This manifested in "(Type64Enum) 2".
12246 * class.cs (TypeManager.AddMethod): The fix is not to change
12247 AddEnum, because that one was using a fully qualified name (every
12248 DeclSpace derivative does), but to change the AddMethod routine
12249 that was using an un-namespaced name. This now correctly reports
12250 the duplicated name.
12252 Revert patch until I can properly fix it. The issue
12253 is that we have a shared Type space across all namespaces
12254 currently, which is wrong.
12256 Options include making the Namespace a DeclSpace, and merge
12257 current_namespace/current_container in the parser.
12259 2002-09-25 Miguel de Icaza <miguel@ximian.com>
12261 * cs-parser.jay: Improve error reporting when we get a different
12262 kind of expression in local_variable_type and
12263 local_variable_pointer_type.
12265 Propagate this to avoid missleading errors being reported.
12267 * ecore.cs (ImplicitReferenceConversion): treat
12268 TypeManager.value_type as a target just like object_type. As
12273 Is valid, and needs to result in the int 1 being boxed before it
12274 is assigned to the value type v.
12276 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
12277 to validate the enumeration name.
12279 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
12280 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
12281 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
12283 * ecore.cs (TryImplicitIntConversion): When doing an
12284 implicit-enumeration-conversion, check if the type is 64-bits and
12285 perform a conversion before passing to EnumConstant.
12287 2002-09-23 Miguel de Icaza <miguel@ximian.com>
12289 * decl.cs (Error_AmbiguousTypeReference); New routine used to
12290 report ambiguous type references. Unlike the MS version, we
12291 report what the ambiguity is. Innovation at work ;-)
12293 (DeclSpace.FindType): Require a location argument to
12294 display when we display an ambiguous error.
12296 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
12298 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
12300 * expression.cs (EmitDynamicInitializers): Apply patch from
12301 hwang_rob@yahoo.ca that fixes the order in which we emit our
12304 2002-09-21 Martin Baulig <martin@gnome.org>
12306 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
12307 delegate takes no arguments.
12309 2002-09-20 Miguel de Icaza <miguel@ximian.com>
12311 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
12314 * expression.cs: Extract the underlying type.
12316 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
12318 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
12320 2002-09-19 Miguel de Icaza <miguel@ximian.com>
12322 * class.cs (TypeContainer.DefineType): We can not use the nice
12323 PackingSize with the size set to 1 DefineType method, because it
12324 will not allow us to define the interfaces that the struct
12327 This completes the fixing of bug 27287
12329 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
12330 means also structs. This fixes part of the problem.
12331 (Expresion.ImplicitReferenceConversionExists): ditto.
12333 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
12334 error if there were no errors reported during the type lookup
12335 process, to avoid duplicates or redundant errors. Without this
12336 you would get an ambiguous errors plus a type not found. We have
12337 beaten the user enough with the first error.
12339 (DeclSparce.FindType): Emit a warning if we have an ambiguous
12342 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
12343 during the resolution process, stop the lookup, this avoids
12344 repeated error reports (same error twice).
12346 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
12348 * typemanager.cs (LookupType): Redo the type lookup code to match
12349 the needs of System.Reflection.
12351 The issue is that System.Reflection requires references to nested
12352 types to begin with a "+" sign instead of a dot. So toplevel
12353 types look like: "NameSpace.TopLevelClass", and nested ones look
12354 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
12357 2002-09-19 Martin Baulig <martin@gnome.org>
12359 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
12360 says that a method always returns or always throws an exception,
12361 don't report the CS0161.
12363 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
12364 set `Returns = new_returns'.
12366 2002-09-19 Martin Baulig <martin@gnome.org>
12368 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
12369 to an enum constant, check for a CS0176.
12371 2002-09-18 Miguel de Icaza <miguel@ximian.com>
12373 * class.cs (TypeContainer.CheckPairedOperators): Now we check
12374 for operators that must be in pairs and report errors.
12376 * ecore.cs (SimpleName.DoResolveType): During the initial type
12377 resolution process, when we define types recursively, we must
12378 check first for types in our current scope before we perform
12379 lookups in the enclosing scopes.
12381 * expression.cs (MakeByteBlob): Handle Decimal blobs.
12383 (Invocation.VerifyArgumentsCompat): Call
12384 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
12385 I thought we were supposed to always call this, but there are a
12386 few places in the code where we dont do it.
12388 2002-09-17 Miguel de Icaza <miguel@ximian.com>
12390 * driver.cs: Add support in -linkres and -resource to specify the
12391 name of the identifier.
12393 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12395 * ecore.cs (StandardConversionExists): Sync with the conversion
12396 code: allow anything-* to void* conversions.
12398 (FindMostSpecificSource): Use an Expression argument
12399 instead of a Type, because we might be handed over a Literal which
12400 gets a few more implicit conversions that plain types do not. So
12401 this information was being lost.
12403 Also, we drop the temporary type-holder expression when not
12406 2002-09-17 Martin Baulig <martin@gnome.org>
12408 * class.cs (PropertyBase.CheckBase): Don't check the base class if
12409 this is an explicit interface implementation.
12411 2002-09-17 Martin Baulig <martin@gnome.org>
12413 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
12414 different `IndexerName' attributes.
12416 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
12417 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
12418 virtual CommonResolve().
12420 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12422 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
12423 and convert that to the UnderlyingType.
12425 * statement.cs (Foreach.Resolve): Indexers are just like variables
12426 or PropertyAccesses.
12428 * cs-tokenizer.cs (consume_string): Track line numbers and columns
12429 inside quoted strings, we were not doing this before.
12431 2002-09-16 Martin Baulig <martin@gnome.org>
12433 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
12434 resolve it. This is needed for the definite assignment check of the
12435 instance expression, fixes bug #29846.
12436 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
12438 2002-09-16 Nick Drochak <ndrochak@gol.com>
12440 * parameter.cs: Fix compile error. Cannot reference static member
12441 from an instance object. Is this an mcs bug?
12443 2002-09-14 Martin Baulig <martin@gnome.org>
12445 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
12446 multiple times. Fixes bug #30295, added test-166.cs.
12448 2002-09-14 Martin Baulig <martin@gnome.org>
12450 * statement.cs (Block.Emit): Don't emit unreachable code.
12451 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
12452 `break' statements.
12453 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
12455 2002-09-14 Martin Baulig <martin@gnome.org>
12457 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
12460 2002-09-14 Martin Baulig <martin@gnome.org>
12462 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
12463 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
12464 be false on the ms runtime.
12466 2002-09-13 Martin Baulig <martin@gnome.org>
12468 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
12469 the CS0038 error message.
12471 2002-09-12 Miguel de Icaza <miguel@ximian.com>
12473 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
12474 constant inside, return it.
12476 2002-09-12 Martin Baulig <martin@gnome.org>
12478 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
12479 implicit conversion can be done between enum types.
12481 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
12482 check whether an implicit conversion to the current enum's UnderlyingType
12483 exists and report an error if not.
12485 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
12486 without debugging support.
12488 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
12489 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
12491 2002-09-12 Martin Baulig <martin@gnome.org>
12493 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
12495 * ecore.cs (IMemberExpr.DeclaringType): New property.
12496 (SimpleName.SimpleNameResolve): Check whether we're accessing a
12497 nonstatic member of an outer type (CS0038).
12499 2002-09-11 Miguel de Icaza <miguel@ximian.com>
12501 * driver.cs: Activate the using-error detector at warning level
12502 4 (at least for MS-compatible APIs).
12504 * namespace.cs (VerifyUsing): Small buglett fix.
12506 * pending.cs (PendingImplementation): pass the container pointer.
12508 * interface.cs (GetMethods): Allow for recursive definition. Long
12509 term, I would like to move every type to support recursive
12510 definitions, not the current ordering mechanism that we have right
12513 The situation is this: Attributes are handled before interfaces,
12514 so we can apply attributes to interfaces. But some attributes
12515 implement interfaces, we will now handle the simple cases
12516 (recursive definitions will just get an error).
12518 * parameter.cs: Only invalidate types at the end if we fail to
12521 2002-09-09 Martin Baulig <martin@gnome.org>
12523 * ecore.cs (PropertyExpr.Emit): Also check for
12524 TypeManager.system_int_array_get_length so this'll also work when
12525 compiling corlib. Fixes #30003.
12527 2002-09-09 Martin Baulig <martin@gnome.org>
12529 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
12530 and throw an exception if we can't get the type's size. Fixed #30040,
12533 2002-09-09 Martin Baulig <martin@gnome.org>
12535 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
12537 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
12538 context. Fixes bug #30027.
12540 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
12541 virtual functions. Fixes bug #30043, added test-164.cs.
12543 2002-09-08 Ravi Pratap <ravi@ximian.com>
12545 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
12547 2002-09-08 Nick Drochak <ndrochak@gol.com>
12549 * driver.cs: Use an object to get the windows codepage since it's not a
12552 2002-09-08 Miguel de Icaza <miguel@ximian.com>
12554 * statement.cs (For.Emit): for infinite loops (test == null)
12555 return whether there is a break inside, not always "true".
12557 * namespace.cs (UsingEntry): New struct to hold the name of the
12558 using definition, the location where it is defined, and whether it
12559 has been used in a successful type lookup.
12561 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
12566 2002-09-06 Ravi Pratap <ravi@ximian.com>
12568 * attribute.cs : Fix incorrect code which relied on catching
12569 a NullReferenceException to detect a null being passed in
12570 where an object was expected.
12572 2002-09-06 Miguel de Icaza <miguel@ximian.com>
12574 * statement.cs (Try): flag the catch variable as assigned
12576 * expression.cs (Cast): Simplified by using ResolveType instead of
12577 manually resolving.
12579 * statement.cs (Catch): Fix bug by using ResolveType.
12581 2002-09-06 Ravi Pratap <ravi@ximian.com>
12583 * expression.cs (BetterConversion): Special case for when we have
12584 a NullLiteral as the argument and we have to choose between string
12585 and object types - we choose string the way csc does.
12587 * attribute.cs (Attribute.Resolve): Catch the
12588 NullReferenceException and report error #182 since the Mono
12589 runtime no more has the bug and having this exception raised means
12590 we tried to select a constructor which takes an object and is
12593 2002-09-05 Ravi Pratap <ravi@ximian.com>
12595 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
12596 message (1502, 1503) when we can't locate a method after overload
12597 resolution. This is much more informative and closes the bug
12600 * interface.cs (PopulateMethod): Return if there are no argument
12601 types. Fixes a NullReferenceException bug.
12603 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
12604 expressions too. Previously we were checking only in one place for
12605 positional arguments leaving out named arguments.
12607 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
12608 type to the enum type is not allowed. Remove code corresponding to
12611 (ConvertNumericExplicit): Allow explicit conversions from
12612 the underlying type to enum type. This precisely follows the spec
12613 and closes a bug filed by Gonzalo.
12615 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12618 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
12620 2002-09-03 Miguel de Icaza <miguel@ximian.com>
12622 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
12623 it was important that we stored the right value after the
12624 reduction in `converted'.
12626 2002-09-04 Martin Baulig <martin@gnome.org>
12628 * location.cs (Location.SymbolDocument): Use full pathnames for the
12631 2002-08-30 Miguel de Icaza <miguel@ximian.com>
12633 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
12634 of the expression resolve mechanism, because that will catch the
12635 SimpleName error failures.
12637 (Conditional): If we can not resolve the
12638 expression, return, do not crash.
12640 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12643 (location): display token name instead of its number.
12645 2002-08-28 Martin Baulig <martin@gnome.org>
12647 * expression.cs (Binary.ResolveOperator): Don't silently return
12648 but return an error if an operator cannot be applied between two
12651 2002-08-28 Martin Baulig <martin@gnome.org>
12653 * class.cs (Constructor.Define): Set the permission attributes
12654 correctly instead of making all constructors public.
12656 2002-08-28 Martin Baulig <martin@gnome.org>
12658 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
12659 for private members before reporting a CS0103; if we find anything,
12662 2002-08-28 Martin Baulig <martin@gnome.org>
12664 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
12665 to check whether `closure_start_type == closure_invocation_type',
12666 we also need to check whether `m.DeclaringType == closure_invocation_type'
12667 before bypassing the permission checks. We might be accessing
12668 protected/private members from the base class.
12669 (TypeManager.RealMemberLookup): Only set private_ok if private
12670 members were requested via BindingFlags.NonPublic.
12672 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
12674 * expression.cs (MemberAccess.ResolveMemberAccess): Set
12675 MethodGroupExpr.IsExplicitImpl if appropriate.
12676 (Invocation.DoResolve): Don't report the CS0120 for explicit
12677 interface implementations.
12679 2002-08-27 Martin Baulig <martin@gnome.org>
12681 * expression.cs (Invocation.DoResolve): If this is a static
12682 method and we don't have an InstanceExpression, we must report
12685 2002-08-25 Martin Baulig <martin@gnome.org>
12687 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
12688 `==' between a valuetype and an object.
12690 2002-08-25 Miguel de Icaza <miguel@ximian.com>
12692 * ecore.cs (TypeExpr): Provide a ToString method.
12694 2002-08-24 Martin Baulig <martin@gnome.org>
12696 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
12697 now called proggie.dbg and it's a binary file.
12699 2002-08-23 Martin Baulig <martin@gnome.org>
12701 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
12703 2002-08-23 Martin Baulig <martin@gnome.org>
12705 * struct.cs (MyStructInfo.ctor): Make this work with empty
12706 structs; it's not allowed to use foreach() on null.
12708 2002-08-23 Martin Baulig <martin@gnome.org>
12710 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
12711 writer the full pathname of the generated assembly.
12713 2002-08-23 Martin Baulig <martin@gnome.org>
12715 * statements.cs (FlowBranching.UsageVector.MergeChildren):
12716 A `finally' block never returns or breaks; improved handling of
12719 2002-08-23 Martin Baulig <martin@gnome.org>
12721 * statement.cs (Throw.Resolve): Allow `throw null'.
12723 2002-08-23 Martin Baulig <martin@gnome.org>
12725 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
12726 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
12727 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
12728 MemberLookup would return a wrong event if this is an explicit
12729 interface implementation and the class has an event with the same
12732 2002-08-23 Martin Baulig <martin@gnome.org>
12734 * statement.cs (Block.AddChildVariableNames): New public method.
12735 (Block.AddChildVariableName): Likewise.
12736 (Block.IsVariableNameUsedInChildBlock): Likewise.
12737 (Block.AddVariable): Check whether a variable name has already
12738 been used in a child block.
12740 * cs-parser.jay (declare_local_variables): Mark all variable names
12741 from the current block as being used in a child block in the
12744 2002-08-23 Martin Baulig <martin@gnome.org>
12746 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
12747 find the symbol writer.
12749 * driver.cs: csc also allows the arguments to /define being
12750 separated by commas, not only by semicolons.
12752 2002-08-23 Martin Baulig <martin@gnome.org>
12754 * interface.cs (Interface.GetMembers): Added static check for events.
12756 2002-08-15 Martin Baulig <martin@gnome.org>
12758 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
12759 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
12761 * ecore.cs (Expression.MemberLookup): Added documentation and explained
12762 why the MethodData.EmitDestructor() change was necessary.
12764 2002-08-20 Martin Baulig <martin@gnome.org>
12766 * class.cs (TypeContainer.FindMembers): Added static check for events.
12768 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
12770 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
12771 use Type.GetEvents(), not Type.FindMembers().
12773 2002-08-20 Martin Baulig <martin@gnome.org>
12775 * decl.cs (MemberCache): Added a special method cache which will
12776 be used for method-only searched. This ensures that a method
12777 search will return a MethodInfo with the correct ReflectedType for
12780 2002-08-20 Martin Baulig <martin@gnome.org>
12782 * decl.cs (DeclSpace.FindMembers): Made this public.
12784 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12786 * delegate.cs: fixed build on windows.
12787 [FIXME: Filed as bug #29150: MCS must report these errors.]
12789 2002-08-19 Ravi Pratap <ravi@ximian.com>
12791 * ecore.cs (StandardConversionExists): Return a false
12792 if we are trying to convert the void type to anything else
12793 since that is not allowed.
12795 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
12796 we flag error 70 in the event an event is trying to be accessed
12797 directly from outside the declaring type.
12799 2002-08-20 Martin Baulig <martin@gnome.org>
12801 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
12802 MemberCache from typemanager.cs to decl.cs.
12804 2002-08-19 Martin Baulig <martin@gnome.org>
12806 * class.cs (TypeContainer): Implement IMemberContainer.
12807 (TypeContainer.DefineMembers): Create the MemberCache.
12808 (TypeContainer.FindMembers): Do better BindingFlags checking; only
12809 return public members if BindingFlags.Public was given, check
12810 whether members are static.
12812 2002-08-16 Martin Baulig <martin@gnome.org>
12814 * decl.cs (DeclSpace.Define): Splitted this in Define and
12815 DefineMembers. DefineMembers is called first and initializes the
12818 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
12819 DefineMembers() on all our DeclSpaces.
12821 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
12822 but call DefineMembers() on all nested interfaces. We call their
12823 Define() in our new Define() function.
12825 * interface.cs (Interface): Implement IMemberContainer.
12826 (Interface.Define): Moved all code except the attribute stuf to
12828 (Interface.DefineMembers): Initialize the member cache.
12830 * typemanager.cs (IMemberFinder): Removed this interface, we don't
12831 need this anymore since we can use MemberCache.FindMembers directly.
12833 2002-08-19 Martin Baulig <martin@gnome.org>
12835 * typemanager.cs (MemberCache): When creating the cache for an
12836 interface type, add all inherited members.
12837 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
12838 to `out bool used_cache' and documented it.
12839 (TypeManager.MemberLookup): If we already used the cache in the first
12840 iteration, we don't need to do the interfaces check.
12842 2002-08-19 Martin Baulig <martin@gnome.org>
12844 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
12845 here from IMemberFinder and don't implement this interface anymore.
12846 (DeclSpace.MemberCache): Moved here from IMemberFinder.
12848 * typemanager.cs (IMemberFinder): This interface is now only used by
12849 classes which actually support the member cache.
12850 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
12851 since we only put DeclSpaces into this Hashtable.
12852 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
12853 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
12855 2002-08-16 Martin Baulig <martin@gnome.org>
12857 * typemanager.cs (ICachingMemberFinder): Removed.
12858 (IMemberFinder.MemberCache): New property.
12859 (TypeManager.FindMembers): Merged this with RealFindMembers().
12860 This function will never be called from TypeManager.MemberLookup()
12861 so we can't use the cache here, just the IMemberFinder.
12862 (TypeManager.MemberLookup_FindMembers): Check whether the
12863 IMemberFinder has a MemberCache and call the cache's FindMembers
12865 (MemberCache): Rewrote larger parts of this yet another time and
12866 cleaned it up a bit.
12868 2002-08-15 Miguel de Icaza <miguel@ximian.com>
12870 * driver.cs (LoadArgs): Support quoting.
12872 (Usage): Show the CSC-like command line arguments.
12874 Improved a few error messages.
12876 2002-08-15 Martin Baulig <martin@gnome.org>
12878 * typemanager.cs (IMemberContainer.Type): New property.
12879 (IMemberContainer.IsInterface): New property.
12881 The following changes are conditional to BROKEN_RUNTIME, which is
12882 defined at the top of the file.
12884 * typemanager.cs (MemberCache.MemberCache): Don't add the base
12885 class'es members, but add all members from TypeHandle.ObjectType
12886 if we're an interface.
12887 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
12888 is the current type.
12889 (MemberCache.CacheEntry.Container): Removed this field.
12890 (TypeHandle.GetMembers): Include inherited members.
12892 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12894 * typemanager.cs: fixed compilation and added a comment on a field that
12897 2002-08-15 Martin Baulig <martin@gnome.org>
12899 * class.cs (ConstructorInitializer.Resolve): In the
12900 Expression.MemberLookup call, use the queried_type as
12903 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
12904 declared' attribute, it's always true.
12905 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
12906 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
12907 temporary wrapper for FindMembers which tells MemberLookup whether
12908 members from the base classes are included in the return value.
12909 This will go away soon.
12910 (TypeManager.MemberLookup): Use this temporary hack here; once the
12911 new MemberCache is completed, we don't need to do the DeclaredOnly
12912 looping here anymore since the MemberCache will take care of this.
12913 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
12914 (MemberCache): When creating the MemberCache for a class, get
12915 members from the current class and all its base classes.
12916 (MemberCache.CacheEntry.Container): New field. This is a
12917 temporary hack until the Mono runtime is fixed to distinguish
12918 between ReflectedType and DeclaringType. It allows us to use MCS
12919 with both the MS runtime and the unfixed Mono runtime without
12920 problems and without accecting performance.
12921 (MemberCache.SearchMembers): The DeclaredOnly looping from
12922 TypeManager.MemberLookup is now done here.
12924 2002-08-14 Martin Baulig <martin@gnome.org>
12926 * statement.cs (MyStructInfo.MyStructInfo): Don't call
12927 Type.GetFields on dynamic types but get the fields from the
12928 corresponding TypeContainer.
12929 (MyStructInfo.GetStructInfo): Added check for enum types.
12931 * typemanager.cs (MemberList.IsSynchronized): Implemented.
12932 (MemberList.SyncRoot): Implemented.
12933 (TypeManager.FilterWithClosure): No need to check permissions if
12934 closure_start_type == closure_invocation_type, don't crash if
12935 closure_invocation_type is null.
12937 2002-08-13 Martin Baulig <martin@gnome.org>
12939 Rewrote TypeContainer.FindMembers to use a member cache. This
12940 gives us a speed increase of about 35% for the self-hosting MCS
12941 build and of about 15-20% for the class libs (both on GNU/Linux).
12943 * report.cs (Timer): New class to get enhanced profiling. This
12944 whole class is "TIMER" conditional since it remarkably slows down
12947 * class.cs (MemberList): New class. This is an IList wrapper
12948 which we're now using instead of passing MemberInfo[]'s around to
12949 avoid copying this array unnecessarily.
12950 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
12951 (ICachingMemberFinder, IMemberContainer): New interface.
12952 (TypeManager.FilterWithClosure): If `criteria' is null, the name
12953 has already been checked, otherwise use it for the name comparision.
12954 (TypeManager.FindMembers): Renamed to RealMemberFinder and
12955 provided wrapper which tries to use ICachingMemberFinder.FindMembers
12956 if possible. Returns a MemberList, not a MemberInfo [].
12957 (TypeHandle): New class, implements IMemberContainer. We create
12958 one instance of this class per type, it contains a MemberCache
12959 which is used to do the member lookups.
12960 (MemberCache): New class. Each instance of this class contains
12961 all members of a type and a name-based hash table.
12962 (MemberCache.FindMembers): This is our new member lookup
12963 function. First, it looks up all members of the requested name in
12964 the hash table. Then, it walks this list and sorts out all
12965 applicable members and returns them.
12967 2002-08-13 Martin Baulig <martin@gnome.org>
12969 In addition to a nice code cleanup, this gives us a performance
12970 increase of about 1.4% on GNU/Linux - not much, but it's already
12971 half a second for the self-hosting MCS compilation.
12973 * typemanager.cs (IMemberFinder): New interface. It is used by
12974 TypeManager.FindMembers to call FindMembers on a TypeContainer,
12975 Enum, Delegate or Interface.
12976 (TypeManager.finder_to_member_finder): New PtrHashtable.
12977 (TypeManager.finder_to_container): Removed.
12978 (TypeManager.finder_to_delegate): Removed.
12979 (TypeManager.finder_to_interface): Removed.
12980 (TypeManager.finder_to_enum): Removed.
12982 * interface.cs (Interface): Implement IMemberFinder.
12984 * delegate.cs (Delegate): Implement IMemberFinder.
12986 * enum.cs (Enum): Implement IMemberFinder.
12988 * class.cs (TypeContainer): Implement IMemberFinder.
12990 2002-08-12 Martin Baulig <martin@gnome.org>
12992 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
12994 2002-08-12 Martin Baulig <martin@gnome.org>
12996 * ecore.cs (ITypeExpression): New interface for expressions which
12998 (TypeExpression): Renamed to TypeLookupExpression.
12999 (Expression.DoResolve): If we're doing a types-only lookup, the
13000 expression must implement the ITypeExpression interface and we
13001 call DoResolveType() on it.
13002 (SimpleName): Implement the new ITypeExpression interface.
13003 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
13004 hack, the situation that we're only looking up types can't happen
13005 anymore when this method is called. Moved the type lookup code to
13006 DoResolveType() and call it.
13007 (SimpleName.DoResolveType): This ITypeExpression interface method
13008 is now doing the types-only lookup.
13009 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
13010 (ResolveFlags): Added MaskExprClass.
13012 * expression.cs (MemberAccess): Implement the ITypeExpression
13014 (MemberAccess.DoResolve): Added support for a types-only lookup
13015 when we're called via ITypeExpression.DoResolveType().
13016 (ComposedCast): Implement the ITypeExpression interface.
13018 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
13019 Expression.Resolve() with ResolveFlags.Type instead.
13021 2002-08-12 Martin Baulig <martin@gnome.org>
13023 * interface.cs (Interface.Define): Apply attributes.
13025 * attribute.cs (Attribute.ApplyAttributes): Added support for
13026 interface attributes.
13028 2002-08-11 Martin Baulig <martin@gnome.org>
13030 * statement.cs (Block.Emit): Only check the "this" variable if we
13031 do not always throw an exception.
13033 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
13034 whether the property has a set accessor.
13036 2002-08-11 Martin Baulig <martin@gnome.org>
13038 Added control flow analysis support for structs.
13040 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
13041 with control flow analysis turned off.
13042 (IVariable): New interface.
13043 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
13044 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
13045 (FieldExpr.DoResolve): Resolve the instance expression with flow
13046 analysis turned off and do the definite assignment check after the
13047 resolving when we know what the expression will resolve to.
13049 * expression.cs (LocalVariableReference, ParameterReference):
13050 Implement the new IVariable interface, only call the flow analysis
13051 code if ec.DoFlowAnalysis is true.
13052 (This): Added constructor which takes a Block argument. Implement
13053 the new IVariable interface.
13054 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
13055 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
13056 This does the definite assignment checks for struct members.
13058 * class.cs (Constructor.Emit): If this is a non-static `struct'
13059 constructor which doesn't have any initializer, call
13060 Block.AddThisVariable() to tell the flow analysis code that all
13061 struct elements must be initialized before control returns from
13064 * statement.cs (MyStructInfo): New public class.
13065 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
13066 argument to this indexer. If non-zero, check an individual struct
13067 member, not the whole struct.
13068 (FlowBranching.CheckOutParameters): Check struct members.
13069 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
13070 overloaded versions of these methods which take an additional
13071 `int field_idx' argument to check struct members.
13072 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
13073 overloaded versions of these methods which take an additional
13074 `string field_name' argument to check struct member.s
13075 (VariableInfo): Implement the IVariable interface.
13076 (VariableInfo.StructInfo): New public property. Returns the
13077 MyStructInfo instance of the variable if it's a struct or null.
13078 (Block.AddThisVariable): New public method. This is called from
13079 Constructor.Emit() for non-static `struct' constructor which do
13080 not have any initializer. It creates a special variable for the
13081 "this" instance variable which will be checked by the flow
13082 analysis code to ensure that all of the struct's fields are
13083 initialized before control returns from the constructor.
13084 (UsageVector): Added support for struct members. If a
13085 variable/parameter is a struct with N members, we reserve a slot
13086 in the usage vector for each member. A struct is considered fully
13087 initialized if either the struct itself (slot 0) or all its
13088 members are initialized.
13090 2002-08-08 Martin Baulig <martin@gnome.org>
13092 * driver.cs (Driver.MainDriver): Only report an error CS5001
13093 if there were no compilation errors.
13095 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
13096 `UnsafeContext' property to determine whether the parent is in
13097 unsafe context rather than checking the parent's ModFlags:
13098 classes nested in an unsafe class are unsafe as well.
13100 2002-08-08 Martin Baulig <martin@gnome.org>
13102 * statement.cs (UsageVector.MergeChildren): Distinguish between
13103 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
13104 we return. Added test17() and test18() to test-154.cs.
13106 2002-08-08 Martin Baulig <martin@gnome.org>
13108 * typemanager.cs (TypeManager.FilterWithClosure): If we have
13109 Family access, make sure the invoking type isn't a subclass of the
13110 queried type (that'd be a CS1540).
13112 * ecore.cs (Expression.MemberLookup): Added overloaded version of
13113 this method which takes an additional `Type invocation_type'.
13115 * expression.cs (BaseAccess.DoResolve): Use the base type as
13116 invocation and query type.
13117 (MemberAccess.DoResolve): If the lookup failed and we're about to
13118 report a CS0122, try a lookup with the ec.ContainerType - if this
13119 succeeds, we must report a CS1540.
13121 2002-08-08 Martin Baulig <martin@gnome.org>
13123 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
13124 (MethodGroupExpr): Implement the IMemberExpr interface.
13126 * expression (MemberAccess.ResolveMemberAccess): No need to have
13127 any special code for MethodGroupExprs anymore, they're now
13130 2002-08-08 Martin Baulig <martin@gnome.org>
13132 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
13133 Family, FamANDAssem and FamORAssem permissions.
13134 (TypeManager.IsSubclassOrNestedChildOf): New public method.
13136 2002-08-08 Martin Baulig <martin@gnome.org>
13138 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
13139 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
13142 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
13144 * driver.cs: implemented /resource option to embed managed resources.
13146 2002-08-07 Martin Baulig <martin@gnome.org>
13148 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
13149 (FieldBase.HasFieldInitializer): New public property.
13150 (FieldBase.GetInitializerExpression): New public method. Resolves and
13151 returns the field initializer and makes sure it is only resolved once.
13152 (TypeContainer.EmitFieldInitializers): Call
13153 FieldBase.GetInitializerExpression to get the initializer, this ensures
13154 that it isn't resolved multiple times.
13156 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
13157 the resolving process (SimpleName/MemberLookup) that we're currently
13158 emitting a field initializer (which must not access any instance members,
13159 this is an error CS0236).
13161 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
13162 argument, if the `IsFieldInitializer' flag is set, we must report and
13163 error CS0236 and not an error CS0120.
13165 2002-08-07 Martin Baulig <martin@gnome.org>
13167 * ecore.cs (IMemberExpr): New public interface.
13168 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
13169 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
13170 if the expression is an IMemberExpr.
13172 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
13173 to be null, implicitly default to `this' if we're non-static in
13174 this case. Simplified the code a lot by using the new IMemberExpr
13175 interface. Also fixed bug #28176 here.
13177 2002-08-06 Martin Baulig <martin@gnome.org>
13179 * cs-parser.jay (SimpleLookup): Removed. We need to create
13180 ParameterReferences during semantic analysis so that we can do a
13181 type-only search when resolving Cast, TypeOf and SizeOf.
13182 (block): Pass the `current_local_parameters' to the Block's
13185 * class.cs (ConstructorInitializer): Added `Parameters parameters'
13186 argument to the constructor.
13187 (ConstructorInitializer.Resolve): Create a temporary implicit
13188 block with the parameters.
13190 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
13191 references here if we aren't doing a type-only search.
13193 * statement.cs (Block): Added constructor which takes a
13194 `Parameters parameters' argument.
13195 (Block.Parameters): New public property.
13197 * support.cs (InternalParameters.Parameters): Renamed `parameters'
13198 to `Parameters' and made it public readonly.
13200 2002-08-06 Martin Baulig <martin@gnome.org>
13202 * ecore.cs (Expression.Warning): Made this public as well.
13204 * report.cs (Report.Debug): Print the contents of collections.
13206 2002-08-06 Martin Baulig <martin@gnome.org>
13208 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
13209 used to tell Resolve() which kinds of expressions it may return.
13210 (Expression.Resolve): Added overloaded version of this method which
13211 takes a `ResolveFlags flags' argument. This can be used to tell
13212 Resolve() which kinds of expressions it may return. Reports a
13214 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
13215 ResolveFlags.SimpleName.
13216 (Expression.Error118): Added overloaded version of this method which
13217 takes a `ResolveFlags flags' argument. It uses the flags to determine
13218 which kinds of expressions are allowed.
13220 * expression.cs (Argument.ResolveMethodGroup): New public method.
13221 Resolves an argument, but allows a MethodGroup to be returned.
13222 This is used when invoking a delegate.
13224 * TODO: Updated a bit.
13226 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13228 Fixed compilation with csc.
13230 * ecore.cs: Expression.Error made public. Is this correct? Should
13231 Warning be made public too?
13233 * expression.cs: use ea.Location instead of ea.loc.
13234 [FIXME: Filed as bug #28607: MCS must report these errors.]
13236 2002-08-06 Martin Baulig <martin@gnome.org>
13238 * ecore.cs (Expression.loc): Moved the location here instead of
13239 duplicating it in all derived classes.
13240 (Expression.Location): New public property.
13241 (Expression.Error, Expression.Warning): Made them non-static and
13242 removed the location argument.
13243 (Expression.Warning): Added overloaded version which takes an
13244 `int level' argument.
13245 (Expression.Error118): Make this non-static and removed the
13246 expression and location arguments.
13247 (TypeExpr): Added location argument to the constructor.
13249 * expression.cs (StaticCallExpr): Added location argument to
13251 (Indirection, PointerArithmetic): Likewise.
13252 (CheckedExpr, UnCheckedExpr): Likewise.
13253 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
13254 (StringPtr): Likewise.
13257 2002-08-05 Martin Baulig <martin@gnome.org>
13259 * expression.cs (BaseAccess.DoResolve): Actually report errors.
13261 * assign.cs (Assign.DoResolve): Check whether the source
13262 expression is a value or variable.
13264 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
13265 while resolving the corresponding blocks.
13267 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
13268 an error, don't silently return null.
13270 * statement.cs (Block.AddVariable): Do the error reporting here
13271 and distinguish between CS0128 and CS0136.
13272 (Block.DoResolve): Report all unused labels (warning CS0164).
13273 (LabeledStatement): Pass the location to the constructor.
13274 (LabeledStatement.HasBeenReferenced): New property.
13275 (LabeledStatement.Resolve): Set it to true here.
13277 * statement.cs (Return.Emit): Return success even after reporting
13278 a type mismatch error (CS0126 or CS0127), this is what csc does and
13279 it avoids confusing the users with any consecutive errors.
13281 2002-08-05 Martin Baulig <martin@gnome.org>
13283 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
13285 * const.cs (Const.LookupConstantValue): Catch circular definitions.
13287 * expression.cs (MemberAccess.DoResolve): Silently return if an
13288 error has already been reported.
13290 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
13291 error has already been reported.
13293 2002-08-05 Martin Baulig <martin@gnome.org>
13295 * statement.cs (UsageVector): Only initialize the `parameters'
13296 vector if we actually have any "out" parameters.
13298 2002-08-05 Martin Baulig <martin@gnome.org>
13300 * expression.cs (Binary.ResolveOperator): When combining delegates,
13301 they must have the same type.
13303 2002-08-05 Martin Baulig <martin@gnome.org>
13305 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
13306 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
13307 work with the ms runtime and we also don't need it: if we're a
13308 PropertyBuilder and not in the `indexer_arguments' hash, then we
13309 are a property and not an indexer.
13311 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
13312 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
13313 since the latter one doesn't work with the ms runtime.
13315 2002-08-03 Martin Baulig <martin@gnome.org>
13317 Fixed bugs #27998 and #22735.
13319 * class.cs (Method.IsOperator): New public field.
13320 (Method.CheckBase): Report CS0111 if there's already a method
13321 with the same parameters in the current class. Report CS0508 when
13322 attempting to change the return type of an inherited method.
13323 (MethodData.Emit): Report CS0179 if a method doesn't have a body
13324 and it's not marked abstract or extern.
13325 (PropertyBase): New abstract base class for Property and Indexer.
13326 (PropertyBase.CheckBase): Moved here from Property and made it work
13328 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
13329 the same so we can reuse it there.
13330 (Property, Indexer): Derive from PropertyBase.
13331 (MethodSignature.inheritable_property_signature_filter): New delegate
13332 to find properties and indexers.
13334 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
13335 argument and improved error reporting.
13337 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
13338 EmptyReadOnlyParameters and made it a property.
13340 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
13341 version of this method which takes a `PropertyInfo indexer'.
13342 (TypeManager.RegisterIndexer): New method.
13344 * class.cs: Added myself as author of this file :-)
13346 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13348 * class.cs: fixed compilation on windoze.
13350 2002-08-03 Martin Baulig <martin@gnome.org>
13352 * interface.cs (Interface.GetInterfaceBases): Check whether all
13353 base interfaces are at least as accessible than the current one.
13355 * class.cs (TypeContainer.GetClassBases): Check whether base types
13356 are at least as accessible than the current type.
13357 (TypeContainer.AsAccessible): Implemented and made non-static.
13358 (MemberBase.CheckParameters): Report errors if the accessibility
13361 * delegate.cs (Delegate.Delegate): The default visibility is
13362 internal for top-level types and private for nested types.
13363 (Delegate.Define): Report errors if the accessibility checks fail.
13365 * enum.cs (Enum.Enum): The default visibility is internal for
13366 top-level types and private for nested types.
13367 (Enum.DefineType): Compute the correct visibility.
13369 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
13370 function which takes a `bool is_toplevel' instead of a TypeContainer.
13372 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
13375 2002-08-02 Martin Baulig <martin@gnome.org>
13377 * expression.cs (LocalVariableReferenc): Added constructor which
13378 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
13379 (LocalVariableReference.IsReadOnly): New property.
13380 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
13381 variable is readonly, use our own readonly flag to do this; you can
13382 use the new constructor to get a writable reference to a read-only
13385 * cs-parser.jay (foreach_statement, using_statement): Get a writable
13386 reference to the local variable.
13388 2002-08-01 Miguel de Icaza <miguel@ximian.com>
13390 * rootcontext.cs (ResolveCore): Also include System.Exception
13392 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
13393 we reach an EmptyStatement.
13395 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
13398 * expression.cs (Binary.ResolveOperator): Check error result in
13401 use brtrue/brfalse directly and avoid compares to null.
13403 2002-08-02 Martin Baulig <martin@gnome.org>
13405 * class.cs (TypeContainer.Define): Define all nested interfaces here.
13406 Fixes bug #28407, added test-155.cs.
13408 2002-08-01 Martin Baulig <martin@gnome.org>
13410 * class.cs (Event.EmitDefaultMethod): Make this work with static
13411 events. Fixes #28311, added verify-3.cs.
13413 2002-08-01 Martin Baulig <martin@gnome.org>
13415 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
13416 `is_disposable' fields.
13417 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
13418 `hm.is_disposable' if we're using the collection pattern.
13419 (Foreach.EmitCollectionForeach): Use the correct type for the
13420 enumerator's local variable, only emit the try/finally block if
13421 necessary (fixes #27713).
13423 2002-08-01 Martin Baulig <martin@gnome.org>
13425 * ecore.cs (Expression.report118): Renamed to Error118 and made
13428 * statement.cs (Throw.Resolve): Check whether the expression is of
13429 the correct type (CS0118) and whether the type derives from
13430 System.Exception (CS0155).
13431 (Catch.Resolve): New method. Do the type lookup here and check
13432 whether it derives from System.Exception (CS0155).
13433 (Catch.CatchType, Catch.IsGeneral): New public properties.
13435 * typemanager.cs (TypeManager.exception_type): Added.
13437 2002-07-31 Miguel de Icaza <miguel@ximian.com>
13439 * driver.cs: Updated About function.
13441 2002-07-31 Martin Baulig <martin@gnome.org>
13443 Implemented Control Flow Analysis.
13445 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
13446 (EmitContext.CurrentBranching): Added.
13447 (EmitContext.StartFlowBranching): Added.
13448 (EmitContext.EndFlowBranching): Added.
13449 (EmitContext.KillFlowBranching): Added.
13450 (EmitContext.IsVariableAssigned): Added.
13451 (EmitContext.SetVariableAssigned): Added.
13452 (EmitContext.IsParameterAssigned): Added.
13453 (EmitContext.SetParameterAssigned): Added.
13454 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
13455 Added control flow analysis stuff here.
13457 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
13458 resolve the expression as lvalue.
13459 (LocalVariableReference.DoResolve): Check whether the variable has
13460 already been assigned.
13461 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
13462 the parameter as assigned here.
13463 (ParameterReference.DoResolve): Check whether the parameter has already
13465 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
13466 expression as lvalue.
13468 * statement.cs (FlowBranching): New class for the flow analysis code.
13469 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
13470 (LabeledStatement.IsDefined): New public property.
13471 (LabeledStatement.AddUsageVector): New public method to tell flow
13472 analyis that the label may be reached via a forward jump.
13473 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
13475 (VariableInfo.Number): New public field. This is used by flow analysis
13476 to number all locals of a block.
13477 (Block.CountVariables): New public property. This is the number of
13478 local variables in this block (including the locals from all parent
13480 (Block.EmitMeta): Number all the variables.
13482 * statement.cs: Added flow analysis support to all classes.
13484 2002-07-31 Martin Baulig <martin@gnome.org>
13486 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
13487 To get debugging messages, compile mcs with /define:MCS_DEBUG and
13488 then use this argument.
13490 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
13492 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
13493 use this to specify /define options.
13495 2002-07-29 Martin Baulig <martin@gnome.org>
13497 * statement.cs (Fixed): Moved all code that does variable lookups
13498 and resolvings from Emit to Resolve.
13500 * statement.cs (For): Moved all code that does variable lookups
13501 and resolvings from Emit to Resolve.
13503 * statement.cs (Using): Moved all code that does variable lookups
13504 and resolvings from Emit to Resolve.
13506 2002-07-29 Martin Baulig <martin@gnome.org>
13508 * attribute.cs (Attribute.Resolve): Explicitly catch a
13509 System.NullReferenceException when creating the
13510 CustromAttributeBuilder and report a different warning message.
13512 2002-07-29 Martin Baulig <martin@gnome.org>
13514 * support.cs (ParameterData.ParameterName): Added method to
13515 get the name of a parameter.
13517 * typemanager.cs (TypeManager.IsValueType): New public method.
13519 2002-07-29 Martin Baulig <martin@gnome.org>
13521 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
13522 is a flag which specifies that it's either ref or out.
13523 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
13524 the out parameter to `out Parameter.Modifier mod', also set the
13525 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
13527 * support.cs (InternalParameters.ParameterModifier): Distinguish
13528 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
13529 Parameter.Modifier.ISBYREF flag if it's either ref or out.
13531 * expression.cs (Argument.GetParameterModifier): Distinguish
13532 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
13533 Parameter.Modifier.ISBYREF flag if it's either ref or out.
13535 2002-07-29 Martin Baulig <martin@gnome.org>
13537 * expression.cs (ParameterReference.ParameterReference): Added
13538 `Location loc' argument to the constructor.
13540 * cs-parser.jay: Pass location to ParameterReference.
13542 2002-07-28 Miguel de Icaza <miguel@ximian.com>
13544 * statement.cs (Try): Initialize the location.
13546 * cs-parser.jay: pass location to Try.
13548 * expression.cs (Unary.Reduce): Change the prototype to return
13549 whether a constant fold could be performed or not. The result is
13550 returned in an out parameters. In the case of Indirection and
13551 AddressOf, we want to perform the full tests.
13553 2002-07-26 Miguel de Icaza <miguel@ximian.com>
13555 * statement.cs (Statement.Emit): Flag dead code.
13557 2002-07-27 Andrew Birkett <andy@nobugs.org>
13559 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
13561 2002-07-27 Martin Baulig <martin@gnome.org>
13563 * class.cs (MethodData.Define): Put back call to
13564 TypeManager.AddMethod(), accidentally commented this out.
13566 * report.cs (Debug): New public method to print debugging information,
13567 this is `[Conditional ("DEBUG")]'.
13569 2002-07-26 Martin Baulig <martin@gnome.org>
13571 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
13572 (switch_statement): Push the current_block to the switch_stack and
13573 pop it again when we're done with the switch.
13574 (switch_section): The new block is a child of the current_block.
13575 Fixes bug #24007, added test-152.cs.
13577 2002-07-27 Martin Baulig <martin@gnome.org>
13579 * expression.cs (Invocation.EmitArguments): When calling a varargs
13580 function with only its fixed arguments, we need to pass an empty
13583 2002-07-27 Martin Baulig <martin@gnome.org>
13585 Mono 0.13 has been released.
13587 2002-07-25 Miguel de Icaza <miguel@ximian.com>
13589 * driver.cs: Rename --resource to --linkres, because that is what
13590 we do currently, we dont support --resource yet.
13592 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
13594 2002-07-25 Martin Baulig <martin@gnome.org>
13596 * class.cs (MethodData): New public class. This is a `method builder'
13597 class for a method or one accessor of a Property/Indexer/Event.
13598 (MethodData.GetMethodFlags): Moved here from MemberBase.
13599 (MethodData.ApplyAttributes): Likewise.
13600 (MethodData.ApplyObsoleteAttribute): Likewise.
13601 (MethodData.ApplyConditionalAttribute): Likewise.
13602 (MethodData.ApplyDllImportAttribute): Likewise.
13603 (MethodData.CheckAbstractAndExternal): Likewise.
13604 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
13605 (MethodData.Emit): Formerly known as Method.Emit().
13606 (MemberBase): Moved everything which was specific to a single
13607 accessor/method to MethodData.
13608 (Method): Create a new MethodData and call Define() and Emit() on it.
13609 (Property, Indexer, Event): Create a new MethodData objects for each
13610 accessor and call Define() and Emit() on them.
13612 2002-07-25 Martin Baulig <martin@gnome.org>
13614 Made MethodCore derive from MemberBase to reuse the code from there.
13615 MemberBase now also checks for attributes.
13617 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
13618 (MemberBase.GetMethodFlags): Moved here from class Method and marked
13620 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
13621 `CallingConventions cc' and `Attributes opt_attrs' arguments.
13622 (MemberBase.ApplyAttributes): New virtual method; applies the
13623 attributes to a method or accessor.
13624 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
13625 (MemberBase.ApplyConditionalAttribute): Likewise.
13626 (MemberBase.ApplyDllImportAttribute): Likewise.
13627 (MemberBase.CheckAbstractAndExternal): Likewise.
13628 (MethodCore.ParameterTypes): This is now a property instead of a
13629 method, it's initialized from DoDefineParameters().
13630 (MethodCore.ParameterInfo): Removed the set accessor.
13631 (MethodCore.DoDefineParameters): New protected virtual method to
13632 initialize ParameterTypes and ParameterInfo.
13633 (Method.GetReturnType): We can now simply return the MemberType.
13634 (Method.GetMethodFlags): Override the MemberBase version and add
13635 the conditional flags.
13636 (Method.CheckBase): Moved some code from Define() here, call
13637 DoDefineParameters() here.
13638 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
13639 here to avoid some larger code duplication.
13640 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
13641 ensure that abstract and external accessors don't declare a body.
13643 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
13644 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
13645 lookup in the attribute's parent classes, so we need to abort as soon
13646 as we found the first match.
13647 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
13648 the attribute has no arguments.
13650 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
13653 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13655 * cs-parser.jay: reverted previous patch.
13657 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13659 * cs-parser.jay: fixed bug #22119.
13661 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13663 * attribute.cs: fixed compilation. The error was:
13664 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
13665 be assigned to before control leaves the current method."
13666 [FIXME: Filed as bug #28186: MCS must report this error.]
13668 2002-07-25 Martin Baulig <martin@gnome.org>
13670 * attribute.cs (Attribute.Conditional_GetConditionName): New static
13671 method to pull the condition name ouf of a Conditional attribute.
13672 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
13673 the obsolete message and error flag out of an Obsolete attribute.
13675 * class.cs (Method.GetMethodFlags): New public method to get the
13676 TypeManager.MethodFlags for this method.
13677 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
13679 (Method.Define): Get and apply the Obsolete and Conditional attributes;
13680 if we're overriding a virtual function, set the new private variable
13681 `parent_method'; call the new TypeManager.AddMethod().
13683 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
13684 the MethodBuilder and the Method in a PtrHashtable.
13685 (TypeManager.builder_to_method): Added for this purpose.
13686 (TypeManager.MethodFlags): Added IsObsoleteError.
13687 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
13688 Obsolete and Conditional arguments in MethodBuilders. If we discover
13689 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
13690 the message from the attribute.
13692 2002-07-24 Martin Baulig <martin@gnome.org>
13694 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
13695 preprocessor directives, ensure that the argument to #define/#undef is
13696 exactly one identifier and that it's actually an identifier.
13698 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
13701 2002-07-24 Martin Baulig <martin@gnome.org>
13703 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
13704 initialize it to TypeManager.object_type in the constructor.
13705 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
13706 of the `hm.get_current' method if we're using the collection pattern.
13707 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
13708 for the explicit conversion to make it work when we're using the collection
13709 pattern and the `Current' property has a different return type than `object'.
13712 2002-07-24 Martin Baulig <martin@gnome.org>
13714 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
13715 does not match, but don't report any errors. This method is called in
13716 order for all methods in a MethodGroupExpr until a matching method is
13717 found, so we don't want to bail out if the first method doesn't match.
13718 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
13719 matches, report the 123. Fixes #28070.
13721 2002-07-24 Martin Baulig <martin@gnome.org>
13723 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
13724 TypeManager.TypeToCoreType() to the top of the method so the
13725 following equality checks will work. Fixes #28107.
13727 2002-07-24 Martin Baulig <martin@gnome.org>
13729 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
13730 operand is of type uint, and the other operand is of type sbyte,
13731 short or int, the operands are converted to type long." -
13732 Actually do what this comment already told us. Fixes bug #28106,
13735 2002-07-24 Martin Baulig <martin@gnome.org>
13737 * class.cs (MethodBase): New abstract class. This is now a base
13738 class for Property, Indexer and Event to avoid some code duplication
13739 in their Define() and DefineMethods() methods.
13740 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
13741 generic methods for Define() and DefineMethods().
13742 (FieldBase): Derive from MemberBase, not MemberCore.
13743 (Property): Derive from MemberBase, not MemberCore.
13744 (Property.DefineMethod): Moved all the code from this method to the
13745 new MethodBase.DefineAccessor(), just call it with appropriate
13747 (Property.Define): Call the new Property.DoDefine(), this does some
13748 sanity checks and we don't need to duplicate the code everywhere.
13749 (Event): Derive from MemberBase, not MemberCore.
13750 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
13751 accessors, this will also make them work with interface events.
13752 (Indexer): Derive from MemberBase, not MemberCore.
13753 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
13754 (Indexer.Define): Use the new MethodBase functions.
13756 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
13757 argument to the constructor.
13758 (Interface.FindMembers): Added support for interface events.
13759 (Interface.PopluateEvent): Implemented.
13761 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
13763 2002-07-22 Miguel de Icaza <miguel@ximian.com>
13765 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
13766 but this is required to check for a method name being the same as
13767 the containing class.
13771 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13773 * interface.cs: initialize variable.
13775 2002-07-23 Martin Baulig <martin@gnome.org>
13777 Implemented the IndexerName attribute in interfaces.
13779 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
13780 name if this is an explicit interface implementation.
13781 (Indexer.InterfaceIndexerName): New public variable. If we're
13782 implementing an interface indexer, this is the IndexerName in that
13783 interface. Otherwise, it's the IndexerName.
13784 (Indexer.DefineMethod): If we're implementing interface indexer,
13785 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
13786 and Pending.ImplementIndexer methods.
13787 (Indexer.Define): Also define the PropertyBuilder if we're
13788 implementing an interface indexer and this is neither an explicit
13789 interface implementation nor do the IndexerName match the one in
13792 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
13793 If a method is defined here, then we always need to create a proxy
13794 for it. This is used when implementing interface indexers.
13795 (Pending.IsInterfaceIndexer): New public method.
13796 (Pending.ImplementIndexer): New public method.
13797 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
13798 This is used when implementing interface indexers to define a proxy
13800 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
13801 define a proxy if necessary.
13803 * interface.cs (Interface.IndexerName): New public variable.
13804 (Interface.PopulateIndexer): Set the IndexerName.
13805 (Interface.DefineIndexers): New private method. Populate all the
13806 indexers and make sure their IndexerNames match.
13808 * typemanager.cs (IndexerPropertyName): Added support for interface
13811 2002-07-22 Martin Baulig <martin@gnome.org>
13813 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
13814 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
13815 ret if HasReturnLabel.
13816 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
13819 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
13820 and set the ec.LoopBeginTryCatchLevel.
13821 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
13822 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
13823 the current ec.TryCatchLevel, the branch goes out of an exception
13824 block. In this case, we need to use Leave and not Br.
13826 2002-07-22 Martin Baulig <martin@gnome.org>
13828 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
13829 block unless the block does not always return or it is contained in
13830 another try { ... } catch { ... } block. Fixes bug #26506.
13831 Added verify-1.cs to the test suite.
13833 2002-07-22 Martin Baulig <martin@gnome.org>
13835 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
13836 then we do not always return. Fixes bug #24985.
13838 2002-07-22 Martin Baulig <martin@gnome.org>
13840 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
13841 lookup on a per-class level; ie. walk up the class hierarchy until we
13842 found at least one applicable method, then choose the best among them.
13843 Fixes bug #24463 and test-29.cs.
13845 2002-07-22 Martin Baulig <martin@gnome.org>
13847 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
13848 return types of the methods. The return type is not part of the
13849 signature and we must not check it to make the `new' modifier work.
13850 Fixes bug #27999, also added test-147.cs.
13851 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
13853 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
13854 on the method's return type.
13856 2002-07-21 Martin Baulig <martin@gnome.org>
13858 * assign.cs: Make this work if the rightmost source is a constant and
13859 we need to do an implicit type conversion. Also adding a few more tests
13860 to test-38.cs which should have caught this.
13862 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
13863 target in the makefile for this. The makefile.gnu is primarily intended
13864 for end-users who don't want to debug the compiler.
13866 2002-07-21 Martin Baulig <martin@gnome.org>
13868 * assign.cs: Improved the Assign class so it can now handle embedded
13869 assignments (X = Y = Z = something). As a side-effect this'll now also
13870 consume less local variables. test-38.cs now passes with MCS, added
13871 a few new test cases to that test.
13873 2002-07-20 Martin Baulig <martin@gnome.org>
13875 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
13876 instructions. Fixes bug #27977, also added test-146.cs.
13878 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13880 * cs-tokenizer.cs: fixed getHex ().
13882 2002-07-19 Martin Baulig <martin@gnome.org>
13884 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
13885 not Type.GetType() to lookup the array type. This is needed when
13886 we're constructing an array of a user-defined type.
13887 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
13888 single-dimensional arrays, but also for single-dimensial arrays of
13891 2002-07-19 Martin Baulig <martin@gnome.org>
13893 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
13894 this function is called, it's not allowed to share LocalBuilders
13895 among ILGenerators.
13897 2002-07-19 Martin Baulig <martin@gnome.org>
13899 * expression.cs (Argument.Resolve): Report an error 118 when trying
13900 to pass a type as argument.
13902 2002-07-18 Martin Baulig <martin@gnome.org>
13904 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
13905 Conv_R_Un for the signed `long' type.
13907 2002-07-15 Miguel de Icaza <miguel@ximian.com>
13909 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
13910 `expr' for the temporary result, as that will fail if we do
13911 multiple resolves on the same expression.
13913 2002-07-05 Miguel de Icaza <miguel@ximian.com>
13915 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
13916 ec.TypeContainer for looking up aliases.
13918 * class.cs (TypeContainer): Remove LookupAlias from here.
13920 * decl.cs (DeclSpace); Move here.
13922 2002-07-01 Miguel de Icaza <miguel@ximian.com>
13924 * class.cs (FindMembers): Only call filter if the constructor
13925 bulider is not null.
13927 Also handle delegates in `NestedTypes' now. Now we will perform
13928 type lookups using the standard resolution process. This also
13931 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
13932 This uses Expressions (the limited kind that can be parsed by the
13933 tree) instead of strings.
13935 * expression.cs (ComposedCast.ToString): Implement, used to flag
13936 errors since now we have to render expressions.
13938 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
13941 * ecore.cs (SimpleName.ToString): ditto.
13943 * cs-parser.jay: Instead of using strings to assemble types, use
13944 Expressions to assemble the type (using SimpleName, ComposedCast,
13945 MemberAccess). This should fix the type lookups in declarations,
13946 because we were using a different code path for this.
13948 * statement.cs (Block.Resolve): Continue processing statements
13949 even when there is an error.
13951 2002-07-17 Miguel de Icaza <miguel@ximian.com>
13953 * class.cs (Event.Define): Also remove the `remove' method from
13954 the list of pending items.
13956 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
13957 generate more compact code.
13959 2002-07-17 Martin Baulig <martin@gnome.org>
13961 * const.cs (Const.LookupConstantValue): Add support for constant
13962 `unchecked' and `checked' expressions.
13963 Also adding test case test-140.cs for this.
13965 2002-07-17 Martin Baulig <martin@gnome.org>
13967 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
13968 check whether mi.ReturnType implements the IEnumerator interface; the
13969 `==' and the IsAssignableFrom() will fail in this situation.
13971 2002-07-16 Ravi Pratap <ravi@ximian.com>
13973 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
13976 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13978 * expression.cs: fixed bug #27811.
13980 2002-07-14 Miguel de Icaza <miguel@ximian.com>
13982 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
13983 Molaro: when we are a ref, the value already contains a pointer
13984 value, do not take the address of it.
13986 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
13987 * removed mb-parser.jay and mb-tokenizer.cs
13989 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
13991 * expression.cs: check against the building corlib void type.
13993 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
13995 * ecore.cs: fix for valuetype static readonly fields: when
13996 initializing them, we need their address, not the address of a copy.
13998 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
14000 * typemanager.cs: register also enum_type in corlib.
14002 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
14004 * class.cs: allow calling this (but not base) initializers in structs.
14006 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
14008 * ecore.cs: make sure we compare against the building base types
14011 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
14013 * typemanager.cs: fix TypeToCoreType() to handle void and object
14014 (corlib gets no more typerefs after this change).
14016 2002-07-12 Miguel de Icaza <miguel@ximian.com>
14018 * expression.cs (ArrayCreation.EmitArrayArguments): use
14019 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
14021 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
14022 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
14023 array indexes, the runtime actually forbids them.
14025 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
14026 for array arguments here.
14028 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
14029 instead of the default for ValueTypes.
14031 (New.DoEmit): Use IsValueType instead of
14032 IsSubclassOf (value_type)
14033 (New.DoResolve): ditto.
14034 (Invocation.EmitCall): ditto.
14036 * assign.cs (Assign): ditto.
14038 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
14039 Statements *are* currently doing part of their resolution during
14042 Expressions do always resolve during resolve, but statements are
14043 only required to propagate resolution to their children.
14045 2002-07-11 Miguel de Icaza <miguel@ximian.com>
14047 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
14049 (LoadAssembly): Do not add the dll if it is already specified
14051 (MainDriver): Add the System directory to the link path at the end,
14052 after all the other -L arguments.
14054 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
14055 wrong opcode for loading bytes and bools (ldelem.i1 instead of
14056 ldelem.u1) and using the opposite for sbytes.
14058 This fixes Digger, and we can finally run it.
14060 * driver.cs (UnixParseOption): Move the option parsing here.
14061 (CSCParseOption): Implement CSC-like parsing of options.
14063 We now support both modes of operation, the old Unix way, and the
14064 new CSC-like way. This should help those who wanted to make cross
14065 platform makefiles.
14067 The only thing broken is that /r:, /reference: and /lib: are not
14068 implemented, because I want to make those have the same semantics
14069 as the CSC compiler has, and kill once and for all the confussion
14070 around this. Will be doing this tomorrow.
14072 * statement.cs (Unsafe.Resolve): The state is checked during
14073 resolve, not emit, so we have to set the flags for IsUnsfe here.
14075 2002-07-10 Miguel de Icaza <miguel@ximian.com>
14077 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
14078 not catch the Error_ObjectRefRequired in SimpleName (as it is
14079 possible to have a class/instance variable name that later gets
14080 deambiguated), we have to check this here.
14082 2002-07-10 Ravi Pratap <ravi@ximian.com>
14084 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
14085 make static and put into Expression.
14087 (Event.Define): Register the private field of the event with the
14088 TypeManager so that GetFieldFromEvent can get at it.
14090 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
14091 keep track of the private field associated with an event which
14094 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
14097 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
14099 2002-07-10 Miguel de Icaza <miguel@ximian.com>
14101 * expression.cs (Binary.EmitBranchable): this routine emits the
14102 Binary expression in a branchable context. This basically means:
14103 we need to branch somewhere, not just get the value on the stack.
14105 This works together with Statement.EmitBoolExpression.
14107 * statement.cs (Statement.EmitBoolExpression): Use
14110 2002-07-09 Miguel de Icaza <miguel@ximian.com>
14112 * statement.cs (For): Reduce the number of jumps in loops.
14114 (For): Implement loop inversion for the For statement.
14116 (Break): We can be breaking out of a Try/Catch controlled section
14117 (foreach might have an implicit try/catch clause), so we need to
14118 use Leave instead of Br.
14120 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
14121 now). If the instace expression supports IMemoryLocation, we use
14122 the AddressOf method from the IMemoryLocation to extract the
14123 address instead of emitting the instance.
14125 This showed up with `This', as we were emitting the instance
14126 always (Emit) instead of the Address of This. Particularly
14127 interesting when This is a value type, as we dont want the Emit
14128 effect (which was to load the object).
14130 2002-07-08 Miguel de Icaza <miguel@ximian.com>
14132 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
14134 * statement.cs (Checked): Set the CheckedState during the resolve
14135 process too, as the ConvCast operations track the checked state on
14136 the resolve process, and not emit.
14138 * cs-parser.jay (namespace_member_declaration): Flag that we have
14139 found a declaration when we do. This is used to flag error 1529
14141 * driver.cs: Report ok when we display the help only.
14143 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
14145 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
14147 2002-07-04 Miguel de Icaza <miguel@ximian.com>
14149 * cs-tokenizer.cs (define): We also have to track locally the
14150 defines. AllDefines is just used for the Conditional Attribute,
14151 but we also need the local defines for the current source code.
14153 2002-07-03 Miguel de Icaza <miguel@ximian.com>
14155 * statement.cs (While, For, Do): These loops can exit through a
14156 Break statement, use this information to tell whether the
14157 statement is the last piece of code.
14159 (Break): Flag that we break.
14161 * codegen.cs (EmitContexts): New `Breaks' state variable.
14163 2002-07-03 Martin Baulig <martin@gnome.org>
14165 * class.cs (TypeContainer.MethodModifiersValid): Allow override
14166 modifiers in method declarations in structs. Otherwise, you won't
14167 be able to override things like Object.Equals().
14169 2002-07-02 Miguel de Icaza <miguel@ximian.com>
14171 * class.cs (Method, Property, Indexer): Do not allow the public
14172 modifier to be used in explicit interface implementations.
14174 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
14175 override modifiers in method declarations in structs
14177 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
14179 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
14180 integer or real overflow, report an error
14182 2002-07-02 Martin Baulig <martin@gnome.org>
14184 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
14185 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
14186 to tell the runtime about our newly created System.Object and
14187 System.ValueType types.
14189 2002-07-02 Miguel de Icaza <miguel@ximian.com>
14191 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
14192 struct instead of Ldarg/Starg.
14194 2002-07-02 Martin Baulig <martin@gnome.org>
14196 * expression.cs (Indirection.Indirection): Call
14197 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
14199 2002-07-02 Martin Baulig <martin@gnome.org>
14201 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
14202 ValueType, call TypeManager.TypeToCoreType() on it.
14203 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
14204 the OpCodes.Newarr argument.
14206 2002-07-02 Martin Baulig <martin@gnome.org>
14208 * expression.cs (Invocation.EmitCall): When compiling corlib,
14209 replace all calls to the system's System.Array type to calls to
14210 the newly created one.
14212 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
14213 System.Array methods.
14214 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
14215 from the system's System.Array type which must be replaced.
14217 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
14219 * typemanager.cs: load unverifiable_code_ctor so we can build
14220 corlib using the correct type. Avoid using GetTypeCode() with
14222 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
14223 TypeManager.object_type to allow building corlib.
14225 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
14227 * ecore.cs: handle System.Enum separately in LoadFromPtr().
14229 2002-07-01 Martin Baulig <martin@gnome.org>
14231 * class.cs: Make the last change actually work, we need to check
14232 whether `ifaces != null' to avoid a crash.
14234 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
14236 * class.cs: when we build structs without fields that implement
14237 interfaces, we need to add the interfaces separately, since there is
14238 no API to both set the size and add the interfaces at type creation
14241 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
14243 * expression.cs: the dimension arguments to the array constructors
14244 need to be converted if they are a long.
14246 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
14248 * class.cs: don't emit ldarg.0 if there is no parent constructor
14249 (fixes showstopper for corlib).
14251 2002-06-29 Martin Baulig <martin@gnome.org>
14253 MCS now compiles corlib on GNU/Linux :-)
14255 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
14256 ie. check for MethodImplOptions.InternalCall.
14258 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
14259 and TypeManager.attribute_type are null, so we must explicitly check
14260 whether parent is not null to find out whether it's an attribute type.
14261 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
14262 and SetBuilder, not only if the property is neither abstract nor external.
14263 This is necessary to set the MethodImplOptions on the accessor methods.
14264 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
14265 SetBuilder, see Property.Emit().
14267 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
14268 populate "System.Object", "System.ValueType" and "System.Attribute" since
14269 they've already been populated from BootCorlib_PopulateCoreTypes().
14271 2002-06-29 Martin Baulig <martin@gnome.org>
14273 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
14274 is the NullLiteral, we also need to make sure that target_type is not
14277 2002-06-29 Martin Baulig <martin@gnome.org>
14279 * rootcontext.cs (RootContext.ResolveCore): We must initialize
14280 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
14281 before calling BootstrapCorlib_ResolveDelegate ().
14283 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14285 * statement.cs: fixed build-breaker. All tests passed ok.
14287 2002-06-27 Martin Baulig <martin@gnome.org>
14289 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
14290 for System.Decimal when compiling corlib.
14292 2002-06-27 Martin Baulig <martin@gnome.org>
14294 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
14295 switch blocks which contain nothing but a default clause.
14297 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
14299 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
14301 2002-06-27 Martin Baulig <martin@gnome.org>
14303 * ecore.cs (PropertyExpr.PropertyExpr): Call
14304 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
14306 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
14307 is already a TypeBuilder.
14309 2002-06-27 Martin Baulig <martin@gnome.org>
14311 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
14312 `target_type == TypeManager.array_type', not IsAssignableFrom() in
14313 the "from an array-type to System.Array" case. This makes it work
14314 when compiling corlib.
14316 2002-06-27 Martin Baulig <martin@gnome.org>
14318 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
14319 non-static PropertyExpr, set its InstanceExpression. This makes
14320 the `ICollection.Count' property work in System/Array.cs.
14322 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
14324 * driver.cs: Made error handling more consistent. Errors now
14325 tracked by Report class, so many methods which used to return int
14326 now return void. Main() now prints success/failure and
14327 errors/warnings message.
14329 Renamed '--probe' compiler argument to '--expect-error'. Removed
14330 the magic number return values (123 and 124). Now, if the
14331 expected error occurs, the compiler exits with success (exit value
14332 0). If the compilation completes without seeing that particular
14333 error, the compiler exits with failure (exit value 1). The
14334 makefile in mcs/errors has been changed to handle the new behaviour.
14336 * report.cs: Made 'expected error' number a property and renamed
14337 it from 'Probe' to 'ExpectedError'.
14339 * genericparser.cs: Removed error handling support, since it is
14340 now all done by Report class.
14342 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
14343 class, so parse() no longer returns an int.
14345 * namespace.cs: Use Report.Error instead of GenericParser.error
14347 2002-06-22 Miguel de Icaza <miguel@ximian.com>
14349 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
14350 TypeContainer.AddOperator): At the front of the list put the
14351 explicit implementations, so they get resolved/defined first.
14353 2002-06-21 Miguel de Icaza <miguel@ximian.com>
14355 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
14356 interface type is implemented by this TypeContainer. Used during
14357 explicit interface implementation.
14359 (Property.Define, Indexer.Define, Method.Define): Validate that
14360 the given interface in the explicit implementation is one of the
14361 base classes for the containing type.
14363 Also if we are explicitly implementing an interface, but there is
14364 no match in the pending implementation table, report an error.
14366 (Property.Define): Only define the property if we are
14367 not explicitly implementing a property from an interface. Use the
14368 correct name also for those properties (the same CSC uses,
14369 although that is really not needed).
14371 (Property.Emit): Do not emit attributes for explicitly implemented
14372 properties, as there is no TypeBuilder.
14374 (Indexer.Emit): ditto.
14376 Hiding then means that we do not really *implement* a pending
14377 implementation, which makes code fail.
14379 2002-06-22 Martin Baulig <martin@gnome.org>
14381 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
14382 the return value of Object.GetType(). [FIXME: we need to do this whenever
14383 we get a type back from the reflection library].
14385 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
14387 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
14389 2002-06-20 Miguel de Icaza <miguel@ximian.com>
14391 * attribute.cs: Return null if we can not look up the type.
14393 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
14394 the interface types found.
14396 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
14397 interface types found.
14399 * typemanager.cs (GetInterfaces): Make this routine returns alll
14400 the interfaces and work around the lame differences between
14401 System.Type and System.Reflection.Emit.TypeBuilder in the results
14402 result for GetInterfaces.
14404 (ExpandInterfaces): Given an array of interface types, expand and
14405 eliminate repeated ocurrences of an interface. This expands in
14406 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
14409 2002-06-21 Martin Baulig <martin@gnome.org>
14411 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
14414 2002-06-21 Martin Baulig <martin@gnome.org>
14416 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
14417 and called with one of the core types, return the corresponding typebuilder for
14420 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
14423 2002-06-21 Martin Baulig <martin@gnome.org>
14425 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
14426 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
14427 (Expression.ConvertReferenceExplicit): Likewise.
14429 * expression.cs (ElementAccess.DoResolve): Likewise.
14430 (ElementAccess.DoResolveLValue): Likewise.
14432 2002-06-10 Martin Baulig <martin@gnome.org>
14434 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
14435 add the "value" parameter to the parameter list.
14437 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
14440 2002-06-19 Miguel de Icaza <miguel@ximian.com>
14442 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
14443 the argument to an int, uint, long or ulong, per the spec. Also
14444 catch negative constants in array creation.
14446 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
14448 * class.cs: do not allow the same interface to appear twice in
14449 the definition list.
14451 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
14453 * ecore.cs: don't use ldlen with System.Array.
14455 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
14457 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
14459 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
14461 * modifiers.cs: produce correct field attributes for protected
14462 internal. Easy fix so miguel can work on ther harder stuff:-)
14464 2002-06-18 Miguel de Icaza <miguel@ximian.com>
14466 * pending.cs: New file. Move the code from class.cs here.
14467 Support clearning the pending flag for all methods (when not doing
14468 explicit interface implementation).
14470 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
14472 * rootcontext.cs: added a couple more types needed to bootstrap.
14474 2002-06-17 Miguel de Icaza <miguel@ximian.com>
14476 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
14477 constructor in the type, instead of any constructor in the type
14478 hierarchy. Thanks to Paolo for finding this bug (it showed up as
14479 a bug in the Mono runtime when applying the params attribute).
14481 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
14482 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
14484 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
14486 * expression.cs (Unary.ResolveOperator): Use TypeManager
14487 to resolve the type.
14489 2002-06-13 Ravi Pratap <ravi@ximian.com>
14491 * cs-parser.jay (enum_member_declaration): Pass in the attributes
14494 * enum.cs (AddEnumMember): Add support to store the attributes associated
14495 with each member too.
14497 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
14498 field builders too - this takes care of the enum member case.
14500 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
14502 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
14503 address-of operator on both value types and pointers.
14505 2002-06-10 Martin Baulig <martin@gnome.org>
14507 * interface.cs (Interface.PopulateIndexer): Add the indexer's
14508 PropertyBuilder to the `property_builders' list.
14510 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
14511 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
14512 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
14513 find any indexers which are inherited from an interface.
14515 2002-06-09 Martin Baulig <martin@gnome.org>
14517 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
14518 the same type as the constant if necessary. There's also a test-130.cs
14521 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
14523 * typemanager.cs (TypeManager.ChangeType): Previously known as
14524 Enum.ChangeEnumType().
14526 2002-06-09 Martin Baulig <martin@gnome.org>
14528 * expression.cs (Cast.TryReduce): Added support for consts.
14530 2002-06-08 Ravi Pratap <ravi@ximian.com>
14532 * class.cs (Accessor): Hold attributes information so we can pass
14535 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
14536 Modify to pass in attributes attached to the methods.
14538 (add_accessor_declaration, remove_accessor_declaration): Ditto.
14540 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
14541 to handle the Accessor kind :-)
14543 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
14545 2002-06-08 Martin Baulig <martin@gnome.org>
14547 * expression.cs (Unary.TryReduceNegative): Added support for
14550 2002-06-08 Martin Baulig <martin@gnome.org>
14552 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
14553 name can't be found in the `defined_names' - the caller will do a
14554 MemberLookup in this case and thus find methods in System.Enum
14555 such as Enum.IsDefined().
14557 2002-06-08 Martin Baulig <martin@gnome.org>
14559 * enum.cs (Enum.ChangeEnumType): This is a custom version of
14560 Convert.ChangeType() which works with TypeBuilder created types.
14561 (Enum.LookupEnumValue, Enum.Define): Use it here.
14563 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
14564 `TypeBuilder.BaseType != null' check.
14565 (TypeContainer.FindMembers): Only lookup parent members if we
14566 actually have a parent.
14567 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
14568 (ConstructorInitializer.Resolve): Likewise.
14570 * interface.cs (Interface.FindMembers): Added
14571 `TypeBuilder.BaseType != null' check.
14573 * rootcontext.cs (RootContext.ResolveCore): Added
14574 "System.Runtime.CompilerServices.IndexerNameAttribute" to
14575 classes_second_stage.
14577 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
14578 debug_type and trace_type when compiling with --nostdlib.
14580 2002-06-07 Martin Baulig <martin@gnome.org>
14582 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
14583 (AddField): Set it to true when adding a non-static field.
14584 (DefineType): Use `have_nonstatic_fields' to find out whether we
14585 have non-static fields, not `Fields != null'.
14587 2002-06-02 Miguel de Icaza <miguel@ximian.com>
14589 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
14590 dereferencing a null on the static-field code path)
14592 2002-05-30 Martin Baulig <martin@gnome.org>
14594 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
14595 to take command line arguments. Use reflection to call the new
14596 custom `Initialize' function on the symbol writer and pass it the
14597 command line arguments.
14599 * driver.cs (--debug-args): New command line argument to pass command
14600 line arguments to the symbol writer.
14602 2002-05-28 Miguel de Icaza <miguel@ximian.com>
14604 * assign.cs (DoResolve): Forgot to do the implicit conversion to
14605 the target type for indexers and properties. Thanks to Joe for
14608 2002-05-27 Miguel de Icaza <miguel@ximian.com>
14610 * typemanager.cs (MethodFlags): returns the method flags
14611 (Obsolete/ShouldIgnore) that control warning emission and whether
14612 the invocation should be made, or ignored.
14614 * expression.cs (Invocation.Emit): Remove previous hack, we should
14615 not do this on matching a base type, we should do this based on an attribute
14617 Only emit calls to System.Diagnostics.Debug and
14618 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
14619 on the command line.
14621 * rootcontext.cs: Global settings for tracing and debugging.
14623 * cs-tokenizer.cs (define): New utility function to track
14624 defines. Set the global settings for TRACE and DEBUG if found.
14626 2002-05-25 Ravi Pratap <ravi@ximian.com>
14628 * interface.cs (Populate*): Pass in the TypeContainer as well as
14629 the DeclSpace as parameters so that we can create EmitContexts and
14630 then use that to apply attributes etc.
14632 (PopulateMethod, PopulateEvent, PopulateProperty)
14633 (PopulateIndexer): Apply attributes everywhere.
14635 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
14638 (ApplyAttributes): Update accordingly.
14640 We now apply interface attributes for all members too.
14642 2002-05-26 Miguel de Icaza <miguel@ximian.com>
14644 * class.cs (Indexer.Define); Correctly check if we are explicit
14645 implementation (instead of checking the Name for a ".", we
14646 directly look up if the InterfaceType was specified).
14648 Delay the creation of the PropertyBuilder.
14650 Only create the PropertyBuilder if we are not an explicit
14651 interface implementation. This means that explicit interface
14652 implementation members do not participate in regular function
14653 lookups, and hence fixes another major ambiguity problem in
14654 overload resolution (that was the visible effect).
14656 (DefineMethod): Return whether we are doing an interface
14659 * typemanager.cs: Temporary hack until we get attributes in
14660 interfaces (Ravi is working on that) and we get IndexerName
14661 support in interfaces.
14663 * interface.cs: Register the indexers as properties.
14665 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
14666 warning, I have verified that this is a bug in the .NET runtime
14667 (JavaScript suffers of the same problem).
14669 * typemanager.cs (MemberLookup): When looking up members for
14670 interfaces, the parent of an interface is the implicit
14671 System.Object (so we succeed in searches of Object methods in an
14672 interface method invocation. Example: IEnumerable x; x.ToString
14675 2002-05-25 Miguel de Icaza <miguel@ximian.com>
14677 * class.cs (Event): Events should also register if they do
14678 implement the methods that an interface requires.
14680 * typemanager.cs (MemberLookup); use the new GetInterfaces
14683 (GetInterfaces): The code used to lookup interfaces for a type is
14684 used in more than one place, factor it here.
14686 * driver.cs: Track the errors at the bottom of the file, we kept
14689 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
14690 instance if the method we are calling is static!
14692 2002-05-24 Miguel de Icaza <miguel@ximian.com>
14694 * attribute.cs (ApplyAttributes): Make this function filter out
14695 the IndexerName attribute (as that attribute in reality is never
14696 applied) and return the string constant for the IndexerName
14699 * class.cs (TypeContainer.Emit): Validate that all the indexers
14700 have the same IndexerName attribute, and if so, set the
14701 DefaultName attribute on the class.
14703 * typemanager.cs: The return value might contain other stuff (not
14704 only methods). For instance, consider a method with an "Item"
14705 property and an Item method.
14707 * class.cs: If there is a problem with the parameter types,
14710 2002-05-24 Ravi Pratap <ravi@ximian.com>
14712 * ecore.cs (ImplicitConversionExists): Wrapper function which also
14713 looks at user defined conversion after making a call to
14714 StandardConversionExists - we need this for overload resolution.
14716 * expression.cs : Update accordingly the various method calls.
14718 This fixes 2 bugs filed against implicit user defined conversions
14720 2002-05-22 Miguel de Icaza <miguel@ximian.com>
14722 * statement.cs: Track the result of the assignment.
14724 2002-05-21 Miguel de Icaza <miguel@ximian.com>
14726 * expression.cs (MemberAccess): Improved error reporting for
14727 inaccessible members.
14729 2002-05-22 Martin Baulig <martin@gnome.org>
14731 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
14732 itself with debugging support.
14734 2002-05-22 Martin Baulig <martin@gnome.org>
14736 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
14737 Removed, this isn't needed anymore.
14739 2002-05-20 Martin Baulig <martin@gnome.org>
14741 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
14742 be underlying type for an enum.
14744 2002-05-20 Miguel de Icaza <miguel@ximian.com>
14746 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
14747 that splits out the loading of just the core types.
14749 * rootcontext.cs (ResolveCore): Split the struct resolution in
14750 two, so we can load the enumeration underlying types before any
14753 * expression.cs (Is): Bandaid until we fix properly Switch (see
14754 bug #24985 for details).
14756 * typemanager.cs (ImplementsInterface): The hashtable will contain
14757 a null if there are no interfaces implemented.
14759 2002-05-18 Miguel de Icaza <miguel@ximian.com>
14761 * cs-parser.jay (indexer_declarator): It is fine to have array
14764 2002-05-17 Miguel de Icaza <miguel@ximian.com>
14766 * typemanager.cs: (RegisterBuilder): New function used to register
14767 TypeBuilders that implement interfaces. Since
14768 TypeBuilder.GetInterfaces (as usual) does not work with lame
14770 (AddUserType): register interfaces.
14772 (ImplementsInterface): Use the builder_to_ifaces hash if we are
14773 dealing with TypeBuilder. Also, arrays are showing up as
14774 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
14775 methods can not be invoked on them!
14777 * ecore.cs (ExplicitReferenceConversionExists): Made public.
14778 (ImplicitReferenceConversionExists): Split out from
14779 StandardConversionExists.
14781 * expression.cs (As): We were only implementing one of the three
14782 cases for the as operator. We now implement them all.
14783 (Is): Implement the various other cases for Is as well.
14785 * typemanager.cs (CACHE): New define used to control if we want or
14786 not the FindMembers cache. Seems to have a negative impact on
14787 performance currently
14789 (MemberLookup): Nested types have full acess to
14790 enclosing type members
14792 Remove code that coped with instance/static returns for events, we
14793 now catch this in RealFindMembers.
14795 (RealFindMembers): only perform static lookup if the instance
14796 lookup did not return a type or an event.
14798 2002-05-17 Miguel de Icaza <miguel@ximian.com>
14800 * assign.cs (CompoundAssign): We pass more semantic information
14801 now to Compound Assignments than we did before: now we have all
14802 the information at hand, and now we resolve the target *before* we
14803 do the expression expansion, which allows the "CacheValue" method
14804 to have the effect we intended (before, a [x] += 1 would generate
14805 two differen ArrayAccess expressions from the ElementAccess,
14806 during the resolution process).
14808 (CompoundAssign.DoResolve): Resolve target and original_source here.
14810 2002-05-16 Miguel de Icaza <miguel@ximian.com>
14812 * expression.cs (ArrayAccess): dropped debugging information.
14814 * typemanager.cs: Small bug fix: I was always returning i_members,
14815 instead of one of i_members or s_members (depending on which had
14818 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
14819 method is invoked before any code generation takes place, and it
14820 is a mechanism to inform that the expression will be invoked more
14821 than once, and that the method should use temporary values to
14822 avoid having side effects
14824 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
14826 * ecore.cs (Expression.CacheTemporaries): Provide empty default
14829 * expression.cs (Indirection, ArrayAccess): Add support for
14830 CacheTemporaries in these two bad boys.
14832 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
14833 ldobj or ldind_ref.
14834 (StoreFromPtr): Handle stobj as well.
14836 * expression.cs (UnaryMutator): Share more code.
14838 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
14839 down: I was not tracking the Filter function as well, which
14840 was affecting the results of the cache.
14842 2002-05-15 Miguel de Icaza <miguel@ximian.com>
14844 * attribute.cs: Remove the hack to handle the CharSet property on
14847 2002-05-14 Miguel de Icaza <miguel@ximian.com>
14849 * attribute.cs (DoResolve): More uglyness, we now only try to
14850 resolve the attribute partially, to extract the CharSet
14851 information (only if we are a StructLayout attribute). Otherwise
14853 (GetExtraTypeInfo): Add some code to conditionally kill in the
14854 future this. I am more and more convinced that the .NET
14855 framework has special code to handle the attribute setting on
14858 * expression.cs (IsParamsMethodApplicable): Revert my previous
14859 foreach change here, it was wrong.
14861 2002-05-13 Miguel de Icaza <miguel@ximian.com>
14863 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
14864 (pp_expr): do not abort on unknown input, just return.
14865 (eval): abort if there are pending chars.
14867 * attribute.cs (Attribute.Resolve): Positional parameters are
14868 optional. Deal with that case.
14870 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
14871 the Ansi/Unicode/Auto information for the type.
14873 (TypeContainer.DefineType): instantiate the EmitContext here, as
14874 we will be using it during the type definition (to resolve
14875 attributes) and during the emit phase.
14877 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
14878 to pull type information out of the attributes
14880 (Attribute.Resolve): track the constructor builder, and allow for
14881 multiple invocations (structs and classes will use this).
14883 * ecore.cs (MemberLookupFinal): new version with all the
14884 parameters customizable.
14886 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
14887 constructors. Return if the result value is null (as the error
14888 would have been flagged already by MemberLookupFinal)
14890 Do not allow instances of abstract classes or interfaces to be
14893 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
14894 We have to compare the assembly property here when dealing with
14895 FamANDAssem and Assembly access modifiers, because we might be
14896 creating an assembly from *modules* (that means that we are not
14897 getting TypeBuilders for types defined in other modules that are
14898 part of this assembly).
14900 (Method.Emit): If the method is marked abstract and has a body,
14903 (TypeContainer.DefineMembers): If both the defined member and the
14904 parent name match are methods, then do not emit any warnings: let
14905 the Method.Define routine take care of flagging warnings. But if
14906 there is a mismatch (method overrides something else, or method is
14907 overriwritten by something, then emit warning).
14909 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
14910 set to null, this means `do not check for the return type on the
14913 (Method.Define): set the return type for the method signature to
14914 null, so that we get methods with the same name and parameters and
14915 different return types. This is used to flag warning 114 (you are
14916 hiding a method, and you probably want to use the new/override
14919 * typemanager.cs (MemberLookup): Implemented proper access
14920 control, closing a long standing set of bug reports. The problem
14921 was that the Framework only has two bits: Public and NonPublic,
14922 and NonPublic includes private and protected methods, but we need
14923 to enforce the FamANDAssem, FamOrAssem and Family.
14925 2002-05-11 Miguel de Icaza <miguel@ximian.com>
14927 * statement.cs (GotoCase): Return true: Ammounts to giving up
14928 knowledge on whether we return or not, and letting the other case
14929 be responsible for it.
14931 2002-05-10 Miguel de Icaza <miguel@ximian.com>
14933 * driver.cs: Do not load directories for each file processed, only
14934 do it if there is a pattern.
14936 * ecore.cs: Report readonly assigns here as well, as we might have
14937 been resolved only by MemberAccess.
14939 (SimpleName.SimpleNameResolve): Also be useful for LValue
14940 resolution. We need this to propagate assign to local readonly variables
14942 * typemanager.cs: Use a ptrhashtable for the criteria, because we
14943 do not want to reuse potential criteria memory.
14945 * class.cs (MyEventBuilder): Set reflected_type;
14947 * ecore.cs (Constantify): Added support for constifying bools.
14949 (RootContext.LookupType): Added a cache for values looked up in
14950 the declaration space.
14952 * typemanager.cs (FindMembers): Now is a front-end to
14953 RealFindMembers, and provides a two-level hashtable-based cache to
14956 15% performance improvement: from 22.5 to 19.2 seconds.
14958 * expression.cs (IsParamsMethodApplicable): use foreach.
14959 (Invocation.DoResolve): ditto.
14960 (New.DoResolve): ditto.
14961 (ArrayCreation.DoResolve): ditto.
14963 * ecore.cs (FindMostEncompassingType): use foreach.
14965 * delegate.cs (NewDelegate.DoResolve): Use foreach
14967 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
14968 (RemoveMethods): use foreach.
14970 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
14971 nested foreach statements instead of for, and also break out of
14972 the inner loop once a match is found.
14974 (Invocation.OverloadResolve): Use foreach, simplify the code.
14976 2002-05-08 Miguel de Icaza <miguel@ximian.com>
14978 * cfold.cs (BinaryFold): During an enumeration evaluation context,
14979 we actually unwrap the expression to allow for extra information
14982 * expression.cs: Use Shr_Un on unsigned operations.
14984 2002-05-08 Ravi Pratap <ravi@ximian.com>
14986 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
14987 applicable operators was not being considered correctly. This closes
14988 the bug Miguel reported.
14990 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
14992 * attribute.cs: check that the type derives from System.Attribute
14993 and report the correct error in that case (moved the duplicate code to
14994 its own method, too).
14996 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
14998 * attribute.cs: lookup attribute type name as the spec says: first the
14999 bare attribute name and then name + "Attribute" (nant compiles with
15000 mcs after this fix).
15002 2002-05-07 Miguel de Icaza <miguel@ximian.com>
15004 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
15005 Because of the way we parse things, we should try to see if a
15006 UIntConstant can fit in an integer.
15008 2002-05-07 Ravi Pratap <ravi@ximian.com>
15010 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
15011 when we are in an explicit context.
15013 (ConvertReferenceExplicit): When converting from Iface type S to Class
15014 T make sure the rules are implemented as an OR.
15016 * parameter.cs (ParameterType): Make it a property for now although the
15017 purpose really isn't anything immediate.
15019 * expression.cs (Is*Applicable): Do better checking on the parameter type
15020 of a ref/out parameter. The ones from the system assemblies are already
15021 marked with the correct type so we don't need to do any correction.
15023 * ecore.cs (StandardConversionExists): Conversion from Interface types to
15024 the object type is standard too so include that.
15026 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15028 * ecore.cs (StandardConversionExists): Augment with missing code:
15029 deal with IntConstant, LongConstants and Enumerations.
15031 * assign.cs: Report the error, instead of failing silently
15033 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
15034 typecontainer that they are declared, because the
15035 typecontainer/namespace will have the list of using clauses that
15036 need to be applied.
15038 Assembly Attributes were escaping the normal registration
15041 (EmitCode): Apply attributes within an EmitContext that represents
15042 the container they were declared on.
15044 * cs-parser.jay: Track bases for structs. How did I get this wrong?
15046 2002-05-06 Ravi Pratap <ravi@ximian.com>
15048 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
15049 Revamp completely - make much cleaner as we now operate only
15052 (FindMostSpecificSource, FindMostSpecificTarget): New methods
15053 to implement the logic detailed in the spec more correctly.
15055 (UserDefinedConversion): Update accordingly.
15057 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15059 * statement.cs: Return flow analysis information up.
15061 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
15064 (token): Do not consume an extra character before calling
15067 2002-05-06 Piers Haken <piersh@friskit.com>
15069 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
15071 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15073 * class.cs (Constructor.Emit): Set the IsStatic flag in the
15074 EmitContext during the instance constructor initializer
15075 resolution, to stop access to instance variables.
15077 This is mandated by the spec, last paragraph of the `constructor
15078 initializers' section.
15080 2002-05-05 Miguel de Icaza <miguel@ximian.com>
15082 * cs-parser.jay, class.cs (Accessor): new class used to represent
15083 an accessor (get or set). In the past we used `null' to represent
15084 a missing accessor. But this is ambiguous because there was no
15085 way to tell in abstract indexers/properties if one of them was
15088 Now there is a way of addressing that.
15090 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
15091 instead of FindMembers.
15093 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
15094 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
15096 * attribute.cs: Treat indexers and properties as the same in terms
15097 of applying attributes
15099 * ecore.cs (FindMostEncompassedType): Use statically initialized
15100 EmptyExpressions()s like we do elsewhere to avoid creating useless
15101 objects (and we take this out of the tight loop).
15103 (GetConversionOperators): Move the code to extract the actual
15104 operators to a separate routine to clean things up.
15106 2002-05-04 Miguel de Icaza <miguel@ximian.com>
15108 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
15109 events are always registered FieldBuilders.
15111 * class.cs (FieldBase): New class shared by Fields
15113 * delegate.cs: If we are a toplevel delegate, use our full name.
15114 If we are a nested delegate, then only use our tail name.
15116 2002-05-02 Ravi Pratap <ravi@ximian.com>
15118 * expression.cs (IsApplicable): Ensure that we add the "&" to
15119 ref/out types before comparing it with the type of the argument.
15121 (IsParamsMethodApplicable): Ditto.
15123 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
15126 * delegate.cs : Handle the case when we have more than one applicable
15127 method. Flag an error only when we finish checking all.
15129 2002-05-02 Miguel de Icaza <miguel@ximian.com>
15131 * expression.cs: Add support for boolean static initializers.
15133 2002-05-01 Miguel de Icaza <miguel@ximian.com>
15135 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
15137 * parameter.cs (ComputeParameterTypes,
15138 ComputeAndDefineParameterTypes): Better error handling: now we
15139 clear the `types' cache if we fail during any of the type lookups.
15140 We also return the status code correctly to our caller
15142 * delegate.cs: If we fail to define a delegate, abort the extra
15145 * expression.cs (Binary.ResolveOperator): for
15146 operator==(object,object) and operator !=(object, object) we also
15147 have to verify that there is an implicit conversion from one to
15150 (ArrayAccess.DoResolve): Array Access can operate on
15153 2002-04-30 Miguel de Icaza <miguel@ximian.com>
15155 * assign.cs (CompoundAssign): A new class used as a "flag" that
15156 the assignment actually is happening as part of a compound
15157 assignment operator.
15159 During compound assignment, a few new rules exist to enable things
15166 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
15167 to the type of x) if y is implicitly convertible to the type of x,
15168 and the operator is a builtin operator and the return type of the
15169 operator is explicitly convertible to the type of x.
15171 * rootcontext.cs: Reset warning level to 2. 4 catches various
15172 "interesting" features in mcs, we must clean this up at some
15173 point, but currently am trying to kill other bugs ;-)
15175 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
15176 in container classes as well.
15178 * expression.cs (Binary.ResolveOperator): Handle string case
15179 before anything else (as operator overloading does emit an error
15180 before doing anything else).
15182 This code could go away when we move to a table driven model, but
15183 i could not come up with a good plan last night.
15185 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
15187 * typemanager.cs (CSharpName): reimplementation using regex.
15188 * class.cs: added null check for fields in Emit
15189 * rootcontext.cs: set warninglevel to 4
15191 2002-04-29 Miguel de Icaza <miguel@ximian.com>
15193 * typemanager.cs (CSharpName): reimplemented with Lupus
15196 2002-04-28 Miguel de Icaza <miguel@ximian.com>
15198 * statement.cs (If): correclty implement Resolve, because we were
15199 not catching sem errors in there. The same process is needed
15201 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
15204 (Statement.Warning_DeadCodeFound): Factorize code.
15205 (While): Report dead code here too.
15207 (Statement): Added Resolve virtual method to allow
15208 for resolution split from the emit code.
15210 2002-04-26 Miguel de Icaza <miguel@ximian.com>
15212 * statement.cs (EmitBoolExpression): No longer try to resolve the
15214 (MakeBoolean): New utility function that resolve, implicitly
15215 converts to boolean and tags the expression.
15218 (If, Do): Implement dead code elimination.
15219 (While): Implement loop inversion
15221 (Do, While, For, If): Resolve the expression prior to calling our
15224 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
15227 - added method Report28 (warning: program has more than one entry point)
15228 - added method IsEntryPoint, implements paragraph 10.1 of the spec
15229 - modified method Method.Define, the part at the end of the method
15231 * rootcontext.cs: added static public Location EntryPointLocation;
15233 * ../errors/cs0028.cs : Add test case for the above warning.
15236 - modified method CSharpName to allow arrays of primitive type to
15237 be printed nicely (e.g. instead of System.Int32[][] it now prints
15239 - added method CSharpSignature: returns the signature of a method
15240 in string format to be used in reporting errors, warnings, etc.
15242 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
15245 2002-04-26 Ravi Pratap <ravi@ximian.com>
15247 * delegate.cs (Define): Fix extremely silly bug where I was
15248 setting the type of the 'object' parameter of the BeginInvoke
15249 method to System.IAsyncResult instead of System.Object ;-)
15251 2002-04-26 Miguel de Icaza <miguel@ximian.com>
15253 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
15256 (Constructor.Emit): return if we fail to initialize the
15257 constructor. Another door closed!
15259 * expression.cs (New.DoResolve): Improve error message (from -6 to
15260 1501). Use DeclaredOnly lookup to find the exact constructor.
15262 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
15263 loop. This is useful.
15265 * cs-parser.jay: Adjust the default parameters so that destructors
15266 have the proper signature.
15268 2002-04-26 Martin Baulig <martin@gnome.org>
15270 * driver.cs (LoadAssembly): If `assembly' contains any characters
15271 which are only valid in path names and not in assembly names
15272 (currently slash, backslash and point), use Assembly.LoadFrom ()
15273 instead of Assembly.Load () on the `assembly' (before iteration
15274 over the link_paths).
15276 2002-04-26 Martin Baulig <martin@gnome.org>
15278 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
15280 2002-04-25 Miguel de Icaza <miguel@ximian.com>
15282 * class.cs (Property): use the new typemanager.MemberLookup
15284 (TypeContainer.MemberLookup): Implement using the
15285 TypeManager.MemberLookup now.
15287 * typemanager.cs: Make MemberLookup a function of the TypeManager,
15288 and return MemberInfos, so that these can be used without an
15289 EmitContext (what we had before).
15291 2002-04-24 Miguel de Icaza <miguel@ximian.com>
15293 * expression.cs: Fix the case where the argument to params if the
15294 type of the params. I omitted handling this before. Fixed
15296 2002-04-22 Miguel de Icaza <miguel@ximian.com>
15298 * driver.cs: Call BootCorlib_PopulateCoreType
15300 * class.cs (Property.CheckBase): Check for properties only, not
15303 * interface.cs: Temporary hack: try/catch around the
15304 CustomAttributeBuilder, because I am getting an exception that I
15307 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
15308 types whose definitions are required to be there (attributes are
15309 defined before standard types).
15311 Compute definitions as we boot the various types, as they are used
15312 immediately (value_type class will need object_type, but if we do
15313 not initialize object_type, we will pass a null, which will let
15314 the runtime pick the System.Object from the existing corlib, which
15315 is not what we want).
15317 2002-04-22 Patrik Torstensson <totte@labs2.com>
15319 * cs-tokenizer.cs: fixed a number of trim() issues.
15321 2002-04-22 Ravi Pratap <ravi@ximian.com>
15323 * expression.cs (Argument.Type): Ensure that we return the correct
15324 type when we have out or ref parameters [in which case we
15327 2002-04-22 Miguel de Icaza <miguel@ximian.com>
15329 * class.cs (Property, Indexer): Allow extern modifier in there.
15331 * typemanager.cs (InitBaseTypes): Initializes object_type and
15332 value_type, since those will be used early on during the bootstrap
15333 process to compile corlib.
15335 (InitCoreTypes): Move code from here to InitBaseTypes.
15337 2002-04-21 Miguel de Icaza <miguel@ximian.com>
15339 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
15340 single-dimension arrays as using the ldlen opcode.
15342 Daniel Lewis discovered this optimization.
15344 * typemanager.cs: Add signature for System.Array::get_Length
15346 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15348 * statement.cs: report the error when the foreach does not apply to an
15349 array nor a collection.
15351 2002-04-19 Miguel de Icaza <miguel@ximian.com>
15353 * expression.cs: Add implicit conversions to the operator ~.
15355 * constant.cs (DecimalConstant.Emit): Emit decimal value.
15357 * typemanager.cs: Locate the decimal constructor.
15359 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15361 * attribute.cs: use the new property of TypeOf.
15362 * expression.cs: added 'get' property around typearg.
15364 These changes fix a build breaker reported by NickD. Is this the
15365 correct way to fix? If not, please, revert my changes and make it
15368 2002-04-17 Miguel de Icaza <miguel@ximian.com>
15370 * attribute.cs: Add support for typeof in attribute invocations.
15371 I am not sure that this is right though.
15373 2002-04-14 Duncan Mak <duncan@ximian.com>
15375 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
15376 Binary.Operator.Division case.
15378 2002-04-13 Ravi Pratap <ravi@ximian.com>
15380 * class.cs (DefineType): Ensure that we do a proper check on
15381 attribute types and also register it with the TypeManager.
15383 (TypeContainer.Targets): The default for attribute types is
15384 AttributeTargets.All.
15386 * attribute.cs (ApplyAttributes): Registering the attribute type
15387 is done elsewhere, not when we discover we have a Usage attribute.
15389 2002-04-12 Ravi Pratap <ravi@ximian.com>
15391 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
15392 and get rid of is_delegate parameter.
15394 * everywhere : update.
15396 2002-04-12 Ravi Pratap <ravi@ximian.com>
15398 * cs-parser.jay (compilation_unit): Revamp completely to use
15399 some new ideas that I got from Rhys' grammar to solve the problems
15400 with assembly level attributes.
15402 (outer_declaration): New grammar production.
15404 (attribute_sections): Add.
15406 (opt_attributes): Base on attribute_sections
15408 (namespace_declaration): Allow opt_attributes to tackle the case
15409 when we have assembly level attributes - we are clever in this
15412 * attribute.cs (ApplyAttributes): Do not worry about assembly
15413 attributes in the non-global context.
15415 * rootcontext.cs (AddGlobalAttributes): Go back to using this
15416 instead of SetGlobalAttributes.
15418 * class.cs, rootcontext.cs : Ensure we define and generate
15419 attribute types before anything else.
15421 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
15422 and flag the new error -20 for the case when the attribute type
15423 does not have valid targets specified. csc does not catch this.
15425 * ../errors/errors.txt : update for error # -20
15427 2002-04-11 Ravi Pratap <ravi@ximian.com>
15429 * support.cs (InternalParameters.ParameterModifier): Do some null
15430 checking and return sane values.
15432 * class.cs (Method.Define): If we are a PInvoke method, ensure
15433 that we are static and extern. Report error # 601
15435 * ../errors/cs0601.cs : Add test case for the above error.
15437 2002-04-07 Ravi Pratap <ravi@ximian.com>
15439 * rootcontext.cs (attribute_types): We need to keep type of
15440 all attribute types separately and emit code for them first.
15442 (RegisterAttribute) : Implement.
15444 * class.cs (DefineType): Check if the current Type is a custom
15445 attribute type and register it accordingly.
15447 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
15448 adding the first attribute twice and rename to
15450 (SetGlobalAttributes): this.
15452 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
15455 * attribute.cs (ApplyAttributes): Take an additional argument telling us
15456 if we are processing global arguments. Hmm, I am unsure of this.
15458 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15460 * expression.cs: added static array of strings to avoid calling
15461 Enum.ToString () for Operator in Binary. Significant recover of
15464 2002-04-10 Miguel de Icaza <miguel@ximian.com>
15466 * class.cs (FindMembers): Allow the Builders of the various
15467 members to be null. If they are skip them. This only happens
15468 during the PInvoke declaration.
15470 2002-04-09 Miguel de Icaza <miguel@ximian.com>
15472 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
15473 failure, so we do not keep going afterwards.
15475 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
15476 wanted to pass `false' as the `is_delegate' argument. If this is
15477 the case, why not use delegate_type == null to mean `is_delegate =
15478 false' and anything else as is_delegate = true.
15480 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
15482 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
15483 code for the section, not the beginning of the tests.
15485 2002-04-08 Miguel de Icaza <miguel@ximian.com>
15487 * cfold.cs: Handle operator + (Enum x, Underlying x)
15489 * expression.cs (Binary): same. Warn about errors where we have
15490 Enum/Enum in operator + as well.
15492 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
15495 - added support for switch(bool)
15496 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
15497 - add TableSwitchEmit() to handle table-based switch statements
15499 2002-04-05 Ravi Pratap <ravi@ximian.com>
15501 * expression.cs (Invocation.OverloadResolve): Factor out code which
15502 does parameter compatibility checking with arguments so that we can
15503 re-use the code even from Delegate.VerifyApplicability
15505 (VerifyArgumentsCompat): Move above code here.
15507 * delegate.cs (VerifyApplicability): Get rid of duplicate code
15508 and instead make a call to the above method.
15510 2002-03-31 Ravi Pratap <ravi@ximian.com>
15512 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
15513 We use it to keep track of classes which are attribute types.
15515 2002-04-02 Miguel de Icaza <miguel@ximian.com>
15517 * delegate.cs (Delegate.Define): Correctly define the types in the
15518 presence of fixed and array parameters.
15520 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
15523 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
15524 include NonPublic after the first iteration.
15526 * class.cs (Indexer.CheckBase): Only check if both parents are
15529 * cs-parser.jay (accessor_body): If empty, set to null.
15531 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
15532 same code path here to resolve constants names that we did have in
15533 MemberAccess.DoResolve. There is too much code duplicated here.
15535 2002-04-01 Miguel de Icaza <miguel@ximian.com>
15537 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
15539 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
15542 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
15543 tokens, numbers and strings.
15545 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
15548 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
15549 asyncronous parameters and the regular parameters.
15551 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
15552 specify the target directory.
15554 * expression.cs: (This.DoResolve): Simplify
15555 (As.Emit): Optimize, do not generate IsInst if the expression is
15556 always of the given type.
15558 (Is.DoResolve): Bug fix, we were reporting both always/never for
15561 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
15562 creating too many unnecessary arrays.
15564 2002-03-31 Miguel de Icaza <miguel@ximian.com>
15566 * class.cs (EmitFieldInitializer): Use Assign expression to assign
15567 fields instead of rolling our own initializer. Takes care of all
15568 implicit conversions, and drops unnecessary static checks/argument.
15570 2002-03-31 Dick Porter <dick@ximian.com>
15572 * driver.cs: use the GetDirectories() return values properly, and
15573 use "/" as path separator.
15575 2002-03-30 Miguel de Icaza <miguel@ximian.com>
15577 * expression.cs (Unary): Optimize - - expr into expr.
15578 (Binary): Optimize a + (-b) into a -b.
15580 * codegen.cs (CodeGen): Made all methods static.
15582 2002-03-29 Miguel de Icaza <miguel@ximian.com>
15586 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
15587 TypeBuilder property.
15589 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
15592 * tree.cs: Removed the various RecordXXXX, and replaced with a
15593 single RecordDecl. Removed all the accessor methods, and just
15594 left a single access point Type
15596 * enum.cs: Rename DefineEnum to DefineType.
15598 * decl.cs: New abstract method `DefineType' used to unify the
15599 Defines for Enumerations, Interfaces, TypeContainers and
15602 (FindType): Moved LookupInterfaceOrClass here. Moved the
15603 LookupBaseClasses method that used to live in class.cs and
15604 interface.cs here, and renamed to FindType.
15606 * delegate.cs: Implement DefineType. Take advantage of the
15607 refactored pattern for locating the parent builder without taking
15608 the parent_builder argument (which we know does not work if we are
15609 nested, and triggering a toplevel definition).
15611 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15613 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
15614 accessibility of a member has changed during override and report
15617 * class.cs (Method.Define, Property.Define): Only complain on
15618 overrides if the method is private, any other accessibility is
15619 fine (and since we just checked the permission is the same, we are
15622 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
15623 and elif are processed always. The other pre-processing
15624 directives are only processed if we are "taking" the path
15626 2002-03-29 Martin Baulig <martin@gnome.org>
15628 * class.cs (Method.Emit): Only emit symbolic debugging info if the
15629 current location is not Null.
15631 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
15632 a separate method so we can profile it.
15634 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
15635 `span.Seconds' are just seconds, but no minutes or hours.
15636 (MainDriver): Profile the CodeGen.SaveSymbols calls.
15638 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15640 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
15641 Remove the gratuitous set of Final:
15643 // If an interface implementation, then we can set Final.
15644 if (((flags & MethodAttributes.Abstract) == 0) &&
15645 implementing.DeclaringType.IsInterface)
15646 flags |= MethodAttributes.Final;
15648 I do not know what I was smoking when I used that.
15651 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
15652 step into fixing the name resolution issues for delegates and
15653 unifying the toplevel name resolution.
15655 2002-03-28 Martin Baulig <martin@gnome.org>
15657 * class.cs (Method.Emit): If we have a symbol writer, call its
15658 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
15659 tell it about the current method.
15661 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
15662 writer that we're going to emit the first byte of IL code for a new
15663 statement (a new source line).
15664 (EmitContext.EmitTopBlock): If we have a symbol writer, call
15665 EmitContext.Mark() before emitting any code.
15667 * location.cs (SymbolDocument): Return null when we're Null.
15669 * statement.cs (Statement): Moved the `Location loc' variable here.
15670 (Statement.EmitBoolExpression): If we have a symbol writer, call
15671 ec.Mark() before emitting any code to tell it that we're at the
15672 beginning of a new statement.
15673 (StatementExpression): Added `Location' argument to the constructor.
15674 (Block): Added public readonly variable `StartLocation' and public
15675 variable `EndLocation'. The latter is to be set using SetEndLocation().
15676 (Block): Added constructor which takes a start and end location.
15677 (Block.SetEndLocation): New method. This sets the end location.
15678 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
15679 local variables we create.
15680 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
15681 each statement and do also mark the begin and end of the block.
15683 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
15684 tell it the current lexer.Location, use Location.Null for the end of the
15686 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
15687 current block, set its end location using SetEndLocation().
15688 (statement_expression): StatementExpression constructor now takes the
15689 lexer.Location as additional argument.
15690 (for_statement, declare_local_variables): Likewise.
15691 (declare_local_variables): When creating a new implicit block, use the
15692 new Block constructor and pass it the lexer.Location.
15694 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15696 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
15697 members also on the parent interfaces recursively.
15699 2002-03-27 Miguel de Icaza <miguel@ximian.com>
15701 * report.cs: Use new formats, since Gonzalo finished the missing
15704 * expression.cs (Binary.ResolveOperator): added missing operator|
15705 operator& and operator^ for bool/bool.
15707 * cs-parser.jay: CheckDef now takes a Location argument that is
15708 used to report errors more precisly (instead of reporting the end
15709 of a definition, we try to track something which is a lot closer
15710 to the source of the problem).
15712 * cs-tokenizer.cs: Track global token use, so we can properly flag
15713 the use of #define/#undef after the first token has been seen.
15715 Also, rename the reportXXXX to Error_DescriptiveName
15717 * decl.cs (DeclSpace.IsTopLevel): Move property here from
15718 TypeContainer, so that Enum and Interface can use this too.
15720 * class.cs (TypeContainer.LookupInterfaceOrClass,
15721 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
15722 `builder' argument. Typically this was used to pass the parent
15723 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
15726 The problem is that a nested class could trigger the definition of
15727 a toplevel class, and the builder would be obviously wrong in that
15730 So we drop this argument, and we compute dynamically the
15731 TypeBuilder/ModuleBuilder (the correct information was available
15732 to us anyways from DeclSpace.Parent)
15734 * interface.cs (Interface.DefineInterface): Drop builder
15735 parameter cleanup like class.cs
15737 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
15740 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
15743 (Try.Emit): Propagate the returns value from the statement.
15745 (Return.Emit): Even if we are leavning
15747 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
15749 * modifiers.cs: Fix the computation of MethodAttributes flags.
15751 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
15753 * driver.cs: allow compilation of files that start with '/'.
15754 Add a default case when checking the argument of --target.
15756 2002-03-25 Miguel de Icaza <miguel@ximian.com>
15758 * interface.cs: Implement the same search algorithm for types in
15759 the interface code.
15761 * delegate.cs: Do not allow multiple definition.
15763 * Recovered ChangeLog that got accidentally amputated
15765 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
15767 * rootcontext.cs: Load manually enum to allow core classes to
15768 contain enumerations.
15770 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
15771 Update to new static methods in TypeManager.
15773 * typemanager.cs (GetMethod, GetConstructor): Use our
15774 implementation of FindMembers to find the members, since during
15775 corlib compilation, the types are TypeBuilders and GetMethod and
15776 GetConstructor do not work.
15778 Make all methods in TypeManager static.
15780 (InitCodeHelpers): Split the functionality from
15781 the InitCodeTypes function.
15783 * driver.cs: Call InitCodeHelpers after we have populated the
15786 * cs-parser.jay (delegate_declaration): we did not used to compute
15787 the delegate name correctly for void delegates.
15789 2002-03-24 Miguel de Icaza <miguel@ximian.com>
15791 * rootcontext.cs (RootContext): Init the interface_resolve_order
15792 and type_container_resolve_order always.
15794 (ResolveCore, BootstrapCorlib_ResolveClass,
15795 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
15796 compiler when compiling with --nostdlib
15798 * class.cs (TypeContainer.DefineType): Check that our parent is
15799 not null. This test is most important when we are bootstraping
15802 * codegen.cs: Split out the symbol writing code.
15804 2002-03-25 Martin Baulig <martin@gnome.org>
15806 * driver.cs (-g): Made -g an alias for --debug.
15808 2002-03-24 Martin Baulig <martin@gnome.org>
15810 * codegen.cs (SymbolWriter): New public variable. Returns the
15811 current symbol writer.
15812 (CodeGen): Added `bool want_debugging_support' argument to the
15813 constructor. If true, tell the ModuleBuild that we want debugging
15814 support and ask it for the ISymbolWriter.
15815 (Save): If we have a symbol writer, call it's Close() method after
15816 saving the assembly.
15818 * driver.c (--debug): New command line argument to create a
15819 debugger information file.
15821 * location.cs (SymbolDocument): New public property. Returns an
15822 ISymbolDocumentWriter object for the current source file or null
15823 if we don't have a symbol writer.
15825 2002-03-21 Miguel de Icaza <miguel@ximian.com>
15827 * driver.cs (LoadAssembly): Correctly return when all the paths
15828 have been tried and not before.
15830 * statement.cs (Switch.Emit): return the actual coverage for this
15831 statement (returns/not-returns)
15833 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
15834 switch of the statement if we are the last switch section. That
15835 kills two problems: try/catch problems (we used to emit an empty
15836 nop at the end) and switch statements where all branches would
15839 2002-03-19 Miguel de Icaza <miguel@ximian.com>
15841 * driver.cs: Add default assemblies (the equivalent to the
15842 Microsoft CSC.RSP file)
15844 * cs-tokenizer.cs: When updating `cols and setting it to zero,
15845 also update tokens_seen and set it to false.
15847 * driver.cs: Implement --recurse for Mike.
15849 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
15850 correctly splitting out the paths.
15852 2002-03-18 Miguel de Icaza <miguel@ximian.com>
15854 * interface.cs (Interface.PopulateProperty): Instead of using
15855 `parent' as the declaration space for the set parameters, use
15858 * support.cs (InternalParameters): InternalParameters constructor
15859 takes a DeclSpace instead of a TypeContainer.
15861 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
15862 types are being initialized, load the address of it before calling
15865 (New): Provide a mechanism to disable the generation of local
15866 value type temporaries when the caller will be providing us with
15867 an address to store it.
15869 (ArrayCreation.EmitDynamicInitializers): Use it.
15871 2002-03-17 Miguel de Icaza <miguel@ximian.com>
15873 * expression.cs (Invocation.EmitArguments): Only probe for array
15874 property if there is more than one argument. Sorry about that.
15876 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
15877 empty param arrays.
15879 * class.cs (Method.LabelParameters): Fix incorrect code path that
15880 prevented the `ParamArrayAttribute' from being applied to the
15883 2002-03-16 Miguel de Icaza <miguel@ximian.com>
15885 * support.cs (ReflectionParameters): Correctly compute whether the
15886 last argument is a params array. Fixes the problem with
15889 * typemanager.cs: Make the assemblies array always be non-null
15890 (empty, but non-null)
15892 * tree.cs (RecordDecl): New function that abstracts the recording
15893 of names. This reports error 101, and provides a pointer to the
15894 previous declaration. Fixes a crash in the compiler.
15896 * cs-parser.jay (constructor_declaration): Update to new grammar,
15897 and provide a constructor_body that can be empty.
15899 2002-03-15 Miguel de Icaza <miguel@ximian.com>
15901 * driver.cs: Add support for --resources.
15903 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
15904 Make all types for the various array helper methods be integer.
15906 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
15907 CheckState to ConvCast.
15909 (ConvCast): Now it takes a `checked' state argument, to avoid
15910 depending on the emit context for the conversion, and just using
15911 the resolve time setting.
15913 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
15914 instead of Invocation.EmitArguments. We do not emit the original
15915 arguments, instead we emit those which have been converted to
15916 unsigned int expressions.
15918 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
15920 * codegen.cs: ditto.
15922 * expression.cs (LocalVariableReference): Drop the use of the
15923 Store function that depended on the variable index.
15925 * statement.cs (VariableInfo): Drop the `Idx' property from this
15926 class, as this is not taking into account the indexes for
15927 temporaries tat we generate during the execution, getting the
15930 * class.cs: First emit class initializers, then call the parent
15933 * expression.cs (Binary): Fix opcode emision.
15934 (UnaryMutator.EmitCode): Support checked code generation
15936 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
15937 matches for events for both the Static and Instance scans,
15938 pointing to the same element. Fix that.
15940 2002-03-14 Miguel de Icaza <miguel@ximian.com>
15942 * rootcontext.cs (ResolveTree): Always set the
15943 interface_resolve_order, because nested interfaces will be calling
15946 * class.cs (GetInterfaceOrClass): Track the same resolution
15947 process used by TypeManager.LookupType. This fixes the nested
15948 type lookups in class declarations (separate path from
15951 (TypeContainer.DefineType): Also define nested interfaces.
15952 (TypeContainer.RegisterOrder): New public function used to
15953 register the order in which child interfaces need to be closed.
15955 Nested interfaces need to be closed after their parents have been
15958 * interface.cs (InterfaceAttr): Put all the logic for computing
15959 the interface attribute here.
15961 (DefineInterface): Register our interface order with the
15962 RootContext or with the TypeContainer depending on the case.
15964 2002-03-12 Miguel de Icaza <miguel@ximian.com>
15966 * cs-parser.jay: rework foreach statement to work with the new
15967 changes to the policy on SimpleNames.
15969 * report.cs: support Stacktrace on warnings as well.
15971 * makefile: drop --unsafe and /unsafe from the compile.
15973 2002-03-13 Ravi Pratap <ravi@ximian.com>
15975 * ecore.cs (StandardConversionExists): Modify to take an Expression
15976 as the first parameter. Ensure we do null -> reference type conversion
15979 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
15980 temporary Expression objects.
15982 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
15984 * interface.cs: workaround bug in method overloading resolution
15985 (there is already a bugzilla bug for it).
15987 2002-03-12 Miguel de Icaza <miguel@ximian.com>
15989 We could also solve this problem by having a separate path for
15990 performing type lookups, instead of DoResolve, we could have a
15991 ResolveType entry point, and only participating pieces of the
15992 production (simplename, deref, array) would implement this.
15994 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
15995 signal SimpleName to only resolve type names and not attempt to
15996 resolve anything else.
15998 * expression.cs (Cast): Set the flag.
16000 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
16002 * class.cs: Only report 108 if there is no `new' modifier.
16004 * cs-parser.jay: rework foreach statement to work with the new
16005 changes to the policy on SimpleNames.
16007 * report.cs: support Stacktrace on warnings as well.
16009 * makefile: drop --unsafe and /unsafe from the compile.
16011 2002-03-11 Miguel de Icaza <miguel@ximian.com>
16013 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
16014 lookups here, instead of doing that at parse time. This means
16015 that our grammar will not introduce `LocalVariableReferences' as
16016 expressions at this point. That solves the problem of code like
16020 static void Main ()
16024 This is only half the fix. The full fix requires parameters to
16025 also be handled in this way.
16027 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
16028 makes the use more obvious of the DeclSpace. The
16029 ec.TypeContainer.TypeBuilder is now only used to pull the
16030 TypeBuilder for it.
16032 My theory is that I can get rid of the TypeBuilder completely from
16033 the EmitContext, and have typecasts where it is used (from
16034 DeclSpace to where it matters).
16036 The only pending problem is that the code that implements Aliases
16037 is on TypeContainer, and probably should go in DeclSpace.
16039 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
16040 lookups here, instead of doing that at parse time. This means
16041 that our grammar will not introduce `LocalVariableReferences' as
16042 expressions at this point. That solves the problem of code like
16046 static void Main ()
16050 This is only half the fix. The full fix requires parameters to
16051 also be handled in this way.
16053 * class.cs (Property.DefineMethod): When implementing an interface
16054 method, set newslot, when implementing an abstract method, do not
16055 set the flag (before we tried never setting it, or always setting
16056 it, which is the difference).
16057 (Indexer.DefineMethod): same.
16058 (Method.DefineMethod): same.
16060 * ecore.cs: Only set the status used flag if we get back a Field.
16062 * attribute.cs: Temporary hack, so Paolo can keep working.
16064 2002-03-08 Ravi Pratap <ravi@ximian.com>
16066 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
16067 the unmanaged type in the case we have a MarshalAs attribute.
16069 (Resolve): Handle the case when we are parsing the special MarshalAs
16070 attribute [we need to store the unmanaged type to use later]
16072 * typemanager.cs (marshal_as_attr_type): Built in type for the
16073 MarshalAs Attribute.
16075 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
16076 on parameters and accordingly set the marshalling info.
16078 2002-03-09 Miguel de Icaza <miguel@ximian.com>
16080 * class.cs: Optimizing slightly by removing redundant code after
16081 we switched to the `NoTypes' return value.
16082 (Property.DefineMethod): use NoTypes here too.
16084 This fixes the bug I introduced in my last batch of changes.
16086 2002-03-05 Ravi Pratap <ravi@ximian.com>
16088 * tree.cs (RecordEnum): Add. We now keep track of enums too.
16090 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
16091 Enums since those are types too.
16093 * cs-parser.jay (enum_declaration): Record enums as we parse them.
16095 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
16096 thanks to a call during the lookup process.
16098 2002-03-07 Miguel de Icaza <miguel@ximian.com>
16100 * statement.cs (Foreach): Lots of work to accomodate a particular
16101 kind of foreach statement that I had not kept in mind. It is
16102 possible to have foreachs on classes that provide a GetEnumerator
16103 method that return objects that implement the "pattern" for using
16104 a foreach, there is no need to support GetEnumerator
16107 This is needed to compile nant.
16109 * decl.cs: Only report 114 if the member is not `Finalize' and if
16110 the warning level is at least 2.
16112 * class.cs: Moved the compare function from Method to
16115 (MethodSignature.InheritableMemberSignatureCompare): Add new
16116 filter function that is used to extract inheritable methods from a
16119 (Method.Define): Use the new `inheritable_method_signature_filter'
16122 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
16125 2002-03-06 Miguel de Icaza <miguel@ximian.com>
16127 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
16129 * cs-parser.jay: Add opt_semicolon to the interface declaration.
16131 * expression.cs: Pass location information to
16132 ConvertImplicitStandard.
16134 * class.cs: Added debugging code to track return values from
16137 2002-03-05 Miguel de Icaza <miguel@ximian.com>
16139 * expression.cs (Is.DoResolve): If either side of the `is' is an
16140 interface, do not flag the warning.
16142 * ecore.cs (ImplicitReferenceConversion): We need a separate test
16145 * report.cs: Allow for --fatal to be used with --probe.
16147 * typemanager.cs (NoTypes): Move the definition for the empty Type
16150 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
16152 (TypeContainer.DefineProxy): New function used to proxy to parent
16153 implementations when implementing interfaces.
16154 (TypeContainer.ParentImplements): used to lookup if our parent
16155 implements a public function that is required by an interface.
16156 (TypeContainer.VerifyPendingMethods): Hook this up.
16158 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
16159 `modules' and `assemblies' arraylists into arrays. We only grow
16160 these are the very early start up of the program, so this improves
16161 the speedof LookupType (nicely measured).
16163 * expression.cs (MakeByteBlob): Replaced unsafe code with
16164 BitConverter, as suggested by Paolo.
16166 * cfold.cs (ConstantFold.Binary): Special case: perform constant
16167 folding of string concatenation, but if either side is a string,
16168 and the other is not, then return null, and let the runtime use
16169 the concatenation on the string plus the object (using
16170 `Object.ToString').
16172 2002-03-04 Miguel de Icaza <miguel@ximian.com>
16174 Constant Folding has been implemented now.
16176 * expression.cs (Unary.Reduce): Do not throw an exception, catch
16177 the error instead on types that are not supported in one's
16180 * constant.cs (Constant and all children): New set of functions to
16181 perform implict and explicit conversions.
16183 * ecore.cs (EnumConstant): Implement the new functions to perform
16184 conversion by proxying to the child expression.
16186 * codegen.cs: (ConstantCheckState): Constant evaluation has its
16187 own separate setting that can not be turned off from the command
16188 line using --unchecked or --checked and is only controlled using
16189 the checked/unchecked statements and expressions. This setting is
16190 used by the constant folder to flag errors.
16192 * expression.cs (CheckedExpr, UncheckedExpr): Set the
16193 ConstantCheckState as well.
16195 During Resolve, they also have to flag the state, because the
16196 constant folder runs completely in the Resolve phase.
16198 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
16201 2002-03-01 Miguel de Icaza <miguel@ximian.com>
16203 * cfold.cs: New file, this file contains the constant folder.
16205 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
16206 argument to track whether we are using the resulting address to
16207 load or store a value and provide better error messages.
16209 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
16210 new AddressOf arguments.
16212 * statement.cs (Foreach.EmitCollectionForeach): Update
16214 * expression.cs (Argument.Emit): Call AddressOf with proper
16215 arguments to track usage.
16217 (New.DoEmit): Call AddressOf with new arguments.
16219 (Unary.Emit): Adjust AddressOf call.
16221 2002-03-01 Ravi Pratap <ravi@ximian.com>
16223 * cs-parser.jay (member_access): Change the case for pre-defined types
16224 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
16227 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
16230 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
16231 essentially like methods and apply attributes like MethodImplOptions to them too.
16233 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
16236 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
16237 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
16240 * Update code everywhere accordingly.
16242 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
16244 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
16246 2002-02-28 Ravi Pratap <ravi@ximian.com>
16248 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
16249 try performing lookups against those instead of jumping straight into using
16250 the 'using' clauses.
16252 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
16254 (LookupType): Perform lookups in implicit parents too.
16256 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
16257 sequence as RootContext.LookupType.
16259 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
16260 the various cases of namespace lookups into this method.
16262 2002-03-01 Miguel de Icaza <miguel@ximian.com>
16264 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
16265 in positional arguments)
16267 * class.cs (Operator): Update the AllowedModifiers to contain
16270 * cs-parser.jay: Update operator declaration to allow for the
16271 operator body to be empty.
16273 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
16276 2002-02-27 Miguel de Icaza <miguel@ximian.com>
16278 * class.cs (Method.Emit): Label parameters.
16280 * driver.cs: Return 1 or 0 as the program exit code.
16282 2002-02-26 Miguel de Icaza <miguel@ximian.com>
16284 * expression.cs: Special case the `null' object when trying to
16285 auto-compute the type, as anything can be explicitly converted to
16288 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
16289 spotting this Paolo.
16291 (Expression.ImplicitNumericConversion): Perform comparissions of
16292 the type using the underlying type in the case of an enumeration
16293 rather than using the enumeration type for the compare.
16295 Cope with the underlying == type case, which is not possible to
16298 (Expression.ConvertNumericExplicit): Perform comparissions of
16299 the type using the underlying type in the case of an enumeration
16300 rather than using the enumeration type for the compare.
16302 * driver.cs: If the user does not supply an extension, assume .exe
16304 * cs-parser.jay (if_statement): Rewrote so that we can track the
16305 location for the if statement.
16307 * expression.cs (Binary.ConstantFold): Only concat strings when
16308 the operation is "+", not everything ;-)
16310 * statement.cs (Statement.EmitBoolExpression): Take a location
16312 (If, While, Do): Track location.
16314 * expression.cs (Binary.ResolveOperator): In the object + string
16315 case, I was missing a call to ConvertImplicit
16317 2002-02-25 Ravi Pratap <ravi@ximian.com>
16319 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
16320 Location arguments. Ensure we use RootContext.LookupType to do our work
16321 and not try to do a direct Type.GetType and ModuleBuilder.GetType
16323 * interface.cs (PopulateMethod): Handle the type of the parameter being
16326 * expression.cs (Invocation.BetterFunction): Handle the case when we
16327 have a params method with no fixed arguments and a call is made with no
16330 2002-02-25 Miguel de Icaza <miguel@ximian.com>
16332 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
16333 the verbatim-string-literal
16335 * support.cs (InternalParameters.ParameterModifier): handle null
16337 (InternalParameters.ParameterType): ditto.
16339 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
16340 duplicating the name of the variable parameter.
16341 (GetParameterByName): Fix bug where we were not looking up array
16342 paramters if they were the only present (thanks Paolo!).
16343 (GetParameterInfo): We only have an empty set of types if both
16344 fixed and array are set to null.
16345 (GetParameterInfo-idx): Handle FixedParameter == null
16347 * cs-parser.jay: Handle the case where there is no catch
16348 statements (missing null test).
16350 2002-02-22 Miguel de Icaza <miguel@ximian.com>
16352 * driver.cs (MainDriver): Be conservative on our command line
16355 Catch DirectoryNotFoundException when calling GetFiles.
16357 (SplitPathAndPattern): Used to split the input specification into
16358 a path and a pattern that we can feed to Directory.GetFiles.
16360 2002-02-21 Miguel de Icaza <miguel@ximian.com>
16362 * statement.cs (Fixed): Implement the last case of the Fixed
16363 statement (string handling).
16365 * expression.cs (StringPtr): New class used to return a char * to
16366 a string; Used by the Fixed statement.
16368 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
16370 * expression.cs (Binary.ResolveOperator): Remove redundant
16371 MemberLookup pn parent type.
16372 Optimize union call, we do not need a union if the types are the same.
16373 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
16376 Specialize the use of MemberLookup everywhere, instead of using
16377 the default settings.
16379 (StackAlloc): Implement stackalloc keyword.
16381 * cs-parser.jay: Add rule to parse stackalloc.
16383 * driver.cs: Handle /h, /help, /?
16385 * expression.cs (MakeByteBlob): Removed the hacks we had in place
16386 before we supported unsafe code.
16388 * makefile: add --unsafe to the self compilation of mcs.
16390 2002-02-20 Miguel de Icaza <miguel@ximian.com>
16392 * expression.cs (PointerArithmetic): New class that is used to
16393 perform pointer arithmetic.
16394 (Binary.Resolve): Handle pointer arithmetic
16395 Handle pointer comparission.
16396 (ArrayPtr): Utility expression class that is used to take the
16397 address of an array.
16399 (ElementAccess): Implement array access for pointers
16401 * statement.cs (Fixed): Implement fixed statement for arrays, we
16402 are missing one more case before we are done.
16404 * expression.cs (Indirection): Implement EmitAssign and set the
16405 ExprClass to Variable. This allows pointer dereferences to be
16406 treated as variables, and to have values assigned to them.
16408 * ecore.cs (Expression.StoreFromPtr): New utility function to
16409 store values dereferencing.
16411 2002-02-20 Ravi Pratap <ravi@ximian.com>
16413 * expression.cs (Binary.ResolveOperator): Ensure that we are
16414 not trying to operate on a void type - this fixes the reported
16417 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
16418 the parent implementation is sealed.
16420 * ../errors/cs0239.cs : Add.
16422 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
16424 * typemanager.cs (unverifiable_code_type): Corresponds to
16425 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
16426 which have unsafe code in them.
16428 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
16431 2002-02-19 Miguel de Icaza <miguel@ximian.com>
16433 * cs-tokenizer.cs: Add support for @"litreal strings"
16435 Make tokenizer accept pre-processor directives
16436 on any column (remove the old C-like limitation).
16438 * rootcontext.cs (EmitCode): Emit any global attributes.
16439 (AddGlobalAttributes): Used to keep track of assembly attributes.
16441 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
16443 * cs-parser.jay: Add support for global attributes.
16445 2002-02-17 Miguel de Icaza <miguel@ximian.com>
16447 * expression.cs (Indirection): New helper class. Unary will
16448 create Indirection classes to be able to implement the
16449 IMemoryLocation interface on it.
16451 2002-02-16 Miguel de Icaza <miguel@ximian.com>
16453 * cs-parser.jay (fixed_statement): reference the right statement.
16455 * statement.cs (Fixed.Emit): Finish implementing the fixed
16456 statement for the &x case.
16458 2002-02-14 Miguel de Icaza <miguel@ximian.com>
16460 * class.cs (Property.Define, Method.Define): Remove newslot when
16463 * modifiers.cs: My use of NewSlot when `Abstract' was set was
16464 wrong. NewSlot should only be used if the `new' keyword is present.
16466 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
16467 locating our system dir. Sorry about this.
16469 2002-02-13 Miguel de Icaza <miguel@ximian.com>
16471 * driver.cs (GetSystemDir): Compute correctly the location of our
16472 system assemblies. I was using the compiler directory instead of
16473 the library directory.
16475 2002-02-13 Ravi Pratap <ravi@ximian.com>
16477 * expression.cs (BetterFunction): Put back in what Miguel commented out
16478 since it is the correct fix. The problem is elsewhere ;-)
16480 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
16481 parameters of the parms method are themselves compatible or not !
16483 (StandardConversionExists): Fix very dangerous bug where we were forgetting
16484 to check that a class implements an interface before saying that an implicit
16485 conversion was allowed. Use ImplementsInterface to do the checking.
16487 2002-02-13 Miguel de Icaza <miguel@ximian.com>
16489 * class.cs (Method.Define): Track whether we are an explicit
16490 implementation or not. And only call DefineMethodOverride if we
16491 are an explicit implementation.
16493 (Property.DefineMethod): Ditto.
16495 2002-02-11 Ravi Pratap <ravi@ximian.com>
16497 * expression.cs (BetterFunction): Catch hideous bug which was
16498 preventing us from detecting ambiguous calls due to implicit casts i.e
16501 2002-01-29 Miguel de Icaza <miguel@ximian.com>
16503 * support.cs (Pair): Remove un-needed method. I figured why I was
16504 getting the error in cs-parser.jay, the variable in a foreach loop
16505 is readonly, and the compiler does not really treat this as a variable.
16507 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
16508 instead of EQUALS in grammar.
16510 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
16512 * expression.cs (Unary.DoResolve): Check whether the argument is
16515 2002-01-28 Miguel de Icaza <miguel@ximian.com>
16517 * support.cs: Api for Pair to set a value. Despite the fact that
16518 the variables are public the MS C# compiler refuses to compile
16519 code that accesses the field if the variable is part of a foreach
16522 * statement.cs (Fixed): Begin implementation of the fixed
16525 (Block.AddVariable): Return the VariableInfo on success and null
16526 on failure instead of true/false.
16528 * cs-parser.jay (foreach): Catch errors on variables already
16529 defined (we were ignoring this value before) and properly unwind
16530 the block hierarchy
16532 (fixed_statement): grammar for the fixed statement.
16534 2002-01-25 Miguel de Icaza <miguel@ximian.com>
16536 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
16537 pointer types to be incretemented.
16539 (SizeOf): Implement.
16541 * cs-parser.jay (pointer_member_access): Implement
16542 expr->IDENTIFIER production.
16544 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
16545 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
16548 (Unary): Implement indirection.
16550 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
16551 use in non-unsafe context).
16553 (SimpleName.DoResolve): Check for pointers in field access on safe
16556 (Expression.LoadFromPtr): Factor the load-indirect code in this
16557 function. This was duplicated in UnboxCast and ParameterReference
16559 2002-01-24 Miguel de Icaza <miguel@ximian.com>
16561 * expression.cs (ComposedCast): report an error if a pointer cast
16562 is used in a safe region.
16564 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
16565 pointer type casts in unsafe context.
16567 * codegen.cs (EmitContext): Set up IsUnsafe.
16569 * cs-parser.jay (non_expression_type): Add productions for pointer
16572 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
16573 code. We should not use force into static mode if the method is
16574 not virtual. Fixes bug in MIS
16576 * statement.cs (Do.Emit, While.Emit, For.Emit,
16577 Statement.EmitBoolExpression): Add support to Do and While to
16578 propagate infinite loop as `I do return' semantics.
16580 Improve the For case to also test for boolean constants.
16582 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
16583 to the list of attributes we can add.
16585 Remove `EmitContext' argument.
16587 * class.cs (Method.Define): Apply parameter attributes.
16588 (Constructor.Define): Apply parameter attributes.
16589 (MethodCore.LabelParameters): Move here the core of labeling
16592 * support.cs (ReflectionParameters.ParameterModifier,
16593 InternalParameters.ParameterModifier): Use IsByRef on the type and
16594 only return the OUT bit for these parameters instead of in/out/ref
16597 This is because I miss-understood things. The ParameterInfo.IsIn
16598 and IsOut represent whether the parameter has the [In] and [Out]
16601 2002-01-22 Miguel de Icaza <miguel@ximian.com>
16603 * ecore.cs (FieldExpr.Emit): Release temporaries.
16605 * assign.cs (LocalTemporary.Release): new function.
16607 * codegen.cs (EmitContext.GetTemporaryStorage,
16608 EmitContext.FreeTemporaryStorage): Rework the way we deal with
16609 temporary storage. Now we can "put back" localbuilders when we
16612 2002-01-21 Miguel de Icaza <miguel@ximian.com>
16614 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
16615 need to make a copy of the variable to generate verifiable code.
16617 2002-01-19 Miguel de Icaza <miguel@ximian.com>
16619 * driver.cs: Compute dynamically the system directory.
16621 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
16622 Slower, but more generally useful. Used by the abstract
16623 registering implementation.
16625 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
16626 the rules for the special rule on Type/instances. First check if
16627 we have the same name, and if so, try that special static path
16628 rather than the instance path.
16630 2002-01-18 Miguel de Icaza <miguel@ximian.com>
16632 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
16635 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
16636 Enum, ValueType, Delegate or Array for non-corlib compiles.
16638 * cs-tokenizer.cs: Catch long identifiers (645)
16640 * typemanager.cs (IndexerPropetyName): Ravi never tested this
16643 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
16644 fix, we were returning too early, so we were not registering
16645 pending methods from abstract classes.
16647 Do not register pending methods if the class is abstract.
16649 * expression.cs (Conditional.DoResolve): Report circular implicit
16650 conversions when we neecd to compute it for conditional
16653 (Is.DoResolve): If the expression is always of the provided type,
16654 flag warning 183. If the expression can not ever be of the
16655 provided type flag warning 184.
16657 * class.cs: Catch 169 as well.
16659 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
16662 2002-01-18 Nick Drochak <ndrochak@gol.com>
16664 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
16666 2002-01-17 Miguel de Icaza <miguel@ximian.com>
16668 * interface.cs: (PopulateMethod): Check for pointers being defined
16669 only if the unsafe context is active.
16670 (PopulateProperty): ditto.
16671 (PopulateIndexer): ditto.
16673 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
16674 specified. If pointers are present, make sure that they are
16675 present in an unsafe context.
16676 (Constructor, Constructor.Define): ditto.
16677 (Field, Field.Define): ditto.
16678 (Property, Property.Define): ditto.
16679 (Event, Event.Define): ditto.
16681 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
16682 hashtable if there are classes or structs defined.
16684 * expression.cs (LocalVariableReference.DoResolve): Simplify this
16685 code, as the constant resolution moved.
16687 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
16688 the metadata, so we can flag error 133.
16690 * decl.cs (MemberCore.UnsafeOK): New function to test that a
16691 pointer is being declared in an unsafe context.
16693 2002-01-16 Miguel de Icaza <miguel@ximian.com>
16695 * modifiers.cs (Modifiers.Check): Require a Location argument.
16696 Report error 227 for Unsafe use.
16698 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
16700 * statement.cs (For.Emit): If the test is null, then report that
16701 we do `return', as we wont reach anything afterwards.
16703 (Switch.SwitchGoverningType): Track the expression that matched
16706 * driver.cs: Allow negative numbers as an error code to flag.
16708 * cs-parser.jay: Handle 1551.
16710 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
16712 2002-01-15 Miguel de Icaza <miguel@ximian.com>
16714 * cs-parser.jay: Report 1518 (type declaration can only contain
16715 class, struct, interface, enum or delegate)
16717 (switch_label): Report 1523 (keywords `case' or `default' must
16720 (opt_switch_sections): Report 1522 (empty switch)
16722 * driver.cs: Report 1515 (response file specified multiple times)
16723 Report 1516 (Source file specified multiple times).
16725 * expression.cs (Argument.Resolve): Signal 1510
16727 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
16728 access not allowed in static code)
16730 2002-01-11 Ravi Pratap <ravi@ximian.com>
16732 * typemanager.cs (IsPointerType): Utility method which we are going
16735 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
16736 the object type, so we take care of that.
16738 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
16740 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
16741 added to non-params parameters :-)
16743 * typemanager.cs (CSharpName): Include 'void' type too.
16745 (void_ptr_type): Include in the set of core types.
16747 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
16750 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
16753 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
16754 completely forgotten about it.
16756 2002-01-10 Ravi Pratap <ravi@ximian.com>
16758 * cs-parser.jay (pointer_type): Add. This begins our implementation
16759 of parsing rules for unsafe code.
16761 (unsafe_statement): Implement.
16763 (embedded_statement): Modify to include the above.
16765 * statement.cs (Unsafe): Implement new class for unsafe blocks.
16767 * codegen.cs (EmitContext.InUnsafe): Add. This determines
16768 if the current context is an unsafe one.
16770 * cs-parser.jay (local_variable_pointer_type): Since local variable types
16771 are handled differently, we need separate rules for them.
16773 (local_variable_declaration): Update to use local_variable_pointer_type
16774 to allow variable declarations of unmanaged pointer types.
16776 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
16777 in unsafe contexts.
16779 * ../errors/cs0214.cs : Add.
16781 2002-01-16 Nick Drochak <ndrochak@gol.com>
16783 * makefile: remove 'response' file when cleaning.
16785 2002-01-15 Miguel de Icaza <miguel@ximian.com>
16787 * cs-parser.jay: Report 1524.
16789 2002-01-14 Miguel de Icaza <miguel@ximian.com>
16791 * typemanager.cs (RegisterMethod): drop checking if we have
16792 registered this from here
16794 2002-01-12 Miguel de Icaza <miguel@ximian.com>
16796 * class.cs (Method.EmitDestructor): Implement calling our base
16799 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
16800 value of InFinally.
16802 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
16803 this routine and will wrap the call in a try/catch block. Deal
16806 2002-01-11 Miguel de Icaza <miguel@ximian.com>
16808 * ecore.cs (Expression.MemberLookup): instead of taking a
16809 parameter `same_type' that was used to tell whether we could
16810 access private members we compute our containing type from the
16813 (FieldExpr): Added partial support for volatile fields. This does
16814 not work for volatile fields exposed from assemblies, as I can not
16815 figure out how to extract the modreq from it.
16817 Updated all the source files to use this.
16819 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
16820 because it is referenced by MemberLookup very often.
16822 2002-01-09 Ravi Pratap <ravi@ximian.com>
16824 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
16825 TypeBuilder.GetCustomAttributes to retrieve what we need.
16827 Get rid of redundant default_member_attr_type as this is the same as
16828 default_member_type which already exists.
16830 * interface.cs, attribute.cs : Update accordingly.
16832 2002-01-08 Miguel de Icaza <miguel@ximian.com>
16834 * typemanager.cs: Enable IndexerPropertyName again. It does not
16835 work for TYpeBuilders though. Ravi, can you please fix this?
16837 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
16839 * expression.cs (Argument.Emit): Handle the case of ref objects
16840 being passed to ref functions;
16842 (ParameterReference.EmitLoad): Loads the content of the pointer
16843 without dereferencing.
16845 2002-01-07 Miguel de Icaza <miguel@ximian.com>
16847 * cs-tokenizer.cs: Implemented the pre-processing expressions.
16849 2002-01-08 Ravi Pratap <ravi@ximian.com>
16851 * class.cs (Indexer.DefineMethod): Incorporate the interface
16852 type in the name of the method if we are doing explicit interface
16855 * expression.cs (ConversionExists): Remove as it is completely obsolete.
16857 (BetterConversion): Fix extremely trivial bug where we were referring to
16858 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
16861 * ../errors/bug16.cs : Add although we have fixed it.
16863 2002-01-07 Miguel de Icaza <miguel@ximian.com>
16865 * expression.cs (BaseIndexer): Begin implementation.
16867 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
16869 * cs-parser.jay (indexer_declarator): Use qualified_identifier
16870 production directly to remove a shift/reduce, and implement
16871 explicit interface implementation.
16873 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
16874 after a floating point suffix.
16876 * expression.cs (DoNumericPromotions): Improved the conversion for
16877 uint/uint. If we have a constant, we avoid doing a typecast to a
16880 * class.cs (Indexer): Implement explicit interface implementation
16883 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
16885 * class.cs: make the default instance constructor public and hidebysig.
16887 2001-01-03 Ravi Pratap <ravi@ximian.com>
16889 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
16890 so we can call it from elsewhere.
16892 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
16893 we emit it internally if the class has a defined indexer; otherwise the user
16894 emits it by decorating the class definition with the DefaultMemberAttribute.
16896 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
16897 attribute is not used on a type which defines an indexer.
16899 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
16900 character when we skip whitespace.
16902 * ../errors/cs0646.cs : Add.
16904 2002-01-03 Miguel de Icaza <miguel@ximian.com>
16906 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
16909 * makefile: Add practical target `mcs3.exe' which builds the third
16910 generation compiler.
16912 * expression.cs (New): Fix structures constructor calling.
16914 * class.cs (Property, Method, Indexer): Emit Final flag on the
16915 method if we are an interface implementation and we are not
16918 * ecore.cs (PropertyExpr): New public field `IsBase', tells
16919 whether this property is referencing a `base' method.
16921 * expression.cs (Invocation.EmitCall): take an extra argument:
16922 is_base, this is used to determine whether the `call' or
16923 `callvirt' opcode should be used.
16926 * delegate.cs: update EmitCall.
16928 * class.cs (Method.Define): Set NewSlot for the cases where we are
16929 not implementing an interface method.
16931 (Property.Define): ditto.
16933 2002-01-02 Miguel de Icaza <miguel@ximian.com>
16935 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
16936 'r'. Allows mcs to parse itself fully.
16938 2002-01-02 Ravi Pratap <ravi@ximian.com>
16940 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
16941 of the number of initializers that require the InitializeArray method.
16943 (CheckIndices): Store the Expression in all cases - not the plain value. Also
16944 update the above field where necessary.
16946 (MakeByteBlob): Update accordingly.
16948 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
16951 (EmitDynamicInitializers): Update in accordance with the new optimization.
16953 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
16954 same OpCode applies.
16956 * cs-parser.jay : Fix some glaring errors I introduced.
16958 2002-01-01 Ravi Pratap <ravi@ximian.com>
16960 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
16961 so that we can check for name clashes there too.
16963 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
16964 for interface indexers.
16966 * interfaces.cs (Define): Emit the default member attribute.
16968 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
16969 variable was being referred to while setting the value ;-)
16971 2002-01-01 Miguel de Icaza <miguel@ximian.com>
16973 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
16974 byte-by-byte information when we know the data is zero.
16976 Make the block always a multiple of 4, because
16977 DefineInitializedData has a bug.
16979 * assign.cs: Fix, we should assign from the temporary, not from
16982 * expression.cs (MakeByteBlob): Fix my incorrect code.
16984 2001-12-31 Miguel de Icaza <miguel@ximian.com>
16986 * typemanager.cs (EnumToUnderlying): This function is used to get
16987 the underlying type from an enumeration, because it does not
16990 * constant.cs: Use the I4_S form for values between -128 and 127.
16992 * statement.cs (Block.LookupLabel): Looks up a label.
16993 (Block): Drop support for labeled blocks.
16995 (LabeledStatement): New kind of statement that represents a label
16998 (Goto): Finally implement this bad boy.
17000 * cs-parser.jay: Update to reflect new mechanism to implement
17003 2001-12-30 Miguel de Icaza <miguel@ximian.com>
17005 * codegen.cs (EmitContext.This): a codegen property that keeps the
17006 a single instance of this instead of creating many different this
17009 * delegate.cs (Delegate.DoResolve): Update to use the property;
17011 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
17013 * expression.cs (BaseAccess.DoResolve): Ditto.
17015 2001-12-29 Ravi Pratap <ravi@ximian.com>
17017 * typemanager.cs (methodimpl_attr_type): Add to hold the type
17018 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
17020 (InitCoreTypes): Update accordingly.
17022 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
17023 so we can quickly store the state.
17025 (ApplyAttributes): Set the correct implementation flags
17026 for InternalCall methods.
17028 2001-12-29 Miguel de Icaza <miguel@ximian.com>
17030 * expression.cs (EmitCall): if a method is not virtual, then do
17031 not use callvirt on it.
17033 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
17034 user defined stuff) requires the use of stobj, which takes an
17035 address on the stack instead of an array and an index. So emit
17036 the Ldelema operation for it.
17038 (EmitStoreOpcode): Use stobj for valuetypes.
17040 (UnaryMutator.EmitCode): Use the right 1 value depending on
17041 whether we are dealing with int64/uint64, float or doubles.
17043 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
17044 constructors that I implemented last night.
17046 (Constructor.IsDefault): Fix to work properly for static
17049 * cs-parser.jay (CheckDef): report method signature errors.
17050 Update error number 103 to be 132.
17052 * decl.cs: New AdditionResult enumeration value: MethodExists.
17053 Although we do this check for methods later on in the semantic
17054 analysis, catching repeated default constructors is so easy that
17055 we catch these here.
17057 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
17060 (ParameterReference.EmitAssign, Emit): handle
17063 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
17064 (ArrayAccess.EmitStoreOpcode): ditto.
17066 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
17068 * expression.cs (MakeByteBlob): Complete all the missing types
17069 (uint, short, ushort, byte, sbyte)
17071 * class.cs: Only init instance field initializers on instance
17074 Rename `constructors' to instance_constructors.
17076 (TypeContainer.AddConstructor): Only add constructors to the list
17077 if it is not static.
17079 Make sure that we handle default_static_constructor independently
17080 everywhere where we handle instance_constructors
17082 2001-12-28 Miguel de Icaza <miguel@ximian.com>
17084 * class.cs: Do not lookup or create a base initializer for a
17085 static constructor.
17087 (ConstructorInitializer.Resolve): use the proper type to lookup
17090 * cs-parser.jay: Report error 1585 (modifiers between type and name).
17092 * enum.cs, interface.cs: Remove CloseType, this is taken care by
17095 * decl.cs: CloseType is now an virtual method, the default
17096 implementation just closes this type.
17098 2001-12-28 Ravi Pratap <ravi@ximian.com>
17100 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
17101 to PreserveSig by default. Also emit HideBySig on such methods.
17103 Basically, set the defaults to standard values.
17105 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
17106 argument, if candidate is better, it can't be worse than the best !
17108 (Invocation): Re-write bits to differentiate between methods being
17109 applicable in their expanded form and their normal form - for params
17112 Get rid of use_standard everywhere as only standard conversions are allowed
17113 in overload resolution.
17115 More spec conformance.
17117 2001-12-27 Miguel de Icaza <miguel@ximian.com>
17119 * driver.cs: Add --timestamp, to see where the compiler spends
17122 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
17123 `this' in static code.
17125 (SimpleName.DoResolve): Implement in terms of a helper function
17126 that allows static-references to be passed upstream to
17129 (Expression.ResolveWithSimpleName): Resolve specially simple
17130 names when called by MemberAccess to implement the special
17133 (Expression.ImplicitReferenceConversion): Handle conversions from
17134 Null to reference types before others, as Null's type is
17137 * expression.cs (Invocation.EmitCall): Handle the special case of
17138 calling methods declared on a reference type from a ValueType
17139 (Base classes System.Object and System.Enum)
17141 (MemberAccess.Resolve): Only perform lookups on Enumerations if
17142 the left hand side is a TypeExpr, not on every enumeration.
17144 (Binary.Resolve): If types are reference types, then do a cast to
17145 object on operators != and == of both arguments.
17147 * typemanager.cs (FindMembers): Extract instance and static
17148 members if requested.
17150 * interface.cs (PopulateProperty): Use void_type instead of null
17151 as the return type for the setter method.
17153 (PopulateIndexer): ditto.
17155 2001-12-27 Ravi Pratap <ravi@ximian.com>
17157 * support.cs (ReflectionParameters): Fix minor bug where we
17158 were examining the wrong parameter for the ParamArray attribute.
17160 Cope with requests for the type of the parameter at position
17161 greater than the params parameter's. We now return the element
17162 type of the params array as that makes more sense.
17164 * expression.cs (Invocation.IsParamsMethodApplicable): Update
17165 accordingly as we no longer have to extract the element type
17168 (Invocation.OverloadResolve): Update.
17170 2001-12-27 Miguel de Icaza <miguel@ximian.com>
17172 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
17173 against IEnumerator, test whether the return value is a descendant
17174 of the IEnumerator interface.
17176 * class.cs (Indexer.Define): Use an auxiliary method to implement
17177 the other bits of the method definition. Begin support for
17178 explicit interface implementation.
17180 (Property.DefineMethod): Use TypeManager.void_type instead of null
17181 for an empty return value.
17183 2001-12-26 Miguel de Icaza <miguel@ximian.com>
17185 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
17186 dealing with a FieldExpr which is composed of a FieldBuilder, in
17187 the code path we did extract the constant, but we should have
17188 obtained the underlying value to be able to cast it (otherwise we
17189 end up in an infinite loop, this is what Ravi was running into).
17191 (ArrayCreation.UpdateIndices): Arrays might be empty.
17193 (MemberAccess.ResolveMemberAccess): Add support for section
17194 14.5.4.1 that deals with the special case of E.I when E is a type
17195 and something else, that I can be a reference to a static member.
17197 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
17198 handle a particular array type to create byte blobs, it is just
17199 something we dont generate byteblobs for.
17201 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
17204 * location.cs (Push): remove the key from the hashtable that we
17205 are about to add. This happens for empty files.
17207 * driver.cs: Dispose files after we have parsed them.
17209 (tokenize): new function that only runs the tokenizer on its
17210 input, for speed testing.
17212 2001-12-26 Ravi Pratap <ravi@ximian.com>
17214 * class.cs (Event.Define): Define the private field only if there
17215 are no accessors defined.
17217 * expression.cs (ResolveMemberAccess): If there is no associated
17218 field with the event, that means we have an event defined with its
17219 own accessors and we should flag error cs0070 since transforming
17220 ourselves into a field is not valid in that case.
17222 * ecore.cs (SimpleName.DoResolve): Same as above.
17224 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
17225 and charset to sane values.
17227 2001-12-25 Ravi Pratap <ravi@ximian.com>
17229 * assign.cs (DoResolve): Perform check on events only if they
17230 are being accessed outside the declaring type.
17232 * cs-parser.jay (event_declarations): Update rules to correctly
17233 set the type of the implicit parameter etc.
17235 (add_accessor, remove_accessor): Set current local parameters.
17237 * expression.cs (Binary): For delegate addition and subtraction,
17238 cast the return value from the method into the appropriate delegate
17241 2001-12-24 Ravi Pratap <ravi@ximian.com>
17243 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
17244 of these as the workaround is unnecessary.
17246 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
17247 delegate data - none of that is needed at all.
17249 Re-write bits to extract the instance expression and the delegate method
17252 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
17255 * attribute.cs (ApplyAttributes): New method to take care of common tasks
17256 of attaching attributes instead of duplicating code everywhere.
17258 * everywhere : Update code to do attribute emission using the above method.
17260 2001-12-23 Miguel de Icaza <miguel@ximian.com>
17262 * expression.cs (IsParamsMethodApplicable): if there are not
17263 parameters, return immediately.
17265 * ecore.cs: The 0 literal can be implicity converted to an enum
17268 (SimpleName.DoResolve): First lookup the type, then lookup the
17271 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
17272 want to get its address. If the InstanceExpression is not
17273 addressable, store the result in a temporary variable, then get
17276 * codegen.cs: Only display 219 errors on warning level or above.
17278 * expression.cs (ArrayAccess): Make it implement the
17279 IMemoryLocation interface.
17281 (Binary.DoResolve): handle the operator == (object a, object b)
17282 and operator != (object a, object b) without incurring into a
17283 BoxedCast (because 5 != o should never be performed).
17285 Handle binary enumerator operators.
17287 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
17288 value type, otherwise use Ldelem_ref.
17290 Use precomputed names;
17292 (AddressOf): Implement address of
17294 * cs-parser.jay (labeled_statement): Fix recursive block
17295 addition by reworking the production.
17297 * expression.cs (New.DoEmit): New has a special case:
17299 If we are dealing with a ValueType, we have a few
17300 situations to deal with:
17302 * The target of New is a ValueType variable, that is
17303 easy, we just pass this as the variable reference
17305 * The target of New is being passed as an argument,
17306 to a boxing operation or a function that takes a
17309 In this case, we need to create a temporary variable
17310 that is the argument of New.
17313 2001-12-23 Ravi Pratap <ravi@ximian.com>
17315 * rootcontext.cs (LookupType): Check that current_type is not null before
17316 going about looking at nested types.
17318 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
17319 not implement the IAssignMethod interface any more.
17321 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
17322 where we tranform them into FieldExprs if they are being resolved from within
17323 the declaring type.
17325 * ecore.cs (SimpleName.DoResolve): Do the same here.
17327 * assign.cs (DoResolve, Emit): Clean up code considerably.
17329 * ../errors/bug10.cs : Add.
17331 * ../errors/cs0070.cs : Add.
17333 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
17335 * assign.cs : Get rid of EventIsLocal everywhere.
17337 2001-12-23 Miguel de Icaza <miguel@ximian.com>
17339 * ecore.cs (ConvertIntLiteral): finished the implementation.
17341 * statement.cs (SwitchLabel): Convert the value we are using as a
17342 key before looking up the table.
17344 2001-12-22 Miguel de Icaza <miguel@ximian.com>
17346 * codegen.cs (EmitTopBlock): Require a Location argument now.
17348 * cs-parser.jay (constructor_declarator): We need to setup
17349 current_local_parameters before we parse the
17350 opt_constructor_initializer, to allow the variables to be bound
17351 to the constructor arguments.
17353 * rootcontext.cs (LookupType): First lookup nested classes in our
17354 class and our parents before we go looking outside our class.
17356 * expression.cs (ConstantFold): Extract/debox the values at the
17359 * rootcontext.cs (EmitCode): Resolve the constants first before we
17360 resolve the types. This is not really needed, but it helps debugging.
17362 * statement.cs: report location.
17364 * cs-parser.jay: pass location to throw statement.
17366 * driver.cs: Small bug fix.
17368 * report.cs: Updated format to be 4-zero filled digits.
17370 2001-12-22 Ravi Pratap <ravi@ximian.com>
17372 * expression.cs (CheckIndices): Fix minor bug where the wrong
17373 variable was being referred to ;-)
17375 (DoEmit): Do not call EmitStaticInitializers when the
17376 underlying type is System.Object.
17378 2001-12-21 Ravi Pratap <ravi@ximian.com>
17380 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
17381 and do the usual workaround for SRE.
17383 * class.cs (MyEventBuilder.EventType): New member to get at the type
17384 of the event, quickly.
17386 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
17388 * assign.cs (Assign.DoResolve): Handle the case when the target
17389 is an EventExpr and perform the necessary checks.
17391 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
17394 (SimpleName.MemberStaticCheck): Include check for EventExpr.
17396 (EventExpr): Set the type in the constructor itself since we
17397 are meant to be born fully resolved.
17399 (EventExpr.Define): Revert code I wrote earlier.
17401 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
17402 instance expression is null. The instance expression is a This in that case
17403 or a null, depending on whether it is a static method or not.
17405 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
17406 refers to more than one method.
17408 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
17409 and accordingly flag errors.
17411 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17413 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
17415 2001-12-22 Miguel de Icaza <miguel@ximian.com>
17417 * location.cs (ToString): Provide useful rutine.
17419 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17421 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
17422 objects, return the actual integral boxed.
17424 * statement.cs (SwitchLabel): define an ILLabel for each
17427 (Switch.CheckSwitch): If the value is a Literal, extract
17428 the underlying literal.
17430 Also in the unused hashtable we had, add the SwitchLabel so we can
17431 quickly look this value up.
17433 * constant.cs: Implement a bunch of new constants. Rewrite
17434 Literal based on this. Made changes everywhere to adapt to this.
17436 * expression.cs (Expression.MakeByteBlob): Optimize routine by
17437 dereferencing array only once, and also copes with enumrations.
17439 bytes are two bytes wide, not one.
17441 (Cast): Perform constant conversions.
17443 * ecore.cs (TryImplicitIntConversion): Return literals instead of
17444 wrappers to the literals here.
17446 * expression.cs (DoNumericPromotions): long literals can converted
17447 to ulong implicity (this is taken care of elsewhere, but I was
17448 missing this spot).
17450 * ecore.cs (Expression.Literalize): Make the return type Literal,
17451 to improve type checking.
17453 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
17455 2001-12-20 Miguel de Icaza <miguel@ximian.com>
17457 * literal.cs: Revert code from ravi that checked the bounds. The
17458 bounds are sane by the definition of the type itself.
17460 * typemanager.cs: Fix implementation of ImplementsInterface. We
17461 need to actually look up in our parent hierarchy for interfaces
17464 * const.cs: Use the underlying type for enumerations
17466 * delegate.cs: Compute the basename for the delegate creation,
17467 that should fix the delegate test case, and restore the correct
17468 Type Lookup semantics in rootcontext
17470 * rootcontext.cs: Revert Ravi's last patch. The correct way of
17471 referencing a nested type with the Reflection API is using the "+"
17474 * cs-parser.jay: Do not require EOF token at the end.
17476 2001-12-20 Ravi Pratap <ravi@ximian.com>
17478 * rootcontext.cs (LookupType): Concatenate type names with
17479 a '.' instead of a '+' The test suite passes again.
17481 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
17482 field of the enumeration.
17484 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
17485 the case when the member is an EventExpr.
17487 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
17488 static has an associated instance expression.
17490 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
17492 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
17494 * class.cs (Event.Define): Register event and perform appropriate checks
17497 We define the Add and Remove methods even if the use provides none because
17498 in that case, we provide default implementations ourselves.
17500 Define a private field of the type of the event. This is done by the CSC compiler
17501 and we should be doing it too ;-)
17503 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
17504 More methods we use in code we generate.
17506 (multicast_delegate_type, delegate_type): Two separate types since the distinction
17509 (InitCoreTypes): Update accordingly for the above.
17511 * class.cs (Event.Emit): Generate code for default accessors that we provide
17513 (EmitDefaultMethod): Do the job in the above.
17515 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
17518 2001-12-20 Miguel de Icaza <miguel@ximian.com>
17520 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
17521 builders even if we were missing one.
17523 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
17524 pass the Basename as our class name instead of the Name. The
17525 basename will be correctly composed for us.
17527 * parameter.cs (Paramters): Now takes a Location argument.
17529 * decl.cs (DeclSpace.LookupType): Removed convenience function and
17530 make all the code call directly LookupType in RootContext and take
17531 this chance to pass the Location information everywhere.
17533 * Everywhere: pass Location information.
17535 2001-12-19 Miguel de Icaza <miguel@ximian.com>
17537 * class.cs (Constructor.Define): Updated way of detecting the
17538 length of the parameters.
17540 (TypeContainer.DefineType): Use basename as the type name for
17543 (TypeContainer.Define): Do not recursively define types here, as
17544 definition is taken care in order by the RootContext.
17546 * tree.cs: Keep track of namespaces in a per-file basis.
17548 * parameter.cs (Parameter.ComputeSignature): Update to use
17551 (Parameters.GetSignature): ditto.
17553 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
17554 instead of a TypeContainer.
17556 (Interface.SemanticAnalysis): Use `this' instead of our parent to
17557 resolve names. Because we need to be resolve in our context, not
17560 * driver.cs: Implement response files.
17562 * class.cs (TypeContainer.DefineType): If we are defined, do not
17563 redefine ourselves.
17565 (Event.Emit): Emit the code for add/remove handlers.
17566 (Event.Define): Save the MethodBuilders for add/remove.
17568 * typemanager.cs: Use pair here too.
17570 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
17571 DictionaryEntry requires the first argument to be non-null.
17573 (enum_declaration): Compute full name for registering the
17576 (delegate_declaration): Instead of using
17577 formal_parameter_list, use opt_formal_parameter_list as the list
17580 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
17581 (EventParsing): New property that controls whether `add' and
17582 `remove' are returned as tokens or identifiers (for events);
17584 2001-12-19 Ravi Pratap <ravi@ximian.com>
17586 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
17587 use MyEventBuilder only and let it wrap the real builder for us.
17589 (MyEventBuilder): Revamp constructor etc.
17591 Implement all operations that we perform on EventBuilder in precisely the same
17594 (FindMembers): Update to use the EventBuilder member.
17596 (Event.Emit): Update accordingly.
17598 2001-12-18 Ravi Pratap <ravi@ximian.com>
17600 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
17601 by calling the appropriate methods.
17603 (GetCustomAttributes): Make stubs as they cannot possibly do anything
17606 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
17608 2001-12-17 Ravi Pratap <ravi@ximian.com>
17610 * delegate.cs (Delegate.Populate): Check that the return type
17611 and various parameters types are indeed accessible.
17613 * class.cs (Constructor.Define): Same here.
17615 (Field.Define): Ditto.
17617 (Event.Define): Ditto.
17619 (Operator.Define): Check that the underlying Method defined itself
17620 correctly - so it's MethodBuilder should not be null.
17622 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
17623 expression happens to be null.
17625 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
17626 members but as of now we don't seem to be able to do anything really useful with it.
17628 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
17629 not the EventBuilder.
17631 2001-12-18 Miguel de Icaza <miguel@ximian.com>
17633 * cs-tokenizer.cs: Add support for defines.
17634 Add support for #if, #elif, #else, #endif
17636 (eval_var): evaluates a variable.
17637 (eval): stubbed for evaluating functions.
17639 * cs-parser.jay: Pass the defines information
17641 * driver.cs: Add --define command line option.
17643 * decl.cs: Move MemberCore here.
17645 Make it the base class for DeclSpace. This allows us to catch and
17646 report 108 and 109 for everything now.
17648 * class.cs (TypeContainer.Define): Extract all the members
17649 before populating and emit the warning 108 (new keyword required
17650 to override) instead of having each member implement this.
17652 (MemberCore.Define): New abstract method, we will be using this in
17653 the warning reporting engine in Populate.
17655 (Operator.Define): Adjust to new MemberCore protocol.
17657 * const.cs (Const): This does not derive from Expression, it is a
17658 temporary object we use to create fields, it is a MemberCore.
17660 * class.cs (Method.Define): Allow the entry point to be in a
17663 * driver.cs: Rewrite the argument handler to clean it up a bit.
17665 * rootcontext.cs: Made it just an auxiliary namespace feature by
17666 making everything static.
17668 * driver.cs: Adapt code to use RootContext type name instead of
17671 * delegate.cs: Remove RootContext argument.
17673 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
17676 * class.cs (Event.Define): The lookup can fail.
17678 * cs-tokenizer.cs: Begin implementation of pre-procesor.
17680 * expression.cs: Resolve the this instance before invoking the code.
17682 2001-12-17 Miguel de Icaza <miguel@ximian.com>
17684 * cs-parser.jay: Add a production in element_access that allows
17685 the thing to become a "type" reference. This way we can parse
17686 things like "(string [])" as a type.
17688 Note that this still does not handle the more complex rules of
17692 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
17694 * ecore.cs: (CopyNewMethods): new utility function used to
17695 assemble the list of methods from running FindMembers.
17697 (MemberLookup): Rework FindMembers so that
17699 2001-12-16 Miguel de Icaza <miguel@ximian.com>
17701 * class.cs (TypeContainer): Remove Delegates who fail to be
17704 * delegate.cs (Populate): Verify that we dont get null return
17705 values. TODO: Check for AsAccessible.
17707 * cs-parser.jay: Use basename to emit error 574 (destructor should
17708 have the same name as container class), not the full name.
17710 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
17711 possible representation.
17713 Also implements integer type suffixes U and L.
17715 2001-12-15 Miguel de Icaza <miguel@ximian.com>
17717 * expression.cs (ArrayCreation.DoResolve): We need to do the
17718 argument resolution *always*.
17720 * decl.cs: Make this hold the namespace. Hold the root context as
17722 (LookupType): Move here.
17724 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
17726 * location.cs (Row, Name): Fixed the code, it was always returning
17727 references to the first file.
17729 * interface.cs: Register properties defined through interfaces.
17731 * driver.cs: Add support for globbing on the command line
17733 * class.cs (Field): Make it derive from MemberCore as well.
17736 2001-12-15 Ravi Pratap <ravi@ximian.com>
17738 * class.cs (Event::Define): Check that the type of the event is a delegate
17739 type else flag error #66.
17741 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
17744 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
17745 values of EntryPoint, CharSet etc etc.
17747 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
17749 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
17750 be null and we should ignore this. I am not sure if this is really clean. Apparently,
17751 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
17752 which needs this to do its work.
17754 * ../errors/cs0066.cs : Add.
17756 2001-12-14 Miguel de Icaza <miguel@ximian.com>
17758 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
17761 * class.cs: (MethodSignature.MethodSignature): Removed hack that
17762 clears out the parameters field.
17763 (MemberSignatureCompare): Cleanup
17765 (MemberCore): New base class used to share code between MethodCore
17768 (RegisterRequiredImplementations) BindingFlags.Public requires
17769 either BindingFlags.Instace or Static. Use instance here.
17771 (Property): Refactored code to cope better with the full spec.
17773 * parameter.cs (GetParameterInfo): Return an empty array instead
17776 * class.cs (Property): Abstract or extern properties have no bodies.
17778 * parameter.cs (GetParameterInfo): return a zero-sized array.
17780 * class.cs (TypeContainer.MethodModifiersValid): Move all the
17781 method modifier validation to the typecontainer so we can reuse
17782 this on properties.
17784 (MethodCore.ParameterTypes): return an empty sized array of types.
17786 (Property.Define): Test property modifier validity.
17788 Add tests for sealed/override too.
17790 (Method.Emit): abstract or extern methods have no bodies.
17792 2001-12-14 Ravi Pratap <ravi@ximian.com>
17794 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
17797 (Method::Define, ::Emit): Modify accordingly.
17799 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
17801 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
17803 * makefile: Pass in /unsafe.
17805 2001-12-13 Miguel de Icaza <miguel@ximian.com>
17807 * class.cs (MakeKey): Kill routine.
17809 * class.cs (TypeContainer.Define): Correctly define explicit
17810 method implementations (they require the full interface name plus
17813 * typemanager.cs: Deply the PtrHashtable here and stop using the
17814 lame keys. Things work so much better.
17816 This of course broke everyone who depended on `RegisterMethod' to
17817 do the `test for existance' test. This has to be done elsewhere.
17819 * support.cs (PtrHashtable): A hashtable that avoid comparing with
17820 the object stupid Equals method (because, that like fails all over
17821 the place). We still do not use it.
17823 * class.cs (TypeContainer.SetRequiredInterface,
17824 TypeContainer.RequireMethods): Killed these two routines and moved
17825 all the functionality to RegisterRequiredImplementations.
17827 (TypeContainer.RegisterRequiredImplementations): This routine now
17828 registers all the implementations required in an array for the
17829 interfaces and abstract methods. We use an array of structures
17830 which can be computed ahead of time to reduce memory usage and we
17831 also assume that lookups are cheap as most classes will not
17832 implement too many interfaces.
17834 We also avoid creating too many MethodSignatures.
17836 (TypeContainer.IsInterfaceMethod): Update and optionally does not
17837 clear the "pending" bit if we find that there are problems with
17840 (TypeContainer.VerifyPendingMethods): Update to report errors of
17841 methods that look like implementations but are not.
17843 (TypeContainer.Define): Add support for explicit interface method
17846 2001-12-12 Miguel de Icaza <miguel@ximian.com>
17848 * typemanager.cs: Keep track of the parameters here instead of
17849 being a feature of the TypeContainer.
17851 * class.cs: Drop the registration of parameters here, as
17852 InterfaceMethods are also interface declarations.
17854 * delegate.cs: Register methods with the TypeManager not only with
17855 the TypeContainer. This code was buggy.
17857 * interface.cs: Full registation here.
17859 2001-12-11 Miguel de Icaza <miguel@ximian.com>
17861 * expression.cs: Remove reducer for binary expressions, it can not
17864 * const.cs: Put here the code that used to go into constant.cs
17866 * constant.cs: Put here the code for constants, this is a new base
17867 class for Literals.
17869 * literal.cs: Make Literal derive from Constant.
17871 2001-12-09 Miguel de Icaza <miguel@ximian.com>
17873 * statement.cs (Return.Emit): Report error 157 if the user
17874 attempts to return from a finally block.
17876 (Return.Emit): Instead of emitting a return, jump to the end of
17879 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
17880 LocalBuilder to store the result of the function. ReturnLabel is
17881 the target where we jump.
17884 2001-12-09 Radek Doulik <rodo@ximian.com>
17886 * cs-parser.jay: remember alias in current namespace
17888 * ecore.cs (SimpleName::DoResolve): use aliases for types or
17891 * class.cs (LookupAlias): lookup alias in my_namespace
17893 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
17895 (LookupAlias): lookup alias in this and if needed in parent
17898 2001-12-08 Miguel de Icaza <miguel@ximian.com>
17902 * rootcontext.cs: (ModuleBuilder) Made static, first step into
17903 making things static. I need this to avoid passing the
17904 TypeContainer when calling ParameterType.
17906 * support.cs (InternalParameters.ParameterType): Remove ugly hack
17907 that did string manipulation to compute the type and then call
17908 GetType. Use Parameter.ParameterType instead.
17910 * cs-tokenizer.cs: Consume the suffix for floating values.
17912 * expression.cs (ParameterReference): figure out whether this is a
17913 reference parameter or not. Kill an extra variable by computing
17914 the arg_idx during emission.
17916 * parameter.cs (Parameters.GetParameterInfo): New overloaded
17917 function that returns whether a parameter is an out/ref value or not.
17919 (Parameter.ParameterType): The type of the parameter (base,
17920 without ref/out applied).
17922 (Parameter.Resolve): Perform resolution here.
17923 (Parameter.ExternalType): The full type (with ref/out applied).
17925 * statement.cs (Using.Emit, Using.EmitExpression): Implement
17926 support for expressions on the using statement.
17928 2001-12-07 Miguel de Icaza <miguel@ximian.com>
17930 * statement.cs (Using.EmitLocalVariableDecls): Split the
17931 localvariable handling of the using statement.
17933 (Block.EmitMeta): Keep track of variable count across blocks. We
17934 were reusing slots on separate branches of blocks.
17936 (Try.Emit): Emit the general code block, we were not emitting it.
17938 Check the type of the declaration to be an IDisposable or
17939 something that can be implicity converted to it.
17941 Emit conversions if required.
17943 * ecore.cs (EmptyExpression): New utility class.
17944 (Expression.ImplicitConversionExists): New utility function.
17946 2001-12-06 Miguel de Icaza <miguel@ximian.com>
17948 * statement.cs (Using): Implement.
17950 * expression.cs (LocalVariableReference): Support read only variables.
17952 * statement.cs: Remove the explicit emit for the Leave opcode.
17953 (VariableInfo): Add a readonly field.
17955 2001-12-05 Miguel de Icaza <miguel@ximian.com>
17957 * ecore.cs (ConvCast): new class used to encapsulate the various
17958 explicit integer conversions that works in both checked and
17959 unchecked contexts.
17961 (Expression.ConvertNumericExplicit): Use new ConvCast class to
17962 properly generate the overflow opcodes.
17964 2001-12-04 Miguel de Icaza <miguel@ximian.com>
17966 * statement.cs: The correct type for the EmptyExpression is the
17967 element_type, not the variable type. Ravi pointed this out.
17969 2001-12-04 Ravi Pratap <ravi@ximian.com>
17971 * class.cs (Method::Define): Handle PInvoke methods specially
17972 by using DefinePInvokeMethod instead of the usual one.
17974 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
17975 above to do the task of extracting information and defining the method.
17977 2001-12-04 Ravi Pratap <ravi@ximian.com>
17979 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
17980 of the condition for string type.
17982 (Emit): Move that here.
17984 (ArrayCreation::CheckIndices): Keep string literals in their expression
17987 (EmitDynamicInitializers): Handle strings appropriately.
17989 2001-12-04 Miguel de Icaza <miguel@ximian.com>
17991 * codegen.cs (EmitContext): Replace multiple variables with a
17992 single pointer to the current Switch statement.
17994 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
17997 2001-12-03 Miguel de Icaza <miguel@ximian.com>
18001 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
18004 (Foreach.Emit): Foreach on arrays was not setting
18005 up the loop variables (for break/continue).
18007 (GotoCase): Semi-implented.
18009 2001-12-03 Ravi Pratap <ravi@ximian.com>
18011 * attribute.cs (CheckAttribute): Handle system attributes by using
18012 Attribute.GetAttributes to examine information we need.
18014 (GetValidPlaces): Same here.
18016 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
18018 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
18020 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
18022 (Method::Define): Set appropriate flags if we have a DllImport attribute.
18024 (Method::Emit): Handle the case when we are a PInvoke method.
18026 2001-12-03 Miguel de Icaza <miguel@ximian.com>
18028 * expression.cs: Use ResolveWithSimpleName on compound names.
18030 2001-12-02 Ravi Pratap <ravi@ximian.com>
18032 * constant.cs (EmitConstant): Make sure we resolve the associated expression
18033 before trying to reduce it.
18035 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
18037 * constant.cs (LookupConstantValue): Implement.
18039 (EmitConstant): Use the above in emitting the constant.
18041 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
18042 that are user-defined by doing a LookupConstantValue on them.
18044 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
18047 2001-11-29 Miguel de Icaza <miguel@ximian.com>
18049 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
18051 (BaseAccess.DoResolve): Implement.
18053 (MemberAccess.DoResolve): Split this routine into a
18054 ResolveMemberAccess routine that can be used independently
18056 2001-11-28 Miguel de Icaza <miguel@ximian.com>
18058 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
18059 As that share bits of the implementation. Is returns a boolean,
18060 while As returns the Type that is being probed.
18062 2001-12-01 Ravi Pratap <ravi@ximian.com>
18064 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
18065 instead of a Literal - much easier.
18067 (EnumInTransit): Remove - utterly useless :-)
18069 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
18071 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
18073 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
18074 chain when we have no associated expression.
18076 2001-11-30 Ravi Pratap <ravi@ximian.com>
18078 * constant.cs (Define): Use Location while reporting the errror.
18080 Also emit a warning when 'new' is used and there is no inherited
18083 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
18086 (LookupEnumValue): Implement to lookup an enum member's value and define it
18089 (Populate): Re-write accordingly to use the above routine.
18091 2001-11-27 Miguel de Icaza <miguel@ximian.com>
18093 * expression.cs (This): Fix prototype for DoResolveLValue to
18094 override the base class DoResolveLValue.
18096 * cs-parser.cs: Report errors cs574 and cs575 (destructor
18099 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
18100 (we need to load the address of the field here). This fixes
18103 (FieldExpr.DoResolveLValue): Call the DoResolve
18104 function to initialize the Instance expression.
18106 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
18107 correctly the GetEnumerator operation on a value type.
18109 * cs-parser.jay: Add more simple parsing error catches.
18111 * statement.cs (Switch): Add support for string switches.
18112 Handle null specially.
18114 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
18116 2001-11-28 Ravi Pratap <ravi@ximian.com>
18118 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
18120 (declare_local_constant): New helper function.
18122 * statement.cs (AddConstant): Keep a separate record of constants
18124 (IsConstant): Implement to determine if a variable is a constant.
18126 (GetConstantExpression): Implement.
18128 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
18130 * statement.cs (IsVariableDefined): Re-write.
18132 2001-11-27 Ravi Pratap <ravi@ximian.com>
18134 * class.cs (TypeContainer::FindMembers): Look for constants
18135 in the case when we are looking for MemberTypes.Field
18137 * expression.cs (MemberAccess::DoResolve): Check that in the
18138 case we are a FieldExpr and a Literal, we are not being accessed
18139 by an instance reference.
18141 * cs-parser.jay (local_constant_declaration): Implement.
18143 (declaration_statement): Implement for constant declarations.
18145 2001-11-26 Miguel de Icaza <miguel@ximian.com>
18147 * statement.cs (Switch): Catch double defaults.
18149 (Switch): More work on the switch() statement
18150 implementation. It works for integral values now, need to finish
18154 2001-11-24 Miguel de Icaza <miguel@ximian.com>
18156 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
18157 integer literals into other integer literals. To be used by
18160 2001-11-24 Ravi Pratap <ravi@ximian.com>
18162 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
18165 (EmitDynamicInitializers): Cope with the above since we extract data
18166 directly from ArrayData now.
18168 (ExpectInitializers): Keep track of whether initializers are mandatory
18171 (Bounds): Make it a hashtable to prevent the same dimension being
18172 recorded for every element in that dimension.
18174 (EmitDynamicInitializers): Fix bug which prevented the Set array method
18177 Also fix bug which was causing the indices to be emitted in the reverse
18180 2001-11-24 Miguel de Icaza <miguel@ximian.com>
18182 * expression.cs (ArrayCreation): Implement the bits that Ravi left
18183 unfinished. They do not work, because the underlying code is
18186 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18188 * cs-parser.jay: Remove bogus fixme.
18190 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
18191 on Switch statement.
18193 2001-11-23 Ravi Pratap <ravi@ximian.com>
18195 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
18198 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
18199 parameter. Apparently, any expression is allowed.
18201 (ValidateInitializers): Update accordingly.
18203 (CheckIndices): Fix some tricky bugs thanks to recursion.
18205 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
18206 I was being completely brain-dead.
18208 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
18209 and re-write acordingly.
18211 (DelegateInvocation): Re-write accordingly.
18213 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
18215 (MakeByteBlob): Handle types more correctly.
18217 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
18218 initialization from expressions but it is incomplete because I am a complete
18221 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18223 * statement.cs (If.Emit): Fix a bug that generated incorrect code
18224 on If. Basically, we have to return `true' (ie, we do return to
18225 our caller) only if both branches of the if return.
18227 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
18228 short-circuit operators, handle them as short circuit operators.
18230 (Cast.DoResolve): Resolve type.
18231 (Cast.Cast): Take an expression as the target type.
18233 * cs-parser.jay (cast_expression): Remove old hack that only
18234 allowed a limited set of types to be handled. Now we take a
18235 unary_expression and we resolve to a type during semantic
18238 Use the grammar productions from Rhys to handle casts (this is
18239 not complete like Rhys syntax yet, we fail to handle that corner
18240 case that C# has regarding (-x), but we will get there.
18242 2001-11-22 Ravi Pratap <ravi@ximian.com>
18244 * class.cs (EmitFieldInitializer): Take care of the case when we have a
18245 field which is an array type.
18247 * cs-parser.jay (declare_local_variables): Support array initialization too.
18249 * typemanager.cs (MakeKey): Implement.
18251 (everywhere): Use the above appropriately.
18253 * cs-parser.jay (for_statement): Update for array initialization while
18254 declaring variables.
18256 * ecore.cs : The error message was correct, it's the variable's names that
18257 were misleading ;-) Make the code more readable.
18259 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
18260 the correct type etc.
18262 (ConvertExplicit): Handle Enum types by examining the underlying type.
18264 2001-11-21 Ravi Pratap <ravi@ximian.com>
18266 * parameter.cs (GetCallingConvention): Always return
18267 CallingConventions.Standard for now.
18269 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18271 * expression.cs (Binary.ResolveOperator): Update the values of `l'
18272 and `r' after calling DoNumericPromotions.
18274 * ecore.cs: Fix error message (the types were in the wrong order).
18276 * statement.cs (Foreach.ProbeCollectionType): Need to pass
18277 BindingFlags.Instance as well
18279 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
18280 implicit int literal conversion in an empty cast so that we
18281 propagate the right type upstream.
18283 (UnboxCast): new class used to unbox value types.
18284 (Expression.ConvertExplicit): Add explicit type conversions done
18287 (Expression.ImplicitNumericConversion): Oops, forgot to test for
18288 the target type before applying the implicit LongLiterals to ULong
18291 2001-11-21 Miguel de Icaza <miguel@ximian.com>
18293 * cs-parser.jay (for_statement): Reworked the way For works: now
18294 we declare manually any variables that are introduced in
18295 for_initializer to solve the problem of having out-of-band code
18296 emition (that is what got for broken).
18298 (declaration_statement): Perform the actual variable declaration
18299 that used to be done in local_variable_declaration here.
18301 (local_variable_declaration): Do not declare anything, just pass
18302 the information on a DictionaryEntry
18304 2001-11-20 Ravi Pratap <ravi@ximian.com>
18306 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
18307 re-write of the logic to now make it recursive.
18309 (UpdateIndices): Re-write accordingly.
18311 Store element data in a separate ArrayData list in the above methods.
18313 (MakeByteBlob): Implement to dump the array data into a byte array.
18315 2001-11-19 Ravi Pratap <ravi@ximian.com>
18317 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
18320 * constant.cs (Define): Implement.
18322 (EmitConstant): Re-write fully.
18324 Pass in location info.
18326 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
18329 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
18330 DictionaryEntry since we need location info too.
18332 (constant_declaration): Update accordingly.
18334 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
18335 code into another method : UpdateIndices.
18337 2001-11-18 Ravi Pratap <ravi@ximian.com>
18339 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
18340 some type checking etc.
18342 2001-11-17 Ravi Pratap <ravi@ximian.com>
18344 * expression.cs (ArrayCreation::ValidateInitializers): Implement
18345 bits to provide dimension info if the user skips doing that.
18347 Update second constructor to store the rank correctly.
18349 2001-11-16 Ravi Pratap <ravi@ximian.com>
18351 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
18352 and try to implement.
18354 * ../errors/cs0150.cs : Add.
18356 * ../errors/cs0178.cs : Add.
18358 2001-11-16 Miguel de Icaza <miguel@ximian.com>
18360 * statement.cs: Implement foreach on multi-dimensional arrays.
18362 * parameter.cs (Parameters.GetParameterByName): Also lookup the
18363 name of the params argument.
18365 * expression.cs: Use EmitStoreOpcode to get the right opcode while
18366 initializing the array.
18368 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
18369 we can use this elsewhere.
18371 * statement.cs: Finish implementation of foreach for single
18374 * cs-parser.jay: Use an out-of-band stack to pass information
18375 around, I wonder why I need this.
18377 foreach_block: Make the new foreach_block the current_block.
18379 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
18380 function used to return a static Parameters structure. Used for
18381 empty parameters, as those are created very frequently.
18383 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
18385 2001-11-15 Ravi Pratap <ravi@ximian.com>
18387 * interface.cs : Default modifier is private, not public. The
18388 make verify test passes again.
18390 2001-11-15 Ravi Pratap <ravi@ximian.com>
18392 * support.cs (ReflectionParameters): Fix logic to determine
18393 whether the last parameter is a params one. Test 9 passes again.
18395 * delegate.cs (Populate): Register the builders we define with
18396 RegisterParameterForBuilder. Test 19 passes again.
18398 * cs-parser.jay (property_declaration): Reference $6 instead
18399 of $$ to get at the location.
18401 (indexer_declaration): Similar stuff.
18403 (attribute): Ditto.
18405 * class.cs (Property): Register parameters for the Get and Set methods
18406 if they exist. Test 23 passes again.
18408 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
18409 call to EmitArguments as we are sure there aren't any params arguments.
18410 Test 32 passes again.
18412 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
18413 IndexOutOfRangeException.
18415 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
18416 Test 33 now passes again.
18418 2001-11-15 Miguel de Icaza <miguel@ximian.com>
18420 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
18421 broke a bunch of things. Will have to come up with a better way
18422 of tracking locations.
18424 * statement.cs: Implemented foreach for single dimension arrays.
18426 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18428 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
18429 an error. This removes the lookup from the critical path.
18431 * cs-parser.jay: Removed use of temporary_loc, which is completely
18434 2001-11-14 Miguel de Icaza <miguel@ximian.com>
18436 * support.cs (ReflectionParameters.ParameterModifier): Report
18437 whether the argument is a PARAMS argument or not.
18439 * class.cs: Set the attribute `ParamArrayAttribute' on the
18440 parameter argument.
18442 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
18443 and cons_param_array_attribute (ConstructorInfo for
18444 ParamArrayAttribute).,
18446 * codegen.cs: Emit the return using the `Return' statement, that
18447 way we can report the error correctly for missing return values.
18449 * class.cs (Method.Emit): Clean up.
18451 * expression.cs (Argument.Resolve): Take another argument: the
18452 location where this argument is used. Notice that this is not
18453 part of the "Argument" class as to reduce the size of the
18454 structure (we know the approximate location anyways).
18456 Test if the argument is a variable-reference, if not, then
18457 complain with a 206.
18459 (Argument.Emit): Emit addresses of variables.
18461 (Argument.FullDesc): Simplify.
18463 (Invocation.DoResolve): Update for Argument.Resolve.
18465 (ElementAccess.DoResolve): ditto.
18467 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
18468 method should be virtual, as this method is always virtual.
18470 (NewDelegate.DoResolve): Update for Argument.Resolve.
18472 * class.cs (ConstructorInitializer.DoResolve): ditto.
18474 * attribute.cs (Attribute.Resolve): ditto.
18476 2001-11-13 Miguel de Icaza <miguel@ximian.com>
18478 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
18480 * expression.cs (ParameterReference): Drop IStackStorage and implement
18481 IAssignMethod instead.
18483 (LocalVariableReference): ditto.
18485 * ecore.cs (FieldExpr): Drop IStackStorage and implement
18486 IAssignMethod instead.
18488 2001-11-13 Miguel de Icaza <miguel@ximian.com>
18490 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
18491 enumerations that are used in heavily used structures derive from
18492 byte in a laughable and pathetic attempt to reduce memory usage.
18493 This is the kind of pre-optimzations that you should not do at
18494 home without adult supervision.
18496 * expression.cs (UnaryMutator): New class, used to handle ++ and
18497 -- separatedly from the other unary operators. Cleans up the
18498 code, and kills the ExpressionStatement dependency in Unary.
18500 (Unary): Removed `method' and `Arguments' from this class, making
18501 it smaller, and moving it all to SimpleCall, so I can reuse this
18502 code in other locations and avoid creating a lot of transient data
18503 strucutres when not required.
18505 * cs-parser.jay: Adjust for new changes.
18507 2001-11-11 Miguel de Icaza <miguel@ximian.com>
18509 * enum.cs (Enum.Populate): If there is a failure during
18512 * cs-parser.jay (opt_enum_base): we used to catch type errors
18513 here, but this is really incorrect. The type error should be
18514 catched during semantic analysis.
18516 2001-12-11 Ravi Pratap <ravi@ximian.com>
18518 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
18519 current_local_parameters as expected since I, in my stupidity, had forgotten
18522 * attribute.cs (GetValidPlaces): Fix stupid bug.
18524 * class.cs (Method::Emit): Perform check on applicability of attributes.
18526 (Constructor::Emit): Ditto.
18528 (Field::Emit): Ditto.
18530 (Field.Location): Store location information.
18532 (Property, Event, Indexer, Operator): Ditto.
18534 * cs-parser.jay (field_declaration): Pass in location for each field.
18536 * ../errors/cs0592.cs : Add.
18538 2001-11-12 Ravi Pratap <ravi@ximian.com>
18540 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
18542 (InitCoreTypes): Update accordingly.
18544 (RegisterAttrType, LookupAttr): Implement.
18546 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
18547 info about the same.
18549 (Resolve): Update to populate the above as necessary.
18551 (Error592): Helper.
18553 (GetValidPlaces): Helper to the above.
18555 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
18557 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
18559 2001-11-12 Ravi Pratap <ravi@ximian.com>
18561 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
18563 * ../errors/cs0617.cs : Add.
18565 2001-11-11 Ravi Pratap <ravi@ximian.com>
18567 * enum.cs (Emit): Rename to Populate to be more consistent with what
18568 we expect it to do and when exactly it is called.
18570 * class.cs, rootcontext.cs : Update accordingly.
18572 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
18573 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
18575 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
18577 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
18578 of a fieldinfo using the above, when dealing with a FieldBuilder.
18580 2001-11-10 Ravi Pratap <ravi@ximian.com>
18582 * ../errors/cs0031.cs : Add.
18584 * ../errors/cs1008.cs : Add.
18586 * ../errrors/cs0543.cs : Add.
18588 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
18591 (FindMembers): Implement.
18593 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
18594 enums and delegates too.
18596 (enum_types): Rename to builder_to_enum.
18598 (delegate_types): Rename to builder_to_delegate.
18600 * delegate.cs (FindMembers): Implement.
18602 2001-11-09 Ravi Pratap <ravi@ximian.com>
18604 * typemanager.cs (IsEnumType): Implement.
18606 * enum.cs (Emit): Re-write parts to account for the underlying type
18607 better and perform checking etc.
18609 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
18610 of the underlying type.
18612 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
18615 * enum.cs (error31): Helper to report error #31.
18617 * cs-parser.jay (enum_declaration): Store location of each member too.
18619 * enum.cs (member_to_location): New hashtable.
18621 (AddEnumMember): Update location hashtable.
18623 (Emit): Use the location of each member while reporting errors.
18625 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18627 * cs-parser.jay: A for_initializer if is a
18628 local_variable_declaration really ammount to have an implicit
18629 block with the variable declaration and no initializer for for.
18631 * statement.cs (For.Emit): Cope with null initializers.
18633 This fixes the infinite loop on for initializers.
18635 2001-11-08 Miguel de Icaza <miguel@ximian.com>
18637 * enum.cs: More cleanup.
18639 * ecore.cs: Remove dead code.
18641 * class.cs (Property.Emit): More simplification.
18642 (Event.Emit): ditto.
18644 Reworked to have less levels of indentation.
18646 2001-11-08 Ravi Pratap <ravi@ximian.com>
18648 * class.cs (Property): Emit attributes.
18658 * enum.cs (Emit): Ditto.
18660 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
18663 * class.cs (Field, Event, etc.): Move attribute generation into the
18664 Emit method everywhere.
18666 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
18667 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
18668 as we had no way of defining nested enums !
18670 * rootcontext.cs : Adjust code accordingly.
18672 * typemanager.cs (AddEnumType): To keep track of enum types separately.
18674 2001-11-07 Ravi Pratap <ravi@ximian.com>
18676 * expression.cs (EvalConstantExpression): Move into ecore.cs
18678 * enum.cs (Enum): Rename some members and make them public and readonly
18679 according to our convention.
18681 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
18684 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
18686 (Enum::Emit): Write a simple version for now which doesn't try to compute
18687 expressions. I shall modify this to be more robust in just a while.
18689 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
18691 (TypeContainer::CloseType): Create the Enum types too.
18693 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
18695 * expression.cs (EvalConstantExpression): Get rid of completely.
18697 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
18698 user-defined values and other cases.
18700 (IsValidEnumLiteral): Helper function.
18702 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
18703 out there in the case we had a literal FieldExpr.
18705 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
18707 (Literalize): Revamp a bit to take two arguments.
18709 (EnumLiteral): New class which derives from Literal to wrap enum literals.
18711 2001-11-06 Ravi Pratap <ravi@ximian.com>
18713 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
18715 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
18717 (Resolve): Use the above to ensure we have proper initializers.
18719 2001-11-05 Ravi Pratap <ravi@ximian.com>
18721 * expression.cs (Expression::EvalConstantExpression): New method to
18722 evaluate constant expressions.
18724 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
18726 2001-11-07 Miguel de Icaza <miguel@ximian.com>
18728 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
18731 (Binary.ResolveOperator): Handle operator != (object a, object b)
18732 and operator == (object a, object b);
18734 (Binary.DoNumericPromotions): Indicate whether the numeric
18735 promotion was possible.
18737 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
18740 Made the ArrayAccess implement interface IAssignMethod instead of
18741 IStackStore as the order in which arguments are passed reflects
18744 * assign.cs: Instead of using expr.ExprClass to select the way of
18745 assinging, probe for the IStackStore/IAssignMethod interfaces.
18747 * typemanager.cs: Load InitializeArray definition.
18749 * rootcontext.cs (RootContext.MakeStaticData): Used to define
18750 static data that can be used to initialize arrays.
18752 2001-11-05 Miguel de Icaza <miguel@ximian.com>
18754 * expression.cs: Handle operator== and operator!= for booleans.
18756 (Conditioal.Reduce): Implement reducer for the ?: operator.
18758 (Conditional.Resolve): Implement dead code elimination.
18760 (Binary.Resolve): Catch string literals and return a new
18761 concatenated string.
18763 (Unary.Reduce): Implement reduction of unary expressions.
18765 * ecore.cs: Split out the expression core handling here.
18767 (Expression.Reduce): New method used to perform constant folding
18768 and CSE. This is needed to support constant-expressions.
18770 * statement.cs (Statement.EmitBoolExpression): Pass true and false
18771 targets, and optimize for !x.
18773 2001-11-04 Ravi Pratap <ravi@ximian.com>
18775 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
18776 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
18777 set custom atttributes.
18779 * literal.cs (Literal::GetValue): New abstract method to return the actual
18780 value of the literal, cast as an object.
18782 (*Literal): Implement GetValue method.
18784 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
18785 expressions to the arraylist but objects of type Argument.
18787 * class.cs (TypeContainer::Emit): Emit our attributes too.
18789 (Method::Emit, Constructor::Emit): Ditto.
18791 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
18792 to be ignoring earlier.
18794 2001-11-03 Ravi Pratap <ravi@ximian.com>
18796 * attribute.cs (AttributeSection::Define): Implement to do the business
18797 of constructing a CustomAttributeBuilder.
18799 (Attribute): New trivial class. Increases readability of code.
18801 * cs-parser.jay : Update accordingly.
18803 (positional_argument_list, named_argument_list, named_argument): New rules
18805 (attribute_arguments): Use the above so that we are more correct.
18807 2001-11-02 Ravi Pratap <ravi@ximian.com>
18809 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
18810 to perform all checks for a method with a params parameter.
18812 (Invocation::OverloadResolve): Update to use the above method and therefore
18813 cope correctly with params method invocations.
18815 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
18818 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
18819 constructors in our parent too because we can't afford to miss out on
18822 * attribute.cs (AttributeSection): New name for the class Attribute
18824 Other trivial changes to improve readability.
18826 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
18827 use the new class names.
18829 2001-11-01 Ravi Pratap <ravi@ximian.com>
18831 * class.cs (Method::Define): Complete definition for params types too
18833 (Indexer::Define): Ditto.
18835 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
18836 Cope everywhere with a request for info about the array parameter.
18838 2001-11-01 Ravi Pratap <ravi@ximian.com>
18840 * tree.cs (RecordNamespace): Fix up to check for the correct key.
18842 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
18843 local_variable_type to extract the string corresponding to the type.
18845 (local_variable_type): Fixup the action to use the new helper method.
18847 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
18850 * expression.cs : Clean out code which uses the above.
18852 2001-10-31 Ravi Pratap <ravi@ximian.com>
18854 * typemanager.cs (RegisterMethod): Check if we already have an existing key
18855 and bale out if necessary by returning a false.
18857 (RegisterProperty): Ditto.
18859 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
18860 and print out appropriate error messages.
18862 * interface.cs (everywhere): Ditto.
18864 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
18865 location to constructor.
18867 * class.cs (Property, Event, Indexer): Update accordingly.
18869 * ../errors/cs111.cs : Added.
18871 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
18872 of a method, as laid down by the spec.
18874 (Invocation::OverloadResolve): Use the above method.
18876 2001-10-31 Ravi Pratap <ravi@ximian.com>
18878 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
18879 now take a TypeContainer and a Parameters object.
18881 (ParameterData): Modify return type of ParameterModifier method to be
18882 Parameter.Modifier and not a string.
18884 (ReflectionParameters, InternalParameters): Update accordingly.
18886 * expression.cs (Argument::GetParameterModifier): Same here.
18888 * support.cs (InternalParameters::ParameterType): Find a better way of determining
18889 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
18890 symbol in it at all so maybe this is only for now.
18892 2001-10-30 Ravi Pratap <ravi@ximian.com>
18894 * support.cs (InternalParameters): Constructor now takes an extra argument
18895 which is the actual Parameters class.
18897 (ParameterDesc): Update to provide info on ref/out modifiers.
18899 * class.cs (everywhere): Update call to InternalParameters to pass in
18900 the second argument too.
18902 * support.cs (ParameterData): Add ParameterModifier, which is a method
18903 to return the modifier info [ref/out etc]
18905 (InternalParameters, ReflectionParameters): Implement the above.
18907 * expression.cs (Argument::ParameterModifier): Similar function to return
18908 info about the argument's modifiers.
18910 (Invocation::OverloadResolve): Update to take into account matching modifiers
18913 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
18914 a new SetFormalParameters object which we pass to InternalParameters.
18916 2001-10-30 Ravi Pratap <ravi@ximian.com>
18918 * expression.cs (NewArray): Merge into the ArrayCreation class.
18920 2001-10-29 Ravi Pratap <ravi@ximian.com>
18922 * expression.cs (NewArray): Merge classes NewBuiltinArray and
18923 NewUserdefinedArray into one as there wasn't much of a use in having
18926 * expression.cs (Argument): Change field's name to ArgType from Type.
18928 (Type): New readonly property which returns the proper type, taking into
18929 account ref/out modifiers.
18931 (everywhere): Adjust code accordingly for the above.
18933 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
18934 whether we are emitting for a ref or out parameter.
18936 * expression.cs (Argument::Emit): Use the above field to set the state.
18938 (LocalVariableReference::Emit): Update to honour the flag and emit the
18941 * parameter.cs (Attributes): Set the correct flags for ref parameters.
18943 * expression.cs (Argument::FullDesc): New function to provide a full desc.
18945 * support.cs (ParameterData): Add method ParameterDesc to the interface.
18947 (ReflectionParameters, InternalParameters): Implement the above method.
18949 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
18952 (Invocation::FullMethodDesc): Ditto.
18954 2001-10-29 Miguel de Icaza <miguel@ximian.com>
18956 * cs-parser.jay: Add extra production for the second form of array
18959 * expression.cs (ArrayCreation): Update to reflect the above
18962 * Small changes to prepare for Array initialization.
18964 2001-10-28 Miguel de Icaza <miguel@ximian.com>
18966 * typemanager.cs (ImplementsInterface): interface might be null;
18967 Deal with this problem;
18969 Also, we do store negative hits on the cache (null values), so use
18970 this instead of calling t.GetInterfaces on the type everytime.
18972 2001-10-28 Ravi Pratap <ravi@ximian.com>
18974 * typemanager.cs (IsBuiltinType): New method to help determine the same.
18976 * expression.cs (New::DoResolve): Get rid of array creation code and instead
18977 split functionality out into different classes.
18979 (New::FormArrayType): Move into NewBuiltinArray.
18981 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
18984 (NewBuiltinArray): New class to handle creation of built-in arrays.
18986 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
18987 account creation of one-dimensional arrays.
18989 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
18991 (NewUserdefinedArray::DoResolve): Implement.
18993 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
18995 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
18996 we maintain inside the TypeManager. This is necessary to perform lookups on the
18999 (LookupType): Update to perform GetType on the module builders too.
19001 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
19003 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
19005 2001-10-23 Ravi Pratap <ravi@ximian.com>
19007 * expression.cs (New::DoResolve): Implement guts of array creation.
19009 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
19011 2001-10-27 Miguel de Icaza <miguel@ximian.com>
19013 * expression.cs: Fix bug I introduced lsat night that broke
19016 (Expression.Resolve): Report a 246 error (can not resolve name)
19017 if we find a SimpleName in the stream.
19019 (Expression.ResolveLValue): Ditto.
19021 (Expression.ResolveWithSimpleName): This function is a variant of
19022 ResolveName, this one allows SimpleNames to be returned without a
19023 warning. The only consumer of SimpleNames is MemberAccess
19025 2001-10-26 Miguel de Icaza <miguel@ximian.com>
19027 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
19028 might arrive here. I have my doubts that this is correct.
19030 * statement.cs (Lock): Implement lock statement.
19032 * cs-parser.jay: Small fixes to support `lock' and `using'
19034 * cs-tokenizer.cs: Remove extra space
19036 * driver.cs: New flag --checked, allows to turn on integer math
19039 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
19040 Threading.Monitor.Exit
19042 2001-10-23 Miguel de Icaza <miguel@ximian.com>
19044 * expression.cs (IndexerAccess::DoResolveLValue): Set the
19045 Expression Class to be IndexerAccess.
19047 Notice that Indexer::DoResolve sets the eclass to Value.
19049 2001-10-22 Miguel de Icaza <miguel@ximian.com>
19051 * class.cs (TypeContainer::Emit): Emit code for indexers.
19053 * assign.cs (IAssignMethod): New interface implemented by Indexers
19054 and Properties for handling assignment.
19056 (Assign::Emit): Simplify and reuse code.
19058 * expression.cs (IndexerAccess, PropertyExpr): Implement
19059 IAssignMethod, clean up old code.
19061 2001-10-22 Ravi Pratap <ravi@ximian.com>
19063 * typemanager.cs (ImplementsInterface): New method to determine if a type
19064 implements a given interface. Provides a nice cache too.
19066 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
19069 (ConvertReferenceExplicit): Ditto.
19071 * delegate.cs (Delegate::Populate): Update to define the parameters on the
19072 various methods, with correct names etc.
19074 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
19075 Operator.UnaryNegation.
19077 * cs-parser.jay (operator_declarator): Be a little clever in the case where
19078 we have a unary plus or minus operator.
19080 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
19083 * everywhere : update accordingly.
19085 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
19088 * class.cs (Method::Define): For the case where we are implementing a method
19089 inherited from an interface, we need to set the MethodAttributes.Final flag too.
19090 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
19092 2001-10-21 Ravi Pratap <ravi@ximian.com>
19094 * interface.cs (FindMembers): Implement to work around S.R.E
19097 * typemanager.cs (IsInterfaceType): Implement.
19099 (FindMembers): Update to handle interface types too.
19101 * expression.cs (ImplicitReferenceConversion): Re-write bits which
19102 use IsAssignableFrom as that is not correct - it doesn't work.
19104 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
19105 and accordingly override EmitStatement.
19107 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
19108 using the correct logic :-)
19110 2001-10-19 Ravi Pratap <ravi@ximian.com>
19112 * ../errors/cs-11.cs : Add to demonstrate error -11
19114 2001-10-17 Miguel de Icaza <miguel@ximian.com>
19116 * assign.cs (Assign::Resolve): Resolve right hand side first, and
19117 then pass this as a hint to ResolveLValue.
19119 * expression.cs (FieldExpr): Add Location information
19121 (FieldExpr::LValueResolve): Report assignment to readonly
19124 (Expression::ExprClassFromMemberInfo): Pass location information.
19126 (Expression::ResolveLValue): Add new method that resolves an
19129 (Expression::DoResolveLValue): Default invocation calls
19132 (Indexers): New class used to keep track of indexers in a given
19135 (IStackStore): Renamed from LValue, as it did not really describe
19136 what this did. Also ResolveLValue is gone from this interface and
19137 now is part of Expression.
19139 (ElementAccess): Depending on the element access type
19141 * typemanager.cs: Add `indexer_name_type' as a Core type
19142 (System.Runtime.CompilerServices.IndexerNameAttribute)
19144 * statement.cs (Goto): Take a location.
19146 2001-10-18 Ravi Pratap <ravi@ximian.com>
19148 * delegate.cs (Delegate::VerifyDelegate): New method to verify
19149 if two delegates are compatible.
19151 (NewDelegate::DoResolve): Update to take care of the case when
19152 we instantiate a delegate from another delegate.
19154 * typemanager.cs (FindMembers): Don't even try to look up members
19155 of Delegate types for now.
19157 2001-10-18 Ravi Pratap <ravi@ximian.com>
19159 * delegate.cs (NewDelegate): New class to take care of delegate
19162 * expression.cs (New): Split the delegate related code out into
19163 the NewDelegate class.
19165 * delegate.cs (DelegateInvocation): New class to handle delegate
19168 * expression.cs (Invocation): Split out delegate related code into
19169 the DelegateInvocation class.
19171 2001-10-17 Ravi Pratap <ravi@ximian.com>
19173 * expression.cs (New::DoResolve): Implement delegate creation fully
19174 and according to the spec.
19176 (New::DoEmit): Update to handle delegates differently.
19178 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
19179 because of which we were printing out arguments in reverse order !
19181 * delegate.cs (VerifyMethod): Implement to check if the given method
19182 matches the delegate.
19184 (FullDelegateDesc): Implement.
19186 (VerifyApplicability): Implement.
19188 * expression.cs (Invocation::DoResolve): Update to accordingly handle
19189 delegate invocations too.
19191 (Invocation::Emit): Ditto.
19193 * ../errors/cs1593.cs : Added.
19195 * ../errors/cs1594.cs : Added.
19197 * delegate.cs (InstanceExpression, TargetMethod): New properties.
19199 2001-10-16 Ravi Pratap <ravi@ximian.com>
19201 * typemanager.cs (intptr_type): Core type for System.IntPtr
19203 (InitCoreTypes): Update for the same.
19205 (iasyncresult_type, asynccallback_type): Ditto.
19207 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
19210 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
19213 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
19214 the builders for the 4 members of a delegate type :-)
19216 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
19219 * expression.cs (New::DoResolve): Implement guts for delegate creation.
19221 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
19223 2001-10-15 Miguel de Icaza <miguel@ximian.com>
19225 * statement.cs (Break::Emit): Implement.
19226 (Continue::Emit): Implement.
19228 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
19229 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
19230 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
19231 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
19234 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
19235 properties that track the label for the current loop (begin of the
19236 loop and end of the loop).
19238 2001-10-15 Ravi Pratap <ravi@ximian.com>
19240 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
19241 use of emitting anything at all.
19243 * class.cs, rootcontext.cs : Get rid of calls to the same.
19245 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
19247 (Populate): Define the constructor correctly and set the implementation
19250 * typemanager.cs (delegate_types): New hashtable to hold delegates that
19253 (AddDelegateType): Implement.
19255 (IsDelegateType): Implement helper method.
19257 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
19259 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
19260 and accordingly handle it.
19262 * delegate.cs (Populate): Take TypeContainer argument.
19263 Implement bits to define the Invoke method. However, I still haven't figured out
19264 how to take care of the native int bit :-(
19266 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
19267 Qualify the name of the delegate, not its return type !
19269 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
19272 (StandardConversionExists): Checking for array types turns out to be recursive.
19274 (ConvertReferenceExplicit): Implement array conversion.
19276 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
19278 2001-10-12 Ravi Pratap <ravi@ximian.com>
19280 * cs-parser.jay (delegate_declaration): Store the fully qualified
19281 name as it is a type declaration.
19283 * delegate.cs (ReturnType, Name): Rename members to these. Make them
19286 (DefineDelegate): Renamed from Define. Does the same thing essentially,
19287 as TypeContainer::DefineType.
19289 (Populate): Method in which all the definition of the various methods (Invoke)
19292 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
19295 (CloseDelegate): Finally creates the delegate.
19297 * class.cs (TypeContainer::DefineType): Update to define delegates.
19298 (Populate, Emit and CloseType): Do the same thing here too.
19300 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
19301 delegates in all these operations.
19303 2001-10-14 Miguel de Icaza <miguel@ximian.com>
19305 * expression.cs: LocalTemporary: a new expression used to
19306 reference a temporary that has been created.
19308 * assign.cs: Handle PropertyAccess back here, so that we can
19309 provide the proper semantic access to properties.
19311 * expression.cs (Expression::ConvertReferenceExplicit): Implement
19312 a few more explicit conversions.
19314 * modifiers.cs: `NEW' modifier maps to HideBySig.
19316 * expression.cs (PropertyExpr): Make this into an
19317 ExpressionStatement, and support the EmitStatement code path.
19319 Perform get/set error checking, clean up the interface.
19321 * assign.cs: recognize PropertyExprs as targets, and if so, turn
19322 them into toplevel access objects.
19324 2001-10-12 Miguel de Icaza <miguel@ximian.com>
19326 * expression.cs: PropertyExpr::PropertyExpr: use work around the
19329 * typemanager.cs: Keep track here of our PropertyBuilders again to
19330 work around lameness in SRE.
19332 2001-10-11 Miguel de Icaza <miguel@ximian.com>
19334 * expression.cs (LValue::LValueResolve): New method in the
19335 interface, used to perform a second resolution pass for LValues.
19337 (This::DoResolve): Catch the use of this in static methods.
19339 (This::LValueResolve): Implement.
19341 (This::Store): Remove warning, assigning to `this' in structures
19344 (Invocation::Emit): Deal with invocation of
19345 methods on value types. We need to pass the address to structure
19346 methods rather than the object itself. (The equivalent code to
19347 emit "this" for structures leaves the entire structure on the
19348 stack instead of a pointer to it).
19350 (ParameterReference::DoResolve): Compute the real index for the
19351 argument based on whether the method takes or not a `this' pointer
19352 (ie, the method is static).
19354 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
19355 value types returned from functions when we need to invoke a
19356 method on the sturcture.
19359 2001-10-11 Ravi Pratap <ravi@ximian.com>
19361 * class.cs (TypeContainer::DefineType): Method to actually do the business of
19362 defining the type in the Modulebuilder or Typebuilder. This is to take
19363 care of nested types which need to be defined on the TypeBuilder using
19364 DefineNestedMethod.
19366 (TypeContainer::GetClassBases): Implement. Essentially the code from the
19367 methods in RootContext, only ported to be part of TypeContainer.
19369 (TypeContainer::GetInterfaceOrClass): Ditto.
19371 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
19373 * interface.cs (Interface::DefineInterface): New method. Does exactly
19374 what RootContext.CreateInterface did earlier, only it takes care of nested types
19377 (Interface::GetInterfaces): Move from RootContext here and port.
19379 (Interface::GetInterfaceByName): Same here.
19381 * rootcontext.cs (ResolveTree): Re-write.
19383 (PopulateTypes): Re-write.
19385 * class.cs (TypeContainer::Populate): Populate nested types too.
19386 (TypeContainer::Emit): Emit nested members too.
19388 * typemanager.cs (AddUserType): Do not make use of the FullName property,
19389 instead just use the name argument passed in as it is already fully
19392 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
19393 to TypeContainer mapping to see if a type is user-defined.
19395 * class.cs (TypeContainer::CloseType): Implement.
19397 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
19398 the default constructor.
19400 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
19403 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
19405 * interface.cs (CloseType): Create the type here.
19407 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
19410 Remove all the methods which are now in TypeContainer.
19412 2001-10-10 Ravi Pratap <ravi@ximian.com>
19414 * delegate.cs (Define): Re-write bits to define the delegate
19417 2001-10-10 Miguel de Icaza <miguel@ximian.com>
19419 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
19421 * expression.cs (ImplicitReferenceConversion): handle null as well
19422 as a source to convert to any reference type.
19424 * statement.cs (Return): Perform any implicit conversions to
19425 expected return type.
19427 Validate use of return statement.
19429 * codegen.cs (EmitContext): Pass the expected return type here.
19431 * class.cs (Method, Constructor, Property): Pass expected return
19432 type to EmitContext.
19434 2001-10-09 Miguel de Icaza <miguel@ximian.com>
19436 * expression.cs: Make DoResolve take an EmitContext instead of a
19439 Replaced `l' and `location' for `loc', for consistency.
19441 (Error, Warning): Remove unneeded Tc argument.
19443 * assign.cs, literal.cs, constant.cs: Update to new calling
19446 * codegen.cs: EmitContext now contains a flag indicating whether
19447 code is being generated in a static method or not.
19449 * cs-parser.jay: DecomposeQI, new function that replaces the old
19450 QualifiedIdentifier. Now we always decompose the assembled
19451 strings from qualified_identifier productions into a group of
19454 2001-10-08 Miguel de Icaza <miguel@ximian.com>
19456 * rootcontext.cs: Deal with field-less struct types correctly now
19457 by passing the size option to Define Type.
19459 * class.cs: Removed hack that created one static field.
19461 2001-10-07 Miguel de Icaza <miguel@ximian.com>
19463 * statement.cs: Moved most of the code generation here.
19465 2001-10-09 Ravi Pratap <ravi@ximian.com>
19467 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
19470 (ElementAccess): Remove useless bits for now - keep checks as the spec
19473 2001-10-08 Ravi Pratap <ravi@ximian.com>
19475 * expression.cs (ElementAccess::DoResolve): Remove my crap code
19476 and start performing checks according to the spec.
19478 2001-10-07 Ravi Pratap <ravi@ximian.com>
19480 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
19481 rank_specifiers instead.
19483 (rank_specifiers): Change the order in which the rank specifiers are stored
19485 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
19487 * expression.cs (ElementAccess): Implement the LValue interface too.
19489 2001-10-06 Ravi Pratap <ravi@ximian.com>
19491 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
19492 except that user defined conversions are not included.
19494 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
19495 perform the conversion of the return type, if necessary.
19497 (New::DoResolve): Check whether we are creating an array or an object
19498 and accordingly do the needful.
19500 (New::Emit): Same here.
19502 (New::DoResolve): Implement guts of array creation.
19504 (New::FormLookupType): Helper function.
19506 2001-10-07 Miguel de Icaza <miguel@ximian.com>
19508 * codegen.cs: Removed most of the code generation here, and move the
19509 corresponding code generation bits to the statement classes.
19511 Added support for try/catch/finalize and throw.
19513 * cs-parser.jay: Added support for try/catch/finalize.
19515 * class.cs: Catch static methods having the flags override,
19516 virtual or abstract.
19518 * expression.cs (UserCast): This user cast was not really doing
19519 what it was supposed to do. Which is to be born in fully resolved
19520 state. Parts of the resolution were being performed at Emit time!
19524 2001-10-05 Miguel de Icaza <miguel@ximian.com>
19526 * expression.cs: Implicity convert the result from UserCast.
19528 2001-10-05 Ravi Pratap <ravi@ximian.com>
19530 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
19531 prevented it from working correctly.
19533 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
19534 merely ConvertImplicit.
19536 2001-10-05 Miguel de Icaza <miguel@ximian.com>
19538 * typemanager.cs: Make the LookupTypeContainer function static,
19539 and not per-instance.
19541 * class.cs: Make static FindMembers (the one that takes a Type
19544 * codegen.cs: Add EmitForeach here.
19546 * cs-parser.jay: Make foreach a toplevel object instead of the
19547 inline expansion, as we need to perform semantic analysis on it.
19549 2001-10-05 Ravi Pratap <ravi@ximian.com>
19551 * expression.cs (Expression::ImplicitUserConversion): Rename to
19552 UserDefinedConversion.
19554 (Expression::UserDefinedConversion): Take an extra argument specifying
19555 whether we look for explicit user conversions too.
19557 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
19559 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
19561 (ExplicitUserConversion): Make it a call to UserDefinedConversion
19562 with the appropriate arguments.
19564 * cs-parser.jay (cast_expression): Record location too.
19566 * expression.cs (Cast): Record location info.
19568 (Expression::ConvertExplicit): Take location argument.
19570 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
19571 to determine if we are doing explicit conversions.
19573 (UserCast::Emit): Update accordingly.
19575 (Expression::ConvertExplicit): Report an error if everything fails.
19577 * ../errors/cs0030.cs : Add.
19579 2001-10-04 Miguel de Icaza <miguel@ximian.com>
19581 * modifiers.cs: If the ABSTRACT keyword is present, also set the
19582 virtual and newslot bits.
19584 * class.cs (TypeContainer::RegisterRequiredImplementations):
19585 Record methods we need.
19587 (TypeContainer::MakeKey): Helper function to make keys for
19588 MethodBases, since the Methodbase key is useless.
19590 (TypeContainer::Populate): Call RegisterRequiredImplementations
19591 before defining the methods.
19593 Create a mapping for method_builders_to_methods ahead of time
19594 instead of inside a tight loop.
19596 (::RequireMethods): Accept an object as the data to set into the
19597 hashtable so we can report interface vs abstract method mismatch.
19599 2001-10-03 Miguel de Icaza <miguel@ximian.com>
19601 * report.cs: Make all of it static.
19603 * rootcontext.cs: Drop object_type and value_type computations, as
19604 we have those in the TypeManager anyways.
19606 Drop report instance variable too, now it is a global.
19608 * driver.cs: Use try/catch on command line handling.
19610 Add --probe option to debug the error reporting system with a test
19613 * report.cs: Add support for exiting program when a probe
19614 condition is reached.
19616 2001-10-03 Ravi Pratap <ravi@ximian.com>
19618 * expression.cs (Binary::DoNumericPromotions): Fix the case when
19619 we do a forcible conversion regardless of type, to check if
19620 ForceConversion returns a null.
19622 (Binary::error19): Use location to report error.
19624 (Unary::error23): Use location here too.
19626 * ../errors/cs0019.cs : Check in.
19628 * ../errors/cs0023.cs : Check in.
19630 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
19631 case of a non-null MethodInfo object with a length of 0 !
19633 (Binary::ResolveOperator): Flag error if overload resolution fails to find
19634 an applicable member - according to the spec :-)
19635 Also fix logic to find members in base types.
19637 (Unary::ResolveOperator): Same here.
19639 (Unary::report23): Change name to error23 and make first argument a TypeContainer
19640 as I was getting thoroughly confused between this and error19 :-)
19642 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
19643 (::FindMostEncompassedType): Implement.
19644 (::FindMostEncompassingType): Implement.
19645 (::StandardConversionExists): Implement.
19647 (UserImplicitCast): Re-vamp. We now need info about most specific
19648 source and target types so that we can do the necessary conversions.
19650 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
19651 mathematical union with no duplicates.
19653 2001-10-03 Miguel de Icaza <miguel@ximian.com>
19655 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
19656 in order from base classes to child classes, so that we can in
19657 child classes look up in our parent for method names and
19658 attributes (required for handling abstract, virtual, new, override
19659 constructs: we need to instrospect our base class, and if we dont
19660 populate the classes in order, the introspection might be
19661 incorrect. For example, a method could query its parent before
19662 the parent has any methods and would determine that the parent has
19663 no abstract methods (while it could have had them)).
19665 (RootContext::CreateType): Record the order in which we define the
19668 2001-10-02 Miguel de Icaza <miguel@ximian.com>
19670 * class.cs (TypeContainer::Populate): Also method definitions can
19671 fail now, keep track of this.
19673 (TypeContainer::FindMembers): Implement support for
19674 DeclaredOnly/noDeclaredOnly flag.
19676 (Constructor::Emit) Return the ConstructorBuilder.
19678 (Method::Emit) Return the MethodBuilder.
19679 Check for abstract or virtual methods to be public.
19681 * rootcontext.cs (RootContext::CreateType): Register all the
19682 abstract methods required for the class to be complete and the
19683 interface methods that must be implemented.
19685 * cs-parser.jay: Report error 501 (method requires body if it is
19686 not marked abstract or extern).
19688 * expression.cs (TypeOf::Emit): Implement.
19690 * typemanager.cs: runtime_handle_type, new global type.
19692 * class.cs (Property::Emit): Generate code for properties.
19694 2001-10-02 Ravi Pratap <ravi@ximian.com>
19696 * expression.cs (Unary::ResolveOperator): Find operators on base type
19697 too - we now conform exactly to the spec.
19699 (Binary::ResolveOperator): Same here.
19701 * class.cs (Operator::Define): Fix minor quirk in the tests.
19703 * ../errors/cs0215.cs : Added.
19705 * ../errors/cs0556.cs : Added.
19707 * ../errors/cs0555.cs : Added.
19709 2001-10-01 Miguel de Icaza <miguel@ximian.com>
19711 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
19712 single integer which is really efficient
19714 2001-10-01 Ravi Pratap <ravi@ximian.com>
19716 * expression.cs (Expression::ImplicitUserConversion): Use location
19717 even in the case when we are examining True operators.
19719 * class.cs (Operator::Define): Perform extensive checks to conform
19720 with the rules for operator overloading in the spec.
19722 * expression.cs (Expression::ImplicitReferenceConversion): Implement
19723 some of the other conversions mentioned in the spec.
19725 * typemanager.cs (array_type): New static member for the System.Array built-in
19728 (cloneable_interface): For System.ICloneable interface.
19730 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
19731 we start resolving the tree and populating types.
19733 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
19735 2001-10-01 Miguel de Icaza <miguel@ximian.com>
19737 * expression.cs (Expression::ExprClassFromMemberInfo,
19738 Expression::Literalize): Create literal expressions from
19739 FieldInfos which are literals.
19741 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
19742 type casts, because they were wrong. The test suite in tests
19745 (ImplicitNumericConversion): ushort to ulong requires a widening
19748 Int32 constant to long requires widening cast as well.
19750 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
19751 for integers because the type on the stack is not i4.
19753 2001-09-30 Miguel de Icaza <miguel@ximian.com>
19755 * expression.cs (report118): require location argument.
19757 * parameter.cs: Do not dereference potential null value.
19759 * class.cs: Catch methods that lack the `new' keyword when
19760 overriding a name. Report warnings when `new' is used without
19761 anything being there to override.
19763 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
19765 * class.cs: Only add constructor to hashtable if it is non-null
19766 (as now constructors can fail on define).
19768 (TypeManager, Class, Struct): Take location arguments.
19770 Catch field instance initialization in structs as errors.
19772 accepting_filter: a new filter for FindMembers that is static so
19773 that we dont create an instance per invocation.
19775 (Constructor::Define): Catch errors where a struct constructor is
19778 * cs-parser.jay: Pass location information for various new
19781 * delegate.cs (Delegate): take a location argument.
19783 * driver.cs: Do not call EmitCode if there were problesm in the
19784 Definition of the types, as many Builders wont be there.
19786 * decl.cs (Decl::Decl): Require a location argument.
19788 * cs-tokenizer.cs: Handle properly hex constants that can not fit
19789 into integers, and find the most appropiate integer for it.
19791 * literal.cs: Implement ULongLiteral.
19793 * rootcontext.cs: Provide better information about the location of
19794 failure when CreateType fails.
19796 2001-09-29 Miguel de Icaza <miguel@ximian.com>
19798 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
19801 * expression.cs (Binary::CheckShiftArguments): Add missing type
19803 (Binary::ResolveOperator): Add type to the logical and and logical
19804 or, Bitwise And/Or and Exclusive Or code paths, it was missing
19807 (Binary::DoNumericPromotions): In the case where either argument
19808 is ulong (and most signed types combined with ulong cause an
19809 error) perform implicit integer constant conversions as well.
19811 2001-09-28 Miguel de Icaza <miguel@ximian.com>
19813 * expression.cs (UserImplicitCast): Method should always be
19815 (Invocation::BetterConversion): Simplified test for IntLiteral.
19817 (Expression::ImplicitNumericConversion): Split this routine out.
19818 Put the code that performs implicit constant integer conversions
19821 (Expression::Resolve): Become a wrapper around DoResolve so we can
19822 check eclass and type being set after resolve.
19824 (Invocation::Badness): Remove this dead function
19826 (Binary::ResolveOperator): Do not compute the expensive argumnets
19827 unless we have a union for it.
19829 (Probe::Emit): Is needs to do an isinst and then
19830 compare against null.
19832 (::CanConvert): Added Location argument. If the Location argument
19833 is null (Location.Null), then we do not report errors. This is
19834 used by the `probe' mechanism of the Explicit conversion. We do
19835 not want to generate an error for something that the user
19836 explicitly requested to be casted. But the pipeline for an
19837 explicit cast first tests for potential implicit casts.
19839 So for now, if the Location is null, it means `Probe only' to
19840 avoid adding another argument. Might have to revise this
19843 (ClassCast): New class used to type cast objects into arbitrary
19844 classes (used in Explicit Reference Conversions).
19846 Implement `as' as well.
19848 Reverted all the patches from Ravi below: they were broken:
19850 * The use of `level' as a mechanism to stop recursive
19851 invocations is wrong. That was there just to catch the
19852 bug with a strack trace but not as a way of addressing
19855 To fix the problem we have to *understand* what is going
19856 on and the interactions and come up with a plan, not
19857 just get things going.
19859 * The use of the type conversion cache that I proposed
19860 last night had an open topic: How does this work across
19861 protection domains. A user defined conversion might not
19862 be public in the location where we are applying the
19863 conversion, a different conversion might be selected
19864 (ie, private A->B (better) but public B->A (worse),
19865 inside A, A->B applies, but outside it, B->A will
19868 * On top of that (ie, even if the above is solved),
19869 conversions in a cache need to be abstract. Ie, `To
19870 convert from an Int to a Short use an OpcodeCast', not
19871 `To convert from an Int to a Short use the OpcodeCast on
19872 the variable 5' (which is what this patch was doing).
19874 2001-09-28 Ravi Pratap <ravi@ximian.com>
19876 * expression.cs (Invocation::ConversionExists): Re-write to use
19877 the conversion cache
19879 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
19880 cache all conversions done, not just user-defined ones.
19882 (Invocation::BetterConversion): The real culprit. Use ConversionExists
19883 to determine if a conversion exists instead of acutually trying to
19884 perform the conversion. It's faster too.
19886 (Expression::ConvertExplicit): Modify to use ConversionExists to check
19887 and only then attempt the implicit conversion.
19889 2001-09-28 Ravi Pratap <ravi@ximian.com>
19891 * expression.cs (ConvertImplicit): Use a cache for conversions
19892 already found. Check level of recursion and bail out if necessary.
19894 2001-09-28 Miguel de Icaza <miguel@ximian.com>
19896 * typemanager.cs (string_concat_string_string, string_concat_object_object):
19897 Export standard methods that we expect for string operations.
19899 * statement.cs (Block::UsageWarning): Track usage of variables and
19900 report the errors for not used variables.
19902 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
19905 2001-09-27 Miguel de Icaza <miguel@ximian.com>
19907 * codegen.cs: remove unnneded code
19909 * expression.cs: Removed BuiltinTypeAccess class
19911 Fix the order in which implicit conversions are
19914 The previous fixed dropped support for boxed conversions (adding a
19915 test to the test suite now)
19917 (UserImplicitCast::CanConvert): Remove test for source being null,
19918 that code is broken. We should not feed a null to begin with, if
19919 we do, then we should track the bug where the problem originates
19920 and not try to cover it up here.
19922 Return a resolved expression of type UserImplicitCast on success
19923 rather than true/false. Ravi: this is what I was talking about,
19924 the pattern is to use a static method as a "constructor" for
19927 Also, do not create arguments until the very last minute,
19928 otherwise we always create the arguments even for lookups that
19929 will never be performed.
19931 (UserImplicitCast::Resolve): Eliminate, objects of type
19932 UserImplicitCast are born in a fully resolved state.
19934 * typemanager.cs (InitCoreTypes): Init also value_type
19935 (System.ValueType).
19937 * expression.cs (Cast::Resolve): First resolve the child expression.
19939 (LValue): Add new method AddressOf to be used by
19942 Change the argument of Store to take an EmitContext instead of an
19943 ILGenerator, because things like FieldExpr need to be able to call
19944 their children expression to generate the instance code.
19946 (Expression::Error, Expression::Warning): Sugar functions for
19949 (Expression::MemberLookup): Accept a TypeContainer instead of a
19950 Report as the first argument.
19952 (Expression::ResolvePrimary): Killed. I still want to improve
19953 this as currently the code is just not right.
19955 (Expression::ResolveMemberAccess): Simplify, but it is still
19958 (Unary::Resolve): Catch errors in AddressOf operators.
19960 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
19961 index to a byte for the short-version, or the compiler will choose
19962 the wrong Emit call, which generates the wrong data.
19964 (ParameterReference::Emit, ::Store): same.
19966 (FieldExpr::AddressOf): Implement.
19968 * typemanager.cs: TypeManager: made public variable instead of
19971 * driver.cs: document --fatal.
19973 * report.cs (ErrorMessage, WarningMessage): new names for the old
19974 Error and Warning classes.
19976 * cs-parser.jay (member_access): Turn built-in access to types
19977 into a normal simplename
19979 2001-09-27 Ravi Pratap <ravi@ximian.com>
19981 * expression.cs (Invocation::BetterConversion): Fix to cope
19982 with q being null, since this was introducing a bug.
19984 * expression.cs (ConvertImplicit): Do built-in conversions first.
19986 2001-09-27 Ravi Pratap <ravi@ximian.com>
19988 * expression.cs (UserImplicitCast::Resolve): Fix bug.
19990 2001-09-27 Ravi Pratap <ravi@ximian.com>
19992 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
19993 I had introduced long ago (what's new ?).
19995 * expression.cs (UserImplicitCast::CanConvert): Static method to do
19996 the work of all the checking.
19997 (ConvertImplicit): Call CanConvert and only then create object if necessary.
19998 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
20000 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
20001 that is the right way.
20003 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
20004 overloading resolution. Use everywhere instead of cutting and pasting code.
20006 (Binary::ResolveOperator): Use MakeUnionSet.
20008 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
20009 we have to convert to bool types. Not complete yet.
20011 2001-09-27 Miguel de Icaza <miguel@ximian.com>
20013 * typemanager.cs (TypeManager::CSharpName): support ushort.
20015 * expression.cs (Expression::TryImplicitIntConversion): Attempts
20016 to provide an expression that performsn an implicit constant int
20017 conversion (section 6.1.6).
20018 (Expression::ConvertImplicitRequired): Reworked to include
20019 implicit constant expression conversions.
20021 (Expression::ConvertNumericExplicit): Finished.
20023 (Invocation::Emit): If InstanceExpression is null, then it means
20024 that we perform a call on this.
20026 2001-09-26 Miguel de Icaza <miguel@ximian.com>
20028 * expression.cs (Unary::Emit): Remove some dead code.
20029 (Probe): Implement Resolve and Emit for `is'.
20030 (Expression::ConvertImplicitRequired): Attempt to do constant
20031 expression conversions here. Maybe should be moved to
20032 ConvertImplicit, but I am not sure.
20033 (Expression::ImplicitLongConstantConversionPossible,
20034 Expression::ImplicitIntConstantConversionPossible): New functions
20035 that tell whether is it possible to apply an implicit constant
20036 expression conversion.
20038 (ConvertNumericExplicit): Started work on explicit numeric
20041 * cs-parser.jay: Update operator constants.
20043 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
20044 (Parameters::GetSignature): Hook up VerifyArgs here.
20045 (Parameters::VerifyArgs): Verifies that no two arguments have the
20048 * class.cs (Operator): Update the operator names to reflect the
20049 ones that the spec expects (as we are just stringizing the
20052 * expression.cs (Unary::ResolveOperator): Fix bug: Use
20053 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
20054 previous usage did only work for our methods.
20055 (Expression::ConvertImplicit): Handle decimal implicit numeric
20056 conversions as well.
20057 (Expression::InternalTypeConstructor): Used to invoke constructors
20058 on internal types for default promotions.
20060 (Unary::Emit): Implement special handling for the pre/post
20061 increment/decrement for overloaded operators, as they need to have
20062 the same semantics as the other operators.
20064 (Binary::ResolveOperator): ditto.
20065 (Invocation::ConversionExists): ditto.
20066 (UserImplicitCast::Resolve): ditto.
20068 2001-09-26 Ravi Pratap <ravi@ximian.com>
20070 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
20071 operator, return after emitting body. Regression tests pass again !
20073 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
20074 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
20075 (Invocation::OverloadResolve): Ditto.
20076 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
20078 * everywhere : update calls to the above methods accordingly.
20080 2001-09-26 Miguel de Icaza <miguel@ximian.com>
20082 * assign.cs (Assign): Make it inherit from ExpressionStatement.
20084 * expression.cs (ExpressionStatement): New base class used for
20085 expressions that can appear in statements, so that we can provide
20086 an alternate path to generate expression that do not leave a value
20089 (Expression::Emit, and all the derivatives): We no longer return
20090 whether a value is left on the stack or not. Every expression
20091 after being emitted leaves a single value on the stack.
20093 * codegen.cs (EmitContext::EmitStatementExpression): Use the
20094 facilties of ExpressionStatement if possible.
20096 * cs-parser.jay: Update statement_expression.
20098 2001-09-25 Miguel de Icaza <miguel@ximian.com>
20100 * driver.cs: Change the wording of message
20102 2001-09-25 Ravi Pratap <ravi@ximian.com>
20104 * expression.cs (Binary::ResolveOperator): Had forgottten to set
20105 the type of the expression to the return type of the method if
20106 we have an overloaded operator match ! The regression tests pass again !
20107 (Unary::ResolveOperator): Ditto.
20109 * expression.cs (Invocation::ConversionExists): Correct the member lookup
20110 to find "op_Implicit", not "implicit" ;-)
20111 (UserImplicitCast): New class to take care of user-defined implicit conversions.
20112 (ConvertImplicit, ForceConversion): Take TypeContainer argument
20114 * everywhere : Correct calls to the above accordingly.
20116 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
20117 (ConvertImplicit): Do user-defined conversion if it exists.
20119 2001-09-24 Miguel de Icaza <miguel@ximian.com>
20121 * assign.cs: track location.
20122 (Resolve): Use implicit conversions on assignment.
20124 * literal.cs: Oops. Not good, Emit of short access values should
20125 pass (Bytes) or the wrong argument will be selected.
20127 * expression.cs (Unary::Emit): Emit code for -expr.
20129 (Unary::ResolveOperator): Handle `Substract' for non-constants
20130 (substract from zero from the non-constants).
20131 Deal with Doubles as well.
20133 (Expression::ConvertImplicitRequired): New routine that reports an
20134 error if no implicit conversion exists.
20136 (Invocation::OverloadResolve): Store the converted implicit
20137 expressions if we make them
20139 2001-09-24 Ravi Pratap <ravi@ximian.com>
20141 * class.cs (ConstructorInitializer): Take a Location argument.
20142 (ConstructorBaseInitializer): Same here.
20143 (ConstructorThisInitializer): Same here.
20145 * cs-parser.jay : Update all calls accordingly.
20147 * expression.cs (Unary, Binary, New): Take location argument.
20148 Update accordingly everywhere.
20150 * cs-parser.jay : Update all calls to the above to take a location
20153 * class.cs : Ditto.
20155 2001-09-24 Ravi Pratap <ravi@ximian.com>
20157 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
20158 (Invocation::BetterConversion): Same here
20159 (Invocation::ConversionExists): Ditto.
20161 (Invocation::ConversionExists): Implement.
20163 2001-09-22 Ravi Pratap <ravi@ximian.com>
20165 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
20166 Also take an additional TypeContainer argument.
20168 * All over : Pass in TypeContainer as argument to OverloadResolve.
20170 * typemanager.cs (CSharpName): Update to check for the string type and return
20173 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
20176 2001-09-21 Ravi Pratap <ravi@ximian.com>
20178 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
20179 (Invocation::BetterFunction): Implement.
20180 (Invocation::BetterConversion): Implement.
20181 (Invocation::ConversionExists): Skeleton, no implementation yet.
20183 Okay, things work fine !
20185 2001-09-21 Miguel de Icaza <miguel@ximian.com>
20187 * typemanager.cs: declare and load enum_type, delegate_type and
20190 * expression.cs (Expression::Emit): Now emit returns a value that
20191 tells whether a value is left on the stack or not. This strategy
20192 might be reveted tomorrow with a mechanism that would address
20193 multiple assignments.
20194 (Expression::report118): Utility routine to report mismatches on
20197 (Unary::Report23): Report impossible type/operator combination
20200 (Unary::IsIncrementableNumber): Whether the type can be
20201 incremented or decremented with add.
20202 (Unary::ResolveOperator): Also allow enumerations to be bitwise
20204 (Unary::ResolveOperator): Implement ++, !, ~,
20206 (Invocation::Emit): Deal with new Emit convetion.
20208 * All Expression derivatives: Updated their Emit method to return
20209 whether they leave values on the stack or not.
20211 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
20212 stack for expressions that are statements.
20214 2001-09-20 Miguel de Icaza <miguel@ximian.com>
20216 * expression.cs (LValue): New interface. Must be implemented by
20218 (LocalVariableReference, ParameterReference, FieldExpr): Implement
20221 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
20222 interface for generating code, simplifies the code.
20224 2001-09-20 Ravi Pratap <ravi@ximian.com>
20226 * expression.cs (everywhere): Comment out return statements in ::Resolve
20227 methods to avoid the warnings.
20229 2001-09-20 Miguel de Icaza <miguel@ximian.com>
20231 * driver.cs (parse): Report error 2001 if we can not open the
20234 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
20237 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
20240 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
20241 otherwise nested blocks end up with the same index.
20243 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
20245 * expression.cs: Instead of having FIXMEs in the Resolve
20246 functions, throw exceptions so it is obvious that we are facing a
20249 * cs-parser.jay (invocation_expression): Pass Location information.
20251 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
20252 Use a basename for those routines because .NET does not like paths
20255 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
20258 2001-09-19 Miguel de Icaza <miguel@ximian.com>
20260 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
20261 are loading the correct data types (throws an exception if not).
20262 (TypeManager::InitCoreTypes): Use CoreLookupType
20264 * expression.cs (Unary::ResolveOperator): return the child
20265 expression for expressions which are just +expr.
20266 (Unary::ResolveOperator): Return negative literals for -LITERAL
20267 expressions (otherwise they are Unary {Literal}).
20268 (Invocation::Badness): Take into account `Implicit constant
20269 expression conversions'.
20271 * literal.cs (LongLiteral): Implement long literal class.
20272 (IntLiteral): export the `Value' of the intliteral.
20274 2001-09-19 Ravi Pratap <ravi@ximian.com>
20276 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
20278 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
20279 instead of 'Operator'
20281 * expression.cs (Binary::ResolveOperator): Update accordingly.
20282 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
20285 * cs-parser.jay (unary_expression): Update to use the new names.
20287 * gen-treedump.cs (GetUnary): Same here.
20289 * expression.cs (Unary::Resolve): Implement.
20290 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
20291 operators are found instead of making noise ;-)
20292 (Unary::ResolveOperator): New method to do precisely the same thing which
20293 Binary::ResolveOperator does for Binary expressions.
20294 (Unary.method, .Arguments): Add.
20295 (Unary::OperName): Implement.
20296 (Unary::ForceConversion): Copy and Paste !
20298 * class.cs (Operator::Define): Fix a small bug for the case when we have
20301 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
20302 for the inbuilt operators. Only overloading works for now ;-)
20304 2001-09-18 Miguel de Icaza <miguel@ximian.com>
20306 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
20307 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
20309 * expression.cs (This::Emit): Implement.
20310 (This::Resolve): Implement.
20311 (TypeOf:Resolve): Implement.
20312 (Expression::ResolveSimpleName): Add an implicit this to instance
20314 (MemberAccess::Resolve): Deal with Parameters and Fields.
20315 Bind instance variable to Field expressions.
20316 (FieldExpr::Instance): New field used to track the expression that
20317 represents the object instance.
20318 (FieldExpr::Resolve): Track potential errors from MemberLookup not
20320 (FieldExpr::Emit): Implement.
20322 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
20323 the last instruction contains a return opcode to avoid generating
20324 the last `ret' instruction (this generates correct code, and it is
20325 nice to pass the peverify output).
20327 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
20328 initializer for static and instance variables.
20329 (Constructor::Emit): Allow initializer to be null in the case of
20330 static constructors. Only emit initializer for instance
20333 (TypeContainer::FindMembers): Return a null array if there are no
20336 Also fix the code for the MemberTypes.Method branch, as it was not
20337 scanning that for operators (or tried to access null variables before).
20339 * assign.cs (Assign::Emit): Handle instance and static fields.
20343 * driver.cs: Stop compilation if there are parse errors.
20345 * cs-parser.jay (constructor_declaration): Provide default base
20346 initializer for non-static constructors.
20347 (constructor_declarator): Do not provide a default base
20348 initializers if none was specified.
20349 Catch the fact that constructors should not have parameters.
20351 * class.cs: Do not emit parent class initializers for static
20352 constructors, that should be flagged as an error.
20354 2001-09-18 Ravi Pratap <ravi@ximian.com>
20356 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
20357 Move back code into TypeContainer::Populate.
20359 2001-09-18 Ravi Pratap <ravi@ximian.com>
20361 * class.cs (TypeContainer::AddConstructor): Fix the check to
20362 compare against Name, not Basename.
20363 (Operator::OpType): Change Plus and Minus to Add and Subtract.
20365 * cs-parser.jay : Update accordingly.
20367 * class.cs (TypeContainer::FindMembers): For the case where we are searching
20368 for methods, don't forget to look into the operators too.
20369 (RegisterMethodBuilder): Helper method to take care of this for
20370 methods, constructors and operators.
20371 (Operator::Define): Completely revamp.
20372 (Operator.OperatorMethod, MethodName): New fields.
20373 (TypeContainer::Populate): Move the registering of builders into
20374 RegisterMethodBuilder.
20375 (Operator::Emit): Re-write.
20377 * expression.cs (Binary::Emit): Comment out code path to emit method
20378 invocation stuff for the case when we have a user defined operator. I am
20379 just not able to get it right !
20381 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20383 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
20386 (Expression::MemberLookup): Provide a version that allows to
20387 specify the MemberTypes and BindingFlags.
20389 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
20390 so it was not fetching variable information from outer blocks.
20392 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
20393 Beforefieldinit as it was buggy.
20395 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
20396 that Ravi put here.
20398 * class.cs (Constructor::Emit): Only emit if block is not null.
20399 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
20400 deal with this by semantically definining it as if the user had
20403 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
20404 constructors as we now "emit" them at a higher level.
20406 (TypeContainer::DefineDefaultConstructor): Used to define the
20407 default constructors if none was provided.
20409 (ConstructorInitializer): Add methods Resolve and Emit.
20411 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
20413 2001-09-17 Ravi Pratap <ravi@ximian.com>
20415 * class.cs (TypeContainer::EmitDefaultConstructor): Register
20416 the default constructor builder with our hashtable for methodbuilders
20419 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
20420 and argument_count is 0 in which case we have a match.
20421 (Binary::ResolveOperator): More null checking and miscellaneous coding
20424 2001-09-17 Ravi Pratap <ravi@ximian.com>
20426 * rootcontext.cs (IsNameSpace): Compare against null.
20428 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
20430 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
20431 and Unary::Operator.
20433 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
20436 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
20437 we have overloaded operators.
20438 (Binary::ResolveOperator): Implement the part which does the operator overload
20441 * class.cs (Operator::Emit): Implement.
20442 (TypeContainer::Emit): Emit the operators we have too.
20444 * expression.cs (Binary::Emit): Update to emit the appropriate code for
20445 the case when we have a user-defined operator.
20447 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20449 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
20451 2001-09-16 Ravi Pratap <ravi@ximian.com>
20453 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
20454 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
20455 (Constructor::Emit): Implement.
20456 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
20457 if we have no work to do.
20458 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
20461 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
20462 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
20464 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
20467 2001-09-15 Ravi Pratap <ravi@ximian.com>
20469 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
20471 (Tree::RecordNamespace): Method to do what the name says ;-)
20472 (Tree::Namespaces): Property to get at the namespaces hashtable.
20474 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
20477 * rootcontext.cs (IsNamespace): Fixed it :-)
20479 2001-09-14 Miguel de Icaza <miguel@ximian.com>
20481 * class.cs (TypeContainer::FindMembers): Add support for
20483 (MethodCore): New class that encapsulates both the shared aspects
20484 of a Constructor and a Method.
20485 (Method, Constructor): Factored pieces into MethodCore.
20487 * driver.cs: Added --fatal which makes errors throw exceptions.
20488 Load System assembly as well as part of the standard library.
20490 * report.cs: Allow throwing exceptions on errors for debugging.
20492 * modifiers.cs: Do not use `parent', instead use the real type
20493 container to evaluate permission settings.
20495 * class.cs: Put Ravi's patch back in. He is right, and we will
20496 have to cope with the
20498 2001-09-14 Ravi Pratap <ravi@ximian.com>
20500 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
20501 FamORAssem, not FamANDAssem.
20503 2001-09-14 Miguel de Icaza <miguel@ximian.com>
20505 * driver.cs: Added --parse option that only parses its input files
20508 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
20509 incorrect. IsTopLevel is not used to tell whether an object is
20510 root_types or not (that can be achieved by testing this ==
20511 root_types). But to see if this is a top-level *class* (not
20512 necessarly our "toplevel" container).
20514 2001-09-14 Ravi Pratap <ravi@ximian.com>
20516 * enum.cs (Enum::Define): Modify to call the Lookup method on the
20517 parent instead of a direct call to GetType.
20519 2001-09-14 Ravi Pratap <ravi@ximian.com>
20521 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
20522 Modifiers.TypeAttr. This should just be a call to that method.
20524 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
20525 object so that we can determine if we are top-level or not.
20527 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
20530 * enum.cs (Enum::Define): Ditto.
20532 * modifiers.cs (FieldAttr): Re-write.
20534 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
20535 (TypeContainer::HaveStaticConstructor): New property to provide access
20536 to precisely that info.
20538 * modifiers.cs (MethodAttr): Re-write.
20539 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
20541 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
20542 of top-level types as claimed.
20544 2001-09-13 Miguel de Icaza <miguel@ximian.com>
20546 * expression.cs (MemberLookup): Fruitless attempt to lookup
20547 constructors. Maybe I need to emit default constructors? That
20548 might be it (currently .NET emits this for me automatically).
20549 (Invocation::OverloadResolve): Cope with Arguments == null.
20550 (Invocation::EmitArguments): new function, shared by the new
20551 constructor and us.
20552 (Invocation::Emit): Handle static and instance methods. Emit
20553 proper call instruction for virtual or non-virtual invocations.
20554 (New::Emit): Implement.
20555 (New::Resolve): Implement.
20556 (MemberAccess:Resolve): Implement.
20557 (MethodGroupExpr::InstanceExpression): used conforming to the spec
20558 to track instances.
20559 (FieldExpr::Resolve): Set type.
20561 * support.cs: Handle empty arguments.
20563 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
20564 SimpleLookup): Auxiliary routines to help parse a qualifier
20567 Update qualifier_identifier rule.
20569 * codegen.cs: Removed debugging messages.
20571 * class.cs: Make this a global thing, this acts just as a "key" to
20572 objects that we might have around.
20574 (Populate): Only initialize method_builders_to_methods once.
20576 * expression.cs (PropertyExpr): Initialize type from the
20579 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
20580 Resolve pattern. Attempt to implicitly convert value to boolean.
20583 * expression.cs: Set the type for the int32/int32 argument case.
20584 (Binary::ResolveOperator): Set the return type to boolean for
20585 comparission operators
20587 * typemanager.cs: Remove debugging print code.
20589 (Invocation::Resolve): resolve type.
20591 * class.cs: Allocate a MemberInfo of the correct size, as the code
20592 elsewhere depends on the test to reflect the correct contents.
20594 (Method::) Keep track of parameters, due to System.Reflection holes
20596 (TypeContainer::Populate): Keep track of MethodBuilders to Method
20599 (TypeContainer::FindMembers): Use ArrayList and then copy an array
20600 of the exact size and return that.
20602 (Class::LookupMethodByBuilder): New function that maps
20603 MethodBuilders to its methods. Required to locate the information
20604 on methods because System.Reflection bit us again.
20606 * support.cs: New file, contains an interface ParameterData and
20607 two implementations: ReflectionParameters and InternalParameters
20608 used to access Parameter information. We will need to grow this
20611 * expression.cs (Invocation::GetParameterData): implement a cache
20612 and a wrapper around the ParameterData creation for methods.
20613 (Invocation::OverloadResolve): Use new code.
20615 2001-09-13 Ravi Pratap <ravi@ximian.com>
20617 * class.cs (TypeContainer::EmitField): Remove and move into
20618 (Field::Define): here and modify accordingly.
20619 (Field.FieldBuilder): New member.
20620 (TypeContainer::Populate): Update accordingly.
20621 (TypeContainer::FindMembers): Implement.
20623 2001-09-13 Miguel de Icaza <miguel@ximian.com>
20625 * statement.cs: (VariableInfo::VariableType): New field to be
20626 initialized with the full type once it is resolved.
20628 2001-09-12 Miguel de Icaza <miguel@ximian.com>
20630 * parameter.cs (GetParameterInfo): Use a type cache to compute
20631 things only once, and to reuse this information
20633 * expression.cs (LocalVariableReference::Emit): Implement.
20634 (OpcodeCast::Emit): fix.
20636 (ParameterReference::Resolve): Implement.
20637 (ParameterReference::Emit): Implement.
20639 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
20640 that are expressions need to stay as Expressions.
20642 * typemanager.cs (CSharpName): Returns the C# name of a type if
20645 * expression.cs (Expression::ConvertImplicit): New function that
20646 implements implicit type conversions.
20648 (Expression::ImplicitReferenceConversion): Implements implicit
20649 reference conversions.
20651 (EmptyCast): New type for transparent casts.
20653 (OpcodeCast): New type for casts of types that are performed with
20654 a sequence of bytecodes.
20656 (BoxedCast): New type used for casting value types into reference
20657 types. Emits a box opcode.
20659 (Binary::DoNumericPromotions): Implements numeric promotions of
20660 and computation of the Binary::Type.
20662 (Binary::EmitBranchable): Optimization.
20664 (Binary::Emit): Implement code emission for expressions.
20666 * typemanager.cs (TypeManager): Added two new core types: sbyte
20669 2001-09-12 Ravi Pratap <ravi@ximian.com>
20671 * class.cs (TypeContainer::FindMembers): Method which does exactly
20672 what Type.FindMembers does, only we don't have to use reflection. No
20673 implementation yet.
20675 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
20676 typecontainer objects as we need to get at them.
20677 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
20679 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
20680 typecontainer object.
20682 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
20683 of just a Report object.
20685 2001-09-11 Ravi Pratap <ravi@ximian.com>
20687 * class.cs (Event::Define): Go back to using the prefixes "add_" and
20689 (TypeContainer::Populate): Now define the delegates of the type too.
20690 (TypeContainer.Delegates): Property to access the list of delegates defined
20693 * delegates.cs (Delegate::Define): Implement partially.
20695 * modifiers.cs (TypeAttr): Handle more flags.
20697 2001-09-11 Ravi Pratap <ravi@ximian.com>
20699 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
20701 (Operator::Define): Re-write logic to get types by using the LookupType method
20702 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
20703 (Indexer::Define): Ditto.
20704 (Event::Define): Ditto.
20705 (Property::Define): Ditto.
20707 2001-09-10 Ravi Pratap <ravi@ximian.com>
20709 * class.cs (TypeContainer::Populate): Now define operators too.
20710 (TypeContainer.Operators): New property to access the list of operators
20712 (Operator.OperatorMethodBuilder): New member to hold the method builder
20713 for the operator we are defining.
20714 (Operator::Define): Implement.
20716 2001-09-10 Ravi Pratap <ravi@ximian.com>
20718 * class.cs (Event::Define): Make the prefixes of the accessor methods
20719 addOn_ and removeOn_
20721 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
20722 of the location being passed in too. Ideally, this should go later since all
20723 error reporting should be done through the Report object.
20725 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
20726 (Populate): Iterate thru the indexers we have and define them too.
20727 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
20728 for the get and set accessors.
20729 (Indexer::Define): Implement.
20731 2001-09-09 Miguel de Icaza <miguel@ximian.com>
20733 * expression.cs (Binary::Resolve): Beginning of it. I scratched
20734 my previous implementation, did not work.
20736 * typemanager.cs: Add a couple of missing types (the longs).
20738 * literal.cs: Use TypeManager.bool_type instead of getting it.
20740 * expression.cs (EventExpr): New kind of expressions.
20741 (Expressio::ExprClassFromMemberInfo): finish
20743 2001-09-08 Miguel de Icaza <miguel@ximian.com>
20745 * assign.cs: Emit stores to static fields differently.
20747 2001-09-08 Ravi Pratap <ravi@ximian.com>
20749 * Merge in changes and adjust code to tackle conflicts. Backed out my
20750 code in Assign::Resolve ;-)
20752 2001-09-08 Ravi Pratap <ravi@ximian.com>
20754 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
20755 instead Report.Error and also pass in the location.
20756 (CSharpParser::Lexer): New readonly property to return the reference
20757 to the Tokenizer object.
20758 (declare_local_variables): Use Report.Error with location instead of plain
20762 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
20763 (Operator.CheckBinaryOperator): Ditto.
20765 * cs-parser.jay (operator_declarator): Update accordingly.
20767 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
20768 (CheckBinaryOperator): Same here.
20770 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
20771 on the name without any prefixes of namespace names etc. This is because we
20772 already might have something already fully qualified like
20773 'System.Console.WriteLine'
20775 * assign.cs (Resolve): Begin implementation. Stuck ;-)
20777 2001-09-07 Ravi Pratap <ravi@ximian.com>
20779 * cs-tokenizer.cs (location): Return a string which also contains
20782 * expression.cs (ElementAccess): New class for expressions of the
20783 type 'element access.'
20784 (BaseAccess): New class for expressions of the type 'base access.'
20785 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
20788 * cs-parser.jay (element_access): Implement action.
20789 (base_access): Implement actions.
20790 (checked_expression, unchecked_expression): Implement.
20792 * cs-parser.jay (local_variable_type): Correct and implement.
20793 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
20795 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
20797 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
20798 name and the specifiers.
20800 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
20802 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
20803 making them all public ;-)
20805 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
20808 2001-09-07 Miguel de Icaza <miguel@ximian.com>
20810 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
20812 (FieldExpr, PropertyExprs): New resolved expressions.
20813 (SimpleName::MemberStaticCheck): Perform static checks for access
20814 to non-static fields on static methods. Maybe this should be
20815 generalized for MemberAccesses.
20816 (SimpleName::ResolveSimpleName): More work on simple name
20819 * cs-parser.jay (primary_expression/qualified_identifier): track
20820 the parameter index.
20822 * codegen.cs (CodeGen::Save): Catch save exception, report error.
20823 (EmitContext::EmitBoolExpression): Chain to expression generation
20824 instead of temporary hack.
20825 (::EmitStatementExpression): Put generic expression code generation.
20827 * assign.cs (Assign::Emit): Implement variable assignments to
20828 local variables, parameters and fields.
20830 2001-09-06 Miguel de Icaza <miguel@ximian.com>
20832 * statement.cs (Block::GetVariableInfo): New method, returns the
20833 VariableInfo for a variable name in a block.
20834 (Block::GetVariableType): Implement in terms of GetVariableInfo
20836 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
20837 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
20839 2001-09-06 Ravi Pratap <ravi@ximian.com>
20841 * cs-parser.jay (operator_declaration): Continue on my quest : update
20842 to take attributes argument.
20843 (event_declaration): Ditto.
20844 (enum_declaration): Ditto.
20845 (indexer_declaration): Ditto.
20847 * class.cs (Operator::Operator): Update constructor accordingly.
20848 (Event::Event): Ditto.
20850 * delegate.cs (Delegate::Delegate): Same here.
20852 * enum.cs (Enum::Enum): Same here.
20854 2001-09-05 Ravi Pratap <ravi@ximian.com>
20856 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
20858 * ../tests/cs0658.cs : New file to demonstrate error 0658.
20860 * attribute.cs (Attributes): New class to encapsulate all attributes which were
20861 being passed around as an arraylist.
20862 (Attributes::AddAttribute): Method to add attribute sections.
20864 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
20865 (struct_declaration): Update accordingly.
20866 (constant_declaration): Update.
20867 (field_declaration): Update.
20868 (method_header): Update.
20869 (fixed_parameter): Update.
20870 (parameter_array): Ditto.
20871 (property_declaration): Ditto.
20872 (destructor_declaration): Ditto.
20874 * class.cs (Struct::Struct): Update constructors accordingly.
20875 (Class::Class): Ditto.
20876 (Field::Field): Ditto.
20877 (Method::Method): Ditto.
20878 (Property::Property): Ditto.
20879 (TypeContainer::OptAttribute): update property's return type.
20881 * interface.cs (Interface.opt_attributes): New member.
20882 (Interface::Interface): Update to take the extra Attributes argument.
20884 * parameter.cs (Parameter::Parameter): Ditto.
20886 * constant.cs (Constant::Constant): Ditto.
20888 * interface.cs (InterfaceMemberBase): New OptAttributes field.
20889 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
20890 the attributes as a parameter.
20891 (InterfaceProperty): Update constructor call.
20892 (InterfaceEvent): Ditto.
20893 (InterfaceMethod): Ditto.
20894 (InterfaceIndexer): Ditto.
20896 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
20897 pass the attributes too.
20898 (interface_event_declaration): Ditto.
20899 (interface_property_declaration): Ditto.
20900 (interface_method_declaration): Ditto.
20901 (interface_declaration): Ditto.
20903 2001-09-05 Miguel de Icaza <miguel@ximian.com>
20905 * class.cs (Method::Define): Track the "static Main" definition to
20906 create an entry point.
20908 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
20909 EntryPoint if we find it.
20911 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
20912 (EmitContext::ig): Make this variable public.
20914 * driver.cs: Make the default output file be the first file name
20915 with the .exe extension.
20917 Detect empty compilations
20919 Handle various kinds of output targets. Handle --target and
20920 rename -t to --dumper.
20922 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
20923 methods inherited from Expression return now an Expression. This
20924 will is used during the tree rewriting as we resolve them during
20927 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
20928 the spec. Missing entirely is the information about
20929 accessability of elements of it.
20931 (Expression::ExprClassFromMemberInfo): New constructor for
20932 Expressions that creates a fully initialized Expression based on
20933 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
20936 (Invocation::Resolve): Begin implementing resolution of invocations.
20938 * literal.cs (StringLiteral): Implement Emit.
20940 2001-09-05 Ravi Pratap <ravi@ximian.com>
20942 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
20945 2001-09-04 Ravi Pratap <ravi@ximian.com>
20947 * cs-parser.jay (attribute_arguments): Implement actions.
20948 (attribute): Fix bug in production. Implement action.
20949 (attribute_list): Implement.
20950 (attribute_target): Implement.
20951 (attribute_target_specifier, opt_target_specifier): Implement
20952 (CheckAttributeTarget): New method to check if the attribute target
20954 (attribute_section): Implement.
20955 (opt_attributes): Implement.
20957 * attribute.cs : New file to handle attributes.
20958 (Attribute): Class to hold attribute info.
20960 * cs-parser.jay (opt_attribute_target_specifier): Remove production
20961 (attribute_section): Modify production to use 2 different rules to
20962 achieve the same thing. 1 s/r conflict down !
20963 Clean out commented, useless, non-reducing dimension_separator rules.
20965 * class.cs (TypeContainer.attributes): New member to hold list
20966 of attributes for a type.
20967 (Struct::Struct): Modify to take one more argument, the attribute list.
20968 (Class::Class): Ditto.
20969 (Field::Field): Ditto.
20970 (Method::Method): Ditto.
20971 (Property::Property): Ditto.
20973 * cs-parser.jay (struct_declaration): Update constructor call to
20974 pass in the attributes too.
20975 (class_declaration): Ditto.
20976 (constant_declaration): Ditto.
20977 (field_declaration): Ditto.
20978 (method_header): Ditto.
20979 (fixed_parameter): Ditto.
20980 (parameter_array): Ditto.
20981 (property_declaration): Ditto.
20983 * constant.cs (Constant::Constant): Update constructor similarly.
20984 Use System.Collections.
20986 * parameter.cs (Parameter::Parameter): Update as above.
20988 2001-09-02 Ravi Pratap <ravi@ximian.com>
20990 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
20991 (TypeContainer.delegates): New member to hold list of delegates.
20993 * cs-parser.jay (delegate_declaration): Implement the action correctly
20994 this time as I seem to be on crack ;-)
20996 2001-09-02 Miguel de Icaza <miguel@ximian.com>
20998 * rootcontext.cs (RootContext::IsNamespace): new function, used to
20999 tell whether an identifier represents a namespace.
21001 * expression.cs (NamespaceExpr): A namespace expression, used only
21002 temporarly during expression resolution.
21003 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
21004 utility functions to resolve names on expressions.
21006 2001-09-01 Miguel de Icaza <miguel@ximian.com>
21008 * codegen.cs: Add hook for StatementExpressions.
21010 * class.cs: Fix inverted test for static flag in methods.
21012 2001-09-02 Ravi Pratap <ravi@ximian.com>
21014 * class.cs (Operator::CheckUnaryOperator): Correct error number used
21015 to make it coincide with MS' number.
21016 (Operator::CheckBinaryOperator): Ditto.
21018 * ../errors/errors.txt : Remove error numbers added earlier.
21020 * ../errors/cs1019.cs : Test case for error # 1019
21022 * ../errros/cs1020.cs : Test case for error # 1020
21024 * cs-parser.jay : Clean out commented cruft.
21025 (dimension_separators, dimension_separator): Comment out. Ostensibly not
21026 used anywhere - non-reducing rule.
21027 (namespace_declarations): Non-reducing rule - comment out.
21029 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
21030 with TypeContainer::AddEnum.
21032 * delegate.cs : New file for delegate handling classes.
21033 (Delegate): Class for declaring delegates.
21035 * makefile : Update.
21037 * cs-parser.jay (delegate_declaration): Implement.
21039 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
21041 * class.cs (Event::Define): Implement.
21042 (Event.EventBuilder): New member.
21044 * class.cs (TypeContainer::Populate): Update to define all enums and events
21046 (Events): New property for the events arraylist we hold. Shouldn't we move to using
21047 readonly fields for all these cases ?
21049 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
21051 * class.cs (Property): Revamp to use the convention of making fields readonly.
21052 Accordingly modify code elsewhere.
21054 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
21055 the Define method of the Property class.
21057 * class.cs : Clean up applied patch and update references to variables etc. Fix
21059 (TypeContainer::Populate): Update to define all the properties we have. Also
21060 define all enumerations.
21062 * enum.cs (Define): Implement.
21064 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
21066 * cs-parser.jay (overloadable_operator): The semantic value is an
21067 enum of the Operator class.
21068 (operator_declarator): Implement actions.
21069 (operator_declaration): Implement.
21071 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
21072 validity of definitions.
21073 (Operator::CheckBinaryOperator): Static method to check for binary operators
21074 (TypeContainer::AddOperator): New method to add an operator to a type.
21076 * cs-parser.jay (indexer_declaration): Added line to actually call the
21077 AddIndexer method so it gets added ;-)
21079 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
21080 already taken care of by the MS compiler ?
21082 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
21084 * class.cs (Operator): New class for operator declarations.
21085 (Operator::OpType): Enum for the various operators.
21087 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
21089 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
21090 ostensibly handle this in semantic analysis.
21092 * cs-parser.jay (general_catch_clause): Comment out
21093 (specific_catch_clauses, specific_catch_clause): Ditto.
21094 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
21095 (catch_args, opt_catch_args): New productions.
21096 (catch_clause): Rewrite to use the new productions above
21097 (catch_clauses): Modify accordingly.
21098 (opt_catch_clauses): New production to use in try_statement
21099 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
21100 and re-write the code in the actions to extract the specific and
21101 general catch clauses by being a little smart ;-)
21103 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
21104 Hooray, try and catch statements parse fine !
21106 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21108 * statement.cs (Block::GetVariableType): Fix logic to extract the type
21109 string from the hashtable of variables.
21111 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
21112 I end up making that mistake ;-)
21113 (catch_clauses): Fixed gross error which made Key and Value of the
21114 DictionaryEntry the same : $1 !!
21116 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21118 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
21120 * cs-parser.jay (event_declaration): Correct to remove the semicolon
21121 when the add and remove accessors are specified.
21123 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21125 * cs-parser.jay (IndexerDeclaration): New helper class to hold
21126 information about indexer_declarator.
21127 (indexer_declarator): Implement actions.
21128 (parsing_indexer): New local boolean used to keep track of whether
21129 we are parsing indexers or properties. This is necessary because
21130 implicit_parameters come into picture even for the get accessor in the
21131 case of an indexer.
21132 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
21134 * class.cs (Indexer): New class for indexer declarations.
21135 (TypeContainer::AddIndexer): New method to add an indexer to a type.
21136 (TypeContainer::indexers): New member to hold list of indexers for the
21139 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
21141 * cs-parser.jay (add_accessor_declaration): Implement action.
21142 (remove_accessor_declaration): Implement action.
21143 (event_accessors_declaration): Implement
21144 (variable_declarators): swap statements for first rule - trivial.
21146 * class.cs (Event): New class to hold information about event
21148 (TypeContainer::AddEvent): New method to add an event to a type
21149 (TypeContainer::events): New member to hold list of events.
21151 * cs-parser.jay (event_declaration): Implement actions.
21153 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
21155 * cs-parser.jay (dim_separators): Implement. Make it a string
21156 concatenating all the commas together, just as they appear.
21157 (opt_dim_separators): Modify accordingly
21158 (rank_specifiers): Update accordingly. Basically do the same
21159 thing - instead, collect the brackets here.
21160 (opt_rank_sepcifiers): Modify accordingly.
21161 (array_type): Modify to actually return the complete type string
21162 instead of ignoring the rank_specifiers.
21163 (expression_list): Implement to collect the expressions
21164 (variable_initializer): Implement. We make it a list of expressions
21165 essentially so that we can handle the array_initializer case neatly too.
21166 (variable_initializer_list): Implement.
21167 (array_initializer): Make it a list of variable_initializers
21168 (opt_array_initializer): Modify accordingly.
21170 * expression.cs (New::NType): Add enumeration to help us
21171 keep track of whether we have an object/delegate creation
21172 or an array creation.
21173 (New:NewType, New::Rank, New::Indices, New::Initializers): New
21174 members to hold data about array creation.
21175 (New:New): Modify to update NewType
21176 (New:New): New Overloaded contructor for the array creation
21179 * cs-parser.jay (array_creation_expression): Implement to call
21180 the overloaded New constructor.
21182 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
21184 * class.cs (TypeContainer::Constructors): Return member
21185 constructors instead of returning null.
21187 2001-08-26 Miguel de Icaza <miguel@ximian.com>
21189 * typemanager.cs (InitCoreTypes): Initialize the various core
21190 types after we have populated the type manager with the user
21191 defined types (this distinction will be important later while
21192 compiling corlib.dll)
21194 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
21195 on Expression Classification. Now all expressions have a method
21196 `Resolve' and a method `Emit'.
21198 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
21199 generation from working. Also add some temporary debugging
21202 2001-08-24 Miguel de Icaza <miguel@ximian.com>
21204 * codegen.cs: Lots of code generation pieces. This is only the
21205 beginning, will continue tomorrow with more touches of polish. We
21206 handle the fundamentals of if, while, do, for, return. Others are
21207 trickier and I need to start working on invocations soon.
21209 * gen-treedump.cs: Bug fix, use s.Increment here instead of
21212 * codegen.cs (EmitContext): New struct, used during code
21213 emission to keep a context. Most of the code generation will be
21216 * cs-parser.jay: Add embedded blocks to the list of statements of
21217 this block. So code generation proceeds in a top down fashion.
21219 2001-08-23 Miguel de Icaza <miguel@ximian.com>
21221 * statement.cs: Add support for multiple child blocks.
21223 2001-08-22 Miguel de Icaza <miguel@ximian.com>
21225 * codegen.cs (EmitCode): New function, will emit the code for a
21226 Block of code given a TypeContainer and its ILGenerator.
21228 * statement.cs (Block): Standard public readonly optimization.
21229 (Block::Block constructors): Link children.
21230 (Block::Child): Child Linker.
21231 (Block::EmitVariables): Emits IL variable declarations.
21233 * class.cs: Drop support for MethodGroups here, delay until
21235 (Method::): Applied the same simplification that I did before, and
21236 move from Properties to public readonly fields.
21237 (Method::ParameterTypes): Returns the parameter types for the
21238 function, and implements a cache that will be useful later when I
21239 do error checking and the semantic analysis on the methods is
21241 (Constructor::GetCallingConvention): Renamed from CallingConvetion
21242 and made a method, optional argument tells whether this is a class
21243 or a structure to apply the `has-this' bit.
21244 (Method::GetCallingConvention): Implement, returns the calling
21246 (Method::Define): Defines the type, a second pass is performed
21247 later to populate the methods.
21249 (Constructor::ParameterTypes): implement a cache similar to the
21250 one on Method::ParameterTypes, useful later when we do semantic
21253 (TypeContainer::EmitMethod): New method. Emits methods.
21255 * expression.cs: Removed MethodGroup class from here.
21257 * parameter.cs (Parameters::GetCallingConvention): new method.
21259 2001-08-21 Miguel de Icaza <miguel@ximian.com>
21261 * class.cs (TypeContainer::Populate): Drop RootContext from the
21264 (Constructor::CallingConvention): Returns the calling convention.
21265 (Constructor::ParameterTypes): Returns the constructor parameter
21268 (TypeContainer::AddConstructor): Keep track of default constructor
21269 and the default static constructor.
21271 (Constructor::) Another class that starts using `public readonly'
21272 instead of properties.
21274 (Constructor::IsDefault): Whether this is a default constructor.
21276 (Field::) use readonly public fields instead of properties also.
21278 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
21279 track of static constructors; If none is used, turn on
21280 BeforeFieldInit in the TypeAttributes.
21282 * cs-parser.jay (opt_argument_list): now the return can be null
21283 for the cases where there are no arguments.
21285 (constructor_declarator): If there is no implicit `base' or
21286 `this', then invoke the default parent constructor.
21288 * modifiers.cs (MethodAttr): New static function maps a set of
21289 modifiers flags into a MethodAttributes enum
21290 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
21291 MethodAttr, TypeAttr to represent the various mappings where the
21292 modifiers are used.
21293 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
21295 2001-08-19 Miguel de Icaza <miguel@ximian.com>
21297 * parameter.cs (GetParameterInfo): Fix bug where there would be no
21300 * interface.cs (PopulateIndexer): Implemented the code generator
21301 for interface indexers.
21303 2001-08-17 Miguel de Icaza <miguel@ximian.com>
21305 * interface.cs (InterfaceMemberBase): Now we track the new status
21308 (PopulateProperty): Implement property population. Woohoo! Got
21309 Methods and Properties going today.
21311 Removed all the properties for interfaces, and replaced them with
21312 `public readonly' fields.
21314 2001-08-16 Miguel de Icaza <miguel@ximian.com>
21316 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
21317 initialize their hashtables/arraylists only when they are needed
21318 instead of doing this always.
21320 * parameter.cs: Handle refs and out parameters.
21322 * cs-parser.jay: Use an ArrayList to construct the arguments
21323 instead of the ParameterCollection, and then cast that to a
21326 * parameter.cs: Drop the use of ParameterCollection and use
21327 instead arrays of Parameters.
21329 (GetParameterInfo): Use the Type, not the Name when resolving
21332 2001-08-13 Miguel de Icaza <miguel@ximian.com>
21334 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
21335 and instead use public readonly fields.
21337 * class.cs: Put back walking code for type containers.
21339 2001-08-11 Miguel de Icaza <miguel@ximian.com>
21341 * class.cs (MakeConstant): Code to define constants.
21343 * rootcontext.cs (LookupType): New function. Used to locate types
21346 2001-08-08 Miguel de Icaza <miguel@ximian.com>
21348 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
21349 this System.Reflection code is. Kudos to Microsoft
21351 * typemanager.cs: Implement a type cache and avoid loading all
21352 types at boot time. Wrap in LookupType the internals. This made
21353 the compiler so much faster. Wow. I rule!
21355 * driver.cs: Make sure we always load mscorlib first (for
21356 debugging purposes, nothing really important).
21358 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
21359 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
21361 * rootcontext.cs: Lookup types on their namespace; Lookup types
21362 on namespaces that have been imported using the `using' keyword.
21364 * class.cs (TypeContainer::TypeAttr): Virtualize.
21365 (Class::TypeAttr): Return attributes suitable for this bad boy.
21366 (Struct::TypeAttr): ditto.
21367 Handle nested classes.
21368 (TypeContainer::) Remove all the type visiting code, it is now
21369 replaced with the rootcontext.cs code
21371 * rootcontext.cs (GetClassBases): Added support for structs.
21373 2001-08-06 Miguel de Icaza <miguel@ximian.com>
21375 * interface.cs, statement.cs, class.cs, parameter.cs,
21376 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
21377 Drop use of TypeRefs, and use strings instead.
21379 2001-08-04 Miguel de Icaza <miguel@ximian.com>
21383 * class.cs (Struct::Struct): set the SEALED flags after
21384 checking the modifiers.
21385 (TypeContainer::TypeAttr): new property, returns the
21386 TypeAttributes for a class.
21388 * cs-parser.jay (type_list): Oops, list production was creating a
21389 new list of base types.
21391 * rootcontext.cs (StdLib): New property.
21392 (GetInterfaceTypeByName): returns an interface by type name, and
21393 encapsulates error handling here.
21394 (GetInterfaces): simplified.
21395 (ResolveTree): Encapsulated all the tree resolution here.
21396 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
21399 * driver.cs: Add support for --nostdlib, to avoid loading the
21400 default assemblies.
21401 (Main): Do not put tree resolution here.
21403 * rootcontext.cs: Beginning of the class resolution.
21405 2001-08-03 Miguel de Icaza <miguel@ximian.com>
21407 * rootcontext.cs: Provide better error reporting.
21409 * cs-parser.jay (interface_base): set our $$ to be interfaces.
21411 * rootcontext.cs (CreateInterface): Handle the case where there
21412 are no parent interfaces.
21414 (CloseTypes): Routine to flush types at the end.
21415 (CreateInterface): Track types.
21416 (GetInterfaces): Returns an array of Types from the list of
21417 defined interfaces.
21419 * typemanager.c (AddUserType): Mechanism to track user types (puts
21420 the type on the global type hash, and allows us to close it at the
21423 2001-08-02 Miguel de Icaza <miguel@ximian.com>
21425 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
21426 RecordInterface instead.
21428 * cs-parser.jay: Updated to reflect changes above.
21430 * decl.cs (Definition): Keep track of the TypeBuilder type that
21431 represents this type here. Not sure we will use it in the long
21432 run, but wont hurt for now.
21434 * driver.cs: Smaller changes to accomodate the new code.
21436 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
21439 * rootcontext.cs (CreateInterface): New method, used to create
21440 the System.TypeBuilder type for interfaces.
21441 (ResolveInterfaces): new entry point to resolve the interface
21443 (CodeGen): Property, used to keep track of the code generator.
21445 2001-07-26 Miguel de Icaza <miguel@ximian.com>
21447 * cs-parser.jay: Add a second production for delegate_declaration
21450 (enum_body): Put an opt_comma here instead of putting it on
21451 enum_body or enum_member_declarations so we can handle trailing
21452 commas on enumeration members. Gets rid of a shift/reduce.
21454 (type_list): Need a COMMA in the middle.
21456 (indexer_declaration): Tell tokenizer to recognize get/set
21458 * Remove old targets.
21460 * Re-add the parser target.
21462 2001-07-13 Simon Cozens <simon@simon-cozens.org>
21464 * cs-parser.jay: Add precendence rules for a number of operators
21465 ot reduce the number of shift/reduce conflicts in the grammar.
21467 2001-07-17 Miguel de Icaza <miguel@ximian.com>
21469 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
21472 Get rid of old crufty code.
21474 * rootcontext.cs: Use this to keep track of the parsed
21475 representation and the defined types available to the program.
21477 * gen-treedump.cs: adjust for new convention.
21479 * type.cs: Split out the type manager, and the assembly builder
21482 * typemanager.cs: the type manager will live here now.
21484 * cil-codegen.cs: And the code generator here.
21486 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
21488 * makefile: Fixed up for easy making.
21490 2001-07-13 Simon Cozens <simon@simon-cozens.org>
21492 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
21495 (unary_expression): Expand pre_increment_expression and
21496 post_decrement_expression to reduce a shift/reduce.
21498 2001-07-11 Simon Cozens
21500 * cs-tokenizer.cs: Hex numbers should begin with a 0.
21502 Improve allow_keyword_as_indent name.
21504 2001-06-19 Miguel de Icaza <miguel@ximian.com>
21506 * Adjustments for Beta2.
21508 2001-06-13 Miguel de Icaza <miguel@ximian.com>
21510 * decl.cs: Added `Define' abstract method.
21511 (InTransit): new property, used to catch recursive definitions.
21513 * interface.cs: Implement `Define'.
21515 * modifiers.cs: Map Modifiers.constants to
21516 System.Reflection.TypeAttribute flags.
21518 * class.cs: Keep track of types and user-defined types.
21519 (BuilderInit): New method for creating an assembly
21520 (ResolveType): New function to launch the resolution process, only
21521 used by interfaces for now.
21523 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
21524 that are inserted into the name space.
21526 2001-06-08 Miguel de Icaza <miguel@ximian.com>
21528 * ARGH. I have screwed up my tree so many times due to the use of
21529 rsync rather than using CVS. Going to fix this at once.
21531 * driver.cs: Objetify driver. Load assemblies, use assemblies to
21534 2001-06-07 Miguel de Icaza <miguel@ximian.com>
21536 * Experiment successful: Use System.Type rather that our own
21539 2001-05-25 Miguel de Icaza <miguel@ximian.com>
21541 * cs-parser.jay: Removed nsAliases from here.
21543 Use new namespaces, handle `using XXX;'
21545 * namespace.cs: Reimplemented namespace handling, use a recursive
21546 definition of the class. Now we can keep track of using clauses
21547 and catch invalid using clauses.
21549 2001-05-24 Miguel de Icaza <miguel@ximian.com>
21551 * gen-treedump.cs: Adapted for all the renaming.
21553 * expression.cs (Expression): this class now has a Type property
21554 which returns an expression Type.
21556 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
21557 `Type', as this has a different meaning now in the base
21559 2001-05-22 Miguel de Icaza <miguel@ximian.com>
21561 * interface.cs, class.cs: Removed from all the sources the
21562 references to signature computation, as we can not do method
21563 signature computation during the parsing time, as we are not
21564 trying to solve at that point distinguishing:
21568 void a (NS.Blah x) {}
21571 Which depending on the context might be valid or not, as we do not
21572 know if Blah is the same thing as NS.Blah at that point.
21574 * Redid everything so the code uses TypeRefs now instead of
21575 Types. TypeRefs are just temporary type placeholders, that need
21576 to be resolved. They initially have a pointer to a string and the
21577 current scope in which they are used. This is used later by the
21578 compiler to resolve the reference to an actual Type.
21580 * DeclSpace is no longer a CIR.Type, and neither are
21581 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
21582 are all DeclSpaces, but no Types.
21584 * type.cs (TypeRefManager): This implements the TypeRef manager,
21585 which keeps track of all the types that need to be resolved after
21586 the parsing has finished.
21588 2001-05-13 Miguel de Icaza <miguel@ximian.com>
21590 * ARGH. We are going to have to store `foreach' as a class rather
21591 than resolving it, as we need to verify error 1579 after name
21592 resolution. *OR* we could keep a flag that says `This request to
21593 IEnumerator comes from a foreach statement' which we can then use
21594 to generate the error.
21596 2001-05-10 Miguel de Icaza <miguel@ximian.com>
21598 * class.cs (TypeContainer.AddMethod): we now add methods to the
21599 MethodGroup instead of the method hashtable.
21601 * expression.cs: Add MethodGroup abstraction, which gets us one
21602 step closer to the specification in the way we handle method
21605 * cs-parser.jay (primary_expression): qualified_identifier now
21606 tried to match up an identifier to a local variable reference or
21607 to a parameter reference.
21609 current_local_parameters is now a parser global variable that
21610 points to the current parameters for the block, used during name
21613 (property_declaration): Now creates an implicit `value' argument to
21616 2001-05-09 Miguel de Icaza <miguel@ximian.com>
21618 * parameter.cs: Do not use `param' arguments as part of the
21619 signature, per the spec.
21621 2001-05-08 Miguel de Icaza <miguel@ximian.com>
21623 * decl.cs: Base class for classes, structs and interfaces. This
21624 is the "Declaration Space"
21626 * cs-parser.jay: Use CheckDef for checking declaration errors
21627 instead of having one on each function.
21629 * class.cs: Factor out some code for handling error handling in
21630 accordance to the "Declarations" section in the "Basic Concepts"
21631 chapter in the ECMA C# spec.
21633 * interface.cs: Make all interface member classes derive from
21634 InterfaceMemberBase.
21636 2001-05-07 Miguel de Icaza <miguel@ximian.com>
21638 * Many things: all interfaces are parsed and generated in
21639 gen-treedump. Support for member variables, constructors,
21640 destructors, properties, constants is there.
21642 Beginning of the IL backend, but very little done, just there for
21645 2001-04-29 Miguel de Icaza <miguel@ximian.com>
21647 * cs-parser.jay: Fix labeled statement.
21649 * cs-tokenizer.cs (escape): Escape " and ' always.
21650 ref_line, ref_name: keep track of the line/filename as instructed
21651 by #line by the compiler.
21654 2001-04-27 Miguel de Icaza <miguel@ximian.com>
21656 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
21657 to match the values in System.CodeDOM.
21659 Divid renamed to Divide.
21661 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
21663 (Statements.set): remove.
21665 * System.CodeDOM/CodeCatchClause.cs: always have a valid
21668 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
21669 falseStatements always have valid values.
21671 * cs-parser.jay: Use System.CodeDOM now.