1 2005-02-15 Martin Baulig <martin@ximian.com>
3 * generic.cs (ConstructedType.Constraints): Correctly check
4 constraints if the argument type is a type parameter; fixes
7 2005-02-02 Martin Baulig <martin@ximian.com>
9 * delegate.cs (Delegate.DefineType): Report an internal error if
10 TypeManager.multicast_delegate_type is null. See bug #72015 for
13 2005-01-29 Miguel de Icaza <miguel@novell.com>
15 * pending.cs: Produce better code (no nops produced by using Ldarg
18 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
19 i - 1' it should be arg + 1.
23 2005-01-26 Martin Baulig <martin@ximian.com>
25 * cs-parser.jay (indexer_declarator): Don't report an error if we
26 have type parameters since we can be an explicit interface
27 implementation; fixes #71449.
29 2005-01-26 Martin Baulig <martin@ximian.com>
31 * class.cs (TypeContainer.AttributeTargets): Return the correct
32 AttributeTargets depending on our `Kind' instead of throwing an
33 exception; fixes #71632.
35 2005-01-26 Martin Baulig <martin@ximian.com>
37 * delegate.cs (Delegate.DefineType): Correctly define our type
38 parameters. Fixes #71483.
40 2005-01-25 Raja R Harinath <rharinath@novell.com>
43 * expression.cs (MemberAccess.DoResolve): Don't complain with
44 cs0572 when the LHS of a member access has identical name and type
47 2005-01-25 Marek Safar <marek.safar@seznam.cz>
50 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
52 Create custom PermissionSet only for PermissionSetAttribute.
54 2005-01-24 Marek Safar <marek.safar@seznam.cz>
57 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
58 delegates in static class.
60 2005-01-24 Martin Baulig <martin@ximian.com>
62 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
63 merging an implicit block, just use its reachability.
65 * statement.cs (Block.Resolve): Make the unreachable code check
66 work wrt. implicit blocks; see test-337 from #63842.
68 2005-01-21 Alp Toker <alp@atoker.com>
70 * cs-parser.jay: destructor_declaration's container is PartialContainer
71 not Class when partial types are used, so use Kind prop instead of
74 2005-01-22 Miguel de Icaza <miguel@ximian.com>
76 * cs-parser.jay: Improve error reporting when an interface
79 2005-01-20 Dick Porter <dick@ximian.com>
81 * support.cs: SeekableStreamReader fix from Sandor Dobos
82 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
83 chars are read. Fixes bug 70369.
85 2005-01-20 Raja R Harinath <rharinath@novell.com>
87 * cs-parser.jay (catch_clause): Simplify current_block handling
90 2005-01-17 Miguel de Icaza <miguel@ximian.com>
92 * convert.cs (ImplicitStandardConversionExists): Synchronize the
93 code with ImplicitStandardConversion to handle the implicit
94 conversion of method groups into valid delegate invocations.
96 The problem is that in parameter handling we were using this code
97 path. Fixes bug #64698
99 2005-01-19 Raja R Harinath <rharinath@novell.com>
101 * cs-parser.jay: Fix several infelicities.
102 - Avoid assigning to the parser value stack. Code like
103 '$3 = null' is unclean. Synthesize a value for the code block
105 - Avoid using oob_stack for storing location information. Use ...
106 (_mark_): ... this. New (empty) rule. Saves the current location
108 (foreach_statement): Avoid using oob_stack for current_block
109 handling. Use technique used in for_statement and
110 using_statement. Synthesize a value for the code block to store
111 additional intermediate information.
113 2005-01-13 Miguel de Icaza <miguel@ximian.com>
115 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
116 of a different type is only allowed to private fields of a
117 containing type, not on fields of a base class.
119 See test-174.cs and error cs0122-9.cs
121 2005-01-13 Raja R Harinath <rharinath@novell.com>
123 Fix test-335.cs (bug #58126).
124 * cs-parser.jay (argument): Split out non-expression parts of the
125 rule into 'non_simple_argument'.
126 (invocation_expression): Support parenthesized invocations with
127 multiple arguments, and with single non-simple arguments.
129 2005-01-13 Raja R Harinath <rharinath@novell.com>
131 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
134 2005-01-12 Raja R Harinath <rharinath@novell.com>
136 Fix cs0038-1.cs, cs1640-6.cs.
137 * ecore.cs (Expression.Resolve): Remove special-case for
138 SimpleName in error-handling.
139 (Expression.almostMatchedMembers): Relax access permission to
141 (Expression.MemberLookupFailed): Handle duplicates in
142 almostMatchedMembers list.
143 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
144 * expression.cs (New.DoResolve): Report CS1540 for more cases.
145 * typemanager.cs (GetFullNameSignature): Use the MethodBase
146 overload if the passed in MemberInfo is a MethodBase.
148 2005-01-25 Martin Baulig <martin@ximian.com>
151 (DocUtil.emptyParamList): Removed; use `Type.EmptyTypes' instead.
153 2005-01-12 Marek Safar <marek.safar@seznam.cz>
156 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
157 for non-CAS & merge permission sets properly.
159 2005-01-11 Raja R Harinath <rharinath@novell.com>
161 Improve standard-compliance of simple name and member access
162 resolution. Fixes bugs #52697, #57200, #67520, #69519.
163 * ecore.cs (FullNamedExpression): New abstract base class
164 for Namespaces and TypeExpressions.
165 (ResolveFlags.SimpleName): Remove.
166 (SimpleName): Remove support for dotted names.
167 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
168 DeclSpace.FindType and DeclSpace.LookupType.
169 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
170 (Expression.ExprClassName): Make member function.
171 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
172 a namespace. Remove creation of dotted "SimpleName"s.
173 (MemberAccess.DoResolve): Likewise.
174 * decl.cs (DeclSpace.Cache): Make private.
175 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
176 (DeclSpace.FindType): Update.
177 (DeclSpace.LookupType): Move here from RootContext. Return a
179 * namespace.cs (Namespace): Derive from FullNamedExpression
180 so that it can be part of expression resolution.
181 (Namespace.Lookup): Return an FullNamedExpression.
182 (NamespaceEntry.LookupAlias): Lookup aliases only in current
184 * rootcontext.cs (NamespaceLookup): Remove.
185 (LookupType): Move to DeclSpace.
186 * attribute.cs (CheckAttributeType): Update.
187 * doc.cs (FindDocumentedType): Remove allowAlias argument.
188 (FindDocumentedTypeNonArray): Likewise.
190 2005-01-11 Raja R Harinath <rharinath@novell.com>
192 Fix cs0509.cs, cs1632.cs.
193 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
194 is the same as IsInterface.
195 (TypeContainer.GetClassBases): Likewise.
196 * statement.cs (LabeledStatement.ig): New field.
197 (LabeledStatement.LabelTarget): Save ILGenerator which created the
199 (LabeledStatement.DoEmit): Check that the label was created with
200 the same ILGenerator.
202 2005-01-10 Marek Safar <marek.safar@seznam.cz>
205 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
206 accessors to its properties.
208 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
209 from accessors to property.
211 2005-01-10 Marek Safar <marek.safar@seznam.cz>
214 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
217 2005-01-08 Miguel de Icaza <miguel@ximian.com>
219 * attribute.cs: Check for null and empty strings.
221 I have lost another battle to Paolo.
223 2005-01-07 Marek Safar <marek.safar@seznam.cz>
226 * class.cs (PropertyMethod): Set Parent field in ctors.
227 (SetMethod.InternalParameters): Add unsafe switch hack.
228 Override MarkForDuplicationCheck where it is appropriate.
230 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
231 It says whether container allows members with the same name.
233 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
234 Removed is_method parameter.
236 2005-01-06 Duncan Mak <duncan@ximian.com>
238 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
239 because the previous change led to incorrect reporting of CS1032
240 ("Cannot define/undefine preprocessor symbols after first token in
241 file"). Instead of using `tokens_seen' as the only flag that
242 triggers CS1040, introduce `comments_seen'. This new flag is used
243 to signify having seen comments on the current line, so it is
244 unset after a newline.
246 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
248 * doc.cs : When searching for a type, find nested type too.
249 This fixes bug #71040.
251 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
254 - Warn missing member comment on those classes which also does not
255 have doc comments. Fixed bug #71041.
256 - Don't warn missing doc comment on default constructor.
259 2005-01-06 Duncan Mak <duncan@ximian.com>
261 * cs-tokenizer.cs (xtoken): After handling traditional C-style
262 comments, set `tokens_seen' to true. This allows us to detect
263 misplaced preprocessor directives (i.e. not at the beginning of
264 the a line, nor after whitespaces). In that case, report error
265 CS1040. This fixes bug #56460.
267 * cs-parser.jay (interface_member_declaration): Add checks for
268 IsExplicitImpl, and report CS0541 error if an interface member is
269 defined as an explicit interface declaration.
271 2005-01-06 Marek Safar <marek.safar@seznam.cz>
274 * class.cs (PropertyMethod): Set Parent field in ctors.
275 (SetMethod.InternalParameters): Add unsafe switch hack.
277 * decl.cs (MemberCore.Parent): Cannot be readonly.
279 2005-01-06 Raja R Harinath <rharinath@novell.com>
281 * decl.cs (DeclSpace.ResolveType): Remove.
282 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
283 Merge in code from ...
284 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
285 * class.cs, enum.cs: Update to changes.
287 2005-01-06 Miguel de Icaza <miguel@ximian.com>
289 * anonymous.cs: Ensure that we init the scope of our parent if it
290 has not been initialized yet.
292 2004-12-30 Duncan Mak <duncan@ximian.com>
294 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
295 if field.FieldBuilder is null. Fixes #70758.
297 * convert.cs: Fixed some typos and updated some of the comments.
298 (ImplicitStandardConversionExists):
299 (TryImplicitIntConversion): If `target_type' is an interface and
300 the type of `ic' implements this interface, return true or a new
301 BoxedCast instead of null. This fixes #70468.
303 2004-12-29 Duncan Mak <duncan@ximian.com>
305 * expression.cs (Argument.Emit): Check that Expr is
306 IMemoryLocation before casting to it, and report CS1510 otherwise.
310 2004-12-21 Ben Maurer <bmaurer@ximian.com>
312 * statement.cs (Block.ThisVariable): remove the recursion here, to
313 make the --profile more sane.
315 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
317 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
318 assembly, by JB Evain.
320 2004-12-17 Raja R Harinath <rharinath@novell.com>
322 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
323 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
324 "parent" refers to enclosing type/class. "base" refers to superclass.
326 2004-12-17 Raja R Harinath <rharinath@novell.com>
328 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
329 Ensure that we only have GlobalAttributes.
330 * attribute.cs (Attribute.Emit): Make non-virtual.
331 (GlobalAttribute.Emit): Remove.
332 (Attribute.Resolve): Make virtual.
333 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
334 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
335 the argument. Don't create one.
336 (Attribute.GetObsoleteAttribute): Likewise.
337 (Attribute.GetClsCompliantAttributeValue): Likewise.
338 * class.cs, decl.cs: Update to changes.
340 2004-12-17 Marek Safar <marek.safar@seznam.cz>
342 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
344 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
346 * statement.cs (Foreach.Resolve): Add error 186 report.
348 2004-12-16 Marek Safar <marek.safar@seznam.cz>
350 * expression.cs (Conditional.DoResolve): Add warning 429.
352 * statement.cs (If.Resolve): Add warning 665.
354 2004-12-16 Raja R Harinath <rharinath@novell.com>
356 New invariant: RootContext.Tree.Types.NamespaceEntry == null
357 except when in the parser, and in GlobalAttribute.
358 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
359 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
360 RootContext.Tree.Types.NamespaceEntry once work is done.
361 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
362 and resets RootContext.Tree.Types.NamespaceEntry.
364 2004-12-15 Marek Safar <marek.safar@seznam.cz>
366 * cs-parser.jay: Don't create a block for every variable.
368 2004-12-14 Miguel de Icaza <miguel@ximian.com>
370 * location.cs: Provide extra information.
372 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
373 variables from the captured environment, it is the ldarg_0.
375 2004-12-14 Marek Safar <marek.safar@seznam.cz>
377 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
380 * class.cs: Changed warning level for 169 to avoid developer
381 displeasure from warning flooding. It will be changed back when they
382 fix most of current BCL warnings.
384 * RootContext.cs: Pushed default WarningLevel to 3.
386 * statement.cs: Removed unused variable.
388 2004-12-14 Marek Safar <marek.safar@seznam.cz>
390 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
391 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
392 Add error 502 report.
393 (StaticClass.DefineType): Add error 441 report.
394 (Class.AllowedModifiersProp): New virtual property as temporary
395 extension to AllowedModifiers.
396 (Class.DefineType): Add error 418 report. Moved ModFlags check here
397 to share implementation with StaticClass and don't call virtual
400 * driver.cs (MainDriver): Add error 1558 test.
402 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
403 report. Moved error 36 test here.
405 * statement.cs (Throw.Resolve): Add error 724 report.
407 * typemanager.cs: Add out_attribute_type core type.
409 2004-12-13 Marek Safar <marek.safar@seznam.cz>
411 * class.cs (TypeContainer.VerifyClsCompliance): Add error
413 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
415 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
418 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
420 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
421 Add error 3023 report.
422 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
424 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
427 2004-12-12 John Luke <john.luke@gmail.com>
429 * driver.cs (AddArgs): take -- into account when
430 adding arguments, fixes bug 65710
432 2004-12-12 Martin Baulig <martin@ximian.com>
434 * expression.cs (Unary.TryReduceNegative): Added support for
435 SByteConstant and ByteConstant.
436 (Unary.Reduce): Check error values from TryReduceNegative().
438 2004-12-10 Marek Safar <marek.safar@seznam.cz>
440 * attributes.cs (Attribute.Resolve): Avoid multiple error report
441 and report exception as error 182.
443 2004-12-10 Raja R Harinath <rharinath@novell.com>
445 * driver.cs (Main): Fix message when there are warnings.
447 2004-12-09 Miguel de Icaza <miguel@ximian.com>
449 * delegate.cs: Fixed my fix from yesterday, sorry about that.
451 2004-12-09 Marek Safar <marek.safar@seznam.cz>
453 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
454 Reduced number of warnings.
456 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
458 2004-12-08 Miguel de Icaza <miguel@ximian.com>
460 * driver.cs: Removed message.
462 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
464 2004-12-08 <vargaz@freemail.hu>
466 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
468 2004-12-08 Martin Baulig <martin@ximian.com>
470 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
471 instead of a CS3002 for properties and indexer.
473 2004-12-08 Martin Baulig <martin@ximian.com>
475 * decl.cs (MemberName.ToString): Make this work again.
477 2004-12-08 Marek Safar <marek.safar@seznam.cz>
479 * attribute.cs (Resolve): Add error 591 detection.
481 * class.cs (FieldMember.Define): Add error 1547 detection.
482 (Indexer.Define): Add error 620 detection.
483 (Operator.Define): Add error 590 detection.
485 * ecore.cs: Missing argument for error 79.
487 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
490 2004-12-07 Marek Safar <marek.safar@seznam.cz>
493 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
496 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
498 * cs-parser.jay : handle doc comments on implicit/explicit operators.
499 Some operator comments were suppressed.
500 * doc.cs : Implicit/explicit operator name in doc comments are like
501 "op_Explicit(type)~returnType", so added suffix handling.
503 2005-01-21 Alp Toker <alp@atoker.com>
505 * cs-parser.jay: destructor_declaration's container is PartialContainer
506 not Class when partial types are used, so use Kind prop instead of 'is'.
508 2004-12-12 Martin Baulig <martin@ximian.com>
510 * expression.cs (Unary.TryReduceNegative): Added support for
511 SByteConstant and ByteConstant.
512 (Unary.Reduce): Check error values from TryReduceNegative().
514 2004-12-11 Martin Baulig <martin@ximian.com>
516 * support.cs (ReflectionParameters.ParameterName): If we have a
517 `gpd', call `ParameterName' on it.
519 * parameter.cs (Parameter.GetParameterAttributes): New static method.
521 * pending.cs (PendingImplementation.DefineProxy): Call
522 DefineParameter() for all of the MethodBuilder's arguments.
524 2004-12-09 Martin Baulig <martin@ximian.com>
526 * doc.cs (DocUtil): Make this a static class.
528 2004-12-09 Martin Baulig <martin@ximian.com>
530 * expression.cs (Invocation.InferType): Moved the type inference
531 implementation into TypeManager.
533 * generics.cs (TypeManager): Moved the type inference
536 2004-12-09 Martin Baulig <martin@ximian.com>
538 * typemanager.cs (TypeManager): Make this a partial class.
541 (TypeManager): Move the generics part of `TypeManager' here.
543 2004-12-08 Martin Baulig <martin@ximian.com>
545 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
546 instead of a CS3002 for properties and indexer. Added CS3024
547 check for generic interfaces.
549 * attributes.cs (AttributeTester.AnalyzeTypeCompliance): Generic
550 instances are not CLS-compliant.
552 2004-12-08 Martin Baulig <martin@ximian.com>
555 (void_pointer_expression): New rule for `void*', `void**' etc.
556 (typeof_expression): Add `void_pointer_expression'; fixes #66846.
558 2004-12-08 Martin Baulig <martin@ximian.com>
560 * expression.cs (Invocation.InferType): Removed the hack for
561 MethodCore.MayUnify().
563 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Make
566 * class.cs (MethodCore.MayUnify): Use
567 TypeManager.MayBecomeEqualGenericTypes().
569 2004-12-08 Martin Baulig <martin@ximian.com>
571 * expression.cs (Is.DoResolve, As.DoResolve): If we're a type
572 parameter, box it. Fixes #69233.
574 2004-12-08 Martin Baulig <martin@ximian.com>
576 * generic.cs (ConstructedType.CheckConstraints): Valuetypes always
577 have the ctor constraint. Fixes #68326.
579 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
581 * cs-parser.jay : interface comment was not consumed because of
582 extra opt_semicolon before doc handling.
584 2004-12-03 Raja R Harinath <rharinath@novell.com>
586 Fix test-327.cs, test-328.cs, and put in early infrastructure
587 for eventually fixing #52697.
588 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
589 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
591 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
592 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
593 (VerifyUsing, error246): Update.
594 * rootcontext.cs (RootContext.NamespaceLookup): Just use
595 'NamespaceEntry.LookupNamespaceOrType'.
597 2004-12-07 Martin Baulig <martin@ximian.com>
599 * driver.cs: Call it "BETA SOFTWARE" :-)
601 2004-12-06 Raja R Harinath <rharinath@novell.com>
603 Fix crash on cs0657-17.cs.
604 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
605 Use RootContext.Tree.Types, not 'new RootTypes ()'.
606 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
607 the case where the NamespaceEntry gets overwritten.
609 2004-12-06 Marek Safar <marek.safar@seznam.cz>
612 * ecore.cs (ResolveBoolean): Tiny refactoring.
614 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
615 of right expression resolving when left is false constant and
616 operator is LogicalAnd OR true constant and operator is LogicalOr.
618 * statement.cs (ResolveUnreachable): Always reports warning.
620 2004-12-05 Miguel de Icaza <miguel@ximian.com>
622 * class.cs: Distinguish between 1721 and 1722 (just a little help
625 2004-12-03 Miguel de Icaza <miguel@ximian.com>
627 * delegate.cs: Only allow this on new versions of the language.
629 2004-12-02 Duncan Mak <duncan@ximian.com>
631 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
633 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
634 here as a static method. Take an additional bool out parameter
635 `must_do_cs1540_check' for signaling to InstanceResolve.
636 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
637 member field from PropertyExpr class and made it an argument of
639 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
640 check for MarshalByRefObject, and report CS0122 instead of CS1540.
641 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
642 and `remove_accessor' as well as InstanceResolve: report CS0122
647 2004-12-07 Martin Baulig <martin@ximian.com>
649 * decl.cs (DeclSpace.AddToContainer): Report correct errors CS0694
650 and CS0692 where appropriate.
652 2004-12-06 Martin Baulig <martin@ximian.com>
654 * class.cs (MethodCore.MayUnify): Moved the CS0408 check here from
655 IsDuplicateImplementation() and improved it.
657 * expression.cs (Invocation.InferTypeArguments): Added
658 `Type[] inferred_class_types' argument (for MethodCore.MayUnify)
659 and removed the "ref" modifier from `infered_types'.
661 * decl.cs (MemberName.ToString): Removed the exception.
663 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
665 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
666 comments are allowed.
668 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
670 * delegate.cs: Add checks for subtypes in paramaters and return values
671 in VerifyMethod () to add support for Covariance/Contravariance
674 2004-12-02 Miguel de Icaza <miguel@ximian.com>
676 * report.cs: Remove extra closing parenthesis.
678 * convert.cs (Error_CannotImplicitConversion): If the name of the
679 types are the same, provide some extra information.
681 2004-12-02 Marek Safar <marek.safar@seznam.cz>
684 * attribute.cs (Resolve): Improved implementation of params
687 * support.cs (ParameterData): Add HasParams to be faster.
689 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
691 all things are for /doc support:
693 * doc.cs: new file that supports XML documentation generation.
694 * mcs.exe.sources: added doc.cs.
696 Handle /doc command line option.
697 Report error 2006 instead of 5 for missing file name for /doc.
698 Generate XML documentation when required, after type resolution.
700 Added support for picking up documentation (/// and /** ... */),
701 including a new XmlCommentState enumeration.
703 Added lines to fill Documentation element for field, constant,
704 property, indexer, method, constructor, destructor, operator, event
705 and class, struct, interface, delegate, enum.
706 Added lines to warn incorrect comment.
708 Added Documentation field (passed only when /doc was specified).
710 Added DocComment, DocCommentHeader, GenerateDocComment() and
711 OnGenerateDocComment() and some supporting private members for
712 /doc feature to MemberCore.
714 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
716 Added overriden DocCommentHeader.
718 Added overriden DocCommentHeader and GenerateDocComment().
720 2004-12-01 Miguel de Icaza <miguel@ximian.com>
722 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
723 unwrapping the enumeration values, chain to
724 DoConstantNumericPromotions again, so we can promote things to the
725 fundamental types (takes care of enums that are bytes, sbytes).
729 2004-12-01 Raja R Harinath <rharinath@novell.com>
731 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
732 Fix long-standing bug in type-lookup. Use FindType instead of
733 LookupType when ec.ResolvingTypeTree.
734 (Attribute.ResolveType, Attribute.Resolve)
735 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
737 (Attributes.Search): Remove internal version. Update.
738 (Attributes.SearchMulti): Update.
739 (Attributes.GetClsCompliantAttribute): Remove.
740 (Attributes.GetIndexerNameAttribute): Remove.
741 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
742 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
743 * class.cs (Indexer.Define): Likewise.
745 2004-12-01 Marek Safar <marek.safar@seznam.cz>
748 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
749 MarshallByReference members access.
751 * expression.cs: Use CheckMarshallByRefAccess;
752 Better error CS0197 message.
754 * report.cs: Print whole related error message.
756 2004-11-29 Marek Safar <marek.safar@seznam.cz>
758 * class (GetClassBases): Better error 60 report.
759 (EventProperty): Disabled warning 67 detection.
761 2004-11-29 Marek Safar <marek.safar@seznam.cz>
764 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
766 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
769 2004-11-29 Marek Safar <marek.safar@seznam.cz>
772 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
774 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
776 2004-11-26 Miguel de Icaza <miguel@ximian.com>
778 * attribute.cs (Attribute.Resolve): Refine error reporting and
779 report a cs0117 if the identifier does not exist, to distinguish
780 from 0617 which is a miss-use of the actual identifier.
782 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
783 between cs0070 and cs0079.
785 * class.cs (MemberBase.DoDefine): When reporting a wrong
786 accessibility level, we use MethodCore to compare instead of
787 Method (this was a regression in some refactoring effort).
789 So now we correctly report cs0056 again.
791 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
792 testing the target_type (which was known to be object_type) and
793 not the source type (which is anonymous_method).
795 Fixed reporting of error cs1660.
797 * expression.cs (UserCast.Source): Expose the underlying cast.
799 * statement.cs (Switch.SwitchGoverningType): Sort the list of
800 allowed types to find a match to int32 first (most common).
802 In addition, it ignores any ImplicitUserConversions that did an
803 internal implicit conversion (as the switch statement allows only
804 one integral conversion to exist).
806 * class.cs (PartialContainer.Create): rename `name' to
807 `member_name' for clarity. Then replace the string calls with a
808 call to MemberName.GetPartialName, as now using
809 MemberName.ToString is an error (this is due to the side effects
810 it had, that were fixed in the past).
812 This will restore the error reporting on a number of partial class
813 errors that were missusing this (and getting an exception as a
814 results, which is now just a plain textual warning, because
815 yyparse debug output would crash otherwise).
817 2004-11-26 Raja R Harinath <rharinath@novell.com>
819 * Makefile (PROGRAM_INSTALL_DIR): Remove.
821 2004-11-25 Ben Maurer <bmaurer@ximian.com>
823 * rootcontext.cs (LookupType): Make sure to cache lookups that
824 don't give us a negative result. This saves about 5% of corlib
827 2004-11-25 Miguel de Icaza <miguel@ximian.com>
829 * report.cs (AbstractMessage.Print): messages are sent to stderr
831 * class.cs (TypeContainer.GetClassBases): It is an error to have a
832 non-interface in the list of interfaces (at this point, either
833 parent was properly set, or a base class is being listed in the
836 This flags error 1722, and resolves the crash from bug 69259.
838 2004-11-25 Ben Maurer <bmaurer@ximian.com>
840 * statement.cs (Using.EmitExpressionFinally): make this work right
841 for valuetypes. Fixes 69926.
843 2004-11-25 Miguel de Icaza <miguel@ximian.com>
845 * const.cs (Const.ChangeType): Cope with the "0 literal can be
846 converted to an enum" here, before we try to change the underlying
847 type. This code exists, but it is a different code path than the
848 one used while encoding constants.
850 (ImplicitReferenceConversionExists): In addition, resynchronized
851 the code here, so it matches the same code in
852 ImplicitReferenceConversionExists for the `from any class-type S
853 to any interface-type T'.
855 2004-11-25 Marek Safar <marek.safar@seznam.cz>
857 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
859 2004-11-24 Miguel de Icaza <miguel@ximian.com>
861 * cs-parser.jay: Use verbosity accordingly.
863 2004-11-24 Marek Safar <marek.safar@seznam.cz>
865 * expression.cs (Unary.ResolveOperator): Do not report warning;
866 AddressOf reads from variable.
868 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
870 2004-11-24 Marek Safar <marek.safar@seznam.cz>
874 * attribute.cs (Attributable): Removed CheckTargets.
875 (Attributes.Emit): Explicit attribute targets are tested here.
877 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
878 not enabled for interfaces.
880 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
881 (GetAssemblyName): Ouch next bug there.
883 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
885 * expression.cs: Error 275 added.
887 2004-11-23 Marek Safar <marek.safar@seznam.cz>
889 Fix bug #69177 (Implemented decimal constant support)
891 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
892 (BinaryFold): Add DecimalConstant.
894 * const.cs (Define): Decimal constant
896 (ChangeType): Add decimal type handling.
897 (LookupConstantValue): Don't set value for decimal type but
898 emit DecimalConstantAttribute. Needed for constant optimization.
900 * constant.cs (ToDecimal): New method.
901 (ConvertToDecimal): New method.
902 (IntConstant): Implemented ConvertToDecimal.
903 (DecimalConstant.Emit): Emit optimized version for decimals in
906 * expression.cs (ResolveOperator): Changed order of constant
907 reduction to work correctly with native types which have
908 overloaded operators.
909 (ResolveMemberAccess): Extract constant value from attribute
912 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
914 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
915 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
916 (ChangeType): Decimal is special.
917 (TypeToCoreType): Add decimal type.
919 2004-11-22 Marek Safar <marek.safar@seznam.cz>
921 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
924 2004-11-22 Marek Safar <marek.safar@seznam.cz>
926 * class.cs (EventField.ApplyAttributeBuilder): Fix error
929 2004-11-19 Marek Safar <marek.safar@seznam.cz>
931 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
933 * pending.cs (PendingImplementation): Grab only interfaces.
935 2004-11-19 Marek Safar <marek.safar@seznam.cz>
937 * statement.cs (ForeachHelperMethods): Add location member and
940 2004-11-18 Marek Safar <marek.safar@seznam.cz>
942 * expression.cs (DoResolveBase): Fixed wrong warning for out
945 2004-12-04 Martin Baulig <martin@ximian.com>
947 * convert.cs (Convert.TypeParameter_to_Null): Use the constraints
948 to check whether the conversion is ok.
950 * typemanager.cs (TypeManager.GetTypeArguments): Just return
951 `Type.EmptyTypes' if we're not a generic TypeContainer.
953 2004-11-25 Miguel de Icaza <miguel@ximian.com>
955 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
956 old bug: when converting from the null literal to a pointer,
957 return an EmptyCast, not the NullLiteral.
959 This fixes #69921, the recent null_type changes probably made this
962 2004-12-03 Martin Baulig <martin@ximian.com>
964 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
965 method as our child, call AnonymousMethod.Compatible() on it.
967 2004-12-02 Miguel de Icaza <miguel@ximian.com>
969 * class.cs (FieldBase): Use an unused bit field from the field to
970 encode the `has_offset' property from the FieldMember. This saves
971 a couple of Ks on bootstrap compilation.
973 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
974 method as our child, return the AnonymousMethod resolved
977 * expression.cs (New.DoResolve): Allow return values from
978 NewDelegate to also include AnonymousMethods.
982 2004-11-29 Raja R Harinath <rharinath@novell.com>
984 * decl.cs (MemberCore.MemberName): Remove readonly to fix an error
986 * rootcontext.cs (ResolveCore::interfaces_first_stage): Add
987 System.Runtime.InteropServices._Exception, since it's a base
988 interface of the core type System.Exception in the net_2_0 profile.
990 2004-11-27 Martin Baulig <martin@ximian.com>
992 * ecore.cs (Expression.StoreFromPtr): Use `stobj' for generic parameters.
994 2004-11-26 Raja R Harinath <rharinath@novell.com>
996 * Makefile: Convert to use executable.make.
997 * gmcs.exe.sources: New.
999 2004-11-25 Martin Baulig <martin@ximian.com>
1001 * expression.cs (Invocation.InferType): Added support for byref types.
1003 2004-11-25 Martin Baulig <martin@ximian.com>
1005 * statement.cs (Foreach.FetchMethodMoveNext): Wrap `mi.ReturnType'
1006 in TypeManager.TypeToCoreType().
1008 2004-11-25 Martin Baulig <martin@ximian.com>
1010 * iterators.cs (Iterator.DoDefineMembers): Override and lookup the
1011 "Dispose" method from the `current_type'.
1012 (Iterator.EmitMoveNext): Use the `dispose_method' we looked up in
1013 DoDefineMembers() instead of using the MethodBuilder; this is
1014 required for generic iterators.
1016 * class.cs (TypeContainer.DoDefineMembers): Make this virtual.
1018 2004-11-24 Martin Baulig <martin@ximian.com>
1020 * ecore.cs (Expression.LoadFromPtr): Use `ldobj' for generic parameters.
1022 2004-11-20 Martin Baulig <martin@ximian.com>
1024 * expression.cs (Invocation.InferType): Correctly infer generic
1025 instances; see gen-103.cs.
1026 (Invocation.InferTypeArguments): If a generic method doesn't have
1027 any unbound type parameters, we don't need to infer anything.
1029 2004-11-19 Raja R Harinath <rharinath@novell.com>
1031 * Makefile (gmcs.exe): Update to new location of bootstrap mcs.exe.
1033 2004-11-17 Raja R Harinath <rharinath@novell.com>
1035 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
1036 (TypeHandle.GetMemberCache): New.
1037 (TypeHandle.TypeHandle): Update.
1038 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
1039 (TypeManager.LookupParentInterfacesCache):
1040 Rename from LookupInterfaceCache. Optimize slightly.
1041 (TypeManager.MemberLookup_FindMembers): Update.
1042 * decl.cs (MemberCache.MemberCache): Set Container to null in the
1044 (AddCacheContents): Rename from AddHashtable.
1045 * class.cs (TypeContainer.parent_container): Remove.
1046 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
1047 (TypeContainer.DoDefineMembers): Don't initialize it.
1048 Update to name changes.
1050 2004-11-17 Miguel de Icaza <miguel@ximian.com>
1052 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
1053 that factors the code to check access modifiers on override.
1055 (PropertyBase): Use the code here.
1057 Patch from Lluis S'anchez, fixes bug #69361.
1059 2004-11-15 Miguel de Icaza <miguel@ximian.com>
1061 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
1062 routine that is used to report the use of a captured variable
1063 whose address has been taken.
1065 There are two checks: one when variables are being captured and
1066 the other check is when the address of a variable is taken.
1068 (because an anonymous methods might be resolved before *or* after
1069 the address has been taken) and
1071 * expression.cs (Conditional.DoResolve): Remove the special
1072 casing that Martin added to trueExpr and falseExpr being both
1073 NullLiteral. We get the right behavior now just by introducing
1074 the null_type into the compiler.
1076 * convert.cs (ExplicitConversion): Change the code to use
1077 null_type instead of testing `expr is NullLiteral'.
1078 (ImplicitConversionStandard): use null_type too.
1079 (ImplicitReferenceConversionExists): use null_type too.
1080 (ImplicitReferenceConversion): use null_type too.
1082 * literal.cs: The type of `NullLiteral' is now null_type instead
1084 (Resolve): Set the type here.
1086 * typemanager.cs: Introduce null_type.
1088 2004-11-18 Martin Baulig <martin@ximian.com>
1091 (RootContext.LookupType): Return a `Type', not a `TypeExpr'.
1093 2004-11-18 Martin Baulig <martin@ximian.com>
1095 * ecore.cs (TypeExpr.DoResolveAsTypeStep): Make this protected.
1097 2004-11-18 Martin Baulig <martin@ximian.com>
1099 * generic.cs (Constraints.Resolve): Take an `EmitContext' instead
1100 of a `DeclSpace'. If one of our constraints is a `ConstructedType',
1101 call ResolveConstructedType() on it to resolve it without checking
1103 (Constraints.ResolveTypes): Check them here.
1104 (ConstructedType.DoResolveAsTypeStep): Fully resolve ourselves,
1105 but don't check constraints.
1106 (ConstructedType.ResolveAsTypeTerminal): Override this and also
1107 check constraints here.
1108 (ConstructedType.ResolveConstructedType): New public method. This
1109 is called from DoResolveAsTypeStep() and Constraints.Resolve() to
1110 resolve ourselves without checking constraints.
1112 * ecore.cs (Expression.ResolveAsTypeTerminal): Make this virtual.
1114 2004-11-18 Martin Baulig <martin@ximian.com>
1117 (DeclSpace.CurrentType): Changed type from `TypeExpr' to `Type'.
1119 * delegate.cs (Delegate.DefineType): Always create the EmitContext.
1121 2004-11-18 Martin Baulig <martin@ximian.com>
1123 * ecore.cs (TypeExpr.ResolveType): Removed.
1124 (Expression.ResolveAsTypeTerminal): We always return a fully
1125 resolved `TypeExpr', so we can just access its `Type'.
1127 * class.cs (TypeContainer.DefineType): Resolve `CurrentType' here.
1129 2004-11-17 Martin Baulig <martin@ximian.com>
1131 * ecore.cs (IAlias.Type): Replaced with ResolveAsType() to make
1132 sure we don't return any unresolved TypeExpr's.
1133 (TypeAliasExpression): The .ctor now takes an `IAlias' instead of
1135 (Expression.ResolveAsTypeTerminal): Make sure `te.Type != null'.
1137 * expression.cs (MemberAccess.ResolveAsTypeStep): Don't return any
1138 unresolved `ConstructedType's.
1140 2004-11-17 Martin Baulig <martin@ximian.com>
1142 * ecore.cs (TypeExpr.ResolveType): Don't make this virtual.
1144 2004-11-17 Martin Baulig <martin@ximian.com>
1147 (Expression.ResolveAsTypeTerminal): Removed the `bool silent' argument.
1149 * decl.cs (DeclSpace.ResolveType): Removed.
1150 (DeclSpace.ResolveTypeExpr): Removed the `bool silent' argument.
1152 2004-11-17 Martin Baulig <martin@ximian.com>
1154 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
1155 direction, like FindMembers() does. Fixes #69546, testcase is in
1158 2004-11-16 Martin Baulig <martin@ximian.com>
1160 This is based on a patch from Marek Safar, see bug #69082.
1161 Fixes bugs #63705 and #67130.
1163 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
1164 method; create a MemberCache for an interface type and cache the
1167 * decl.cs (IMemberContainer.ParentContainer): Removed.
1168 (IMemberContainer.ParentCache): New property.
1169 (MemberCache.SetupCacheForInterface): Removed.
1170 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
1171 to create a cache for an interface's "parent".
1173 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
1176 2004-11-14 Ben Maurer <bmaurer@ximian.com>
1178 * statement.cs: Avoid adding bools to a hashtable.
1180 2004-11-15 Martin Baulig <martin@ximian.com>
1182 * decl.cs (MemberName.GetPartialName): Removed, use GetTypeName() instead.
1184 2004-11-11 Martin Baulig <martin@ximian.com>
1186 * typemanager.cs (TypeManager.GetMethodName): New method.
1188 * class.cs (MethodData.Define): Include the generic arity in the
1189 name of an explicit interface; also add it to the method name.
1191 * pending.cs (PendingImplementation.InterfaceMethod): The method
1192 name now includes the generic arity.
1194 2004-11-07 Miguel de Icaza <miguel@ximian.com>
1196 * expression.cs (Invocation.OverloadResolve): Flag error if we are
1197 calling an unsafe method from a safe location.
1199 2004-11-06 Marek Safar <marek.safar@seznam.cz>
1202 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
1204 2004-11-06 Miguel de Icaza <miguel@ximian.com>
1206 * namespace.cs (VerifyUsing): use GetPartialName instead of
1209 2004-11-05 Miguel de Icaza <miguel@ximian.com>
1211 * statement.cs (Return.Resolve): Fix regression in typo: if
1212 `in_exc', we have to request a NeedReturnLabel, this was a typo
1213 introduced in the anonymous method check-in. Fixes #69131.
1215 * Indexers were using the ShortName when defining themselves,
1216 causing a regression in the compiler bootstrap when applying the
1217 patch from 2004-11-02 (first part), now they use their full name
1218 and the bug is gone.
1220 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
1222 * driver.cs: Strip the path from the names of embedded resources. Fixes
1225 2004-11-04 Raja R Harinath <rharinath@novell.com>
1227 Fix error message regression: cs0104-2.cs.
1228 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
1229 (AliasEntry.Resolve): Update.
1230 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
1232 (RootContext.LookupType): Update.
1234 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
1236 * cs-parser.jay: Add support for handling accessor modifiers
1237 * class: Add support port accessor modifiers and error checking,
1238 define PropertyMethod.Define as virtual (not abstract anymore)
1239 * ecore.cs: Add checking for proeprties access with access modifiers
1240 * iterators.cs: Modify Accessor constructor call based in the modified
1242 2004-11-02 Ben Maurer <bmaurer@ximian.com>
1244 * expression.cs (StringConcat): Handle being called twice,
1245 as when we have a concat in a field init with more than two
1248 2004-11-02 Miguel de Icaza <miguel@ximian.com>
1250 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
1251 special case explicit implementations, we should always produce
1252 the .property or .event declaration.
1254 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
1255 since it will not return correct data if people use this
1256 unresolved in the presence of using statements (see test-313).
1258 * class.cs (MethodData.Define): If we are an explicit interface
1259 implementation, set the method name to the full name of the
1260 interface plus the name of the method.
1262 Notice that using the method.MethodName.GetFullName() does not
1263 work, as it will only contain the name as declared on the source
1264 file (it can be a shorthand in the presence of using statements)
1265 and not the fully qualifed type name, for example:
1269 class D : ICloneable {
1270 object ICloneable.Clone () {
1274 Would produce a method called `ICloneable.Clone' instead of
1275 `System.ICloneable.Clone'.
1277 * namespace.cs (Alias.Resolve): Use GetPartialName.
1279 2004-11-01 Marek Safar <marek.safar@seznam.cz>
1281 * cs-parser.jay: Add error 1055 report.
1283 2004-11-01 Miguel de Icaza <miguel@ximian.com>
1285 * assign.cs (Assign.DoResolve): Only do the transform of
1286 assignment into a New if the types are compatible, if not, fall
1287 through and let the implicit code deal with the errors and with
1288 the necessary conversions.
1290 2004-11-01 Marek Safar <marek.safar@seznam.cz>
1292 * cs-parser.jay: Add error 1031 report.
1294 * cs-tokenizer.cs: Add location for error 1038.
1296 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1298 * cs-parser.jay: Add error 1016 report.
1300 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1302 * cs-parser.jay: Add errors 1575,1611 report.
1304 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1306 * cs-parser.jay: Add error 1001 report.
1308 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1311 * attribute.cs (GetMarshal): Add method argument for
1312 caller identification.
1314 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
1315 agument for GetMarshal and RuntimeMissingSupport.
1317 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1319 * attribute.cs (ExtractSecurityPermissionSet): Removed
1320 TypeManager.code_access_permission_type.
1322 * typemanager.cs: Removed TypeManager.code_access_permission_type.
1324 2004-10-27 Miguel de Icaza <miguel@ximian.com>
1326 * expression.cs (LocalVariableReference.DoResolveLValue): Check
1327 for obsolete use of a variable here. Fixes regression on errors
1328 cs0619-25 and cs0619-26.
1330 2004-10-27 Marek Safar <marek.safar@seznam.cz>
1332 Fix #62358, implemented security attribute encoding.
1334 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
1335 Tests permitted SecurityAction for assembly or other types.
1336 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
1337 data from SecurityPermissionAttribute to PermisionSet class.
1339 * class.cs (ApplyAttributeBuilder): Added special handling
1340 for System.Security.Permissions.SecurityAttribute based types.
1342 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
1343 special handling for System.Security.Permissions.SecurityAttribute
1346 * enum.cs (ApplyAttributeBuilder): Added special handling
1347 for System.Security.Permissions.SecurityAttribute based types.
1349 * parameter.cs (ApplyAttributeBuilder): Added special handling
1350 for System.Security.Permissions.SecurityAttribute based types.
1352 * rootcontext.cs: Next 2 core types.
1354 * typemanager.cs (TypeManager.security_permission_attr_type):
1355 Built in type for the SecurityPermission Attribute.
1356 (code_access_permission_type): Build in type.
1358 2004-10-17 Miguel de Icaza <miguel@ximian.com>
1360 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
1361 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
1362 all of this information into
1363 EmitContext.EmitCapturedVariableInstance.
1365 * codegen.cs (EmitCapturedVariableInstance): move here the
1366 funcionality of emitting an ldarg.0 in the presence of a
1367 remapping. This centralizes the instance emit code.
1369 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
1370 then emit a load of this: it means that we have reached the
1371 topmost ScopeInfo: the one that contains the pointer to the
1372 instance of the class hosting the anonymous method.
1374 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
1375 captures to the topmost CaptureContext.
1377 2004-10-12 Miguel de Icaza <miguel@ximian.com>
1379 * expression.cs (LocalVariableReference): Move the knowledge about
1380 the iterators into codegen's EmitCapturedVariableInstance.
1382 2004-10-11 Miguel de Icaza <miguel@ximian.com>
1384 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
1385 all code paths return a value from an anonymous method (it is the
1386 same as the 161 error, but for anonymous methods).
1388 2004-10-08 Miguel de Icaza <miguel@ximian.com>
1390 The introduction of anonymous methods in the compiler changed
1391 various ways of doing things in the compiler. The most
1392 significant one is the hard split between the resolution phase
1393 and the emission phases of the compiler.
1395 For instance, routines that referenced local variables no
1396 longer can safely create temporary variables during the
1397 resolution phase: they must do so from the emission phase,
1398 since the variable might have been "captured", hence access to
1399 it can not be done with the local-variable operations from the runtime.
1403 (Block.Flags): New flag `IsTopLevel' to indicate that this block
1404 is a toplevel block.
1406 (ToplevelBlock): A new kind of Block, these are the blocks that
1407 are created by the parser for all toplevel method bodies. These
1408 include methods, accessors and anonymous methods.
1410 These contain some extra information not found in regular blocks:
1411 A pointer to an optional CaptureContext (for tracking captured
1412 local variables and parameters). A pointer to the parent
1415 (Return.Resolve): Catch missmatches when returning a value from an
1416 anonymous method (error 1662).
1417 Invoke NeedReturnLabel from the Resolve phase instead of the emit
1420 (Break.Resolve): ditto.
1422 (SwitchLabel): instead of defining the labels during the
1423 resolution phase, we now turned the public ILLabel and ILLabelCode
1424 labels into methods called GetILLabelCode() and GetILLabel() that
1425 only define the label during the Emit phase.
1427 (GotoCase): Track the SwitchLabel instead of the computed label
1428 (its contained therein). Emit the code by using
1429 SwitchLabel.GetILLabelCode ().
1431 (LocalInfo.Flags.Captured): A new flag has been introduce to track
1432 whether the Local has been captured or not.
1434 (LocalInfo.IsCaptured): New property, used to tell whether the
1435 local has been captured.
1437 * anonymous.cs: Vastly updated to contain the anonymous method
1440 The main classes here are: CaptureContext which tracks any
1441 captured information for a toplevel block and ScopeInfo used to
1442 track the activation frames for various local variables.
1444 Each toplevel block has an optional capture context associated
1445 with it. When a method contains an anonymous method both the
1446 toplevel method and the anonymous method will create a capture
1447 context. When variables or parameters are captured, they are
1448 recorded on the CaptureContext that owns them, for example:
1452 MyDelegate d = delegate {
1457 Here `a' will be recorded as captured on the toplevel
1458 CapturedContext, the inner captured context will not have anything
1459 (it will only have data if local variables or parameters from it
1460 are captured in a nested anonymous method.
1462 The ScopeInfo is used to track the activation frames for local
1463 variables, for example:
1465 for (int i = 0; i < 10; i++)
1466 for (int j = 0; j < 10; j++){
1467 MyDelegate d = delegate {
1472 At runtime this captures a single captured variable `i', but it
1473 captures 10 different versions of the variable `j'. The variable
1474 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
1475 recorded on a child.
1477 The toplevel ScopeInfo will also track information like the `this'
1478 pointer if instance variables were referenced (this is necessary
1479 as the anonymous method lives inside a nested class in the host
1480 type of the method).
1482 (AnonymousMethod): Expanded to track the Toplevel, implement
1483 `AnonymousMethod.Compatible' to tell whether an anonymous method
1484 can be converted to a target delegate type.
1486 The routine now also produces the anonymous method content
1488 (AnonymousDelegate): A helper class that derives from
1489 DelegateCreation, this is used to generate the code necessary to
1490 produce the delegate for the anonymous method that was created.
1492 * assign.cs: API adjustments for new changes in
1493 Convert.ImplicitStandardConversionExists.
1495 * class.cs: Adjustments to cope with the fact that now toplevel
1496 blocks are of type `ToplevelBlock'.
1498 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
1499 insteda of standard blocks.
1501 Flag errors if params arguments are passed to anonymous methods.
1503 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
1504 `CurrentAnonymousMethod' which points to the current Anonymous
1505 Method. The variable points to the AnonymousMethod class that
1506 holds the code being compiled. It is set in the new EmitContext
1507 created for the anonymous method.
1509 (EmitContext.Phase): Introduce a variable and an enumeration to
1510 assist in enforcing some rules about when and where we are allowed
1511 to invoke certain methods (EmitContext.NeedsReturnLabel is the
1512 only one that enfonces this right now).
1514 (EmitContext.HaveCaptureInfo): new helper method that returns
1515 whether we have a CapturedContext initialized.
1517 (EmitContext.CaptureVariable): New method used to register that a
1518 LocalInfo must be flagged for capturing.
1520 (EmitContext.CapturedParameter): New method used to register that a
1521 parameters must be flagged for capturing.
1523 (EmitContext.CapturedField): New method used to register that a
1524 field must be flagged for capturing.
1526 (EmitContext.HaveCapturedVariables,
1527 EmitContext.HaveCapturedFields): Return whether there are captured
1528 variables or fields.
1530 (EmitContext.EmitMethodHostInstance): This is used to emit the
1531 instance for the anonymous method. The instance might be null
1532 (static methods), this (for anonymous methods that capture nothing
1533 and happen to live side-by-side with the current method body) or a
1534 more complicated expression if the method has a CaptureContext.
1536 (EmitContext.EmitTopBlock): Routine that drives the emission of
1537 code: it will first resolve the top block, then emit any metadata
1538 and then emit the code. The split is done so that we can extract
1539 any anonymous methods and flag any captured variables/parameters.
1541 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
1542 during this phase, the ILGenerator should not be used as labels
1543 and local variables declared here might not be accessible to any
1544 code that is part of an anonymous method.
1546 Exceptions to this include the temporary variables that are
1547 created by some statements internally for holding temporary
1550 (EmitContext.EmitMeta): New routine, in charge of emitting all the
1553 (EmitContext.TemporaryReturn): This method is typically called
1554 from the Emit phase, and its the only place where we allow the
1555 ReturnLabel to be defined other than the EmitMeta. The reason is
1556 that otherwise we would have to duplicate a lot of logic in the
1557 Resolve phases of various methods that today is on the Emit
1560 (EmitContext.NeedReturnLabel): This no longer creates the label,
1561 as the ILGenerator is not valid during the resolve phase.
1563 (EmitContext.EmitThis): Extended the knowledge in this class to
1564 work in anonymous methods in addition to iterators.
1566 (EmitContext.EmitCapturedVariableInstance): This emits whatever
1567 code is necessary on the stack to access the instance to a local
1568 variable (the variable will be accessed as a field).
1570 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
1571 EmitContext.EmitAddressOfParameter): Routines to support
1572 parameters (not completed at this point).
1574 Removals: Removed RemapLocal and RemapLocalLValue. We probably
1575 will also remove the parameters.
1577 * convert.cs (Convert): Define a `ConstantEC' which points to a
1578 null. This is just to prefity some code that uses
1579 ImplicitStandardConversion code and do not have an EmitContext
1582 The idea is to flag explicitly that at that point in time, it is
1583 known that the conversion will not trigger the delegate checking
1584 code in implicit conversions (which requires a valid
1587 Everywhere: pass new EmitContext parameter since
1588 ImplicitStandardConversionExists now requires it to check for
1589 anonymous method conversions.
1591 (Convert.ImplicitStandardConversionExists): If the type of an
1592 expression is the anonymous_method_type, and the type is a
1593 delegate, we invoke the AnonymousMethod.Compatible method to check
1594 whether an implicit conversion is possible.
1596 (Convert.ImplicitConversionStandard): Only do implicit method
1597 group conversions if the language level is not ISO_1.
1599 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
1600 MethodInfo for the Invoke method. used by Delegate and
1603 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
1604 method conversions if the target type is a delegate.
1606 Removed extra debugging nops.
1608 (LocalVariableReference): Turn the `local_info' into a public
1611 Add `prepared' field, the same hack used for FieldExprs to cope
1612 with composed assignments, as Local variables do not necessarily
1613 operate purely on the stack as they used to: they can be captured
1616 Add `temp' for a temporary result, like fields.
1618 Refactor DoResolve and DoResolveLValue into DoResolveBase.
1620 It now copes with Local variables that are captured and emits the
1621 proper instance variable to load it from a field in the captured
1624 (ParameterReference.DoResolveBase): During the resolve phase,
1625 capture parameters if we are in an anonymous method.
1627 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
1628 anonymous method, use the EmitContext helper routines to emit the
1629 parameter reference.
1631 * iterators.cs: Set RemapToProxy to true/false during the
1634 * parameters.cs (GetParameterByName): New helper method.
1636 * typemanager.cs (anonymous_method_type) a new type that
1637 represents an anonyous method. This is always an internal type,
1638 used as a fencepost to test against the anonymous-methodness of an
1641 2004-10-20 Marek Safar <marek.safar@seznam.cz>
1643 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
1645 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
1647 2004-11-10 Martin Baulig <martin@ximian.com>
1649 * expression.cs (Invocation.BetterFunction): If two methods have
1650 equal parameter types, but only one of them is generic, the
1651 non-generic one wins.
1652 (New.DoResolve): Don't set `is_struct' to false if we're a generic
1653 instance; just use `Type.IsValueType' to determine whether
1654 something is a struct or not.
1655 (MemberAccess.DoResolveAsTypeStep): Don't modify the `args' field,
1656 so we can be called multiple times.
1658 2004-11-10 Martin Baulig <martin@ximian.com>
1660 * generic.cs (TypeParameter.DefineConstraints): New public method.
1661 (TypeParameter.CheckAccessLevel): Override this and return true.
1662 (ConstructedType.ResolveType): Renamed to DoResolveType(), don't
1663 override ResolveType() anymore.
1664 (ConstructedType.DoResolveAsTypeStep): Call DoResolveType() here.
1666 2004-11-10 Martin Baulig <martin@ximian.com>
1668 * rootcontext.cs (RootContext.LookupType): If we're a nested type,
1669 call DeclSpace.ResolveNestedType() on it.
1671 2004-11-10 Martin Baulig <martin@ximian.com>
1673 * support.cs (ReflectionParameters.ParameterModifier): If `gpd' is
1674 non-null, call ParameterModifier() on it.
1676 2004-11-10 Martin Baulig <martin@ximian.com>
1679 (Iterators): Added `current_type' and `this_type' fields.
1680 (Iterators.DefineIterator): Create a new EmitContext and store it
1681 in `ec'; compute `this_type'.
1683 2004-11-10 Martin Baulig <martin@ximian.com>
1686 (TypeManager.IsPrivateAccessible): New public method.
1687 (Closure.Filter): Use IsPrivateAccessible() instead of IsEqual().
1689 2004-11-10 Martin Baulig <martin@ximian.com>
1691 * class.cs (TypeContainer.DefineType): Call
1692 TypeBuilder.DefineGenericParameters() before resolving the type
1694 (MethodData.parent_method): New protected field.
1695 (MethodData..ctor): Added `MethodInfo parent_method' argument.
1696 (MethodData.Define): Compute `parent_method'.
1699 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
1700 (MemberCore.GetClsCompliantAttributeValue): Likewise.
1701 (DeclSpace.ec): New protected field; store the EmitContext here.
1702 (DeclSpace.EmitContext): New public property.
1703 (DeclSpace.ResolveType): Un-comment from the [Obsolte] attribute.
1704 (DeclSpace.ResolveNestedType): New public method.
1705 (DeclSpace.ResolveTypeExpr): Just call ResolveAsTypeTerminal() here.
1706 (DeclSpace.NestedAccessible): Added `Type tb' argument.
1707 (DeclSpace.FamilyAccessible): Likewise.
1708 (DeclSpace.FindType): Call ResolveNestedType() for nested types.
1709 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
1712 * delegate.cs (Delegate.Define): Store the EmitContext in the `ec'
1715 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
1716 (Enum.Emit): Don't create a new EmitContext.
1718 2004-10-18 Martin Baulig <martin@ximian.com>
1720 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
1721 `Type' directly, but call ResolveType() on it.
1722 (Catch.Resolve): Likewise.
1723 (Foreach.Resolve): Likewise.
1725 2004-10-18 Martin Baulig <martin@ximian.com>
1727 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
1728 `Type' directly, but call ResolveType() on it.
1729 (Probe.DoResolve): Likewise.
1730 (ArrayCreation.LookupType): Likewise.
1731 (TypeOf.DoResolve): Likewise.
1732 (SizeOf.DoResolve): Likewise.
1734 2004-10-18 Raja R Harinath <rharinath@novell.com>
1736 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
1739 2004-10-17 John Luke <john.luke@gmail.com>
1741 * class.cs (Operator.GetSignatureForError): use CSharpName
1743 * parameter.cs (Parameter.GetSignatureForError): Returns
1744 correct name even if was not defined.
1746 2004-10-13 Raja R Harinath <rharinath@novell.com>
1749 * class.cs (TypeContainer.EmitContext): New property.
1750 (DefineNestedTypes): Create an emitcontext for each part.
1751 (MethodCore.DoDefineParameters): Use container's emitcontext.
1752 Pass type array to InternalParameters.
1753 (MemberBase.DoDefine): Use container's emitcontext.
1754 (FieldMember.Define): Likewise.
1755 (Event.Define): Likewise.
1756 (SetMethod.GetParameterInfo): Change argument to EmitContext.
1757 Pass type array to InternalParameters.
1758 (SetIndexerMethod.GetParameterInfo): Likewise.
1759 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
1760 * delegate.cs (Define): Pass emitcontext to
1761 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
1762 array to InternalParameters.
1763 * expression.cs (ParameterReference.DoResolveBase): Pass
1764 emitcontext to GetParameterInfo.
1765 (ComposedCast.DoResolveAsTypeStep): Remove check on
1766 ec.ResolvingTypeTree.
1767 * parameter.cs (Parameter.Resolve): Change argument to
1768 EmitContext. Use ResolveAsTypeTerminal.
1769 (Parameter.GetSignature): Change argument to EmitContext.
1770 (Parameters.ComputeSignature): Likewise.
1771 (Parameters.ComputeParameterTypes): Likewise.
1772 (Parameters.GetParameterInfo): Likewise.
1773 (Parameters.ComputeAndDefineParameterTypes): Likewise.
1774 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
1775 * support.cs (InternalParameters..ctor): Remove variant that takes
1777 * typemanager.cs (system_intptr_expr): New.
1778 (InitExpressionTypes): Initialize it.
1780 2004-10-12 Chris Toshok <toshok@ximian.com>
1782 * cs-parser.jay: fix location for try_statement and catch_clause.
1784 2004-10-18 Martin Baulig <martin@ximian.com>
1786 * class.cs (FieldMember.Define): Don't access the TypeExpr's
1787 `Type' directly, but call ResolveType() on it.
1788 (MemberBase.DoDefine): Likewise.
1790 * expression.cs (New.DoResolve): Don't access the TypeExpr's
1791 `Type' directly, but call ResolveType() on it.
1792 (ComposedCast.DoResolveAsTypeStep): Likewise.
1794 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
1795 `Type' directly, but call ResolveType() on it.
1797 2004-10-17 John Luke <john.luke@gmail.com>
1799 * class.cs (Operator.GetSignatureForError): use CSharpName
1801 * parameter.cs (Parameter.GetSignatureForError): Returns
1802 correct name even if was not defined.
1804 2004-10-13 Raja R Harinath <rharinath@novell.com>
1807 * class.cs (TypeContainer.EmitContext): New property.
1808 (DefineNestedTypes): Create an emitcontext for each part.
1809 (MethodCore.DoDefineParameters): Use container's emitcontext.
1810 Pass type array to InternalParameters.
1811 (MemberBase.DoDefine): Use container's emitcontext.
1812 (FieldMember.Define): Likewise.
1813 (Event.Define): Likewise.
1814 (SetMethod.GetParameterInfo): Change argument to EmitContext.
1815 Pass type array to InternalParameters.
1816 (SetIndexerMethod.GetParameterInfo): Likewise.
1817 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
1818 * delegate.cs (Define): Pass emitcontext to
1819 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
1820 array to InternalParameters.
1821 * expression.cs (ParameterReference.DoResolveBase): Pass
1822 emitcontext to GetParameterInfo.
1823 (ComposedCast.DoResolveAsTypeStep): Remove check on
1824 ec.ResolvingTypeTree.
1825 * parameter.cs (Parameter.Resolve): Change argument to
1826 EmitContext. Use ResolveAsTypeTerminal.
1827 (Parameter.GetSignature): Change argument to EmitContext.
1828 (Parameters.ComputeSignature): Likewise.
1829 (Parameters.ComputeParameterTypes): Likewise.
1830 (Parameters.GetParameterInfo): Likewise.
1831 (Parameters.ComputeAndDefineParameterTypes): Likewise.
1832 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
1833 * support.cs (InternalParameters..ctor): Remove variant that takes
1835 * typemanager.cs (system_intptr_expr): New.
1836 (InitExpressionTypes): Initialize it.
1838 2004-10-12 Chris Toshok <toshok@ximian.com>
1840 * cs-parser.jay: fix location for try_statement and catch_clause.
1842 2004-10-07 Raja R Harinath <rharinath@novell.com>
1844 More DeclSpace.ResolveType avoidance.
1845 * decl.cs (MemberCore.InUnsafe): New property.
1846 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
1847 with newly created EmitContext.
1848 (FieldMember.Define): Likewise.
1849 * delegate.cs (Delegate.Define): Likewise.
1850 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
1851 only if normal name-lookup fails.
1852 (TypeExpr.DoResolve): Enable error-checking.
1853 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
1854 (SizeOf.DoResolve): Likewise.
1855 (ComposedCast.DoResolveAsTypeStep): Likewise.
1856 (StackAlloc.DoResolve): Likewise.
1857 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
1858 (Block.Unsafe): New property.
1859 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
1860 (Unsafe): Set 'unsafe' flag of contained block.
1861 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
1862 (Fixed.Resolve): Likewise.
1863 (Catch.Resolve): Likewise.
1864 (Using.ResolveLocalVariableDecls): Likewise.
1865 (Foreach.Resolve): Likewise.
1867 2004-10-05 John Luke <john.luke@gmail.com>
1869 * cs-parser.jay: add location to error CS0175
1871 2004-10-04 Miguel de Icaza <miguel@ximian.com>
1873 * ecore.cs (Expression.Constantity): Add support for turning null
1876 * const.cs (Const.Define): Allow constants to be reference types
1877 as long as the value is Null.
1879 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
1881 * namespace.cs (NamespaceEntry.Using): No matter which warning
1882 level is set, check if this namespace name has already been added.
1884 2004-10-03 Ben Maurer <bmaurer@ximian.com>
1886 * expression.cs: reftype [!=]= null should always use br[true,false].
1889 2004-10-03 Marek Safar <marek.safar@seznam.cz>
1892 * attribute.cs: Enum conversion moved to
1893 GetAttributeArgumentExpression to be applied to the all
1896 2004-10-01 Raja R Harinath <rharinath@novell.com>
1898 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
1899 * class.c (TypeContainer.DefineType): Flag error if
1900 base types aren't accessible due to access permissions.
1901 * decl.cs (DeclSpace.ResolveType): Move logic to
1902 Expression.ResolveAsTypeTerminal.
1903 (DeclSpace.ResolveTypeExpr): Thin layer over
1904 Expression.ResolveAsTypeTerminal.
1905 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
1906 Refactor code into NestedAccess. Use it.
1907 (DeclSpace.NestedAccess): New.
1908 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
1909 argument to silence errors. Check access permissions.
1910 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
1911 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
1912 (Cast.DoResolve): Likewise.
1913 (New.DoResolve): Likewise.
1914 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
1915 (TypeOf.DoResolve): Likewise.
1917 * expression.cs (Invocation.BetterConversion): Return the Type of
1918 the better conversion. Implement section 14.4.2.3 more faithfully.
1919 (Invocation.BetterFunction): Make boolean. Make correspondence to
1920 section 14.4.2.2 explicit.
1921 (Invocation.OverloadResolve): Update.
1922 (Invocation): Remove is_base field.
1923 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
1924 (Invocation.Emit): Likewise.
1926 2004-09-24 Marek Safar <marek.safar@seznam.cz>
1928 * cs-parser.jay: Reverted 642 warning fix.
1930 2004-09-23 Marek Safar <marek.safar@seznam.cz>
1933 * decl.cs (FindMemberWithSameName): Indexer can have more than
1936 2004-09-23 Marek Safar <marek.safar@seznam.cz>
1938 * expression.cs (LocalVariableReference.DoResolveLValue):
1939 Do not report warning 219 for out values.
1940 (EmptyExpression.Null): New member to avoid extra allocations.
1942 2004-09-23 Marek Safar <marek.safar@seznam.cz>
1944 * cs-parser.jay: Fix wrong warning 642 report.
1946 * cs-tokenizer.cs (CheckNextToken): New helper;
1947 Inspect next character if is same as expected.
1949 2004-09-23 Martin Baulig <martin@ximian.com>
1951 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
1952 (Convert.ImplicitReferenceConversionExists): Likewise.
1954 2004-11-09 Raja R Harinath <rharinath@novell.com>
1956 * Makefile (DISTFILES): Comment out a few missing files.
1958 2004-10-29 Raja R Harinath <rharinath@novell.com>
1960 * Makefile (bootstrap_libs,bootstrap_libfiles): New.
1961 (bootstrap-libs): New target. Invokes the net_2_0_bootstrap profile.
1962 (gmcs.exe): Invoke bootstrap-libs.
1963 (clean-local): Clean the net_2_0_bootstrap profile too.
1964 (PROGRAM_INSTALL_DIR): New.
1965 (install-local): Use it.
1967 2004-10-13 Martin Baulig <martin@ximian.com>
1969 * generic.cs (TypeManager.InflatedConstraints): New nested class.
1970 (TypeParameter.DefineType): If we're a method type parameter and
1971 that method is overriding something, "inflate" its constraints.
1973 2004-10-12 Martin Baulig <martin@ximian.com>
1975 * expression.cs (MemberAccess.DoResolve): If we're a SimpleName
1976 and have type arguments, create and resolve a ConstructedType.
1978 2004-10-12 Martin Baulig <martin@ximian.com>
1980 * decl.cs (MemberCache.FindMemberToOverride): Use
1981 TypeManager.IsEqual() to compare the parameters and Type.Equals()
1982 to compare the invocationType.
1984 * typemanager.cs (TypeManager.IsEqual): Added support for arrays.
1985 When comparing two type parameters, only do the signature-only
1986 comparision for method type parameters.
1988 2004-10-11 Martin Baulig <martin@ximian.com>
1990 * report.cs: Don't make --fatal abort on warnings, we have
1991 -warnaserror for that.
1993 2004-10-11 Martin Baulig <martin@ximian.com>
1996 (TypeManager.IsEqualGenericType): Removed, use IsEqual() instead.
1997 (TypeManager.IsEqual): Call ourself recursively instead of using
2000 2004-10-11 Martin Baulig <martin@ximian.com>
2002 * class.cs (TypeContainer.DefineType): Only call TypeParameter.Define()
2003 on our own type parameters, not on the ones we inherit from a containing
2006 * expression.cs (Invocation.InferType): Use `==', not `Equals()' for
2009 * generic.cs (TypeParameter.Define): We may only be called once.
2011 * pending.cs (Pending.InterfaceMethod): Call TypeManager.Real_IsEqual()
2012 instead of TypeManager.IsEqual().
2014 2004-09-28 Martin Baulig <martin@ximian.com>
2017 (GenericConstraints.EffectiveBaseClass): New public property.
2018 (TypeParameter.GenericConstraints): New public property.
2019 (ConstructedType.CheckConstraints): Improved.
2021 * convert.cs (Convert.TypeParam_EffectiveBaseType): New private method.
2022 (Convert.TypeParameterConversion): New private method; use this in
2023 ImplicitReferenceConversion() and ImplicitReferenceConversionExists()
2024 for all conversions related to type parameters.
2026 2004-09-24 Martin Baulig <martin@ximian.com>
2028 * convert.cs (Convert.ImplicitReferenceConversion): Added implicit
2029 type parameter conversions for type parameters which are known to
2032 2004-09-24 Martin Baulig <martin@ximian.com>
2034 * generic.cs (GenericConstraints): Added `IsReferenceType' and
2035 `IsValueType' properties.
2037 * support.cs (ReflectionConstraints): Use
2038 Type.GetGenericParameterConstraints() instead of the old hack.
2040 2004-09-24 Martin Baulig <martin@ximian.com>
2042 * generic.cs (GenericConstraints): Moved here and made it an
2045 * support.cs (GenericConstraints): Moved to generic.cs.
2047 2004-09-24 Martin Baulig <martin@ximian.com>
2050 (ReflectionConstraints): Un-nested this class and made it public.
2053 (TypeManager.GetTypeParameterConstraints): New public method.
2054 (TypeManager.HasConstructorConstraint): Use the attributes.
2056 2004-09-24 Martin Baulig <martin@ximian.com>
2058 * support.cs (GenericConstraints): Replaced `HasConstructor',
2059 `IsReferenceType' and `IsValueType' with `Attributes'.
2060 (ReflectionParameters.ReflectionConstraints): Removed the Create()
2061 method and made the .ctor public.
2063 * generic.cs (Constraints.Attributes): New public property.
2064 (Constraints): Renamed `HasConstructor' -> `HasConstructorConstraint',
2065 `IsReferenceType' -> `HasReferenceTypeConstraint' and
2066 `IsValueType' -> `HasValueTypeConstraint'.
2068 2004-09-23 Martin Baulig <martin@ximian.com>
2070 * generic.cs (Constraints): Reflect latest runtime changes.
2072 2004-09-23 Martin Baulig <martin@ximian.com>
2074 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
2075 (Convert.ImplicitReferenceConversionExists): Likewise.
2077 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2079 * class.cs (Operator.Define): Add error 448 and 559 report.
2081 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2083 * class.cs (MemberBase.IsTypePermitted): New protected
2084 method for checking error CS0610.
2086 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2088 * class.cs (TypeContainer.HasExplicitLayout): New property
2089 Returns whether container has StructLayout attribute set Explicit.
2090 (FieldMember): New abstract class for consts and fields.
2091 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
2092 (Field): Reuse FieldMember.
2094 * const.cs (Const): Reuse FieldMember.
2096 * rootcontext.cs: EmitConstants call moved to class.
2098 2004-09-22 Martin Baulig <martin@ximian.com>
2100 Marek and me just fixed one of our oldest bugs: #28562 :-)
2102 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
2104 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
2105 we're an EnumConstant, just return that.
2106 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
2107 an EnumConstant. In this case, we need to use GetValueAsEnumType()
2108 to get the value which'll actually be written into the attribute.
2109 However, we have to use GetValue() to access the attribute's value
2112 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2114 * constant.cs (Constant.IsNegative): New abstract property
2117 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
2118 (StackAlloc.DoResolve): Reused IsNegative.
2120 2004-09-22 Martin Baulig <martin@ximian.com>
2122 * typemanager.cs (TypeManager.LookupGenericTypeContainer): New
2123 public method; like LookupTypeContainer, but also works for
2126 * report.cs (Report.SymbolRelatedToPreviousError): Use
2127 TypeManager.LookupGenericTypeContainer().
2129 2004-09-22 Martin Baulig <martin@ximian.com>
2131 Thanks to Peter Sestoft for this bug report.
2133 * expression.cs (Conditional): If both the `trueExpr' and the
2134 `falseExpr' is a NullLiteral, return a NullLiteral.
2136 2004-09-22 Martin Baulig <martin@ximian.com>
2138 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
2139 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
2140 for the "get_Current" call.
2142 2004-09-21 Martin Baulig <martin@ximian.com>
2144 * convert.cs (Convert.ImplicitReferenceConversion): When
2145 converting to an interface type, first check whether we're
2146 converting from a reference type.
2148 2004-09-14 Martin Baulig <martin@ximian.com>
2150 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
2152 2004-09-14 Marek Safar <marek.safar@seznam.cz>
2155 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
2156 called and is obsolete then this member suppress message
2157 when call is inside next [Obsolete] method or type.
2159 * expression.cs: Use TestObsoleteMethodUsage member.
2161 2004-09-14 Martin Baulig <martin@ximian.com>
2163 * genericparser.cs: Removed.
2165 2004-09-13 Marek Safar <marek.safar@seznam.cz>
2167 * class.cs (MethodCore.CheckBase): Fix bug #65757.
2169 2004-09-12 Marek Safar <marek.safar@seznam.cz>
2171 * attribute.cs (Attribute.Resolve): Add error 653 report.
2173 * class.cs (Class.ApplyAttributeBuilder): Add error 641
2175 (Method.ApplyAttributeBuilder): Add error 685 report.
2176 (Operator.Define): Add error 564 report.
2178 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
2180 * expression.cs (Invocation.DoResolve): Add error
2183 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
2186 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2188 * class.cs (ConstructorInitializer.Resolve):
2189 Wrong error number (515->516).
2191 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2193 * class.cs (Indexer.Define): Add error 631 report.
2195 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2197 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
2199 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2201 * expression.cs (Probe.DoResolve): Add error CS0241 report.
2203 2004-09-10 Marek Safar <marek.safar@seznam.cz>
2205 * cs-parser.jay: Added error CS0241 report.
2207 2004-09-10 Raja R Harinath <rharinath@novell.com>
2209 * cs-parser.jay (fixed_statement): Introduce a scope for the
2210 declaration in the 'fixed' statement.
2212 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2214 * cs-parser.jay: Added CS0230 error report.
2216 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2218 * cs-parser.jay: Added errors CS0231 and CS0257 report.
2220 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2222 * expression.cs (Argument.Resolve): Added error CS0192 and
2225 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2227 C# 2.0 #pragma warning feature
2229 * cs-tokenizer.cs (PreProcessPragma): New method;
2230 Handles #pragma directive.
2232 * report.cs (WarningRegions): New class; Support
2233 class for #pragma warning directive. It tests whether
2234 warning is enabled for a given line.
2236 2004-09-08 Miguel de Icaza <miguel@ximian.com>
2238 * const.cs: Add more descriptive error report, tahnks to
2241 2004-09-08 Marek Safar <marek.safar@seznam.cz>
2243 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
2245 2004-09-07 Miguel de Icaza <miguel@ximian.com>
2247 * expression.cs: Apply patch from Ben: Remove dead code from
2248 ArrayCreation, and remove the TurnintoConstant call in const.cs,
2249 as that code just threw an exception anwyays.
2251 * const.cs: Remove the call to the turnintoconstant, for details
2254 * literal.cs: The type of the null-literal is the null type; So
2255 we use a placeholder type (literal.cs:System.Null, defined here)
2258 * expression.cs (Conditional.DoResolve): Remove some old code that
2259 is no longer needed, conversions have been fixed.
2261 (ArrayCreationExpression.DoResolve): Return false if we fail to
2262 resolve the inner expression.
2264 2004-09-07 Raja R Harinath <rharinath@novell.com>
2267 * cs-parser.jay (delegate_declaration): Record a delegate
2268 declaration as a type declaration.
2269 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
2271 2004-09-06 Miguel de Icaza <miguel@ximian.com>
2273 * parameter.cs: Do not crash if the type can not be resolved.
2275 * expression.cs: Report errors with unsafe pointers, fixes #64896
2277 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
2279 * expression.cs: Pointer arith always needs to do a conv.i
2280 if the operand is a long. fix 65320
2282 2004-09-04 Marek Safar <marek.safar@seznam.cz>
2284 Fixed cs0619-37.cs, cs0619-38.cs
2286 * enum.cs (GetObsoleteAttribute): Removed.
2288 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
2289 on Enum member is double staged. The first is tested member
2292 2004-09-04 Marek Safar <marek.safar@seznam.cz>
2294 Fixed #56986, #63631, #65231
2296 * class.cs: (TypeContainer.AddToMemberContainer): New method,
2297 adds member to name container.
2298 (TypeContainer.AddToTypeContainer): New method, adds type to
2300 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
2301 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
2302 AddOperator): Simplified by reusing AddToMemberContainer.
2303 (TypeContainer.UserDefinedStaticConstructor): Changed to property
2305 (Method.CheckForDuplications): Fixed implementation to test all
2307 (MemberBase): Detection whether member is explicit interface
2308 implementation is now in constructor.
2309 (MemberBase.UpdateMemberName): Handles IndexerName.
2310 (Accessor): Changed to keep also location information.
2311 (AbstractPropertyEventMethod): Is derived from MemberCore.
2312 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
2313 will be emited or not.
2314 (PropertyBase.AreAccessorsDuplicateImplementation):
2315 Tests whether accessors are not in collision with some method.
2316 (Operator): Is derived from MethodCore to simplify common
2319 * decl.cs (Flags.TestMethodDuplication): Test for duplication
2321 (DeclSpace.AddToContainer): Adds the member to defined_names
2322 table. It tests for duplications and enclosing name conflicts.
2324 * enum.cs (EnumMember): Clean up to reuse the base structures
2326 2004-09-03 Martin Baulig <martin@ximian.com>
2328 Merged latest changes into gmcs. Please keep this comment in
2329 here, it makes it easier for me to see what changed in MCS since
2330 the last time I merged.
2332 2004-09-03 Martin Baulig <martin@ximian.com>
2334 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
2335 into TypeContainer, to make partial classes work again.
2337 2004-09-03 Martin Baulig <martin@ximian.com>
2339 * rootcontext.cs (RootContext.V2): Removed.
2341 2004-03-23 Martin Baulig <martin@ximian.com>
2343 * expression.cs (Invocation.OverloadResolve): Added `bool
2344 may_fail' argument and use it instead of the Location.IsNull() hack.
2346 2004-09-09 Martin Baulig <martin@ximian.com>
2348 * cs-parser.jay (namespace_declaration): Fixed CS0134 reporting.
2350 2004-09-09 Martin Baulig <martin@ximian.com>
2352 * generic.cs (TypeParameter.DefineType): Added support for
2353 explicit interface methods.
2355 2004-09-09 Martin Baulig <martin@ximian.com>
2357 * README.Changes: New document. Started to list important changes
2358 between MCS and GMCS here.
2360 2004-09-08 Martin Baulig <martin@ximian.com>
2363 (TypeContainer.CheckRecursiveDefinition): New protected method.
2364 (TypeContainer.DefineType): Move the CS0146 check into
2365 CheckRecursiveDefinition().
2367 2004-09-06 Martin Baulig <martin@ximian.com>
2369 * generic.cs (ConstructedType.CheckConstraints): Allow builtin
2370 types for the constructor constraint.
2372 2004-09-03 Martin Baulig <martin@ximian.com>
2374 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
2375 into TypeContainer, to make partial classes work again.
2377 2004-09-03 Martin Baulig <martin@ximian.com>
2379 * rootcontext.cs (RootContext.V2): Removed.
2381 2004-03-23 Martin Baulig <martin@ximian.com>
2383 * expression.cs (Invocation.OverloadResolve): Added `bool
2384 may_fail' argument and use it instead of the Location.IsNull() hack.
2386 2004-09-03 Martin Baulig <martin@ximian.com>
2388 Merged latest changes into gmcs. Please keep this comment in
2389 here, it makes it easier for me to see what changed in MCS since
2390 the last time I merged.
2392 2004-09-03 Raja R Harinath <rharinath@novell.com>
2395 * expression.cs (BetterConversion): Don't allow either conversion
2396 to be null. Remove redundant implicit conversion test when 'q ==
2397 null' -- when this function is invoked, we already know that the
2398 implicit conversion exists.
2399 (BetterFunction): Assume that 'best' is non-null. Remove
2400 redundant reimplementation of IsApplicable when 'best' is null.
2401 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
2402 number of arguments.
2403 (IsAncestralType): Extract from OverloadResolve.
2404 (OverloadResolve): Make robust to the MethodGroupExpr being
2405 unsorted. Implement all the logic of Section 14.5.5.1, and
2406 support overloading of methods from multiple applicable types.
2407 Clean up logic somewhat. Don't pass null methods to BetterFunction.
2409 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
2410 (RealError, Warning): Append type of report to related symbol.
2412 2004-09-03 Marek Safar <marek.safar@seznam.cz>
2414 * enum.cs: Fixed CLS-Compliance checks for enum members.
2415 Error tests cs3008-8.cs, cs3014-8.cs
2417 2004-09-02 Marek Safar <marek.safar@seznam.cz>
2419 Fixed bug #62342, #63102
2420 * class.cs: ImplementIndexer uses member.IsExplicitImpl
2421 like ImplementMethod.
2423 2004-09-02 Marek Safar <marek.safar@seznam.cz>
2425 * attribute.cs (Attribute.GetAttributeArgumentExpression):
2428 2004-09-02 Martin Baulig <martin@ximian.com>
2430 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
2431 TypeManager.GetArgumentTypes() rather than calling GetParameters()
2434 2004-09-01 Marek Safar <marek.safar@seznam.cz>
2436 C# 2.0 Static classes implemented
2438 * class.cs (TypeContainer): instance_constructors,
2439 initialized_fields, initialized_static_fields,
2440 default_constructor, base_inteface_types are protected to be
2441 accessible from StaticClass.
2442 (TypeContainer.DefineDefaultConstructor): New virtual method
2443 for custom default constructor generating
2444 (StaticClass): New class to handle "Static classes" feature.
2446 * cs-parser.jay: Handle static keyword on class like instance
2449 * driver.cs: Added "/langversion" command line switch with two
2450 options (iso-1, default).
2452 2004-08-31 Marek Safar <marek.safar@seznam.cz>
2454 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
2456 2004-08-31 Miguel de Icaza <miguel@ximian.com>
2458 * delegate.cs: Style.
2460 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
2462 * delegate.cs: Add seperate instance expr field for miguel.
2464 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
2466 * PointerArithmetic (Resolve): make sure we are not doing
2467 pointer arith on void*. Also, make sure we are resolved
2468 by not setting eclass until resolve.
2470 All callers: Make sure that PointerArithmetic gets resolved.
2472 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
2474 * ArrayCreation (LookupType): If the type does not resolve
2475 to an array, give an error.
2477 2004-08-27 Marek Safar <marek.safar@seznam.cz>
2479 * statement.cs (Try.Resolve): Fixed bug #64222
2481 2004-08-27 Martin Baulig <martin@ximian.com>
2484 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
2487 2004-08-26 Marek Safar <marek.safar@seznam.cz>
2489 * ecore.cs (Constantify): Get underlying type via
2490 System.Enum.GetUnderlyingType to avoid StackOverflow on the
2491 Windows in special cases.
2493 2004-08-26 Marek Safar <marek.safar@seznam.cz>
2495 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
2496 for obtaining also private methods.
2497 (GetRemoveMethod): Used GetRemoveMethod (true)
2498 for obtaining also private methods.
2500 2004-09-02 Martin Baulig <martin@ximian.com>
2502 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
2503 TypeManager.GetArgumentTypes() rather than calling GetParameters()
2506 2004-08-27 Martin Baulig <martin@ximian.com>
2509 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
2512 2004-08-25 Martin Baulig <martin@ximian.com>
2514 * support.cs (ReflectionParameters..ctor): If this is a generic
2515 method, retrieve and store its type parameters.
2516 (InternalParameters..ctor): Added `TypeParameter[]' argument.
2517 (ReflectionParameters.GenericConstraints): The argument specifies
2518 the type parameter, not the method parameter.
2519 (InternalParameters.GenericConstraints): Likewise.
2521 * generic.cs (TypeParameter.DefineType): Correctly handle
2522 constraints wrt. generic methods in interfaces and their
2525 2004-08-24 Martin Baulig <martin@ximian.com>
2527 * generic.cs (TypeParameter.IsSubclassOf): New public method.
2528 (Constraints.IsSubclassOf): New internal method.
2530 * typemanager.cs (TypeManager.FindMembers): Added special support
2531 for GenericTypeParameterBuilder's.
2532 (TypeManager.IsSubclassOf, IsFamilyAccessible): Added support for
2535 2004-08-24 Martin Baulig <martin@ximian.com>
2538 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
2539 this for accessibility checks.
2540 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
2541 IsNestedFamilyAccessible.
2542 (TypeManager.IsSubclassOf): New method, do what the name actually
2545 2004-08-24 Martin Baulig <martin@ximian.com>
2547 * expression.cs (MemberAccess.DoResolve): When resolving ourselves
2548 as a SimpleName, include the generic arity.
2550 2004-08-24 Martin Baulig <martin@ximian.com>
2552 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
2553 MethodAttributes.HideBySig for operators.
2555 2004-08-23 Martin Baulig <martin@ximian.com>
2557 Back to the old error reporting system :-)
2559 * report.cs (Message): Removed.
2560 (Report.MessageData, ErrorData, WarningData): Removed.
2561 (Report.Error, Warning): Back to the old system.
2563 2004-08-23 Martin Baulig <martin@ximian.com>
2565 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
2567 * class.cs (TypeContainer.ParentContainer): New public virtual
2568 method; replaces the explicit interface implementation.
2569 (ClassPart.ParentContainer): Override.
2571 2004-08-23 Martin Baulig <martin@ximian.com>
2573 * statement.cs (Switch): Added support for constant switches; see
2574 #59428 or test-285.cs.
2576 2004-08-22 Marek Safar <marek.safar@seznam.cz>
2579 * statement.cs (GetEnumeratorFilter): Removed useless
2580 logic because C# specs is strict. GetEnumerator must be
2583 2004-08-22 Martin Baulig <martin@ximian.com>
2585 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2586 a switch and may break, reset the barrier. Fixes #59867.
2588 2004-08-22 Marek Safar <marek.safar@seznam.cz>
2590 CLS-Compliance speed up (~5% for corlib)
2592 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
2593 New method. Tests container for CLS-Compliant names
2595 * class.cs (TypeContainer.VerifyClsName): New method.
2596 Checks whether container name is CLS Compliant.
2597 (Constructor): Implements IMethodData.
2599 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
2600 low-case table for CLS Compliance test.
2601 (MemberCache.VerifyClsParameterConflict): New method.
2602 Checks method parameters for CS3006 error.
2604 * enum.cs (EnumMember): Is derived from MemberCore.
2605 (Enum.VerifyClsName): Optimized for better performance.
2607 2004-08-06 Marek Safar <marek.safar@seznam.cz>
2609 * report.cs: Renamed Error_T to Error and changed all
2612 2004-08-06 Marek Safar <marek.safar@seznam.cz>
2614 * class.cs (TypeContainer.IndexerArrayList): New inner class
2615 container for indexers.
2616 (TypeContainer.DefaultIndexerName): New constant for default
2617 indexer name. Replaced all "Item" with this constant.
2618 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
2620 * typemanager.cs (TypeManager.default_member_ctor): Cache here
2621 DefaultMemberAttribute constructor.
2623 2004-08-05 Martin Baulig <martin@ximian.com>
2625 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
2628 2004-08-05 Marek Safar <marek.safar@seznam.cz>
2630 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
2631 multi platforms problem.
2633 * compiler.csproj: Included shared files.
2635 2004-08-04 Marek Safar <marek.safar@seznam.cz>
2637 Fix bug 60333, 55971 in the more general way
2638 * attribute.cs (Attribute.GetAttributeArgumentExpression):
2639 Added arg_type argument for constant conversion.
2640 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
2642 2004-08-04 Marek Safar <marek.safar@seznam.cz>
2645 * class.cs (TypeContainer ): New inner classes MethodArrayList,
2646 OperatorArrayList, MethodCoreArrayList for typecontainer
2647 containers. Changed class member types to these new types.
2648 (MethodArrayList.DefineMembers): Added test for CS0659.
2650 2004-08-04 Miguel de Icaza <miguel@ximian.com>
2652 * cfold.cs: Synchronize the folding with the code in expression.cs
2653 Binary.DoNumericPromotions for uint operands.
2655 * attribute.cs: Revert patch from Raja, it introduced a regression
2656 while building Blam-1.2.1 (hard to isolate a test case).
2658 2004-08-04 Marek Safar <marek.safar@seznam.cz>
2662 (TypeContainer.Define): Renamed to DefineContainerMembers because of
2664 (MethodCore.parent_method): New member. The method we're overriding
2665 if this is an override method.
2666 (MethodCore.CheckBase): Moved from Method class and made common.
2667 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
2669 (MethodCore.CheckForDuplications): New abstract method. For custom
2670 member duplication search in a container
2671 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
2672 method and its return type.
2673 (Event.conflict_symbol): New member. Symbol with same name in the
2677 (MemberCache.FindMemberWithSameName): New method. The method
2678 is looking for conflict with inherited symbols.
2680 2004-08-04 Martin Baulig <martin@ximian.com>
2682 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
2684 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
2686 2004-08-03 Marek Safar <marek.safar@seznam.cz>
2688 * report.cs (Message): New enum for better error, warning reference in
2690 (MessageData): New inner abstract class. It generally handles printing of
2691 error and warning messages.
2692 Removed unused Error, Warning, Message methods.
2694 2004-08-03 Marek Safar <marek.safar@seznam.cz>
2696 Fix for cs0592-8.cs test
2698 (Attributable.ValidAttributeTargets): Made public.
2699 (Attribute.ExplicitTarget): New member for explicit target value.
2700 (Attribute.CheckTargets): Now we translate explicit attribute
2701 target to Target here.
2703 2004-08-03 Ben Maurer <bmaurer@ximian.com>
2705 * ecore.cs (MethodGroupExpr): new IsBase property.
2707 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
2709 * delegate.cs (DelegateCreation): store a MethodGroupExpr
2710 rather than an instance expr.
2712 (DelegateCreation.Emit): Use the method group rather than
2713 the instance expression. Also, if you have base.Foo as the
2714 method for a delegate, make sure to emit ldftn, not ldftnvirt.
2716 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
2718 (NewDelegate.DoResolve): Only check for the existance of Invoke
2719 if the method is going to be needed. Use MethodGroupExpr.
2721 (NewDelegate.Emit): Remove, DelegateCreation implements this.
2723 * expression.cs: For pointer arith., make sure to use
2724 the size of the type, not the size of the pointer to
2727 2004-08-03 Marek Safar <marek.safar@seznam.cz>
2730 * class.cs (Class): Added error CS0502 test.
2732 2004-08-03 John Luke <jluke@cfl.rr.com>
2733 Raja R Harinath <rharinath@novell.com>
2736 * attribute.cs (Attribute.complained_before): New flag.
2737 (Attribute.ResolveType, Attribute.Resolve),
2738 (Attribute.DefinePInvokeMethod): Set it.
2739 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
2741 2004-08-03 Martin Baulig <martin@ximian.com>
2743 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
2744 use a user-defined operator; we still need to do numeric
2745 promotions in case one argument is a builtin type and the other
2746 one has an implicit conversion to that type. Fixes #62322.
2748 2004-08-18 Martin Baulig <martin@ximian.com>
2750 * class.cs (Method.Define): Use the correct method name when
2751 creating the MethodBuilder for a generic method.
2753 2004-08-17 Martin Baulig <martin@ximian.com>
2755 * generic.cs (Constraints): Support type parameter constraints.
2757 2004-08-16 Martin Baulig <martin@ximian.com>
2759 * cs-tokenizer.cs (Tokenizer.TypeOfParsing): New public property.
2760 (Token.GENERIC_DIMENSION): New token; this is returned if we
2761 encounter an unbound generic type in a typeof() expression.
2763 * cs-parser.jay (opt_type_argument_list): Added GENERIC_DIMENSION;
2764 this token is only generated while parsing a typeof() expression.
2765 (typeof_expression): Removed the old unbound_type hack.
2767 * generic.cs (TypeArguments.IsUnbound): New public property.
2769 * decl.cs (MemberName): Added support for unbound types.
2771 2004-08-14 Martin Baulig <martin@ximian.com>
2774 (TypeManager.IsEqualGenericInstance): New static method.
2775 (TypeManager.IsSubclassOrNestedChildOf, IsSubclassOf): This is
2776 just used to check accessibility, so follow the rules of 26.1.6.
2778 * expression.cs (MemberAccess.ResolveAsTypeStep): Return a
2779 ConstructedType instead of a TypeExpression if we have type arguments.
2781 * cs-parser.jay (typeof_expression): Support unbound generic types.
2783 * ecore.cs (UnboundTypeExpression): New public class.
2785 2004-08-12 Martin Baulig <martin@ximian.com>
2787 * typemanager.cs (TypeManager.IsNestedChildOf): Use
2788 TypeManager.IsEqual() rather than `=='.
2790 * decl.cs (DeclSpace.CheckAccessLevel): Use `tb.FullName' for
2791 generic instances as well.
2793 2004-08-12 Martin Baulig <martin@ximian.com>
2795 * expression.cs (Invocation.InferType): We can only infer method
2796 type parameters. Fixes #62647.
2798 2004-08-11 Martin Baulig <martin@ximian.com>
2800 * class.cs (TypeContainer.DefineType): Create the TypeBuilder
2801 before resolving the base classes.
2803 2004-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2805 * Makefile: install .mdb file too.
2807 2004-08-05 Martin Baulig <martin@ximian.com>
2809 * ecore.cs (FieldExpr.DoResolveLValue): If we're resolving a field
2810 initializer, the current type is just the TypeBuilder, not the
2811 instantiated generic type.
2812 (FieldExpr.IsFieldInitializer): New public property.
2814 2004-08-04 Martin Baulig <martin@ximian.com>
2816 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
2818 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
2820 2004-08-03 Martin Baulig <martin@ximian.com>
2822 * class.cs (MethodData.Define): If we're an explicit
2823 implementation, remove the generic arity from the type name.
2825 2004-08-03 Martin Baulig <martin@ximian.com>
2827 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
2828 use a user-defined operator; we still need to do numeric
2829 promotions in case one argument is a builtin type and the other
2830 one has an implicit conversion to that type. Fixes #62322.
2832 2004-08-02 Martin Baulig <martin@ximian.com>
2834 * class.cs (TypeContainer.ifaces): Make this a `Type[]', not a
2836 (TypeContainer.GetClassBases): Return the unexpanded list of
2837 interfaces; we expand them later.
2838 (TypeContainer.DefineType): After creating the TypeBuilder, call
2839 TypeManager.ExpandInterfaces() to get an expanded and resolved
2842 * ecore.cs (TypeExpr.GetInterfaces): Removed
2844 * generics.cs (Constraints.InterfaceConstraints): Remove.
2845 (TypeParameter.DefineType): Call TypeManager.RegisterBuilder() to
2846 register the interface constraints.
2849 (TypeManager.AddUserType): Removed the `ifaces' argument.
2850 (TypeManager.AddTypeParameter): Likewise.
2851 (TypeManager.AddUserInterface): Removed, was unused.
2852 (TypeManager.RegisterBuilder): Take a `Type[]' instead of a
2853 `TypeExpr[]' array for the interfaces.
2854 (TypeManager.ExpandInterfaces): Call this after the TypeBuilder
2855 has been defined, returns a list of the resolved interfaces types.
2856 (TypeManager.GetInterfaces): Return a `Type[]', not a `TypeExpr[]'.
2857 (TypeManager.GetExplicitInterfaces): Likewise.
2859 2004-08-02 Martin Baulig <martin@ximian.com>
2861 * expression.cs (Invocation.EmitCall): If we're invoking a method
2862 on a type parameter, use the new `Constrained' prefix opcode.
2864 2004-08-02 Martin Baulig <martin@ximian.com>
2866 * statement.cs (LocalInfo.Flags): Added `IsThis'.
2867 (LocalInfo.IsThis): New public property.
2868 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
2870 2004-08-01 Martin Baulig <martin@ximian.com>
2872 * class.cs (TypeContainer.GetClassBases): Don't set the default
2873 here since we may get called from GetPartialBases().
2874 (TypeContainer.DefineType): If GetClassBases() didn't return a
2875 parent, use the default one.
2877 2004-07-30 Martin Baulig <martin@ximian.com>
2879 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
2881 * class.cs (SourceMethod): New public class, derive from the
2882 symbol writer's ISourceMethod.
2883 (Method): Use the new symbol writer API.
2885 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
2886 as argument and use the new symbol writer.
2889 (SourceFile): Implement the symbol writer's ISourceFile.
2890 (Location.SymbolDocument): Removed.
2891 (Location.SourceFile): New public property.
2893 * symbolwriter.cs: Use the new symbol writer API.
2895 2004-07-30 Raja R Harinath <rharinath@novell.com>
2897 * Makefile (install-local): Remove. Functionality moved to
2900 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
2902 * Makefile: Install mcs.exe.config file together with mcs.exe.
2903 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
2904 correct runtime version.
2906 2004-07-25 Martin Baulig <martin@ximian.com>
2909 (TypeContainer.RegisterOrder): Removed, this was unused.
2910 (TypeContainer, interface_order): Removed.
2911 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
2912 TypeContainer as argument since we can also be called with a
2913 `PartialContainer' for a partial class/struct/interface.
2914 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
2915 of checking whether we're an `Interface' - we could be a
2917 (PartialContainer.Register): Override; call
2918 AddClass()/AddStruct()/AddInterface() on our parent.
2920 * cs-parser.jay (interface_member_declaration): Add things to the
2921 `current_container', not the `current_class'.
2923 * rootcontext.cs (RegisterOrder): The overloaded version which
2924 takes an `Interface' was unused, removed.
2926 * typemanager.cs (TypeManager.LookupInterface): Return a
2927 `TypeContainer', not an `Interface'.
2928 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
2929 contain a `PartialContainer' for an interface, so check it's
2930 `Kind' to figure out what it is.
2932 2004-07-25 Martin Baulig <martin@ximian.com>
2934 * class.cs (Class.DefaultTypeAttributes): New public constant.
2935 (Struct.DefaultTypeAttributes): Likewise.
2936 (Interface.DefaultTypeAttributes): Likewise.
2937 (PartialContainer.TypeAttr): Override this and add the
2938 DefaultTypeAttributes.
2940 2004-07-25 Martin Baulig <martin@ximian.com>
2942 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
2943 we can just use the `Parent' field instead.
2945 2004-07-25 Martin Baulig <martin@ximian.com>
2947 * class.cs (TypeContainer.Emit): Renamed to EmitType().
2949 2004-07-25 Martin Baulig <martin@ximian.com>
2951 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
2952 our parts before defining any methods.
2953 (TypeContainer.VerifyImplements): Make this virtual.
2954 (ClassPart.VerifyImplements): Override and call VerifyImplements()
2955 on our PartialContainer.
2957 2004-07-25 Martin Baulig <martin@ximian.com>
2959 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
2961 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
2962 argument, we can just use the `Parent' field instead.
2965 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
2966 (MemberBase.DoDefine): Likewise.
2968 2004-07-24 Martin Baulig <martin@ximian.com>
2970 * decl.cs (MemberCore.Parent): New public field.
2971 (DeclSpace.Parent): Moved to MemberCore.
2973 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
2974 (MemberBase.ctor): Added TypeContainer argument, pass it to our
2976 (FieldBase, Field, Operator): Likewise.
2977 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
2978 (EventField, Event): Likewise.
2980 2004-07-23 Martin Baulig <martin@ximian.com>
2982 * class.cs (PartialContainer): New public class.
2983 (ClassPart): New public class.
2984 (TypeContainer): Added support for partial classes.
2985 (TypeContainer.GetClassBases): Splitted some of the functionality
2986 out into GetNormalBases() and GetPartialBases().
2988 * cs-tokenizer.cs (Token.PARTIAL): New token.
2989 (Tokenizer.consume_identifier): Added some hacks to recognize
2990 `partial', but only if it's immediately followed by `class',
2991 `struct' or `interface'.
2993 * cs-parser.jay: Added support for partial clases.
2995 2004-07-23 Martin Baulig <martin@ximian.com>
2997 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
2998 a `DeclSpace' and also made it readonly.
2999 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
3000 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
3001 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
3003 * cs-parser.jay: Pass the `current_class', not the
3004 `current_container' (at the moment, this is still the same thing)
3005 to a new Method, Property, Event, Indexer or Constructor.
3007 2004-07-23 Martin Baulig <martin@ximian.com>
3009 * cs-parser.jay (CSharpParser): Added a new `current_class' field
3010 and removed the `current_interface' one.
3011 (struct_declaration, class_declaration, interface_declaration):
3012 Set `current_class' to the newly created class/struct/interface;
3013 set their `Bases' and call Register() before parsing their body.
3015 2004-07-23 Martin Baulig <martin@ximian.com>
3017 * class.cs (Kind): New public enum.
3018 (TypeContainer): Made this class abstract.
3019 (TypeContainer.Kind): New public readonly field.
3020 (TypeContainer.CheckDef): New public method; moved here from
3022 (TypeContainer.Register): New public abstract method.
3023 (TypeContainer.GetPendingImplementations): New public abstract
3025 (TypeContainer.GetClassBases): Removed the `is_class' and
3026 `is_iface' parameters.
3027 (TypeContainer.DefineNestedTypes): Formerly known as
3029 (ClassOrStruct): Made this class abstract.
3031 * tree.cs (RootTypes): New public type.
3033 2004-07-20 Martin Baulig <martin@ximian.com>
3035 * tree.cs (Tree.RecordNamespace): Removed.
3036 (Tree.Namespaces): Removed.
3038 * rootcontext.cs (RootContext.IsNamespace): Removed.
3040 * cs-parser.jay (namespace_declaration): Just create a new
3041 NamespaceEntry here.
3043 2004-07-21 Lluis Sanchez Gual <lluis@novell.com>
3045 * Makefile: Install gmcs.exe.config file together with gmcs.exe.
3046 * gmcs.exe.config: Renamed from mcs.exe.config. Added supportedRuntime
3047 entry to make sure it runs in the correct runtime version.
3049 2004-07-18 Martin Baulig <martin@ximian.com>
3051 * generic.cs (ConstructedType.CheckConstraints): Improved
3052 constraints checking.
3054 2004-07-18 Martin Baulig <martin@ximian.com>
3056 * expression.cs (Invocation.BetterMethod): Call
3057 TypeManager.TypeToCoreType() on all types and removed my previous
3058 hack; we're already doig the right thing here.
3060 2004-07-17 Martin Baulig <martin@ximian.com>
3062 * decl.cs (MemberName.MakeName): Create the "class`1" names here.
3064 2004-07-16 Martin Baulig <martin@ximian.com>
3066 * iterators.cs: Added generics support.
3068 2004-07-16 Martin Baulig <martin@ximian.com>
3070 * iterators.cs: Rewrote this. We're now using one single Proxy
3071 class for both the IEnumerable and the IEnumerator interface and
3072 `Iterator' derives from Class so we can use the high-level API.
3074 * class.cs (TypeContainer.AddIterator): New method.
3075 (TypeContainer.DoDefineType): New protected virtual method, which
3076 is called from DefineType().
3077 (TypeContainer.DoDefineMembers): Call DefineType() and
3078 DefineMembers() on all our iterators.
3079 (TypeContainer.Emit): Call Emit() on all our iterators.
3080 (TypeContainer.CloseType): Call CloseType() on all our iterators.
3082 * codegen.cs (EmitContext.CurrentIterator): New public field.
3084 2004-07-15 Martin Baulig <martin@ximian.com>
3087 (TypeManager.not_supported_exception_type): New type.
3089 2004-07-14 Martin Baulig <martin@ximian.com>
3092 (TypeManager.generic_ienumerable_type): New type.
3093 (TypeManager.generic_ienumerator_type): New type.
3096 (RootContext.interfaces_first_stage): Added
3097 "System.Collections.Generic.IEnumerator`1" and
3098 "System.Collections.Generic.IEnumerable`1".
3100 2004-07-14 Martin Baulig <martin@ximian.com>
3102 * iterators.cs: Use real error numbers.
3104 2004-07-14 Martin Baulig <martin@ximian.com>
3106 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
3107 requires this to be a System.Collection.IEnumerable and not a
3108 class implementing that interface.
3109 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
3111 2004-07-13 Marek Safar <marek.safar@seznam.cz>
3113 * class.cs: Fixed previous fix, it broke some error tests.
3115 2004-07-12 Martin Baulig <martin@ximian.com>
3117 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
3120 2004-07-14 Martin Baulig <martin@ximian.com>
3122 * decl.cs, expression.cs, generic.cs: Use a backqoute (`) and not
3123 an exclamation mark (!) for the generic arity to reflect the
3124 latest spec changes; ie. use "System.Collections.Generic.IList`1".
3126 2004-07-13 Martin Baulig <martin@ximian.com>
3128 * cs-tokenizer.cs (Tokenizer.parse_less_than): Allow array rank
3129 specifiers being part of a type argument.
3131 2004-07-13 Martin Baulig <martin@ximian.com>
3133 * expression.cs (MemberAccess.ResolveAsTypeStep): Use the full `!'
3134 name for generic types.
3136 2004-07-13 Martin Baulig <martin@ximian.com>
3138 * assign.cs (Assign.DoResolve): Moved the CS0131 check up a little
3141 2004-07-09 Miguel de Icaza <miguel@ximian.com>
3143 * assign.cs (LocalTemporary): Add new argument: is_address,If
3144 `is_address' is true, then the value that we store is the address
3145 to the real value, and not the value itself.
3147 * ecore.cs (PropertyExpr): use the new local temporary
3148 stuff to allow us to handle X.Y += z (where X is a struct)
3150 2004-07-08 Martin Baulig <martin@ximian.com>
3152 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
3153 not always return, just like we're doing in Using.Resolve().
3155 2004-07-07 Miguel de Icaza <miguel@ximian.com>
3157 * cs-parser.jay (fixed_statement): flag this as Pinned.
3159 2004-07-06 Miguel de Icaza <miguel@ximian.com>
3161 * typemanager.cs (TypeManager): Removed MakePinned method, this
3162 mechanism is replaced with the .NET 2.x compatible mechanism of
3163 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
3165 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
3166 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
3167 `IsFixed' property which has a different meaning.
3169 2004-07-02 Raja R Harinath <rharinath@novell.com>
3171 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
3172 visible from inside a nested class, not just the names of the
3173 immediately enclosing class.
3176 2004-06-24 Raja R Harinath <rharinath@novell.com>
3178 * expression.cs (BetterConversion): Remove buggy special-case
3179 handling of "implicit constant expression conversions". At this
3180 point, we already know that the conversion is possible -- we're
3181 only checking to see which is better.
3183 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3185 * cs-parser.jay: Added error CS0210 test.
3187 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3189 * cs-parser.jay: Added error CS0134 test.
3191 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3194 * cs-parser.jay: Added error CS0145 test.
3196 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3198 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
3200 2004-06-23 Ben Maurer <bmaurer@ximian.com>
3202 * expression.cs (StackAlloc.Resolve): The argument may not
3203 be a constant; deal with this case.
3205 2004-06-23 Marek Safar <marek.safar@seznam.cz>
3207 * attribute.cs (IndexerName_GetIndexerName): Renamed to
3208 GetIndexerAttributeValue.
3209 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
3211 * class.cs (Indexer.Define): Added error tests for CS0415,
3214 2004-06-23 Miguel de Icaza <miguel@ximian.com>
3216 * attribute.cs (Attribute.Resolve): Keep field code in sync with
3219 2004-06-23 Martin Baulig <martin@ximian.com>
3221 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
3222 neither return nor throw, reset the barrier as well. Fixes #60457.
3224 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
3226 * class.cs : EventAttributes is now set to None by default.
3227 This fixes bug #60459.
3229 2004-06-18 Marek Safar <marek.safar@seznam.cz>
3232 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
3233 Don't throw exception but return null (it's sufficient now).
3235 2004-06-18 Marek Safar <marek.safar@seznam.cz>
3237 * typemanager.cs (GetArgumentTypes): Faster implementation.
3239 2004-06-18 Martin Baulig <martin@ximian.com>
3241 * attribute.cs (Attribute.Resolve): Check whether we're an
3242 EmptyCast which a Constant child. Fixes #60333.
3244 2004-06-17 Ben Maurer <bmaurer@ximian.com>
3246 * statement.cs (EmitCollectionForeach): Account for the fact that
3247 not all valuetypes are in areas which we can take the address of.
3248 For these variables, we store to a temporary variable. Also, make
3249 sure that we dont emit a `callvirt' on a valuetype method.
3251 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3253 * expression.cs (StackAlloc.DoReSolve): Added test for
3254 negative parameter (CS0247).
3256 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3259 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
3261 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3264 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
3267 2004-06-14 Marek Safar <marek.safar@seznam.cz>
3269 Fix bug #58254 & cs1555.cs, cs1556.cs
3270 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
3272 2004-06-14 Marek Safar <marek.safar@seznam.cz>
3274 * cs-parser.jay: Added error CS1669 test for indexers.
3276 2004-06-18 Martin Baulig <martin@ximian.com>
3278 * generics.cs (GenericMethod.ctor): Don't take an Attributes
3279 argument. Fixes #60441.
3281 2004-06-16 Ben Maurer <bmaurer@ximian.com>
3282 * ecore.cs (MethodGroupExpr.Name): Revert Martin's patch.
3283 The name needs to have the actual name of the method in order
3284 for other tests (such as the one in OverloadResolve for Invoke
3285 on a delegate) to work. As well, it does not really help
3286 error reporting because the method group had multiple methods.
3287 * Makefile: Remove MCS_DEBUG, you can enable with the DEBUG_FLAGS.
3288 Make profiling work.
3290 2004-06-13 Martin Baulig <martin@ximian.com>
3292 * cs-parser.jay: Don't allow generic attributes.
3294 2004-06-13 Martin Baulig <martin@ximian.com>
3296 * class.cs (MemberBase.DoDefineBase): New protected method.
3297 (MemberBase.DoDefine): Compute the `flags' in the new
3298 DoDefineBase() which must be called first.
3299 (Method.Define): Call DoDefineBase() first so we have the flags
3300 when defining the generic method.
3302 * cs-parser.jay (interface_method_declaration): Support generic methods.
3304 2004-06-13 Martin Baulig <martin@ximian.com>
3306 * decl.cs (TypeName): Removed.
3307 (MemberName): Removed TypeName and MemberNow; now we just have
3310 * cs-parser.jay: Don't distinguish between type arguments and type
3311 parameters in the grammar and simplified the rules a bit. The
3312 reduce/reduce conflicts are now gone (except the one we inherited
3315 2004-06-11 Martin Baulig <martin@ximian.com>
3317 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
3318 call this twice: for params and varargs methods.
3320 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3323 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
3325 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3327 * attribute.cs (Attribute.GetValidTargets): Made public.
3330 (AbstractPropertyEventMethod): New class for better code sharing.
3331 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
3333 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
3335 2004-06-09 Martin Baulig <martin@ximian.com>
3337 * cs-parser.jay: Removed a reduce/reduce conflict.
3339 2004-06-03 Martin Baulig <martin@ximian.com>
3341 * generic.cs (ConstructedType.GetMemberAccess): Renamed to
3342 GetSimpleName() and return a SimpleName.
3344 * ecore.cs (SimpleName.Arguments): New public field.
3345 (SimpleName): Added overloaded ctor which takes an additional
3346 TypeArguments argument.
3347 (SimpleName.SimpleNameResolve): Added support for generic methods.
3348 (MethodGroupExpr.ResolveGeneric): New public method. The code was
3349 formerly in MemberAccess.DoResolve(), but we also need it in
3350 SimpleNameResolve().
3352 * expression.cs (MemberAccess.DoResolve): Use the new
3353 MethodGroupExpr.ResolveGeneric().
3355 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3357 * decl.cs: If possible, use lookuptypedirect here. We can only do
3358 this if there is no `.' after the namespace. Avoids using
3359 LookupType, which does lots of slow processing.
3360 (FindNestedType) New method, does what it says :-).
3361 * namespace.cs: use LookupTypeDirect.
3362 * rootcontext.cs: use membercache, if possible.
3363 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
3365 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3368 According to the spec,
3370 In a member access of the form E.I, if E is a single identifier,
3371 and if the meaning of E as a simple-name (§7.5.2) is a constant,
3372 field, property, localvariable, or parameter with the same type as
3373 the meaning of E as a type-name (§3.8), then both possible
3374 meanings of E are permitted.
3376 We did not check that E as a simple-name had the same type as E as
3379 This trivial check gives us 5-7% on bootstrap time.
3381 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3383 * expression.cs (Invocation.OverloadResolve): Avoid the
3384 use of hashtables and boxing here by allocating on demand.
3386 2004-05-30 Martin Baulig <martin@ximian.com>
3388 * rootcontext.cs (RootContext.LookupType): Don't cache things if
3389 we're doing a silent lookup. Don't try to lookup nested types in
3390 TypeManager.object_type (thanks to Ben Maurer).
3392 2004-05-30 Martin Baulig <martin@ximian.com>
3394 Committing a patch from Ben Maurer.
3396 * rootcontext.cs (RootContext.LookupType): Cache negative results.
3398 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3400 * convert.cs: add a trivial cache for overload operator resolution.
3402 2004-05-31 Marek Safar <marek.safar@seznam.cz>
3405 (AttributeTester.GetObsoleteAttribute): Returns instance of
3406 ObsoleteAttribute when type is obsolete.
3409 (TypeContainer.VerifyObsoleteAttribute): Override.
3410 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
3411 (MethodCode.VerifyObsoleteAttribute): Override.
3412 (MemberBase.VerifyObsoleteAttribute): Override.
3415 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
3416 and report proper error.
3419 (Delegate.VerifyObsoleteAttribute): Override.
3422 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
3423 and report proper error.
3424 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
3427 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
3431 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
3432 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
3433 Added test for ObsoleteAttribute.
3436 (Catch): Derived from Statement.
3438 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3440 * decl.cs: If possible, use lookuptypedirect here. We can only do
3441 this if there is no `.' after the namespace. Avoids using
3442 LookupType, which does lots of slow processing.
3443 (FindNestedType) New method, does what it says :-).
3444 * namespace.cs: use LookupTypeDirect.
3445 * rootcontext.cs: use membercache, if possible.
3446 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
3448 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3451 According to the spec,
3453 In a member access of the form E.I, if E is a single identifier,
3454 and if the meaning of E as a simple-name (§7.5.2) is a constant,
3455 field, property, localvariable, or parameter with the same type as
3456 the meaning of E as a type-name (§3.8), then both possible
3457 meanings of E are permitted.
3459 We did not check that E as a simple-name had the same type as E as
3462 This trivial check gives us 5-7% on bootstrap time.
3464 2004-05-30 Marek Safar <marek.safar@seznam.cz>
3466 Fixed bug #59071 & cs0160.cs
3467 * statement.cs (Try.Resolve): Check here whether order of catch
3468 clauses matches their dependencies.
3470 2004-05-30 Marek Safar <marek.safar@seznam.cz>
3473 * ecore.cs (SimpleName.SimpleNameResolve): Added test for
3476 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3478 * expression.cs (Invocation.OverloadResolve): Avoid the
3479 use of hashtables and boxing here by allocating on demand.
3481 2004-05-30 Martin Baulig <martin@ximian.com>
3483 * rootcontext.cs (RootContext.LookupType): Don't cache things if
3484 we're doing a silent lookup. Don't try to lookup nested types in
3485 TypeManager.object_type (thanks to Ben Maurer).
3487 2004-05-30 Martin Baulig <martin@ximian.com>
3489 Committing a patch from Ben Maurer.
3491 * rootcontext.cs (RootContext.LookupType): Cache negative results.
3493 2004-05-29 Martin Baulig <martin@ximian.com>
3495 * class.cs (IMethodData.ShouldIgnore): New method.
3497 * typemanager.cs (TypeManager.MethodFlags): Don't take a
3498 `Location' argument, we don't need it anywhere. Use
3499 `IMethodData.ShouldIgnore ()' instead of
3500 `MethodData.GetMethodFlags ()'.
3501 (TypeManager.AddMethod): Removed.
3502 (TypeManager.AddMethod2): Renamed to AddMethod.
3504 2004-05-29 Martin Baulig <martin@ximian.com>
3506 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
3508 * convert.cs (Convert.ImplicitReferenceConversion): If we're
3509 converting from a class type S to an interface type and we already
3510 have an object on the stack, don't box it again. Fixes #52578.
3512 2004-05-29 Martin Baulig <martin@ximian.com>
3514 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
3515 Added support for `params' parameters. Fixes #59267.
3517 2004-05-29 Martin Baulig <martin@ximian.com>
3519 * literal.cs (NullPointer): Provide a private .ctor which sets
3520 `type' to TypeManager.object_type. Fixes #59048.
3522 2004-05-29 Martin Baulig <martin@ximian.com>
3524 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
3525 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
3527 * ecore.cs (EventExpr.instance_expr): Make the field private.
3529 2004-05-26 Marek Safar <marek.safar@seznam.cz>
3531 Fixed bug #50080 & cs0214-2.cs
3532 * expression.cs (Cast.DoResolve): Check unsafe context here.
3534 * statement.cs (Resolve.DoResolve): Likewise.
3536 2004-05-26 Martin Baulig <martin@ximian.com>
3538 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
3540 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
3541 (RootContext.LookupType): Pass down the `silent' flag.
3543 2004-05-25 Martin Baulig <martin@ximian.com>
3546 (MethodGroupExpr.IdenticalTypeName): New public property.
3547 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
3548 expression actually refers to a type.
3550 2004-05-25 Martin Baulig <martin@ximian.com>
3552 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
3553 for #56176 and made it actually work.
3555 2004-05-25 Martin Baulig <martin@ximian.com>
3557 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
3558 (FieldExpr, PropertyExpr): Override and implement
3559 CacheTemporaries. Fixes #52279.
3561 2004-05-25 Miguel de Icaza <miguel@ximian.com>
3563 * location.cs: In the new compiler listing a file twice is a
3564 warning, not an error.
3566 2004-05-24 Martin Baulig <martin@ximian.com>
3568 * enum.cs (Enum.DefineType): For the `BaseType' to be a
3569 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
3571 2004-05-24 Martin Baulig <martin@ximian.com>
3573 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
3574 walking the `using' list. Fixes #53921.
3576 2004-05-24 Martin Baulig <martin@ximian.com>
3578 * const.cs (Const.LookupConstantValue): Added support for
3579 EmptyCast's; fixes #55251.
3581 2004-05-24 Martin Baulig <martin@ximian.com>
3583 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
3584 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
3585 which does the CS0135 check. The reason is that we first need to
3586 check whether the variable actually exists.
3588 2004-05-24 Martin Baulig <martin@ximian.com>
3590 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
3591 than RootContext.LookupType() to find the explicit interface
3594 2004-05-24 Raja R Harinath <rharinath@novell.com>
3596 * Makefile: Simplify. Use executable.make.
3597 * mcs.exe.sources: New file. List of sources of mcs.exe.
3599 2004-05-24 Anders Carlsson <andersca@gnome.org>
3603 Use the invariant culture when doing String.Compare for CLS case
3606 2004-05-23 Martin Baulig <martin@ximian.com>
3608 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
3609 don't have any dots. Fixes #52622, added cs0246-8.cs.
3611 * namespace.cs (NamespaceEntry.Lookup): Likewise.
3613 2004-05-23 Marek Safar <marek.safar@seznam.cz>
3615 * class.cs (MemberBase.Define): Reuse MemberType member for
3616 resolved type. Other methods can use it too.
3618 2004-05-23 Martin Baulig <martin@ximian.com>
3620 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
3621 the variable also exists in the current block (otherwise, we need
3622 to report a CS0103). Fixes #58670.
3624 2004-05-23 Martin Baulig <martin@ximian.com>
3626 * flowanalysis.cs (Reachability.Reachable): Compute this
3627 on-the-fly rather than storing it as a field.
3629 2004-05-23 Martin Baulig <martin@ximian.com>
3631 * flowanalysis.cs (Reachability.And): Manually compute the
3632 resulting `barrier' from the reachability.
3634 2004-05-23 Marek Safar <marek.safar@seznam.cz>
3637 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
3638 instance of ObsoleteAttribute when symbol is obsolete.
3641 (IMethodData): Extended interface for ObsoleteAttribute support.
3643 2004-05-22 Marek Safar <marek.safar@seznam.cz>
3645 * attribute.cs: Fix bug #55970
3647 2004-05-22 Marek Safar <marek.safar@seznam.cz>
3651 (GetObsoleteAttribute): New method. Creates the instance of
3653 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
3654 ObsoleteAttribute when member is obsolete.
3655 (AttributeTester.Report_ObsoleteMessage): Common method for
3656 Obsolete error/warning reporting.
3659 (TypeContainer.base_classs_type): New member for storing parent type.
3662 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
3663 for this MemberCore.
3665 2004-05-21 Marek Safar <marek.safar@seznam.cz>
3667 * attribute.cs, const.cs: Fix bug #58590
3669 2004-05-21 Martin Baulig <martin@ximian.com>
3671 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
3672 out parameters if the end of the method is unreachable. Fixes
3675 2004-05-21 Marek Safar <marek.safar@seznam.cz>
3677 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
3678 Hari was right, why extra method.
3680 2004-05-21 Marek Safar <marek.safar@seznam.cz>
3682 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
3684 2004-05-20 Martin Baulig <martin@ximian.com>
3686 * delegate.cs: Convert this file to Unix mode - like the original
3689 2004-05-20 Martin Baulig <martin@ximian.com>
3691 * attribute.cs: Convert this file to Unix mode - like the original
3694 2004-05-19 Marek Safar <marek.safar@seznam.cz>
3696 Fix bug #58688 (MCS does not report error when the same attribute
3699 * attribute.cs (Attribute.Emit): Distinction between null and default.
3701 2004-05-19 Raja R Harinath <rharinath@novell.com>
3703 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
3704 of a top-level attribute without an attribute target.
3705 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
3707 (Attribute.Conditional_GetConditionName),
3708 (Attribute.Obsolete_GetObsoleteMessage): Update.
3709 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
3710 part of ScanForIndexerName.
3711 (Attribute.CanIgnoreInvalidAttribute): New function.
3712 (Attribute.ScanForIndexerName): Move to ...
3713 (Attributes.ScanForIndexerName): ... here.
3714 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
3715 (Attributes.Search): New internal variant that can choose not to
3716 complain if types aren't resolved. The original signature now
3718 (Attributes.GetClsCompliantAttribute): Use internal variant, with
3719 complaints suppressed.
3720 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
3721 only if it not useful.
3722 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
3723 top-level for attributes that are shared between the assembly
3724 and a top-level class.
3725 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
3726 * class.cs: Update to reflect changes.
3727 (DefineIndexers): Fuse loops.
3728 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
3729 a couple more variants of attribute names.
3731 2004-05-18 Marek Safar <marek.safar@seznam.cz>
3733 Fix bug #52585 (Implemented explicit attribute declaration)
3736 (Attributable.ValidAttributeTargets): New abstract method. It gets
3737 list of valid attribute targets for explicit target declaration.
3738 (Attribute.Target): It holds target itself.
3739 (AttributeSection): Removed.
3740 (Attribute.CheckTargets): New method. It checks whether attribute
3741 target is valid for the current element.
3744 (EventProperty): New class. For events that are declared like
3745 property (with add and remove accessors).
3746 (EventField): New class. For events that are declared like field.
3749 * cs-parser.jay: Implemented explicit attribute target declaration.
3751 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
3752 Override ValidAttributeTargets.
3755 (ReturnParameter): Class for applying custom attributes on
3757 (ParameterAtribute): New class. Class for applying custom
3758 attributes on the parameter type.
3760 2004-05-17 Miguel de Icaza <miguel@ximian.com>
3762 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
3765 (Method): Allow UNSAFE here.
3767 * modifiers.cs: Support unsafe reporting.
3769 2004-05-17 Marek Safar <marek.safar@seznam.cz>
3771 * decl.cs: Fix bug #58478.
3773 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3775 * statement.cs: When checking for unreachable code on an EmptyStatement,
3776 set the location. Fixes bug #58488.
3778 2004-05-13 Miguel de Icaza <miguel@ximian.com>
3780 * driver.cs: Add -pkg handling.
3782 From Gonzalo: UseShelLExecute=false
3784 2004-05-12 Marek Safar <marek.safar@seznam.cz>
3787 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
3789 (Attribute.IsClsCompliaceRequired): Moved to base for better
3791 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
3792 when attribute is AttributeUsageAttribute.
3793 (Attribute.GetValidTargets): Simplified.
3794 (Attribute.GetAttributeUsage): New method returns AttributeUsage
3795 attribute for this type.
3796 (Attribute.ApplyAttributes): Method renamed to Emit and make
3798 (GlobalAttributeSection): New class for special handling of global
3799 attributes (assembly, module).
3800 (AttributeSection.Emit): New method.
3802 * class.cs: Implemented Attributable abstract methods.
3803 (MethodCore.LabelParameters): Moved to Parameter class.
3804 (Accessor): Is back simple class.
3805 (PropertyMethod): Implemented Attributable abstract class.
3806 (DelegateMethod): Implemented Attributable abstract class.
3807 (Event): New constructor for disctintion between normal Event
3808 and Event with accessors.
3810 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
3812 * codegen.cs, const.cs, decl.cs, delegate.cs:
3813 (CommonAssemblyModulClass): Implemented Attributable abstract class
3816 * enum.cs: Implement IAttributeSupport interface.
3817 (EnumMember): New class for emum members. Implemented Attributable
3821 (ParameterBase): Is abstract.
3822 (ReturnParameter): New class for easier [return:] attribute handling.
3824 * typemanager.cs: Removed builder_to_attr.
3826 2004-05-11 Raja R Harinath <rharinath@novell.com>
3829 * attribute.cs (Attribute.GetPositionalValue): New function.
3830 * class.cs (TypeContainer.VerifyMembers): New function.
3831 (TypeContainer.Emit): Use it.
3832 (ClassOrStruct): New base class for Class and Struct.
3833 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
3834 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
3836 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
3837 then each non-static field should have a FieldOffset attribute.
3838 Otherwise, none of the fields should have a FieldOffset attribute.
3839 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
3840 and FieldOffset attributes.
3841 * typemanager.cs (TypeManager.struct_layout_attribute_type)
3842 (TypeManager.field_offset_attribute_type): New core types.
3843 (TypeManager.InitCoreTypes): Initialize them.
3845 2004-05-11 Michal Moskal <malekith@pld-linux.org>
3847 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
3848 Return correct type.
3851 2004-05-09 Miguel de Icaza <miguel@ximian.com>
3853 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
3854 be implicitly converted to ulong.
3856 * expression.cs: The logic for allowing operator &, | and ^ worked
3857 was wrong, it worked before because we did not report an error in
3858 an else branch. Fixes 57895.
3860 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
3861 allow volatile fields to be reference types.
3863 2004-05-07 Miguel de Icaza <miguel@ximian.com>
3865 * driver.cs: Add support for /debug-
3867 2004-05-07 Raja R Harinath <rharinath@novell.com>
3869 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
3870 Add a 'complain' parameter to silence errors.
3871 (Attribute.Resolve): Update to changes. Put in sanity check to catch
3872 silently overlooked type-resolutions.
3873 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
3875 (Attributes.Search): New function.
3876 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
3877 (Attributes.GetAttributeFullName): Remove hack.
3878 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
3879 Update to reflect changes.
3880 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3881 Use Attributes.Search instead of nested loops.
3883 2004-05-07 Marek Safar <marek.safar@seznam.cz>
3886 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
3887 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
3888 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
3890 * report.cs: (Report.Warning): Renamed to Warning_T because of
3891 parameter collision.
3893 2004-05-05 Raja R Harinath <rharinath@novell.com>
3895 * expression.cs (MemberAccess.ResolveMemberAccess):
3896 Exit with non-zero status after Report.Error.
3897 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
3899 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
3901 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
3903 * support.cs: Don't hang when the file is empty.
3905 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
3907 * support.cs: In SeekableStreamReader, compute the preamble size of the
3908 underlying stream. Position changes should take into account that initial
3911 2004-05-03 Todd Berman <tberman@sevenl.net>
3913 * driver.cs: remove unused GetSysVersion function.
3915 2004-05-03 Todd Berman <tberman@sevenl.net>
3917 * driver.cs: Remove the hack from saturday, as well as the hack
3918 from jackson (LoadAssemblyFromGac), also adds the CWD to the
3919 link_paths to get that bit proper.
3921 2004-05-01 Todd Berman <tberman@sevenl.net>
3923 * driver.cs: Try a LoadFrom before a Load, this checks the current
3924 path. This is currently a bug in mono that is be fixed, however, this
3925 provides a workaround for now. This will be removed when the bug
3928 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
3930 * CryptoConvert.cs: Updated to latest version. Fix issue with
3931 incomplete key pairs (#57941).
3933 2004-05-01 Todd Berman <tberman@sevenl.net>
3935 * driver.cs: Remove '.' from path_chars, now System.* loads properly
3938 2004-04-30 Jackson Harper <jackson@ximian.com>
3940 * codegen.cs: Open keys readonly.
3942 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3944 * typemanager.cs: don't report cyclic struct layout when a struct
3945 contains 2 or more fields of the same type. Failed for Pango.AttrShape
3946 which has 2 Pango.Rectangle fields.
3948 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
3950 * expression.cs: Handle IntPtr comparisons with IL code
3951 rather than a method call.
3953 2004-04-29 Martin Baulig <martin@ximian.com>
3955 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
3956 the list of PropertyInfo's in class hierarchy and find the
3957 accessor. Fixes #56013.
3959 2004-04-29 Martin Baulig <martin@ximian.com>
3961 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
3963 2004-04-29 Martin Baulig <martin@ximian.com>
3965 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
3967 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
3969 2004-04-29 Martin Baulig <martin@ximian.com>
3971 * class.cs (ConstructorInitializer.Resolve): Check whether the
3972 parent .ctor is accessible. Fixes #52146.
3974 2004-04-29 Martin Baulig <martin@ximian.com>
3976 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
3978 * statement.cs (Using.EmitLocalVariableDecls): Use
3979 TypeManager.idisposable_type, not typeof (IDisposable).
3980 (Foreach.EmitCollectionForeach): Added support for valuetypes.
3982 2004-04-29 Martin Baulig <martin@ximian.com>
3984 * class.cs (Event.Define): Don't emit the field and don't set
3985 RTSpecialName and SpecialName for events on interfaces. Fixes
3988 2004-04-29 Raja R Harinath <rharinath@novell.com>
3990 Refactor Attribute.ApplyAttributes.
3991 * attribute.cs (Attributable): New base class for objects that can
3992 have Attributes applied on them.
3993 (Attribute): Make AttributeUsage fields public.
3994 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
3995 (Attribute.IsInternalCall): New property.
3996 (Attribute.UsageAttr): Convert to a public read-only property.
3997 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
3998 (Attribute.ResolveType, Attribute.Resolve)
3999 (Attribute.ScanForIndexerName): Update to reflect changes.
4000 (Attribute.CheckAttributeTarget): Re-format.
4001 (Attribute.ApplyAttributes): Refactor, to various
4002 Attributable.ApplyAttributeBuilder methods.
4003 * decl.cs (MemberCore): Make Attributable.
4004 * class.cs (Accessor): Make Attributable.
4005 (MethodData.ApplyAttributes): Use proper attribute types, not
4007 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
4008 (TypeContainer.ApplyAttributeBuilder)
4009 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
4010 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
4011 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
4012 (Operator.ApplyAttributeBuilder): New factored-out methods.
4013 * const.cs (Const.ApplyAttributeBuilder): Likewise.
4014 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
4015 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
4016 * parameter.cs (ParameterBase): New Attributable base class
4017 that can also represent Return types.
4018 (Parameter): Update to the changes.
4020 2004-04-29 Jackson Harper <jackson@ximian.com>
4022 * driver.cs: Prefer the corlib system version when looking for
4023 assemblies in the GAC. This is still a hack, but its a better hack
4026 2004-04-29 Marek Safar <marek.safar@seznam.cz>
4028 * decl.cs, enum.cs: Improved error 3005 reporting.
4030 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
4031 (related_symbols): New private member for list of symbols
4032 related to reported error/warning.
4034 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
4036 2004-04-29 Martin Baulig <martin@ximian.com>
4038 * ecore.cs (Expression.Constantify): If we're an enum and
4039 TypeManager.TypeToCoreType() doesn't give us another type, use
4040 t.UnderlyingSystemType. Fixes #56178.
4042 2004-04-29 Martin Baulig <martin@ximian.com>
4044 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
4045 interfaces and for each interface, only add members directly
4046 declared in that interface. Fixes #53255.
4048 2004-04-28 Martin Baulig <martin@ximian.com>
4050 * expression.cs (ConditionalLogicalOperator): Use a temporary
4051 variable for `left' to avoid that we evaluate it more than once;
4054 2004-04-28 Martin Baulig <martin@ximian.com>
4056 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
4059 2004-04-28 Martin Baulig <martin@ximian.com>
4061 * statement.cs (LocalInfo.Resolve): Check whether the type is not
4064 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
4065 whether the type is not void (CS1547).
4067 2004-04-28 Martin Baulig <martin@ximian.com>
4069 * expression.cs (Unary.DoResolveLValue): Override this and report
4070 CS0131 for anything but Operator.Indirection.
4072 2004-04-28 Martin Baulig <martin@ximian.com>
4074 Committing a patch from Ben Maurer; see bug #50820.
4076 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4079 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4082 2004-04-28 Martin Baulig <martin@ximian.com>
4084 Committing a patch from Ben Maurer; see bug #50820.
4086 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4089 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4092 2004-04-28 Martin Baulig <martin@ximian.com>
4094 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
4095 (Block.AddLabel): Call DoLookupLabel() to only search in the
4098 2004-04-28 Martin Baulig <martin@ximian.com>
4100 * cfold.cs (ConstantFold.BinaryFold): Added special support for
4101 comparing StringConstants and NullLiterals in Equality and Inequality.
4103 2004-04-28 Jackson Harper <jackson@ximian.com>
4105 * driver.cs: Attempt to load referenced assemblies from the
4106 GAC. This is the quick and dirty version of this method that
4107 doesnt take into account versions and just takes the first
4108 canidate found. Will be good enough for now as we will not have more
4109 then one version installed into the GAC until I update this method.
4111 2004-04-28 Martin Baulig <martin@ximian.com>
4113 * typemanager.cs (TypeManager.CheckStructCycles): New public
4114 static method to check for cycles in the struct layout.
4116 * rootcontext.cs (RootContext.PopulateTypes): Call
4117 TypeManager.CheckStructCycles() for each TypeContainer.
4118 [Note: We only need to visit each type once.]
4120 2004-04-28 Martin Baulig <martin@ximian.com>
4122 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
4124 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
4125 success and added `out object value'. Use a `bool resolved' field
4126 to check whether we've already been called rather than
4127 `ConstantValue != null' since this breaks for NullLiterals.
4129 2004-04-28 Raja R Harinath <rharinath@novell.com>
4131 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
4132 setting of this flag, since the 'set' method may be non-public.
4134 2004-04-28 Raja R Harinath <rharinath@novell.com>
4136 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
4137 check on current_vector.Block.
4139 2004-04-27 Martin Baulig <martin@ximian.com>
4141 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
4142 a field initializer. Fixes #56459.
4144 2004-04-27 Martin Baulig <martin@ximian.com>
4146 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
4147 we're not attempting to use an indexer. Fixes #52154.
4149 2004-04-27 Martin Baulig <martin@ximian.com>
4151 * statement.cs (Return): Don't create a return label if we don't
4152 need it; reverts my change from January 20th. Thanks to Ben
4155 2004-04-27 Martin Baulig <martin@ximian.com>
4157 According to the spec, `goto' can only leave a nested scope, but
4160 * statement.cs (Block.LookupLabel): Only lookup in the current
4161 block, don't recurse into parent or child blocks.
4162 (Block.AddLabel): Check in parent and child blocks, report
4163 CS0140/CS0158 if we find a duplicate.
4164 (Block): Removed this indexer for label lookups.
4165 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
4166 this already does the error reporting for us.
4169 (FlowBranching.UsageVector.Block): New public variable; may be null.
4170 (FlowBranching.CreateSibling): Added `Block' argument.
4171 (FlowBranching.LookupLabel): New public virtual method. Lookup a
4172 label for the target of a `goto' and check whether we're not
4173 leaving a `finally'.
4175 2004-04-27 Martin Baulig <martin@ximian.com>
4177 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
4178 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
4181 2004-04-27 Martin Baulig <martin@ximian.com>
4183 * statement.cs (Block.AddLabel): Also check for implicit blocks
4184 and added a CS0158 check.
4186 2004-04-27 Martin Baulig <martin@ximian.com>
4188 * flowanalysis.cs (FlowBranchingLoop): New class.
4189 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
4190 UsageVector's instead of an ArrayList.
4191 (FlowBranching.Label): Likewise.
4192 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
4193 (FlowBranching.AddBreakVector): New method.
4195 2004-04-27 Miguel de Icaza <miguel@ximian.com>
4197 * attribute.cs: Small regression fix: only convert the type if we
4198 the type is different, fixes System.Drawing build.
4200 2004-04-27 Martin Baulig <martin@ximian.com>
4202 * attribute.cs (Attribute.Resolve): If we have a constant value
4203 for a named field or property, implicity convert it to the correct
4206 2004-04-27 Raja R Harinath <rharinath@novell.com>
4208 * statement.cs (Block.Block): Implicit blocks share
4209 'child_variable_names' fields with parent blocks.
4210 (Block.AddChildVariableNames): Remove.
4211 (Block.AddVariable): Mark variable as "used by a child block" in
4212 every surrounding block.
4213 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
4214 been used in a child block, complain about violation of "Invariant
4215 meaning in blocks" rule.
4216 * cs-parser.jay (declare_local_variables): Don't use
4217 AddChildVariableNames.
4218 (foreach_statement): Don't create an implicit block: 'foreach'
4221 2004-04-23 Miguel de Icaza <miguel@ximian.com>
4223 * convert.cs (ImplicitNumericConversion): 0 is also positive when
4224 converting from 0L to ulong. Fixes 57522.
4226 2004-04-22 Marek Safar <marek.safar@seznam.cz>
4228 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
4229 derived class hides via 'new' keyword field from base class (test-242.cs).
4230 TODO: Handle this in the more general way.
4232 * class.cs (CheckBase): Ditto.
4234 2004-04-22 Marek Safar <marek.safar@seznam.cz>
4236 * decl.cs (caching_flags): New member for storing cached values
4238 (MemberCore.Flags): New enum where bit flags for caching_flags
4240 (MemberCore.cls_compliance): Moved to caching_flags.
4241 (DeclSpace.Created): Moved to caching_flags.
4243 * class.cs: Use caching_flags instead of DeclSpace.Created
4245 2004-04-21 Miguel de Icaza <miguel@ximian.com>
4247 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
4248 if we are only a derived class, not a nested class.
4250 * typemanager.cs: Same as above, but do this at the MemberLookup
4251 level (used by field and methods, properties are handled in
4252 PropertyExpr). Allow for the qualified access if we are a nested
4255 2004-04-21 Marek Safar <marek.safar@seznam.cz>
4257 * class.cs: Refactoring.
4258 (IMethodData): New inteface; Holds links to parent members
4259 to avoid member duplication (reduced memory allocation).
4260 (Method): Implemented IMethodData interface.
4261 (PropertyBase): New inner classes for get/set methods.
4262 (PropertyBase.PropertyMethod): Implemented IMethodData interface
4263 (Event): New inner classes for add/remove methods.
4264 (Event.DelegateMethod): Implemented IMethodData interface.
4266 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
4267 EmitContext (related to class.cs refactoring).
4269 2004-04-21 Raja R Harinath <rharinath@novell.com>
4271 * delegate.cs (Delegate.VerifyApplicability): If the number of
4272 arguments are the same as the number of parameters, first try to
4273 verify applicability ignoring any 'params' modifier on the last
4277 2004-04-08 Martin Baulig <martin@ximian.com>
4279 Merged latest changes into gmcs. Please keep this comment in
4280 here, it makes it easier for me to see what changed in MCS since
4281 the last time I merged.
4283 2004-04-16 Raja R Harinath <rharinath@novell.com>
4285 * class.cs (TypeContainer.AddIndexer): Use
4286 'ExplicitInterfaceName' to determine if interface name was
4287 explicitly specified. 'InterfaceType' is not initialized at this time.
4288 (TypeContainer.DefineIndexers): Remove use of temporary list. The
4289 Indexers array is already in the required order. Initialize
4290 'IndexerName' only if there are normal indexers.
4291 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
4292 (TypeContainer.Emit): Emit DefaultMember attribute only if
4293 IndexerName is initialized.
4296 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
4298 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
4301 2004-04-15 Raja R Harinath <rharinath@novell.com>
4303 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
4307 * attribute.cs (Attribute.Resolve): Check for duplicate named
4311 2004-04-15 Miguel de Icaza <miguel@ximian.com>
4313 * iterators.cs (MarkYield): track whether we are in an exception,
4314 and generate code accordingly. Use a temporary value to store the
4315 result for our state.
4317 I had ignored a bit the interaction of try/catch with iterators
4318 since their behavior was not entirely obvious, but now it is
4319 possible to verify that our behavior is the same as MS .NET 2.0
4323 2004-04-14 Miguel de Icaza <miguel@ximian.com>
4325 * iterators.cs: Avoid creating temporaries if there is no work to
4328 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
4329 Enumerations, use TypeManager.EnumToUnderlying and call
4332 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
4335 (This.Emit): Use EmitContext.EmitThis to emit our
4338 (This.EmitAssign): Ditto.
4340 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
4341 codepaths, we will move all the functionality into
4344 (FieldExpr.EmitAssign): Ditto.
4346 This fixes several hidden bugs that I uncovered while doing a code
4347 review of this today.
4349 * codegen.cs (EmitThis): reworked so the semantics are more clear
4350 and also support value types "this" instances.
4352 * iterators.cs: Changed so that for iterators in value types, we
4353 do not pass the value type as a parameter.
4355 Initialization of the enumerator helpers is now done in the caller
4356 instead of passing the parameters to the constructors and having
4357 the constructor set the fields.
4359 The fields have now `assembly' visibility instead of private.
4361 2004-04-11 Miguel de Icaza <miguel@ximian.com>
4363 * expression.cs (Argument.Resolve): Check if fields passed as ref
4364 or out are contained in a MarshalByRefObject.
4366 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
4367 another compiler type.
4369 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
4371 * class.cs (Indexer.Define): use the new name checking method.
4372 Also, return false on an error.
4373 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
4374 (is_identifier_[start/part]_character): make static.
4376 2004-04-10 Miguel de Icaza <miguel@ximian.com>
4378 * expression.cs (Binary.ResolveOperator): Do no append strings
4379 twice: since we can be invoked more than once (array evaluation)
4380 on the same concatenation, take care of this here. Based on a fix
4381 from Ben (bug #56454)
4383 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
4385 * codegen.cs: Fix another case where CS1548 must be reported (when
4386 delay-sign isn't specified and no private is available #56564). Fix
4387 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
4388 error when MCS is used on the MS runtime and we need to delay-sign
4389 (which seems unsupported by AssemblyBuilder - see #56621).
4391 2004-04-08 Marek Safar <marek.safar@seznam.cz>
4393 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
4394 (TypeManager.ComputeNamespaces): Faster implementation for
4397 * compiler.csproj: Updated AssemblyName to mcs.
4399 2004-05-11 Jackson Harper <jackson@ximian.com>
4401 * Makefile: Preserve MONO_PATH
4403 2004-05-11 Jackson Harper <jackson@ximian.com>
4405 * Makefile: Use mono and mcs to build gmcs
4407 2004-05-03 Miguel de Icaza <miguel@ximian.com>
4409 * codegen.cs: Add patch from Robert Shade
4410 <rshade@dvsconsulting.com>, use FileAccess.Read on the keyfile, to
4413 2004-05-02 Sebastien Pouliot <sebastien@ximian.com>
4415 * CryptoConvert.cs: Updated to latest version. Fix issue with
4416 incomplete key pairs (#57941).
4418 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
4420 * codegen.cs: Fix another case where CS1548 must be reported (when
4421 delay-sign isn't specified and no private is available #56564). Fix
4422 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
4423 error when MCS is used on the MS runtime and we need to delay-sign
4424 (which seems unsupported by AssemblyBuilder - see #56621).
4426 2004-04-29 Jackson Harper <jackson@ximian.com>
4428 * Makefile: Set MONO_PATH to use the bootstrap corlib
4429 * driver.cs: Check the GAC for referenced assemblies.
4431 2004-04-29 Martin Baulig <martin@ximian.com>
4433 * Makefile (gmcs.exe): Set MONO_PATH to use `../class/lib/net_2_0'.
4435 2004-04-07 Martin Baulig <martin@ximian.com>
4437 * expression.cs (Binary.ResolveOperator): Added special case for
4438 Equality/Inequality between a type parameter and a null literal.
4440 2004-04-07 Martin Baulig <martin@ximian.com>
4442 * convert.cs: Check null literal -> type parameter conversions.
4444 2004-04-07 Martin Baulig <martin@ximian.com>
4446 * generic.cs (ConstructedType.CheckConstraints): Enforce the
4447 `class' and `struct' constraints.
4449 2004-04-07 Martin Baulig <martin@ximian.com>
4451 * generic.cs (SpecialConstraint): New public enum.
4452 (Constraints.Resolve): Added support for the `class' and `struct'
4455 * cs-parser.jay (type_parameter_constraint): Added support for the
4456 `class' and `struct' constraints.
4458 2004-04-07 Martin Baulig <martin@ximian.com>
4460 * support.cs (GenericConstraints): Replaced `Types' by
4461 `ClassConstraint' and `InterfaceConstraints'; added
4462 `HasClassConstraint'.
4464 2004-04-07 Martin Baulig <martin@ximian.com>
4467 (Constraints.InterfaceConstraints): New public property.
4468 (Constraints.Types): Make this property public
4469 (TypeParameter): Implement IMemberContainer.
4470 (TypeParameter.Define): Take a `GenericTypeParameterBuilder'
4471 instead of a TypeBuilder/MethodBuilder; pass the interface
4472 constraints to TypeManager.AddTypeParameter().
4473 (TypeParameter.DefineType): Just take an EmitContext and no
4474 TypeBuilder/MethodBuilder. Use the new public API.
4476 * typemanager.cs (TypeManager.AddTypeParameter): Added
4477 `TypeExpr[]' argument; add the interfaces to the
4478 `builder_to_ifaces' hash.
4479 (TypeManager.LookupMemberContainer): For
4480 GenericTypeParameterBuilders, get the TypeParameter from the
4481 `builder_to_type_param'.
4482 (TypeManager.FindMembers): For GenericTypeParameterBuilders, get
4483 the TypeParameter and call FindMembers on it.
4485 2004-04-07 Martin Baulig <martin@ximian.com>
4488 (MethodCore.GenericMethod): Moved this field here from Method.
4489 (MethodCore.IsDuplicateImplementation): Take the number of type
4490 parameters into account if we're a generic method.
4492 * expression.cs (Invocation.InferTypeArguments): Don't return true
4493 if `arguments' is null; we still need to check whether we actually
4494 don't need to infer anything in this case.
4495 (MemberAccess): Merged the functionality from GenericMemberAccess
4498 * generic.cs (GenericMemberAccess): Removed.
4500 2004-04-05 Martin Baulig <martin@ximian.com>
4502 * decl.cs (MemberCore): For generic classes, interfaces and
4503 structs, `Name' now includes the number of type parameters
4505 (DeclSpace.FindType): Removed the `num_type_args' argument; we now
4506 encode the number of type arguments in the type name.
4508 * expression.cs (Expression.MemberLookup): Removed the
4509 `num_type_args' argument; we now encode the number of type
4510 arguments in the type name.
4512 * ecore.cs (SimpleName): Encode the number of type arguments in
4513 the type name itself.
4515 * generic.cs (ConstructedType): Likewise.
4517 * tree.cs (Tree.RecordDecl): Take a `string' instead of a
4518 `MemberName'; we now include the number of type parameters in the
4521 * typemanager.cs (TypeManager.CheckGeneric): Removed.
4522 (TypeManager.MemberLookup): Removed the
4523 `num_type_args' argument; we now encode the number of type
4524 arguments in the type name.
4526 2004-04-03 Martin Baulig <martin@ximian.com>
4528 * decl.cs (MemberCore.ctor): Take a MemberName instead of a sting.
4529 (MemberCore.MemberName): Moved here from MemberBase.
4530 (DeclSpace.SetParameterInfo): Just take the constraints as an
4531 ArrayList; we already have the type parameters in our
4532 `MemberName'; also do the CS0080 reporting here.
4534 * cs-parser.jay (struct_declaration): Use `member_name' instead of
4535 `IDENTIFIER opt_type_parameter_list'; when constructing our
4536 `MemberName', it'll already include our type parameters.
4537 (class_declaration, interface_declaration): Likewise.
4538 (delegate_declaration): Likewise.
4539 (MakeName): Take a MemberName and return a MemberName.
4540 The following two changes are required to avoid shift/reduce conflicts:
4541 (member_name): Don't include a TypeName anymore; ie. this is now
4542 just 'IDENTIFIER opt_type_parameter_list'.
4543 (property_declaration, event_declaration): Use a
4544 `namespace_or_type_name' instead of a `member_name'.
4546 2004-04-03 Martin Baulig <martin@ximian.com>
4548 * decl.cs (MemberName): Renamed to `TypeName' and created a new
4550 (TypeName): Formerly known as MemberName.
4552 * namespace.cs (NamespaceEntry.UsingAlias): Take a `TypeName'
4553 instead of a `MemberName'.
4555 * cs-parser.jay (namespace_or_type_name): Create a TypeName.
4556 (member_name): New rule; create a MemberName.
4558 2004-04-02 Martin Baulig <martin@ximian.com>
4560 * namespace.cs (NamespaceEntry.VerifyUsing): Added error checking
4561 (CS0305 and CS0308).
4563 2004-04-02 Martin Baulig <martin@ximian.com>
4565 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Added
4566 support for nested types.
4568 2004-04-02 Martin Baulig <martin@ximian.com>
4570 * ecore.cs (IAlias): New public interface.
4571 (TypeExpr, TypeExpression): Implement IAlias.
4572 (TypeAliasExpression): New public class.
4574 * namespace.cs (Namespace): Implement IAlias.
4575 (Namespace.Lookup): Return an IAlias instead on an object.
4576 (Namespace.DefineName): Take an IAlias instead of an object.
4577 (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
4579 (NamespaceEntry.UsingAlias): Take a Membername instead of an
4581 (NamespaceEntry.LookupAlias): Return an IAlias instead on an
4583 (NamespaceEntry.Lookup): Likewise.
4585 * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
4588 * decl.cs (DeclSpace): Implement IAlias.
4589 (DeclSpace.LookupAlias): Return an IAlias instead of a string.
4591 * generic.cs (ConstructedType): Improved error checking.
4593 2004-04-02 Martin Baulig <martin@ximian.com>
4595 * convert.cs: Added type parameter conversions.
4598 (UnboxCast.Emit): Emit an `unbox.any' for type params.
4599 (ClassCast.Emit): If the source type is a type parameter, box it.
4600 If the target type is a type parameter, emit an `unbox.any'
4601 instead of a `classcast'.1
4603 2004-04-01 Martin Baulig <martin@ximian.com>
4605 * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
4607 2004-04-01 Martin Baulig <martin@ximian.com>
4609 * generic.cs (ConstructedType.CheckConstraints): Use
4610 Convert.ImplicitStandardConversionExists(); user-defined implicit
4611 conversions are not allowed according to the spec.
4613 2004-03-30 Martin Baulig <martin@ximian.com>
4615 * expression.cs (New): Added support for type parameters.
4618 (TypeManager.activator_type): New public static field.
4619 (TypeManager.activator_create_instance): Likewise.
4621 2004-03-30 Martin Baulig <martin@ximian.com>
4623 * typemanager.cs (TypeManager.HasConstructorConstraint): New
4626 2004-03-30 Martin Baulig <martin@ximian.com>
4628 * generic.cs (ConstructedType.CheckConstraints): Actually follow
4629 the spec here: the argument type must be convertible to the
4632 2004-03-30 Martin Baulig <martin@ximian.com>
4635 (TypeParameter.Define, TypeParameter.DefineMethod): Call
4636 TypeManager.AddTypeParameter().
4637 (ConstructedType.CheckConstraints): Re-enable this and actually
4638 check whether we have a constructor constraint.
4641 (TypeManager.builder_to_type_param): New static field.
4642 (TypeManager.AddTypeParameter): New static method.
4643 (TypeManager.LookupTypeParameter): New public method.
4645 2004-03-30 Martin Baulig <martin@ximian.com>
4647 * generic.cs (TypeParameter.DefineType): Return a boolean and use
4648 the new API to actually define the constructor constraint.
4651 (TypeManager.new_constraint_attr_type): New static field.
4652 (TypeManager.InitCoreTypes): Initialize it.
4654 2004-03-30 Martin Baulig <martin@ximian.com>
4656 * generic.cs (Constraints): Completed error checking, use correct
4659 2004-03-29 Martin Baulig <martin@ximian.com>
4661 * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
4663 * expression.cs (Invocation.InferTypeArguments): Added overloaded
4664 public version which takes a `ParameterData pd' instead of an
4667 2004-03-29 Martin Baulig <martin@ximian.com>
4669 * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
4672 2004-03-29 Martin Baulig <martin@ximian.com>
4674 * expression.cs (Argument.ResolveMethodGroup): If we're a
4675 ConstructedType, call GetMemberAccess() on it.
4677 2004-03-29 Martin Baulig <martin@ximian.com>
4679 * class.cs (MethodBase.CheckGenericOverride): New abstract method.
4680 (MethodCore.CheckGenericOverride): When overriding a generic
4681 method, check whether the constraints match.
4683 * support.cs (GenericConstraints): New public interface.
4684 (ParameterData.GenericConstraints): New public method.
4686 * parameter.cs (Parameter.Resolve): Check whether we're a generic
4687 method parameter and compute our constraints if appropriate.
4688 (Parameter.GenericConstraints): New public property.
4690 * generic.cs (Constraints): Implement GenericConstraints.
4692 2004-03-29 Martin Baulig <martin@ximian.com>
4694 * decl.cs (MemberCache.FindMemberToOverride): Use
4695 `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
4697 2004-03-29 Martin Baulig <martin@ximian.com>
4699 * generic.cs (GenericMethod.Define): Resolve our type parameters.
4701 2004-03-29 Martin Baulig <martin@ximian.com>
4703 * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
4704 not allowed on non-generic declarations").
4706 2004-03-29 Martin Baulig <martin@ximian.com>
4708 * expression.cs (Invocation.InferTypeArguments): Added overloaded
4709 public version of this method.
4711 * class.cs (MethodCore.IsDuplicateImplementation): Use
4712 Invocation.InferTypeArguments() to check this.
4714 2004-03-29 Martin Baulig <martin@ximian.com>
4716 * convert.cs: Use TypeManager.IsDelegateType() instead of
4717 comparing types correctly.
4719 2004-03-29 Martin Baulig <martin@ximian.com>
4721 * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
4722 types directly to make it work for generic instances.
4724 * typemanager.cs (TypeManager.IsSubclassOf): New static method.
4726 2004-03-29 Martin Baulig <martin@ximian.com>
4728 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
4731 2004-03-24 Martin Baulig <martin@ximian.com>
4733 * decl.cs (DeclSpace.FindType): Also use
4734 TypeManager.CheckGeneric() for types from the using clauses.
4736 2004-03-23 Martin Baulig <martin@ximian.com>
4738 * expression.cs (Invocation.OverloadResolve): Added `bool
4739 may_fail' argument and use it instead of the Location.IsNull() hack.
4741 2004-03-23 Martin Baulig <martin@ximian.com>
4743 * expression.cs (Invocation.InferType): Use correct type inference
4746 2004-03-23 Martin Baulig <martin@ximian.com>
4748 * ecore.cs (MethodGroupExpr.Name): Use
4749 TypeManager.CSharpSignature() instead of just the name.
4751 * expression.cs (Invocation.OverloadResolve): Provide better error
4753 (Invocation.DoResolve): OverloadResolve() never returns null
4754 without reporting an error, so removed the error -6 reporting here.
4756 2004-03-23 Martin Baulig <martin@ximian.com>
4758 * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
4761 * cs-parser.jay (delegate_declaration): Support generic delegates.
4763 * delegate.cs: Support generic delegates.
4765 2004-03-22 Martin Baulig <martin@ximian.com>
4767 * expression.cs (Invocation.InferParamsTypeArguments): New static
4768 method; does type inference for params arguments.
4770 2004-03-21 Martin Baulig <martin@ximian.com>
4772 * typemanager.cs (TypeManager.IsGenericMethod): New public static
4773 method; checks whether a method is a generic method.
4775 * expression.cs (Invocation.InferTypeArguments): New static method;
4776 infer type arguments for generic method invocation.
4778 * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
4779 property; we set this to true if we're resolving a generic method
4780 invocation and the user specified type arguments, ie. we're not
4781 doing type inference.
4783 2004-03-20 Martin Baulig <martin@ximian.com>
4785 * class.cs (MethodData.DeclaringType): New public property.
4786 (MethodData.Define): Set DeclaringType here.
4787 (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
4788 instead of OperatorMethodBuilder.DeclaringType.
4790 2004-03-20 Martin Baulig <martin@ximian.com>
4792 * cs-tokenizer.cs (xtoken): Return a special
4793 Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
4795 * cs-parser.jay (default_value_expression): Switch to the new
4798 2004-03-19 Martin Baulig <martin@ximian.com>
4800 * decl.cs (MemberName): New class. We use this to "construct"
4801 namespace_or_type_name's.
4803 * generics.cs (TypeArguments.GetDeclarations): New public method;
4804 returns the type arguments as a string[] and reports a CS0081 if
4805 one of them is not an identifier.
4807 * class.cs (MemberBase): The .ctor now takes the name as a
4808 MemberName instead of a string.
4809 (MemberBase.ExplicitInterfaceName): Changed type from string to
4811 (MemberBase.DoDefine): If we're an explicit implementation, the
4812 InterfaceType may be a generic instance.
4814 * cs-parser.jay (namespace_or_type_name): Return a MemberName.
4815 (namespace_name): Call MemberName.GetName () to transform the
4816 MemberName into a string and ensure we don't have any type
4818 (type_name): Call MemberName.GetTypeExpression() to transfrom the
4819 MemberName into an expression.
4820 (method_header): Use namespace_or_type_name instead of member_name.
4822 2004-04-07 Miguel de Icaza <miguel@ximian.com>
4824 * rootcontext.cs: Add new types to the boot resolution.
4826 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
4827 MulticastDelegate is not allowed.
4829 * typemanager.cs: Add new types to lookup: System.TypedReference
4832 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
4833 check for TypedReference or ArgIterator, they are not allowed.
4835 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
4836 makes us properly catch 1510 in some conditions (see bug 56016 for
4839 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
4841 * CryptoConvert.cs: update from corlib version
4844 2004-04-05 Miguel de Icaza <miguel@ximian.com>
4846 * class.cs (Indexer.Define): Check indexername declaration
4848 2004-04-05 Marek Safar <marek.safar@seznam.cz>
4850 * attribute.cs (IsClsCompliant): Fixed problem with handling
4851 all three states (compliant, not-compliant, undetected).
4853 2004-03-30 Marek Safar <marek.safar@seznam.cz>
4855 * attribute.cs (Attribute): Location is now public.
4856 (Resolve): Store resolved arguments (pos_values) in attribute class.
4857 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
4858 (GetClsCompliantAttributeValue): New method that gets
4859 CLSCompliantAttribute value.
4860 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
4861 if exists else null.
4862 (AttributeTester): New class for CLS-Compliant verification routines.
4864 * class.cs (Emit): Add CLS-Compliant verification.
4865 (Method.GetSignatureForError): Implemented.
4866 (Constructor.GetSignatureForError): Implemented
4867 (Constructor.HasCompliantArgs): Returns if constructor has
4868 CLS-Compliant arguments.
4869 (Constructor.Emit): Override.
4870 (Construcor.IsIdentifierClsCompliant): New method; For constructors
4871 is needed to test only parameters.
4872 (FieldBase.GetSignatureForError): Implemented.
4873 (TypeContainer): New member for storing base interfaces.
4874 (TypeContainer.FindMembers): Search in base interfaces too.
4876 * codegen.cs (GetClsComplianceAttribute): New method that gets
4877 assembly or module CLSCompliantAttribute value.
4878 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
4880 (ModuleClass.Emit): Add error 3012 test.
4882 * const.cs (Emit): Override and call base for CLS-Compliant tests.
4884 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
4885 state for all decl types.
4886 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
4887 if CLS-Compliant tests are required.
4888 (IsClsCompliaceRequired): New method. Analyze whether code
4889 must be CLS-Compliant.
4890 (IsExposedFromAssembly): New method. Returns true when MemberCore
4891 is exposed from assembly.
4892 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
4893 value or gets cached value.
4894 (HasClsCompliantAttribute): New method. Returns true if MemberCore
4895 is explicitly marked with CLSCompliantAttribute.
4896 (IsIdentifierClsCompliant): New abstract method. This method is
4897 used to testing error 3005.
4898 (IsIdentifierAndParamClsCompliant): New method. Common helper method
4899 for identifier and parameters CLS-Compliant testing.
4900 (VerifyClsCompliance): New method. The main virtual method for
4901 CLS-Compliant verifications.
4902 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
4903 null. I don't know why is null (too many public members !).
4904 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
4905 and get value of first CLSCompliantAttribute that found.
4907 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
4908 (VerifyClsCompliance): Override and add extra tests.
4910 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
4911 clscheck- disable CLS-Compliant verification event if assembly is has
4912 CLSCompliantAttribute(true).
4914 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
4915 ApllyAttribute is now called in emit section as in the other cases.
4916 Possible future Emit integration.
4917 (IsIdentifierClsCompliant): New override.
4918 (VerifyClsCompliance): New override.
4919 (GetEnumeratorName): Returns full enum name.
4921 * parameter.cs (GetSignatureForError): Implemented.
4923 * report.cs (WarningData): New struct for Warning message information.
4924 (LocationOfPreviousError): New method.
4925 (Warning): New method. Reports warning based on the warning table.
4926 (Error_T): New method. Reports error based on the error table.
4928 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
4929 verifications are done here.
4931 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
4933 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
4934 CLSCompliantAttribute.
4935 (all_imported_types): New member holds all imported types from other
4937 (LoadAllImportedTypes): New method fills static table with exported types
4938 from all referenced assemblies.
4939 (Modules): New property returns all assembly modules.
4941 2004-03-30 Miguel de Icaza <miguel@ximian.com>
4943 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
4944 throwing a parser error.
4946 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
4947 which removes the hardcoded get_/set_ prefixes for properties, as
4948 IL allows for the properties to be named something else.
4952 * expression.cs: Do not override operand before we know if it is
4955 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
4957 * typemanager.cs: support for pinned variables.
4959 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
4961 * decl.cs, typemanager.cs: Avoid using an arraylist
4962 as a buffer if there is only one result set.
4964 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
4966 * expression.cs: Make sure you cant call a static method
4967 with an instance expression, bug #56174.
4969 2004-03-29 Miguel de Icaza <miguel@ximian.com>
4971 * class.cs (IsDuplicateImplementation): Improve error reporting to
4972 flag 663 (method only differs in parameter modifier).
4974 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
4975 in preprocessor directives.
4977 * location.cs (LookupFile): Allow for the empty path.
4979 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
4980 better approach for some of that patch, but its failing with the
4981 CharSet enumeration. For now try/catch will do.
4983 * typemanager.cs: Do not crash if a struct does not have fields.
4986 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
4988 * expression.cs: cs0213, cant fix a fixed expression.
4991 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
4993 * cs-parser.jay: detect invalid embeded statements gracefully.
4996 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
4998 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
5001 the invocation type may not be a subclass of the tye of the item/
5002 The type of the item must be a subclass of the invocation item.
5007 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
5009 * attribute.cs: Added methods to get a string and a bool from an
5010 attribute. Required to information from AssemblyKeyFileAttribute,
5011 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
5012 * codegen.cs: Modified AssemblyName creation to include support for
5013 strongnames. Catch additional exceptions to report them as CS1548.
5014 * compiler.csproj: Updated include CryptoConvert.cs.
5015 * compiler.csproj.user: Removed file - user specific configuration.
5016 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
5017 Mono.Security assembly. The original class is maintained and tested in
5018 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
5019 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
5020 like CSC 8.0 (C# v2) supports.
5021 * Makefile: Added CryptoConvert.cs to mcs sources.
5022 * rootcontext.cs: Added new options for strongnames.
5024 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
5026 * driver.cs: For --expect-error, report error code `2'
5027 if the program compiled with no errors, error code `1' if
5028 it compiled with an error other than the one expected.
5030 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
5032 * compiler.csproj: Updated for Visual Studio .NET 2003.
5033 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
5034 * compiler.sln: Updated for Visual Studio .NET 2003.
5036 2004-03-24 Ravi Pratap M <ravi@ximian.com>
5038 * expression.cs: Fix bug #47234. We basically need to apply the
5039 rule that we prefer the conversion of null to a reference type
5040 when faced with a conversion to 'object' (csc behaviour).
5042 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5044 * statement.cs: Shorter form for foreach, eliminates
5045 a local variable. r=Martin.
5047 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5049 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
5050 checks if we can use brtrue/brfalse to test for 0.
5051 * expression.cs: use the above in the test for using brtrue/brfalse.
5054 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5056 * expression.cs: Rewrite string concat stuff. Benefits:
5058 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
5059 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
5060 rather than a concat chain.
5062 * typemanager.cs: Add lookups for more concat overloads.
5064 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5066 * expression.cs: Emit shorter il code for array init.
5083 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
5085 * statement.cs: Before, two switch blocks would be merged if the
5086 total size of the blocks (end_item - begin_item + 1) was less than
5087 two times the combined sizes of the blocks.
5089 Now, it will only merge if after the merge at least half of the
5094 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
5096 * class.cs : csc build fix for GetMethods(). See bug #52503.
5098 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
5100 * expression.cs: Make sure fp comparisons work with NaN.
5101 This fixes bug #54303. Mig approved this patch a long
5102 time ago, but we were not able to test b/c the runtime
5105 2004-03-19 Miguel de Icaza <miguel@ximian.com>
5107 * ecore.cs (TypExpr.GetHashCode): implement this overload.
5109 2004-03-19 Martin Baulig <martin@ximian.com>
5111 * class.cs (MemberCore.IsDuplicateImplementation): Check whether
5112 two overloads may unify for some type parameter substitutions and
5113 report a CS0408 if appropriate.
5115 2004-03-19 Martin Baulig <martin@ximian.com>
5117 * class.cs (MemberCore.IsDuplicateImplementation): Report the
5118 error here and not in our caller.
5120 2004-03-19 Martin Baulig <martin@ximian.com>
5122 * interface.cs: Completely killed this file.
5123 (Interface): We're now a TypeContainer and live in class.cs.
5125 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
5126 argument; we're now also called for interfaces.
5127 (TypeContainer.DefineMembers): Allow this method being called
5129 (TypeContainer.GetMethods): New public method; formerly known as
5130 Interface.GetMethod(). This is used by PendingImplementation.
5131 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
5132 it's now private and non-static.
5133 (Interface): Moved this here; it's now implemented similar to
5135 (Method, Property, Event, Indexer): Added `bool is_interface'
5136 argument to their .ctor's.
5137 (MemberBase.IsInterface): New public field.
5139 * cs-parser.jay: Create normal Method, Property, Event, Indexer
5140 instances instead of InterfaceMethod, InterfaceProperty, etc.
5141 (opt_interface_base): Removed; we now use `opt_class_base' instead.
5142 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
5144 2004-03-19 Martin Baulig <martin@ximian.com>
5146 * class.cs (MethodCore.IsDuplicateImplementation): New private
5147 method which does the CS0111 checking.
5148 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
5149 Use IsDuplicateImplementation().
5151 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
5153 * decl.cs (FindMemberToOverride): New method to find the correct
5154 method or property to override in the base class.
5156 - Make Method/Property use the above method to find the
5157 version in the base class.
5158 - Remove the InheritableMemberSignatureCompare as it is now
5161 This patch makes large code bases much faster to compile, as it is
5162 O(n) rather than O(n^2) to do this validation.
5164 Also, it fixes bug 52458 which is that nested classes are not
5165 taken into account when finding the base class member.
5167 Reviewed/Approved by Martin.
5169 2004-03-17 Martin Baulig <martin@ximian.com>
5171 * expression.cs (MemberAccess.DoResolve): Take the parent's number
5172 of type arguments into account; use the `real_num_type_args'
5173 approach like in DoResolveAsTypeStep().
5175 * generic.cs (GenericMemberAccess.DoResolve): Make this work for
5178 2004-03-17 Marek Safar <marek.safar@seznam.cz>
5180 * interface.cs: In all interface classes removed redundant
5181 member initialization.
5183 2004-03-16 Martin Baulig <martin@ximian.com>
5185 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
5187 2004-03-15 Miguel de Icaza <miguel@ximian.com>
5189 * decl.cs (DefineTypeAndParents): New helper method to define a
5190 type's containers before the type itself is defined; This is a
5191 bug exposed by the recent changes to Windows.Forms when an
5192 implemented interface was defined inside a class that had not been
5195 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
5197 (Check): Loop correctly to report errors modifiers
5198 (UNSAFE was not in the loop, since it was the same as TOP).
5200 * interface.cs: Every interface member now takes a ModFlags,
5201 instead of a "is_new" bool, which we set on the base MemberCore.
5203 Every place where we called "UnsafeOk" in the interface, now we
5204 call the proper member (InterfaceMethod.UnsafeOK) instead to get
5205 the unsafe settings from the member declaration instead of the
5206 container interface.
5208 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
5210 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
5211 `set_indexer_name' to the pending bits (one per type).
5213 We fixed a bug today that was picking the wrong method to
5214 override, since for properties the existing InterfaceMethod code
5215 basically ignored the method name. Now we make sure that the
5216 method name is one of the valid indexer names.
5218 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
5220 * support.cs (SeekableStreamReader): Keep track of stream byte
5221 positions and don't mix them with character offsets to the buffer.
5223 Patch from Gustavo Giráldez
5225 2004-03-15 Marek Safar <marek.safar@seznam.cz>
5227 * interface.cs (InterfaceSetGetBase): Removed double member
5228 initialization, base class does it as well.
5230 2004-03-13 Martin Baulig <martin@ximian.com>
5232 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
5233 when compiling corlib.
5235 2004-03-13 Miguel de Icaza <miguel@ximian.com>
5237 * convert.cs (ExplicitConversion): We were reporting an error on
5238 certain conversions (object_type source to a value type, when the
5239 expression was `null') before we had a chance to pass it through
5240 the user defined conversions.
5242 * driver.cs: Replace / and \ in resource specifications to dots.
5245 * class.cs: Add check for duplicate operators. Fixes 52477
5247 2004-03-11 Miguel de Icaza <miguel@ximian.com>
5249 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
5250 that are in the middle of the statements, not only at the end.
5253 * class.cs (TypeContainer.AddField): No longer set the
5254 `HaveStaticConstructor' flag, now we call it
5255 `UserDefineStaticConstructor' to diferentiate the slightly
5256 semantic difference.
5258 The situation is that we were not adding BeforeFieldInit (from
5259 Modifiers.TypeAttr) to classes that could have it.
5260 BeforeFieldInit should be set to classes that have no static
5265 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
5267 And most importantly Zoltan's comment:
5269 http://bugzilla.ximian.com/show_bug.cgi?id=44229
5271 "I think beforefieldinit means 'it's ok to initialize the type sometime
5272 before its static fields are used', i.e. initialization does not need
5273 to be triggered by the first access to the type. Setting this flag
5274 helps the JIT to compile better code, since it can run the static
5275 constructor at JIT time, and does not need to generate code to call it
5276 (possibly lots of times) at runtime. Unfortunately, mcs does not set
5277 this flag for lots of classes like String.
5279 csc sets this flag if the type does not have an explicit static
5280 constructor. The reasoning seems to be that if there are only static
5281 initalizers for a type, and no static constructor, then the programmer
5282 does not care when this initialization happens, so beforefieldinit
5285 This bug prevents the AOT compiler from being usable, since it
5286 generates so many calls to mono_runtime_class_init that the AOT code
5287 is much slower than the JITted code. The JITted code is faster,
5288 because it does not generate these calls if the vtable is type is
5289 already initialized, which is true in the majority of cases. But the
5290 AOT compiler can't do this."
5292 2004-03-10 Miguel de Icaza <miguel@ximian.com>
5294 * class.cs (MethodData.Emit): Refactor the code so symbolic
5295 information is generated for destructors; For some reasons we
5296 were taking a code path that did not generate symbolic information
5299 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
5301 * class.cs: Create a Constructor.CheckBase method that
5302 takes care of all validation type code. The method
5303 contains some code that was moved from Define.
5305 It also includes new code that checks for duplicate ctors.
5306 This fixes bug #55148.
5308 2004-03-09 Joshua Tauberer <tauberer@for.net>
5310 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
5311 a { ... }-style array creation invokes EmitStaticInitializers
5312 which is not good for reference-type arrays. String, decimal
5313 and now null constants (NullCast) are not counted toward
5314 static initializers.
5316 2004-03-05 Martin Baulig <martin@ximian.com>
5318 * location.cs (SourceFile.HasLineDirective): New public field;
5319 specifies whether the file contains or is referenced by a "#line"
5321 (Location.DefineSymbolDocuments): Ignore source files which
5322 either contain or are referenced by a "#line" directive.
5324 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
5326 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
5327 direct access to our parent, so check the method inline there.
5329 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
5331 * expression.cs (Invocation.EmitCall): Miguel's last commit
5332 caused a regression. If you had:
5337 In Foo the implict this would be null.
5339 2004-02-27 Miguel de Icaza <miguel@ximian.com>
5341 * expression.cs (Invocation.EmitCall): If the method is not
5342 virtual, do not emit a CallVirt to it, use Call.
5344 * typemanager.cs (GetFullNameSignature): Improve the method to
5345 cope with ".ctor" and replace it with the type name.
5347 * class.cs (ConstructorInitializer.Resolve): Now the method takes
5348 as an argument the ConstructorBuilder where it is being defined,
5349 to catch the recursive constructor invocations.
5351 2004-03-16 Martin Baulig <martin@ximian.com>
5353 * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
5354 ConstructedType, call ResolveType() on it to get the type rather
5355 than just using `expr.Type'.
5357 2004-03-16 Martin Baulig <martin@ximian.com>
5359 * generics.cs (ConstructedType.GetMemberAccess): Take the
5360 EmitContext instead on the TypeExpr and use
5361 ec.TypeContainer.CurrentType/ec.ContainerType.
5363 2004-03-16 Martin Baulig <martin@ximian.com>
5365 * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
5366 parameters before aliases.
5368 2004-03-16 Martin Baulig <martin@ximian.com>
5370 * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
5371 New oublic function; checks whether two generic instances may become
5372 equal under some instantiations (26.3.1).
5374 * class.cs (TypeContainer.Define): Call
5375 TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
5378 2004-03-16 Martin Baulig <martin@ximian.com>
5380 * class.cs (TypeContainer.GetClassBases): Moved
5381 Error_TypeParameterAsBase() here and also check whether the base
5382 class is not an attribute.
5384 2004-03-16 Martin Baulig <martin@ximian.com>
5386 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
5388 2004-03-16 Martin Baulig <martin@ximian.com>
5390 * class.cs (Error_TypeParameterAsBase): Use correct error number
5393 2004-03-16 Martin Baulig <martin@ximian.com>
5395 * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
5398 * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
5401 2004-03-15 Martin Baulig <martin@ximian.com>
5403 * typemanager.cs (TypeManager.GetFullName): New public method.
5404 (TypeManager.MemberLookup): Added `int_num_type_arguments'
5405 argument; only return members with the correct number of type
5407 (TypeManager.CheckGeneric): Allow -1 to bypass the check.
5408 (TypeManager.FilterWithClosure): Call CheckGeneric() to check
5409 whether the number of type arguments matches.
5411 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
5412 not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
5414 * expression.cs (MemberAccess): Added public `NumTypeArguments'
5415 field; it's set by the protected .ctor when we're actually a
5416 GenericMemberAccess.
5417 (MemberAccess.ResolveAsTypeStep): Compute the total number of type
5418 arguments and pass it to MemberLookupFinal ().
5420 * ecore.cs (Expression.MemberLookup): Added `int
5421 num_type_arguments' argument; only return members with the correct
5422 number of type arguments.
5423 (Expression.MemberLookupFailed): Check whether the MemberLookup
5424 failed because we did not have the correct number of type
5425 arguments; report CS0305 in this case.
5427 * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
5428 `e.ResolveAsTypeTerminal()' already did so.
5430 2004-03-15 Martin Baulig <martin@ximian.com>
5432 * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
5433 we're a ConstructedType; in this case, the caller must report an
5434 error (for instance CS0131).
5436 * generic.cs (TypeArguments): Added Location argument to the .ctor.
5437 (TypeArguments.Resolve): Actually report errors here.
5439 2004-03-15 Miguel de Icaza <miguel@ximian.com>
5441 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
5442 `set_indexer_name' to the pending bits (one per type).
5444 We fixed a bug today that was picking the wrong method to
5445 override, since for properties the existing InterfaceMethod code
5446 basically ignored the method name. Now we make sure that the
5447 method name is one of the valid indexer names.
5449 2004-03-15 Martin Baulig <martin@ximian.com>
5451 * typemanager.cs (TypeManager.IndexerPropertyName): Added support
5452 for generic instances.
5454 2004-03-13 Martin Baulig <martin@ximian.com>
5456 * class.cs (TypeContainer.DefineType): Call
5457 TypeManager.AddUserType() immediately after creating the
5458 TypeBuilder; pass all type parameters when creating the
5461 * decl.cs (DeclSpace.FindNestedType): New public method.
5462 (DeclSpace.FindType): Added `int num_type_args' argument; only
5463 return types with the correct number of type parameters.
5464 (DeclSpace.CountTypeParams): New public property.
5466 * ecore.cs (SimpleName.ctor): Added overloaded version which takes
5467 the number of type parameters; defaults to zero.
5469 * generic.cs (TypeArguments.Count): New public property.
5470 (ConstructedType.DoResolveAsTypeStep): First call
5471 ds.FindNestedType() to find out whether we're nested in the
5472 current generic type; in this case, we inherit all type parameters
5473 from the current class.
5475 * rootcontext.cs (RootContext.NamespaceLookup): Added `int
5476 num_type_args' argument.
5477 (RootContext.LookupType): Added overloaded version which takes the
5478 number of type arguments; only return types with the correct
5479 number of type arguments.
5481 * typemanager.cs (TypeManager.CheckGeneric): New public function;
5482 checks whether `Type t' has `int num_type_args'.
5484 2004-03-13 Martin Baulig <martin@ximian.com>
5486 * generic.cs (GenericMethod.DefineType): New method; calls
5487 DefineType() on all the type parameters.
5489 * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
5490 (MethodData.Define): If we're a generic method, call
5491 GenericMethod.DefineType() to define the type parameters.
5493 2004-03-10 Martin Baulig <martin@ximian.com>
5495 * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
5496 instead of IsAssignableFrom.
5498 2004-03-10 Martin Baulig <martin@ximian.com>
5500 * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
5502 * support.cs (ParameterData.HasArrayParameter): New property.
5503 (ReflectionParameters.ctor): Take a MethodBase instead of a
5504 ParameterInfo[]. If we have any type parameters, get the generic
5505 method definition and ask it whether we have variable arguments.
5507 2004-02-26 Miguel de Icaza <miguel@ximian.com>
5509 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
5510 routines to check if a type is an enumerable/enumerator allow
5511 classes that implement the IEnumerable or IEnumerator interfaces.
5513 * class.cs (Property, Operator): Implement IIteratorContainer, and
5514 implement SetYields.
5516 (Property.Define): Do the block swapping for get_methods in the
5517 context of iterators. We need to check if Properties also
5518 include indexers or not.
5520 (Operator): Assign the Block before invoking the
5521 OperatorMethod.Define, so we can trigger the Iterator code
5524 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
5525 Property and Operator classes are not created when we parse the
5526 declarator but until we have the block completed, so we use a
5527 singleton SimpleIteratorContainer.Simple to flag whether the
5528 SetYields has been invoked.
5530 We propagate this setting then to the Property or the Operator to
5531 allow the `yield' to function.
5533 2004-02-25 Marek Safar <marek.safar@seznam.cz>
5535 * codegen.cs: Implemented attribute support for modules.
5536 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
5537 Assembly/Module functionality.
5539 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
5540 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
5541 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
5543 2004-02-16 Marek Safar <marek.safar@seznam.cz>
5545 * interface.cs (FindMembers): The operation is performed on all base
5546 interfaces and not only on the first. It is required for future CLS Compliance patch.
5548 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
5550 * statement.cs, codegen.cs:
5551 This patch deals with patterns such as:
5553 public class List : IEnumerable {
5555 public MyEnumerator GetEnumerator () {
5556 return new MyEnumerator(this);
5559 IEnumerator IEnumerable.GetEnumerator () {
5563 public struct MyEnumerator : IEnumerator {
5568 Before, there were a few things we did wrong:
5569 1) we would emit callvirt on a struct, which is illegal
5570 2) we emited ldarg when we needed to emit ldarga
5571 3) we would mistakenly call the interface methods on an enumerator
5572 type that derived from IEnumerator and was in another assembly. For example:
5574 public class MyEnumerator : IEnumerator
5576 Would have the interface methods called, even if there were public impls of the
5577 method. In a struct, this lead to invalid IL code.
5579 2004-02-11 Marek Safar <marek.safar@seznam.cz>
5581 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
5584 * delegate.cs (Define): Fixed crash when delegate type is undefined.
5586 2004-02-11 Miguel de Icaza <miguel@ximian.com>
5588 * cs-parser.jay: Fix small regression: we were not testing V2
5589 compiler features correctly.
5591 * interface.cs: If the emit context is null, then create one
5593 2004-02-09 Marek Safar <marek.safar@seznam.cz>
5595 * decl.cs (GetSignatureForError): New virtual method to get full name
5598 * attribute.cs (IAttributeSupport): New interface for attribute setting.
5599 Now it is possible to rewrite ApplyAttributes method to be less if/else.
5601 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
5602 Duplicated members and code in these classes has been removed.
5603 Better encapsulation in these classes.
5605 2004-02-07 Miguel de Icaza <miguel@ximian.com>
5607 * assign.cs (Assign.DoResolve): When dealing with compound
5608 assignments, there is a new rule in ECMA C# 2.4 (might have been
5609 there before, but it is documented here) that states that in:
5613 If b is of type int, and the `op' is a shift-operator, then the
5614 above is evaluated as:
5618 * expression.cs (Binary.ResolveOperator): Instead of testing for
5619 int/uint/long/ulong, try to implicitly convert to any of those
5620 types and use that in pointer arithmetic.
5622 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
5623 method to print information for from the type, not from the
5624 null-method we were given.
5626 2004-02-01 Duncan Mak <duncan@ximian.com>
5628 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
5629 parsing for cmd, fixes bug #53694.
5631 2004-02-04 Marek Safar <marek.safar@seznam.cz>
5633 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
5634 in the member name duplication tests. Property and operator name duplication
5635 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
5637 2004-02-03 Marek Safar <marek.safar@seznam.cz>
5639 * interface.cs (PopulateMethod): Fixed crash when interface method
5640 returns not existing type (error test cs0246-3.cs).
5642 2004-02-02 Ravi Pratap M <ravi@ximian.com>
5644 * cs-parser.jay (interface_accessors): Re-write actions to also
5645 store attributes attached to get and set methods. Fix spelling
5648 (inteface_property_declaration): Modify accordingly.
5650 (InterfaceAccessorInfo): New helper class to store information to pass
5651 around between rules that use interface_accessors.
5653 * interface.cs (Emit): Apply attributes on the get and set
5654 accessors of properties and indexers too.
5656 * attribute.cs (ApplyAttributes): Modify accordingly to use the
5657 right MethodBuilder when applying attributes to the get and set accessors.
5659 2004-01-31 Miguel de Icaza <miguel@ximian.com>
5661 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
5663 2004-01-26 Miguel de Icaza <miguel@ximian.com>
5665 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
5667 2004-01-25 Miguel de Icaza <miguel@ximian.com>
5669 * cs-parser.jay: Remove YIELD token, instead use the new grammar
5670 changes that treat `yield' specially when present before `break'
5673 * cs-tokenizer.cs: yield is no longer a keyword.
5675 2004-01-23 Marek Safar <marek.safar@seznam.cz>
5677 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
5678 setting for default constructors.
5679 For default constructors are almost every time set wrong Modifier. The
5680 generated IL code has been alright. But inside mcs this values was
5681 wrong and this was reason why several of my CLS Compliance tests
5684 2004-02-27 Martin Baulig <martin@ximian.com>
5686 * generics.cs (ConstructedType.ResolveType): Make the nested type
5687 stuff actually work.
5689 2004-02-25 Martin Baulig <martin@ximian.com>
5691 * decl.cs (DeclSpace.CurrentTypeParameters): New protected
5692 property; returns the type parameters just from the current type,
5693 ie. with the ones from outer classes.
5694 (DeclSpace.LookupGeneric): First search in the current class, then
5696 (DeclSpace.initialize_type_params): When hiding a type parameter
5697 from an outer class, put it into the `type_param_list' anyways.
5699 * expression.cs (MemberAccess.expr): Made this field protected.
5701 * class.cs (TypeContainer.Define): The `CurrentType' just contains
5702 the type parameters from the current class.
5704 * generic.cs (ConstructedType.ResolveType): Support nested generic
5705 types by taking the type parameters which we inherit from outer
5706 classes into account.
5707 (GenericMemberAccess.ResolveAsTypeStep): Override this and added
5708 support for nested generic types.
5710 2004-02-23 Martin Baulig <martin@ximian.com>
5712 * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
5713 field and check whether we're nested inside a generic type.
5714 (DeclSpace.ResolveType): If we're resolving to a generic type
5715 definition, create a ConstructedType and return its resolved type.
5716 (DeclSpace.initialize_type_params): New private method;
5717 initializes the `type_param_list' field from the type parameters
5718 from this and all enclosing classes.
5719 (DeclSpace.TypeParameters): Call initialize_type_params() unless
5720 we're already initialized.
5722 2004-02-23 Martin Baulig <martin@ximian.com>
5724 * class.cs (Method.Define): Create the generic method before
5726 (Memberbase.DoDefine): Added DeclSpace argument (in addition to
5727 the TypeContainer one); we use this for generic methods.
5729 * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
5730 parent's TypeBuilder.
5732 2004-02-18 Martin Baulig <martin@ximian.com>
5734 * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
5735 to check for equality.
5737 2004-02-05 Martin Baulig <martin@ximian.com>
5739 * ecore.cs (FieldExpr.DoResolveLValue): If we have an
5740 `ec.TypeContainer.CurrentType', use it instead of
5741 `ec.ContainerType' to check whether we're in the type's ctor.
5743 2004-01-29 Martin Baulig <martin@ximian.com>
5745 * expression.cs (Invocation.DoResolve): If we're a
5746 `ConstructedType', then we're actually a generic method, so
5747 rewrite the expr as a GenericMemberAccess.
5749 * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
5750 here; manually parse it into a string.
5752 2004-01-28 Martin Baulig <martin@ximian.com>
5754 * typemanager.cs (TypeManager.IsEqual): New static method.
5755 (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
5756 check for equality instead of using `=='.
5758 2004-01-26 Martin Baulig <martin@ximian.com>
5760 * decl.cs (DeclSpace.CurrentType): New public field.
5762 * expression.cs (This.ResolveBase): If we have an
5763 `ec.TypeContainer.CurrentType', use it instead of
5766 * class.cs (TypeContainer.DefineType): If we're a generic type,
5767 create the `CurrentType' (unresolved).
5768 (TypeContainer.GenericType): New private field.
5769 (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
5770 it and store it in `GenericType' before creating the MemberCache.
5771 (TypeContainer.GetMembers): If we have a `GenericType', call
5772 TypeManager.FindMembers() on it.
5774 * interface.cs (Interface.GenericType): New private field.
5775 (Interface.DefineType): If we're a generic type, create the
5776 `CurrentType' (unresolved).
5777 (Interface.DefineMembers): If we have a `CurrentType', resolve it
5778 and store it in `GenericType' before creating the MemberCache.
5779 (Interface.GetMembers): If we have a `GenericType', call
5780 TypeManager.FindMembers() on it.
5782 2004-01-22 Martin Baulig <martin@ximian.com>
5784 * cs-parser.jay (namespace_or_type_name): Return an Expression,
5785 not a QualifiedIdentifier. This is what `type_name_expression'
5786 was previously doing.
5787 (type_name_expression): Removed; the code is now in
5788 `namespace_or_type_name'.
5789 (qualified_identifier): Removed, use `namespace_or_type_name'
5791 (QualifiedIdentifier): Removed this class.
5793 2004-01-22 Martin Baulig <martin@ximian.com>
5795 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
5796 not a string as alias name.
5798 2004-01-21 Miguel de Icaza <miguel@ximian.com>
5800 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
5801 #52730 bug, and instead compute correctly the need to use a
5802 temporary variable when requesting an address based on the
5803 static/instace modified of the field and the constructor.
5805 2004-01-21 Martin Baulig <martin@ximian.com>
5807 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
5808 class and namespace before looking up aliases. Fixes #52517.
5810 2004-01-21 Martin Baulig <martin@ximian.com>
5812 * flowanalysis.cs (UsageVector.Merge): Allow variables being
5813 assinged in a 'try'; fixes exception4.cs.
5815 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5816 * class.cs : Implemented parameter-less constructor for TypeContainer
5818 * decl.cs: Attributes are now stored here. New property OptAttributes
5820 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
5822 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
5824 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5826 * typemanager.cs (CSharpSignature): Now reports also inner class name.
5827 (CSharpSignature): New method for indexer and property signature.
5829 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5831 * pending.cs (IsVirtualFilter): Faster implementation.
5833 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5835 * typemanager.cs: Avoid inclusion of same assembly more than once.
5837 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5839 * cs-parser.jay: Fixed problem where the last assembly attribute
5840 has been applied also to following declaration (class, struct, etc.)
5842 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5844 * class.cs: Added error CS0538, CS0539 reporting.
5845 Fixed crash on Microsoft runtime when field type is void.
5847 * cs-parser.jay: Added error CS0537 reporting.
5849 * pending.cs: Added error CS0535 reporting.
5850 Improved error report for errors CS0536, CS0534.
5852 2004-01-20 Miguel de Icaza <miguel@ximian.com>
5854 Merge a few bits from the Anonymous Method MCS tree.
5856 * statement.cs (ToplevelBlock): New class for toplevel methods,
5857 will hold anonymous methods, lifted variables.
5859 * cs-parser.jay: Create toplevel blocks for delegates and for
5860 regular blocks of code.
5862 2004-01-20 Martin Baulig <martin@ximian.com>
5864 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
5865 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
5866 and `NeedExplicitReturn'; added `IsLastStatement'.
5867 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
5868 have a `ReturnLabel' or we're not unreachable.
5870 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
5871 child's reachability; don't just override ours with it. Fixes
5872 #58058 (lluis's example).
5873 (FlowBranching): Added public InTryOrCatch(), InCatch(),
5874 InFinally(), InLoop(), InSwitch() and
5875 BreakCrossesTryCatchBoundary() methods.
5877 * statement.cs (Return): Do all error checking in Resolve().
5878 Unless we are the last statement in a top-level block, always
5879 create a return label and jump to it.
5880 (Break, Continue): Do all error checking in Resolve(); also make
5881 sure we aren't leaving a `finally'.
5882 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
5883 statement in a top-level block.
5884 (Block.Flags): Added `IsDestructor'.
5885 (Block.IsDestructor): New public property.
5887 2004-01-20 Martin Baulig <martin@ximian.com>
5889 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
5891 2004-01-20 Martin Baulig <martin@ximian.com>
5893 * statement.cs (Statement.ResolveUnreachable): New public method.
5894 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
5895 (Block.Resolve): Resolve unreachable statements.
5897 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
5899 * expression.cs: We need to fix the case where we do
5900 not have a temp variable here.
5902 * assign.cs: Only expression compound assignments need
5903 temporary variables.
5905 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
5907 * flowanalysis.cs: Reduce memory allocation in a few ways:
5908 - A block with no variables should not allocate a bit
5910 - A method with no out parameters does not need any tracking
5911 for assignment of the parameters, so we need not allocate
5914 public readonly Type[] VariableTypes;
5915 public readonly string[] VariableNames;
5916 Are redundant. The data is already stored in the variable
5917 map, so we need not allocate another array for it.
5918 - We need to add alot of checks for if (params | locals) == null
5919 due to the first two changes.
5921 2004-01-18 Miguel de Icaza <miguel@ximian.com>
5923 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
5924 implement IMemoryLocation, we store a copy on a local variable and
5925 take the address of it. Patch from Benjamin Jemlich
5927 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
5928 to use a special "type_name_expression" rule which reduces the
5929 number of "QualifiedIdentifier" classes created, and instead
5930 directly creates MemberAccess expressions.
5932 2004-01-17 Miguel de Icaza <miguel@ximian.com>
5934 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
5935 that fixes #52853. Null literal assignment to ValueType
5937 * class.cs (MethodData.Emit): Instead of checking the name of the
5938 method to determine if its a destructor, create a new derived
5939 class from Method called Destructor, and test for that.
5941 * cs-parser.jay: Create a Destructor object instead of a Method.
5943 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
5947 2004-01-16 Miguel de Icaza <miguel@ximian.com>
5949 * expression.cs (Binary.ResolveOperator): Perform an implicit
5950 conversion from MethodGroups to their delegate types on the
5953 * delegate.cs: Introduce a new class DelegateCreation that is the
5954 base class for `NewDelegate' and `ImplicitDelegateCreation',
5955 factor some code in here.
5957 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
5958 conversion from MethodGroups to compatible delegate types.
5960 * ecore.cs (Expression.Resolve): Do not flag error 654
5961 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
5962 we allow conversions from MethodGroups to delegate types now.
5964 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
5965 assignments in v2 either.
5967 2004-01-10 Miguel de Icaza <miguel@ximian.com>
5969 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
5970 static read-only fields in ctors.
5972 Applied patch from Benjamin Jemlich
5974 * expression.cs (UnaryMutator): Avoid leaking local variables.
5976 2004-01-09 Miguel de Icaza <miguel@ximian.com>
5978 * cs-tokenizer.cs (IsCastToken): Allow the various native types
5979 here to return true, as they can be used like this:
5983 Fixed 49836 and all the other dups
5985 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
5987 * driver.cs: Implement /win32res and /win32icon.
5989 2004-01-08 Miguel de Icaza <miguel@ximian.com>
5991 * cs-parser.jay: Add a rule to improve error handling for the
5992 common mistake of placing modifiers after the type.
5994 2004-01-07 Miguel de Icaza <miguel@ximian.com>
5996 * cs-parser.jay (interface_event_declaration): Catch
5997 initialization of events on interfaces, and report cs0068
5999 * cs-parser.jay (interface_event_declaration): Catch
6000 initialization of events.
6002 * ecore.cs: Better report missing constructors.
6004 * expression.cs (Binary.ResolveOperator): My previous bug fix had
6005 the error reporting done in the wrong place. Fix.
6007 * expression.cs (Binary.ResolveOperator): Catch the
6008 operator + (E x, E y) error earlier, and later allow for implicit
6009 conversions in operator +/- (E e, U x) from U to the underlying
6012 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
6013 52596, if the container class is abstract, the default constructor
6014 is protected otherwise its public (before, we were always public).
6016 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
6019 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
6020 Jemlich that fixes bug #52597, MCS was generating invalid code for
6021 idisposable structs. Thanks to Ben for following up with this
6024 2004-01-06 Miguel de Icaza <miguel@ximian.com>
6026 * driver.cs: Allow assemblies without code to be generated, fixes
6029 2004-01-07 Nick Drochak <ndrochak@gol.com>
6031 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
6033 2004-01-05 Miguel de Icaza <miguel@ximian.com>
6035 * cs-parser.jay: Add rules to improve error reporting if fields or
6036 methods are declared at the namespace level (error 116)
6038 * Add rules to catch event add/remove
6040 2004-01-04 David Sheldon <dave-mono@earth.li>
6042 * expression.cs: Added matching ")" to error message for
6045 2004-01-03 Todd Berman <tberman@gentoo.org>
6047 * ecore.cs, attribute.cs:
6048 Applying fix from #52429.
6050 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6052 * ecore.cs, expression.cs, statement.cs:
6053 Total rewrite of how we handle branching. We
6054 now handle complex boolean expressions with fewer
6055 jumps. As well if (x == 0) no longer emits a ceq.
6057 if (x is Foo) is much faster now, because we generate
6060 Overall, we get a pretty big improvement on our benchmark
6061 tests. The code we generate is smaller and more readable.
6063 I did a full two-stage bootstrap. The patch was reviewed
6064 by Martin and Miguel.
6066 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6068 * cs-parser.jay: Make primary_expression not take a QI.
6069 we dont need this because the member_access rule covers
6070 us here. So we replace the rule with just IDENTIFIER.
6072 This has two good effects. First, we remove a s/r conflict.
6073 Second, we allocate many fewer QualifiedIdentifier objects.
6075 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6077 * attribute.cs: Handle MarshalAs attributes as pseudo, and
6078 set the correct information via SRE. This prevents
6079 hanging on the MS runtime. Fixes #29374.
6081 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6083 * convert.cs: correctly handle conversions to value types
6084 from Enum and ValueType as unboxing conversions.
6086 Fixes bug #52569. Patch by Benjamin Jemlich.
6088 2004-01-02 Ravi Pratap <ravi@ximian.com>
6090 * expression.cs (BetterConversion): Prefer int -> uint
6091 over int -> ulong (csc's behaviour). This fixed bug #52046.
6093 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
6095 * decl.cs (MemberCache.FindMembers): now returns a
6098 * typemanager.cs: In general, go with with ^^.
6099 (CopyNewMethods): take an IList.
6100 (RealMemberLookup): Only allocate an arraylist
6101 if we copy from two sets of methods.
6103 This change basically does two things:
6104 1) Fewer array lists allocated due to CopyNewMethods.
6105 2) the explicit cast in MemberList costed ALOT.
6107 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
6109 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
6110 a hashtable to avoid needless string allocations when an identifier is
6111 used more than once (the common case).
6113 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6115 * pending.cs: MS's TypeBuilder.GetInterfaces ()
6116 is broken, it will not return anything. So, we
6117 have to use the information we have in mcs to
6120 * typemanager.cs: Add a cache for GetInterfaces,
6121 since this will now be used more often (due to ^^)
6123 (GetExplicitInterfaces) New method that gets the
6124 declared, not effective, interfaces on a type
6125 builder (eg, if you have interface IFoo, interface
6126 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
6129 This patch makes MCS able to bootstrap itself on
6132 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6134 * expression.cs: Remove the Nop's that Miguel put
6137 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6139 * report.cs, codegen.cs: Give the real stack trace to
6140 the error when an exception is thrown.
6142 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6144 * decl.cs: only allocate hashtables for ifaces if
6147 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6149 * expression.cs: fix the error from cs0121-2.cs
6150 (a parent interface has two child interfaces that
6151 have a function with the same name and 0 params
6152 and the function is called through the parent).
6154 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
6156 * class.cs, rootcontext.cs, typmanager.cs: do not
6159 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
6161 * codegen.cs: remove stack for the ec flow branching.
6162 It is already a linked list, so no need.
6164 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
6166 * Makefile: Allow custom profiler here.
6168 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6170 * typemanager.cs (LookupType):
6171 - Use a static char [], because split takes
6172 a param array for args, so it was allocating
6174 - Do not store true in a hashtable, it boxes.
6176 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6178 * flowanalysis.cs: bytify common enums.
6180 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6182 * modifiers.cs: Add a new set of flags for the
6183 flags allowed on explicit interface impls.
6184 * cs-parser.jay: catch the use of modifiers in
6185 interfaces correctly.
6186 * class.cs: catch private void IFoo.Blah ().
6188 All related to bug #50572.
6190 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6192 * decl.cs: Rewrite the consistant accessability checking.
6193 Accessability is not linear, it must be implemented in
6194 a tableish way. Fixes #49704.
6196 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6198 * expression.cs: Handle negation in a checked context.
6199 We must use subtraction from zero. Fixes #38674.
6201 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
6203 * class.cs: Ignore static void main in DLLs.
6204 * rootcontext.cs: Handle the target type here,
6205 since we are have to access it from class.cs
6206 * driver.cs: account for the above.
6208 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
6210 * report.cs: Give line numbers and files if available.
6212 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
6214 * driver.cs: Implement /addmodule.
6216 * typemanager.cs: Change 'modules' field so it now contains Modules not
6219 2003-12-20 Martin Baulig <martin@ximian.com>
6221 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
6222 (FieldBase.IsAssigned): Removed this field.
6223 (FieldBase.SetAssigned): New public method.
6224 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
6226 2003-12-20 Martin Baulig <martin@ximian.com>
6228 * expression.cs (LocalVariableReference.DoResolve): Don't set
6229 `vi.Used' if we're called from DoResolveLValue().
6231 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
6232 returns the usage vector it just merged into the current one -
6233 pass this one to UsageWarning().
6234 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
6235 of the `EmitContext', don't call this recursively on our children.
6237 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
6239 * driver.cs: Implement /target:module.
6241 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
6243 * support.cs (CharArrayHashtable): New helper class.
6245 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
6246 char arrays, not strings, so we can avoid creating a string in
6247 consume_identifier if the identifier is a keyword.
6249 2003-12-16 Martin Baulig <martin@ximian.com>
6251 * statement.cs (LocalInfo.Assigned): Removed this property.
6252 (LocalInfo.Flags): Removed `Assigned'.
6253 (LocalInfo.IsAssigned): New public method; takes the EmitContext
6254 and uses flow analysis.
6255 (Block.UsageWarning): Made this method private.
6256 (Block.Resolve): Call UsageWarning() if appropriate.
6258 * expression.cs (LocalVariableReference.DoResolve): Always set
6259 LocalInfo.Used here.
6261 2003-12-13 Martin Baulig <martin@ximian.com>
6263 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
6264 any value here; we're now using flow analysis to figure out
6265 whether a statement/block returns a value.
6267 2003-12-13 Martin Baulig <martin@ximian.com>
6269 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
6271 (FlowBranching.MergeFinally): Don't call
6272 `branching.CheckOutParameters()' here, this is called in
6274 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
6275 when adding the `finally' vector.
6277 2003-12-13 Martin Baulig <martin@ximian.com>
6280 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
6281 actually work and also fix #48962.
6283 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
6285 * decl.cs: Do not check System.Object for nested types,
6286 since we know it does not have any. Big bang for buck:
6291 corlib: 17.99 seconds
6295 corlib: 17.39 seconds
6297 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
6299 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
6300 time we are returning 0 members, so we save alot here.
6302 2003-12-11 Martin Baulig <martin@ximian.com>
6304 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
6305 `MergeChild()', also just take the `FlowBranching' as argument;
6306 call Merge() on it and return the result.
6307 (FlowBranching.Merge): We don't need to do anything if we just
6310 2003-12-11 Martin Baulig <martin@ximian.com>
6312 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
6313 them in an `ArrayList' to reduce memory usage. Thanks to Ben
6314 Maurer for this idea.
6316 2003-12-11 Martin Baulig <martin@ximian.com>
6318 * flowanalysis.cs (MergeResult): This class is now gone; we now
6319 use the `UsageVector' for this. The reason for this is that if a
6320 branching just has one sibling, we don't need to "merge" them at
6321 all - that's the next step to do.
6322 (FlowBranching.Merge): We now return a `UsageVector' instead of a
6325 2003-12-11 Martin Baulig <martin@ximian.com>
6327 Reworked flow analyis and made it more precise and bug-free. The
6328 most important change is that we're now using a special `Reachability'
6329 class instead of having "magic" meanings of `FlowReturns'. I'll
6330 do some more cleanups and optimizations and also add some more
6331 documentation this week.
6333 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
6334 largely reworked this class.
6335 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
6336 the new `Reachability' class instead of having "magic" values here.
6337 (FlowBranching): We're now using an instance of `Reachability'
6338 instead of having separate `Returns', `Breaks' etc. fields.
6340 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
6341 based on flow analysis; ignore the return value of block.Emit ().
6343 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
6345 * driver.cs typemanager.cs: Find the mono extensions to corlib even
6346 if they are private.
6348 2003-12-09 Martin Baulig <martin@ximian.com>
6350 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
6351 call them directly on the UsageVector.
6353 2003-12-09 Martin Baulig <martin@ximian.com>
6355 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
6356 Changed return type from `FlowReturns' to `Reachability'.
6358 2003-12-09 Martin Baulig <martin@ximian.com>
6360 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
6361 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
6362 `Reachable' fields with a single `Reachability' one.
6364 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6366 * class.cs (FindMembers): Remove foreach's.
6379 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6384 This patch does a few things:
6385 1. EmptyStatement is now a singleton, so it is never reallocated.
6386 2. All blah is EmptyStatement constructs have been changed to
6387 blah == EmptyStatement.Value, which is much faster and valid
6388 now that EmptyStatement is a singleton.
6389 3. When resolving a block, rather than allocating a new array for
6390 the non-empty statements, empty statements are replaced with
6391 EmptyStatement.Value
6392 4. Some recursive functions have been made non-recursive.
6393 Mainly the performance impact is from (3), however (1) and (2) are needed for
6394 this to work. (4) does not make a big difference in normal situations, however
6395 it makes the profile look saner.
6400 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6401 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6402 Total memory allocated: 56397 KB
6405 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
6406 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
6407 Total memory allocated: 55666 KB
6409 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6411 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
6412 than the hashtable in a hashtable version
6414 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
6415 we always end up concating a string. This results in a huge perf
6416 loss, because many strings have to be tracked by the GC. In this
6417 patch, we first use a hashtable that works with two keys, so that
6418 the strings do not need to be concat'ed.
6429 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6431 * Makefile: Add a new target `do-time' that does a quick and simple
6432 profile, leaving easy to parse output.
6434 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
6436 * codegen.cs (Init): Create the dynamic assembly with
6437 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
6439 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
6441 * support.cs: Make the PtrHashtable use only one
6442 instance of its comparer.
6444 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
6446 * typemanager.cs: Fix lookup of GetNamespaces.
6448 2003-11-29 Miguel de Icaza <miguel@ximian.com>
6450 * expression.cs: Removed redundant line.
6452 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
6453 ArrayLists, use for loops with bounds.
6455 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
6458 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
6459 arraylists, use for loop with bounds.
6461 The above three changes give us a 0.071 second performance
6462 improvement out of 3.294 seconds down to 3.223. On my machine
6463 the above changes reduced the memory usage by 1,387 KB during
6466 * cs-parser.jay (QualifiedIdentifier): New class used to represent
6467 QualifiedIdentifiers. Before we created a new string through
6468 concatenation, and mostly later on, the result would be
6469 manipulated by DecomposeQI through string manipulation.
6471 This reduced the compiler memory usage for bootstrapping from
6472 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
6473 compile times in 0.05 seconds.
6475 2003-11-28 Dick Porter <dick@ximian.com>
6477 * support.cs: Do string compares with the Invariant culture.
6485 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
6486 the comparison is done with the Invariant culture.
6488 2003-11-27 Miguel de Icaza <miguel@ximian.com>
6490 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
6491 GetEnumerator method.
6493 (ProbeCollectionType): Iterate starting at the most specific type
6494 upwards looking for a GetEnumerator
6496 * expression.cs: Shift count can be up to 31 for int/uint and 63
6499 2003-11-26 Miguel de Icaza <miguel@ximian.com>
6501 * statement.cs (Block.LookupLabel): Also look for the label on the
6502 children blocks. Use a hash table to keep track of visited
6505 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
6506 we actually did transform the other operand, otherwise fall back
6507 to the common codepath that casts to long.
6509 * cs-tokenizer.cs: Use the same code pattern as the int case.
6510 Maybe I should do the parsing myself, and avoid depending on the
6511 Parse routines to get this done.
6513 2003-11-25 Miguel de Icaza <miguel@ximian.com>
6515 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
6516 which fixes bug 51347. This time test it.
6518 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
6519 attributes for example can not tell the difference between these.
6520 The difference was only a syntax feature of the language.
6522 * attribute.cs: Apply attributes to delegates.
6524 * delegate.cs: Call the apply attributes method.
6526 2003-11-24 Miguel de Icaza <miguel@ximian.com>
6528 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
6529 comparing 0 vs Byte.MinValue, not the value
6531 (ImplicitConversionRequired): When reporting a conversion error,
6532 use error 31 to print out the constant error instead of the
6535 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
6536 which fixes bug 51347.
6538 2003-11-22 Miguel de Icaza <miguel@ximian.com>
6540 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
6541 which fixes the -warnaserror command line option.
6543 2003-11-21 Miguel de Icaza <miguel@ximian.com>
6545 * cfold.cs (DoNumericPromotions): During constant folding of
6546 additions on UIntConstant, special case intconstants with
6547 IntConstants like we do on the expression binary operator.
6549 2003-11-12 Miguel de Icaza <miguel@ximian.com>
6551 * convert.cs (ImplicitReferenceConversion): We were missing a case
6552 (System.Enum are not value types or class types, so we need to
6553 classify them separatedly).
6555 * driver.cs: We do not support error 2007.
6557 2003-11-12 Jackson Harper <jackson@ximian.com>
6559 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
6560 system directory. Also use the full file name so users can
6561 libraries names mscorlib-o-tron.dll in a non system dir.
6563 2004-01-04 David Sheldon <dave-mono@earth.li>
6565 * expression.cs: Added matching ")" to error message for CS0077.
6567 2003-12-19 Martin Baulig <martin@ximian.com>
6569 * typemanager.cs (TypeManager.IsEqualGenericType): New public
6570 static method; see documentation in the method.
6571 (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
6573 * convert.cs (Convert.ImplicitReferenceConversion,
6574 Convert.ImplicitReferenceConversionExists): Add support for
6575 generic type declarations; see gen-36.cs.
6577 2003-12-19 Martin Baulig <martin@ximian.com>
6579 * pending.cs (Pending.InterfaceMethod): Use
6580 `Type.IsAssignableFrom()' instead of `=='.
6582 2003-12-18 Martin Baulig <martin@ximian.com>
6584 * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
6587 * convert.cs (Convert.ImplicitStandardConversionExists): Use
6588 `expr_type.Equals (target_type)' instead of `=='.
6590 2003-12-08 Martin Baulig <martin@ximian.com>
6592 * generics.cs (Constraints.Types): Removed.
6593 (Constraints.Resolve): Just resolve everything to TypeExpr's, not
6595 (Constraints.ResolveTypes): New public method; resolves the
6596 TypeExpr's to Type's.
6597 (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
6598 longer takes the constraints.
6599 (TypeParameter.DefineMethod): Likewise.
6600 (TypeParameter.DefineType): New public method. Calls
6601 `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
6604 2003-12-08 Martin Baulig <martin@ximian.com>
6606 * convert.cs (Convert.ImplicitConversionStandard): Use
6607 `expr_type.Equals (target_type)' instead of `=='.
6609 2003-12-08 Martin Baulig <martin@ximian.com>
6611 * typemanager.cs (TypeManager.GetReferenceType): Call
6612 `Type.MakeByRefType ()'.
6614 2003-12-08 Martin Baulig <martin@ximian.com>
6616 * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
6617 just has some special meaning in some situations. For instance,
6618 it is allowed to use `where' as the name of a variable etc.
6620 2003-12-04 Martin Baulig <martin@ximian.com>
6622 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
6623 `Type.MakeArrayType()' for array types.
6625 2003-11-18 Miguel de Icaza <miguel@ximian.com>
6627 * expression.cs (Invocation.VerifyArgumentsCompat): Remove
6630 (SizeOf.DoResolve): assign the `type_queried' field. This gets
6633 2003-11-16 Martin Baulig <martin@ximian.com>
6635 * codegen.cs (EmitContext.IsGeneric): Removed.
6637 * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
6638 ResolveGeneric() on the DeclSpace.
6640 2003-11-16 Martin Baulig <martin@ximian.com>
6642 * generic.cs (TypeArguments.Resolve):
6643 `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
6644 `ResolveType()' on it to get the Type.
6646 2003-11-15 Martin Baulig <martin@ximian.com>
6648 * generic.cs (ConstructedType.GetInterfaces): Override this.
6650 2003-11-14 Martin Baulig <martin@ximian.com>
6652 * interface.cs (Interface.DefineType): Define all type parameters
6653 before adding the interfaces we inherit.
6655 2003-11-11 Martin Baulig <martin@ximian.com>
6657 * generic.cs (ConstructedType.ResolveType): Always call
6658 `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
6660 2003-11-10 Martin Baulig <martin@ximian.com>
6662 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
6663 (TypeManager.InitCoreTypes): Initialize them here, but instead of
6664 calling `ResolveType()' on them, directly assign their `Type'.
6666 2003-11-08 Martin Baulig <martin@ximian.com>
6668 * generic.cs (ConstructedType): Override `IsClass' etc.
6670 2003-11-08 Martin Baulig <martin@ximian.com>
6672 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
6673 return value and the `out parent' parameter.
6674 (TypeContainer.DefineType): Moved the CS0644 check into
6675 GetClassBases(). Don't pass the interface types to the
6676 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
6677 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
6679 * ecore.cs (TypeExpr.IsAttribute): New property.
6680 (TypeExpr.GetInterfaces): New method.
6682 * interface.cs (Interface.GetInterfaceTypeByName): Return a
6683 TypeExpr instead of a Type.
6684 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
6685 (Interface.DefineType): Don't pass the interface types to the
6686 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
6687 them later and then call `TypeBulider.AddInterfaceImplementation()'.
6689 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
6690 instead of a `Type[]'.
6691 (TypeManager.RegisterBuilder): Likewise.
6692 (TypeManager.AddUserInterface): Likewise.
6693 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
6694 `Type[]' and also return a `TypeExpr[]'.
6695 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
6697 2003-11-08 Martin Baulig <martin@ximian.com>
6699 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
6702 2003-11-08 Martin Baulig <martin@ximian.com>
6704 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
6705 TypeManager.ResolveExpressionTypes().
6707 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
6708 instead of an Expression.
6709 (TypeExpr): This is now an abstract base class for `TypeExpression'.
6710 (TypeExpression): New public class; formerly known as `TypeExpr'.
6712 * expression.cs (ComposedCast): Derive from TypeExpr.
6714 * typemanager.cs (TypeManager.system_*_expr): These are now
6715 TypExpr's instead of Expression's.
6716 (TypeManager.ResolveExpressionTypes): New public static function;
6717 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
6720 2003-11-06 Miguel de Icaza <miguel@ximian.com>
6722 * expression.cs (New.DoResolve): Do not dereference value that
6723 might be a null return.
6725 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
6726 sure that the constant value has the right type. Fixes an
6727 unreported bug, similar to 50425.
6729 * const.cs (Const.LookupConstantValue): Call
6730 ImplicitStandardConversionExists before doing a conversion to
6731 avoid havng the TypeManager.ChangeType do conversions.
6733 Reduced the number of casts used
6735 (Const.ChangeType): New routine to enable reuse of the constant
6736 type changing code from statement.
6738 * typemanager.cs (ChangeType): Move common initialization to
6739 static global variables.
6743 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
6744 every value type to go through, even if it was void. Fix that.
6746 * cs-tokenizer.cs: Use is_identifier_start_character on the start
6747 character of the define, and the is_identifier_part_character for
6748 the rest of the string.
6750 2003-11-05 Miguel de Icaza <miguel@ximian.com>
6752 * expression.cs (UnaryMutator.EmitCode): When I updated
6753 LocalVariableReference.DoResolve, I overdid it, and dropped an
6754 optimization done on local variable references.
6756 2003-11-04 Miguel de Icaza <miguel@ximian.com>
6758 * ecore.cs: Convert the return from Ldlen into an int.
6760 2003-10-20 Miguel de Icaza <miguel@ximian.com>
6762 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
6763 the accessibility, this is a special case for toplevel non-public
6764 classes (internal for instance).
6766 2003-10-20 Nick Drochak <ndrochak@gol.com>
6768 * ecore.cs: Fix typo and build. Needed another right paren.
6770 2003-10-19 Miguel de Icaza <miguel@ximian.com>
6772 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
6773 `internal' case regular and protected, but not allowing protected
6774 to be evaluated later. Bug 49840
6776 2003-10-15 Miguel de Icaza <miguel@ximian.com>
6778 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
6779 to kb.Nlast, and not the kb.nFirst to isolate the switch
6782 Extract the underlying type, so enumerations of long/ulong are
6783 treated like long/ulong.
6785 2003-10-14 Miguel de Icaza <miguel@ximian.com>
6787 * expression.cs (New): Overload the meaning of RequestedType to
6788 track the possible creation of the NewDelegate type, since
6789 DoResolve is invoked more than once for new constructors on field
6792 See bugs: #48800 and #37014
6794 * cs-parser.jay (declare_local_constants): Take an arraylist
6795 instead of a single constant.
6797 (local_constant_declaration): It should take a
6798 constant_declarators, not a constant_declarator. Fixes 49487
6800 * convert.cs: Fix error report.
6802 2003-10-13 Jackson Harper <jackson@ximian.com>
6804 * typemanager.cs (TypeToCoreType): Add float and double this fixes
6807 2003-11-03 Martin Baulig <martin@ximian.com>
6809 * expression.cs (ArrayAccess.GetStoreOpcode): Added
6810 `out bool has_type_arg'; if set, we need to pass the type to
6812 (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
6813 Stelem_Any/Ldelem_Any for generic parameters.
6815 2003-11-02 Martin Baulig <martin@ximian.com>
6817 * expression.cs (Invocation.EmitCall): Use
6818 `TypeManager.IsValueType()' to check whether it's a value type.
6819 Don't set `struct_call' when calling a method on a type parameter.
6821 2003-11-02 Martin Baulig <martin@ximian.com>
6823 * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
6824 and removed the TypeBuilder argument.
6826 * typemanager.cs (TypeManager.IsValueType): Return
6827 `t.IsGenericParameter || t.IsValueType'.
6829 2003-10-25 Martin Baulig <martin@ximian.com>
6831 * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
6832 call ConstructedType.Resolve() on it.
6834 * generic.cs (ConstructedType.Resolve): Set `type' on success.
6836 2003-10-25 Martin Baulig <martin@ximian.com>
6838 * class.cs (TypeContainer.GetClassBases): Changed
6839 `out Type parent' into `out TypeExpr parent'. Moved CS0644 and
6840 CS8214 reporting here.
6841 (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
6842 instead of a `Type' for our parent. In case of a recursive
6843 declaration (see tests/gen-23.cs for an example), our parent is a
6844 ConstructedType and it doesn't have its type set. So, first
6845 create our own TypeBuilder, then call constructed.Resolve() to get
6846 the parent's type and finally TypeBuilder.SetParent() it.
6848 * ecore.cs (TypeExpr.Name): New public virtual property.
6851 (ConstructedType): We're now a TypeExpr and not just an Expression.
6852 (ConstructedType.ResolveAsTypeStep): Don't resolve our type
6853 arguments here; this is done later.
6854 (ConstructedType.Resolve): New public method to resolve the type
6855 arguments and bind them.
6857 2003-10-21 Martin Baulig <martin@ximian.com>
6859 * convert.cs: Use `TypeManager.IsValueType' instead of
6860 'type.IsValueType' everywhere.
6862 * typemanager.cs (TypeManager.IsValueType): Return true for type
6863 parameters. The reason for this is that we need to box a type
6864 parameter when converting it to a reference type.
6866 * cs-parser.jay: Added support for default value expressions.
6868 * generics.cs (DefaultValueExpression): New public class.
6870 2003-10-17 Martin Baulig <martin@ximian.com>
6872 * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
6873 TypeContainer so we can also use this for Interfaces.
6874 (TypeParameter.Resolve): Likewise.
6876 * interface.cs (Interface.DefineType): Added support for generic
6879 * cs-parser.jay: Added support for generic structs and interfaces.
6881 2003-10-17 Martin Baulig <martin@ximian.com>
6883 * generic.cs (GenericMemberAccess.DoResolve): We can now actually
6884 call generic methods :-)
6886 2003-10-16 Martin Baulig <martin@ximian.com>
6888 * cs-parser.jay (namespace_or_type_name): Only create a
6889 GenericMemberAccess if we actually have type arguments.
6891 2003-10-13 Martin Baulig <martin@ximian.com>
6893 * class.cs (Method.Define): If we're a generic method, call
6894 TypeBuilder.DefineGenericMethod () before resolving
6896 (MethodData): Added .ctor which takes an additional MethodBuilder
6897 argument; this is used for generic methods.
6898 (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
6899 we already have a MethodBuilder.
6901 2003-10-10 Martin Baulig <martin@ximian.com>
6903 * class.cs (Method): Added .ctor which takes a `GenericMethod'
6904 instead of a `DeclSpace'. This is used for generic methods.
6906 * cs-parser.jay (method_header): Added support for generic
6907 methods; create a `GenericMethod' instance and pass it to the
6908 `Method's .ctor; it'll be used as the `DeclSpace' to lookup
6909 parameters and locals.
6911 * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
6912 since we already have the location. Check whether we're a generic
6913 type declaration or a generic method and create the correct type
6916 * generic.cs (TypeParameter.DefineMethod): New public method.
6917 (GenericMethod): New public class; derives from DeclSpace and is
6918 used for generic methods.
6920 2003-10-09 Martin Baulig <martin@ximian.com>
6922 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
6924 (MethodCore.DoDefineParameters): Removed the TypeContainer
6925 argument; use the DeclSpace which was passed to the .ctor instead.
6926 (MethodCore.CheckParameter): Take a DeclSpace instead of a
6927 TypeContainer; we only need a DeclSpace here.
6929 2003-10-09 Martin Baulig <martin@ximian.com>
6931 * class.cs (MethodData): Added additional `DeclSpace ds' argument
6933 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
6934 EmitContext's .ctor.
6936 2003-10-09 Martin Baulig <martin@ximian.com>
6938 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
6939 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
6940 AsAccessible(), moved them as well.
6942 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
6944 2003-10-07 Miguel de Icaza <miguel@ximian.com>
6946 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
6947 generation for >=, as spotted by Paolo, bug 48679.
6948 Patch from David Waite.
6950 * cs-tokenizer.cs: Add handling for #pragma.
6952 * cs-parser.jay: Allow for both yield and yield return in the
6953 syntax. The anti-cobolization of C# fight will go on!
6955 * class.cs (TypeBuilder.DefineType): Catch error condition here
6956 (Parent.DefineType erroring out and returning null).
6958 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
6959 coping with enumerations variables, we were mistakenly processing
6960 them as a regular value type instead of built-in types. Fixes the
6963 * typemanager.cs (IsBuiltinOrEnum): New method.
6965 2003-09-30 Miguel de Icaza <miguel@ximian.com>
6967 * cs-parser.jay: Upgrade: yield now needs the return clause.
6969 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
6971 * cs-parser.jay : Renamed yyName to yyNames related to jay.
6973 2003-09-29 Martin Baulig <martin@ximian.com>
6975 * typemanager.cs (TypeManager.GetMethodFlags): Added support for
6976 inflated generic methods.
6978 * generics.cs (ConstructedType): Distinguish between open and
6979 closed constructed types; correctly resolve the arguments.
6981 2003-09-22 Martin Baulig <martin@ximian.com>
6983 * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
6984 all type arguments meet their constraints.
6986 2003-09-19 Martin Baulig <martin@ximian.com>
6988 * decl.cs (MemberCache.SetupCacheForInterface): Take a
6989 `MemberCache parent' argument. Normally, an interface doesn't
6990 have a parent type except System.Object, but we use this in gmcs
6991 for generic type parameters.
6993 2003-09-18 Martin Baulig <martin@ximian.com>
6995 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
6996 on `type.IsInterface'; don't check whether the type has a parent
6997 to determine whether it's an interface.
6999 2003-09-17 Martin Baulig <martin@ximian.com>
7001 * generic.cs (ConstructedType.ToString): Always use `name' as the
7004 2003-09-15 Martin Baulig <martin@ximian.com>
7006 * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
7008 * generic.cs (Constraints.Resolve): New public method; this is
7009 called to resolve the constraint types and to check whether all
7010 the constraints are correct.
7011 (Constraints.Types): New public property.
7012 (TypeParameter.Resolve): New public method; resolves all the
7015 * class.cs (TypeContainer.DefineType): Call
7016 TypeParameter.Resolve() before actually defining the type.
7018 2003-09-15 Martin Baulig <martin@ximian.com>
7020 * class.cs (TypeContainer.DefineType): Added an error flag to
7021 avoid reporting duplicate CS0146's ("class definition is
7024 * driver.cs (Driver.MainDriver): Abort if
7025 RootContext.ResolveTree() reported any errors.
7027 2003-09-07 Martin Baulig <martin@ximian.com>
7029 * report.cs (Error, Warning): Added overloaded versions which take
7030 a `params object[] args' and call String.Format().
7032 2003-09-07 Martin Baulig <martin@ximian.com>
7034 * decl.cs (DeclSpace..ctor): Don't call
7035 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
7036 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
7037 (DeclSpace.RecordDecl): New method.
7039 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
7041 2003-09-02 Ravi Pratap <ravi@ximian.com>
7043 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
7044 value attributes to be applied to ParameterBuilders.
7046 * class.cs (MethodCore.LabelParameters): Make static and more
7047 generic so that it can be used from other places - like interface
7048 methods, for instance.
7050 * interface.cs (Interface.Emit): Call LabelParameters before
7051 emitting attributes on the InterfaceMethod.
7053 2003-09-07 Martin Baulig <martin@ximian.com>
7055 * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
7056 if the number of type parameters doesn't match.
7058 2003-09-04 Martin Baulig <martin@ximian.com>
7060 * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
7061 for arrays of generic type params (ie. `!0[]').
7063 2003-09-04 Martin Baulig <martin@ximian.com>
7065 * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
7068 2003-09-04 Martin Baulig <martin@ximian.com>
7070 * decl.cs (DeclSpace.LookupGeneric): New method.
7071 (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
7074 * generic.cs (TypeParameterExpr): Take a TypeParameter as
7075 argument, not just a string.
7076 (TypeParameter.Define): New public method; this is called to
7077 actually define the generic parameter; after this, you can use the
7078 new `Type' property to get the type.
7080 2003-09-04 Martin Baulig <martin@ximian.com>
7082 * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
7083 is now an ArrayList; initialize the result of the `TypeParameters'
7085 (DeclSpace.GetGenericData): Removed.
7086 (DeclSpace.LookupGeneric): Temporarily removed; we need to
7087 implement this in a different way.
7088 (DeclSpace.GetTypeParameters): Removed; there's now a
7089 `TypeParameters' property.
7090 (DeclSpace.TypeParameters): New public property.
7092 * generic.cs (Constraints): Make this class public.
7093 (TypeParameter): New public class.
7095 2003-09-04 Martin Baulig <martin@ximian.com>
7097 * decl.cs (DeclSpace.GetTypeParameters): New method to return the
7100 * class.cs (TypeContainer.DefineType): Call
7101 TypeBuilder.DefineGenericParameter () on all generic parameters if
7102 this is a generic type.
7104 2003-08-28 Martin Baulig <martin@ximian.com>
7106 * sample-stack.il: Compile this with ilasm: "ilasm /dll
7109 * sample-hello.cs: Compile this with gmcs: "gmcs
7110 /r:sample-stack.dll sample-hello.cs".
7112 2003-08-28 Martin Baulig <martin@ximian.com>
7114 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
7115 the parameters to the generic type.
7117 2003-08-28 Martin Baulig <martin@ximian.com>
7119 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
7121 2003-08-28 Martin Baulig <martin@ximian.com>
7123 * cs-parser.jay (opt_type_argument_list): Use
7124 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
7125 (primary_expression): Replace `qualified_identifier' with `type_name'.
7126 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
7128 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
7129 parser to check whether it is syntactically a type parameter list;
7130 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
7133 2003-08-26 Martin Baulig <martin@ximian.com>
7135 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
7136 resolving aliases; fixes #47927.
7138 2003-08-26 Martin Baulig <martin@ximian.com>
7140 * statement.cs (Using.DoResolve): This is internally emitting a
7141 try/finally clause, so we need to set ec.NeedExplicitReturn if we
7142 do not always return. Fixes #47681.
7144 2003-08-26 Martin Baulig <martin@ximian.com>
7146 * decl.cs (MemberCore): Moved WarningNotHiding(),
7147 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
7149 (AdditionResult): Make this nested in DeclSpace.
7150 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
7151 argument; call NamespaceEntry.Define() unless we're nested in a
7154 * namespace.cs (Namespace.DefineName): New public function. This
7155 is called from DeclSpace's .ctor to add
7156 (Namespace.Lookup): Include DeclSpaces in the lookup.
7158 * class.cs (Operator): Derive from MemberBase, not MemberCore.
7160 * const.cs (Const): Derive from MemberBase, not MemberCore.
7162 2003-08-25 Martin Baulig <martin@ximian.com>
7164 * convert.cs (Convert.ExplicitReferenceConversion): When
7165 converting from an interface type to a class, unbox if the target
7166 type is a struct type. Fixes #47822.
7168 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7170 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
7173 2003-08-22 Martin Baulig <martin@ximian.com>
7175 * class.cs (TypeManager.DefineType): When defining a nested type,
7176 call DefineType() on our parent; fixes #47801.
7178 2003-08-22 Martin Baulig <martin@ximian.com>
7180 * class.cs (MethodData.Define): While checking if a method is an
7181 interface implementation, improve the test a bit more to fix #47654.
7183 2003-08-22 Martin Baulig <martin@ximian.com>
7185 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
7186 correctly; fixes #47722.
7188 2003-08-22 Martin Baulig <martin@ximian.com>
7190 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
7191 LocalVariableReference, ensure it's not read-only. Fixes #47536.
7193 * statement.cs (Fixed.DoResolve): Make all variables read-only.
7195 2003-08-22 Martin Baulig <martin@ximian.com>
7197 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
7198 can only be assigned in static constructors. Fixes #47161.
7200 2003-08-22 Martin Baulig <martin@ximian.com>
7202 Rewrote and improved the flow analysis code.
7204 * flowbranching.cs (FlowBranching): Make this class abstract.
7205 (FlowBranching.CreateBranching): New static function to create a
7207 (FlowBranchingBlock, FlowBranchingException): New classes.
7208 (FlowBranching.UsageVector.Type): New public readonly field.
7209 (FlowBranching.UsageVector.Breaks): Removed the setter.
7210 (FlowBranching.UsageVector.Returns): Removed the setter.
7211 (FlowBranching.UsageVector): Added Break(), Return(),
7212 NeverReachable() and Throw() methods to modify the reachability.
7213 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
7214 done by FlowBranching.Merge().
7215 (FlowBranching.UsageVector.MergeChild): New method; merges the
7216 merge result into the current vector.
7217 (FlowBranching.Merge): New abstract method to merge a branching.
7219 2003-08-12 Martin Baulig <martin@ximian.com>
7221 * expression.cs (Indirection.CacheTemporaries): Create the
7222 LocalTemporary with the pointer type, not its element type.
7224 2003-08-10 Miguel de Icaza <miguel@ximian.com>
7226 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
7227 token was a keyword or not.
7229 Add `error' options where an IDENTIFIER was expected; Provide
7230 CheckToken and CheckIdentifierToken convenience error reporting
7233 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
7235 * decl.cs: Rename `NamespaceEntry Namespace' public field into
7236 NameSpaceEntry NameSpaceEntry.
7238 (LookupInterfaceOrClass): Avoid creating a full qualified name
7239 from namespace and name: avoid doing lookups when we know the
7240 namespace is non-existant. Use new Tree.LookupByNamespace which
7241 looks up DeclSpaces based on their namespace, name pair.
7243 * driver.cs: Provide a new `parser verbose' to display the
7244 exception thrown during parsing. This is turned off by default
7245 now, so the output of a failure from mcs is more graceful.
7247 * namespace.cs: Track all the namespaces defined in a hashtable
7250 (IsNamespace): New method
7252 2003-08-09 Miguel de Icaza <miguel@ximian.com>
7254 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
7255 we know that we need to concatenate (full typename can never be
7260 * statement.cs: Use a bitfield; Do not initialize to null things
7261 which are done by the constructor by default.
7263 * cs-parser.jay: bug fix, parameter was 4, not 3.
7265 * expression.cs: Just use the property;
7267 * statement.cs: No need for GetVariableInfo method.
7269 2003-08-08 Martin Baulig <martin@ximian.com>
7271 * flowanalysis.cs (FlowReturns): This is now nested in the
7272 `FlowBranching' class.
7273 (MyBitVector): Moved this here from statement.cs.
7274 (FlowBranching.SiblingType): New enum type.
7275 (FlowBranching.CreateSibling): Added `SiblingType' argument.
7277 2003-08-07 Martin Baulig <martin@ximian.com>
7279 * flowanalysis.cs (FlowBranchingType): This is now nested in the
7280 `FlowBranching' class and called `BranchingType'.
7282 2003-08-07 Martin Baulig <martin@ximian.com>
7284 * flowanalysis.cs: Moved all the control flow analysis code into
7287 2003-08-07 Martin Baulig <martin@ximian.com>
7289 * assign.cs (Assign.DoResolve): `target' must either be an
7290 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
7293 2003-08-07 Miguel de Icaza <miguel@ximian.com>
7295 * expression.cs (BinaryMethod): This kind of expression is created by the
7296 Binary class if it determines that the operator has to be handled
7299 (BinaryDelegate): This kind of expression is created if we are
7300 dealing with a + or - operator on delegates.
7302 (Binary): remove method, argumetns, and DelegateOperator: when
7303 dealing with methods,
7305 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
7307 * statement.cs (Block): use bitfields for the three extra booleans
7308 we had in use. Remove unused topblock parameter.
7310 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
7312 * assign.cs: Drop extra unneeded tests.
7314 2003-08-06 Miguel de Icaza <miguel@ximian.com>
7316 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
7318 * statement.cs (Foreach): Use VariableStorage instead of
7321 * codegen.cs (VariableStorage): New class used by clients that
7322 require a variable stored: locals or fields for variables that
7323 need to live across yield.
7325 Maybe provide a convenience api for EmitThis+EmitLoad?
7327 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
7330 2003-08-05 Miguel de Icaza <miguel@ximian.com>
7332 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
7333 RemapParameterLValue): New methods that are used to turn a
7334 precomputed FieldInfo into an expression like this:
7338 The idea is to use this instead of making LocalVariableReference
7339 have more than one meaning.
7341 * cs-parser.jay: Add error production to BASE.
7343 * ecore.cs: Deal with TypeManager.GetField returning null, which
7344 is now a valid return value.
7346 (FieldExprNoAddress): New expression for Fields whose address can
7349 * expression.cs (LocalVariableReference): During the resolve
7350 phases, create new expressions if we are in a remapping context.
7351 Remove code that dealt with remapping here.
7353 (ParameterReference): same.
7355 (ProxyInstance): New expression, like the `This' expression, but
7356 it is born fully resolved. We know what we are doing, so remove
7357 the errors that are targeted to user-provided uses of `this'.
7359 * statement.cs (Foreach): our variable is now stored as an
7360 Expression; During resolution, follow the protocol, dont just
7361 assume it will return this.
7363 2003-08-06 Martin Baulig <martin@ximian.com>
7365 * support.cs (SeekableStreamReader.cs): New public class.
7367 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
7368 SeekableStreamReader instead of the normal StreamReader.
7370 2003-08-04 Martin Baulig <martin@ximian.com>
7372 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
7373 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
7374 deambiguate casts and delegate invocations.
7375 (parenthesized_expression): Use the new tokens to ensure this is
7376 not a cast of method invocation.
7378 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
7379 when reading a `)' and Deambiguate_CloseParens () was previously
7382 * expression.cs (ParenthesizedExpression): New class. This is
7383 just used for the CS0075 test.
7384 (Binary.DoResolve): Check for CS0075.
7386 2003-07-29 Ravi Pratap <ravi@ximian.com>
7388 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
7389 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
7390 reference comparison.
7392 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
7393 examine the ReturnType for equality - this is necessary in the
7394 cases of implicit and explicit operators whose signature also
7395 includes the return type.
7397 2003-07-26 Miguel de Icaza <miguel@ximian.com>
7399 * namespace.cs: Cache the result of the namespace computation,
7400 instead of computing it every time.
7402 2003-07-24 Miguel de Icaza <miguel@ximian.com>
7404 * decl.cs: Use a global arraylist that we reuse over invocations
7405 to avoid excesive memory consumption. Reduces memory usage on an
7406 mcs compile by one meg (45 average).
7408 * typemanager.cs (LookupTypeReflection): In .NET pointers are
7409 private, work around that.
7411 2003-07-23 Miguel de Icaza <miguel@ximian.com>
7413 * literal.cs (IntLiteral): Define Zero and One static literals.
7415 * cs-parser.jay (integer_literal): use static literals to reduce
7416 memory usage for the most used literals (0, 1 and -1). 211kb
7417 reduced in memory usage.
7419 Replace all calls to `new ArrayList' with `new
7420 ArrayList(4)' which is a good average number for most allocations,
7421 and also requires only 16 bytes of memory for its buffer by
7424 This reduced MCS memory usage in seven megabytes for the RSS after
7427 2003-07-28 Ravi Pratap <ravi@ximian.com>
7429 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
7430 handle params methods the correct way by forming only one
7431 applicable set with params and normal methods in them. Earlier we
7432 were looking at params methods only if we found no normal methods
7433 which was not the correct thing to do.
7435 (Invocation.BetterFunction): Take separate arguments indicating
7436 when candidate and the best method are params methods in their
7439 This fixes bugs #43367 and #46199.
7441 * attribute.cs: Documentation updates.
7443 (CheckAttribute): Rename to CheckAttributeTarget.
7444 (GetValidPlaces): Rename to GetValidTargets.
7446 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
7447 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
7451 2003-07-28 Miguel de Icaza <miguel@ximian.com>
7453 * codegen.cs: Compute IsGeneric correctly.
7455 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
7458 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
7459 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
7460 regressions, and I was chasing more bugs than I required.
7462 * interface.cs: Use expressions for base type names (like classes
7463 and structs have been doing for a while now), and resolve that.
7464 This patch should probably go into head as well.
7466 This makes it one less user of FindType.
7468 2003-07-24 Miguel de Icaza <miguel@ximian.com>
7470 This compiler can not self host currently. Need to fix that.
7472 * Makefile: compile to `gmcs.exe'
7474 * driver.cs: Turn on v2 by default on gmcs.
7476 * generic.cs (ConstructedType): Does no longer take a container
7477 type argument; That will be taken care of later.
7479 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
7480 Use SimpleName to resolve for now, so we can continue the work on
7481 the parser, until we get Type.GetType that understands generics.
7483 (ConstructedType.ToString): Implement
7485 (TypeArguments.Resolve): Resolve the child expressions as types.
7487 * cs-parser.jay: Rename interface_constraints to
7488 type_parameter_constraints
7490 (namespace_or_type_name): Only use constructed types for the basic
7491 construction, we will deal with identifier<...> later.
7493 (type/type_name): No longer call DecomposeQI, as
7494 namespace_or_type_name is always decoded now.
7496 2003-07-22 Ravi Pratap <ravi@ximian.com>
7498 * expression.cs (Invocation.OverloadResolve): Follow the spec more
7499 closely: we eliminate methods in base types when we have an
7500 applicable method in a top-level type.
7502 Please see section 14.5.5.1 for an exact description of what goes
7505 This fixes bug #45127 and a host of other related to corlib compilation.
7507 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
7508 array is the method corresponding to the top-level type (this is
7509 because of the changes made to icall.c) so we change this
7512 (MethodGroupExpr.Name): This too.
7514 * typemanager.cs (GetElementType): New method which does the right
7515 thing when compiling corlib.
7517 * everywhere: Make use of the above in the relevant places.
7519 2003-07-22 Martin Baulig <martin@ximian.com>
7521 * cs-parser.jay (invocation_expression): Moved
7522 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
7523 `cast_expression', but create a InvocationOrCast which later
7524 resolves to either an Invocation or a Cast.
7526 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
7527 method; call this before EmitStatement() to make sure that this
7528 expression can be used as a statement.
7530 * expression.cs (InvocationOrCast): New class; resolves to either
7531 an Invocation or a Cast.
7533 * statement.cs (StatementExpression): Call ResolveStatement() on
7534 the ExpressionStatement before emitting it.
7536 2003-07-21 Martin Baulig <martin@ximian.com>
7538 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
7539 `ref' and `out' attributes match; fixes #46220.
7540 (MemberAccess.ResolveMemberAccess): You can't reference a type
7541 through an expression; fixes #33180.
7542 (Indexers.GetIndexersForType): Don't return the indexers from
7543 interfaces the class implements; fixes #46502.
7545 2003-07-21 Martin Baulig <martin@ximian.com>
7547 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
7548 CS0661 checks; fixes bug #30442.
7550 2003-07-21 Martin Baulig <martin@ximian.com>
7552 * decl.cs (AdditionResult): Added `Error'.
7554 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
7556 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
7557 cs0031.cs actually work.
7559 2003-07-20 Miguel de Icaza <miguel@ximian.com>
7561 * cs-parser.jay (namespace_name): do not use
7562 namespace_or_type_name, use qualified_identifier, because
7563 namespace_or_type_name will soon return a composed expression
7564 instead of a string.
7566 (namespace_or_type_name): Instead of returning a string, now this
7567 production returns an expression.
7569 * codegen.cs (EmitContext): Setup IsGeneric property based on
7570 whether our DeclSpace is generic, our the method is generic.
7572 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
7573 the method is generic.
7575 * cs-parser.jay (type_arguments, opt_type_argument_list,
7576 type_parameters, type_parameter_list, opt_type_parameter_list,
7577 type_parameter,, opt_type_parameter_constraints_clauses,
7578 type_parameter_constraints_clauses,
7579 type_parameter_constraint_clause, type_parameter_constraint,
7580 interface_constraints): Add new production
7582 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
7583 DeclSpace is generic or not.
7585 (DeclSpace.SetParameterInfo): New routine, used to set the
7586 parameter info for a type.
7588 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
7589 returns a GenericTypeExpr
7591 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
7592 generic, lookup the generic argument.
7594 * attribute.cs: Do not allow TypeParameterExpressions in
7597 * class.cs: Do not allow the Main method to be defined in a
7600 * expression.cs (SizeOf): Do not allow generic types to be used as
7601 arguments to sizeof.
7603 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
7604 it: whether a type is generic or not. Only works for types we are
7605 currently building for now.
7607 2003-07-20 Martin Baulig <martin@ximian.com>
7609 * namespace.cs: Fixed that bug which caused a crash when compiling
7612 2003-07-20 Miguel de Icaza <miguel@ximian.com>
7614 * typemanager.cs (LookupTypeReflection): Never expose types which
7615 are NotPublic, NestedPrivate, NestedAssembly, or
7616 NestedFamANDAssem. We used to return these, and later do a check
7617 that would report a meaningful error, but the problem is that we
7618 would not get the real match, if there was a name override.
7620 2003-07-18 Miguel de Icaza <miguel@ximian.com>
7622 * namespace.cs (Namespace, Name): Do not compute the namespace
7623 name dynamically, compute it in the constructor. This reduced
7624 memory usage by 1697 KB.
7626 * driver.cs: Use --pause to pause at the end.
7628 2003-07-17 Peter Williams <peter@newton.cx>
7630 * Makefile: Change the name of the test target so that it doesn't
7631 conflict with the recursive test target.
7633 2003-07-17 Miguel de Icaza <miguel@ximian.com>
7635 * expression.cs (LocalVariableReference.Emit, EmitAssign,
7636 AddressOf): Do not use EmitThis, that was wrong, use the actual
7639 2003-07-15 Miguel de Icaza <miguel@ximian.com>
7641 * class.cs (MethodData.Define): While checking if a method is an
7642 interface implementation, improve the test: If we are not public
7643 (use new test here: use the computed MethodAttributes directly,
7644 instead of the parsed modifier flags) check if the `implementing'
7645 method comes from an interface or not.
7647 * pending.cs (VerifyPendingMethods): Slightly better error
7650 * makefile: add test target that does the mcs bootstrap.
7652 2003-07-16 Ravi Pratap <ravi@ximian.com>
7654 * interface.cs (Define): Do nothing here since there are no
7655 members to populate etc. Move the attribute emission out of here
7656 since this was just totally the wrong place to put it. Attribute
7657 application happens during the 'Emit' phase, not in the 'Define'
7660 (Emit): Add this method and move the attribute emission here
7662 * rootcontext.cs (EmitCode): Call the Emit method on interface
7665 2003-07-14 Ravi Pratap M <ravi@ximian.com>
7667 * expression.cs (OverloadResolve): Report error only if Location
7668 is not 'Null' which means that there was a probe going on.
7670 2003-07-14 Martin Baulig <martin@ximian.com>
7672 * expression.cs (ConditionalLogicalOperator): New public class to
7673 implement user defined conditional logical operators.
7674 This is section 14.11.2 in the spec and bug #40505.
7676 2003-07-14 Martin Baulig <martin@ximian.com>
7678 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
7680 2003-07-14 Martin Baulig <martin@ximian.com>
7682 * codegen.cs (EmitContext.InFixedInitializer): New public field.
7684 * ecore.cs (IVariable.VerifyFixed): New interface method.
7686 * expression.cs (Unary.ResolveOperator): When resolving the `&'
7687 operator, check whether the variable is actually fixed. Fixes bug
7688 #36055. Set a variable definitely assigned when taking its
7689 address as required by the spec.
7691 * statement.cs (LocalInfo.IsFixed): New field.
7692 (LocalInfo.MakePinned): Set `IsFixed' to true.
7694 2003-07-14 Ravi Pratap M <ravi@ximian.com>
7696 * attribute.cs (Attribute.Resolve): While doing a Member lookup
7697 for .ctors, ensure that we only ask for members declared in the
7698 attribute type (BindingFlags.DeclaredOnly).
7702 * expression.cs (Error_WrongNumArguments): Report error 1501
7703 correctly the way CSC does.
7705 2003-07-13 Martin Baulig <martin@ximian.com>
7707 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
7708 lookup on the fully qualified name, to make things like "X.X" work
7709 where "X.X" is a fully qualified type name, but we also have a
7710 namespace "X" in the using list. Fixes #41975.
7712 2003-07-13 Martin Baulig <martin@ximian.com>
7714 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
7715 function. If we're a CompoundAssign, we need to create an embedded
7716 CompoundAssign, not an embedded Assign.
7717 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
7720 2003-07-13 Martin Baulig <martin@ximian.com>
7722 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
7723 work to fix bug #46088.
7725 2003-07-13 Ravi Pratap <ravi@ximian.com>
7727 * class.cs (Operator.Emit): Do not emit attributes here - it is
7728 taken care of by the Method class that we delegate too. This takes
7731 2003-07-10 Martin Baulig <martin@ximian.com>
7733 * expression.cs (TypeOfVoid): New class.
7734 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
7736 2003-07-10 Martin Baulig <martin@ximian.com>
7738 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
7741 2003-07-10 Martin Baulig <martin@ximian.com>
7743 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
7744 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
7746 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
7748 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
7750 2003-07-10 Martin Baulig <martin@ximian.com>
7752 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
7753 of decimal. Fixes #42850.
7755 NOTE: I also fixed the created byte blob, but this doesn't work on
7756 the MS runtime and csc never produces any byte blobs for decimal
7759 2003-07-10 Martin Baulig <martin@ximian.com>
7761 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
7762 structs; fixes #32068.
7763 (Block.AddChildVariableNames): Fixed #44302.
7765 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7767 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
7769 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7771 * attribute.cs: And this test is onger needed.
7773 2003-07-08 Martin Baulig <martin@ximian.com>
7775 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
7776 inaccessible types. Fixes #36313.
7778 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
7780 * namespace.cs (NamespaceEntry): Create implicit entries for all
7781 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
7782 implicit entries for N1.N2 and N1.
7784 2003-07-08 Martin Baulig <martin@ximian.com>
7786 Rewrote the handling of namespaces to fix a lot of the issues
7787 wrt. `using' aliases etc.
7789 * namespace.cs (Namespace): Splitted this class into a
7790 per-assembly `Namespace' and a per-file `NamespaceEntry'.
7792 * typemanager.cs (TypeManager.IsNamespace): Removed.
7793 (TypeManager.ComputeNamespaces): Only compute namespaces from
7794 loaded assemblies here, not the namespaces from the assembly we're
7795 currently compiling.
7797 2003-07-08 Martin Baulig <martin@ximian.com>
7799 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
7801 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7803 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
7806 I thought about the memory savings here, but LookupTypeReflection
7807 is used under already very constrained scenarios. Compiling
7808 corlib or mcs only exposes one hit, so it would not really reduce
7809 any memory consumption.
7811 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7813 * typemanager.cs: fixes bug #45889 by only adding public types from
7814 other assemblies to the list of known types.
7816 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7818 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
7819 on the type we resolved.
7821 2003-07-05 Martin Baulig <martin@ximian.com>
7823 * pending.cs (PendingImplementation.ParentImplements): Don't
7824 create the proxy if the parent is abstract.
7826 * class.cs (TypeContainer.DefineIndexers): Process explicit
7827 interface implementations first. Fixes #37714.
7829 2003-07-04 Miguel de Icaza <miguel@ximian.com>
7831 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
7832 defined recursively; but since we modify the input parameters
7833 (left is set to `this' temporarily), we reset this value if the
7834 left_is_explicit is false, which gives the original semantics to
7837 * literal.cs (NullPointer): new class used to represent a null
7838 literal in a pointer context.
7840 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
7841 type is a pointer, use a NullPointer object instead of a
7842 NullLiteral. Closes 43687
7844 (ExplicitConversion): Convert pointer values using
7845 the conv opcode to the proper type.
7847 * ecore.cs (New): change ValueTypeVariable property into a method,
7848 that returns whether the valuetype is suitable for being used.
7850 * expression.cs (Binary.DoNumericPromotions): Only return if we
7851 the int constant was a valid uint, and we can return both left and
7852 right as uints. If not, we continue processing, to trigger the
7853 type conversion. This fixes 39018.
7855 * statement.cs (Block.EmitMeta): During constant resolution, set
7856 the CurrentBlock property on the emitcontext, so that we resolve
7857 constants propertly.
7859 2003-07-02 Martin Baulig <martin@ximian.com>
7861 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
7862 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
7864 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
7865 than emitting it here.
7867 * statement.cs: Fixed some more flow analysis bugs.
7869 2003-07-02 Martin Baulig <martin@ximian.com>
7871 * class.cs (MethodData.Define): When implementing interface
7872 methods, set Final unless we're Virtual.
7874 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
7875 check work for interface methods.
7877 2003-07-01 Martin Baulig <martin@ximian.com>
7879 * ecore.cs (EmitContext.This): Replaced this property with a
7880 GetThis() method which takes a Location argument. This ensures
7881 that we get the correct error location for a CS0188.
7883 2003-07-01 Miguel de Icaza <miguel@ximian.com>
7885 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
7886 ImplicitStandardConversion.
7888 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
7890 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
7892 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
7895 2003-06-30 Miguel de Icaza <miguel@ximian.com>
7897 * class.cs (Constructor.Define): Turn off initlocals for unsafe
7900 (MethodData.Define): Turn off initlocals for unsafe methods.
7902 2003-06-29 Miguel de Icaza <miguel@ximian.com>
7904 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
7905 complete; Fixes #37521.
7907 * delegate.cs: Use Modifiers.TypeAttr to compute the
7908 TypeAttributes, instead of rolling our own. This makes the flags
7909 correct for the delegates.
7911 2003-06-28 Miguel de Icaza <miguel@ximian.com>
7913 * class.cs (Constructor.Define): Set the private flag for static
7914 constructors as well.
7916 * cs-parser.jay (statement_expression): Set the return value to
7917 null, to avoid a crash when we catch an error.
7919 2003-06-24 Miguel de Icaza <miguel@ximian.com>
7921 * cs-parser.jay: Applied patch from Jackson that adds support for
7922 extern and unsafe modifiers to destructor declarations.
7924 * expression.cs: Report error 21 if the user is trying to index a
7927 * driver.cs: Add an error message, suggested by the bug report.
7929 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
7930 if we do not have a ": this ()" constructor initializer. Fixes 45149
7932 2003-06-14 Miguel de Icaza <miguel@ximian.com>
7934 * namespace.cs: Add some information to reduce FAQs.
7936 2003-06-13 Miguel de Icaza <miguel@ximian.com>
7938 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
7939 underlying enumeration types. Fixes #43915.
7941 * expression.cs: Treat ushort/short as legal values to be used in
7944 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
7946 * delegate.cs: transfer custom attributes for paramenters from
7947 the delegate declaration to Invoke and BeginInvoke.
7949 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
7951 * attribute.cs: handle custom marshalers and emit marshal info
7954 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
7956 * makefile.gnu: Added anonymous.cs to the compiler sources.
7958 2003-05-28 Miguel de Icaza <miguel@ximian.com>
7960 * iterators.cs: Change the name of the proxy class to include two
7963 * cs-parser.jay: Update grammar to include anonymous methods.
7965 * anonymous.cs: new file.
7967 2003-05-27 Miguel de Icaza <miguel@ximian.com>
7969 * class.cs (Field.Define): Add missing test for pointers and
7972 2003-05-27 Ravi Pratap <ravi@ximian.com>
7974 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
7975 we use the stobj opcode.
7977 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
7978 since it wasn't the correct fix.
7980 It still is puzzling that we are required to use stobj for IntPtr
7981 which seems to be a ValueType.
7983 2003-05-26 Miguel de Icaza <miguel@ximian.com>
7985 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
7986 during regular simple name resolution. Now, the trick is that
7987 instead of returning for processing the simplename, we do a
7988 TypeManager.LookupType (ie, a rooted lookup as opposed to a
7989 contextual lookup type). If a match is found, return that, if
7990 not, return for further composition.
7992 This fixes long-standing 30485.
7994 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
7995 using the address to initialize an object, do an Stobj instead of
7996 using the regular Stelem.
7998 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
7999 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
8000 Because if we are a BaseIndexerAccess that value will be true.
8003 * statement.cs (GotoCase.Resolve): Return after reporting an
8004 error, do not attempt to continue.
8006 * expression.cs (PointerArithmetic.Emit): If our operand is a
8007 long, convert our constants to match the operand before
8008 multiplying. Convert to I type before adding. Fixes 43670.
8010 2003-05-14 Ravi Pratap <ravi@ximian.com>
8012 * enum.cs (ImplicitConversionExists) : Rename to
8013 ImplicitEnumConversionExists to remove ambiguity.
8015 * ecore.cs (NullCast): New type of cast expression class which
8016 basically is very similar to EmptyCast with the difference being
8017 it still is a constant since it is used only to cast a null to
8021 * convert.cs (ImplicitReferenceConversion): When casting a null
8022 literal, we return a NullCast.
8024 * literal.cs (NullLiteralTyped): Remove - I don't see why this
8025 should be around anymore.
8027 The renaming (reported was slightly wrong). Corrections:
8029 ConvertImplicitStandard -> ImplicitConversionStandard
8030 ConvertExplicitStandard -> ExplicitConversionStandard
8032 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
8033 before passing them in !
8035 * convert.cs (ImplicitConversionStandard): When comparing for
8036 equal expr and target types, ensure that expr is not a
8039 In general, we must not be checking (expr_type ==
8040 target_type) in the top level conversion methods
8041 (ImplicitConversion, ExplicitConversion etc). This checking is
8042 done in the methods that they delegate to.
8044 2003-05-20 Miguel de Icaza <miguel@ximian.com>
8046 * convert.cs: Move Error_CannotConvertType,
8047 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
8048 ImplicitNumericConversion, ImplicitConversionExists,
8049 ImplicitUserConversionExists, StandardConversionExists,
8050 FindMostEncompassedType, FindMostSpecificSource,
8051 FindMostSpecificTarget, ImplicitUserConversion,
8052 ExplicitUserConversion, GetConversionOperators,
8053 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
8054 TryImplicitIntConversion, Error_CannotConvertImplicit,
8055 ConvertImplicitRequired, ConvertNumericExplicit,
8056 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
8057 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
8060 Perform the following renames:
8062 StandardConversionExists -> ImplicitStandardConversionExists
8063 ConvertImplicit -> ImplicitConversion
8064 ConvertImplicitStandard -> ImplicitStandardConversion
8065 TryImplicitIntConversion -> ImplicitIntConversion
8066 ConvertImplicitRequired -> ImplicitConversionRequired
8067 ConvertNumericExplicit -> ExplicitNumericConversion
8068 ConvertReferenceExplicit -> ExplicitReferenceConversion
8069 ConvertExplicit -> ExplicitConversion
8070 ConvertExplicitStandard -> ExplicitStandardConversion
8072 2003-05-19 Martin Baulig <martin@ximian.com>
8074 * statement.cs (TypeInfo.StructInfo): Made this type protected.
8075 (TypeInfo): Added support for structs having structs as fields.
8077 * ecore.cs (FieldExpr): Implement IVariable.
8078 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
8079 VariableInfo for the field.
8081 2003-05-18 Martin Baulig <martin@ximian.com>
8083 * expression.cs (This.DoResolve): Report a CS0027 if we're
8084 emitting a field initializer.
8086 2003-05-18 Martin Baulig <martin@ximian.com>
8088 * expression.cs (This.ResolveBase): New public function.
8089 (This.DoResolve): Check for CS0188.
8091 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
8094 * ecore.cs (MethodGroupExpr.DoResolve): Set the
8095 `instance_expression' to null if we don't have any non-static
8098 2003-05-18 Martin Baulig <martin@ximian.com>
8100 Reworked the way how local variables and parameters are handled by
8101 the flow analysis code.
8103 * statement.cs (TypeInfo, VariableMap): New public classes.
8104 (VariableInfo): New public class. This is now responsible for
8105 checking whether a variable has been assigned. It is used for
8106 parameters and local variables.
8107 (Block.EmitMeta): Take the InternalParameters as argument; compute
8108 the layout of the flow vectors here.
8109 (Block.LocalMap, Block.ParameterMap): New public properties.
8110 (FlowBranching): The .ctor doesn't get the InternalParameters
8111 anymore since Block.EmitMeta() now computes the layout of the flow
8113 (MyStructInfo): This class is now known as `StructInfo' and nested
8114 in `TypeInfo'; we don't access this directly anymore.
8116 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
8117 property and removed IsAssigned(), IsFieldAssigned(),
8118 SetAssigned() and SetFieldAssigned(); we now call them on the
8119 VariableInfo so we don't need to duplicate this code everywhere.
8121 * expression.cs (ParameterReference): Added `Block block' argument
8123 (LocalVariableReference, ParameterReference, This): The new
8124 VariableInfo class is now responsible for all the definite
8127 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
8128 IsParameterAssigned, SetParameterAssigned): Removed.
8130 2003-05-18 Martin Baulig <martin@ximian.com>
8132 * typemanager.cs (InitCoreTypes): Try calling
8133 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
8134 the 3-args-version. Corlib now also needs our `void_type'.
8135 (GetMethod): Added overloaded version which takes an optional
8136 `bool report_errors' to allow lookups of optional methods.
8138 2003-05-12 Martin Baulig <martin@ximian.com>
8140 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
8141 only used for locals and not for parameters.
8143 2003-05-12 Miguel de Icaza <miguel@ximian.com>
8145 * support.cs (InternalParameters.ParameterType): Return the
8146 ExternalType of the parameter.
8148 * parameter.cs (Parameter.ExternalType): drop the two arguments,
8151 2003-05-11 Miguel de Icaza <miguel@ximian.com>
8153 * class.cs (MethodData.Define): Do not set the `newslot' on
8154 interface members, if they are also flagged as "override".
8156 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
8157 better code for ++i and i++. This only works for static fields
8158 and local variables.
8160 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
8161 want to pull the DeclSpace out of the builder_to_declspace instead
8162 of the TypeBuilder (like in TypeContainer.FindMembers).
8164 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
8165 instead of LookupTypeContainer. Fixes the crash on .NET for
8166 looking up interface members.
8168 * const.cs: Create our own emit context during the Definition
8169 stage, so that constants are evaluated in the proper context, when
8170 a recursive definition happens.
8172 2003-05-11 Martin Baulig <martin@ximian.com>
8174 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
8175 new block for a switch section.
8176 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
8177 the adding/lookup in the switch block. Fixes #39828.
8179 2003-05-09 Miguel de Icaza <miguel@ximian.com>
8181 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
8182 functionality: I needed to convert the data after I had performed
8183 the add/sub operation into the operands type size.
8185 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
8186 pass the type for the box operation, otherwise the resulting
8187 object would have been of type object.
8189 (BoxedCast): Add constructor to specify the type to box as.
8191 2003-05-07 Miguel de Icaza <miguel@ximian.com>
8193 * iterators.cs: I was reusing the `count' variable inadvertently,
8194 take steps to not allow this to happen.
8196 2003-05-06 Miguel de Icaza <miguel@ximian.com>
8198 * attribute.cs (Attribute.Resolve): Params attributes are encoded
8199 by creating an array at the point where the params starts and
8200 putting all those arguments there, then adjusting the size of the
8203 2003-05-05 Miguel de Icaza <miguel@ximian.com>
8205 * expression.cs (New.AddressOf): Implement interface
8206 IMemoryLocation. This is used when the `new' operator is used in
8207 the context of an invocation to a method on a value type.
8209 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
8212 * namespace.cs: Also check the using aliases here.
8214 * driver.cs: Move the test for using validity after the types have
8215 been entered, so we do a single pass that also includes the using
8218 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
8219 in the regular case. CreateSiblingForFinally is doing extra
8222 * attribute.cs (GetAttributeArgumentExpression): Store the result
8223 on an out value, and use the return value to indicate failure
8224 instead of using null (which is a valid return for Constant.GetValue).
8226 * statement.cs: Perform the analysis flow for the increment
8227 portion after the statement, because this will be the real flow of
8228 execution. Fixes #42385
8230 * codegen.cs (EmitContext.EmitArgument,
8231 EmitContext.EmitStoreArgument): New helper functions when the
8232 RemapToProxy flag is set.
8234 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
8237 Add support for remapping parameters.
8239 * iterators.cs: Propagate parameter values; Store parameter
8240 values in the proxy classes.
8242 2003-05-04 Miguel de Icaza <miguel@ximian.com>
8244 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
8245 need a proxy reference; I do not know what I was thinking
8247 * cs-parser.jay (constructor_initializer): catch another error,
8248 and display nice message.
8250 (field_declaration): catch void field declaration
8251 to flag a better error.
8253 * class.cs (MemberBase.CheckBase): Report an error instead of a
8254 warning if a new protected member is declared in a struct.
8255 (Field.Define): catch the error of readonly/volatile.
8257 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
8259 (FieldExpr.AddressOf): ditto. Catch error where the address of a
8260 volatile variable is taken
8262 2003-05-02 Miguel de Icaza <miguel@ximian.com>
8264 * statement.cs (Fixed.Resolve): Report an error if we are not in
8267 2003-05-01 Miguel de Icaza <miguel@ximian.com>
8269 * typemanager.cs: reuse the code that handles type clashes for
8270 delegates and enumerations.
8272 * class.cs (Report28): Always report.
8274 * expression.cs (EncodeAsAttribute): Allow nulls here.
8276 2003-04-28 Miguel de Icaza <miguel@ximian.com>
8278 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
8279 the functionality for testing whether an expression is valid for
8280 an attribute here. Also handle the case of arrays of elements
8283 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
8284 encoding a linear array into an array of objects that are suitable
8285 to be passed to an CustomAttributeBuilder.
8287 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
8289 * ecore.cs: (FieldExpr): Handle field remapping here.
8291 * iteratators.cs: Pass the instance variable (if the method is an
8292 instance method) to the constructors, so we can access the field
8293 variables on the class.
8295 TODO: Test this with structs. I think the THIS variable on
8296 structs might have to be a pointer, and not a refenrece
8298 2003-04-27 Miguel de Icaza <miguel@ximian.com>
8300 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
8301 local variables to fields in a proxy class.
8303 * iterators.cs (PopulateProxy): Rename our internal fields to
8305 Create a <THIS> field if we are an instance method, so we can
8306 reference our parent container variables.
8307 (MapVariable): Called back from the EmitContext code to enter a
8308 new variable to field mapping into the proxy class (we just create
8312 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
8313 for using the remapped locals to fields.
8315 I placed the code here, because that gives the same semantics to
8316 local variables, and only changes the Emit code.
8318 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
8319 statements inside iterators.
8320 (VariableInfo): Add a FieldBuilder for the cases when we are
8321 remapping local variables to fields in a proxy class
8323 * ecore.cs (SimpleNameResolve): Avoid testing two times for
8324 current_block != null.
8326 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
8327 not cope with strings, as it has been moved to the
8328 TableSwitchEmit. Fixed bug in switch generation.
8330 * expression.cs (New.DoResolve): Provide more context for the user
8331 when reporting an error.
8333 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
8336 * expression.cs (MemberAccess.DoResolve): When we get a type back,
8337 check the permissions for it. Note than in a type-resolution
8338 context the check was already present in DeclSpace.ResolveType,
8339 but was missing from the MemberAccess.
8341 (ArrayCreation.CheckIndices): warn if the user has
8342 more nested levels of expressions, but there are no more
8343 dimensions specified. Avoids crash on bug 41906.
8345 2003-04-26 Miguel de Icaza <miguel@ximian.com>
8347 * statement.cs (Block): replace Implicit bool, for a generic
8349 New flag: `Unchecked'. This is used during the EmitMeta phase
8350 (which is out-of-line with the regular Resolve/Emit process for a
8351 statement, as this is done ahead of time, but still gets a chance
8352 to call constant resolve).
8354 (Block.Flags): new enum for adding a new flag.
8356 (Block.EmitMeta): track the state of unchecked.
8358 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
8359 to enable constant resolution to work there as well.
8361 2003-04-22 Miguel de Icaza <miguel@ximian.com>
8363 * typemanager.cs (ienumerable_type): Also look up
8364 System.Collections.IEnumerable.
8366 2003-04-21 Miguel de Icaza <miguel@ximian.com>
8368 TODO: Test more than one conditional per method.
8370 * class.cs (Indexer.Define): Report the location where the user is
8371 referencing the unsupported feature.
8373 (MethodData): Overload the use of `conditionals' to
8374 minimize the creation of needless ArrayLists. This saves roughly
8375 212kb on my machine.
8377 (Method): Implement the new IIteratorContainer interface.
8378 (Method.SetYields): Implement the method by setting the ModFlags
8379 to contain METHOD_YIELDS.
8381 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
8382 which just got set to null.
8384 * iterators.cs: New file.
8386 (Yield, YieldBreak): New statements.
8388 * statement.cs (Return.Resolve): Flag an error if we are used in
8391 * codegen.cs (InIterator): New flag set if the code is being
8392 compiled in an iterator method.
8394 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
8395 internal modifier, and we just use it to avoid adding extra
8396 fields, as this is seldom used.
8398 * cs-parser.jay: Add yield_statement (yield and yield break).
8400 * driver.cs: New flag -v2 to turn on version 2 features.
8402 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
8403 hashtable when v2 is enabled.
8405 2003-04-20 Miguel de Icaza <miguel@ximian.com>
8407 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
8408 there is already a namespace defined with this name.
8410 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
8411 people upgraded their corlibs.
8413 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
8414 always use fully qualified types, no need to use the compiler
8417 (TypeManager.IsNamespace): Use binarysearch.
8419 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
8420 AddDelegate): I did not quite use the new IsValid API properly: I
8421 have to pass the short-name and the fullname. I was passing only
8422 the basename instead of the fullname sometimes.
8424 (TypeContainer.DefineType): call NamespaceClash.
8426 * interface.cs (Interface.DefineType): use NamespaceClash before
8429 * delegate.cs (Delegate.DefineType): use NamespaceClash before
8432 * enum.cs: (Enum.DefineType): use NamespaceClash before
8435 * typemanager.cs (: 3-line patch that gives us some tasty 11%
8436 speed increase. First, use the negative_hits cache when we get a
8437 negative. Second, add the type with its full original name
8438 instead of the new . and + encoded name (reflection uses + to
8439 separate type from a nested type). Use LookupTypeReflection
8440 directly which bypasses the type->name hashtable (that we already
8441 know does not contain the type.
8443 * decl.cs (DeclSpace.ResolveTypeExpr): track the
8444 location/container type.
8446 * driver.cs: When passing utf8, use directly the UTF8Encoding.
8448 2003-04-19 Miguel de Icaza <miguel@ximian.com>
8450 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
8452 * delegate.cs (NewDelegate.Resolve): Test whether an instance
8453 method is being referenced in the method group from a static
8454 context, and report error 120 if so.
8456 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
8459 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
8460 is created, we create the A namespace).
8462 * cs-parser.jay: A namespace also introduces a DeclarationFound.
8465 2003-04-18 Miguel de Icaza <miguel@ximian.com>
8467 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
8468 invocation to ModuleBuilder.GetType with the same values will
8469 return a new type instance, so we need to cache its return
8472 * expression.cs (Binary.ResolveOperator): Only allow the compare
8473 operators on enums if they are of the same type.
8475 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
8476 types of ValueType on their own case. Before we were giving them
8477 the same treatment as objects.
8479 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
8480 fullname. Short name is used to compare against container name.
8481 Fullname is used to check against defined namespace names.
8483 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
8484 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
8486 (Method.CheckBase): Call parent.
8487 (MemberBase.CheckBase): Check for protected members on sealed
8489 (PropertyBase.CheckBase): Call parent.
8490 (Field.Define): Call parent.
8492 * report.cs: Negative error codes are now mapped to 8000 - code,
8493 so that the display is render more nicely.
8495 * typemanager.cs: Do not use try/catch, instead report a regular
8498 (GetPointerType, GetReferenceType): These methods provide
8499 mechanisms to obtain the T* and T& from a T. We had the code
8500 previously scattered around the code base, and it also used
8501 TypeManager.LookupType that would go through plenty of caches.
8502 This one goes directly to the type source.
8504 In some places we did the Type.GetType followed by
8505 ModuleBuilder.GetType, but not in others, so this unifies the
8508 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
8509 statements now that we have namespace information.
8511 * typemanager.cs (IsNamespace): New method, returns whether the
8512 string presented is a namespace or not.
8514 (ComputeNamespaces): New public entry point, computes the list of
8515 available namespaces, using the GetNamespaces API call in Mono, or
8516 the slower version in MS.NET.
8518 Now before we start the semantic analysis phase, we have a
8519 complete list of namespaces including everything that the user has
8522 Deleted old code to cache namespaces in .nsc files.
8524 2003-04-17 Miguel de Icaza <miguel@ximian.com>
8526 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
8527 class/struct location definition Location for the implicit
8528 constructor location.
8530 (Operator.Define): Use the location of the operator for the
8531 implicit Method definition.
8533 (Constructor.Emit): use the constructor location for the implicit
8534 base initializer constructor.
8536 * ecore.cs: Remove ITypeExpression. This interface is now gone,
8537 and the Expression class now contains two new methods:
8539 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
8540 isolate type lookup from the rest of the resolution process.
8542 Since we use Expressions to hold type definitions due to the way
8543 we parse the input we have historically overloaded Resolve to
8544 perform the Type lookups if a special flag is passed. Now this is
8545 eliminated and two methods take their place.
8547 The differences in the two methods between xStep and xTerminal is
8548 that xStep is involved in our current lookup system that uses
8549 SimpleNames to compose a name, while xTerminal is used just to
8550 catch the case where the simplename lookup failed.
8552 2003-04-16 Miguel de Icaza <miguel@ximian.com>
8554 * expression.cs (ResolveMemberAccess): Remove redundant code.
8555 TypeExpr expressions are always born fully resolved.
8557 * interface.cs (PopulateMethod): Do not lookup the types twice.
8558 We were doing it once during SemanticAnalysis and once during
8561 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
8562 in local variable type definitions, were being returned as a
8563 SimpleName (we decomposed everything into a string), that is
8564 because primary_expression was being used instead of a type in the
8565 grammar (reduce/reduce conflicts).
8567 The part that was wrong is that we converted the expression into a
8568 string (an oversimplification in one hand, compounded with primary
8569 expressions doing string concatenation).
8575 Would return "A.B.C[]" as a SimpleName. This stopped things like
8576 using clauses from working on this particular context. And a type
8577 was being matched directly against "A.B.C[]".
8579 We now use the correct approach, and allow for ComposedCast to be
8580 part of the unary expression. So the "A.B.C []" become a composed
8581 cast of "A.B.C" (as a nested group of MemberAccess with a
8582 SimpleName at the end) plus the rank composition "[]".
8586 2003-04-10 Miguel de Icaza <miguel@ximian.com>
8588 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
8589 for the access level checking.
8591 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
8592 `TypeContainer container', because I kept getting confused when I
8593 was debugging this code.
8595 * expression.cs (Indexers): Instead of tracking getters/setters,
8596 we now track them in parallel. We create one arraylist less, but
8597 most importantly it is possible now for the LValue code to find a
8598 matching get for a set.
8600 (IndexerAccess.DoResolveLValue): Update the code.
8601 GetIndexersForType has been modified already to extract all the
8602 indexers from a type. The code assumed it did not.
8604 Also make the code set the correct return type for the indexer.
8605 This was fixed a long time ago for properties, but was missing for
8606 indexers. It used to be void_type.
8608 (Binary.Emit): Test first for doubles instead of
8609 floats, as they are more common.
8611 (Binary.EmitBranchable): Use the .un version of the branch opcodes
8612 when dealing with floats and the <=, >= operators. This fixes bug
8615 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
8616 to load the array value by emitting a load on the foreach variable
8617 type. This was incorrect.
8619 We now emit the code to load an element using the the array
8620 variable type, and then we emit the conversion operator.
8624 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
8626 * attribute.cs: Avoid allocation of ArrayLists in the common case.
8628 2003-04-09 Miguel de Icaza <miguel@ximian.com>
8630 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
8631 test for protection before we test for signatures.
8633 (MethodSignature.ToString): implement.
8635 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
8636 to the case where we reduced into a LongConstant.
8638 * decl.cs (CheckAccessLevel): If the type is an array, we can not
8639 depend on whether the information is acurrate, because the
8640 Microsoft runtime will always claim that the array type is public,
8641 regardless of the real state.
8643 If the type is a pointer, another problem happens: the type is
8644 reported as non-public in Microsoft.
8646 In both cases we have to call CheckAccessLevel recursively with
8647 the underlying type as the argument to be tested.
8649 2003-04-08 Miguel de Icaza <miguel@ximian.com>
8651 * assign.cs (Assign.Emit): If we are dealing with a compound
8652 assignment expression, we should use the code path that stores the
8653 intermediate result in a temporary value. This fixes #40903.
8655 *expression.cs (Indirection.ToString): Provide ToString method for
8658 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
8660 * class.cs: Null out fields holding references to Block objects so
8661 they can be garbage collected.
8663 * expression.cs (OverloadResolve): Remove unused local.
8665 2003-04-07 Martin Baulig <martin@ximian.com>
8667 * codegen.cs (EmitContext.CurrentFile): New public field.
8668 (EmitContext.Mark): Use the CurrentFile to check whether the
8669 location is in the correct file.
8670 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
8672 2003-04-07 Martin Baulig <martin@ximian.com>
8674 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
8676 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
8677 location. [FIXME: The location argument which gets passed to this
8678 method is sometimes wrong!]
8680 2003-04-07 Nick Drochak <ndrochak@gol.com>
8682 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
8684 2003-04-07 Miguel de Icaza <miguel@ximian.com>
8686 * expression.cs (Indirection.EmitAssign): We were using the
8687 temporary, but returning immediately instead of continuing the
8690 2003-04-06 Martin Baulig <martin@ximian.com>
8692 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
8693 if it's a nested child, but also deriving from the outer class.
8696 * typemanager.cs (IsNestedChildOf): Make this work if it's a
8697 nested child, but also deriving from the outer class. See
8699 (FilterWithClosure): We may access private members of the outer
8700 class if we're a nested child and deriving from the outer class.
8701 (RealMemberLookup): Only set `closure_private_ok' if the
8702 `original_bf' contained BindingFlags.NonPublic.
8704 2003-04-05 Martin Baulig <martin@ximian.com>
8706 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
8707 probe if its a type parameter, and if so, flag an error.
8709 * decl.cs: Move here the SetParameterInfo code from class.cs.
8710 Handle IsGeneric here.
8712 Handle a variety of errors in the parameter info definition.
8714 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
8715 type parameters here.
8717 * cs-parser.jay (class_declaration): report errors for parameters
8720 2003-01-21 Miguel de Icaza <miguel@ximian.com>
8722 * generic.cs: New file, contains support code for generics.
8724 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
8725 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
8727 Update parser for the above removals.
8729 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
8730 now taken care of in the parser.
8732 2003-04-02 Miguel de Icaza <miguel@ximian.com>
8734 * class.cs (Event.Define): Do not allow abstract events to have
8737 2003-04-01 Miguel de Icaza <miguel@ximian.com>
8739 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
8740 block in event declarations.
8742 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
8743 value type, get its address.
8745 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
8746 leaving a class on the stack instead of a boolean value (int
8747 0/1). Change the code so we compare against null, and then the
8748 result against zero.
8750 * class.cs (TypeContainer.GetClassBases): We were checking for the
8751 parent class being sealed too late.
8753 * expression.cs (Binary.Emit): For <= and >= when dealing with
8754 floating point values, use cgt.un and clt.un instead of cgt and
8757 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
8759 * statement.cs: Apply the same optimization as MS: skip the
8760 GetEnumerator returning an IEnumerator, and use the one returning a
8761 CharEnumerator instead. This allows us to avoid the try-finally block
8764 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
8766 * cs-parser.jay: Attributes cannot be applied to
8767 namespaces. Fixes #40473
8769 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8772 (Add*): check if the name is valid using the full name for constants,
8773 fields, properties and events.
8775 2003-03-28 Miguel de Icaza <miguel@ximian.com>
8777 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
8778 char constants to be part of the enumeration.
8780 * expression.cs (Conditional.DoResolve): Add support for operator
8781 true. Implements the missing functionality from 14.12
8783 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
8784 operator true/false as required by the spec.
8786 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
8787 implicit conversion to boolean.
8789 * statement.cs (Statement.ResolveBoolean): A boolean expression is
8790 also one where the type implements `operator true'.
8792 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
8793 get an expression that will invoke operator true based on an
8796 (GetConversionOperators): Removed the hack that called op_True
8799 (Expression.ResolveBoolean): Move this from Statement.
8801 2003-03-17 Miguel de Icaza <miguel@ximian.com>
8803 * ecore.cs (FieldExpr): do not allow initialization of initonly
8804 fields on derived classes
8806 2003-03-13 Martin Baulig <martin@ximian.com>
8808 * statement.cs (Block.Emit): Call ig.BeginScope() and
8809 ig.EndScope() when compiling with debugging info; call
8810 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
8812 2003-03-08 Miguel de Icaza <miguel@ximian.com>
8814 * expression.cs (Indexers): Do not construct immediately, allow
8815 for new members to be appended as we go. Fixes 38143
8817 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8819 * expression.cs: save/restore context when resolving an unchecked
8822 2003-03-05 Miguel de Icaza <miguel@ximian.com>
8824 * cfold.cs: Catch division by zero in modulus operator during
8827 2003-03-03 Miguel de Icaza <miguel@ximian.com>
8829 * interface.cs (Interface.DefineMembers): Avoid defining members
8832 2003-02-27 Miguel de Icaza <miguel@ximian.com>
8834 * driver.cs: handle the +/- options for -noconfig
8836 * statement.cs (Unckeched.Resolve): Also track the state of
8837 unchecked in the Resolve phase.
8839 2003-02-27 Martin Baulig <martin@ximian.com>
8841 * ecore.cs (Expression.MemberLookup): Don't create a
8842 MethodGroupExpr for something which is not a method. Fixes #38291.
8844 2003-02-25 Miguel de Icaza <miguel@ximian.com>
8846 * class.cs (MemberBase.CheckParameters): Also check that the type
8847 is unmanaged if it is a pointer.
8849 * expression.cs (SizeOf.Resolve): Add location information.
8851 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
8852 a managed type is declared.
8854 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
8855 parameter modifiers as well. Fixes bug 38606
8857 * class.cs: Very sad. Am backing out the speed up changes
8858 introduced by the ArrayList -> Array in the TypeContainer, as they
8859 were not actually that much faster, and introduced a bug (no error
8860 reports on duplicated methods).
8862 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
8863 source first, this will guarantee that we have a valid expression
8864 before calling in lower levels functions that will require a
8865 resolved object. Then use this original_source in the
8866 target.ResolveLValue instead of the original source that was
8869 Another change. Use target.Resolve instead of LValueResolve.
8870 Although we are resolving for LValues, we will let the Assign code
8871 take care of that (it will be called again from Resolve). This
8872 basically allows code like this:
8874 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
8875 class Y { void A (X x) { x [0] += o; }
8877 The problem was that the indexer was trying to resolve for
8878 set_Item (idx, object o) and never finding one. The real set_Item
8879 was set_Item (idx, X). By delaying the process we get the right
8884 2003-02-23 Martin Baulig <martin@ximian.com>
8886 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
8887 while calling DoEmit ().
8889 * codegen.cs (EmitContext.Mark): Don't mark locations in other
8890 source files; if you use the #line directive inside a method, the
8891 compiler stops emitting line numbers for the debugger until it
8892 reaches the end of the method or another #line directive which
8893 restores the original file.
8895 2003-02-23 Martin Baulig <martin@ximian.com>
8897 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
8899 2003-02-23 Martin Baulig <martin@ximian.com>
8901 * statement.cs (Block.AddChildVariableNames): We need to call this
8902 recursively, not just for our immediate children.
8904 2003-02-23 Martin Baulig <martin@ximian.com>
8906 * class.cs (Event.Define): Always make the field private, like csc does.
8908 * typemanager.cs (TypeManager.RealMemberLookup): Make events
8909 actually work, fixes bug #37521.
8911 2003-02-23 Miguel de Icaza <miguel@ximian.com>
8913 * delegate.cs: When creating the various temporary "Parameters"
8914 classes, make sure that we call the ComputeAndDefineParameterTypes
8915 on those new parameters (just like we do with the formal ones), to
8916 allow them to be resolved in the context of the DeclSpace.
8918 This fixes the bug that Dick observed in Bugzilla #38530.
8920 2003-02-22 Miguel de Icaza <miguel@ximian.com>
8922 * expression.cs (ResolveMemberAccess): When resolving a constant,
8923 do not attempt to pull a constant if the value was not able to
8924 generate a valid constant.
8926 * const.cs (LookupConstantValue): Do not report more errors than required.
8928 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8930 * expression.cs: fixes bug #38328.
8932 2003-02-18 Miguel de Icaza <miguel@ximian.com>
8934 * class.cs: Changed all the various members that can be part of a
8935 class from being an ArrayList to be an Array of the right type.
8936 During the DefineType type_list, interface_list, delegate_list and
8937 enum_list are turned into types, interfaces, delegates and enums
8940 And during the member population, indexer_list, event_list,
8941 constant_list, field_list, instance_constructor_list, method_list,
8942 operator_list and property_list are turned into their real arrays.
8944 Although we could probably perform this operation earlier, for
8945 good error reporting we need to keep the lists and remove the
8946 lists for longer than required.
8948 This optimization was triggered by Paolo profiling the compiler
8949 speed on the output of `gen-sample-program.pl' perl script.
8951 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
8952 not crash in methods like MemberLookupFailed that use this field.
8954 This problem arises when the compiler fails to resolve a type
8955 during interface type definition for example.
8957 2003-02-18 Miguel de Icaza <miguel@ximian.com>
8959 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
8960 inherit from System.Object, so we have to stop at null, not only
8961 when reaching System.Object.
8963 2003-02-17 Miguel de Icaza <miguel@ximian.com>
8965 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
8966 DeclaredOnly because the parent indexer might have had a different
8967 name, but did not loop until the top of the hierarchy was reached.
8969 The problem this one fixes is 35492: when a class implemented an
8970 indexer from an interface, we were getting the interface method
8971 (which was abstract) and we were flagging an error (can not invoke
8974 This also keeps bug 33089 functioning, and test-148 functioning.
8976 * typemanager.cs (IsSpecialMethod): The correct way of figuring
8977 out if a method is special is to see if it is declared in a
8978 property or event, or whether it is one of the predefined operator
8979 names. This should fix correctly #36804.
8981 2003-02-15 Miguel de Icaza <miguel@ximian.com>
8983 The goal here is to remove the dependency on EmptyCast.Peel ().
8984 Killing it completely.
8986 The problem is that currently in a number of places where
8987 constants are expected, we have to "probe" for an EmptyCast, and
8988 Peel, which is not the correct thing to do, as this will be
8989 repetitive and will likely lead to errors.
8991 The idea is to remove any EmptyCasts that are used in casts that
8992 can be reduced to constants, so we only have to cope with
8995 This bug hunt was triggered by Bug 37363 and the desire to remove
8996 the duplicate pattern where we were "peeling" emptycasts to check
8997 whether they were constants. Now constants will always be
9000 * ecore.cs: Use an enumconstant here instead of wrapping with
9003 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
9004 throwing me off. By handling this we can get rid of a few hacks.
9006 * statement.cs (Switch): Removed Peel() code.
9008 2003-02-14 Miguel de Icaza <miguel@ximian.com>
9010 * class.cs: Location information for error 508
9012 * expression.cs (New.DoResolve): Add a guard against double
9013 resolution of an expression.
9015 The New DoResolve might be called twice when initializing field
9016 expressions (see EmitFieldInitializers, the call to
9017 GetInitializerExpression will perform a resolve on the expression,
9018 and later the assign will trigger another resolution
9020 This leads to bugs (#37014)
9022 * delegate.cs: The signature for EndInvoke should contain any ref
9023 or out parameters as well. We were not doing this in the past.
9025 * class.cs (Field.Define): Do not overwrite the type definition
9026 inside the `volatile' group. Turns out that volatile enumerations
9027 were changing the type here to perform a validity test, which
9030 2003-02-12 Miguel de Icaza <miguel@ximian.com>
9032 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
9033 and structs, we do not want to load the instance variable
9035 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
9036 enum_type has to be handled like an object reference (implicit
9037 conversions exists from this to object), but the regular IsClass
9038 and IsValueType tests will never return true for this one.
9040 Also we use TypeManager.IsValueType instead of type.IsValueType,
9041 just for consistency with the rest of the code (this is only
9042 needed if we ever use the construct exposed by test-180.cs inside
9043 corlib, which we dont today).
9045 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
9047 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
9050 2003-02-09 Martin Baulig <martin@ximian.com>
9052 * namespace.cs (Namespace..ctor): Added SourceFile argument.
9053 (Namespace.DefineNamespaces): New static public method; this is
9054 called when we're compiling with debugging to add all namespaces
9057 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
9058 pass it to the Namespace's .ctor.
9060 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
9061 and MethodBase arguments; pass the namespace ID to the symwriter;
9062 pass the MethodBase instead of the token to the symwriter.
9063 (SymbolWriter.DefineNamespace): New method to add a namespace to
9066 2003-02-09 Martin Baulig <martin@ximian.com>
9068 * symbolwriter.cs: New file. This is a wrapper around
9069 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
9070 methods here in near future.
9072 2003-02-09 Martin Baulig <martin@ximian.com>
9074 * codegen.cs (EmitContext.Mark): Just pass the arguments to
9075 ILGenerator.MarkSequencePoint() which are actually used by the
9078 2003-02-09 Martin Baulig <martin@ximian.com>
9080 * location.cs (SourceFile): New public sealed class. This
9081 contains the name and an index which is used in the location's token.
9082 (Location): Reserve an appropriate number of bits in the token for
9083 the source file instead of walking over that list, this gives us a
9084 really huge performance improvement when compiling with debugging.
9086 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
9087 `SourceFile' argument instead of a string.
9088 (Driver.ProcessFile): Add all the files via Location.AddFile(),
9089 but don't parse/tokenize here, we need to generate the list of all
9090 source files before we do that.
9091 (Driver.ProcessFiles): New static function. Parses/tokenizes all
9094 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
9095 instead of a string.
9097 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
9100 2003-02-09 Martin Baulig <martin@ximian.com>
9102 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
9103 filename on `#line default'.
9105 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
9107 * statement.cs: don't clear the pinned var when the fixed statement
9108 returns from the method (fixes bug#37752).
9110 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
9112 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
9115 2003-02-07 Martin Baulig <martin@ximian.com>
9117 * driver.cs: Removed the `--debug-args' command line argument.
9119 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
9120 automatically by the AsssemblyBuilder.
9121 (CodeGen.InitializeSymbolWriter): We don't need to call any
9122 initialization function on the symbol writer anymore. This method
9123 doesn't take any arguments.
9125 2003-02-03 Miguel de Icaza <miguel@ximian.com>
9127 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
9128 from referenced assemblies as well.
9130 2003-02-02 Martin Baulig <martin@ximian.com>
9132 * class.cs (MethodData.Emit): Generate debugging info for external methods.
9134 2003-02-02 Martin Baulig <martin@ximian.com>
9136 * class.cs (Constructor.Emit): Open the symbol writer before
9137 emitting the constructor initializer.
9138 (ConstructorInitializer.Emit): Call ec.Mark() to allow
9139 single-stepping through constructor initializers.
9141 2003-01-30 Miguel de Icaza <miguel@ximian.com>
9143 * class.cs: Handle error 549: do not allow virtual methods in
9146 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
9148 * decl.cs: Check access levels when resolving types
9150 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
9152 * statement.cs: Add parameters and locals set in catch blocks that might
9153 return to set vector
9155 2003-01-29 Miguel de Icaza <miguel@ximian.com>
9157 * class.cs (Operator): Set the SpecialName flags for operators.
9159 * expression.cs (Invocation.DoResolve): Only block calls to
9160 accessors and operators on SpecialName methods.
9162 (Cast.TryReduce): Handle conversions from char constants.
9165 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
9167 * statement.cs: small memory and time optimization in FlowBranching.
9169 2003-01-28 Pedro Mart <yoros@wanadoo.es>
9171 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
9172 problem that the last fix but in the other sid (Set).
9174 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
9175 access when there is no indexer in the hierarchy.
9177 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
9179 * class.cs: Combine some if statements.
9181 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9183 * driver.cs: fixed bug #37187.
9185 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
9187 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
9188 any indexer, it's needed to build a list with all the indexers in the
9189 hierarchy (AllGetters), else we have problems. Fixes #35653.
9191 2003-01-23 Miguel de Icaza <miguel@ximian.com>
9193 * class.cs (MethodData.Define): It is wrong for an interface
9194 implementation to be static in both cases: explicit and implicit.
9195 We were only handling this in one case.
9197 Improve the if situation there to not have negations.
9199 * class.cs (Field.Define): Turns out that we do not need to check
9200 the unsafe bit on field definition, only on usage. Remove the test.
9202 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9204 * driver.cs: use assembly.Location instead of Codebase (the latest
9205 patch made mcs fail when using MS assemblies).
9207 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
9209 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
9210 get the path to *corlib.dll.
9212 2003-01-21 Nick Drochak <ndrochak@gol.com>
9216 * typemanager.cs: Remove compiler warnings
9218 2003-01-20 Duncan Mak <duncan@ximian.com>
9220 * AssemblyInfo.cs: Bump the version number to 0.19.
9222 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9224 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
9226 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
9228 * class.cs (Constructor::Emit): Emit debugging info for constructors.
9230 2003-01-17 Miguel de Icaza <miguel@ximian.com>
9232 * cs-parser.jay: Small fix: we were not comparing the constructor
9233 name correctly. Thanks to Zoltan for the initial pointer.
9235 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
9237 * cs-tokenizer.cs: Set file name when specified with #line
9239 2003-01-15 Miguel de Icaza <miguel@ximian.com>
9241 * cs-parser.jay: Only perform the constructor checks here if we
9242 are named like the class; This will help provider a better
9243 error. The constructor path is taken when a type definition is
9244 not found, but most likely the user forgot to add the type, so
9245 report that rather than the constructor error.
9247 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
9249 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
9252 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
9254 * cs-parser.jay: Add cleanup call.
9256 2003-01-13 Duncan Mak <duncan@ximian.com>
9258 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
9259 consistent with other methods.
9261 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
9263 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
9265 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
9267 * attribute.cs: only set GuidAttr to true when we have a
9270 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9274 * typemanager.cs: fixes to allow mcs compile corlib with the new
9275 Type.IsSubclassOf fix.
9277 2003-01-08 Miguel de Icaza <miguel@ximian.com>
9279 * expression.cs (LocalVariableReference.DoResolve): Classify a
9280 constant as a value, not as a variable. Also, set the type for
9283 * cs-parser.jay (fixed_statement): take a type instead of a
9284 pointer_type, so we can produce a better error message later.
9286 * statement.cs (Fixed.Resolve): Flag types that are not pointers
9289 (For.DoEmit): Make inifinite loops have a
9290 non-conditional branch back.
9292 (Fixed.DoEmit): First populate the pinned variables, then emit the
9293 statement, then clear the variables. Before I was emitting the
9294 code once for each fixed piece.
9297 2003-01-08 Martin Baulig <martin@ximian.com>
9299 * statement.cs (FlowBranching.MergeChild): A break in a
9300 SWITCH_SECTION does not leave a loop. Fixes #36155.
9302 2003-01-08 Martin Baulig <martin@ximian.com>
9304 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
9305 lives in the same number space than `param_map'. Fixes #36154.
9307 2003-01-07 Miguel de Icaza <miguel@ximian.com>
9309 * cs-parser.jay (constructor_declaration): Set the
9310 Constructor.ModFlags before probing for it. This makes the
9311 compiler report 514, 515 and 132 (the code was there, but got
9314 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
9315 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
9316 (GotoCase.Resolve): Set `Returns' to ALWAYS.
9318 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
9320 * enum.cs: create the enum static fields using the enum type.
9322 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
9324 * class.cs: don't try to create the ParamBuilder for the return
9325 type if it's not needed (and handle it breaking for the ms runtime
9328 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
9330 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
9332 2002-12-29 Miguel de Icaza <miguel@ximian.com>
9334 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
9335 the command. This showed up while compiling the JANET source
9336 code, which used \r as its only newline separator.
9338 2002-12-28 Miguel de Icaza <miguel@ximian.com>
9340 * class.cs (Method.Define): If we are an operator (because it
9341 reuses our code), then set the SpecialName and HideBySig. #36128
9343 2002-12-22 Miguel de Icaza <miguel@ximian.com>
9345 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
9346 exception, report error 120 `object reference required'.
9348 * driver.cs: Add --pause option, used during to measure the size
9349 of the process as it goes with --timestamp.
9351 * expression.cs (Invocation.DoResolve): Do not allow methods with
9352 SpecialName to be invoked.
9354 2002-12-21 Miguel de Icaza <miguel@ximian.com>
9356 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
9357 number before adding it.
9359 2002-12-21 Ravi Pratap <ravi@ximian.com>
9361 * ecore.cs (StandardImplicitConversion): When in an unsafe
9362 context, we allow conversion between void * to any other pointer
9363 type. This fixes bug #35973.
9365 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
9367 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
9368 is not thrown when extensionless outputs are used
9370 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9372 * rootcontext.cs: fixed compilation of corlib.
9374 2002-12-19 Miguel de Icaza <miguel@ximian.com>
9376 * attribute.cs (Attributes.Contains): Add new method.
9378 * class.cs (MethodCore.LabelParameters): if the parameter is an
9379 `out' parameter, check that no attribute `[In]' has been passed.
9381 * enum.cs: Handle the `value__' name in an enumeration.
9383 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
9385 * decl.cs: Added special case to allow overrides on "protected
9388 2002-12-18 Ravi Pratap <ravi@ximian.com>
9390 * attribute.cs (Attributes.AddAttributeSection): Rename to this
9391 since it makes much more sense.
9393 (Attributes.ctor): Don't require a Location parameter.
9395 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
9397 * attribute.cs (ApplyAttributes): Remove extra Location parameters
9398 since we already have that information per attribute.
9400 * everywhere : make appropriate changes.
9402 * class.cs (LabelParameters): Write the code which actually
9403 applies attributes to the return type. We can't do this on the MS
9404 .NET runtime so we flag a warning in the case an exception is
9407 2002-12-18 Miguel de Icaza <miguel@ximian.com>
9409 * const.cs: Handle implicit null conversions here too.
9411 2002-12-17 Ravi Pratap <ravi@ximian.com>
9413 * class.cs (MethodCore.LabelParameters): Remove the extra
9414 Type [] parameter since it is completely unnecessary. Instead
9415 pass in the method's attributes so that we can extract
9416 the "return" attribute.
9418 2002-12-17 Miguel de Icaza <miguel@ximian.com>
9420 * cs-parser.jay (parse): Use Report.Error to flag errors instead
9421 of ignoring it and letting the compile continue.
9423 * typemanager.cs (ChangeType): use an extra argument to return an
9424 error condition instead of throwing an exception.
9426 2002-12-15 Miguel de Icaza <miguel@ximian.com>
9428 * expression.cs (Unary.TryReduce): mimic the code for the regular
9429 code path. Perform an implicit cast in the cases where we can
9430 implicitly convert to one of the integral types, and then reduce
9431 based on that constant. This fixes bug #35483.
9433 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9435 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
9437 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9439 * namespace.cs: fixed bug #35489.
9441 2002-12-12 Miguel de Icaza <miguel@ximian.com>
9443 * class.cs: Remove some dead code.
9445 * cs-parser.jay: Estimate the number of methods needed
9446 (RootContext.MethodCount);
9448 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
9449 numbers instead of StringBuilders.
9451 * support.cs (PtrHashtable): Add constructor with initial size;
9452 We can now reduce reallocations of the method table.
9454 2002-12-10 Ravi Pratap <ravi@ximian.com>
9456 * attribute.cs (ApplyAttributes): Keep track of the emitted
9457 attributes on a per-target basis. This fixes bug #35413.
9459 2002-12-10 Miguel de Icaza <miguel@ximian.com>
9461 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
9462 default to the Windows 1252 encoding.
9464 (UnixParseOption): Support version, thanks to Alp for the missing
9467 * AssemblyInfo.cs: Add nice assembly information.
9469 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
9472 * cs-parser.jay: Allow a trailing comma before the close bracked
9473 in the attribute_section production.
9475 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
9476 address of the instance was being taken, I will take this out,
9477 because we take the address of the object immediately here.
9479 2002-12-09 Ravi Pratap <ravi@ximian.com>
9481 * typemanager.cs (AreMultipleAllowed): Take care of the most
9482 obvious case where attribute type is not in the current assembly -
9485 2002-12-08 Miguel de Icaza <miguel@ximian.com>
9487 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
9488 definitions, instead of doing that afterwards.
9490 Also we use a nice little hack, depending on the constructor, we
9491 know if we are a "composed" name or a simple name. Hence, we
9492 avoid the IndexOf test, and we avoid
9494 * codegen.cs: Add code to assist in a bug reporter to track down
9495 the source of a compiler crash.
9497 2002-12-07 Ravi Pratap <ravi@ximian.com>
9499 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
9500 types have been emitted for a given element and flag an error
9501 if something which does not have AllowMultiple set is used more
9504 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
9505 attribute types and their corresponding AllowMultiple properties
9507 (AreMultipleAllowed): Check the property for a given type.
9509 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
9510 property in the case we have a TypeContainer.
9512 (Attributes.AddAttribute): Detect duplicates and just skip on
9513 adding them. This trivial fix catches a pretty gross error in our
9514 attribute emission - global attributes were being emitted twice!
9516 Bugzilla bug #33187 is now fixed.
9518 2002-12-06 Miguel de Icaza <miguel@ximian.com>
9520 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
9523 * expression.cs (Binary.ResolveOperator): I can only use the
9524 Concat (string, string, string) and Concat (string, string,
9525 string, string) if the child is actually a concatenation of
9528 2002-12-04 Miguel de Icaza <miguel@ximian.com>
9530 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
9531 context where we need a 2-character lookahead.
9533 * pending.cs (PendingImplementation): Rework so we can keep track
9534 of interface types all the time, and flag those which were
9535 implemented by parents as optional.
9537 2002-12-03 Miguel de Icaza <miguel@ximian.com>
9539 * expression.cs (Binary.ResolveOperator): Use
9540 String.Concat(string,string,string) or
9541 String.Concat(string,string,string,string) when possible.
9543 * typemanager: More helper methods.
9546 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
9548 * pending.cs: remove the bogus return from GetMissingInterfaces()
9549 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
9551 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9553 * namespace.cs: avoid duplicated 'using xxx' being added to
9554 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
9555 when we get more than one 'using' statement for the same namespace.
9556 Report a CS0105 warning for it.
9558 2002-11-30 Miguel de Icaza <miguel@ximian.com>
9560 * cs-tokenizer.cs (consume_identifier): use read directly, instead
9561 of calling getChar/putback, uses internal knowledge of it.
9563 (xtoken): Reorder tokenizer so most common patterns are checked
9564 first. This reduces the compilation time in another 5% (from 8.11s
9565 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
9567 The parsing time is 22% of the compilation in mcs, and from that
9568 64% is spent on the tokenization process.
9570 I tried using a binary search for keywords, but this is slower
9571 than the hashtable. Another option would be to do a couple of
9574 * Not use a StringBuilder, instead use an array of chars,
9575 with a set value. Notice that this way we could catch
9576 the 645 error without having to do it *afterwards*.
9578 * We could write a hand-parser to avoid the hashtable
9579 compares altogether.
9581 The identifier consumption process takes 37% of the tokenization
9582 time. Another 15% is spent on is_number. 56% of the time spent
9583 on is_number is spent on Int64.Parse:
9585 * We could probably choose based on the string length to
9586 use Int32.Parse or Int64.Parse and avoid all the 64-bit
9589 Another 3% is spend on wrapping `xtoken' in the `token' function.
9591 Handle 0xa0 as whitespace (#34752)
9593 2002-11-26 Miguel de Icaza <miguel@ximian.com>
9595 * typemanager.cs (IsCLRType): New routine to tell whether a type
9596 is one of the builtin types.
9598 Maybe it needs to use TypeCodes to be faster. Maybe we could use
9599 typecode in more places instead of doing pointer comparissions.
9600 We could leverage some knowledge about the way the typecodes are
9603 New code to cache namespaces in assemblies, it is currently not
9604 invoked, to be used soon.
9606 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
9608 * expression.cs (Binary.ResolveOperator): specially handle
9609 strings, and do not perform user-defined operator overloading for
9612 2002-11-24 Miguel de Icaza <miguel@ximian.com>
9614 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
9615 internalcall as it is a pretty simple operation; Avoid whenever
9616 possible to call Char.IsLetter.
9618 (consume_identifier): Cut by half the number of
9619 hashtable calls by merging the is_keyword and GetKeyword behavior.
9621 Do not short-circuit, because if we do, we
9622 report errors (ie, #if false && true would produce an invalid
9626 2002-11-24 Martin Baulig <martin@ximian.com>
9628 * expression.cs (Cast.TryReduce): If we're in checked syntax,
9629 check constant ranges and report a CS0221. Fixes #33186.
9631 2002-11-24 Martin Baulig <martin@ximian.com>
9633 * cs-parser.jay: Make this work for uninitialized variable
9634 declarations in the `for' initializer. Fixes #32416.
9636 2002-11-24 Martin Baulig <martin@ximian.com>
9638 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
9639 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
9641 2002-11-24 Martin Baulig <martin@ximian.com>
9643 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
9644 argument; if true, we also check for user-defined conversions.
9645 This is only needed if both arguments are of a user-defined type.
9646 Fixes #30443, added test-175.cs.
9647 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
9649 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
9651 2002-11-24 Martin Baulig <martin@ximian.com>
9653 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
9654 function to get the store opcode.
9655 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
9656 only emit the Ldelema if the store opcode is Stobj. You must run
9657 both test-34 and test-167 to test this. Fixes #34529.
9659 2002-11-23 Martin Baulig <martin@ximian.com>
9661 * ecore.cs (Expression.MemberLookup): Added additional
9662 `qualifier_type' argument which is used when we're being called
9663 from MemberAccess.DoResolve() and null if we're called from a
9665 (Expression.MemberLookupFailed): New method to report errors; this
9666 does the CS1540 check and reports the correct error message.
9668 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
9669 argument for the CS1540 check and redone the way how we're dealing
9670 with private members. See the comment in the source code for details.
9671 (FilterWithClosure): Reverted this back to revision 1.197; renamed
9672 `closure_start_type' to `closure_qualifier_type' and check whether
9673 it's not null. It was not this filter being broken, it was just
9674 being called with the wrong arguments.
9676 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
9677 and pass it the correct `qualifier_type'; this also does the error
9680 2002-11-22 Miguel de Icaza <miguel@ximian.com>
9682 * expression.cs (Invocation.EmitParams): If the we are dealing
9683 with a non-built-in value type, load its address as well.
9685 (ArrayCreation): Use a a pretty constant instead
9686 of the hardcoded value 2. Use 6 instead of 2 for the number of
9687 static initializers.
9689 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
9690 because they are not really value types, just glorified integers.
9692 * driver.cs: Do not append .exe, the CSC compiler does not do it.
9694 * ecore.cs: Remove redundant code for enumerations, make them use
9695 the same code path as everything else, fixes the casting issue
9696 with enumerations in Windows.Forms.
9698 * attribute.cs: Do only cast to string if it is a string, the
9699 validation happens later.
9701 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
9702 people upgrade their corlibs.
9704 * ecore.cs: Oops, enumerations were not following the entire code path
9706 2002-11-21 Miguel de Icaza <miguel@ximian.com>
9708 * typemanager.cs (FilterWithClosure): Commented out the test for
9709 1540 in typemanager.cs, as it has problems when accessing
9710 protected methods from a parent class (see test-174.cs).
9712 * attribute.cs (Attribute.ValidateGuid): new method.
9713 (Attribute.Resolve): Use above.
9715 2002-11-19 Miguel de Icaza <miguel@ximian.com>
9717 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
9719 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
9720 handling for enumerations, as we only needed the TypeContainer
9721 functionality to begin with (this is required for the fix below to
9722 work for enums that reference constants in a container class for
9725 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
9727 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
9728 a valid TypeBuilder to perform lookups on.o
9730 * class.cs (InheritableMemberSignatureCompare): Use true in the
9731 call to GetGetMethod and GetSetMethod, because we are comparing
9732 the signature, and we need to get the methods *even* if they are
9735 (PropertyBase.CheckBase): ditto.
9737 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
9738 GotoCase.Resolve): Use Peel on EmpytCasts.
9740 * ecore.cs (EmptyCast): drop child, add Peel method.
9742 2002-11-17 Martin Baulig <martin@ximian.com>
9744 * ecore.cs (EmptyCast.Child): New public property.
9746 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
9747 label resolved to an EmptyCast. Fixes #34162.
9748 (GotoCase.Resolve): Likewise.
9749 (Block.EmitMeta): Likewise.
9751 2002-11-17 Martin Baulig <martin@ximian.com>
9753 * expression.cs (Invocation.BetterConversion): Prefer int over
9754 uint; short over ushort; long over ulong for integer literals.
9755 Use ImplicitConversionExists instead of StandardConversionExists
9756 since we also need to check for user-defined implicit conversions.
9757 Fixes #34165. Added test-173.cs.
9759 2002-11-16 Martin Baulig <martin@ximian.com>
9761 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
9762 with the `true' and `false' literals. Fixes #33151.
9764 2002-11-16 Martin Baulig <martin@ximian.com>
9766 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
9767 October 22nd; don't do the cs1540 check for static members.
9769 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
9770 now using our own filter here and doing the cs1540 check again.
9772 2002-11-16 Martin Baulig <martin@ximian.com>
9774 * support.cs (InternalParameters): Don't crash if we don't have
9775 any fixed parameters. Fixes #33532.
9777 2002-11-16 Martin Baulig <martin@ximian.com>
9779 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
9780 when looking up static methods to make this work on Windows.
9783 2002-11-16 Martin Baulig <martin@ximian.com>
9785 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
9786 a setter rather than using PropertyInfo.CanWrite.
9788 2002-11-15 Nick Drochak <ndrochak@gol.com>
9790 * class.cs: Allow acces to block member by subclasses. Fixes build
9793 2002-11-14 Martin Baulig <martin@ximian.com>
9795 * class.cs (Constructor.Emit): Added the extern/block check.
9798 2002-11-14 Martin Baulig <martin@ximian.com>
9800 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
9801 iteration while looking for indexers, this is needed because the
9802 indexer may have a different name in our base classes. Fixed the
9803 error reporting (no indexers at all, not get accessor, no
9804 overloaded match). Fixes bug #33089.
9805 (IndexerAccess.DoResolveLValue): Likewise.
9807 2002-11-14 Martin Baulig <martin@ximian.com>
9809 * class.cs (PropertyBase.CheckBase): Make this work for multiple
9810 indexers. Fixes the first part of bug #33089.
9811 (MethodSignature.InheritableMemberSignatureCompare): Added support
9814 2002-11-13 Ravi Pratap <ravi@ximian.com>
9816 * attribute.cs (Attribute.Resolve): Catch the
9817 NullReferenceException and report it since it isn't supposed to
9820 2002-11-12 Miguel de Icaza <miguel@ximian.com>
9822 * expression.cs (Binary.EmitBranchable): Also handle the cases for
9823 LogicalOr and LogicalAnd that can benefit from recursively
9824 handling EmitBranchable. The code now should be nice for Paolo.
9826 2002-11-08 Miguel de Icaza <miguel@ximian.com>
9828 * typemanager.cs (LookupType): Added a negative-hit hashtable for
9829 the Type lookups, as we perform quite a number of lookups on
9830 non-Types. This can be removed once we can deterministically tell
9831 whether we have a type or a namespace in advance.
9833 But this might require special hacks from our corlib.
9837 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
9838 and double which avoids a conversion from an integer to a double.
9840 * expression.cs: tiny optimization, avoid calling IsConstant,
9841 because it effectively performs the lookup twice.
9843 2002-11-06 Miguel de Icaza <miguel@ximian.com>
9845 But a bogus return here to keep the semantics of the old code
9846 until the Mono runtime is fixed.
9848 * pending.cs (GetMissingInterfaces): New method used to remove all
9849 the interfaces that are already implemented by our parent
9850 classes from the list of pending methods.
9852 * interface.cs: Add checks for calls after ResolveTypeExpr.
9854 2002-11-05 Miguel de Icaza <miguel@ximian.com>
9856 * class.cs (Class.Emit): Report warning 67: event not used if the
9857 warning level is beyond 3.
9859 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
9860 being a NullLiteral.
9862 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
9865 * class.cs (TypeContainer.GetClassBases): Cover a missing code
9866 path that might fail if a type can not be resolved.
9868 * expression.cs (Binary.Emit): Emit unsigned versions of the
9871 * driver.cs: use error 5.
9873 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
9875 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
9877 2002-11-01 Miguel de Icaza <miguel@ximian.com>
9879 * cs-parser.jay (switch_section): A beautiful patch from Martin
9880 Baulig that fixed 33094.
9882 2002-10-31 Miguel de Icaza <miguel@ximian.com>
9884 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
9885 Check whether the base is abstract and report an error if so.
9887 * expression.cs (IndexerAccess.DoResolveLValue,
9888 IndexerAccess.DoResolve): ditto.
9890 (Invocation.DoResolve): ditto.
9892 (Invocation.FullMethodDesc): Improve the report string.
9894 * statement.cs (Block): Eliminate IsVariableDefined as it is
9895 basically just a wrapper for GetVariableInfo.
9897 * ecore.cs (SimpleName): Use new
9899 * support.cs (ReflectionParamter.ParameterType): We unwrap the
9900 type, as we return the actual parameter ref/unref state on a
9903 2002-10-30 Miguel de Icaza <miguel@ximian.com>
9905 * support.cs: Return proper flags REF/OUT fixing the previous
9908 * expression.cs: Reverted last patch, that was wrong. Is_ref is
9909 not used to mean `ref' but `ref or out' in ParameterReference
9911 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
9912 full type signature instead of calling TypeManger.CSharpName
9915 * support.cs (InternalParameters.ParameterDesc): Do not compare
9916 directly to the modflags, because REF/OUT will actually be bitsets
9919 * delegate.cs (VerifyMethod): Check also the modifiers.
9921 * cs-tokenizer.cs: Fix bug where floating point values with an
9922 exponent where a sign was missing was ignored.
9924 * driver.cs: Allow multiple assemblies to be specified in a single
9927 2002-10-28 Miguel de Icaza <miguel@ximian.com>
9929 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
9930 because identifiers after a parenthesis would end up in this kind
9931 of production, and we needed to desamiguate it for having casts
9934 (UserDefinedType *) xxx
9936 2002-10-24 Miguel de Icaza <miguel@ximian.com>
9938 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
9939 we should set on the Bindingflags.NonPublic, but not turn on
9940 private_ok. private_ok controls whether a Private member is
9941 returned (this is chekced on the filter routine), while the
9942 BindingFlags.NonPublic just controls whether private/protected
9943 will be allowed. This fixes the problem part of the problem of
9944 private properties being allowed to be used in derived classes.
9946 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
9947 so we can call the children DoResolveLValue method (this will
9948 properly signal errors on lvalue assignments to base properties)
9950 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
9951 getter are null, and we have a property info, we know that this
9952 happened because the lookup failed, so we report an error 122 for
9953 protection level violation.
9955 We also silently return if setter and getter are null in the
9956 resolve functions, this condition only happens if we have flagged
9957 the error before. This is the other half of the problem.
9959 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
9960 not have accessibility information, that is why we were returning
9961 true in the filter function in typemanager.cs.
9963 To properly report 122 (property is inaccessible because of its
9964 protection level) correctly, we report this error in ResolveAccess
9965 by failing if both the setter and the getter are lacking (ie, the
9968 DoResolve and DoLResolve have been modified to check for both
9969 setter/getter being null and returning silently, the reason being
9970 that I did not want to put the knowledge about this error in upper
9973 int old = Report.Errors;
9974 x = new PropertyExpr (...);
9975 if (old != Report.Errors)
9980 So the property expr is returned, but it is invalid, so the error
9981 will be flagged during the resolve process.
9983 * class.cs: Remove InheritablePropertySignatureCompare from the
9984 class, as we no longer depend on the property signature to compute
9985 whether it is possible to implement a method or not.
9987 The reason is that calling PropertyInfo.GetGetMethod will return
9988 null (in .NET, in Mono it works, and we should change this), in
9989 cases where the Get Method does not exist in that particular
9994 class X { public virtual int A { get { return 1; } } }
9996 class Z : Y { public override int A { get { return 2; } } }
9998 Would fail in Z because the parent (Y) would not have the property
9999 defined. So we avoid this completely now (because the alternative
10000 fix was ugly and slow), and we now depend exclusively on the
10003 (PropertyBase.CheckBase): Use a method-base mechanism to find our
10004 reference method, instead of using the property.
10006 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
10007 routines are gone now.
10009 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
10010 names, they were incorrectly named.
10012 * cs-tokenizer.cs: Return are more gentle token on failure.
10014 * pending.cs (PendingImplementation.InterfaceMethod): This routine
10015 had an out-of-sync index variable, which caused it to remove from
10016 the list of pending methods the wrong method sometimes.
10018 2002-10-22 Miguel de Icaza <miguel@ximian.com>
10020 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
10021 CanWrite, because those refer to this particular instance of the
10022 property, and do not take into account the fact that we can
10023 override single members of a property.
10025 Constructor requires an EmitContext. The resolution process does
10026 not happen here, but we need to compute the accessors before,
10027 because the resolution does not always happen for properties.
10029 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
10030 subclass, before we did not update this flag, but we did update
10033 (GetAccessors): Drop this routine, as it did not work in the
10034 presence of partially overwritten set/get methods.
10036 Notice that this broke the cs1540 detection, but that will require
10039 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10043 * driver.cs: issue a warning instead of an error if we don't support
10044 debugging for the platform. Also ignore a couple of errors that may
10045 arise when trying to write the symbols. Undo my previous patch.
10047 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10049 * driver.cs: ignore /debug switch except for Unix platforms.
10051 2002-10-23 Nick Drochak <ndrochak@gol.com>
10053 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
10055 2002-10-21 Miguel de Icaza <miguel@ximian.com>
10057 * driver.cs: Do not make mcs-debug conditional, so we do not break
10058 builds that use it.
10060 * statement.cs (UsageVector.MergeChildren): I would like Martin to
10061 review this patch. But basically after all the children variables
10062 have been merged, the value of "Breaks" was not being set to
10063 new_breaks for Switch blocks. I think that it should be set after
10064 it has executed. Currently I set this to the value of new_breaks,
10065 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
10066 conservative, but I do not understand this code very well.
10068 I did not break anything in the build, so that is good ;-)
10070 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
10072 2002-10-20 Mark Crichton <crichton@gimp.org>
10074 * cfold.cs: Fixed compile blocker. Really fixed it this time.
10076 2002-10-20 Nick Drochak <ndrochak@gol.com>
10078 * cfold.cs: Fixed compile blocker.
10080 2002-10-20 Miguel de Icaza <miguel@ximian.com>
10082 * driver.cs: I was chekcing the key, not the file.
10084 2002-10-19 Ravi Pratap <ravi@ximian.com>
10086 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
10087 message that we were generating - we just need to silently return
10090 2002-10-19 Miguel de Icaza <miguel@ximian.com>
10092 * class.cs (Event.Define): Change my previous commit, as this
10093 breaks the debugger. This is a temporary hack, as it seems like
10094 the compiler is generating events incorrectly to begin with.
10096 * expression.cs (Binary.ResolveOperator): Added support for
10097 "U operator - (E x, E y)"
10099 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
10102 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
10103 init-only variables, but this path did not take into account that
10104 there might be also instance readonly variables. Correct this
10107 This fixes bug 32253
10109 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
10112 * driver.cs: Change the extension for modules to `netmodule'
10114 * cs-parser.jay: Improved slightly the location tracking for
10115 the debugger symbols.
10117 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
10118 modifiers that were specified instead of the hardcoded value
10119 (FamAndAssem). This was basically ignoring the static modifier,
10120 and others. Fixes 32429.
10122 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
10123 fixed a bug in the process (32476)
10125 * expression.cs (ArrayAccess.EmitAssign): Patch from
10126 hwang_rob@yahoo.ca that fixes bug 31834.3
10128 2002-10-18 Miguel de Icaza <miguel@ximian.com>
10130 * driver.cs: Make the module extension .netmodule.
10132 2002-10-16 Miguel de Icaza <miguel@ximian.com>
10134 * driver.cs: Report an error if the resource file is not found
10135 instead of crashing.
10137 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
10138 false, like Emit does.
10140 2002-10-16 Nick Drochak <ndrochak@gol.com>
10142 * typemanager.cs: Remove unused private member. Also reported mcs
10143 bug to report this as a warning like csc.
10145 2002-10-15 Martin Baulig <martin@gnome.org>
10147 * statement.cs (Statement.Emit): Made this a virtual method; emits
10148 the line number info and calls DoEmit().
10149 (Statement.DoEmit): New protected abstract method, formerly knows
10150 as Statement.Emit().
10152 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
10154 2002-10-11 Miguel de Icaza <miguel@ximian.com>
10156 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
10157 have fixed a remaining problem: not every AddXXXX was adding a
10158 fully qualified name.
10160 Now everyone registers a fully qualified name in the DeclSpace as
10161 being defined instead of the partial name.
10163 Downsides: we are slower than we need to be due to the excess
10164 copies and the names being registered this way.
10166 The reason for this is that we currently depend (on the corlib
10167 bootstrap for instance) that types are fully qualified, because
10168 we dump all the types in the namespace, and we should really have
10169 types inserted into the proper namespace, so we can only store the
10170 basenames in the defined_names array.
10172 2002-10-10 Martin Baulig <martin@gnome.org>
10174 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
10175 from bug #31834, see the bug report for a testcase which is
10178 2002-10-10 Martin Baulig <martin@gnome.org>
10180 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
10181 flow analysis code for this.
10183 * statement.cs (Do, While, For): Tell the flow analysis code about
10185 (FlowBranching.UsageVector): Added support for infinite loops.
10186 (Block.Resolve): Moved the dead code elimination here and use flow
10189 2002-10-09 Miguel de Icaza <miguel@ximian.com>
10191 * class.cs (Field.Define): Catch cycles on struct type
10194 * typemanager.cs (IsUnmanagedtype): Do not recursively check
10195 fields if the fields are static. We only need to check instance
10198 * expression.cs (As.DoResolve): Test for reference type.
10200 * statement.cs (Using.ResolveExpression): Use
10201 ConvertImplicitRequired, not ConvertImplicit which reports an
10203 (Using.ResolveLocalVariableDecls): ditto.
10205 * expression.cs (Binary.ResolveOperator): Report errors in a few
10206 places where we had to.
10208 * typemanager.cs (IsUnmanagedtype): Finish implementation.
10210 2002-10-08 Miguel de Icaza <miguel@ximian.com>
10212 * expression.cs: Use StoreFromPtr instead of extracting the type
10213 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
10215 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
10216 an enumeration value to a System.Enum, but System.Enum is not a
10217 value type, but an class type, so we need to box.
10219 (Expression.ConvertExplicit): One codepath could return
10220 errors but not flag them. Fix this. Fixes #31853
10222 * parameter.cs (Resolve): Do not allow void as a parameter type.
10224 2002-10-06 Martin Baulig <martin@gnome.org>
10226 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
10227 if it's a class type and not a struct. Fixes #31815.
10229 2002-10-06 Martin Baulig <martin@gnome.org>
10231 * statement.cs: Reworked the flow analysis code a bit to make it
10232 usable for dead code elimination.
10234 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10236 * cs-parser.jay: allow empty source files. Fixes bug #31781.
10238 2002-10-04 Miguel de Icaza <miguel@ximian.com>
10240 * expression.cs (ComposedCast.DoResolveType): A quick workaround
10241 to fix the test 165, will investigate deeper.
10243 2002-10-04 Martin Baulig <martin@gnome.org>
10245 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
10246 finally blocks actually work.
10247 (Try.Resolve): We don't need to create a sibling for `finally' if
10248 there is no finally block.
10250 2002-10-04 Martin Baulig <martin@gnome.org>
10252 * class.cs (Constructor.Define): The default accessibility for a
10253 non-default constructor is private, not public.
10255 2002-10-04 Miguel de Icaza <miguel@ximian.com>
10257 * class.cs (Constructor): Make AllowedModifiers public, add
10260 * cs-parser.jay: Perform the modifiers test here, as the
10261 constructor for the Constructor class usually receives a zero
10262 because of the way we create it (first we create, later we
10263 customize, and we were never checking the modifiers).
10265 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
10266 is a version of LookupTypeReflection that includes the type-name
10267 cache. This can be used as a fast path for functions that know
10268 the fully qualified name and are only calling into *.GetType() to
10269 obtain a composed type.
10271 This is also used by TypeManager.LookupType during its type
10274 (LookupType): We now also track the real type name, as sometimes
10275 we can get a quey for the real type name from things like
10276 ComposedCast. This fixes bug 31422.
10278 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
10279 complete type fullname, it does not have to go through the type
10280 resolution system to obtain the composed version of the type (for
10281 obtaining arrays or pointers).
10283 (Conditional.Emit): Use the EmitBoolExpression to
10284 generate nicer code, as requested by Paolo.
10286 (ArrayCreation.CheckIndices): Use the patch from
10287 hwang_rob@yahoo.ca to validate the array initializers.
10289 2002-10-03 Miguel de Icaza <miguel@ximian.com>
10291 * class.cs (ConstructorInitializer.Emit): simplify code by using
10292 Invocation.EmitCall, and at the same time, fix the bugs in calling
10293 parent constructors that took variable arguments.
10295 * ecore.cs (Expression.ConvertNumericExplicit,
10296 Expression.ImplicitNumericConversion): Remove the code that
10297 manually wrapped decimal (InternalTypeConstructor call is now gone
10300 * expression.cs (Cast.TryReduce): Also handle decimal types when
10301 trying to perform a constant fold on the type.
10303 * typemanager.cs (IsUnmanagedtype): Partially implemented.
10305 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
10306 that only turned off an error report, and did nothing else.
10308 2002-10-02 Miguel de Icaza <miguel@ximian.com>
10310 * driver.cs: Handle and ignore /fullpaths
10312 2002-10-01 Miguel de Icaza <miguel@ximian.com>
10314 * expression.cs (Binary.ResolveOperator): Catch the case where
10315 DoNumericPromotions returns true,
10317 (Binary.DoNumericPromotions): Simplify the code, and the tests.
10319 2002-09-27 Miguel de Icaza <miguel@ximian.com>
10321 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
10324 2002-09-26 Miguel de Icaza <miguel@ximian.com>
10326 * ecore.cs (ConvertNumericExplicit): It is not enough that the
10327 conversion exists, but it is also required that the conversion be
10328 performed. This manifested in "(Type64Enum) 2".
10330 * class.cs (TypeManager.AddMethod): The fix is not to change
10331 AddEnum, because that one was using a fully qualified name (every
10332 DeclSpace derivative does), but to change the AddMethod routine
10333 that was using an un-namespaced name. This now correctly reports
10334 the duplicated name.
10336 Revert patch until I can properly fix it. The issue
10337 is that we have a shared Type space across all namespaces
10338 currently, which is wrong.
10340 Options include making the Namespace a DeclSpace, and merge
10341 current_namespace/current_container in the parser.
10343 2002-09-25 Miguel de Icaza <miguel@ximian.com>
10345 * cs-parser.jay: Improve error reporting when we get a different
10346 kind of expression in local_variable_type and
10347 local_variable_pointer_type.
10349 Propagate this to avoid missleading errors being reported.
10351 * ecore.cs (ImplicitReferenceConversion): treat
10352 TypeManager.value_type as a target just like object_type. As
10357 Is valid, and needs to result in the int 1 being boxed before it
10358 is assigned to the value type v.
10360 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
10361 to validate the enumeration name.
10363 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
10364 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
10365 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
10367 * ecore.cs (TryImplicitIntConversion): When doing an
10368 implicit-enumeration-conversion, check if the type is 64-bits and
10369 perform a conversion before passing to EnumConstant.
10371 2002-09-23 Miguel de Icaza <miguel@ximian.com>
10373 * decl.cs (Error_AmbiguousTypeReference); New routine used to
10374 report ambiguous type references. Unlike the MS version, we
10375 report what the ambiguity is. Innovation at work ;-)
10377 (DeclSpace.FindType): Require a location argument to
10378 display when we display an ambiguous error.
10380 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
10382 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
10384 * expression.cs (EmitDynamicInitializers): Apply patch from
10385 hwang_rob@yahoo.ca that fixes the order in which we emit our
10388 2002-09-21 Martin Baulig <martin@gnome.org>
10390 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
10391 delegate takes no arguments.
10393 2002-09-20 Miguel de Icaza <miguel@ximian.com>
10395 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
10398 * expression.cs: Extract the underlying type.
10400 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
10402 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
10404 2002-09-19 Miguel de Icaza <miguel@ximian.com>
10406 * class.cs (TypeContainer.DefineType): We can not use the nice
10407 PackingSize with the size set to 1 DefineType method, because it
10408 will not allow us to define the interfaces that the struct
10411 This completes the fixing of bug 27287
10413 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
10414 means also structs. This fixes part of the problem.
10415 (Expresion.ImplicitReferenceConversionExists): ditto.
10417 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
10418 error if there were no errors reported during the type lookup
10419 process, to avoid duplicates or redundant errors. Without this
10420 you would get an ambiguous errors plus a type not found. We have
10421 beaten the user enough with the first error.
10423 (DeclSparce.FindType): Emit a warning if we have an ambiguous
10426 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
10427 during the resolution process, stop the lookup, this avoids
10428 repeated error reports (same error twice).
10430 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
10432 * typemanager.cs (LookupType): Redo the type lookup code to match
10433 the needs of System.Reflection.
10435 The issue is that System.Reflection requires references to nested
10436 types to begin with a "+" sign instead of a dot. So toplevel
10437 types look like: "NameSpace.TopLevelClass", and nested ones look
10438 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
10441 2002-09-19 Martin Baulig <martin@gnome.org>
10443 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
10444 says that a method always returns or always throws an exception,
10445 don't report the CS0161.
10447 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
10448 set `Returns = new_returns'.
10450 2002-09-19 Martin Baulig <martin@gnome.org>
10452 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
10453 to an enum constant, check for a CS0176.
10455 2002-09-18 Miguel de Icaza <miguel@ximian.com>
10457 * class.cs (TypeContainer.CheckPairedOperators): Now we check
10458 for operators that must be in pairs and report errors.
10460 * ecore.cs (SimpleName.DoResolveType): During the initial type
10461 resolution process, when we define types recursively, we must
10462 check first for types in our current scope before we perform
10463 lookups in the enclosing scopes.
10465 * expression.cs (MakeByteBlob): Handle Decimal blobs.
10467 (Invocation.VerifyArgumentsCompat): Call
10468 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
10469 I thought we were supposed to always call this, but there are a
10470 few places in the code where we dont do it.
10472 2002-09-17 Miguel de Icaza <miguel@ximian.com>
10474 * driver.cs: Add support in -linkres and -resource to specify the
10475 name of the identifier.
10477 2002-09-16 Miguel de Icaza <miguel@ximian.com>
10479 * ecore.cs (StandardConversionExists): Sync with the conversion
10480 code: allow anything-* to void* conversions.
10482 (FindMostSpecificSource): Use an Expression argument
10483 instead of a Type, because we might be handed over a Literal which
10484 gets a few more implicit conversions that plain types do not. So
10485 this information was being lost.
10487 Also, we drop the temporary type-holder expression when not
10490 2002-09-17 Martin Baulig <martin@gnome.org>
10492 * class.cs (PropertyBase.CheckBase): Don't check the base class if
10493 this is an explicit interface implementation.
10495 2002-09-17 Martin Baulig <martin@gnome.org>
10497 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
10498 different `IndexerName' attributes.
10500 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
10501 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
10502 virtual CommonResolve().
10504 2002-09-16 Miguel de Icaza <miguel@ximian.com>
10506 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
10507 and convert that to the UnderlyingType.
10509 * statement.cs (Foreach.Resolve): Indexers are just like variables
10510 or PropertyAccesses.
10512 * cs-tokenizer.cs (consume_string): Track line numbers and columns
10513 inside quoted strings, we were not doing this before.
10515 2002-09-16 Martin Baulig <martin@gnome.org>
10517 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
10518 resolve it. This is needed for the definite assignment check of the
10519 instance expression, fixes bug #29846.
10520 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
10522 2002-09-16 Nick Drochak <ndrochak@gol.com>
10524 * parameter.cs: Fix compile error. Cannot reference static member
10525 from an instance object. Is this an mcs bug?
10527 2002-09-14 Martin Baulig <martin@gnome.org>
10529 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
10530 multiple times. Fixes bug #30295, added test-166.cs.
10532 2002-09-14 Martin Baulig <martin@gnome.org>
10534 * statement.cs (Block.Emit): Don't emit unreachable code.
10535 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
10536 `break' statements.
10537 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
10539 2002-09-14 Martin Baulig <martin@gnome.org>
10541 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
10544 2002-09-14 Martin Baulig <martin@gnome.org>
10546 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
10547 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
10548 be false on the ms runtime.
10550 2002-09-13 Martin Baulig <martin@gnome.org>
10552 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
10553 the CS0038 error message.
10555 2002-09-12 Miguel de Icaza <miguel@ximian.com>
10557 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
10558 constant inside, return it.
10560 2002-09-12 Martin Baulig <martin@gnome.org>
10562 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
10563 implicit conversion can be done between enum types.
10565 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
10566 check whether an implicit conversion to the current enum's UnderlyingType
10567 exists and report an error if not.
10569 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
10570 without debugging support.
10572 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
10573 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
10575 2002-09-12 Martin Baulig <martin@gnome.org>
10577 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
10579 * ecore.cs (IMemberExpr.DeclaringType): New property.
10580 (SimpleName.SimpleNameResolve): Check whether we're accessing a
10581 nonstatic member of an outer type (CS0038).
10583 2002-09-11 Miguel de Icaza <miguel@ximian.com>
10585 * driver.cs: Activate the using-error detector at warning level
10586 4 (at least for MS-compatible APIs).
10588 * namespace.cs (VerifyUsing): Small buglett fix.
10590 * pending.cs (PendingImplementation): pass the container pointer.
10592 * interface.cs (GetMethods): Allow for recursive definition. Long
10593 term, I would like to move every type to support recursive
10594 definitions, not the current ordering mechanism that we have right
10597 The situation is this: Attributes are handled before interfaces,
10598 so we can apply attributes to interfaces. But some attributes
10599 implement interfaces, we will now handle the simple cases
10600 (recursive definitions will just get an error).
10602 * parameter.cs: Only invalidate types at the end if we fail to
10605 2002-09-09 Martin Baulig <martin@gnome.org>
10607 * ecore.cs (PropertyExpr.Emit): Also check for
10608 TypeManager.system_int_array_get_length so this'll also work when
10609 compiling corlib. Fixes #30003.
10611 2002-09-09 Martin Baulig <martin@gnome.org>
10613 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
10614 and throw an exception if we can't get the type's size. Fixed #30040,
10617 2002-09-09 Martin Baulig <martin@gnome.org>
10619 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
10621 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
10622 context. Fixes bug #30027.
10624 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
10625 virtual functions. Fixes bug #30043, added test-164.cs.
10627 2002-09-08 Ravi Pratap <ravi@ximian.com>
10629 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
10631 2002-09-08 Nick Drochak <ndrochak@gol.com>
10633 * driver.cs: Use an object to get the windows codepage since it's not a
10636 2002-09-08 Miguel de Icaza <miguel@ximian.com>
10638 * statement.cs (For.Emit): for infinite loops (test == null)
10639 return whether there is a break inside, not always "true".
10641 * namespace.cs (UsingEntry): New struct to hold the name of the
10642 using definition, the location where it is defined, and whether it
10643 has been used in a successful type lookup.
10645 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
10650 2002-09-06 Ravi Pratap <ravi@ximian.com>
10652 * attribute.cs : Fix incorrect code which relied on catching
10653 a NullReferenceException to detect a null being passed in
10654 where an object was expected.
10656 2002-09-06 Miguel de Icaza <miguel@ximian.com>
10658 * statement.cs (Try): flag the catch variable as assigned
10660 * expression.cs (Cast): Simplified by using ResolveType instead of
10661 manually resolving.
10663 * statement.cs (Catch): Fix bug by using ResolveType.
10665 2002-09-06 Ravi Pratap <ravi@ximian.com>
10667 * expression.cs (BetterConversion): Special case for when we have
10668 a NullLiteral as the argument and we have to choose between string
10669 and object types - we choose string the way csc does.
10671 * attribute.cs (Attribute.Resolve): Catch the
10672 NullReferenceException and report error #182 since the Mono
10673 runtime no more has the bug and having this exception raised means
10674 we tried to select a constructor which takes an object and is
10677 2002-09-05 Ravi Pratap <ravi@ximian.com>
10679 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
10680 message (1502, 1503) when we can't locate a method after overload
10681 resolution. This is much more informative and closes the bug
10684 * interface.cs (PopulateMethod): Return if there are no argument
10685 types. Fixes a NullReferenceException bug.
10687 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
10688 expressions too. Previously we were checking only in one place for
10689 positional arguments leaving out named arguments.
10691 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
10692 type to the enum type is not allowed. Remove code corresponding to
10695 (ConvertNumericExplicit): Allow explicit conversions from
10696 the underlying type to enum type. This precisely follows the spec
10697 and closes a bug filed by Gonzalo.
10699 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10702 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
10704 2002-09-03 Miguel de Icaza <miguel@ximian.com>
10706 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
10707 it was important that we stored the right value after the
10708 reduction in `converted'.
10710 2002-09-04 Martin Baulig <martin@gnome.org>
10712 * location.cs (Location.SymbolDocument): Use full pathnames for the
10715 2002-08-30 Miguel de Icaza <miguel@ximian.com>
10717 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
10718 of the expression resolve mechanism, because that will catch the
10719 SimpleName error failures.
10721 (Conditional): If we can not resolve the
10722 expression, return, do not crash.
10724 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10727 (location): display token name instead of its number.
10729 2002-08-28 Martin Baulig <martin@gnome.org>
10731 * expression.cs (Binary.ResolveOperator): Don't silently return
10732 but return an error if an operator cannot be applied between two
10735 2002-08-28 Martin Baulig <martin@gnome.org>
10737 * class.cs (Constructor.Define): Set the permission attributes
10738 correctly instead of making all constructors public.
10740 2002-08-28 Martin Baulig <martin@gnome.org>
10742 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
10743 for private members before reporting a CS0103; if we find anything,
10746 2002-08-28 Martin Baulig <martin@gnome.org>
10748 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
10749 to check whether `closure_start_type == closure_invocation_type',
10750 we also need to check whether `m.DeclaringType == closure_invocation_type'
10751 before bypassing the permission checks. We might be accessing
10752 protected/private members from the base class.
10753 (TypeManager.RealMemberLookup): Only set private_ok if private
10754 members were requested via BindingFlags.NonPublic.
10756 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
10758 * expression.cs (MemberAccess.ResolveMemberAccess): Set
10759 MethodGroupExpr.IsExplicitImpl if appropriate.
10760 (Invocation.DoResolve): Don't report the CS0120 for explicit
10761 interface implementations.
10763 2002-08-27 Martin Baulig <martin@gnome.org>
10765 * expression.cs (Invocation.DoResolve): If this is a static
10766 method and we don't have an InstanceExpression, we must report
10769 2002-08-25 Martin Baulig <martin@gnome.org>
10771 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
10772 `==' between a valuetype and an object.
10774 2002-08-25 Miguel de Icaza <miguel@ximian.com>
10776 * ecore.cs (TypeExpr): Provide a ToString method.
10778 2002-08-24 Martin Baulig <martin@gnome.org>
10780 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
10781 now called proggie.dbg and it's a binary file.
10783 2002-08-23 Martin Baulig <martin@gnome.org>
10785 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
10787 2002-08-23 Martin Baulig <martin@gnome.org>
10789 * struct.cs (MyStructInfo.ctor): Make this work with empty
10790 structs; it's not allowed to use foreach() on null.
10792 2002-08-23 Martin Baulig <martin@gnome.org>
10794 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
10795 writer the full pathname of the generated assembly.
10797 2002-08-23 Martin Baulig <martin@gnome.org>
10799 * statements.cs (FlowBranching.UsageVector.MergeChildren):
10800 A `finally' block never returns or breaks; improved handling of
10803 2002-08-23 Martin Baulig <martin@gnome.org>
10805 * statement.cs (Throw.Resolve): Allow `throw null'.
10807 2002-08-23 Martin Baulig <martin@gnome.org>
10809 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
10810 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
10811 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
10812 MemberLookup would return a wrong event if this is an explicit
10813 interface implementation and the class has an event with the same
10816 2002-08-23 Martin Baulig <martin@gnome.org>
10818 * statement.cs (Block.AddChildVariableNames): New public method.
10819 (Block.AddChildVariableName): Likewise.
10820 (Block.IsVariableNameUsedInChildBlock): Likewise.
10821 (Block.AddVariable): Check whether a variable name has already
10822 been used in a child block.
10824 * cs-parser.jay (declare_local_variables): Mark all variable names
10825 from the current block as being used in a child block in the
10828 2002-08-23 Martin Baulig <martin@gnome.org>
10830 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
10831 find the symbol writer.
10833 * driver.cs: csc also allows the arguments to /define being
10834 separated by commas, not only by semicolons.
10836 2002-08-23 Martin Baulig <martin@gnome.org>
10838 * interface.cs (Interface.GetMembers): Added static check for events.
10840 2002-08-15 Martin Baulig <martin@gnome.org>
10842 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
10843 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
10845 * ecore.cs (Expression.MemberLookup): Added documentation and explained
10846 why the MethodData.EmitDestructor() change was necessary.
10848 2002-08-20 Martin Baulig <martin@gnome.org>
10850 * class.cs (TypeContainer.FindMembers): Added static check for events.
10852 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
10854 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
10855 use Type.GetEvents(), not Type.FindMembers().
10857 2002-08-20 Martin Baulig <martin@gnome.org>
10859 * decl.cs (MemberCache): Added a special method cache which will
10860 be used for method-only searched. This ensures that a method
10861 search will return a MethodInfo with the correct ReflectedType for
10864 2002-08-20 Martin Baulig <martin@gnome.org>
10866 * decl.cs (DeclSpace.FindMembers): Made this public.
10868 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10870 * delegate.cs: fixed build on windows.
10871 [FIXME: Filed as bug #29150: MCS must report these errors.]
10873 2002-08-19 Ravi Pratap <ravi@ximian.com>
10875 * ecore.cs (StandardConversionExists): Return a false
10876 if we are trying to convert the void type to anything else
10877 since that is not allowed.
10879 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
10880 we flag error 70 in the event an event is trying to be accessed
10881 directly from outside the declaring type.
10883 2002-08-20 Martin Baulig <martin@gnome.org>
10885 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
10886 MemberCache from typemanager.cs to decl.cs.
10888 2002-08-19 Martin Baulig <martin@gnome.org>
10890 * class.cs (TypeContainer): Implement IMemberContainer.
10891 (TypeContainer.DefineMembers): Create the MemberCache.
10892 (TypeContainer.FindMembers): Do better BindingFlags checking; only
10893 return public members if BindingFlags.Public was given, check
10894 whether members are static.
10896 2002-08-16 Martin Baulig <martin@gnome.org>
10898 * decl.cs (DeclSpace.Define): Splitted this in Define and
10899 DefineMembers. DefineMembers is called first and initializes the
10902 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
10903 DefineMembers() on all our DeclSpaces.
10905 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
10906 but call DefineMembers() on all nested interfaces. We call their
10907 Define() in our new Define() function.
10909 * interface.cs (Interface): Implement IMemberContainer.
10910 (Interface.Define): Moved all code except the attribute stuf to
10912 (Interface.DefineMembers): Initialize the member cache.
10914 * typemanager.cs (IMemberFinder): Removed this interface, we don't
10915 need this anymore since we can use MemberCache.FindMembers directly.
10917 2002-08-19 Martin Baulig <martin@gnome.org>
10919 * typemanager.cs (MemberCache): When creating the cache for an
10920 interface type, add all inherited members.
10921 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
10922 to `out bool used_cache' and documented it.
10923 (TypeManager.MemberLookup): If we already used the cache in the first
10924 iteration, we don't need to do the interfaces check.
10926 2002-08-19 Martin Baulig <martin@gnome.org>
10928 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
10929 here from IMemberFinder and don't implement this interface anymore.
10930 (DeclSpace.MemberCache): Moved here from IMemberFinder.
10932 * typemanager.cs (IMemberFinder): This interface is now only used by
10933 classes which actually support the member cache.
10934 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
10935 since we only put DeclSpaces into this Hashtable.
10936 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
10937 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
10939 2002-08-16 Martin Baulig <martin@gnome.org>
10941 * typemanager.cs (ICachingMemberFinder): Removed.
10942 (IMemberFinder.MemberCache): New property.
10943 (TypeManager.FindMembers): Merged this with RealFindMembers().
10944 This function will never be called from TypeManager.MemberLookup()
10945 so we can't use the cache here, just the IMemberFinder.
10946 (TypeManager.MemberLookup_FindMembers): Check whether the
10947 IMemberFinder has a MemberCache and call the cache's FindMembers
10949 (MemberCache): Rewrote larger parts of this yet another time and
10950 cleaned it up a bit.
10952 2002-08-15 Miguel de Icaza <miguel@ximian.com>
10954 * driver.cs (LoadArgs): Support quoting.
10956 (Usage): Show the CSC-like command line arguments.
10958 Improved a few error messages.
10960 2002-08-15 Martin Baulig <martin@gnome.org>
10962 * typemanager.cs (IMemberContainer.Type): New property.
10963 (IMemberContainer.IsInterface): New property.
10965 The following changes are conditional to BROKEN_RUNTIME, which is
10966 defined at the top of the file.
10968 * typemanager.cs (MemberCache.MemberCache): Don't add the base
10969 class'es members, but add all members from TypeHandle.ObjectType
10970 if we're an interface.
10971 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
10972 is the current type.
10973 (MemberCache.CacheEntry.Container): Removed this field.
10974 (TypeHandle.GetMembers): Include inherited members.
10976 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10978 * typemanager.cs: fixed compilation and added a comment on a field that
10981 2002-08-15 Martin Baulig <martin@gnome.org>
10983 * class.cs (ConstructorInitializer.Resolve): In the
10984 Expression.MemberLookup call, use the queried_type as
10987 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
10988 declared' attribute, it's always true.
10989 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
10990 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
10991 temporary wrapper for FindMembers which tells MemberLookup whether
10992 members from the base classes are included in the return value.
10993 This will go away soon.
10994 (TypeManager.MemberLookup): Use this temporary hack here; once the
10995 new MemberCache is completed, we don't need to do the DeclaredOnly
10996 looping here anymore since the MemberCache will take care of this.
10997 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
10998 (MemberCache): When creating the MemberCache for a class, get
10999 members from the current class and all its base classes.
11000 (MemberCache.CacheEntry.Container): New field. This is a
11001 temporary hack until the Mono runtime is fixed to distinguish
11002 between ReflectedType and DeclaringType. It allows us to use MCS
11003 with both the MS runtime and the unfixed Mono runtime without
11004 problems and without accecting performance.
11005 (MemberCache.SearchMembers): The DeclaredOnly looping from
11006 TypeManager.MemberLookup is now done here.
11008 2002-08-14 Martin Baulig <martin@gnome.org>
11010 * statement.cs (MyStructInfo.MyStructInfo): Don't call
11011 Type.GetFields on dynamic types but get the fields from the
11012 corresponding TypeContainer.
11013 (MyStructInfo.GetStructInfo): Added check for enum types.
11015 * typemanager.cs (MemberList.IsSynchronized): Implemented.
11016 (MemberList.SyncRoot): Implemented.
11017 (TypeManager.FilterWithClosure): No need to check permissions if
11018 closure_start_type == closure_invocation_type, don't crash if
11019 closure_invocation_type is null.
11021 2002-08-13 Martin Baulig <martin@gnome.org>
11023 Rewrote TypeContainer.FindMembers to use a member cache. This
11024 gives us a speed increase of about 35% for the self-hosting MCS
11025 build and of about 15-20% for the class libs (both on GNU/Linux).
11027 * report.cs (Timer): New class to get enhanced profiling. This
11028 whole class is "TIMER" conditional since it remarkably slows down
11031 * class.cs (MemberList): New class. This is an IList wrapper
11032 which we're now using instead of passing MemberInfo[]'s around to
11033 avoid copying this array unnecessarily.
11034 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
11035 (ICachingMemberFinder, IMemberContainer): New interface.
11036 (TypeManager.FilterWithClosure): If `criteria' is null, the name
11037 has already been checked, otherwise use it for the name comparision.
11038 (TypeManager.FindMembers): Renamed to RealMemberFinder and
11039 provided wrapper which tries to use ICachingMemberFinder.FindMembers
11040 if possible. Returns a MemberList, not a MemberInfo [].
11041 (TypeHandle): New class, implements IMemberContainer. We create
11042 one instance of this class per type, it contains a MemberCache
11043 which is used to do the member lookups.
11044 (MemberCache): New class. Each instance of this class contains
11045 all members of a type and a name-based hash table.
11046 (MemberCache.FindMembers): This is our new member lookup
11047 function. First, it looks up all members of the requested name in
11048 the hash table. Then, it walks this list and sorts out all
11049 applicable members and returns them.
11051 2002-08-13 Martin Baulig <martin@gnome.org>
11053 In addition to a nice code cleanup, this gives us a performance
11054 increase of about 1.4% on GNU/Linux - not much, but it's already
11055 half a second for the self-hosting MCS compilation.
11057 * typemanager.cs (IMemberFinder): New interface. It is used by
11058 TypeManager.FindMembers to call FindMembers on a TypeContainer,
11059 Enum, Delegate or Interface.
11060 (TypeManager.finder_to_member_finder): New PtrHashtable.
11061 (TypeManager.finder_to_container): Removed.
11062 (TypeManager.finder_to_delegate): Removed.
11063 (TypeManager.finder_to_interface): Removed.
11064 (TypeManager.finder_to_enum): Removed.
11066 * interface.cs (Interface): Implement IMemberFinder.
11068 * delegate.cs (Delegate): Implement IMemberFinder.
11070 * enum.cs (Enum): Implement IMemberFinder.
11072 * class.cs (TypeContainer): Implement IMemberFinder.
11074 2002-08-12 Martin Baulig <martin@gnome.org>
11076 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
11078 2002-08-12 Martin Baulig <martin@gnome.org>
11080 * ecore.cs (ITypeExpression): New interface for expressions which
11082 (TypeExpression): Renamed to TypeLookupExpression.
11083 (Expression.DoResolve): If we're doing a types-only lookup, the
11084 expression must implement the ITypeExpression interface and we
11085 call DoResolveType() on it.
11086 (SimpleName): Implement the new ITypeExpression interface.
11087 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
11088 hack, the situation that we're only looking up types can't happen
11089 anymore when this method is called. Moved the type lookup code to
11090 DoResolveType() and call it.
11091 (SimpleName.DoResolveType): This ITypeExpression interface method
11092 is now doing the types-only lookup.
11093 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
11094 (ResolveFlags): Added MaskExprClass.
11096 * expression.cs (MemberAccess): Implement the ITypeExpression
11098 (MemberAccess.DoResolve): Added support for a types-only lookup
11099 when we're called via ITypeExpression.DoResolveType().
11100 (ComposedCast): Implement the ITypeExpression interface.
11102 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
11103 Expression.Resolve() with ResolveFlags.Type instead.
11105 2002-08-12 Martin Baulig <martin@gnome.org>
11107 * interface.cs (Interface.Define): Apply attributes.
11109 * attribute.cs (Attribute.ApplyAttributes): Added support for
11110 interface attributes.
11112 2002-08-11 Martin Baulig <martin@gnome.org>
11114 * statement.cs (Block.Emit): Only check the "this" variable if we
11115 do not always throw an exception.
11117 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
11118 whether the property has a set accessor.
11120 2002-08-11 Martin Baulig <martin@gnome.org>
11122 Added control flow analysis support for structs.
11124 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
11125 with control flow analysis turned off.
11126 (IVariable): New interface.
11127 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
11128 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
11129 (FieldExpr.DoResolve): Resolve the instance expression with flow
11130 analysis turned off and do the definite assignment check after the
11131 resolving when we know what the expression will resolve to.
11133 * expression.cs (LocalVariableReference, ParameterReference):
11134 Implement the new IVariable interface, only call the flow analysis
11135 code if ec.DoFlowAnalysis is true.
11136 (This): Added constructor which takes a Block argument. Implement
11137 the new IVariable interface.
11138 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
11139 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
11140 This does the definite assignment checks for struct members.
11142 * class.cs (Constructor.Emit): If this is a non-static `struct'
11143 constructor which doesn't have any initializer, call
11144 Block.AddThisVariable() to tell the flow analysis code that all
11145 struct elements must be initialized before control returns from
11148 * statement.cs (MyStructInfo): New public class.
11149 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
11150 argument to this indexer. If non-zero, check an individual struct
11151 member, not the whole struct.
11152 (FlowBranching.CheckOutParameters): Check struct members.
11153 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
11154 overloaded versions of these methods which take an additional
11155 `int field_idx' argument to check struct members.
11156 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
11157 overloaded versions of these methods which take an additional
11158 `string field_name' argument to check struct member.s
11159 (VariableInfo): Implement the IVariable interface.
11160 (VariableInfo.StructInfo): New public property. Returns the
11161 MyStructInfo instance of the variable if it's a struct or null.
11162 (Block.AddThisVariable): New public method. This is called from
11163 Constructor.Emit() for non-static `struct' constructor which do
11164 not have any initializer. It creates a special variable for the
11165 "this" instance variable which will be checked by the flow
11166 analysis code to ensure that all of the struct's fields are
11167 initialized before control returns from the constructor.
11168 (UsageVector): Added support for struct members. If a
11169 variable/parameter is a struct with N members, we reserve a slot
11170 in the usage vector for each member. A struct is considered fully
11171 initialized if either the struct itself (slot 0) or all its
11172 members are initialized.
11174 2002-08-08 Martin Baulig <martin@gnome.org>
11176 * driver.cs (Driver.MainDriver): Only report an error CS5001
11177 if there were no compilation errors.
11179 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
11180 `UnsafeContext' property to determine whether the parent is in
11181 unsafe context rather than checking the parent's ModFlags:
11182 classes nested in an unsafe class are unsafe as well.
11184 2002-08-08 Martin Baulig <martin@gnome.org>
11186 * statement.cs (UsageVector.MergeChildren): Distinguish between
11187 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
11188 we return. Added test17() and test18() to test-154.cs.
11190 2002-08-08 Martin Baulig <martin@gnome.org>
11192 * typemanager.cs (TypeManager.FilterWithClosure): If we have
11193 Family access, make sure the invoking type isn't a subclass of the
11194 queried type (that'd be a CS1540).
11196 * ecore.cs (Expression.MemberLookup): Added overloaded version of
11197 this method which takes an additional `Type invocation_type'.
11199 * expression.cs (BaseAccess.DoResolve): Use the base type as
11200 invocation and query type.
11201 (MemberAccess.DoResolve): If the lookup failed and we're about to
11202 report a CS0122, try a lookup with the ec.ContainerType - if this
11203 succeeds, we must report a CS1540.
11205 2002-08-08 Martin Baulig <martin@gnome.org>
11207 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
11208 (MethodGroupExpr): Implement the IMemberExpr interface.
11210 * expression (MemberAccess.ResolveMemberAccess): No need to have
11211 any special code for MethodGroupExprs anymore, they're now
11214 2002-08-08 Martin Baulig <martin@gnome.org>
11216 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
11217 Family, FamANDAssem and FamORAssem permissions.
11218 (TypeManager.IsSubclassOrNestedChildOf): New public method.
11220 2002-08-08 Martin Baulig <martin@gnome.org>
11222 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
11223 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
11226 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
11228 * driver.cs: implemented /resource option to embed managed resources.
11230 2002-08-07 Martin Baulig <martin@gnome.org>
11232 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
11233 (FieldBase.HasFieldInitializer): New public property.
11234 (FieldBase.GetInitializerExpression): New public method. Resolves and
11235 returns the field initializer and makes sure it is only resolved once.
11236 (TypeContainer.EmitFieldInitializers): Call
11237 FieldBase.GetInitializerExpression to get the initializer, this ensures
11238 that it isn't resolved multiple times.
11240 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
11241 the resolving process (SimpleName/MemberLookup) that we're currently
11242 emitting a field initializer (which must not access any instance members,
11243 this is an error CS0236).
11245 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
11246 argument, if the `IsFieldInitializer' flag is set, we must report and
11247 error CS0236 and not an error CS0120.
11249 2002-08-07 Martin Baulig <martin@gnome.org>
11251 * ecore.cs (IMemberExpr): New public interface.
11252 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
11253 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
11254 if the expression is an IMemberExpr.
11256 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
11257 to be null, implicitly default to `this' if we're non-static in
11258 this case. Simplified the code a lot by using the new IMemberExpr
11259 interface. Also fixed bug #28176 here.
11261 2002-08-06 Martin Baulig <martin@gnome.org>
11263 * cs-parser.jay (SimpleLookup): Removed. We need to create
11264 ParameterReferences during semantic analysis so that we can do a
11265 type-only search when resolving Cast, TypeOf and SizeOf.
11266 (block): Pass the `current_local_parameters' to the Block's
11269 * class.cs (ConstructorInitializer): Added `Parameters parameters'
11270 argument to the constructor.
11271 (ConstructorInitializer.Resolve): Create a temporary implicit
11272 block with the parameters.
11274 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
11275 references here if we aren't doing a type-only search.
11277 * statement.cs (Block): Added constructor which takes a
11278 `Parameters parameters' argument.
11279 (Block.Parameters): New public property.
11281 * support.cs (InternalParameters.Parameters): Renamed `parameters'
11282 to `Parameters' and made it public readonly.
11284 2002-08-06 Martin Baulig <martin@gnome.org>
11286 * ecore.cs (Expression.Warning): Made this public as well.
11288 * report.cs (Report.Debug): Print the contents of collections.
11290 2002-08-06 Martin Baulig <martin@gnome.org>
11292 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
11293 used to tell Resolve() which kinds of expressions it may return.
11294 (Expression.Resolve): Added overloaded version of this method which
11295 takes a `ResolveFlags flags' argument. This can be used to tell
11296 Resolve() which kinds of expressions it may return. Reports a
11298 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
11299 ResolveFlags.SimpleName.
11300 (Expression.Error118): Added overloaded version of this method which
11301 takes a `ResolveFlags flags' argument. It uses the flags to determine
11302 which kinds of expressions are allowed.
11304 * expression.cs (Argument.ResolveMethodGroup): New public method.
11305 Resolves an argument, but allows a MethodGroup to be returned.
11306 This is used when invoking a delegate.
11308 * TODO: Updated a bit.
11310 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11312 Fixed compilation with csc.
11314 * ecore.cs: Expression.Error made public. Is this correct? Should
11315 Warning be made public too?
11317 * expression.cs: use ea.Location instead of ea.loc.
11318 [FIXME: Filed as bug #28607: MCS must report these errors.]
11320 2002-08-06 Martin Baulig <martin@gnome.org>
11322 * ecore.cs (Expression.loc): Moved the location here instead of
11323 duplicating it in all derived classes.
11324 (Expression.Location): New public property.
11325 (Expression.Error, Expression.Warning): Made them non-static and
11326 removed the location argument.
11327 (Expression.Warning): Added overloaded version which takes an
11328 `int level' argument.
11329 (Expression.Error118): Make this non-static and removed the
11330 expression and location arguments.
11331 (TypeExpr): Added location argument to the constructor.
11333 * expression.cs (StaticCallExpr): Added location argument to
11335 (Indirection, PointerArithmetic): Likewise.
11336 (CheckedExpr, UnCheckedExpr): Likewise.
11337 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
11338 (StringPtr): Likewise.
11341 2002-08-05 Martin Baulig <martin@gnome.org>
11343 * expression.cs (BaseAccess.DoResolve): Actually report errors.
11345 * assign.cs (Assign.DoResolve): Check whether the source
11346 expression is a value or variable.
11348 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
11349 while resolving the corresponding blocks.
11351 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
11352 an error, don't silently return null.
11354 * statement.cs (Block.AddVariable): Do the error reporting here
11355 and distinguish between CS0128 and CS0136.
11356 (Block.DoResolve): Report all unused labels (warning CS0164).
11357 (LabeledStatement): Pass the location to the constructor.
11358 (LabeledStatement.HasBeenReferenced): New property.
11359 (LabeledStatement.Resolve): Set it to true here.
11361 * statement.cs (Return.Emit): Return success even after reporting
11362 a type mismatch error (CS0126 or CS0127), this is what csc does and
11363 it avoids confusing the users with any consecutive errors.
11365 2002-08-05 Martin Baulig <martin@gnome.org>
11367 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
11369 * const.cs (Const.LookupConstantValue): Catch circular definitions.
11371 * expression.cs (MemberAccess.DoResolve): Silently return if an
11372 error has already been reported.
11374 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
11375 error has already been reported.
11377 2002-08-05 Martin Baulig <martin@gnome.org>
11379 * statement.cs (UsageVector): Only initialize the `parameters'
11380 vector if we actually have any "out" parameters.
11382 2002-08-05 Martin Baulig <martin@gnome.org>
11384 * expression.cs (Binary.ResolveOperator): When combining delegates,
11385 they must have the same type.
11387 2002-08-05 Martin Baulig <martin@gnome.org>
11389 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
11390 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
11391 work with the ms runtime and we also don't need it: if we're a
11392 PropertyBuilder and not in the `indexer_arguments' hash, then we
11393 are a property and not an indexer.
11395 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
11396 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
11397 since the latter one doesn't work with the ms runtime.
11399 2002-08-03 Martin Baulig <martin@gnome.org>
11401 Fixed bugs #27998 and #22735.
11403 * class.cs (Method.IsOperator): New public field.
11404 (Method.CheckBase): Report CS0111 if there's already a method
11405 with the same parameters in the current class. Report CS0508 when
11406 attempting to change the return type of an inherited method.
11407 (MethodData.Emit): Report CS0179 if a method doesn't have a body
11408 and it's not marked abstract or extern.
11409 (PropertyBase): New abstract base class for Property and Indexer.
11410 (PropertyBase.CheckBase): Moved here from Property and made it work
11412 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
11413 the same so we can reuse it there.
11414 (Property, Indexer): Derive from PropertyBase.
11415 (MethodSignature.inheritable_property_signature_filter): New delegate
11416 to find properties and indexers.
11418 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
11419 argument and improved error reporting.
11421 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
11422 EmptyReadOnlyParameters and made it a property.
11424 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
11425 version of this method which takes a `PropertyInfo indexer'.
11426 (TypeManager.RegisterIndexer): New method.
11428 * class.cs: Added myself as author of this file :-)
11430 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11432 * class.cs: fixed compilation on windoze.
11434 2002-08-03 Martin Baulig <martin@gnome.org>
11436 * interface.cs (Interface.GetInterfaceBases): Check whether all
11437 base interfaces are at least as accessible than the current one.
11439 * class.cs (TypeContainer.GetClassBases): Check whether base types
11440 are at least as accessible than the current type.
11441 (TypeContainer.AsAccessible): Implemented and made non-static.
11442 (MemberBase.CheckParameters): Report errors if the accessibility
11445 * delegate.cs (Delegate.Delegate): The default visibility is
11446 internal for top-level types and private for nested types.
11447 (Delegate.Define): Report errors if the accessibility checks fail.
11449 * enum.cs (Enum.Enum): The default visibility is internal for
11450 top-level types and private for nested types.
11451 (Enum.DefineType): Compute the correct visibility.
11453 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
11454 function which takes a `bool is_toplevel' instead of a TypeContainer.
11456 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
11459 2002-08-02 Martin Baulig <martin@gnome.org>
11461 * expression.cs (LocalVariableReferenc): Added constructor which
11462 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
11463 (LocalVariableReference.IsReadOnly): New property.
11464 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
11465 variable is readonly, use our own readonly flag to do this; you can
11466 use the new constructor to get a writable reference to a read-only
11469 * cs-parser.jay (foreach_statement, using_statement): Get a writable
11470 reference to the local variable.
11472 2002-08-01 Miguel de Icaza <miguel@ximian.com>
11474 * rootcontext.cs (ResolveCore): Also include System.Exception
11476 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
11477 we reach an EmptyStatement.
11479 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
11482 * expression.cs (Binary.ResolveOperator): Check error result in
11485 use brtrue/brfalse directly and avoid compares to null.
11487 2002-08-02 Martin Baulig <martin@gnome.org>
11489 * class.cs (TypeContainer.Define): Define all nested interfaces here.
11490 Fixes bug #28407, added test-155.cs.
11492 2002-08-01 Martin Baulig <martin@gnome.org>
11494 * class.cs (Event.EmitDefaultMethod): Make this work with static
11495 events. Fixes #28311, added verify-3.cs.
11497 2002-08-01 Martin Baulig <martin@gnome.org>
11499 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
11500 `is_disposable' fields.
11501 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
11502 `hm.is_disposable' if we're using the collection pattern.
11503 (Foreach.EmitCollectionForeach): Use the correct type for the
11504 enumerator's local variable, only emit the try/finally block if
11505 necessary (fixes #27713).
11507 2002-08-01 Martin Baulig <martin@gnome.org>
11509 * ecore.cs (Expression.report118): Renamed to Error118 and made
11512 * statement.cs (Throw.Resolve): Check whether the expression is of
11513 the correct type (CS0118) and whether the type derives from
11514 System.Exception (CS0155).
11515 (Catch.Resolve): New method. Do the type lookup here and check
11516 whether it derives from System.Exception (CS0155).
11517 (Catch.CatchType, Catch.IsGeneral): New public properties.
11519 * typemanager.cs (TypeManager.exception_type): Added.
11521 2002-07-31 Miguel de Icaza <miguel@ximian.com>
11523 * driver.cs: Updated About function.
11525 2002-07-31 Martin Baulig <martin@gnome.org>
11527 Implemented Control Flow Analysis.
11529 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
11530 (EmitContext.CurrentBranching): Added.
11531 (EmitContext.StartFlowBranching): Added.
11532 (EmitContext.EndFlowBranching): Added.
11533 (EmitContext.KillFlowBranching): Added.
11534 (EmitContext.IsVariableAssigned): Added.
11535 (EmitContext.SetVariableAssigned): Added.
11536 (EmitContext.IsParameterAssigned): Added.
11537 (EmitContext.SetParameterAssigned): Added.
11538 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
11539 Added control flow analysis stuff here.
11541 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
11542 resolve the expression as lvalue.
11543 (LocalVariableReference.DoResolve): Check whether the variable has
11544 already been assigned.
11545 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
11546 the parameter as assigned here.
11547 (ParameterReference.DoResolve): Check whether the parameter has already
11549 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
11550 expression as lvalue.
11552 * statement.cs (FlowBranching): New class for the flow analysis code.
11553 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
11554 (LabeledStatement.IsDefined): New public property.
11555 (LabeledStatement.AddUsageVector): New public method to tell flow
11556 analyis that the label may be reached via a forward jump.
11557 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
11559 (VariableInfo.Number): New public field. This is used by flow analysis
11560 to number all locals of a block.
11561 (Block.CountVariables): New public property. This is the number of
11562 local variables in this block (including the locals from all parent
11564 (Block.EmitMeta): Number all the variables.
11566 * statement.cs: Added flow analysis support to all classes.
11568 2002-07-31 Martin Baulig <martin@gnome.org>
11570 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
11571 To get debugging messages, compile mcs with /define:MCS_DEBUG and
11572 then use this argument.
11574 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
11576 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
11577 use this to specify /define options.
11579 2002-07-29 Martin Baulig <martin@gnome.org>
11581 * statement.cs (Fixed): Moved all code that does variable lookups
11582 and resolvings from Emit to Resolve.
11584 * statement.cs (For): Moved all code that does variable lookups
11585 and resolvings from Emit to Resolve.
11587 * statement.cs (Using): Moved all code that does variable lookups
11588 and resolvings from Emit to Resolve.
11590 2002-07-29 Martin Baulig <martin@gnome.org>
11592 * attribute.cs (Attribute.Resolve): Explicitly catch a
11593 System.NullReferenceException when creating the
11594 CustromAttributeBuilder and report a different warning message.
11596 2002-07-29 Martin Baulig <martin@gnome.org>
11598 * support.cs (ParameterData.ParameterName): Added method to
11599 get the name of a parameter.
11601 * typemanager.cs (TypeManager.IsValueType): New public method.
11603 2002-07-29 Martin Baulig <martin@gnome.org>
11605 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
11606 is a flag which specifies that it's either ref or out.
11607 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
11608 the out parameter to `out Parameter.Modifier mod', also set the
11609 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
11611 * support.cs (InternalParameters.ParameterModifier): Distinguish
11612 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
11613 Parameter.Modifier.ISBYREF flag if it's either ref or out.
11615 * expression.cs (Argument.GetParameterModifier): Distinguish
11616 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
11617 Parameter.Modifier.ISBYREF flag if it's either ref or out.
11619 2002-07-29 Martin Baulig <martin@gnome.org>
11621 * expression.cs (ParameterReference.ParameterReference): Added
11622 `Location loc' argument to the constructor.
11624 * cs-parser.jay: Pass location to ParameterReference.
11626 2002-07-28 Miguel de Icaza <miguel@ximian.com>
11628 * statement.cs (Try): Initialize the location.
11630 * cs-parser.jay: pass location to Try.
11632 * expression.cs (Unary.Reduce): Change the prototype to return
11633 whether a constant fold could be performed or not. The result is
11634 returned in an out parameters. In the case of Indirection and
11635 AddressOf, we want to perform the full tests.
11637 2002-07-26 Miguel de Icaza <miguel@ximian.com>
11639 * statement.cs (Statement.Emit): Flag dead code.
11641 2002-07-27 Andrew Birkett <andy@nobugs.org>
11643 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
11645 2002-07-27 Martin Baulig <martin@gnome.org>
11647 * class.cs (MethodData.Define): Put back call to
11648 TypeManager.AddMethod(), accidentally commented this out.
11650 * report.cs (Debug): New public method to print debugging information,
11651 this is `[Conditional ("DEBUG")]'.
11653 2002-07-26 Martin Baulig <martin@gnome.org>
11655 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
11656 (switch_statement): Push the current_block to the switch_stack and
11657 pop it again when we're done with the switch.
11658 (switch_section): The new block is a child of the current_block.
11659 Fixes bug #24007, added test-152.cs.
11661 2002-07-27 Martin Baulig <martin@gnome.org>
11663 * expression.cs (Invocation.EmitArguments): When calling a varargs
11664 function with only its fixed arguments, we need to pass an empty
11667 2002-07-27 Martin Baulig <martin@gnome.org>
11669 Mono 0.13 has been released.
11671 2002-07-25 Miguel de Icaza <miguel@ximian.com>
11673 * driver.cs: Rename --resource to --linkres, because that is what
11674 we do currently, we dont support --resource yet.
11676 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
11678 2002-07-25 Martin Baulig <martin@gnome.org>
11680 * class.cs (MethodData): New public class. This is a `method builder'
11681 class for a method or one accessor of a Property/Indexer/Event.
11682 (MethodData.GetMethodFlags): Moved here from MemberBase.
11683 (MethodData.ApplyAttributes): Likewise.
11684 (MethodData.ApplyObsoleteAttribute): Likewise.
11685 (MethodData.ApplyConditionalAttribute): Likewise.
11686 (MethodData.ApplyDllImportAttribute): Likewise.
11687 (MethodData.CheckAbstractAndExternal): Likewise.
11688 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
11689 (MethodData.Emit): Formerly known as Method.Emit().
11690 (MemberBase): Moved everything which was specific to a single
11691 accessor/method to MethodData.
11692 (Method): Create a new MethodData and call Define() and Emit() on it.
11693 (Property, Indexer, Event): Create a new MethodData objects for each
11694 accessor and call Define() and Emit() on them.
11696 2002-07-25 Martin Baulig <martin@gnome.org>
11698 Made MethodCore derive from MemberBase to reuse the code from there.
11699 MemberBase now also checks for attributes.
11701 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
11702 (MemberBase.GetMethodFlags): Moved here from class Method and marked
11704 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
11705 `CallingConventions cc' and `Attributes opt_attrs' arguments.
11706 (MemberBase.ApplyAttributes): New virtual method; applies the
11707 attributes to a method or accessor.
11708 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
11709 (MemberBase.ApplyConditionalAttribute): Likewise.
11710 (MemberBase.ApplyDllImportAttribute): Likewise.
11711 (MemberBase.CheckAbstractAndExternal): Likewise.
11712 (MethodCore.ParameterTypes): This is now a property instead of a
11713 method, it's initialized from DoDefineParameters().
11714 (MethodCore.ParameterInfo): Removed the set accessor.
11715 (MethodCore.DoDefineParameters): New protected virtual method to
11716 initialize ParameterTypes and ParameterInfo.
11717 (Method.GetReturnType): We can now simply return the MemberType.
11718 (Method.GetMethodFlags): Override the MemberBase version and add
11719 the conditional flags.
11720 (Method.CheckBase): Moved some code from Define() here, call
11721 DoDefineParameters() here.
11722 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
11723 here to avoid some larger code duplication.
11724 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
11725 ensure that abstract and external accessors don't declare a body.
11727 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
11728 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
11729 lookup in the attribute's parent classes, so we need to abort as soon
11730 as we found the first match.
11731 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
11732 the attribute has no arguments.
11734 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
11737 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11739 * cs-parser.jay: reverted previous patch.
11741 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11743 * cs-parser.jay: fixed bug #22119.
11745 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11747 * attribute.cs: fixed compilation. The error was:
11748 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
11749 be assigned to before control leaves the current method."
11750 [FIXME: Filed as bug #28186: MCS must report this error.]
11752 2002-07-25 Martin Baulig <martin@gnome.org>
11754 * attribute.cs (Attribute.Conditional_GetConditionName): New static
11755 method to pull the condition name ouf of a Conditional attribute.
11756 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
11757 the obsolete message and error flag out of an Obsolete attribute.
11759 * class.cs (Method.GetMethodFlags): New public method to get the
11760 TypeManager.MethodFlags for this method.
11761 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
11763 (Method.Define): Get and apply the Obsolete and Conditional attributes;
11764 if we're overriding a virtual function, set the new private variable
11765 `parent_method'; call the new TypeManager.AddMethod().
11767 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
11768 the MethodBuilder and the Method in a PtrHashtable.
11769 (TypeManager.builder_to_method): Added for this purpose.
11770 (TypeManager.MethodFlags): Added IsObsoleteError.
11771 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
11772 Obsolete and Conditional arguments in MethodBuilders. If we discover
11773 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
11774 the message from the attribute.
11776 2002-07-24 Martin Baulig <martin@gnome.org>
11778 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
11779 preprocessor directives, ensure that the argument to #define/#undef is
11780 exactly one identifier and that it's actually an identifier.
11782 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
11785 2002-07-24 Martin Baulig <martin@gnome.org>
11787 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
11788 initialize it to TypeManager.object_type in the constructor.
11789 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
11790 of the `hm.get_current' method if we're using the collection pattern.
11791 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
11792 for the explicit conversion to make it work when we're using the collection
11793 pattern and the `Current' property has a different return type than `object'.
11796 2002-07-24 Martin Baulig <martin@gnome.org>
11798 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
11799 does not match, but don't report any errors. This method is called in
11800 order for all methods in a MethodGroupExpr until a matching method is
11801 found, so we don't want to bail out if the first method doesn't match.
11802 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
11803 matches, report the 123. Fixes #28070.
11805 2002-07-24 Martin Baulig <martin@gnome.org>
11807 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
11808 TypeManager.TypeToCoreType() to the top of the method so the
11809 following equality checks will work. Fixes #28107.
11811 2002-07-24 Martin Baulig <martin@gnome.org>
11813 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
11814 operand is of type uint, and the other operand is of type sbyte,
11815 short or int, the operands are converted to type long." -
11816 Actually do what this comment already told us. Fixes bug #28106,
11819 2002-07-24 Martin Baulig <martin@gnome.org>
11821 * class.cs (MethodBase): New abstract class. This is now a base
11822 class for Property, Indexer and Event to avoid some code duplication
11823 in their Define() and DefineMethods() methods.
11824 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
11825 generic methods for Define() and DefineMethods().
11826 (FieldBase): Derive from MemberBase, not MemberCore.
11827 (Property): Derive from MemberBase, not MemberCore.
11828 (Property.DefineMethod): Moved all the code from this method to the
11829 new MethodBase.DefineAccessor(), just call it with appropriate
11831 (Property.Define): Call the new Property.DoDefine(), this does some
11832 sanity checks and we don't need to duplicate the code everywhere.
11833 (Event): Derive from MemberBase, not MemberCore.
11834 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
11835 accessors, this will also make them work with interface events.
11836 (Indexer): Derive from MemberBase, not MemberCore.
11837 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
11838 (Indexer.Define): Use the new MethodBase functions.
11840 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
11841 argument to the constructor.
11842 (Interface.FindMembers): Added support for interface events.
11843 (Interface.PopluateEvent): Implemented.
11845 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
11847 2002-07-22 Miguel de Icaza <miguel@ximian.com>
11849 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
11850 but this is required to check for a method name being the same as
11851 the containing class.
11855 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11857 * interface.cs: initialize variable.
11859 2002-07-23 Martin Baulig <martin@gnome.org>
11861 Implemented the IndexerName attribute in interfaces.
11863 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
11864 name if this is an explicit interface implementation.
11865 (Indexer.InterfaceIndexerName): New public variable. If we're
11866 implementing an interface indexer, this is the IndexerName in that
11867 interface. Otherwise, it's the IndexerName.
11868 (Indexer.DefineMethod): If we're implementing interface indexer,
11869 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
11870 and Pending.ImplementIndexer methods.
11871 (Indexer.Define): Also define the PropertyBuilder if we're
11872 implementing an interface indexer and this is neither an explicit
11873 interface implementation nor do the IndexerName match the one in
11876 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
11877 If a method is defined here, then we always need to create a proxy
11878 for it. This is used when implementing interface indexers.
11879 (Pending.IsInterfaceIndexer): New public method.
11880 (Pending.ImplementIndexer): New public method.
11881 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
11882 This is used when implementing interface indexers to define a proxy
11884 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
11885 define a proxy if necessary.
11887 * interface.cs (Interface.IndexerName): New public variable.
11888 (Interface.PopulateIndexer): Set the IndexerName.
11889 (Interface.DefineIndexers): New private method. Populate all the
11890 indexers and make sure their IndexerNames match.
11892 * typemanager.cs (IndexerPropertyName): Added support for interface
11895 2002-07-22 Martin Baulig <martin@gnome.org>
11897 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
11898 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
11899 ret if HasReturnLabel.
11900 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
11903 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
11904 and set the ec.LoopBeginTryCatchLevel.
11905 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
11906 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
11907 the current ec.TryCatchLevel, the branch goes out of an exception
11908 block. In this case, we need to use Leave and not Br.
11910 2002-07-22 Martin Baulig <martin@gnome.org>
11912 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
11913 block unless the block does not always return or it is contained in
11914 another try { ... } catch { ... } block. Fixes bug #26506.
11915 Added verify-1.cs to the test suite.
11917 2002-07-22 Martin Baulig <martin@gnome.org>
11919 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
11920 then we do not always return. Fixes bug #24985.
11922 2002-07-22 Martin Baulig <martin@gnome.org>
11924 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
11925 lookup on a per-class level; ie. walk up the class hierarchy until we
11926 found at least one applicable method, then choose the best among them.
11927 Fixes bug #24463 and test-29.cs.
11929 2002-07-22 Martin Baulig <martin@gnome.org>
11931 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
11932 return types of the methods. The return type is not part of the
11933 signature and we must not check it to make the `new' modifier work.
11934 Fixes bug #27999, also added test-147.cs.
11935 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
11937 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
11938 on the method's return type.
11940 2002-07-21 Martin Baulig <martin@gnome.org>
11942 * assign.cs: Make this work if the rightmost source is a constant and
11943 we need to do an implicit type conversion. Also adding a few more tests
11944 to test-38.cs which should have caught this.
11946 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
11947 target in the makefile for this. The makefile.gnu is primarily intended
11948 for end-users who don't want to debug the compiler.
11950 2002-07-21 Martin Baulig <martin@gnome.org>
11952 * assign.cs: Improved the Assign class so it can now handle embedded
11953 assignments (X = Y = Z = something). As a side-effect this'll now also
11954 consume less local variables. test-38.cs now passes with MCS, added
11955 a few new test cases to that test.
11957 2002-07-20 Martin Baulig <martin@gnome.org>
11959 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
11960 instructions. Fixes bug #27977, also added test-146.cs.
11962 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11964 * cs-tokenizer.cs: fixed getHex ().
11966 2002-07-19 Martin Baulig <martin@gnome.org>
11968 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
11969 not Type.GetType() to lookup the array type. This is needed when
11970 we're constructing an array of a user-defined type.
11971 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
11972 single-dimensional arrays, but also for single-dimensial arrays of
11975 2002-07-19 Martin Baulig <martin@gnome.org>
11977 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
11978 this function is called, it's not allowed to share LocalBuilders
11979 among ILGenerators.
11981 2002-07-19 Martin Baulig <martin@gnome.org>
11983 * expression.cs (Argument.Resolve): Report an error 118 when trying
11984 to pass a type as argument.
11986 2002-07-18 Martin Baulig <martin@gnome.org>
11988 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
11989 Conv_R_Un for the signed `long' type.
11991 2002-07-15 Miguel de Icaza <miguel@ximian.com>
11993 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
11994 `expr' for the temporary result, as that will fail if we do
11995 multiple resolves on the same expression.
11997 2002-07-05 Miguel de Icaza <miguel@ximian.com>
11999 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
12000 ec.TypeContainer for looking up aliases.
12002 * class.cs (TypeContainer): Remove LookupAlias from here.
12004 * decl.cs (DeclSpace); Move here.
12006 2002-07-01 Miguel de Icaza <miguel@ximian.com>
12008 * class.cs (FindMembers): Only call filter if the constructor
12009 bulider is not null.
12011 Also handle delegates in `NestedTypes' now. Now we will perform
12012 type lookups using the standard resolution process. This also
12015 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
12016 This uses Expressions (the limited kind that can be parsed by the
12017 tree) instead of strings.
12019 * expression.cs (ComposedCast.ToString): Implement, used to flag
12020 errors since now we have to render expressions.
12022 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
12025 * ecore.cs (SimpleName.ToString): ditto.
12027 * cs-parser.jay: Instead of using strings to assemble types, use
12028 Expressions to assemble the type (using SimpleName, ComposedCast,
12029 MemberAccess). This should fix the type lookups in declarations,
12030 because we were using a different code path for this.
12032 * statement.cs (Block.Resolve): Continue processing statements
12033 even when there is an error.
12035 2002-07-17 Miguel de Icaza <miguel@ximian.com>
12037 * class.cs (Event.Define): Also remove the `remove' method from
12038 the list of pending items.
12040 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
12041 generate more compact code.
12043 2002-07-17 Martin Baulig <martin@gnome.org>
12045 * const.cs (Const.LookupConstantValue): Add support for constant
12046 `unchecked' and `checked' expressions.
12047 Also adding test case test-140.cs for this.
12049 2002-07-17 Martin Baulig <martin@gnome.org>
12051 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
12052 check whether mi.ReturnType implements the IEnumerator interface; the
12053 `==' and the IsAssignableFrom() will fail in this situation.
12055 2002-07-16 Ravi Pratap <ravi@ximian.com>
12057 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
12060 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12062 * expression.cs: fixed bug #27811.
12064 2002-07-14 Miguel de Icaza <miguel@ximian.com>
12066 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
12067 Molaro: when we are a ref, the value already contains a pointer
12068 value, do not take the address of it.
12070 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
12071 * removed mb-parser.jay and mb-tokenizer.cs
12073 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
12075 * expression.cs: check against the building corlib void type.
12077 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
12079 * ecore.cs: fix for valuetype static readonly fields: when
12080 initializing them, we need their address, not the address of a copy.
12082 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
12084 * typemanager.cs: register also enum_type in corlib.
12086 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
12088 * class.cs: allow calling this (but not base) initializers in structs.
12090 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
12092 * ecore.cs: make sure we compare against the building base types
12095 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
12097 * typemanager.cs: fix TypeToCoreType() to handle void and object
12098 (corlib gets no more typerefs after this change).
12100 2002-07-12 Miguel de Icaza <miguel@ximian.com>
12102 * expression.cs (ArrayCreation.EmitArrayArguments): use
12103 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
12105 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
12106 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
12107 array indexes, the runtime actually forbids them.
12109 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
12110 for array arguments here.
12112 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
12113 instead of the default for ValueTypes.
12115 (New.DoEmit): Use IsValueType instead of
12116 IsSubclassOf (value_type)
12117 (New.DoResolve): ditto.
12118 (Invocation.EmitCall): ditto.
12120 * assign.cs (Assign): ditto.
12122 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
12123 Statements *are* currently doing part of their resolution during
12126 Expressions do always resolve during resolve, but statements are
12127 only required to propagate resolution to their children.
12129 2002-07-11 Miguel de Icaza <miguel@ximian.com>
12131 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
12133 (LoadAssembly): Do not add the dll if it is already specified
12135 (MainDriver): Add the System directory to the link path at the end,
12136 after all the other -L arguments.
12138 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
12139 wrong opcode for loading bytes and bools (ldelem.i1 instead of
12140 ldelem.u1) and using the opposite for sbytes.
12142 This fixes Digger, and we can finally run it.
12144 * driver.cs (UnixParseOption): Move the option parsing here.
12145 (CSCParseOption): Implement CSC-like parsing of options.
12147 We now support both modes of operation, the old Unix way, and the
12148 new CSC-like way. This should help those who wanted to make cross
12149 platform makefiles.
12151 The only thing broken is that /r:, /reference: and /lib: are not
12152 implemented, because I want to make those have the same semantics
12153 as the CSC compiler has, and kill once and for all the confussion
12154 around this. Will be doing this tomorrow.
12156 * statement.cs (Unsafe.Resolve): The state is checked during
12157 resolve, not emit, so we have to set the flags for IsUnsfe here.
12159 2002-07-10 Miguel de Icaza <miguel@ximian.com>
12161 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
12162 not catch the Error_ObjectRefRequired in SimpleName (as it is
12163 possible to have a class/instance variable name that later gets
12164 deambiguated), we have to check this here.
12166 2002-07-10 Ravi Pratap <ravi@ximian.com>
12168 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
12169 make static and put into Expression.
12171 (Event.Define): Register the private field of the event with the
12172 TypeManager so that GetFieldFromEvent can get at it.
12174 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
12175 keep track of the private field associated with an event which
12178 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
12181 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
12183 2002-07-10 Miguel de Icaza <miguel@ximian.com>
12185 * expression.cs (Binary.EmitBranchable): this routine emits the
12186 Binary expression in a branchable context. This basically means:
12187 we need to branch somewhere, not just get the value on the stack.
12189 This works together with Statement.EmitBoolExpression.
12191 * statement.cs (Statement.EmitBoolExpression): Use
12194 2002-07-09 Miguel de Icaza <miguel@ximian.com>
12196 * statement.cs (For): Reduce the number of jumps in loops.
12198 (For): Implement loop inversion for the For statement.
12200 (Break): We can be breaking out of a Try/Catch controlled section
12201 (foreach might have an implicit try/catch clause), so we need to
12202 use Leave instead of Br.
12204 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
12205 now). If the instace expression supports IMemoryLocation, we use
12206 the AddressOf method from the IMemoryLocation to extract the
12207 address instead of emitting the instance.
12209 This showed up with `This', as we were emitting the instance
12210 always (Emit) instead of the Address of This. Particularly
12211 interesting when This is a value type, as we dont want the Emit
12212 effect (which was to load the object).
12214 2002-07-08 Miguel de Icaza <miguel@ximian.com>
12216 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
12218 * statement.cs (Checked): Set the CheckedState during the resolve
12219 process too, as the ConvCast operations track the checked state on
12220 the resolve process, and not emit.
12222 * cs-parser.jay (namespace_member_declaration): Flag that we have
12223 found a declaration when we do. This is used to flag error 1529
12225 * driver.cs: Report ok when we display the help only.
12227 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
12229 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
12231 2002-07-04 Miguel de Icaza <miguel@ximian.com>
12233 * cs-tokenizer.cs (define): We also have to track locally the
12234 defines. AllDefines is just used for the Conditional Attribute,
12235 but we also need the local defines for the current source code.
12237 2002-07-03 Miguel de Icaza <miguel@ximian.com>
12239 * statement.cs (While, For, Do): These loops can exit through a
12240 Break statement, use this information to tell whether the
12241 statement is the last piece of code.
12243 (Break): Flag that we break.
12245 * codegen.cs (EmitContexts): New `Breaks' state variable.
12247 2002-07-03 Martin Baulig <martin@gnome.org>
12249 * class.cs (TypeContainer.MethodModifiersValid): Allow override
12250 modifiers in method declarations in structs. Otherwise, you won't
12251 be able to override things like Object.Equals().
12253 2002-07-02 Miguel de Icaza <miguel@ximian.com>
12255 * class.cs (Method, Property, Indexer): Do not allow the public
12256 modifier to be used in explicit interface implementations.
12258 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
12259 override modifiers in method declarations in structs
12261 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
12263 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
12264 integer or real overflow, report an error
12266 2002-07-02 Martin Baulig <martin@gnome.org>
12268 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
12269 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
12270 to tell the runtime about our newly created System.Object and
12271 System.ValueType types.
12273 2002-07-02 Miguel de Icaza <miguel@ximian.com>
12275 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
12276 struct instead of Ldarg/Starg.
12278 2002-07-02 Martin Baulig <martin@gnome.org>
12280 * expression.cs (Indirection.Indirection): Call
12281 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
12283 2002-07-02 Martin Baulig <martin@gnome.org>
12285 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
12286 ValueType, call TypeManager.TypeToCoreType() on it.
12287 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
12288 the OpCodes.Newarr argument.
12290 2002-07-02 Martin Baulig <martin@gnome.org>
12292 * expression.cs (Invocation.EmitCall): When compiling corlib,
12293 replace all calls to the system's System.Array type to calls to
12294 the newly created one.
12296 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
12297 System.Array methods.
12298 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
12299 from the system's System.Array type which must be replaced.
12301 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
12303 * typemanager.cs: load unverifiable_code_ctor so we can build
12304 corlib using the correct type. Avoid using GetTypeCode() with
12306 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
12307 TypeManager.object_type to allow building corlib.
12309 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
12311 * ecore.cs: handle System.Enum separately in LoadFromPtr().
12313 2002-07-01 Martin Baulig <martin@gnome.org>
12315 * class.cs: Make the last change actually work, we need to check
12316 whether `ifaces != null' to avoid a crash.
12318 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
12320 * class.cs: when we build structs without fields that implement
12321 interfaces, we need to add the interfaces separately, since there is
12322 no API to both set the size and add the interfaces at type creation
12325 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
12327 * expression.cs: the dimension arguments to the array constructors
12328 need to be converted if they are a long.
12330 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
12332 * class.cs: don't emit ldarg.0 if there is no parent constructor
12333 (fixes showstopper for corlib).
12335 2002-06-29 Martin Baulig <martin@gnome.org>
12337 MCS now compiles corlib on GNU/Linux :-)
12339 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
12340 ie. check for MethodImplOptions.InternalCall.
12342 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
12343 and TypeManager.attribute_type are null, so we must explicitly check
12344 whether parent is not null to find out whether it's an attribute type.
12345 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
12346 and SetBuilder, not only if the property is neither abstract nor external.
12347 This is necessary to set the MethodImplOptions on the accessor methods.
12348 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
12349 SetBuilder, see Property.Emit().
12351 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
12352 populate "System.Object", "System.ValueType" and "System.Attribute" since
12353 they've already been populated from BootCorlib_PopulateCoreTypes().
12355 2002-06-29 Martin Baulig <martin@gnome.org>
12357 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
12358 is the NullLiteral, we also need to make sure that target_type is not
12361 2002-06-29 Martin Baulig <martin@gnome.org>
12363 * rootcontext.cs (RootContext.ResolveCore): We must initialize
12364 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
12365 before calling BootstrapCorlib_ResolveDelegate ().
12367 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12369 * statement.cs: fixed build-breaker. All tests passed ok.
12371 2002-06-27 Martin Baulig <martin@gnome.org>
12373 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
12374 for System.Decimal when compiling corlib.
12376 2002-06-27 Martin Baulig <martin@gnome.org>
12378 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
12379 switch blocks which contain nothing but a default clause.
12381 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
12383 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
12385 2002-06-27 Martin Baulig <martin@gnome.org>
12387 * ecore.cs (PropertyExpr.PropertyExpr): Call
12388 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
12390 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
12391 is already a TypeBuilder.
12393 2002-06-27 Martin Baulig <martin@gnome.org>
12395 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
12396 `target_type == TypeManager.array_type', not IsAssignableFrom() in
12397 the "from an array-type to System.Array" case. This makes it work
12398 when compiling corlib.
12400 2002-06-27 Martin Baulig <martin@gnome.org>
12402 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
12403 non-static PropertyExpr, set its InstanceExpression. This makes
12404 the `ICollection.Count' property work in System/Array.cs.
12406 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
12408 * driver.cs: Made error handling more consistent. Errors now
12409 tracked by Report class, so many methods which used to return int
12410 now return void. Main() now prints success/failure and
12411 errors/warnings message.
12413 Renamed '--probe' compiler argument to '--expect-error'. Removed
12414 the magic number return values (123 and 124). Now, if the
12415 expected error occurs, the compiler exits with success (exit value
12416 0). If the compilation completes without seeing that particular
12417 error, the compiler exits with failure (exit value 1). The
12418 makefile in mcs/errors has been changed to handle the new behaviour.
12420 * report.cs: Made 'expected error' number a property and renamed
12421 it from 'Probe' to 'ExpectedError'.
12423 * genericparser.cs: Removed error handling support, since it is
12424 now all done by Report class.
12426 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
12427 class, so parse() no longer returns an int.
12429 * namespace.cs: Use Report.Error instead of GenericParser.error
12431 2002-06-22 Miguel de Icaza <miguel@ximian.com>
12433 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
12434 TypeContainer.AddOperator): At the front of the list put the
12435 explicit implementations, so they get resolved/defined first.
12437 2002-06-21 Miguel de Icaza <miguel@ximian.com>
12439 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
12440 interface type is implemented by this TypeContainer. Used during
12441 explicit interface implementation.
12443 (Property.Define, Indexer.Define, Method.Define): Validate that
12444 the given interface in the explicit implementation is one of the
12445 base classes for the containing type.
12447 Also if we are explicitly implementing an interface, but there is
12448 no match in the pending implementation table, report an error.
12450 (Property.Define): Only define the property if we are
12451 not explicitly implementing a property from an interface. Use the
12452 correct name also for those properties (the same CSC uses,
12453 although that is really not needed).
12455 (Property.Emit): Do not emit attributes for explicitly implemented
12456 properties, as there is no TypeBuilder.
12458 (Indexer.Emit): ditto.
12460 Hiding then means that we do not really *implement* a pending
12461 implementation, which makes code fail.
12463 2002-06-22 Martin Baulig <martin@gnome.org>
12465 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
12466 the return value of Object.GetType(). [FIXME: we need to do this whenever
12467 we get a type back from the reflection library].
12469 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
12471 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
12473 2002-06-20 Miguel de Icaza <miguel@ximian.com>
12475 * attribute.cs: Return null if we can not look up the type.
12477 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
12478 the interface types found.
12480 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
12481 interface types found.
12483 * typemanager.cs (GetInterfaces): Make this routine returns alll
12484 the interfaces and work around the lame differences between
12485 System.Type and System.Reflection.Emit.TypeBuilder in the results
12486 result for GetInterfaces.
12488 (ExpandInterfaces): Given an array of interface types, expand and
12489 eliminate repeated ocurrences of an interface. This expands in
12490 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
12493 2002-06-21 Martin Baulig <martin@gnome.org>
12495 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
12498 2002-06-21 Martin Baulig <martin@gnome.org>
12500 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
12501 and called with one of the core types, return the corresponding typebuilder for
12504 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
12507 2002-06-21 Martin Baulig <martin@gnome.org>
12509 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
12510 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
12511 (Expression.ConvertReferenceExplicit): Likewise.
12513 * expression.cs (ElementAccess.DoResolve): Likewise.
12514 (ElementAccess.DoResolveLValue): Likewise.
12516 2002-06-10 Martin Baulig <martin@gnome.org>
12518 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
12519 add the "value" parameter to the parameter list.
12521 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
12524 2002-06-19 Miguel de Icaza <miguel@ximian.com>
12526 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
12527 the argument to an int, uint, long or ulong, per the spec. Also
12528 catch negative constants in array creation.
12530 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
12532 * class.cs: do not allow the same interface to appear twice in
12533 the definition list.
12535 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
12537 * ecore.cs: don't use ldlen with System.Array.
12539 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
12541 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
12543 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
12545 * modifiers.cs: produce correct field attributes for protected
12546 internal. Easy fix so miguel can work on ther harder stuff:-)
12548 2002-06-18 Miguel de Icaza <miguel@ximian.com>
12550 * pending.cs: New file. Move the code from class.cs here.
12551 Support clearning the pending flag for all methods (when not doing
12552 explicit interface implementation).
12554 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
12556 * rootcontext.cs: added a couple more types needed to bootstrap.
12558 2002-06-17 Miguel de Icaza <miguel@ximian.com>
12560 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
12561 constructor in the type, instead of any constructor in the type
12562 hierarchy. Thanks to Paolo for finding this bug (it showed up as
12563 a bug in the Mono runtime when applying the params attribute).
12565 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
12566 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
12568 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
12570 * expression.cs (Unary.ResolveOperator): Use TypeManager
12571 to resolve the type.
12573 2002-06-13 Ravi Pratap <ravi@ximian.com>
12575 * cs-parser.jay (enum_member_declaration): Pass in the attributes
12578 * enum.cs (AddEnumMember): Add support to store the attributes associated
12579 with each member too.
12581 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
12582 field builders too - this takes care of the enum member case.
12584 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
12586 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
12587 address-of operator on both value types and pointers.
12589 2002-06-10 Martin Baulig <martin@gnome.org>
12591 * interface.cs (Interface.PopulateIndexer): Add the indexer's
12592 PropertyBuilder to the `property_builders' list.
12594 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
12595 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
12596 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
12597 find any indexers which are inherited from an interface.
12599 2002-06-09 Martin Baulig <martin@gnome.org>
12601 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
12602 the same type as the constant if necessary. There's also a test-130.cs
12605 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
12607 * typemanager.cs (TypeManager.ChangeType): Previously known as
12608 Enum.ChangeEnumType().
12610 2002-06-09 Martin Baulig <martin@gnome.org>
12612 * expression.cs (Cast.TryReduce): Added support for consts.
12614 2002-06-08 Ravi Pratap <ravi@ximian.com>
12616 * class.cs (Accessor): Hold attributes information so we can pass
12619 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
12620 Modify to pass in attributes attached to the methods.
12622 (add_accessor_declaration, remove_accessor_declaration): Ditto.
12624 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
12625 to handle the Accessor kind :-)
12627 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
12629 2002-06-08 Martin Baulig <martin@gnome.org>
12631 * expression.cs (Unary.TryReduceNegative): Added support for
12634 2002-06-08 Martin Baulig <martin@gnome.org>
12636 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
12637 name can't be found in the `defined_names' - the caller will do a
12638 MemberLookup in this case and thus find methods in System.Enum
12639 such as Enum.IsDefined().
12641 2002-06-08 Martin Baulig <martin@gnome.org>
12643 * enum.cs (Enum.ChangeEnumType): This is a custom version of
12644 Convert.ChangeType() which works with TypeBuilder created types.
12645 (Enum.LookupEnumValue, Enum.Define): Use it here.
12647 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
12648 `TypeBuilder.BaseType != null' check.
12649 (TypeContainer.FindMembers): Only lookup parent members if we
12650 actually have a parent.
12651 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
12652 (ConstructorInitializer.Resolve): Likewise.
12654 * interface.cs (Interface.FindMembers): Added
12655 `TypeBuilder.BaseType != null' check.
12657 * rootcontext.cs (RootContext.ResolveCore): Added
12658 "System.Runtime.CompilerServices.IndexerNameAttribute" to
12659 classes_second_stage.
12661 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
12662 debug_type and trace_type when compiling with --nostdlib.
12664 2002-06-07 Martin Baulig <martin@gnome.org>
12666 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
12667 (AddField): Set it to true when adding a non-static field.
12668 (DefineType): Use `have_nonstatic_fields' to find out whether we
12669 have non-static fields, not `Fields != null'.
12671 2002-06-02 Miguel de Icaza <miguel@ximian.com>
12673 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
12674 dereferencing a null on the static-field code path)
12676 2002-05-30 Martin Baulig <martin@gnome.org>
12678 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
12679 to take command line arguments. Use reflection to call the new
12680 custom `Initialize' function on the symbol writer and pass it the
12681 command line arguments.
12683 * driver.cs (--debug-args): New command line argument to pass command
12684 line arguments to the symbol writer.
12686 2002-05-28 Miguel de Icaza <miguel@ximian.com>
12688 * assign.cs (DoResolve): Forgot to do the implicit conversion to
12689 the target type for indexers and properties. Thanks to Joe for
12692 2002-05-27 Miguel de Icaza <miguel@ximian.com>
12694 * typemanager.cs (MethodFlags): returns the method flags
12695 (Obsolete/ShouldIgnore) that control warning emission and whether
12696 the invocation should be made, or ignored.
12698 * expression.cs (Invocation.Emit): Remove previous hack, we should
12699 not do this on matching a base type, we should do this based on an attribute
12701 Only emit calls to System.Diagnostics.Debug and
12702 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
12703 on the command line.
12705 * rootcontext.cs: Global settings for tracing and debugging.
12707 * cs-tokenizer.cs (define): New utility function to track
12708 defines. Set the global settings for TRACE and DEBUG if found.
12710 2002-05-25 Ravi Pratap <ravi@ximian.com>
12712 * interface.cs (Populate*): Pass in the TypeContainer as well as
12713 the DeclSpace as parameters so that we can create EmitContexts and
12714 then use that to apply attributes etc.
12716 (PopulateMethod, PopulateEvent, PopulateProperty)
12717 (PopulateIndexer): Apply attributes everywhere.
12719 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
12722 (ApplyAttributes): Update accordingly.
12724 We now apply interface attributes for all members too.
12726 2002-05-26 Miguel de Icaza <miguel@ximian.com>
12728 * class.cs (Indexer.Define); Correctly check if we are explicit
12729 implementation (instead of checking the Name for a ".", we
12730 directly look up if the InterfaceType was specified).
12732 Delay the creation of the PropertyBuilder.
12734 Only create the PropertyBuilder if we are not an explicit
12735 interface implementation. This means that explicit interface
12736 implementation members do not participate in regular function
12737 lookups, and hence fixes another major ambiguity problem in
12738 overload resolution (that was the visible effect).
12740 (DefineMethod): Return whether we are doing an interface
12743 * typemanager.cs: Temporary hack until we get attributes in
12744 interfaces (Ravi is working on that) and we get IndexerName
12745 support in interfaces.
12747 * interface.cs: Register the indexers as properties.
12749 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
12750 warning, I have verified that this is a bug in the .NET runtime
12751 (JavaScript suffers of the same problem).
12753 * typemanager.cs (MemberLookup): When looking up members for
12754 interfaces, the parent of an interface is the implicit
12755 System.Object (so we succeed in searches of Object methods in an
12756 interface method invocation. Example: IEnumerable x; x.ToString
12759 2002-05-25 Miguel de Icaza <miguel@ximian.com>
12761 * class.cs (Event): Events should also register if they do
12762 implement the methods that an interface requires.
12764 * typemanager.cs (MemberLookup); use the new GetInterfaces
12767 (GetInterfaces): The code used to lookup interfaces for a type is
12768 used in more than one place, factor it here.
12770 * driver.cs: Track the errors at the bottom of the file, we kept
12773 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
12774 instance if the method we are calling is static!
12776 2002-05-24 Miguel de Icaza <miguel@ximian.com>
12778 * attribute.cs (ApplyAttributes): Make this function filter out
12779 the IndexerName attribute (as that attribute in reality is never
12780 applied) and return the string constant for the IndexerName
12783 * class.cs (TypeContainer.Emit): Validate that all the indexers
12784 have the same IndexerName attribute, and if so, set the
12785 DefaultName attribute on the class.
12787 * typemanager.cs: The return value might contain other stuff (not
12788 only methods). For instance, consider a method with an "Item"
12789 property and an Item method.
12791 * class.cs: If there is a problem with the parameter types,
12794 2002-05-24 Ravi Pratap <ravi@ximian.com>
12796 * ecore.cs (ImplicitConversionExists): Wrapper function which also
12797 looks at user defined conversion after making a call to
12798 StandardConversionExists - we need this for overload resolution.
12800 * expression.cs : Update accordingly the various method calls.
12802 This fixes 2 bugs filed against implicit user defined conversions
12804 2002-05-22 Miguel de Icaza <miguel@ximian.com>
12806 * statement.cs: Track the result of the assignment.
12808 2002-05-21 Miguel de Icaza <miguel@ximian.com>
12810 * expression.cs (MemberAccess): Improved error reporting for
12811 inaccessible members.
12813 2002-05-22 Martin Baulig <martin@gnome.org>
12815 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
12816 itself with debugging support.
12818 2002-05-22 Martin Baulig <martin@gnome.org>
12820 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
12821 Removed, this isn't needed anymore.
12823 2002-05-20 Martin Baulig <martin@gnome.org>
12825 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
12826 be underlying type for an enum.
12828 2002-05-20 Miguel de Icaza <miguel@ximian.com>
12830 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
12831 that splits out the loading of just the core types.
12833 * rootcontext.cs (ResolveCore): Split the struct resolution in
12834 two, so we can load the enumeration underlying types before any
12837 * expression.cs (Is): Bandaid until we fix properly Switch (see
12838 bug #24985 for details).
12840 * typemanager.cs (ImplementsInterface): The hashtable will contain
12841 a null if there are no interfaces implemented.
12843 2002-05-18 Miguel de Icaza <miguel@ximian.com>
12845 * cs-parser.jay (indexer_declarator): It is fine to have array
12848 2002-05-17 Miguel de Icaza <miguel@ximian.com>
12850 * typemanager.cs: (RegisterBuilder): New function used to register
12851 TypeBuilders that implement interfaces. Since
12852 TypeBuilder.GetInterfaces (as usual) does not work with lame
12854 (AddUserType): register interfaces.
12856 (ImplementsInterface): Use the builder_to_ifaces hash if we are
12857 dealing with TypeBuilder. Also, arrays are showing up as
12858 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
12859 methods can not be invoked on them!
12861 * ecore.cs (ExplicitReferenceConversionExists): Made public.
12862 (ImplicitReferenceConversionExists): Split out from
12863 StandardConversionExists.
12865 * expression.cs (As): We were only implementing one of the three
12866 cases for the as operator. We now implement them all.
12867 (Is): Implement the various other cases for Is as well.
12869 * typemanager.cs (CACHE): New define used to control if we want or
12870 not the FindMembers cache. Seems to have a negative impact on
12871 performance currently
12873 (MemberLookup): Nested types have full acess to
12874 enclosing type members
12876 Remove code that coped with instance/static returns for events, we
12877 now catch this in RealFindMembers.
12879 (RealFindMembers): only perform static lookup if the instance
12880 lookup did not return a type or an event.
12882 2002-05-17 Miguel de Icaza <miguel@ximian.com>
12884 * assign.cs (CompoundAssign): We pass more semantic information
12885 now to Compound Assignments than we did before: now we have all
12886 the information at hand, and now we resolve the target *before* we
12887 do the expression expansion, which allows the "CacheValue" method
12888 to have the effect we intended (before, a [x] += 1 would generate
12889 two differen ArrayAccess expressions from the ElementAccess,
12890 during the resolution process).
12892 (CompoundAssign.DoResolve): Resolve target and original_source here.
12894 2002-05-16 Miguel de Icaza <miguel@ximian.com>
12896 * expression.cs (ArrayAccess): dropped debugging information.
12898 * typemanager.cs: Small bug fix: I was always returning i_members,
12899 instead of one of i_members or s_members (depending on which had
12902 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
12903 method is invoked before any code generation takes place, and it
12904 is a mechanism to inform that the expression will be invoked more
12905 than once, and that the method should use temporary values to
12906 avoid having side effects
12908 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
12910 * ecore.cs (Expression.CacheTemporaries): Provide empty default
12913 * expression.cs (Indirection, ArrayAccess): Add support for
12914 CacheTemporaries in these two bad boys.
12916 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
12917 ldobj or ldind_ref.
12918 (StoreFromPtr): Handle stobj as well.
12920 * expression.cs (UnaryMutator): Share more code.
12922 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
12923 down: I was not tracking the Filter function as well, which
12924 was affecting the results of the cache.
12926 2002-05-15 Miguel de Icaza <miguel@ximian.com>
12928 * attribute.cs: Remove the hack to handle the CharSet property on
12931 2002-05-14 Miguel de Icaza <miguel@ximian.com>
12933 * attribute.cs (DoResolve): More uglyness, we now only try to
12934 resolve the attribute partially, to extract the CharSet
12935 information (only if we are a StructLayout attribute). Otherwise
12937 (GetExtraTypeInfo): Add some code to conditionally kill in the
12938 future this. I am more and more convinced that the .NET
12939 framework has special code to handle the attribute setting on
12942 * expression.cs (IsParamsMethodApplicable): Revert my previous
12943 foreach change here, it was wrong.
12945 2002-05-13 Miguel de Icaza <miguel@ximian.com>
12947 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
12948 (pp_expr): do not abort on unknown input, just return.
12949 (eval): abort if there are pending chars.
12951 * attribute.cs (Attribute.Resolve): Positional parameters are
12952 optional. Deal with that case.
12954 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
12955 the Ansi/Unicode/Auto information for the type.
12957 (TypeContainer.DefineType): instantiate the EmitContext here, as
12958 we will be using it during the type definition (to resolve
12959 attributes) and during the emit phase.
12961 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
12962 to pull type information out of the attributes
12964 (Attribute.Resolve): track the constructor builder, and allow for
12965 multiple invocations (structs and classes will use this).
12967 * ecore.cs (MemberLookupFinal): new version with all the
12968 parameters customizable.
12970 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
12971 constructors. Return if the result value is null (as the error
12972 would have been flagged already by MemberLookupFinal)
12974 Do not allow instances of abstract classes or interfaces to be
12977 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
12978 We have to compare the assembly property here when dealing with
12979 FamANDAssem and Assembly access modifiers, because we might be
12980 creating an assembly from *modules* (that means that we are not
12981 getting TypeBuilders for types defined in other modules that are
12982 part of this assembly).
12984 (Method.Emit): If the method is marked abstract and has a body,
12987 (TypeContainer.DefineMembers): If both the defined member and the
12988 parent name match are methods, then do not emit any warnings: let
12989 the Method.Define routine take care of flagging warnings. But if
12990 there is a mismatch (method overrides something else, or method is
12991 overriwritten by something, then emit warning).
12993 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
12994 set to null, this means `do not check for the return type on the
12997 (Method.Define): set the return type for the method signature to
12998 null, so that we get methods with the same name and parameters and
12999 different return types. This is used to flag warning 114 (you are
13000 hiding a method, and you probably want to use the new/override
13003 * typemanager.cs (MemberLookup): Implemented proper access
13004 control, closing a long standing set of bug reports. The problem
13005 was that the Framework only has two bits: Public and NonPublic,
13006 and NonPublic includes private and protected methods, but we need
13007 to enforce the FamANDAssem, FamOrAssem and Family.
13009 2002-05-11 Miguel de Icaza <miguel@ximian.com>
13011 * statement.cs (GotoCase): Return true: Ammounts to giving up
13012 knowledge on whether we return or not, and letting the other case
13013 be responsible for it.
13015 2002-05-10 Miguel de Icaza <miguel@ximian.com>
13017 * driver.cs: Do not load directories for each file processed, only
13018 do it if there is a pattern.
13020 * ecore.cs: Report readonly assigns here as well, as we might have
13021 been resolved only by MemberAccess.
13023 (SimpleName.SimpleNameResolve): Also be useful for LValue
13024 resolution. We need this to propagate assign to local readonly variables
13026 * typemanager.cs: Use a ptrhashtable for the criteria, because we
13027 do not want to reuse potential criteria memory.
13029 * class.cs (MyEventBuilder): Set reflected_type;
13031 * ecore.cs (Constantify): Added support for constifying bools.
13033 (RootContext.LookupType): Added a cache for values looked up in
13034 the declaration space.
13036 * typemanager.cs (FindMembers): Now is a front-end to
13037 RealFindMembers, and provides a two-level hashtable-based cache to
13040 15% performance improvement: from 22.5 to 19.2 seconds.
13042 * expression.cs (IsParamsMethodApplicable): use foreach.
13043 (Invocation.DoResolve): ditto.
13044 (New.DoResolve): ditto.
13045 (ArrayCreation.DoResolve): ditto.
13047 * ecore.cs (FindMostEncompassingType): use foreach.
13049 * delegate.cs (NewDelegate.DoResolve): Use foreach
13051 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
13052 (RemoveMethods): use foreach.
13054 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
13055 nested foreach statements instead of for, and also break out of
13056 the inner loop once a match is found.
13058 (Invocation.OverloadResolve): Use foreach, simplify the code.
13060 2002-05-08 Miguel de Icaza <miguel@ximian.com>
13062 * cfold.cs (BinaryFold): During an enumeration evaluation context,
13063 we actually unwrap the expression to allow for extra information
13066 * expression.cs: Use Shr_Un on unsigned operations.
13068 2002-05-08 Ravi Pratap <ravi@ximian.com>
13070 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
13071 applicable operators was not being considered correctly. This closes
13072 the bug Miguel reported.
13074 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
13076 * attribute.cs: check that the type derives from System.Attribute
13077 and report the correct error in that case (moved the duplicate code to
13078 its own method, too).
13080 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
13082 * attribute.cs: lookup attribute type name as the spec says: first the
13083 bare attribute name and then name + "Attribute" (nant compiles with
13084 mcs after this fix).
13086 2002-05-07 Miguel de Icaza <miguel@ximian.com>
13088 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
13089 Because of the way we parse things, we should try to see if a
13090 UIntConstant can fit in an integer.
13092 2002-05-07 Ravi Pratap <ravi@ximian.com>
13094 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
13095 when we are in an explicit context.
13097 (ConvertReferenceExplicit): When converting from Iface type S to Class
13098 T make sure the rules are implemented as an OR.
13100 * parameter.cs (ParameterType): Make it a property for now although the
13101 purpose really isn't anything immediate.
13103 * expression.cs (Is*Applicable): Do better checking on the parameter type
13104 of a ref/out parameter. The ones from the system assemblies are already
13105 marked with the correct type so we don't need to do any correction.
13107 * ecore.cs (StandardConversionExists): Conversion from Interface types to
13108 the object type is standard too so include that.
13110 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13112 * ecore.cs (StandardConversionExists): Augment with missing code:
13113 deal with IntConstant, LongConstants and Enumerations.
13115 * assign.cs: Report the error, instead of failing silently
13117 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
13118 typecontainer that they are declared, because the
13119 typecontainer/namespace will have the list of using clauses that
13120 need to be applied.
13122 Assembly Attributes were escaping the normal registration
13125 (EmitCode): Apply attributes within an EmitContext that represents
13126 the container they were declared on.
13128 * cs-parser.jay: Track bases for structs. How did I get this wrong?
13130 2002-05-06 Ravi Pratap <ravi@ximian.com>
13132 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
13133 Revamp completely - make much cleaner as we now operate only
13136 (FindMostSpecificSource, FindMostSpecificTarget): New methods
13137 to implement the logic detailed in the spec more correctly.
13139 (UserDefinedConversion): Update accordingly.
13141 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13143 * statement.cs: Return flow analysis information up.
13145 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
13148 (token): Do not consume an extra character before calling
13151 2002-05-06 Piers Haken <piersh@friskit.com>
13153 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
13155 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13157 * class.cs (Constructor.Emit): Set the IsStatic flag in the
13158 EmitContext during the instance constructor initializer
13159 resolution, to stop access to instance variables.
13161 This is mandated by the spec, last paragraph of the `constructor
13162 initializers' section.
13164 2002-05-05 Miguel de Icaza <miguel@ximian.com>
13166 * cs-parser.jay, class.cs (Accessor): new class used to represent
13167 an accessor (get or set). In the past we used `null' to represent
13168 a missing accessor. But this is ambiguous because there was no
13169 way to tell in abstract indexers/properties if one of them was
13172 Now there is a way of addressing that.
13174 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
13175 instead of FindMembers.
13177 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
13178 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
13180 * attribute.cs: Treat indexers and properties as the same in terms
13181 of applying attributes
13183 * ecore.cs (FindMostEncompassedType): Use statically initialized
13184 EmptyExpressions()s like we do elsewhere to avoid creating useless
13185 objects (and we take this out of the tight loop).
13187 (GetConversionOperators): Move the code to extract the actual
13188 operators to a separate routine to clean things up.
13190 2002-05-04 Miguel de Icaza <miguel@ximian.com>
13192 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
13193 events are always registered FieldBuilders.
13195 * class.cs (FieldBase): New class shared by Fields
13197 * delegate.cs: If we are a toplevel delegate, use our full name.
13198 If we are a nested delegate, then only use our tail name.
13200 2002-05-02 Ravi Pratap <ravi@ximian.com>
13202 * expression.cs (IsApplicable): Ensure that we add the "&" to
13203 ref/out types before comparing it with the type of the argument.
13205 (IsParamsMethodApplicable): Ditto.
13207 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
13210 * delegate.cs : Handle the case when we have more than one applicable
13211 method. Flag an error only when we finish checking all.
13213 2002-05-02 Miguel de Icaza <miguel@ximian.com>
13215 * expression.cs: Add support for boolean static initializers.
13217 2002-05-01 Miguel de Icaza <miguel@ximian.com>
13219 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
13221 * parameter.cs (ComputeParameterTypes,
13222 ComputeAndDefineParameterTypes): Better error handling: now we
13223 clear the `types' cache if we fail during any of the type lookups.
13224 We also return the status code correctly to our caller
13226 * delegate.cs: If we fail to define a delegate, abort the extra
13229 * expression.cs (Binary.ResolveOperator): for
13230 operator==(object,object) and operator !=(object, object) we also
13231 have to verify that there is an implicit conversion from one to
13234 (ArrayAccess.DoResolve): Array Access can operate on
13237 2002-04-30 Miguel de Icaza <miguel@ximian.com>
13239 * assign.cs (CompoundAssign): A new class used as a "flag" that
13240 the assignment actually is happening as part of a compound
13241 assignment operator.
13243 During compound assignment, a few new rules exist to enable things
13250 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
13251 to the type of x) if y is implicitly convertible to the type of x,
13252 and the operator is a builtin operator and the return type of the
13253 operator is explicitly convertible to the type of x.
13255 * rootcontext.cs: Reset warning level to 2. 4 catches various
13256 "interesting" features in mcs, we must clean this up at some
13257 point, but currently am trying to kill other bugs ;-)
13259 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
13260 in container classes as well.
13262 * expression.cs (Binary.ResolveOperator): Handle string case
13263 before anything else (as operator overloading does emit an error
13264 before doing anything else).
13266 This code could go away when we move to a table driven model, but
13267 i could not come up with a good plan last night.
13269 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
13271 * typemanager.cs (CSharpName): reimplementation using regex.
13272 * class.cs: added null check for fields in Emit
13273 * rootcontext.cs: set warninglevel to 4
13275 2002-04-29 Miguel de Icaza <miguel@ximian.com>
13277 * typemanager.cs (CSharpName): reimplemented with Lupus
13280 2002-04-28 Miguel de Icaza <miguel@ximian.com>
13282 * statement.cs (If): correclty implement Resolve, because we were
13283 not catching sem errors in there. The same process is needed
13285 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
13288 (Statement.Warning_DeadCodeFound): Factorize code.
13289 (While): Report dead code here too.
13291 (Statement): Added Resolve virtual method to allow
13292 for resolution split from the emit code.
13294 2002-04-26 Miguel de Icaza <miguel@ximian.com>
13296 * statement.cs (EmitBoolExpression): No longer try to resolve the
13298 (MakeBoolean): New utility function that resolve, implicitly
13299 converts to boolean and tags the expression.
13302 (If, Do): Implement dead code elimination.
13303 (While): Implement loop inversion
13305 (Do, While, For, If): Resolve the expression prior to calling our
13308 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
13311 - added method Report28 (warning: program has more than one entry point)
13312 - added method IsEntryPoint, implements paragraph 10.1 of the spec
13313 - modified method Method.Define, the part at the end of the method
13315 * rootcontext.cs: added static public Location EntryPointLocation;
13317 * ../errors/cs0028.cs : Add test case for the above warning.
13320 - modified method CSharpName to allow arrays of primitive type to
13321 be printed nicely (e.g. instead of System.Int32[][] it now prints
13323 - added method CSharpSignature: returns the signature of a method
13324 in string format to be used in reporting errors, warnings, etc.
13326 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
13329 2002-04-26 Ravi Pratap <ravi@ximian.com>
13331 * delegate.cs (Define): Fix extremely silly bug where I was
13332 setting the type of the 'object' parameter of the BeginInvoke
13333 method to System.IAsyncResult instead of System.Object ;-)
13335 2002-04-26 Miguel de Icaza <miguel@ximian.com>
13337 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
13340 (Constructor.Emit): return if we fail to initialize the
13341 constructor. Another door closed!
13343 * expression.cs (New.DoResolve): Improve error message (from -6 to
13344 1501). Use DeclaredOnly lookup to find the exact constructor.
13346 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
13347 loop. This is useful.
13349 * cs-parser.jay: Adjust the default parameters so that destructors
13350 have the proper signature.
13352 2002-04-26 Martin Baulig <martin@gnome.org>
13354 * driver.cs (LoadAssembly): If `assembly' contains any characters
13355 which are only valid in path names and not in assembly names
13356 (currently slash, backslash and point), use Assembly.LoadFrom ()
13357 instead of Assembly.Load () on the `assembly' (before iteration
13358 over the link_paths).
13360 2002-04-26 Martin Baulig <martin@gnome.org>
13362 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
13364 2002-04-25 Miguel de Icaza <miguel@ximian.com>
13366 * class.cs (Property): use the new typemanager.MemberLookup
13368 (TypeContainer.MemberLookup): Implement using the
13369 TypeManager.MemberLookup now.
13371 * typemanager.cs: Make MemberLookup a function of the TypeManager,
13372 and return MemberInfos, so that these can be used without an
13373 EmitContext (what we had before).
13375 2002-04-24 Miguel de Icaza <miguel@ximian.com>
13377 * expression.cs: Fix the case where the argument to params if the
13378 type of the params. I omitted handling this before. Fixed
13380 2002-04-22 Miguel de Icaza <miguel@ximian.com>
13382 * driver.cs: Call BootCorlib_PopulateCoreType
13384 * class.cs (Property.CheckBase): Check for properties only, not
13387 * interface.cs: Temporary hack: try/catch around the
13388 CustomAttributeBuilder, because I am getting an exception that I
13391 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
13392 types whose definitions are required to be there (attributes are
13393 defined before standard types).
13395 Compute definitions as we boot the various types, as they are used
13396 immediately (value_type class will need object_type, but if we do
13397 not initialize object_type, we will pass a null, which will let
13398 the runtime pick the System.Object from the existing corlib, which
13399 is not what we want).
13401 2002-04-22 Patrik Torstensson <totte@labs2.com>
13403 * cs-tokenizer.cs: fixed a number of trim() issues.
13405 2002-04-22 Ravi Pratap <ravi@ximian.com>
13407 * expression.cs (Argument.Type): Ensure that we return the correct
13408 type when we have out or ref parameters [in which case we
13411 2002-04-22 Miguel de Icaza <miguel@ximian.com>
13413 * class.cs (Property, Indexer): Allow extern modifier in there.
13415 * typemanager.cs (InitBaseTypes): Initializes object_type and
13416 value_type, since those will be used early on during the bootstrap
13417 process to compile corlib.
13419 (InitCoreTypes): Move code from here to InitBaseTypes.
13421 2002-04-21 Miguel de Icaza <miguel@ximian.com>
13423 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
13424 single-dimension arrays as using the ldlen opcode.
13426 Daniel Lewis discovered this optimization.
13428 * typemanager.cs: Add signature for System.Array::get_Length
13430 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13432 * statement.cs: report the error when the foreach does not apply to an
13433 array nor a collection.
13435 2002-04-19 Miguel de Icaza <miguel@ximian.com>
13437 * expression.cs: Add implicit conversions to the operator ~.
13439 * constant.cs (DecimalConstant.Emit): Emit decimal value.
13441 * typemanager.cs: Locate the decimal constructor.
13443 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13445 * attribute.cs: use the new property of TypeOf.
13446 * expression.cs: added 'get' property around typearg.
13448 These changes fix a build breaker reported by NickD. Is this the
13449 correct way to fix? If not, please, revert my changes and make it
13452 2002-04-17 Miguel de Icaza <miguel@ximian.com>
13454 * attribute.cs: Add support for typeof in attribute invocations.
13455 I am not sure that this is right though.
13457 2002-04-14 Duncan Mak <duncan@ximian.com>
13459 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
13460 Binary.Operator.Division case.
13462 2002-04-13 Ravi Pratap <ravi@ximian.com>
13464 * class.cs (DefineType): Ensure that we do a proper check on
13465 attribute types and also register it with the TypeManager.
13467 (TypeContainer.Targets): The default for attribute types is
13468 AttributeTargets.All.
13470 * attribute.cs (ApplyAttributes): Registering the attribute type
13471 is done elsewhere, not when we discover we have a Usage attribute.
13473 2002-04-12 Ravi Pratap <ravi@ximian.com>
13475 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
13476 and get rid of is_delegate parameter.
13478 * everywhere : update.
13480 2002-04-12 Ravi Pratap <ravi@ximian.com>
13482 * cs-parser.jay (compilation_unit): Revamp completely to use
13483 some new ideas that I got from Rhys' grammar to solve the problems
13484 with assembly level attributes.
13486 (outer_declaration): New grammar production.
13488 (attribute_sections): Add.
13490 (opt_attributes): Base on attribute_sections
13492 (namespace_declaration): Allow opt_attributes to tackle the case
13493 when we have assembly level attributes - we are clever in this
13496 * attribute.cs (ApplyAttributes): Do not worry about assembly
13497 attributes in the non-global context.
13499 * rootcontext.cs (AddGlobalAttributes): Go back to using this
13500 instead of SetGlobalAttributes.
13502 * class.cs, rootcontext.cs : Ensure we define and generate
13503 attribute types before anything else.
13505 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
13506 and flag the new error -20 for the case when the attribute type
13507 does not have valid targets specified. csc does not catch this.
13509 * ../errors/errors.txt : update for error # -20
13511 2002-04-11 Ravi Pratap <ravi@ximian.com>
13513 * support.cs (InternalParameters.ParameterModifier): Do some null
13514 checking and return sane values.
13516 * class.cs (Method.Define): If we are a PInvoke method, ensure
13517 that we are static and extern. Report error # 601
13519 * ../errors/cs0601.cs : Add test case for the above error.
13521 2002-04-07 Ravi Pratap <ravi@ximian.com>
13523 * rootcontext.cs (attribute_types): We need to keep type of
13524 all attribute types separately and emit code for them first.
13526 (RegisterAttribute) : Implement.
13528 * class.cs (DefineType): Check if the current Type is a custom
13529 attribute type and register it accordingly.
13531 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
13532 adding the first attribute twice and rename to
13534 (SetGlobalAttributes): this.
13536 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
13539 * attribute.cs (ApplyAttributes): Take an additional argument telling us
13540 if we are processing global arguments. Hmm, I am unsure of this.
13542 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13544 * expression.cs: added static array of strings to avoid calling
13545 Enum.ToString () for Operator in Binary. Significant recover of
13548 2002-04-10 Miguel de Icaza <miguel@ximian.com>
13550 * class.cs (FindMembers): Allow the Builders of the various
13551 members to be null. If they are skip them. This only happens
13552 during the PInvoke declaration.
13554 2002-04-09 Miguel de Icaza <miguel@ximian.com>
13556 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
13557 failure, so we do not keep going afterwards.
13559 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
13560 wanted to pass `false' as the `is_delegate' argument. If this is
13561 the case, why not use delegate_type == null to mean `is_delegate =
13562 false' and anything else as is_delegate = true.
13564 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
13566 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
13567 code for the section, not the beginning of the tests.
13569 2002-04-08 Miguel de Icaza <miguel@ximian.com>
13571 * cfold.cs: Handle operator + (Enum x, Underlying x)
13573 * expression.cs (Binary): same. Warn about errors where we have
13574 Enum/Enum in operator + as well.
13576 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
13579 - added support for switch(bool)
13580 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
13581 - add TableSwitchEmit() to handle table-based switch statements
13583 2002-04-05 Ravi Pratap <ravi@ximian.com>
13585 * expression.cs (Invocation.OverloadResolve): Factor out code which
13586 does parameter compatibility checking with arguments so that we can
13587 re-use the code even from Delegate.VerifyApplicability
13589 (VerifyArgumentsCompat): Move above code here.
13591 * delegate.cs (VerifyApplicability): Get rid of duplicate code
13592 and instead make a call to the above method.
13594 2002-03-31 Ravi Pratap <ravi@ximian.com>
13596 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
13597 We use it to keep track of classes which are attribute types.
13599 2002-04-02 Miguel de Icaza <miguel@ximian.com>
13601 * delegate.cs (Delegate.Define): Correctly define the types in the
13602 presence of fixed and array parameters.
13604 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
13607 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
13608 include NonPublic after the first iteration.
13610 * class.cs (Indexer.CheckBase): Only check if both parents are
13613 * cs-parser.jay (accessor_body): If empty, set to null.
13615 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
13616 same code path here to resolve constants names that we did have in
13617 MemberAccess.DoResolve. There is too much code duplicated here.
13619 2002-04-01 Miguel de Icaza <miguel@ximian.com>
13621 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
13623 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
13626 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
13627 tokens, numbers and strings.
13629 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
13632 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
13633 asyncronous parameters and the regular parameters.
13635 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
13636 specify the target directory.
13638 * expression.cs: (This.DoResolve): Simplify
13639 (As.Emit): Optimize, do not generate IsInst if the expression is
13640 always of the given type.
13642 (Is.DoResolve): Bug fix, we were reporting both always/never for
13645 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
13646 creating too many unnecessary arrays.
13648 2002-03-31 Miguel de Icaza <miguel@ximian.com>
13650 * class.cs (EmitFieldInitializer): Use Assign expression to assign
13651 fields instead of rolling our own initializer. Takes care of all
13652 implicit conversions, and drops unnecessary static checks/argument.
13654 2002-03-31 Dick Porter <dick@ximian.com>
13656 * driver.cs: use the GetDirectories() return values properly, and
13657 use "/" as path separator.
13659 2002-03-30 Miguel de Icaza <miguel@ximian.com>
13661 * expression.cs (Unary): Optimize - - expr into expr.
13662 (Binary): Optimize a + (-b) into a -b.
13664 * codegen.cs (CodeGen): Made all methods static.
13666 2002-03-29 Miguel de Icaza <miguel@ximian.com>
13670 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
13671 TypeBuilder property.
13673 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
13676 * tree.cs: Removed the various RecordXXXX, and replaced with a
13677 single RecordDecl. Removed all the accessor methods, and just
13678 left a single access point Type
13680 * enum.cs: Rename DefineEnum to DefineType.
13682 * decl.cs: New abstract method `DefineType' used to unify the
13683 Defines for Enumerations, Interfaces, TypeContainers and
13686 (FindType): Moved LookupInterfaceOrClass here. Moved the
13687 LookupBaseClasses method that used to live in class.cs and
13688 interface.cs here, and renamed to FindType.
13690 * delegate.cs: Implement DefineType. Take advantage of the
13691 refactored pattern for locating the parent builder without taking
13692 the parent_builder argument (which we know does not work if we are
13693 nested, and triggering a toplevel definition).
13695 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13697 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
13698 accessibility of a member has changed during override and report
13701 * class.cs (Method.Define, Property.Define): Only complain on
13702 overrides if the method is private, any other accessibility is
13703 fine (and since we just checked the permission is the same, we are
13706 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
13707 and elif are processed always. The other pre-processing
13708 directives are only processed if we are "taking" the path
13710 2002-03-29 Martin Baulig <martin@gnome.org>
13712 * class.cs (Method.Emit): Only emit symbolic debugging info if the
13713 current location is not Null.
13715 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
13716 a separate method so we can profile it.
13718 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
13719 `span.Seconds' are just seconds, but no minutes or hours.
13720 (MainDriver): Profile the CodeGen.SaveSymbols calls.
13722 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13724 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
13725 Remove the gratuitous set of Final:
13727 // If an interface implementation, then we can set Final.
13728 if (((flags & MethodAttributes.Abstract) == 0) &&
13729 implementing.DeclaringType.IsInterface)
13730 flags |= MethodAttributes.Final;
13732 I do not know what I was smoking when I used that.
13735 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
13736 step into fixing the name resolution issues for delegates and
13737 unifying the toplevel name resolution.
13739 2002-03-28 Martin Baulig <martin@gnome.org>
13741 * class.cs (Method.Emit): If we have a symbol writer, call its
13742 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
13743 tell it about the current method.
13745 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
13746 writer that we're going to emit the first byte of IL code for a new
13747 statement (a new source line).
13748 (EmitContext.EmitTopBlock): If we have a symbol writer, call
13749 EmitContext.Mark() before emitting any code.
13751 * location.cs (SymbolDocument): Return null when we're Null.
13753 * statement.cs (Statement): Moved the `Location loc' variable here.
13754 (Statement.EmitBoolExpression): If we have a symbol writer, call
13755 ec.Mark() before emitting any code to tell it that we're at the
13756 beginning of a new statement.
13757 (StatementExpression): Added `Location' argument to the constructor.
13758 (Block): Added public readonly variable `StartLocation' and public
13759 variable `EndLocation'. The latter is to be set using SetEndLocation().
13760 (Block): Added constructor which takes a start and end location.
13761 (Block.SetEndLocation): New method. This sets the end location.
13762 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
13763 local variables we create.
13764 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
13765 each statement and do also mark the begin and end of the block.
13767 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
13768 tell it the current lexer.Location, use Location.Null for the end of the
13770 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
13771 current block, set its end location using SetEndLocation().
13772 (statement_expression): StatementExpression constructor now takes the
13773 lexer.Location as additional argument.
13774 (for_statement, declare_local_variables): Likewise.
13775 (declare_local_variables): When creating a new implicit block, use the
13776 new Block constructor and pass it the lexer.Location.
13778 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13780 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
13781 members also on the parent interfaces recursively.
13783 2002-03-27 Miguel de Icaza <miguel@ximian.com>
13785 * report.cs: Use new formats, since Gonzalo finished the missing
13788 * expression.cs (Binary.ResolveOperator): added missing operator|
13789 operator& and operator^ for bool/bool.
13791 * cs-parser.jay: CheckDef now takes a Location argument that is
13792 used to report errors more precisly (instead of reporting the end
13793 of a definition, we try to track something which is a lot closer
13794 to the source of the problem).
13796 * cs-tokenizer.cs: Track global token use, so we can properly flag
13797 the use of #define/#undef after the first token has been seen.
13799 Also, rename the reportXXXX to Error_DescriptiveName
13801 * decl.cs (DeclSpace.IsTopLevel): Move property here from
13802 TypeContainer, so that Enum and Interface can use this too.
13804 * class.cs (TypeContainer.LookupInterfaceOrClass,
13805 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
13806 `builder' argument. Typically this was used to pass the parent
13807 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
13810 The problem is that a nested class could trigger the definition of
13811 a toplevel class, and the builder would be obviously wrong in that
13814 So we drop this argument, and we compute dynamically the
13815 TypeBuilder/ModuleBuilder (the correct information was available
13816 to us anyways from DeclSpace.Parent)
13818 * interface.cs (Interface.DefineInterface): Drop builder
13819 parameter cleanup like class.cs
13821 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
13824 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
13827 (Try.Emit): Propagate the returns value from the statement.
13829 (Return.Emit): Even if we are leavning
13831 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
13833 * modifiers.cs: Fix the computation of MethodAttributes flags.
13835 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
13837 * driver.cs: allow compilation of files that start with '/'.
13838 Add a default case when checking the argument of --target.
13840 2002-03-25 Miguel de Icaza <miguel@ximian.com>
13842 * interface.cs: Implement the same search algorithm for types in
13843 the interface code.
13845 * delegate.cs: Do not allow multiple definition.
13847 * Recovered ChangeLog that got accidentally amputated
13849 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
13851 * rootcontext.cs: Load manually enum to allow core classes to
13852 contain enumerations.
13854 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
13855 Update to new static methods in TypeManager.
13857 * typemanager.cs (GetMethod, GetConstructor): Use our
13858 implementation of FindMembers to find the members, since during
13859 corlib compilation, the types are TypeBuilders and GetMethod and
13860 GetConstructor do not work.
13862 Make all methods in TypeManager static.
13864 (InitCodeHelpers): Split the functionality from
13865 the InitCodeTypes function.
13867 * driver.cs: Call InitCodeHelpers after we have populated the
13870 * cs-parser.jay (delegate_declaration): we did not used to compute
13871 the delegate name correctly for void delegates.
13873 2002-03-24 Miguel de Icaza <miguel@ximian.com>
13875 * rootcontext.cs (RootContext): Init the interface_resolve_order
13876 and type_container_resolve_order always.
13878 (ResolveCore, BootstrapCorlib_ResolveClass,
13879 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
13880 compiler when compiling with --nostdlib
13882 * class.cs (TypeContainer.DefineType): Check that our parent is
13883 not null. This test is most important when we are bootstraping
13886 * codegen.cs: Split out the symbol writing code.
13888 2002-03-25 Martin Baulig <martin@gnome.org>
13890 * driver.cs (-g): Made -g an alias for --debug.
13892 2002-03-24 Martin Baulig <martin@gnome.org>
13894 * codegen.cs (SymbolWriter): New public variable. Returns the
13895 current symbol writer.
13896 (CodeGen): Added `bool want_debugging_support' argument to the
13897 constructor. If true, tell the ModuleBuild that we want debugging
13898 support and ask it for the ISymbolWriter.
13899 (Save): If we have a symbol writer, call it's Close() method after
13900 saving the assembly.
13902 * driver.c (--debug): New command line argument to create a
13903 debugger information file.
13905 * location.cs (SymbolDocument): New public property. Returns an
13906 ISymbolDocumentWriter object for the current source file or null
13907 if we don't have a symbol writer.
13909 2002-03-21 Miguel de Icaza <miguel@ximian.com>
13911 * driver.cs (LoadAssembly): Correctly return when all the paths
13912 have been tried and not before.
13914 * statement.cs (Switch.Emit): return the actual coverage for this
13915 statement (returns/not-returns)
13917 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
13918 switch of the statement if we are the last switch section. That
13919 kills two problems: try/catch problems (we used to emit an empty
13920 nop at the end) and switch statements where all branches would
13923 2002-03-19 Miguel de Icaza <miguel@ximian.com>
13925 * driver.cs: Add default assemblies (the equivalent to the
13926 Microsoft CSC.RSP file)
13928 * cs-tokenizer.cs: When updating `cols and setting it to zero,
13929 also update tokens_seen and set it to false.
13931 * driver.cs: Implement --recurse for Mike.
13933 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
13934 correctly splitting out the paths.
13936 2002-03-18 Miguel de Icaza <miguel@ximian.com>
13938 * interface.cs (Interface.PopulateProperty): Instead of using
13939 `parent' as the declaration space for the set parameters, use
13942 * support.cs (InternalParameters): InternalParameters constructor
13943 takes a DeclSpace instead of a TypeContainer.
13945 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
13946 types are being initialized, load the address of it before calling
13949 (New): Provide a mechanism to disable the generation of local
13950 value type temporaries when the caller will be providing us with
13951 an address to store it.
13953 (ArrayCreation.EmitDynamicInitializers): Use it.
13955 2002-03-17 Miguel de Icaza <miguel@ximian.com>
13957 * expression.cs (Invocation.EmitArguments): Only probe for array
13958 property if there is more than one argument. Sorry about that.
13960 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
13961 empty param arrays.
13963 * class.cs (Method.LabelParameters): Fix incorrect code path that
13964 prevented the `ParamArrayAttribute' from being applied to the
13967 2002-03-16 Miguel de Icaza <miguel@ximian.com>
13969 * support.cs (ReflectionParameters): Correctly compute whether the
13970 last argument is a params array. Fixes the problem with
13973 * typemanager.cs: Make the assemblies array always be non-null
13974 (empty, but non-null)
13976 * tree.cs (RecordDecl): New function that abstracts the recording
13977 of names. This reports error 101, and provides a pointer to the
13978 previous declaration. Fixes a crash in the compiler.
13980 * cs-parser.jay (constructor_declaration): Update to new grammar,
13981 and provide a constructor_body that can be empty.
13983 2002-03-15 Miguel de Icaza <miguel@ximian.com>
13985 * driver.cs: Add support for --resources.
13987 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
13988 Make all types for the various array helper methods be integer.
13990 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
13991 CheckState to ConvCast.
13993 (ConvCast): Now it takes a `checked' state argument, to avoid
13994 depending on the emit context for the conversion, and just using
13995 the resolve time setting.
13997 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
13998 instead of Invocation.EmitArguments. We do not emit the original
13999 arguments, instead we emit those which have been converted to
14000 unsigned int expressions.
14002 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
14004 * codegen.cs: ditto.
14006 * expression.cs (LocalVariableReference): Drop the use of the
14007 Store function that depended on the variable index.
14009 * statement.cs (VariableInfo): Drop the `Idx' property from this
14010 class, as this is not taking into account the indexes for
14011 temporaries tat we generate during the execution, getting the
14014 * class.cs: First emit class initializers, then call the parent
14017 * expression.cs (Binary): Fix opcode emision.
14018 (UnaryMutator.EmitCode): Support checked code generation
14020 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
14021 matches for events for both the Static and Instance scans,
14022 pointing to the same element. Fix that.
14024 2002-03-14 Miguel de Icaza <miguel@ximian.com>
14026 * rootcontext.cs (ResolveTree): Always set the
14027 interface_resolve_order, because nested interfaces will be calling
14030 * class.cs (GetInterfaceOrClass): Track the same resolution
14031 process used by TypeManager.LookupType. This fixes the nested
14032 type lookups in class declarations (separate path from
14035 (TypeContainer.DefineType): Also define nested interfaces.
14036 (TypeContainer.RegisterOrder): New public function used to
14037 register the order in which child interfaces need to be closed.
14039 Nested interfaces need to be closed after their parents have been
14042 * interface.cs (InterfaceAttr): Put all the logic for computing
14043 the interface attribute here.
14045 (DefineInterface): Register our interface order with the
14046 RootContext or with the TypeContainer depending on the case.
14048 2002-03-12 Miguel de Icaza <miguel@ximian.com>
14050 * cs-parser.jay: rework foreach statement to work with the new
14051 changes to the policy on SimpleNames.
14053 * report.cs: support Stacktrace on warnings as well.
14055 * makefile: drop --unsafe and /unsafe from the compile.
14057 2002-03-13 Ravi Pratap <ravi@ximian.com>
14059 * ecore.cs (StandardConversionExists): Modify to take an Expression
14060 as the first parameter. Ensure we do null -> reference type conversion
14063 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
14064 temporary Expression objects.
14066 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
14068 * interface.cs: workaround bug in method overloading resolution
14069 (there is already a bugzilla bug for it).
14071 2002-03-12 Miguel de Icaza <miguel@ximian.com>
14073 We could also solve this problem by having a separate path for
14074 performing type lookups, instead of DoResolve, we could have a
14075 ResolveType entry point, and only participating pieces of the
14076 production (simplename, deref, array) would implement this.
14078 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
14079 signal SimpleName to only resolve type names and not attempt to
14080 resolve anything else.
14082 * expression.cs (Cast): Set the flag.
14084 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
14086 * class.cs: Only report 108 if there is no `new' modifier.
14088 * cs-parser.jay: rework foreach statement to work with the new
14089 changes to the policy on SimpleNames.
14091 * report.cs: support Stacktrace on warnings as well.
14093 * makefile: drop --unsafe and /unsafe from the compile.
14095 2002-03-11 Miguel de Icaza <miguel@ximian.com>
14097 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
14098 lookups here, instead of doing that at parse time. This means
14099 that our grammar will not introduce `LocalVariableReferences' as
14100 expressions at this point. That solves the problem of code like
14104 static void Main ()
14108 This is only half the fix. The full fix requires parameters to
14109 also be handled in this way.
14111 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
14112 makes the use more obvious of the DeclSpace. The
14113 ec.TypeContainer.TypeBuilder is now only used to pull the
14114 TypeBuilder for it.
14116 My theory is that I can get rid of the TypeBuilder completely from
14117 the EmitContext, and have typecasts where it is used (from
14118 DeclSpace to where it matters).
14120 The only pending problem is that the code that implements Aliases
14121 is on TypeContainer, and probably should go in DeclSpace.
14123 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
14124 lookups here, instead of doing that at parse time. This means
14125 that our grammar will not introduce `LocalVariableReferences' as
14126 expressions at this point. That solves the problem of code like
14130 static void Main ()
14134 This is only half the fix. The full fix requires parameters to
14135 also be handled in this way.
14137 * class.cs (Property.DefineMethod): When implementing an interface
14138 method, set newslot, when implementing an abstract method, do not
14139 set the flag (before we tried never setting it, or always setting
14140 it, which is the difference).
14141 (Indexer.DefineMethod): same.
14142 (Method.DefineMethod): same.
14144 * ecore.cs: Only set the status used flag if we get back a Field.
14146 * attribute.cs: Temporary hack, so Paolo can keep working.
14148 2002-03-08 Ravi Pratap <ravi@ximian.com>
14150 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
14151 the unmanaged type in the case we have a MarshalAs attribute.
14153 (Resolve): Handle the case when we are parsing the special MarshalAs
14154 attribute [we need to store the unmanaged type to use later]
14156 * typemanager.cs (marshal_as_attr_type): Built in type for the
14157 MarshalAs Attribute.
14159 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
14160 on parameters and accordingly set the marshalling info.
14162 2002-03-09 Miguel de Icaza <miguel@ximian.com>
14164 * class.cs: Optimizing slightly by removing redundant code after
14165 we switched to the `NoTypes' return value.
14166 (Property.DefineMethod): use NoTypes here too.
14168 This fixes the bug I introduced in my last batch of changes.
14170 2002-03-05 Ravi Pratap <ravi@ximian.com>
14172 * tree.cs (RecordEnum): Add. We now keep track of enums too.
14174 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
14175 Enums since those are types too.
14177 * cs-parser.jay (enum_declaration): Record enums as we parse them.
14179 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
14180 thanks to a call during the lookup process.
14182 2002-03-07 Miguel de Icaza <miguel@ximian.com>
14184 * statement.cs (Foreach): Lots of work to accomodate a particular
14185 kind of foreach statement that I had not kept in mind. It is
14186 possible to have foreachs on classes that provide a GetEnumerator
14187 method that return objects that implement the "pattern" for using
14188 a foreach, there is no need to support GetEnumerator
14191 This is needed to compile nant.
14193 * decl.cs: Only report 114 if the member is not `Finalize' and if
14194 the warning level is at least 2.
14196 * class.cs: Moved the compare function from Method to
14199 (MethodSignature.InheritableMemberSignatureCompare): Add new
14200 filter function that is used to extract inheritable methods from a
14203 (Method.Define): Use the new `inheritable_method_signature_filter'
14206 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
14209 2002-03-06 Miguel de Icaza <miguel@ximian.com>
14211 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
14213 * cs-parser.jay: Add opt_semicolon to the interface declaration.
14215 * expression.cs: Pass location information to
14216 ConvertImplicitStandard.
14218 * class.cs: Added debugging code to track return values from
14221 2002-03-05 Miguel de Icaza <miguel@ximian.com>
14223 * expression.cs (Is.DoResolve): If either side of the `is' is an
14224 interface, do not flag the warning.
14226 * ecore.cs (ImplicitReferenceConversion): We need a separate test
14229 * report.cs: Allow for --fatal to be used with --probe.
14231 * typemanager.cs (NoTypes): Move the definition for the empty Type
14234 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
14236 (TypeContainer.DefineProxy): New function used to proxy to parent
14237 implementations when implementing interfaces.
14238 (TypeContainer.ParentImplements): used to lookup if our parent
14239 implements a public function that is required by an interface.
14240 (TypeContainer.VerifyPendingMethods): Hook this up.
14242 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
14243 `modules' and `assemblies' arraylists into arrays. We only grow
14244 these are the very early start up of the program, so this improves
14245 the speedof LookupType (nicely measured).
14247 * expression.cs (MakeByteBlob): Replaced unsafe code with
14248 BitConverter, as suggested by Paolo.
14250 * cfold.cs (ConstantFold.Binary): Special case: perform constant
14251 folding of string concatenation, but if either side is a string,
14252 and the other is not, then return null, and let the runtime use
14253 the concatenation on the string plus the object (using
14254 `Object.ToString').
14256 2002-03-04 Miguel de Icaza <miguel@ximian.com>
14258 Constant Folding has been implemented now.
14260 * expression.cs (Unary.Reduce): Do not throw an exception, catch
14261 the error instead on types that are not supported in one's
14264 * constant.cs (Constant and all children): New set of functions to
14265 perform implict and explicit conversions.
14267 * ecore.cs (EnumConstant): Implement the new functions to perform
14268 conversion by proxying to the child expression.
14270 * codegen.cs: (ConstantCheckState): Constant evaluation has its
14271 own separate setting that can not be turned off from the command
14272 line using --unchecked or --checked and is only controlled using
14273 the checked/unchecked statements and expressions. This setting is
14274 used by the constant folder to flag errors.
14276 * expression.cs (CheckedExpr, UncheckedExpr): Set the
14277 ConstantCheckState as well.
14279 During Resolve, they also have to flag the state, because the
14280 constant folder runs completely in the Resolve phase.
14282 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
14285 2002-03-01 Miguel de Icaza <miguel@ximian.com>
14287 * cfold.cs: New file, this file contains the constant folder.
14289 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
14290 argument to track whether we are using the resulting address to
14291 load or store a value and provide better error messages.
14293 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
14294 new AddressOf arguments.
14296 * statement.cs (Foreach.EmitCollectionForeach): Update
14298 * expression.cs (Argument.Emit): Call AddressOf with proper
14299 arguments to track usage.
14301 (New.DoEmit): Call AddressOf with new arguments.
14303 (Unary.Emit): Adjust AddressOf call.
14305 2002-03-01 Ravi Pratap <ravi@ximian.com>
14307 * cs-parser.jay (member_access): Change the case for pre-defined types
14308 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
14311 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
14314 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
14315 essentially like methods and apply attributes like MethodImplOptions to them too.
14317 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
14320 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
14321 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
14324 * Update code everywhere accordingly.
14326 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
14328 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
14330 2002-02-28 Ravi Pratap <ravi@ximian.com>
14332 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
14333 try performing lookups against those instead of jumping straight into using
14334 the 'using' clauses.
14336 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
14338 (LookupType): Perform lookups in implicit parents too.
14340 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
14341 sequence as RootContext.LookupType.
14343 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
14344 the various cases of namespace lookups into this method.
14346 2002-03-01 Miguel de Icaza <miguel@ximian.com>
14348 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
14349 in positional arguments)
14351 * class.cs (Operator): Update the AllowedModifiers to contain
14354 * cs-parser.jay: Update operator declaration to allow for the
14355 operator body to be empty.
14357 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
14360 2002-02-27 Miguel de Icaza <miguel@ximian.com>
14362 * class.cs (Method.Emit): Label parameters.
14364 * driver.cs: Return 1 or 0 as the program exit code.
14366 2002-02-26 Miguel de Icaza <miguel@ximian.com>
14368 * expression.cs: Special case the `null' object when trying to
14369 auto-compute the type, as anything can be explicitly converted to
14372 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
14373 spotting this Paolo.
14375 (Expression.ImplicitNumericConversion): Perform comparissions of
14376 the type using the underlying type in the case of an enumeration
14377 rather than using the enumeration type for the compare.
14379 Cope with the underlying == type case, which is not possible to
14382 (Expression.ConvertNumericExplicit): Perform comparissions of
14383 the type using the underlying type in the case of an enumeration
14384 rather than using the enumeration type for the compare.
14386 * driver.cs: If the user does not supply an extension, assume .exe
14388 * cs-parser.jay (if_statement): Rewrote so that we can track the
14389 location for the if statement.
14391 * expression.cs (Binary.ConstantFold): Only concat strings when
14392 the operation is "+", not everything ;-)
14394 * statement.cs (Statement.EmitBoolExpression): Take a location
14396 (If, While, Do): Track location.
14398 * expression.cs (Binary.ResolveOperator): In the object + string
14399 case, I was missing a call to ConvertImplicit
14401 2002-02-25 Ravi Pratap <ravi@ximian.com>
14403 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
14404 Location arguments. Ensure we use RootContext.LookupType to do our work
14405 and not try to do a direct Type.GetType and ModuleBuilder.GetType
14407 * interface.cs (PopulateMethod): Handle the type of the parameter being
14410 * expression.cs (Invocation.BetterFunction): Handle the case when we
14411 have a params method with no fixed arguments and a call is made with no
14414 2002-02-25 Miguel de Icaza <miguel@ximian.com>
14416 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
14417 the verbatim-string-literal
14419 * support.cs (InternalParameters.ParameterModifier): handle null
14421 (InternalParameters.ParameterType): ditto.
14423 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
14424 duplicating the name of the variable parameter.
14425 (GetParameterByName): Fix bug where we were not looking up array
14426 paramters if they were the only present (thanks Paolo!).
14427 (GetParameterInfo): We only have an empty set of types if both
14428 fixed and array are set to null.
14429 (GetParameterInfo-idx): Handle FixedParameter == null
14431 * cs-parser.jay: Handle the case where there is no catch
14432 statements (missing null test).
14434 2002-02-22 Miguel de Icaza <miguel@ximian.com>
14436 * driver.cs (MainDriver): Be conservative on our command line
14439 Catch DirectoryNotFoundException when calling GetFiles.
14441 (SplitPathAndPattern): Used to split the input specification into
14442 a path and a pattern that we can feed to Directory.GetFiles.
14444 2002-02-21 Miguel de Icaza <miguel@ximian.com>
14446 * statement.cs (Fixed): Implement the last case of the Fixed
14447 statement (string handling).
14449 * expression.cs (StringPtr): New class used to return a char * to
14450 a string; Used by the Fixed statement.
14452 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
14454 * expression.cs (Binary.ResolveOperator): Remove redundant
14455 MemberLookup pn parent type.
14456 Optimize union call, we do not need a union if the types are the same.
14457 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
14460 Specialize the use of MemberLookup everywhere, instead of using
14461 the default settings.
14463 (StackAlloc): Implement stackalloc keyword.
14465 * cs-parser.jay: Add rule to parse stackalloc.
14467 * driver.cs: Handle /h, /help, /?
14469 * expression.cs (MakeByteBlob): Removed the hacks we had in place
14470 before we supported unsafe code.
14472 * makefile: add --unsafe to the self compilation of mcs.
14474 2002-02-20 Miguel de Icaza <miguel@ximian.com>
14476 * expression.cs (PointerArithmetic): New class that is used to
14477 perform pointer arithmetic.
14478 (Binary.Resolve): Handle pointer arithmetic
14479 Handle pointer comparission.
14480 (ArrayPtr): Utility expression class that is used to take the
14481 address of an array.
14483 (ElementAccess): Implement array access for pointers
14485 * statement.cs (Fixed): Implement fixed statement for arrays, we
14486 are missing one more case before we are done.
14488 * expression.cs (Indirection): Implement EmitAssign and set the
14489 ExprClass to Variable. This allows pointer dereferences to be
14490 treated as variables, and to have values assigned to them.
14492 * ecore.cs (Expression.StoreFromPtr): New utility function to
14493 store values dereferencing.
14495 2002-02-20 Ravi Pratap <ravi@ximian.com>
14497 * expression.cs (Binary.ResolveOperator): Ensure that we are
14498 not trying to operate on a void type - this fixes the reported
14501 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
14502 the parent implementation is sealed.
14504 * ../errors/cs0239.cs : Add.
14506 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
14508 * typemanager.cs (unverifiable_code_type): Corresponds to
14509 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
14510 which have unsafe code in them.
14512 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
14515 2002-02-19 Miguel de Icaza <miguel@ximian.com>
14517 * cs-tokenizer.cs: Add support for @"litreal strings"
14519 Make tokenizer accept pre-processor directives
14520 on any column (remove the old C-like limitation).
14522 * rootcontext.cs (EmitCode): Emit any global attributes.
14523 (AddGlobalAttributes): Used to keep track of assembly attributes.
14525 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
14527 * cs-parser.jay: Add support for global attributes.
14529 2002-02-17 Miguel de Icaza <miguel@ximian.com>
14531 * expression.cs (Indirection): New helper class. Unary will
14532 create Indirection classes to be able to implement the
14533 IMemoryLocation interface on it.
14535 2002-02-16 Miguel de Icaza <miguel@ximian.com>
14537 * cs-parser.jay (fixed_statement): reference the right statement.
14539 * statement.cs (Fixed.Emit): Finish implementing the fixed
14540 statement for the &x case.
14542 2002-02-14 Miguel de Icaza <miguel@ximian.com>
14544 * class.cs (Property.Define, Method.Define): Remove newslot when
14547 * modifiers.cs: My use of NewSlot when `Abstract' was set was
14548 wrong. NewSlot should only be used if the `new' keyword is present.
14550 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
14551 locating our system dir. Sorry about this.
14553 2002-02-13 Miguel de Icaza <miguel@ximian.com>
14555 * driver.cs (GetSystemDir): Compute correctly the location of our
14556 system assemblies. I was using the compiler directory instead of
14557 the library directory.
14559 2002-02-13 Ravi Pratap <ravi@ximian.com>
14561 * expression.cs (BetterFunction): Put back in what Miguel commented out
14562 since it is the correct fix. The problem is elsewhere ;-)
14564 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
14565 parameters of the parms method are themselves compatible or not !
14567 (StandardConversionExists): Fix very dangerous bug where we were forgetting
14568 to check that a class implements an interface before saying that an implicit
14569 conversion was allowed. Use ImplementsInterface to do the checking.
14571 2002-02-13 Miguel de Icaza <miguel@ximian.com>
14573 * class.cs (Method.Define): Track whether we are an explicit
14574 implementation or not. And only call DefineMethodOverride if we
14575 are an explicit implementation.
14577 (Property.DefineMethod): Ditto.
14579 2002-02-11 Ravi Pratap <ravi@ximian.com>
14581 * expression.cs (BetterFunction): Catch hideous bug which was
14582 preventing us from detecting ambiguous calls due to implicit casts i.e
14585 2002-01-29 Miguel de Icaza <miguel@ximian.com>
14587 * support.cs (Pair): Remove un-needed method. I figured why I was
14588 getting the error in cs-parser.jay, the variable in a foreach loop
14589 is readonly, and the compiler does not really treat this as a variable.
14591 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
14592 instead of EQUALS in grammar.
14594 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
14596 * expression.cs (Unary.DoResolve): Check whether the argument is
14599 2002-01-28 Miguel de Icaza <miguel@ximian.com>
14601 * support.cs: Api for Pair to set a value. Despite the fact that
14602 the variables are public the MS C# compiler refuses to compile
14603 code that accesses the field if the variable is part of a foreach
14606 * statement.cs (Fixed): Begin implementation of the fixed
14609 (Block.AddVariable): Return the VariableInfo on success and null
14610 on failure instead of true/false.
14612 * cs-parser.jay (foreach): Catch errors on variables already
14613 defined (we were ignoring this value before) and properly unwind
14614 the block hierarchy
14616 (fixed_statement): grammar for the fixed statement.
14618 2002-01-25 Miguel de Icaza <miguel@ximian.com>
14620 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
14621 pointer types to be incretemented.
14623 (SizeOf): Implement.
14625 * cs-parser.jay (pointer_member_access): Implement
14626 expr->IDENTIFIER production.
14628 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
14629 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
14632 (Unary): Implement indirection.
14634 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
14635 use in non-unsafe context).
14637 (SimpleName.DoResolve): Check for pointers in field access on safe
14640 (Expression.LoadFromPtr): Factor the load-indirect code in this
14641 function. This was duplicated in UnboxCast and ParameterReference
14643 2002-01-24 Miguel de Icaza <miguel@ximian.com>
14645 * expression.cs (ComposedCast): report an error if a pointer cast
14646 is used in a safe region.
14648 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
14649 pointer type casts in unsafe context.
14651 * codegen.cs (EmitContext): Set up IsUnsafe.
14653 * cs-parser.jay (non_expression_type): Add productions for pointer
14656 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
14657 code. We should not use force into static mode if the method is
14658 not virtual. Fixes bug in MIS
14660 * statement.cs (Do.Emit, While.Emit, For.Emit,
14661 Statement.EmitBoolExpression): Add support to Do and While to
14662 propagate infinite loop as `I do return' semantics.
14664 Improve the For case to also test for boolean constants.
14666 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
14667 to the list of attributes we can add.
14669 Remove `EmitContext' argument.
14671 * class.cs (Method.Define): Apply parameter attributes.
14672 (Constructor.Define): Apply parameter attributes.
14673 (MethodCore.LabelParameters): Move here the core of labeling
14676 * support.cs (ReflectionParameters.ParameterModifier,
14677 InternalParameters.ParameterModifier): Use IsByRef on the type and
14678 only return the OUT bit for these parameters instead of in/out/ref
14681 This is because I miss-understood things. The ParameterInfo.IsIn
14682 and IsOut represent whether the parameter has the [In] and [Out]
14685 2002-01-22 Miguel de Icaza <miguel@ximian.com>
14687 * ecore.cs (FieldExpr.Emit): Release temporaries.
14689 * assign.cs (LocalTemporary.Release): new function.
14691 * codegen.cs (EmitContext.GetTemporaryStorage,
14692 EmitContext.FreeTemporaryStorage): Rework the way we deal with
14693 temporary storage. Now we can "put back" localbuilders when we
14696 2002-01-21 Miguel de Icaza <miguel@ximian.com>
14698 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
14699 need to make a copy of the variable to generate verifiable code.
14701 2002-01-19 Miguel de Icaza <miguel@ximian.com>
14703 * driver.cs: Compute dynamically the system directory.
14705 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
14706 Slower, but more generally useful. Used by the abstract
14707 registering implementation.
14709 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
14710 the rules for the special rule on Type/instances. First check if
14711 we have the same name, and if so, try that special static path
14712 rather than the instance path.
14714 2002-01-18 Miguel de Icaza <miguel@ximian.com>
14716 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
14719 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
14720 Enum, ValueType, Delegate or Array for non-corlib compiles.
14722 * cs-tokenizer.cs: Catch long identifiers (645)
14724 * typemanager.cs (IndexerPropetyName): Ravi never tested this
14727 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
14728 fix, we were returning too early, so we were not registering
14729 pending methods from abstract classes.
14731 Do not register pending methods if the class is abstract.
14733 * expression.cs (Conditional.DoResolve): Report circular implicit
14734 conversions when we neecd to compute it for conditional
14737 (Is.DoResolve): If the expression is always of the provided type,
14738 flag warning 183. If the expression can not ever be of the
14739 provided type flag warning 184.
14741 * class.cs: Catch 169 as well.
14743 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
14746 2002-01-18 Nick Drochak <ndrochak@gol.com>
14748 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
14750 2002-01-17 Miguel de Icaza <miguel@ximian.com>
14752 * interface.cs: (PopulateMethod): Check for pointers being defined
14753 only if the unsafe context is active.
14754 (PopulateProperty): ditto.
14755 (PopulateIndexer): ditto.
14757 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
14758 specified. If pointers are present, make sure that they are
14759 present in an unsafe context.
14760 (Constructor, Constructor.Define): ditto.
14761 (Field, Field.Define): ditto.
14762 (Property, Property.Define): ditto.
14763 (Event, Event.Define): ditto.
14765 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
14766 hashtable if there are classes or structs defined.
14768 * expression.cs (LocalVariableReference.DoResolve): Simplify this
14769 code, as the constant resolution moved.
14771 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
14772 the metadata, so we can flag error 133.
14774 * decl.cs (MemberCore.UnsafeOK): New function to test that a
14775 pointer is being declared in an unsafe context.
14777 2002-01-16 Miguel de Icaza <miguel@ximian.com>
14779 * modifiers.cs (Modifiers.Check): Require a Location argument.
14780 Report error 227 for Unsafe use.
14782 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
14784 * statement.cs (For.Emit): If the test is null, then report that
14785 we do `return', as we wont reach anything afterwards.
14787 (Switch.SwitchGoverningType): Track the expression that matched
14790 * driver.cs: Allow negative numbers as an error code to flag.
14792 * cs-parser.jay: Handle 1551.
14794 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
14796 2002-01-15 Miguel de Icaza <miguel@ximian.com>
14798 * cs-parser.jay: Report 1518 (type declaration can only contain
14799 class, struct, interface, enum or delegate)
14801 (switch_label): Report 1523 (keywords `case' or `default' must
14804 (opt_switch_sections): Report 1522 (empty switch)
14806 * driver.cs: Report 1515 (response file specified multiple times)
14807 Report 1516 (Source file specified multiple times).
14809 * expression.cs (Argument.Resolve): Signal 1510
14811 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
14812 access not allowed in static code)
14814 2002-01-11 Ravi Pratap <ravi@ximian.com>
14816 * typemanager.cs (IsPointerType): Utility method which we are going
14819 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
14820 the object type, so we take care of that.
14822 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
14824 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
14825 added to non-params parameters :-)
14827 * typemanager.cs (CSharpName): Include 'void' type too.
14829 (void_ptr_type): Include in the set of core types.
14831 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
14834 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
14837 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
14838 completely forgotten about it.
14840 2002-01-10 Ravi Pratap <ravi@ximian.com>
14842 * cs-parser.jay (pointer_type): Add. This begins our implementation
14843 of parsing rules for unsafe code.
14845 (unsafe_statement): Implement.
14847 (embedded_statement): Modify to include the above.
14849 * statement.cs (Unsafe): Implement new class for unsafe blocks.
14851 * codegen.cs (EmitContext.InUnsafe): Add. This determines
14852 if the current context is an unsafe one.
14854 * cs-parser.jay (local_variable_pointer_type): Since local variable types
14855 are handled differently, we need separate rules for them.
14857 (local_variable_declaration): Update to use local_variable_pointer_type
14858 to allow variable declarations of unmanaged pointer types.
14860 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
14861 in unsafe contexts.
14863 * ../errors/cs0214.cs : Add.
14865 2002-01-16 Nick Drochak <ndrochak@gol.com>
14867 * makefile: remove 'response' file when cleaning.
14869 2002-01-15 Miguel de Icaza <miguel@ximian.com>
14871 * cs-parser.jay: Report 1524.
14873 2002-01-14 Miguel de Icaza <miguel@ximian.com>
14875 * typemanager.cs (RegisterMethod): drop checking if we have
14876 registered this from here
14878 2002-01-12 Miguel de Icaza <miguel@ximian.com>
14880 * class.cs (Method.EmitDestructor): Implement calling our base
14883 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
14884 value of InFinally.
14886 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
14887 this routine and will wrap the call in a try/catch block. Deal
14890 2002-01-11 Miguel de Icaza <miguel@ximian.com>
14892 * ecore.cs (Expression.MemberLookup): instead of taking a
14893 parameter `same_type' that was used to tell whether we could
14894 access private members we compute our containing type from the
14897 (FieldExpr): Added partial support for volatile fields. This does
14898 not work for volatile fields exposed from assemblies, as I can not
14899 figure out how to extract the modreq from it.
14901 Updated all the source files to use this.
14903 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
14904 because it is referenced by MemberLookup very often.
14906 2002-01-09 Ravi Pratap <ravi@ximian.com>
14908 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
14909 TypeBuilder.GetCustomAttributes to retrieve what we need.
14911 Get rid of redundant default_member_attr_type as this is the same as
14912 default_member_type which already exists.
14914 * interface.cs, attribute.cs : Update accordingly.
14916 2002-01-08 Miguel de Icaza <miguel@ximian.com>
14918 * typemanager.cs: Enable IndexerPropertyName again. It does not
14919 work for TYpeBuilders though. Ravi, can you please fix this?
14921 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
14923 * expression.cs (Argument.Emit): Handle the case of ref objects
14924 being passed to ref functions;
14926 (ParameterReference.EmitLoad): Loads the content of the pointer
14927 without dereferencing.
14929 2002-01-07 Miguel de Icaza <miguel@ximian.com>
14931 * cs-tokenizer.cs: Implemented the pre-processing expressions.
14933 2002-01-08 Ravi Pratap <ravi@ximian.com>
14935 * class.cs (Indexer.DefineMethod): Incorporate the interface
14936 type in the name of the method if we are doing explicit interface
14939 * expression.cs (ConversionExists): Remove as it is completely obsolete.
14941 (BetterConversion): Fix extremely trivial bug where we were referring to
14942 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
14945 * ../errors/bug16.cs : Add although we have fixed it.
14947 2002-01-07 Miguel de Icaza <miguel@ximian.com>
14949 * expression.cs (BaseIndexer): Begin implementation.
14951 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
14953 * cs-parser.jay (indexer_declarator): Use qualified_identifier
14954 production directly to remove a shift/reduce, and implement
14955 explicit interface implementation.
14957 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
14958 after a floating point suffix.
14960 * expression.cs (DoNumericPromotions): Improved the conversion for
14961 uint/uint. If we have a constant, we avoid doing a typecast to a
14964 * class.cs (Indexer): Implement explicit interface implementation
14967 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
14969 * class.cs: make the default instance constructor public and hidebysig.
14971 2001-01-03 Ravi Pratap <ravi@ximian.com>
14973 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
14974 so we can call it from elsewhere.
14976 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
14977 we emit it internally if the class has a defined indexer; otherwise the user
14978 emits it by decorating the class definition with the DefaultMemberAttribute.
14980 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
14981 attribute is not used on a type which defines an indexer.
14983 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
14984 character when we skip whitespace.
14986 * ../errors/cs0646.cs : Add.
14988 2002-01-03 Miguel de Icaza <miguel@ximian.com>
14990 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
14993 * makefile: Add practical target `mcs3.exe' which builds the third
14994 generation compiler.
14996 * expression.cs (New): Fix structures constructor calling.
14998 * class.cs (Property, Method, Indexer): Emit Final flag on the
14999 method if we are an interface implementation and we are not
15002 * ecore.cs (PropertyExpr): New public field `IsBase', tells
15003 whether this property is referencing a `base' method.
15005 * expression.cs (Invocation.EmitCall): take an extra argument:
15006 is_base, this is used to determine whether the `call' or
15007 `callvirt' opcode should be used.
15010 * delegate.cs: update EmitCall.
15012 * class.cs (Method.Define): Set NewSlot for the cases where we are
15013 not implementing an interface method.
15015 (Property.Define): ditto.
15017 2002-01-02 Miguel de Icaza <miguel@ximian.com>
15019 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
15020 'r'. Allows mcs to parse itself fully.
15022 2002-01-02 Ravi Pratap <ravi@ximian.com>
15024 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
15025 of the number of initializers that require the InitializeArray method.
15027 (CheckIndices): Store the Expression in all cases - not the plain value. Also
15028 update the above field where necessary.
15030 (MakeByteBlob): Update accordingly.
15032 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
15035 (EmitDynamicInitializers): Update in accordance with the new optimization.
15037 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
15038 same OpCode applies.
15040 * cs-parser.jay : Fix some glaring errors I introduced.
15042 2002-01-01 Ravi Pratap <ravi@ximian.com>
15044 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
15045 so that we can check for name clashes there too.
15047 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
15048 for interface indexers.
15050 * interfaces.cs (Define): Emit the default member attribute.
15052 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
15053 variable was being referred to while setting the value ;-)
15055 2002-01-01 Miguel de Icaza <miguel@ximian.com>
15057 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
15058 byte-by-byte information when we know the data is zero.
15060 Make the block always a multiple of 4, because
15061 DefineInitializedData has a bug.
15063 * assign.cs: Fix, we should assign from the temporary, not from
15066 * expression.cs (MakeByteBlob): Fix my incorrect code.
15068 2001-12-31 Miguel de Icaza <miguel@ximian.com>
15070 * typemanager.cs (EnumToUnderlying): This function is used to get
15071 the underlying type from an enumeration, because it does not
15074 * constant.cs: Use the I4_S form for values between -128 and 127.
15076 * statement.cs (Block.LookupLabel): Looks up a label.
15077 (Block): Drop support for labeled blocks.
15079 (LabeledStatement): New kind of statement that represents a label
15082 (Goto): Finally implement this bad boy.
15084 * cs-parser.jay: Update to reflect new mechanism to implement
15087 2001-12-30 Miguel de Icaza <miguel@ximian.com>
15089 * codegen.cs (EmitContext.This): a codegen property that keeps the
15090 a single instance of this instead of creating many different this
15093 * delegate.cs (Delegate.DoResolve): Update to use the property;
15095 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
15097 * expression.cs (BaseAccess.DoResolve): Ditto.
15099 2001-12-29 Ravi Pratap <ravi@ximian.com>
15101 * typemanager.cs (methodimpl_attr_type): Add to hold the type
15102 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
15104 (InitCoreTypes): Update accordingly.
15106 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
15107 so we can quickly store the state.
15109 (ApplyAttributes): Set the correct implementation flags
15110 for InternalCall methods.
15112 2001-12-29 Miguel de Icaza <miguel@ximian.com>
15114 * expression.cs (EmitCall): if a method is not virtual, then do
15115 not use callvirt on it.
15117 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
15118 user defined stuff) requires the use of stobj, which takes an
15119 address on the stack instead of an array and an index. So emit
15120 the Ldelema operation for it.
15122 (EmitStoreOpcode): Use stobj for valuetypes.
15124 (UnaryMutator.EmitCode): Use the right 1 value depending on
15125 whether we are dealing with int64/uint64, float or doubles.
15127 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
15128 constructors that I implemented last night.
15130 (Constructor.IsDefault): Fix to work properly for static
15133 * cs-parser.jay (CheckDef): report method signature errors.
15134 Update error number 103 to be 132.
15136 * decl.cs: New AdditionResult enumeration value: MethodExists.
15137 Although we do this check for methods later on in the semantic
15138 analysis, catching repeated default constructors is so easy that
15139 we catch these here.
15141 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
15144 (ParameterReference.EmitAssign, Emit): handle
15147 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
15148 (ArrayAccess.EmitStoreOpcode): ditto.
15150 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
15152 * expression.cs (MakeByteBlob): Complete all the missing types
15153 (uint, short, ushort, byte, sbyte)
15155 * class.cs: Only init instance field initializers on instance
15158 Rename `constructors' to instance_constructors.
15160 (TypeContainer.AddConstructor): Only add constructors to the list
15161 if it is not static.
15163 Make sure that we handle default_static_constructor independently
15164 everywhere where we handle instance_constructors
15166 2001-12-28 Miguel de Icaza <miguel@ximian.com>
15168 * class.cs: Do not lookup or create a base initializer for a
15169 static constructor.
15171 (ConstructorInitializer.Resolve): use the proper type to lookup
15174 * cs-parser.jay: Report error 1585 (modifiers between type and name).
15176 * enum.cs, interface.cs: Remove CloseType, this is taken care by
15179 * decl.cs: CloseType is now an virtual method, the default
15180 implementation just closes this type.
15182 2001-12-28 Ravi Pratap <ravi@ximian.com>
15184 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
15185 to PreserveSig by default. Also emit HideBySig on such methods.
15187 Basically, set the defaults to standard values.
15189 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
15190 argument, if candidate is better, it can't be worse than the best !
15192 (Invocation): Re-write bits to differentiate between methods being
15193 applicable in their expanded form and their normal form - for params
15196 Get rid of use_standard everywhere as only standard conversions are allowed
15197 in overload resolution.
15199 More spec conformance.
15201 2001-12-27 Miguel de Icaza <miguel@ximian.com>
15203 * driver.cs: Add --timestamp, to see where the compiler spends
15206 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
15207 `this' in static code.
15209 (SimpleName.DoResolve): Implement in terms of a helper function
15210 that allows static-references to be passed upstream to
15213 (Expression.ResolveWithSimpleName): Resolve specially simple
15214 names when called by MemberAccess to implement the special
15217 (Expression.ImplicitReferenceConversion): Handle conversions from
15218 Null to reference types before others, as Null's type is
15221 * expression.cs (Invocation.EmitCall): Handle the special case of
15222 calling methods declared on a reference type from a ValueType
15223 (Base classes System.Object and System.Enum)
15225 (MemberAccess.Resolve): Only perform lookups on Enumerations if
15226 the left hand side is a TypeExpr, not on every enumeration.
15228 (Binary.Resolve): If types are reference types, then do a cast to
15229 object on operators != and == of both arguments.
15231 * typemanager.cs (FindMembers): Extract instance and static
15232 members if requested.
15234 * interface.cs (PopulateProperty): Use void_type instead of null
15235 as the return type for the setter method.
15237 (PopulateIndexer): ditto.
15239 2001-12-27 Ravi Pratap <ravi@ximian.com>
15241 * support.cs (ReflectionParameters): Fix minor bug where we
15242 were examining the wrong parameter for the ParamArray attribute.
15244 Cope with requests for the type of the parameter at position
15245 greater than the params parameter's. We now return the element
15246 type of the params array as that makes more sense.
15248 * expression.cs (Invocation.IsParamsMethodApplicable): Update
15249 accordingly as we no longer have to extract the element type
15252 (Invocation.OverloadResolve): Update.
15254 2001-12-27 Miguel de Icaza <miguel@ximian.com>
15256 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
15257 against IEnumerator, test whether the return value is a descendant
15258 of the IEnumerator interface.
15260 * class.cs (Indexer.Define): Use an auxiliary method to implement
15261 the other bits of the method definition. Begin support for
15262 explicit interface implementation.
15264 (Property.DefineMethod): Use TypeManager.void_type instead of null
15265 for an empty return value.
15267 2001-12-26 Miguel de Icaza <miguel@ximian.com>
15269 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
15270 dealing with a FieldExpr which is composed of a FieldBuilder, in
15271 the code path we did extract the constant, but we should have
15272 obtained the underlying value to be able to cast it (otherwise we
15273 end up in an infinite loop, this is what Ravi was running into).
15275 (ArrayCreation.UpdateIndices): Arrays might be empty.
15277 (MemberAccess.ResolveMemberAccess): Add support for section
15278 14.5.4.1 that deals with the special case of E.I when E is a type
15279 and something else, that I can be a reference to a static member.
15281 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
15282 handle a particular array type to create byte blobs, it is just
15283 something we dont generate byteblobs for.
15285 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
15288 * location.cs (Push): remove the key from the hashtable that we
15289 are about to add. This happens for empty files.
15291 * driver.cs: Dispose files after we have parsed them.
15293 (tokenize): new function that only runs the tokenizer on its
15294 input, for speed testing.
15296 2001-12-26 Ravi Pratap <ravi@ximian.com>
15298 * class.cs (Event.Define): Define the private field only if there
15299 are no accessors defined.
15301 * expression.cs (ResolveMemberAccess): If there is no associated
15302 field with the event, that means we have an event defined with its
15303 own accessors and we should flag error cs0070 since transforming
15304 ourselves into a field is not valid in that case.
15306 * ecore.cs (SimpleName.DoResolve): Same as above.
15308 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
15309 and charset to sane values.
15311 2001-12-25 Ravi Pratap <ravi@ximian.com>
15313 * assign.cs (DoResolve): Perform check on events only if they
15314 are being accessed outside the declaring type.
15316 * cs-parser.jay (event_declarations): Update rules to correctly
15317 set the type of the implicit parameter etc.
15319 (add_accessor, remove_accessor): Set current local parameters.
15321 * expression.cs (Binary): For delegate addition and subtraction,
15322 cast the return value from the method into the appropriate delegate
15325 2001-12-24 Ravi Pratap <ravi@ximian.com>
15327 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
15328 of these as the workaround is unnecessary.
15330 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
15331 delegate data - none of that is needed at all.
15333 Re-write bits to extract the instance expression and the delegate method
15336 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
15339 * attribute.cs (ApplyAttributes): New method to take care of common tasks
15340 of attaching attributes instead of duplicating code everywhere.
15342 * everywhere : Update code to do attribute emission using the above method.
15344 2001-12-23 Miguel de Icaza <miguel@ximian.com>
15346 * expression.cs (IsParamsMethodApplicable): if there are not
15347 parameters, return immediately.
15349 * ecore.cs: The 0 literal can be implicity converted to an enum
15352 (SimpleName.DoResolve): First lookup the type, then lookup the
15355 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
15356 want to get its address. If the InstanceExpression is not
15357 addressable, store the result in a temporary variable, then get
15360 * codegen.cs: Only display 219 errors on warning level or above.
15362 * expression.cs (ArrayAccess): Make it implement the
15363 IMemoryLocation interface.
15365 (Binary.DoResolve): handle the operator == (object a, object b)
15366 and operator != (object a, object b) without incurring into a
15367 BoxedCast (because 5 != o should never be performed).
15369 Handle binary enumerator operators.
15371 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
15372 value type, otherwise use Ldelem_ref.
15374 Use precomputed names;
15376 (AddressOf): Implement address of
15378 * cs-parser.jay (labeled_statement): Fix recursive block
15379 addition by reworking the production.
15381 * expression.cs (New.DoEmit): New has a special case:
15383 If we are dealing with a ValueType, we have a few
15384 situations to deal with:
15386 * The target of New is a ValueType variable, that is
15387 easy, we just pass this as the variable reference
15389 * The target of New is being passed as an argument,
15390 to a boxing operation or a function that takes a
15393 In this case, we need to create a temporary variable
15394 that is the argument of New.
15397 2001-12-23 Ravi Pratap <ravi@ximian.com>
15399 * rootcontext.cs (LookupType): Check that current_type is not null before
15400 going about looking at nested types.
15402 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
15403 not implement the IAssignMethod interface any more.
15405 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
15406 where we tranform them into FieldExprs if they are being resolved from within
15407 the declaring type.
15409 * ecore.cs (SimpleName.DoResolve): Do the same here.
15411 * assign.cs (DoResolve, Emit): Clean up code considerably.
15413 * ../errors/bug10.cs : Add.
15415 * ../errors/cs0070.cs : Add.
15417 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
15419 * assign.cs : Get rid of EventIsLocal everywhere.
15421 2001-12-23 Miguel de Icaza <miguel@ximian.com>
15423 * ecore.cs (ConvertIntLiteral): finished the implementation.
15425 * statement.cs (SwitchLabel): Convert the value we are using as a
15426 key before looking up the table.
15428 2001-12-22 Miguel de Icaza <miguel@ximian.com>
15430 * codegen.cs (EmitTopBlock): Require a Location argument now.
15432 * cs-parser.jay (constructor_declarator): We need to setup
15433 current_local_parameters before we parse the
15434 opt_constructor_initializer, to allow the variables to be bound
15435 to the constructor arguments.
15437 * rootcontext.cs (LookupType): First lookup nested classes in our
15438 class and our parents before we go looking outside our class.
15440 * expression.cs (ConstantFold): Extract/debox the values at the
15443 * rootcontext.cs (EmitCode): Resolve the constants first before we
15444 resolve the types. This is not really needed, but it helps debugging.
15446 * statement.cs: report location.
15448 * cs-parser.jay: pass location to throw statement.
15450 * driver.cs: Small bug fix.
15452 * report.cs: Updated format to be 4-zero filled digits.
15454 2001-12-22 Ravi Pratap <ravi@ximian.com>
15456 * expression.cs (CheckIndices): Fix minor bug where the wrong
15457 variable was being referred to ;-)
15459 (DoEmit): Do not call EmitStaticInitializers when the
15460 underlying type is System.Object.
15462 2001-12-21 Ravi Pratap <ravi@ximian.com>
15464 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
15465 and do the usual workaround for SRE.
15467 * class.cs (MyEventBuilder.EventType): New member to get at the type
15468 of the event, quickly.
15470 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
15472 * assign.cs (Assign.DoResolve): Handle the case when the target
15473 is an EventExpr and perform the necessary checks.
15475 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
15478 (SimpleName.MemberStaticCheck): Include check for EventExpr.
15480 (EventExpr): Set the type in the constructor itself since we
15481 are meant to be born fully resolved.
15483 (EventExpr.Define): Revert code I wrote earlier.
15485 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
15486 instance expression is null. The instance expression is a This in that case
15487 or a null, depending on whether it is a static method or not.
15489 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
15490 refers to more than one method.
15492 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
15493 and accordingly flag errors.
15495 2001-12-21 Miguel de Icaza <miguel@ximian.com>
15497 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
15499 2001-12-22 Miguel de Icaza <miguel@ximian.com>
15501 * location.cs (ToString): Provide useful rutine.
15503 2001-12-21 Miguel de Icaza <miguel@ximian.com>
15505 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
15506 objects, return the actual integral boxed.
15508 * statement.cs (SwitchLabel): define an ILLabel for each
15511 (Switch.CheckSwitch): If the value is a Literal, extract
15512 the underlying literal.
15514 Also in the unused hashtable we had, add the SwitchLabel so we can
15515 quickly look this value up.
15517 * constant.cs: Implement a bunch of new constants. Rewrite
15518 Literal based on this. Made changes everywhere to adapt to this.
15520 * expression.cs (Expression.MakeByteBlob): Optimize routine by
15521 dereferencing array only once, and also copes with enumrations.
15523 bytes are two bytes wide, not one.
15525 (Cast): Perform constant conversions.
15527 * ecore.cs (TryImplicitIntConversion): Return literals instead of
15528 wrappers to the literals here.
15530 * expression.cs (DoNumericPromotions): long literals can converted
15531 to ulong implicity (this is taken care of elsewhere, but I was
15532 missing this spot).
15534 * ecore.cs (Expression.Literalize): Make the return type Literal,
15535 to improve type checking.
15537 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
15539 2001-12-20 Miguel de Icaza <miguel@ximian.com>
15541 * literal.cs: Revert code from ravi that checked the bounds. The
15542 bounds are sane by the definition of the type itself.
15544 * typemanager.cs: Fix implementation of ImplementsInterface. We
15545 need to actually look up in our parent hierarchy for interfaces
15548 * const.cs: Use the underlying type for enumerations
15550 * delegate.cs: Compute the basename for the delegate creation,
15551 that should fix the delegate test case, and restore the correct
15552 Type Lookup semantics in rootcontext
15554 * rootcontext.cs: Revert Ravi's last patch. The correct way of
15555 referencing a nested type with the Reflection API is using the "+"
15558 * cs-parser.jay: Do not require EOF token at the end.
15560 2001-12-20 Ravi Pratap <ravi@ximian.com>
15562 * rootcontext.cs (LookupType): Concatenate type names with
15563 a '.' instead of a '+' The test suite passes again.
15565 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
15566 field of the enumeration.
15568 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
15569 the case when the member is an EventExpr.
15571 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
15572 static has an associated instance expression.
15574 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
15576 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
15578 * class.cs (Event.Define): Register event and perform appropriate checks
15581 We define the Add and Remove methods even if the use provides none because
15582 in that case, we provide default implementations ourselves.
15584 Define a private field of the type of the event. This is done by the CSC compiler
15585 and we should be doing it too ;-)
15587 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
15588 More methods we use in code we generate.
15590 (multicast_delegate_type, delegate_type): Two separate types since the distinction
15593 (InitCoreTypes): Update accordingly for the above.
15595 * class.cs (Event.Emit): Generate code for default accessors that we provide
15597 (EmitDefaultMethod): Do the job in the above.
15599 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
15602 2001-12-20 Miguel de Icaza <miguel@ximian.com>
15604 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
15605 builders even if we were missing one.
15607 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
15608 pass the Basename as our class name instead of the Name. The
15609 basename will be correctly composed for us.
15611 * parameter.cs (Paramters): Now takes a Location argument.
15613 * decl.cs (DeclSpace.LookupType): Removed convenience function and
15614 make all the code call directly LookupType in RootContext and take
15615 this chance to pass the Location information everywhere.
15617 * Everywhere: pass Location information.
15619 2001-12-19 Miguel de Icaza <miguel@ximian.com>
15621 * class.cs (Constructor.Define): Updated way of detecting the
15622 length of the parameters.
15624 (TypeContainer.DefineType): Use basename as the type name for
15627 (TypeContainer.Define): Do not recursively define types here, as
15628 definition is taken care in order by the RootContext.
15630 * tree.cs: Keep track of namespaces in a per-file basis.
15632 * parameter.cs (Parameter.ComputeSignature): Update to use
15635 (Parameters.GetSignature): ditto.
15637 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
15638 instead of a TypeContainer.
15640 (Interface.SemanticAnalysis): Use `this' instead of our parent to
15641 resolve names. Because we need to be resolve in our context, not
15644 * driver.cs: Implement response files.
15646 * class.cs (TypeContainer.DefineType): If we are defined, do not
15647 redefine ourselves.
15649 (Event.Emit): Emit the code for add/remove handlers.
15650 (Event.Define): Save the MethodBuilders for add/remove.
15652 * typemanager.cs: Use pair here too.
15654 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
15655 DictionaryEntry requires the first argument to be non-null.
15657 (enum_declaration): Compute full name for registering the
15660 (delegate_declaration): Instead of using
15661 formal_parameter_list, use opt_formal_parameter_list as the list
15664 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
15665 (EventParsing): New property that controls whether `add' and
15666 `remove' are returned as tokens or identifiers (for events);
15668 2001-12-19 Ravi Pratap <ravi@ximian.com>
15670 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
15671 use MyEventBuilder only and let it wrap the real builder for us.
15673 (MyEventBuilder): Revamp constructor etc.
15675 Implement all operations that we perform on EventBuilder in precisely the same
15678 (FindMembers): Update to use the EventBuilder member.
15680 (Event.Emit): Update accordingly.
15682 2001-12-18 Ravi Pratap <ravi@ximian.com>
15684 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
15685 by calling the appropriate methods.
15687 (GetCustomAttributes): Make stubs as they cannot possibly do anything
15690 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
15692 2001-12-17 Ravi Pratap <ravi@ximian.com>
15694 * delegate.cs (Delegate.Populate): Check that the return type
15695 and various parameters types are indeed accessible.
15697 * class.cs (Constructor.Define): Same here.
15699 (Field.Define): Ditto.
15701 (Event.Define): Ditto.
15703 (Operator.Define): Check that the underlying Method defined itself
15704 correctly - so it's MethodBuilder should not be null.
15706 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
15707 expression happens to be null.
15709 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
15710 members but as of now we don't seem to be able to do anything really useful with it.
15712 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
15713 not the EventBuilder.
15715 2001-12-18 Miguel de Icaza <miguel@ximian.com>
15717 * cs-tokenizer.cs: Add support for defines.
15718 Add support for #if, #elif, #else, #endif
15720 (eval_var): evaluates a variable.
15721 (eval): stubbed for evaluating functions.
15723 * cs-parser.jay: Pass the defines information
15725 * driver.cs: Add --define command line option.
15727 * decl.cs: Move MemberCore here.
15729 Make it the base class for DeclSpace. This allows us to catch and
15730 report 108 and 109 for everything now.
15732 * class.cs (TypeContainer.Define): Extract all the members
15733 before populating and emit the warning 108 (new keyword required
15734 to override) instead of having each member implement this.
15736 (MemberCore.Define): New abstract method, we will be using this in
15737 the warning reporting engine in Populate.
15739 (Operator.Define): Adjust to new MemberCore protocol.
15741 * const.cs (Const): This does not derive from Expression, it is a
15742 temporary object we use to create fields, it is a MemberCore.
15744 * class.cs (Method.Define): Allow the entry point to be in a
15747 * driver.cs: Rewrite the argument handler to clean it up a bit.
15749 * rootcontext.cs: Made it just an auxiliary namespace feature by
15750 making everything static.
15752 * driver.cs: Adapt code to use RootContext type name instead of
15755 * delegate.cs: Remove RootContext argument.
15757 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
15760 * class.cs (Event.Define): The lookup can fail.
15762 * cs-tokenizer.cs: Begin implementation of pre-procesor.
15764 * expression.cs: Resolve the this instance before invoking the code.
15766 2001-12-17 Miguel de Icaza <miguel@ximian.com>
15768 * cs-parser.jay: Add a production in element_access that allows
15769 the thing to become a "type" reference. This way we can parse
15770 things like "(string [])" as a type.
15772 Note that this still does not handle the more complex rules of
15776 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
15778 * ecore.cs: (CopyNewMethods): new utility function used to
15779 assemble the list of methods from running FindMembers.
15781 (MemberLookup): Rework FindMembers so that
15783 2001-12-16 Miguel de Icaza <miguel@ximian.com>
15785 * class.cs (TypeContainer): Remove Delegates who fail to be
15788 * delegate.cs (Populate): Verify that we dont get null return
15789 values. TODO: Check for AsAccessible.
15791 * cs-parser.jay: Use basename to emit error 574 (destructor should
15792 have the same name as container class), not the full name.
15794 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
15795 possible representation.
15797 Also implements integer type suffixes U and L.
15799 2001-12-15 Miguel de Icaza <miguel@ximian.com>
15801 * expression.cs (ArrayCreation.DoResolve): We need to do the
15802 argument resolution *always*.
15804 * decl.cs: Make this hold the namespace. Hold the root context as
15806 (LookupType): Move here.
15808 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
15810 * location.cs (Row, Name): Fixed the code, it was always returning
15811 references to the first file.
15813 * interface.cs: Register properties defined through interfaces.
15815 * driver.cs: Add support for globbing on the command line
15817 * class.cs (Field): Make it derive from MemberCore as well.
15820 2001-12-15 Ravi Pratap <ravi@ximian.com>
15822 * class.cs (Event::Define): Check that the type of the event is a delegate
15823 type else flag error #66.
15825 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
15828 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
15829 values of EntryPoint, CharSet etc etc.
15831 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
15833 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
15834 be null and we should ignore this. I am not sure if this is really clean. Apparently,
15835 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
15836 which needs this to do its work.
15838 * ../errors/cs0066.cs : Add.
15840 2001-12-14 Miguel de Icaza <miguel@ximian.com>
15842 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
15845 * class.cs: (MethodSignature.MethodSignature): Removed hack that
15846 clears out the parameters field.
15847 (MemberSignatureCompare): Cleanup
15849 (MemberCore): New base class used to share code between MethodCore
15852 (RegisterRequiredImplementations) BindingFlags.Public requires
15853 either BindingFlags.Instace or Static. Use instance here.
15855 (Property): Refactored code to cope better with the full spec.
15857 * parameter.cs (GetParameterInfo): Return an empty array instead
15860 * class.cs (Property): Abstract or extern properties have no bodies.
15862 * parameter.cs (GetParameterInfo): return a zero-sized array.
15864 * class.cs (TypeContainer.MethodModifiersValid): Move all the
15865 method modifier validation to the typecontainer so we can reuse
15866 this on properties.
15868 (MethodCore.ParameterTypes): return an empty sized array of types.
15870 (Property.Define): Test property modifier validity.
15872 Add tests for sealed/override too.
15874 (Method.Emit): abstract or extern methods have no bodies.
15876 2001-12-14 Ravi Pratap <ravi@ximian.com>
15878 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
15881 (Method::Define, ::Emit): Modify accordingly.
15883 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
15885 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
15887 * makefile: Pass in /unsafe.
15889 2001-12-13 Miguel de Icaza <miguel@ximian.com>
15891 * class.cs (MakeKey): Kill routine.
15893 * class.cs (TypeContainer.Define): Correctly define explicit
15894 method implementations (they require the full interface name plus
15897 * typemanager.cs: Deply the PtrHashtable here and stop using the
15898 lame keys. Things work so much better.
15900 This of course broke everyone who depended on `RegisterMethod' to
15901 do the `test for existance' test. This has to be done elsewhere.
15903 * support.cs (PtrHashtable): A hashtable that avoid comparing with
15904 the object stupid Equals method (because, that like fails all over
15905 the place). We still do not use it.
15907 * class.cs (TypeContainer.SetRequiredInterface,
15908 TypeContainer.RequireMethods): Killed these two routines and moved
15909 all the functionality to RegisterRequiredImplementations.
15911 (TypeContainer.RegisterRequiredImplementations): This routine now
15912 registers all the implementations required in an array for the
15913 interfaces and abstract methods. We use an array of structures
15914 which can be computed ahead of time to reduce memory usage and we
15915 also assume that lookups are cheap as most classes will not
15916 implement too many interfaces.
15918 We also avoid creating too many MethodSignatures.
15920 (TypeContainer.IsInterfaceMethod): Update and optionally does not
15921 clear the "pending" bit if we find that there are problems with
15924 (TypeContainer.VerifyPendingMethods): Update to report errors of
15925 methods that look like implementations but are not.
15927 (TypeContainer.Define): Add support for explicit interface method
15930 2001-12-12 Miguel de Icaza <miguel@ximian.com>
15932 * typemanager.cs: Keep track of the parameters here instead of
15933 being a feature of the TypeContainer.
15935 * class.cs: Drop the registration of parameters here, as
15936 InterfaceMethods are also interface declarations.
15938 * delegate.cs: Register methods with the TypeManager not only with
15939 the TypeContainer. This code was buggy.
15941 * interface.cs: Full registation here.
15943 2001-12-11 Miguel de Icaza <miguel@ximian.com>
15945 * expression.cs: Remove reducer for binary expressions, it can not
15948 * const.cs: Put here the code that used to go into constant.cs
15950 * constant.cs: Put here the code for constants, this is a new base
15951 class for Literals.
15953 * literal.cs: Make Literal derive from Constant.
15955 2001-12-09 Miguel de Icaza <miguel@ximian.com>
15957 * statement.cs (Return.Emit): Report error 157 if the user
15958 attempts to return from a finally block.
15960 (Return.Emit): Instead of emitting a return, jump to the end of
15963 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
15964 LocalBuilder to store the result of the function. ReturnLabel is
15965 the target where we jump.
15968 2001-12-09 Radek Doulik <rodo@ximian.com>
15970 * cs-parser.jay: remember alias in current namespace
15972 * ecore.cs (SimpleName::DoResolve): use aliases for types or
15975 * class.cs (LookupAlias): lookup alias in my_namespace
15977 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
15979 (LookupAlias): lookup alias in this and if needed in parent
15982 2001-12-08 Miguel de Icaza <miguel@ximian.com>
15986 * rootcontext.cs: (ModuleBuilder) Made static, first step into
15987 making things static. I need this to avoid passing the
15988 TypeContainer when calling ParameterType.
15990 * support.cs (InternalParameters.ParameterType): Remove ugly hack
15991 that did string manipulation to compute the type and then call
15992 GetType. Use Parameter.ParameterType instead.
15994 * cs-tokenizer.cs: Consume the suffix for floating values.
15996 * expression.cs (ParameterReference): figure out whether this is a
15997 reference parameter or not. Kill an extra variable by computing
15998 the arg_idx during emission.
16000 * parameter.cs (Parameters.GetParameterInfo): New overloaded
16001 function that returns whether a parameter is an out/ref value or not.
16003 (Parameter.ParameterType): The type of the parameter (base,
16004 without ref/out applied).
16006 (Parameter.Resolve): Perform resolution here.
16007 (Parameter.ExternalType): The full type (with ref/out applied).
16009 * statement.cs (Using.Emit, Using.EmitExpression): Implement
16010 support for expressions on the using statement.
16012 2001-12-07 Miguel de Icaza <miguel@ximian.com>
16014 * statement.cs (Using.EmitLocalVariableDecls): Split the
16015 localvariable handling of the using statement.
16017 (Block.EmitMeta): Keep track of variable count across blocks. We
16018 were reusing slots on separate branches of blocks.
16020 (Try.Emit): Emit the general code block, we were not emitting it.
16022 Check the type of the declaration to be an IDisposable or
16023 something that can be implicity converted to it.
16025 Emit conversions if required.
16027 * ecore.cs (EmptyExpression): New utility class.
16028 (Expression.ImplicitConversionExists): New utility function.
16030 2001-12-06 Miguel de Icaza <miguel@ximian.com>
16032 * statement.cs (Using): Implement.
16034 * expression.cs (LocalVariableReference): Support read only variables.
16036 * statement.cs: Remove the explicit emit for the Leave opcode.
16037 (VariableInfo): Add a readonly field.
16039 2001-12-05 Miguel de Icaza <miguel@ximian.com>
16041 * ecore.cs (ConvCast): new class used to encapsulate the various
16042 explicit integer conversions that works in both checked and
16043 unchecked contexts.
16045 (Expression.ConvertNumericExplicit): Use new ConvCast class to
16046 properly generate the overflow opcodes.
16048 2001-12-04 Miguel de Icaza <miguel@ximian.com>
16050 * statement.cs: The correct type for the EmptyExpression is the
16051 element_type, not the variable type. Ravi pointed this out.
16053 2001-12-04 Ravi Pratap <ravi@ximian.com>
16055 * class.cs (Method::Define): Handle PInvoke methods specially
16056 by using DefinePInvokeMethod instead of the usual one.
16058 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
16059 above to do the task of extracting information and defining the method.
16061 2001-12-04 Ravi Pratap <ravi@ximian.com>
16063 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
16064 of the condition for string type.
16066 (Emit): Move that here.
16068 (ArrayCreation::CheckIndices): Keep string literals in their expression
16071 (EmitDynamicInitializers): Handle strings appropriately.
16073 2001-12-04 Miguel de Icaza <miguel@ximian.com>
16075 * codegen.cs (EmitContext): Replace multiple variables with a
16076 single pointer to the current Switch statement.
16078 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
16081 2001-12-03 Miguel de Icaza <miguel@ximian.com>
16085 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
16088 (Foreach.Emit): Foreach on arrays was not setting
16089 up the loop variables (for break/continue).
16091 (GotoCase): Semi-implented.
16093 2001-12-03 Ravi Pratap <ravi@ximian.com>
16095 * attribute.cs (CheckAttribute): Handle system attributes by using
16096 Attribute.GetAttributes to examine information we need.
16098 (GetValidPlaces): Same here.
16100 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
16102 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
16104 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
16106 (Method::Define): Set appropriate flags if we have a DllImport attribute.
16108 (Method::Emit): Handle the case when we are a PInvoke method.
16110 2001-12-03 Miguel de Icaza <miguel@ximian.com>
16112 * expression.cs: Use ResolveWithSimpleName on compound names.
16114 2001-12-02 Ravi Pratap <ravi@ximian.com>
16116 * constant.cs (EmitConstant): Make sure we resolve the associated expression
16117 before trying to reduce it.
16119 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
16121 * constant.cs (LookupConstantValue): Implement.
16123 (EmitConstant): Use the above in emitting the constant.
16125 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
16126 that are user-defined by doing a LookupConstantValue on them.
16128 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
16131 2001-11-29 Miguel de Icaza <miguel@ximian.com>
16133 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
16135 (BaseAccess.DoResolve): Implement.
16137 (MemberAccess.DoResolve): Split this routine into a
16138 ResolveMemberAccess routine that can be used independently
16140 2001-11-28 Miguel de Icaza <miguel@ximian.com>
16142 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
16143 As that share bits of the implementation. Is returns a boolean,
16144 while As returns the Type that is being probed.
16146 2001-12-01 Ravi Pratap <ravi@ximian.com>
16148 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
16149 instead of a Literal - much easier.
16151 (EnumInTransit): Remove - utterly useless :-)
16153 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
16155 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
16157 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
16158 chain when we have no associated expression.
16160 2001-11-30 Ravi Pratap <ravi@ximian.com>
16162 * constant.cs (Define): Use Location while reporting the errror.
16164 Also emit a warning when 'new' is used and there is no inherited
16167 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
16170 (LookupEnumValue): Implement to lookup an enum member's value and define it
16173 (Populate): Re-write accordingly to use the above routine.
16175 2001-11-27 Miguel de Icaza <miguel@ximian.com>
16177 * expression.cs (This): Fix prototype for DoResolveLValue to
16178 override the base class DoResolveLValue.
16180 * cs-parser.cs: Report errors cs574 and cs575 (destructor
16183 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
16184 (we need to load the address of the field here). This fixes
16187 (FieldExpr.DoResolveLValue): Call the DoResolve
16188 function to initialize the Instance expression.
16190 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
16191 correctly the GetEnumerator operation on a value type.
16193 * cs-parser.jay: Add more simple parsing error catches.
16195 * statement.cs (Switch): Add support for string switches.
16196 Handle null specially.
16198 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
16200 2001-11-28 Ravi Pratap <ravi@ximian.com>
16202 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
16204 (declare_local_constant): New helper function.
16206 * statement.cs (AddConstant): Keep a separate record of constants
16208 (IsConstant): Implement to determine if a variable is a constant.
16210 (GetConstantExpression): Implement.
16212 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
16214 * statement.cs (IsVariableDefined): Re-write.
16216 2001-11-27 Ravi Pratap <ravi@ximian.com>
16218 * class.cs (TypeContainer::FindMembers): Look for constants
16219 in the case when we are looking for MemberTypes.Field
16221 * expression.cs (MemberAccess::DoResolve): Check that in the
16222 case we are a FieldExpr and a Literal, we are not being accessed
16223 by an instance reference.
16225 * cs-parser.jay (local_constant_declaration): Implement.
16227 (declaration_statement): Implement for constant declarations.
16229 2001-11-26 Miguel de Icaza <miguel@ximian.com>
16231 * statement.cs (Switch): Catch double defaults.
16233 (Switch): More work on the switch() statement
16234 implementation. It works for integral values now, need to finish
16238 2001-11-24 Miguel de Icaza <miguel@ximian.com>
16240 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
16241 integer literals into other integer literals. To be used by
16244 2001-11-24 Ravi Pratap <ravi@ximian.com>
16246 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
16249 (EmitDynamicInitializers): Cope with the above since we extract data
16250 directly from ArrayData now.
16252 (ExpectInitializers): Keep track of whether initializers are mandatory
16255 (Bounds): Make it a hashtable to prevent the same dimension being
16256 recorded for every element in that dimension.
16258 (EmitDynamicInitializers): Fix bug which prevented the Set array method
16261 Also fix bug which was causing the indices to be emitted in the reverse
16264 2001-11-24 Miguel de Icaza <miguel@ximian.com>
16266 * expression.cs (ArrayCreation): Implement the bits that Ravi left
16267 unfinished. They do not work, because the underlying code is
16270 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16272 * cs-parser.jay: Remove bogus fixme.
16274 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
16275 on Switch statement.
16277 2001-11-23 Ravi Pratap <ravi@ximian.com>
16279 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
16282 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
16283 parameter. Apparently, any expression is allowed.
16285 (ValidateInitializers): Update accordingly.
16287 (CheckIndices): Fix some tricky bugs thanks to recursion.
16289 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
16290 I was being completely brain-dead.
16292 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
16293 and re-write acordingly.
16295 (DelegateInvocation): Re-write accordingly.
16297 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
16299 (MakeByteBlob): Handle types more correctly.
16301 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
16302 initialization from expressions but it is incomplete because I am a complete
16305 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16307 * statement.cs (If.Emit): Fix a bug that generated incorrect code
16308 on If. Basically, we have to return `true' (ie, we do return to
16309 our caller) only if both branches of the if return.
16311 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
16312 short-circuit operators, handle them as short circuit operators.
16314 (Cast.DoResolve): Resolve type.
16315 (Cast.Cast): Take an expression as the target type.
16317 * cs-parser.jay (cast_expression): Remove old hack that only
16318 allowed a limited set of types to be handled. Now we take a
16319 unary_expression and we resolve to a type during semantic
16322 Use the grammar productions from Rhys to handle casts (this is
16323 not complete like Rhys syntax yet, we fail to handle that corner
16324 case that C# has regarding (-x), but we will get there.
16326 2001-11-22 Ravi Pratap <ravi@ximian.com>
16328 * class.cs (EmitFieldInitializer): Take care of the case when we have a
16329 field which is an array type.
16331 * cs-parser.jay (declare_local_variables): Support array initialization too.
16333 * typemanager.cs (MakeKey): Implement.
16335 (everywhere): Use the above appropriately.
16337 * cs-parser.jay (for_statement): Update for array initialization while
16338 declaring variables.
16340 * ecore.cs : The error message was correct, it's the variable's names that
16341 were misleading ;-) Make the code more readable.
16343 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
16344 the correct type etc.
16346 (ConvertExplicit): Handle Enum types by examining the underlying type.
16348 2001-11-21 Ravi Pratap <ravi@ximian.com>
16350 * parameter.cs (GetCallingConvention): Always return
16351 CallingConventions.Standard for now.
16353 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16355 * expression.cs (Binary.ResolveOperator): Update the values of `l'
16356 and `r' after calling DoNumericPromotions.
16358 * ecore.cs: Fix error message (the types were in the wrong order).
16360 * statement.cs (Foreach.ProbeCollectionType): Need to pass
16361 BindingFlags.Instance as well
16363 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
16364 implicit int literal conversion in an empty cast so that we
16365 propagate the right type upstream.
16367 (UnboxCast): new class used to unbox value types.
16368 (Expression.ConvertExplicit): Add explicit type conversions done
16371 (Expression.ImplicitNumericConversion): Oops, forgot to test for
16372 the target type before applying the implicit LongLiterals to ULong
16375 2001-11-21 Miguel de Icaza <miguel@ximian.com>
16377 * cs-parser.jay (for_statement): Reworked the way For works: now
16378 we declare manually any variables that are introduced in
16379 for_initializer to solve the problem of having out-of-band code
16380 emition (that is what got for broken).
16382 (declaration_statement): Perform the actual variable declaration
16383 that used to be done in local_variable_declaration here.
16385 (local_variable_declaration): Do not declare anything, just pass
16386 the information on a DictionaryEntry
16388 2001-11-20 Ravi Pratap <ravi@ximian.com>
16390 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
16391 re-write of the logic to now make it recursive.
16393 (UpdateIndices): Re-write accordingly.
16395 Store element data in a separate ArrayData list in the above methods.
16397 (MakeByteBlob): Implement to dump the array data into a byte array.
16399 2001-11-19 Ravi Pratap <ravi@ximian.com>
16401 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
16404 * constant.cs (Define): Implement.
16406 (EmitConstant): Re-write fully.
16408 Pass in location info.
16410 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
16413 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
16414 DictionaryEntry since we need location info too.
16416 (constant_declaration): Update accordingly.
16418 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
16419 code into another method : UpdateIndices.
16421 2001-11-18 Ravi Pratap <ravi@ximian.com>
16423 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
16424 some type checking etc.
16426 2001-11-17 Ravi Pratap <ravi@ximian.com>
16428 * expression.cs (ArrayCreation::ValidateInitializers): Implement
16429 bits to provide dimension info if the user skips doing that.
16431 Update second constructor to store the rank correctly.
16433 2001-11-16 Ravi Pratap <ravi@ximian.com>
16435 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
16436 and try to implement.
16438 * ../errors/cs0150.cs : Add.
16440 * ../errors/cs0178.cs : Add.
16442 2001-11-16 Miguel de Icaza <miguel@ximian.com>
16444 * statement.cs: Implement foreach on multi-dimensional arrays.
16446 * parameter.cs (Parameters.GetParameterByName): Also lookup the
16447 name of the params argument.
16449 * expression.cs: Use EmitStoreOpcode to get the right opcode while
16450 initializing the array.
16452 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
16453 we can use this elsewhere.
16455 * statement.cs: Finish implementation of foreach for single
16458 * cs-parser.jay: Use an out-of-band stack to pass information
16459 around, I wonder why I need this.
16461 foreach_block: Make the new foreach_block the current_block.
16463 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
16464 function used to return a static Parameters structure. Used for
16465 empty parameters, as those are created very frequently.
16467 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
16469 2001-11-15 Ravi Pratap <ravi@ximian.com>
16471 * interface.cs : Default modifier is private, not public. The
16472 make verify test passes again.
16474 2001-11-15 Ravi Pratap <ravi@ximian.com>
16476 * support.cs (ReflectionParameters): Fix logic to determine
16477 whether the last parameter is a params one. Test 9 passes again.
16479 * delegate.cs (Populate): Register the builders we define with
16480 RegisterParameterForBuilder. Test 19 passes again.
16482 * cs-parser.jay (property_declaration): Reference $6 instead
16483 of $$ to get at the location.
16485 (indexer_declaration): Similar stuff.
16487 (attribute): Ditto.
16489 * class.cs (Property): Register parameters for the Get and Set methods
16490 if they exist. Test 23 passes again.
16492 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
16493 call to EmitArguments as we are sure there aren't any params arguments.
16494 Test 32 passes again.
16496 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
16497 IndexOutOfRangeException.
16499 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
16500 Test 33 now passes again.
16502 2001-11-15 Miguel de Icaza <miguel@ximian.com>
16504 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
16505 broke a bunch of things. Will have to come up with a better way
16506 of tracking locations.
16508 * statement.cs: Implemented foreach for single dimension arrays.
16510 2001-11-09 Miguel de Icaza <miguel@ximian.com>
16512 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
16513 an error. This removes the lookup from the critical path.
16515 * cs-parser.jay: Removed use of temporary_loc, which is completely
16518 2001-11-14 Miguel de Icaza <miguel@ximian.com>
16520 * support.cs (ReflectionParameters.ParameterModifier): Report
16521 whether the argument is a PARAMS argument or not.
16523 * class.cs: Set the attribute `ParamArrayAttribute' on the
16524 parameter argument.
16526 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
16527 and cons_param_array_attribute (ConstructorInfo for
16528 ParamArrayAttribute).,
16530 * codegen.cs: Emit the return using the `Return' statement, that
16531 way we can report the error correctly for missing return values.
16533 * class.cs (Method.Emit): Clean up.
16535 * expression.cs (Argument.Resolve): Take another argument: the
16536 location where this argument is used. Notice that this is not
16537 part of the "Argument" class as to reduce the size of the
16538 structure (we know the approximate location anyways).
16540 Test if the argument is a variable-reference, if not, then
16541 complain with a 206.
16543 (Argument.Emit): Emit addresses of variables.
16545 (Argument.FullDesc): Simplify.
16547 (Invocation.DoResolve): Update for Argument.Resolve.
16549 (ElementAccess.DoResolve): ditto.
16551 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
16552 method should be virtual, as this method is always virtual.
16554 (NewDelegate.DoResolve): Update for Argument.Resolve.
16556 * class.cs (ConstructorInitializer.DoResolve): ditto.
16558 * attribute.cs (Attribute.Resolve): ditto.
16560 2001-11-13 Miguel de Icaza <miguel@ximian.com>
16562 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
16564 * expression.cs (ParameterReference): Drop IStackStorage and implement
16565 IAssignMethod instead.
16567 (LocalVariableReference): ditto.
16569 * ecore.cs (FieldExpr): Drop IStackStorage and implement
16570 IAssignMethod instead.
16572 2001-11-13 Miguel de Icaza <miguel@ximian.com>
16574 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
16575 enumerations that are used in heavily used structures derive from
16576 byte in a laughable and pathetic attempt to reduce memory usage.
16577 This is the kind of pre-optimzations that you should not do at
16578 home without adult supervision.
16580 * expression.cs (UnaryMutator): New class, used to handle ++ and
16581 -- separatedly from the other unary operators. Cleans up the
16582 code, and kills the ExpressionStatement dependency in Unary.
16584 (Unary): Removed `method' and `Arguments' from this class, making
16585 it smaller, and moving it all to SimpleCall, so I can reuse this
16586 code in other locations and avoid creating a lot of transient data
16587 strucutres when not required.
16589 * cs-parser.jay: Adjust for new changes.
16591 2001-11-11 Miguel de Icaza <miguel@ximian.com>
16593 * enum.cs (Enum.Populate): If there is a failure during
16596 * cs-parser.jay (opt_enum_base): we used to catch type errors
16597 here, but this is really incorrect. The type error should be
16598 catched during semantic analysis.
16600 2001-12-11 Ravi Pratap <ravi@ximian.com>
16602 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
16603 current_local_parameters as expected since I, in my stupidity, had forgotten
16606 * attribute.cs (GetValidPlaces): Fix stupid bug.
16608 * class.cs (Method::Emit): Perform check on applicability of attributes.
16610 (Constructor::Emit): Ditto.
16612 (Field::Emit): Ditto.
16614 (Field.Location): Store location information.
16616 (Property, Event, Indexer, Operator): Ditto.
16618 * cs-parser.jay (field_declaration): Pass in location for each field.
16620 * ../errors/cs0592.cs : Add.
16622 2001-11-12 Ravi Pratap <ravi@ximian.com>
16624 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
16626 (InitCoreTypes): Update accordingly.
16628 (RegisterAttrType, LookupAttr): Implement.
16630 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
16631 info about the same.
16633 (Resolve): Update to populate the above as necessary.
16635 (Error592): Helper.
16637 (GetValidPlaces): Helper to the above.
16639 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
16641 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
16643 2001-11-12 Ravi Pratap <ravi@ximian.com>
16645 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
16647 * ../errors/cs0617.cs : Add.
16649 2001-11-11 Ravi Pratap <ravi@ximian.com>
16651 * enum.cs (Emit): Rename to Populate to be more consistent with what
16652 we expect it to do and when exactly it is called.
16654 * class.cs, rootcontext.cs : Update accordingly.
16656 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
16657 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
16659 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
16661 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
16662 of a fieldinfo using the above, when dealing with a FieldBuilder.
16664 2001-11-10 Ravi Pratap <ravi@ximian.com>
16666 * ../errors/cs0031.cs : Add.
16668 * ../errors/cs1008.cs : Add.
16670 * ../errrors/cs0543.cs : Add.
16672 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
16675 (FindMembers): Implement.
16677 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
16678 enums and delegates too.
16680 (enum_types): Rename to builder_to_enum.
16682 (delegate_types): Rename to builder_to_delegate.
16684 * delegate.cs (FindMembers): Implement.
16686 2001-11-09 Ravi Pratap <ravi@ximian.com>
16688 * typemanager.cs (IsEnumType): Implement.
16690 * enum.cs (Emit): Re-write parts to account for the underlying type
16691 better and perform checking etc.
16693 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
16694 of the underlying type.
16696 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
16699 * enum.cs (error31): Helper to report error #31.
16701 * cs-parser.jay (enum_declaration): Store location of each member too.
16703 * enum.cs (member_to_location): New hashtable.
16705 (AddEnumMember): Update location hashtable.
16707 (Emit): Use the location of each member while reporting errors.
16709 2001-11-09 Miguel de Icaza <miguel@ximian.com>
16711 * cs-parser.jay: A for_initializer if is a
16712 local_variable_declaration really ammount to have an implicit
16713 block with the variable declaration and no initializer for for.
16715 * statement.cs (For.Emit): Cope with null initializers.
16717 This fixes the infinite loop on for initializers.
16719 2001-11-08 Miguel de Icaza <miguel@ximian.com>
16721 * enum.cs: More cleanup.
16723 * ecore.cs: Remove dead code.
16725 * class.cs (Property.Emit): More simplification.
16726 (Event.Emit): ditto.
16728 Reworked to have less levels of indentation.
16730 2001-11-08 Ravi Pratap <ravi@ximian.com>
16732 * class.cs (Property): Emit attributes.
16742 * enum.cs (Emit): Ditto.
16744 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
16747 * class.cs (Field, Event, etc.): Move attribute generation into the
16748 Emit method everywhere.
16750 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
16751 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
16752 as we had no way of defining nested enums !
16754 * rootcontext.cs : Adjust code accordingly.
16756 * typemanager.cs (AddEnumType): To keep track of enum types separately.
16758 2001-11-07 Ravi Pratap <ravi@ximian.com>
16760 * expression.cs (EvalConstantExpression): Move into ecore.cs
16762 * enum.cs (Enum): Rename some members and make them public and readonly
16763 according to our convention.
16765 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
16768 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
16770 (Enum::Emit): Write a simple version for now which doesn't try to compute
16771 expressions. I shall modify this to be more robust in just a while.
16773 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
16775 (TypeContainer::CloseType): Create the Enum types too.
16777 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
16779 * expression.cs (EvalConstantExpression): Get rid of completely.
16781 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
16782 user-defined values and other cases.
16784 (IsValidEnumLiteral): Helper function.
16786 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
16787 out there in the case we had a literal FieldExpr.
16789 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
16791 (Literalize): Revamp a bit to take two arguments.
16793 (EnumLiteral): New class which derives from Literal to wrap enum literals.
16795 2001-11-06 Ravi Pratap <ravi@ximian.com>
16797 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
16799 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
16801 (Resolve): Use the above to ensure we have proper initializers.
16803 2001-11-05 Ravi Pratap <ravi@ximian.com>
16805 * expression.cs (Expression::EvalConstantExpression): New method to
16806 evaluate constant expressions.
16808 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
16810 2001-11-07 Miguel de Icaza <miguel@ximian.com>
16812 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
16815 (Binary.ResolveOperator): Handle operator != (object a, object b)
16816 and operator == (object a, object b);
16818 (Binary.DoNumericPromotions): Indicate whether the numeric
16819 promotion was possible.
16821 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
16824 Made the ArrayAccess implement interface IAssignMethod instead of
16825 IStackStore as the order in which arguments are passed reflects
16828 * assign.cs: Instead of using expr.ExprClass to select the way of
16829 assinging, probe for the IStackStore/IAssignMethod interfaces.
16831 * typemanager.cs: Load InitializeArray definition.
16833 * rootcontext.cs (RootContext.MakeStaticData): Used to define
16834 static data that can be used to initialize arrays.
16836 2001-11-05 Miguel de Icaza <miguel@ximian.com>
16838 * expression.cs: Handle operator== and operator!= for booleans.
16840 (Conditioal.Reduce): Implement reducer for the ?: operator.
16842 (Conditional.Resolve): Implement dead code elimination.
16844 (Binary.Resolve): Catch string literals and return a new
16845 concatenated string.
16847 (Unary.Reduce): Implement reduction of unary expressions.
16849 * ecore.cs: Split out the expression core handling here.
16851 (Expression.Reduce): New method used to perform constant folding
16852 and CSE. This is needed to support constant-expressions.
16854 * statement.cs (Statement.EmitBoolExpression): Pass true and false
16855 targets, and optimize for !x.
16857 2001-11-04 Ravi Pratap <ravi@ximian.com>
16859 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
16860 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
16861 set custom atttributes.
16863 * literal.cs (Literal::GetValue): New abstract method to return the actual
16864 value of the literal, cast as an object.
16866 (*Literal): Implement GetValue method.
16868 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
16869 expressions to the arraylist but objects of type Argument.
16871 * class.cs (TypeContainer::Emit): Emit our attributes too.
16873 (Method::Emit, Constructor::Emit): Ditto.
16875 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
16876 to be ignoring earlier.
16878 2001-11-03 Ravi Pratap <ravi@ximian.com>
16880 * attribute.cs (AttributeSection::Define): Implement to do the business
16881 of constructing a CustomAttributeBuilder.
16883 (Attribute): New trivial class. Increases readability of code.
16885 * cs-parser.jay : Update accordingly.
16887 (positional_argument_list, named_argument_list, named_argument): New rules
16889 (attribute_arguments): Use the above so that we are more correct.
16891 2001-11-02 Ravi Pratap <ravi@ximian.com>
16893 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
16894 to perform all checks for a method with a params parameter.
16896 (Invocation::OverloadResolve): Update to use the above method and therefore
16897 cope correctly with params method invocations.
16899 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
16902 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
16903 constructors in our parent too because we can't afford to miss out on
16906 * attribute.cs (AttributeSection): New name for the class Attribute
16908 Other trivial changes to improve readability.
16910 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
16911 use the new class names.
16913 2001-11-01 Ravi Pratap <ravi@ximian.com>
16915 * class.cs (Method::Define): Complete definition for params types too
16917 (Indexer::Define): Ditto.
16919 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
16920 Cope everywhere with a request for info about the array parameter.
16922 2001-11-01 Ravi Pratap <ravi@ximian.com>
16924 * tree.cs (RecordNamespace): Fix up to check for the correct key.
16926 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
16927 local_variable_type to extract the string corresponding to the type.
16929 (local_variable_type): Fixup the action to use the new helper method.
16931 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
16934 * expression.cs : Clean out code which uses the above.
16936 2001-10-31 Ravi Pratap <ravi@ximian.com>
16938 * typemanager.cs (RegisterMethod): Check if we already have an existing key
16939 and bale out if necessary by returning a false.
16941 (RegisterProperty): Ditto.
16943 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
16944 and print out appropriate error messages.
16946 * interface.cs (everywhere): Ditto.
16948 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
16949 location to constructor.
16951 * class.cs (Property, Event, Indexer): Update accordingly.
16953 * ../errors/cs111.cs : Added.
16955 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
16956 of a method, as laid down by the spec.
16958 (Invocation::OverloadResolve): Use the above method.
16960 2001-10-31 Ravi Pratap <ravi@ximian.com>
16962 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
16963 now take a TypeContainer and a Parameters object.
16965 (ParameterData): Modify return type of ParameterModifier method to be
16966 Parameter.Modifier and not a string.
16968 (ReflectionParameters, InternalParameters): Update accordingly.
16970 * expression.cs (Argument::GetParameterModifier): Same here.
16972 * support.cs (InternalParameters::ParameterType): Find a better way of determining
16973 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
16974 symbol in it at all so maybe this is only for now.
16976 2001-10-30 Ravi Pratap <ravi@ximian.com>
16978 * support.cs (InternalParameters): Constructor now takes an extra argument
16979 which is the actual Parameters class.
16981 (ParameterDesc): Update to provide info on ref/out modifiers.
16983 * class.cs (everywhere): Update call to InternalParameters to pass in
16984 the second argument too.
16986 * support.cs (ParameterData): Add ParameterModifier, which is a method
16987 to return the modifier info [ref/out etc]
16989 (InternalParameters, ReflectionParameters): Implement the above.
16991 * expression.cs (Argument::ParameterModifier): Similar function to return
16992 info about the argument's modifiers.
16994 (Invocation::OverloadResolve): Update to take into account matching modifiers
16997 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
16998 a new SetFormalParameters object which we pass to InternalParameters.
17000 2001-10-30 Ravi Pratap <ravi@ximian.com>
17002 * expression.cs (NewArray): Merge into the ArrayCreation class.
17004 2001-10-29 Ravi Pratap <ravi@ximian.com>
17006 * expression.cs (NewArray): Merge classes NewBuiltinArray and
17007 NewUserdefinedArray into one as there wasn't much of a use in having
17010 * expression.cs (Argument): Change field's name to ArgType from Type.
17012 (Type): New readonly property which returns the proper type, taking into
17013 account ref/out modifiers.
17015 (everywhere): Adjust code accordingly for the above.
17017 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
17018 whether we are emitting for a ref or out parameter.
17020 * expression.cs (Argument::Emit): Use the above field to set the state.
17022 (LocalVariableReference::Emit): Update to honour the flag and emit the
17025 * parameter.cs (Attributes): Set the correct flags for ref parameters.
17027 * expression.cs (Argument::FullDesc): New function to provide a full desc.
17029 * support.cs (ParameterData): Add method ParameterDesc to the interface.
17031 (ReflectionParameters, InternalParameters): Implement the above method.
17033 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
17036 (Invocation::FullMethodDesc): Ditto.
17038 2001-10-29 Miguel de Icaza <miguel@ximian.com>
17040 * cs-parser.jay: Add extra production for the second form of array
17043 * expression.cs (ArrayCreation): Update to reflect the above
17046 * Small changes to prepare for Array initialization.
17048 2001-10-28 Miguel de Icaza <miguel@ximian.com>
17050 * typemanager.cs (ImplementsInterface): interface might be null;
17051 Deal with this problem;
17053 Also, we do store negative hits on the cache (null values), so use
17054 this instead of calling t.GetInterfaces on the type everytime.
17056 2001-10-28 Ravi Pratap <ravi@ximian.com>
17058 * typemanager.cs (IsBuiltinType): New method to help determine the same.
17060 * expression.cs (New::DoResolve): Get rid of array creation code and instead
17061 split functionality out into different classes.
17063 (New::FormArrayType): Move into NewBuiltinArray.
17065 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
17068 (NewBuiltinArray): New class to handle creation of built-in arrays.
17070 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
17071 account creation of one-dimensional arrays.
17073 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
17075 (NewUserdefinedArray::DoResolve): Implement.
17077 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
17079 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
17080 we maintain inside the TypeManager. This is necessary to perform lookups on the
17083 (LookupType): Update to perform GetType on the module builders too.
17085 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
17087 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
17089 2001-10-23 Ravi Pratap <ravi@ximian.com>
17091 * expression.cs (New::DoResolve): Implement guts of array creation.
17093 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
17095 2001-10-27 Miguel de Icaza <miguel@ximian.com>
17097 * expression.cs: Fix bug I introduced lsat night that broke
17100 (Expression.Resolve): Report a 246 error (can not resolve name)
17101 if we find a SimpleName in the stream.
17103 (Expression.ResolveLValue): Ditto.
17105 (Expression.ResolveWithSimpleName): This function is a variant of
17106 ResolveName, this one allows SimpleNames to be returned without a
17107 warning. The only consumer of SimpleNames is MemberAccess
17109 2001-10-26 Miguel de Icaza <miguel@ximian.com>
17111 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
17112 might arrive here. I have my doubts that this is correct.
17114 * statement.cs (Lock): Implement lock statement.
17116 * cs-parser.jay: Small fixes to support `lock' and `using'
17118 * cs-tokenizer.cs: Remove extra space
17120 * driver.cs: New flag --checked, allows to turn on integer math
17123 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
17124 Threading.Monitor.Exit
17126 2001-10-23 Miguel de Icaza <miguel@ximian.com>
17128 * expression.cs (IndexerAccess::DoResolveLValue): Set the
17129 Expression Class to be IndexerAccess.
17131 Notice that Indexer::DoResolve sets the eclass to Value.
17133 2001-10-22 Miguel de Icaza <miguel@ximian.com>
17135 * class.cs (TypeContainer::Emit): Emit code for indexers.
17137 * assign.cs (IAssignMethod): New interface implemented by Indexers
17138 and Properties for handling assignment.
17140 (Assign::Emit): Simplify and reuse code.
17142 * expression.cs (IndexerAccess, PropertyExpr): Implement
17143 IAssignMethod, clean up old code.
17145 2001-10-22 Ravi Pratap <ravi@ximian.com>
17147 * typemanager.cs (ImplementsInterface): New method to determine if a type
17148 implements a given interface. Provides a nice cache too.
17150 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
17153 (ConvertReferenceExplicit): Ditto.
17155 * delegate.cs (Delegate::Populate): Update to define the parameters on the
17156 various methods, with correct names etc.
17158 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
17159 Operator.UnaryNegation.
17161 * cs-parser.jay (operator_declarator): Be a little clever in the case where
17162 we have a unary plus or minus operator.
17164 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
17167 * everywhere : update accordingly.
17169 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
17172 * class.cs (Method::Define): For the case where we are implementing a method
17173 inherited from an interface, we need to set the MethodAttributes.Final flag too.
17174 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
17176 2001-10-21 Ravi Pratap <ravi@ximian.com>
17178 * interface.cs (FindMembers): Implement to work around S.R.E
17181 * typemanager.cs (IsInterfaceType): Implement.
17183 (FindMembers): Update to handle interface types too.
17185 * expression.cs (ImplicitReferenceConversion): Re-write bits which
17186 use IsAssignableFrom as that is not correct - it doesn't work.
17188 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
17189 and accordingly override EmitStatement.
17191 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
17192 using the correct logic :-)
17194 2001-10-19 Ravi Pratap <ravi@ximian.com>
17196 * ../errors/cs-11.cs : Add to demonstrate error -11
17198 2001-10-17 Miguel de Icaza <miguel@ximian.com>
17200 * assign.cs (Assign::Resolve): Resolve right hand side first, and
17201 then pass this as a hint to ResolveLValue.
17203 * expression.cs (FieldExpr): Add Location information
17205 (FieldExpr::LValueResolve): Report assignment to readonly
17208 (Expression::ExprClassFromMemberInfo): Pass location information.
17210 (Expression::ResolveLValue): Add new method that resolves an
17213 (Expression::DoResolveLValue): Default invocation calls
17216 (Indexers): New class used to keep track of indexers in a given
17219 (IStackStore): Renamed from LValue, as it did not really describe
17220 what this did. Also ResolveLValue is gone from this interface and
17221 now is part of Expression.
17223 (ElementAccess): Depending on the element access type
17225 * typemanager.cs: Add `indexer_name_type' as a Core type
17226 (System.Runtime.CompilerServices.IndexerNameAttribute)
17228 * statement.cs (Goto): Take a location.
17230 2001-10-18 Ravi Pratap <ravi@ximian.com>
17232 * delegate.cs (Delegate::VerifyDelegate): New method to verify
17233 if two delegates are compatible.
17235 (NewDelegate::DoResolve): Update to take care of the case when
17236 we instantiate a delegate from another delegate.
17238 * typemanager.cs (FindMembers): Don't even try to look up members
17239 of Delegate types for now.
17241 2001-10-18 Ravi Pratap <ravi@ximian.com>
17243 * delegate.cs (NewDelegate): New class to take care of delegate
17246 * expression.cs (New): Split the delegate related code out into
17247 the NewDelegate class.
17249 * delegate.cs (DelegateInvocation): New class to handle delegate
17252 * expression.cs (Invocation): Split out delegate related code into
17253 the DelegateInvocation class.
17255 2001-10-17 Ravi Pratap <ravi@ximian.com>
17257 * expression.cs (New::DoResolve): Implement delegate creation fully
17258 and according to the spec.
17260 (New::DoEmit): Update to handle delegates differently.
17262 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
17263 because of which we were printing out arguments in reverse order !
17265 * delegate.cs (VerifyMethod): Implement to check if the given method
17266 matches the delegate.
17268 (FullDelegateDesc): Implement.
17270 (VerifyApplicability): Implement.
17272 * expression.cs (Invocation::DoResolve): Update to accordingly handle
17273 delegate invocations too.
17275 (Invocation::Emit): Ditto.
17277 * ../errors/cs1593.cs : Added.
17279 * ../errors/cs1594.cs : Added.
17281 * delegate.cs (InstanceExpression, TargetMethod): New properties.
17283 2001-10-16 Ravi Pratap <ravi@ximian.com>
17285 * typemanager.cs (intptr_type): Core type for System.IntPtr
17287 (InitCoreTypes): Update for the same.
17289 (iasyncresult_type, asynccallback_type): Ditto.
17291 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
17294 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
17297 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
17298 the builders for the 4 members of a delegate type :-)
17300 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
17303 * expression.cs (New::DoResolve): Implement guts for delegate creation.
17305 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
17307 2001-10-15 Miguel de Icaza <miguel@ximian.com>
17309 * statement.cs (Break::Emit): Implement.
17310 (Continue::Emit): Implement.
17312 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
17313 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
17314 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
17315 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
17318 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
17319 properties that track the label for the current loop (begin of the
17320 loop and end of the loop).
17322 2001-10-15 Ravi Pratap <ravi@ximian.com>
17324 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
17325 use of emitting anything at all.
17327 * class.cs, rootcontext.cs : Get rid of calls to the same.
17329 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
17331 (Populate): Define the constructor correctly and set the implementation
17334 * typemanager.cs (delegate_types): New hashtable to hold delegates that
17337 (AddDelegateType): Implement.
17339 (IsDelegateType): Implement helper method.
17341 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
17343 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
17344 and accordingly handle it.
17346 * delegate.cs (Populate): Take TypeContainer argument.
17347 Implement bits to define the Invoke method. However, I still haven't figured out
17348 how to take care of the native int bit :-(
17350 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
17351 Qualify the name of the delegate, not its return type !
17353 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
17356 (StandardConversionExists): Checking for array types turns out to be recursive.
17358 (ConvertReferenceExplicit): Implement array conversion.
17360 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
17362 2001-10-12 Ravi Pratap <ravi@ximian.com>
17364 * cs-parser.jay (delegate_declaration): Store the fully qualified
17365 name as it is a type declaration.
17367 * delegate.cs (ReturnType, Name): Rename members to these. Make them
17370 (DefineDelegate): Renamed from Define. Does the same thing essentially,
17371 as TypeContainer::DefineType.
17373 (Populate): Method in which all the definition of the various methods (Invoke)
17376 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
17379 (CloseDelegate): Finally creates the delegate.
17381 * class.cs (TypeContainer::DefineType): Update to define delegates.
17382 (Populate, Emit and CloseType): Do the same thing here too.
17384 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
17385 delegates in all these operations.
17387 2001-10-14 Miguel de Icaza <miguel@ximian.com>
17389 * expression.cs: LocalTemporary: a new expression used to
17390 reference a temporary that has been created.
17392 * assign.cs: Handle PropertyAccess back here, so that we can
17393 provide the proper semantic access to properties.
17395 * expression.cs (Expression::ConvertReferenceExplicit): Implement
17396 a few more explicit conversions.
17398 * modifiers.cs: `NEW' modifier maps to HideBySig.
17400 * expression.cs (PropertyExpr): Make this into an
17401 ExpressionStatement, and support the EmitStatement code path.
17403 Perform get/set error checking, clean up the interface.
17405 * assign.cs: recognize PropertyExprs as targets, and if so, turn
17406 them into toplevel access objects.
17408 2001-10-12 Miguel de Icaza <miguel@ximian.com>
17410 * expression.cs: PropertyExpr::PropertyExpr: use work around the
17413 * typemanager.cs: Keep track here of our PropertyBuilders again to
17414 work around lameness in SRE.
17416 2001-10-11 Miguel de Icaza <miguel@ximian.com>
17418 * expression.cs (LValue::LValueResolve): New method in the
17419 interface, used to perform a second resolution pass for LValues.
17421 (This::DoResolve): Catch the use of this in static methods.
17423 (This::LValueResolve): Implement.
17425 (This::Store): Remove warning, assigning to `this' in structures
17428 (Invocation::Emit): Deal with invocation of
17429 methods on value types. We need to pass the address to structure
17430 methods rather than the object itself. (The equivalent code to
17431 emit "this" for structures leaves the entire structure on the
17432 stack instead of a pointer to it).
17434 (ParameterReference::DoResolve): Compute the real index for the
17435 argument based on whether the method takes or not a `this' pointer
17436 (ie, the method is static).
17438 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
17439 value types returned from functions when we need to invoke a
17440 method on the sturcture.
17443 2001-10-11 Ravi Pratap <ravi@ximian.com>
17445 * class.cs (TypeContainer::DefineType): Method to actually do the business of
17446 defining the type in the Modulebuilder or Typebuilder. This is to take
17447 care of nested types which need to be defined on the TypeBuilder using
17448 DefineNestedMethod.
17450 (TypeContainer::GetClassBases): Implement. Essentially the code from the
17451 methods in RootContext, only ported to be part of TypeContainer.
17453 (TypeContainer::GetInterfaceOrClass): Ditto.
17455 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
17457 * interface.cs (Interface::DefineInterface): New method. Does exactly
17458 what RootContext.CreateInterface did earlier, only it takes care of nested types
17461 (Interface::GetInterfaces): Move from RootContext here and port.
17463 (Interface::GetInterfaceByName): Same here.
17465 * rootcontext.cs (ResolveTree): Re-write.
17467 (PopulateTypes): Re-write.
17469 * class.cs (TypeContainer::Populate): Populate nested types too.
17470 (TypeContainer::Emit): Emit nested members too.
17472 * typemanager.cs (AddUserType): Do not make use of the FullName property,
17473 instead just use the name argument passed in as it is already fully
17476 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
17477 to TypeContainer mapping to see if a type is user-defined.
17479 * class.cs (TypeContainer::CloseType): Implement.
17481 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
17482 the default constructor.
17484 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
17487 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
17489 * interface.cs (CloseType): Create the type here.
17491 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
17494 Remove all the methods which are now in TypeContainer.
17496 2001-10-10 Ravi Pratap <ravi@ximian.com>
17498 * delegate.cs (Define): Re-write bits to define the delegate
17501 2001-10-10 Miguel de Icaza <miguel@ximian.com>
17503 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
17505 * expression.cs (ImplicitReferenceConversion): handle null as well
17506 as a source to convert to any reference type.
17508 * statement.cs (Return): Perform any implicit conversions to
17509 expected return type.
17511 Validate use of return statement.
17513 * codegen.cs (EmitContext): Pass the expected return type here.
17515 * class.cs (Method, Constructor, Property): Pass expected return
17516 type to EmitContext.
17518 2001-10-09 Miguel de Icaza <miguel@ximian.com>
17520 * expression.cs: Make DoResolve take an EmitContext instead of a
17523 Replaced `l' and `location' for `loc', for consistency.
17525 (Error, Warning): Remove unneeded Tc argument.
17527 * assign.cs, literal.cs, constant.cs: Update to new calling
17530 * codegen.cs: EmitContext now contains a flag indicating whether
17531 code is being generated in a static method or not.
17533 * cs-parser.jay: DecomposeQI, new function that replaces the old
17534 QualifiedIdentifier. Now we always decompose the assembled
17535 strings from qualified_identifier productions into a group of
17538 2001-10-08 Miguel de Icaza <miguel@ximian.com>
17540 * rootcontext.cs: Deal with field-less struct types correctly now
17541 by passing the size option to Define Type.
17543 * class.cs: Removed hack that created one static field.
17545 2001-10-07 Miguel de Icaza <miguel@ximian.com>
17547 * statement.cs: Moved most of the code generation here.
17549 2001-10-09 Ravi Pratap <ravi@ximian.com>
17551 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
17554 (ElementAccess): Remove useless bits for now - keep checks as the spec
17557 2001-10-08 Ravi Pratap <ravi@ximian.com>
17559 * expression.cs (ElementAccess::DoResolve): Remove my crap code
17560 and start performing checks according to the spec.
17562 2001-10-07 Ravi Pratap <ravi@ximian.com>
17564 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
17565 rank_specifiers instead.
17567 (rank_specifiers): Change the order in which the rank specifiers are stored
17569 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
17571 * expression.cs (ElementAccess): Implement the LValue interface too.
17573 2001-10-06 Ravi Pratap <ravi@ximian.com>
17575 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
17576 except that user defined conversions are not included.
17578 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
17579 perform the conversion of the return type, if necessary.
17581 (New::DoResolve): Check whether we are creating an array or an object
17582 and accordingly do the needful.
17584 (New::Emit): Same here.
17586 (New::DoResolve): Implement guts of array creation.
17588 (New::FormLookupType): Helper function.
17590 2001-10-07 Miguel de Icaza <miguel@ximian.com>
17592 * codegen.cs: Removed most of the code generation here, and move the
17593 corresponding code generation bits to the statement classes.
17595 Added support for try/catch/finalize and throw.
17597 * cs-parser.jay: Added support for try/catch/finalize.
17599 * class.cs: Catch static methods having the flags override,
17600 virtual or abstract.
17602 * expression.cs (UserCast): This user cast was not really doing
17603 what it was supposed to do. Which is to be born in fully resolved
17604 state. Parts of the resolution were being performed at Emit time!
17608 2001-10-05 Miguel de Icaza <miguel@ximian.com>
17610 * expression.cs: Implicity convert the result from UserCast.
17612 2001-10-05 Ravi Pratap <ravi@ximian.com>
17614 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
17615 prevented it from working correctly.
17617 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
17618 merely ConvertImplicit.
17620 2001-10-05 Miguel de Icaza <miguel@ximian.com>
17622 * typemanager.cs: Make the LookupTypeContainer function static,
17623 and not per-instance.
17625 * class.cs: Make static FindMembers (the one that takes a Type
17628 * codegen.cs: Add EmitForeach here.
17630 * cs-parser.jay: Make foreach a toplevel object instead of the
17631 inline expansion, as we need to perform semantic analysis on it.
17633 2001-10-05 Ravi Pratap <ravi@ximian.com>
17635 * expression.cs (Expression::ImplicitUserConversion): Rename to
17636 UserDefinedConversion.
17638 (Expression::UserDefinedConversion): Take an extra argument specifying
17639 whether we look for explicit user conversions too.
17641 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
17643 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
17645 (ExplicitUserConversion): Make it a call to UserDefinedConversion
17646 with the appropriate arguments.
17648 * cs-parser.jay (cast_expression): Record location too.
17650 * expression.cs (Cast): Record location info.
17652 (Expression::ConvertExplicit): Take location argument.
17654 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
17655 to determine if we are doing explicit conversions.
17657 (UserCast::Emit): Update accordingly.
17659 (Expression::ConvertExplicit): Report an error if everything fails.
17661 * ../errors/cs0030.cs : Add.
17663 2001-10-04 Miguel de Icaza <miguel@ximian.com>
17665 * modifiers.cs: If the ABSTRACT keyword is present, also set the
17666 virtual and newslot bits.
17668 * class.cs (TypeContainer::RegisterRequiredImplementations):
17669 Record methods we need.
17671 (TypeContainer::MakeKey): Helper function to make keys for
17672 MethodBases, since the Methodbase key is useless.
17674 (TypeContainer::Populate): Call RegisterRequiredImplementations
17675 before defining the methods.
17677 Create a mapping for method_builders_to_methods ahead of time
17678 instead of inside a tight loop.
17680 (::RequireMethods): Accept an object as the data to set into the
17681 hashtable so we can report interface vs abstract method mismatch.
17683 2001-10-03 Miguel de Icaza <miguel@ximian.com>
17685 * report.cs: Make all of it static.
17687 * rootcontext.cs: Drop object_type and value_type computations, as
17688 we have those in the TypeManager anyways.
17690 Drop report instance variable too, now it is a global.
17692 * driver.cs: Use try/catch on command line handling.
17694 Add --probe option to debug the error reporting system with a test
17697 * report.cs: Add support for exiting program when a probe
17698 condition is reached.
17700 2001-10-03 Ravi Pratap <ravi@ximian.com>
17702 * expression.cs (Binary::DoNumericPromotions): Fix the case when
17703 we do a forcible conversion regardless of type, to check if
17704 ForceConversion returns a null.
17706 (Binary::error19): Use location to report error.
17708 (Unary::error23): Use location here too.
17710 * ../errors/cs0019.cs : Check in.
17712 * ../errors/cs0023.cs : Check in.
17714 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
17715 case of a non-null MethodInfo object with a length of 0 !
17717 (Binary::ResolveOperator): Flag error if overload resolution fails to find
17718 an applicable member - according to the spec :-)
17719 Also fix logic to find members in base types.
17721 (Unary::ResolveOperator): Same here.
17723 (Unary::report23): Change name to error23 and make first argument a TypeContainer
17724 as I was getting thoroughly confused between this and error19 :-)
17726 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
17727 (::FindMostEncompassedType): Implement.
17728 (::FindMostEncompassingType): Implement.
17729 (::StandardConversionExists): Implement.
17731 (UserImplicitCast): Re-vamp. We now need info about most specific
17732 source and target types so that we can do the necessary conversions.
17734 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
17735 mathematical union with no duplicates.
17737 2001-10-03 Miguel de Icaza <miguel@ximian.com>
17739 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
17740 in order from base classes to child classes, so that we can in
17741 child classes look up in our parent for method names and
17742 attributes (required for handling abstract, virtual, new, override
17743 constructs: we need to instrospect our base class, and if we dont
17744 populate the classes in order, the introspection might be
17745 incorrect. For example, a method could query its parent before
17746 the parent has any methods and would determine that the parent has
17747 no abstract methods (while it could have had them)).
17749 (RootContext::CreateType): Record the order in which we define the
17752 2001-10-02 Miguel de Icaza <miguel@ximian.com>
17754 * class.cs (TypeContainer::Populate): Also method definitions can
17755 fail now, keep track of this.
17757 (TypeContainer::FindMembers): Implement support for
17758 DeclaredOnly/noDeclaredOnly flag.
17760 (Constructor::Emit) Return the ConstructorBuilder.
17762 (Method::Emit) Return the MethodBuilder.
17763 Check for abstract or virtual methods to be public.
17765 * rootcontext.cs (RootContext::CreateType): Register all the
17766 abstract methods required for the class to be complete and the
17767 interface methods that must be implemented.
17769 * cs-parser.jay: Report error 501 (method requires body if it is
17770 not marked abstract or extern).
17772 * expression.cs (TypeOf::Emit): Implement.
17774 * typemanager.cs: runtime_handle_type, new global type.
17776 * class.cs (Property::Emit): Generate code for properties.
17778 2001-10-02 Ravi Pratap <ravi@ximian.com>
17780 * expression.cs (Unary::ResolveOperator): Find operators on base type
17781 too - we now conform exactly to the spec.
17783 (Binary::ResolveOperator): Same here.
17785 * class.cs (Operator::Define): Fix minor quirk in the tests.
17787 * ../errors/cs0215.cs : Added.
17789 * ../errors/cs0556.cs : Added.
17791 * ../errors/cs0555.cs : Added.
17793 2001-10-01 Miguel de Icaza <miguel@ximian.com>
17795 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
17796 single integer which is really efficient
17798 2001-10-01 Ravi Pratap <ravi@ximian.com>
17800 * expression.cs (Expression::ImplicitUserConversion): Use location
17801 even in the case when we are examining True operators.
17803 * class.cs (Operator::Define): Perform extensive checks to conform
17804 with the rules for operator overloading in the spec.
17806 * expression.cs (Expression::ImplicitReferenceConversion): Implement
17807 some of the other conversions mentioned in the spec.
17809 * typemanager.cs (array_type): New static member for the System.Array built-in
17812 (cloneable_interface): For System.ICloneable interface.
17814 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
17815 we start resolving the tree and populating types.
17817 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
17819 2001-10-01 Miguel de Icaza <miguel@ximian.com>
17821 * expression.cs (Expression::ExprClassFromMemberInfo,
17822 Expression::Literalize): Create literal expressions from
17823 FieldInfos which are literals.
17825 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
17826 type casts, because they were wrong. The test suite in tests
17829 (ImplicitNumericConversion): ushort to ulong requires a widening
17832 Int32 constant to long requires widening cast as well.
17834 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
17835 for integers because the type on the stack is not i4.
17837 2001-09-30 Miguel de Icaza <miguel@ximian.com>
17839 * expression.cs (report118): require location argument.
17841 * parameter.cs: Do not dereference potential null value.
17843 * class.cs: Catch methods that lack the `new' keyword when
17844 overriding a name. Report warnings when `new' is used without
17845 anything being there to override.
17847 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
17849 * class.cs: Only add constructor to hashtable if it is non-null
17850 (as now constructors can fail on define).
17852 (TypeManager, Class, Struct): Take location arguments.
17854 Catch field instance initialization in structs as errors.
17856 accepting_filter: a new filter for FindMembers that is static so
17857 that we dont create an instance per invocation.
17859 (Constructor::Define): Catch errors where a struct constructor is
17862 * cs-parser.jay: Pass location information for various new
17865 * delegate.cs (Delegate): take a location argument.
17867 * driver.cs: Do not call EmitCode if there were problesm in the
17868 Definition of the types, as many Builders wont be there.
17870 * decl.cs (Decl::Decl): Require a location argument.
17872 * cs-tokenizer.cs: Handle properly hex constants that can not fit
17873 into integers, and find the most appropiate integer for it.
17875 * literal.cs: Implement ULongLiteral.
17877 * rootcontext.cs: Provide better information about the location of
17878 failure when CreateType fails.
17880 2001-09-29 Miguel de Icaza <miguel@ximian.com>
17882 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
17885 * expression.cs (Binary::CheckShiftArguments): Add missing type
17887 (Binary::ResolveOperator): Add type to the logical and and logical
17888 or, Bitwise And/Or and Exclusive Or code paths, it was missing
17891 (Binary::DoNumericPromotions): In the case where either argument
17892 is ulong (and most signed types combined with ulong cause an
17893 error) perform implicit integer constant conversions as well.
17895 2001-09-28 Miguel de Icaza <miguel@ximian.com>
17897 * expression.cs (UserImplicitCast): Method should always be
17899 (Invocation::BetterConversion): Simplified test for IntLiteral.
17901 (Expression::ImplicitNumericConversion): Split this routine out.
17902 Put the code that performs implicit constant integer conversions
17905 (Expression::Resolve): Become a wrapper around DoResolve so we can
17906 check eclass and type being set after resolve.
17908 (Invocation::Badness): Remove this dead function
17910 (Binary::ResolveOperator): Do not compute the expensive argumnets
17911 unless we have a union for it.
17913 (Probe::Emit): Is needs to do an isinst and then
17914 compare against null.
17916 (::CanConvert): Added Location argument. If the Location argument
17917 is null (Location.Null), then we do not report errors. This is
17918 used by the `probe' mechanism of the Explicit conversion. We do
17919 not want to generate an error for something that the user
17920 explicitly requested to be casted. But the pipeline for an
17921 explicit cast first tests for potential implicit casts.
17923 So for now, if the Location is null, it means `Probe only' to
17924 avoid adding another argument. Might have to revise this
17927 (ClassCast): New class used to type cast objects into arbitrary
17928 classes (used in Explicit Reference Conversions).
17930 Implement `as' as well.
17932 Reverted all the patches from Ravi below: they were broken:
17934 * The use of `level' as a mechanism to stop recursive
17935 invocations is wrong. That was there just to catch the
17936 bug with a strack trace but not as a way of addressing
17939 To fix the problem we have to *understand* what is going
17940 on and the interactions and come up with a plan, not
17941 just get things going.
17943 * The use of the type conversion cache that I proposed
17944 last night had an open topic: How does this work across
17945 protection domains. A user defined conversion might not
17946 be public in the location where we are applying the
17947 conversion, a different conversion might be selected
17948 (ie, private A->B (better) but public B->A (worse),
17949 inside A, A->B applies, but outside it, B->A will
17952 * On top of that (ie, even if the above is solved),
17953 conversions in a cache need to be abstract. Ie, `To
17954 convert from an Int to a Short use an OpcodeCast', not
17955 `To convert from an Int to a Short use the OpcodeCast on
17956 the variable 5' (which is what this patch was doing).
17958 2001-09-28 Ravi Pratap <ravi@ximian.com>
17960 * expression.cs (Invocation::ConversionExists): Re-write to use
17961 the conversion cache
17963 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
17964 cache all conversions done, not just user-defined ones.
17966 (Invocation::BetterConversion): The real culprit. Use ConversionExists
17967 to determine if a conversion exists instead of acutually trying to
17968 perform the conversion. It's faster too.
17970 (Expression::ConvertExplicit): Modify to use ConversionExists to check
17971 and only then attempt the implicit conversion.
17973 2001-09-28 Ravi Pratap <ravi@ximian.com>
17975 * expression.cs (ConvertImplicit): Use a cache for conversions
17976 already found. Check level of recursion and bail out if necessary.
17978 2001-09-28 Miguel de Icaza <miguel@ximian.com>
17980 * typemanager.cs (string_concat_string_string, string_concat_object_object):
17981 Export standard methods that we expect for string operations.
17983 * statement.cs (Block::UsageWarning): Track usage of variables and
17984 report the errors for not used variables.
17986 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
17989 2001-09-27 Miguel de Icaza <miguel@ximian.com>
17991 * codegen.cs: remove unnneded code
17993 * expression.cs: Removed BuiltinTypeAccess class
17995 Fix the order in which implicit conversions are
17998 The previous fixed dropped support for boxed conversions (adding a
17999 test to the test suite now)
18001 (UserImplicitCast::CanConvert): Remove test for source being null,
18002 that code is broken. We should not feed a null to begin with, if
18003 we do, then we should track the bug where the problem originates
18004 and not try to cover it up here.
18006 Return a resolved expression of type UserImplicitCast on success
18007 rather than true/false. Ravi: this is what I was talking about,
18008 the pattern is to use a static method as a "constructor" for
18011 Also, do not create arguments until the very last minute,
18012 otherwise we always create the arguments even for lookups that
18013 will never be performed.
18015 (UserImplicitCast::Resolve): Eliminate, objects of type
18016 UserImplicitCast are born in a fully resolved state.
18018 * typemanager.cs (InitCoreTypes): Init also value_type
18019 (System.ValueType).
18021 * expression.cs (Cast::Resolve): First resolve the child expression.
18023 (LValue): Add new method AddressOf to be used by
18026 Change the argument of Store to take an EmitContext instead of an
18027 ILGenerator, because things like FieldExpr need to be able to call
18028 their children expression to generate the instance code.
18030 (Expression::Error, Expression::Warning): Sugar functions for
18033 (Expression::MemberLookup): Accept a TypeContainer instead of a
18034 Report as the first argument.
18036 (Expression::ResolvePrimary): Killed. I still want to improve
18037 this as currently the code is just not right.
18039 (Expression::ResolveMemberAccess): Simplify, but it is still
18042 (Unary::Resolve): Catch errors in AddressOf operators.
18044 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
18045 index to a byte for the short-version, or the compiler will choose
18046 the wrong Emit call, which generates the wrong data.
18048 (ParameterReference::Emit, ::Store): same.
18050 (FieldExpr::AddressOf): Implement.
18052 * typemanager.cs: TypeManager: made public variable instead of
18055 * driver.cs: document --fatal.
18057 * report.cs (ErrorMessage, WarningMessage): new names for the old
18058 Error and Warning classes.
18060 * cs-parser.jay (member_access): Turn built-in access to types
18061 into a normal simplename
18063 2001-09-27 Ravi Pratap <ravi@ximian.com>
18065 * expression.cs (Invocation::BetterConversion): Fix to cope
18066 with q being null, since this was introducing a bug.
18068 * expression.cs (ConvertImplicit): Do built-in conversions first.
18070 2001-09-27 Ravi Pratap <ravi@ximian.com>
18072 * expression.cs (UserImplicitCast::Resolve): Fix bug.
18074 2001-09-27 Ravi Pratap <ravi@ximian.com>
18076 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
18077 I had introduced long ago (what's new ?).
18079 * expression.cs (UserImplicitCast::CanConvert): Static method to do
18080 the work of all the checking.
18081 (ConvertImplicit): Call CanConvert and only then create object if necessary.
18082 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
18084 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
18085 that is the right way.
18087 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
18088 overloading resolution. Use everywhere instead of cutting and pasting code.
18090 (Binary::ResolveOperator): Use MakeUnionSet.
18092 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
18093 we have to convert to bool types. Not complete yet.
18095 2001-09-27 Miguel de Icaza <miguel@ximian.com>
18097 * typemanager.cs (TypeManager::CSharpName): support ushort.
18099 * expression.cs (Expression::TryImplicitIntConversion): Attempts
18100 to provide an expression that performsn an implicit constant int
18101 conversion (section 6.1.6).
18102 (Expression::ConvertImplicitRequired): Reworked to include
18103 implicit constant expression conversions.
18105 (Expression::ConvertNumericExplicit): Finished.
18107 (Invocation::Emit): If InstanceExpression is null, then it means
18108 that we perform a call on this.
18110 2001-09-26 Miguel de Icaza <miguel@ximian.com>
18112 * expression.cs (Unary::Emit): Remove some dead code.
18113 (Probe): Implement Resolve and Emit for `is'.
18114 (Expression::ConvertImplicitRequired): Attempt to do constant
18115 expression conversions here. Maybe should be moved to
18116 ConvertImplicit, but I am not sure.
18117 (Expression::ImplicitLongConstantConversionPossible,
18118 Expression::ImplicitIntConstantConversionPossible): New functions
18119 that tell whether is it possible to apply an implicit constant
18120 expression conversion.
18122 (ConvertNumericExplicit): Started work on explicit numeric
18125 * cs-parser.jay: Update operator constants.
18127 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
18128 (Parameters::GetSignature): Hook up VerifyArgs here.
18129 (Parameters::VerifyArgs): Verifies that no two arguments have the
18132 * class.cs (Operator): Update the operator names to reflect the
18133 ones that the spec expects (as we are just stringizing the
18136 * expression.cs (Unary::ResolveOperator): Fix bug: Use
18137 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
18138 previous usage did only work for our methods.
18139 (Expression::ConvertImplicit): Handle decimal implicit numeric
18140 conversions as well.
18141 (Expression::InternalTypeConstructor): Used to invoke constructors
18142 on internal types for default promotions.
18144 (Unary::Emit): Implement special handling for the pre/post
18145 increment/decrement for overloaded operators, as they need to have
18146 the same semantics as the other operators.
18148 (Binary::ResolveOperator): ditto.
18149 (Invocation::ConversionExists): ditto.
18150 (UserImplicitCast::Resolve): ditto.
18152 2001-09-26 Ravi Pratap <ravi@ximian.com>
18154 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
18155 operator, return after emitting body. Regression tests pass again !
18157 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
18158 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
18159 (Invocation::OverloadResolve): Ditto.
18160 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
18162 * everywhere : update calls to the above methods accordingly.
18164 2001-09-26 Miguel de Icaza <miguel@ximian.com>
18166 * assign.cs (Assign): Make it inherit from ExpressionStatement.
18168 * expression.cs (ExpressionStatement): New base class used for
18169 expressions that can appear in statements, so that we can provide
18170 an alternate path to generate expression that do not leave a value
18173 (Expression::Emit, and all the derivatives): We no longer return
18174 whether a value is left on the stack or not. Every expression
18175 after being emitted leaves a single value on the stack.
18177 * codegen.cs (EmitContext::EmitStatementExpression): Use the
18178 facilties of ExpressionStatement if possible.
18180 * cs-parser.jay: Update statement_expression.
18182 2001-09-25 Miguel de Icaza <miguel@ximian.com>
18184 * driver.cs: Change the wording of message
18186 2001-09-25 Ravi Pratap <ravi@ximian.com>
18188 * expression.cs (Binary::ResolveOperator): Had forgottten to set
18189 the type of the expression to the return type of the method if
18190 we have an overloaded operator match ! The regression tests pass again !
18191 (Unary::ResolveOperator): Ditto.
18193 * expression.cs (Invocation::ConversionExists): Correct the member lookup
18194 to find "op_Implicit", not "implicit" ;-)
18195 (UserImplicitCast): New class to take care of user-defined implicit conversions.
18196 (ConvertImplicit, ForceConversion): Take TypeContainer argument
18198 * everywhere : Correct calls to the above accordingly.
18200 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
18201 (ConvertImplicit): Do user-defined conversion if it exists.
18203 2001-09-24 Miguel de Icaza <miguel@ximian.com>
18205 * assign.cs: track location.
18206 (Resolve): Use implicit conversions on assignment.
18208 * literal.cs: Oops. Not good, Emit of short access values should
18209 pass (Bytes) or the wrong argument will be selected.
18211 * expression.cs (Unary::Emit): Emit code for -expr.
18213 (Unary::ResolveOperator): Handle `Substract' for non-constants
18214 (substract from zero from the non-constants).
18215 Deal with Doubles as well.
18217 (Expression::ConvertImplicitRequired): New routine that reports an
18218 error if no implicit conversion exists.
18220 (Invocation::OverloadResolve): Store the converted implicit
18221 expressions if we make them
18223 2001-09-24 Ravi Pratap <ravi@ximian.com>
18225 * class.cs (ConstructorInitializer): Take a Location argument.
18226 (ConstructorBaseInitializer): Same here.
18227 (ConstructorThisInitializer): Same here.
18229 * cs-parser.jay : Update all calls accordingly.
18231 * expression.cs (Unary, Binary, New): Take location argument.
18232 Update accordingly everywhere.
18234 * cs-parser.jay : Update all calls to the above to take a location
18237 * class.cs : Ditto.
18239 2001-09-24 Ravi Pratap <ravi@ximian.com>
18241 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
18242 (Invocation::BetterConversion): Same here
18243 (Invocation::ConversionExists): Ditto.
18245 (Invocation::ConversionExists): Implement.
18247 2001-09-22 Ravi Pratap <ravi@ximian.com>
18249 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
18250 Also take an additional TypeContainer argument.
18252 * All over : Pass in TypeContainer as argument to OverloadResolve.
18254 * typemanager.cs (CSharpName): Update to check for the string type and return
18257 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
18260 2001-09-21 Ravi Pratap <ravi@ximian.com>
18262 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
18263 (Invocation::BetterFunction): Implement.
18264 (Invocation::BetterConversion): Implement.
18265 (Invocation::ConversionExists): Skeleton, no implementation yet.
18267 Okay, things work fine !
18269 2001-09-21 Miguel de Icaza <miguel@ximian.com>
18271 * typemanager.cs: declare and load enum_type, delegate_type and
18274 * expression.cs (Expression::Emit): Now emit returns a value that
18275 tells whether a value is left on the stack or not. This strategy
18276 might be reveted tomorrow with a mechanism that would address
18277 multiple assignments.
18278 (Expression::report118): Utility routine to report mismatches on
18281 (Unary::Report23): Report impossible type/operator combination
18284 (Unary::IsIncrementableNumber): Whether the type can be
18285 incremented or decremented with add.
18286 (Unary::ResolveOperator): Also allow enumerations to be bitwise
18288 (Unary::ResolveOperator): Implement ++, !, ~,
18290 (Invocation::Emit): Deal with new Emit convetion.
18292 * All Expression derivatives: Updated their Emit method to return
18293 whether they leave values on the stack or not.
18295 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
18296 stack for expressions that are statements.
18298 2001-09-20 Miguel de Icaza <miguel@ximian.com>
18300 * expression.cs (LValue): New interface. Must be implemented by
18302 (LocalVariableReference, ParameterReference, FieldExpr): Implement
18305 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
18306 interface for generating code, simplifies the code.
18308 2001-09-20 Ravi Pratap <ravi@ximian.com>
18310 * expression.cs (everywhere): Comment out return statements in ::Resolve
18311 methods to avoid the warnings.
18313 2001-09-20 Miguel de Icaza <miguel@ximian.com>
18315 * driver.cs (parse): Report error 2001 if we can not open the
18318 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
18321 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
18324 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
18325 otherwise nested blocks end up with the same index.
18327 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
18329 * expression.cs: Instead of having FIXMEs in the Resolve
18330 functions, throw exceptions so it is obvious that we are facing a
18333 * cs-parser.jay (invocation_expression): Pass Location information.
18335 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
18336 Use a basename for those routines because .NET does not like paths
18339 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
18342 2001-09-19 Miguel de Icaza <miguel@ximian.com>
18344 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
18345 are loading the correct data types (throws an exception if not).
18346 (TypeManager::InitCoreTypes): Use CoreLookupType
18348 * expression.cs (Unary::ResolveOperator): return the child
18349 expression for expressions which are just +expr.
18350 (Unary::ResolveOperator): Return negative literals for -LITERAL
18351 expressions (otherwise they are Unary {Literal}).
18352 (Invocation::Badness): Take into account `Implicit constant
18353 expression conversions'.
18355 * literal.cs (LongLiteral): Implement long literal class.
18356 (IntLiteral): export the `Value' of the intliteral.
18358 2001-09-19 Ravi Pratap <ravi@ximian.com>
18360 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
18362 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
18363 instead of 'Operator'
18365 * expression.cs (Binary::ResolveOperator): Update accordingly.
18366 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
18369 * cs-parser.jay (unary_expression): Update to use the new names.
18371 * gen-treedump.cs (GetUnary): Same here.
18373 * expression.cs (Unary::Resolve): Implement.
18374 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
18375 operators are found instead of making noise ;-)
18376 (Unary::ResolveOperator): New method to do precisely the same thing which
18377 Binary::ResolveOperator does for Binary expressions.
18378 (Unary.method, .Arguments): Add.
18379 (Unary::OperName): Implement.
18380 (Unary::ForceConversion): Copy and Paste !
18382 * class.cs (Operator::Define): Fix a small bug for the case when we have
18385 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
18386 for the inbuilt operators. Only overloading works for now ;-)
18388 2001-09-18 Miguel de Icaza <miguel@ximian.com>
18390 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
18391 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
18393 * expression.cs (This::Emit): Implement.
18394 (This::Resolve): Implement.
18395 (TypeOf:Resolve): Implement.
18396 (Expression::ResolveSimpleName): Add an implicit this to instance
18398 (MemberAccess::Resolve): Deal with Parameters and Fields.
18399 Bind instance variable to Field expressions.
18400 (FieldExpr::Instance): New field used to track the expression that
18401 represents the object instance.
18402 (FieldExpr::Resolve): Track potential errors from MemberLookup not
18404 (FieldExpr::Emit): Implement.
18406 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
18407 the last instruction contains a return opcode to avoid generating
18408 the last `ret' instruction (this generates correct code, and it is
18409 nice to pass the peverify output).
18411 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
18412 initializer for static and instance variables.
18413 (Constructor::Emit): Allow initializer to be null in the case of
18414 static constructors. Only emit initializer for instance
18417 (TypeContainer::FindMembers): Return a null array if there are no
18420 Also fix the code for the MemberTypes.Method branch, as it was not
18421 scanning that for operators (or tried to access null variables before).
18423 * assign.cs (Assign::Emit): Handle instance and static fields.
18427 * driver.cs: Stop compilation if there are parse errors.
18429 * cs-parser.jay (constructor_declaration): Provide default base
18430 initializer for non-static constructors.
18431 (constructor_declarator): Do not provide a default base
18432 initializers if none was specified.
18433 Catch the fact that constructors should not have parameters.
18435 * class.cs: Do not emit parent class initializers for static
18436 constructors, that should be flagged as an error.
18438 2001-09-18 Ravi Pratap <ravi@ximian.com>
18440 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
18441 Move back code into TypeContainer::Populate.
18443 2001-09-18 Ravi Pratap <ravi@ximian.com>
18445 * class.cs (TypeContainer::AddConstructor): Fix the check to
18446 compare against Name, not Basename.
18447 (Operator::OpType): Change Plus and Minus to Add and Subtract.
18449 * cs-parser.jay : Update accordingly.
18451 * class.cs (TypeContainer::FindMembers): For the case where we are searching
18452 for methods, don't forget to look into the operators too.
18453 (RegisterMethodBuilder): Helper method to take care of this for
18454 methods, constructors and operators.
18455 (Operator::Define): Completely revamp.
18456 (Operator.OperatorMethod, MethodName): New fields.
18457 (TypeContainer::Populate): Move the registering of builders into
18458 RegisterMethodBuilder.
18459 (Operator::Emit): Re-write.
18461 * expression.cs (Binary::Emit): Comment out code path to emit method
18462 invocation stuff for the case when we have a user defined operator. I am
18463 just not able to get it right !
18465 2001-09-17 Miguel de Icaza <miguel@ximian.com>
18467 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
18470 (Expression::MemberLookup): Provide a version that allows to
18471 specify the MemberTypes and BindingFlags.
18473 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
18474 so it was not fetching variable information from outer blocks.
18476 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
18477 Beforefieldinit as it was buggy.
18479 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
18480 that Ravi put here.
18482 * class.cs (Constructor::Emit): Only emit if block is not null.
18483 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
18484 deal with this by semantically definining it as if the user had
18487 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
18488 constructors as we now "emit" them at a higher level.
18490 (TypeContainer::DefineDefaultConstructor): Used to define the
18491 default constructors if none was provided.
18493 (ConstructorInitializer): Add methods Resolve and Emit.
18495 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
18497 2001-09-17 Ravi Pratap <ravi@ximian.com>
18499 * class.cs (TypeContainer::EmitDefaultConstructor): Register
18500 the default constructor builder with our hashtable for methodbuilders
18503 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
18504 and argument_count is 0 in which case we have a match.
18505 (Binary::ResolveOperator): More null checking and miscellaneous coding
18508 2001-09-17 Ravi Pratap <ravi@ximian.com>
18510 * rootcontext.cs (IsNameSpace): Compare against null.
18512 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
18514 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
18515 and Unary::Operator.
18517 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
18520 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
18521 we have overloaded operators.
18522 (Binary::ResolveOperator): Implement the part which does the operator overload
18525 * class.cs (Operator::Emit): Implement.
18526 (TypeContainer::Emit): Emit the operators we have too.
18528 * expression.cs (Binary::Emit): Update to emit the appropriate code for
18529 the case when we have a user-defined operator.
18531 2001-09-17 Miguel de Icaza <miguel@ximian.com>
18533 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
18535 2001-09-16 Ravi Pratap <ravi@ximian.com>
18537 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
18538 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
18539 (Constructor::Emit): Implement.
18540 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
18541 if we have no work to do.
18542 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
18545 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
18546 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
18548 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
18551 2001-09-15 Ravi Pratap <ravi@ximian.com>
18553 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
18555 (Tree::RecordNamespace): Method to do what the name says ;-)
18556 (Tree::Namespaces): Property to get at the namespaces hashtable.
18558 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
18561 * rootcontext.cs (IsNamespace): Fixed it :-)
18563 2001-09-14 Miguel de Icaza <miguel@ximian.com>
18565 * class.cs (TypeContainer::FindMembers): Add support for
18567 (MethodCore): New class that encapsulates both the shared aspects
18568 of a Constructor and a Method.
18569 (Method, Constructor): Factored pieces into MethodCore.
18571 * driver.cs: Added --fatal which makes errors throw exceptions.
18572 Load System assembly as well as part of the standard library.
18574 * report.cs: Allow throwing exceptions on errors for debugging.
18576 * modifiers.cs: Do not use `parent', instead use the real type
18577 container to evaluate permission settings.
18579 * class.cs: Put Ravi's patch back in. He is right, and we will
18580 have to cope with the
18582 2001-09-14 Ravi Pratap <ravi@ximian.com>
18584 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
18585 FamORAssem, not FamANDAssem.
18587 2001-09-14 Miguel de Icaza <miguel@ximian.com>
18589 * driver.cs: Added --parse option that only parses its input files
18592 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
18593 incorrect. IsTopLevel is not used to tell whether an object is
18594 root_types or not (that can be achieved by testing this ==
18595 root_types). But to see if this is a top-level *class* (not
18596 necessarly our "toplevel" container).
18598 2001-09-14 Ravi Pratap <ravi@ximian.com>
18600 * enum.cs (Enum::Define): Modify to call the Lookup method on the
18601 parent instead of a direct call to GetType.
18603 2001-09-14 Ravi Pratap <ravi@ximian.com>
18605 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
18606 Modifiers.TypeAttr. This should just be a call to that method.
18608 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
18609 object so that we can determine if we are top-level or not.
18611 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
18614 * enum.cs (Enum::Define): Ditto.
18616 * modifiers.cs (FieldAttr): Re-write.
18618 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
18619 (TypeContainer::HaveStaticConstructor): New property to provide access
18620 to precisely that info.
18622 * modifiers.cs (MethodAttr): Re-write.
18623 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
18625 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
18626 of top-level types as claimed.
18628 2001-09-13 Miguel de Icaza <miguel@ximian.com>
18630 * expression.cs (MemberLookup): Fruitless attempt to lookup
18631 constructors. Maybe I need to emit default constructors? That
18632 might be it (currently .NET emits this for me automatically).
18633 (Invocation::OverloadResolve): Cope with Arguments == null.
18634 (Invocation::EmitArguments): new function, shared by the new
18635 constructor and us.
18636 (Invocation::Emit): Handle static and instance methods. Emit
18637 proper call instruction for virtual or non-virtual invocations.
18638 (New::Emit): Implement.
18639 (New::Resolve): Implement.
18640 (MemberAccess:Resolve): Implement.
18641 (MethodGroupExpr::InstanceExpression): used conforming to the spec
18642 to track instances.
18643 (FieldExpr::Resolve): Set type.
18645 * support.cs: Handle empty arguments.
18647 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
18648 SimpleLookup): Auxiliary routines to help parse a qualifier
18651 Update qualifier_identifier rule.
18653 * codegen.cs: Removed debugging messages.
18655 * class.cs: Make this a global thing, this acts just as a "key" to
18656 objects that we might have around.
18658 (Populate): Only initialize method_builders_to_methods once.
18660 * expression.cs (PropertyExpr): Initialize type from the
18663 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
18664 Resolve pattern. Attempt to implicitly convert value to boolean.
18667 * expression.cs: Set the type for the int32/int32 argument case.
18668 (Binary::ResolveOperator): Set the return type to boolean for
18669 comparission operators
18671 * typemanager.cs: Remove debugging print code.
18673 (Invocation::Resolve): resolve type.
18675 * class.cs: Allocate a MemberInfo of the correct size, as the code
18676 elsewhere depends on the test to reflect the correct contents.
18678 (Method::) Keep track of parameters, due to System.Reflection holes
18680 (TypeContainer::Populate): Keep track of MethodBuilders to Method
18683 (TypeContainer::FindMembers): Use ArrayList and then copy an array
18684 of the exact size and return that.
18686 (Class::LookupMethodByBuilder): New function that maps
18687 MethodBuilders to its methods. Required to locate the information
18688 on methods because System.Reflection bit us again.
18690 * support.cs: New file, contains an interface ParameterData and
18691 two implementations: ReflectionParameters and InternalParameters
18692 used to access Parameter information. We will need to grow this
18695 * expression.cs (Invocation::GetParameterData): implement a cache
18696 and a wrapper around the ParameterData creation for methods.
18697 (Invocation::OverloadResolve): Use new code.
18699 2001-09-13 Ravi Pratap <ravi@ximian.com>
18701 * class.cs (TypeContainer::EmitField): Remove and move into
18702 (Field::Define): here and modify accordingly.
18703 (Field.FieldBuilder): New member.
18704 (TypeContainer::Populate): Update accordingly.
18705 (TypeContainer::FindMembers): Implement.
18707 2001-09-13 Miguel de Icaza <miguel@ximian.com>
18709 * statement.cs: (VariableInfo::VariableType): New field to be
18710 initialized with the full type once it is resolved.
18712 2001-09-12 Miguel de Icaza <miguel@ximian.com>
18714 * parameter.cs (GetParameterInfo): Use a type cache to compute
18715 things only once, and to reuse this information
18717 * expression.cs (LocalVariableReference::Emit): Implement.
18718 (OpcodeCast::Emit): fix.
18720 (ParameterReference::Resolve): Implement.
18721 (ParameterReference::Emit): Implement.
18723 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
18724 that are expressions need to stay as Expressions.
18726 * typemanager.cs (CSharpName): Returns the C# name of a type if
18729 * expression.cs (Expression::ConvertImplicit): New function that
18730 implements implicit type conversions.
18732 (Expression::ImplicitReferenceConversion): Implements implicit
18733 reference conversions.
18735 (EmptyCast): New type for transparent casts.
18737 (OpcodeCast): New type for casts of types that are performed with
18738 a sequence of bytecodes.
18740 (BoxedCast): New type used for casting value types into reference
18741 types. Emits a box opcode.
18743 (Binary::DoNumericPromotions): Implements numeric promotions of
18744 and computation of the Binary::Type.
18746 (Binary::EmitBranchable): Optimization.
18748 (Binary::Emit): Implement code emission for expressions.
18750 * typemanager.cs (TypeManager): Added two new core types: sbyte
18753 2001-09-12 Ravi Pratap <ravi@ximian.com>
18755 * class.cs (TypeContainer::FindMembers): Method which does exactly
18756 what Type.FindMembers does, only we don't have to use reflection. No
18757 implementation yet.
18759 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
18760 typecontainer objects as we need to get at them.
18761 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
18763 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
18764 typecontainer object.
18766 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
18767 of just a Report object.
18769 2001-09-11 Ravi Pratap <ravi@ximian.com>
18771 * class.cs (Event::Define): Go back to using the prefixes "add_" and
18773 (TypeContainer::Populate): Now define the delegates of the type too.
18774 (TypeContainer.Delegates): Property to access the list of delegates defined
18777 * delegates.cs (Delegate::Define): Implement partially.
18779 * modifiers.cs (TypeAttr): Handle more flags.
18781 2001-09-11 Ravi Pratap <ravi@ximian.com>
18783 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
18785 (Operator::Define): Re-write logic to get types by using the LookupType method
18786 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
18787 (Indexer::Define): Ditto.
18788 (Event::Define): Ditto.
18789 (Property::Define): Ditto.
18791 2001-09-10 Ravi Pratap <ravi@ximian.com>
18793 * class.cs (TypeContainer::Populate): Now define operators too.
18794 (TypeContainer.Operators): New property to access the list of operators
18796 (Operator.OperatorMethodBuilder): New member to hold the method builder
18797 for the operator we are defining.
18798 (Operator::Define): Implement.
18800 2001-09-10 Ravi Pratap <ravi@ximian.com>
18802 * class.cs (Event::Define): Make the prefixes of the accessor methods
18803 addOn_ and removeOn_
18805 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
18806 of the location being passed in too. Ideally, this should go later since all
18807 error reporting should be done through the Report object.
18809 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
18810 (Populate): Iterate thru the indexers we have and define them too.
18811 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
18812 for the get and set accessors.
18813 (Indexer::Define): Implement.
18815 2001-09-09 Miguel de Icaza <miguel@ximian.com>
18817 * expression.cs (Binary::Resolve): Beginning of it. I scratched
18818 my previous implementation, did not work.
18820 * typemanager.cs: Add a couple of missing types (the longs).
18822 * literal.cs: Use TypeManager.bool_type instead of getting it.
18824 * expression.cs (EventExpr): New kind of expressions.
18825 (Expressio::ExprClassFromMemberInfo): finish
18827 2001-09-08 Miguel de Icaza <miguel@ximian.com>
18829 * assign.cs: Emit stores to static fields differently.
18831 2001-09-08 Ravi Pratap <ravi@ximian.com>
18833 * Merge in changes and adjust code to tackle conflicts. Backed out my
18834 code in Assign::Resolve ;-)
18836 2001-09-08 Ravi Pratap <ravi@ximian.com>
18838 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
18839 instead Report.Error and also pass in the location.
18840 (CSharpParser::Lexer): New readonly property to return the reference
18841 to the Tokenizer object.
18842 (declare_local_variables): Use Report.Error with location instead of plain
18846 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
18847 (Operator.CheckBinaryOperator): Ditto.
18849 * cs-parser.jay (operator_declarator): Update accordingly.
18851 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
18852 (CheckBinaryOperator): Same here.
18854 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
18855 on the name without any prefixes of namespace names etc. This is because we
18856 already might have something already fully qualified like
18857 'System.Console.WriteLine'
18859 * assign.cs (Resolve): Begin implementation. Stuck ;-)
18861 2001-09-07 Ravi Pratap <ravi@ximian.com>
18863 * cs-tokenizer.cs (location): Return a string which also contains
18866 * expression.cs (ElementAccess): New class for expressions of the
18867 type 'element access.'
18868 (BaseAccess): New class for expressions of the type 'base access.'
18869 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
18872 * cs-parser.jay (element_access): Implement action.
18873 (base_access): Implement actions.
18874 (checked_expression, unchecked_expression): Implement.
18876 * cs-parser.jay (local_variable_type): Correct and implement.
18877 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
18879 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
18881 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
18882 name and the specifiers.
18884 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
18886 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
18887 making them all public ;-)
18889 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
18892 2001-09-07 Miguel de Icaza <miguel@ximian.com>
18894 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
18896 (FieldExpr, PropertyExprs): New resolved expressions.
18897 (SimpleName::MemberStaticCheck): Perform static checks for access
18898 to non-static fields on static methods. Maybe this should be
18899 generalized for MemberAccesses.
18900 (SimpleName::ResolveSimpleName): More work on simple name
18903 * cs-parser.jay (primary_expression/qualified_identifier): track
18904 the parameter index.
18906 * codegen.cs (CodeGen::Save): Catch save exception, report error.
18907 (EmitContext::EmitBoolExpression): Chain to expression generation
18908 instead of temporary hack.
18909 (::EmitStatementExpression): Put generic expression code generation.
18911 * assign.cs (Assign::Emit): Implement variable assignments to
18912 local variables, parameters and fields.
18914 2001-09-06 Miguel de Icaza <miguel@ximian.com>
18916 * statement.cs (Block::GetVariableInfo): New method, returns the
18917 VariableInfo for a variable name in a block.
18918 (Block::GetVariableType): Implement in terms of GetVariableInfo
18920 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
18921 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
18923 2001-09-06 Ravi Pratap <ravi@ximian.com>
18925 * cs-parser.jay (operator_declaration): Continue on my quest : update
18926 to take attributes argument.
18927 (event_declaration): Ditto.
18928 (enum_declaration): Ditto.
18929 (indexer_declaration): Ditto.
18931 * class.cs (Operator::Operator): Update constructor accordingly.
18932 (Event::Event): Ditto.
18934 * delegate.cs (Delegate::Delegate): Same here.
18936 * enum.cs (Enum::Enum): Same here.
18938 2001-09-05 Ravi Pratap <ravi@ximian.com>
18940 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
18942 * ../tests/cs0658.cs : New file to demonstrate error 0658.
18944 * attribute.cs (Attributes): New class to encapsulate all attributes which were
18945 being passed around as an arraylist.
18946 (Attributes::AddAttribute): Method to add attribute sections.
18948 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
18949 (struct_declaration): Update accordingly.
18950 (constant_declaration): Update.
18951 (field_declaration): Update.
18952 (method_header): Update.
18953 (fixed_parameter): Update.
18954 (parameter_array): Ditto.
18955 (property_declaration): Ditto.
18956 (destructor_declaration): Ditto.
18958 * class.cs (Struct::Struct): Update constructors accordingly.
18959 (Class::Class): Ditto.
18960 (Field::Field): Ditto.
18961 (Method::Method): Ditto.
18962 (Property::Property): Ditto.
18963 (TypeContainer::OptAttribute): update property's return type.
18965 * interface.cs (Interface.opt_attributes): New member.
18966 (Interface::Interface): Update to take the extra Attributes argument.
18968 * parameter.cs (Parameter::Parameter): Ditto.
18970 * constant.cs (Constant::Constant): Ditto.
18972 * interface.cs (InterfaceMemberBase): New OptAttributes field.
18973 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
18974 the attributes as a parameter.
18975 (InterfaceProperty): Update constructor call.
18976 (InterfaceEvent): Ditto.
18977 (InterfaceMethod): Ditto.
18978 (InterfaceIndexer): Ditto.
18980 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
18981 pass the attributes too.
18982 (interface_event_declaration): Ditto.
18983 (interface_property_declaration): Ditto.
18984 (interface_method_declaration): Ditto.
18985 (interface_declaration): Ditto.
18987 2001-09-05 Miguel de Icaza <miguel@ximian.com>
18989 * class.cs (Method::Define): Track the "static Main" definition to
18990 create an entry point.
18992 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
18993 EntryPoint if we find it.
18995 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
18996 (EmitContext::ig): Make this variable public.
18998 * driver.cs: Make the default output file be the first file name
18999 with the .exe extension.
19001 Detect empty compilations
19003 Handle various kinds of output targets. Handle --target and
19004 rename -t to --dumper.
19006 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
19007 methods inherited from Expression return now an Expression. This
19008 will is used during the tree rewriting as we resolve them during
19011 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
19012 the spec. Missing entirely is the information about
19013 accessability of elements of it.
19015 (Expression::ExprClassFromMemberInfo): New constructor for
19016 Expressions that creates a fully initialized Expression based on
19017 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
19020 (Invocation::Resolve): Begin implementing resolution of invocations.
19022 * literal.cs (StringLiteral): Implement Emit.
19024 2001-09-05 Ravi Pratap <ravi@ximian.com>
19026 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
19029 2001-09-04 Ravi Pratap <ravi@ximian.com>
19031 * cs-parser.jay (attribute_arguments): Implement actions.
19032 (attribute): Fix bug in production. Implement action.
19033 (attribute_list): Implement.
19034 (attribute_target): Implement.
19035 (attribute_target_specifier, opt_target_specifier): Implement
19036 (CheckAttributeTarget): New method to check if the attribute target
19038 (attribute_section): Implement.
19039 (opt_attributes): Implement.
19041 * attribute.cs : New file to handle attributes.
19042 (Attribute): Class to hold attribute info.
19044 * cs-parser.jay (opt_attribute_target_specifier): Remove production
19045 (attribute_section): Modify production to use 2 different rules to
19046 achieve the same thing. 1 s/r conflict down !
19047 Clean out commented, useless, non-reducing dimension_separator rules.
19049 * class.cs (TypeContainer.attributes): New member to hold list
19050 of attributes for a type.
19051 (Struct::Struct): Modify to take one more argument, the attribute list.
19052 (Class::Class): Ditto.
19053 (Field::Field): Ditto.
19054 (Method::Method): Ditto.
19055 (Property::Property): Ditto.
19057 * cs-parser.jay (struct_declaration): Update constructor call to
19058 pass in the attributes too.
19059 (class_declaration): Ditto.
19060 (constant_declaration): Ditto.
19061 (field_declaration): Ditto.
19062 (method_header): Ditto.
19063 (fixed_parameter): Ditto.
19064 (parameter_array): Ditto.
19065 (property_declaration): Ditto.
19067 * constant.cs (Constant::Constant): Update constructor similarly.
19068 Use System.Collections.
19070 * parameter.cs (Parameter::Parameter): Update as above.
19072 2001-09-02 Ravi Pratap <ravi@ximian.com>
19074 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
19075 (TypeContainer.delegates): New member to hold list of delegates.
19077 * cs-parser.jay (delegate_declaration): Implement the action correctly
19078 this time as I seem to be on crack ;-)
19080 2001-09-02 Miguel de Icaza <miguel@ximian.com>
19082 * rootcontext.cs (RootContext::IsNamespace): new function, used to
19083 tell whether an identifier represents a namespace.
19085 * expression.cs (NamespaceExpr): A namespace expression, used only
19086 temporarly during expression resolution.
19087 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
19088 utility functions to resolve names on expressions.
19090 2001-09-01 Miguel de Icaza <miguel@ximian.com>
19092 * codegen.cs: Add hook for StatementExpressions.
19094 * class.cs: Fix inverted test for static flag in methods.
19096 2001-09-02 Ravi Pratap <ravi@ximian.com>
19098 * class.cs (Operator::CheckUnaryOperator): Correct error number used
19099 to make it coincide with MS' number.
19100 (Operator::CheckBinaryOperator): Ditto.
19102 * ../errors/errors.txt : Remove error numbers added earlier.
19104 * ../errors/cs1019.cs : Test case for error # 1019
19106 * ../errros/cs1020.cs : Test case for error # 1020
19108 * cs-parser.jay : Clean out commented cruft.
19109 (dimension_separators, dimension_separator): Comment out. Ostensibly not
19110 used anywhere - non-reducing rule.
19111 (namespace_declarations): Non-reducing rule - comment out.
19113 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
19114 with TypeContainer::AddEnum.
19116 * delegate.cs : New file for delegate handling classes.
19117 (Delegate): Class for declaring delegates.
19119 * makefile : Update.
19121 * cs-parser.jay (delegate_declaration): Implement.
19123 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
19125 * class.cs (Event::Define): Implement.
19126 (Event.EventBuilder): New member.
19128 * class.cs (TypeContainer::Populate): Update to define all enums and events
19130 (Events): New property for the events arraylist we hold. Shouldn't we move to using
19131 readonly fields for all these cases ?
19133 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
19135 * class.cs (Property): Revamp to use the convention of making fields readonly.
19136 Accordingly modify code elsewhere.
19138 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
19139 the Define method of the Property class.
19141 * class.cs : Clean up applied patch and update references to variables etc. Fix
19143 (TypeContainer::Populate): Update to define all the properties we have. Also
19144 define all enumerations.
19146 * enum.cs (Define): Implement.
19148 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
19150 * cs-parser.jay (overloadable_operator): The semantic value is an
19151 enum of the Operator class.
19152 (operator_declarator): Implement actions.
19153 (operator_declaration): Implement.
19155 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
19156 validity of definitions.
19157 (Operator::CheckBinaryOperator): Static method to check for binary operators
19158 (TypeContainer::AddOperator): New method to add an operator to a type.
19160 * cs-parser.jay (indexer_declaration): Added line to actually call the
19161 AddIndexer method so it gets added ;-)
19163 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
19164 already taken care of by the MS compiler ?
19166 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
19168 * class.cs (Operator): New class for operator declarations.
19169 (Operator::OpType): Enum for the various operators.
19171 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
19173 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
19174 ostensibly handle this in semantic analysis.
19176 * cs-parser.jay (general_catch_clause): Comment out
19177 (specific_catch_clauses, specific_catch_clause): Ditto.
19178 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
19179 (catch_args, opt_catch_args): New productions.
19180 (catch_clause): Rewrite to use the new productions above
19181 (catch_clauses): Modify accordingly.
19182 (opt_catch_clauses): New production to use in try_statement
19183 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
19184 and re-write the code in the actions to extract the specific and
19185 general catch clauses by being a little smart ;-)
19187 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
19188 Hooray, try and catch statements parse fine !
19190 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19192 * statement.cs (Block::GetVariableType): Fix logic to extract the type
19193 string from the hashtable of variables.
19195 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
19196 I end up making that mistake ;-)
19197 (catch_clauses): Fixed gross error which made Key and Value of the
19198 DictionaryEntry the same : $1 !!
19200 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19202 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
19204 * cs-parser.jay (event_declaration): Correct to remove the semicolon
19205 when the add and remove accessors are specified.
19207 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19209 * cs-parser.jay (IndexerDeclaration): New helper class to hold
19210 information about indexer_declarator.
19211 (indexer_declarator): Implement actions.
19212 (parsing_indexer): New local boolean used to keep track of whether
19213 we are parsing indexers or properties. This is necessary because
19214 implicit_parameters come into picture even for the get accessor in the
19215 case of an indexer.
19216 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
19218 * class.cs (Indexer): New class for indexer declarations.
19219 (TypeContainer::AddIndexer): New method to add an indexer to a type.
19220 (TypeContainer::indexers): New member to hold list of indexers for the
19223 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
19225 * cs-parser.jay (add_accessor_declaration): Implement action.
19226 (remove_accessor_declaration): Implement action.
19227 (event_accessors_declaration): Implement
19228 (variable_declarators): swap statements for first rule - trivial.
19230 * class.cs (Event): New class to hold information about event
19232 (TypeContainer::AddEvent): New method to add an event to a type
19233 (TypeContainer::events): New member to hold list of events.
19235 * cs-parser.jay (event_declaration): Implement actions.
19237 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
19239 * cs-parser.jay (dim_separators): Implement. Make it a string
19240 concatenating all the commas together, just as they appear.
19241 (opt_dim_separators): Modify accordingly
19242 (rank_specifiers): Update accordingly. Basically do the same
19243 thing - instead, collect the brackets here.
19244 (opt_rank_sepcifiers): Modify accordingly.
19245 (array_type): Modify to actually return the complete type string
19246 instead of ignoring the rank_specifiers.
19247 (expression_list): Implement to collect the expressions
19248 (variable_initializer): Implement. We make it a list of expressions
19249 essentially so that we can handle the array_initializer case neatly too.
19250 (variable_initializer_list): Implement.
19251 (array_initializer): Make it a list of variable_initializers
19252 (opt_array_initializer): Modify accordingly.
19254 * expression.cs (New::NType): Add enumeration to help us
19255 keep track of whether we have an object/delegate creation
19256 or an array creation.
19257 (New:NewType, New::Rank, New::Indices, New::Initializers): New
19258 members to hold data about array creation.
19259 (New:New): Modify to update NewType
19260 (New:New): New Overloaded contructor for the array creation
19263 * cs-parser.jay (array_creation_expression): Implement to call
19264 the overloaded New constructor.
19266 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
19268 * class.cs (TypeContainer::Constructors): Return member
19269 constructors instead of returning null.
19271 2001-08-26 Miguel de Icaza <miguel@ximian.com>
19273 * typemanager.cs (InitCoreTypes): Initialize the various core
19274 types after we have populated the type manager with the user
19275 defined types (this distinction will be important later while
19276 compiling corlib.dll)
19278 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
19279 on Expression Classification. Now all expressions have a method
19280 `Resolve' and a method `Emit'.
19282 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
19283 generation from working. Also add some temporary debugging
19286 2001-08-24 Miguel de Icaza <miguel@ximian.com>
19288 * codegen.cs: Lots of code generation pieces. This is only the
19289 beginning, will continue tomorrow with more touches of polish. We
19290 handle the fundamentals of if, while, do, for, return. Others are
19291 trickier and I need to start working on invocations soon.
19293 * gen-treedump.cs: Bug fix, use s.Increment here instead of
19296 * codegen.cs (EmitContext): New struct, used during code
19297 emission to keep a context. Most of the code generation will be
19300 * cs-parser.jay: Add embedded blocks to the list of statements of
19301 this block. So code generation proceeds in a top down fashion.
19303 2001-08-23 Miguel de Icaza <miguel@ximian.com>
19305 * statement.cs: Add support for multiple child blocks.
19307 2001-08-22 Miguel de Icaza <miguel@ximian.com>
19309 * codegen.cs (EmitCode): New function, will emit the code for a
19310 Block of code given a TypeContainer and its ILGenerator.
19312 * statement.cs (Block): Standard public readonly optimization.
19313 (Block::Block constructors): Link children.
19314 (Block::Child): Child Linker.
19315 (Block::EmitVariables): Emits IL variable declarations.
19317 * class.cs: Drop support for MethodGroups here, delay until
19319 (Method::): Applied the same simplification that I did before, and
19320 move from Properties to public readonly fields.
19321 (Method::ParameterTypes): Returns the parameter types for the
19322 function, and implements a cache that will be useful later when I
19323 do error checking and the semantic analysis on the methods is
19325 (Constructor::GetCallingConvention): Renamed from CallingConvetion
19326 and made a method, optional argument tells whether this is a class
19327 or a structure to apply the `has-this' bit.
19328 (Method::GetCallingConvention): Implement, returns the calling
19330 (Method::Define): Defines the type, a second pass is performed
19331 later to populate the methods.
19333 (Constructor::ParameterTypes): implement a cache similar to the
19334 one on Method::ParameterTypes, useful later when we do semantic
19337 (TypeContainer::EmitMethod): New method. Emits methods.
19339 * expression.cs: Removed MethodGroup class from here.
19341 * parameter.cs (Parameters::GetCallingConvention): new method.
19343 2001-08-21 Miguel de Icaza <miguel@ximian.com>
19345 * class.cs (TypeContainer::Populate): Drop RootContext from the
19348 (Constructor::CallingConvention): Returns the calling convention.
19349 (Constructor::ParameterTypes): Returns the constructor parameter
19352 (TypeContainer::AddConstructor): Keep track of default constructor
19353 and the default static constructor.
19355 (Constructor::) Another class that starts using `public readonly'
19356 instead of properties.
19358 (Constructor::IsDefault): Whether this is a default constructor.
19360 (Field::) use readonly public fields instead of properties also.
19362 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
19363 track of static constructors; If none is used, turn on
19364 BeforeFieldInit in the TypeAttributes.
19366 * cs-parser.jay (opt_argument_list): now the return can be null
19367 for the cases where there are no arguments.
19369 (constructor_declarator): If there is no implicit `base' or
19370 `this', then invoke the default parent constructor.
19372 * modifiers.cs (MethodAttr): New static function maps a set of
19373 modifiers flags into a MethodAttributes enum
19374 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
19375 MethodAttr, TypeAttr to represent the various mappings where the
19376 modifiers are used.
19377 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
19379 2001-08-19 Miguel de Icaza <miguel@ximian.com>
19381 * parameter.cs (GetParameterInfo): Fix bug where there would be no
19384 * interface.cs (PopulateIndexer): Implemented the code generator
19385 for interface indexers.
19387 2001-08-17 Miguel de Icaza <miguel@ximian.com>
19389 * interface.cs (InterfaceMemberBase): Now we track the new status
19392 (PopulateProperty): Implement property population. Woohoo! Got
19393 Methods and Properties going today.
19395 Removed all the properties for interfaces, and replaced them with
19396 `public readonly' fields.
19398 2001-08-16 Miguel de Icaza <miguel@ximian.com>
19400 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
19401 initialize their hashtables/arraylists only when they are needed
19402 instead of doing this always.
19404 * parameter.cs: Handle refs and out parameters.
19406 * cs-parser.jay: Use an ArrayList to construct the arguments
19407 instead of the ParameterCollection, and then cast that to a
19410 * parameter.cs: Drop the use of ParameterCollection and use
19411 instead arrays of Parameters.
19413 (GetParameterInfo): Use the Type, not the Name when resolving
19416 2001-08-13 Miguel de Icaza <miguel@ximian.com>
19418 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
19419 and instead use public readonly fields.
19421 * class.cs: Put back walking code for type containers.
19423 2001-08-11 Miguel de Icaza <miguel@ximian.com>
19425 * class.cs (MakeConstant): Code to define constants.
19427 * rootcontext.cs (LookupType): New function. Used to locate types
19430 2001-08-08 Miguel de Icaza <miguel@ximian.com>
19432 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
19433 this System.Reflection code is. Kudos to Microsoft
19435 * typemanager.cs: Implement a type cache and avoid loading all
19436 types at boot time. Wrap in LookupType the internals. This made
19437 the compiler so much faster. Wow. I rule!
19439 * driver.cs: Make sure we always load mscorlib first (for
19440 debugging purposes, nothing really important).
19442 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
19443 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
19445 * rootcontext.cs: Lookup types on their namespace; Lookup types
19446 on namespaces that have been imported using the `using' keyword.
19448 * class.cs (TypeContainer::TypeAttr): Virtualize.
19449 (Class::TypeAttr): Return attributes suitable for this bad boy.
19450 (Struct::TypeAttr): ditto.
19451 Handle nested classes.
19452 (TypeContainer::) Remove all the type visiting code, it is now
19453 replaced with the rootcontext.cs code
19455 * rootcontext.cs (GetClassBases): Added support for structs.
19457 2001-08-06 Miguel de Icaza <miguel@ximian.com>
19459 * interface.cs, statement.cs, class.cs, parameter.cs,
19460 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
19461 Drop use of TypeRefs, and use strings instead.
19463 2001-08-04 Miguel de Icaza <miguel@ximian.com>
19467 * class.cs (Struct::Struct): set the SEALED flags after
19468 checking the modifiers.
19469 (TypeContainer::TypeAttr): new property, returns the
19470 TypeAttributes for a class.
19472 * cs-parser.jay (type_list): Oops, list production was creating a
19473 new list of base types.
19475 * rootcontext.cs (StdLib): New property.
19476 (GetInterfaceTypeByName): returns an interface by type name, and
19477 encapsulates error handling here.
19478 (GetInterfaces): simplified.
19479 (ResolveTree): Encapsulated all the tree resolution here.
19480 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
19483 * driver.cs: Add support for --nostdlib, to avoid loading the
19484 default assemblies.
19485 (Main): Do not put tree resolution here.
19487 * rootcontext.cs: Beginning of the class resolution.
19489 2001-08-03 Miguel de Icaza <miguel@ximian.com>
19491 * rootcontext.cs: Provide better error reporting.
19493 * cs-parser.jay (interface_base): set our $$ to be interfaces.
19495 * rootcontext.cs (CreateInterface): Handle the case where there
19496 are no parent interfaces.
19498 (CloseTypes): Routine to flush types at the end.
19499 (CreateInterface): Track types.
19500 (GetInterfaces): Returns an array of Types from the list of
19501 defined interfaces.
19503 * typemanager.c (AddUserType): Mechanism to track user types (puts
19504 the type on the global type hash, and allows us to close it at the
19507 2001-08-02 Miguel de Icaza <miguel@ximian.com>
19509 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
19510 RecordInterface instead.
19512 * cs-parser.jay: Updated to reflect changes above.
19514 * decl.cs (Definition): Keep track of the TypeBuilder type that
19515 represents this type here. Not sure we will use it in the long
19516 run, but wont hurt for now.
19518 * driver.cs: Smaller changes to accomodate the new code.
19520 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
19523 * rootcontext.cs (CreateInterface): New method, used to create
19524 the System.TypeBuilder type for interfaces.
19525 (ResolveInterfaces): new entry point to resolve the interface
19527 (CodeGen): Property, used to keep track of the code generator.
19529 2001-07-26 Miguel de Icaza <miguel@ximian.com>
19531 * cs-parser.jay: Add a second production for delegate_declaration
19534 (enum_body): Put an opt_comma here instead of putting it on
19535 enum_body or enum_member_declarations so we can handle trailing
19536 commas on enumeration members. Gets rid of a shift/reduce.
19538 (type_list): Need a COMMA in the middle.
19540 (indexer_declaration): Tell tokenizer to recognize get/set
19542 * Remove old targets.
19544 * Re-add the parser target.
19546 2001-07-13 Simon Cozens <simon@simon-cozens.org>
19548 * cs-parser.jay: Add precendence rules for a number of operators
19549 ot reduce the number of shift/reduce conflicts in the grammar.
19551 2001-07-17 Miguel de Icaza <miguel@ximian.com>
19553 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
19556 Get rid of old crufty code.
19558 * rootcontext.cs: Use this to keep track of the parsed
19559 representation and the defined types available to the program.
19561 * gen-treedump.cs: adjust for new convention.
19563 * type.cs: Split out the type manager, and the assembly builder
19566 * typemanager.cs: the type manager will live here now.
19568 * cil-codegen.cs: And the code generator here.
19570 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
19572 * makefile: Fixed up for easy making.
19574 2001-07-13 Simon Cozens <simon@simon-cozens.org>
19576 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
19579 (unary_expression): Expand pre_increment_expression and
19580 post_decrement_expression to reduce a shift/reduce.
19582 2001-07-11 Simon Cozens
19584 * cs-tokenizer.cs: Hex numbers should begin with a 0.
19586 Improve allow_keyword_as_indent name.
19588 2001-06-19 Miguel de Icaza <miguel@ximian.com>
19590 * Adjustments for Beta2.
19592 2001-06-13 Miguel de Icaza <miguel@ximian.com>
19594 * decl.cs: Added `Define' abstract method.
19595 (InTransit): new property, used to catch recursive definitions.
19597 * interface.cs: Implement `Define'.
19599 * modifiers.cs: Map Modifiers.constants to
19600 System.Reflection.TypeAttribute flags.
19602 * class.cs: Keep track of types and user-defined types.
19603 (BuilderInit): New method for creating an assembly
19604 (ResolveType): New function to launch the resolution process, only
19605 used by interfaces for now.
19607 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
19608 that are inserted into the name space.
19610 2001-06-08 Miguel de Icaza <miguel@ximian.com>
19612 * ARGH. I have screwed up my tree so many times due to the use of
19613 rsync rather than using CVS. Going to fix this at once.
19615 * driver.cs: Objetify driver. Load assemblies, use assemblies to
19618 2001-06-07 Miguel de Icaza <miguel@ximian.com>
19620 * Experiment successful: Use System.Type rather that our own
19623 2001-05-25 Miguel de Icaza <miguel@ximian.com>
19625 * cs-parser.jay: Removed nsAliases from here.
19627 Use new namespaces, handle `using XXX;'
19629 * namespace.cs: Reimplemented namespace handling, use a recursive
19630 definition of the class. Now we can keep track of using clauses
19631 and catch invalid using clauses.
19633 2001-05-24 Miguel de Icaza <miguel@ximian.com>
19635 * gen-treedump.cs: Adapted for all the renaming.
19637 * expression.cs (Expression): this class now has a Type property
19638 which returns an expression Type.
19640 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
19641 `Type', as this has a different meaning now in the base
19643 2001-05-22 Miguel de Icaza <miguel@ximian.com>
19645 * interface.cs, class.cs: Removed from all the sources the
19646 references to signature computation, as we can not do method
19647 signature computation during the parsing time, as we are not
19648 trying to solve at that point distinguishing:
19652 void a (NS.Blah x) {}
19655 Which depending on the context might be valid or not, as we do not
19656 know if Blah is the same thing as NS.Blah at that point.
19658 * Redid everything so the code uses TypeRefs now instead of
19659 Types. TypeRefs are just temporary type placeholders, that need
19660 to be resolved. They initially have a pointer to a string and the
19661 current scope in which they are used. This is used later by the
19662 compiler to resolve the reference to an actual Type.
19664 * DeclSpace is no longer a CIR.Type, and neither are
19665 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
19666 are all DeclSpaces, but no Types.
19668 * type.cs (TypeRefManager): This implements the TypeRef manager,
19669 which keeps track of all the types that need to be resolved after
19670 the parsing has finished.
19672 2001-05-13 Miguel de Icaza <miguel@ximian.com>
19674 * ARGH. We are going to have to store `foreach' as a class rather
19675 than resolving it, as we need to verify error 1579 after name
19676 resolution. *OR* we could keep a flag that says `This request to
19677 IEnumerator comes from a foreach statement' which we can then use
19678 to generate the error.
19680 2001-05-10 Miguel de Icaza <miguel@ximian.com>
19682 * class.cs (TypeContainer.AddMethod): we now add methods to the
19683 MethodGroup instead of the method hashtable.
19685 * expression.cs: Add MethodGroup abstraction, which gets us one
19686 step closer to the specification in the way we handle method
19689 * cs-parser.jay (primary_expression): qualified_identifier now
19690 tried to match up an identifier to a local variable reference or
19691 to a parameter reference.
19693 current_local_parameters is now a parser global variable that
19694 points to the current parameters for the block, used during name
19697 (property_declaration): Now creates an implicit `value' argument to
19700 2001-05-09 Miguel de Icaza <miguel@ximian.com>
19702 * parameter.cs: Do not use `param' arguments as part of the
19703 signature, per the spec.
19705 2001-05-08 Miguel de Icaza <miguel@ximian.com>
19707 * decl.cs: Base class for classes, structs and interfaces. This
19708 is the "Declaration Space"
19710 * cs-parser.jay: Use CheckDef for checking declaration errors
19711 instead of having one on each function.
19713 * class.cs: Factor out some code for handling error handling in
19714 accordance to the "Declarations" section in the "Basic Concepts"
19715 chapter in the ECMA C# spec.
19717 * interface.cs: Make all interface member classes derive from
19718 InterfaceMemberBase.
19720 2001-05-07 Miguel de Icaza <miguel@ximian.com>
19722 * Many things: all interfaces are parsed and generated in
19723 gen-treedump. Support for member variables, constructors,
19724 destructors, properties, constants is there.
19726 Beginning of the IL backend, but very little done, just there for
19729 2001-04-29 Miguel de Icaza <miguel@ximian.com>
19731 * cs-parser.jay: Fix labeled statement.
19733 * cs-tokenizer.cs (escape): Escape " and ' always.
19734 ref_line, ref_name: keep track of the line/filename as instructed
19735 by #line by the compiler.
19738 2001-04-27 Miguel de Icaza <miguel@ximian.com>
19740 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
19741 to match the values in System.CodeDOM.
19743 Divid renamed to Divide.
19745 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
19747 (Statements.set): remove.
19749 * System.CodeDOM/CodeCatchClause.cs: always have a valid
19752 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
19753 falseStatements always have valid values.
19755 * cs-parser.jay: Use System.CodeDOM now.