1 2005-02-28 Martin Baulig <martin@ximian.com>
3 * generic.cs (TypeManager.IsNullableType): New static method.
4 (Nullable): New abstract class.
5 (Nullable.NullLiteral): New public class.
6 (Nullable.LiftedConversion): New public class.
8 * cs-parser.jay (non_expression_type): Changed `builtin_types' to
9 `builtin_types opt_nullable'.
12 (Convert.ImplicitConversionStandard): Added nullable conversions.
13 (Convert.ExplicitConversionStandard): Likewise.
14 (Convert.ExplicitConversion): Likewise.
16 2005-02-26 Martin Baulig <martin@ximian.com>
18 * expression.cs (ComposedCast.DoResolveAsTypeStep): Allow `dim' to
19 begin with a "?", for instance "?[]". Don't do a type lookup if
22 2005-02-25 Martin Baulig <martin@ximian.com>
24 The first part of Nullable Types :-)
26 * generic.cs (NullableType): New public class.
27 (NullCoalescingOperator): New public class.
28 (TypeArguments.Resolve): Add a CS0306 check.
30 * cs-parser.jay (opt_error_modifier): Removed, this was unused.
31 (opt_nullable): New rule.
32 (type): Added `opt_nullable' to `namespace_or_type_name',
33 `builtin_types' and `pointer_type'.
34 (array_type): Added `opt_nullable'.
35 (opt_rank_specifier_or_nullable): New rule; this is the
36 combination of `opt_rank_specifier' and `opt_nullable'.
37 (opt_error): New rule; catch errors here.
38 (nullable_type_or_conditional): New rule; we use this to check for
39 nullable and still detect the conditional operator.
40 (local_variable_type): Use `opt_rank_specifier_or_nullable'
41 instead `opt_rank_specifier'.
43 * expression.cs (ComposedCast.DoResolveAsTypeStep): Added support
46 2005-02-24 Martin Baulig <martin@ximian.com>
48 * README, README.Changes: Removed; they're old and obsolete.
50 2005-02-22 Martin Baulig <martin@ximian.com>
52 * generic.cs (TypeParameter.Resolve): If resolving the constraints
53 returned an error, set `constraints' to null to avoid a crash
55 (TypeParameter.ResolveType): Likewise.
57 2005-02-22 Martin Baulig <martin@ximian.com>
60 (Constraints.ResolveTypes): Protect against being called twice.
61 (Constraints.CheckInterfaceMethod): Don't call ResolveTypes().
62 (TypeParameter.ResolveType): New public method; calls
63 constraints.ResolveTypes().
64 (TypeParameter.DefineType): Moved constraints.ResolveType() out
65 into the new ResolveType().
66 (GenericMethod.Define): Call ResolveType() on all our
69 2005-02-21 Martin Baulig <martin@ximian.com>
72 (TypeManager.generic_nullable_type): New static public field.
73 (TypeManager.InitGenericCoreType): Lookup "System.Nullable`1".
76 (RootContext.ResolveCore): Resolve "System.Nullable`1".
78 2005-02-15 Martin Baulig <martin@ximian.com>
80 * generic.cs (ConstructedType.Constraints): Correctly check
81 constraints if the argument type is a type parameter; fixes
85 2005-03-01 Jambunathan K <kjambunathan.devel@gmail.com>
87 * ecore.cs (ImplicitInvocation, ImplicitNew, FloatingToFixedCast): Added
88 * expression.cs (ImplicitInvocation, ImplicitNew): Removed
90 * driver.cs, rootcontext.cs: Added the 'removeintchecks' and
91 'optionstrict' command line options
93 * convert.cs (WideningNumericConversion,
94 NarrowingNumericConversion): Updated to refelct VB.NET semantics.
96 2005-03-01 Jambunathan K <kjambunathan.devel@gmail.com>
98 * convert.cs: Added the following conversion routines:
99 BooleanConversions, WideningStringConversions,
100 NarrowingStringConversions.
102 * ecore.cs: Added following helper classes: BooleanToNumericCast,
105 * typemanager.cs: Added System.DateTime to the cached types.
107 2005-02-28 Jambunathan K <kjambunathan.devel@gmail.com>
109 * ecore.cs (StringToExpression):
110 * expression.cs (ImplicitInvocation, ImplicitNew): VB.NET specific
111 helper classes and methods.
113 2005-02-28 Jambunathan K <kjambunathan.devel@gmail.com>
115 * assign.cs, attribute.cs, cfold.cs, const.cs, constant.cs,
116 * convert.cs, ecore.cs, enum.cs, expression.cs, generic.cs,
117 * iterator.cs, statement.cs : Broadly, what C# spec terms as
118 "Implicit" & "Explicit", VB.NET spec terms as "Widening" &
119 "Narrowing" respectively. So renamed exisiting methods to reflect
120 the VB.NET nomenclature. These are just first renamings.
122 2005-02-28 Jambunathan K <kjambunathan.devel@gmail.com>
126 * statement.cs: VB.NET has no notion of User defined
127 conversions. Assuming that UserDefinedConversion() returns null,
128 propagated the resulting changes upstream.
130 2005-02-02 Martin Baulig <martin@ximian.com>
132 * delegate.cs (Delegate.DefineType): Report an internal error if
133 TypeManager.multicast_delegate_type is null. See bug #72015 for
136 2005-01-29 Miguel de Icaza <miguel@novell.com>
138 * pending.cs: Produce better code (no nops produced by using Ldarg
141 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
142 i - 1' it should be arg + 1.
146 2005-01-26 Martin Baulig <martin@ximian.com>
148 * cs-parser.jay (indexer_declarator): Don't report an error if we
149 have type parameters since we can be an explicit interface
150 implementation; fixes #71449.
152 2005-01-26 Martin Baulig <martin@ximian.com>
154 * class.cs (TypeContainer.AttributeTargets): Return the correct
155 AttributeTargets depending on our `Kind' instead of throwing an
156 exception; fixes #71632.
158 2005-01-26 Martin Baulig <martin@ximian.com>
160 * delegate.cs (Delegate.DefineType): Correctly define our type
161 parameters. Fixes #71483.
163 2005-01-25 Raja R Harinath <rharinath@novell.com>
166 * expression.cs (MemberAccess.DoResolve): Don't complain with
167 cs0572 when the LHS of a member access has identical name and type
170 2005-01-25 Marek Safar <marek.safar@seznam.cz>
173 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
175 Create custom PermissionSet only for PermissionSetAttribute.
177 2005-01-24 Marek Safar <marek.safar@seznam.cz>
180 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
181 delegates in static class.
183 2005-01-24 Martin Baulig <martin@ximian.com>
185 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
186 merging an implicit block, just use its reachability.
188 * statement.cs (Block.Resolve): Make the unreachable code check
189 work wrt. implicit blocks; see test-337 from #63842.
191 2005-01-21 Alp Toker <alp@atoker.com>
193 * cs-parser.jay: destructor_declaration's container is PartialContainer
194 not Class when partial types are used, so use Kind prop instead of
197 2005-01-22 Miguel de Icaza <miguel@ximian.com>
199 * cs-parser.jay: Improve error reporting when an interface
202 2005-01-20 Dick Porter <dick@ximian.com>
204 * support.cs: SeekableStreamReader fix from Sandor Dobos
205 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
206 chars are read. Fixes bug 70369.
208 2005-01-20 Raja R Harinath <rharinath@novell.com>
210 * cs-parser.jay (catch_clause): Simplify current_block handling
213 2005-01-17 Miguel de Icaza <miguel@ximian.com>
215 * convert.cs (ImplicitStandardConversionExists): Synchronize the
216 code with ImplicitStandardConversion to handle the implicit
217 conversion of method groups into valid delegate invocations.
219 The problem is that in parameter handling we were using this code
220 path. Fixes bug #64698
222 2005-01-19 Raja R Harinath <rharinath@novell.com>
224 * cs-parser.jay: Fix several infelicities.
225 - Avoid assigning to the parser value stack. Code like
226 '$3 = null' is unclean. Synthesize a value for the code block
228 - Avoid using oob_stack for storing location information. Use ...
229 (_mark_): ... this. New (empty) rule. Saves the current location
231 (foreach_statement): Avoid using oob_stack for current_block
232 handling. Use technique used in for_statement and
233 using_statement. Synthesize a value for the code block to store
234 additional intermediate information.
236 2005-01-13 Miguel de Icaza <miguel@ximian.com>
238 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
239 of a different type is only allowed to private fields of a
240 containing type, not on fields of a base class.
242 See test-174.cs and error cs0122-9.cs
244 2005-01-13 Raja R Harinath <rharinath@novell.com>
246 Fix test-335.cs (bug #58126).
247 * cs-parser.jay (argument): Split out non-expression parts of the
248 rule into 'non_simple_argument'.
249 (invocation_expression): Support parenthesized invocations with
250 multiple arguments, and with single non-simple arguments.
252 2005-01-13 Raja R Harinath <rharinath@novell.com>
254 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
257 2005-01-12 Raja R Harinath <rharinath@novell.com>
259 Fix cs0038-1.cs, cs1640-6.cs.
260 * ecore.cs (Expression.Resolve): Remove special-case for
261 SimpleName in error-handling.
262 (Expression.almostMatchedMembers): Relax access permission to
264 (Expression.MemberLookupFailed): Handle duplicates in
265 almostMatchedMembers list.
266 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
267 * expression.cs (New.DoResolve): Report CS1540 for more cases.
268 * typemanager.cs (GetFullNameSignature): Use the MethodBase
269 overload if the passed in MemberInfo is a MethodBase.
271 2005-01-25 Martin Baulig <martin@ximian.com>
274 (DocUtil.emptyParamList): Removed; use `Type.EmptyTypes' instead.
276 2005-01-12 Marek Safar <marek.safar@seznam.cz>
279 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
280 for non-CAS & merge permission sets properly.
282 2005-01-11 Raja R Harinath <rharinath@novell.com>
284 Improve standard-compliance of simple name and member access
285 resolution. Fixes bugs #52697, #57200, #67520, #69519.
286 * ecore.cs (FullNamedExpression): New abstract base class
287 for Namespaces and TypeExpressions.
288 (ResolveFlags.SimpleName): Remove.
289 (SimpleName): Remove support for dotted names.
290 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
291 DeclSpace.FindType and DeclSpace.LookupType.
292 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
293 (Expression.ExprClassName): Make member function.
294 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
295 a namespace. Remove creation of dotted "SimpleName"s.
296 (MemberAccess.DoResolve): Likewise.
297 * decl.cs (DeclSpace.Cache): Make private.
298 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
299 (DeclSpace.FindType): Update.
300 (DeclSpace.LookupType): Move here from RootContext. Return a
302 * namespace.cs (Namespace): Derive from FullNamedExpression
303 so that it can be part of expression resolution.
304 (Namespace.Lookup): Return an FullNamedExpression.
305 (NamespaceEntry.LookupAlias): Lookup aliases only in current
307 * rootcontext.cs (NamespaceLookup): Remove.
308 (LookupType): Move to DeclSpace.
309 * attribute.cs (CheckAttributeType): Update.
310 * doc.cs (FindDocumentedType): Remove allowAlias argument.
311 (FindDocumentedTypeNonArray): Likewise.
313 2005-01-11 Raja R Harinath <rharinath@novell.com>
315 Fix cs0509.cs, cs1632.cs.
316 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
317 is the same as IsInterface.
318 (TypeContainer.GetClassBases): Likewise.
319 * statement.cs (LabeledStatement.ig): New field.
320 (LabeledStatement.LabelTarget): Save ILGenerator which created the
322 (LabeledStatement.DoEmit): Check that the label was created with
323 the same ILGenerator.
325 2005-01-10 Marek Safar <marek.safar@seznam.cz>
328 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
329 accessors to its properties.
331 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
332 from accessors to property.
334 2005-01-10 Marek Safar <marek.safar@seznam.cz>
337 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
340 2005-01-08 Miguel de Icaza <miguel@ximian.com>
342 * attribute.cs: Check for null and empty strings.
344 I have lost another battle to Paolo.
346 2005-01-07 Marek Safar <marek.safar@seznam.cz>
349 * class.cs (PropertyMethod): Set Parent field in ctors.
350 (SetMethod.InternalParameters): Add unsafe switch hack.
351 Override MarkForDuplicationCheck where it is appropriate.
353 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
354 It says whether container allows members with the same name.
356 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
357 Removed is_method parameter.
359 2005-01-06 Duncan Mak <duncan@ximian.com>
361 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
362 because the previous change led to incorrect reporting of CS1032
363 ("Cannot define/undefine preprocessor symbols after first token in
364 file"). Instead of using `tokens_seen' as the only flag that
365 triggers CS1040, introduce `comments_seen'. This new flag is used
366 to signify having seen comments on the current line, so it is
367 unset after a newline.
369 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
371 * doc.cs : When searching for a type, find nested type too.
372 This fixes bug #71040.
374 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
377 - Warn missing member comment on those classes which also does not
378 have doc comments. Fixed bug #71041.
379 - Don't warn missing doc comment on default constructor.
382 2005-01-06 Duncan Mak <duncan@ximian.com>
384 * cs-tokenizer.cs (xtoken): After handling traditional C-style
385 comments, set `tokens_seen' to true. This allows us to detect
386 misplaced preprocessor directives (i.e. not at the beginning of
387 the a line, nor after whitespaces). In that case, report error
388 CS1040. This fixes bug #56460.
390 * cs-parser.jay (interface_member_declaration): Add checks for
391 IsExplicitImpl, and report CS0541 error if an interface member is
392 defined as an explicit interface declaration.
394 2005-01-06 Marek Safar <marek.safar@seznam.cz>
397 * class.cs (PropertyMethod): Set Parent field in ctors.
398 (SetMethod.InternalParameters): Add unsafe switch hack.
400 * decl.cs (MemberCore.Parent): Cannot be readonly.
402 2005-01-06 Raja R Harinath <rharinath@novell.com>
404 * decl.cs (DeclSpace.ResolveType): Remove.
405 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
406 Merge in code from ...
407 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
408 * class.cs, enum.cs: Update to changes.
410 2005-01-06 Miguel de Icaza <miguel@ximian.com>
412 * anonymous.cs: Ensure that we init the scope of our parent if it
413 has not been initialized yet.
415 2004-12-30 Duncan Mak <duncan@ximian.com>
417 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
418 if field.FieldBuilder is null. Fixes #70758.
420 * convert.cs: Fixed some typos and updated some of the comments.
421 (ImplicitStandardConversionExists):
422 (TryImplicitIntConversion): If `target_type' is an interface and
423 the type of `ic' implements this interface, return true or a new
424 BoxedCast instead of null. This fixes #70468.
426 2004-12-29 Duncan Mak <duncan@ximian.com>
428 * expression.cs (Argument.Emit): Check that Expr is
429 IMemoryLocation before casting to it, and report CS1510 otherwise.
433 2004-12-21 Ben Maurer <bmaurer@ximian.com>
435 * statement.cs (Block.ThisVariable): remove the recursion here, to
436 make the --profile more sane.
438 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
440 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
441 assembly, by JB Evain.
443 2004-12-17 Raja R Harinath <rharinath@novell.com>
445 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
446 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
447 "parent" refers to enclosing type/class. "base" refers to superclass.
449 2004-12-17 Raja R Harinath <rharinath@novell.com>
451 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
452 Ensure that we only have GlobalAttributes.
453 * attribute.cs (Attribute.Emit): Make non-virtual.
454 (GlobalAttribute.Emit): Remove.
455 (Attribute.Resolve): Make virtual.
456 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
457 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
458 the argument. Don't create one.
459 (Attribute.GetObsoleteAttribute): Likewise.
460 (Attribute.GetClsCompliantAttributeValue): Likewise.
461 * class.cs, decl.cs: Update to changes.
463 2004-12-17 Marek Safar <marek.safar@seznam.cz>
465 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
467 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
469 * statement.cs (Foreach.Resolve): Add error 186 report.
471 2004-12-16 Marek Safar <marek.safar@seznam.cz>
473 * expression.cs (Conditional.DoResolve): Add warning 429.
475 * statement.cs (If.Resolve): Add warning 665.
477 2004-12-16 Raja R Harinath <rharinath@novell.com>
479 New invariant: RootContext.Tree.Types.NamespaceEntry == null
480 except when in the parser, and in GlobalAttribute.
481 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
482 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
483 RootContext.Tree.Types.NamespaceEntry once work is done.
484 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
485 and resets RootContext.Tree.Types.NamespaceEntry.
487 2004-12-15 Marek Safar <marek.safar@seznam.cz>
489 * cs-parser.jay: Don't create a block for every variable.
491 2004-12-14 Miguel de Icaza <miguel@ximian.com>
493 * location.cs: Provide extra information.
495 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
496 variables from the captured environment, it is the ldarg_0.
498 2004-12-14 Marek Safar <marek.safar@seznam.cz>
500 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
503 * class.cs: Changed warning level for 169 to avoid developer
504 displeasure from warning flooding. It will be changed back when they
505 fix most of current BCL warnings.
507 * RootContext.cs: Pushed default WarningLevel to 3.
509 * statement.cs: Removed unused variable.
511 2004-12-14 Marek Safar <marek.safar@seznam.cz>
513 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
514 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
515 Add error 502 report.
516 (StaticClass.DefineType): Add error 441 report.
517 (Class.AllowedModifiersProp): New virtual property as temporary
518 extension to AllowedModifiers.
519 (Class.DefineType): Add error 418 report. Moved ModFlags check here
520 to share implementation with StaticClass and don't call virtual
523 * driver.cs (MainDriver): Add error 1558 test.
525 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
526 report. Moved error 36 test here.
528 * statement.cs (Throw.Resolve): Add error 724 report.
530 * typemanager.cs: Add out_attribute_type core type.
532 2004-12-13 Marek Safar <marek.safar@seznam.cz>
534 * class.cs (TypeContainer.VerifyClsCompliance): Add error
536 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
538 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
541 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
543 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
544 Add error 3023 report.
545 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
547 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
550 2004-12-12 John Luke <john.luke@gmail.com>
552 * driver.cs (AddArgs): take -- into account when
553 adding arguments, fixes bug 65710
555 2004-12-12 Martin Baulig <martin@ximian.com>
557 * expression.cs (Unary.TryReduceNegative): Added support for
558 SByteConstant and ByteConstant.
559 (Unary.Reduce): Check error values from TryReduceNegative().
561 2004-12-10 Marek Safar <marek.safar@seznam.cz>
563 * attributes.cs (Attribute.Resolve): Avoid multiple error report
564 and report exception as error 182.
566 2004-12-10 Raja R Harinath <rharinath@novell.com>
568 * driver.cs (Main): Fix message when there are warnings.
570 2004-12-09 Miguel de Icaza <miguel@ximian.com>
572 * delegate.cs: Fixed my fix from yesterday, sorry about that.
574 2004-12-09 Marek Safar <marek.safar@seznam.cz>
576 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
577 Reduced number of warnings.
579 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
581 2004-12-08 Miguel de Icaza <miguel@ximian.com>
583 * driver.cs: Removed message.
585 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
587 2004-12-08 <vargaz@freemail.hu>
589 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
591 2004-12-08 Martin Baulig <martin@ximian.com>
593 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
594 instead of a CS3002 for properties and indexer.
596 2004-12-08 Martin Baulig <martin@ximian.com>
598 * decl.cs (MemberName.ToString): Make this work again.
600 2004-12-08 Marek Safar <marek.safar@seznam.cz>
602 * attribute.cs (Resolve): Add error 591 detection.
604 * class.cs (FieldMember.Define): Add error 1547 detection.
605 (Indexer.Define): Add error 620 detection.
606 (Operator.Define): Add error 590 detection.
608 * ecore.cs: Missing argument for error 79.
610 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
613 2004-12-07 Marek Safar <marek.safar@seznam.cz>
616 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
619 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
621 * cs-parser.jay : handle doc comments on implicit/explicit operators.
622 Some operator comments were suppressed.
623 * doc.cs : Implicit/explicit operator name in doc comments are like
624 "op_Explicit(type)~returnType", so added suffix handling.
626 2005-01-21 Alp Toker <alp@atoker.com>
628 * cs-parser.jay: destructor_declaration's container is PartialContainer
629 not Class when partial types are used, so use Kind prop instead of 'is'.
631 2004-12-12 Martin Baulig <martin@ximian.com>
633 * expression.cs (Unary.TryReduceNegative): Added support for
634 SByteConstant and ByteConstant.
635 (Unary.Reduce): Check error values from TryReduceNegative().
637 2004-12-11 Martin Baulig <martin@ximian.com>
639 * support.cs (ReflectionParameters.ParameterName): If we have a
640 `gpd', call `ParameterName' on it.
642 * parameter.cs (Parameter.GetParameterAttributes): New static method.
644 * pending.cs (PendingImplementation.DefineProxy): Call
645 DefineParameter() for all of the MethodBuilder's arguments.
647 2004-12-09 Martin Baulig <martin@ximian.com>
649 * doc.cs (DocUtil): Make this a static class.
651 2004-12-09 Martin Baulig <martin@ximian.com>
653 * expression.cs (Invocation.InferType): Moved the type inference
654 implementation into TypeManager.
656 * generics.cs (TypeManager): Moved the type inference
659 2004-12-09 Martin Baulig <martin@ximian.com>
661 * typemanager.cs (TypeManager): Make this a partial class.
664 (TypeManager): Move the generics part of `TypeManager' here.
666 2004-12-08 Martin Baulig <martin@ximian.com>
668 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
669 instead of a CS3002 for properties and indexer. Added CS3024
670 check for generic interfaces.
672 * attributes.cs (AttributeTester.AnalyzeTypeCompliance): Generic
673 instances are not CLS-compliant.
675 2004-12-08 Martin Baulig <martin@ximian.com>
678 (void_pointer_expression): New rule for `void*', `void**' etc.
679 (typeof_expression): Add `void_pointer_expression'; fixes #66846.
681 2004-12-08 Martin Baulig <martin@ximian.com>
683 * expression.cs (Invocation.InferType): Removed the hack for
684 MethodCore.MayUnify().
686 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Make
689 * class.cs (MethodCore.MayUnify): Use
690 TypeManager.MayBecomeEqualGenericTypes().
692 2004-12-08 Martin Baulig <martin@ximian.com>
694 * expression.cs (Is.DoResolve, As.DoResolve): If we're a type
695 parameter, box it. Fixes #69233.
697 2004-12-08 Martin Baulig <martin@ximian.com>
699 * generic.cs (ConstructedType.CheckConstraints): Valuetypes always
700 have the ctor constraint. Fixes #68326.
702 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
704 * cs-parser.jay : interface comment was not consumed because of
705 extra opt_semicolon before doc handling.
707 2004-12-03 Raja R Harinath <rharinath@novell.com>
709 Fix test-327.cs, test-328.cs, and put in early infrastructure
710 for eventually fixing #52697.
711 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
712 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
714 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
715 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
716 (VerifyUsing, error246): Update.
717 * rootcontext.cs (RootContext.NamespaceLookup): Just use
718 'NamespaceEntry.LookupNamespaceOrType'.
720 2004-12-07 Martin Baulig <martin@ximian.com>
722 * driver.cs: Call it "BETA SOFTWARE" :-)
724 2004-12-06 Raja R Harinath <rharinath@novell.com>
726 Fix crash on cs0657-17.cs.
727 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
728 Use RootContext.Tree.Types, not 'new RootTypes ()'.
729 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
730 the case where the NamespaceEntry gets overwritten.
732 2004-12-06 Marek Safar <marek.safar@seznam.cz>
735 * ecore.cs (ResolveBoolean): Tiny refactoring.
737 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
738 of right expression resolving when left is false constant and
739 operator is LogicalAnd OR true constant and operator is LogicalOr.
741 * statement.cs (ResolveUnreachable): Always reports warning.
743 2004-12-05 Miguel de Icaza <miguel@ximian.com>
745 * class.cs: Distinguish between 1721 and 1722 (just a little help
748 2004-12-03 Miguel de Icaza <miguel@ximian.com>
750 * delegate.cs: Only allow this on new versions of the language.
752 2004-12-02 Duncan Mak <duncan@ximian.com>
754 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
756 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
757 here as a static method. Take an additional bool out parameter
758 `must_do_cs1540_check' for signaling to InstanceResolve.
759 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
760 member field from PropertyExpr class and made it an argument of
762 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
763 check for MarshalByRefObject, and report CS0122 instead of CS1540.
764 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
765 and `remove_accessor' as well as InstanceResolve: report CS0122
770 2004-12-07 Martin Baulig <martin@ximian.com>
772 * decl.cs (DeclSpace.AddToContainer): Report correct errors CS0694
773 and CS0692 where appropriate.
775 2004-12-06 Martin Baulig <martin@ximian.com>
777 * class.cs (MethodCore.MayUnify): Moved the CS0408 check here from
778 IsDuplicateImplementation() and improved it.
780 * expression.cs (Invocation.InferTypeArguments): Added
781 `Type[] inferred_class_types' argument (for MethodCore.MayUnify)
782 and removed the "ref" modifier from `infered_types'.
784 * decl.cs (MemberName.ToString): Removed the exception.
786 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
788 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
789 comments are allowed.
791 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
793 * delegate.cs: Add checks for subtypes in paramaters and return values
794 in VerifyMethod () to add support for Covariance/Contravariance
797 2004-12-02 Miguel de Icaza <miguel@ximian.com>
799 * report.cs: Remove extra closing parenthesis.
801 * convert.cs (Error_CannotImplicitConversion): If the name of the
802 types are the same, provide some extra information.
804 2004-12-02 Marek Safar <marek.safar@seznam.cz>
807 * attribute.cs (Resolve): Improved implementation of params
810 * support.cs (ParameterData): Add HasParams to be faster.
812 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
814 all things are for /doc support:
816 * doc.cs: new file that supports XML documentation generation.
817 * mcs.exe.sources: added doc.cs.
819 Handle /doc command line option.
820 Report error 2006 instead of 5 for missing file name for /doc.
821 Generate XML documentation when required, after type resolution.
823 Added support for picking up documentation (/// and /** ... */),
824 including a new XmlCommentState enumeration.
826 Added lines to fill Documentation element for field, constant,
827 property, indexer, method, constructor, destructor, operator, event
828 and class, struct, interface, delegate, enum.
829 Added lines to warn incorrect comment.
831 Added Documentation field (passed only when /doc was specified).
833 Added DocComment, DocCommentHeader, GenerateDocComment() and
834 OnGenerateDocComment() and some supporting private members for
835 /doc feature to MemberCore.
837 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
839 Added overriden DocCommentHeader.
841 Added overriden DocCommentHeader and GenerateDocComment().
843 2004-12-01 Miguel de Icaza <miguel@ximian.com>
845 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
846 unwrapping the enumeration values, chain to
847 DoConstantNumericPromotions again, so we can promote things to the
848 fundamental types (takes care of enums that are bytes, sbytes).
852 2004-12-01 Raja R Harinath <rharinath@novell.com>
854 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
855 Fix long-standing bug in type-lookup. Use FindType instead of
856 LookupType when ec.ResolvingTypeTree.
857 (Attribute.ResolveType, Attribute.Resolve)
858 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
860 (Attributes.Search): Remove internal version. Update.
861 (Attributes.SearchMulti): Update.
862 (Attributes.GetClsCompliantAttribute): Remove.
863 (Attributes.GetIndexerNameAttribute): Remove.
864 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
865 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
866 * class.cs (Indexer.Define): Likewise.
868 2004-12-01 Marek Safar <marek.safar@seznam.cz>
871 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
872 MarshallByReference members access.
874 * expression.cs: Use CheckMarshallByRefAccess;
875 Better error CS0197 message.
877 * report.cs: Print whole related error message.
879 2004-11-29 Marek Safar <marek.safar@seznam.cz>
881 * class (GetClassBases): Better error 60 report.
882 (EventProperty): Disabled warning 67 detection.
884 2004-11-29 Marek Safar <marek.safar@seznam.cz>
887 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
889 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
892 2004-11-29 Marek Safar <marek.safar@seznam.cz>
895 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
897 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
899 2004-11-26 Miguel de Icaza <miguel@ximian.com>
901 * attribute.cs (Attribute.Resolve): Refine error reporting and
902 report a cs0117 if the identifier does not exist, to distinguish
903 from 0617 which is a miss-use of the actual identifier.
905 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
906 between cs0070 and cs0079.
908 * class.cs (MemberBase.DoDefine): When reporting a wrong
909 accessibility level, we use MethodCore to compare instead of
910 Method (this was a regression in some refactoring effort).
912 So now we correctly report cs0056 again.
914 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
915 testing the target_type (which was known to be object_type) and
916 not the source type (which is anonymous_method).
918 Fixed reporting of error cs1660.
920 * expression.cs (UserCast.Source): Expose the underlying cast.
922 * statement.cs (Switch.SwitchGoverningType): Sort the list of
923 allowed types to find a match to int32 first (most common).
925 In addition, it ignores any ImplicitUserConversions that did an
926 internal implicit conversion (as the switch statement allows only
927 one integral conversion to exist).
929 * class.cs (PartialContainer.Create): rename `name' to
930 `member_name' for clarity. Then replace the string calls with a
931 call to MemberName.GetPartialName, as now using
932 MemberName.ToString is an error (this is due to the side effects
933 it had, that were fixed in the past).
935 This will restore the error reporting on a number of partial class
936 errors that were missusing this (and getting an exception as a
937 results, which is now just a plain textual warning, because
938 yyparse debug output would crash otherwise).
940 2004-11-26 Raja R Harinath <rharinath@novell.com>
942 * Makefile (PROGRAM_INSTALL_DIR): Remove.
944 2004-11-25 Ben Maurer <bmaurer@ximian.com>
946 * rootcontext.cs (LookupType): Make sure to cache lookups that
947 don't give us a negative result. This saves about 5% of corlib
950 2004-11-25 Miguel de Icaza <miguel@ximian.com>
952 * report.cs (AbstractMessage.Print): messages are sent to stderr
954 * class.cs (TypeContainer.GetClassBases): It is an error to have a
955 non-interface in the list of interfaces (at this point, either
956 parent was properly set, or a base class is being listed in the
959 This flags error 1722, and resolves the crash from bug 69259.
961 2004-11-25 Ben Maurer <bmaurer@ximian.com>
963 * statement.cs (Using.EmitExpressionFinally): make this work right
964 for valuetypes. Fixes 69926.
966 2004-11-25 Miguel de Icaza <miguel@ximian.com>
968 * const.cs (Const.ChangeType): Cope with the "0 literal can be
969 converted to an enum" here, before we try to change the underlying
970 type. This code exists, but it is a different code path than the
971 one used while encoding constants.
973 (ImplicitReferenceConversionExists): In addition, resynchronized
974 the code here, so it matches the same code in
975 ImplicitReferenceConversionExists for the `from any class-type S
976 to any interface-type T'.
978 2004-11-25 Marek Safar <marek.safar@seznam.cz>
980 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
982 2004-11-24 Miguel de Icaza <miguel@ximian.com>
984 * cs-parser.jay: Use verbosity accordingly.
986 2004-11-24 Marek Safar <marek.safar@seznam.cz>
988 * expression.cs (Unary.ResolveOperator): Do not report warning;
989 AddressOf reads from variable.
991 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
993 2004-11-24 Marek Safar <marek.safar@seznam.cz>
997 * attribute.cs (Attributable): Removed CheckTargets.
998 (Attributes.Emit): Explicit attribute targets are tested here.
1000 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
1001 not enabled for interfaces.
1003 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
1004 (GetAssemblyName): Ouch next bug there.
1006 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
1008 * expression.cs: Error 275 added.
1010 2004-11-23 Marek Safar <marek.safar@seznam.cz>
1012 Fix bug #69177 (Implemented decimal constant support)
1014 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
1015 (BinaryFold): Add DecimalConstant.
1017 * const.cs (Define): Decimal constant
1019 (ChangeType): Add decimal type handling.
1020 (LookupConstantValue): Don't set value for decimal type but
1021 emit DecimalConstantAttribute. Needed for constant optimization.
1023 * constant.cs (ToDecimal): New method.
1024 (ConvertToDecimal): New method.
1025 (IntConstant): Implemented ConvertToDecimal.
1026 (DecimalConstant.Emit): Emit optimized version for decimals in
1029 * expression.cs (ResolveOperator): Changed order of constant
1030 reduction to work correctly with native types which have
1031 overloaded operators.
1032 (ResolveMemberAccess): Extract constant value from attribute
1035 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
1037 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
1038 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
1039 (ChangeType): Decimal is special.
1040 (TypeToCoreType): Add decimal type.
1042 2004-11-22 Marek Safar <marek.safar@seznam.cz>
1044 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
1047 2004-11-22 Marek Safar <marek.safar@seznam.cz>
1049 * class.cs (EventField.ApplyAttributeBuilder): Fix error
1052 2004-11-19 Marek Safar <marek.safar@seznam.cz>
1054 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
1056 * pending.cs (PendingImplementation): Grab only interfaces.
1058 2004-11-19 Marek Safar <marek.safar@seznam.cz>
1060 * statement.cs (ForeachHelperMethods): Add location member and
1061 error 202 detection.
1063 2004-11-18 Marek Safar <marek.safar@seznam.cz>
1065 * expression.cs (DoResolveBase): Fixed wrong warning for out
1068 2004-12-04 Martin Baulig <martin@ximian.com>
1070 * convert.cs (Convert.TypeParameter_to_Null): Use the constraints
1071 to check whether the conversion is ok.
1073 * typemanager.cs (TypeManager.GetTypeArguments): Just return
1074 `Type.EmptyTypes' if we're not a generic TypeContainer.
1076 2004-11-25 Miguel de Icaza <miguel@ximian.com>
1078 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
1079 old bug: when converting from the null literal to a pointer,
1080 return an EmptyCast, not the NullLiteral.
1082 This fixes #69921, the recent null_type changes probably made this
1085 2004-12-03 Martin Baulig <martin@ximian.com>
1087 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
1088 method as our child, call AnonymousMethod.Compatible() on it.
1090 2004-12-02 Miguel de Icaza <miguel@ximian.com>
1092 * class.cs (FieldBase): Use an unused bit field from the field to
1093 encode the `has_offset' property from the FieldMember. This saves
1094 a couple of Ks on bootstrap compilation.
1096 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
1097 method as our child, return the AnonymousMethod resolved
1100 * expression.cs (New.DoResolve): Allow return values from
1101 NewDelegate to also include AnonymousMethods.
1105 2004-11-29 Raja R Harinath <rharinath@novell.com>
1107 * decl.cs (MemberCore.MemberName): Remove readonly to fix an error
1109 * rootcontext.cs (ResolveCore::interfaces_first_stage): Add
1110 System.Runtime.InteropServices._Exception, since it's a base
1111 interface of the core type System.Exception in the net_2_0 profile.
1113 2004-11-27 Martin Baulig <martin@ximian.com>
1115 * ecore.cs (Expression.StoreFromPtr): Use `stobj' for generic parameters.
1117 2004-11-26 Raja R Harinath <rharinath@novell.com>
1119 * Makefile: Convert to use executable.make.
1120 * gmcs.exe.sources: New.
1122 2004-11-25 Martin Baulig <martin@ximian.com>
1124 * expression.cs (Invocation.InferType): Added support for byref types.
1126 2004-11-25 Martin Baulig <martin@ximian.com>
1128 * statement.cs (Foreach.FetchMethodMoveNext): Wrap `mi.ReturnType'
1129 in TypeManager.TypeToCoreType().
1131 2004-11-25 Martin Baulig <martin@ximian.com>
1133 * iterators.cs (Iterator.DoDefineMembers): Override and lookup the
1134 "Dispose" method from the `current_type'.
1135 (Iterator.EmitMoveNext): Use the `dispose_method' we looked up in
1136 DoDefineMembers() instead of using the MethodBuilder; this is
1137 required for generic iterators.
1139 * class.cs (TypeContainer.DoDefineMembers): Make this virtual.
1141 2004-11-24 Martin Baulig <martin@ximian.com>
1143 * ecore.cs (Expression.LoadFromPtr): Use `ldobj' for generic parameters.
1145 2004-11-20 Martin Baulig <martin@ximian.com>
1147 * expression.cs (Invocation.InferType): Correctly infer generic
1148 instances; see gen-103.cs.
1149 (Invocation.InferTypeArguments): If a generic method doesn't have
1150 any unbound type parameters, we don't need to infer anything.
1152 2004-11-19 Raja R Harinath <rharinath@novell.com>
1154 * Makefile (gmcs.exe): Update to new location of bootstrap mcs.exe.
1156 2004-11-17 Raja R Harinath <rharinath@novell.com>
1158 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
1159 (TypeHandle.GetMemberCache): New.
1160 (TypeHandle.TypeHandle): Update.
1161 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
1162 (TypeManager.LookupParentInterfacesCache):
1163 Rename from LookupInterfaceCache. Optimize slightly.
1164 (TypeManager.MemberLookup_FindMembers): Update.
1165 * decl.cs (MemberCache.MemberCache): Set Container to null in the
1167 (AddCacheContents): Rename from AddHashtable.
1168 * class.cs (TypeContainer.parent_container): Remove.
1169 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
1170 (TypeContainer.DoDefineMembers): Don't initialize it.
1171 Update to name changes.
1173 2004-11-17 Miguel de Icaza <miguel@ximian.com>
1175 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
1176 that factors the code to check access modifiers on override.
1178 (PropertyBase): Use the code here.
1180 Patch from Lluis S'anchez, fixes bug #69361.
1182 2004-11-15 Miguel de Icaza <miguel@ximian.com>
1184 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
1185 routine that is used to report the use of a captured variable
1186 whose address has been taken.
1188 There are two checks: one when variables are being captured and
1189 the other check is when the address of a variable is taken.
1191 (because an anonymous methods might be resolved before *or* after
1192 the address has been taken) and
1194 * expression.cs (Conditional.DoResolve): Remove the special
1195 casing that Martin added to trueExpr and falseExpr being both
1196 NullLiteral. We get the right behavior now just by introducing
1197 the null_type into the compiler.
1199 * convert.cs (ExplicitConversion): Change the code to use
1200 null_type instead of testing `expr is NullLiteral'.
1201 (ImplicitConversionStandard): use null_type too.
1202 (ImplicitReferenceConversionExists): use null_type too.
1203 (ImplicitReferenceConversion): use null_type too.
1205 * literal.cs: The type of `NullLiteral' is now null_type instead
1207 (Resolve): Set the type here.
1209 * typemanager.cs: Introduce null_type.
1211 2004-11-18 Martin Baulig <martin@ximian.com>
1214 (RootContext.LookupType): Return a `Type', not a `TypeExpr'.
1216 2004-11-18 Martin Baulig <martin@ximian.com>
1218 * ecore.cs (TypeExpr.DoResolveAsTypeStep): Make this protected.
1220 2004-11-18 Martin Baulig <martin@ximian.com>
1222 * generic.cs (Constraints.Resolve): Take an `EmitContext' instead
1223 of a `DeclSpace'. If one of our constraints is a `ConstructedType',
1224 call ResolveConstructedType() on it to resolve it without checking
1226 (Constraints.ResolveTypes): Check them here.
1227 (ConstructedType.DoResolveAsTypeStep): Fully resolve ourselves,
1228 but don't check constraints.
1229 (ConstructedType.ResolveAsTypeTerminal): Override this and also
1230 check constraints here.
1231 (ConstructedType.ResolveConstructedType): New public method. This
1232 is called from DoResolveAsTypeStep() and Constraints.Resolve() to
1233 resolve ourselves without checking constraints.
1235 * ecore.cs (Expression.ResolveAsTypeTerminal): Make this virtual.
1237 2004-11-18 Martin Baulig <martin@ximian.com>
1240 (DeclSpace.CurrentType): Changed type from `TypeExpr' to `Type'.
1242 * delegate.cs (Delegate.DefineType): Always create the EmitContext.
1244 2004-11-18 Martin Baulig <martin@ximian.com>
1246 * ecore.cs (TypeExpr.ResolveType): Removed.
1247 (Expression.ResolveAsTypeTerminal): We always return a fully
1248 resolved `TypeExpr', so we can just access its `Type'.
1250 * class.cs (TypeContainer.DefineType): Resolve `CurrentType' here.
1252 2004-11-17 Martin Baulig <martin@ximian.com>
1254 * ecore.cs (IAlias.Type): Replaced with ResolveAsType() to make
1255 sure we don't return any unresolved TypeExpr's.
1256 (TypeAliasExpression): The .ctor now takes an `IAlias' instead of
1258 (Expression.ResolveAsTypeTerminal): Make sure `te.Type != null'.
1260 * expression.cs (MemberAccess.ResolveAsTypeStep): Don't return any
1261 unresolved `ConstructedType's.
1263 2004-11-17 Martin Baulig <martin@ximian.com>
1265 * ecore.cs (TypeExpr.ResolveType): Don't make this virtual.
1267 2004-11-17 Martin Baulig <martin@ximian.com>
1270 (Expression.ResolveAsTypeTerminal): Removed the `bool silent' argument.
1272 * decl.cs (DeclSpace.ResolveType): Removed.
1273 (DeclSpace.ResolveTypeExpr): Removed the `bool silent' argument.
1275 2004-11-17 Martin Baulig <martin@ximian.com>
1277 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
1278 direction, like FindMembers() does. Fixes #69546, testcase is in
1281 2004-11-16 Martin Baulig <martin@ximian.com>
1283 This is based on a patch from Marek Safar, see bug #69082.
1284 Fixes bugs #63705 and #67130.
1286 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
1287 method; create a MemberCache for an interface type and cache the
1290 * decl.cs (IMemberContainer.ParentContainer): Removed.
1291 (IMemberContainer.ParentCache): New property.
1292 (MemberCache.SetupCacheForInterface): Removed.
1293 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
1294 to create a cache for an interface's "parent".
1296 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
1299 2004-11-14 Ben Maurer <bmaurer@ximian.com>
1301 * statement.cs: Avoid adding bools to a hashtable.
1303 2004-11-15 Martin Baulig <martin@ximian.com>
1305 * decl.cs (MemberName.GetPartialName): Removed, use GetTypeName() instead.
1307 2004-11-11 Martin Baulig <martin@ximian.com>
1309 * typemanager.cs (TypeManager.GetMethodName): New method.
1311 * class.cs (MethodData.Define): Include the generic arity in the
1312 name of an explicit interface; also add it to the method name.
1314 * pending.cs (PendingImplementation.InterfaceMethod): The method
1315 name now includes the generic arity.
1317 2004-11-07 Miguel de Icaza <miguel@ximian.com>
1319 * expression.cs (Invocation.OverloadResolve): Flag error if we are
1320 calling an unsafe method from a safe location.
1322 2004-11-06 Marek Safar <marek.safar@seznam.cz>
1325 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
1327 2004-11-06 Miguel de Icaza <miguel@ximian.com>
1329 * namespace.cs (VerifyUsing): use GetPartialName instead of
1332 2004-11-05 Miguel de Icaza <miguel@ximian.com>
1334 * statement.cs (Return.Resolve): Fix regression in typo: if
1335 `in_exc', we have to request a NeedReturnLabel, this was a typo
1336 introduced in the anonymous method check-in. Fixes #69131.
1338 * Indexers were using the ShortName when defining themselves,
1339 causing a regression in the compiler bootstrap when applying the
1340 patch from 2004-11-02 (first part), now they use their full name
1341 and the bug is gone.
1343 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
1345 * driver.cs: Strip the path from the names of embedded resources. Fixes
1348 2004-11-04 Raja R Harinath <rharinath@novell.com>
1350 Fix error message regression: cs0104-2.cs.
1351 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
1352 (AliasEntry.Resolve): Update.
1353 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
1355 (RootContext.LookupType): Update.
1357 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
1359 * cs-parser.jay: Add support for handling accessor modifiers
1360 * class: Add support port accessor modifiers and error checking,
1361 define PropertyMethod.Define as virtual (not abstract anymore)
1362 * ecore.cs: Add checking for proeprties access with access modifiers
1363 * iterators.cs: Modify Accessor constructor call based in the modified
1365 2004-11-02 Ben Maurer <bmaurer@ximian.com>
1367 * expression.cs (StringConcat): Handle being called twice,
1368 as when we have a concat in a field init with more than two
1371 2004-11-02 Miguel de Icaza <miguel@ximian.com>
1373 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
1374 special case explicit implementations, we should always produce
1375 the .property or .event declaration.
1377 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
1378 since it will not return correct data if people use this
1379 unresolved in the presence of using statements (see test-313).
1381 * class.cs (MethodData.Define): If we are an explicit interface
1382 implementation, set the method name to the full name of the
1383 interface plus the name of the method.
1385 Notice that using the method.MethodName.GetFullName() does not
1386 work, as it will only contain the name as declared on the source
1387 file (it can be a shorthand in the presence of using statements)
1388 and not the fully qualifed type name, for example:
1392 class D : ICloneable {
1393 object ICloneable.Clone () {
1397 Would produce a method called `ICloneable.Clone' instead of
1398 `System.ICloneable.Clone'.
1400 * namespace.cs (Alias.Resolve): Use GetPartialName.
1402 2004-11-01 Marek Safar <marek.safar@seznam.cz>
1404 * cs-parser.jay: Add error 1055 report.
1406 2004-11-01 Miguel de Icaza <miguel@ximian.com>
1408 * assign.cs (Assign.DoResolve): Only do the transform of
1409 assignment into a New if the types are compatible, if not, fall
1410 through and let the implicit code deal with the errors and with
1411 the necessary conversions.
1413 2004-11-01 Marek Safar <marek.safar@seznam.cz>
1415 * cs-parser.jay: Add error 1031 report.
1417 * cs-tokenizer.cs: Add location for error 1038.
1419 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1421 * cs-parser.jay: Add error 1016 report.
1423 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1425 * cs-parser.jay: Add errors 1575,1611 report.
1427 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1429 * cs-parser.jay: Add error 1001 report.
1431 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1434 * attribute.cs (GetMarshal): Add method argument for
1435 caller identification.
1437 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
1438 agument for GetMarshal and RuntimeMissingSupport.
1440 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1442 * attribute.cs (ExtractSecurityPermissionSet): Removed
1443 TypeManager.code_access_permission_type.
1445 * typemanager.cs: Removed TypeManager.code_access_permission_type.
1447 2004-10-27 Miguel de Icaza <miguel@ximian.com>
1449 * expression.cs (LocalVariableReference.DoResolveLValue): Check
1450 for obsolete use of a variable here. Fixes regression on errors
1451 cs0619-25 and cs0619-26.
1453 2004-10-27 Marek Safar <marek.safar@seznam.cz>
1455 Fix #62358, implemented security attribute encoding.
1457 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
1458 Tests permitted SecurityAction for assembly or other types.
1459 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
1460 data from SecurityPermissionAttribute to PermisionSet class.
1462 * class.cs (ApplyAttributeBuilder): Added special handling
1463 for System.Security.Permissions.SecurityAttribute based types.
1465 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
1466 special handling for System.Security.Permissions.SecurityAttribute
1469 * enum.cs (ApplyAttributeBuilder): Added special handling
1470 for System.Security.Permissions.SecurityAttribute based types.
1472 * parameter.cs (ApplyAttributeBuilder): Added special handling
1473 for System.Security.Permissions.SecurityAttribute based types.
1475 * rootcontext.cs: Next 2 core types.
1477 * typemanager.cs (TypeManager.security_permission_attr_type):
1478 Built in type for the SecurityPermission Attribute.
1479 (code_access_permission_type): Build in type.
1481 2004-10-17 Miguel de Icaza <miguel@ximian.com>
1483 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
1484 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
1485 all of this information into
1486 EmitContext.EmitCapturedVariableInstance.
1488 * codegen.cs (EmitCapturedVariableInstance): move here the
1489 funcionality of emitting an ldarg.0 in the presence of a
1490 remapping. This centralizes the instance emit code.
1492 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
1493 then emit a load of this: it means that we have reached the
1494 topmost ScopeInfo: the one that contains the pointer to the
1495 instance of the class hosting the anonymous method.
1497 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
1498 captures to the topmost CaptureContext.
1500 2004-10-12 Miguel de Icaza <miguel@ximian.com>
1502 * expression.cs (LocalVariableReference): Move the knowledge about
1503 the iterators into codegen's EmitCapturedVariableInstance.
1505 2004-10-11 Miguel de Icaza <miguel@ximian.com>
1507 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
1508 all code paths return a value from an anonymous method (it is the
1509 same as the 161 error, but for anonymous methods).
1511 2004-10-08 Miguel de Icaza <miguel@ximian.com>
1513 The introduction of anonymous methods in the compiler changed
1514 various ways of doing things in the compiler. The most
1515 significant one is the hard split between the resolution phase
1516 and the emission phases of the compiler.
1518 For instance, routines that referenced local variables no
1519 longer can safely create temporary variables during the
1520 resolution phase: they must do so from the emission phase,
1521 since the variable might have been "captured", hence access to
1522 it can not be done with the local-variable operations from the runtime.
1526 (Block.Flags): New flag `IsTopLevel' to indicate that this block
1527 is a toplevel block.
1529 (ToplevelBlock): A new kind of Block, these are the blocks that
1530 are created by the parser for all toplevel method bodies. These
1531 include methods, accessors and anonymous methods.
1533 These contain some extra information not found in regular blocks:
1534 A pointer to an optional CaptureContext (for tracking captured
1535 local variables and parameters). A pointer to the parent
1538 (Return.Resolve): Catch missmatches when returning a value from an
1539 anonymous method (error 1662).
1540 Invoke NeedReturnLabel from the Resolve phase instead of the emit
1543 (Break.Resolve): ditto.
1545 (SwitchLabel): instead of defining the labels during the
1546 resolution phase, we now turned the public ILLabel and ILLabelCode
1547 labels into methods called GetILLabelCode() and GetILLabel() that
1548 only define the label during the Emit phase.
1550 (GotoCase): Track the SwitchLabel instead of the computed label
1551 (its contained therein). Emit the code by using
1552 SwitchLabel.GetILLabelCode ().
1554 (LocalInfo.Flags.Captured): A new flag has been introduce to track
1555 whether the Local has been captured or not.
1557 (LocalInfo.IsCaptured): New property, used to tell whether the
1558 local has been captured.
1560 * anonymous.cs: Vastly updated to contain the anonymous method
1563 The main classes here are: CaptureContext which tracks any
1564 captured information for a toplevel block and ScopeInfo used to
1565 track the activation frames for various local variables.
1567 Each toplevel block has an optional capture context associated
1568 with it. When a method contains an anonymous method both the
1569 toplevel method and the anonymous method will create a capture
1570 context. When variables or parameters are captured, they are
1571 recorded on the CaptureContext that owns them, for example:
1575 MyDelegate d = delegate {
1580 Here `a' will be recorded as captured on the toplevel
1581 CapturedContext, the inner captured context will not have anything
1582 (it will only have data if local variables or parameters from it
1583 are captured in a nested anonymous method.
1585 The ScopeInfo is used to track the activation frames for local
1586 variables, for example:
1588 for (int i = 0; i < 10; i++)
1589 for (int j = 0; j < 10; j++){
1590 MyDelegate d = delegate {
1595 At runtime this captures a single captured variable `i', but it
1596 captures 10 different versions of the variable `j'. The variable
1597 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
1598 recorded on a child.
1600 The toplevel ScopeInfo will also track information like the `this'
1601 pointer if instance variables were referenced (this is necessary
1602 as the anonymous method lives inside a nested class in the host
1603 type of the method).
1605 (AnonymousMethod): Expanded to track the Toplevel, implement
1606 `AnonymousMethod.Compatible' to tell whether an anonymous method
1607 can be converted to a target delegate type.
1609 The routine now also produces the anonymous method content
1611 (AnonymousDelegate): A helper class that derives from
1612 DelegateCreation, this is used to generate the code necessary to
1613 produce the delegate for the anonymous method that was created.
1615 * assign.cs: API adjustments for new changes in
1616 Convert.ImplicitStandardConversionExists.
1618 * class.cs: Adjustments to cope with the fact that now toplevel
1619 blocks are of type `ToplevelBlock'.
1621 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
1622 insteda of standard blocks.
1624 Flag errors if params arguments are passed to anonymous methods.
1626 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
1627 `CurrentAnonymousMethod' which points to the current Anonymous
1628 Method. The variable points to the AnonymousMethod class that
1629 holds the code being compiled. It is set in the new EmitContext
1630 created for the anonymous method.
1632 (EmitContext.Phase): Introduce a variable and an enumeration to
1633 assist in enforcing some rules about when and where we are allowed
1634 to invoke certain methods (EmitContext.NeedsReturnLabel is the
1635 only one that enfonces this right now).
1637 (EmitContext.HaveCaptureInfo): new helper method that returns
1638 whether we have a CapturedContext initialized.
1640 (EmitContext.CaptureVariable): New method used to register that a
1641 LocalInfo must be flagged for capturing.
1643 (EmitContext.CapturedParameter): New method used to register that a
1644 parameters must be flagged for capturing.
1646 (EmitContext.CapturedField): New method used to register that a
1647 field must be flagged for capturing.
1649 (EmitContext.HaveCapturedVariables,
1650 EmitContext.HaveCapturedFields): Return whether there are captured
1651 variables or fields.
1653 (EmitContext.EmitMethodHostInstance): This is used to emit the
1654 instance for the anonymous method. The instance might be null
1655 (static methods), this (for anonymous methods that capture nothing
1656 and happen to live side-by-side with the current method body) or a
1657 more complicated expression if the method has a CaptureContext.
1659 (EmitContext.EmitTopBlock): Routine that drives the emission of
1660 code: it will first resolve the top block, then emit any metadata
1661 and then emit the code. The split is done so that we can extract
1662 any anonymous methods and flag any captured variables/parameters.
1664 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
1665 during this phase, the ILGenerator should not be used as labels
1666 and local variables declared here might not be accessible to any
1667 code that is part of an anonymous method.
1669 Exceptions to this include the temporary variables that are
1670 created by some statements internally for holding temporary
1673 (EmitContext.EmitMeta): New routine, in charge of emitting all the
1676 (EmitContext.TemporaryReturn): This method is typically called
1677 from the Emit phase, and its the only place where we allow the
1678 ReturnLabel to be defined other than the EmitMeta. The reason is
1679 that otherwise we would have to duplicate a lot of logic in the
1680 Resolve phases of various methods that today is on the Emit
1683 (EmitContext.NeedReturnLabel): This no longer creates the label,
1684 as the ILGenerator is not valid during the resolve phase.
1686 (EmitContext.EmitThis): Extended the knowledge in this class to
1687 work in anonymous methods in addition to iterators.
1689 (EmitContext.EmitCapturedVariableInstance): This emits whatever
1690 code is necessary on the stack to access the instance to a local
1691 variable (the variable will be accessed as a field).
1693 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
1694 EmitContext.EmitAddressOfParameter): Routines to support
1695 parameters (not completed at this point).
1697 Removals: Removed RemapLocal and RemapLocalLValue. We probably
1698 will also remove the parameters.
1700 * convert.cs (Convert): Define a `ConstantEC' which points to a
1701 null. This is just to prefity some code that uses
1702 ImplicitStandardConversion code and do not have an EmitContext
1705 The idea is to flag explicitly that at that point in time, it is
1706 known that the conversion will not trigger the delegate checking
1707 code in implicit conversions (which requires a valid
1710 Everywhere: pass new EmitContext parameter since
1711 ImplicitStandardConversionExists now requires it to check for
1712 anonymous method conversions.
1714 (Convert.ImplicitStandardConversionExists): If the type of an
1715 expression is the anonymous_method_type, and the type is a
1716 delegate, we invoke the AnonymousMethod.Compatible method to check
1717 whether an implicit conversion is possible.
1719 (Convert.ImplicitConversionStandard): Only do implicit method
1720 group conversions if the language level is not ISO_1.
1722 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
1723 MethodInfo for the Invoke method. used by Delegate and
1726 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
1727 method conversions if the target type is a delegate.
1729 Removed extra debugging nops.
1731 (LocalVariableReference): Turn the `local_info' into a public
1734 Add `prepared' field, the same hack used for FieldExprs to cope
1735 with composed assignments, as Local variables do not necessarily
1736 operate purely on the stack as they used to: they can be captured
1739 Add `temp' for a temporary result, like fields.
1741 Refactor DoResolve and DoResolveLValue into DoResolveBase.
1743 It now copes with Local variables that are captured and emits the
1744 proper instance variable to load it from a field in the captured
1747 (ParameterReference.DoResolveBase): During the resolve phase,
1748 capture parameters if we are in an anonymous method.
1750 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
1751 anonymous method, use the EmitContext helper routines to emit the
1752 parameter reference.
1754 * iterators.cs: Set RemapToProxy to true/false during the
1757 * parameters.cs (GetParameterByName): New helper method.
1759 * typemanager.cs (anonymous_method_type) a new type that
1760 represents an anonyous method. This is always an internal type,
1761 used as a fencepost to test against the anonymous-methodness of an
1764 2004-10-20 Marek Safar <marek.safar@seznam.cz>
1766 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
1768 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
1770 2004-11-10 Martin Baulig <martin@ximian.com>
1772 * expression.cs (Invocation.BetterFunction): If two methods have
1773 equal parameter types, but only one of them is generic, the
1774 non-generic one wins.
1775 (New.DoResolve): Don't set `is_struct' to false if we're a generic
1776 instance; just use `Type.IsValueType' to determine whether
1777 something is a struct or not.
1778 (MemberAccess.DoResolveAsTypeStep): Don't modify the `args' field,
1779 so we can be called multiple times.
1781 2004-11-10 Martin Baulig <martin@ximian.com>
1783 * generic.cs (TypeParameter.DefineConstraints): New public method.
1784 (TypeParameter.CheckAccessLevel): Override this and return true.
1785 (ConstructedType.ResolveType): Renamed to DoResolveType(), don't
1786 override ResolveType() anymore.
1787 (ConstructedType.DoResolveAsTypeStep): Call DoResolveType() here.
1789 2004-11-10 Martin Baulig <martin@ximian.com>
1791 * rootcontext.cs (RootContext.LookupType): If we're a nested type,
1792 call DeclSpace.ResolveNestedType() on it.
1794 2004-11-10 Martin Baulig <martin@ximian.com>
1796 * support.cs (ReflectionParameters.ParameterModifier): If `gpd' is
1797 non-null, call ParameterModifier() on it.
1799 2004-11-10 Martin Baulig <martin@ximian.com>
1802 (Iterators): Added `current_type' and `this_type' fields.
1803 (Iterators.DefineIterator): Create a new EmitContext and store it
1804 in `ec'; compute `this_type'.
1806 2004-11-10 Martin Baulig <martin@ximian.com>
1809 (TypeManager.IsPrivateAccessible): New public method.
1810 (Closure.Filter): Use IsPrivateAccessible() instead of IsEqual().
1812 2004-11-10 Martin Baulig <martin@ximian.com>
1814 * class.cs (TypeContainer.DefineType): Call
1815 TypeBuilder.DefineGenericParameters() before resolving the type
1817 (MethodData.parent_method): New protected field.
1818 (MethodData..ctor): Added `MethodInfo parent_method' argument.
1819 (MethodData.Define): Compute `parent_method'.
1822 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
1823 (MemberCore.GetClsCompliantAttributeValue): Likewise.
1824 (DeclSpace.ec): New protected field; store the EmitContext here.
1825 (DeclSpace.EmitContext): New public property.
1826 (DeclSpace.ResolveType): Un-comment from the [Obsolte] attribute.
1827 (DeclSpace.ResolveNestedType): New public method.
1828 (DeclSpace.ResolveTypeExpr): Just call ResolveAsTypeTerminal() here.
1829 (DeclSpace.NestedAccessible): Added `Type tb' argument.
1830 (DeclSpace.FamilyAccessible): Likewise.
1831 (DeclSpace.FindType): Call ResolveNestedType() for nested types.
1832 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
1835 * delegate.cs (Delegate.Define): Store the EmitContext in the `ec'
1838 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
1839 (Enum.Emit): Don't create a new EmitContext.
1841 2004-10-18 Martin Baulig <martin@ximian.com>
1843 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
1844 `Type' directly, but call ResolveType() on it.
1845 (Catch.Resolve): Likewise.
1846 (Foreach.Resolve): Likewise.
1848 2004-10-18 Martin Baulig <martin@ximian.com>
1850 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
1851 `Type' directly, but call ResolveType() on it.
1852 (Probe.DoResolve): Likewise.
1853 (ArrayCreation.LookupType): Likewise.
1854 (TypeOf.DoResolve): Likewise.
1855 (SizeOf.DoResolve): Likewise.
1857 2004-10-18 Raja R Harinath <rharinath@novell.com>
1859 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
1862 2004-10-17 John Luke <john.luke@gmail.com>
1864 * class.cs (Operator.GetSignatureForError): use CSharpName
1866 * parameter.cs (Parameter.GetSignatureForError): Returns
1867 correct name even if was not defined.
1869 2004-10-13 Raja R Harinath <rharinath@novell.com>
1872 * class.cs (TypeContainer.EmitContext): New property.
1873 (DefineNestedTypes): Create an emitcontext for each part.
1874 (MethodCore.DoDefineParameters): Use container's emitcontext.
1875 Pass type array to InternalParameters.
1876 (MemberBase.DoDefine): Use container's emitcontext.
1877 (FieldMember.Define): Likewise.
1878 (Event.Define): Likewise.
1879 (SetMethod.GetParameterInfo): Change argument to EmitContext.
1880 Pass type array to InternalParameters.
1881 (SetIndexerMethod.GetParameterInfo): Likewise.
1882 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
1883 * delegate.cs (Define): Pass emitcontext to
1884 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
1885 array to InternalParameters.
1886 * expression.cs (ParameterReference.DoResolveBase): Pass
1887 emitcontext to GetParameterInfo.
1888 (ComposedCast.DoResolveAsTypeStep): Remove check on
1889 ec.ResolvingTypeTree.
1890 * parameter.cs (Parameter.Resolve): Change argument to
1891 EmitContext. Use ResolveAsTypeTerminal.
1892 (Parameter.GetSignature): Change argument to EmitContext.
1893 (Parameters.ComputeSignature): Likewise.
1894 (Parameters.ComputeParameterTypes): Likewise.
1895 (Parameters.GetParameterInfo): Likewise.
1896 (Parameters.ComputeAndDefineParameterTypes): Likewise.
1897 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
1898 * support.cs (InternalParameters..ctor): Remove variant that takes
1900 * typemanager.cs (system_intptr_expr): New.
1901 (InitExpressionTypes): Initialize it.
1903 2004-10-12 Chris Toshok <toshok@ximian.com>
1905 * cs-parser.jay: fix location for try_statement and catch_clause.
1907 2004-10-18 Martin Baulig <martin@ximian.com>
1909 * class.cs (FieldMember.Define): Don't access the TypeExpr's
1910 `Type' directly, but call ResolveType() on it.
1911 (MemberBase.DoDefine): Likewise.
1913 * expression.cs (New.DoResolve): Don't access the TypeExpr's
1914 `Type' directly, but call ResolveType() on it.
1915 (ComposedCast.DoResolveAsTypeStep): Likewise.
1917 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
1918 `Type' directly, but call ResolveType() on it.
1920 2004-10-17 John Luke <john.luke@gmail.com>
1922 * class.cs (Operator.GetSignatureForError): use CSharpName
1924 * parameter.cs (Parameter.GetSignatureForError): Returns
1925 correct name even if was not defined.
1927 2004-10-13 Raja R Harinath <rharinath@novell.com>
1930 * class.cs (TypeContainer.EmitContext): New property.
1931 (DefineNestedTypes): Create an emitcontext for each part.
1932 (MethodCore.DoDefineParameters): Use container's emitcontext.
1933 Pass type array to InternalParameters.
1934 (MemberBase.DoDefine): Use container's emitcontext.
1935 (FieldMember.Define): Likewise.
1936 (Event.Define): Likewise.
1937 (SetMethod.GetParameterInfo): Change argument to EmitContext.
1938 Pass type array to InternalParameters.
1939 (SetIndexerMethod.GetParameterInfo): Likewise.
1940 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
1941 * delegate.cs (Define): Pass emitcontext to
1942 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
1943 array to InternalParameters.
1944 * expression.cs (ParameterReference.DoResolveBase): Pass
1945 emitcontext to GetParameterInfo.
1946 (ComposedCast.DoResolveAsTypeStep): Remove check on
1947 ec.ResolvingTypeTree.
1948 * parameter.cs (Parameter.Resolve): Change argument to
1949 EmitContext. Use ResolveAsTypeTerminal.
1950 (Parameter.GetSignature): Change argument to EmitContext.
1951 (Parameters.ComputeSignature): Likewise.
1952 (Parameters.ComputeParameterTypes): Likewise.
1953 (Parameters.GetParameterInfo): Likewise.
1954 (Parameters.ComputeAndDefineParameterTypes): Likewise.
1955 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
1956 * support.cs (InternalParameters..ctor): Remove variant that takes
1958 * typemanager.cs (system_intptr_expr): New.
1959 (InitExpressionTypes): Initialize it.
1961 2004-10-12 Chris Toshok <toshok@ximian.com>
1963 * cs-parser.jay: fix location for try_statement and catch_clause.
1965 2004-10-07 Raja R Harinath <rharinath@novell.com>
1967 More DeclSpace.ResolveType avoidance.
1968 * decl.cs (MemberCore.InUnsafe): New property.
1969 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
1970 with newly created EmitContext.
1971 (FieldMember.Define): Likewise.
1972 * delegate.cs (Delegate.Define): Likewise.
1973 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
1974 only if normal name-lookup fails.
1975 (TypeExpr.DoResolve): Enable error-checking.
1976 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
1977 (SizeOf.DoResolve): Likewise.
1978 (ComposedCast.DoResolveAsTypeStep): Likewise.
1979 (StackAlloc.DoResolve): Likewise.
1980 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
1981 (Block.Unsafe): New property.
1982 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
1983 (Unsafe): Set 'unsafe' flag of contained block.
1984 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
1985 (Fixed.Resolve): Likewise.
1986 (Catch.Resolve): Likewise.
1987 (Using.ResolveLocalVariableDecls): Likewise.
1988 (Foreach.Resolve): Likewise.
1990 2004-10-05 John Luke <john.luke@gmail.com>
1992 * cs-parser.jay: add location to error CS0175
1994 2004-10-04 Miguel de Icaza <miguel@ximian.com>
1996 * ecore.cs (Expression.Constantity): Add support for turning null
1999 * const.cs (Const.Define): Allow constants to be reference types
2000 as long as the value is Null.
2002 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
2004 * namespace.cs (NamespaceEntry.Using): No matter which warning
2005 level is set, check if this namespace name has already been added.
2007 2004-10-03 Ben Maurer <bmaurer@ximian.com>
2009 * expression.cs: reftype [!=]= null should always use br[true,false].
2012 2004-10-03 Marek Safar <marek.safar@seznam.cz>
2015 * attribute.cs: Enum conversion moved to
2016 GetAttributeArgumentExpression to be applied to the all
2019 2004-10-01 Raja R Harinath <rharinath@novell.com>
2021 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
2022 * class.c (TypeContainer.DefineType): Flag error if
2023 base types aren't accessible due to access permissions.
2024 * decl.cs (DeclSpace.ResolveType): Move logic to
2025 Expression.ResolveAsTypeTerminal.
2026 (DeclSpace.ResolveTypeExpr): Thin layer over
2027 Expression.ResolveAsTypeTerminal.
2028 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
2029 Refactor code into NestedAccess. Use it.
2030 (DeclSpace.NestedAccess): New.
2031 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
2032 argument to silence errors. Check access permissions.
2033 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
2034 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
2035 (Cast.DoResolve): Likewise.
2036 (New.DoResolve): Likewise.
2037 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
2038 (TypeOf.DoResolve): Likewise.
2040 * expression.cs (Invocation.BetterConversion): Return the Type of
2041 the better conversion. Implement section 14.4.2.3 more faithfully.
2042 (Invocation.BetterFunction): Make boolean. Make correspondence to
2043 section 14.4.2.2 explicit.
2044 (Invocation.OverloadResolve): Update.
2045 (Invocation): Remove is_base field.
2046 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
2047 (Invocation.Emit): Likewise.
2049 2004-09-24 Marek Safar <marek.safar@seznam.cz>
2051 * cs-parser.jay: Reverted 642 warning fix.
2053 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2056 * decl.cs (FindMemberWithSameName): Indexer can have more than
2059 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2061 * expression.cs (LocalVariableReference.DoResolveLValue):
2062 Do not report warning 219 for out values.
2063 (EmptyExpression.Null): New member to avoid extra allocations.
2065 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2067 * cs-parser.jay: Fix wrong warning 642 report.
2069 * cs-tokenizer.cs (CheckNextToken): New helper;
2070 Inspect next character if is same as expected.
2072 2004-09-23 Martin Baulig <martin@ximian.com>
2074 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
2075 (Convert.ImplicitReferenceConversionExists): Likewise.
2077 2004-11-09 Raja R Harinath <rharinath@novell.com>
2079 * Makefile (DISTFILES): Comment out a few missing files.
2081 2004-10-29 Raja R Harinath <rharinath@novell.com>
2083 * Makefile (bootstrap_libs,bootstrap_libfiles): New.
2084 (bootstrap-libs): New target. Invokes the net_2_0_bootstrap profile.
2085 (gmcs.exe): Invoke bootstrap-libs.
2086 (clean-local): Clean the net_2_0_bootstrap profile too.
2087 (PROGRAM_INSTALL_DIR): New.
2088 (install-local): Use it.
2090 2004-10-13 Martin Baulig <martin@ximian.com>
2092 * generic.cs (TypeManager.InflatedConstraints): New nested class.
2093 (TypeParameter.DefineType): If we're a method type parameter and
2094 that method is overriding something, "inflate" its constraints.
2096 2004-10-12 Martin Baulig <martin@ximian.com>
2098 * expression.cs (MemberAccess.DoResolve): If we're a SimpleName
2099 and have type arguments, create and resolve a ConstructedType.
2101 2004-10-12 Martin Baulig <martin@ximian.com>
2103 * decl.cs (MemberCache.FindMemberToOverride): Use
2104 TypeManager.IsEqual() to compare the parameters and Type.Equals()
2105 to compare the invocationType.
2107 * typemanager.cs (TypeManager.IsEqual): Added support for arrays.
2108 When comparing two type parameters, only do the signature-only
2109 comparision for method type parameters.
2111 2004-10-11 Martin Baulig <martin@ximian.com>
2113 * report.cs: Don't make --fatal abort on warnings, we have
2114 -warnaserror for that.
2116 2004-10-11 Martin Baulig <martin@ximian.com>
2119 (TypeManager.IsEqualGenericType): Removed, use IsEqual() instead.
2120 (TypeManager.IsEqual): Call ourself recursively instead of using
2123 2004-10-11 Martin Baulig <martin@ximian.com>
2125 * class.cs (TypeContainer.DefineType): Only call TypeParameter.Define()
2126 on our own type parameters, not on the ones we inherit from a containing
2129 * expression.cs (Invocation.InferType): Use `==', not `Equals()' for
2132 * generic.cs (TypeParameter.Define): We may only be called once.
2134 * pending.cs (Pending.InterfaceMethod): Call TypeManager.Real_IsEqual()
2135 instead of TypeManager.IsEqual().
2137 2004-09-28 Martin Baulig <martin@ximian.com>
2140 (GenericConstraints.EffectiveBaseClass): New public property.
2141 (TypeParameter.GenericConstraints): New public property.
2142 (ConstructedType.CheckConstraints): Improved.
2144 * convert.cs (Convert.TypeParam_EffectiveBaseType): New private method.
2145 (Convert.TypeParameterConversion): New private method; use this in
2146 ImplicitReferenceConversion() and ImplicitReferenceConversionExists()
2147 for all conversions related to type parameters.
2149 2004-09-24 Martin Baulig <martin@ximian.com>
2151 * convert.cs (Convert.ImplicitReferenceConversion): Added implicit
2152 type parameter conversions for type parameters which are known to
2155 2004-09-24 Martin Baulig <martin@ximian.com>
2157 * generic.cs (GenericConstraints): Added `IsReferenceType' and
2158 `IsValueType' properties.
2160 * support.cs (ReflectionConstraints): Use
2161 Type.GetGenericParameterConstraints() instead of the old hack.
2163 2004-09-24 Martin Baulig <martin@ximian.com>
2165 * generic.cs (GenericConstraints): Moved here and made it an
2168 * support.cs (GenericConstraints): Moved to generic.cs.
2170 2004-09-24 Martin Baulig <martin@ximian.com>
2173 (ReflectionConstraints): Un-nested this class and made it public.
2176 (TypeManager.GetTypeParameterConstraints): New public method.
2177 (TypeManager.HasConstructorConstraint): Use the attributes.
2179 2004-09-24 Martin Baulig <martin@ximian.com>
2181 * support.cs (GenericConstraints): Replaced `HasConstructor',
2182 `IsReferenceType' and `IsValueType' with `Attributes'.
2183 (ReflectionParameters.ReflectionConstraints): Removed the Create()
2184 method and made the .ctor public.
2186 * generic.cs (Constraints.Attributes): New public property.
2187 (Constraints): Renamed `HasConstructor' -> `HasConstructorConstraint',
2188 `IsReferenceType' -> `HasReferenceTypeConstraint' and
2189 `IsValueType' -> `HasValueTypeConstraint'.
2191 2004-09-23 Martin Baulig <martin@ximian.com>
2193 * generic.cs (Constraints): Reflect latest runtime changes.
2195 2004-09-23 Martin Baulig <martin@ximian.com>
2197 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
2198 (Convert.ImplicitReferenceConversionExists): Likewise.
2200 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2202 * class.cs (Operator.Define): Add error 448 and 559 report.
2204 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2206 * class.cs (MemberBase.IsTypePermitted): New protected
2207 method for checking error CS0610.
2209 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2211 * class.cs (TypeContainer.HasExplicitLayout): New property
2212 Returns whether container has StructLayout attribute set Explicit.
2213 (FieldMember): New abstract class for consts and fields.
2214 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
2215 (Field): Reuse FieldMember.
2217 * const.cs (Const): Reuse FieldMember.
2219 * rootcontext.cs: EmitConstants call moved to class.
2221 2004-09-22 Martin Baulig <martin@ximian.com>
2223 Marek and me just fixed one of our oldest bugs: #28562 :-)
2225 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
2227 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
2228 we're an EnumConstant, just return that.
2229 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
2230 an EnumConstant. In this case, we need to use GetValueAsEnumType()
2231 to get the value which'll actually be written into the attribute.
2232 However, we have to use GetValue() to access the attribute's value
2235 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2237 * constant.cs (Constant.IsNegative): New abstract property
2240 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
2241 (StackAlloc.DoResolve): Reused IsNegative.
2243 2004-09-22 Martin Baulig <martin@ximian.com>
2245 * typemanager.cs (TypeManager.LookupGenericTypeContainer): New
2246 public method; like LookupTypeContainer, but also works for
2249 * report.cs (Report.SymbolRelatedToPreviousError): Use
2250 TypeManager.LookupGenericTypeContainer().
2252 2004-09-22 Martin Baulig <martin@ximian.com>
2254 Thanks to Peter Sestoft for this bug report.
2256 * expression.cs (Conditional): If both the `trueExpr' and the
2257 `falseExpr' is a NullLiteral, return a NullLiteral.
2259 2004-09-22 Martin Baulig <martin@ximian.com>
2261 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
2262 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
2263 for the "get_Current" call.
2265 2004-09-21 Martin Baulig <martin@ximian.com>
2267 * convert.cs (Convert.ImplicitReferenceConversion): When
2268 converting to an interface type, first check whether we're
2269 converting from a reference type.
2271 2004-09-14 Martin Baulig <martin@ximian.com>
2273 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
2275 2004-09-14 Marek Safar <marek.safar@seznam.cz>
2278 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
2279 called and is obsolete then this member suppress message
2280 when call is inside next [Obsolete] method or type.
2282 * expression.cs: Use TestObsoleteMethodUsage member.
2284 2004-09-14 Martin Baulig <martin@ximian.com>
2286 * genericparser.cs: Removed.
2288 2004-09-13 Marek Safar <marek.safar@seznam.cz>
2290 * class.cs (MethodCore.CheckBase): Fix bug #65757.
2292 2004-09-12 Marek Safar <marek.safar@seznam.cz>
2294 * attribute.cs (Attribute.Resolve): Add error 653 report.
2296 * class.cs (Class.ApplyAttributeBuilder): Add error 641
2298 (Method.ApplyAttributeBuilder): Add error 685 report.
2299 (Operator.Define): Add error 564 report.
2301 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
2303 * expression.cs (Invocation.DoResolve): Add error
2306 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
2309 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2311 * class.cs (ConstructorInitializer.Resolve):
2312 Wrong error number (515->516).
2314 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2316 * class.cs (Indexer.Define): Add error 631 report.
2318 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2320 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
2322 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2324 * expression.cs (Probe.DoResolve): Add error CS0241 report.
2326 2004-09-10 Marek Safar <marek.safar@seznam.cz>
2328 * cs-parser.jay: Added error CS0241 report.
2330 2004-09-10 Raja R Harinath <rharinath@novell.com>
2332 * cs-parser.jay (fixed_statement): Introduce a scope for the
2333 declaration in the 'fixed' statement.
2335 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2337 * cs-parser.jay: Added CS0230 error report.
2339 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2341 * cs-parser.jay: Added errors CS0231 and CS0257 report.
2343 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2345 * expression.cs (Argument.Resolve): Added error CS0192 and
2348 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2350 C# 2.0 #pragma warning feature
2352 * cs-tokenizer.cs (PreProcessPragma): New method;
2353 Handles #pragma directive.
2355 * report.cs (WarningRegions): New class; Support
2356 class for #pragma warning directive. It tests whether
2357 warning is enabled for a given line.
2359 2004-09-08 Miguel de Icaza <miguel@ximian.com>
2361 * const.cs: Add more descriptive error report, tahnks to
2364 2004-09-08 Marek Safar <marek.safar@seznam.cz>
2366 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
2368 2004-09-07 Miguel de Icaza <miguel@ximian.com>
2370 * expression.cs: Apply patch from Ben: Remove dead code from
2371 ArrayCreation, and remove the TurnintoConstant call in const.cs,
2372 as that code just threw an exception anwyays.
2374 * const.cs: Remove the call to the turnintoconstant, for details
2377 * literal.cs: The type of the null-literal is the null type; So
2378 we use a placeholder type (literal.cs:System.Null, defined here)
2381 * expression.cs (Conditional.DoResolve): Remove some old code that
2382 is no longer needed, conversions have been fixed.
2384 (ArrayCreationExpression.DoResolve): Return false if we fail to
2385 resolve the inner expression.
2387 2004-09-07 Raja R Harinath <rharinath@novell.com>
2390 * cs-parser.jay (delegate_declaration): Record a delegate
2391 declaration as a type declaration.
2392 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
2394 2004-09-06 Miguel de Icaza <miguel@ximian.com>
2396 * parameter.cs: Do not crash if the type can not be resolved.
2398 * expression.cs: Report errors with unsafe pointers, fixes #64896
2400 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
2402 * expression.cs: Pointer arith always needs to do a conv.i
2403 if the operand is a long. fix 65320
2405 2004-09-04 Marek Safar <marek.safar@seznam.cz>
2407 Fixed cs0619-37.cs, cs0619-38.cs
2409 * enum.cs (GetObsoleteAttribute): Removed.
2411 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
2412 on Enum member is double staged. The first is tested member
2415 2004-09-04 Marek Safar <marek.safar@seznam.cz>
2417 Fixed #56986, #63631, #65231
2419 * class.cs: (TypeContainer.AddToMemberContainer): New method,
2420 adds member to name container.
2421 (TypeContainer.AddToTypeContainer): New method, adds type to
2423 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
2424 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
2425 AddOperator): Simplified by reusing AddToMemberContainer.
2426 (TypeContainer.UserDefinedStaticConstructor): Changed to property
2428 (Method.CheckForDuplications): Fixed implementation to test all
2430 (MemberBase): Detection whether member is explicit interface
2431 implementation is now in constructor.
2432 (MemberBase.UpdateMemberName): Handles IndexerName.
2433 (Accessor): Changed to keep also location information.
2434 (AbstractPropertyEventMethod): Is derived from MemberCore.
2435 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
2436 will be emited or not.
2437 (PropertyBase.AreAccessorsDuplicateImplementation):
2438 Tests whether accessors are not in collision with some method.
2439 (Operator): Is derived from MethodCore to simplify common
2442 * decl.cs (Flags.TestMethodDuplication): Test for duplication
2444 (DeclSpace.AddToContainer): Adds the member to defined_names
2445 table. It tests for duplications and enclosing name conflicts.
2447 * enum.cs (EnumMember): Clean up to reuse the base structures
2449 2004-09-03 Martin Baulig <martin@ximian.com>
2451 Merged latest changes into gmcs. Please keep this comment in
2452 here, it makes it easier for me to see what changed in MCS since
2453 the last time I merged.
2455 2004-09-03 Martin Baulig <martin@ximian.com>
2457 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
2458 into TypeContainer, to make partial classes work again.
2460 2004-09-03 Martin Baulig <martin@ximian.com>
2462 * rootcontext.cs (RootContext.V2): Removed.
2464 2004-03-23 Martin Baulig <martin@ximian.com>
2466 * expression.cs (Invocation.OverloadResolve): Added `bool
2467 may_fail' argument and use it instead of the Location.IsNull() hack.
2469 2004-09-09 Martin Baulig <martin@ximian.com>
2471 * cs-parser.jay (namespace_declaration): Fixed CS0134 reporting.
2473 2004-09-09 Martin Baulig <martin@ximian.com>
2475 * generic.cs (TypeParameter.DefineType): Added support for
2476 explicit interface methods.
2478 2004-09-09 Martin Baulig <martin@ximian.com>
2480 * README.Changes: New document. Started to list important changes
2481 between MCS and GMCS here.
2483 2004-09-08 Martin Baulig <martin@ximian.com>
2486 (TypeContainer.CheckRecursiveDefinition): New protected method.
2487 (TypeContainer.DefineType): Move the CS0146 check into
2488 CheckRecursiveDefinition().
2490 2004-09-06 Martin Baulig <martin@ximian.com>
2492 * generic.cs (ConstructedType.CheckConstraints): Allow builtin
2493 types for the constructor constraint.
2495 2004-09-03 Martin Baulig <martin@ximian.com>
2497 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
2498 into TypeContainer, to make partial classes work again.
2500 2004-09-03 Martin Baulig <martin@ximian.com>
2502 * rootcontext.cs (RootContext.V2): Removed.
2504 2004-03-23 Martin Baulig <martin@ximian.com>
2506 * expression.cs (Invocation.OverloadResolve): Added `bool
2507 may_fail' argument and use it instead of the Location.IsNull() hack.
2509 2004-09-03 Martin Baulig <martin@ximian.com>
2511 Merged latest changes into gmcs. Please keep this comment in
2512 here, it makes it easier for me to see what changed in MCS since
2513 the last time I merged.
2515 2004-09-03 Raja R Harinath <rharinath@novell.com>
2518 * expression.cs (BetterConversion): Don't allow either conversion
2519 to be null. Remove redundant implicit conversion test when 'q ==
2520 null' -- when this function is invoked, we already know that the
2521 implicit conversion exists.
2522 (BetterFunction): Assume that 'best' is non-null. Remove
2523 redundant reimplementation of IsApplicable when 'best' is null.
2524 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
2525 number of arguments.
2526 (IsAncestralType): Extract from OverloadResolve.
2527 (OverloadResolve): Make robust to the MethodGroupExpr being
2528 unsorted. Implement all the logic of Section 14.5.5.1, and
2529 support overloading of methods from multiple applicable types.
2530 Clean up logic somewhat. Don't pass null methods to BetterFunction.
2532 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
2533 (RealError, Warning): Append type of report to related symbol.
2535 2004-09-03 Marek Safar <marek.safar@seznam.cz>
2537 * enum.cs: Fixed CLS-Compliance checks for enum members.
2538 Error tests cs3008-8.cs, cs3014-8.cs
2540 2004-09-02 Marek Safar <marek.safar@seznam.cz>
2542 Fixed bug #62342, #63102
2543 * class.cs: ImplementIndexer uses member.IsExplicitImpl
2544 like ImplementMethod.
2546 2004-09-02 Marek Safar <marek.safar@seznam.cz>
2548 * attribute.cs (Attribute.GetAttributeArgumentExpression):
2551 2004-09-02 Martin Baulig <martin@ximian.com>
2553 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
2554 TypeManager.GetArgumentTypes() rather than calling GetParameters()
2557 2004-09-01 Marek Safar <marek.safar@seznam.cz>
2559 C# 2.0 Static classes implemented
2561 * class.cs (TypeContainer): instance_constructors,
2562 initialized_fields, initialized_static_fields,
2563 default_constructor, base_inteface_types are protected to be
2564 accessible from StaticClass.
2565 (TypeContainer.DefineDefaultConstructor): New virtual method
2566 for custom default constructor generating
2567 (StaticClass): New class to handle "Static classes" feature.
2569 * cs-parser.jay: Handle static keyword on class like instance
2572 * driver.cs: Added "/langversion" command line switch with two
2573 options (iso-1, default).
2575 2004-08-31 Marek Safar <marek.safar@seznam.cz>
2577 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
2579 2004-08-31 Miguel de Icaza <miguel@ximian.com>
2581 * delegate.cs: Style.
2583 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
2585 * delegate.cs: Add seperate instance expr field for miguel.
2587 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
2589 * PointerArithmetic (Resolve): make sure we are not doing
2590 pointer arith on void*. Also, make sure we are resolved
2591 by not setting eclass until resolve.
2593 All callers: Make sure that PointerArithmetic gets resolved.
2595 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
2597 * ArrayCreation (LookupType): If the type does not resolve
2598 to an array, give an error.
2600 2004-08-27 Marek Safar <marek.safar@seznam.cz>
2602 * statement.cs (Try.Resolve): Fixed bug #64222
2604 2004-08-27 Martin Baulig <martin@ximian.com>
2607 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
2610 2004-08-26 Marek Safar <marek.safar@seznam.cz>
2612 * ecore.cs (Constantify): Get underlying type via
2613 System.Enum.GetUnderlyingType to avoid StackOverflow on the
2614 Windows in special cases.
2616 2004-08-26 Marek Safar <marek.safar@seznam.cz>
2618 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
2619 for obtaining also private methods.
2620 (GetRemoveMethod): Used GetRemoveMethod (true)
2621 for obtaining also private methods.
2623 2004-09-02 Martin Baulig <martin@ximian.com>
2625 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
2626 TypeManager.GetArgumentTypes() rather than calling GetParameters()
2629 2004-08-27 Martin Baulig <martin@ximian.com>
2632 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
2635 2004-08-25 Martin Baulig <martin@ximian.com>
2637 * support.cs (ReflectionParameters..ctor): If this is a generic
2638 method, retrieve and store its type parameters.
2639 (InternalParameters..ctor): Added `TypeParameter[]' argument.
2640 (ReflectionParameters.GenericConstraints): The argument specifies
2641 the type parameter, not the method parameter.
2642 (InternalParameters.GenericConstraints): Likewise.
2644 * generic.cs (TypeParameter.DefineType): Correctly handle
2645 constraints wrt. generic methods in interfaces and their
2648 2004-08-24 Martin Baulig <martin@ximian.com>
2650 * generic.cs (TypeParameter.IsSubclassOf): New public method.
2651 (Constraints.IsSubclassOf): New internal method.
2653 * typemanager.cs (TypeManager.FindMembers): Added special support
2654 for GenericTypeParameterBuilder's.
2655 (TypeManager.IsSubclassOf, IsFamilyAccessible): Added support for
2658 2004-08-24 Martin Baulig <martin@ximian.com>
2661 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
2662 this for accessibility checks.
2663 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
2664 IsNestedFamilyAccessible.
2665 (TypeManager.IsSubclassOf): New method, do what the name actually
2668 2004-08-24 Martin Baulig <martin@ximian.com>
2670 * expression.cs (MemberAccess.DoResolve): When resolving ourselves
2671 as a SimpleName, include the generic arity.
2673 2004-08-24 Martin Baulig <martin@ximian.com>
2675 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
2676 MethodAttributes.HideBySig for operators.
2678 2004-08-23 Martin Baulig <martin@ximian.com>
2680 Back to the old error reporting system :-)
2682 * report.cs (Message): Removed.
2683 (Report.MessageData, ErrorData, WarningData): Removed.
2684 (Report.Error, Warning): Back to the old system.
2686 2004-08-23 Martin Baulig <martin@ximian.com>
2688 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
2690 * class.cs (TypeContainer.ParentContainer): New public virtual
2691 method; replaces the explicit interface implementation.
2692 (ClassPart.ParentContainer): Override.
2694 2004-08-23 Martin Baulig <martin@ximian.com>
2696 * statement.cs (Switch): Added support for constant switches; see
2697 #59428 or test-285.cs.
2699 2004-08-22 Marek Safar <marek.safar@seznam.cz>
2702 * statement.cs (GetEnumeratorFilter): Removed useless
2703 logic because C# specs is strict. GetEnumerator must be
2706 2004-08-22 Martin Baulig <martin@ximian.com>
2708 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2709 a switch and may break, reset the barrier. Fixes #59867.
2711 2004-08-22 Marek Safar <marek.safar@seznam.cz>
2713 CLS-Compliance speed up (~5% for corlib)
2715 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
2716 New method. Tests container for CLS-Compliant names
2718 * class.cs (TypeContainer.VerifyClsName): New method.
2719 Checks whether container name is CLS Compliant.
2720 (Constructor): Implements IMethodData.
2722 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
2723 low-case table for CLS Compliance test.
2724 (MemberCache.VerifyClsParameterConflict): New method.
2725 Checks method parameters for CS3006 error.
2727 * enum.cs (EnumMember): Is derived from MemberCore.
2728 (Enum.VerifyClsName): Optimized for better performance.
2730 2004-08-06 Marek Safar <marek.safar@seznam.cz>
2732 * report.cs: Renamed Error_T to Error and changed all
2735 2004-08-06 Marek Safar <marek.safar@seznam.cz>
2737 * class.cs (TypeContainer.IndexerArrayList): New inner class
2738 container for indexers.
2739 (TypeContainer.DefaultIndexerName): New constant for default
2740 indexer name. Replaced all "Item" with this constant.
2741 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
2743 * typemanager.cs (TypeManager.default_member_ctor): Cache here
2744 DefaultMemberAttribute constructor.
2746 2004-08-05 Martin Baulig <martin@ximian.com>
2748 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
2751 2004-08-05 Marek Safar <marek.safar@seznam.cz>
2753 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
2754 multi platforms problem.
2756 * compiler.csproj: Included shared files.
2758 2004-08-04 Marek Safar <marek.safar@seznam.cz>
2760 Fix bug 60333, 55971 in the more general way
2761 * attribute.cs (Attribute.GetAttributeArgumentExpression):
2762 Added arg_type argument for constant conversion.
2763 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
2765 2004-08-04 Marek Safar <marek.safar@seznam.cz>
2768 * class.cs (TypeContainer ): New inner classes MethodArrayList,
2769 OperatorArrayList, MethodCoreArrayList for typecontainer
2770 containers. Changed class member types to these new types.
2771 (MethodArrayList.DefineMembers): Added test for CS0659.
2773 2004-08-04 Miguel de Icaza <miguel@ximian.com>
2775 * cfold.cs: Synchronize the folding with the code in expression.cs
2776 Binary.DoNumericPromotions for uint operands.
2778 * attribute.cs: Revert patch from Raja, it introduced a regression
2779 while building Blam-1.2.1 (hard to isolate a test case).
2781 2004-08-04 Marek Safar <marek.safar@seznam.cz>
2785 (TypeContainer.Define): Renamed to DefineContainerMembers because of
2787 (MethodCore.parent_method): New member. The method we're overriding
2788 if this is an override method.
2789 (MethodCore.CheckBase): Moved from Method class and made common.
2790 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
2792 (MethodCore.CheckForDuplications): New abstract method. For custom
2793 member duplication search in a container
2794 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
2795 method and its return type.
2796 (Event.conflict_symbol): New member. Symbol with same name in the
2800 (MemberCache.FindMemberWithSameName): New method. The method
2801 is looking for conflict with inherited symbols.
2803 2004-08-04 Martin Baulig <martin@ximian.com>
2805 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
2807 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
2809 2004-08-03 Marek Safar <marek.safar@seznam.cz>
2811 * report.cs (Message): New enum for better error, warning reference in
2813 (MessageData): New inner abstract class. It generally handles printing of
2814 error and warning messages.
2815 Removed unused Error, Warning, Message methods.
2817 2004-08-03 Marek Safar <marek.safar@seznam.cz>
2819 Fix for cs0592-8.cs test
2821 (Attributable.ValidAttributeTargets): Made public.
2822 (Attribute.ExplicitTarget): New member for explicit target value.
2823 (Attribute.CheckTargets): Now we translate explicit attribute
2824 target to Target here.
2826 2004-08-03 Ben Maurer <bmaurer@ximian.com>
2828 * ecore.cs (MethodGroupExpr): new IsBase property.
2830 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
2832 * delegate.cs (DelegateCreation): store a MethodGroupExpr
2833 rather than an instance expr.
2835 (DelegateCreation.Emit): Use the method group rather than
2836 the instance expression. Also, if you have base.Foo as the
2837 method for a delegate, make sure to emit ldftn, not ldftnvirt.
2839 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
2841 (NewDelegate.DoResolve): Only check for the existance of Invoke
2842 if the method is going to be needed. Use MethodGroupExpr.
2844 (NewDelegate.Emit): Remove, DelegateCreation implements this.
2846 * expression.cs: For pointer arith., make sure to use
2847 the size of the type, not the size of the pointer to
2850 2004-08-03 Marek Safar <marek.safar@seznam.cz>
2853 * class.cs (Class): Added error CS0502 test.
2855 2004-08-03 John Luke <jluke@cfl.rr.com>
2856 Raja R Harinath <rharinath@novell.com>
2859 * attribute.cs (Attribute.complained_before): New flag.
2860 (Attribute.ResolveType, Attribute.Resolve),
2861 (Attribute.DefinePInvokeMethod): Set it.
2862 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
2864 2004-08-03 Martin Baulig <martin@ximian.com>
2866 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
2867 use a user-defined operator; we still need to do numeric
2868 promotions in case one argument is a builtin type and the other
2869 one has an implicit conversion to that type. Fixes #62322.
2871 2004-08-18 Martin Baulig <martin@ximian.com>
2873 * class.cs (Method.Define): Use the correct method name when
2874 creating the MethodBuilder for a generic method.
2876 2004-08-17 Martin Baulig <martin@ximian.com>
2878 * generic.cs (Constraints): Support type parameter constraints.
2880 2004-08-16 Martin Baulig <martin@ximian.com>
2882 * cs-tokenizer.cs (Tokenizer.TypeOfParsing): New public property.
2883 (Token.GENERIC_DIMENSION): New token; this is returned if we
2884 encounter an unbound generic type in a typeof() expression.
2886 * cs-parser.jay (opt_type_argument_list): Added GENERIC_DIMENSION;
2887 this token is only generated while parsing a typeof() expression.
2888 (typeof_expression): Removed the old unbound_type hack.
2890 * generic.cs (TypeArguments.IsUnbound): New public property.
2892 * decl.cs (MemberName): Added support for unbound types.
2894 2004-08-14 Martin Baulig <martin@ximian.com>
2897 (TypeManager.IsEqualGenericInstance): New static method.
2898 (TypeManager.IsSubclassOrNestedChildOf, IsSubclassOf): This is
2899 just used to check accessibility, so follow the rules of 26.1.6.
2901 * expression.cs (MemberAccess.ResolveAsTypeStep): Return a
2902 ConstructedType instead of a TypeExpression if we have type arguments.
2904 * cs-parser.jay (typeof_expression): Support unbound generic types.
2906 * ecore.cs (UnboundTypeExpression): New public class.
2908 2004-08-12 Martin Baulig <martin@ximian.com>
2910 * typemanager.cs (TypeManager.IsNestedChildOf): Use
2911 TypeManager.IsEqual() rather than `=='.
2913 * decl.cs (DeclSpace.CheckAccessLevel): Use `tb.FullName' for
2914 generic instances as well.
2916 2004-08-12 Martin Baulig <martin@ximian.com>
2918 * expression.cs (Invocation.InferType): We can only infer method
2919 type parameters. Fixes #62647.
2921 2004-08-11 Martin Baulig <martin@ximian.com>
2923 * class.cs (TypeContainer.DefineType): Create the TypeBuilder
2924 before resolving the base classes.
2926 2004-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2928 * Makefile: install .mdb file too.
2930 2004-08-05 Martin Baulig <martin@ximian.com>
2932 * ecore.cs (FieldExpr.DoResolveLValue): If we're resolving a field
2933 initializer, the current type is just the TypeBuilder, not the
2934 instantiated generic type.
2935 (FieldExpr.IsFieldInitializer): New public property.
2937 2004-08-04 Martin Baulig <martin@ximian.com>
2939 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
2941 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
2943 2004-08-03 Martin Baulig <martin@ximian.com>
2945 * class.cs (MethodData.Define): If we're an explicit
2946 implementation, remove the generic arity from the type name.
2948 2004-08-03 Martin Baulig <martin@ximian.com>
2950 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
2951 use a user-defined operator; we still need to do numeric
2952 promotions in case one argument is a builtin type and the other
2953 one has an implicit conversion to that type. Fixes #62322.
2955 2004-08-02 Martin Baulig <martin@ximian.com>
2957 * class.cs (TypeContainer.ifaces): Make this a `Type[]', not a
2959 (TypeContainer.GetClassBases): Return the unexpanded list of
2960 interfaces; we expand them later.
2961 (TypeContainer.DefineType): After creating the TypeBuilder, call
2962 TypeManager.ExpandInterfaces() to get an expanded and resolved
2965 * ecore.cs (TypeExpr.GetInterfaces): Removed
2967 * generics.cs (Constraints.InterfaceConstraints): Remove.
2968 (TypeParameter.DefineType): Call TypeManager.RegisterBuilder() to
2969 register the interface constraints.
2972 (TypeManager.AddUserType): Removed the `ifaces' argument.
2973 (TypeManager.AddTypeParameter): Likewise.
2974 (TypeManager.AddUserInterface): Removed, was unused.
2975 (TypeManager.RegisterBuilder): Take a `Type[]' instead of a
2976 `TypeExpr[]' array for the interfaces.
2977 (TypeManager.ExpandInterfaces): Call this after the TypeBuilder
2978 has been defined, returns a list of the resolved interfaces types.
2979 (TypeManager.GetInterfaces): Return a `Type[]', not a `TypeExpr[]'.
2980 (TypeManager.GetExplicitInterfaces): Likewise.
2982 2004-08-02 Martin Baulig <martin@ximian.com>
2984 * expression.cs (Invocation.EmitCall): If we're invoking a method
2985 on a type parameter, use the new `Constrained' prefix opcode.
2987 2004-08-02 Martin Baulig <martin@ximian.com>
2989 * statement.cs (LocalInfo.Flags): Added `IsThis'.
2990 (LocalInfo.IsThis): New public property.
2991 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
2993 2004-08-01 Martin Baulig <martin@ximian.com>
2995 * class.cs (TypeContainer.GetClassBases): Don't set the default
2996 here since we may get called from GetPartialBases().
2997 (TypeContainer.DefineType): If GetClassBases() didn't return a
2998 parent, use the default one.
3000 2004-07-30 Martin Baulig <martin@ximian.com>
3002 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
3004 * class.cs (SourceMethod): New public class, derive from the
3005 symbol writer's ISourceMethod.
3006 (Method): Use the new symbol writer API.
3008 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
3009 as argument and use the new symbol writer.
3012 (SourceFile): Implement the symbol writer's ISourceFile.
3013 (Location.SymbolDocument): Removed.
3014 (Location.SourceFile): New public property.
3016 * symbolwriter.cs: Use the new symbol writer API.
3018 2004-07-30 Raja R Harinath <rharinath@novell.com>
3020 * Makefile (install-local): Remove. Functionality moved to
3023 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
3025 * Makefile: Install mcs.exe.config file together with mcs.exe.
3026 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
3027 correct runtime version.
3029 2004-07-25 Martin Baulig <martin@ximian.com>
3032 (TypeContainer.RegisterOrder): Removed, this was unused.
3033 (TypeContainer, interface_order): Removed.
3034 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
3035 TypeContainer as argument since we can also be called with a
3036 `PartialContainer' for a partial class/struct/interface.
3037 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
3038 of checking whether we're an `Interface' - we could be a
3040 (PartialContainer.Register): Override; call
3041 AddClass()/AddStruct()/AddInterface() on our parent.
3043 * cs-parser.jay (interface_member_declaration): Add things to the
3044 `current_container', not the `current_class'.
3046 * rootcontext.cs (RegisterOrder): The overloaded version which
3047 takes an `Interface' was unused, removed.
3049 * typemanager.cs (TypeManager.LookupInterface): Return a
3050 `TypeContainer', not an `Interface'.
3051 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
3052 contain a `PartialContainer' for an interface, so check it's
3053 `Kind' to figure out what it is.
3055 2004-07-25 Martin Baulig <martin@ximian.com>
3057 * class.cs (Class.DefaultTypeAttributes): New public constant.
3058 (Struct.DefaultTypeAttributes): Likewise.
3059 (Interface.DefaultTypeAttributes): Likewise.
3060 (PartialContainer.TypeAttr): Override this and add the
3061 DefaultTypeAttributes.
3063 2004-07-25 Martin Baulig <martin@ximian.com>
3065 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
3066 we can just use the `Parent' field instead.
3068 2004-07-25 Martin Baulig <martin@ximian.com>
3070 * class.cs (TypeContainer.Emit): Renamed to EmitType().
3072 2004-07-25 Martin Baulig <martin@ximian.com>
3074 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
3075 our parts before defining any methods.
3076 (TypeContainer.VerifyImplements): Make this virtual.
3077 (ClassPart.VerifyImplements): Override and call VerifyImplements()
3078 on our PartialContainer.
3080 2004-07-25 Martin Baulig <martin@ximian.com>
3082 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
3084 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
3085 argument, we can just use the `Parent' field instead.
3088 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
3089 (MemberBase.DoDefine): Likewise.
3091 2004-07-24 Martin Baulig <martin@ximian.com>
3093 * decl.cs (MemberCore.Parent): New public field.
3094 (DeclSpace.Parent): Moved to MemberCore.
3096 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
3097 (MemberBase.ctor): Added TypeContainer argument, pass it to our
3099 (FieldBase, Field, Operator): Likewise.
3100 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
3101 (EventField, Event): Likewise.
3103 2004-07-23 Martin Baulig <martin@ximian.com>
3105 * class.cs (PartialContainer): New public class.
3106 (ClassPart): New public class.
3107 (TypeContainer): Added support for partial classes.
3108 (TypeContainer.GetClassBases): Splitted some of the functionality
3109 out into GetNormalBases() and GetPartialBases().
3111 * cs-tokenizer.cs (Token.PARTIAL): New token.
3112 (Tokenizer.consume_identifier): Added some hacks to recognize
3113 `partial', but only if it's immediately followed by `class',
3114 `struct' or `interface'.
3116 * cs-parser.jay: Added support for partial clases.
3118 2004-07-23 Martin Baulig <martin@ximian.com>
3120 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
3121 a `DeclSpace' and also made it readonly.
3122 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
3123 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
3124 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
3126 * cs-parser.jay: Pass the `current_class', not the
3127 `current_container' (at the moment, this is still the same thing)
3128 to a new Method, Property, Event, Indexer or Constructor.
3130 2004-07-23 Martin Baulig <martin@ximian.com>
3132 * cs-parser.jay (CSharpParser): Added a new `current_class' field
3133 and removed the `current_interface' one.
3134 (struct_declaration, class_declaration, interface_declaration):
3135 Set `current_class' to the newly created class/struct/interface;
3136 set their `Bases' and call Register() before parsing their body.
3138 2004-07-23 Martin Baulig <martin@ximian.com>
3140 * class.cs (Kind): New public enum.
3141 (TypeContainer): Made this class abstract.
3142 (TypeContainer.Kind): New public readonly field.
3143 (TypeContainer.CheckDef): New public method; moved here from
3145 (TypeContainer.Register): New public abstract method.
3146 (TypeContainer.GetPendingImplementations): New public abstract
3148 (TypeContainer.GetClassBases): Removed the `is_class' and
3149 `is_iface' parameters.
3150 (TypeContainer.DefineNestedTypes): Formerly known as
3152 (ClassOrStruct): Made this class abstract.
3154 * tree.cs (RootTypes): New public type.
3156 2004-07-20 Martin Baulig <martin@ximian.com>
3158 * tree.cs (Tree.RecordNamespace): Removed.
3159 (Tree.Namespaces): Removed.
3161 * rootcontext.cs (RootContext.IsNamespace): Removed.
3163 * cs-parser.jay (namespace_declaration): Just create a new
3164 NamespaceEntry here.
3166 2004-07-21 Lluis Sanchez Gual <lluis@novell.com>
3168 * Makefile: Install gmcs.exe.config file together with gmcs.exe.
3169 * gmcs.exe.config: Renamed from mcs.exe.config. Added supportedRuntime
3170 entry to make sure it runs in the correct runtime version.
3172 2004-07-18 Martin Baulig <martin@ximian.com>
3174 * generic.cs (ConstructedType.CheckConstraints): Improved
3175 constraints checking.
3177 2004-07-18 Martin Baulig <martin@ximian.com>
3179 * expression.cs (Invocation.BetterMethod): Call
3180 TypeManager.TypeToCoreType() on all types and removed my previous
3181 hack; we're already doig the right thing here.
3183 2004-07-17 Martin Baulig <martin@ximian.com>
3185 * decl.cs (MemberName.MakeName): Create the "class`1" names here.
3187 2004-07-16 Martin Baulig <martin@ximian.com>
3189 * iterators.cs: Added generics support.
3191 2004-07-16 Martin Baulig <martin@ximian.com>
3193 * iterators.cs: Rewrote this. We're now using one single Proxy
3194 class for both the IEnumerable and the IEnumerator interface and
3195 `Iterator' derives from Class so we can use the high-level API.
3197 * class.cs (TypeContainer.AddIterator): New method.
3198 (TypeContainer.DoDefineType): New protected virtual method, which
3199 is called from DefineType().
3200 (TypeContainer.DoDefineMembers): Call DefineType() and
3201 DefineMembers() on all our iterators.
3202 (TypeContainer.Emit): Call Emit() on all our iterators.
3203 (TypeContainer.CloseType): Call CloseType() on all our iterators.
3205 * codegen.cs (EmitContext.CurrentIterator): New public field.
3207 2004-07-15 Martin Baulig <martin@ximian.com>
3210 (TypeManager.not_supported_exception_type): New type.
3212 2004-07-14 Martin Baulig <martin@ximian.com>
3215 (TypeManager.generic_ienumerable_type): New type.
3216 (TypeManager.generic_ienumerator_type): New type.
3219 (RootContext.interfaces_first_stage): Added
3220 "System.Collections.Generic.IEnumerator`1" and
3221 "System.Collections.Generic.IEnumerable`1".
3223 2004-07-14 Martin Baulig <martin@ximian.com>
3225 * iterators.cs: Use real error numbers.
3227 2004-07-14 Martin Baulig <martin@ximian.com>
3229 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
3230 requires this to be a System.Collection.IEnumerable and not a
3231 class implementing that interface.
3232 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
3234 2004-07-13 Marek Safar <marek.safar@seznam.cz>
3236 * class.cs: Fixed previous fix, it broke some error tests.
3238 2004-07-12 Martin Baulig <martin@ximian.com>
3240 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
3243 2004-07-14 Martin Baulig <martin@ximian.com>
3245 * decl.cs, expression.cs, generic.cs: Use a backqoute (`) and not
3246 an exclamation mark (!) for the generic arity to reflect the
3247 latest spec changes; ie. use "System.Collections.Generic.IList`1".
3249 2004-07-13 Martin Baulig <martin@ximian.com>
3251 * cs-tokenizer.cs (Tokenizer.parse_less_than): Allow array rank
3252 specifiers being part of a type argument.
3254 2004-07-13 Martin Baulig <martin@ximian.com>
3256 * expression.cs (MemberAccess.ResolveAsTypeStep): Use the full `!'
3257 name for generic types.
3259 2004-07-13 Martin Baulig <martin@ximian.com>
3261 * assign.cs (Assign.DoResolve): Moved the CS0131 check up a little
3264 2004-07-09 Miguel de Icaza <miguel@ximian.com>
3266 * assign.cs (LocalTemporary): Add new argument: is_address,If
3267 `is_address' is true, then the value that we store is the address
3268 to the real value, and not the value itself.
3270 * ecore.cs (PropertyExpr): use the new local temporary
3271 stuff to allow us to handle X.Y += z (where X is a struct)
3273 2004-07-08 Martin Baulig <martin@ximian.com>
3275 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
3276 not always return, just like we're doing in Using.Resolve().
3278 2004-07-07 Miguel de Icaza <miguel@ximian.com>
3280 * cs-parser.jay (fixed_statement): flag this as Pinned.
3282 2004-07-06 Miguel de Icaza <miguel@ximian.com>
3284 * typemanager.cs (TypeManager): Removed MakePinned method, this
3285 mechanism is replaced with the .NET 2.x compatible mechanism of
3286 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
3288 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
3289 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
3290 `IsFixed' property which has a different meaning.
3292 2004-07-02 Raja R Harinath <rharinath@novell.com>
3294 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
3295 visible from inside a nested class, not just the names of the
3296 immediately enclosing class.
3299 2004-06-24 Raja R Harinath <rharinath@novell.com>
3301 * expression.cs (BetterConversion): Remove buggy special-case
3302 handling of "implicit constant expression conversions". At this
3303 point, we already know that the conversion is possible -- we're
3304 only checking to see which is better.
3306 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3308 * cs-parser.jay: Added error CS0210 test.
3310 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3312 * cs-parser.jay: Added error CS0134 test.
3314 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3317 * cs-parser.jay: Added error CS0145 test.
3319 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3321 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
3323 2004-06-23 Ben Maurer <bmaurer@ximian.com>
3325 * expression.cs (StackAlloc.Resolve): The argument may not
3326 be a constant; deal with this case.
3328 2004-06-23 Marek Safar <marek.safar@seznam.cz>
3330 * attribute.cs (IndexerName_GetIndexerName): Renamed to
3331 GetIndexerAttributeValue.
3332 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
3334 * class.cs (Indexer.Define): Added error tests for CS0415,
3337 2004-06-23 Miguel de Icaza <miguel@ximian.com>
3339 * attribute.cs (Attribute.Resolve): Keep field code in sync with
3342 2004-06-23 Martin Baulig <martin@ximian.com>
3344 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
3345 neither return nor throw, reset the barrier as well. Fixes #60457.
3347 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
3349 * class.cs : EventAttributes is now set to None by default.
3350 This fixes bug #60459.
3352 2004-06-18 Marek Safar <marek.safar@seznam.cz>
3355 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
3356 Don't throw exception but return null (it's sufficient now).
3358 2004-06-18 Marek Safar <marek.safar@seznam.cz>
3360 * typemanager.cs (GetArgumentTypes): Faster implementation.
3362 2004-06-18 Martin Baulig <martin@ximian.com>
3364 * attribute.cs (Attribute.Resolve): Check whether we're an
3365 EmptyCast which a Constant child. Fixes #60333.
3367 2004-06-17 Ben Maurer <bmaurer@ximian.com>
3369 * statement.cs (EmitCollectionForeach): Account for the fact that
3370 not all valuetypes are in areas which we can take the address of.
3371 For these variables, we store to a temporary variable. Also, make
3372 sure that we dont emit a `callvirt' on a valuetype method.
3374 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3376 * expression.cs (StackAlloc.DoReSolve): Added test for
3377 negative parameter (CS0247).
3379 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3382 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
3384 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3387 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
3390 2004-06-14 Marek Safar <marek.safar@seznam.cz>
3392 Fix bug #58254 & cs1555.cs, cs1556.cs
3393 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
3395 2004-06-14 Marek Safar <marek.safar@seznam.cz>
3397 * cs-parser.jay: Added error CS1669 test for indexers.
3399 2004-06-18 Martin Baulig <martin@ximian.com>
3401 * generics.cs (GenericMethod.ctor): Don't take an Attributes
3402 argument. Fixes #60441.
3404 2004-06-16 Ben Maurer <bmaurer@ximian.com>
3405 * ecore.cs (MethodGroupExpr.Name): Revert Martin's patch.
3406 The name needs to have the actual name of the method in order
3407 for other tests (such as the one in OverloadResolve for Invoke
3408 on a delegate) to work. As well, it does not really help
3409 error reporting because the method group had multiple methods.
3410 * Makefile: Remove MCS_DEBUG, you can enable with the DEBUG_FLAGS.
3411 Make profiling work.
3413 2004-06-13 Martin Baulig <martin@ximian.com>
3415 * cs-parser.jay: Don't allow generic attributes.
3417 2004-06-13 Martin Baulig <martin@ximian.com>
3419 * class.cs (MemberBase.DoDefineBase): New protected method.
3420 (MemberBase.DoDefine): Compute the `flags' in the new
3421 DoDefineBase() which must be called first.
3422 (Method.Define): Call DoDefineBase() first so we have the flags
3423 when defining the generic method.
3425 * cs-parser.jay (interface_method_declaration): Support generic methods.
3427 2004-06-13 Martin Baulig <martin@ximian.com>
3429 * decl.cs (TypeName): Removed.
3430 (MemberName): Removed TypeName and MemberNow; now we just have
3433 * cs-parser.jay: Don't distinguish between type arguments and type
3434 parameters in the grammar and simplified the rules a bit. The
3435 reduce/reduce conflicts are now gone (except the one we inherited
3438 2004-06-11 Martin Baulig <martin@ximian.com>
3440 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
3441 call this twice: for params and varargs methods.
3443 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3446 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
3448 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3450 * attribute.cs (Attribute.GetValidTargets): Made public.
3453 (AbstractPropertyEventMethod): New class for better code sharing.
3454 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
3456 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
3458 2004-06-09 Martin Baulig <martin@ximian.com>
3460 * cs-parser.jay: Removed a reduce/reduce conflict.
3462 2004-06-03 Martin Baulig <martin@ximian.com>
3464 * generic.cs (ConstructedType.GetMemberAccess): Renamed to
3465 GetSimpleName() and return a SimpleName.
3467 * ecore.cs (SimpleName.Arguments): New public field.
3468 (SimpleName): Added overloaded ctor which takes an additional
3469 TypeArguments argument.
3470 (SimpleName.SimpleNameResolve): Added support for generic methods.
3471 (MethodGroupExpr.ResolveGeneric): New public method. The code was
3472 formerly in MemberAccess.DoResolve(), but we also need it in
3473 SimpleNameResolve().
3475 * expression.cs (MemberAccess.DoResolve): Use the new
3476 MethodGroupExpr.ResolveGeneric().
3478 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3480 * decl.cs: If possible, use lookuptypedirect here. We can only do
3481 this if there is no `.' after the namespace. Avoids using
3482 LookupType, which does lots of slow processing.
3483 (FindNestedType) New method, does what it says :-).
3484 * namespace.cs: use LookupTypeDirect.
3485 * rootcontext.cs: use membercache, if possible.
3486 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
3488 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3491 According to the spec,
3493 In a member access of the form E.I, if E is a single identifier,
3494 and if the meaning of E as a simple-name (§7.5.2) is a constant,
3495 field, property, localvariable, or parameter with the same type as
3496 the meaning of E as a type-name (§3.8), then both possible
3497 meanings of E are permitted.
3499 We did not check that E as a simple-name had the same type as E as
3502 This trivial check gives us 5-7% on bootstrap time.
3504 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3506 * expression.cs (Invocation.OverloadResolve): Avoid the
3507 use of hashtables and boxing here by allocating on demand.
3509 2004-05-30 Martin Baulig <martin@ximian.com>
3511 * rootcontext.cs (RootContext.LookupType): Don't cache things if
3512 we're doing a silent lookup. Don't try to lookup nested types in
3513 TypeManager.object_type (thanks to Ben Maurer).
3515 2004-05-30 Martin Baulig <martin@ximian.com>
3517 Committing a patch from Ben Maurer.
3519 * rootcontext.cs (RootContext.LookupType): Cache negative results.
3521 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3523 * convert.cs: add a trivial cache for overload operator resolution.
3525 2004-05-31 Marek Safar <marek.safar@seznam.cz>
3528 (AttributeTester.GetObsoleteAttribute): Returns instance of
3529 ObsoleteAttribute when type is obsolete.
3532 (TypeContainer.VerifyObsoleteAttribute): Override.
3533 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
3534 (MethodCode.VerifyObsoleteAttribute): Override.
3535 (MemberBase.VerifyObsoleteAttribute): Override.
3538 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
3539 and report proper error.
3542 (Delegate.VerifyObsoleteAttribute): Override.
3545 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
3546 and report proper error.
3547 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
3550 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
3554 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
3555 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
3556 Added test for ObsoleteAttribute.
3559 (Catch): Derived from Statement.
3561 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3563 * decl.cs: If possible, use lookuptypedirect here. We can only do
3564 this if there is no `.' after the namespace. Avoids using
3565 LookupType, which does lots of slow processing.
3566 (FindNestedType) New method, does what it says :-).
3567 * namespace.cs: use LookupTypeDirect.
3568 * rootcontext.cs: use membercache, if possible.
3569 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
3571 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3574 According to the spec,
3576 In a member access of the form E.I, if E is a single identifier,
3577 and if the meaning of E as a simple-name (§7.5.2) is a constant,
3578 field, property, localvariable, or parameter with the same type as
3579 the meaning of E as a type-name (§3.8), then both possible
3580 meanings of E are permitted.
3582 We did not check that E as a simple-name had the same type as E as
3585 This trivial check gives us 5-7% on bootstrap time.
3587 2004-05-30 Marek Safar <marek.safar@seznam.cz>
3589 Fixed bug #59071 & cs0160.cs
3590 * statement.cs (Try.Resolve): Check here whether order of catch
3591 clauses matches their dependencies.
3593 2004-05-30 Marek Safar <marek.safar@seznam.cz>
3596 * ecore.cs (SimpleName.SimpleNameResolve): Added test for
3599 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3601 * expression.cs (Invocation.OverloadResolve): Avoid the
3602 use of hashtables and boxing here by allocating on demand.
3604 2004-05-30 Martin Baulig <martin@ximian.com>
3606 * rootcontext.cs (RootContext.LookupType): Don't cache things if
3607 we're doing a silent lookup. Don't try to lookup nested types in
3608 TypeManager.object_type (thanks to Ben Maurer).
3610 2004-05-30 Martin Baulig <martin@ximian.com>
3612 Committing a patch from Ben Maurer.
3614 * rootcontext.cs (RootContext.LookupType): Cache negative results.
3616 2004-05-29 Martin Baulig <martin@ximian.com>
3618 * class.cs (IMethodData.ShouldIgnore): New method.
3620 * typemanager.cs (TypeManager.MethodFlags): Don't take a
3621 `Location' argument, we don't need it anywhere. Use
3622 `IMethodData.ShouldIgnore ()' instead of
3623 `MethodData.GetMethodFlags ()'.
3624 (TypeManager.AddMethod): Removed.
3625 (TypeManager.AddMethod2): Renamed to AddMethod.
3627 2004-05-29 Martin Baulig <martin@ximian.com>
3629 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
3631 * convert.cs (Convert.ImplicitReferenceConversion): If we're
3632 converting from a class type S to an interface type and we already
3633 have an object on the stack, don't box it again. Fixes #52578.
3635 2004-05-29 Martin Baulig <martin@ximian.com>
3637 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
3638 Added support for `params' parameters. Fixes #59267.
3640 2004-05-29 Martin Baulig <martin@ximian.com>
3642 * literal.cs (NullPointer): Provide a private .ctor which sets
3643 `type' to TypeManager.object_type. Fixes #59048.
3645 2004-05-29 Martin Baulig <martin@ximian.com>
3647 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
3648 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
3650 * ecore.cs (EventExpr.instance_expr): Make the field private.
3652 2004-05-26 Marek Safar <marek.safar@seznam.cz>
3654 Fixed bug #50080 & cs0214-2.cs
3655 * expression.cs (Cast.DoResolve): Check unsafe context here.
3657 * statement.cs (Resolve.DoResolve): Likewise.
3659 2004-05-26 Martin Baulig <martin@ximian.com>
3661 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
3663 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
3664 (RootContext.LookupType): Pass down the `silent' flag.
3666 2004-05-25 Martin Baulig <martin@ximian.com>
3669 (MethodGroupExpr.IdenticalTypeName): New public property.
3670 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
3671 expression actually refers to a type.
3673 2004-05-25 Martin Baulig <martin@ximian.com>
3675 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
3676 for #56176 and made it actually work.
3678 2004-05-25 Martin Baulig <martin@ximian.com>
3680 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
3681 (FieldExpr, PropertyExpr): Override and implement
3682 CacheTemporaries. Fixes #52279.
3684 2004-05-25 Miguel de Icaza <miguel@ximian.com>
3686 * location.cs: In the new compiler listing a file twice is a
3687 warning, not an error.
3689 2004-05-24 Martin Baulig <martin@ximian.com>
3691 * enum.cs (Enum.DefineType): For the `BaseType' to be a
3692 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
3694 2004-05-24 Martin Baulig <martin@ximian.com>
3696 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
3697 walking the `using' list. Fixes #53921.
3699 2004-05-24 Martin Baulig <martin@ximian.com>
3701 * const.cs (Const.LookupConstantValue): Added support for
3702 EmptyCast's; fixes #55251.
3704 2004-05-24 Martin Baulig <martin@ximian.com>
3706 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
3707 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
3708 which does the CS0135 check. The reason is that we first need to
3709 check whether the variable actually exists.
3711 2004-05-24 Martin Baulig <martin@ximian.com>
3713 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
3714 than RootContext.LookupType() to find the explicit interface
3717 2004-05-24 Raja R Harinath <rharinath@novell.com>
3719 * Makefile: Simplify. Use executable.make.
3720 * mcs.exe.sources: New file. List of sources of mcs.exe.
3722 2004-05-24 Anders Carlsson <andersca@gnome.org>
3726 Use the invariant culture when doing String.Compare for CLS case
3729 2004-05-23 Martin Baulig <martin@ximian.com>
3731 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
3732 don't have any dots. Fixes #52622, added cs0246-8.cs.
3734 * namespace.cs (NamespaceEntry.Lookup): Likewise.
3736 2004-05-23 Marek Safar <marek.safar@seznam.cz>
3738 * class.cs (MemberBase.Define): Reuse MemberType member for
3739 resolved type. Other methods can use it too.
3741 2004-05-23 Martin Baulig <martin@ximian.com>
3743 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
3744 the variable also exists in the current block (otherwise, we need
3745 to report a CS0103). Fixes #58670.
3747 2004-05-23 Martin Baulig <martin@ximian.com>
3749 * flowanalysis.cs (Reachability.Reachable): Compute this
3750 on-the-fly rather than storing it as a field.
3752 2004-05-23 Martin Baulig <martin@ximian.com>
3754 * flowanalysis.cs (Reachability.And): Manually compute the
3755 resulting `barrier' from the reachability.
3757 2004-05-23 Marek Safar <marek.safar@seznam.cz>
3760 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
3761 instance of ObsoleteAttribute when symbol is obsolete.
3764 (IMethodData): Extended interface for ObsoleteAttribute support.
3766 2004-05-22 Marek Safar <marek.safar@seznam.cz>
3768 * attribute.cs: Fix bug #55970
3770 2004-05-22 Marek Safar <marek.safar@seznam.cz>
3774 (GetObsoleteAttribute): New method. Creates the instance of
3776 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
3777 ObsoleteAttribute when member is obsolete.
3778 (AttributeTester.Report_ObsoleteMessage): Common method for
3779 Obsolete error/warning reporting.
3782 (TypeContainer.base_classs_type): New member for storing parent type.
3785 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
3786 for this MemberCore.
3788 2004-05-21 Marek Safar <marek.safar@seznam.cz>
3790 * attribute.cs, const.cs: Fix bug #58590
3792 2004-05-21 Martin Baulig <martin@ximian.com>
3794 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
3795 out parameters if the end of the method is unreachable. Fixes
3798 2004-05-21 Marek Safar <marek.safar@seznam.cz>
3800 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
3801 Hari was right, why extra method.
3803 2004-05-21 Marek Safar <marek.safar@seznam.cz>
3805 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
3807 2004-05-20 Martin Baulig <martin@ximian.com>
3809 * delegate.cs: Convert this file to Unix mode - like the original
3812 2004-05-20 Martin Baulig <martin@ximian.com>
3814 * attribute.cs: Convert this file to Unix mode - like the original
3817 2004-05-19 Marek Safar <marek.safar@seznam.cz>
3819 Fix bug #58688 (MCS does not report error when the same attribute
3822 * attribute.cs (Attribute.Emit): Distinction between null and default.
3824 2004-05-19 Raja R Harinath <rharinath@novell.com>
3826 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
3827 of a top-level attribute without an attribute target.
3828 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
3830 (Attribute.Conditional_GetConditionName),
3831 (Attribute.Obsolete_GetObsoleteMessage): Update.
3832 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
3833 part of ScanForIndexerName.
3834 (Attribute.CanIgnoreInvalidAttribute): New function.
3835 (Attribute.ScanForIndexerName): Move to ...
3836 (Attributes.ScanForIndexerName): ... here.
3837 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
3838 (Attributes.Search): New internal variant that can choose not to
3839 complain if types aren't resolved. The original signature now
3841 (Attributes.GetClsCompliantAttribute): Use internal variant, with
3842 complaints suppressed.
3843 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
3844 only if it not useful.
3845 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
3846 top-level for attributes that are shared between the assembly
3847 and a top-level class.
3848 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
3849 * class.cs: Update to reflect changes.
3850 (DefineIndexers): Fuse loops.
3851 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
3852 a couple more variants of attribute names.
3854 2004-05-18 Marek Safar <marek.safar@seznam.cz>
3856 Fix bug #52585 (Implemented explicit attribute declaration)
3859 (Attributable.ValidAttributeTargets): New abstract method. It gets
3860 list of valid attribute targets for explicit target declaration.
3861 (Attribute.Target): It holds target itself.
3862 (AttributeSection): Removed.
3863 (Attribute.CheckTargets): New method. It checks whether attribute
3864 target is valid for the current element.
3867 (EventProperty): New class. For events that are declared like
3868 property (with add and remove accessors).
3869 (EventField): New class. For events that are declared like field.
3872 * cs-parser.jay: Implemented explicit attribute target declaration.
3874 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
3875 Override ValidAttributeTargets.
3878 (ReturnParameter): Class for applying custom attributes on
3880 (ParameterAtribute): New class. Class for applying custom
3881 attributes on the parameter type.
3883 2004-05-17 Miguel de Icaza <miguel@ximian.com>
3885 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
3888 (Method): Allow UNSAFE here.
3890 * modifiers.cs: Support unsafe reporting.
3892 2004-05-17 Marek Safar <marek.safar@seznam.cz>
3894 * decl.cs: Fix bug #58478.
3896 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3898 * statement.cs: When checking for unreachable code on an EmptyStatement,
3899 set the location. Fixes bug #58488.
3901 2004-05-13 Miguel de Icaza <miguel@ximian.com>
3903 * driver.cs: Add -pkg handling.
3905 From Gonzalo: UseShelLExecute=false
3907 2004-05-12 Marek Safar <marek.safar@seznam.cz>
3910 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
3912 (Attribute.IsClsCompliaceRequired): Moved to base for better
3914 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
3915 when attribute is AttributeUsageAttribute.
3916 (Attribute.GetValidTargets): Simplified.
3917 (Attribute.GetAttributeUsage): New method returns AttributeUsage
3918 attribute for this type.
3919 (Attribute.ApplyAttributes): Method renamed to Emit and make
3921 (GlobalAttributeSection): New class for special handling of global
3922 attributes (assembly, module).
3923 (AttributeSection.Emit): New method.
3925 * class.cs: Implemented Attributable abstract methods.
3926 (MethodCore.LabelParameters): Moved to Parameter class.
3927 (Accessor): Is back simple class.
3928 (PropertyMethod): Implemented Attributable abstract class.
3929 (DelegateMethod): Implemented Attributable abstract class.
3930 (Event): New constructor for disctintion between normal Event
3931 and Event with accessors.
3933 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
3935 * codegen.cs, const.cs, decl.cs, delegate.cs:
3936 (CommonAssemblyModulClass): Implemented Attributable abstract class
3939 * enum.cs: Implement IAttributeSupport interface.
3940 (EnumMember): New class for emum members. Implemented Attributable
3944 (ParameterBase): Is abstract.
3945 (ReturnParameter): New class for easier [return:] attribute handling.
3947 * typemanager.cs: Removed builder_to_attr.
3949 2004-05-11 Raja R Harinath <rharinath@novell.com>
3952 * attribute.cs (Attribute.GetPositionalValue): New function.
3953 * class.cs (TypeContainer.VerifyMembers): New function.
3954 (TypeContainer.Emit): Use it.
3955 (ClassOrStruct): New base class for Class and Struct.
3956 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
3957 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
3959 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
3960 then each non-static field should have a FieldOffset attribute.
3961 Otherwise, none of the fields should have a FieldOffset attribute.
3962 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
3963 and FieldOffset attributes.
3964 * typemanager.cs (TypeManager.struct_layout_attribute_type)
3965 (TypeManager.field_offset_attribute_type): New core types.
3966 (TypeManager.InitCoreTypes): Initialize them.
3968 2004-05-11 Michal Moskal <malekith@pld-linux.org>
3970 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
3971 Return correct type.
3974 2004-05-09 Miguel de Icaza <miguel@ximian.com>
3976 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
3977 be implicitly converted to ulong.
3979 * expression.cs: The logic for allowing operator &, | and ^ worked
3980 was wrong, it worked before because we did not report an error in
3981 an else branch. Fixes 57895.
3983 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
3984 allow volatile fields to be reference types.
3986 2004-05-07 Miguel de Icaza <miguel@ximian.com>
3988 * driver.cs: Add support for /debug-
3990 2004-05-07 Raja R Harinath <rharinath@novell.com>
3992 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
3993 Add a 'complain' parameter to silence errors.
3994 (Attribute.Resolve): Update to changes. Put in sanity check to catch
3995 silently overlooked type-resolutions.
3996 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
3998 (Attributes.Search): New function.
3999 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
4000 (Attributes.GetAttributeFullName): Remove hack.
4001 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
4002 Update to reflect changes.
4003 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
4004 Use Attributes.Search instead of nested loops.
4006 2004-05-07 Marek Safar <marek.safar@seznam.cz>
4009 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
4010 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
4011 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
4013 * report.cs: (Report.Warning): Renamed to Warning_T because of
4014 parameter collision.
4016 2004-05-05 Raja R Harinath <rharinath@novell.com>
4018 * expression.cs (MemberAccess.ResolveMemberAccess):
4019 Exit with non-zero status after Report.Error.
4020 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
4022 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
4024 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
4026 * support.cs: Don't hang when the file is empty.
4028 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
4030 * support.cs: In SeekableStreamReader, compute the preamble size of the
4031 underlying stream. Position changes should take into account that initial
4034 2004-05-03 Todd Berman <tberman@sevenl.net>
4036 * driver.cs: remove unused GetSysVersion function.
4038 2004-05-03 Todd Berman <tberman@sevenl.net>
4040 * driver.cs: Remove the hack from saturday, as well as the hack
4041 from jackson (LoadAssemblyFromGac), also adds the CWD to the
4042 link_paths to get that bit proper.
4044 2004-05-01 Todd Berman <tberman@sevenl.net>
4046 * driver.cs: Try a LoadFrom before a Load, this checks the current
4047 path. This is currently a bug in mono that is be fixed, however, this
4048 provides a workaround for now. This will be removed when the bug
4051 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
4053 * CryptoConvert.cs: Updated to latest version. Fix issue with
4054 incomplete key pairs (#57941).
4056 2004-05-01 Todd Berman <tberman@sevenl.net>
4058 * driver.cs: Remove '.' from path_chars, now System.* loads properly
4061 2004-04-30 Jackson Harper <jackson@ximian.com>
4063 * codegen.cs: Open keys readonly.
4065 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4067 * typemanager.cs: don't report cyclic struct layout when a struct
4068 contains 2 or more fields of the same type. Failed for Pango.AttrShape
4069 which has 2 Pango.Rectangle fields.
4071 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
4073 * expression.cs: Handle IntPtr comparisons with IL code
4074 rather than a method call.
4076 2004-04-29 Martin Baulig <martin@ximian.com>
4078 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
4079 the list of PropertyInfo's in class hierarchy and find the
4080 accessor. Fixes #56013.
4082 2004-04-29 Martin Baulig <martin@ximian.com>
4084 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
4086 2004-04-29 Martin Baulig <martin@ximian.com>
4088 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
4090 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
4092 2004-04-29 Martin Baulig <martin@ximian.com>
4094 * class.cs (ConstructorInitializer.Resolve): Check whether the
4095 parent .ctor is accessible. Fixes #52146.
4097 2004-04-29 Martin Baulig <martin@ximian.com>
4099 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
4101 * statement.cs (Using.EmitLocalVariableDecls): Use
4102 TypeManager.idisposable_type, not typeof (IDisposable).
4103 (Foreach.EmitCollectionForeach): Added support for valuetypes.
4105 2004-04-29 Martin Baulig <martin@ximian.com>
4107 * class.cs (Event.Define): Don't emit the field and don't set
4108 RTSpecialName and SpecialName for events on interfaces. Fixes
4111 2004-04-29 Raja R Harinath <rharinath@novell.com>
4113 Refactor Attribute.ApplyAttributes.
4114 * attribute.cs (Attributable): New base class for objects that can
4115 have Attributes applied on them.
4116 (Attribute): Make AttributeUsage fields public.
4117 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
4118 (Attribute.IsInternalCall): New property.
4119 (Attribute.UsageAttr): Convert to a public read-only property.
4120 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
4121 (Attribute.ResolveType, Attribute.Resolve)
4122 (Attribute.ScanForIndexerName): Update to reflect changes.
4123 (Attribute.CheckAttributeTarget): Re-format.
4124 (Attribute.ApplyAttributes): Refactor, to various
4125 Attributable.ApplyAttributeBuilder methods.
4126 * decl.cs (MemberCore): Make Attributable.
4127 * class.cs (Accessor): Make Attributable.
4128 (MethodData.ApplyAttributes): Use proper attribute types, not
4130 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
4131 (TypeContainer.ApplyAttributeBuilder)
4132 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
4133 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
4134 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
4135 (Operator.ApplyAttributeBuilder): New factored-out methods.
4136 * const.cs (Const.ApplyAttributeBuilder): Likewise.
4137 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
4138 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
4139 * parameter.cs (ParameterBase): New Attributable base class
4140 that can also represent Return types.
4141 (Parameter): Update to the changes.
4143 2004-04-29 Jackson Harper <jackson@ximian.com>
4145 * driver.cs: Prefer the corlib system version when looking for
4146 assemblies in the GAC. This is still a hack, but its a better hack
4149 2004-04-29 Marek Safar <marek.safar@seznam.cz>
4151 * decl.cs, enum.cs: Improved error 3005 reporting.
4153 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
4154 (related_symbols): New private member for list of symbols
4155 related to reported error/warning.
4157 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
4159 2004-04-29 Martin Baulig <martin@ximian.com>
4161 * ecore.cs (Expression.Constantify): If we're an enum and
4162 TypeManager.TypeToCoreType() doesn't give us another type, use
4163 t.UnderlyingSystemType. Fixes #56178.
4165 2004-04-29 Martin Baulig <martin@ximian.com>
4167 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
4168 interfaces and for each interface, only add members directly
4169 declared in that interface. Fixes #53255.
4171 2004-04-28 Martin Baulig <martin@ximian.com>
4173 * expression.cs (ConditionalLogicalOperator): Use a temporary
4174 variable for `left' to avoid that we evaluate it more than once;
4177 2004-04-28 Martin Baulig <martin@ximian.com>
4179 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
4182 2004-04-28 Martin Baulig <martin@ximian.com>
4184 * statement.cs (LocalInfo.Resolve): Check whether the type is not
4187 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
4188 whether the type is not void (CS1547).
4190 2004-04-28 Martin Baulig <martin@ximian.com>
4192 * expression.cs (Unary.DoResolveLValue): Override this and report
4193 CS0131 for anything but Operator.Indirection.
4195 2004-04-28 Martin Baulig <martin@ximian.com>
4197 Committing a patch from Ben Maurer; see bug #50820.
4199 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4202 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4205 2004-04-28 Martin Baulig <martin@ximian.com>
4207 Committing a patch from Ben Maurer; see bug #50820.
4209 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4212 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4215 2004-04-28 Martin Baulig <martin@ximian.com>
4217 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
4218 (Block.AddLabel): Call DoLookupLabel() to only search in the
4221 2004-04-28 Martin Baulig <martin@ximian.com>
4223 * cfold.cs (ConstantFold.BinaryFold): Added special support for
4224 comparing StringConstants and NullLiterals in Equality and Inequality.
4226 2004-04-28 Jackson Harper <jackson@ximian.com>
4228 * driver.cs: Attempt to load referenced assemblies from the
4229 GAC. This is the quick and dirty version of this method that
4230 doesnt take into account versions and just takes the first
4231 canidate found. Will be good enough for now as we will not have more
4232 then one version installed into the GAC until I update this method.
4234 2004-04-28 Martin Baulig <martin@ximian.com>
4236 * typemanager.cs (TypeManager.CheckStructCycles): New public
4237 static method to check for cycles in the struct layout.
4239 * rootcontext.cs (RootContext.PopulateTypes): Call
4240 TypeManager.CheckStructCycles() for each TypeContainer.
4241 [Note: We only need to visit each type once.]
4243 2004-04-28 Martin Baulig <martin@ximian.com>
4245 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
4247 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
4248 success and added `out object value'. Use a `bool resolved' field
4249 to check whether we've already been called rather than
4250 `ConstantValue != null' since this breaks for NullLiterals.
4252 2004-04-28 Raja R Harinath <rharinath@novell.com>
4254 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
4255 setting of this flag, since the 'set' method may be non-public.
4257 2004-04-28 Raja R Harinath <rharinath@novell.com>
4259 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
4260 check on current_vector.Block.
4262 2004-04-27 Martin Baulig <martin@ximian.com>
4264 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
4265 a field initializer. Fixes #56459.
4267 2004-04-27 Martin Baulig <martin@ximian.com>
4269 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
4270 we're not attempting to use an indexer. Fixes #52154.
4272 2004-04-27 Martin Baulig <martin@ximian.com>
4274 * statement.cs (Return): Don't create a return label if we don't
4275 need it; reverts my change from January 20th. Thanks to Ben
4278 2004-04-27 Martin Baulig <martin@ximian.com>
4280 According to the spec, `goto' can only leave a nested scope, but
4283 * statement.cs (Block.LookupLabel): Only lookup in the current
4284 block, don't recurse into parent or child blocks.
4285 (Block.AddLabel): Check in parent and child blocks, report
4286 CS0140/CS0158 if we find a duplicate.
4287 (Block): Removed this indexer for label lookups.
4288 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
4289 this already does the error reporting for us.
4292 (FlowBranching.UsageVector.Block): New public variable; may be null.
4293 (FlowBranching.CreateSibling): Added `Block' argument.
4294 (FlowBranching.LookupLabel): New public virtual method. Lookup a
4295 label for the target of a `goto' and check whether we're not
4296 leaving a `finally'.
4298 2004-04-27 Martin Baulig <martin@ximian.com>
4300 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
4301 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
4304 2004-04-27 Martin Baulig <martin@ximian.com>
4306 * statement.cs (Block.AddLabel): Also check for implicit blocks
4307 and added a CS0158 check.
4309 2004-04-27 Martin Baulig <martin@ximian.com>
4311 * flowanalysis.cs (FlowBranchingLoop): New class.
4312 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
4313 UsageVector's instead of an ArrayList.
4314 (FlowBranching.Label): Likewise.
4315 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
4316 (FlowBranching.AddBreakVector): New method.
4318 2004-04-27 Miguel de Icaza <miguel@ximian.com>
4320 * attribute.cs: Small regression fix: only convert the type if we
4321 the type is different, fixes System.Drawing build.
4323 2004-04-27 Martin Baulig <martin@ximian.com>
4325 * attribute.cs (Attribute.Resolve): If we have a constant value
4326 for a named field or property, implicity convert it to the correct
4329 2004-04-27 Raja R Harinath <rharinath@novell.com>
4331 * statement.cs (Block.Block): Implicit blocks share
4332 'child_variable_names' fields with parent blocks.
4333 (Block.AddChildVariableNames): Remove.
4334 (Block.AddVariable): Mark variable as "used by a child block" in
4335 every surrounding block.
4336 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
4337 been used in a child block, complain about violation of "Invariant
4338 meaning in blocks" rule.
4339 * cs-parser.jay (declare_local_variables): Don't use
4340 AddChildVariableNames.
4341 (foreach_statement): Don't create an implicit block: 'foreach'
4344 2004-04-23 Miguel de Icaza <miguel@ximian.com>
4346 * convert.cs (ImplicitNumericConversion): 0 is also positive when
4347 converting from 0L to ulong. Fixes 57522.
4349 2004-04-22 Marek Safar <marek.safar@seznam.cz>
4351 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
4352 derived class hides via 'new' keyword field from base class (test-242.cs).
4353 TODO: Handle this in the more general way.
4355 * class.cs (CheckBase): Ditto.
4357 2004-04-22 Marek Safar <marek.safar@seznam.cz>
4359 * decl.cs (caching_flags): New member for storing cached values
4361 (MemberCore.Flags): New enum where bit flags for caching_flags
4363 (MemberCore.cls_compliance): Moved to caching_flags.
4364 (DeclSpace.Created): Moved to caching_flags.
4366 * class.cs: Use caching_flags instead of DeclSpace.Created
4368 2004-04-21 Miguel de Icaza <miguel@ximian.com>
4370 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
4371 if we are only a derived class, not a nested class.
4373 * typemanager.cs: Same as above, but do this at the MemberLookup
4374 level (used by field and methods, properties are handled in
4375 PropertyExpr). Allow for the qualified access if we are a nested
4378 2004-04-21 Marek Safar <marek.safar@seznam.cz>
4380 * class.cs: Refactoring.
4381 (IMethodData): New inteface; Holds links to parent members
4382 to avoid member duplication (reduced memory allocation).
4383 (Method): Implemented IMethodData interface.
4384 (PropertyBase): New inner classes for get/set methods.
4385 (PropertyBase.PropertyMethod): Implemented IMethodData interface
4386 (Event): New inner classes for add/remove methods.
4387 (Event.DelegateMethod): Implemented IMethodData interface.
4389 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
4390 EmitContext (related to class.cs refactoring).
4392 2004-04-21 Raja R Harinath <rharinath@novell.com>
4394 * delegate.cs (Delegate.VerifyApplicability): If the number of
4395 arguments are the same as the number of parameters, first try to
4396 verify applicability ignoring any 'params' modifier on the last
4400 2004-04-08 Martin Baulig <martin@ximian.com>
4402 Merged latest changes into gmcs. Please keep this comment in
4403 here, it makes it easier for me to see what changed in MCS since
4404 the last time I merged.
4406 2004-04-16 Raja R Harinath <rharinath@novell.com>
4408 * class.cs (TypeContainer.AddIndexer): Use
4409 'ExplicitInterfaceName' to determine if interface name was
4410 explicitly specified. 'InterfaceType' is not initialized at this time.
4411 (TypeContainer.DefineIndexers): Remove use of temporary list. The
4412 Indexers array is already in the required order. Initialize
4413 'IndexerName' only if there are normal indexers.
4414 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
4415 (TypeContainer.Emit): Emit DefaultMember attribute only if
4416 IndexerName is initialized.
4419 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
4421 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
4424 2004-04-15 Raja R Harinath <rharinath@novell.com>
4426 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
4430 * attribute.cs (Attribute.Resolve): Check for duplicate named
4434 2004-04-15 Miguel de Icaza <miguel@ximian.com>
4436 * iterators.cs (MarkYield): track whether we are in an exception,
4437 and generate code accordingly. Use a temporary value to store the
4438 result for our state.
4440 I had ignored a bit the interaction of try/catch with iterators
4441 since their behavior was not entirely obvious, but now it is
4442 possible to verify that our behavior is the same as MS .NET 2.0
4446 2004-04-14 Miguel de Icaza <miguel@ximian.com>
4448 * iterators.cs: Avoid creating temporaries if there is no work to
4451 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
4452 Enumerations, use TypeManager.EnumToUnderlying and call
4455 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
4458 (This.Emit): Use EmitContext.EmitThis to emit our
4461 (This.EmitAssign): Ditto.
4463 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
4464 codepaths, we will move all the functionality into
4467 (FieldExpr.EmitAssign): Ditto.
4469 This fixes several hidden bugs that I uncovered while doing a code
4470 review of this today.
4472 * codegen.cs (EmitThis): reworked so the semantics are more clear
4473 and also support value types "this" instances.
4475 * iterators.cs: Changed so that for iterators in value types, we
4476 do not pass the value type as a parameter.
4478 Initialization of the enumerator helpers is now done in the caller
4479 instead of passing the parameters to the constructors and having
4480 the constructor set the fields.
4482 The fields have now `assembly' visibility instead of private.
4484 2004-04-11 Miguel de Icaza <miguel@ximian.com>
4486 * expression.cs (Argument.Resolve): Check if fields passed as ref
4487 or out are contained in a MarshalByRefObject.
4489 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
4490 another compiler type.
4492 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
4494 * class.cs (Indexer.Define): use the new name checking method.
4495 Also, return false on an error.
4496 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
4497 (is_identifier_[start/part]_character): make static.
4499 2004-04-10 Miguel de Icaza <miguel@ximian.com>
4501 * expression.cs (Binary.ResolveOperator): Do no append strings
4502 twice: since we can be invoked more than once (array evaluation)
4503 on the same concatenation, take care of this here. Based on a fix
4504 from Ben (bug #56454)
4506 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
4508 * codegen.cs: Fix another case where CS1548 must be reported (when
4509 delay-sign isn't specified and no private is available #56564). Fix
4510 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
4511 error when MCS is used on the MS runtime and we need to delay-sign
4512 (which seems unsupported by AssemblyBuilder - see #56621).
4514 2004-04-08 Marek Safar <marek.safar@seznam.cz>
4516 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
4517 (TypeManager.ComputeNamespaces): Faster implementation for
4520 * compiler.csproj: Updated AssemblyName to mcs.
4522 2004-05-11 Jackson Harper <jackson@ximian.com>
4524 * Makefile: Preserve MONO_PATH
4526 2004-05-11 Jackson Harper <jackson@ximian.com>
4528 * Makefile: Use mono and mcs to build gmcs
4530 2004-05-03 Miguel de Icaza <miguel@ximian.com>
4532 * codegen.cs: Add patch from Robert Shade
4533 <rshade@dvsconsulting.com>, use FileAccess.Read on the keyfile, to
4536 2004-05-02 Sebastien Pouliot <sebastien@ximian.com>
4538 * CryptoConvert.cs: Updated to latest version. Fix issue with
4539 incomplete key pairs (#57941).
4541 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
4543 * codegen.cs: Fix another case where CS1548 must be reported (when
4544 delay-sign isn't specified and no private is available #56564). Fix
4545 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
4546 error when MCS is used on the MS runtime and we need to delay-sign
4547 (which seems unsupported by AssemblyBuilder - see #56621).
4549 2004-04-29 Jackson Harper <jackson@ximian.com>
4551 * Makefile: Set MONO_PATH to use the bootstrap corlib
4552 * driver.cs: Check the GAC for referenced assemblies.
4554 2004-04-29 Martin Baulig <martin@ximian.com>
4556 * Makefile (gmcs.exe): Set MONO_PATH to use `../class/lib/net_2_0'.
4558 2004-04-07 Martin Baulig <martin@ximian.com>
4560 * expression.cs (Binary.ResolveOperator): Added special case for
4561 Equality/Inequality between a type parameter and a null literal.
4563 2004-04-07 Martin Baulig <martin@ximian.com>
4565 * convert.cs: Check null literal -> type parameter conversions.
4567 2004-04-07 Martin Baulig <martin@ximian.com>
4569 * generic.cs (ConstructedType.CheckConstraints): Enforce the
4570 `class' and `struct' constraints.
4572 2004-04-07 Martin Baulig <martin@ximian.com>
4574 * generic.cs (SpecialConstraint): New public enum.
4575 (Constraints.Resolve): Added support for the `class' and `struct'
4578 * cs-parser.jay (type_parameter_constraint): Added support for the
4579 `class' and `struct' constraints.
4581 2004-04-07 Martin Baulig <martin@ximian.com>
4583 * support.cs (GenericConstraints): Replaced `Types' by
4584 `ClassConstraint' and `InterfaceConstraints'; added
4585 `HasClassConstraint'.
4587 2004-04-07 Martin Baulig <martin@ximian.com>
4590 (Constraints.InterfaceConstraints): New public property.
4591 (Constraints.Types): Make this property public
4592 (TypeParameter): Implement IMemberContainer.
4593 (TypeParameter.Define): Take a `GenericTypeParameterBuilder'
4594 instead of a TypeBuilder/MethodBuilder; pass the interface
4595 constraints to TypeManager.AddTypeParameter().
4596 (TypeParameter.DefineType): Just take an EmitContext and no
4597 TypeBuilder/MethodBuilder. Use the new public API.
4599 * typemanager.cs (TypeManager.AddTypeParameter): Added
4600 `TypeExpr[]' argument; add the interfaces to the
4601 `builder_to_ifaces' hash.
4602 (TypeManager.LookupMemberContainer): For
4603 GenericTypeParameterBuilders, get the TypeParameter from the
4604 `builder_to_type_param'.
4605 (TypeManager.FindMembers): For GenericTypeParameterBuilders, get
4606 the TypeParameter and call FindMembers on it.
4608 2004-04-07 Martin Baulig <martin@ximian.com>
4611 (MethodCore.GenericMethod): Moved this field here from Method.
4612 (MethodCore.IsDuplicateImplementation): Take the number of type
4613 parameters into account if we're a generic method.
4615 * expression.cs (Invocation.InferTypeArguments): Don't return true
4616 if `arguments' is null; we still need to check whether we actually
4617 don't need to infer anything in this case.
4618 (MemberAccess): Merged the functionality from GenericMemberAccess
4621 * generic.cs (GenericMemberAccess): Removed.
4623 2004-04-05 Martin Baulig <martin@ximian.com>
4625 * decl.cs (MemberCore): For generic classes, interfaces and
4626 structs, `Name' now includes the number of type parameters
4628 (DeclSpace.FindType): Removed the `num_type_args' argument; we now
4629 encode the number of type arguments in the type name.
4631 * expression.cs (Expression.MemberLookup): Removed the
4632 `num_type_args' argument; we now encode the number of type
4633 arguments in the type name.
4635 * ecore.cs (SimpleName): Encode the number of type arguments in
4636 the type name itself.
4638 * generic.cs (ConstructedType): Likewise.
4640 * tree.cs (Tree.RecordDecl): Take a `string' instead of a
4641 `MemberName'; we now include the number of type parameters in the
4644 * typemanager.cs (TypeManager.CheckGeneric): Removed.
4645 (TypeManager.MemberLookup): Removed the
4646 `num_type_args' argument; we now encode the number of type
4647 arguments in the type name.
4649 2004-04-03 Martin Baulig <martin@ximian.com>
4651 * decl.cs (MemberCore.ctor): Take a MemberName instead of a sting.
4652 (MemberCore.MemberName): Moved here from MemberBase.
4653 (DeclSpace.SetParameterInfo): Just take the constraints as an
4654 ArrayList; we already have the type parameters in our
4655 `MemberName'; also do the CS0080 reporting here.
4657 * cs-parser.jay (struct_declaration): Use `member_name' instead of
4658 `IDENTIFIER opt_type_parameter_list'; when constructing our
4659 `MemberName', it'll already include our type parameters.
4660 (class_declaration, interface_declaration): Likewise.
4661 (delegate_declaration): Likewise.
4662 (MakeName): Take a MemberName and return a MemberName.
4663 The following two changes are required to avoid shift/reduce conflicts:
4664 (member_name): Don't include a TypeName anymore; ie. this is now
4665 just 'IDENTIFIER opt_type_parameter_list'.
4666 (property_declaration, event_declaration): Use a
4667 `namespace_or_type_name' instead of a `member_name'.
4669 2004-04-03 Martin Baulig <martin@ximian.com>
4671 * decl.cs (MemberName): Renamed to `TypeName' and created a new
4673 (TypeName): Formerly known as MemberName.
4675 * namespace.cs (NamespaceEntry.UsingAlias): Take a `TypeName'
4676 instead of a `MemberName'.
4678 * cs-parser.jay (namespace_or_type_name): Create a TypeName.
4679 (member_name): New rule; create a MemberName.
4681 2004-04-02 Martin Baulig <martin@ximian.com>
4683 * namespace.cs (NamespaceEntry.VerifyUsing): Added error checking
4684 (CS0305 and CS0308).
4686 2004-04-02 Martin Baulig <martin@ximian.com>
4688 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Added
4689 support for nested types.
4691 2004-04-02 Martin Baulig <martin@ximian.com>
4693 * ecore.cs (IAlias): New public interface.
4694 (TypeExpr, TypeExpression): Implement IAlias.
4695 (TypeAliasExpression): New public class.
4697 * namespace.cs (Namespace): Implement IAlias.
4698 (Namespace.Lookup): Return an IAlias instead on an object.
4699 (Namespace.DefineName): Take an IAlias instead of an object.
4700 (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
4702 (NamespaceEntry.UsingAlias): Take a Membername instead of an
4704 (NamespaceEntry.LookupAlias): Return an IAlias instead on an
4706 (NamespaceEntry.Lookup): Likewise.
4708 * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
4711 * decl.cs (DeclSpace): Implement IAlias.
4712 (DeclSpace.LookupAlias): Return an IAlias instead of a string.
4714 * generic.cs (ConstructedType): Improved error checking.
4716 2004-04-02 Martin Baulig <martin@ximian.com>
4718 * convert.cs: Added type parameter conversions.
4721 (UnboxCast.Emit): Emit an `unbox.any' for type params.
4722 (ClassCast.Emit): If the source type is a type parameter, box it.
4723 If the target type is a type parameter, emit an `unbox.any'
4724 instead of a `classcast'.1
4726 2004-04-01 Martin Baulig <martin@ximian.com>
4728 * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
4730 2004-04-01 Martin Baulig <martin@ximian.com>
4732 * generic.cs (ConstructedType.CheckConstraints): Use
4733 Convert.ImplicitStandardConversionExists(); user-defined implicit
4734 conversions are not allowed according to the spec.
4736 2004-03-30 Martin Baulig <martin@ximian.com>
4738 * expression.cs (New): Added support for type parameters.
4741 (TypeManager.activator_type): New public static field.
4742 (TypeManager.activator_create_instance): Likewise.
4744 2004-03-30 Martin Baulig <martin@ximian.com>
4746 * typemanager.cs (TypeManager.HasConstructorConstraint): New
4749 2004-03-30 Martin Baulig <martin@ximian.com>
4751 * generic.cs (ConstructedType.CheckConstraints): Actually follow
4752 the spec here: the argument type must be convertible to the
4755 2004-03-30 Martin Baulig <martin@ximian.com>
4758 (TypeParameter.Define, TypeParameter.DefineMethod): Call
4759 TypeManager.AddTypeParameter().
4760 (ConstructedType.CheckConstraints): Re-enable this and actually
4761 check whether we have a constructor constraint.
4764 (TypeManager.builder_to_type_param): New static field.
4765 (TypeManager.AddTypeParameter): New static method.
4766 (TypeManager.LookupTypeParameter): New public method.
4768 2004-03-30 Martin Baulig <martin@ximian.com>
4770 * generic.cs (TypeParameter.DefineType): Return a boolean and use
4771 the new API to actually define the constructor constraint.
4774 (TypeManager.new_constraint_attr_type): New static field.
4775 (TypeManager.InitCoreTypes): Initialize it.
4777 2004-03-30 Martin Baulig <martin@ximian.com>
4779 * generic.cs (Constraints): Completed error checking, use correct
4782 2004-03-29 Martin Baulig <martin@ximian.com>
4784 * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
4786 * expression.cs (Invocation.InferTypeArguments): Added overloaded
4787 public version which takes a `ParameterData pd' instead of an
4790 2004-03-29 Martin Baulig <martin@ximian.com>
4792 * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
4795 2004-03-29 Martin Baulig <martin@ximian.com>
4797 * expression.cs (Argument.ResolveMethodGroup): If we're a
4798 ConstructedType, call GetMemberAccess() on it.
4800 2004-03-29 Martin Baulig <martin@ximian.com>
4802 * class.cs (MethodBase.CheckGenericOverride): New abstract method.
4803 (MethodCore.CheckGenericOverride): When overriding a generic
4804 method, check whether the constraints match.
4806 * support.cs (GenericConstraints): New public interface.
4807 (ParameterData.GenericConstraints): New public method.
4809 * parameter.cs (Parameter.Resolve): Check whether we're a generic
4810 method parameter and compute our constraints if appropriate.
4811 (Parameter.GenericConstraints): New public property.
4813 * generic.cs (Constraints): Implement GenericConstraints.
4815 2004-03-29 Martin Baulig <martin@ximian.com>
4817 * decl.cs (MemberCache.FindMemberToOverride): Use
4818 `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
4820 2004-03-29 Martin Baulig <martin@ximian.com>
4822 * generic.cs (GenericMethod.Define): Resolve our type parameters.
4824 2004-03-29 Martin Baulig <martin@ximian.com>
4826 * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
4827 not allowed on non-generic declarations").
4829 2004-03-29 Martin Baulig <martin@ximian.com>
4831 * expression.cs (Invocation.InferTypeArguments): Added overloaded
4832 public version of this method.
4834 * class.cs (MethodCore.IsDuplicateImplementation): Use
4835 Invocation.InferTypeArguments() to check this.
4837 2004-03-29 Martin Baulig <martin@ximian.com>
4839 * convert.cs: Use TypeManager.IsDelegateType() instead of
4840 comparing types correctly.
4842 2004-03-29 Martin Baulig <martin@ximian.com>
4844 * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
4845 types directly to make it work for generic instances.
4847 * typemanager.cs (TypeManager.IsSubclassOf): New static method.
4849 2004-03-29 Martin Baulig <martin@ximian.com>
4851 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
4854 2004-03-24 Martin Baulig <martin@ximian.com>
4856 * decl.cs (DeclSpace.FindType): Also use
4857 TypeManager.CheckGeneric() for types from the using clauses.
4859 2004-03-23 Martin Baulig <martin@ximian.com>
4861 * expression.cs (Invocation.OverloadResolve): Added `bool
4862 may_fail' argument and use it instead of the Location.IsNull() hack.
4864 2004-03-23 Martin Baulig <martin@ximian.com>
4866 * expression.cs (Invocation.InferType): Use correct type inference
4869 2004-03-23 Martin Baulig <martin@ximian.com>
4871 * ecore.cs (MethodGroupExpr.Name): Use
4872 TypeManager.CSharpSignature() instead of just the name.
4874 * expression.cs (Invocation.OverloadResolve): Provide better error
4876 (Invocation.DoResolve): OverloadResolve() never returns null
4877 without reporting an error, so removed the error -6 reporting here.
4879 2004-03-23 Martin Baulig <martin@ximian.com>
4881 * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
4884 * cs-parser.jay (delegate_declaration): Support generic delegates.
4886 * delegate.cs: Support generic delegates.
4888 2004-03-22 Martin Baulig <martin@ximian.com>
4890 * expression.cs (Invocation.InferParamsTypeArguments): New static
4891 method; does type inference for params arguments.
4893 2004-03-21 Martin Baulig <martin@ximian.com>
4895 * typemanager.cs (TypeManager.IsGenericMethod): New public static
4896 method; checks whether a method is a generic method.
4898 * expression.cs (Invocation.InferTypeArguments): New static method;
4899 infer type arguments for generic method invocation.
4901 * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
4902 property; we set this to true if we're resolving a generic method
4903 invocation and the user specified type arguments, ie. we're not
4904 doing type inference.
4906 2004-03-20 Martin Baulig <martin@ximian.com>
4908 * class.cs (MethodData.DeclaringType): New public property.
4909 (MethodData.Define): Set DeclaringType here.
4910 (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
4911 instead of OperatorMethodBuilder.DeclaringType.
4913 2004-03-20 Martin Baulig <martin@ximian.com>
4915 * cs-tokenizer.cs (xtoken): Return a special
4916 Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
4918 * cs-parser.jay (default_value_expression): Switch to the new
4921 2004-03-19 Martin Baulig <martin@ximian.com>
4923 * decl.cs (MemberName): New class. We use this to "construct"
4924 namespace_or_type_name's.
4926 * generics.cs (TypeArguments.GetDeclarations): New public method;
4927 returns the type arguments as a string[] and reports a CS0081 if
4928 one of them is not an identifier.
4930 * class.cs (MemberBase): The .ctor now takes the name as a
4931 MemberName instead of a string.
4932 (MemberBase.ExplicitInterfaceName): Changed type from string to
4934 (MemberBase.DoDefine): If we're an explicit implementation, the
4935 InterfaceType may be a generic instance.
4937 * cs-parser.jay (namespace_or_type_name): Return a MemberName.
4938 (namespace_name): Call MemberName.GetName () to transform the
4939 MemberName into a string and ensure we don't have any type
4941 (type_name): Call MemberName.GetTypeExpression() to transfrom the
4942 MemberName into an expression.
4943 (method_header): Use namespace_or_type_name instead of member_name.
4945 2004-04-07 Miguel de Icaza <miguel@ximian.com>
4947 * rootcontext.cs: Add new types to the boot resolution.
4949 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
4950 MulticastDelegate is not allowed.
4952 * typemanager.cs: Add new types to lookup: System.TypedReference
4955 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
4956 check for TypedReference or ArgIterator, they are not allowed.
4958 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
4959 makes us properly catch 1510 in some conditions (see bug 56016 for
4962 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
4964 * CryptoConvert.cs: update from corlib version
4967 2004-04-05 Miguel de Icaza <miguel@ximian.com>
4969 * class.cs (Indexer.Define): Check indexername declaration
4971 2004-04-05 Marek Safar <marek.safar@seznam.cz>
4973 * attribute.cs (IsClsCompliant): Fixed problem with handling
4974 all three states (compliant, not-compliant, undetected).
4976 2004-03-30 Marek Safar <marek.safar@seznam.cz>
4978 * attribute.cs (Attribute): Location is now public.
4979 (Resolve): Store resolved arguments (pos_values) in attribute class.
4980 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
4981 (GetClsCompliantAttributeValue): New method that gets
4982 CLSCompliantAttribute value.
4983 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
4984 if exists else null.
4985 (AttributeTester): New class for CLS-Compliant verification routines.
4987 * class.cs (Emit): Add CLS-Compliant verification.
4988 (Method.GetSignatureForError): Implemented.
4989 (Constructor.GetSignatureForError): Implemented
4990 (Constructor.HasCompliantArgs): Returns if constructor has
4991 CLS-Compliant arguments.
4992 (Constructor.Emit): Override.
4993 (Construcor.IsIdentifierClsCompliant): New method; For constructors
4994 is needed to test only parameters.
4995 (FieldBase.GetSignatureForError): Implemented.
4996 (TypeContainer): New member for storing base interfaces.
4997 (TypeContainer.FindMembers): Search in base interfaces too.
4999 * codegen.cs (GetClsComplianceAttribute): New method that gets
5000 assembly or module CLSCompliantAttribute value.
5001 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
5003 (ModuleClass.Emit): Add error 3012 test.
5005 * const.cs (Emit): Override and call base for CLS-Compliant tests.
5007 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
5008 state for all decl types.
5009 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
5010 if CLS-Compliant tests are required.
5011 (IsClsCompliaceRequired): New method. Analyze whether code
5012 must be CLS-Compliant.
5013 (IsExposedFromAssembly): New method. Returns true when MemberCore
5014 is exposed from assembly.
5015 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
5016 value or gets cached value.
5017 (HasClsCompliantAttribute): New method. Returns true if MemberCore
5018 is explicitly marked with CLSCompliantAttribute.
5019 (IsIdentifierClsCompliant): New abstract method. This method is
5020 used to testing error 3005.
5021 (IsIdentifierAndParamClsCompliant): New method. Common helper method
5022 for identifier and parameters CLS-Compliant testing.
5023 (VerifyClsCompliance): New method. The main virtual method for
5024 CLS-Compliant verifications.
5025 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
5026 null. I don't know why is null (too many public members !).
5027 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
5028 and get value of first CLSCompliantAttribute that found.
5030 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
5031 (VerifyClsCompliance): Override and add extra tests.
5033 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
5034 clscheck- disable CLS-Compliant verification event if assembly is has
5035 CLSCompliantAttribute(true).
5037 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
5038 ApllyAttribute is now called in emit section as in the other cases.
5039 Possible future Emit integration.
5040 (IsIdentifierClsCompliant): New override.
5041 (VerifyClsCompliance): New override.
5042 (GetEnumeratorName): Returns full enum name.
5044 * parameter.cs (GetSignatureForError): Implemented.
5046 * report.cs (WarningData): New struct for Warning message information.
5047 (LocationOfPreviousError): New method.
5048 (Warning): New method. Reports warning based on the warning table.
5049 (Error_T): New method. Reports error based on the error table.
5051 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
5052 verifications are done here.
5054 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
5056 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
5057 CLSCompliantAttribute.
5058 (all_imported_types): New member holds all imported types from other
5060 (LoadAllImportedTypes): New method fills static table with exported types
5061 from all referenced assemblies.
5062 (Modules): New property returns all assembly modules.
5064 2004-03-30 Miguel de Icaza <miguel@ximian.com>
5066 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
5067 throwing a parser error.
5069 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
5070 which removes the hardcoded get_/set_ prefixes for properties, as
5071 IL allows for the properties to be named something else.
5075 * expression.cs: Do not override operand before we know if it is
5078 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5080 * typemanager.cs: support for pinned variables.
5082 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5084 * decl.cs, typemanager.cs: Avoid using an arraylist
5085 as a buffer if there is only one result set.
5087 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5089 * expression.cs: Make sure you cant call a static method
5090 with an instance expression, bug #56174.
5092 2004-03-29 Miguel de Icaza <miguel@ximian.com>
5094 * class.cs (IsDuplicateImplementation): Improve error reporting to
5095 flag 663 (method only differs in parameter modifier).
5097 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
5098 in preprocessor directives.
5100 * location.cs (LookupFile): Allow for the empty path.
5102 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
5103 better approach for some of that patch, but its failing with the
5104 CharSet enumeration. For now try/catch will do.
5106 * typemanager.cs: Do not crash if a struct does not have fields.
5109 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5111 * expression.cs: cs0213, cant fix a fixed expression.
5114 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5116 * cs-parser.jay: detect invalid embeded statements gracefully.
5119 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5121 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
5124 the invocation type may not be a subclass of the tye of the item/
5125 The type of the item must be a subclass of the invocation item.
5130 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
5132 * attribute.cs: Added methods to get a string and a bool from an
5133 attribute. Required to information from AssemblyKeyFileAttribute,
5134 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
5135 * codegen.cs: Modified AssemblyName creation to include support for
5136 strongnames. Catch additional exceptions to report them as CS1548.
5137 * compiler.csproj: Updated include CryptoConvert.cs.
5138 * compiler.csproj.user: Removed file - user specific configuration.
5139 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
5140 Mono.Security assembly. The original class is maintained and tested in
5141 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
5142 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
5143 like CSC 8.0 (C# v2) supports.
5144 * Makefile: Added CryptoConvert.cs to mcs sources.
5145 * rootcontext.cs: Added new options for strongnames.
5147 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
5149 * driver.cs: For --expect-error, report error code `2'
5150 if the program compiled with no errors, error code `1' if
5151 it compiled with an error other than the one expected.
5153 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
5155 * compiler.csproj: Updated for Visual Studio .NET 2003.
5156 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
5157 * compiler.sln: Updated for Visual Studio .NET 2003.
5159 2004-03-24 Ravi Pratap M <ravi@ximian.com>
5161 * expression.cs: Fix bug #47234. We basically need to apply the
5162 rule that we prefer the conversion of null to a reference type
5163 when faced with a conversion to 'object' (csc behaviour).
5165 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5167 * statement.cs: Shorter form for foreach, eliminates
5168 a local variable. r=Martin.
5170 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5172 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
5173 checks if we can use brtrue/brfalse to test for 0.
5174 * expression.cs: use the above in the test for using brtrue/brfalse.
5177 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5179 * expression.cs: Rewrite string concat stuff. Benefits:
5181 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
5182 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
5183 rather than a concat chain.
5185 * typemanager.cs: Add lookups for more concat overloads.
5187 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5189 * expression.cs: Emit shorter il code for array init.
5206 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
5208 * statement.cs: Before, two switch blocks would be merged if the
5209 total size of the blocks (end_item - begin_item + 1) was less than
5210 two times the combined sizes of the blocks.
5212 Now, it will only merge if after the merge at least half of the
5217 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
5219 * class.cs : csc build fix for GetMethods(). See bug #52503.
5221 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
5223 * expression.cs: Make sure fp comparisons work with NaN.
5224 This fixes bug #54303. Mig approved this patch a long
5225 time ago, but we were not able to test b/c the runtime
5228 2004-03-19 Miguel de Icaza <miguel@ximian.com>
5230 * ecore.cs (TypExpr.GetHashCode): implement this overload.
5232 2004-03-19 Martin Baulig <martin@ximian.com>
5234 * class.cs (MemberCore.IsDuplicateImplementation): Check whether
5235 two overloads may unify for some type parameter substitutions and
5236 report a CS0408 if appropriate.
5238 2004-03-19 Martin Baulig <martin@ximian.com>
5240 * class.cs (MemberCore.IsDuplicateImplementation): Report the
5241 error here and not in our caller.
5243 2004-03-19 Martin Baulig <martin@ximian.com>
5245 * interface.cs: Completely killed this file.
5246 (Interface): We're now a TypeContainer and live in class.cs.
5248 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
5249 argument; we're now also called for interfaces.
5250 (TypeContainer.DefineMembers): Allow this method being called
5252 (TypeContainer.GetMethods): New public method; formerly known as
5253 Interface.GetMethod(). This is used by PendingImplementation.
5254 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
5255 it's now private and non-static.
5256 (Interface): Moved this here; it's now implemented similar to
5258 (Method, Property, Event, Indexer): Added `bool is_interface'
5259 argument to their .ctor's.
5260 (MemberBase.IsInterface): New public field.
5262 * cs-parser.jay: Create normal Method, Property, Event, Indexer
5263 instances instead of InterfaceMethod, InterfaceProperty, etc.
5264 (opt_interface_base): Removed; we now use `opt_class_base' instead.
5265 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
5267 2004-03-19 Martin Baulig <martin@ximian.com>
5269 * class.cs (MethodCore.IsDuplicateImplementation): New private
5270 method which does the CS0111 checking.
5271 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
5272 Use IsDuplicateImplementation().
5274 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
5276 * decl.cs (FindMemberToOverride): New method to find the correct
5277 method or property to override in the base class.
5279 - Make Method/Property use the above method to find the
5280 version in the base class.
5281 - Remove the InheritableMemberSignatureCompare as it is now
5284 This patch makes large code bases much faster to compile, as it is
5285 O(n) rather than O(n^2) to do this validation.
5287 Also, it fixes bug 52458 which is that nested classes are not
5288 taken into account when finding the base class member.
5290 Reviewed/Approved by Martin.
5292 2004-03-17 Martin Baulig <martin@ximian.com>
5294 * expression.cs (MemberAccess.DoResolve): Take the parent's number
5295 of type arguments into account; use the `real_num_type_args'
5296 approach like in DoResolveAsTypeStep().
5298 * generic.cs (GenericMemberAccess.DoResolve): Make this work for
5301 2004-03-17 Marek Safar <marek.safar@seznam.cz>
5303 * interface.cs: In all interface classes removed redundant
5304 member initialization.
5306 2004-03-16 Martin Baulig <martin@ximian.com>
5308 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
5310 2004-03-15 Miguel de Icaza <miguel@ximian.com>
5312 * decl.cs (DefineTypeAndParents): New helper method to define a
5313 type's containers before the type itself is defined; This is a
5314 bug exposed by the recent changes to Windows.Forms when an
5315 implemented interface was defined inside a class that had not been
5318 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
5320 (Check): Loop correctly to report errors modifiers
5321 (UNSAFE was not in the loop, since it was the same as TOP).
5323 * interface.cs: Every interface member now takes a ModFlags,
5324 instead of a "is_new" bool, which we set on the base MemberCore.
5326 Every place where we called "UnsafeOk" in the interface, now we
5327 call the proper member (InterfaceMethod.UnsafeOK) instead to get
5328 the unsafe settings from the member declaration instead of the
5329 container interface.
5331 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
5333 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
5334 `set_indexer_name' to the pending bits (one per type).
5336 We fixed a bug today that was picking the wrong method to
5337 override, since for properties the existing InterfaceMethod code
5338 basically ignored the method name. Now we make sure that the
5339 method name is one of the valid indexer names.
5341 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
5343 * support.cs (SeekableStreamReader): Keep track of stream byte
5344 positions and don't mix them with character offsets to the buffer.
5346 Patch from Gustavo Giráldez
5348 2004-03-15 Marek Safar <marek.safar@seznam.cz>
5350 * interface.cs (InterfaceSetGetBase): Removed double member
5351 initialization, base class does it as well.
5353 2004-03-13 Martin Baulig <martin@ximian.com>
5355 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
5356 when compiling corlib.
5358 2004-03-13 Miguel de Icaza <miguel@ximian.com>
5360 * convert.cs (ExplicitConversion): We were reporting an error on
5361 certain conversions (object_type source to a value type, when the
5362 expression was `null') before we had a chance to pass it through
5363 the user defined conversions.
5365 * driver.cs: Replace / and \ in resource specifications to dots.
5368 * class.cs: Add check for duplicate operators. Fixes 52477
5370 2004-03-11 Miguel de Icaza <miguel@ximian.com>
5372 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
5373 that are in the middle of the statements, not only at the end.
5376 * class.cs (TypeContainer.AddField): No longer set the
5377 `HaveStaticConstructor' flag, now we call it
5378 `UserDefineStaticConstructor' to diferentiate the slightly
5379 semantic difference.
5381 The situation is that we were not adding BeforeFieldInit (from
5382 Modifiers.TypeAttr) to classes that could have it.
5383 BeforeFieldInit should be set to classes that have no static
5388 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
5390 And most importantly Zoltan's comment:
5392 http://bugzilla.ximian.com/show_bug.cgi?id=44229
5394 "I think beforefieldinit means 'it's ok to initialize the type sometime
5395 before its static fields are used', i.e. initialization does not need
5396 to be triggered by the first access to the type. Setting this flag
5397 helps the JIT to compile better code, since it can run the static
5398 constructor at JIT time, and does not need to generate code to call it
5399 (possibly lots of times) at runtime. Unfortunately, mcs does not set
5400 this flag for lots of classes like String.
5402 csc sets this flag if the type does not have an explicit static
5403 constructor. The reasoning seems to be that if there are only static
5404 initalizers for a type, and no static constructor, then the programmer
5405 does not care when this initialization happens, so beforefieldinit
5408 This bug prevents the AOT compiler from being usable, since it
5409 generates so many calls to mono_runtime_class_init that the AOT code
5410 is much slower than the JITted code. The JITted code is faster,
5411 because it does not generate these calls if the vtable is type is
5412 already initialized, which is true in the majority of cases. But the
5413 AOT compiler can't do this."
5415 2004-03-10 Miguel de Icaza <miguel@ximian.com>
5417 * class.cs (MethodData.Emit): Refactor the code so symbolic
5418 information is generated for destructors; For some reasons we
5419 were taking a code path that did not generate symbolic information
5422 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
5424 * class.cs: Create a Constructor.CheckBase method that
5425 takes care of all validation type code. The method
5426 contains some code that was moved from Define.
5428 It also includes new code that checks for duplicate ctors.
5429 This fixes bug #55148.
5431 2004-03-09 Joshua Tauberer <tauberer@for.net>
5433 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
5434 a { ... }-style array creation invokes EmitStaticInitializers
5435 which is not good for reference-type arrays. String, decimal
5436 and now null constants (NullCast) are not counted toward
5437 static initializers.
5439 2004-03-05 Martin Baulig <martin@ximian.com>
5441 * location.cs (SourceFile.HasLineDirective): New public field;
5442 specifies whether the file contains or is referenced by a "#line"
5444 (Location.DefineSymbolDocuments): Ignore source files which
5445 either contain or are referenced by a "#line" directive.
5447 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
5449 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
5450 direct access to our parent, so check the method inline there.
5452 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
5454 * expression.cs (Invocation.EmitCall): Miguel's last commit
5455 caused a regression. If you had:
5460 In Foo the implict this would be null.
5462 2004-02-27 Miguel de Icaza <miguel@ximian.com>
5464 * expression.cs (Invocation.EmitCall): If the method is not
5465 virtual, do not emit a CallVirt to it, use Call.
5467 * typemanager.cs (GetFullNameSignature): Improve the method to
5468 cope with ".ctor" and replace it with the type name.
5470 * class.cs (ConstructorInitializer.Resolve): Now the method takes
5471 as an argument the ConstructorBuilder where it is being defined,
5472 to catch the recursive constructor invocations.
5474 2004-03-16 Martin Baulig <martin@ximian.com>
5476 * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
5477 ConstructedType, call ResolveType() on it to get the type rather
5478 than just using `expr.Type'.
5480 2004-03-16 Martin Baulig <martin@ximian.com>
5482 * generics.cs (ConstructedType.GetMemberAccess): Take the
5483 EmitContext instead on the TypeExpr and use
5484 ec.TypeContainer.CurrentType/ec.ContainerType.
5486 2004-03-16 Martin Baulig <martin@ximian.com>
5488 * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
5489 parameters before aliases.
5491 2004-03-16 Martin Baulig <martin@ximian.com>
5493 * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
5494 New oublic function; checks whether two generic instances may become
5495 equal under some instantiations (26.3.1).
5497 * class.cs (TypeContainer.Define): Call
5498 TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
5501 2004-03-16 Martin Baulig <martin@ximian.com>
5503 * class.cs (TypeContainer.GetClassBases): Moved
5504 Error_TypeParameterAsBase() here and also check whether the base
5505 class is not an attribute.
5507 2004-03-16 Martin Baulig <martin@ximian.com>
5509 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
5511 2004-03-16 Martin Baulig <martin@ximian.com>
5513 * class.cs (Error_TypeParameterAsBase): Use correct error number
5516 2004-03-16 Martin Baulig <martin@ximian.com>
5518 * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
5521 * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
5524 2004-03-15 Martin Baulig <martin@ximian.com>
5526 * typemanager.cs (TypeManager.GetFullName): New public method.
5527 (TypeManager.MemberLookup): Added `int_num_type_arguments'
5528 argument; only return members with the correct number of type
5530 (TypeManager.CheckGeneric): Allow -1 to bypass the check.
5531 (TypeManager.FilterWithClosure): Call CheckGeneric() to check
5532 whether the number of type arguments matches.
5534 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
5535 not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
5537 * expression.cs (MemberAccess): Added public `NumTypeArguments'
5538 field; it's set by the protected .ctor when we're actually a
5539 GenericMemberAccess.
5540 (MemberAccess.ResolveAsTypeStep): Compute the total number of type
5541 arguments and pass it to MemberLookupFinal ().
5543 * ecore.cs (Expression.MemberLookup): Added `int
5544 num_type_arguments' argument; only return members with the correct
5545 number of type arguments.
5546 (Expression.MemberLookupFailed): Check whether the MemberLookup
5547 failed because we did not have the correct number of type
5548 arguments; report CS0305 in this case.
5550 * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
5551 `e.ResolveAsTypeTerminal()' already did so.
5553 2004-03-15 Martin Baulig <martin@ximian.com>
5555 * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
5556 we're a ConstructedType; in this case, the caller must report an
5557 error (for instance CS0131).
5559 * generic.cs (TypeArguments): Added Location argument to the .ctor.
5560 (TypeArguments.Resolve): Actually report errors here.
5562 2004-03-15 Miguel de Icaza <miguel@ximian.com>
5564 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
5565 `set_indexer_name' to the pending bits (one per type).
5567 We fixed a bug today that was picking the wrong method to
5568 override, since for properties the existing InterfaceMethod code
5569 basically ignored the method name. Now we make sure that the
5570 method name is one of the valid indexer names.
5572 2004-03-15 Martin Baulig <martin@ximian.com>
5574 * typemanager.cs (TypeManager.IndexerPropertyName): Added support
5575 for generic instances.
5577 2004-03-13 Martin Baulig <martin@ximian.com>
5579 * class.cs (TypeContainer.DefineType): Call
5580 TypeManager.AddUserType() immediately after creating the
5581 TypeBuilder; pass all type parameters when creating the
5584 * decl.cs (DeclSpace.FindNestedType): New public method.
5585 (DeclSpace.FindType): Added `int num_type_args' argument; only
5586 return types with the correct number of type parameters.
5587 (DeclSpace.CountTypeParams): New public property.
5589 * ecore.cs (SimpleName.ctor): Added overloaded version which takes
5590 the number of type parameters; defaults to zero.
5592 * generic.cs (TypeArguments.Count): New public property.
5593 (ConstructedType.DoResolveAsTypeStep): First call
5594 ds.FindNestedType() to find out whether we're nested in the
5595 current generic type; in this case, we inherit all type parameters
5596 from the current class.
5598 * rootcontext.cs (RootContext.NamespaceLookup): Added `int
5599 num_type_args' argument.
5600 (RootContext.LookupType): Added overloaded version which takes the
5601 number of type arguments; only return types with the correct
5602 number of type arguments.
5604 * typemanager.cs (TypeManager.CheckGeneric): New public function;
5605 checks whether `Type t' has `int num_type_args'.
5607 2004-03-13 Martin Baulig <martin@ximian.com>
5609 * generic.cs (GenericMethod.DefineType): New method; calls
5610 DefineType() on all the type parameters.
5612 * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
5613 (MethodData.Define): If we're a generic method, call
5614 GenericMethod.DefineType() to define the type parameters.
5616 2004-03-10 Martin Baulig <martin@ximian.com>
5618 * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
5619 instead of IsAssignableFrom.
5621 2004-03-10 Martin Baulig <martin@ximian.com>
5623 * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
5625 * support.cs (ParameterData.HasArrayParameter): New property.
5626 (ReflectionParameters.ctor): Take a MethodBase instead of a
5627 ParameterInfo[]. If we have any type parameters, get the generic
5628 method definition and ask it whether we have variable arguments.
5630 2004-02-26 Miguel de Icaza <miguel@ximian.com>
5632 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
5633 routines to check if a type is an enumerable/enumerator allow
5634 classes that implement the IEnumerable or IEnumerator interfaces.
5636 * class.cs (Property, Operator): Implement IIteratorContainer, and
5637 implement SetYields.
5639 (Property.Define): Do the block swapping for get_methods in the
5640 context of iterators. We need to check if Properties also
5641 include indexers or not.
5643 (Operator): Assign the Block before invoking the
5644 OperatorMethod.Define, so we can trigger the Iterator code
5647 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
5648 Property and Operator classes are not created when we parse the
5649 declarator but until we have the block completed, so we use a
5650 singleton SimpleIteratorContainer.Simple to flag whether the
5651 SetYields has been invoked.
5653 We propagate this setting then to the Property or the Operator to
5654 allow the `yield' to function.
5656 2004-02-25 Marek Safar <marek.safar@seznam.cz>
5658 * codegen.cs: Implemented attribute support for modules.
5659 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
5660 Assembly/Module functionality.
5662 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
5663 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
5664 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
5666 2004-02-16 Marek Safar <marek.safar@seznam.cz>
5668 * interface.cs (FindMembers): The operation is performed on all base
5669 interfaces and not only on the first. It is required for future CLS Compliance patch.
5671 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
5673 * statement.cs, codegen.cs:
5674 This patch deals with patterns such as:
5676 public class List : IEnumerable {
5678 public MyEnumerator GetEnumerator () {
5679 return new MyEnumerator(this);
5682 IEnumerator IEnumerable.GetEnumerator () {
5686 public struct MyEnumerator : IEnumerator {
5691 Before, there were a few things we did wrong:
5692 1) we would emit callvirt on a struct, which is illegal
5693 2) we emited ldarg when we needed to emit ldarga
5694 3) we would mistakenly call the interface methods on an enumerator
5695 type that derived from IEnumerator and was in another assembly. For example:
5697 public class MyEnumerator : IEnumerator
5699 Would have the interface methods called, even if there were public impls of the
5700 method. In a struct, this lead to invalid IL code.
5702 2004-02-11 Marek Safar <marek.safar@seznam.cz>
5704 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
5707 * delegate.cs (Define): Fixed crash when delegate type is undefined.
5709 2004-02-11 Miguel de Icaza <miguel@ximian.com>
5711 * cs-parser.jay: Fix small regression: we were not testing V2
5712 compiler features correctly.
5714 * interface.cs: If the emit context is null, then create one
5716 2004-02-09 Marek Safar <marek.safar@seznam.cz>
5718 * decl.cs (GetSignatureForError): New virtual method to get full name
5721 * attribute.cs (IAttributeSupport): New interface for attribute setting.
5722 Now it is possible to rewrite ApplyAttributes method to be less if/else.
5724 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
5725 Duplicated members and code in these classes has been removed.
5726 Better encapsulation in these classes.
5728 2004-02-07 Miguel de Icaza <miguel@ximian.com>
5730 * assign.cs (Assign.DoResolve): When dealing with compound
5731 assignments, there is a new rule in ECMA C# 2.4 (might have been
5732 there before, but it is documented here) that states that in:
5736 If b is of type int, and the `op' is a shift-operator, then the
5737 above is evaluated as:
5741 * expression.cs (Binary.ResolveOperator): Instead of testing for
5742 int/uint/long/ulong, try to implicitly convert to any of those
5743 types and use that in pointer arithmetic.
5745 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
5746 method to print information for from the type, not from the
5747 null-method we were given.
5749 2004-02-01 Duncan Mak <duncan@ximian.com>
5751 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
5752 parsing for cmd, fixes bug #53694.
5754 2004-02-04 Marek Safar <marek.safar@seznam.cz>
5756 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
5757 in the member name duplication tests. Property and operator name duplication
5758 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
5760 2004-02-03 Marek Safar <marek.safar@seznam.cz>
5762 * interface.cs (PopulateMethod): Fixed crash when interface method
5763 returns not existing type (error test cs0246-3.cs).
5765 2004-02-02 Ravi Pratap M <ravi@ximian.com>
5767 * cs-parser.jay (interface_accessors): Re-write actions to also
5768 store attributes attached to get and set methods. Fix spelling
5771 (inteface_property_declaration): Modify accordingly.
5773 (InterfaceAccessorInfo): New helper class to store information to pass
5774 around between rules that use interface_accessors.
5776 * interface.cs (Emit): Apply attributes on the get and set
5777 accessors of properties and indexers too.
5779 * attribute.cs (ApplyAttributes): Modify accordingly to use the
5780 right MethodBuilder when applying attributes to the get and set accessors.
5782 2004-01-31 Miguel de Icaza <miguel@ximian.com>
5784 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
5786 2004-01-26 Miguel de Icaza <miguel@ximian.com>
5788 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
5790 2004-01-25 Miguel de Icaza <miguel@ximian.com>
5792 * cs-parser.jay: Remove YIELD token, instead use the new grammar
5793 changes that treat `yield' specially when present before `break'
5796 * cs-tokenizer.cs: yield is no longer a keyword.
5798 2004-01-23 Marek Safar <marek.safar@seznam.cz>
5800 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
5801 setting for default constructors.
5802 For default constructors are almost every time set wrong Modifier. The
5803 generated IL code has been alright. But inside mcs this values was
5804 wrong and this was reason why several of my CLS Compliance tests
5807 2004-02-27 Martin Baulig <martin@ximian.com>
5809 * generics.cs (ConstructedType.ResolveType): Make the nested type
5810 stuff actually work.
5812 2004-02-25 Martin Baulig <martin@ximian.com>
5814 * decl.cs (DeclSpace.CurrentTypeParameters): New protected
5815 property; returns the type parameters just from the current type,
5816 ie. with the ones from outer classes.
5817 (DeclSpace.LookupGeneric): First search in the current class, then
5819 (DeclSpace.initialize_type_params): When hiding a type parameter
5820 from an outer class, put it into the `type_param_list' anyways.
5822 * expression.cs (MemberAccess.expr): Made this field protected.
5824 * class.cs (TypeContainer.Define): The `CurrentType' just contains
5825 the type parameters from the current class.
5827 * generic.cs (ConstructedType.ResolveType): Support nested generic
5828 types by taking the type parameters which we inherit from outer
5829 classes into account.
5830 (GenericMemberAccess.ResolveAsTypeStep): Override this and added
5831 support for nested generic types.
5833 2004-02-23 Martin Baulig <martin@ximian.com>
5835 * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
5836 field and check whether we're nested inside a generic type.
5837 (DeclSpace.ResolveType): If we're resolving to a generic type
5838 definition, create a ConstructedType and return its resolved type.
5839 (DeclSpace.initialize_type_params): New private method;
5840 initializes the `type_param_list' field from the type parameters
5841 from this and all enclosing classes.
5842 (DeclSpace.TypeParameters): Call initialize_type_params() unless
5843 we're already initialized.
5845 2004-02-23 Martin Baulig <martin@ximian.com>
5847 * class.cs (Method.Define): Create the generic method before
5849 (Memberbase.DoDefine): Added DeclSpace argument (in addition to
5850 the TypeContainer one); we use this for generic methods.
5852 * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
5853 parent's TypeBuilder.
5855 2004-02-18 Martin Baulig <martin@ximian.com>
5857 * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
5858 to check for equality.
5860 2004-02-05 Martin Baulig <martin@ximian.com>
5862 * ecore.cs (FieldExpr.DoResolveLValue): If we have an
5863 `ec.TypeContainer.CurrentType', use it instead of
5864 `ec.ContainerType' to check whether we're in the type's ctor.
5866 2004-01-29 Martin Baulig <martin@ximian.com>
5868 * expression.cs (Invocation.DoResolve): If we're a
5869 `ConstructedType', then we're actually a generic method, so
5870 rewrite the expr as a GenericMemberAccess.
5872 * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
5873 here; manually parse it into a string.
5875 2004-01-28 Martin Baulig <martin@ximian.com>
5877 * typemanager.cs (TypeManager.IsEqual): New static method.
5878 (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
5879 check for equality instead of using `=='.
5881 2004-01-26 Martin Baulig <martin@ximian.com>
5883 * decl.cs (DeclSpace.CurrentType): New public field.
5885 * expression.cs (This.ResolveBase): If we have an
5886 `ec.TypeContainer.CurrentType', use it instead of
5889 * class.cs (TypeContainer.DefineType): If we're a generic type,
5890 create the `CurrentType' (unresolved).
5891 (TypeContainer.GenericType): New private field.
5892 (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
5893 it and store it in `GenericType' before creating the MemberCache.
5894 (TypeContainer.GetMembers): If we have a `GenericType', call
5895 TypeManager.FindMembers() on it.
5897 * interface.cs (Interface.GenericType): New private field.
5898 (Interface.DefineType): If we're a generic type, create the
5899 `CurrentType' (unresolved).
5900 (Interface.DefineMembers): If we have a `CurrentType', resolve it
5901 and store it in `GenericType' before creating the MemberCache.
5902 (Interface.GetMembers): If we have a `GenericType', call
5903 TypeManager.FindMembers() on it.
5905 2004-01-22 Martin Baulig <martin@ximian.com>
5907 * cs-parser.jay (namespace_or_type_name): Return an Expression,
5908 not a QualifiedIdentifier. This is what `type_name_expression'
5909 was previously doing.
5910 (type_name_expression): Removed; the code is now in
5911 `namespace_or_type_name'.
5912 (qualified_identifier): Removed, use `namespace_or_type_name'
5914 (QualifiedIdentifier): Removed this class.
5916 2004-01-22 Martin Baulig <martin@ximian.com>
5918 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
5919 not a string as alias name.
5921 2004-01-21 Miguel de Icaza <miguel@ximian.com>
5923 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
5924 #52730 bug, and instead compute correctly the need to use a
5925 temporary variable when requesting an address based on the
5926 static/instace modified of the field and the constructor.
5928 2004-01-21 Martin Baulig <martin@ximian.com>
5930 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
5931 class and namespace before looking up aliases. Fixes #52517.
5933 2004-01-21 Martin Baulig <martin@ximian.com>
5935 * flowanalysis.cs (UsageVector.Merge): Allow variables being
5936 assinged in a 'try'; fixes exception4.cs.
5938 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5939 * class.cs : Implemented parameter-less constructor for TypeContainer
5941 * decl.cs: Attributes are now stored here. New property OptAttributes
5943 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
5945 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
5947 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5949 * typemanager.cs (CSharpSignature): Now reports also inner class name.
5950 (CSharpSignature): New method for indexer and property signature.
5952 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5954 * pending.cs (IsVirtualFilter): Faster implementation.
5956 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5958 * typemanager.cs: Avoid inclusion of same assembly more than once.
5960 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5962 * cs-parser.jay: Fixed problem where the last assembly attribute
5963 has been applied also to following declaration (class, struct, etc.)
5965 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5967 * class.cs: Added error CS0538, CS0539 reporting.
5968 Fixed crash on Microsoft runtime when field type is void.
5970 * cs-parser.jay: Added error CS0537 reporting.
5972 * pending.cs: Added error CS0535 reporting.
5973 Improved error report for errors CS0536, CS0534.
5975 2004-01-20 Miguel de Icaza <miguel@ximian.com>
5977 Merge a few bits from the Anonymous Method MCS tree.
5979 * statement.cs (ToplevelBlock): New class for toplevel methods,
5980 will hold anonymous methods, lifted variables.
5982 * cs-parser.jay: Create toplevel blocks for delegates and for
5983 regular blocks of code.
5985 2004-01-20 Martin Baulig <martin@ximian.com>
5987 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
5988 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
5989 and `NeedExplicitReturn'; added `IsLastStatement'.
5990 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
5991 have a `ReturnLabel' or we're not unreachable.
5993 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
5994 child's reachability; don't just override ours with it. Fixes
5995 #58058 (lluis's example).
5996 (FlowBranching): Added public InTryOrCatch(), InCatch(),
5997 InFinally(), InLoop(), InSwitch() and
5998 BreakCrossesTryCatchBoundary() methods.
6000 * statement.cs (Return): Do all error checking in Resolve().
6001 Unless we are the last statement in a top-level block, always
6002 create a return label and jump to it.
6003 (Break, Continue): Do all error checking in Resolve(); also make
6004 sure we aren't leaving a `finally'.
6005 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
6006 statement in a top-level block.
6007 (Block.Flags): Added `IsDestructor'.
6008 (Block.IsDestructor): New public property.
6010 2004-01-20 Martin Baulig <martin@ximian.com>
6012 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
6014 2004-01-20 Martin Baulig <martin@ximian.com>
6016 * statement.cs (Statement.ResolveUnreachable): New public method.
6017 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
6018 (Block.Resolve): Resolve unreachable statements.
6020 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
6022 * expression.cs: We need to fix the case where we do
6023 not have a temp variable here.
6025 * assign.cs: Only expression compound assignments need
6026 temporary variables.
6028 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
6030 * flowanalysis.cs: Reduce memory allocation in a few ways:
6031 - A block with no variables should not allocate a bit
6033 - A method with no out parameters does not need any tracking
6034 for assignment of the parameters, so we need not allocate
6037 public readonly Type[] VariableTypes;
6038 public readonly string[] VariableNames;
6039 Are redundant. The data is already stored in the variable
6040 map, so we need not allocate another array for it.
6041 - We need to add alot of checks for if (params | locals) == null
6042 due to the first two changes.
6044 2004-01-18 Miguel de Icaza <miguel@ximian.com>
6046 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
6047 implement IMemoryLocation, we store a copy on a local variable and
6048 take the address of it. Patch from Benjamin Jemlich
6050 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
6051 to use a special "type_name_expression" rule which reduces the
6052 number of "QualifiedIdentifier" classes created, and instead
6053 directly creates MemberAccess expressions.
6055 2004-01-17 Miguel de Icaza <miguel@ximian.com>
6057 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
6058 that fixes #52853. Null literal assignment to ValueType
6060 * class.cs (MethodData.Emit): Instead of checking the name of the
6061 method to determine if its a destructor, create a new derived
6062 class from Method called Destructor, and test for that.
6064 * cs-parser.jay: Create a Destructor object instead of a Method.
6066 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
6070 2004-01-16 Miguel de Icaza <miguel@ximian.com>
6072 * expression.cs (Binary.ResolveOperator): Perform an implicit
6073 conversion from MethodGroups to their delegate types on the
6076 * delegate.cs: Introduce a new class DelegateCreation that is the
6077 base class for `NewDelegate' and `ImplicitDelegateCreation',
6078 factor some code in here.
6080 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
6081 conversion from MethodGroups to compatible delegate types.
6083 * ecore.cs (Expression.Resolve): Do not flag error 654
6084 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
6085 we allow conversions from MethodGroups to delegate types now.
6087 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
6088 assignments in v2 either.
6090 2004-01-10 Miguel de Icaza <miguel@ximian.com>
6092 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
6093 static read-only fields in ctors.
6095 Applied patch from Benjamin Jemlich
6097 * expression.cs (UnaryMutator): Avoid leaking local variables.
6099 2004-01-09 Miguel de Icaza <miguel@ximian.com>
6101 * cs-tokenizer.cs (IsCastToken): Allow the various native types
6102 here to return true, as they can be used like this:
6106 Fixed 49836 and all the other dups
6108 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
6110 * driver.cs: Implement /win32res and /win32icon.
6112 2004-01-08 Miguel de Icaza <miguel@ximian.com>
6114 * cs-parser.jay: Add a rule to improve error handling for the
6115 common mistake of placing modifiers after the type.
6117 2004-01-07 Miguel de Icaza <miguel@ximian.com>
6119 * cs-parser.jay (interface_event_declaration): Catch
6120 initialization of events on interfaces, and report cs0068
6122 * cs-parser.jay (interface_event_declaration): Catch
6123 initialization of events.
6125 * ecore.cs: Better report missing constructors.
6127 * expression.cs (Binary.ResolveOperator): My previous bug fix had
6128 the error reporting done in the wrong place. Fix.
6130 * expression.cs (Binary.ResolveOperator): Catch the
6131 operator + (E x, E y) error earlier, and later allow for implicit
6132 conversions in operator +/- (E e, U x) from U to the underlying
6135 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
6136 52596, if the container class is abstract, the default constructor
6137 is protected otherwise its public (before, we were always public).
6139 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
6142 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
6143 Jemlich that fixes bug #52597, MCS was generating invalid code for
6144 idisposable structs. Thanks to Ben for following up with this
6147 2004-01-06 Miguel de Icaza <miguel@ximian.com>
6149 * driver.cs: Allow assemblies without code to be generated, fixes
6152 2004-01-07 Nick Drochak <ndrochak@gol.com>
6154 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
6156 2004-01-05 Miguel de Icaza <miguel@ximian.com>
6158 * cs-parser.jay: Add rules to improve error reporting if fields or
6159 methods are declared at the namespace level (error 116)
6161 * Add rules to catch event add/remove
6163 2004-01-04 David Sheldon <dave-mono@earth.li>
6165 * expression.cs: Added matching ")" to error message for
6168 2004-01-03 Todd Berman <tberman@gentoo.org>
6170 * ecore.cs, attribute.cs:
6171 Applying fix from #52429.
6173 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6175 * ecore.cs, expression.cs, statement.cs:
6176 Total rewrite of how we handle branching. We
6177 now handle complex boolean expressions with fewer
6178 jumps. As well if (x == 0) no longer emits a ceq.
6180 if (x is Foo) is much faster now, because we generate
6183 Overall, we get a pretty big improvement on our benchmark
6184 tests. The code we generate is smaller and more readable.
6186 I did a full two-stage bootstrap. The patch was reviewed
6187 by Martin and Miguel.
6189 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6191 * cs-parser.jay: Make primary_expression not take a QI.
6192 we dont need this because the member_access rule covers
6193 us here. So we replace the rule with just IDENTIFIER.
6195 This has two good effects. First, we remove a s/r conflict.
6196 Second, we allocate many fewer QualifiedIdentifier objects.
6198 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6200 * attribute.cs: Handle MarshalAs attributes as pseudo, and
6201 set the correct information via SRE. This prevents
6202 hanging on the MS runtime. Fixes #29374.
6204 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6206 * convert.cs: correctly handle conversions to value types
6207 from Enum and ValueType as unboxing conversions.
6209 Fixes bug #52569. Patch by Benjamin Jemlich.
6211 2004-01-02 Ravi Pratap <ravi@ximian.com>
6213 * expression.cs (BetterConversion): Prefer int -> uint
6214 over int -> ulong (csc's behaviour). This fixed bug #52046.
6216 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
6218 * decl.cs (MemberCache.FindMembers): now returns a
6221 * typemanager.cs: In general, go with with ^^.
6222 (CopyNewMethods): take an IList.
6223 (RealMemberLookup): Only allocate an arraylist
6224 if we copy from two sets of methods.
6226 This change basically does two things:
6227 1) Fewer array lists allocated due to CopyNewMethods.
6228 2) the explicit cast in MemberList costed ALOT.
6230 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
6232 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
6233 a hashtable to avoid needless string allocations when an identifier is
6234 used more than once (the common case).
6236 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6238 * pending.cs: MS's TypeBuilder.GetInterfaces ()
6239 is broken, it will not return anything. So, we
6240 have to use the information we have in mcs to
6243 * typemanager.cs: Add a cache for GetInterfaces,
6244 since this will now be used more often (due to ^^)
6246 (GetExplicitInterfaces) New method that gets the
6247 declared, not effective, interfaces on a type
6248 builder (eg, if you have interface IFoo, interface
6249 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
6252 This patch makes MCS able to bootstrap itself on
6255 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6257 * expression.cs: Remove the Nop's that Miguel put
6260 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6262 * report.cs, codegen.cs: Give the real stack trace to
6263 the error when an exception is thrown.
6265 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6267 * decl.cs: only allocate hashtables for ifaces if
6270 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6272 * expression.cs: fix the error from cs0121-2.cs
6273 (a parent interface has two child interfaces that
6274 have a function with the same name and 0 params
6275 and the function is called through the parent).
6277 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
6279 * class.cs, rootcontext.cs, typmanager.cs: do not
6282 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
6284 * codegen.cs: remove stack for the ec flow branching.
6285 It is already a linked list, so no need.
6287 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
6289 * Makefile: Allow custom profiler here.
6291 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6293 * typemanager.cs (LookupType):
6294 - Use a static char [], because split takes
6295 a param array for args, so it was allocating
6297 - Do not store true in a hashtable, it boxes.
6299 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6301 * flowanalysis.cs: bytify common enums.
6303 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6305 * modifiers.cs: Add a new set of flags for the
6306 flags allowed on explicit interface impls.
6307 * cs-parser.jay: catch the use of modifiers in
6308 interfaces correctly.
6309 * class.cs: catch private void IFoo.Blah ().
6311 All related to bug #50572.
6313 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6315 * decl.cs: Rewrite the consistant accessability checking.
6316 Accessability is not linear, it must be implemented in
6317 a tableish way. Fixes #49704.
6319 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6321 * expression.cs: Handle negation in a checked context.
6322 We must use subtraction from zero. Fixes #38674.
6324 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
6326 * class.cs: Ignore static void main in DLLs.
6327 * rootcontext.cs: Handle the target type here,
6328 since we are have to access it from class.cs
6329 * driver.cs: account for the above.
6331 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
6333 * report.cs: Give line numbers and files if available.
6335 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
6337 * driver.cs: Implement /addmodule.
6339 * typemanager.cs: Change 'modules' field so it now contains Modules not
6342 2003-12-20 Martin Baulig <martin@ximian.com>
6344 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
6345 (FieldBase.IsAssigned): Removed this field.
6346 (FieldBase.SetAssigned): New public method.
6347 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
6349 2003-12-20 Martin Baulig <martin@ximian.com>
6351 * expression.cs (LocalVariableReference.DoResolve): Don't set
6352 `vi.Used' if we're called from DoResolveLValue().
6354 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
6355 returns the usage vector it just merged into the current one -
6356 pass this one to UsageWarning().
6357 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
6358 of the `EmitContext', don't call this recursively on our children.
6360 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
6362 * driver.cs: Implement /target:module.
6364 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
6366 * support.cs (CharArrayHashtable): New helper class.
6368 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
6369 char arrays, not strings, so we can avoid creating a string in
6370 consume_identifier if the identifier is a keyword.
6372 2003-12-16 Martin Baulig <martin@ximian.com>
6374 * statement.cs (LocalInfo.Assigned): Removed this property.
6375 (LocalInfo.Flags): Removed `Assigned'.
6376 (LocalInfo.IsAssigned): New public method; takes the EmitContext
6377 and uses flow analysis.
6378 (Block.UsageWarning): Made this method private.
6379 (Block.Resolve): Call UsageWarning() if appropriate.
6381 * expression.cs (LocalVariableReference.DoResolve): Always set
6382 LocalInfo.Used here.
6384 2003-12-13 Martin Baulig <martin@ximian.com>
6386 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
6387 any value here; we're now using flow analysis to figure out
6388 whether a statement/block returns a value.
6390 2003-12-13 Martin Baulig <martin@ximian.com>
6392 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
6394 (FlowBranching.MergeFinally): Don't call
6395 `branching.CheckOutParameters()' here, this is called in
6397 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
6398 when adding the `finally' vector.
6400 2003-12-13 Martin Baulig <martin@ximian.com>
6403 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
6404 actually work and also fix #48962.
6406 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
6408 * decl.cs: Do not check System.Object for nested types,
6409 since we know it does not have any. Big bang for buck:
6414 corlib: 17.99 seconds
6418 corlib: 17.39 seconds
6420 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
6422 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
6423 time we are returning 0 members, so we save alot here.
6425 2003-12-11 Martin Baulig <martin@ximian.com>
6427 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
6428 `MergeChild()', also just take the `FlowBranching' as argument;
6429 call Merge() on it and return the result.
6430 (FlowBranching.Merge): We don't need to do anything if we just
6433 2003-12-11 Martin Baulig <martin@ximian.com>
6435 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
6436 them in an `ArrayList' to reduce memory usage. Thanks to Ben
6437 Maurer for this idea.
6439 2003-12-11 Martin Baulig <martin@ximian.com>
6441 * flowanalysis.cs (MergeResult): This class is now gone; we now
6442 use the `UsageVector' for this. The reason for this is that if a
6443 branching just has one sibling, we don't need to "merge" them at
6444 all - that's the next step to do.
6445 (FlowBranching.Merge): We now return a `UsageVector' instead of a
6448 2003-12-11 Martin Baulig <martin@ximian.com>
6450 Reworked flow analyis and made it more precise and bug-free. The
6451 most important change is that we're now using a special `Reachability'
6452 class instead of having "magic" meanings of `FlowReturns'. I'll
6453 do some more cleanups and optimizations and also add some more
6454 documentation this week.
6456 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
6457 largely reworked this class.
6458 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
6459 the new `Reachability' class instead of having "magic" values here.
6460 (FlowBranching): We're now using an instance of `Reachability'
6461 instead of having separate `Returns', `Breaks' etc. fields.
6463 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
6464 based on flow analysis; ignore the return value of block.Emit ().
6466 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
6468 * driver.cs typemanager.cs: Find the mono extensions to corlib even
6469 if they are private.
6471 2003-12-09 Martin Baulig <martin@ximian.com>
6473 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
6474 call them directly on the UsageVector.
6476 2003-12-09 Martin Baulig <martin@ximian.com>
6478 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
6479 Changed return type from `FlowReturns' to `Reachability'.
6481 2003-12-09 Martin Baulig <martin@ximian.com>
6483 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
6484 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
6485 `Reachable' fields with a single `Reachability' one.
6487 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6489 * class.cs (FindMembers): Remove foreach's.
6502 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6507 This patch does a few things:
6508 1. EmptyStatement is now a singleton, so it is never reallocated.
6509 2. All blah is EmptyStatement constructs have been changed to
6510 blah == EmptyStatement.Value, which is much faster and valid
6511 now that EmptyStatement is a singleton.
6512 3. When resolving a block, rather than allocating a new array for
6513 the non-empty statements, empty statements are replaced with
6514 EmptyStatement.Value
6515 4. Some recursive functions have been made non-recursive.
6516 Mainly the performance impact is from (3), however (1) and (2) are needed for
6517 this to work. (4) does not make a big difference in normal situations, however
6518 it makes the profile look saner.
6523 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6524 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6525 Total memory allocated: 56397 KB
6528 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
6529 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
6530 Total memory allocated: 55666 KB
6532 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6534 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
6535 than the hashtable in a hashtable version
6537 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
6538 we always end up concating a string. This results in a huge perf
6539 loss, because many strings have to be tracked by the GC. In this
6540 patch, we first use a hashtable that works with two keys, so that
6541 the strings do not need to be concat'ed.
6552 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6554 * Makefile: Add a new target `do-time' that does a quick and simple
6555 profile, leaving easy to parse output.
6557 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
6559 * codegen.cs (Init): Create the dynamic assembly with
6560 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
6562 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
6564 * support.cs: Make the PtrHashtable use only one
6565 instance of its comparer.
6567 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
6569 * typemanager.cs: Fix lookup of GetNamespaces.
6571 2003-11-29 Miguel de Icaza <miguel@ximian.com>
6573 * expression.cs: Removed redundant line.
6575 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
6576 ArrayLists, use for loops with bounds.
6578 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
6581 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
6582 arraylists, use for loop with bounds.
6584 The above three changes give us a 0.071 second performance
6585 improvement out of 3.294 seconds down to 3.223. On my machine
6586 the above changes reduced the memory usage by 1,387 KB during
6589 * cs-parser.jay (QualifiedIdentifier): New class used to represent
6590 QualifiedIdentifiers. Before we created a new string through
6591 concatenation, and mostly later on, the result would be
6592 manipulated by DecomposeQI through string manipulation.
6594 This reduced the compiler memory usage for bootstrapping from
6595 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
6596 compile times in 0.05 seconds.
6598 2003-11-28 Dick Porter <dick@ximian.com>
6600 * support.cs: Do string compares with the Invariant culture.
6608 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
6609 the comparison is done with the Invariant culture.
6611 2003-11-27 Miguel de Icaza <miguel@ximian.com>
6613 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
6614 GetEnumerator method.
6616 (ProbeCollectionType): Iterate starting at the most specific type
6617 upwards looking for a GetEnumerator
6619 * expression.cs: Shift count can be up to 31 for int/uint and 63
6622 2003-11-26 Miguel de Icaza <miguel@ximian.com>
6624 * statement.cs (Block.LookupLabel): Also look for the label on the
6625 children blocks. Use a hash table to keep track of visited
6628 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
6629 we actually did transform the other operand, otherwise fall back
6630 to the common codepath that casts to long.
6632 * cs-tokenizer.cs: Use the same code pattern as the int case.
6633 Maybe I should do the parsing myself, and avoid depending on the
6634 Parse routines to get this done.
6636 2003-11-25 Miguel de Icaza <miguel@ximian.com>
6638 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
6639 which fixes bug 51347. This time test it.
6641 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
6642 attributes for example can not tell the difference between these.
6643 The difference was only a syntax feature of the language.
6645 * attribute.cs: Apply attributes to delegates.
6647 * delegate.cs: Call the apply attributes method.
6649 2003-11-24 Miguel de Icaza <miguel@ximian.com>
6651 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
6652 comparing 0 vs Byte.MinValue, not the value
6654 (ImplicitConversionRequired): When reporting a conversion error,
6655 use error 31 to print out the constant error instead of the
6658 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
6659 which fixes bug 51347.
6661 2003-11-22 Miguel de Icaza <miguel@ximian.com>
6663 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
6664 which fixes the -warnaserror command line option.
6666 2003-11-21 Miguel de Icaza <miguel@ximian.com>
6668 * cfold.cs (DoNumericPromotions): During constant folding of
6669 additions on UIntConstant, special case intconstants with
6670 IntConstants like we do on the expression binary operator.
6672 2003-11-12 Miguel de Icaza <miguel@ximian.com>
6674 * convert.cs (ImplicitReferenceConversion): We were missing a case
6675 (System.Enum are not value types or class types, so we need to
6676 classify them separatedly).
6678 * driver.cs: We do not support error 2007.
6680 2003-11-12 Jackson Harper <jackson@ximian.com>
6682 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
6683 system directory. Also use the full file name so users can
6684 libraries names mscorlib-o-tron.dll in a non system dir.
6686 2004-01-04 David Sheldon <dave-mono@earth.li>
6688 * expression.cs: Added matching ")" to error message for CS0077.
6690 2003-12-19 Martin Baulig <martin@ximian.com>
6692 * typemanager.cs (TypeManager.IsEqualGenericType): New public
6693 static method; see documentation in the method.
6694 (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
6696 * convert.cs (Convert.ImplicitReferenceConversion,
6697 Convert.ImplicitReferenceConversionExists): Add support for
6698 generic type declarations; see gen-36.cs.
6700 2003-12-19 Martin Baulig <martin@ximian.com>
6702 * pending.cs (Pending.InterfaceMethod): Use
6703 `Type.IsAssignableFrom()' instead of `=='.
6705 2003-12-18 Martin Baulig <martin@ximian.com>
6707 * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
6710 * convert.cs (Convert.ImplicitStandardConversionExists): Use
6711 `expr_type.Equals (target_type)' instead of `=='.
6713 2003-12-08 Martin Baulig <martin@ximian.com>
6715 * generics.cs (Constraints.Types): Removed.
6716 (Constraints.Resolve): Just resolve everything to TypeExpr's, not
6718 (Constraints.ResolveTypes): New public method; resolves the
6719 TypeExpr's to Type's.
6720 (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
6721 longer takes the constraints.
6722 (TypeParameter.DefineMethod): Likewise.
6723 (TypeParameter.DefineType): New public method. Calls
6724 `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
6727 2003-12-08 Martin Baulig <martin@ximian.com>
6729 * convert.cs (Convert.ImplicitConversionStandard): Use
6730 `expr_type.Equals (target_type)' instead of `=='.
6732 2003-12-08 Martin Baulig <martin@ximian.com>
6734 * typemanager.cs (TypeManager.GetReferenceType): Call
6735 `Type.MakeByRefType ()'.
6737 2003-12-08 Martin Baulig <martin@ximian.com>
6739 * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
6740 just has some special meaning in some situations. For instance,
6741 it is allowed to use `where' as the name of a variable etc.
6743 2003-12-04 Martin Baulig <martin@ximian.com>
6745 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
6746 `Type.MakeArrayType()' for array types.
6748 2003-11-18 Miguel de Icaza <miguel@ximian.com>
6750 * expression.cs (Invocation.VerifyArgumentsCompat): Remove
6753 (SizeOf.DoResolve): assign the `type_queried' field. This gets
6756 2003-11-16 Martin Baulig <martin@ximian.com>
6758 * codegen.cs (EmitContext.IsGeneric): Removed.
6760 * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
6761 ResolveGeneric() on the DeclSpace.
6763 2003-11-16 Martin Baulig <martin@ximian.com>
6765 * generic.cs (TypeArguments.Resolve):
6766 `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
6767 `ResolveType()' on it to get the Type.
6769 2003-11-15 Martin Baulig <martin@ximian.com>
6771 * generic.cs (ConstructedType.GetInterfaces): Override this.
6773 2003-11-14 Martin Baulig <martin@ximian.com>
6775 * interface.cs (Interface.DefineType): Define all type parameters
6776 before adding the interfaces we inherit.
6778 2003-11-11 Martin Baulig <martin@ximian.com>
6780 * generic.cs (ConstructedType.ResolveType): Always call
6781 `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
6783 2003-11-10 Martin Baulig <martin@ximian.com>
6785 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
6786 (TypeManager.InitCoreTypes): Initialize them here, but instead of
6787 calling `ResolveType()' on them, directly assign their `Type'.
6789 2003-11-08 Martin Baulig <martin@ximian.com>
6791 * generic.cs (ConstructedType): Override `IsClass' etc.
6793 2003-11-08 Martin Baulig <martin@ximian.com>
6795 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
6796 return value and the `out parent' parameter.
6797 (TypeContainer.DefineType): Moved the CS0644 check into
6798 GetClassBases(). Don't pass the interface types to the
6799 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
6800 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
6802 * ecore.cs (TypeExpr.IsAttribute): New property.
6803 (TypeExpr.GetInterfaces): New method.
6805 * interface.cs (Interface.GetInterfaceTypeByName): Return a
6806 TypeExpr instead of a Type.
6807 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
6808 (Interface.DefineType): Don't pass the interface types to the
6809 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
6810 them later and then call `TypeBulider.AddInterfaceImplementation()'.
6812 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
6813 instead of a `Type[]'.
6814 (TypeManager.RegisterBuilder): Likewise.
6815 (TypeManager.AddUserInterface): Likewise.
6816 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
6817 `Type[]' and also return a `TypeExpr[]'.
6818 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
6820 2003-11-08 Martin Baulig <martin@ximian.com>
6822 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
6825 2003-11-08 Martin Baulig <martin@ximian.com>
6827 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
6828 TypeManager.ResolveExpressionTypes().
6830 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
6831 instead of an Expression.
6832 (TypeExpr): This is now an abstract base class for `TypeExpression'.
6833 (TypeExpression): New public class; formerly known as `TypeExpr'.
6835 * expression.cs (ComposedCast): Derive from TypeExpr.
6837 * typemanager.cs (TypeManager.system_*_expr): These are now
6838 TypExpr's instead of Expression's.
6839 (TypeManager.ResolveExpressionTypes): New public static function;
6840 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
6843 2003-11-06 Miguel de Icaza <miguel@ximian.com>
6845 * expression.cs (New.DoResolve): Do not dereference value that
6846 might be a null return.
6848 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
6849 sure that the constant value has the right type. Fixes an
6850 unreported bug, similar to 50425.
6852 * const.cs (Const.LookupConstantValue): Call
6853 ImplicitStandardConversionExists before doing a conversion to
6854 avoid havng the TypeManager.ChangeType do conversions.
6856 Reduced the number of casts used
6858 (Const.ChangeType): New routine to enable reuse of the constant
6859 type changing code from statement.
6861 * typemanager.cs (ChangeType): Move common initialization to
6862 static global variables.
6866 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
6867 every value type to go through, even if it was void. Fix that.
6869 * cs-tokenizer.cs: Use is_identifier_start_character on the start
6870 character of the define, and the is_identifier_part_character for
6871 the rest of the string.
6873 2003-11-05 Miguel de Icaza <miguel@ximian.com>
6875 * expression.cs (UnaryMutator.EmitCode): When I updated
6876 LocalVariableReference.DoResolve, I overdid it, and dropped an
6877 optimization done on local variable references.
6879 2003-11-04 Miguel de Icaza <miguel@ximian.com>
6881 * ecore.cs: Convert the return from Ldlen into an int.
6883 2003-10-20 Miguel de Icaza <miguel@ximian.com>
6885 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
6886 the accessibility, this is a special case for toplevel non-public
6887 classes (internal for instance).
6889 2003-10-20 Nick Drochak <ndrochak@gol.com>
6891 * ecore.cs: Fix typo and build. Needed another right paren.
6893 2003-10-19 Miguel de Icaza <miguel@ximian.com>
6895 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
6896 `internal' case regular and protected, but not allowing protected
6897 to be evaluated later. Bug 49840
6899 2003-10-15 Miguel de Icaza <miguel@ximian.com>
6901 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
6902 to kb.Nlast, and not the kb.nFirst to isolate the switch
6905 Extract the underlying type, so enumerations of long/ulong are
6906 treated like long/ulong.
6908 2003-10-14 Miguel de Icaza <miguel@ximian.com>
6910 * expression.cs (New): Overload the meaning of RequestedType to
6911 track the possible creation of the NewDelegate type, since
6912 DoResolve is invoked more than once for new constructors on field
6915 See bugs: #48800 and #37014
6917 * cs-parser.jay (declare_local_constants): Take an arraylist
6918 instead of a single constant.
6920 (local_constant_declaration): It should take a
6921 constant_declarators, not a constant_declarator. Fixes 49487
6923 * convert.cs: Fix error report.
6925 2003-10-13 Jackson Harper <jackson@ximian.com>
6927 * typemanager.cs (TypeToCoreType): Add float and double this fixes
6930 2003-11-03 Martin Baulig <martin@ximian.com>
6932 * expression.cs (ArrayAccess.GetStoreOpcode): Added
6933 `out bool has_type_arg'; if set, we need to pass the type to
6935 (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
6936 Stelem_Any/Ldelem_Any for generic parameters.
6938 2003-11-02 Martin Baulig <martin@ximian.com>
6940 * expression.cs (Invocation.EmitCall): Use
6941 `TypeManager.IsValueType()' to check whether it's a value type.
6942 Don't set `struct_call' when calling a method on a type parameter.
6944 2003-11-02 Martin Baulig <martin@ximian.com>
6946 * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
6947 and removed the TypeBuilder argument.
6949 * typemanager.cs (TypeManager.IsValueType): Return
6950 `t.IsGenericParameter || t.IsValueType'.
6952 2003-10-25 Martin Baulig <martin@ximian.com>
6954 * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
6955 call ConstructedType.Resolve() on it.
6957 * generic.cs (ConstructedType.Resolve): Set `type' on success.
6959 2003-10-25 Martin Baulig <martin@ximian.com>
6961 * class.cs (TypeContainer.GetClassBases): Changed
6962 `out Type parent' into `out TypeExpr parent'. Moved CS0644 and
6963 CS8214 reporting here.
6964 (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
6965 instead of a `Type' for our parent. In case of a recursive
6966 declaration (see tests/gen-23.cs for an example), our parent is a
6967 ConstructedType and it doesn't have its type set. So, first
6968 create our own TypeBuilder, then call constructed.Resolve() to get
6969 the parent's type and finally TypeBuilder.SetParent() it.
6971 * ecore.cs (TypeExpr.Name): New public virtual property.
6974 (ConstructedType): We're now a TypeExpr and not just an Expression.
6975 (ConstructedType.ResolveAsTypeStep): Don't resolve our type
6976 arguments here; this is done later.
6977 (ConstructedType.Resolve): New public method to resolve the type
6978 arguments and bind them.
6980 2003-10-21 Martin Baulig <martin@ximian.com>
6982 * convert.cs: Use `TypeManager.IsValueType' instead of
6983 'type.IsValueType' everywhere.
6985 * typemanager.cs (TypeManager.IsValueType): Return true for type
6986 parameters. The reason for this is that we need to box a type
6987 parameter when converting it to a reference type.
6989 * cs-parser.jay: Added support for default value expressions.
6991 * generics.cs (DefaultValueExpression): New public class.
6993 2003-10-17 Martin Baulig <martin@ximian.com>
6995 * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
6996 TypeContainer so we can also use this for Interfaces.
6997 (TypeParameter.Resolve): Likewise.
6999 * interface.cs (Interface.DefineType): Added support for generic
7002 * cs-parser.jay: Added support for generic structs and interfaces.
7004 2003-10-17 Martin Baulig <martin@ximian.com>
7006 * generic.cs (GenericMemberAccess.DoResolve): We can now actually
7007 call generic methods :-)
7009 2003-10-16 Martin Baulig <martin@ximian.com>
7011 * cs-parser.jay (namespace_or_type_name): Only create a
7012 GenericMemberAccess if we actually have type arguments.
7014 2003-10-13 Martin Baulig <martin@ximian.com>
7016 * class.cs (Method.Define): If we're a generic method, call
7017 TypeBuilder.DefineGenericMethod () before resolving
7019 (MethodData): Added .ctor which takes an additional MethodBuilder
7020 argument; this is used for generic methods.
7021 (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
7022 we already have a MethodBuilder.
7024 2003-10-10 Martin Baulig <martin@ximian.com>
7026 * class.cs (Method): Added .ctor which takes a `GenericMethod'
7027 instead of a `DeclSpace'. This is used for generic methods.
7029 * cs-parser.jay (method_header): Added support for generic
7030 methods; create a `GenericMethod' instance and pass it to the
7031 `Method's .ctor; it'll be used as the `DeclSpace' to lookup
7032 parameters and locals.
7034 * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
7035 since we already have the location. Check whether we're a generic
7036 type declaration or a generic method and create the correct type
7039 * generic.cs (TypeParameter.DefineMethod): New public method.
7040 (GenericMethod): New public class; derives from DeclSpace and is
7041 used for generic methods.
7043 2003-10-09 Martin Baulig <martin@ximian.com>
7045 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
7047 (MethodCore.DoDefineParameters): Removed the TypeContainer
7048 argument; use the DeclSpace which was passed to the .ctor instead.
7049 (MethodCore.CheckParameter): Take a DeclSpace instead of a
7050 TypeContainer; we only need a DeclSpace here.
7052 2003-10-09 Martin Baulig <martin@ximian.com>
7054 * class.cs (MethodData): Added additional `DeclSpace ds' argument
7056 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
7057 EmitContext's .ctor.
7059 2003-10-09 Martin Baulig <martin@ximian.com>
7061 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
7062 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
7063 AsAccessible(), moved them as well.
7065 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
7067 2003-10-07 Miguel de Icaza <miguel@ximian.com>
7069 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
7070 generation for >=, as spotted by Paolo, bug 48679.
7071 Patch from David Waite.
7073 * cs-tokenizer.cs: Add handling for #pragma.
7075 * cs-parser.jay: Allow for both yield and yield return in the
7076 syntax. The anti-cobolization of C# fight will go on!
7078 * class.cs (TypeBuilder.DefineType): Catch error condition here
7079 (Parent.DefineType erroring out and returning null).
7081 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
7082 coping with enumerations variables, we were mistakenly processing
7083 them as a regular value type instead of built-in types. Fixes the
7086 * typemanager.cs (IsBuiltinOrEnum): New method.
7088 2003-09-30 Miguel de Icaza <miguel@ximian.com>
7090 * cs-parser.jay: Upgrade: yield now needs the return clause.
7092 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
7094 * cs-parser.jay : Renamed yyName to yyNames related to jay.
7096 2003-09-29 Martin Baulig <martin@ximian.com>
7098 * typemanager.cs (TypeManager.GetMethodFlags): Added support for
7099 inflated generic methods.
7101 * generics.cs (ConstructedType): Distinguish between open and
7102 closed constructed types; correctly resolve the arguments.
7104 2003-09-22 Martin Baulig <martin@ximian.com>
7106 * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
7107 all type arguments meet their constraints.
7109 2003-09-19 Martin Baulig <martin@ximian.com>
7111 * decl.cs (MemberCache.SetupCacheForInterface): Take a
7112 `MemberCache parent' argument. Normally, an interface doesn't
7113 have a parent type except System.Object, but we use this in gmcs
7114 for generic type parameters.
7116 2003-09-18 Martin Baulig <martin@ximian.com>
7118 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
7119 on `type.IsInterface'; don't check whether the type has a parent
7120 to determine whether it's an interface.
7122 2003-09-17 Martin Baulig <martin@ximian.com>
7124 * generic.cs (ConstructedType.ToString): Always use `name' as the
7127 2003-09-15 Martin Baulig <martin@ximian.com>
7129 * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
7131 * generic.cs (Constraints.Resolve): New public method; this is
7132 called to resolve the constraint types and to check whether all
7133 the constraints are correct.
7134 (Constraints.Types): New public property.
7135 (TypeParameter.Resolve): New public method; resolves all the
7138 * class.cs (TypeContainer.DefineType): Call
7139 TypeParameter.Resolve() before actually defining the type.
7141 2003-09-15 Martin Baulig <martin@ximian.com>
7143 * class.cs (TypeContainer.DefineType): Added an error flag to
7144 avoid reporting duplicate CS0146's ("class definition is
7147 * driver.cs (Driver.MainDriver): Abort if
7148 RootContext.ResolveTree() reported any errors.
7150 2003-09-07 Martin Baulig <martin@ximian.com>
7152 * report.cs (Error, Warning): Added overloaded versions which take
7153 a `params object[] args' and call String.Format().
7155 2003-09-07 Martin Baulig <martin@ximian.com>
7157 * decl.cs (DeclSpace..ctor): Don't call
7158 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
7159 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
7160 (DeclSpace.RecordDecl): New method.
7162 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
7164 2003-09-02 Ravi Pratap <ravi@ximian.com>
7166 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
7167 value attributes to be applied to ParameterBuilders.
7169 * class.cs (MethodCore.LabelParameters): Make static and more
7170 generic so that it can be used from other places - like interface
7171 methods, for instance.
7173 * interface.cs (Interface.Emit): Call LabelParameters before
7174 emitting attributes on the InterfaceMethod.
7176 2003-09-07 Martin Baulig <martin@ximian.com>
7178 * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
7179 if the number of type parameters doesn't match.
7181 2003-09-04 Martin Baulig <martin@ximian.com>
7183 * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
7184 for arrays of generic type params (ie. `!0[]').
7186 2003-09-04 Martin Baulig <martin@ximian.com>
7188 * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
7191 2003-09-04 Martin Baulig <martin@ximian.com>
7193 * decl.cs (DeclSpace.LookupGeneric): New method.
7194 (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
7197 * generic.cs (TypeParameterExpr): Take a TypeParameter as
7198 argument, not just a string.
7199 (TypeParameter.Define): New public method; this is called to
7200 actually define the generic parameter; after this, you can use the
7201 new `Type' property to get the type.
7203 2003-09-04 Martin Baulig <martin@ximian.com>
7205 * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
7206 is now an ArrayList; initialize the result of the `TypeParameters'
7208 (DeclSpace.GetGenericData): Removed.
7209 (DeclSpace.LookupGeneric): Temporarily removed; we need to
7210 implement this in a different way.
7211 (DeclSpace.GetTypeParameters): Removed; there's now a
7212 `TypeParameters' property.
7213 (DeclSpace.TypeParameters): New public property.
7215 * generic.cs (Constraints): Make this class public.
7216 (TypeParameter): New public class.
7218 2003-09-04 Martin Baulig <martin@ximian.com>
7220 * decl.cs (DeclSpace.GetTypeParameters): New method to return the
7223 * class.cs (TypeContainer.DefineType): Call
7224 TypeBuilder.DefineGenericParameter () on all generic parameters if
7225 this is a generic type.
7227 2003-08-28 Martin Baulig <martin@ximian.com>
7229 * sample-stack.il: Compile this with ilasm: "ilasm /dll
7232 * sample-hello.cs: Compile this with gmcs: "gmcs
7233 /r:sample-stack.dll sample-hello.cs".
7235 2003-08-28 Martin Baulig <martin@ximian.com>
7237 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
7238 the parameters to the generic type.
7240 2003-08-28 Martin Baulig <martin@ximian.com>
7242 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
7244 2003-08-28 Martin Baulig <martin@ximian.com>
7246 * cs-parser.jay (opt_type_argument_list): Use
7247 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
7248 (primary_expression): Replace `qualified_identifier' with `type_name'.
7249 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
7251 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
7252 parser to check whether it is syntactically a type parameter list;
7253 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
7256 2003-08-26 Martin Baulig <martin@ximian.com>
7258 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
7259 resolving aliases; fixes #47927.
7261 2003-08-26 Martin Baulig <martin@ximian.com>
7263 * statement.cs (Using.DoResolve): This is internally emitting a
7264 try/finally clause, so we need to set ec.NeedExplicitReturn if we
7265 do not always return. Fixes #47681.
7267 2003-08-26 Martin Baulig <martin@ximian.com>
7269 * decl.cs (MemberCore): Moved WarningNotHiding(),
7270 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
7272 (AdditionResult): Make this nested in DeclSpace.
7273 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
7274 argument; call NamespaceEntry.Define() unless we're nested in a
7277 * namespace.cs (Namespace.DefineName): New public function. This
7278 is called from DeclSpace's .ctor to add
7279 (Namespace.Lookup): Include DeclSpaces in the lookup.
7281 * class.cs (Operator): Derive from MemberBase, not MemberCore.
7283 * const.cs (Const): Derive from MemberBase, not MemberCore.
7285 2003-08-25 Martin Baulig <martin@ximian.com>
7287 * convert.cs (Convert.ExplicitReferenceConversion): When
7288 converting from an interface type to a class, unbox if the target
7289 type is a struct type. Fixes #47822.
7291 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7293 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
7296 2003-08-22 Martin Baulig <martin@ximian.com>
7298 * class.cs (TypeManager.DefineType): When defining a nested type,
7299 call DefineType() on our parent; fixes #47801.
7301 2003-08-22 Martin Baulig <martin@ximian.com>
7303 * class.cs (MethodData.Define): While checking if a method is an
7304 interface implementation, improve the test a bit more to fix #47654.
7306 2003-08-22 Martin Baulig <martin@ximian.com>
7308 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
7309 correctly; fixes #47722.
7311 2003-08-22 Martin Baulig <martin@ximian.com>
7313 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
7314 LocalVariableReference, ensure it's not read-only. Fixes #47536.
7316 * statement.cs (Fixed.DoResolve): Make all variables read-only.
7318 2003-08-22 Martin Baulig <martin@ximian.com>
7320 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
7321 can only be assigned in static constructors. Fixes #47161.
7323 2003-08-22 Martin Baulig <martin@ximian.com>
7325 Rewrote and improved the flow analysis code.
7327 * flowbranching.cs (FlowBranching): Make this class abstract.
7328 (FlowBranching.CreateBranching): New static function to create a
7330 (FlowBranchingBlock, FlowBranchingException): New classes.
7331 (FlowBranching.UsageVector.Type): New public readonly field.
7332 (FlowBranching.UsageVector.Breaks): Removed the setter.
7333 (FlowBranching.UsageVector.Returns): Removed the setter.
7334 (FlowBranching.UsageVector): Added Break(), Return(),
7335 NeverReachable() and Throw() methods to modify the reachability.
7336 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
7337 done by FlowBranching.Merge().
7338 (FlowBranching.UsageVector.MergeChild): New method; merges the
7339 merge result into the current vector.
7340 (FlowBranching.Merge): New abstract method to merge a branching.
7342 2003-08-12 Martin Baulig <martin@ximian.com>
7344 * expression.cs (Indirection.CacheTemporaries): Create the
7345 LocalTemporary with the pointer type, not its element type.
7347 2003-08-10 Miguel de Icaza <miguel@ximian.com>
7349 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
7350 token was a keyword or not.
7352 Add `error' options where an IDENTIFIER was expected; Provide
7353 CheckToken and CheckIdentifierToken convenience error reporting
7356 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
7358 * decl.cs: Rename `NamespaceEntry Namespace' public field into
7359 NameSpaceEntry NameSpaceEntry.
7361 (LookupInterfaceOrClass): Avoid creating a full qualified name
7362 from namespace and name: avoid doing lookups when we know the
7363 namespace is non-existant. Use new Tree.LookupByNamespace which
7364 looks up DeclSpaces based on their namespace, name pair.
7366 * driver.cs: Provide a new `parser verbose' to display the
7367 exception thrown during parsing. This is turned off by default
7368 now, so the output of a failure from mcs is more graceful.
7370 * namespace.cs: Track all the namespaces defined in a hashtable
7373 (IsNamespace): New method
7375 2003-08-09 Miguel de Icaza <miguel@ximian.com>
7377 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
7378 we know that we need to concatenate (full typename can never be
7383 * statement.cs: Use a bitfield; Do not initialize to null things
7384 which are done by the constructor by default.
7386 * cs-parser.jay: bug fix, parameter was 4, not 3.
7388 * expression.cs: Just use the property;
7390 * statement.cs: No need for GetVariableInfo method.
7392 2003-08-08 Martin Baulig <martin@ximian.com>
7394 * flowanalysis.cs (FlowReturns): This is now nested in the
7395 `FlowBranching' class.
7396 (MyBitVector): Moved this here from statement.cs.
7397 (FlowBranching.SiblingType): New enum type.
7398 (FlowBranching.CreateSibling): Added `SiblingType' argument.
7400 2003-08-07 Martin Baulig <martin@ximian.com>
7402 * flowanalysis.cs (FlowBranchingType): This is now nested in the
7403 `FlowBranching' class and called `BranchingType'.
7405 2003-08-07 Martin Baulig <martin@ximian.com>
7407 * flowanalysis.cs: Moved all the control flow analysis code into
7410 2003-08-07 Martin Baulig <martin@ximian.com>
7412 * assign.cs (Assign.DoResolve): `target' must either be an
7413 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
7416 2003-08-07 Miguel de Icaza <miguel@ximian.com>
7418 * expression.cs (BinaryMethod): This kind of expression is created by the
7419 Binary class if it determines that the operator has to be handled
7422 (BinaryDelegate): This kind of expression is created if we are
7423 dealing with a + or - operator on delegates.
7425 (Binary): remove method, argumetns, and DelegateOperator: when
7426 dealing with methods,
7428 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
7430 * statement.cs (Block): use bitfields for the three extra booleans
7431 we had in use. Remove unused topblock parameter.
7433 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
7435 * assign.cs: Drop extra unneeded tests.
7437 2003-08-06 Miguel de Icaza <miguel@ximian.com>
7439 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
7441 * statement.cs (Foreach): Use VariableStorage instead of
7444 * codegen.cs (VariableStorage): New class used by clients that
7445 require a variable stored: locals or fields for variables that
7446 need to live across yield.
7448 Maybe provide a convenience api for EmitThis+EmitLoad?
7450 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
7453 2003-08-05 Miguel de Icaza <miguel@ximian.com>
7455 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
7456 RemapParameterLValue): New methods that are used to turn a
7457 precomputed FieldInfo into an expression like this:
7461 The idea is to use this instead of making LocalVariableReference
7462 have more than one meaning.
7464 * cs-parser.jay: Add error production to BASE.
7466 * ecore.cs: Deal with TypeManager.GetField returning null, which
7467 is now a valid return value.
7469 (FieldExprNoAddress): New expression for Fields whose address can
7472 * expression.cs (LocalVariableReference): During the resolve
7473 phases, create new expressions if we are in a remapping context.
7474 Remove code that dealt with remapping here.
7476 (ParameterReference): same.
7478 (ProxyInstance): New expression, like the `This' expression, but
7479 it is born fully resolved. We know what we are doing, so remove
7480 the errors that are targeted to user-provided uses of `this'.
7482 * statement.cs (Foreach): our variable is now stored as an
7483 Expression; During resolution, follow the protocol, dont just
7484 assume it will return this.
7486 2003-08-06 Martin Baulig <martin@ximian.com>
7488 * support.cs (SeekableStreamReader.cs): New public class.
7490 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
7491 SeekableStreamReader instead of the normal StreamReader.
7493 2003-08-04 Martin Baulig <martin@ximian.com>
7495 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
7496 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
7497 deambiguate casts and delegate invocations.
7498 (parenthesized_expression): Use the new tokens to ensure this is
7499 not a cast of method invocation.
7501 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
7502 when reading a `)' and Deambiguate_CloseParens () was previously
7505 * expression.cs (ParenthesizedExpression): New class. This is
7506 just used for the CS0075 test.
7507 (Binary.DoResolve): Check for CS0075.
7509 2003-07-29 Ravi Pratap <ravi@ximian.com>
7511 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
7512 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
7513 reference comparison.
7515 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
7516 examine the ReturnType for equality - this is necessary in the
7517 cases of implicit and explicit operators whose signature also
7518 includes the return type.
7520 2003-07-26 Miguel de Icaza <miguel@ximian.com>
7522 * namespace.cs: Cache the result of the namespace computation,
7523 instead of computing it every time.
7525 2003-07-24 Miguel de Icaza <miguel@ximian.com>
7527 * decl.cs: Use a global arraylist that we reuse over invocations
7528 to avoid excesive memory consumption. Reduces memory usage on an
7529 mcs compile by one meg (45 average).
7531 * typemanager.cs (LookupTypeReflection): In .NET pointers are
7532 private, work around that.
7534 2003-07-23 Miguel de Icaza <miguel@ximian.com>
7536 * literal.cs (IntLiteral): Define Zero and One static literals.
7538 * cs-parser.jay (integer_literal): use static literals to reduce
7539 memory usage for the most used literals (0, 1 and -1). 211kb
7540 reduced in memory usage.
7542 Replace all calls to `new ArrayList' with `new
7543 ArrayList(4)' which is a good average number for most allocations,
7544 and also requires only 16 bytes of memory for its buffer by
7547 This reduced MCS memory usage in seven megabytes for the RSS after
7550 2003-07-28 Ravi Pratap <ravi@ximian.com>
7552 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
7553 handle params methods the correct way by forming only one
7554 applicable set with params and normal methods in them. Earlier we
7555 were looking at params methods only if we found no normal methods
7556 which was not the correct thing to do.
7558 (Invocation.BetterFunction): Take separate arguments indicating
7559 when candidate and the best method are params methods in their
7562 This fixes bugs #43367 and #46199.
7564 * attribute.cs: Documentation updates.
7566 (CheckAttribute): Rename to CheckAttributeTarget.
7567 (GetValidPlaces): Rename to GetValidTargets.
7569 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
7570 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
7574 2003-07-28 Miguel de Icaza <miguel@ximian.com>
7576 * codegen.cs: Compute IsGeneric correctly.
7578 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
7581 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
7582 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
7583 regressions, and I was chasing more bugs than I required.
7585 * interface.cs: Use expressions for base type names (like classes
7586 and structs have been doing for a while now), and resolve that.
7587 This patch should probably go into head as well.
7589 This makes it one less user of FindType.
7591 2003-07-24 Miguel de Icaza <miguel@ximian.com>
7593 This compiler can not self host currently. Need to fix that.
7595 * Makefile: compile to `gmcs.exe'
7597 * driver.cs: Turn on v2 by default on gmcs.
7599 * generic.cs (ConstructedType): Does no longer take a container
7600 type argument; That will be taken care of later.
7602 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
7603 Use SimpleName to resolve for now, so we can continue the work on
7604 the parser, until we get Type.GetType that understands generics.
7606 (ConstructedType.ToString): Implement
7608 (TypeArguments.Resolve): Resolve the child expressions as types.
7610 * cs-parser.jay: Rename interface_constraints to
7611 type_parameter_constraints
7613 (namespace_or_type_name): Only use constructed types for the basic
7614 construction, we will deal with identifier<...> later.
7616 (type/type_name): No longer call DecomposeQI, as
7617 namespace_or_type_name is always decoded now.
7619 2003-07-22 Ravi Pratap <ravi@ximian.com>
7621 * expression.cs (Invocation.OverloadResolve): Follow the spec more
7622 closely: we eliminate methods in base types when we have an
7623 applicable method in a top-level type.
7625 Please see section 14.5.5.1 for an exact description of what goes
7628 This fixes bug #45127 and a host of other related to corlib compilation.
7630 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
7631 array is the method corresponding to the top-level type (this is
7632 because of the changes made to icall.c) so we change this
7635 (MethodGroupExpr.Name): This too.
7637 * typemanager.cs (GetElementType): New method which does the right
7638 thing when compiling corlib.
7640 * everywhere: Make use of the above in the relevant places.
7642 2003-07-22 Martin Baulig <martin@ximian.com>
7644 * cs-parser.jay (invocation_expression): Moved
7645 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
7646 `cast_expression', but create a InvocationOrCast which later
7647 resolves to either an Invocation or a Cast.
7649 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
7650 method; call this before EmitStatement() to make sure that this
7651 expression can be used as a statement.
7653 * expression.cs (InvocationOrCast): New class; resolves to either
7654 an Invocation or a Cast.
7656 * statement.cs (StatementExpression): Call ResolveStatement() on
7657 the ExpressionStatement before emitting it.
7659 2003-07-21 Martin Baulig <martin@ximian.com>
7661 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
7662 `ref' and `out' attributes match; fixes #46220.
7663 (MemberAccess.ResolveMemberAccess): You can't reference a type
7664 through an expression; fixes #33180.
7665 (Indexers.GetIndexersForType): Don't return the indexers from
7666 interfaces the class implements; fixes #46502.
7668 2003-07-21 Martin Baulig <martin@ximian.com>
7670 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
7671 CS0661 checks; fixes bug #30442.
7673 2003-07-21 Martin Baulig <martin@ximian.com>
7675 * decl.cs (AdditionResult): Added `Error'.
7677 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
7679 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
7680 cs0031.cs actually work.
7682 2003-07-20 Miguel de Icaza <miguel@ximian.com>
7684 * cs-parser.jay (namespace_name): do not use
7685 namespace_or_type_name, use qualified_identifier, because
7686 namespace_or_type_name will soon return a composed expression
7687 instead of a string.
7689 (namespace_or_type_name): Instead of returning a string, now this
7690 production returns an expression.
7692 * codegen.cs (EmitContext): Setup IsGeneric property based on
7693 whether our DeclSpace is generic, our the method is generic.
7695 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
7696 the method is generic.
7698 * cs-parser.jay (type_arguments, opt_type_argument_list,
7699 type_parameters, type_parameter_list, opt_type_parameter_list,
7700 type_parameter,, opt_type_parameter_constraints_clauses,
7701 type_parameter_constraints_clauses,
7702 type_parameter_constraint_clause, type_parameter_constraint,
7703 interface_constraints): Add new production
7705 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
7706 DeclSpace is generic or not.
7708 (DeclSpace.SetParameterInfo): New routine, used to set the
7709 parameter info for a type.
7711 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
7712 returns a GenericTypeExpr
7714 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
7715 generic, lookup the generic argument.
7717 * attribute.cs: Do not allow TypeParameterExpressions in
7720 * class.cs: Do not allow the Main method to be defined in a
7723 * expression.cs (SizeOf): Do not allow generic types to be used as
7724 arguments to sizeof.
7726 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
7727 it: whether a type is generic or not. Only works for types we are
7728 currently building for now.
7730 2003-07-20 Martin Baulig <martin@ximian.com>
7732 * namespace.cs: Fixed that bug which caused a crash when compiling
7735 2003-07-20 Miguel de Icaza <miguel@ximian.com>
7737 * typemanager.cs (LookupTypeReflection): Never expose types which
7738 are NotPublic, NestedPrivate, NestedAssembly, or
7739 NestedFamANDAssem. We used to return these, and later do a check
7740 that would report a meaningful error, but the problem is that we
7741 would not get the real match, if there was a name override.
7743 2003-07-18 Miguel de Icaza <miguel@ximian.com>
7745 * namespace.cs (Namespace, Name): Do not compute the namespace
7746 name dynamically, compute it in the constructor. This reduced
7747 memory usage by 1697 KB.
7749 * driver.cs: Use --pause to pause at the end.
7751 2003-07-17 Peter Williams <peter@newton.cx>
7753 * Makefile: Change the name of the test target so that it doesn't
7754 conflict with the recursive test target.
7756 2003-07-17 Miguel de Icaza <miguel@ximian.com>
7758 * expression.cs (LocalVariableReference.Emit, EmitAssign,
7759 AddressOf): Do not use EmitThis, that was wrong, use the actual
7762 2003-07-15 Miguel de Icaza <miguel@ximian.com>
7764 * class.cs (MethodData.Define): While checking if a method is an
7765 interface implementation, improve the test: If we are not public
7766 (use new test here: use the computed MethodAttributes directly,
7767 instead of the parsed modifier flags) check if the `implementing'
7768 method comes from an interface or not.
7770 * pending.cs (VerifyPendingMethods): Slightly better error
7773 * makefile: add test target that does the mcs bootstrap.
7775 2003-07-16 Ravi Pratap <ravi@ximian.com>
7777 * interface.cs (Define): Do nothing here since there are no
7778 members to populate etc. Move the attribute emission out of here
7779 since this was just totally the wrong place to put it. Attribute
7780 application happens during the 'Emit' phase, not in the 'Define'
7783 (Emit): Add this method and move the attribute emission here
7785 * rootcontext.cs (EmitCode): Call the Emit method on interface
7788 2003-07-14 Ravi Pratap M <ravi@ximian.com>
7790 * expression.cs (OverloadResolve): Report error only if Location
7791 is not 'Null' which means that there was a probe going on.
7793 2003-07-14 Martin Baulig <martin@ximian.com>
7795 * expression.cs (ConditionalLogicalOperator): New public class to
7796 implement user defined conditional logical operators.
7797 This is section 14.11.2 in the spec and bug #40505.
7799 2003-07-14 Martin Baulig <martin@ximian.com>
7801 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
7803 2003-07-14 Martin Baulig <martin@ximian.com>
7805 * codegen.cs (EmitContext.InFixedInitializer): New public field.
7807 * ecore.cs (IVariable.VerifyFixed): New interface method.
7809 * expression.cs (Unary.ResolveOperator): When resolving the `&'
7810 operator, check whether the variable is actually fixed. Fixes bug
7811 #36055. Set a variable definitely assigned when taking its
7812 address as required by the spec.
7814 * statement.cs (LocalInfo.IsFixed): New field.
7815 (LocalInfo.MakePinned): Set `IsFixed' to true.
7817 2003-07-14 Ravi Pratap M <ravi@ximian.com>
7819 * attribute.cs (Attribute.Resolve): While doing a Member lookup
7820 for .ctors, ensure that we only ask for members declared in the
7821 attribute type (BindingFlags.DeclaredOnly).
7825 * expression.cs (Error_WrongNumArguments): Report error 1501
7826 correctly the way CSC does.
7828 2003-07-13 Martin Baulig <martin@ximian.com>
7830 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
7831 lookup on the fully qualified name, to make things like "X.X" work
7832 where "X.X" is a fully qualified type name, but we also have a
7833 namespace "X" in the using list. Fixes #41975.
7835 2003-07-13 Martin Baulig <martin@ximian.com>
7837 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
7838 function. If we're a CompoundAssign, we need to create an embedded
7839 CompoundAssign, not an embedded Assign.
7840 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
7843 2003-07-13 Martin Baulig <martin@ximian.com>
7845 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
7846 work to fix bug #46088.
7848 2003-07-13 Ravi Pratap <ravi@ximian.com>
7850 * class.cs (Operator.Emit): Do not emit attributes here - it is
7851 taken care of by the Method class that we delegate too. This takes
7854 2003-07-10 Martin Baulig <martin@ximian.com>
7856 * expression.cs (TypeOfVoid): New class.
7857 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
7859 2003-07-10 Martin Baulig <martin@ximian.com>
7861 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
7864 2003-07-10 Martin Baulig <martin@ximian.com>
7866 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
7867 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
7869 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
7871 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
7873 2003-07-10 Martin Baulig <martin@ximian.com>
7875 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
7876 of decimal. Fixes #42850.
7878 NOTE: I also fixed the created byte blob, but this doesn't work on
7879 the MS runtime and csc never produces any byte blobs for decimal
7882 2003-07-10 Martin Baulig <martin@ximian.com>
7884 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
7885 structs; fixes #32068.
7886 (Block.AddChildVariableNames): Fixed #44302.
7888 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7890 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
7892 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7894 * attribute.cs: And this test is onger needed.
7896 2003-07-08 Martin Baulig <martin@ximian.com>
7898 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
7899 inaccessible types. Fixes #36313.
7901 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
7903 * namespace.cs (NamespaceEntry): Create implicit entries for all
7904 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
7905 implicit entries for N1.N2 and N1.
7907 2003-07-08 Martin Baulig <martin@ximian.com>
7909 Rewrote the handling of namespaces to fix a lot of the issues
7910 wrt. `using' aliases etc.
7912 * namespace.cs (Namespace): Splitted this class into a
7913 per-assembly `Namespace' and a per-file `NamespaceEntry'.
7915 * typemanager.cs (TypeManager.IsNamespace): Removed.
7916 (TypeManager.ComputeNamespaces): Only compute namespaces from
7917 loaded assemblies here, not the namespaces from the assembly we're
7918 currently compiling.
7920 2003-07-08 Martin Baulig <martin@ximian.com>
7922 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
7924 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7926 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
7929 I thought about the memory savings here, but LookupTypeReflection
7930 is used under already very constrained scenarios. Compiling
7931 corlib or mcs only exposes one hit, so it would not really reduce
7932 any memory consumption.
7934 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7936 * typemanager.cs: fixes bug #45889 by only adding public types from
7937 other assemblies to the list of known types.
7939 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7941 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
7942 on the type we resolved.
7944 2003-07-05 Martin Baulig <martin@ximian.com>
7946 * pending.cs (PendingImplementation.ParentImplements): Don't
7947 create the proxy if the parent is abstract.
7949 * class.cs (TypeContainer.DefineIndexers): Process explicit
7950 interface implementations first. Fixes #37714.
7952 2003-07-04 Miguel de Icaza <miguel@ximian.com>
7954 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
7955 defined recursively; but since we modify the input parameters
7956 (left is set to `this' temporarily), we reset this value if the
7957 left_is_explicit is false, which gives the original semantics to
7960 * literal.cs (NullPointer): new class used to represent a null
7961 literal in a pointer context.
7963 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
7964 type is a pointer, use a NullPointer object instead of a
7965 NullLiteral. Closes 43687
7967 (ExplicitConversion): Convert pointer values using
7968 the conv opcode to the proper type.
7970 * ecore.cs (New): change ValueTypeVariable property into a method,
7971 that returns whether the valuetype is suitable for being used.
7973 * expression.cs (Binary.DoNumericPromotions): Only return if we
7974 the int constant was a valid uint, and we can return both left and
7975 right as uints. If not, we continue processing, to trigger the
7976 type conversion. This fixes 39018.
7978 * statement.cs (Block.EmitMeta): During constant resolution, set
7979 the CurrentBlock property on the emitcontext, so that we resolve
7980 constants propertly.
7982 2003-07-02 Martin Baulig <martin@ximian.com>
7984 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
7985 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
7987 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
7988 than emitting it here.
7990 * statement.cs: Fixed some more flow analysis bugs.
7992 2003-07-02 Martin Baulig <martin@ximian.com>
7994 * class.cs (MethodData.Define): When implementing interface
7995 methods, set Final unless we're Virtual.
7997 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
7998 check work for interface methods.
8000 2003-07-01 Martin Baulig <martin@ximian.com>
8002 * ecore.cs (EmitContext.This): Replaced this property with a
8003 GetThis() method which takes a Location argument. This ensures
8004 that we get the correct error location for a CS0188.
8006 2003-07-01 Miguel de Icaza <miguel@ximian.com>
8008 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
8009 ImplicitStandardConversion.
8011 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
8013 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
8015 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
8018 2003-06-30 Miguel de Icaza <miguel@ximian.com>
8020 * class.cs (Constructor.Define): Turn off initlocals for unsafe
8023 (MethodData.Define): Turn off initlocals for unsafe methods.
8025 2003-06-29 Miguel de Icaza <miguel@ximian.com>
8027 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
8028 complete; Fixes #37521.
8030 * delegate.cs: Use Modifiers.TypeAttr to compute the
8031 TypeAttributes, instead of rolling our own. This makes the flags
8032 correct for the delegates.
8034 2003-06-28 Miguel de Icaza <miguel@ximian.com>
8036 * class.cs (Constructor.Define): Set the private flag for static
8037 constructors as well.
8039 * cs-parser.jay (statement_expression): Set the return value to
8040 null, to avoid a crash when we catch an error.
8042 2003-06-24 Miguel de Icaza <miguel@ximian.com>
8044 * cs-parser.jay: Applied patch from Jackson that adds support for
8045 extern and unsafe modifiers to destructor declarations.
8047 * expression.cs: Report error 21 if the user is trying to index a
8050 * driver.cs: Add an error message, suggested by the bug report.
8052 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
8053 if we do not have a ": this ()" constructor initializer. Fixes 45149
8055 2003-06-14 Miguel de Icaza <miguel@ximian.com>
8057 * namespace.cs: Add some information to reduce FAQs.
8059 2003-06-13 Miguel de Icaza <miguel@ximian.com>
8061 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
8062 underlying enumeration types. Fixes #43915.
8064 * expression.cs: Treat ushort/short as legal values to be used in
8067 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
8069 * delegate.cs: transfer custom attributes for paramenters from
8070 the delegate declaration to Invoke and BeginInvoke.
8072 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
8074 * attribute.cs: handle custom marshalers and emit marshal info
8077 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
8079 * makefile.gnu: Added anonymous.cs to the compiler sources.
8081 2003-05-28 Miguel de Icaza <miguel@ximian.com>
8083 * iterators.cs: Change the name of the proxy class to include two
8086 * cs-parser.jay: Update grammar to include anonymous methods.
8088 * anonymous.cs: new file.
8090 2003-05-27 Miguel de Icaza <miguel@ximian.com>
8092 * class.cs (Field.Define): Add missing test for pointers and
8095 2003-05-27 Ravi Pratap <ravi@ximian.com>
8097 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
8098 we use the stobj opcode.
8100 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
8101 since it wasn't the correct fix.
8103 It still is puzzling that we are required to use stobj for IntPtr
8104 which seems to be a ValueType.
8106 2003-05-26 Miguel de Icaza <miguel@ximian.com>
8108 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
8109 during regular simple name resolution. Now, the trick is that
8110 instead of returning for processing the simplename, we do a
8111 TypeManager.LookupType (ie, a rooted lookup as opposed to a
8112 contextual lookup type). If a match is found, return that, if
8113 not, return for further composition.
8115 This fixes long-standing 30485.
8117 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
8118 using the address to initialize an object, do an Stobj instead of
8119 using the regular Stelem.
8121 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
8122 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
8123 Because if we are a BaseIndexerAccess that value will be true.
8126 * statement.cs (GotoCase.Resolve): Return after reporting an
8127 error, do not attempt to continue.
8129 * expression.cs (PointerArithmetic.Emit): If our operand is a
8130 long, convert our constants to match the operand before
8131 multiplying. Convert to I type before adding. Fixes 43670.
8133 2003-05-14 Ravi Pratap <ravi@ximian.com>
8135 * enum.cs (ImplicitConversionExists) : Rename to
8136 ImplicitEnumConversionExists to remove ambiguity.
8138 * ecore.cs (NullCast): New type of cast expression class which
8139 basically is very similar to EmptyCast with the difference being
8140 it still is a constant since it is used only to cast a null to
8144 * convert.cs (ImplicitReferenceConversion): When casting a null
8145 literal, we return a NullCast.
8147 * literal.cs (NullLiteralTyped): Remove - I don't see why this
8148 should be around anymore.
8150 The renaming (reported was slightly wrong). Corrections:
8152 ConvertImplicitStandard -> ImplicitConversionStandard
8153 ConvertExplicitStandard -> ExplicitConversionStandard
8155 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
8156 before passing them in !
8158 * convert.cs (ImplicitConversionStandard): When comparing for
8159 equal expr and target types, ensure that expr is not a
8162 In general, we must not be checking (expr_type ==
8163 target_type) in the top level conversion methods
8164 (ImplicitConversion, ExplicitConversion etc). This checking is
8165 done in the methods that they delegate to.
8167 2003-05-20 Miguel de Icaza <miguel@ximian.com>
8169 * convert.cs: Move Error_CannotConvertType,
8170 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
8171 ImplicitNumericConversion, ImplicitConversionExists,
8172 ImplicitUserConversionExists, StandardConversionExists,
8173 FindMostEncompassedType, FindMostSpecificSource,
8174 FindMostSpecificTarget, ImplicitUserConversion,
8175 ExplicitUserConversion, GetConversionOperators,
8176 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
8177 TryImplicitIntConversion, Error_CannotConvertImplicit,
8178 ConvertImplicitRequired, ConvertNumericExplicit,
8179 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
8180 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
8183 Perform the following renames:
8185 StandardConversionExists -> ImplicitStandardConversionExists
8186 ConvertImplicit -> ImplicitConversion
8187 ConvertImplicitStandard -> ImplicitStandardConversion
8188 TryImplicitIntConversion -> ImplicitIntConversion
8189 ConvertImplicitRequired -> ImplicitConversionRequired
8190 ConvertNumericExplicit -> ExplicitNumericConversion
8191 ConvertReferenceExplicit -> ExplicitReferenceConversion
8192 ConvertExplicit -> ExplicitConversion
8193 ConvertExplicitStandard -> ExplicitStandardConversion
8195 2003-05-19 Martin Baulig <martin@ximian.com>
8197 * statement.cs (TypeInfo.StructInfo): Made this type protected.
8198 (TypeInfo): Added support for structs having structs as fields.
8200 * ecore.cs (FieldExpr): Implement IVariable.
8201 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
8202 VariableInfo for the field.
8204 2003-05-18 Martin Baulig <martin@ximian.com>
8206 * expression.cs (This.DoResolve): Report a CS0027 if we're
8207 emitting a field initializer.
8209 2003-05-18 Martin Baulig <martin@ximian.com>
8211 * expression.cs (This.ResolveBase): New public function.
8212 (This.DoResolve): Check for CS0188.
8214 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
8217 * ecore.cs (MethodGroupExpr.DoResolve): Set the
8218 `instance_expression' to null if we don't have any non-static
8221 2003-05-18 Martin Baulig <martin@ximian.com>
8223 Reworked the way how local variables and parameters are handled by
8224 the flow analysis code.
8226 * statement.cs (TypeInfo, VariableMap): New public classes.
8227 (VariableInfo): New public class. This is now responsible for
8228 checking whether a variable has been assigned. It is used for
8229 parameters and local variables.
8230 (Block.EmitMeta): Take the InternalParameters as argument; compute
8231 the layout of the flow vectors here.
8232 (Block.LocalMap, Block.ParameterMap): New public properties.
8233 (FlowBranching): The .ctor doesn't get the InternalParameters
8234 anymore since Block.EmitMeta() now computes the layout of the flow
8236 (MyStructInfo): This class is now known as `StructInfo' and nested
8237 in `TypeInfo'; we don't access this directly anymore.
8239 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
8240 property and removed IsAssigned(), IsFieldAssigned(),
8241 SetAssigned() and SetFieldAssigned(); we now call them on the
8242 VariableInfo so we don't need to duplicate this code everywhere.
8244 * expression.cs (ParameterReference): Added `Block block' argument
8246 (LocalVariableReference, ParameterReference, This): The new
8247 VariableInfo class is now responsible for all the definite
8250 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
8251 IsParameterAssigned, SetParameterAssigned): Removed.
8253 2003-05-18 Martin Baulig <martin@ximian.com>
8255 * typemanager.cs (InitCoreTypes): Try calling
8256 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
8257 the 3-args-version. Corlib now also needs our `void_type'.
8258 (GetMethod): Added overloaded version which takes an optional
8259 `bool report_errors' to allow lookups of optional methods.
8261 2003-05-12 Martin Baulig <martin@ximian.com>
8263 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
8264 only used for locals and not for parameters.
8266 2003-05-12 Miguel de Icaza <miguel@ximian.com>
8268 * support.cs (InternalParameters.ParameterType): Return the
8269 ExternalType of the parameter.
8271 * parameter.cs (Parameter.ExternalType): drop the two arguments,
8274 2003-05-11 Miguel de Icaza <miguel@ximian.com>
8276 * class.cs (MethodData.Define): Do not set the `newslot' on
8277 interface members, if they are also flagged as "override".
8279 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
8280 better code for ++i and i++. This only works for static fields
8281 and local variables.
8283 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
8284 want to pull the DeclSpace out of the builder_to_declspace instead
8285 of the TypeBuilder (like in TypeContainer.FindMembers).
8287 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
8288 instead of LookupTypeContainer. Fixes the crash on .NET for
8289 looking up interface members.
8291 * const.cs: Create our own emit context during the Definition
8292 stage, so that constants are evaluated in the proper context, when
8293 a recursive definition happens.
8295 2003-05-11 Martin Baulig <martin@ximian.com>
8297 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
8298 new block for a switch section.
8299 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
8300 the adding/lookup in the switch block. Fixes #39828.
8302 2003-05-09 Miguel de Icaza <miguel@ximian.com>
8304 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
8305 functionality: I needed to convert the data after I had performed
8306 the add/sub operation into the operands type size.
8308 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
8309 pass the type for the box operation, otherwise the resulting
8310 object would have been of type object.
8312 (BoxedCast): Add constructor to specify the type to box as.
8314 2003-05-07 Miguel de Icaza <miguel@ximian.com>
8316 * iterators.cs: I was reusing the `count' variable inadvertently,
8317 take steps to not allow this to happen.
8319 2003-05-06 Miguel de Icaza <miguel@ximian.com>
8321 * attribute.cs (Attribute.Resolve): Params attributes are encoded
8322 by creating an array at the point where the params starts and
8323 putting all those arguments there, then adjusting the size of the
8326 2003-05-05 Miguel de Icaza <miguel@ximian.com>
8328 * expression.cs (New.AddressOf): Implement interface
8329 IMemoryLocation. This is used when the `new' operator is used in
8330 the context of an invocation to a method on a value type.
8332 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
8335 * namespace.cs: Also check the using aliases here.
8337 * driver.cs: Move the test for using validity after the types have
8338 been entered, so we do a single pass that also includes the using
8341 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
8342 in the regular case. CreateSiblingForFinally is doing extra
8345 * attribute.cs (GetAttributeArgumentExpression): Store the result
8346 on an out value, and use the return value to indicate failure
8347 instead of using null (which is a valid return for Constant.GetValue).
8349 * statement.cs: Perform the analysis flow for the increment
8350 portion after the statement, because this will be the real flow of
8351 execution. Fixes #42385
8353 * codegen.cs (EmitContext.EmitArgument,
8354 EmitContext.EmitStoreArgument): New helper functions when the
8355 RemapToProxy flag is set.
8357 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
8360 Add support for remapping parameters.
8362 * iterators.cs: Propagate parameter values; Store parameter
8363 values in the proxy classes.
8365 2003-05-04 Miguel de Icaza <miguel@ximian.com>
8367 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
8368 need a proxy reference; I do not know what I was thinking
8370 * cs-parser.jay (constructor_initializer): catch another error,
8371 and display nice message.
8373 (field_declaration): catch void field declaration
8374 to flag a better error.
8376 * class.cs (MemberBase.CheckBase): Report an error instead of a
8377 warning if a new protected member is declared in a struct.
8378 (Field.Define): catch the error of readonly/volatile.
8380 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
8382 (FieldExpr.AddressOf): ditto. Catch error where the address of a
8383 volatile variable is taken
8385 2003-05-02 Miguel de Icaza <miguel@ximian.com>
8387 * statement.cs (Fixed.Resolve): Report an error if we are not in
8390 2003-05-01 Miguel de Icaza <miguel@ximian.com>
8392 * typemanager.cs: reuse the code that handles type clashes for
8393 delegates and enumerations.
8395 * class.cs (Report28): Always report.
8397 * expression.cs (EncodeAsAttribute): Allow nulls here.
8399 2003-04-28 Miguel de Icaza <miguel@ximian.com>
8401 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
8402 the functionality for testing whether an expression is valid for
8403 an attribute here. Also handle the case of arrays of elements
8406 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
8407 encoding a linear array into an array of objects that are suitable
8408 to be passed to an CustomAttributeBuilder.
8410 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
8412 * ecore.cs: (FieldExpr): Handle field remapping here.
8414 * iteratators.cs: Pass the instance variable (if the method is an
8415 instance method) to the constructors, so we can access the field
8416 variables on the class.
8418 TODO: Test this with structs. I think the THIS variable on
8419 structs might have to be a pointer, and not a refenrece
8421 2003-04-27 Miguel de Icaza <miguel@ximian.com>
8423 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
8424 local variables to fields in a proxy class.
8426 * iterators.cs (PopulateProxy): Rename our internal fields to
8428 Create a <THIS> field if we are an instance method, so we can
8429 reference our parent container variables.
8430 (MapVariable): Called back from the EmitContext code to enter a
8431 new variable to field mapping into the proxy class (we just create
8435 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
8436 for using the remapped locals to fields.
8438 I placed the code here, because that gives the same semantics to
8439 local variables, and only changes the Emit code.
8441 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
8442 statements inside iterators.
8443 (VariableInfo): Add a FieldBuilder for the cases when we are
8444 remapping local variables to fields in a proxy class
8446 * ecore.cs (SimpleNameResolve): Avoid testing two times for
8447 current_block != null.
8449 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
8450 not cope with strings, as it has been moved to the
8451 TableSwitchEmit. Fixed bug in switch generation.
8453 * expression.cs (New.DoResolve): Provide more context for the user
8454 when reporting an error.
8456 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
8459 * expression.cs (MemberAccess.DoResolve): When we get a type back,
8460 check the permissions for it. Note than in a type-resolution
8461 context the check was already present in DeclSpace.ResolveType,
8462 but was missing from the MemberAccess.
8464 (ArrayCreation.CheckIndices): warn if the user has
8465 more nested levels of expressions, but there are no more
8466 dimensions specified. Avoids crash on bug 41906.
8468 2003-04-26 Miguel de Icaza <miguel@ximian.com>
8470 * statement.cs (Block): replace Implicit bool, for a generic
8472 New flag: `Unchecked'. This is used during the EmitMeta phase
8473 (which is out-of-line with the regular Resolve/Emit process for a
8474 statement, as this is done ahead of time, but still gets a chance
8475 to call constant resolve).
8477 (Block.Flags): new enum for adding a new flag.
8479 (Block.EmitMeta): track the state of unchecked.
8481 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
8482 to enable constant resolution to work there as well.
8484 2003-04-22 Miguel de Icaza <miguel@ximian.com>
8486 * typemanager.cs (ienumerable_type): Also look up
8487 System.Collections.IEnumerable.
8489 2003-04-21 Miguel de Icaza <miguel@ximian.com>
8491 TODO: Test more than one conditional per method.
8493 * class.cs (Indexer.Define): Report the location where the user is
8494 referencing the unsupported feature.
8496 (MethodData): Overload the use of `conditionals' to
8497 minimize the creation of needless ArrayLists. This saves roughly
8498 212kb on my machine.
8500 (Method): Implement the new IIteratorContainer interface.
8501 (Method.SetYields): Implement the method by setting the ModFlags
8502 to contain METHOD_YIELDS.
8504 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
8505 which just got set to null.
8507 * iterators.cs: New file.
8509 (Yield, YieldBreak): New statements.
8511 * statement.cs (Return.Resolve): Flag an error if we are used in
8514 * codegen.cs (InIterator): New flag set if the code is being
8515 compiled in an iterator method.
8517 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
8518 internal modifier, and we just use it to avoid adding extra
8519 fields, as this is seldom used.
8521 * cs-parser.jay: Add yield_statement (yield and yield break).
8523 * driver.cs: New flag -v2 to turn on version 2 features.
8525 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
8526 hashtable when v2 is enabled.
8528 2003-04-20 Miguel de Icaza <miguel@ximian.com>
8530 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
8531 there is already a namespace defined with this name.
8533 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
8534 people upgraded their corlibs.
8536 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
8537 always use fully qualified types, no need to use the compiler
8540 (TypeManager.IsNamespace): Use binarysearch.
8542 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
8543 AddDelegate): I did not quite use the new IsValid API properly: I
8544 have to pass the short-name and the fullname. I was passing only
8545 the basename instead of the fullname sometimes.
8547 (TypeContainer.DefineType): call NamespaceClash.
8549 * interface.cs (Interface.DefineType): use NamespaceClash before
8552 * delegate.cs (Delegate.DefineType): use NamespaceClash before
8555 * enum.cs: (Enum.DefineType): use NamespaceClash before
8558 * typemanager.cs (: 3-line patch that gives us some tasty 11%
8559 speed increase. First, use the negative_hits cache when we get a
8560 negative. Second, add the type with its full original name
8561 instead of the new . and + encoded name (reflection uses + to
8562 separate type from a nested type). Use LookupTypeReflection
8563 directly which bypasses the type->name hashtable (that we already
8564 know does not contain the type.
8566 * decl.cs (DeclSpace.ResolveTypeExpr): track the
8567 location/container type.
8569 * driver.cs: When passing utf8, use directly the UTF8Encoding.
8571 2003-04-19 Miguel de Icaza <miguel@ximian.com>
8573 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
8575 * delegate.cs (NewDelegate.Resolve): Test whether an instance
8576 method is being referenced in the method group from a static
8577 context, and report error 120 if so.
8579 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
8582 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
8583 is created, we create the A namespace).
8585 * cs-parser.jay: A namespace also introduces a DeclarationFound.
8588 2003-04-18 Miguel de Icaza <miguel@ximian.com>
8590 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
8591 invocation to ModuleBuilder.GetType with the same values will
8592 return a new type instance, so we need to cache its return
8595 * expression.cs (Binary.ResolveOperator): Only allow the compare
8596 operators on enums if they are of the same type.
8598 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
8599 types of ValueType on their own case. Before we were giving them
8600 the same treatment as objects.
8602 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
8603 fullname. Short name is used to compare against container name.
8604 Fullname is used to check against defined namespace names.
8606 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
8607 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
8609 (Method.CheckBase): Call parent.
8610 (MemberBase.CheckBase): Check for protected members on sealed
8612 (PropertyBase.CheckBase): Call parent.
8613 (Field.Define): Call parent.
8615 * report.cs: Negative error codes are now mapped to 8000 - code,
8616 so that the display is render more nicely.
8618 * typemanager.cs: Do not use try/catch, instead report a regular
8621 (GetPointerType, GetReferenceType): These methods provide
8622 mechanisms to obtain the T* and T& from a T. We had the code
8623 previously scattered around the code base, and it also used
8624 TypeManager.LookupType that would go through plenty of caches.
8625 This one goes directly to the type source.
8627 In some places we did the Type.GetType followed by
8628 ModuleBuilder.GetType, but not in others, so this unifies the
8631 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
8632 statements now that we have namespace information.
8634 * typemanager.cs (IsNamespace): New method, returns whether the
8635 string presented is a namespace or not.
8637 (ComputeNamespaces): New public entry point, computes the list of
8638 available namespaces, using the GetNamespaces API call in Mono, or
8639 the slower version in MS.NET.
8641 Now before we start the semantic analysis phase, we have a
8642 complete list of namespaces including everything that the user has
8645 Deleted old code to cache namespaces in .nsc files.
8647 2003-04-17 Miguel de Icaza <miguel@ximian.com>
8649 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
8650 class/struct location definition Location for the implicit
8651 constructor location.
8653 (Operator.Define): Use the location of the operator for the
8654 implicit Method definition.
8656 (Constructor.Emit): use the constructor location for the implicit
8657 base initializer constructor.
8659 * ecore.cs: Remove ITypeExpression. This interface is now gone,
8660 and the Expression class now contains two new methods:
8662 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
8663 isolate type lookup from the rest of the resolution process.
8665 Since we use Expressions to hold type definitions due to the way
8666 we parse the input we have historically overloaded Resolve to
8667 perform the Type lookups if a special flag is passed. Now this is
8668 eliminated and two methods take their place.
8670 The differences in the two methods between xStep and xTerminal is
8671 that xStep is involved in our current lookup system that uses
8672 SimpleNames to compose a name, while xTerminal is used just to
8673 catch the case where the simplename lookup failed.
8675 2003-04-16 Miguel de Icaza <miguel@ximian.com>
8677 * expression.cs (ResolveMemberAccess): Remove redundant code.
8678 TypeExpr expressions are always born fully resolved.
8680 * interface.cs (PopulateMethod): Do not lookup the types twice.
8681 We were doing it once during SemanticAnalysis and once during
8684 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
8685 in local variable type definitions, were being returned as a
8686 SimpleName (we decomposed everything into a string), that is
8687 because primary_expression was being used instead of a type in the
8688 grammar (reduce/reduce conflicts).
8690 The part that was wrong is that we converted the expression into a
8691 string (an oversimplification in one hand, compounded with primary
8692 expressions doing string concatenation).
8698 Would return "A.B.C[]" as a SimpleName. This stopped things like
8699 using clauses from working on this particular context. And a type
8700 was being matched directly against "A.B.C[]".
8702 We now use the correct approach, and allow for ComposedCast to be
8703 part of the unary expression. So the "A.B.C []" become a composed
8704 cast of "A.B.C" (as a nested group of MemberAccess with a
8705 SimpleName at the end) plus the rank composition "[]".
8709 2003-04-10 Miguel de Icaza <miguel@ximian.com>
8711 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
8712 for the access level checking.
8714 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
8715 `TypeContainer container', because I kept getting confused when I
8716 was debugging this code.
8718 * expression.cs (Indexers): Instead of tracking getters/setters,
8719 we now track them in parallel. We create one arraylist less, but
8720 most importantly it is possible now for the LValue code to find a
8721 matching get for a set.
8723 (IndexerAccess.DoResolveLValue): Update the code.
8724 GetIndexersForType has been modified already to extract all the
8725 indexers from a type. The code assumed it did not.
8727 Also make the code set the correct return type for the indexer.
8728 This was fixed a long time ago for properties, but was missing for
8729 indexers. It used to be void_type.
8731 (Binary.Emit): Test first for doubles instead of
8732 floats, as they are more common.
8734 (Binary.EmitBranchable): Use the .un version of the branch opcodes
8735 when dealing with floats and the <=, >= operators. This fixes bug
8738 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
8739 to load the array value by emitting a load on the foreach variable
8740 type. This was incorrect.
8742 We now emit the code to load an element using the the array
8743 variable type, and then we emit the conversion operator.
8747 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
8749 * attribute.cs: Avoid allocation of ArrayLists in the common case.
8751 2003-04-09 Miguel de Icaza <miguel@ximian.com>
8753 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
8754 test for protection before we test for signatures.
8756 (MethodSignature.ToString): implement.
8758 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
8759 to the case where we reduced into a LongConstant.
8761 * decl.cs (CheckAccessLevel): If the type is an array, we can not
8762 depend on whether the information is acurrate, because the
8763 Microsoft runtime will always claim that the array type is public,
8764 regardless of the real state.
8766 If the type is a pointer, another problem happens: the type is
8767 reported as non-public in Microsoft.
8769 In both cases we have to call CheckAccessLevel recursively with
8770 the underlying type as the argument to be tested.
8772 2003-04-08 Miguel de Icaza <miguel@ximian.com>
8774 * assign.cs (Assign.Emit): If we are dealing with a compound
8775 assignment expression, we should use the code path that stores the
8776 intermediate result in a temporary value. This fixes #40903.
8778 *expression.cs (Indirection.ToString): Provide ToString method for
8781 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
8783 * class.cs: Null out fields holding references to Block objects so
8784 they can be garbage collected.
8786 * expression.cs (OverloadResolve): Remove unused local.
8788 2003-04-07 Martin Baulig <martin@ximian.com>
8790 * codegen.cs (EmitContext.CurrentFile): New public field.
8791 (EmitContext.Mark): Use the CurrentFile to check whether the
8792 location is in the correct file.
8793 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
8795 2003-04-07 Martin Baulig <martin@ximian.com>
8797 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
8799 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
8800 location. [FIXME: The location argument which gets passed to this
8801 method is sometimes wrong!]
8803 2003-04-07 Nick Drochak <ndrochak@gol.com>
8805 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
8807 2003-04-07 Miguel de Icaza <miguel@ximian.com>
8809 * expression.cs (Indirection.EmitAssign): We were using the
8810 temporary, but returning immediately instead of continuing the
8813 2003-04-06 Martin Baulig <martin@ximian.com>
8815 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
8816 if it's a nested child, but also deriving from the outer class.
8819 * typemanager.cs (IsNestedChildOf): Make this work if it's a
8820 nested child, but also deriving from the outer class. See
8822 (FilterWithClosure): We may access private members of the outer
8823 class if we're a nested child and deriving from the outer class.
8824 (RealMemberLookup): Only set `closure_private_ok' if the
8825 `original_bf' contained BindingFlags.NonPublic.
8827 2003-04-05 Martin Baulig <martin@ximian.com>
8829 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
8830 probe if its a type parameter, and if so, flag an error.
8832 * decl.cs: Move here the SetParameterInfo code from class.cs.
8833 Handle IsGeneric here.
8835 Handle a variety of errors in the parameter info definition.
8837 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
8838 type parameters here.
8840 * cs-parser.jay (class_declaration): report errors for parameters
8843 2003-01-21 Miguel de Icaza <miguel@ximian.com>
8845 * generic.cs: New file, contains support code for generics.
8847 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
8848 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
8850 Update parser for the above removals.
8852 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
8853 now taken care of in the parser.
8855 2003-04-02 Miguel de Icaza <miguel@ximian.com>
8857 * class.cs (Event.Define): Do not allow abstract events to have
8860 2003-04-01 Miguel de Icaza <miguel@ximian.com>
8862 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
8863 block in event declarations.
8865 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
8866 value type, get its address.
8868 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
8869 leaving a class on the stack instead of a boolean value (int
8870 0/1). Change the code so we compare against null, and then the
8871 result against zero.
8873 * class.cs (TypeContainer.GetClassBases): We were checking for the
8874 parent class being sealed too late.
8876 * expression.cs (Binary.Emit): For <= and >= when dealing with
8877 floating point values, use cgt.un and clt.un instead of cgt and
8880 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
8882 * statement.cs: Apply the same optimization as MS: skip the
8883 GetEnumerator returning an IEnumerator, and use the one returning a
8884 CharEnumerator instead. This allows us to avoid the try-finally block
8887 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
8889 * cs-parser.jay: Attributes cannot be applied to
8890 namespaces. Fixes #40473
8892 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8895 (Add*): check if the name is valid using the full name for constants,
8896 fields, properties and events.
8898 2003-03-28 Miguel de Icaza <miguel@ximian.com>
8900 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
8901 char constants to be part of the enumeration.
8903 * expression.cs (Conditional.DoResolve): Add support for operator
8904 true. Implements the missing functionality from 14.12
8906 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
8907 operator true/false as required by the spec.
8909 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
8910 implicit conversion to boolean.
8912 * statement.cs (Statement.ResolveBoolean): A boolean expression is
8913 also one where the type implements `operator true'.
8915 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
8916 get an expression that will invoke operator true based on an
8919 (GetConversionOperators): Removed the hack that called op_True
8922 (Expression.ResolveBoolean): Move this from Statement.
8924 2003-03-17 Miguel de Icaza <miguel@ximian.com>
8926 * ecore.cs (FieldExpr): do not allow initialization of initonly
8927 fields on derived classes
8929 2003-03-13 Martin Baulig <martin@ximian.com>
8931 * statement.cs (Block.Emit): Call ig.BeginScope() and
8932 ig.EndScope() when compiling with debugging info; call
8933 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
8935 2003-03-08 Miguel de Icaza <miguel@ximian.com>
8937 * expression.cs (Indexers): Do not construct immediately, allow
8938 for new members to be appended as we go. Fixes 38143
8940 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8942 * expression.cs: save/restore context when resolving an unchecked
8945 2003-03-05 Miguel de Icaza <miguel@ximian.com>
8947 * cfold.cs: Catch division by zero in modulus operator during
8950 2003-03-03 Miguel de Icaza <miguel@ximian.com>
8952 * interface.cs (Interface.DefineMembers): Avoid defining members
8955 2003-02-27 Miguel de Icaza <miguel@ximian.com>
8957 * driver.cs: handle the +/- options for -noconfig
8959 * statement.cs (Unckeched.Resolve): Also track the state of
8960 unchecked in the Resolve phase.
8962 2003-02-27 Martin Baulig <martin@ximian.com>
8964 * ecore.cs (Expression.MemberLookup): Don't create a
8965 MethodGroupExpr for something which is not a method. Fixes #38291.
8967 2003-02-25 Miguel de Icaza <miguel@ximian.com>
8969 * class.cs (MemberBase.CheckParameters): Also check that the type
8970 is unmanaged if it is a pointer.
8972 * expression.cs (SizeOf.Resolve): Add location information.
8974 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
8975 a managed type is declared.
8977 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
8978 parameter modifiers as well. Fixes bug 38606
8980 * class.cs: Very sad. Am backing out the speed up changes
8981 introduced by the ArrayList -> Array in the TypeContainer, as they
8982 were not actually that much faster, and introduced a bug (no error
8983 reports on duplicated methods).
8985 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
8986 source first, this will guarantee that we have a valid expression
8987 before calling in lower levels functions that will require a
8988 resolved object. Then use this original_source in the
8989 target.ResolveLValue instead of the original source that was
8992 Another change. Use target.Resolve instead of LValueResolve.
8993 Although we are resolving for LValues, we will let the Assign code
8994 take care of that (it will be called again from Resolve). This
8995 basically allows code like this:
8997 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
8998 class Y { void A (X x) { x [0] += o; }
9000 The problem was that the indexer was trying to resolve for
9001 set_Item (idx, object o) and never finding one. The real set_Item
9002 was set_Item (idx, X). By delaying the process we get the right
9007 2003-02-23 Martin Baulig <martin@ximian.com>
9009 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
9010 while calling DoEmit ().
9012 * codegen.cs (EmitContext.Mark): Don't mark locations in other
9013 source files; if you use the #line directive inside a method, the
9014 compiler stops emitting line numbers for the debugger until it
9015 reaches the end of the method or another #line directive which
9016 restores the original file.
9018 2003-02-23 Martin Baulig <martin@ximian.com>
9020 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
9022 2003-02-23 Martin Baulig <martin@ximian.com>
9024 * statement.cs (Block.AddChildVariableNames): We need to call this
9025 recursively, not just for our immediate children.
9027 2003-02-23 Martin Baulig <martin@ximian.com>
9029 * class.cs (Event.Define): Always make the field private, like csc does.
9031 * typemanager.cs (TypeManager.RealMemberLookup): Make events
9032 actually work, fixes bug #37521.
9034 2003-02-23 Miguel de Icaza <miguel@ximian.com>
9036 * delegate.cs: When creating the various temporary "Parameters"
9037 classes, make sure that we call the ComputeAndDefineParameterTypes
9038 on those new parameters (just like we do with the formal ones), to
9039 allow them to be resolved in the context of the DeclSpace.
9041 This fixes the bug that Dick observed in Bugzilla #38530.
9043 2003-02-22 Miguel de Icaza <miguel@ximian.com>
9045 * expression.cs (ResolveMemberAccess): When resolving a constant,
9046 do not attempt to pull a constant if the value was not able to
9047 generate a valid constant.
9049 * const.cs (LookupConstantValue): Do not report more errors than required.
9051 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9053 * expression.cs: fixes bug #38328.
9055 2003-02-18 Miguel de Icaza <miguel@ximian.com>
9057 * class.cs: Changed all the various members that can be part of a
9058 class from being an ArrayList to be an Array of the right type.
9059 During the DefineType type_list, interface_list, delegate_list and
9060 enum_list are turned into types, interfaces, delegates and enums
9063 And during the member population, indexer_list, event_list,
9064 constant_list, field_list, instance_constructor_list, method_list,
9065 operator_list and property_list are turned into their real arrays.
9067 Although we could probably perform this operation earlier, for
9068 good error reporting we need to keep the lists and remove the
9069 lists for longer than required.
9071 This optimization was triggered by Paolo profiling the compiler
9072 speed on the output of `gen-sample-program.pl' perl script.
9074 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
9075 not crash in methods like MemberLookupFailed that use this field.
9077 This problem arises when the compiler fails to resolve a type
9078 during interface type definition for example.
9080 2003-02-18 Miguel de Icaza <miguel@ximian.com>
9082 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
9083 inherit from System.Object, so we have to stop at null, not only
9084 when reaching System.Object.
9086 2003-02-17 Miguel de Icaza <miguel@ximian.com>
9088 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
9089 DeclaredOnly because the parent indexer might have had a different
9090 name, but did not loop until the top of the hierarchy was reached.
9092 The problem this one fixes is 35492: when a class implemented an
9093 indexer from an interface, we were getting the interface method
9094 (which was abstract) and we were flagging an error (can not invoke
9097 This also keeps bug 33089 functioning, and test-148 functioning.
9099 * typemanager.cs (IsSpecialMethod): The correct way of figuring
9100 out if a method is special is to see if it is declared in a
9101 property or event, or whether it is one of the predefined operator
9102 names. This should fix correctly #36804.
9104 2003-02-15 Miguel de Icaza <miguel@ximian.com>
9106 The goal here is to remove the dependency on EmptyCast.Peel ().
9107 Killing it completely.
9109 The problem is that currently in a number of places where
9110 constants are expected, we have to "probe" for an EmptyCast, and
9111 Peel, which is not the correct thing to do, as this will be
9112 repetitive and will likely lead to errors.
9114 The idea is to remove any EmptyCasts that are used in casts that
9115 can be reduced to constants, so we only have to cope with
9118 This bug hunt was triggered by Bug 37363 and the desire to remove
9119 the duplicate pattern where we were "peeling" emptycasts to check
9120 whether they were constants. Now constants will always be
9123 * ecore.cs: Use an enumconstant here instead of wrapping with
9126 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
9127 throwing me off. By handling this we can get rid of a few hacks.
9129 * statement.cs (Switch): Removed Peel() code.
9131 2003-02-14 Miguel de Icaza <miguel@ximian.com>
9133 * class.cs: Location information for error 508
9135 * expression.cs (New.DoResolve): Add a guard against double
9136 resolution of an expression.
9138 The New DoResolve might be called twice when initializing field
9139 expressions (see EmitFieldInitializers, the call to
9140 GetInitializerExpression will perform a resolve on the expression,
9141 and later the assign will trigger another resolution
9143 This leads to bugs (#37014)
9145 * delegate.cs: The signature for EndInvoke should contain any ref
9146 or out parameters as well. We were not doing this in the past.
9148 * class.cs (Field.Define): Do not overwrite the type definition
9149 inside the `volatile' group. Turns out that volatile enumerations
9150 were changing the type here to perform a validity test, which
9153 2003-02-12 Miguel de Icaza <miguel@ximian.com>
9155 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
9156 and structs, we do not want to load the instance variable
9158 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
9159 enum_type has to be handled like an object reference (implicit
9160 conversions exists from this to object), but the regular IsClass
9161 and IsValueType tests will never return true for this one.
9163 Also we use TypeManager.IsValueType instead of type.IsValueType,
9164 just for consistency with the rest of the code (this is only
9165 needed if we ever use the construct exposed by test-180.cs inside
9166 corlib, which we dont today).
9168 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
9170 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
9173 2003-02-09 Martin Baulig <martin@ximian.com>
9175 * namespace.cs (Namespace..ctor): Added SourceFile argument.
9176 (Namespace.DefineNamespaces): New static public method; this is
9177 called when we're compiling with debugging to add all namespaces
9180 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
9181 pass it to the Namespace's .ctor.
9183 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
9184 and MethodBase arguments; pass the namespace ID to the symwriter;
9185 pass the MethodBase instead of the token to the symwriter.
9186 (SymbolWriter.DefineNamespace): New method to add a namespace to
9189 2003-02-09 Martin Baulig <martin@ximian.com>
9191 * symbolwriter.cs: New file. This is a wrapper around
9192 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
9193 methods here in near future.
9195 2003-02-09 Martin Baulig <martin@ximian.com>
9197 * codegen.cs (EmitContext.Mark): Just pass the arguments to
9198 ILGenerator.MarkSequencePoint() which are actually used by the
9201 2003-02-09 Martin Baulig <martin@ximian.com>
9203 * location.cs (SourceFile): New public sealed class. This
9204 contains the name and an index which is used in the location's token.
9205 (Location): Reserve an appropriate number of bits in the token for
9206 the source file instead of walking over that list, this gives us a
9207 really huge performance improvement when compiling with debugging.
9209 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
9210 `SourceFile' argument instead of a string.
9211 (Driver.ProcessFile): Add all the files via Location.AddFile(),
9212 but don't parse/tokenize here, we need to generate the list of all
9213 source files before we do that.
9214 (Driver.ProcessFiles): New static function. Parses/tokenizes all
9217 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
9218 instead of a string.
9220 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
9223 2003-02-09 Martin Baulig <martin@ximian.com>
9225 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
9226 filename on `#line default'.
9228 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
9230 * statement.cs: don't clear the pinned var when the fixed statement
9231 returns from the method (fixes bug#37752).
9233 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
9235 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
9238 2003-02-07 Martin Baulig <martin@ximian.com>
9240 * driver.cs: Removed the `--debug-args' command line argument.
9242 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
9243 automatically by the AsssemblyBuilder.
9244 (CodeGen.InitializeSymbolWriter): We don't need to call any
9245 initialization function on the symbol writer anymore. This method
9246 doesn't take any arguments.
9248 2003-02-03 Miguel de Icaza <miguel@ximian.com>
9250 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
9251 from referenced assemblies as well.
9253 2003-02-02 Martin Baulig <martin@ximian.com>
9255 * class.cs (MethodData.Emit): Generate debugging info for external methods.
9257 2003-02-02 Martin Baulig <martin@ximian.com>
9259 * class.cs (Constructor.Emit): Open the symbol writer before
9260 emitting the constructor initializer.
9261 (ConstructorInitializer.Emit): Call ec.Mark() to allow
9262 single-stepping through constructor initializers.
9264 2003-01-30 Miguel de Icaza <miguel@ximian.com>
9266 * class.cs: Handle error 549: do not allow virtual methods in
9269 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
9271 * decl.cs: Check access levels when resolving types
9273 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
9275 * statement.cs: Add parameters and locals set in catch blocks that might
9276 return to set vector
9278 2003-01-29 Miguel de Icaza <miguel@ximian.com>
9280 * class.cs (Operator): Set the SpecialName flags for operators.
9282 * expression.cs (Invocation.DoResolve): Only block calls to
9283 accessors and operators on SpecialName methods.
9285 (Cast.TryReduce): Handle conversions from char constants.
9288 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
9290 * statement.cs: small memory and time optimization in FlowBranching.
9292 2003-01-28 Pedro Mart <yoros@wanadoo.es>
9294 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
9295 problem that the last fix but in the other sid (Set).
9297 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
9298 access when there is no indexer in the hierarchy.
9300 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
9302 * class.cs: Combine some if statements.
9304 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9306 * driver.cs: fixed bug #37187.
9308 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
9310 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
9311 any indexer, it's needed to build a list with all the indexers in the
9312 hierarchy (AllGetters), else we have problems. Fixes #35653.
9314 2003-01-23 Miguel de Icaza <miguel@ximian.com>
9316 * class.cs (MethodData.Define): It is wrong for an interface
9317 implementation to be static in both cases: explicit and implicit.
9318 We were only handling this in one case.
9320 Improve the if situation there to not have negations.
9322 * class.cs (Field.Define): Turns out that we do not need to check
9323 the unsafe bit on field definition, only on usage. Remove the test.
9325 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9327 * driver.cs: use assembly.Location instead of Codebase (the latest
9328 patch made mcs fail when using MS assemblies).
9330 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
9332 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
9333 get the path to *corlib.dll.
9335 2003-01-21 Nick Drochak <ndrochak@gol.com>
9339 * typemanager.cs: Remove compiler warnings
9341 2003-01-20 Duncan Mak <duncan@ximian.com>
9343 * AssemblyInfo.cs: Bump the version number to 0.19.
9345 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9347 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
9349 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
9351 * class.cs (Constructor::Emit): Emit debugging info for constructors.
9353 2003-01-17 Miguel de Icaza <miguel@ximian.com>
9355 * cs-parser.jay: Small fix: we were not comparing the constructor
9356 name correctly. Thanks to Zoltan for the initial pointer.
9358 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
9360 * cs-tokenizer.cs: Set file name when specified with #line
9362 2003-01-15 Miguel de Icaza <miguel@ximian.com>
9364 * cs-parser.jay: Only perform the constructor checks here if we
9365 are named like the class; This will help provider a better
9366 error. The constructor path is taken when a type definition is
9367 not found, but most likely the user forgot to add the type, so
9368 report that rather than the constructor error.
9370 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
9372 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
9375 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
9377 * cs-parser.jay: Add cleanup call.
9379 2003-01-13 Duncan Mak <duncan@ximian.com>
9381 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
9382 consistent with other methods.
9384 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
9386 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
9388 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
9390 * attribute.cs: only set GuidAttr to true when we have a
9393 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9397 * typemanager.cs: fixes to allow mcs compile corlib with the new
9398 Type.IsSubclassOf fix.
9400 2003-01-08 Miguel de Icaza <miguel@ximian.com>
9402 * expression.cs (LocalVariableReference.DoResolve): Classify a
9403 constant as a value, not as a variable. Also, set the type for
9406 * cs-parser.jay (fixed_statement): take a type instead of a
9407 pointer_type, so we can produce a better error message later.
9409 * statement.cs (Fixed.Resolve): Flag types that are not pointers
9412 (For.DoEmit): Make inifinite loops have a
9413 non-conditional branch back.
9415 (Fixed.DoEmit): First populate the pinned variables, then emit the
9416 statement, then clear the variables. Before I was emitting the
9417 code once for each fixed piece.
9420 2003-01-08 Martin Baulig <martin@ximian.com>
9422 * statement.cs (FlowBranching.MergeChild): A break in a
9423 SWITCH_SECTION does not leave a loop. Fixes #36155.
9425 2003-01-08 Martin Baulig <martin@ximian.com>
9427 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
9428 lives in the same number space than `param_map'. Fixes #36154.
9430 2003-01-07 Miguel de Icaza <miguel@ximian.com>
9432 * cs-parser.jay (constructor_declaration): Set the
9433 Constructor.ModFlags before probing for it. This makes the
9434 compiler report 514, 515 and 132 (the code was there, but got
9437 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
9438 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
9439 (GotoCase.Resolve): Set `Returns' to ALWAYS.
9441 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
9443 * enum.cs: create the enum static fields using the enum type.
9445 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
9447 * class.cs: don't try to create the ParamBuilder for the return
9448 type if it's not needed (and handle it breaking for the ms runtime
9451 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
9453 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
9455 2002-12-29 Miguel de Icaza <miguel@ximian.com>
9457 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
9458 the command. This showed up while compiling the JANET source
9459 code, which used \r as its only newline separator.
9461 2002-12-28 Miguel de Icaza <miguel@ximian.com>
9463 * class.cs (Method.Define): If we are an operator (because it
9464 reuses our code), then set the SpecialName and HideBySig. #36128
9466 2002-12-22 Miguel de Icaza <miguel@ximian.com>
9468 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
9469 exception, report error 120 `object reference required'.
9471 * driver.cs: Add --pause option, used during to measure the size
9472 of the process as it goes with --timestamp.
9474 * expression.cs (Invocation.DoResolve): Do not allow methods with
9475 SpecialName to be invoked.
9477 2002-12-21 Miguel de Icaza <miguel@ximian.com>
9479 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
9480 number before adding it.
9482 2002-12-21 Ravi Pratap <ravi@ximian.com>
9484 * ecore.cs (StandardImplicitConversion): When in an unsafe
9485 context, we allow conversion between void * to any other pointer
9486 type. This fixes bug #35973.
9488 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
9490 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
9491 is not thrown when extensionless outputs are used
9493 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9495 * rootcontext.cs: fixed compilation of corlib.
9497 2002-12-19 Miguel de Icaza <miguel@ximian.com>
9499 * attribute.cs (Attributes.Contains): Add new method.
9501 * class.cs (MethodCore.LabelParameters): if the parameter is an
9502 `out' parameter, check that no attribute `[In]' has been passed.
9504 * enum.cs: Handle the `value__' name in an enumeration.
9506 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
9508 * decl.cs: Added special case to allow overrides on "protected
9511 2002-12-18 Ravi Pratap <ravi@ximian.com>
9513 * attribute.cs (Attributes.AddAttributeSection): Rename to this
9514 since it makes much more sense.
9516 (Attributes.ctor): Don't require a Location parameter.
9518 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
9520 * attribute.cs (ApplyAttributes): Remove extra Location parameters
9521 since we already have that information per attribute.
9523 * everywhere : make appropriate changes.
9525 * class.cs (LabelParameters): Write the code which actually
9526 applies attributes to the return type. We can't do this on the MS
9527 .NET runtime so we flag a warning in the case an exception is
9530 2002-12-18 Miguel de Icaza <miguel@ximian.com>
9532 * const.cs: Handle implicit null conversions here too.
9534 2002-12-17 Ravi Pratap <ravi@ximian.com>
9536 * class.cs (MethodCore.LabelParameters): Remove the extra
9537 Type [] parameter since it is completely unnecessary. Instead
9538 pass in the method's attributes so that we can extract
9539 the "return" attribute.
9541 2002-12-17 Miguel de Icaza <miguel@ximian.com>
9543 * cs-parser.jay (parse): Use Report.Error to flag errors instead
9544 of ignoring it and letting the compile continue.
9546 * typemanager.cs (ChangeType): use an extra argument to return an
9547 error condition instead of throwing an exception.
9549 2002-12-15 Miguel de Icaza <miguel@ximian.com>
9551 * expression.cs (Unary.TryReduce): mimic the code for the regular
9552 code path. Perform an implicit cast in the cases where we can
9553 implicitly convert to one of the integral types, and then reduce
9554 based on that constant. This fixes bug #35483.
9556 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9558 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
9560 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9562 * namespace.cs: fixed bug #35489.
9564 2002-12-12 Miguel de Icaza <miguel@ximian.com>
9566 * class.cs: Remove some dead code.
9568 * cs-parser.jay: Estimate the number of methods needed
9569 (RootContext.MethodCount);
9571 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
9572 numbers instead of StringBuilders.
9574 * support.cs (PtrHashtable): Add constructor with initial size;
9575 We can now reduce reallocations of the method table.
9577 2002-12-10 Ravi Pratap <ravi@ximian.com>
9579 * attribute.cs (ApplyAttributes): Keep track of the emitted
9580 attributes on a per-target basis. This fixes bug #35413.
9582 2002-12-10 Miguel de Icaza <miguel@ximian.com>
9584 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
9585 default to the Windows 1252 encoding.
9587 (UnixParseOption): Support version, thanks to Alp for the missing
9590 * AssemblyInfo.cs: Add nice assembly information.
9592 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
9595 * cs-parser.jay: Allow a trailing comma before the close bracked
9596 in the attribute_section production.
9598 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
9599 address of the instance was being taken, I will take this out,
9600 because we take the address of the object immediately here.
9602 2002-12-09 Ravi Pratap <ravi@ximian.com>
9604 * typemanager.cs (AreMultipleAllowed): Take care of the most
9605 obvious case where attribute type is not in the current assembly -
9608 2002-12-08 Miguel de Icaza <miguel@ximian.com>
9610 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
9611 definitions, instead of doing that afterwards.
9613 Also we use a nice little hack, depending on the constructor, we
9614 know if we are a "composed" name or a simple name. Hence, we
9615 avoid the IndexOf test, and we avoid
9617 * codegen.cs: Add code to assist in a bug reporter to track down
9618 the source of a compiler crash.
9620 2002-12-07 Ravi Pratap <ravi@ximian.com>
9622 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
9623 types have been emitted for a given element and flag an error
9624 if something which does not have AllowMultiple set is used more
9627 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
9628 attribute types and their corresponding AllowMultiple properties
9630 (AreMultipleAllowed): Check the property for a given type.
9632 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
9633 property in the case we have a TypeContainer.
9635 (Attributes.AddAttribute): Detect duplicates and just skip on
9636 adding them. This trivial fix catches a pretty gross error in our
9637 attribute emission - global attributes were being emitted twice!
9639 Bugzilla bug #33187 is now fixed.
9641 2002-12-06 Miguel de Icaza <miguel@ximian.com>
9643 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
9646 * expression.cs (Binary.ResolveOperator): I can only use the
9647 Concat (string, string, string) and Concat (string, string,
9648 string, string) if the child is actually a concatenation of
9651 2002-12-04 Miguel de Icaza <miguel@ximian.com>
9653 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
9654 context where we need a 2-character lookahead.
9656 * pending.cs (PendingImplementation): Rework so we can keep track
9657 of interface types all the time, and flag those which were
9658 implemented by parents as optional.
9660 2002-12-03 Miguel de Icaza <miguel@ximian.com>
9662 * expression.cs (Binary.ResolveOperator): Use
9663 String.Concat(string,string,string) or
9664 String.Concat(string,string,string,string) when possible.
9666 * typemanager: More helper methods.
9669 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
9671 * pending.cs: remove the bogus return from GetMissingInterfaces()
9672 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
9674 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9676 * namespace.cs: avoid duplicated 'using xxx' being added to
9677 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
9678 when we get more than one 'using' statement for the same namespace.
9679 Report a CS0105 warning for it.
9681 2002-11-30 Miguel de Icaza <miguel@ximian.com>
9683 * cs-tokenizer.cs (consume_identifier): use read directly, instead
9684 of calling getChar/putback, uses internal knowledge of it.
9686 (xtoken): Reorder tokenizer so most common patterns are checked
9687 first. This reduces the compilation time in another 5% (from 8.11s
9688 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
9690 The parsing time is 22% of the compilation in mcs, and from that
9691 64% is spent on the tokenization process.
9693 I tried using a binary search for keywords, but this is slower
9694 than the hashtable. Another option would be to do a couple of
9697 * Not use a StringBuilder, instead use an array of chars,
9698 with a set value. Notice that this way we could catch
9699 the 645 error without having to do it *afterwards*.
9701 * We could write a hand-parser to avoid the hashtable
9702 compares altogether.
9704 The identifier consumption process takes 37% of the tokenization
9705 time. Another 15% is spent on is_number. 56% of the time spent
9706 on is_number is spent on Int64.Parse:
9708 * We could probably choose based on the string length to
9709 use Int32.Parse or Int64.Parse and avoid all the 64-bit
9712 Another 3% is spend on wrapping `xtoken' in the `token' function.
9714 Handle 0xa0 as whitespace (#34752)
9716 2002-11-26 Miguel de Icaza <miguel@ximian.com>
9718 * typemanager.cs (IsCLRType): New routine to tell whether a type
9719 is one of the builtin types.
9721 Maybe it needs to use TypeCodes to be faster. Maybe we could use
9722 typecode in more places instead of doing pointer comparissions.
9723 We could leverage some knowledge about the way the typecodes are
9726 New code to cache namespaces in assemblies, it is currently not
9727 invoked, to be used soon.
9729 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
9731 * expression.cs (Binary.ResolveOperator): specially handle
9732 strings, and do not perform user-defined operator overloading for
9735 2002-11-24 Miguel de Icaza <miguel@ximian.com>
9737 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
9738 internalcall as it is a pretty simple operation; Avoid whenever
9739 possible to call Char.IsLetter.
9741 (consume_identifier): Cut by half the number of
9742 hashtable calls by merging the is_keyword and GetKeyword behavior.
9744 Do not short-circuit, because if we do, we
9745 report errors (ie, #if false && true would produce an invalid
9749 2002-11-24 Martin Baulig <martin@ximian.com>
9751 * expression.cs (Cast.TryReduce): If we're in checked syntax,
9752 check constant ranges and report a CS0221. Fixes #33186.
9754 2002-11-24 Martin Baulig <martin@ximian.com>
9756 * cs-parser.jay: Make this work for uninitialized variable
9757 declarations in the `for' initializer. Fixes #32416.
9759 2002-11-24 Martin Baulig <martin@ximian.com>
9761 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
9762 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
9764 2002-11-24 Martin Baulig <martin@ximian.com>
9766 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
9767 argument; if true, we also check for user-defined conversions.
9768 This is only needed if both arguments are of a user-defined type.
9769 Fixes #30443, added test-175.cs.
9770 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
9772 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
9774 2002-11-24 Martin Baulig <martin@ximian.com>
9776 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
9777 function to get the store opcode.
9778 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
9779 only emit the Ldelema if the store opcode is Stobj. You must run
9780 both test-34 and test-167 to test this. Fixes #34529.
9782 2002-11-23 Martin Baulig <martin@ximian.com>
9784 * ecore.cs (Expression.MemberLookup): Added additional
9785 `qualifier_type' argument which is used when we're being called
9786 from MemberAccess.DoResolve() and null if we're called from a
9788 (Expression.MemberLookupFailed): New method to report errors; this
9789 does the CS1540 check and reports the correct error message.
9791 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
9792 argument for the CS1540 check and redone the way how we're dealing
9793 with private members. See the comment in the source code for details.
9794 (FilterWithClosure): Reverted this back to revision 1.197; renamed
9795 `closure_start_type' to `closure_qualifier_type' and check whether
9796 it's not null. It was not this filter being broken, it was just
9797 being called with the wrong arguments.
9799 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
9800 and pass it the correct `qualifier_type'; this also does the error
9803 2002-11-22 Miguel de Icaza <miguel@ximian.com>
9805 * expression.cs (Invocation.EmitParams): If the we are dealing
9806 with a non-built-in value type, load its address as well.
9808 (ArrayCreation): Use a a pretty constant instead
9809 of the hardcoded value 2. Use 6 instead of 2 for the number of
9810 static initializers.
9812 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
9813 because they are not really value types, just glorified integers.
9815 * driver.cs: Do not append .exe, the CSC compiler does not do it.
9817 * ecore.cs: Remove redundant code for enumerations, make them use
9818 the same code path as everything else, fixes the casting issue
9819 with enumerations in Windows.Forms.
9821 * attribute.cs: Do only cast to string if it is a string, the
9822 validation happens later.
9824 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
9825 people upgrade their corlibs.
9827 * ecore.cs: Oops, enumerations were not following the entire code path
9829 2002-11-21 Miguel de Icaza <miguel@ximian.com>
9831 * typemanager.cs (FilterWithClosure): Commented out the test for
9832 1540 in typemanager.cs, as it has problems when accessing
9833 protected methods from a parent class (see test-174.cs).
9835 * attribute.cs (Attribute.ValidateGuid): new method.
9836 (Attribute.Resolve): Use above.
9838 2002-11-19 Miguel de Icaza <miguel@ximian.com>
9840 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
9842 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
9843 handling for enumerations, as we only needed the TypeContainer
9844 functionality to begin with (this is required for the fix below to
9845 work for enums that reference constants in a container class for
9848 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
9850 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
9851 a valid TypeBuilder to perform lookups on.o
9853 * class.cs (InheritableMemberSignatureCompare): Use true in the
9854 call to GetGetMethod and GetSetMethod, because we are comparing
9855 the signature, and we need to get the methods *even* if they are
9858 (PropertyBase.CheckBase): ditto.
9860 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
9861 GotoCase.Resolve): Use Peel on EmpytCasts.
9863 * ecore.cs (EmptyCast): drop child, add Peel method.
9865 2002-11-17 Martin Baulig <martin@ximian.com>
9867 * ecore.cs (EmptyCast.Child): New public property.
9869 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
9870 label resolved to an EmptyCast. Fixes #34162.
9871 (GotoCase.Resolve): Likewise.
9872 (Block.EmitMeta): Likewise.
9874 2002-11-17 Martin Baulig <martin@ximian.com>
9876 * expression.cs (Invocation.BetterConversion): Prefer int over
9877 uint; short over ushort; long over ulong for integer literals.
9878 Use ImplicitConversionExists instead of StandardConversionExists
9879 since we also need to check for user-defined implicit conversions.
9880 Fixes #34165. Added test-173.cs.
9882 2002-11-16 Martin Baulig <martin@ximian.com>
9884 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
9885 with the `true' and `false' literals. Fixes #33151.
9887 2002-11-16 Martin Baulig <martin@ximian.com>
9889 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
9890 October 22nd; don't do the cs1540 check for static members.
9892 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
9893 now using our own filter here and doing the cs1540 check again.
9895 2002-11-16 Martin Baulig <martin@ximian.com>
9897 * support.cs (InternalParameters): Don't crash if we don't have
9898 any fixed parameters. Fixes #33532.
9900 2002-11-16 Martin Baulig <martin@ximian.com>
9902 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
9903 when looking up static methods to make this work on Windows.
9906 2002-11-16 Martin Baulig <martin@ximian.com>
9908 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
9909 a setter rather than using PropertyInfo.CanWrite.
9911 2002-11-15 Nick Drochak <ndrochak@gol.com>
9913 * class.cs: Allow acces to block member by subclasses. Fixes build
9916 2002-11-14 Martin Baulig <martin@ximian.com>
9918 * class.cs (Constructor.Emit): Added the extern/block check.
9921 2002-11-14 Martin Baulig <martin@ximian.com>
9923 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
9924 iteration while looking for indexers, this is needed because the
9925 indexer may have a different name in our base classes. Fixed the
9926 error reporting (no indexers at all, not get accessor, no
9927 overloaded match). Fixes bug #33089.
9928 (IndexerAccess.DoResolveLValue): Likewise.
9930 2002-11-14 Martin Baulig <martin@ximian.com>
9932 * class.cs (PropertyBase.CheckBase): Make this work for multiple
9933 indexers. Fixes the first part of bug #33089.
9934 (MethodSignature.InheritableMemberSignatureCompare): Added support
9937 2002-11-13 Ravi Pratap <ravi@ximian.com>
9939 * attribute.cs (Attribute.Resolve): Catch the
9940 NullReferenceException and report it since it isn't supposed to
9943 2002-11-12 Miguel de Icaza <miguel@ximian.com>
9945 * expression.cs (Binary.EmitBranchable): Also handle the cases for
9946 LogicalOr and LogicalAnd that can benefit from recursively
9947 handling EmitBranchable. The code now should be nice for Paolo.
9949 2002-11-08 Miguel de Icaza <miguel@ximian.com>
9951 * typemanager.cs (LookupType): Added a negative-hit hashtable for
9952 the Type lookups, as we perform quite a number of lookups on
9953 non-Types. This can be removed once we can deterministically tell
9954 whether we have a type or a namespace in advance.
9956 But this might require special hacks from our corlib.
9960 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
9961 and double which avoids a conversion from an integer to a double.
9963 * expression.cs: tiny optimization, avoid calling IsConstant,
9964 because it effectively performs the lookup twice.
9966 2002-11-06 Miguel de Icaza <miguel@ximian.com>
9968 But a bogus return here to keep the semantics of the old code
9969 until the Mono runtime is fixed.
9971 * pending.cs (GetMissingInterfaces): New method used to remove all
9972 the interfaces that are already implemented by our parent
9973 classes from the list of pending methods.
9975 * interface.cs: Add checks for calls after ResolveTypeExpr.
9977 2002-11-05 Miguel de Icaza <miguel@ximian.com>
9979 * class.cs (Class.Emit): Report warning 67: event not used if the
9980 warning level is beyond 3.
9982 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
9983 being a NullLiteral.
9985 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
9988 * class.cs (TypeContainer.GetClassBases): Cover a missing code
9989 path that might fail if a type can not be resolved.
9991 * expression.cs (Binary.Emit): Emit unsigned versions of the
9994 * driver.cs: use error 5.
9996 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
9998 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
10000 2002-11-01 Miguel de Icaza <miguel@ximian.com>
10002 * cs-parser.jay (switch_section): A beautiful patch from Martin
10003 Baulig that fixed 33094.
10005 2002-10-31 Miguel de Icaza <miguel@ximian.com>
10007 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
10008 Check whether the base is abstract and report an error if so.
10010 * expression.cs (IndexerAccess.DoResolveLValue,
10011 IndexerAccess.DoResolve): ditto.
10013 (Invocation.DoResolve): ditto.
10015 (Invocation.FullMethodDesc): Improve the report string.
10017 * statement.cs (Block): Eliminate IsVariableDefined as it is
10018 basically just a wrapper for GetVariableInfo.
10020 * ecore.cs (SimpleName): Use new
10022 * support.cs (ReflectionParamter.ParameterType): We unwrap the
10023 type, as we return the actual parameter ref/unref state on a
10026 2002-10-30 Miguel de Icaza <miguel@ximian.com>
10028 * support.cs: Return proper flags REF/OUT fixing the previous
10031 * expression.cs: Reverted last patch, that was wrong. Is_ref is
10032 not used to mean `ref' but `ref or out' in ParameterReference
10034 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
10035 full type signature instead of calling TypeManger.CSharpName
10038 * support.cs (InternalParameters.ParameterDesc): Do not compare
10039 directly to the modflags, because REF/OUT will actually be bitsets
10042 * delegate.cs (VerifyMethod): Check also the modifiers.
10044 * cs-tokenizer.cs: Fix bug where floating point values with an
10045 exponent where a sign was missing was ignored.
10047 * driver.cs: Allow multiple assemblies to be specified in a single
10050 2002-10-28 Miguel de Icaza <miguel@ximian.com>
10052 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
10053 because identifiers after a parenthesis would end up in this kind
10054 of production, and we needed to desamiguate it for having casts
10057 (UserDefinedType *) xxx
10059 2002-10-24 Miguel de Icaza <miguel@ximian.com>
10061 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
10062 we should set on the Bindingflags.NonPublic, but not turn on
10063 private_ok. private_ok controls whether a Private member is
10064 returned (this is chekced on the filter routine), while the
10065 BindingFlags.NonPublic just controls whether private/protected
10066 will be allowed. This fixes the problem part of the problem of
10067 private properties being allowed to be used in derived classes.
10069 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
10070 so we can call the children DoResolveLValue method (this will
10071 properly signal errors on lvalue assignments to base properties)
10073 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
10074 getter are null, and we have a property info, we know that this
10075 happened because the lookup failed, so we report an error 122 for
10076 protection level violation.
10078 We also silently return if setter and getter are null in the
10079 resolve functions, this condition only happens if we have flagged
10080 the error before. This is the other half of the problem.
10082 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
10083 not have accessibility information, that is why we were returning
10084 true in the filter function in typemanager.cs.
10086 To properly report 122 (property is inaccessible because of its
10087 protection level) correctly, we report this error in ResolveAccess
10088 by failing if both the setter and the getter are lacking (ie, the
10091 DoResolve and DoLResolve have been modified to check for both
10092 setter/getter being null and returning silently, the reason being
10093 that I did not want to put the knowledge about this error in upper
10096 int old = Report.Errors;
10097 x = new PropertyExpr (...);
10098 if (old != Report.Errors)
10103 So the property expr is returned, but it is invalid, so the error
10104 will be flagged during the resolve process.
10106 * class.cs: Remove InheritablePropertySignatureCompare from the
10107 class, as we no longer depend on the property signature to compute
10108 whether it is possible to implement a method or not.
10110 The reason is that calling PropertyInfo.GetGetMethod will return
10111 null (in .NET, in Mono it works, and we should change this), in
10112 cases where the Get Method does not exist in that particular
10117 class X { public virtual int A { get { return 1; } } }
10119 class Z : Y { public override int A { get { return 2; } } }
10121 Would fail in Z because the parent (Y) would not have the property
10122 defined. So we avoid this completely now (because the alternative
10123 fix was ugly and slow), and we now depend exclusively on the
10126 (PropertyBase.CheckBase): Use a method-base mechanism to find our
10127 reference method, instead of using the property.
10129 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
10130 routines are gone now.
10132 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
10133 names, they were incorrectly named.
10135 * cs-tokenizer.cs: Return are more gentle token on failure.
10137 * pending.cs (PendingImplementation.InterfaceMethod): This routine
10138 had an out-of-sync index variable, which caused it to remove from
10139 the list of pending methods the wrong method sometimes.
10141 2002-10-22 Miguel de Icaza <miguel@ximian.com>
10143 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
10144 CanWrite, because those refer to this particular instance of the
10145 property, and do not take into account the fact that we can
10146 override single members of a property.
10148 Constructor requires an EmitContext. The resolution process does
10149 not happen here, but we need to compute the accessors before,
10150 because the resolution does not always happen for properties.
10152 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
10153 subclass, before we did not update this flag, but we did update
10156 (GetAccessors): Drop this routine, as it did not work in the
10157 presence of partially overwritten set/get methods.
10159 Notice that this broke the cs1540 detection, but that will require
10162 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10166 * driver.cs: issue a warning instead of an error if we don't support
10167 debugging for the platform. Also ignore a couple of errors that may
10168 arise when trying to write the symbols. Undo my previous patch.
10170 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10172 * driver.cs: ignore /debug switch except for Unix platforms.
10174 2002-10-23 Nick Drochak <ndrochak@gol.com>
10176 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
10178 2002-10-21 Miguel de Icaza <miguel@ximian.com>
10180 * driver.cs: Do not make mcs-debug conditional, so we do not break
10181 builds that use it.
10183 * statement.cs (UsageVector.MergeChildren): I would like Martin to
10184 review this patch. But basically after all the children variables
10185 have been merged, the value of "Breaks" was not being set to
10186 new_breaks for Switch blocks. I think that it should be set after
10187 it has executed. Currently I set this to the value of new_breaks,
10188 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
10189 conservative, but I do not understand this code very well.
10191 I did not break anything in the build, so that is good ;-)
10193 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
10195 2002-10-20 Mark Crichton <crichton@gimp.org>
10197 * cfold.cs: Fixed compile blocker. Really fixed it this time.
10199 2002-10-20 Nick Drochak <ndrochak@gol.com>
10201 * cfold.cs: Fixed compile blocker.
10203 2002-10-20 Miguel de Icaza <miguel@ximian.com>
10205 * driver.cs: I was chekcing the key, not the file.
10207 2002-10-19 Ravi Pratap <ravi@ximian.com>
10209 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
10210 message that we were generating - we just need to silently return
10213 2002-10-19 Miguel de Icaza <miguel@ximian.com>
10215 * class.cs (Event.Define): Change my previous commit, as this
10216 breaks the debugger. This is a temporary hack, as it seems like
10217 the compiler is generating events incorrectly to begin with.
10219 * expression.cs (Binary.ResolveOperator): Added support for
10220 "U operator - (E x, E y)"
10222 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
10225 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
10226 init-only variables, but this path did not take into account that
10227 there might be also instance readonly variables. Correct this
10230 This fixes bug 32253
10232 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
10235 * driver.cs: Change the extension for modules to `netmodule'
10237 * cs-parser.jay: Improved slightly the location tracking for
10238 the debugger symbols.
10240 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
10241 modifiers that were specified instead of the hardcoded value
10242 (FamAndAssem). This was basically ignoring the static modifier,
10243 and others. Fixes 32429.
10245 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
10246 fixed a bug in the process (32476)
10248 * expression.cs (ArrayAccess.EmitAssign): Patch from
10249 hwang_rob@yahoo.ca that fixes bug 31834.3
10251 2002-10-18 Miguel de Icaza <miguel@ximian.com>
10253 * driver.cs: Make the module extension .netmodule.
10255 2002-10-16 Miguel de Icaza <miguel@ximian.com>
10257 * driver.cs: Report an error if the resource file is not found
10258 instead of crashing.
10260 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
10261 false, like Emit does.
10263 2002-10-16 Nick Drochak <ndrochak@gol.com>
10265 * typemanager.cs: Remove unused private member. Also reported mcs
10266 bug to report this as a warning like csc.
10268 2002-10-15 Martin Baulig <martin@gnome.org>
10270 * statement.cs (Statement.Emit): Made this a virtual method; emits
10271 the line number info and calls DoEmit().
10272 (Statement.DoEmit): New protected abstract method, formerly knows
10273 as Statement.Emit().
10275 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
10277 2002-10-11 Miguel de Icaza <miguel@ximian.com>
10279 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
10280 have fixed a remaining problem: not every AddXXXX was adding a
10281 fully qualified name.
10283 Now everyone registers a fully qualified name in the DeclSpace as
10284 being defined instead of the partial name.
10286 Downsides: we are slower than we need to be due to the excess
10287 copies and the names being registered this way.
10289 The reason for this is that we currently depend (on the corlib
10290 bootstrap for instance) that types are fully qualified, because
10291 we dump all the types in the namespace, and we should really have
10292 types inserted into the proper namespace, so we can only store the
10293 basenames in the defined_names array.
10295 2002-10-10 Martin Baulig <martin@gnome.org>
10297 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
10298 from bug #31834, see the bug report for a testcase which is
10301 2002-10-10 Martin Baulig <martin@gnome.org>
10303 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
10304 flow analysis code for this.
10306 * statement.cs (Do, While, For): Tell the flow analysis code about
10308 (FlowBranching.UsageVector): Added support for infinite loops.
10309 (Block.Resolve): Moved the dead code elimination here and use flow
10312 2002-10-09 Miguel de Icaza <miguel@ximian.com>
10314 * class.cs (Field.Define): Catch cycles on struct type
10317 * typemanager.cs (IsUnmanagedtype): Do not recursively check
10318 fields if the fields are static. We only need to check instance
10321 * expression.cs (As.DoResolve): Test for reference type.
10323 * statement.cs (Using.ResolveExpression): Use
10324 ConvertImplicitRequired, not ConvertImplicit which reports an
10326 (Using.ResolveLocalVariableDecls): ditto.
10328 * expression.cs (Binary.ResolveOperator): Report errors in a few
10329 places where we had to.
10331 * typemanager.cs (IsUnmanagedtype): Finish implementation.
10333 2002-10-08 Miguel de Icaza <miguel@ximian.com>
10335 * expression.cs: Use StoreFromPtr instead of extracting the type
10336 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
10338 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
10339 an enumeration value to a System.Enum, but System.Enum is not a
10340 value type, but an class type, so we need to box.
10342 (Expression.ConvertExplicit): One codepath could return
10343 errors but not flag them. Fix this. Fixes #31853
10345 * parameter.cs (Resolve): Do not allow void as a parameter type.
10347 2002-10-06 Martin Baulig <martin@gnome.org>
10349 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
10350 if it's a class type and not a struct. Fixes #31815.
10352 2002-10-06 Martin Baulig <martin@gnome.org>
10354 * statement.cs: Reworked the flow analysis code a bit to make it
10355 usable for dead code elimination.
10357 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10359 * cs-parser.jay: allow empty source files. Fixes bug #31781.
10361 2002-10-04 Miguel de Icaza <miguel@ximian.com>
10363 * expression.cs (ComposedCast.DoResolveType): A quick workaround
10364 to fix the test 165, will investigate deeper.
10366 2002-10-04 Martin Baulig <martin@gnome.org>
10368 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
10369 finally blocks actually work.
10370 (Try.Resolve): We don't need to create a sibling for `finally' if
10371 there is no finally block.
10373 2002-10-04 Martin Baulig <martin@gnome.org>
10375 * class.cs (Constructor.Define): The default accessibility for a
10376 non-default constructor is private, not public.
10378 2002-10-04 Miguel de Icaza <miguel@ximian.com>
10380 * class.cs (Constructor): Make AllowedModifiers public, add
10383 * cs-parser.jay: Perform the modifiers test here, as the
10384 constructor for the Constructor class usually receives a zero
10385 because of the way we create it (first we create, later we
10386 customize, and we were never checking the modifiers).
10388 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
10389 is a version of LookupTypeReflection that includes the type-name
10390 cache. This can be used as a fast path for functions that know
10391 the fully qualified name and are only calling into *.GetType() to
10392 obtain a composed type.
10394 This is also used by TypeManager.LookupType during its type
10397 (LookupType): We now also track the real type name, as sometimes
10398 we can get a quey for the real type name from things like
10399 ComposedCast. This fixes bug 31422.
10401 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
10402 complete type fullname, it does not have to go through the type
10403 resolution system to obtain the composed version of the type (for
10404 obtaining arrays or pointers).
10406 (Conditional.Emit): Use the EmitBoolExpression to
10407 generate nicer code, as requested by Paolo.
10409 (ArrayCreation.CheckIndices): Use the patch from
10410 hwang_rob@yahoo.ca to validate the array initializers.
10412 2002-10-03 Miguel de Icaza <miguel@ximian.com>
10414 * class.cs (ConstructorInitializer.Emit): simplify code by using
10415 Invocation.EmitCall, and at the same time, fix the bugs in calling
10416 parent constructors that took variable arguments.
10418 * ecore.cs (Expression.ConvertNumericExplicit,
10419 Expression.ImplicitNumericConversion): Remove the code that
10420 manually wrapped decimal (InternalTypeConstructor call is now gone
10423 * expression.cs (Cast.TryReduce): Also handle decimal types when
10424 trying to perform a constant fold on the type.
10426 * typemanager.cs (IsUnmanagedtype): Partially implemented.
10428 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
10429 that only turned off an error report, and did nothing else.
10431 2002-10-02 Miguel de Icaza <miguel@ximian.com>
10433 * driver.cs: Handle and ignore /fullpaths
10435 2002-10-01 Miguel de Icaza <miguel@ximian.com>
10437 * expression.cs (Binary.ResolveOperator): Catch the case where
10438 DoNumericPromotions returns true,
10440 (Binary.DoNumericPromotions): Simplify the code, and the tests.
10442 2002-09-27 Miguel de Icaza <miguel@ximian.com>
10444 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
10447 2002-09-26 Miguel de Icaza <miguel@ximian.com>
10449 * ecore.cs (ConvertNumericExplicit): It is not enough that the
10450 conversion exists, but it is also required that the conversion be
10451 performed. This manifested in "(Type64Enum) 2".
10453 * class.cs (TypeManager.AddMethod): The fix is not to change
10454 AddEnum, because that one was using a fully qualified name (every
10455 DeclSpace derivative does), but to change the AddMethod routine
10456 that was using an un-namespaced name. This now correctly reports
10457 the duplicated name.
10459 Revert patch until I can properly fix it. The issue
10460 is that we have a shared Type space across all namespaces
10461 currently, which is wrong.
10463 Options include making the Namespace a DeclSpace, and merge
10464 current_namespace/current_container in the parser.
10466 2002-09-25 Miguel de Icaza <miguel@ximian.com>
10468 * cs-parser.jay: Improve error reporting when we get a different
10469 kind of expression in local_variable_type and
10470 local_variable_pointer_type.
10472 Propagate this to avoid missleading errors being reported.
10474 * ecore.cs (ImplicitReferenceConversion): treat
10475 TypeManager.value_type as a target just like object_type. As
10480 Is valid, and needs to result in the int 1 being boxed before it
10481 is assigned to the value type v.
10483 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
10484 to validate the enumeration name.
10486 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
10487 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
10488 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
10490 * ecore.cs (TryImplicitIntConversion): When doing an
10491 implicit-enumeration-conversion, check if the type is 64-bits and
10492 perform a conversion before passing to EnumConstant.
10494 2002-09-23 Miguel de Icaza <miguel@ximian.com>
10496 * decl.cs (Error_AmbiguousTypeReference); New routine used to
10497 report ambiguous type references. Unlike the MS version, we
10498 report what the ambiguity is. Innovation at work ;-)
10500 (DeclSpace.FindType): Require a location argument to
10501 display when we display an ambiguous error.
10503 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
10505 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
10507 * expression.cs (EmitDynamicInitializers): Apply patch from
10508 hwang_rob@yahoo.ca that fixes the order in which we emit our
10511 2002-09-21 Martin Baulig <martin@gnome.org>
10513 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
10514 delegate takes no arguments.
10516 2002-09-20 Miguel de Icaza <miguel@ximian.com>
10518 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
10521 * expression.cs: Extract the underlying type.
10523 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
10525 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
10527 2002-09-19 Miguel de Icaza <miguel@ximian.com>
10529 * class.cs (TypeContainer.DefineType): We can not use the nice
10530 PackingSize with the size set to 1 DefineType method, because it
10531 will not allow us to define the interfaces that the struct
10534 This completes the fixing of bug 27287
10536 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
10537 means also structs. This fixes part of the problem.
10538 (Expresion.ImplicitReferenceConversionExists): ditto.
10540 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
10541 error if there were no errors reported during the type lookup
10542 process, to avoid duplicates or redundant errors. Without this
10543 you would get an ambiguous errors plus a type not found. We have
10544 beaten the user enough with the first error.
10546 (DeclSparce.FindType): Emit a warning if we have an ambiguous
10549 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
10550 during the resolution process, stop the lookup, this avoids
10551 repeated error reports (same error twice).
10553 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
10555 * typemanager.cs (LookupType): Redo the type lookup code to match
10556 the needs of System.Reflection.
10558 The issue is that System.Reflection requires references to nested
10559 types to begin with a "+" sign instead of a dot. So toplevel
10560 types look like: "NameSpace.TopLevelClass", and nested ones look
10561 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
10564 2002-09-19 Martin Baulig <martin@gnome.org>
10566 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
10567 says that a method always returns or always throws an exception,
10568 don't report the CS0161.
10570 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
10571 set `Returns = new_returns'.
10573 2002-09-19 Martin Baulig <martin@gnome.org>
10575 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
10576 to an enum constant, check for a CS0176.
10578 2002-09-18 Miguel de Icaza <miguel@ximian.com>
10580 * class.cs (TypeContainer.CheckPairedOperators): Now we check
10581 for operators that must be in pairs and report errors.
10583 * ecore.cs (SimpleName.DoResolveType): During the initial type
10584 resolution process, when we define types recursively, we must
10585 check first for types in our current scope before we perform
10586 lookups in the enclosing scopes.
10588 * expression.cs (MakeByteBlob): Handle Decimal blobs.
10590 (Invocation.VerifyArgumentsCompat): Call
10591 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
10592 I thought we were supposed to always call this, but there are a
10593 few places in the code where we dont do it.
10595 2002-09-17 Miguel de Icaza <miguel@ximian.com>
10597 * driver.cs: Add support in -linkres and -resource to specify the
10598 name of the identifier.
10600 2002-09-16 Miguel de Icaza <miguel@ximian.com>
10602 * ecore.cs (StandardConversionExists): Sync with the conversion
10603 code: allow anything-* to void* conversions.
10605 (FindMostSpecificSource): Use an Expression argument
10606 instead of a Type, because we might be handed over a Literal which
10607 gets a few more implicit conversions that plain types do not. So
10608 this information was being lost.
10610 Also, we drop the temporary type-holder expression when not
10613 2002-09-17 Martin Baulig <martin@gnome.org>
10615 * class.cs (PropertyBase.CheckBase): Don't check the base class if
10616 this is an explicit interface implementation.
10618 2002-09-17 Martin Baulig <martin@gnome.org>
10620 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
10621 different `IndexerName' attributes.
10623 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
10624 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
10625 virtual CommonResolve().
10627 2002-09-16 Miguel de Icaza <miguel@ximian.com>
10629 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
10630 and convert that to the UnderlyingType.
10632 * statement.cs (Foreach.Resolve): Indexers are just like variables
10633 or PropertyAccesses.
10635 * cs-tokenizer.cs (consume_string): Track line numbers and columns
10636 inside quoted strings, we were not doing this before.
10638 2002-09-16 Martin Baulig <martin@gnome.org>
10640 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
10641 resolve it. This is needed for the definite assignment check of the
10642 instance expression, fixes bug #29846.
10643 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
10645 2002-09-16 Nick Drochak <ndrochak@gol.com>
10647 * parameter.cs: Fix compile error. Cannot reference static member
10648 from an instance object. Is this an mcs bug?
10650 2002-09-14 Martin Baulig <martin@gnome.org>
10652 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
10653 multiple times. Fixes bug #30295, added test-166.cs.
10655 2002-09-14 Martin Baulig <martin@gnome.org>
10657 * statement.cs (Block.Emit): Don't emit unreachable code.
10658 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
10659 `break' statements.
10660 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
10662 2002-09-14 Martin Baulig <martin@gnome.org>
10664 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
10667 2002-09-14 Martin Baulig <martin@gnome.org>
10669 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
10670 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
10671 be false on the ms runtime.
10673 2002-09-13 Martin Baulig <martin@gnome.org>
10675 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
10676 the CS0038 error message.
10678 2002-09-12 Miguel de Icaza <miguel@ximian.com>
10680 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
10681 constant inside, return it.
10683 2002-09-12 Martin Baulig <martin@gnome.org>
10685 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
10686 implicit conversion can be done between enum types.
10688 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
10689 check whether an implicit conversion to the current enum's UnderlyingType
10690 exists and report an error if not.
10692 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
10693 without debugging support.
10695 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
10696 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
10698 2002-09-12 Martin Baulig <martin@gnome.org>
10700 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
10702 * ecore.cs (IMemberExpr.DeclaringType): New property.
10703 (SimpleName.SimpleNameResolve): Check whether we're accessing a
10704 nonstatic member of an outer type (CS0038).
10706 2002-09-11 Miguel de Icaza <miguel@ximian.com>
10708 * driver.cs: Activate the using-error detector at warning level
10709 4 (at least for MS-compatible APIs).
10711 * namespace.cs (VerifyUsing): Small buglett fix.
10713 * pending.cs (PendingImplementation): pass the container pointer.
10715 * interface.cs (GetMethods): Allow for recursive definition. Long
10716 term, I would like to move every type to support recursive
10717 definitions, not the current ordering mechanism that we have right
10720 The situation is this: Attributes are handled before interfaces,
10721 so we can apply attributes to interfaces. But some attributes
10722 implement interfaces, we will now handle the simple cases
10723 (recursive definitions will just get an error).
10725 * parameter.cs: Only invalidate types at the end if we fail to
10728 2002-09-09 Martin Baulig <martin@gnome.org>
10730 * ecore.cs (PropertyExpr.Emit): Also check for
10731 TypeManager.system_int_array_get_length so this'll also work when
10732 compiling corlib. Fixes #30003.
10734 2002-09-09 Martin Baulig <martin@gnome.org>
10736 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
10737 and throw an exception if we can't get the type's size. Fixed #30040,
10740 2002-09-09 Martin Baulig <martin@gnome.org>
10742 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
10744 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
10745 context. Fixes bug #30027.
10747 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
10748 virtual functions. Fixes bug #30043, added test-164.cs.
10750 2002-09-08 Ravi Pratap <ravi@ximian.com>
10752 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
10754 2002-09-08 Nick Drochak <ndrochak@gol.com>
10756 * driver.cs: Use an object to get the windows codepage since it's not a
10759 2002-09-08 Miguel de Icaza <miguel@ximian.com>
10761 * statement.cs (For.Emit): for infinite loops (test == null)
10762 return whether there is a break inside, not always "true".
10764 * namespace.cs (UsingEntry): New struct to hold the name of the
10765 using definition, the location where it is defined, and whether it
10766 has been used in a successful type lookup.
10768 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
10773 2002-09-06 Ravi Pratap <ravi@ximian.com>
10775 * attribute.cs : Fix incorrect code which relied on catching
10776 a NullReferenceException to detect a null being passed in
10777 where an object was expected.
10779 2002-09-06 Miguel de Icaza <miguel@ximian.com>
10781 * statement.cs (Try): flag the catch variable as assigned
10783 * expression.cs (Cast): Simplified by using ResolveType instead of
10784 manually resolving.
10786 * statement.cs (Catch): Fix bug by using ResolveType.
10788 2002-09-06 Ravi Pratap <ravi@ximian.com>
10790 * expression.cs (BetterConversion): Special case for when we have
10791 a NullLiteral as the argument and we have to choose between string
10792 and object types - we choose string the way csc does.
10794 * attribute.cs (Attribute.Resolve): Catch the
10795 NullReferenceException and report error #182 since the Mono
10796 runtime no more has the bug and having this exception raised means
10797 we tried to select a constructor which takes an object and is
10800 2002-09-05 Ravi Pratap <ravi@ximian.com>
10802 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
10803 message (1502, 1503) when we can't locate a method after overload
10804 resolution. This is much more informative and closes the bug
10807 * interface.cs (PopulateMethod): Return if there are no argument
10808 types. Fixes a NullReferenceException bug.
10810 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
10811 expressions too. Previously we were checking only in one place for
10812 positional arguments leaving out named arguments.
10814 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
10815 type to the enum type is not allowed. Remove code corresponding to
10818 (ConvertNumericExplicit): Allow explicit conversions from
10819 the underlying type to enum type. This precisely follows the spec
10820 and closes a bug filed by Gonzalo.
10822 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10825 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
10827 2002-09-03 Miguel de Icaza <miguel@ximian.com>
10829 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
10830 it was important that we stored the right value after the
10831 reduction in `converted'.
10833 2002-09-04 Martin Baulig <martin@gnome.org>
10835 * location.cs (Location.SymbolDocument): Use full pathnames for the
10838 2002-08-30 Miguel de Icaza <miguel@ximian.com>
10840 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
10841 of the expression resolve mechanism, because that will catch the
10842 SimpleName error failures.
10844 (Conditional): If we can not resolve the
10845 expression, return, do not crash.
10847 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10850 (location): display token name instead of its number.
10852 2002-08-28 Martin Baulig <martin@gnome.org>
10854 * expression.cs (Binary.ResolveOperator): Don't silently return
10855 but return an error if an operator cannot be applied between two
10858 2002-08-28 Martin Baulig <martin@gnome.org>
10860 * class.cs (Constructor.Define): Set the permission attributes
10861 correctly instead of making all constructors public.
10863 2002-08-28 Martin Baulig <martin@gnome.org>
10865 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
10866 for private members before reporting a CS0103; if we find anything,
10869 2002-08-28 Martin Baulig <martin@gnome.org>
10871 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
10872 to check whether `closure_start_type == closure_invocation_type',
10873 we also need to check whether `m.DeclaringType == closure_invocation_type'
10874 before bypassing the permission checks. We might be accessing
10875 protected/private members from the base class.
10876 (TypeManager.RealMemberLookup): Only set private_ok if private
10877 members were requested via BindingFlags.NonPublic.
10879 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
10881 * expression.cs (MemberAccess.ResolveMemberAccess): Set
10882 MethodGroupExpr.IsExplicitImpl if appropriate.
10883 (Invocation.DoResolve): Don't report the CS0120 for explicit
10884 interface implementations.
10886 2002-08-27 Martin Baulig <martin@gnome.org>
10888 * expression.cs (Invocation.DoResolve): If this is a static
10889 method and we don't have an InstanceExpression, we must report
10892 2002-08-25 Martin Baulig <martin@gnome.org>
10894 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
10895 `==' between a valuetype and an object.
10897 2002-08-25 Miguel de Icaza <miguel@ximian.com>
10899 * ecore.cs (TypeExpr): Provide a ToString method.
10901 2002-08-24 Martin Baulig <martin@gnome.org>
10903 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
10904 now called proggie.dbg and it's a binary file.
10906 2002-08-23 Martin Baulig <martin@gnome.org>
10908 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
10910 2002-08-23 Martin Baulig <martin@gnome.org>
10912 * struct.cs (MyStructInfo.ctor): Make this work with empty
10913 structs; it's not allowed to use foreach() on null.
10915 2002-08-23 Martin Baulig <martin@gnome.org>
10917 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
10918 writer the full pathname of the generated assembly.
10920 2002-08-23 Martin Baulig <martin@gnome.org>
10922 * statements.cs (FlowBranching.UsageVector.MergeChildren):
10923 A `finally' block never returns or breaks; improved handling of
10926 2002-08-23 Martin Baulig <martin@gnome.org>
10928 * statement.cs (Throw.Resolve): Allow `throw null'.
10930 2002-08-23 Martin Baulig <martin@gnome.org>
10932 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
10933 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
10934 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
10935 MemberLookup would return a wrong event if this is an explicit
10936 interface implementation and the class has an event with the same
10939 2002-08-23 Martin Baulig <martin@gnome.org>
10941 * statement.cs (Block.AddChildVariableNames): New public method.
10942 (Block.AddChildVariableName): Likewise.
10943 (Block.IsVariableNameUsedInChildBlock): Likewise.
10944 (Block.AddVariable): Check whether a variable name has already
10945 been used in a child block.
10947 * cs-parser.jay (declare_local_variables): Mark all variable names
10948 from the current block as being used in a child block in the
10951 2002-08-23 Martin Baulig <martin@gnome.org>
10953 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
10954 find the symbol writer.
10956 * driver.cs: csc also allows the arguments to /define being
10957 separated by commas, not only by semicolons.
10959 2002-08-23 Martin Baulig <martin@gnome.org>
10961 * interface.cs (Interface.GetMembers): Added static check for events.
10963 2002-08-15 Martin Baulig <martin@gnome.org>
10965 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
10966 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
10968 * ecore.cs (Expression.MemberLookup): Added documentation and explained
10969 why the MethodData.EmitDestructor() change was necessary.
10971 2002-08-20 Martin Baulig <martin@gnome.org>
10973 * class.cs (TypeContainer.FindMembers): Added static check for events.
10975 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
10977 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
10978 use Type.GetEvents(), not Type.FindMembers().
10980 2002-08-20 Martin Baulig <martin@gnome.org>
10982 * decl.cs (MemberCache): Added a special method cache which will
10983 be used for method-only searched. This ensures that a method
10984 search will return a MethodInfo with the correct ReflectedType for
10987 2002-08-20 Martin Baulig <martin@gnome.org>
10989 * decl.cs (DeclSpace.FindMembers): Made this public.
10991 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10993 * delegate.cs: fixed build on windows.
10994 [FIXME: Filed as bug #29150: MCS must report these errors.]
10996 2002-08-19 Ravi Pratap <ravi@ximian.com>
10998 * ecore.cs (StandardConversionExists): Return a false
10999 if we are trying to convert the void type to anything else
11000 since that is not allowed.
11002 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
11003 we flag error 70 in the event an event is trying to be accessed
11004 directly from outside the declaring type.
11006 2002-08-20 Martin Baulig <martin@gnome.org>
11008 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
11009 MemberCache from typemanager.cs to decl.cs.
11011 2002-08-19 Martin Baulig <martin@gnome.org>
11013 * class.cs (TypeContainer): Implement IMemberContainer.
11014 (TypeContainer.DefineMembers): Create the MemberCache.
11015 (TypeContainer.FindMembers): Do better BindingFlags checking; only
11016 return public members if BindingFlags.Public was given, check
11017 whether members are static.
11019 2002-08-16 Martin Baulig <martin@gnome.org>
11021 * decl.cs (DeclSpace.Define): Splitted this in Define and
11022 DefineMembers. DefineMembers is called first and initializes the
11025 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
11026 DefineMembers() on all our DeclSpaces.
11028 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
11029 but call DefineMembers() on all nested interfaces. We call their
11030 Define() in our new Define() function.
11032 * interface.cs (Interface): Implement IMemberContainer.
11033 (Interface.Define): Moved all code except the attribute stuf to
11035 (Interface.DefineMembers): Initialize the member cache.
11037 * typemanager.cs (IMemberFinder): Removed this interface, we don't
11038 need this anymore since we can use MemberCache.FindMembers directly.
11040 2002-08-19 Martin Baulig <martin@gnome.org>
11042 * typemanager.cs (MemberCache): When creating the cache for an
11043 interface type, add all inherited members.
11044 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
11045 to `out bool used_cache' and documented it.
11046 (TypeManager.MemberLookup): If we already used the cache in the first
11047 iteration, we don't need to do the interfaces check.
11049 2002-08-19 Martin Baulig <martin@gnome.org>
11051 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
11052 here from IMemberFinder and don't implement this interface anymore.
11053 (DeclSpace.MemberCache): Moved here from IMemberFinder.
11055 * typemanager.cs (IMemberFinder): This interface is now only used by
11056 classes which actually support the member cache.
11057 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
11058 since we only put DeclSpaces into this Hashtable.
11059 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
11060 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
11062 2002-08-16 Martin Baulig <martin@gnome.org>
11064 * typemanager.cs (ICachingMemberFinder): Removed.
11065 (IMemberFinder.MemberCache): New property.
11066 (TypeManager.FindMembers): Merged this with RealFindMembers().
11067 This function will never be called from TypeManager.MemberLookup()
11068 so we can't use the cache here, just the IMemberFinder.
11069 (TypeManager.MemberLookup_FindMembers): Check whether the
11070 IMemberFinder has a MemberCache and call the cache's FindMembers
11072 (MemberCache): Rewrote larger parts of this yet another time and
11073 cleaned it up a bit.
11075 2002-08-15 Miguel de Icaza <miguel@ximian.com>
11077 * driver.cs (LoadArgs): Support quoting.
11079 (Usage): Show the CSC-like command line arguments.
11081 Improved a few error messages.
11083 2002-08-15 Martin Baulig <martin@gnome.org>
11085 * typemanager.cs (IMemberContainer.Type): New property.
11086 (IMemberContainer.IsInterface): New property.
11088 The following changes are conditional to BROKEN_RUNTIME, which is
11089 defined at the top of the file.
11091 * typemanager.cs (MemberCache.MemberCache): Don't add the base
11092 class'es members, but add all members from TypeHandle.ObjectType
11093 if we're an interface.
11094 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
11095 is the current type.
11096 (MemberCache.CacheEntry.Container): Removed this field.
11097 (TypeHandle.GetMembers): Include inherited members.
11099 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11101 * typemanager.cs: fixed compilation and added a comment on a field that
11104 2002-08-15 Martin Baulig <martin@gnome.org>
11106 * class.cs (ConstructorInitializer.Resolve): In the
11107 Expression.MemberLookup call, use the queried_type as
11110 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
11111 declared' attribute, it's always true.
11112 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
11113 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
11114 temporary wrapper for FindMembers which tells MemberLookup whether
11115 members from the base classes are included in the return value.
11116 This will go away soon.
11117 (TypeManager.MemberLookup): Use this temporary hack here; once the
11118 new MemberCache is completed, we don't need to do the DeclaredOnly
11119 looping here anymore since the MemberCache will take care of this.
11120 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
11121 (MemberCache): When creating the MemberCache for a class, get
11122 members from the current class and all its base classes.
11123 (MemberCache.CacheEntry.Container): New field. This is a
11124 temporary hack until the Mono runtime is fixed to distinguish
11125 between ReflectedType and DeclaringType. It allows us to use MCS
11126 with both the MS runtime and the unfixed Mono runtime without
11127 problems and without accecting performance.
11128 (MemberCache.SearchMembers): The DeclaredOnly looping from
11129 TypeManager.MemberLookup is now done here.
11131 2002-08-14 Martin Baulig <martin@gnome.org>
11133 * statement.cs (MyStructInfo.MyStructInfo): Don't call
11134 Type.GetFields on dynamic types but get the fields from the
11135 corresponding TypeContainer.
11136 (MyStructInfo.GetStructInfo): Added check for enum types.
11138 * typemanager.cs (MemberList.IsSynchronized): Implemented.
11139 (MemberList.SyncRoot): Implemented.
11140 (TypeManager.FilterWithClosure): No need to check permissions if
11141 closure_start_type == closure_invocation_type, don't crash if
11142 closure_invocation_type is null.
11144 2002-08-13 Martin Baulig <martin@gnome.org>
11146 Rewrote TypeContainer.FindMembers to use a member cache. This
11147 gives us a speed increase of about 35% for the self-hosting MCS
11148 build and of about 15-20% for the class libs (both on GNU/Linux).
11150 * report.cs (Timer): New class to get enhanced profiling. This
11151 whole class is "TIMER" conditional since it remarkably slows down
11154 * class.cs (MemberList): New class. This is an IList wrapper
11155 which we're now using instead of passing MemberInfo[]'s around to
11156 avoid copying this array unnecessarily.
11157 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
11158 (ICachingMemberFinder, IMemberContainer): New interface.
11159 (TypeManager.FilterWithClosure): If `criteria' is null, the name
11160 has already been checked, otherwise use it for the name comparision.
11161 (TypeManager.FindMembers): Renamed to RealMemberFinder and
11162 provided wrapper which tries to use ICachingMemberFinder.FindMembers
11163 if possible. Returns a MemberList, not a MemberInfo [].
11164 (TypeHandle): New class, implements IMemberContainer. We create
11165 one instance of this class per type, it contains a MemberCache
11166 which is used to do the member lookups.
11167 (MemberCache): New class. Each instance of this class contains
11168 all members of a type and a name-based hash table.
11169 (MemberCache.FindMembers): This is our new member lookup
11170 function. First, it looks up all members of the requested name in
11171 the hash table. Then, it walks this list and sorts out all
11172 applicable members and returns them.
11174 2002-08-13 Martin Baulig <martin@gnome.org>
11176 In addition to a nice code cleanup, this gives us a performance
11177 increase of about 1.4% on GNU/Linux - not much, but it's already
11178 half a second for the self-hosting MCS compilation.
11180 * typemanager.cs (IMemberFinder): New interface. It is used by
11181 TypeManager.FindMembers to call FindMembers on a TypeContainer,
11182 Enum, Delegate or Interface.
11183 (TypeManager.finder_to_member_finder): New PtrHashtable.
11184 (TypeManager.finder_to_container): Removed.
11185 (TypeManager.finder_to_delegate): Removed.
11186 (TypeManager.finder_to_interface): Removed.
11187 (TypeManager.finder_to_enum): Removed.
11189 * interface.cs (Interface): Implement IMemberFinder.
11191 * delegate.cs (Delegate): Implement IMemberFinder.
11193 * enum.cs (Enum): Implement IMemberFinder.
11195 * class.cs (TypeContainer): Implement IMemberFinder.
11197 2002-08-12 Martin Baulig <martin@gnome.org>
11199 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
11201 2002-08-12 Martin Baulig <martin@gnome.org>
11203 * ecore.cs (ITypeExpression): New interface for expressions which
11205 (TypeExpression): Renamed to TypeLookupExpression.
11206 (Expression.DoResolve): If we're doing a types-only lookup, the
11207 expression must implement the ITypeExpression interface and we
11208 call DoResolveType() on it.
11209 (SimpleName): Implement the new ITypeExpression interface.
11210 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
11211 hack, the situation that we're only looking up types can't happen
11212 anymore when this method is called. Moved the type lookup code to
11213 DoResolveType() and call it.
11214 (SimpleName.DoResolveType): This ITypeExpression interface method
11215 is now doing the types-only lookup.
11216 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
11217 (ResolveFlags): Added MaskExprClass.
11219 * expression.cs (MemberAccess): Implement the ITypeExpression
11221 (MemberAccess.DoResolve): Added support for a types-only lookup
11222 when we're called via ITypeExpression.DoResolveType().
11223 (ComposedCast): Implement the ITypeExpression interface.
11225 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
11226 Expression.Resolve() with ResolveFlags.Type instead.
11228 2002-08-12 Martin Baulig <martin@gnome.org>
11230 * interface.cs (Interface.Define): Apply attributes.
11232 * attribute.cs (Attribute.ApplyAttributes): Added support for
11233 interface attributes.
11235 2002-08-11 Martin Baulig <martin@gnome.org>
11237 * statement.cs (Block.Emit): Only check the "this" variable if we
11238 do not always throw an exception.
11240 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
11241 whether the property has a set accessor.
11243 2002-08-11 Martin Baulig <martin@gnome.org>
11245 Added control flow analysis support for structs.
11247 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
11248 with control flow analysis turned off.
11249 (IVariable): New interface.
11250 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
11251 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
11252 (FieldExpr.DoResolve): Resolve the instance expression with flow
11253 analysis turned off and do the definite assignment check after the
11254 resolving when we know what the expression will resolve to.
11256 * expression.cs (LocalVariableReference, ParameterReference):
11257 Implement the new IVariable interface, only call the flow analysis
11258 code if ec.DoFlowAnalysis is true.
11259 (This): Added constructor which takes a Block argument. Implement
11260 the new IVariable interface.
11261 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
11262 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
11263 This does the definite assignment checks for struct members.
11265 * class.cs (Constructor.Emit): If this is a non-static `struct'
11266 constructor which doesn't have any initializer, call
11267 Block.AddThisVariable() to tell the flow analysis code that all
11268 struct elements must be initialized before control returns from
11271 * statement.cs (MyStructInfo): New public class.
11272 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
11273 argument to this indexer. If non-zero, check an individual struct
11274 member, not the whole struct.
11275 (FlowBranching.CheckOutParameters): Check struct members.
11276 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
11277 overloaded versions of these methods which take an additional
11278 `int field_idx' argument to check struct members.
11279 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
11280 overloaded versions of these methods which take an additional
11281 `string field_name' argument to check struct member.s
11282 (VariableInfo): Implement the IVariable interface.
11283 (VariableInfo.StructInfo): New public property. Returns the
11284 MyStructInfo instance of the variable if it's a struct or null.
11285 (Block.AddThisVariable): New public method. This is called from
11286 Constructor.Emit() for non-static `struct' constructor which do
11287 not have any initializer. It creates a special variable for the
11288 "this" instance variable which will be checked by the flow
11289 analysis code to ensure that all of the struct's fields are
11290 initialized before control returns from the constructor.
11291 (UsageVector): Added support for struct members. If a
11292 variable/parameter is a struct with N members, we reserve a slot
11293 in the usage vector for each member. A struct is considered fully
11294 initialized if either the struct itself (slot 0) or all its
11295 members are initialized.
11297 2002-08-08 Martin Baulig <martin@gnome.org>
11299 * driver.cs (Driver.MainDriver): Only report an error CS5001
11300 if there were no compilation errors.
11302 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
11303 `UnsafeContext' property to determine whether the parent is in
11304 unsafe context rather than checking the parent's ModFlags:
11305 classes nested in an unsafe class are unsafe as well.
11307 2002-08-08 Martin Baulig <martin@gnome.org>
11309 * statement.cs (UsageVector.MergeChildren): Distinguish between
11310 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
11311 we return. Added test17() and test18() to test-154.cs.
11313 2002-08-08 Martin Baulig <martin@gnome.org>
11315 * typemanager.cs (TypeManager.FilterWithClosure): If we have
11316 Family access, make sure the invoking type isn't a subclass of the
11317 queried type (that'd be a CS1540).
11319 * ecore.cs (Expression.MemberLookup): Added overloaded version of
11320 this method which takes an additional `Type invocation_type'.
11322 * expression.cs (BaseAccess.DoResolve): Use the base type as
11323 invocation and query type.
11324 (MemberAccess.DoResolve): If the lookup failed and we're about to
11325 report a CS0122, try a lookup with the ec.ContainerType - if this
11326 succeeds, we must report a CS1540.
11328 2002-08-08 Martin Baulig <martin@gnome.org>
11330 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
11331 (MethodGroupExpr): Implement the IMemberExpr interface.
11333 * expression (MemberAccess.ResolveMemberAccess): No need to have
11334 any special code for MethodGroupExprs anymore, they're now
11337 2002-08-08 Martin Baulig <martin@gnome.org>
11339 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
11340 Family, FamANDAssem and FamORAssem permissions.
11341 (TypeManager.IsSubclassOrNestedChildOf): New public method.
11343 2002-08-08 Martin Baulig <martin@gnome.org>
11345 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
11346 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
11349 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
11351 * driver.cs: implemented /resource option to embed managed resources.
11353 2002-08-07 Martin Baulig <martin@gnome.org>
11355 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
11356 (FieldBase.HasFieldInitializer): New public property.
11357 (FieldBase.GetInitializerExpression): New public method. Resolves and
11358 returns the field initializer and makes sure it is only resolved once.
11359 (TypeContainer.EmitFieldInitializers): Call
11360 FieldBase.GetInitializerExpression to get the initializer, this ensures
11361 that it isn't resolved multiple times.
11363 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
11364 the resolving process (SimpleName/MemberLookup) that we're currently
11365 emitting a field initializer (which must not access any instance members,
11366 this is an error CS0236).
11368 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
11369 argument, if the `IsFieldInitializer' flag is set, we must report and
11370 error CS0236 and not an error CS0120.
11372 2002-08-07 Martin Baulig <martin@gnome.org>
11374 * ecore.cs (IMemberExpr): New public interface.
11375 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
11376 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
11377 if the expression is an IMemberExpr.
11379 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
11380 to be null, implicitly default to `this' if we're non-static in
11381 this case. Simplified the code a lot by using the new IMemberExpr
11382 interface. Also fixed bug #28176 here.
11384 2002-08-06 Martin Baulig <martin@gnome.org>
11386 * cs-parser.jay (SimpleLookup): Removed. We need to create
11387 ParameterReferences during semantic analysis so that we can do a
11388 type-only search when resolving Cast, TypeOf and SizeOf.
11389 (block): Pass the `current_local_parameters' to the Block's
11392 * class.cs (ConstructorInitializer): Added `Parameters parameters'
11393 argument to the constructor.
11394 (ConstructorInitializer.Resolve): Create a temporary implicit
11395 block with the parameters.
11397 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
11398 references here if we aren't doing a type-only search.
11400 * statement.cs (Block): Added constructor which takes a
11401 `Parameters parameters' argument.
11402 (Block.Parameters): New public property.
11404 * support.cs (InternalParameters.Parameters): Renamed `parameters'
11405 to `Parameters' and made it public readonly.
11407 2002-08-06 Martin Baulig <martin@gnome.org>
11409 * ecore.cs (Expression.Warning): Made this public as well.
11411 * report.cs (Report.Debug): Print the contents of collections.
11413 2002-08-06 Martin Baulig <martin@gnome.org>
11415 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
11416 used to tell Resolve() which kinds of expressions it may return.
11417 (Expression.Resolve): Added overloaded version of this method which
11418 takes a `ResolveFlags flags' argument. This can be used to tell
11419 Resolve() which kinds of expressions it may return. Reports a
11421 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
11422 ResolveFlags.SimpleName.
11423 (Expression.Error118): Added overloaded version of this method which
11424 takes a `ResolveFlags flags' argument. It uses the flags to determine
11425 which kinds of expressions are allowed.
11427 * expression.cs (Argument.ResolveMethodGroup): New public method.
11428 Resolves an argument, but allows a MethodGroup to be returned.
11429 This is used when invoking a delegate.
11431 * TODO: Updated a bit.
11433 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11435 Fixed compilation with csc.
11437 * ecore.cs: Expression.Error made public. Is this correct? Should
11438 Warning be made public too?
11440 * expression.cs: use ea.Location instead of ea.loc.
11441 [FIXME: Filed as bug #28607: MCS must report these errors.]
11443 2002-08-06 Martin Baulig <martin@gnome.org>
11445 * ecore.cs (Expression.loc): Moved the location here instead of
11446 duplicating it in all derived classes.
11447 (Expression.Location): New public property.
11448 (Expression.Error, Expression.Warning): Made them non-static and
11449 removed the location argument.
11450 (Expression.Warning): Added overloaded version which takes an
11451 `int level' argument.
11452 (Expression.Error118): Make this non-static and removed the
11453 expression and location arguments.
11454 (TypeExpr): Added location argument to the constructor.
11456 * expression.cs (StaticCallExpr): Added location argument to
11458 (Indirection, PointerArithmetic): Likewise.
11459 (CheckedExpr, UnCheckedExpr): Likewise.
11460 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
11461 (StringPtr): Likewise.
11464 2002-08-05 Martin Baulig <martin@gnome.org>
11466 * expression.cs (BaseAccess.DoResolve): Actually report errors.
11468 * assign.cs (Assign.DoResolve): Check whether the source
11469 expression is a value or variable.
11471 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
11472 while resolving the corresponding blocks.
11474 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
11475 an error, don't silently return null.
11477 * statement.cs (Block.AddVariable): Do the error reporting here
11478 and distinguish between CS0128 and CS0136.
11479 (Block.DoResolve): Report all unused labels (warning CS0164).
11480 (LabeledStatement): Pass the location to the constructor.
11481 (LabeledStatement.HasBeenReferenced): New property.
11482 (LabeledStatement.Resolve): Set it to true here.
11484 * statement.cs (Return.Emit): Return success even after reporting
11485 a type mismatch error (CS0126 or CS0127), this is what csc does and
11486 it avoids confusing the users with any consecutive errors.
11488 2002-08-05 Martin Baulig <martin@gnome.org>
11490 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
11492 * const.cs (Const.LookupConstantValue): Catch circular definitions.
11494 * expression.cs (MemberAccess.DoResolve): Silently return if an
11495 error has already been reported.
11497 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
11498 error has already been reported.
11500 2002-08-05 Martin Baulig <martin@gnome.org>
11502 * statement.cs (UsageVector): Only initialize the `parameters'
11503 vector if we actually have any "out" parameters.
11505 2002-08-05 Martin Baulig <martin@gnome.org>
11507 * expression.cs (Binary.ResolveOperator): When combining delegates,
11508 they must have the same type.
11510 2002-08-05 Martin Baulig <martin@gnome.org>
11512 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
11513 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
11514 work with the ms runtime and we also don't need it: if we're a
11515 PropertyBuilder and not in the `indexer_arguments' hash, then we
11516 are a property and not an indexer.
11518 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
11519 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
11520 since the latter one doesn't work with the ms runtime.
11522 2002-08-03 Martin Baulig <martin@gnome.org>
11524 Fixed bugs #27998 and #22735.
11526 * class.cs (Method.IsOperator): New public field.
11527 (Method.CheckBase): Report CS0111 if there's already a method
11528 with the same parameters in the current class. Report CS0508 when
11529 attempting to change the return type of an inherited method.
11530 (MethodData.Emit): Report CS0179 if a method doesn't have a body
11531 and it's not marked abstract or extern.
11532 (PropertyBase): New abstract base class for Property and Indexer.
11533 (PropertyBase.CheckBase): Moved here from Property and made it work
11535 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
11536 the same so we can reuse it there.
11537 (Property, Indexer): Derive from PropertyBase.
11538 (MethodSignature.inheritable_property_signature_filter): New delegate
11539 to find properties and indexers.
11541 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
11542 argument and improved error reporting.
11544 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
11545 EmptyReadOnlyParameters and made it a property.
11547 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
11548 version of this method which takes a `PropertyInfo indexer'.
11549 (TypeManager.RegisterIndexer): New method.
11551 * class.cs: Added myself as author of this file :-)
11553 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11555 * class.cs: fixed compilation on windoze.
11557 2002-08-03 Martin Baulig <martin@gnome.org>
11559 * interface.cs (Interface.GetInterfaceBases): Check whether all
11560 base interfaces are at least as accessible than the current one.
11562 * class.cs (TypeContainer.GetClassBases): Check whether base types
11563 are at least as accessible than the current type.
11564 (TypeContainer.AsAccessible): Implemented and made non-static.
11565 (MemberBase.CheckParameters): Report errors if the accessibility
11568 * delegate.cs (Delegate.Delegate): The default visibility is
11569 internal for top-level types and private for nested types.
11570 (Delegate.Define): Report errors if the accessibility checks fail.
11572 * enum.cs (Enum.Enum): The default visibility is internal for
11573 top-level types and private for nested types.
11574 (Enum.DefineType): Compute the correct visibility.
11576 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
11577 function which takes a `bool is_toplevel' instead of a TypeContainer.
11579 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
11582 2002-08-02 Martin Baulig <martin@gnome.org>
11584 * expression.cs (LocalVariableReferenc): Added constructor which
11585 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
11586 (LocalVariableReference.IsReadOnly): New property.
11587 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
11588 variable is readonly, use our own readonly flag to do this; you can
11589 use the new constructor to get a writable reference to a read-only
11592 * cs-parser.jay (foreach_statement, using_statement): Get a writable
11593 reference to the local variable.
11595 2002-08-01 Miguel de Icaza <miguel@ximian.com>
11597 * rootcontext.cs (ResolveCore): Also include System.Exception
11599 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
11600 we reach an EmptyStatement.
11602 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
11605 * expression.cs (Binary.ResolveOperator): Check error result in
11608 use brtrue/brfalse directly and avoid compares to null.
11610 2002-08-02 Martin Baulig <martin@gnome.org>
11612 * class.cs (TypeContainer.Define): Define all nested interfaces here.
11613 Fixes bug #28407, added test-155.cs.
11615 2002-08-01 Martin Baulig <martin@gnome.org>
11617 * class.cs (Event.EmitDefaultMethod): Make this work with static
11618 events. Fixes #28311, added verify-3.cs.
11620 2002-08-01 Martin Baulig <martin@gnome.org>
11622 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
11623 `is_disposable' fields.
11624 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
11625 `hm.is_disposable' if we're using the collection pattern.
11626 (Foreach.EmitCollectionForeach): Use the correct type for the
11627 enumerator's local variable, only emit the try/finally block if
11628 necessary (fixes #27713).
11630 2002-08-01 Martin Baulig <martin@gnome.org>
11632 * ecore.cs (Expression.report118): Renamed to Error118 and made
11635 * statement.cs (Throw.Resolve): Check whether the expression is of
11636 the correct type (CS0118) and whether the type derives from
11637 System.Exception (CS0155).
11638 (Catch.Resolve): New method. Do the type lookup here and check
11639 whether it derives from System.Exception (CS0155).
11640 (Catch.CatchType, Catch.IsGeneral): New public properties.
11642 * typemanager.cs (TypeManager.exception_type): Added.
11644 2002-07-31 Miguel de Icaza <miguel@ximian.com>
11646 * driver.cs: Updated About function.
11648 2002-07-31 Martin Baulig <martin@gnome.org>
11650 Implemented Control Flow Analysis.
11652 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
11653 (EmitContext.CurrentBranching): Added.
11654 (EmitContext.StartFlowBranching): Added.
11655 (EmitContext.EndFlowBranching): Added.
11656 (EmitContext.KillFlowBranching): Added.
11657 (EmitContext.IsVariableAssigned): Added.
11658 (EmitContext.SetVariableAssigned): Added.
11659 (EmitContext.IsParameterAssigned): Added.
11660 (EmitContext.SetParameterAssigned): Added.
11661 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
11662 Added control flow analysis stuff here.
11664 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
11665 resolve the expression as lvalue.
11666 (LocalVariableReference.DoResolve): Check whether the variable has
11667 already been assigned.
11668 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
11669 the parameter as assigned here.
11670 (ParameterReference.DoResolve): Check whether the parameter has already
11672 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
11673 expression as lvalue.
11675 * statement.cs (FlowBranching): New class for the flow analysis code.
11676 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
11677 (LabeledStatement.IsDefined): New public property.
11678 (LabeledStatement.AddUsageVector): New public method to tell flow
11679 analyis that the label may be reached via a forward jump.
11680 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
11682 (VariableInfo.Number): New public field. This is used by flow analysis
11683 to number all locals of a block.
11684 (Block.CountVariables): New public property. This is the number of
11685 local variables in this block (including the locals from all parent
11687 (Block.EmitMeta): Number all the variables.
11689 * statement.cs: Added flow analysis support to all classes.
11691 2002-07-31 Martin Baulig <martin@gnome.org>
11693 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
11694 To get debugging messages, compile mcs with /define:MCS_DEBUG and
11695 then use this argument.
11697 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
11699 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
11700 use this to specify /define options.
11702 2002-07-29 Martin Baulig <martin@gnome.org>
11704 * statement.cs (Fixed): Moved all code that does variable lookups
11705 and resolvings from Emit to Resolve.
11707 * statement.cs (For): Moved all code that does variable lookups
11708 and resolvings from Emit to Resolve.
11710 * statement.cs (Using): Moved all code that does variable lookups
11711 and resolvings from Emit to Resolve.
11713 2002-07-29 Martin Baulig <martin@gnome.org>
11715 * attribute.cs (Attribute.Resolve): Explicitly catch a
11716 System.NullReferenceException when creating the
11717 CustromAttributeBuilder and report a different warning message.
11719 2002-07-29 Martin Baulig <martin@gnome.org>
11721 * support.cs (ParameterData.ParameterName): Added method to
11722 get the name of a parameter.
11724 * typemanager.cs (TypeManager.IsValueType): New public method.
11726 2002-07-29 Martin Baulig <martin@gnome.org>
11728 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
11729 is a flag which specifies that it's either ref or out.
11730 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
11731 the out parameter to `out Parameter.Modifier mod', also set the
11732 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
11734 * support.cs (InternalParameters.ParameterModifier): Distinguish
11735 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
11736 Parameter.Modifier.ISBYREF flag if it's either ref or out.
11738 * expression.cs (Argument.GetParameterModifier): Distinguish
11739 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
11740 Parameter.Modifier.ISBYREF flag if it's either ref or out.
11742 2002-07-29 Martin Baulig <martin@gnome.org>
11744 * expression.cs (ParameterReference.ParameterReference): Added
11745 `Location loc' argument to the constructor.
11747 * cs-parser.jay: Pass location to ParameterReference.
11749 2002-07-28 Miguel de Icaza <miguel@ximian.com>
11751 * statement.cs (Try): Initialize the location.
11753 * cs-parser.jay: pass location to Try.
11755 * expression.cs (Unary.Reduce): Change the prototype to return
11756 whether a constant fold could be performed or not. The result is
11757 returned in an out parameters. In the case of Indirection and
11758 AddressOf, we want to perform the full tests.
11760 2002-07-26 Miguel de Icaza <miguel@ximian.com>
11762 * statement.cs (Statement.Emit): Flag dead code.
11764 2002-07-27 Andrew Birkett <andy@nobugs.org>
11766 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
11768 2002-07-27 Martin Baulig <martin@gnome.org>
11770 * class.cs (MethodData.Define): Put back call to
11771 TypeManager.AddMethod(), accidentally commented this out.
11773 * report.cs (Debug): New public method to print debugging information,
11774 this is `[Conditional ("DEBUG")]'.
11776 2002-07-26 Martin Baulig <martin@gnome.org>
11778 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
11779 (switch_statement): Push the current_block to the switch_stack and
11780 pop it again when we're done with the switch.
11781 (switch_section): The new block is a child of the current_block.
11782 Fixes bug #24007, added test-152.cs.
11784 2002-07-27 Martin Baulig <martin@gnome.org>
11786 * expression.cs (Invocation.EmitArguments): When calling a varargs
11787 function with only its fixed arguments, we need to pass an empty
11790 2002-07-27 Martin Baulig <martin@gnome.org>
11792 Mono 0.13 has been released.
11794 2002-07-25 Miguel de Icaza <miguel@ximian.com>
11796 * driver.cs: Rename --resource to --linkres, because that is what
11797 we do currently, we dont support --resource yet.
11799 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
11801 2002-07-25 Martin Baulig <martin@gnome.org>
11803 * class.cs (MethodData): New public class. This is a `method builder'
11804 class for a method or one accessor of a Property/Indexer/Event.
11805 (MethodData.GetMethodFlags): Moved here from MemberBase.
11806 (MethodData.ApplyAttributes): Likewise.
11807 (MethodData.ApplyObsoleteAttribute): Likewise.
11808 (MethodData.ApplyConditionalAttribute): Likewise.
11809 (MethodData.ApplyDllImportAttribute): Likewise.
11810 (MethodData.CheckAbstractAndExternal): Likewise.
11811 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
11812 (MethodData.Emit): Formerly known as Method.Emit().
11813 (MemberBase): Moved everything which was specific to a single
11814 accessor/method to MethodData.
11815 (Method): Create a new MethodData and call Define() and Emit() on it.
11816 (Property, Indexer, Event): Create a new MethodData objects for each
11817 accessor and call Define() and Emit() on them.
11819 2002-07-25 Martin Baulig <martin@gnome.org>
11821 Made MethodCore derive from MemberBase to reuse the code from there.
11822 MemberBase now also checks for attributes.
11824 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
11825 (MemberBase.GetMethodFlags): Moved here from class Method and marked
11827 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
11828 `CallingConventions cc' and `Attributes opt_attrs' arguments.
11829 (MemberBase.ApplyAttributes): New virtual method; applies the
11830 attributes to a method or accessor.
11831 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
11832 (MemberBase.ApplyConditionalAttribute): Likewise.
11833 (MemberBase.ApplyDllImportAttribute): Likewise.
11834 (MemberBase.CheckAbstractAndExternal): Likewise.
11835 (MethodCore.ParameterTypes): This is now a property instead of a
11836 method, it's initialized from DoDefineParameters().
11837 (MethodCore.ParameterInfo): Removed the set accessor.
11838 (MethodCore.DoDefineParameters): New protected virtual method to
11839 initialize ParameterTypes and ParameterInfo.
11840 (Method.GetReturnType): We can now simply return the MemberType.
11841 (Method.GetMethodFlags): Override the MemberBase version and add
11842 the conditional flags.
11843 (Method.CheckBase): Moved some code from Define() here, call
11844 DoDefineParameters() here.
11845 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
11846 here to avoid some larger code duplication.
11847 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
11848 ensure that abstract and external accessors don't declare a body.
11850 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
11851 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
11852 lookup in the attribute's parent classes, so we need to abort as soon
11853 as we found the first match.
11854 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
11855 the attribute has no arguments.
11857 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
11860 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11862 * cs-parser.jay: reverted previous patch.
11864 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11866 * cs-parser.jay: fixed bug #22119.
11868 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11870 * attribute.cs: fixed compilation. The error was:
11871 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
11872 be assigned to before control leaves the current method."
11873 [FIXME: Filed as bug #28186: MCS must report this error.]
11875 2002-07-25 Martin Baulig <martin@gnome.org>
11877 * attribute.cs (Attribute.Conditional_GetConditionName): New static
11878 method to pull the condition name ouf of a Conditional attribute.
11879 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
11880 the obsolete message and error flag out of an Obsolete attribute.
11882 * class.cs (Method.GetMethodFlags): New public method to get the
11883 TypeManager.MethodFlags for this method.
11884 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
11886 (Method.Define): Get and apply the Obsolete and Conditional attributes;
11887 if we're overriding a virtual function, set the new private variable
11888 `parent_method'; call the new TypeManager.AddMethod().
11890 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
11891 the MethodBuilder and the Method in a PtrHashtable.
11892 (TypeManager.builder_to_method): Added for this purpose.
11893 (TypeManager.MethodFlags): Added IsObsoleteError.
11894 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
11895 Obsolete and Conditional arguments in MethodBuilders. If we discover
11896 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
11897 the message from the attribute.
11899 2002-07-24 Martin Baulig <martin@gnome.org>
11901 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
11902 preprocessor directives, ensure that the argument to #define/#undef is
11903 exactly one identifier and that it's actually an identifier.
11905 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
11908 2002-07-24 Martin Baulig <martin@gnome.org>
11910 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
11911 initialize it to TypeManager.object_type in the constructor.
11912 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
11913 of the `hm.get_current' method if we're using the collection pattern.
11914 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
11915 for the explicit conversion to make it work when we're using the collection
11916 pattern and the `Current' property has a different return type than `object'.
11919 2002-07-24 Martin Baulig <martin@gnome.org>
11921 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
11922 does not match, but don't report any errors. This method is called in
11923 order for all methods in a MethodGroupExpr until a matching method is
11924 found, so we don't want to bail out if the first method doesn't match.
11925 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
11926 matches, report the 123. Fixes #28070.
11928 2002-07-24 Martin Baulig <martin@gnome.org>
11930 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
11931 TypeManager.TypeToCoreType() to the top of the method so the
11932 following equality checks will work. Fixes #28107.
11934 2002-07-24 Martin Baulig <martin@gnome.org>
11936 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
11937 operand is of type uint, and the other operand is of type sbyte,
11938 short or int, the operands are converted to type long." -
11939 Actually do what this comment already told us. Fixes bug #28106,
11942 2002-07-24 Martin Baulig <martin@gnome.org>
11944 * class.cs (MethodBase): New abstract class. This is now a base
11945 class for Property, Indexer and Event to avoid some code duplication
11946 in their Define() and DefineMethods() methods.
11947 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
11948 generic methods for Define() and DefineMethods().
11949 (FieldBase): Derive from MemberBase, not MemberCore.
11950 (Property): Derive from MemberBase, not MemberCore.
11951 (Property.DefineMethod): Moved all the code from this method to the
11952 new MethodBase.DefineAccessor(), just call it with appropriate
11954 (Property.Define): Call the new Property.DoDefine(), this does some
11955 sanity checks and we don't need to duplicate the code everywhere.
11956 (Event): Derive from MemberBase, not MemberCore.
11957 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
11958 accessors, this will also make them work with interface events.
11959 (Indexer): Derive from MemberBase, not MemberCore.
11960 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
11961 (Indexer.Define): Use the new MethodBase functions.
11963 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
11964 argument to the constructor.
11965 (Interface.FindMembers): Added support for interface events.
11966 (Interface.PopluateEvent): Implemented.
11968 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
11970 2002-07-22 Miguel de Icaza <miguel@ximian.com>
11972 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
11973 but this is required to check for a method name being the same as
11974 the containing class.
11978 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11980 * interface.cs: initialize variable.
11982 2002-07-23 Martin Baulig <martin@gnome.org>
11984 Implemented the IndexerName attribute in interfaces.
11986 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
11987 name if this is an explicit interface implementation.
11988 (Indexer.InterfaceIndexerName): New public variable. If we're
11989 implementing an interface indexer, this is the IndexerName in that
11990 interface. Otherwise, it's the IndexerName.
11991 (Indexer.DefineMethod): If we're implementing interface indexer,
11992 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
11993 and Pending.ImplementIndexer methods.
11994 (Indexer.Define): Also define the PropertyBuilder if we're
11995 implementing an interface indexer and this is neither an explicit
11996 interface implementation nor do the IndexerName match the one in
11999 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
12000 If a method is defined here, then we always need to create a proxy
12001 for it. This is used when implementing interface indexers.
12002 (Pending.IsInterfaceIndexer): New public method.
12003 (Pending.ImplementIndexer): New public method.
12004 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
12005 This is used when implementing interface indexers to define a proxy
12007 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
12008 define a proxy if necessary.
12010 * interface.cs (Interface.IndexerName): New public variable.
12011 (Interface.PopulateIndexer): Set the IndexerName.
12012 (Interface.DefineIndexers): New private method. Populate all the
12013 indexers and make sure their IndexerNames match.
12015 * typemanager.cs (IndexerPropertyName): Added support for interface
12018 2002-07-22 Martin Baulig <martin@gnome.org>
12020 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
12021 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
12022 ret if HasReturnLabel.
12023 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
12026 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
12027 and set the ec.LoopBeginTryCatchLevel.
12028 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
12029 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
12030 the current ec.TryCatchLevel, the branch goes out of an exception
12031 block. In this case, we need to use Leave and not Br.
12033 2002-07-22 Martin Baulig <martin@gnome.org>
12035 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
12036 block unless the block does not always return or it is contained in
12037 another try { ... } catch { ... } block. Fixes bug #26506.
12038 Added verify-1.cs to the test suite.
12040 2002-07-22 Martin Baulig <martin@gnome.org>
12042 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
12043 then we do not always return. Fixes bug #24985.
12045 2002-07-22 Martin Baulig <martin@gnome.org>
12047 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
12048 lookup on a per-class level; ie. walk up the class hierarchy until we
12049 found at least one applicable method, then choose the best among them.
12050 Fixes bug #24463 and test-29.cs.
12052 2002-07-22 Martin Baulig <martin@gnome.org>
12054 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
12055 return types of the methods. The return type is not part of the
12056 signature and we must not check it to make the `new' modifier work.
12057 Fixes bug #27999, also added test-147.cs.
12058 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
12060 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
12061 on the method's return type.
12063 2002-07-21 Martin Baulig <martin@gnome.org>
12065 * assign.cs: Make this work if the rightmost source is a constant and
12066 we need to do an implicit type conversion. Also adding a few more tests
12067 to test-38.cs which should have caught this.
12069 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
12070 target in the makefile for this. The makefile.gnu is primarily intended
12071 for end-users who don't want to debug the compiler.
12073 2002-07-21 Martin Baulig <martin@gnome.org>
12075 * assign.cs: Improved the Assign class so it can now handle embedded
12076 assignments (X = Y = Z = something). As a side-effect this'll now also
12077 consume less local variables. test-38.cs now passes with MCS, added
12078 a few new test cases to that test.
12080 2002-07-20 Martin Baulig <martin@gnome.org>
12082 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
12083 instructions. Fixes bug #27977, also added test-146.cs.
12085 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12087 * cs-tokenizer.cs: fixed getHex ().
12089 2002-07-19 Martin Baulig <martin@gnome.org>
12091 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
12092 not Type.GetType() to lookup the array type. This is needed when
12093 we're constructing an array of a user-defined type.
12094 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
12095 single-dimensional arrays, but also for single-dimensial arrays of
12098 2002-07-19 Martin Baulig <martin@gnome.org>
12100 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
12101 this function is called, it's not allowed to share LocalBuilders
12102 among ILGenerators.
12104 2002-07-19 Martin Baulig <martin@gnome.org>
12106 * expression.cs (Argument.Resolve): Report an error 118 when trying
12107 to pass a type as argument.
12109 2002-07-18 Martin Baulig <martin@gnome.org>
12111 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
12112 Conv_R_Un for the signed `long' type.
12114 2002-07-15 Miguel de Icaza <miguel@ximian.com>
12116 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
12117 `expr' for the temporary result, as that will fail if we do
12118 multiple resolves on the same expression.
12120 2002-07-05 Miguel de Icaza <miguel@ximian.com>
12122 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
12123 ec.TypeContainer for looking up aliases.
12125 * class.cs (TypeContainer): Remove LookupAlias from here.
12127 * decl.cs (DeclSpace); Move here.
12129 2002-07-01 Miguel de Icaza <miguel@ximian.com>
12131 * class.cs (FindMembers): Only call filter if the constructor
12132 bulider is not null.
12134 Also handle delegates in `NestedTypes' now. Now we will perform
12135 type lookups using the standard resolution process. This also
12138 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
12139 This uses Expressions (the limited kind that can be parsed by the
12140 tree) instead of strings.
12142 * expression.cs (ComposedCast.ToString): Implement, used to flag
12143 errors since now we have to render expressions.
12145 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
12148 * ecore.cs (SimpleName.ToString): ditto.
12150 * cs-parser.jay: Instead of using strings to assemble types, use
12151 Expressions to assemble the type (using SimpleName, ComposedCast,
12152 MemberAccess). This should fix the type lookups in declarations,
12153 because we were using a different code path for this.
12155 * statement.cs (Block.Resolve): Continue processing statements
12156 even when there is an error.
12158 2002-07-17 Miguel de Icaza <miguel@ximian.com>
12160 * class.cs (Event.Define): Also remove the `remove' method from
12161 the list of pending items.
12163 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
12164 generate more compact code.
12166 2002-07-17 Martin Baulig <martin@gnome.org>
12168 * const.cs (Const.LookupConstantValue): Add support for constant
12169 `unchecked' and `checked' expressions.
12170 Also adding test case test-140.cs for this.
12172 2002-07-17 Martin Baulig <martin@gnome.org>
12174 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
12175 check whether mi.ReturnType implements the IEnumerator interface; the
12176 `==' and the IsAssignableFrom() will fail in this situation.
12178 2002-07-16 Ravi Pratap <ravi@ximian.com>
12180 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
12183 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12185 * expression.cs: fixed bug #27811.
12187 2002-07-14 Miguel de Icaza <miguel@ximian.com>
12189 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
12190 Molaro: when we are a ref, the value already contains a pointer
12191 value, do not take the address of it.
12193 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
12194 * removed mb-parser.jay and mb-tokenizer.cs
12196 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
12198 * expression.cs: check against the building corlib void type.
12200 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
12202 * ecore.cs: fix for valuetype static readonly fields: when
12203 initializing them, we need their address, not the address of a copy.
12205 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
12207 * typemanager.cs: register also enum_type in corlib.
12209 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
12211 * class.cs: allow calling this (but not base) initializers in structs.
12213 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
12215 * ecore.cs: make sure we compare against the building base types
12218 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
12220 * typemanager.cs: fix TypeToCoreType() to handle void and object
12221 (corlib gets no more typerefs after this change).
12223 2002-07-12 Miguel de Icaza <miguel@ximian.com>
12225 * expression.cs (ArrayCreation.EmitArrayArguments): use
12226 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
12228 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
12229 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
12230 array indexes, the runtime actually forbids them.
12232 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
12233 for array arguments here.
12235 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
12236 instead of the default for ValueTypes.
12238 (New.DoEmit): Use IsValueType instead of
12239 IsSubclassOf (value_type)
12240 (New.DoResolve): ditto.
12241 (Invocation.EmitCall): ditto.
12243 * assign.cs (Assign): ditto.
12245 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
12246 Statements *are* currently doing part of their resolution during
12249 Expressions do always resolve during resolve, but statements are
12250 only required to propagate resolution to their children.
12252 2002-07-11 Miguel de Icaza <miguel@ximian.com>
12254 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
12256 (LoadAssembly): Do not add the dll if it is already specified
12258 (MainDriver): Add the System directory to the link path at the end,
12259 after all the other -L arguments.
12261 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
12262 wrong opcode for loading bytes and bools (ldelem.i1 instead of
12263 ldelem.u1) and using the opposite for sbytes.
12265 This fixes Digger, and we can finally run it.
12267 * driver.cs (UnixParseOption): Move the option parsing here.
12268 (CSCParseOption): Implement CSC-like parsing of options.
12270 We now support both modes of operation, the old Unix way, and the
12271 new CSC-like way. This should help those who wanted to make cross
12272 platform makefiles.
12274 The only thing broken is that /r:, /reference: and /lib: are not
12275 implemented, because I want to make those have the same semantics
12276 as the CSC compiler has, and kill once and for all the confussion
12277 around this. Will be doing this tomorrow.
12279 * statement.cs (Unsafe.Resolve): The state is checked during
12280 resolve, not emit, so we have to set the flags for IsUnsfe here.
12282 2002-07-10 Miguel de Icaza <miguel@ximian.com>
12284 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
12285 not catch the Error_ObjectRefRequired in SimpleName (as it is
12286 possible to have a class/instance variable name that later gets
12287 deambiguated), we have to check this here.
12289 2002-07-10 Ravi Pratap <ravi@ximian.com>
12291 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
12292 make static and put into Expression.
12294 (Event.Define): Register the private field of the event with the
12295 TypeManager so that GetFieldFromEvent can get at it.
12297 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
12298 keep track of the private field associated with an event which
12301 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
12304 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
12306 2002-07-10 Miguel de Icaza <miguel@ximian.com>
12308 * expression.cs (Binary.EmitBranchable): this routine emits the
12309 Binary expression in a branchable context. This basically means:
12310 we need to branch somewhere, not just get the value on the stack.
12312 This works together with Statement.EmitBoolExpression.
12314 * statement.cs (Statement.EmitBoolExpression): Use
12317 2002-07-09 Miguel de Icaza <miguel@ximian.com>
12319 * statement.cs (For): Reduce the number of jumps in loops.
12321 (For): Implement loop inversion for the For statement.
12323 (Break): We can be breaking out of a Try/Catch controlled section
12324 (foreach might have an implicit try/catch clause), so we need to
12325 use Leave instead of Br.
12327 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
12328 now). If the instace expression supports IMemoryLocation, we use
12329 the AddressOf method from the IMemoryLocation to extract the
12330 address instead of emitting the instance.
12332 This showed up with `This', as we were emitting the instance
12333 always (Emit) instead of the Address of This. Particularly
12334 interesting when This is a value type, as we dont want the Emit
12335 effect (which was to load the object).
12337 2002-07-08 Miguel de Icaza <miguel@ximian.com>
12339 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
12341 * statement.cs (Checked): Set the CheckedState during the resolve
12342 process too, as the ConvCast operations track the checked state on
12343 the resolve process, and not emit.
12345 * cs-parser.jay (namespace_member_declaration): Flag that we have
12346 found a declaration when we do. This is used to flag error 1529
12348 * driver.cs: Report ok when we display the help only.
12350 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
12352 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
12354 2002-07-04 Miguel de Icaza <miguel@ximian.com>
12356 * cs-tokenizer.cs (define): We also have to track locally the
12357 defines. AllDefines is just used for the Conditional Attribute,
12358 but we also need the local defines for the current source code.
12360 2002-07-03 Miguel de Icaza <miguel@ximian.com>
12362 * statement.cs (While, For, Do): These loops can exit through a
12363 Break statement, use this information to tell whether the
12364 statement is the last piece of code.
12366 (Break): Flag that we break.
12368 * codegen.cs (EmitContexts): New `Breaks' state variable.
12370 2002-07-03 Martin Baulig <martin@gnome.org>
12372 * class.cs (TypeContainer.MethodModifiersValid): Allow override
12373 modifiers in method declarations in structs. Otherwise, you won't
12374 be able to override things like Object.Equals().
12376 2002-07-02 Miguel de Icaza <miguel@ximian.com>
12378 * class.cs (Method, Property, Indexer): Do not allow the public
12379 modifier to be used in explicit interface implementations.
12381 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
12382 override modifiers in method declarations in structs
12384 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
12386 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
12387 integer or real overflow, report an error
12389 2002-07-02 Martin Baulig <martin@gnome.org>
12391 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
12392 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
12393 to tell the runtime about our newly created System.Object and
12394 System.ValueType types.
12396 2002-07-02 Miguel de Icaza <miguel@ximian.com>
12398 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
12399 struct instead of Ldarg/Starg.
12401 2002-07-02 Martin Baulig <martin@gnome.org>
12403 * expression.cs (Indirection.Indirection): Call
12404 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
12406 2002-07-02 Martin Baulig <martin@gnome.org>
12408 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
12409 ValueType, call TypeManager.TypeToCoreType() on it.
12410 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
12411 the OpCodes.Newarr argument.
12413 2002-07-02 Martin Baulig <martin@gnome.org>
12415 * expression.cs (Invocation.EmitCall): When compiling corlib,
12416 replace all calls to the system's System.Array type to calls to
12417 the newly created one.
12419 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
12420 System.Array methods.
12421 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
12422 from the system's System.Array type which must be replaced.
12424 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
12426 * typemanager.cs: load unverifiable_code_ctor so we can build
12427 corlib using the correct type. Avoid using GetTypeCode() with
12429 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
12430 TypeManager.object_type to allow building corlib.
12432 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
12434 * ecore.cs: handle System.Enum separately in LoadFromPtr().
12436 2002-07-01 Martin Baulig <martin@gnome.org>
12438 * class.cs: Make the last change actually work, we need to check
12439 whether `ifaces != null' to avoid a crash.
12441 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
12443 * class.cs: when we build structs without fields that implement
12444 interfaces, we need to add the interfaces separately, since there is
12445 no API to both set the size and add the interfaces at type creation
12448 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
12450 * expression.cs: the dimension arguments to the array constructors
12451 need to be converted if they are a long.
12453 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
12455 * class.cs: don't emit ldarg.0 if there is no parent constructor
12456 (fixes showstopper for corlib).
12458 2002-06-29 Martin Baulig <martin@gnome.org>
12460 MCS now compiles corlib on GNU/Linux :-)
12462 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
12463 ie. check for MethodImplOptions.InternalCall.
12465 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
12466 and TypeManager.attribute_type are null, so we must explicitly check
12467 whether parent is not null to find out whether it's an attribute type.
12468 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
12469 and SetBuilder, not only if the property is neither abstract nor external.
12470 This is necessary to set the MethodImplOptions on the accessor methods.
12471 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
12472 SetBuilder, see Property.Emit().
12474 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
12475 populate "System.Object", "System.ValueType" and "System.Attribute" since
12476 they've already been populated from BootCorlib_PopulateCoreTypes().
12478 2002-06-29 Martin Baulig <martin@gnome.org>
12480 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
12481 is the NullLiteral, we also need to make sure that target_type is not
12484 2002-06-29 Martin Baulig <martin@gnome.org>
12486 * rootcontext.cs (RootContext.ResolveCore): We must initialize
12487 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
12488 before calling BootstrapCorlib_ResolveDelegate ().
12490 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12492 * statement.cs: fixed build-breaker. All tests passed ok.
12494 2002-06-27 Martin Baulig <martin@gnome.org>
12496 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
12497 for System.Decimal when compiling corlib.
12499 2002-06-27 Martin Baulig <martin@gnome.org>
12501 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
12502 switch blocks which contain nothing but a default clause.
12504 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
12506 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
12508 2002-06-27 Martin Baulig <martin@gnome.org>
12510 * ecore.cs (PropertyExpr.PropertyExpr): Call
12511 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
12513 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
12514 is already a TypeBuilder.
12516 2002-06-27 Martin Baulig <martin@gnome.org>
12518 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
12519 `target_type == TypeManager.array_type', not IsAssignableFrom() in
12520 the "from an array-type to System.Array" case. This makes it work
12521 when compiling corlib.
12523 2002-06-27 Martin Baulig <martin@gnome.org>
12525 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
12526 non-static PropertyExpr, set its InstanceExpression. This makes
12527 the `ICollection.Count' property work in System/Array.cs.
12529 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
12531 * driver.cs: Made error handling more consistent. Errors now
12532 tracked by Report class, so many methods which used to return int
12533 now return void. Main() now prints success/failure and
12534 errors/warnings message.
12536 Renamed '--probe' compiler argument to '--expect-error'. Removed
12537 the magic number return values (123 and 124). Now, if the
12538 expected error occurs, the compiler exits with success (exit value
12539 0). If the compilation completes without seeing that particular
12540 error, the compiler exits with failure (exit value 1). The
12541 makefile in mcs/errors has been changed to handle the new behaviour.
12543 * report.cs: Made 'expected error' number a property and renamed
12544 it from 'Probe' to 'ExpectedError'.
12546 * genericparser.cs: Removed error handling support, since it is
12547 now all done by Report class.
12549 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
12550 class, so parse() no longer returns an int.
12552 * namespace.cs: Use Report.Error instead of GenericParser.error
12554 2002-06-22 Miguel de Icaza <miguel@ximian.com>
12556 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
12557 TypeContainer.AddOperator): At the front of the list put the
12558 explicit implementations, so they get resolved/defined first.
12560 2002-06-21 Miguel de Icaza <miguel@ximian.com>
12562 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
12563 interface type is implemented by this TypeContainer. Used during
12564 explicit interface implementation.
12566 (Property.Define, Indexer.Define, Method.Define): Validate that
12567 the given interface in the explicit implementation is one of the
12568 base classes for the containing type.
12570 Also if we are explicitly implementing an interface, but there is
12571 no match in the pending implementation table, report an error.
12573 (Property.Define): Only define the property if we are
12574 not explicitly implementing a property from an interface. Use the
12575 correct name also for those properties (the same CSC uses,
12576 although that is really not needed).
12578 (Property.Emit): Do not emit attributes for explicitly implemented
12579 properties, as there is no TypeBuilder.
12581 (Indexer.Emit): ditto.
12583 Hiding then means that we do not really *implement* a pending
12584 implementation, which makes code fail.
12586 2002-06-22 Martin Baulig <martin@gnome.org>
12588 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
12589 the return value of Object.GetType(). [FIXME: we need to do this whenever
12590 we get a type back from the reflection library].
12592 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
12594 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
12596 2002-06-20 Miguel de Icaza <miguel@ximian.com>
12598 * attribute.cs: Return null if we can not look up the type.
12600 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
12601 the interface types found.
12603 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
12604 interface types found.
12606 * typemanager.cs (GetInterfaces): Make this routine returns alll
12607 the interfaces and work around the lame differences between
12608 System.Type and System.Reflection.Emit.TypeBuilder in the results
12609 result for GetInterfaces.
12611 (ExpandInterfaces): Given an array of interface types, expand and
12612 eliminate repeated ocurrences of an interface. This expands in
12613 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
12616 2002-06-21 Martin Baulig <martin@gnome.org>
12618 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
12621 2002-06-21 Martin Baulig <martin@gnome.org>
12623 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
12624 and called with one of the core types, return the corresponding typebuilder for
12627 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
12630 2002-06-21 Martin Baulig <martin@gnome.org>
12632 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
12633 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
12634 (Expression.ConvertReferenceExplicit): Likewise.
12636 * expression.cs (ElementAccess.DoResolve): Likewise.
12637 (ElementAccess.DoResolveLValue): Likewise.
12639 2002-06-10 Martin Baulig <martin@gnome.org>
12641 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
12642 add the "value" parameter to the parameter list.
12644 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
12647 2002-06-19 Miguel de Icaza <miguel@ximian.com>
12649 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
12650 the argument to an int, uint, long or ulong, per the spec. Also
12651 catch negative constants in array creation.
12653 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
12655 * class.cs: do not allow the same interface to appear twice in
12656 the definition list.
12658 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
12660 * ecore.cs: don't use ldlen with System.Array.
12662 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
12664 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
12666 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
12668 * modifiers.cs: produce correct field attributes for protected
12669 internal. Easy fix so miguel can work on ther harder stuff:-)
12671 2002-06-18 Miguel de Icaza <miguel@ximian.com>
12673 * pending.cs: New file. Move the code from class.cs here.
12674 Support clearning the pending flag for all methods (when not doing
12675 explicit interface implementation).
12677 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
12679 * rootcontext.cs: added a couple more types needed to bootstrap.
12681 2002-06-17 Miguel de Icaza <miguel@ximian.com>
12683 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
12684 constructor in the type, instead of any constructor in the type
12685 hierarchy. Thanks to Paolo for finding this bug (it showed up as
12686 a bug in the Mono runtime when applying the params attribute).
12688 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
12689 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
12691 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
12693 * expression.cs (Unary.ResolveOperator): Use TypeManager
12694 to resolve the type.
12696 2002-06-13 Ravi Pratap <ravi@ximian.com>
12698 * cs-parser.jay (enum_member_declaration): Pass in the attributes
12701 * enum.cs (AddEnumMember): Add support to store the attributes associated
12702 with each member too.
12704 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
12705 field builders too - this takes care of the enum member case.
12707 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
12709 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
12710 address-of operator on both value types and pointers.
12712 2002-06-10 Martin Baulig <martin@gnome.org>
12714 * interface.cs (Interface.PopulateIndexer): Add the indexer's
12715 PropertyBuilder to the `property_builders' list.
12717 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
12718 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
12719 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
12720 find any indexers which are inherited from an interface.
12722 2002-06-09 Martin Baulig <martin@gnome.org>
12724 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
12725 the same type as the constant if necessary. There's also a test-130.cs
12728 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
12730 * typemanager.cs (TypeManager.ChangeType): Previously known as
12731 Enum.ChangeEnumType().
12733 2002-06-09 Martin Baulig <martin@gnome.org>
12735 * expression.cs (Cast.TryReduce): Added support for consts.
12737 2002-06-08 Ravi Pratap <ravi@ximian.com>
12739 * class.cs (Accessor): Hold attributes information so we can pass
12742 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
12743 Modify to pass in attributes attached to the methods.
12745 (add_accessor_declaration, remove_accessor_declaration): Ditto.
12747 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
12748 to handle the Accessor kind :-)
12750 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
12752 2002-06-08 Martin Baulig <martin@gnome.org>
12754 * expression.cs (Unary.TryReduceNegative): Added support for
12757 2002-06-08 Martin Baulig <martin@gnome.org>
12759 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
12760 name can't be found in the `defined_names' - the caller will do a
12761 MemberLookup in this case and thus find methods in System.Enum
12762 such as Enum.IsDefined().
12764 2002-06-08 Martin Baulig <martin@gnome.org>
12766 * enum.cs (Enum.ChangeEnumType): This is a custom version of
12767 Convert.ChangeType() which works with TypeBuilder created types.
12768 (Enum.LookupEnumValue, Enum.Define): Use it here.
12770 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
12771 `TypeBuilder.BaseType != null' check.
12772 (TypeContainer.FindMembers): Only lookup parent members if we
12773 actually have a parent.
12774 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
12775 (ConstructorInitializer.Resolve): Likewise.
12777 * interface.cs (Interface.FindMembers): Added
12778 `TypeBuilder.BaseType != null' check.
12780 * rootcontext.cs (RootContext.ResolveCore): Added
12781 "System.Runtime.CompilerServices.IndexerNameAttribute" to
12782 classes_second_stage.
12784 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
12785 debug_type and trace_type when compiling with --nostdlib.
12787 2002-06-07 Martin Baulig <martin@gnome.org>
12789 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
12790 (AddField): Set it to true when adding a non-static field.
12791 (DefineType): Use `have_nonstatic_fields' to find out whether we
12792 have non-static fields, not `Fields != null'.
12794 2002-06-02 Miguel de Icaza <miguel@ximian.com>
12796 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
12797 dereferencing a null on the static-field code path)
12799 2002-05-30 Martin Baulig <martin@gnome.org>
12801 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
12802 to take command line arguments. Use reflection to call the new
12803 custom `Initialize' function on the symbol writer and pass it the
12804 command line arguments.
12806 * driver.cs (--debug-args): New command line argument to pass command
12807 line arguments to the symbol writer.
12809 2002-05-28 Miguel de Icaza <miguel@ximian.com>
12811 * assign.cs (DoResolve): Forgot to do the implicit conversion to
12812 the target type for indexers and properties. Thanks to Joe for
12815 2002-05-27 Miguel de Icaza <miguel@ximian.com>
12817 * typemanager.cs (MethodFlags): returns the method flags
12818 (Obsolete/ShouldIgnore) that control warning emission and whether
12819 the invocation should be made, or ignored.
12821 * expression.cs (Invocation.Emit): Remove previous hack, we should
12822 not do this on matching a base type, we should do this based on an attribute
12824 Only emit calls to System.Diagnostics.Debug and
12825 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
12826 on the command line.
12828 * rootcontext.cs: Global settings for tracing and debugging.
12830 * cs-tokenizer.cs (define): New utility function to track
12831 defines. Set the global settings for TRACE and DEBUG if found.
12833 2002-05-25 Ravi Pratap <ravi@ximian.com>
12835 * interface.cs (Populate*): Pass in the TypeContainer as well as
12836 the DeclSpace as parameters so that we can create EmitContexts and
12837 then use that to apply attributes etc.
12839 (PopulateMethod, PopulateEvent, PopulateProperty)
12840 (PopulateIndexer): Apply attributes everywhere.
12842 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
12845 (ApplyAttributes): Update accordingly.
12847 We now apply interface attributes for all members too.
12849 2002-05-26 Miguel de Icaza <miguel@ximian.com>
12851 * class.cs (Indexer.Define); Correctly check if we are explicit
12852 implementation (instead of checking the Name for a ".", we
12853 directly look up if the InterfaceType was specified).
12855 Delay the creation of the PropertyBuilder.
12857 Only create the PropertyBuilder if we are not an explicit
12858 interface implementation. This means that explicit interface
12859 implementation members do not participate in regular function
12860 lookups, and hence fixes another major ambiguity problem in
12861 overload resolution (that was the visible effect).
12863 (DefineMethod): Return whether we are doing an interface
12866 * typemanager.cs: Temporary hack until we get attributes in
12867 interfaces (Ravi is working on that) and we get IndexerName
12868 support in interfaces.
12870 * interface.cs: Register the indexers as properties.
12872 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
12873 warning, I have verified that this is a bug in the .NET runtime
12874 (JavaScript suffers of the same problem).
12876 * typemanager.cs (MemberLookup): When looking up members for
12877 interfaces, the parent of an interface is the implicit
12878 System.Object (so we succeed in searches of Object methods in an
12879 interface method invocation. Example: IEnumerable x; x.ToString
12882 2002-05-25 Miguel de Icaza <miguel@ximian.com>
12884 * class.cs (Event): Events should also register if they do
12885 implement the methods that an interface requires.
12887 * typemanager.cs (MemberLookup); use the new GetInterfaces
12890 (GetInterfaces): The code used to lookup interfaces for a type is
12891 used in more than one place, factor it here.
12893 * driver.cs: Track the errors at the bottom of the file, we kept
12896 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
12897 instance if the method we are calling is static!
12899 2002-05-24 Miguel de Icaza <miguel@ximian.com>
12901 * attribute.cs (ApplyAttributes): Make this function filter out
12902 the IndexerName attribute (as that attribute in reality is never
12903 applied) and return the string constant for the IndexerName
12906 * class.cs (TypeContainer.Emit): Validate that all the indexers
12907 have the same IndexerName attribute, and if so, set the
12908 DefaultName attribute on the class.
12910 * typemanager.cs: The return value might contain other stuff (not
12911 only methods). For instance, consider a method with an "Item"
12912 property and an Item method.
12914 * class.cs: If there is a problem with the parameter types,
12917 2002-05-24 Ravi Pratap <ravi@ximian.com>
12919 * ecore.cs (ImplicitConversionExists): Wrapper function which also
12920 looks at user defined conversion after making a call to
12921 StandardConversionExists - we need this for overload resolution.
12923 * expression.cs : Update accordingly the various method calls.
12925 This fixes 2 bugs filed against implicit user defined conversions
12927 2002-05-22 Miguel de Icaza <miguel@ximian.com>
12929 * statement.cs: Track the result of the assignment.
12931 2002-05-21 Miguel de Icaza <miguel@ximian.com>
12933 * expression.cs (MemberAccess): Improved error reporting for
12934 inaccessible members.
12936 2002-05-22 Martin Baulig <martin@gnome.org>
12938 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
12939 itself with debugging support.
12941 2002-05-22 Martin Baulig <martin@gnome.org>
12943 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
12944 Removed, this isn't needed anymore.
12946 2002-05-20 Martin Baulig <martin@gnome.org>
12948 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
12949 be underlying type for an enum.
12951 2002-05-20 Miguel de Icaza <miguel@ximian.com>
12953 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
12954 that splits out the loading of just the core types.
12956 * rootcontext.cs (ResolveCore): Split the struct resolution in
12957 two, so we can load the enumeration underlying types before any
12960 * expression.cs (Is): Bandaid until we fix properly Switch (see
12961 bug #24985 for details).
12963 * typemanager.cs (ImplementsInterface): The hashtable will contain
12964 a null if there are no interfaces implemented.
12966 2002-05-18 Miguel de Icaza <miguel@ximian.com>
12968 * cs-parser.jay (indexer_declarator): It is fine to have array
12971 2002-05-17 Miguel de Icaza <miguel@ximian.com>
12973 * typemanager.cs: (RegisterBuilder): New function used to register
12974 TypeBuilders that implement interfaces. Since
12975 TypeBuilder.GetInterfaces (as usual) does not work with lame
12977 (AddUserType): register interfaces.
12979 (ImplementsInterface): Use the builder_to_ifaces hash if we are
12980 dealing with TypeBuilder. Also, arrays are showing up as
12981 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
12982 methods can not be invoked on them!
12984 * ecore.cs (ExplicitReferenceConversionExists): Made public.
12985 (ImplicitReferenceConversionExists): Split out from
12986 StandardConversionExists.
12988 * expression.cs (As): We were only implementing one of the three
12989 cases for the as operator. We now implement them all.
12990 (Is): Implement the various other cases for Is as well.
12992 * typemanager.cs (CACHE): New define used to control if we want or
12993 not the FindMembers cache. Seems to have a negative impact on
12994 performance currently
12996 (MemberLookup): Nested types have full acess to
12997 enclosing type members
12999 Remove code that coped with instance/static returns for events, we
13000 now catch this in RealFindMembers.
13002 (RealFindMembers): only perform static lookup if the instance
13003 lookup did not return a type or an event.
13005 2002-05-17 Miguel de Icaza <miguel@ximian.com>
13007 * assign.cs (CompoundAssign): We pass more semantic information
13008 now to Compound Assignments than we did before: now we have all
13009 the information at hand, and now we resolve the target *before* we
13010 do the expression expansion, which allows the "CacheValue" method
13011 to have the effect we intended (before, a [x] += 1 would generate
13012 two differen ArrayAccess expressions from the ElementAccess,
13013 during the resolution process).
13015 (CompoundAssign.DoResolve): Resolve target and original_source here.
13017 2002-05-16 Miguel de Icaza <miguel@ximian.com>
13019 * expression.cs (ArrayAccess): dropped debugging information.
13021 * typemanager.cs: Small bug fix: I was always returning i_members,
13022 instead of one of i_members or s_members (depending on which had
13025 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
13026 method is invoked before any code generation takes place, and it
13027 is a mechanism to inform that the expression will be invoked more
13028 than once, and that the method should use temporary values to
13029 avoid having side effects
13031 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
13033 * ecore.cs (Expression.CacheTemporaries): Provide empty default
13036 * expression.cs (Indirection, ArrayAccess): Add support for
13037 CacheTemporaries in these two bad boys.
13039 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
13040 ldobj or ldind_ref.
13041 (StoreFromPtr): Handle stobj as well.
13043 * expression.cs (UnaryMutator): Share more code.
13045 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
13046 down: I was not tracking the Filter function as well, which
13047 was affecting the results of the cache.
13049 2002-05-15 Miguel de Icaza <miguel@ximian.com>
13051 * attribute.cs: Remove the hack to handle the CharSet property on
13054 2002-05-14 Miguel de Icaza <miguel@ximian.com>
13056 * attribute.cs (DoResolve): More uglyness, we now only try to
13057 resolve the attribute partially, to extract the CharSet
13058 information (only if we are a StructLayout attribute). Otherwise
13060 (GetExtraTypeInfo): Add some code to conditionally kill in the
13061 future this. I am more and more convinced that the .NET
13062 framework has special code to handle the attribute setting on
13065 * expression.cs (IsParamsMethodApplicable): Revert my previous
13066 foreach change here, it was wrong.
13068 2002-05-13 Miguel de Icaza <miguel@ximian.com>
13070 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
13071 (pp_expr): do not abort on unknown input, just return.
13072 (eval): abort if there are pending chars.
13074 * attribute.cs (Attribute.Resolve): Positional parameters are
13075 optional. Deal with that case.
13077 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
13078 the Ansi/Unicode/Auto information for the type.
13080 (TypeContainer.DefineType): instantiate the EmitContext here, as
13081 we will be using it during the type definition (to resolve
13082 attributes) and during the emit phase.
13084 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
13085 to pull type information out of the attributes
13087 (Attribute.Resolve): track the constructor builder, and allow for
13088 multiple invocations (structs and classes will use this).
13090 * ecore.cs (MemberLookupFinal): new version with all the
13091 parameters customizable.
13093 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
13094 constructors. Return if the result value is null (as the error
13095 would have been flagged already by MemberLookupFinal)
13097 Do not allow instances of abstract classes or interfaces to be
13100 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
13101 We have to compare the assembly property here when dealing with
13102 FamANDAssem and Assembly access modifiers, because we might be
13103 creating an assembly from *modules* (that means that we are not
13104 getting TypeBuilders for types defined in other modules that are
13105 part of this assembly).
13107 (Method.Emit): If the method is marked abstract and has a body,
13110 (TypeContainer.DefineMembers): If both the defined member and the
13111 parent name match are methods, then do not emit any warnings: let
13112 the Method.Define routine take care of flagging warnings. But if
13113 there is a mismatch (method overrides something else, or method is
13114 overriwritten by something, then emit warning).
13116 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
13117 set to null, this means `do not check for the return type on the
13120 (Method.Define): set the return type for the method signature to
13121 null, so that we get methods with the same name and parameters and
13122 different return types. This is used to flag warning 114 (you are
13123 hiding a method, and you probably want to use the new/override
13126 * typemanager.cs (MemberLookup): Implemented proper access
13127 control, closing a long standing set of bug reports. The problem
13128 was that the Framework only has two bits: Public and NonPublic,
13129 and NonPublic includes private and protected methods, but we need
13130 to enforce the FamANDAssem, FamOrAssem and Family.
13132 2002-05-11 Miguel de Icaza <miguel@ximian.com>
13134 * statement.cs (GotoCase): Return true: Ammounts to giving up
13135 knowledge on whether we return or not, and letting the other case
13136 be responsible for it.
13138 2002-05-10 Miguel de Icaza <miguel@ximian.com>
13140 * driver.cs: Do not load directories for each file processed, only
13141 do it if there is a pattern.
13143 * ecore.cs: Report readonly assigns here as well, as we might have
13144 been resolved only by MemberAccess.
13146 (SimpleName.SimpleNameResolve): Also be useful for LValue
13147 resolution. We need this to propagate assign to local readonly variables
13149 * typemanager.cs: Use a ptrhashtable for the criteria, because we
13150 do not want to reuse potential criteria memory.
13152 * class.cs (MyEventBuilder): Set reflected_type;
13154 * ecore.cs (Constantify): Added support for constifying bools.
13156 (RootContext.LookupType): Added a cache for values looked up in
13157 the declaration space.
13159 * typemanager.cs (FindMembers): Now is a front-end to
13160 RealFindMembers, and provides a two-level hashtable-based cache to
13163 15% performance improvement: from 22.5 to 19.2 seconds.
13165 * expression.cs (IsParamsMethodApplicable): use foreach.
13166 (Invocation.DoResolve): ditto.
13167 (New.DoResolve): ditto.
13168 (ArrayCreation.DoResolve): ditto.
13170 * ecore.cs (FindMostEncompassingType): use foreach.
13172 * delegate.cs (NewDelegate.DoResolve): Use foreach
13174 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
13175 (RemoveMethods): use foreach.
13177 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
13178 nested foreach statements instead of for, and also break out of
13179 the inner loop once a match is found.
13181 (Invocation.OverloadResolve): Use foreach, simplify the code.
13183 2002-05-08 Miguel de Icaza <miguel@ximian.com>
13185 * cfold.cs (BinaryFold): During an enumeration evaluation context,
13186 we actually unwrap the expression to allow for extra information
13189 * expression.cs: Use Shr_Un on unsigned operations.
13191 2002-05-08 Ravi Pratap <ravi@ximian.com>
13193 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
13194 applicable operators was not being considered correctly. This closes
13195 the bug Miguel reported.
13197 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
13199 * attribute.cs: check that the type derives from System.Attribute
13200 and report the correct error in that case (moved the duplicate code to
13201 its own method, too).
13203 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
13205 * attribute.cs: lookup attribute type name as the spec says: first the
13206 bare attribute name and then name + "Attribute" (nant compiles with
13207 mcs after this fix).
13209 2002-05-07 Miguel de Icaza <miguel@ximian.com>
13211 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
13212 Because of the way we parse things, we should try to see if a
13213 UIntConstant can fit in an integer.
13215 2002-05-07 Ravi Pratap <ravi@ximian.com>
13217 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
13218 when we are in an explicit context.
13220 (ConvertReferenceExplicit): When converting from Iface type S to Class
13221 T make sure the rules are implemented as an OR.
13223 * parameter.cs (ParameterType): Make it a property for now although the
13224 purpose really isn't anything immediate.
13226 * expression.cs (Is*Applicable): Do better checking on the parameter type
13227 of a ref/out parameter. The ones from the system assemblies are already
13228 marked with the correct type so we don't need to do any correction.
13230 * ecore.cs (StandardConversionExists): Conversion from Interface types to
13231 the object type is standard too so include that.
13233 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13235 * ecore.cs (StandardConversionExists): Augment with missing code:
13236 deal with IntConstant, LongConstants and Enumerations.
13238 * assign.cs: Report the error, instead of failing silently
13240 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
13241 typecontainer that they are declared, because the
13242 typecontainer/namespace will have the list of using clauses that
13243 need to be applied.
13245 Assembly Attributes were escaping the normal registration
13248 (EmitCode): Apply attributes within an EmitContext that represents
13249 the container they were declared on.
13251 * cs-parser.jay: Track bases for structs. How did I get this wrong?
13253 2002-05-06 Ravi Pratap <ravi@ximian.com>
13255 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
13256 Revamp completely - make much cleaner as we now operate only
13259 (FindMostSpecificSource, FindMostSpecificTarget): New methods
13260 to implement the logic detailed in the spec more correctly.
13262 (UserDefinedConversion): Update accordingly.
13264 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13266 * statement.cs: Return flow analysis information up.
13268 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
13271 (token): Do not consume an extra character before calling
13274 2002-05-06 Piers Haken <piersh@friskit.com>
13276 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
13278 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13280 * class.cs (Constructor.Emit): Set the IsStatic flag in the
13281 EmitContext during the instance constructor initializer
13282 resolution, to stop access to instance variables.
13284 This is mandated by the spec, last paragraph of the `constructor
13285 initializers' section.
13287 2002-05-05 Miguel de Icaza <miguel@ximian.com>
13289 * cs-parser.jay, class.cs (Accessor): new class used to represent
13290 an accessor (get or set). In the past we used `null' to represent
13291 a missing accessor. But this is ambiguous because there was no
13292 way to tell in abstract indexers/properties if one of them was
13295 Now there is a way of addressing that.
13297 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
13298 instead of FindMembers.
13300 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
13301 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
13303 * attribute.cs: Treat indexers and properties as the same in terms
13304 of applying attributes
13306 * ecore.cs (FindMostEncompassedType): Use statically initialized
13307 EmptyExpressions()s like we do elsewhere to avoid creating useless
13308 objects (and we take this out of the tight loop).
13310 (GetConversionOperators): Move the code to extract the actual
13311 operators to a separate routine to clean things up.
13313 2002-05-04 Miguel de Icaza <miguel@ximian.com>
13315 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
13316 events are always registered FieldBuilders.
13318 * class.cs (FieldBase): New class shared by Fields
13320 * delegate.cs: If we are a toplevel delegate, use our full name.
13321 If we are a nested delegate, then only use our tail name.
13323 2002-05-02 Ravi Pratap <ravi@ximian.com>
13325 * expression.cs (IsApplicable): Ensure that we add the "&" to
13326 ref/out types before comparing it with the type of the argument.
13328 (IsParamsMethodApplicable): Ditto.
13330 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
13333 * delegate.cs : Handle the case when we have more than one applicable
13334 method. Flag an error only when we finish checking all.
13336 2002-05-02 Miguel de Icaza <miguel@ximian.com>
13338 * expression.cs: Add support for boolean static initializers.
13340 2002-05-01 Miguel de Icaza <miguel@ximian.com>
13342 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
13344 * parameter.cs (ComputeParameterTypes,
13345 ComputeAndDefineParameterTypes): Better error handling: now we
13346 clear the `types' cache if we fail during any of the type lookups.
13347 We also return the status code correctly to our caller
13349 * delegate.cs: If we fail to define a delegate, abort the extra
13352 * expression.cs (Binary.ResolveOperator): for
13353 operator==(object,object) and operator !=(object, object) we also
13354 have to verify that there is an implicit conversion from one to
13357 (ArrayAccess.DoResolve): Array Access can operate on
13360 2002-04-30 Miguel de Icaza <miguel@ximian.com>
13362 * assign.cs (CompoundAssign): A new class used as a "flag" that
13363 the assignment actually is happening as part of a compound
13364 assignment operator.
13366 During compound assignment, a few new rules exist to enable things
13373 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
13374 to the type of x) if y is implicitly convertible to the type of x,
13375 and the operator is a builtin operator and the return type of the
13376 operator is explicitly convertible to the type of x.
13378 * rootcontext.cs: Reset warning level to 2. 4 catches various
13379 "interesting" features in mcs, we must clean this up at some
13380 point, but currently am trying to kill other bugs ;-)
13382 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
13383 in container classes as well.
13385 * expression.cs (Binary.ResolveOperator): Handle string case
13386 before anything else (as operator overloading does emit an error
13387 before doing anything else).
13389 This code could go away when we move to a table driven model, but
13390 i could not come up with a good plan last night.
13392 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
13394 * typemanager.cs (CSharpName): reimplementation using regex.
13395 * class.cs: added null check for fields in Emit
13396 * rootcontext.cs: set warninglevel to 4
13398 2002-04-29 Miguel de Icaza <miguel@ximian.com>
13400 * typemanager.cs (CSharpName): reimplemented with Lupus
13403 2002-04-28 Miguel de Icaza <miguel@ximian.com>
13405 * statement.cs (If): correclty implement Resolve, because we were
13406 not catching sem errors in there. The same process is needed
13408 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
13411 (Statement.Warning_DeadCodeFound): Factorize code.
13412 (While): Report dead code here too.
13414 (Statement): Added Resolve virtual method to allow
13415 for resolution split from the emit code.
13417 2002-04-26 Miguel de Icaza <miguel@ximian.com>
13419 * statement.cs (EmitBoolExpression): No longer try to resolve the
13421 (MakeBoolean): New utility function that resolve, implicitly
13422 converts to boolean and tags the expression.
13425 (If, Do): Implement dead code elimination.
13426 (While): Implement loop inversion
13428 (Do, While, For, If): Resolve the expression prior to calling our
13431 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
13434 - added method Report28 (warning: program has more than one entry point)
13435 - added method IsEntryPoint, implements paragraph 10.1 of the spec
13436 - modified method Method.Define, the part at the end of the method
13438 * rootcontext.cs: added static public Location EntryPointLocation;
13440 * ../errors/cs0028.cs : Add test case for the above warning.
13443 - modified method CSharpName to allow arrays of primitive type to
13444 be printed nicely (e.g. instead of System.Int32[][] it now prints
13446 - added method CSharpSignature: returns the signature of a method
13447 in string format to be used in reporting errors, warnings, etc.
13449 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
13452 2002-04-26 Ravi Pratap <ravi@ximian.com>
13454 * delegate.cs (Define): Fix extremely silly bug where I was
13455 setting the type of the 'object' parameter of the BeginInvoke
13456 method to System.IAsyncResult instead of System.Object ;-)
13458 2002-04-26 Miguel de Icaza <miguel@ximian.com>
13460 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
13463 (Constructor.Emit): return if we fail to initialize the
13464 constructor. Another door closed!
13466 * expression.cs (New.DoResolve): Improve error message (from -6 to
13467 1501). Use DeclaredOnly lookup to find the exact constructor.
13469 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
13470 loop. This is useful.
13472 * cs-parser.jay: Adjust the default parameters so that destructors
13473 have the proper signature.
13475 2002-04-26 Martin Baulig <martin@gnome.org>
13477 * driver.cs (LoadAssembly): If `assembly' contains any characters
13478 which are only valid in path names and not in assembly names
13479 (currently slash, backslash and point), use Assembly.LoadFrom ()
13480 instead of Assembly.Load () on the `assembly' (before iteration
13481 over the link_paths).
13483 2002-04-26 Martin Baulig <martin@gnome.org>
13485 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
13487 2002-04-25 Miguel de Icaza <miguel@ximian.com>
13489 * class.cs (Property): use the new typemanager.MemberLookup
13491 (TypeContainer.MemberLookup): Implement using the
13492 TypeManager.MemberLookup now.
13494 * typemanager.cs: Make MemberLookup a function of the TypeManager,
13495 and return MemberInfos, so that these can be used without an
13496 EmitContext (what we had before).
13498 2002-04-24 Miguel de Icaza <miguel@ximian.com>
13500 * expression.cs: Fix the case where the argument to params if the
13501 type of the params. I omitted handling this before. Fixed
13503 2002-04-22 Miguel de Icaza <miguel@ximian.com>
13505 * driver.cs: Call BootCorlib_PopulateCoreType
13507 * class.cs (Property.CheckBase): Check for properties only, not
13510 * interface.cs: Temporary hack: try/catch around the
13511 CustomAttributeBuilder, because I am getting an exception that I
13514 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
13515 types whose definitions are required to be there (attributes are
13516 defined before standard types).
13518 Compute definitions as we boot the various types, as they are used
13519 immediately (value_type class will need object_type, but if we do
13520 not initialize object_type, we will pass a null, which will let
13521 the runtime pick the System.Object from the existing corlib, which
13522 is not what we want).
13524 2002-04-22 Patrik Torstensson <totte@labs2.com>
13526 * cs-tokenizer.cs: fixed a number of trim() issues.
13528 2002-04-22 Ravi Pratap <ravi@ximian.com>
13530 * expression.cs (Argument.Type): Ensure that we return the correct
13531 type when we have out or ref parameters [in which case we
13534 2002-04-22 Miguel de Icaza <miguel@ximian.com>
13536 * class.cs (Property, Indexer): Allow extern modifier in there.
13538 * typemanager.cs (InitBaseTypes): Initializes object_type and
13539 value_type, since those will be used early on during the bootstrap
13540 process to compile corlib.
13542 (InitCoreTypes): Move code from here to InitBaseTypes.
13544 2002-04-21 Miguel de Icaza <miguel@ximian.com>
13546 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
13547 single-dimension arrays as using the ldlen opcode.
13549 Daniel Lewis discovered this optimization.
13551 * typemanager.cs: Add signature for System.Array::get_Length
13553 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13555 * statement.cs: report the error when the foreach does not apply to an
13556 array nor a collection.
13558 2002-04-19 Miguel de Icaza <miguel@ximian.com>
13560 * expression.cs: Add implicit conversions to the operator ~.
13562 * constant.cs (DecimalConstant.Emit): Emit decimal value.
13564 * typemanager.cs: Locate the decimal constructor.
13566 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13568 * attribute.cs: use the new property of TypeOf.
13569 * expression.cs: added 'get' property around typearg.
13571 These changes fix a build breaker reported by NickD. Is this the
13572 correct way to fix? If not, please, revert my changes and make it
13575 2002-04-17 Miguel de Icaza <miguel@ximian.com>
13577 * attribute.cs: Add support for typeof in attribute invocations.
13578 I am not sure that this is right though.
13580 2002-04-14 Duncan Mak <duncan@ximian.com>
13582 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
13583 Binary.Operator.Division case.
13585 2002-04-13 Ravi Pratap <ravi@ximian.com>
13587 * class.cs (DefineType): Ensure that we do a proper check on
13588 attribute types and also register it with the TypeManager.
13590 (TypeContainer.Targets): The default for attribute types is
13591 AttributeTargets.All.
13593 * attribute.cs (ApplyAttributes): Registering the attribute type
13594 is done elsewhere, not when we discover we have a Usage attribute.
13596 2002-04-12 Ravi Pratap <ravi@ximian.com>
13598 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
13599 and get rid of is_delegate parameter.
13601 * everywhere : update.
13603 2002-04-12 Ravi Pratap <ravi@ximian.com>
13605 * cs-parser.jay (compilation_unit): Revamp completely to use
13606 some new ideas that I got from Rhys' grammar to solve the problems
13607 with assembly level attributes.
13609 (outer_declaration): New grammar production.
13611 (attribute_sections): Add.
13613 (opt_attributes): Base on attribute_sections
13615 (namespace_declaration): Allow opt_attributes to tackle the case
13616 when we have assembly level attributes - we are clever in this
13619 * attribute.cs (ApplyAttributes): Do not worry about assembly
13620 attributes in the non-global context.
13622 * rootcontext.cs (AddGlobalAttributes): Go back to using this
13623 instead of SetGlobalAttributes.
13625 * class.cs, rootcontext.cs : Ensure we define and generate
13626 attribute types before anything else.
13628 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
13629 and flag the new error -20 for the case when the attribute type
13630 does not have valid targets specified. csc does not catch this.
13632 * ../errors/errors.txt : update for error # -20
13634 2002-04-11 Ravi Pratap <ravi@ximian.com>
13636 * support.cs (InternalParameters.ParameterModifier): Do some null
13637 checking and return sane values.
13639 * class.cs (Method.Define): If we are a PInvoke method, ensure
13640 that we are static and extern. Report error # 601
13642 * ../errors/cs0601.cs : Add test case for the above error.
13644 2002-04-07 Ravi Pratap <ravi@ximian.com>
13646 * rootcontext.cs (attribute_types): We need to keep type of
13647 all attribute types separately and emit code for them first.
13649 (RegisterAttribute) : Implement.
13651 * class.cs (DefineType): Check if the current Type is a custom
13652 attribute type and register it accordingly.
13654 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
13655 adding the first attribute twice and rename to
13657 (SetGlobalAttributes): this.
13659 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
13662 * attribute.cs (ApplyAttributes): Take an additional argument telling us
13663 if we are processing global arguments. Hmm, I am unsure of this.
13665 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13667 * expression.cs: added static array of strings to avoid calling
13668 Enum.ToString () for Operator in Binary. Significant recover of
13671 2002-04-10 Miguel de Icaza <miguel@ximian.com>
13673 * class.cs (FindMembers): Allow the Builders of the various
13674 members to be null. If they are skip them. This only happens
13675 during the PInvoke declaration.
13677 2002-04-09 Miguel de Icaza <miguel@ximian.com>
13679 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
13680 failure, so we do not keep going afterwards.
13682 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
13683 wanted to pass `false' as the `is_delegate' argument. If this is
13684 the case, why not use delegate_type == null to mean `is_delegate =
13685 false' and anything else as is_delegate = true.
13687 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
13689 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
13690 code for the section, not the beginning of the tests.
13692 2002-04-08 Miguel de Icaza <miguel@ximian.com>
13694 * cfold.cs: Handle operator + (Enum x, Underlying x)
13696 * expression.cs (Binary): same. Warn about errors where we have
13697 Enum/Enum in operator + as well.
13699 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
13702 - added support for switch(bool)
13703 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
13704 - add TableSwitchEmit() to handle table-based switch statements
13706 2002-04-05 Ravi Pratap <ravi@ximian.com>
13708 * expression.cs (Invocation.OverloadResolve): Factor out code which
13709 does parameter compatibility checking with arguments so that we can
13710 re-use the code even from Delegate.VerifyApplicability
13712 (VerifyArgumentsCompat): Move above code here.
13714 * delegate.cs (VerifyApplicability): Get rid of duplicate code
13715 and instead make a call to the above method.
13717 2002-03-31 Ravi Pratap <ravi@ximian.com>
13719 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
13720 We use it to keep track of classes which are attribute types.
13722 2002-04-02 Miguel de Icaza <miguel@ximian.com>
13724 * delegate.cs (Delegate.Define): Correctly define the types in the
13725 presence of fixed and array parameters.
13727 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
13730 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
13731 include NonPublic after the first iteration.
13733 * class.cs (Indexer.CheckBase): Only check if both parents are
13736 * cs-parser.jay (accessor_body): If empty, set to null.
13738 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
13739 same code path here to resolve constants names that we did have in
13740 MemberAccess.DoResolve. There is too much code duplicated here.
13742 2002-04-01 Miguel de Icaza <miguel@ximian.com>
13744 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
13746 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
13749 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
13750 tokens, numbers and strings.
13752 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
13755 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
13756 asyncronous parameters and the regular parameters.
13758 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
13759 specify the target directory.
13761 * expression.cs: (This.DoResolve): Simplify
13762 (As.Emit): Optimize, do not generate IsInst if the expression is
13763 always of the given type.
13765 (Is.DoResolve): Bug fix, we were reporting both always/never for
13768 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
13769 creating too many unnecessary arrays.
13771 2002-03-31 Miguel de Icaza <miguel@ximian.com>
13773 * class.cs (EmitFieldInitializer): Use Assign expression to assign
13774 fields instead of rolling our own initializer. Takes care of all
13775 implicit conversions, and drops unnecessary static checks/argument.
13777 2002-03-31 Dick Porter <dick@ximian.com>
13779 * driver.cs: use the GetDirectories() return values properly, and
13780 use "/" as path separator.
13782 2002-03-30 Miguel de Icaza <miguel@ximian.com>
13784 * expression.cs (Unary): Optimize - - expr into expr.
13785 (Binary): Optimize a + (-b) into a -b.
13787 * codegen.cs (CodeGen): Made all methods static.
13789 2002-03-29 Miguel de Icaza <miguel@ximian.com>
13793 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
13794 TypeBuilder property.
13796 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
13799 * tree.cs: Removed the various RecordXXXX, and replaced with a
13800 single RecordDecl. Removed all the accessor methods, and just
13801 left a single access point Type
13803 * enum.cs: Rename DefineEnum to DefineType.
13805 * decl.cs: New abstract method `DefineType' used to unify the
13806 Defines for Enumerations, Interfaces, TypeContainers and
13809 (FindType): Moved LookupInterfaceOrClass here. Moved the
13810 LookupBaseClasses method that used to live in class.cs and
13811 interface.cs here, and renamed to FindType.
13813 * delegate.cs: Implement DefineType. Take advantage of the
13814 refactored pattern for locating the parent builder without taking
13815 the parent_builder argument (which we know does not work if we are
13816 nested, and triggering a toplevel definition).
13818 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13820 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
13821 accessibility of a member has changed during override and report
13824 * class.cs (Method.Define, Property.Define): Only complain on
13825 overrides if the method is private, any other accessibility is
13826 fine (and since we just checked the permission is the same, we are
13829 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
13830 and elif are processed always. The other pre-processing
13831 directives are only processed if we are "taking" the path
13833 2002-03-29 Martin Baulig <martin@gnome.org>
13835 * class.cs (Method.Emit): Only emit symbolic debugging info if the
13836 current location is not Null.
13838 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
13839 a separate method so we can profile it.
13841 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
13842 `span.Seconds' are just seconds, but no minutes or hours.
13843 (MainDriver): Profile the CodeGen.SaveSymbols calls.
13845 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13847 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
13848 Remove the gratuitous set of Final:
13850 // If an interface implementation, then we can set Final.
13851 if (((flags & MethodAttributes.Abstract) == 0) &&
13852 implementing.DeclaringType.IsInterface)
13853 flags |= MethodAttributes.Final;
13855 I do not know what I was smoking when I used that.
13858 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
13859 step into fixing the name resolution issues for delegates and
13860 unifying the toplevel name resolution.
13862 2002-03-28 Martin Baulig <martin@gnome.org>
13864 * class.cs (Method.Emit): If we have a symbol writer, call its
13865 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
13866 tell it about the current method.
13868 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
13869 writer that we're going to emit the first byte of IL code for a new
13870 statement (a new source line).
13871 (EmitContext.EmitTopBlock): If we have a symbol writer, call
13872 EmitContext.Mark() before emitting any code.
13874 * location.cs (SymbolDocument): Return null when we're Null.
13876 * statement.cs (Statement): Moved the `Location loc' variable here.
13877 (Statement.EmitBoolExpression): If we have a symbol writer, call
13878 ec.Mark() before emitting any code to tell it that we're at the
13879 beginning of a new statement.
13880 (StatementExpression): Added `Location' argument to the constructor.
13881 (Block): Added public readonly variable `StartLocation' and public
13882 variable `EndLocation'. The latter is to be set using SetEndLocation().
13883 (Block): Added constructor which takes a start and end location.
13884 (Block.SetEndLocation): New method. This sets the end location.
13885 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
13886 local variables we create.
13887 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
13888 each statement and do also mark the begin and end of the block.
13890 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
13891 tell it the current lexer.Location, use Location.Null for the end of the
13893 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
13894 current block, set its end location using SetEndLocation().
13895 (statement_expression): StatementExpression constructor now takes the
13896 lexer.Location as additional argument.
13897 (for_statement, declare_local_variables): Likewise.
13898 (declare_local_variables): When creating a new implicit block, use the
13899 new Block constructor and pass it the lexer.Location.
13901 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13903 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
13904 members also on the parent interfaces recursively.
13906 2002-03-27 Miguel de Icaza <miguel@ximian.com>
13908 * report.cs: Use new formats, since Gonzalo finished the missing
13911 * expression.cs (Binary.ResolveOperator): added missing operator|
13912 operator& and operator^ for bool/bool.
13914 * cs-parser.jay: CheckDef now takes a Location argument that is
13915 used to report errors more precisly (instead of reporting the end
13916 of a definition, we try to track something which is a lot closer
13917 to the source of the problem).
13919 * cs-tokenizer.cs: Track global token use, so we can properly flag
13920 the use of #define/#undef after the first token has been seen.
13922 Also, rename the reportXXXX to Error_DescriptiveName
13924 * decl.cs (DeclSpace.IsTopLevel): Move property here from
13925 TypeContainer, so that Enum and Interface can use this too.
13927 * class.cs (TypeContainer.LookupInterfaceOrClass,
13928 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
13929 `builder' argument. Typically this was used to pass the parent
13930 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
13933 The problem is that a nested class could trigger the definition of
13934 a toplevel class, and the builder would be obviously wrong in that
13937 So we drop this argument, and we compute dynamically the
13938 TypeBuilder/ModuleBuilder (the correct information was available
13939 to us anyways from DeclSpace.Parent)
13941 * interface.cs (Interface.DefineInterface): Drop builder
13942 parameter cleanup like class.cs
13944 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
13947 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
13950 (Try.Emit): Propagate the returns value from the statement.
13952 (Return.Emit): Even if we are leavning
13954 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
13956 * modifiers.cs: Fix the computation of MethodAttributes flags.
13958 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
13960 * driver.cs: allow compilation of files that start with '/'.
13961 Add a default case when checking the argument of --target.
13963 2002-03-25 Miguel de Icaza <miguel@ximian.com>
13965 * interface.cs: Implement the same search algorithm for types in
13966 the interface code.
13968 * delegate.cs: Do not allow multiple definition.
13970 * Recovered ChangeLog that got accidentally amputated
13972 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
13974 * rootcontext.cs: Load manually enum to allow core classes to
13975 contain enumerations.
13977 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
13978 Update to new static methods in TypeManager.
13980 * typemanager.cs (GetMethod, GetConstructor): Use our
13981 implementation of FindMembers to find the members, since during
13982 corlib compilation, the types are TypeBuilders and GetMethod and
13983 GetConstructor do not work.
13985 Make all methods in TypeManager static.
13987 (InitCodeHelpers): Split the functionality from
13988 the InitCodeTypes function.
13990 * driver.cs: Call InitCodeHelpers after we have populated the
13993 * cs-parser.jay (delegate_declaration): we did not used to compute
13994 the delegate name correctly for void delegates.
13996 2002-03-24 Miguel de Icaza <miguel@ximian.com>
13998 * rootcontext.cs (RootContext): Init the interface_resolve_order
13999 and type_container_resolve_order always.
14001 (ResolveCore, BootstrapCorlib_ResolveClass,
14002 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
14003 compiler when compiling with --nostdlib
14005 * class.cs (TypeContainer.DefineType): Check that our parent is
14006 not null. This test is most important when we are bootstraping
14009 * codegen.cs: Split out the symbol writing code.
14011 2002-03-25 Martin Baulig <martin@gnome.org>
14013 * driver.cs (-g): Made -g an alias for --debug.
14015 2002-03-24 Martin Baulig <martin@gnome.org>
14017 * codegen.cs (SymbolWriter): New public variable. Returns the
14018 current symbol writer.
14019 (CodeGen): Added `bool want_debugging_support' argument to the
14020 constructor. If true, tell the ModuleBuild that we want debugging
14021 support and ask it for the ISymbolWriter.
14022 (Save): If we have a symbol writer, call it's Close() method after
14023 saving the assembly.
14025 * driver.c (--debug): New command line argument to create a
14026 debugger information file.
14028 * location.cs (SymbolDocument): New public property. Returns an
14029 ISymbolDocumentWriter object for the current source file or null
14030 if we don't have a symbol writer.
14032 2002-03-21 Miguel de Icaza <miguel@ximian.com>
14034 * driver.cs (LoadAssembly): Correctly return when all the paths
14035 have been tried and not before.
14037 * statement.cs (Switch.Emit): return the actual coverage for this
14038 statement (returns/not-returns)
14040 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
14041 switch of the statement if we are the last switch section. That
14042 kills two problems: try/catch problems (we used to emit an empty
14043 nop at the end) and switch statements where all branches would
14046 2002-03-19 Miguel de Icaza <miguel@ximian.com>
14048 * driver.cs: Add default assemblies (the equivalent to the
14049 Microsoft CSC.RSP file)
14051 * cs-tokenizer.cs: When updating `cols and setting it to zero,
14052 also update tokens_seen and set it to false.
14054 * driver.cs: Implement --recurse for Mike.
14056 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
14057 correctly splitting out the paths.
14059 2002-03-18 Miguel de Icaza <miguel@ximian.com>
14061 * interface.cs (Interface.PopulateProperty): Instead of using
14062 `parent' as the declaration space for the set parameters, use
14065 * support.cs (InternalParameters): InternalParameters constructor
14066 takes a DeclSpace instead of a TypeContainer.
14068 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
14069 types are being initialized, load the address of it before calling
14072 (New): Provide a mechanism to disable the generation of local
14073 value type temporaries when the caller will be providing us with
14074 an address to store it.
14076 (ArrayCreation.EmitDynamicInitializers): Use it.
14078 2002-03-17 Miguel de Icaza <miguel@ximian.com>
14080 * expression.cs (Invocation.EmitArguments): Only probe for array
14081 property if there is more than one argument. Sorry about that.
14083 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
14084 empty param arrays.
14086 * class.cs (Method.LabelParameters): Fix incorrect code path that
14087 prevented the `ParamArrayAttribute' from being applied to the
14090 2002-03-16 Miguel de Icaza <miguel@ximian.com>
14092 * support.cs (ReflectionParameters): Correctly compute whether the
14093 last argument is a params array. Fixes the problem with
14096 * typemanager.cs: Make the assemblies array always be non-null
14097 (empty, but non-null)
14099 * tree.cs (RecordDecl): New function that abstracts the recording
14100 of names. This reports error 101, and provides a pointer to the
14101 previous declaration. Fixes a crash in the compiler.
14103 * cs-parser.jay (constructor_declaration): Update to new grammar,
14104 and provide a constructor_body that can be empty.
14106 2002-03-15 Miguel de Icaza <miguel@ximian.com>
14108 * driver.cs: Add support for --resources.
14110 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
14111 Make all types for the various array helper methods be integer.
14113 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
14114 CheckState to ConvCast.
14116 (ConvCast): Now it takes a `checked' state argument, to avoid
14117 depending on the emit context for the conversion, and just using
14118 the resolve time setting.
14120 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
14121 instead of Invocation.EmitArguments. We do not emit the original
14122 arguments, instead we emit those which have been converted to
14123 unsigned int expressions.
14125 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
14127 * codegen.cs: ditto.
14129 * expression.cs (LocalVariableReference): Drop the use of the
14130 Store function that depended on the variable index.
14132 * statement.cs (VariableInfo): Drop the `Idx' property from this
14133 class, as this is not taking into account the indexes for
14134 temporaries tat we generate during the execution, getting the
14137 * class.cs: First emit class initializers, then call the parent
14140 * expression.cs (Binary): Fix opcode emision.
14141 (UnaryMutator.EmitCode): Support checked code generation
14143 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
14144 matches for events for both the Static and Instance scans,
14145 pointing to the same element. Fix that.
14147 2002-03-14 Miguel de Icaza <miguel@ximian.com>
14149 * rootcontext.cs (ResolveTree): Always set the
14150 interface_resolve_order, because nested interfaces will be calling
14153 * class.cs (GetInterfaceOrClass): Track the same resolution
14154 process used by TypeManager.LookupType. This fixes the nested
14155 type lookups in class declarations (separate path from
14158 (TypeContainer.DefineType): Also define nested interfaces.
14159 (TypeContainer.RegisterOrder): New public function used to
14160 register the order in which child interfaces need to be closed.
14162 Nested interfaces need to be closed after their parents have been
14165 * interface.cs (InterfaceAttr): Put all the logic for computing
14166 the interface attribute here.
14168 (DefineInterface): Register our interface order with the
14169 RootContext or with the TypeContainer depending on the case.
14171 2002-03-12 Miguel de Icaza <miguel@ximian.com>
14173 * cs-parser.jay: rework foreach statement to work with the new
14174 changes to the policy on SimpleNames.
14176 * report.cs: support Stacktrace on warnings as well.
14178 * makefile: drop --unsafe and /unsafe from the compile.
14180 2002-03-13 Ravi Pratap <ravi@ximian.com>
14182 * ecore.cs (StandardConversionExists): Modify to take an Expression
14183 as the first parameter. Ensure we do null -> reference type conversion
14186 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
14187 temporary Expression objects.
14189 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
14191 * interface.cs: workaround bug in method overloading resolution
14192 (there is already a bugzilla bug for it).
14194 2002-03-12 Miguel de Icaza <miguel@ximian.com>
14196 We could also solve this problem by having a separate path for
14197 performing type lookups, instead of DoResolve, we could have a
14198 ResolveType entry point, and only participating pieces of the
14199 production (simplename, deref, array) would implement this.
14201 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
14202 signal SimpleName to only resolve type names and not attempt to
14203 resolve anything else.
14205 * expression.cs (Cast): Set the flag.
14207 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
14209 * class.cs: Only report 108 if there is no `new' modifier.
14211 * cs-parser.jay: rework foreach statement to work with the new
14212 changes to the policy on SimpleNames.
14214 * report.cs: support Stacktrace on warnings as well.
14216 * makefile: drop --unsafe and /unsafe from the compile.
14218 2002-03-11 Miguel de Icaza <miguel@ximian.com>
14220 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
14221 lookups here, instead of doing that at parse time. This means
14222 that our grammar will not introduce `LocalVariableReferences' as
14223 expressions at this point. That solves the problem of code like
14227 static void Main ()
14231 This is only half the fix. The full fix requires parameters to
14232 also be handled in this way.
14234 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
14235 makes the use more obvious of the DeclSpace. The
14236 ec.TypeContainer.TypeBuilder is now only used to pull the
14237 TypeBuilder for it.
14239 My theory is that I can get rid of the TypeBuilder completely from
14240 the EmitContext, and have typecasts where it is used (from
14241 DeclSpace to where it matters).
14243 The only pending problem is that the code that implements Aliases
14244 is on TypeContainer, and probably should go in DeclSpace.
14246 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
14247 lookups here, instead of doing that at parse time. This means
14248 that our grammar will not introduce `LocalVariableReferences' as
14249 expressions at this point. That solves the problem of code like
14253 static void Main ()
14257 This is only half the fix. The full fix requires parameters to
14258 also be handled in this way.
14260 * class.cs (Property.DefineMethod): When implementing an interface
14261 method, set newslot, when implementing an abstract method, do not
14262 set the flag (before we tried never setting it, or always setting
14263 it, which is the difference).
14264 (Indexer.DefineMethod): same.
14265 (Method.DefineMethod): same.
14267 * ecore.cs: Only set the status used flag if we get back a Field.
14269 * attribute.cs: Temporary hack, so Paolo can keep working.
14271 2002-03-08 Ravi Pratap <ravi@ximian.com>
14273 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
14274 the unmanaged type in the case we have a MarshalAs attribute.
14276 (Resolve): Handle the case when we are parsing the special MarshalAs
14277 attribute [we need to store the unmanaged type to use later]
14279 * typemanager.cs (marshal_as_attr_type): Built in type for the
14280 MarshalAs Attribute.
14282 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
14283 on parameters and accordingly set the marshalling info.
14285 2002-03-09 Miguel de Icaza <miguel@ximian.com>
14287 * class.cs: Optimizing slightly by removing redundant code after
14288 we switched to the `NoTypes' return value.
14289 (Property.DefineMethod): use NoTypes here too.
14291 This fixes the bug I introduced in my last batch of changes.
14293 2002-03-05 Ravi Pratap <ravi@ximian.com>
14295 * tree.cs (RecordEnum): Add. We now keep track of enums too.
14297 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
14298 Enums since those are types too.
14300 * cs-parser.jay (enum_declaration): Record enums as we parse them.
14302 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
14303 thanks to a call during the lookup process.
14305 2002-03-07 Miguel de Icaza <miguel@ximian.com>
14307 * statement.cs (Foreach): Lots of work to accomodate a particular
14308 kind of foreach statement that I had not kept in mind. It is
14309 possible to have foreachs on classes that provide a GetEnumerator
14310 method that return objects that implement the "pattern" for using
14311 a foreach, there is no need to support GetEnumerator
14314 This is needed to compile nant.
14316 * decl.cs: Only report 114 if the member is not `Finalize' and if
14317 the warning level is at least 2.
14319 * class.cs: Moved the compare function from Method to
14322 (MethodSignature.InheritableMemberSignatureCompare): Add new
14323 filter function that is used to extract inheritable methods from a
14326 (Method.Define): Use the new `inheritable_method_signature_filter'
14329 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
14332 2002-03-06 Miguel de Icaza <miguel@ximian.com>
14334 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
14336 * cs-parser.jay: Add opt_semicolon to the interface declaration.
14338 * expression.cs: Pass location information to
14339 ConvertImplicitStandard.
14341 * class.cs: Added debugging code to track return values from
14344 2002-03-05 Miguel de Icaza <miguel@ximian.com>
14346 * expression.cs (Is.DoResolve): If either side of the `is' is an
14347 interface, do not flag the warning.
14349 * ecore.cs (ImplicitReferenceConversion): We need a separate test
14352 * report.cs: Allow for --fatal to be used with --probe.
14354 * typemanager.cs (NoTypes): Move the definition for the empty Type
14357 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
14359 (TypeContainer.DefineProxy): New function used to proxy to parent
14360 implementations when implementing interfaces.
14361 (TypeContainer.ParentImplements): used to lookup if our parent
14362 implements a public function that is required by an interface.
14363 (TypeContainer.VerifyPendingMethods): Hook this up.
14365 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
14366 `modules' and `assemblies' arraylists into arrays. We only grow
14367 these are the very early start up of the program, so this improves
14368 the speedof LookupType (nicely measured).
14370 * expression.cs (MakeByteBlob): Replaced unsafe code with
14371 BitConverter, as suggested by Paolo.
14373 * cfold.cs (ConstantFold.Binary): Special case: perform constant
14374 folding of string concatenation, but if either side is a string,
14375 and the other is not, then return null, and let the runtime use
14376 the concatenation on the string plus the object (using
14377 `Object.ToString').
14379 2002-03-04 Miguel de Icaza <miguel@ximian.com>
14381 Constant Folding has been implemented now.
14383 * expression.cs (Unary.Reduce): Do not throw an exception, catch
14384 the error instead on types that are not supported in one's
14387 * constant.cs (Constant and all children): New set of functions to
14388 perform implict and explicit conversions.
14390 * ecore.cs (EnumConstant): Implement the new functions to perform
14391 conversion by proxying to the child expression.
14393 * codegen.cs: (ConstantCheckState): Constant evaluation has its
14394 own separate setting that can not be turned off from the command
14395 line using --unchecked or --checked and is only controlled using
14396 the checked/unchecked statements and expressions. This setting is
14397 used by the constant folder to flag errors.
14399 * expression.cs (CheckedExpr, UncheckedExpr): Set the
14400 ConstantCheckState as well.
14402 During Resolve, they also have to flag the state, because the
14403 constant folder runs completely in the Resolve phase.
14405 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
14408 2002-03-01 Miguel de Icaza <miguel@ximian.com>
14410 * cfold.cs: New file, this file contains the constant folder.
14412 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
14413 argument to track whether we are using the resulting address to
14414 load or store a value and provide better error messages.
14416 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
14417 new AddressOf arguments.
14419 * statement.cs (Foreach.EmitCollectionForeach): Update
14421 * expression.cs (Argument.Emit): Call AddressOf with proper
14422 arguments to track usage.
14424 (New.DoEmit): Call AddressOf with new arguments.
14426 (Unary.Emit): Adjust AddressOf call.
14428 2002-03-01 Ravi Pratap <ravi@ximian.com>
14430 * cs-parser.jay (member_access): Change the case for pre-defined types
14431 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
14434 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
14437 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
14438 essentially like methods and apply attributes like MethodImplOptions to them too.
14440 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
14443 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
14444 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
14447 * Update code everywhere accordingly.
14449 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
14451 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
14453 2002-02-28 Ravi Pratap <ravi@ximian.com>
14455 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
14456 try performing lookups against those instead of jumping straight into using
14457 the 'using' clauses.
14459 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
14461 (LookupType): Perform lookups in implicit parents too.
14463 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
14464 sequence as RootContext.LookupType.
14466 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
14467 the various cases of namespace lookups into this method.
14469 2002-03-01 Miguel de Icaza <miguel@ximian.com>
14471 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
14472 in positional arguments)
14474 * class.cs (Operator): Update the AllowedModifiers to contain
14477 * cs-parser.jay: Update operator declaration to allow for the
14478 operator body to be empty.
14480 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
14483 2002-02-27 Miguel de Icaza <miguel@ximian.com>
14485 * class.cs (Method.Emit): Label parameters.
14487 * driver.cs: Return 1 or 0 as the program exit code.
14489 2002-02-26 Miguel de Icaza <miguel@ximian.com>
14491 * expression.cs: Special case the `null' object when trying to
14492 auto-compute the type, as anything can be explicitly converted to
14495 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
14496 spotting this Paolo.
14498 (Expression.ImplicitNumericConversion): Perform comparissions of
14499 the type using the underlying type in the case of an enumeration
14500 rather than using the enumeration type for the compare.
14502 Cope with the underlying == type case, which is not possible to
14505 (Expression.ConvertNumericExplicit): Perform comparissions of
14506 the type using the underlying type in the case of an enumeration
14507 rather than using the enumeration type for the compare.
14509 * driver.cs: If the user does not supply an extension, assume .exe
14511 * cs-parser.jay (if_statement): Rewrote so that we can track the
14512 location for the if statement.
14514 * expression.cs (Binary.ConstantFold): Only concat strings when
14515 the operation is "+", not everything ;-)
14517 * statement.cs (Statement.EmitBoolExpression): Take a location
14519 (If, While, Do): Track location.
14521 * expression.cs (Binary.ResolveOperator): In the object + string
14522 case, I was missing a call to ConvertImplicit
14524 2002-02-25 Ravi Pratap <ravi@ximian.com>
14526 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
14527 Location arguments. Ensure we use RootContext.LookupType to do our work
14528 and not try to do a direct Type.GetType and ModuleBuilder.GetType
14530 * interface.cs (PopulateMethod): Handle the type of the parameter being
14533 * expression.cs (Invocation.BetterFunction): Handle the case when we
14534 have a params method with no fixed arguments and a call is made with no
14537 2002-02-25 Miguel de Icaza <miguel@ximian.com>
14539 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
14540 the verbatim-string-literal
14542 * support.cs (InternalParameters.ParameterModifier): handle null
14544 (InternalParameters.ParameterType): ditto.
14546 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
14547 duplicating the name of the variable parameter.
14548 (GetParameterByName): Fix bug where we were not looking up array
14549 paramters if they were the only present (thanks Paolo!).
14550 (GetParameterInfo): We only have an empty set of types if both
14551 fixed and array are set to null.
14552 (GetParameterInfo-idx): Handle FixedParameter == null
14554 * cs-parser.jay: Handle the case where there is no catch
14555 statements (missing null test).
14557 2002-02-22 Miguel de Icaza <miguel@ximian.com>
14559 * driver.cs (MainDriver): Be conservative on our command line
14562 Catch DirectoryNotFoundException when calling GetFiles.
14564 (SplitPathAndPattern): Used to split the input specification into
14565 a path and a pattern that we can feed to Directory.GetFiles.
14567 2002-02-21 Miguel de Icaza <miguel@ximian.com>
14569 * statement.cs (Fixed): Implement the last case of the Fixed
14570 statement (string handling).
14572 * expression.cs (StringPtr): New class used to return a char * to
14573 a string; Used by the Fixed statement.
14575 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
14577 * expression.cs (Binary.ResolveOperator): Remove redundant
14578 MemberLookup pn parent type.
14579 Optimize union call, we do not need a union if the types are the same.
14580 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
14583 Specialize the use of MemberLookup everywhere, instead of using
14584 the default settings.
14586 (StackAlloc): Implement stackalloc keyword.
14588 * cs-parser.jay: Add rule to parse stackalloc.
14590 * driver.cs: Handle /h, /help, /?
14592 * expression.cs (MakeByteBlob): Removed the hacks we had in place
14593 before we supported unsafe code.
14595 * makefile: add --unsafe to the self compilation of mcs.
14597 2002-02-20 Miguel de Icaza <miguel@ximian.com>
14599 * expression.cs (PointerArithmetic): New class that is used to
14600 perform pointer arithmetic.
14601 (Binary.Resolve): Handle pointer arithmetic
14602 Handle pointer comparission.
14603 (ArrayPtr): Utility expression class that is used to take the
14604 address of an array.
14606 (ElementAccess): Implement array access for pointers
14608 * statement.cs (Fixed): Implement fixed statement for arrays, we
14609 are missing one more case before we are done.
14611 * expression.cs (Indirection): Implement EmitAssign and set the
14612 ExprClass to Variable. This allows pointer dereferences to be
14613 treated as variables, and to have values assigned to them.
14615 * ecore.cs (Expression.StoreFromPtr): New utility function to
14616 store values dereferencing.
14618 2002-02-20 Ravi Pratap <ravi@ximian.com>
14620 * expression.cs (Binary.ResolveOperator): Ensure that we are
14621 not trying to operate on a void type - this fixes the reported
14624 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
14625 the parent implementation is sealed.
14627 * ../errors/cs0239.cs : Add.
14629 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
14631 * typemanager.cs (unverifiable_code_type): Corresponds to
14632 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
14633 which have unsafe code in them.
14635 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
14638 2002-02-19 Miguel de Icaza <miguel@ximian.com>
14640 * cs-tokenizer.cs: Add support for @"litreal strings"
14642 Make tokenizer accept pre-processor directives
14643 on any column (remove the old C-like limitation).
14645 * rootcontext.cs (EmitCode): Emit any global attributes.
14646 (AddGlobalAttributes): Used to keep track of assembly attributes.
14648 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
14650 * cs-parser.jay: Add support for global attributes.
14652 2002-02-17 Miguel de Icaza <miguel@ximian.com>
14654 * expression.cs (Indirection): New helper class. Unary will
14655 create Indirection classes to be able to implement the
14656 IMemoryLocation interface on it.
14658 2002-02-16 Miguel de Icaza <miguel@ximian.com>
14660 * cs-parser.jay (fixed_statement): reference the right statement.
14662 * statement.cs (Fixed.Emit): Finish implementing the fixed
14663 statement for the &x case.
14665 2002-02-14 Miguel de Icaza <miguel@ximian.com>
14667 * class.cs (Property.Define, Method.Define): Remove newslot when
14670 * modifiers.cs: My use of NewSlot when `Abstract' was set was
14671 wrong. NewSlot should only be used if the `new' keyword is present.
14673 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
14674 locating our system dir. Sorry about this.
14676 2002-02-13 Miguel de Icaza <miguel@ximian.com>
14678 * driver.cs (GetSystemDir): Compute correctly the location of our
14679 system assemblies. I was using the compiler directory instead of
14680 the library directory.
14682 2002-02-13 Ravi Pratap <ravi@ximian.com>
14684 * expression.cs (BetterFunction): Put back in what Miguel commented out
14685 since it is the correct fix. The problem is elsewhere ;-)
14687 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
14688 parameters of the parms method are themselves compatible or not !
14690 (StandardConversionExists): Fix very dangerous bug where we were forgetting
14691 to check that a class implements an interface before saying that an implicit
14692 conversion was allowed. Use ImplementsInterface to do the checking.
14694 2002-02-13 Miguel de Icaza <miguel@ximian.com>
14696 * class.cs (Method.Define): Track whether we are an explicit
14697 implementation or not. And only call DefineMethodOverride if we
14698 are an explicit implementation.
14700 (Property.DefineMethod): Ditto.
14702 2002-02-11 Ravi Pratap <ravi@ximian.com>
14704 * expression.cs (BetterFunction): Catch hideous bug which was
14705 preventing us from detecting ambiguous calls due to implicit casts i.e
14708 2002-01-29 Miguel de Icaza <miguel@ximian.com>
14710 * support.cs (Pair): Remove un-needed method. I figured why I was
14711 getting the error in cs-parser.jay, the variable in a foreach loop
14712 is readonly, and the compiler does not really treat this as a variable.
14714 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
14715 instead of EQUALS in grammar.
14717 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
14719 * expression.cs (Unary.DoResolve): Check whether the argument is
14722 2002-01-28 Miguel de Icaza <miguel@ximian.com>
14724 * support.cs: Api for Pair to set a value. Despite the fact that
14725 the variables are public the MS C# compiler refuses to compile
14726 code that accesses the field if the variable is part of a foreach
14729 * statement.cs (Fixed): Begin implementation of the fixed
14732 (Block.AddVariable): Return the VariableInfo on success and null
14733 on failure instead of true/false.
14735 * cs-parser.jay (foreach): Catch errors on variables already
14736 defined (we were ignoring this value before) and properly unwind
14737 the block hierarchy
14739 (fixed_statement): grammar for the fixed statement.
14741 2002-01-25 Miguel de Icaza <miguel@ximian.com>
14743 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
14744 pointer types to be incretemented.
14746 (SizeOf): Implement.
14748 * cs-parser.jay (pointer_member_access): Implement
14749 expr->IDENTIFIER production.
14751 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
14752 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
14755 (Unary): Implement indirection.
14757 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
14758 use in non-unsafe context).
14760 (SimpleName.DoResolve): Check for pointers in field access on safe
14763 (Expression.LoadFromPtr): Factor the load-indirect code in this
14764 function. This was duplicated in UnboxCast and ParameterReference
14766 2002-01-24 Miguel de Icaza <miguel@ximian.com>
14768 * expression.cs (ComposedCast): report an error if a pointer cast
14769 is used in a safe region.
14771 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
14772 pointer type casts in unsafe context.
14774 * codegen.cs (EmitContext): Set up IsUnsafe.
14776 * cs-parser.jay (non_expression_type): Add productions for pointer
14779 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
14780 code. We should not use force into static mode if the method is
14781 not virtual. Fixes bug in MIS
14783 * statement.cs (Do.Emit, While.Emit, For.Emit,
14784 Statement.EmitBoolExpression): Add support to Do and While to
14785 propagate infinite loop as `I do return' semantics.
14787 Improve the For case to also test for boolean constants.
14789 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
14790 to the list of attributes we can add.
14792 Remove `EmitContext' argument.
14794 * class.cs (Method.Define): Apply parameter attributes.
14795 (Constructor.Define): Apply parameter attributes.
14796 (MethodCore.LabelParameters): Move here the core of labeling
14799 * support.cs (ReflectionParameters.ParameterModifier,
14800 InternalParameters.ParameterModifier): Use IsByRef on the type and
14801 only return the OUT bit for these parameters instead of in/out/ref
14804 This is because I miss-understood things. The ParameterInfo.IsIn
14805 and IsOut represent whether the parameter has the [In] and [Out]
14808 2002-01-22 Miguel de Icaza <miguel@ximian.com>
14810 * ecore.cs (FieldExpr.Emit): Release temporaries.
14812 * assign.cs (LocalTemporary.Release): new function.
14814 * codegen.cs (EmitContext.GetTemporaryStorage,
14815 EmitContext.FreeTemporaryStorage): Rework the way we deal with
14816 temporary storage. Now we can "put back" localbuilders when we
14819 2002-01-21 Miguel de Icaza <miguel@ximian.com>
14821 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
14822 need to make a copy of the variable to generate verifiable code.
14824 2002-01-19 Miguel de Icaza <miguel@ximian.com>
14826 * driver.cs: Compute dynamically the system directory.
14828 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
14829 Slower, but more generally useful. Used by the abstract
14830 registering implementation.
14832 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
14833 the rules for the special rule on Type/instances. First check if
14834 we have the same name, and if so, try that special static path
14835 rather than the instance path.
14837 2002-01-18 Miguel de Icaza <miguel@ximian.com>
14839 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
14842 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
14843 Enum, ValueType, Delegate or Array for non-corlib compiles.
14845 * cs-tokenizer.cs: Catch long identifiers (645)
14847 * typemanager.cs (IndexerPropetyName): Ravi never tested this
14850 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
14851 fix, we were returning too early, so we were not registering
14852 pending methods from abstract classes.
14854 Do not register pending methods if the class is abstract.
14856 * expression.cs (Conditional.DoResolve): Report circular implicit
14857 conversions when we neecd to compute it for conditional
14860 (Is.DoResolve): If the expression is always of the provided type,
14861 flag warning 183. If the expression can not ever be of the
14862 provided type flag warning 184.
14864 * class.cs: Catch 169 as well.
14866 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
14869 2002-01-18 Nick Drochak <ndrochak@gol.com>
14871 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
14873 2002-01-17 Miguel de Icaza <miguel@ximian.com>
14875 * interface.cs: (PopulateMethod): Check for pointers being defined
14876 only if the unsafe context is active.
14877 (PopulateProperty): ditto.
14878 (PopulateIndexer): ditto.
14880 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
14881 specified. If pointers are present, make sure that they are
14882 present in an unsafe context.
14883 (Constructor, Constructor.Define): ditto.
14884 (Field, Field.Define): ditto.
14885 (Property, Property.Define): ditto.
14886 (Event, Event.Define): ditto.
14888 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
14889 hashtable if there are classes or structs defined.
14891 * expression.cs (LocalVariableReference.DoResolve): Simplify this
14892 code, as the constant resolution moved.
14894 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
14895 the metadata, so we can flag error 133.
14897 * decl.cs (MemberCore.UnsafeOK): New function to test that a
14898 pointer is being declared in an unsafe context.
14900 2002-01-16 Miguel de Icaza <miguel@ximian.com>
14902 * modifiers.cs (Modifiers.Check): Require a Location argument.
14903 Report error 227 for Unsafe use.
14905 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
14907 * statement.cs (For.Emit): If the test is null, then report that
14908 we do `return', as we wont reach anything afterwards.
14910 (Switch.SwitchGoverningType): Track the expression that matched
14913 * driver.cs: Allow negative numbers as an error code to flag.
14915 * cs-parser.jay: Handle 1551.
14917 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
14919 2002-01-15 Miguel de Icaza <miguel@ximian.com>
14921 * cs-parser.jay: Report 1518 (type declaration can only contain
14922 class, struct, interface, enum or delegate)
14924 (switch_label): Report 1523 (keywords `case' or `default' must
14927 (opt_switch_sections): Report 1522 (empty switch)
14929 * driver.cs: Report 1515 (response file specified multiple times)
14930 Report 1516 (Source file specified multiple times).
14932 * expression.cs (Argument.Resolve): Signal 1510
14934 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
14935 access not allowed in static code)
14937 2002-01-11 Ravi Pratap <ravi@ximian.com>
14939 * typemanager.cs (IsPointerType): Utility method which we are going
14942 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
14943 the object type, so we take care of that.
14945 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
14947 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
14948 added to non-params parameters :-)
14950 * typemanager.cs (CSharpName): Include 'void' type too.
14952 (void_ptr_type): Include in the set of core types.
14954 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
14957 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
14960 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
14961 completely forgotten about it.
14963 2002-01-10 Ravi Pratap <ravi@ximian.com>
14965 * cs-parser.jay (pointer_type): Add. This begins our implementation
14966 of parsing rules for unsafe code.
14968 (unsafe_statement): Implement.
14970 (embedded_statement): Modify to include the above.
14972 * statement.cs (Unsafe): Implement new class for unsafe blocks.
14974 * codegen.cs (EmitContext.InUnsafe): Add. This determines
14975 if the current context is an unsafe one.
14977 * cs-parser.jay (local_variable_pointer_type): Since local variable types
14978 are handled differently, we need separate rules for them.
14980 (local_variable_declaration): Update to use local_variable_pointer_type
14981 to allow variable declarations of unmanaged pointer types.
14983 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
14984 in unsafe contexts.
14986 * ../errors/cs0214.cs : Add.
14988 2002-01-16 Nick Drochak <ndrochak@gol.com>
14990 * makefile: remove 'response' file when cleaning.
14992 2002-01-15 Miguel de Icaza <miguel@ximian.com>
14994 * cs-parser.jay: Report 1524.
14996 2002-01-14 Miguel de Icaza <miguel@ximian.com>
14998 * typemanager.cs (RegisterMethod): drop checking if we have
14999 registered this from here
15001 2002-01-12 Miguel de Icaza <miguel@ximian.com>
15003 * class.cs (Method.EmitDestructor): Implement calling our base
15006 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
15007 value of InFinally.
15009 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
15010 this routine and will wrap the call in a try/catch block. Deal
15013 2002-01-11 Miguel de Icaza <miguel@ximian.com>
15015 * ecore.cs (Expression.MemberLookup): instead of taking a
15016 parameter `same_type' that was used to tell whether we could
15017 access private members we compute our containing type from the
15020 (FieldExpr): Added partial support for volatile fields. This does
15021 not work for volatile fields exposed from assemblies, as I can not
15022 figure out how to extract the modreq from it.
15024 Updated all the source files to use this.
15026 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
15027 because it is referenced by MemberLookup very often.
15029 2002-01-09 Ravi Pratap <ravi@ximian.com>
15031 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
15032 TypeBuilder.GetCustomAttributes to retrieve what we need.
15034 Get rid of redundant default_member_attr_type as this is the same as
15035 default_member_type which already exists.
15037 * interface.cs, attribute.cs : Update accordingly.
15039 2002-01-08 Miguel de Icaza <miguel@ximian.com>
15041 * typemanager.cs: Enable IndexerPropertyName again. It does not
15042 work for TYpeBuilders though. Ravi, can you please fix this?
15044 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
15046 * expression.cs (Argument.Emit): Handle the case of ref objects
15047 being passed to ref functions;
15049 (ParameterReference.EmitLoad): Loads the content of the pointer
15050 without dereferencing.
15052 2002-01-07 Miguel de Icaza <miguel@ximian.com>
15054 * cs-tokenizer.cs: Implemented the pre-processing expressions.
15056 2002-01-08 Ravi Pratap <ravi@ximian.com>
15058 * class.cs (Indexer.DefineMethod): Incorporate the interface
15059 type in the name of the method if we are doing explicit interface
15062 * expression.cs (ConversionExists): Remove as it is completely obsolete.
15064 (BetterConversion): Fix extremely trivial bug where we were referring to
15065 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
15068 * ../errors/bug16.cs : Add although we have fixed it.
15070 2002-01-07 Miguel de Icaza <miguel@ximian.com>
15072 * expression.cs (BaseIndexer): Begin implementation.
15074 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
15076 * cs-parser.jay (indexer_declarator): Use qualified_identifier
15077 production directly to remove a shift/reduce, and implement
15078 explicit interface implementation.
15080 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
15081 after a floating point suffix.
15083 * expression.cs (DoNumericPromotions): Improved the conversion for
15084 uint/uint. If we have a constant, we avoid doing a typecast to a
15087 * class.cs (Indexer): Implement explicit interface implementation
15090 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
15092 * class.cs: make the default instance constructor public and hidebysig.
15094 2001-01-03 Ravi Pratap <ravi@ximian.com>
15096 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
15097 so we can call it from elsewhere.
15099 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
15100 we emit it internally if the class has a defined indexer; otherwise the user
15101 emits it by decorating the class definition with the DefaultMemberAttribute.
15103 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
15104 attribute is not used on a type which defines an indexer.
15106 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
15107 character when we skip whitespace.
15109 * ../errors/cs0646.cs : Add.
15111 2002-01-03 Miguel de Icaza <miguel@ximian.com>
15113 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
15116 * makefile: Add practical target `mcs3.exe' which builds the third
15117 generation compiler.
15119 * expression.cs (New): Fix structures constructor calling.
15121 * class.cs (Property, Method, Indexer): Emit Final flag on the
15122 method if we are an interface implementation and we are not
15125 * ecore.cs (PropertyExpr): New public field `IsBase', tells
15126 whether this property is referencing a `base' method.
15128 * expression.cs (Invocation.EmitCall): take an extra argument:
15129 is_base, this is used to determine whether the `call' or
15130 `callvirt' opcode should be used.
15133 * delegate.cs: update EmitCall.
15135 * class.cs (Method.Define): Set NewSlot for the cases where we are
15136 not implementing an interface method.
15138 (Property.Define): ditto.
15140 2002-01-02 Miguel de Icaza <miguel@ximian.com>
15142 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
15143 'r'. Allows mcs to parse itself fully.
15145 2002-01-02 Ravi Pratap <ravi@ximian.com>
15147 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
15148 of the number of initializers that require the InitializeArray method.
15150 (CheckIndices): Store the Expression in all cases - not the plain value. Also
15151 update the above field where necessary.
15153 (MakeByteBlob): Update accordingly.
15155 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
15158 (EmitDynamicInitializers): Update in accordance with the new optimization.
15160 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
15161 same OpCode applies.
15163 * cs-parser.jay : Fix some glaring errors I introduced.
15165 2002-01-01 Ravi Pratap <ravi@ximian.com>
15167 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
15168 so that we can check for name clashes there too.
15170 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
15171 for interface indexers.
15173 * interfaces.cs (Define): Emit the default member attribute.
15175 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
15176 variable was being referred to while setting the value ;-)
15178 2002-01-01 Miguel de Icaza <miguel@ximian.com>
15180 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
15181 byte-by-byte information when we know the data is zero.
15183 Make the block always a multiple of 4, because
15184 DefineInitializedData has a bug.
15186 * assign.cs: Fix, we should assign from the temporary, not from
15189 * expression.cs (MakeByteBlob): Fix my incorrect code.
15191 2001-12-31 Miguel de Icaza <miguel@ximian.com>
15193 * typemanager.cs (EnumToUnderlying): This function is used to get
15194 the underlying type from an enumeration, because it does not
15197 * constant.cs: Use the I4_S form for values between -128 and 127.
15199 * statement.cs (Block.LookupLabel): Looks up a label.
15200 (Block): Drop support for labeled blocks.
15202 (LabeledStatement): New kind of statement that represents a label
15205 (Goto): Finally implement this bad boy.
15207 * cs-parser.jay: Update to reflect new mechanism to implement
15210 2001-12-30 Miguel de Icaza <miguel@ximian.com>
15212 * codegen.cs (EmitContext.This): a codegen property that keeps the
15213 a single instance of this instead of creating many different this
15216 * delegate.cs (Delegate.DoResolve): Update to use the property;
15218 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
15220 * expression.cs (BaseAccess.DoResolve): Ditto.
15222 2001-12-29 Ravi Pratap <ravi@ximian.com>
15224 * typemanager.cs (methodimpl_attr_type): Add to hold the type
15225 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
15227 (InitCoreTypes): Update accordingly.
15229 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
15230 so we can quickly store the state.
15232 (ApplyAttributes): Set the correct implementation flags
15233 for InternalCall methods.
15235 2001-12-29 Miguel de Icaza <miguel@ximian.com>
15237 * expression.cs (EmitCall): if a method is not virtual, then do
15238 not use callvirt on it.
15240 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
15241 user defined stuff) requires the use of stobj, which takes an
15242 address on the stack instead of an array and an index. So emit
15243 the Ldelema operation for it.
15245 (EmitStoreOpcode): Use stobj for valuetypes.
15247 (UnaryMutator.EmitCode): Use the right 1 value depending on
15248 whether we are dealing with int64/uint64, float or doubles.
15250 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
15251 constructors that I implemented last night.
15253 (Constructor.IsDefault): Fix to work properly for static
15256 * cs-parser.jay (CheckDef): report method signature errors.
15257 Update error number 103 to be 132.
15259 * decl.cs: New AdditionResult enumeration value: MethodExists.
15260 Although we do this check for methods later on in the semantic
15261 analysis, catching repeated default constructors is so easy that
15262 we catch these here.
15264 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
15267 (ParameterReference.EmitAssign, Emit): handle
15270 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
15271 (ArrayAccess.EmitStoreOpcode): ditto.
15273 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
15275 * expression.cs (MakeByteBlob): Complete all the missing types
15276 (uint, short, ushort, byte, sbyte)
15278 * class.cs: Only init instance field initializers on instance
15281 Rename `constructors' to instance_constructors.
15283 (TypeContainer.AddConstructor): Only add constructors to the list
15284 if it is not static.
15286 Make sure that we handle default_static_constructor independently
15287 everywhere where we handle instance_constructors
15289 2001-12-28 Miguel de Icaza <miguel@ximian.com>
15291 * class.cs: Do not lookup or create a base initializer for a
15292 static constructor.
15294 (ConstructorInitializer.Resolve): use the proper type to lookup
15297 * cs-parser.jay: Report error 1585 (modifiers between type and name).
15299 * enum.cs, interface.cs: Remove CloseType, this is taken care by
15302 * decl.cs: CloseType is now an virtual method, the default
15303 implementation just closes this type.
15305 2001-12-28 Ravi Pratap <ravi@ximian.com>
15307 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
15308 to PreserveSig by default. Also emit HideBySig on such methods.
15310 Basically, set the defaults to standard values.
15312 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
15313 argument, if candidate is better, it can't be worse than the best !
15315 (Invocation): Re-write bits to differentiate between methods being
15316 applicable in their expanded form and their normal form - for params
15319 Get rid of use_standard everywhere as only standard conversions are allowed
15320 in overload resolution.
15322 More spec conformance.
15324 2001-12-27 Miguel de Icaza <miguel@ximian.com>
15326 * driver.cs: Add --timestamp, to see where the compiler spends
15329 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
15330 `this' in static code.
15332 (SimpleName.DoResolve): Implement in terms of a helper function
15333 that allows static-references to be passed upstream to
15336 (Expression.ResolveWithSimpleName): Resolve specially simple
15337 names when called by MemberAccess to implement the special
15340 (Expression.ImplicitReferenceConversion): Handle conversions from
15341 Null to reference types before others, as Null's type is
15344 * expression.cs (Invocation.EmitCall): Handle the special case of
15345 calling methods declared on a reference type from a ValueType
15346 (Base classes System.Object and System.Enum)
15348 (MemberAccess.Resolve): Only perform lookups on Enumerations if
15349 the left hand side is a TypeExpr, not on every enumeration.
15351 (Binary.Resolve): If types are reference types, then do a cast to
15352 object on operators != and == of both arguments.
15354 * typemanager.cs (FindMembers): Extract instance and static
15355 members if requested.
15357 * interface.cs (PopulateProperty): Use void_type instead of null
15358 as the return type for the setter method.
15360 (PopulateIndexer): ditto.
15362 2001-12-27 Ravi Pratap <ravi@ximian.com>
15364 * support.cs (ReflectionParameters): Fix minor bug where we
15365 were examining the wrong parameter for the ParamArray attribute.
15367 Cope with requests for the type of the parameter at position
15368 greater than the params parameter's. We now return the element
15369 type of the params array as that makes more sense.
15371 * expression.cs (Invocation.IsParamsMethodApplicable): Update
15372 accordingly as we no longer have to extract the element type
15375 (Invocation.OverloadResolve): Update.
15377 2001-12-27 Miguel de Icaza <miguel@ximian.com>
15379 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
15380 against IEnumerator, test whether the return value is a descendant
15381 of the IEnumerator interface.
15383 * class.cs (Indexer.Define): Use an auxiliary method to implement
15384 the other bits of the method definition. Begin support for
15385 explicit interface implementation.
15387 (Property.DefineMethod): Use TypeManager.void_type instead of null
15388 for an empty return value.
15390 2001-12-26 Miguel de Icaza <miguel@ximian.com>
15392 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
15393 dealing with a FieldExpr which is composed of a FieldBuilder, in
15394 the code path we did extract the constant, but we should have
15395 obtained the underlying value to be able to cast it (otherwise we
15396 end up in an infinite loop, this is what Ravi was running into).
15398 (ArrayCreation.UpdateIndices): Arrays might be empty.
15400 (MemberAccess.ResolveMemberAccess): Add support for section
15401 14.5.4.1 that deals with the special case of E.I when E is a type
15402 and something else, that I can be a reference to a static member.
15404 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
15405 handle a particular array type to create byte blobs, it is just
15406 something we dont generate byteblobs for.
15408 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
15411 * location.cs (Push): remove the key from the hashtable that we
15412 are about to add. This happens for empty files.
15414 * driver.cs: Dispose files after we have parsed them.
15416 (tokenize): new function that only runs the tokenizer on its
15417 input, for speed testing.
15419 2001-12-26 Ravi Pratap <ravi@ximian.com>
15421 * class.cs (Event.Define): Define the private field only if there
15422 are no accessors defined.
15424 * expression.cs (ResolveMemberAccess): If there is no associated
15425 field with the event, that means we have an event defined with its
15426 own accessors and we should flag error cs0070 since transforming
15427 ourselves into a field is not valid in that case.
15429 * ecore.cs (SimpleName.DoResolve): Same as above.
15431 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
15432 and charset to sane values.
15434 2001-12-25 Ravi Pratap <ravi@ximian.com>
15436 * assign.cs (DoResolve): Perform check on events only if they
15437 are being accessed outside the declaring type.
15439 * cs-parser.jay (event_declarations): Update rules to correctly
15440 set the type of the implicit parameter etc.
15442 (add_accessor, remove_accessor): Set current local parameters.
15444 * expression.cs (Binary): For delegate addition and subtraction,
15445 cast the return value from the method into the appropriate delegate
15448 2001-12-24 Ravi Pratap <ravi@ximian.com>
15450 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
15451 of these as the workaround is unnecessary.
15453 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
15454 delegate data - none of that is needed at all.
15456 Re-write bits to extract the instance expression and the delegate method
15459 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
15462 * attribute.cs (ApplyAttributes): New method to take care of common tasks
15463 of attaching attributes instead of duplicating code everywhere.
15465 * everywhere : Update code to do attribute emission using the above method.
15467 2001-12-23 Miguel de Icaza <miguel@ximian.com>
15469 * expression.cs (IsParamsMethodApplicable): if there are not
15470 parameters, return immediately.
15472 * ecore.cs: The 0 literal can be implicity converted to an enum
15475 (SimpleName.DoResolve): First lookup the type, then lookup the
15478 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
15479 want to get its address. If the InstanceExpression is not
15480 addressable, store the result in a temporary variable, then get
15483 * codegen.cs: Only display 219 errors on warning level or above.
15485 * expression.cs (ArrayAccess): Make it implement the
15486 IMemoryLocation interface.
15488 (Binary.DoResolve): handle the operator == (object a, object b)
15489 and operator != (object a, object b) without incurring into a
15490 BoxedCast (because 5 != o should never be performed).
15492 Handle binary enumerator operators.
15494 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
15495 value type, otherwise use Ldelem_ref.
15497 Use precomputed names;
15499 (AddressOf): Implement address of
15501 * cs-parser.jay (labeled_statement): Fix recursive block
15502 addition by reworking the production.
15504 * expression.cs (New.DoEmit): New has a special case:
15506 If we are dealing with a ValueType, we have a few
15507 situations to deal with:
15509 * The target of New is a ValueType variable, that is
15510 easy, we just pass this as the variable reference
15512 * The target of New is being passed as an argument,
15513 to a boxing operation or a function that takes a
15516 In this case, we need to create a temporary variable
15517 that is the argument of New.
15520 2001-12-23 Ravi Pratap <ravi@ximian.com>
15522 * rootcontext.cs (LookupType): Check that current_type is not null before
15523 going about looking at nested types.
15525 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
15526 not implement the IAssignMethod interface any more.
15528 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
15529 where we tranform them into FieldExprs if they are being resolved from within
15530 the declaring type.
15532 * ecore.cs (SimpleName.DoResolve): Do the same here.
15534 * assign.cs (DoResolve, Emit): Clean up code considerably.
15536 * ../errors/bug10.cs : Add.
15538 * ../errors/cs0070.cs : Add.
15540 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
15542 * assign.cs : Get rid of EventIsLocal everywhere.
15544 2001-12-23 Miguel de Icaza <miguel@ximian.com>
15546 * ecore.cs (ConvertIntLiteral): finished the implementation.
15548 * statement.cs (SwitchLabel): Convert the value we are using as a
15549 key before looking up the table.
15551 2001-12-22 Miguel de Icaza <miguel@ximian.com>
15553 * codegen.cs (EmitTopBlock): Require a Location argument now.
15555 * cs-parser.jay (constructor_declarator): We need to setup
15556 current_local_parameters before we parse the
15557 opt_constructor_initializer, to allow the variables to be bound
15558 to the constructor arguments.
15560 * rootcontext.cs (LookupType): First lookup nested classes in our
15561 class and our parents before we go looking outside our class.
15563 * expression.cs (ConstantFold): Extract/debox the values at the
15566 * rootcontext.cs (EmitCode): Resolve the constants first before we
15567 resolve the types. This is not really needed, but it helps debugging.
15569 * statement.cs: report location.
15571 * cs-parser.jay: pass location to throw statement.
15573 * driver.cs: Small bug fix.
15575 * report.cs: Updated format to be 4-zero filled digits.
15577 2001-12-22 Ravi Pratap <ravi@ximian.com>
15579 * expression.cs (CheckIndices): Fix minor bug where the wrong
15580 variable was being referred to ;-)
15582 (DoEmit): Do not call EmitStaticInitializers when the
15583 underlying type is System.Object.
15585 2001-12-21 Ravi Pratap <ravi@ximian.com>
15587 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
15588 and do the usual workaround for SRE.
15590 * class.cs (MyEventBuilder.EventType): New member to get at the type
15591 of the event, quickly.
15593 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
15595 * assign.cs (Assign.DoResolve): Handle the case when the target
15596 is an EventExpr and perform the necessary checks.
15598 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
15601 (SimpleName.MemberStaticCheck): Include check for EventExpr.
15603 (EventExpr): Set the type in the constructor itself since we
15604 are meant to be born fully resolved.
15606 (EventExpr.Define): Revert code I wrote earlier.
15608 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
15609 instance expression is null. The instance expression is a This in that case
15610 or a null, depending on whether it is a static method or not.
15612 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
15613 refers to more than one method.
15615 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
15616 and accordingly flag errors.
15618 2001-12-21 Miguel de Icaza <miguel@ximian.com>
15620 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
15622 2001-12-22 Miguel de Icaza <miguel@ximian.com>
15624 * location.cs (ToString): Provide useful rutine.
15626 2001-12-21 Miguel de Icaza <miguel@ximian.com>
15628 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
15629 objects, return the actual integral boxed.
15631 * statement.cs (SwitchLabel): define an ILLabel for each
15634 (Switch.CheckSwitch): If the value is a Literal, extract
15635 the underlying literal.
15637 Also in the unused hashtable we had, add the SwitchLabel so we can
15638 quickly look this value up.
15640 * constant.cs: Implement a bunch of new constants. Rewrite
15641 Literal based on this. Made changes everywhere to adapt to this.
15643 * expression.cs (Expression.MakeByteBlob): Optimize routine by
15644 dereferencing array only once, and also copes with enumrations.
15646 bytes are two bytes wide, not one.
15648 (Cast): Perform constant conversions.
15650 * ecore.cs (TryImplicitIntConversion): Return literals instead of
15651 wrappers to the literals here.
15653 * expression.cs (DoNumericPromotions): long literals can converted
15654 to ulong implicity (this is taken care of elsewhere, but I was
15655 missing this spot).
15657 * ecore.cs (Expression.Literalize): Make the return type Literal,
15658 to improve type checking.
15660 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
15662 2001-12-20 Miguel de Icaza <miguel@ximian.com>
15664 * literal.cs: Revert code from ravi that checked the bounds. The
15665 bounds are sane by the definition of the type itself.
15667 * typemanager.cs: Fix implementation of ImplementsInterface. We
15668 need to actually look up in our parent hierarchy for interfaces
15671 * const.cs: Use the underlying type for enumerations
15673 * delegate.cs: Compute the basename for the delegate creation,
15674 that should fix the delegate test case, and restore the correct
15675 Type Lookup semantics in rootcontext
15677 * rootcontext.cs: Revert Ravi's last patch. The correct way of
15678 referencing a nested type with the Reflection API is using the "+"
15681 * cs-parser.jay: Do not require EOF token at the end.
15683 2001-12-20 Ravi Pratap <ravi@ximian.com>
15685 * rootcontext.cs (LookupType): Concatenate type names with
15686 a '.' instead of a '+' The test suite passes again.
15688 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
15689 field of the enumeration.
15691 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
15692 the case when the member is an EventExpr.
15694 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
15695 static has an associated instance expression.
15697 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
15699 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
15701 * class.cs (Event.Define): Register event and perform appropriate checks
15704 We define the Add and Remove methods even if the use provides none because
15705 in that case, we provide default implementations ourselves.
15707 Define a private field of the type of the event. This is done by the CSC compiler
15708 and we should be doing it too ;-)
15710 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
15711 More methods we use in code we generate.
15713 (multicast_delegate_type, delegate_type): Two separate types since the distinction
15716 (InitCoreTypes): Update accordingly for the above.
15718 * class.cs (Event.Emit): Generate code for default accessors that we provide
15720 (EmitDefaultMethod): Do the job in the above.
15722 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
15725 2001-12-20 Miguel de Icaza <miguel@ximian.com>
15727 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
15728 builders even if we were missing one.
15730 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
15731 pass the Basename as our class name instead of the Name. The
15732 basename will be correctly composed for us.
15734 * parameter.cs (Paramters): Now takes a Location argument.
15736 * decl.cs (DeclSpace.LookupType): Removed convenience function and
15737 make all the code call directly LookupType in RootContext and take
15738 this chance to pass the Location information everywhere.
15740 * Everywhere: pass Location information.
15742 2001-12-19 Miguel de Icaza <miguel@ximian.com>
15744 * class.cs (Constructor.Define): Updated way of detecting the
15745 length of the parameters.
15747 (TypeContainer.DefineType): Use basename as the type name for
15750 (TypeContainer.Define): Do not recursively define types here, as
15751 definition is taken care in order by the RootContext.
15753 * tree.cs: Keep track of namespaces in a per-file basis.
15755 * parameter.cs (Parameter.ComputeSignature): Update to use
15758 (Parameters.GetSignature): ditto.
15760 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
15761 instead of a TypeContainer.
15763 (Interface.SemanticAnalysis): Use `this' instead of our parent to
15764 resolve names. Because we need to be resolve in our context, not
15767 * driver.cs: Implement response files.
15769 * class.cs (TypeContainer.DefineType): If we are defined, do not
15770 redefine ourselves.
15772 (Event.Emit): Emit the code for add/remove handlers.
15773 (Event.Define): Save the MethodBuilders for add/remove.
15775 * typemanager.cs: Use pair here too.
15777 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
15778 DictionaryEntry requires the first argument to be non-null.
15780 (enum_declaration): Compute full name for registering the
15783 (delegate_declaration): Instead of using
15784 formal_parameter_list, use opt_formal_parameter_list as the list
15787 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
15788 (EventParsing): New property that controls whether `add' and
15789 `remove' are returned as tokens or identifiers (for events);
15791 2001-12-19 Ravi Pratap <ravi@ximian.com>
15793 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
15794 use MyEventBuilder only and let it wrap the real builder for us.
15796 (MyEventBuilder): Revamp constructor etc.
15798 Implement all operations that we perform on EventBuilder in precisely the same
15801 (FindMembers): Update to use the EventBuilder member.
15803 (Event.Emit): Update accordingly.
15805 2001-12-18 Ravi Pratap <ravi@ximian.com>
15807 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
15808 by calling the appropriate methods.
15810 (GetCustomAttributes): Make stubs as they cannot possibly do anything
15813 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
15815 2001-12-17 Ravi Pratap <ravi@ximian.com>
15817 * delegate.cs (Delegate.Populate): Check that the return type
15818 and various parameters types are indeed accessible.
15820 * class.cs (Constructor.Define): Same here.
15822 (Field.Define): Ditto.
15824 (Event.Define): Ditto.
15826 (Operator.Define): Check that the underlying Method defined itself
15827 correctly - so it's MethodBuilder should not be null.
15829 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
15830 expression happens to be null.
15832 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
15833 members but as of now we don't seem to be able to do anything really useful with it.
15835 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
15836 not the EventBuilder.
15838 2001-12-18 Miguel de Icaza <miguel@ximian.com>
15840 * cs-tokenizer.cs: Add support for defines.
15841 Add support for #if, #elif, #else, #endif
15843 (eval_var): evaluates a variable.
15844 (eval): stubbed for evaluating functions.
15846 * cs-parser.jay: Pass the defines information
15848 * driver.cs: Add --define command line option.
15850 * decl.cs: Move MemberCore here.
15852 Make it the base class for DeclSpace. This allows us to catch and
15853 report 108 and 109 for everything now.
15855 * class.cs (TypeContainer.Define): Extract all the members
15856 before populating and emit the warning 108 (new keyword required
15857 to override) instead of having each member implement this.
15859 (MemberCore.Define): New abstract method, we will be using this in
15860 the warning reporting engine in Populate.
15862 (Operator.Define): Adjust to new MemberCore protocol.
15864 * const.cs (Const): This does not derive from Expression, it is a
15865 temporary object we use to create fields, it is a MemberCore.
15867 * class.cs (Method.Define): Allow the entry point to be in a
15870 * driver.cs: Rewrite the argument handler to clean it up a bit.
15872 * rootcontext.cs: Made it just an auxiliary namespace feature by
15873 making everything static.
15875 * driver.cs: Adapt code to use RootContext type name instead of
15878 * delegate.cs: Remove RootContext argument.
15880 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
15883 * class.cs (Event.Define): The lookup can fail.
15885 * cs-tokenizer.cs: Begin implementation of pre-procesor.
15887 * expression.cs: Resolve the this instance before invoking the code.
15889 2001-12-17 Miguel de Icaza <miguel@ximian.com>
15891 * cs-parser.jay: Add a production in element_access that allows
15892 the thing to become a "type" reference. This way we can parse
15893 things like "(string [])" as a type.
15895 Note that this still does not handle the more complex rules of
15899 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
15901 * ecore.cs: (CopyNewMethods): new utility function used to
15902 assemble the list of methods from running FindMembers.
15904 (MemberLookup): Rework FindMembers so that
15906 2001-12-16 Miguel de Icaza <miguel@ximian.com>
15908 * class.cs (TypeContainer): Remove Delegates who fail to be
15911 * delegate.cs (Populate): Verify that we dont get null return
15912 values. TODO: Check for AsAccessible.
15914 * cs-parser.jay: Use basename to emit error 574 (destructor should
15915 have the same name as container class), not the full name.
15917 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
15918 possible representation.
15920 Also implements integer type suffixes U and L.
15922 2001-12-15 Miguel de Icaza <miguel@ximian.com>
15924 * expression.cs (ArrayCreation.DoResolve): We need to do the
15925 argument resolution *always*.
15927 * decl.cs: Make this hold the namespace. Hold the root context as
15929 (LookupType): Move here.
15931 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
15933 * location.cs (Row, Name): Fixed the code, it was always returning
15934 references to the first file.
15936 * interface.cs: Register properties defined through interfaces.
15938 * driver.cs: Add support for globbing on the command line
15940 * class.cs (Field): Make it derive from MemberCore as well.
15943 2001-12-15 Ravi Pratap <ravi@ximian.com>
15945 * class.cs (Event::Define): Check that the type of the event is a delegate
15946 type else flag error #66.
15948 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
15951 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
15952 values of EntryPoint, CharSet etc etc.
15954 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
15956 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
15957 be null and we should ignore this. I am not sure if this is really clean. Apparently,
15958 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
15959 which needs this to do its work.
15961 * ../errors/cs0066.cs : Add.
15963 2001-12-14 Miguel de Icaza <miguel@ximian.com>
15965 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
15968 * class.cs: (MethodSignature.MethodSignature): Removed hack that
15969 clears out the parameters field.
15970 (MemberSignatureCompare): Cleanup
15972 (MemberCore): New base class used to share code between MethodCore
15975 (RegisterRequiredImplementations) BindingFlags.Public requires
15976 either BindingFlags.Instace or Static. Use instance here.
15978 (Property): Refactored code to cope better with the full spec.
15980 * parameter.cs (GetParameterInfo): Return an empty array instead
15983 * class.cs (Property): Abstract or extern properties have no bodies.
15985 * parameter.cs (GetParameterInfo): return a zero-sized array.
15987 * class.cs (TypeContainer.MethodModifiersValid): Move all the
15988 method modifier validation to the typecontainer so we can reuse
15989 this on properties.
15991 (MethodCore.ParameterTypes): return an empty sized array of types.
15993 (Property.Define): Test property modifier validity.
15995 Add tests for sealed/override too.
15997 (Method.Emit): abstract or extern methods have no bodies.
15999 2001-12-14 Ravi Pratap <ravi@ximian.com>
16001 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
16004 (Method::Define, ::Emit): Modify accordingly.
16006 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
16008 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
16010 * makefile: Pass in /unsafe.
16012 2001-12-13 Miguel de Icaza <miguel@ximian.com>
16014 * class.cs (MakeKey): Kill routine.
16016 * class.cs (TypeContainer.Define): Correctly define explicit
16017 method implementations (they require the full interface name plus
16020 * typemanager.cs: Deply the PtrHashtable here and stop using the
16021 lame keys. Things work so much better.
16023 This of course broke everyone who depended on `RegisterMethod' to
16024 do the `test for existance' test. This has to be done elsewhere.
16026 * support.cs (PtrHashtable): A hashtable that avoid comparing with
16027 the object stupid Equals method (because, that like fails all over
16028 the place). We still do not use it.
16030 * class.cs (TypeContainer.SetRequiredInterface,
16031 TypeContainer.RequireMethods): Killed these two routines and moved
16032 all the functionality to RegisterRequiredImplementations.
16034 (TypeContainer.RegisterRequiredImplementations): This routine now
16035 registers all the implementations required in an array for the
16036 interfaces and abstract methods. We use an array of structures
16037 which can be computed ahead of time to reduce memory usage and we
16038 also assume that lookups are cheap as most classes will not
16039 implement too many interfaces.
16041 We also avoid creating too many MethodSignatures.
16043 (TypeContainer.IsInterfaceMethod): Update and optionally does not
16044 clear the "pending" bit if we find that there are problems with
16047 (TypeContainer.VerifyPendingMethods): Update to report errors of
16048 methods that look like implementations but are not.
16050 (TypeContainer.Define): Add support for explicit interface method
16053 2001-12-12 Miguel de Icaza <miguel@ximian.com>
16055 * typemanager.cs: Keep track of the parameters here instead of
16056 being a feature of the TypeContainer.
16058 * class.cs: Drop the registration of parameters here, as
16059 InterfaceMethods are also interface declarations.
16061 * delegate.cs: Register methods with the TypeManager not only with
16062 the TypeContainer. This code was buggy.
16064 * interface.cs: Full registation here.
16066 2001-12-11 Miguel de Icaza <miguel@ximian.com>
16068 * expression.cs: Remove reducer for binary expressions, it can not
16071 * const.cs: Put here the code that used to go into constant.cs
16073 * constant.cs: Put here the code for constants, this is a new base
16074 class for Literals.
16076 * literal.cs: Make Literal derive from Constant.
16078 2001-12-09 Miguel de Icaza <miguel@ximian.com>
16080 * statement.cs (Return.Emit): Report error 157 if the user
16081 attempts to return from a finally block.
16083 (Return.Emit): Instead of emitting a return, jump to the end of
16086 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
16087 LocalBuilder to store the result of the function. ReturnLabel is
16088 the target where we jump.
16091 2001-12-09 Radek Doulik <rodo@ximian.com>
16093 * cs-parser.jay: remember alias in current namespace
16095 * ecore.cs (SimpleName::DoResolve): use aliases for types or
16098 * class.cs (LookupAlias): lookup alias in my_namespace
16100 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
16102 (LookupAlias): lookup alias in this and if needed in parent
16105 2001-12-08 Miguel de Icaza <miguel@ximian.com>
16109 * rootcontext.cs: (ModuleBuilder) Made static, first step into
16110 making things static. I need this to avoid passing the
16111 TypeContainer when calling ParameterType.
16113 * support.cs (InternalParameters.ParameterType): Remove ugly hack
16114 that did string manipulation to compute the type and then call
16115 GetType. Use Parameter.ParameterType instead.
16117 * cs-tokenizer.cs: Consume the suffix for floating values.
16119 * expression.cs (ParameterReference): figure out whether this is a
16120 reference parameter or not. Kill an extra variable by computing
16121 the arg_idx during emission.
16123 * parameter.cs (Parameters.GetParameterInfo): New overloaded
16124 function that returns whether a parameter is an out/ref value or not.
16126 (Parameter.ParameterType): The type of the parameter (base,
16127 without ref/out applied).
16129 (Parameter.Resolve): Perform resolution here.
16130 (Parameter.ExternalType): The full type (with ref/out applied).
16132 * statement.cs (Using.Emit, Using.EmitExpression): Implement
16133 support for expressions on the using statement.
16135 2001-12-07 Miguel de Icaza <miguel@ximian.com>
16137 * statement.cs (Using.EmitLocalVariableDecls): Split the
16138 localvariable handling of the using statement.
16140 (Block.EmitMeta): Keep track of variable count across blocks. We
16141 were reusing slots on separate branches of blocks.
16143 (Try.Emit): Emit the general code block, we were not emitting it.
16145 Check the type of the declaration to be an IDisposable or
16146 something that can be implicity converted to it.
16148 Emit conversions if required.
16150 * ecore.cs (EmptyExpression): New utility class.
16151 (Expression.ImplicitConversionExists): New utility function.
16153 2001-12-06 Miguel de Icaza <miguel@ximian.com>
16155 * statement.cs (Using): Implement.
16157 * expression.cs (LocalVariableReference): Support read only variables.
16159 * statement.cs: Remove the explicit emit for the Leave opcode.
16160 (VariableInfo): Add a readonly field.
16162 2001-12-05 Miguel de Icaza <miguel@ximian.com>
16164 * ecore.cs (ConvCast): new class used to encapsulate the various
16165 explicit integer conversions that works in both checked and
16166 unchecked contexts.
16168 (Expression.ConvertNumericExplicit): Use new ConvCast class to
16169 properly generate the overflow opcodes.
16171 2001-12-04 Miguel de Icaza <miguel@ximian.com>
16173 * statement.cs: The correct type for the EmptyExpression is the
16174 element_type, not the variable type. Ravi pointed this out.
16176 2001-12-04 Ravi Pratap <ravi@ximian.com>
16178 * class.cs (Method::Define): Handle PInvoke methods specially
16179 by using DefinePInvokeMethod instead of the usual one.
16181 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
16182 above to do the task of extracting information and defining the method.
16184 2001-12-04 Ravi Pratap <ravi@ximian.com>
16186 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
16187 of the condition for string type.
16189 (Emit): Move that here.
16191 (ArrayCreation::CheckIndices): Keep string literals in their expression
16194 (EmitDynamicInitializers): Handle strings appropriately.
16196 2001-12-04 Miguel de Icaza <miguel@ximian.com>
16198 * codegen.cs (EmitContext): Replace multiple variables with a
16199 single pointer to the current Switch statement.
16201 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
16204 2001-12-03 Miguel de Icaza <miguel@ximian.com>
16208 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
16211 (Foreach.Emit): Foreach on arrays was not setting
16212 up the loop variables (for break/continue).
16214 (GotoCase): Semi-implented.
16216 2001-12-03 Ravi Pratap <ravi@ximian.com>
16218 * attribute.cs (CheckAttribute): Handle system attributes by using
16219 Attribute.GetAttributes to examine information we need.
16221 (GetValidPlaces): Same here.
16223 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
16225 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
16227 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
16229 (Method::Define): Set appropriate flags if we have a DllImport attribute.
16231 (Method::Emit): Handle the case when we are a PInvoke method.
16233 2001-12-03 Miguel de Icaza <miguel@ximian.com>
16235 * expression.cs: Use ResolveWithSimpleName on compound names.
16237 2001-12-02 Ravi Pratap <ravi@ximian.com>
16239 * constant.cs (EmitConstant): Make sure we resolve the associated expression
16240 before trying to reduce it.
16242 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
16244 * constant.cs (LookupConstantValue): Implement.
16246 (EmitConstant): Use the above in emitting the constant.
16248 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
16249 that are user-defined by doing a LookupConstantValue on them.
16251 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
16254 2001-11-29 Miguel de Icaza <miguel@ximian.com>
16256 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
16258 (BaseAccess.DoResolve): Implement.
16260 (MemberAccess.DoResolve): Split this routine into a
16261 ResolveMemberAccess routine that can be used independently
16263 2001-11-28 Miguel de Icaza <miguel@ximian.com>
16265 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
16266 As that share bits of the implementation. Is returns a boolean,
16267 while As returns the Type that is being probed.
16269 2001-12-01 Ravi Pratap <ravi@ximian.com>
16271 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
16272 instead of a Literal - much easier.
16274 (EnumInTransit): Remove - utterly useless :-)
16276 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
16278 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
16280 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
16281 chain when we have no associated expression.
16283 2001-11-30 Ravi Pratap <ravi@ximian.com>
16285 * constant.cs (Define): Use Location while reporting the errror.
16287 Also emit a warning when 'new' is used and there is no inherited
16290 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
16293 (LookupEnumValue): Implement to lookup an enum member's value and define it
16296 (Populate): Re-write accordingly to use the above routine.
16298 2001-11-27 Miguel de Icaza <miguel@ximian.com>
16300 * expression.cs (This): Fix prototype for DoResolveLValue to
16301 override the base class DoResolveLValue.
16303 * cs-parser.cs: Report errors cs574 and cs575 (destructor
16306 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
16307 (we need to load the address of the field here). This fixes
16310 (FieldExpr.DoResolveLValue): Call the DoResolve
16311 function to initialize the Instance expression.
16313 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
16314 correctly the GetEnumerator operation on a value type.
16316 * cs-parser.jay: Add more simple parsing error catches.
16318 * statement.cs (Switch): Add support for string switches.
16319 Handle null specially.
16321 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
16323 2001-11-28 Ravi Pratap <ravi@ximian.com>
16325 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
16327 (declare_local_constant): New helper function.
16329 * statement.cs (AddConstant): Keep a separate record of constants
16331 (IsConstant): Implement to determine if a variable is a constant.
16333 (GetConstantExpression): Implement.
16335 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
16337 * statement.cs (IsVariableDefined): Re-write.
16339 2001-11-27 Ravi Pratap <ravi@ximian.com>
16341 * class.cs (TypeContainer::FindMembers): Look for constants
16342 in the case when we are looking for MemberTypes.Field
16344 * expression.cs (MemberAccess::DoResolve): Check that in the
16345 case we are a FieldExpr and a Literal, we are not being accessed
16346 by an instance reference.
16348 * cs-parser.jay (local_constant_declaration): Implement.
16350 (declaration_statement): Implement for constant declarations.
16352 2001-11-26 Miguel de Icaza <miguel@ximian.com>
16354 * statement.cs (Switch): Catch double defaults.
16356 (Switch): More work on the switch() statement
16357 implementation. It works for integral values now, need to finish
16361 2001-11-24 Miguel de Icaza <miguel@ximian.com>
16363 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
16364 integer literals into other integer literals. To be used by
16367 2001-11-24 Ravi Pratap <ravi@ximian.com>
16369 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
16372 (EmitDynamicInitializers): Cope with the above since we extract data
16373 directly from ArrayData now.
16375 (ExpectInitializers): Keep track of whether initializers are mandatory
16378 (Bounds): Make it a hashtable to prevent the same dimension being
16379 recorded for every element in that dimension.
16381 (EmitDynamicInitializers): Fix bug which prevented the Set array method
16384 Also fix bug which was causing the indices to be emitted in the reverse
16387 2001-11-24 Miguel de Icaza <miguel@ximian.com>
16389 * expression.cs (ArrayCreation): Implement the bits that Ravi left
16390 unfinished. They do not work, because the underlying code is
16393 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16395 * cs-parser.jay: Remove bogus fixme.
16397 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
16398 on Switch statement.
16400 2001-11-23 Ravi Pratap <ravi@ximian.com>
16402 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
16405 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
16406 parameter. Apparently, any expression is allowed.
16408 (ValidateInitializers): Update accordingly.
16410 (CheckIndices): Fix some tricky bugs thanks to recursion.
16412 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
16413 I was being completely brain-dead.
16415 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
16416 and re-write acordingly.
16418 (DelegateInvocation): Re-write accordingly.
16420 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
16422 (MakeByteBlob): Handle types more correctly.
16424 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
16425 initialization from expressions but it is incomplete because I am a complete
16428 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16430 * statement.cs (If.Emit): Fix a bug that generated incorrect code
16431 on If. Basically, we have to return `true' (ie, we do return to
16432 our caller) only if both branches of the if return.
16434 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
16435 short-circuit operators, handle them as short circuit operators.
16437 (Cast.DoResolve): Resolve type.
16438 (Cast.Cast): Take an expression as the target type.
16440 * cs-parser.jay (cast_expression): Remove old hack that only
16441 allowed a limited set of types to be handled. Now we take a
16442 unary_expression and we resolve to a type during semantic
16445 Use the grammar productions from Rhys to handle casts (this is
16446 not complete like Rhys syntax yet, we fail to handle that corner
16447 case that C# has regarding (-x), but we will get there.
16449 2001-11-22 Ravi Pratap <ravi@ximian.com>
16451 * class.cs (EmitFieldInitializer): Take care of the case when we have a
16452 field which is an array type.
16454 * cs-parser.jay (declare_local_variables): Support array initialization too.
16456 * typemanager.cs (MakeKey): Implement.
16458 (everywhere): Use the above appropriately.
16460 * cs-parser.jay (for_statement): Update for array initialization while
16461 declaring variables.
16463 * ecore.cs : The error message was correct, it's the variable's names that
16464 were misleading ;-) Make the code more readable.
16466 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
16467 the correct type etc.
16469 (ConvertExplicit): Handle Enum types by examining the underlying type.
16471 2001-11-21 Ravi Pratap <ravi@ximian.com>
16473 * parameter.cs (GetCallingConvention): Always return
16474 CallingConventions.Standard for now.
16476 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16478 * expression.cs (Binary.ResolveOperator): Update the values of `l'
16479 and `r' after calling DoNumericPromotions.
16481 * ecore.cs: Fix error message (the types were in the wrong order).
16483 * statement.cs (Foreach.ProbeCollectionType): Need to pass
16484 BindingFlags.Instance as well
16486 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
16487 implicit int literal conversion in an empty cast so that we
16488 propagate the right type upstream.
16490 (UnboxCast): new class used to unbox value types.
16491 (Expression.ConvertExplicit): Add explicit type conversions done
16494 (Expression.ImplicitNumericConversion): Oops, forgot to test for
16495 the target type before applying the implicit LongLiterals to ULong
16498 2001-11-21 Miguel de Icaza <miguel@ximian.com>
16500 * cs-parser.jay (for_statement): Reworked the way For works: now
16501 we declare manually any variables that are introduced in
16502 for_initializer to solve the problem of having out-of-band code
16503 emition (that is what got for broken).
16505 (declaration_statement): Perform the actual variable declaration
16506 that used to be done in local_variable_declaration here.
16508 (local_variable_declaration): Do not declare anything, just pass
16509 the information on a DictionaryEntry
16511 2001-11-20 Ravi Pratap <ravi@ximian.com>
16513 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
16514 re-write of the logic to now make it recursive.
16516 (UpdateIndices): Re-write accordingly.
16518 Store element data in a separate ArrayData list in the above methods.
16520 (MakeByteBlob): Implement to dump the array data into a byte array.
16522 2001-11-19 Ravi Pratap <ravi@ximian.com>
16524 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
16527 * constant.cs (Define): Implement.
16529 (EmitConstant): Re-write fully.
16531 Pass in location info.
16533 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
16536 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
16537 DictionaryEntry since we need location info too.
16539 (constant_declaration): Update accordingly.
16541 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
16542 code into another method : UpdateIndices.
16544 2001-11-18 Ravi Pratap <ravi@ximian.com>
16546 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
16547 some type checking etc.
16549 2001-11-17 Ravi Pratap <ravi@ximian.com>
16551 * expression.cs (ArrayCreation::ValidateInitializers): Implement
16552 bits to provide dimension info if the user skips doing that.
16554 Update second constructor to store the rank correctly.
16556 2001-11-16 Ravi Pratap <ravi@ximian.com>
16558 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
16559 and try to implement.
16561 * ../errors/cs0150.cs : Add.
16563 * ../errors/cs0178.cs : Add.
16565 2001-11-16 Miguel de Icaza <miguel@ximian.com>
16567 * statement.cs: Implement foreach on multi-dimensional arrays.
16569 * parameter.cs (Parameters.GetParameterByName): Also lookup the
16570 name of the params argument.
16572 * expression.cs: Use EmitStoreOpcode to get the right opcode while
16573 initializing the array.
16575 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
16576 we can use this elsewhere.
16578 * statement.cs: Finish implementation of foreach for single
16581 * cs-parser.jay: Use an out-of-band stack to pass information
16582 around, I wonder why I need this.
16584 foreach_block: Make the new foreach_block the current_block.
16586 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
16587 function used to return a static Parameters structure. Used for
16588 empty parameters, as those are created very frequently.
16590 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
16592 2001-11-15 Ravi Pratap <ravi@ximian.com>
16594 * interface.cs : Default modifier is private, not public. The
16595 make verify test passes again.
16597 2001-11-15 Ravi Pratap <ravi@ximian.com>
16599 * support.cs (ReflectionParameters): Fix logic to determine
16600 whether the last parameter is a params one. Test 9 passes again.
16602 * delegate.cs (Populate): Register the builders we define with
16603 RegisterParameterForBuilder. Test 19 passes again.
16605 * cs-parser.jay (property_declaration): Reference $6 instead
16606 of $$ to get at the location.
16608 (indexer_declaration): Similar stuff.
16610 (attribute): Ditto.
16612 * class.cs (Property): Register parameters for the Get and Set methods
16613 if they exist. Test 23 passes again.
16615 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
16616 call to EmitArguments as we are sure there aren't any params arguments.
16617 Test 32 passes again.
16619 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
16620 IndexOutOfRangeException.
16622 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
16623 Test 33 now passes again.
16625 2001-11-15 Miguel de Icaza <miguel@ximian.com>
16627 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
16628 broke a bunch of things. Will have to come up with a better way
16629 of tracking locations.
16631 * statement.cs: Implemented foreach for single dimension arrays.
16633 2001-11-09 Miguel de Icaza <miguel@ximian.com>
16635 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
16636 an error. This removes the lookup from the critical path.
16638 * cs-parser.jay: Removed use of temporary_loc, which is completely
16641 2001-11-14 Miguel de Icaza <miguel@ximian.com>
16643 * support.cs (ReflectionParameters.ParameterModifier): Report
16644 whether the argument is a PARAMS argument or not.
16646 * class.cs: Set the attribute `ParamArrayAttribute' on the
16647 parameter argument.
16649 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
16650 and cons_param_array_attribute (ConstructorInfo for
16651 ParamArrayAttribute).,
16653 * codegen.cs: Emit the return using the `Return' statement, that
16654 way we can report the error correctly for missing return values.
16656 * class.cs (Method.Emit): Clean up.
16658 * expression.cs (Argument.Resolve): Take another argument: the
16659 location where this argument is used. Notice that this is not
16660 part of the "Argument" class as to reduce the size of the
16661 structure (we know the approximate location anyways).
16663 Test if the argument is a variable-reference, if not, then
16664 complain with a 206.
16666 (Argument.Emit): Emit addresses of variables.
16668 (Argument.FullDesc): Simplify.
16670 (Invocation.DoResolve): Update for Argument.Resolve.
16672 (ElementAccess.DoResolve): ditto.
16674 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
16675 method should be virtual, as this method is always virtual.
16677 (NewDelegate.DoResolve): Update for Argument.Resolve.
16679 * class.cs (ConstructorInitializer.DoResolve): ditto.
16681 * attribute.cs (Attribute.Resolve): ditto.
16683 2001-11-13 Miguel de Icaza <miguel@ximian.com>
16685 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
16687 * expression.cs (ParameterReference): Drop IStackStorage and implement
16688 IAssignMethod instead.
16690 (LocalVariableReference): ditto.
16692 * ecore.cs (FieldExpr): Drop IStackStorage and implement
16693 IAssignMethod instead.
16695 2001-11-13 Miguel de Icaza <miguel@ximian.com>
16697 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
16698 enumerations that are used in heavily used structures derive from
16699 byte in a laughable and pathetic attempt to reduce memory usage.
16700 This is the kind of pre-optimzations that you should not do at
16701 home without adult supervision.
16703 * expression.cs (UnaryMutator): New class, used to handle ++ and
16704 -- separatedly from the other unary operators. Cleans up the
16705 code, and kills the ExpressionStatement dependency in Unary.
16707 (Unary): Removed `method' and `Arguments' from this class, making
16708 it smaller, and moving it all to SimpleCall, so I can reuse this
16709 code in other locations and avoid creating a lot of transient data
16710 strucutres when not required.
16712 * cs-parser.jay: Adjust for new changes.
16714 2001-11-11 Miguel de Icaza <miguel@ximian.com>
16716 * enum.cs (Enum.Populate): If there is a failure during
16719 * cs-parser.jay (opt_enum_base): we used to catch type errors
16720 here, but this is really incorrect. The type error should be
16721 catched during semantic analysis.
16723 2001-12-11 Ravi Pratap <ravi@ximian.com>
16725 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
16726 current_local_parameters as expected since I, in my stupidity, had forgotten
16729 * attribute.cs (GetValidPlaces): Fix stupid bug.
16731 * class.cs (Method::Emit): Perform check on applicability of attributes.
16733 (Constructor::Emit): Ditto.
16735 (Field::Emit): Ditto.
16737 (Field.Location): Store location information.
16739 (Property, Event, Indexer, Operator): Ditto.
16741 * cs-parser.jay (field_declaration): Pass in location for each field.
16743 * ../errors/cs0592.cs : Add.
16745 2001-11-12 Ravi Pratap <ravi@ximian.com>
16747 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
16749 (InitCoreTypes): Update accordingly.
16751 (RegisterAttrType, LookupAttr): Implement.
16753 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
16754 info about the same.
16756 (Resolve): Update to populate the above as necessary.
16758 (Error592): Helper.
16760 (GetValidPlaces): Helper to the above.
16762 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
16764 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
16766 2001-11-12 Ravi Pratap <ravi@ximian.com>
16768 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
16770 * ../errors/cs0617.cs : Add.
16772 2001-11-11 Ravi Pratap <ravi@ximian.com>
16774 * enum.cs (Emit): Rename to Populate to be more consistent with what
16775 we expect it to do and when exactly it is called.
16777 * class.cs, rootcontext.cs : Update accordingly.
16779 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
16780 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
16782 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
16784 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
16785 of a fieldinfo using the above, when dealing with a FieldBuilder.
16787 2001-11-10 Ravi Pratap <ravi@ximian.com>
16789 * ../errors/cs0031.cs : Add.
16791 * ../errors/cs1008.cs : Add.
16793 * ../errrors/cs0543.cs : Add.
16795 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
16798 (FindMembers): Implement.
16800 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
16801 enums and delegates too.
16803 (enum_types): Rename to builder_to_enum.
16805 (delegate_types): Rename to builder_to_delegate.
16807 * delegate.cs (FindMembers): Implement.
16809 2001-11-09 Ravi Pratap <ravi@ximian.com>
16811 * typemanager.cs (IsEnumType): Implement.
16813 * enum.cs (Emit): Re-write parts to account for the underlying type
16814 better and perform checking etc.
16816 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
16817 of the underlying type.
16819 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
16822 * enum.cs (error31): Helper to report error #31.
16824 * cs-parser.jay (enum_declaration): Store location of each member too.
16826 * enum.cs (member_to_location): New hashtable.
16828 (AddEnumMember): Update location hashtable.
16830 (Emit): Use the location of each member while reporting errors.
16832 2001-11-09 Miguel de Icaza <miguel@ximian.com>
16834 * cs-parser.jay: A for_initializer if is a
16835 local_variable_declaration really ammount to have an implicit
16836 block with the variable declaration and no initializer for for.
16838 * statement.cs (For.Emit): Cope with null initializers.
16840 This fixes the infinite loop on for initializers.
16842 2001-11-08 Miguel de Icaza <miguel@ximian.com>
16844 * enum.cs: More cleanup.
16846 * ecore.cs: Remove dead code.
16848 * class.cs (Property.Emit): More simplification.
16849 (Event.Emit): ditto.
16851 Reworked to have less levels of indentation.
16853 2001-11-08 Ravi Pratap <ravi@ximian.com>
16855 * class.cs (Property): Emit attributes.
16865 * enum.cs (Emit): Ditto.
16867 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
16870 * class.cs (Field, Event, etc.): Move attribute generation into the
16871 Emit method everywhere.
16873 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
16874 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
16875 as we had no way of defining nested enums !
16877 * rootcontext.cs : Adjust code accordingly.
16879 * typemanager.cs (AddEnumType): To keep track of enum types separately.
16881 2001-11-07 Ravi Pratap <ravi@ximian.com>
16883 * expression.cs (EvalConstantExpression): Move into ecore.cs
16885 * enum.cs (Enum): Rename some members and make them public and readonly
16886 according to our convention.
16888 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
16891 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
16893 (Enum::Emit): Write a simple version for now which doesn't try to compute
16894 expressions. I shall modify this to be more robust in just a while.
16896 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
16898 (TypeContainer::CloseType): Create the Enum types too.
16900 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
16902 * expression.cs (EvalConstantExpression): Get rid of completely.
16904 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
16905 user-defined values and other cases.
16907 (IsValidEnumLiteral): Helper function.
16909 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
16910 out there in the case we had a literal FieldExpr.
16912 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
16914 (Literalize): Revamp a bit to take two arguments.
16916 (EnumLiteral): New class which derives from Literal to wrap enum literals.
16918 2001-11-06 Ravi Pratap <ravi@ximian.com>
16920 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
16922 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
16924 (Resolve): Use the above to ensure we have proper initializers.
16926 2001-11-05 Ravi Pratap <ravi@ximian.com>
16928 * expression.cs (Expression::EvalConstantExpression): New method to
16929 evaluate constant expressions.
16931 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
16933 2001-11-07 Miguel de Icaza <miguel@ximian.com>
16935 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
16938 (Binary.ResolveOperator): Handle operator != (object a, object b)
16939 and operator == (object a, object b);
16941 (Binary.DoNumericPromotions): Indicate whether the numeric
16942 promotion was possible.
16944 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
16947 Made the ArrayAccess implement interface IAssignMethod instead of
16948 IStackStore as the order in which arguments are passed reflects
16951 * assign.cs: Instead of using expr.ExprClass to select the way of
16952 assinging, probe for the IStackStore/IAssignMethod interfaces.
16954 * typemanager.cs: Load InitializeArray definition.
16956 * rootcontext.cs (RootContext.MakeStaticData): Used to define
16957 static data that can be used to initialize arrays.
16959 2001-11-05 Miguel de Icaza <miguel@ximian.com>
16961 * expression.cs: Handle operator== and operator!= for booleans.
16963 (Conditioal.Reduce): Implement reducer for the ?: operator.
16965 (Conditional.Resolve): Implement dead code elimination.
16967 (Binary.Resolve): Catch string literals and return a new
16968 concatenated string.
16970 (Unary.Reduce): Implement reduction of unary expressions.
16972 * ecore.cs: Split out the expression core handling here.
16974 (Expression.Reduce): New method used to perform constant folding
16975 and CSE. This is needed to support constant-expressions.
16977 * statement.cs (Statement.EmitBoolExpression): Pass true and false
16978 targets, and optimize for !x.
16980 2001-11-04 Ravi Pratap <ravi@ximian.com>
16982 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
16983 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
16984 set custom atttributes.
16986 * literal.cs (Literal::GetValue): New abstract method to return the actual
16987 value of the literal, cast as an object.
16989 (*Literal): Implement GetValue method.
16991 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
16992 expressions to the arraylist but objects of type Argument.
16994 * class.cs (TypeContainer::Emit): Emit our attributes too.
16996 (Method::Emit, Constructor::Emit): Ditto.
16998 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
16999 to be ignoring earlier.
17001 2001-11-03 Ravi Pratap <ravi@ximian.com>
17003 * attribute.cs (AttributeSection::Define): Implement to do the business
17004 of constructing a CustomAttributeBuilder.
17006 (Attribute): New trivial class. Increases readability of code.
17008 * cs-parser.jay : Update accordingly.
17010 (positional_argument_list, named_argument_list, named_argument): New rules
17012 (attribute_arguments): Use the above so that we are more correct.
17014 2001-11-02 Ravi Pratap <ravi@ximian.com>
17016 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
17017 to perform all checks for a method with a params parameter.
17019 (Invocation::OverloadResolve): Update to use the above method and therefore
17020 cope correctly with params method invocations.
17022 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
17025 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
17026 constructors in our parent too because we can't afford to miss out on
17029 * attribute.cs (AttributeSection): New name for the class Attribute
17031 Other trivial changes to improve readability.
17033 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
17034 use the new class names.
17036 2001-11-01 Ravi Pratap <ravi@ximian.com>
17038 * class.cs (Method::Define): Complete definition for params types too
17040 (Indexer::Define): Ditto.
17042 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
17043 Cope everywhere with a request for info about the array parameter.
17045 2001-11-01 Ravi Pratap <ravi@ximian.com>
17047 * tree.cs (RecordNamespace): Fix up to check for the correct key.
17049 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
17050 local_variable_type to extract the string corresponding to the type.
17052 (local_variable_type): Fixup the action to use the new helper method.
17054 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
17057 * expression.cs : Clean out code which uses the above.
17059 2001-10-31 Ravi Pratap <ravi@ximian.com>
17061 * typemanager.cs (RegisterMethod): Check if we already have an existing key
17062 and bale out if necessary by returning a false.
17064 (RegisterProperty): Ditto.
17066 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
17067 and print out appropriate error messages.
17069 * interface.cs (everywhere): Ditto.
17071 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
17072 location to constructor.
17074 * class.cs (Property, Event, Indexer): Update accordingly.
17076 * ../errors/cs111.cs : Added.
17078 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
17079 of a method, as laid down by the spec.
17081 (Invocation::OverloadResolve): Use the above method.
17083 2001-10-31 Ravi Pratap <ravi@ximian.com>
17085 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
17086 now take a TypeContainer and a Parameters object.
17088 (ParameterData): Modify return type of ParameterModifier method to be
17089 Parameter.Modifier and not a string.
17091 (ReflectionParameters, InternalParameters): Update accordingly.
17093 * expression.cs (Argument::GetParameterModifier): Same here.
17095 * support.cs (InternalParameters::ParameterType): Find a better way of determining
17096 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
17097 symbol in it at all so maybe this is only for now.
17099 2001-10-30 Ravi Pratap <ravi@ximian.com>
17101 * support.cs (InternalParameters): Constructor now takes an extra argument
17102 which is the actual Parameters class.
17104 (ParameterDesc): Update to provide info on ref/out modifiers.
17106 * class.cs (everywhere): Update call to InternalParameters to pass in
17107 the second argument too.
17109 * support.cs (ParameterData): Add ParameterModifier, which is a method
17110 to return the modifier info [ref/out etc]
17112 (InternalParameters, ReflectionParameters): Implement the above.
17114 * expression.cs (Argument::ParameterModifier): Similar function to return
17115 info about the argument's modifiers.
17117 (Invocation::OverloadResolve): Update to take into account matching modifiers
17120 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
17121 a new SetFormalParameters object which we pass to InternalParameters.
17123 2001-10-30 Ravi Pratap <ravi@ximian.com>
17125 * expression.cs (NewArray): Merge into the ArrayCreation class.
17127 2001-10-29 Ravi Pratap <ravi@ximian.com>
17129 * expression.cs (NewArray): Merge classes NewBuiltinArray and
17130 NewUserdefinedArray into one as there wasn't much of a use in having
17133 * expression.cs (Argument): Change field's name to ArgType from Type.
17135 (Type): New readonly property which returns the proper type, taking into
17136 account ref/out modifiers.
17138 (everywhere): Adjust code accordingly for the above.
17140 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
17141 whether we are emitting for a ref or out parameter.
17143 * expression.cs (Argument::Emit): Use the above field to set the state.
17145 (LocalVariableReference::Emit): Update to honour the flag and emit the
17148 * parameter.cs (Attributes): Set the correct flags for ref parameters.
17150 * expression.cs (Argument::FullDesc): New function to provide a full desc.
17152 * support.cs (ParameterData): Add method ParameterDesc to the interface.
17154 (ReflectionParameters, InternalParameters): Implement the above method.
17156 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
17159 (Invocation::FullMethodDesc): Ditto.
17161 2001-10-29 Miguel de Icaza <miguel@ximian.com>
17163 * cs-parser.jay: Add extra production for the second form of array
17166 * expression.cs (ArrayCreation): Update to reflect the above
17169 * Small changes to prepare for Array initialization.
17171 2001-10-28 Miguel de Icaza <miguel@ximian.com>
17173 * typemanager.cs (ImplementsInterface): interface might be null;
17174 Deal with this problem;
17176 Also, we do store negative hits on the cache (null values), so use
17177 this instead of calling t.GetInterfaces on the type everytime.
17179 2001-10-28 Ravi Pratap <ravi@ximian.com>
17181 * typemanager.cs (IsBuiltinType): New method to help determine the same.
17183 * expression.cs (New::DoResolve): Get rid of array creation code and instead
17184 split functionality out into different classes.
17186 (New::FormArrayType): Move into NewBuiltinArray.
17188 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
17191 (NewBuiltinArray): New class to handle creation of built-in arrays.
17193 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
17194 account creation of one-dimensional arrays.
17196 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
17198 (NewUserdefinedArray::DoResolve): Implement.
17200 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
17202 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
17203 we maintain inside the TypeManager. This is necessary to perform lookups on the
17206 (LookupType): Update to perform GetType on the module builders too.
17208 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
17210 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
17212 2001-10-23 Ravi Pratap <ravi@ximian.com>
17214 * expression.cs (New::DoResolve): Implement guts of array creation.
17216 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
17218 2001-10-27 Miguel de Icaza <miguel@ximian.com>
17220 * expression.cs: Fix bug I introduced lsat night that broke
17223 (Expression.Resolve): Report a 246 error (can not resolve name)
17224 if we find a SimpleName in the stream.
17226 (Expression.ResolveLValue): Ditto.
17228 (Expression.ResolveWithSimpleName): This function is a variant of
17229 ResolveName, this one allows SimpleNames to be returned without a
17230 warning. The only consumer of SimpleNames is MemberAccess
17232 2001-10-26 Miguel de Icaza <miguel@ximian.com>
17234 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
17235 might arrive here. I have my doubts that this is correct.
17237 * statement.cs (Lock): Implement lock statement.
17239 * cs-parser.jay: Small fixes to support `lock' and `using'
17241 * cs-tokenizer.cs: Remove extra space
17243 * driver.cs: New flag --checked, allows to turn on integer math
17246 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
17247 Threading.Monitor.Exit
17249 2001-10-23 Miguel de Icaza <miguel@ximian.com>
17251 * expression.cs (IndexerAccess::DoResolveLValue): Set the
17252 Expression Class to be IndexerAccess.
17254 Notice that Indexer::DoResolve sets the eclass to Value.
17256 2001-10-22 Miguel de Icaza <miguel@ximian.com>
17258 * class.cs (TypeContainer::Emit): Emit code for indexers.
17260 * assign.cs (IAssignMethod): New interface implemented by Indexers
17261 and Properties for handling assignment.
17263 (Assign::Emit): Simplify and reuse code.
17265 * expression.cs (IndexerAccess, PropertyExpr): Implement
17266 IAssignMethod, clean up old code.
17268 2001-10-22 Ravi Pratap <ravi@ximian.com>
17270 * typemanager.cs (ImplementsInterface): New method to determine if a type
17271 implements a given interface. Provides a nice cache too.
17273 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
17276 (ConvertReferenceExplicit): Ditto.
17278 * delegate.cs (Delegate::Populate): Update to define the parameters on the
17279 various methods, with correct names etc.
17281 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
17282 Operator.UnaryNegation.
17284 * cs-parser.jay (operator_declarator): Be a little clever in the case where
17285 we have a unary plus or minus operator.
17287 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
17290 * everywhere : update accordingly.
17292 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
17295 * class.cs (Method::Define): For the case where we are implementing a method
17296 inherited from an interface, we need to set the MethodAttributes.Final flag too.
17297 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
17299 2001-10-21 Ravi Pratap <ravi@ximian.com>
17301 * interface.cs (FindMembers): Implement to work around S.R.E
17304 * typemanager.cs (IsInterfaceType): Implement.
17306 (FindMembers): Update to handle interface types too.
17308 * expression.cs (ImplicitReferenceConversion): Re-write bits which
17309 use IsAssignableFrom as that is not correct - it doesn't work.
17311 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
17312 and accordingly override EmitStatement.
17314 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
17315 using the correct logic :-)
17317 2001-10-19 Ravi Pratap <ravi@ximian.com>
17319 * ../errors/cs-11.cs : Add to demonstrate error -11
17321 2001-10-17 Miguel de Icaza <miguel@ximian.com>
17323 * assign.cs (Assign::Resolve): Resolve right hand side first, and
17324 then pass this as a hint to ResolveLValue.
17326 * expression.cs (FieldExpr): Add Location information
17328 (FieldExpr::LValueResolve): Report assignment to readonly
17331 (Expression::ExprClassFromMemberInfo): Pass location information.
17333 (Expression::ResolveLValue): Add new method that resolves an
17336 (Expression::DoResolveLValue): Default invocation calls
17339 (Indexers): New class used to keep track of indexers in a given
17342 (IStackStore): Renamed from LValue, as it did not really describe
17343 what this did. Also ResolveLValue is gone from this interface and
17344 now is part of Expression.
17346 (ElementAccess): Depending on the element access type
17348 * typemanager.cs: Add `indexer_name_type' as a Core type
17349 (System.Runtime.CompilerServices.IndexerNameAttribute)
17351 * statement.cs (Goto): Take a location.
17353 2001-10-18 Ravi Pratap <ravi@ximian.com>
17355 * delegate.cs (Delegate::VerifyDelegate): New method to verify
17356 if two delegates are compatible.
17358 (NewDelegate::DoResolve): Update to take care of the case when
17359 we instantiate a delegate from another delegate.
17361 * typemanager.cs (FindMembers): Don't even try to look up members
17362 of Delegate types for now.
17364 2001-10-18 Ravi Pratap <ravi@ximian.com>
17366 * delegate.cs (NewDelegate): New class to take care of delegate
17369 * expression.cs (New): Split the delegate related code out into
17370 the NewDelegate class.
17372 * delegate.cs (DelegateInvocation): New class to handle delegate
17375 * expression.cs (Invocation): Split out delegate related code into
17376 the DelegateInvocation class.
17378 2001-10-17 Ravi Pratap <ravi@ximian.com>
17380 * expression.cs (New::DoResolve): Implement delegate creation fully
17381 and according to the spec.
17383 (New::DoEmit): Update to handle delegates differently.
17385 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
17386 because of which we were printing out arguments in reverse order !
17388 * delegate.cs (VerifyMethod): Implement to check if the given method
17389 matches the delegate.
17391 (FullDelegateDesc): Implement.
17393 (VerifyApplicability): Implement.
17395 * expression.cs (Invocation::DoResolve): Update to accordingly handle
17396 delegate invocations too.
17398 (Invocation::Emit): Ditto.
17400 * ../errors/cs1593.cs : Added.
17402 * ../errors/cs1594.cs : Added.
17404 * delegate.cs (InstanceExpression, TargetMethod): New properties.
17406 2001-10-16 Ravi Pratap <ravi@ximian.com>
17408 * typemanager.cs (intptr_type): Core type for System.IntPtr
17410 (InitCoreTypes): Update for the same.
17412 (iasyncresult_type, asynccallback_type): Ditto.
17414 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
17417 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
17420 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
17421 the builders for the 4 members of a delegate type :-)
17423 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
17426 * expression.cs (New::DoResolve): Implement guts for delegate creation.
17428 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
17430 2001-10-15 Miguel de Icaza <miguel@ximian.com>
17432 * statement.cs (Break::Emit): Implement.
17433 (Continue::Emit): Implement.
17435 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
17436 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
17437 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
17438 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
17441 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
17442 properties that track the label for the current loop (begin of the
17443 loop and end of the loop).
17445 2001-10-15 Ravi Pratap <ravi@ximian.com>
17447 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
17448 use of emitting anything at all.
17450 * class.cs, rootcontext.cs : Get rid of calls to the same.
17452 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
17454 (Populate): Define the constructor correctly and set the implementation
17457 * typemanager.cs (delegate_types): New hashtable to hold delegates that
17460 (AddDelegateType): Implement.
17462 (IsDelegateType): Implement helper method.
17464 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
17466 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
17467 and accordingly handle it.
17469 * delegate.cs (Populate): Take TypeContainer argument.
17470 Implement bits to define the Invoke method. However, I still haven't figured out
17471 how to take care of the native int bit :-(
17473 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
17474 Qualify the name of the delegate, not its return type !
17476 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
17479 (StandardConversionExists): Checking for array types turns out to be recursive.
17481 (ConvertReferenceExplicit): Implement array conversion.
17483 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
17485 2001-10-12 Ravi Pratap <ravi@ximian.com>
17487 * cs-parser.jay (delegate_declaration): Store the fully qualified
17488 name as it is a type declaration.
17490 * delegate.cs (ReturnType, Name): Rename members to these. Make them
17493 (DefineDelegate): Renamed from Define. Does the same thing essentially,
17494 as TypeContainer::DefineType.
17496 (Populate): Method in which all the definition of the various methods (Invoke)
17499 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
17502 (CloseDelegate): Finally creates the delegate.
17504 * class.cs (TypeContainer::DefineType): Update to define delegates.
17505 (Populate, Emit and CloseType): Do the same thing here too.
17507 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
17508 delegates in all these operations.
17510 2001-10-14 Miguel de Icaza <miguel@ximian.com>
17512 * expression.cs: LocalTemporary: a new expression used to
17513 reference a temporary that has been created.
17515 * assign.cs: Handle PropertyAccess back here, so that we can
17516 provide the proper semantic access to properties.
17518 * expression.cs (Expression::ConvertReferenceExplicit): Implement
17519 a few more explicit conversions.
17521 * modifiers.cs: `NEW' modifier maps to HideBySig.
17523 * expression.cs (PropertyExpr): Make this into an
17524 ExpressionStatement, and support the EmitStatement code path.
17526 Perform get/set error checking, clean up the interface.
17528 * assign.cs: recognize PropertyExprs as targets, and if so, turn
17529 them into toplevel access objects.
17531 2001-10-12 Miguel de Icaza <miguel@ximian.com>
17533 * expression.cs: PropertyExpr::PropertyExpr: use work around the
17536 * typemanager.cs: Keep track here of our PropertyBuilders again to
17537 work around lameness in SRE.
17539 2001-10-11 Miguel de Icaza <miguel@ximian.com>
17541 * expression.cs (LValue::LValueResolve): New method in the
17542 interface, used to perform a second resolution pass for LValues.
17544 (This::DoResolve): Catch the use of this in static methods.
17546 (This::LValueResolve): Implement.
17548 (This::Store): Remove warning, assigning to `this' in structures
17551 (Invocation::Emit): Deal with invocation of
17552 methods on value types. We need to pass the address to structure
17553 methods rather than the object itself. (The equivalent code to
17554 emit "this" for structures leaves the entire structure on the
17555 stack instead of a pointer to it).
17557 (ParameterReference::DoResolve): Compute the real index for the
17558 argument based on whether the method takes or not a `this' pointer
17559 (ie, the method is static).
17561 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
17562 value types returned from functions when we need to invoke a
17563 method on the sturcture.
17566 2001-10-11 Ravi Pratap <ravi@ximian.com>
17568 * class.cs (TypeContainer::DefineType): Method to actually do the business of
17569 defining the type in the Modulebuilder or Typebuilder. This is to take
17570 care of nested types which need to be defined on the TypeBuilder using
17571 DefineNestedMethod.
17573 (TypeContainer::GetClassBases): Implement. Essentially the code from the
17574 methods in RootContext, only ported to be part of TypeContainer.
17576 (TypeContainer::GetInterfaceOrClass): Ditto.
17578 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
17580 * interface.cs (Interface::DefineInterface): New method. Does exactly
17581 what RootContext.CreateInterface did earlier, only it takes care of nested types
17584 (Interface::GetInterfaces): Move from RootContext here and port.
17586 (Interface::GetInterfaceByName): Same here.
17588 * rootcontext.cs (ResolveTree): Re-write.
17590 (PopulateTypes): Re-write.
17592 * class.cs (TypeContainer::Populate): Populate nested types too.
17593 (TypeContainer::Emit): Emit nested members too.
17595 * typemanager.cs (AddUserType): Do not make use of the FullName property,
17596 instead just use the name argument passed in as it is already fully
17599 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
17600 to TypeContainer mapping to see if a type is user-defined.
17602 * class.cs (TypeContainer::CloseType): Implement.
17604 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
17605 the default constructor.
17607 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
17610 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
17612 * interface.cs (CloseType): Create the type here.
17614 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
17617 Remove all the methods which are now in TypeContainer.
17619 2001-10-10 Ravi Pratap <ravi@ximian.com>
17621 * delegate.cs (Define): Re-write bits to define the delegate
17624 2001-10-10 Miguel de Icaza <miguel@ximian.com>
17626 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
17628 * expression.cs (ImplicitReferenceConversion): handle null as well
17629 as a source to convert to any reference type.
17631 * statement.cs (Return): Perform any implicit conversions to
17632 expected return type.
17634 Validate use of return statement.
17636 * codegen.cs (EmitContext): Pass the expected return type here.
17638 * class.cs (Method, Constructor, Property): Pass expected return
17639 type to EmitContext.
17641 2001-10-09 Miguel de Icaza <miguel@ximian.com>
17643 * expression.cs: Make DoResolve take an EmitContext instead of a
17646 Replaced `l' and `location' for `loc', for consistency.
17648 (Error, Warning): Remove unneeded Tc argument.
17650 * assign.cs, literal.cs, constant.cs: Update to new calling
17653 * codegen.cs: EmitContext now contains a flag indicating whether
17654 code is being generated in a static method or not.
17656 * cs-parser.jay: DecomposeQI, new function that replaces the old
17657 QualifiedIdentifier. Now we always decompose the assembled
17658 strings from qualified_identifier productions into a group of
17661 2001-10-08 Miguel de Icaza <miguel@ximian.com>
17663 * rootcontext.cs: Deal with field-less struct types correctly now
17664 by passing the size option to Define Type.
17666 * class.cs: Removed hack that created one static field.
17668 2001-10-07 Miguel de Icaza <miguel@ximian.com>
17670 * statement.cs: Moved most of the code generation here.
17672 2001-10-09 Ravi Pratap <ravi@ximian.com>
17674 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
17677 (ElementAccess): Remove useless bits for now - keep checks as the spec
17680 2001-10-08 Ravi Pratap <ravi@ximian.com>
17682 * expression.cs (ElementAccess::DoResolve): Remove my crap code
17683 and start performing checks according to the spec.
17685 2001-10-07 Ravi Pratap <ravi@ximian.com>
17687 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
17688 rank_specifiers instead.
17690 (rank_specifiers): Change the order in which the rank specifiers are stored
17692 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
17694 * expression.cs (ElementAccess): Implement the LValue interface too.
17696 2001-10-06 Ravi Pratap <ravi@ximian.com>
17698 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
17699 except that user defined conversions are not included.
17701 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
17702 perform the conversion of the return type, if necessary.
17704 (New::DoResolve): Check whether we are creating an array or an object
17705 and accordingly do the needful.
17707 (New::Emit): Same here.
17709 (New::DoResolve): Implement guts of array creation.
17711 (New::FormLookupType): Helper function.
17713 2001-10-07 Miguel de Icaza <miguel@ximian.com>
17715 * codegen.cs: Removed most of the code generation here, and move the
17716 corresponding code generation bits to the statement classes.
17718 Added support for try/catch/finalize and throw.
17720 * cs-parser.jay: Added support for try/catch/finalize.
17722 * class.cs: Catch static methods having the flags override,
17723 virtual or abstract.
17725 * expression.cs (UserCast): This user cast was not really doing
17726 what it was supposed to do. Which is to be born in fully resolved
17727 state. Parts of the resolution were being performed at Emit time!
17731 2001-10-05 Miguel de Icaza <miguel@ximian.com>
17733 * expression.cs: Implicity convert the result from UserCast.
17735 2001-10-05 Ravi Pratap <ravi@ximian.com>
17737 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
17738 prevented it from working correctly.
17740 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
17741 merely ConvertImplicit.
17743 2001-10-05 Miguel de Icaza <miguel@ximian.com>
17745 * typemanager.cs: Make the LookupTypeContainer function static,
17746 and not per-instance.
17748 * class.cs: Make static FindMembers (the one that takes a Type
17751 * codegen.cs: Add EmitForeach here.
17753 * cs-parser.jay: Make foreach a toplevel object instead of the
17754 inline expansion, as we need to perform semantic analysis on it.
17756 2001-10-05 Ravi Pratap <ravi@ximian.com>
17758 * expression.cs (Expression::ImplicitUserConversion): Rename to
17759 UserDefinedConversion.
17761 (Expression::UserDefinedConversion): Take an extra argument specifying
17762 whether we look for explicit user conversions too.
17764 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
17766 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
17768 (ExplicitUserConversion): Make it a call to UserDefinedConversion
17769 with the appropriate arguments.
17771 * cs-parser.jay (cast_expression): Record location too.
17773 * expression.cs (Cast): Record location info.
17775 (Expression::ConvertExplicit): Take location argument.
17777 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
17778 to determine if we are doing explicit conversions.
17780 (UserCast::Emit): Update accordingly.
17782 (Expression::ConvertExplicit): Report an error if everything fails.
17784 * ../errors/cs0030.cs : Add.
17786 2001-10-04 Miguel de Icaza <miguel@ximian.com>
17788 * modifiers.cs: If the ABSTRACT keyword is present, also set the
17789 virtual and newslot bits.
17791 * class.cs (TypeContainer::RegisterRequiredImplementations):
17792 Record methods we need.
17794 (TypeContainer::MakeKey): Helper function to make keys for
17795 MethodBases, since the Methodbase key is useless.
17797 (TypeContainer::Populate): Call RegisterRequiredImplementations
17798 before defining the methods.
17800 Create a mapping for method_builders_to_methods ahead of time
17801 instead of inside a tight loop.
17803 (::RequireMethods): Accept an object as the data to set into the
17804 hashtable so we can report interface vs abstract method mismatch.
17806 2001-10-03 Miguel de Icaza <miguel@ximian.com>
17808 * report.cs: Make all of it static.
17810 * rootcontext.cs: Drop object_type and value_type computations, as
17811 we have those in the TypeManager anyways.
17813 Drop report instance variable too, now it is a global.
17815 * driver.cs: Use try/catch on command line handling.
17817 Add --probe option to debug the error reporting system with a test
17820 * report.cs: Add support for exiting program when a probe
17821 condition is reached.
17823 2001-10-03 Ravi Pratap <ravi@ximian.com>
17825 * expression.cs (Binary::DoNumericPromotions): Fix the case when
17826 we do a forcible conversion regardless of type, to check if
17827 ForceConversion returns a null.
17829 (Binary::error19): Use location to report error.
17831 (Unary::error23): Use location here too.
17833 * ../errors/cs0019.cs : Check in.
17835 * ../errors/cs0023.cs : Check in.
17837 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
17838 case of a non-null MethodInfo object with a length of 0 !
17840 (Binary::ResolveOperator): Flag error if overload resolution fails to find
17841 an applicable member - according to the spec :-)
17842 Also fix logic to find members in base types.
17844 (Unary::ResolveOperator): Same here.
17846 (Unary::report23): Change name to error23 and make first argument a TypeContainer
17847 as I was getting thoroughly confused between this and error19 :-)
17849 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
17850 (::FindMostEncompassedType): Implement.
17851 (::FindMostEncompassingType): Implement.
17852 (::StandardConversionExists): Implement.
17854 (UserImplicitCast): Re-vamp. We now need info about most specific
17855 source and target types so that we can do the necessary conversions.
17857 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
17858 mathematical union with no duplicates.
17860 2001-10-03 Miguel de Icaza <miguel@ximian.com>
17862 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
17863 in order from base classes to child classes, so that we can in
17864 child classes look up in our parent for method names and
17865 attributes (required for handling abstract, virtual, new, override
17866 constructs: we need to instrospect our base class, and if we dont
17867 populate the classes in order, the introspection might be
17868 incorrect. For example, a method could query its parent before
17869 the parent has any methods and would determine that the parent has
17870 no abstract methods (while it could have had them)).
17872 (RootContext::CreateType): Record the order in which we define the
17875 2001-10-02 Miguel de Icaza <miguel@ximian.com>
17877 * class.cs (TypeContainer::Populate): Also method definitions can
17878 fail now, keep track of this.
17880 (TypeContainer::FindMembers): Implement support for
17881 DeclaredOnly/noDeclaredOnly flag.
17883 (Constructor::Emit) Return the ConstructorBuilder.
17885 (Method::Emit) Return the MethodBuilder.
17886 Check for abstract or virtual methods to be public.
17888 * rootcontext.cs (RootContext::CreateType): Register all the
17889 abstract methods required for the class to be complete and the
17890 interface methods that must be implemented.
17892 * cs-parser.jay: Report error 501 (method requires body if it is
17893 not marked abstract or extern).
17895 * expression.cs (TypeOf::Emit): Implement.
17897 * typemanager.cs: runtime_handle_type, new global type.
17899 * class.cs (Property::Emit): Generate code for properties.
17901 2001-10-02 Ravi Pratap <ravi@ximian.com>
17903 * expression.cs (Unary::ResolveOperator): Find operators on base type
17904 too - we now conform exactly to the spec.
17906 (Binary::ResolveOperator): Same here.
17908 * class.cs (Operator::Define): Fix minor quirk in the tests.
17910 * ../errors/cs0215.cs : Added.
17912 * ../errors/cs0556.cs : Added.
17914 * ../errors/cs0555.cs : Added.
17916 2001-10-01 Miguel de Icaza <miguel@ximian.com>
17918 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
17919 single integer which is really efficient
17921 2001-10-01 Ravi Pratap <ravi@ximian.com>
17923 * expression.cs (Expression::ImplicitUserConversion): Use location
17924 even in the case when we are examining True operators.
17926 * class.cs (Operator::Define): Perform extensive checks to conform
17927 with the rules for operator overloading in the spec.
17929 * expression.cs (Expression::ImplicitReferenceConversion): Implement
17930 some of the other conversions mentioned in the spec.
17932 * typemanager.cs (array_type): New static member for the System.Array built-in
17935 (cloneable_interface): For System.ICloneable interface.
17937 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
17938 we start resolving the tree and populating types.
17940 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
17942 2001-10-01 Miguel de Icaza <miguel@ximian.com>
17944 * expression.cs (Expression::ExprClassFromMemberInfo,
17945 Expression::Literalize): Create literal expressions from
17946 FieldInfos which are literals.
17948 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
17949 type casts, because they were wrong. The test suite in tests
17952 (ImplicitNumericConversion): ushort to ulong requires a widening
17955 Int32 constant to long requires widening cast as well.
17957 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
17958 for integers because the type on the stack is not i4.
17960 2001-09-30 Miguel de Icaza <miguel@ximian.com>
17962 * expression.cs (report118): require location argument.
17964 * parameter.cs: Do not dereference potential null value.
17966 * class.cs: Catch methods that lack the `new' keyword when
17967 overriding a name. Report warnings when `new' is used without
17968 anything being there to override.
17970 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
17972 * class.cs: Only add constructor to hashtable if it is non-null
17973 (as now constructors can fail on define).
17975 (TypeManager, Class, Struct): Take location arguments.
17977 Catch field instance initialization in structs as errors.
17979 accepting_filter: a new filter for FindMembers that is static so
17980 that we dont create an instance per invocation.
17982 (Constructor::Define): Catch errors where a struct constructor is
17985 * cs-parser.jay: Pass location information for various new
17988 * delegate.cs (Delegate): take a location argument.
17990 * driver.cs: Do not call EmitCode if there were problesm in the
17991 Definition of the types, as many Builders wont be there.
17993 * decl.cs (Decl::Decl): Require a location argument.
17995 * cs-tokenizer.cs: Handle properly hex constants that can not fit
17996 into integers, and find the most appropiate integer for it.
17998 * literal.cs: Implement ULongLiteral.
18000 * rootcontext.cs: Provide better information about the location of
18001 failure when CreateType fails.
18003 2001-09-29 Miguel de Icaza <miguel@ximian.com>
18005 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
18008 * expression.cs (Binary::CheckShiftArguments): Add missing type
18010 (Binary::ResolveOperator): Add type to the logical and and logical
18011 or, Bitwise And/Or and Exclusive Or code paths, it was missing
18014 (Binary::DoNumericPromotions): In the case where either argument
18015 is ulong (and most signed types combined with ulong cause an
18016 error) perform implicit integer constant conversions as well.
18018 2001-09-28 Miguel de Icaza <miguel@ximian.com>
18020 * expression.cs (UserImplicitCast): Method should always be
18022 (Invocation::BetterConversion): Simplified test for IntLiteral.
18024 (Expression::ImplicitNumericConversion): Split this routine out.
18025 Put the code that performs implicit constant integer conversions
18028 (Expression::Resolve): Become a wrapper around DoResolve so we can
18029 check eclass and type being set after resolve.
18031 (Invocation::Badness): Remove this dead function
18033 (Binary::ResolveOperator): Do not compute the expensive argumnets
18034 unless we have a union for it.
18036 (Probe::Emit): Is needs to do an isinst and then
18037 compare against null.
18039 (::CanConvert): Added Location argument. If the Location argument
18040 is null (Location.Null), then we do not report errors. This is
18041 used by the `probe' mechanism of the Explicit conversion. We do
18042 not want to generate an error for something that the user
18043 explicitly requested to be casted. But the pipeline for an
18044 explicit cast first tests for potential implicit casts.
18046 So for now, if the Location is null, it means `Probe only' to
18047 avoid adding another argument. Might have to revise this
18050 (ClassCast): New class used to type cast objects into arbitrary
18051 classes (used in Explicit Reference Conversions).
18053 Implement `as' as well.
18055 Reverted all the patches from Ravi below: they were broken:
18057 * The use of `level' as a mechanism to stop recursive
18058 invocations is wrong. That was there just to catch the
18059 bug with a strack trace but not as a way of addressing
18062 To fix the problem we have to *understand* what is going
18063 on and the interactions and come up with a plan, not
18064 just get things going.
18066 * The use of the type conversion cache that I proposed
18067 last night had an open topic: How does this work across
18068 protection domains. A user defined conversion might not
18069 be public in the location where we are applying the
18070 conversion, a different conversion might be selected
18071 (ie, private A->B (better) but public B->A (worse),
18072 inside A, A->B applies, but outside it, B->A will
18075 * On top of that (ie, even if the above is solved),
18076 conversions in a cache need to be abstract. Ie, `To
18077 convert from an Int to a Short use an OpcodeCast', not
18078 `To convert from an Int to a Short use the OpcodeCast on
18079 the variable 5' (which is what this patch was doing).
18081 2001-09-28 Ravi Pratap <ravi@ximian.com>
18083 * expression.cs (Invocation::ConversionExists): Re-write to use
18084 the conversion cache
18086 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
18087 cache all conversions done, not just user-defined ones.
18089 (Invocation::BetterConversion): The real culprit. Use ConversionExists
18090 to determine if a conversion exists instead of acutually trying to
18091 perform the conversion. It's faster too.
18093 (Expression::ConvertExplicit): Modify to use ConversionExists to check
18094 and only then attempt the implicit conversion.
18096 2001-09-28 Ravi Pratap <ravi@ximian.com>
18098 * expression.cs (ConvertImplicit): Use a cache for conversions
18099 already found. Check level of recursion and bail out if necessary.
18101 2001-09-28 Miguel de Icaza <miguel@ximian.com>
18103 * typemanager.cs (string_concat_string_string, string_concat_object_object):
18104 Export standard methods that we expect for string operations.
18106 * statement.cs (Block::UsageWarning): Track usage of variables and
18107 report the errors for not used variables.
18109 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
18112 2001-09-27 Miguel de Icaza <miguel@ximian.com>
18114 * codegen.cs: remove unnneded code
18116 * expression.cs: Removed BuiltinTypeAccess class
18118 Fix the order in which implicit conversions are
18121 The previous fixed dropped support for boxed conversions (adding a
18122 test to the test suite now)
18124 (UserImplicitCast::CanConvert): Remove test for source being null,
18125 that code is broken. We should not feed a null to begin with, if
18126 we do, then we should track the bug where the problem originates
18127 and not try to cover it up here.
18129 Return a resolved expression of type UserImplicitCast on success
18130 rather than true/false. Ravi: this is what I was talking about,
18131 the pattern is to use a static method as a "constructor" for
18134 Also, do not create arguments until the very last minute,
18135 otherwise we always create the arguments even for lookups that
18136 will never be performed.
18138 (UserImplicitCast::Resolve): Eliminate, objects of type
18139 UserImplicitCast are born in a fully resolved state.
18141 * typemanager.cs (InitCoreTypes): Init also value_type
18142 (System.ValueType).
18144 * expression.cs (Cast::Resolve): First resolve the child expression.
18146 (LValue): Add new method AddressOf to be used by
18149 Change the argument of Store to take an EmitContext instead of an
18150 ILGenerator, because things like FieldExpr need to be able to call
18151 their children expression to generate the instance code.
18153 (Expression::Error, Expression::Warning): Sugar functions for
18156 (Expression::MemberLookup): Accept a TypeContainer instead of a
18157 Report as the first argument.
18159 (Expression::ResolvePrimary): Killed. I still want to improve
18160 this as currently the code is just not right.
18162 (Expression::ResolveMemberAccess): Simplify, but it is still
18165 (Unary::Resolve): Catch errors in AddressOf operators.
18167 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
18168 index to a byte for the short-version, or the compiler will choose
18169 the wrong Emit call, which generates the wrong data.
18171 (ParameterReference::Emit, ::Store): same.
18173 (FieldExpr::AddressOf): Implement.
18175 * typemanager.cs: TypeManager: made public variable instead of
18178 * driver.cs: document --fatal.
18180 * report.cs (ErrorMessage, WarningMessage): new names for the old
18181 Error and Warning classes.
18183 * cs-parser.jay (member_access): Turn built-in access to types
18184 into a normal simplename
18186 2001-09-27 Ravi Pratap <ravi@ximian.com>
18188 * expression.cs (Invocation::BetterConversion): Fix to cope
18189 with q being null, since this was introducing a bug.
18191 * expression.cs (ConvertImplicit): Do built-in conversions first.
18193 2001-09-27 Ravi Pratap <ravi@ximian.com>
18195 * expression.cs (UserImplicitCast::Resolve): Fix bug.
18197 2001-09-27 Ravi Pratap <ravi@ximian.com>
18199 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
18200 I had introduced long ago (what's new ?).
18202 * expression.cs (UserImplicitCast::CanConvert): Static method to do
18203 the work of all the checking.
18204 (ConvertImplicit): Call CanConvert and only then create object if necessary.
18205 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
18207 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
18208 that is the right way.
18210 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
18211 overloading resolution. Use everywhere instead of cutting and pasting code.
18213 (Binary::ResolveOperator): Use MakeUnionSet.
18215 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
18216 we have to convert to bool types. Not complete yet.
18218 2001-09-27 Miguel de Icaza <miguel@ximian.com>
18220 * typemanager.cs (TypeManager::CSharpName): support ushort.
18222 * expression.cs (Expression::TryImplicitIntConversion): Attempts
18223 to provide an expression that performsn an implicit constant int
18224 conversion (section 6.1.6).
18225 (Expression::ConvertImplicitRequired): Reworked to include
18226 implicit constant expression conversions.
18228 (Expression::ConvertNumericExplicit): Finished.
18230 (Invocation::Emit): If InstanceExpression is null, then it means
18231 that we perform a call on this.
18233 2001-09-26 Miguel de Icaza <miguel@ximian.com>
18235 * expression.cs (Unary::Emit): Remove some dead code.
18236 (Probe): Implement Resolve and Emit for `is'.
18237 (Expression::ConvertImplicitRequired): Attempt to do constant
18238 expression conversions here. Maybe should be moved to
18239 ConvertImplicit, but I am not sure.
18240 (Expression::ImplicitLongConstantConversionPossible,
18241 Expression::ImplicitIntConstantConversionPossible): New functions
18242 that tell whether is it possible to apply an implicit constant
18243 expression conversion.
18245 (ConvertNumericExplicit): Started work on explicit numeric
18248 * cs-parser.jay: Update operator constants.
18250 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
18251 (Parameters::GetSignature): Hook up VerifyArgs here.
18252 (Parameters::VerifyArgs): Verifies that no two arguments have the
18255 * class.cs (Operator): Update the operator names to reflect the
18256 ones that the spec expects (as we are just stringizing the
18259 * expression.cs (Unary::ResolveOperator): Fix bug: Use
18260 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
18261 previous usage did only work for our methods.
18262 (Expression::ConvertImplicit): Handle decimal implicit numeric
18263 conversions as well.
18264 (Expression::InternalTypeConstructor): Used to invoke constructors
18265 on internal types for default promotions.
18267 (Unary::Emit): Implement special handling for the pre/post
18268 increment/decrement for overloaded operators, as they need to have
18269 the same semantics as the other operators.
18271 (Binary::ResolveOperator): ditto.
18272 (Invocation::ConversionExists): ditto.
18273 (UserImplicitCast::Resolve): ditto.
18275 2001-09-26 Ravi Pratap <ravi@ximian.com>
18277 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
18278 operator, return after emitting body. Regression tests pass again !
18280 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
18281 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
18282 (Invocation::OverloadResolve): Ditto.
18283 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
18285 * everywhere : update calls to the above methods accordingly.
18287 2001-09-26 Miguel de Icaza <miguel@ximian.com>
18289 * assign.cs (Assign): Make it inherit from ExpressionStatement.
18291 * expression.cs (ExpressionStatement): New base class used for
18292 expressions that can appear in statements, so that we can provide
18293 an alternate path to generate expression that do not leave a value
18296 (Expression::Emit, and all the derivatives): We no longer return
18297 whether a value is left on the stack or not. Every expression
18298 after being emitted leaves a single value on the stack.
18300 * codegen.cs (EmitContext::EmitStatementExpression): Use the
18301 facilties of ExpressionStatement if possible.
18303 * cs-parser.jay: Update statement_expression.
18305 2001-09-25 Miguel de Icaza <miguel@ximian.com>
18307 * driver.cs: Change the wording of message
18309 2001-09-25 Ravi Pratap <ravi@ximian.com>
18311 * expression.cs (Binary::ResolveOperator): Had forgottten to set
18312 the type of the expression to the return type of the method if
18313 we have an overloaded operator match ! The regression tests pass again !
18314 (Unary::ResolveOperator): Ditto.
18316 * expression.cs (Invocation::ConversionExists): Correct the member lookup
18317 to find "op_Implicit", not "implicit" ;-)
18318 (UserImplicitCast): New class to take care of user-defined implicit conversions.
18319 (ConvertImplicit, ForceConversion): Take TypeContainer argument
18321 * everywhere : Correct calls to the above accordingly.
18323 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
18324 (ConvertImplicit): Do user-defined conversion if it exists.
18326 2001-09-24 Miguel de Icaza <miguel@ximian.com>
18328 * assign.cs: track location.
18329 (Resolve): Use implicit conversions on assignment.
18331 * literal.cs: Oops. Not good, Emit of short access values should
18332 pass (Bytes) or the wrong argument will be selected.
18334 * expression.cs (Unary::Emit): Emit code for -expr.
18336 (Unary::ResolveOperator): Handle `Substract' for non-constants
18337 (substract from zero from the non-constants).
18338 Deal with Doubles as well.
18340 (Expression::ConvertImplicitRequired): New routine that reports an
18341 error if no implicit conversion exists.
18343 (Invocation::OverloadResolve): Store the converted implicit
18344 expressions if we make them
18346 2001-09-24 Ravi Pratap <ravi@ximian.com>
18348 * class.cs (ConstructorInitializer): Take a Location argument.
18349 (ConstructorBaseInitializer): Same here.
18350 (ConstructorThisInitializer): Same here.
18352 * cs-parser.jay : Update all calls accordingly.
18354 * expression.cs (Unary, Binary, New): Take location argument.
18355 Update accordingly everywhere.
18357 * cs-parser.jay : Update all calls to the above to take a location
18360 * class.cs : Ditto.
18362 2001-09-24 Ravi Pratap <ravi@ximian.com>
18364 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
18365 (Invocation::BetterConversion): Same here
18366 (Invocation::ConversionExists): Ditto.
18368 (Invocation::ConversionExists): Implement.
18370 2001-09-22 Ravi Pratap <ravi@ximian.com>
18372 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
18373 Also take an additional TypeContainer argument.
18375 * All over : Pass in TypeContainer as argument to OverloadResolve.
18377 * typemanager.cs (CSharpName): Update to check for the string type and return
18380 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
18383 2001-09-21 Ravi Pratap <ravi@ximian.com>
18385 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
18386 (Invocation::BetterFunction): Implement.
18387 (Invocation::BetterConversion): Implement.
18388 (Invocation::ConversionExists): Skeleton, no implementation yet.
18390 Okay, things work fine !
18392 2001-09-21 Miguel de Icaza <miguel@ximian.com>
18394 * typemanager.cs: declare and load enum_type, delegate_type and
18397 * expression.cs (Expression::Emit): Now emit returns a value that
18398 tells whether a value is left on the stack or not. This strategy
18399 might be reveted tomorrow with a mechanism that would address
18400 multiple assignments.
18401 (Expression::report118): Utility routine to report mismatches on
18404 (Unary::Report23): Report impossible type/operator combination
18407 (Unary::IsIncrementableNumber): Whether the type can be
18408 incremented or decremented with add.
18409 (Unary::ResolveOperator): Also allow enumerations to be bitwise
18411 (Unary::ResolveOperator): Implement ++, !, ~,
18413 (Invocation::Emit): Deal with new Emit convetion.
18415 * All Expression derivatives: Updated their Emit method to return
18416 whether they leave values on the stack or not.
18418 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
18419 stack for expressions that are statements.
18421 2001-09-20 Miguel de Icaza <miguel@ximian.com>
18423 * expression.cs (LValue): New interface. Must be implemented by
18425 (LocalVariableReference, ParameterReference, FieldExpr): Implement
18428 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
18429 interface for generating code, simplifies the code.
18431 2001-09-20 Ravi Pratap <ravi@ximian.com>
18433 * expression.cs (everywhere): Comment out return statements in ::Resolve
18434 methods to avoid the warnings.
18436 2001-09-20 Miguel de Icaza <miguel@ximian.com>
18438 * driver.cs (parse): Report error 2001 if we can not open the
18441 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
18444 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
18447 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
18448 otherwise nested blocks end up with the same index.
18450 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
18452 * expression.cs: Instead of having FIXMEs in the Resolve
18453 functions, throw exceptions so it is obvious that we are facing a
18456 * cs-parser.jay (invocation_expression): Pass Location information.
18458 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
18459 Use a basename for those routines because .NET does not like paths
18462 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
18465 2001-09-19 Miguel de Icaza <miguel@ximian.com>
18467 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
18468 are loading the correct data types (throws an exception if not).
18469 (TypeManager::InitCoreTypes): Use CoreLookupType
18471 * expression.cs (Unary::ResolveOperator): return the child
18472 expression for expressions which are just +expr.
18473 (Unary::ResolveOperator): Return negative literals for -LITERAL
18474 expressions (otherwise they are Unary {Literal}).
18475 (Invocation::Badness): Take into account `Implicit constant
18476 expression conversions'.
18478 * literal.cs (LongLiteral): Implement long literal class.
18479 (IntLiteral): export the `Value' of the intliteral.
18481 2001-09-19 Ravi Pratap <ravi@ximian.com>
18483 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
18485 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
18486 instead of 'Operator'
18488 * expression.cs (Binary::ResolveOperator): Update accordingly.
18489 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
18492 * cs-parser.jay (unary_expression): Update to use the new names.
18494 * gen-treedump.cs (GetUnary): Same here.
18496 * expression.cs (Unary::Resolve): Implement.
18497 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
18498 operators are found instead of making noise ;-)
18499 (Unary::ResolveOperator): New method to do precisely the same thing which
18500 Binary::ResolveOperator does for Binary expressions.
18501 (Unary.method, .Arguments): Add.
18502 (Unary::OperName): Implement.
18503 (Unary::ForceConversion): Copy and Paste !
18505 * class.cs (Operator::Define): Fix a small bug for the case when we have
18508 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
18509 for the inbuilt operators. Only overloading works for now ;-)
18511 2001-09-18 Miguel de Icaza <miguel@ximian.com>
18513 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
18514 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
18516 * expression.cs (This::Emit): Implement.
18517 (This::Resolve): Implement.
18518 (TypeOf:Resolve): Implement.
18519 (Expression::ResolveSimpleName): Add an implicit this to instance
18521 (MemberAccess::Resolve): Deal with Parameters and Fields.
18522 Bind instance variable to Field expressions.
18523 (FieldExpr::Instance): New field used to track the expression that
18524 represents the object instance.
18525 (FieldExpr::Resolve): Track potential errors from MemberLookup not
18527 (FieldExpr::Emit): Implement.
18529 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
18530 the last instruction contains a return opcode to avoid generating
18531 the last `ret' instruction (this generates correct code, and it is
18532 nice to pass the peverify output).
18534 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
18535 initializer for static and instance variables.
18536 (Constructor::Emit): Allow initializer to be null in the case of
18537 static constructors. Only emit initializer for instance
18540 (TypeContainer::FindMembers): Return a null array if there are no
18543 Also fix the code for the MemberTypes.Method branch, as it was not
18544 scanning that for operators (or tried to access null variables before).
18546 * assign.cs (Assign::Emit): Handle instance and static fields.
18550 * driver.cs: Stop compilation if there are parse errors.
18552 * cs-parser.jay (constructor_declaration): Provide default base
18553 initializer for non-static constructors.
18554 (constructor_declarator): Do not provide a default base
18555 initializers if none was specified.
18556 Catch the fact that constructors should not have parameters.
18558 * class.cs: Do not emit parent class initializers for static
18559 constructors, that should be flagged as an error.
18561 2001-09-18 Ravi Pratap <ravi@ximian.com>
18563 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
18564 Move back code into TypeContainer::Populate.
18566 2001-09-18 Ravi Pratap <ravi@ximian.com>
18568 * class.cs (TypeContainer::AddConstructor): Fix the check to
18569 compare against Name, not Basename.
18570 (Operator::OpType): Change Plus and Minus to Add and Subtract.
18572 * cs-parser.jay : Update accordingly.
18574 * class.cs (TypeContainer::FindMembers): For the case where we are searching
18575 for methods, don't forget to look into the operators too.
18576 (RegisterMethodBuilder): Helper method to take care of this for
18577 methods, constructors and operators.
18578 (Operator::Define): Completely revamp.
18579 (Operator.OperatorMethod, MethodName): New fields.
18580 (TypeContainer::Populate): Move the registering of builders into
18581 RegisterMethodBuilder.
18582 (Operator::Emit): Re-write.
18584 * expression.cs (Binary::Emit): Comment out code path to emit method
18585 invocation stuff for the case when we have a user defined operator. I am
18586 just not able to get it right !
18588 2001-09-17 Miguel de Icaza <miguel@ximian.com>
18590 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
18593 (Expression::MemberLookup): Provide a version that allows to
18594 specify the MemberTypes and BindingFlags.
18596 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
18597 so it was not fetching variable information from outer blocks.
18599 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
18600 Beforefieldinit as it was buggy.
18602 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
18603 that Ravi put here.
18605 * class.cs (Constructor::Emit): Only emit if block is not null.
18606 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
18607 deal with this by semantically definining it as if the user had
18610 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
18611 constructors as we now "emit" them at a higher level.
18613 (TypeContainer::DefineDefaultConstructor): Used to define the
18614 default constructors if none was provided.
18616 (ConstructorInitializer): Add methods Resolve and Emit.
18618 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
18620 2001-09-17 Ravi Pratap <ravi@ximian.com>
18622 * class.cs (TypeContainer::EmitDefaultConstructor): Register
18623 the default constructor builder with our hashtable for methodbuilders
18626 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
18627 and argument_count is 0 in which case we have a match.
18628 (Binary::ResolveOperator): More null checking and miscellaneous coding
18631 2001-09-17 Ravi Pratap <ravi@ximian.com>
18633 * rootcontext.cs (IsNameSpace): Compare against null.
18635 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
18637 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
18638 and Unary::Operator.
18640 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
18643 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
18644 we have overloaded operators.
18645 (Binary::ResolveOperator): Implement the part which does the operator overload
18648 * class.cs (Operator::Emit): Implement.
18649 (TypeContainer::Emit): Emit the operators we have too.
18651 * expression.cs (Binary::Emit): Update to emit the appropriate code for
18652 the case when we have a user-defined operator.
18654 2001-09-17 Miguel de Icaza <miguel@ximian.com>
18656 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
18658 2001-09-16 Ravi Pratap <ravi@ximian.com>
18660 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
18661 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
18662 (Constructor::Emit): Implement.
18663 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
18664 if we have no work to do.
18665 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
18668 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
18669 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
18671 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
18674 2001-09-15 Ravi Pratap <ravi@ximian.com>
18676 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
18678 (Tree::RecordNamespace): Method to do what the name says ;-)
18679 (Tree::Namespaces): Property to get at the namespaces hashtable.
18681 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
18684 * rootcontext.cs (IsNamespace): Fixed it :-)
18686 2001-09-14 Miguel de Icaza <miguel@ximian.com>
18688 * class.cs (TypeContainer::FindMembers): Add support for
18690 (MethodCore): New class that encapsulates both the shared aspects
18691 of a Constructor and a Method.
18692 (Method, Constructor): Factored pieces into MethodCore.
18694 * driver.cs: Added --fatal which makes errors throw exceptions.
18695 Load System assembly as well as part of the standard library.
18697 * report.cs: Allow throwing exceptions on errors for debugging.
18699 * modifiers.cs: Do not use `parent', instead use the real type
18700 container to evaluate permission settings.
18702 * class.cs: Put Ravi's patch back in. He is right, and we will
18703 have to cope with the
18705 2001-09-14 Ravi Pratap <ravi@ximian.com>
18707 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
18708 FamORAssem, not FamANDAssem.
18710 2001-09-14 Miguel de Icaza <miguel@ximian.com>
18712 * driver.cs: Added --parse option that only parses its input files
18715 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
18716 incorrect. IsTopLevel is not used to tell whether an object is
18717 root_types or not (that can be achieved by testing this ==
18718 root_types). But to see if this is a top-level *class* (not
18719 necessarly our "toplevel" container).
18721 2001-09-14 Ravi Pratap <ravi@ximian.com>
18723 * enum.cs (Enum::Define): Modify to call the Lookup method on the
18724 parent instead of a direct call to GetType.
18726 2001-09-14 Ravi Pratap <ravi@ximian.com>
18728 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
18729 Modifiers.TypeAttr. This should just be a call to that method.
18731 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
18732 object so that we can determine if we are top-level or not.
18734 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
18737 * enum.cs (Enum::Define): Ditto.
18739 * modifiers.cs (FieldAttr): Re-write.
18741 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
18742 (TypeContainer::HaveStaticConstructor): New property to provide access
18743 to precisely that info.
18745 * modifiers.cs (MethodAttr): Re-write.
18746 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
18748 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
18749 of top-level types as claimed.
18751 2001-09-13 Miguel de Icaza <miguel@ximian.com>
18753 * expression.cs (MemberLookup): Fruitless attempt to lookup
18754 constructors. Maybe I need to emit default constructors? That
18755 might be it (currently .NET emits this for me automatically).
18756 (Invocation::OverloadResolve): Cope with Arguments == null.
18757 (Invocation::EmitArguments): new function, shared by the new
18758 constructor and us.
18759 (Invocation::Emit): Handle static and instance methods. Emit
18760 proper call instruction for virtual or non-virtual invocations.
18761 (New::Emit): Implement.
18762 (New::Resolve): Implement.
18763 (MemberAccess:Resolve): Implement.
18764 (MethodGroupExpr::InstanceExpression): used conforming to the spec
18765 to track instances.
18766 (FieldExpr::Resolve): Set type.
18768 * support.cs: Handle empty arguments.
18770 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
18771 SimpleLookup): Auxiliary routines to help parse a qualifier
18774 Update qualifier_identifier rule.
18776 * codegen.cs: Removed debugging messages.
18778 * class.cs: Make this a global thing, this acts just as a "key" to
18779 objects that we might have around.
18781 (Populate): Only initialize method_builders_to_methods once.
18783 * expression.cs (PropertyExpr): Initialize type from the
18786 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
18787 Resolve pattern. Attempt to implicitly convert value to boolean.
18790 * expression.cs: Set the type for the int32/int32 argument case.
18791 (Binary::ResolveOperator): Set the return type to boolean for
18792 comparission operators
18794 * typemanager.cs: Remove debugging print code.
18796 (Invocation::Resolve): resolve type.
18798 * class.cs: Allocate a MemberInfo of the correct size, as the code
18799 elsewhere depends on the test to reflect the correct contents.
18801 (Method::) Keep track of parameters, due to System.Reflection holes
18803 (TypeContainer::Populate): Keep track of MethodBuilders to Method
18806 (TypeContainer::FindMembers): Use ArrayList and then copy an array
18807 of the exact size and return that.
18809 (Class::LookupMethodByBuilder): New function that maps
18810 MethodBuilders to its methods. Required to locate the information
18811 on methods because System.Reflection bit us again.
18813 * support.cs: New file, contains an interface ParameterData and
18814 two implementations: ReflectionParameters and InternalParameters
18815 used to access Parameter information. We will need to grow this
18818 * expression.cs (Invocation::GetParameterData): implement a cache
18819 and a wrapper around the ParameterData creation for methods.
18820 (Invocation::OverloadResolve): Use new code.
18822 2001-09-13 Ravi Pratap <ravi@ximian.com>
18824 * class.cs (TypeContainer::EmitField): Remove and move into
18825 (Field::Define): here and modify accordingly.
18826 (Field.FieldBuilder): New member.
18827 (TypeContainer::Populate): Update accordingly.
18828 (TypeContainer::FindMembers): Implement.
18830 2001-09-13 Miguel de Icaza <miguel@ximian.com>
18832 * statement.cs: (VariableInfo::VariableType): New field to be
18833 initialized with the full type once it is resolved.
18835 2001-09-12 Miguel de Icaza <miguel@ximian.com>
18837 * parameter.cs (GetParameterInfo): Use a type cache to compute
18838 things only once, and to reuse this information
18840 * expression.cs (LocalVariableReference::Emit): Implement.
18841 (OpcodeCast::Emit): fix.
18843 (ParameterReference::Resolve): Implement.
18844 (ParameterReference::Emit): Implement.
18846 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
18847 that are expressions need to stay as Expressions.
18849 * typemanager.cs (CSharpName): Returns the C# name of a type if
18852 * expression.cs (Expression::ConvertImplicit): New function that
18853 implements implicit type conversions.
18855 (Expression::ImplicitReferenceConversion): Implements implicit
18856 reference conversions.
18858 (EmptyCast): New type for transparent casts.
18860 (OpcodeCast): New type for casts of types that are performed with
18861 a sequence of bytecodes.
18863 (BoxedCast): New type used for casting value types into reference
18864 types. Emits a box opcode.
18866 (Binary::DoNumericPromotions): Implements numeric promotions of
18867 and computation of the Binary::Type.
18869 (Binary::EmitBranchable): Optimization.
18871 (Binary::Emit): Implement code emission for expressions.
18873 * typemanager.cs (TypeManager): Added two new core types: sbyte
18876 2001-09-12 Ravi Pratap <ravi@ximian.com>
18878 * class.cs (TypeContainer::FindMembers): Method which does exactly
18879 what Type.FindMembers does, only we don't have to use reflection. No
18880 implementation yet.
18882 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
18883 typecontainer objects as we need to get at them.
18884 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
18886 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
18887 typecontainer object.
18889 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
18890 of just a Report object.
18892 2001-09-11 Ravi Pratap <ravi@ximian.com>
18894 * class.cs (Event::Define): Go back to using the prefixes "add_" and
18896 (TypeContainer::Populate): Now define the delegates of the type too.
18897 (TypeContainer.Delegates): Property to access the list of delegates defined
18900 * delegates.cs (Delegate::Define): Implement partially.
18902 * modifiers.cs (TypeAttr): Handle more flags.
18904 2001-09-11 Ravi Pratap <ravi@ximian.com>
18906 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
18908 (Operator::Define): Re-write logic to get types by using the LookupType method
18909 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
18910 (Indexer::Define): Ditto.
18911 (Event::Define): Ditto.
18912 (Property::Define): Ditto.
18914 2001-09-10 Ravi Pratap <ravi@ximian.com>
18916 * class.cs (TypeContainer::Populate): Now define operators too.
18917 (TypeContainer.Operators): New property to access the list of operators
18919 (Operator.OperatorMethodBuilder): New member to hold the method builder
18920 for the operator we are defining.
18921 (Operator::Define): Implement.
18923 2001-09-10 Ravi Pratap <ravi@ximian.com>
18925 * class.cs (Event::Define): Make the prefixes of the accessor methods
18926 addOn_ and removeOn_
18928 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
18929 of the location being passed in too. Ideally, this should go later since all
18930 error reporting should be done through the Report object.
18932 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
18933 (Populate): Iterate thru the indexers we have and define them too.
18934 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
18935 for the get and set accessors.
18936 (Indexer::Define): Implement.
18938 2001-09-09 Miguel de Icaza <miguel@ximian.com>
18940 * expression.cs (Binary::Resolve): Beginning of it. I scratched
18941 my previous implementation, did not work.
18943 * typemanager.cs: Add a couple of missing types (the longs).
18945 * literal.cs: Use TypeManager.bool_type instead of getting it.
18947 * expression.cs (EventExpr): New kind of expressions.
18948 (Expressio::ExprClassFromMemberInfo): finish
18950 2001-09-08 Miguel de Icaza <miguel@ximian.com>
18952 * assign.cs: Emit stores to static fields differently.
18954 2001-09-08 Ravi Pratap <ravi@ximian.com>
18956 * Merge in changes and adjust code to tackle conflicts. Backed out my
18957 code in Assign::Resolve ;-)
18959 2001-09-08 Ravi Pratap <ravi@ximian.com>
18961 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
18962 instead Report.Error and also pass in the location.
18963 (CSharpParser::Lexer): New readonly property to return the reference
18964 to the Tokenizer object.
18965 (declare_local_variables): Use Report.Error with location instead of plain
18969 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
18970 (Operator.CheckBinaryOperator): Ditto.
18972 * cs-parser.jay (operator_declarator): Update accordingly.
18974 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
18975 (CheckBinaryOperator): Same here.
18977 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
18978 on the name without any prefixes of namespace names etc. This is because we
18979 already might have something already fully qualified like
18980 'System.Console.WriteLine'
18982 * assign.cs (Resolve): Begin implementation. Stuck ;-)
18984 2001-09-07 Ravi Pratap <ravi@ximian.com>
18986 * cs-tokenizer.cs (location): Return a string which also contains
18989 * expression.cs (ElementAccess): New class for expressions of the
18990 type 'element access.'
18991 (BaseAccess): New class for expressions of the type 'base access.'
18992 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
18995 * cs-parser.jay (element_access): Implement action.
18996 (base_access): Implement actions.
18997 (checked_expression, unchecked_expression): Implement.
18999 * cs-parser.jay (local_variable_type): Correct and implement.
19000 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
19002 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
19004 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
19005 name and the specifiers.
19007 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
19009 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
19010 making them all public ;-)
19012 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
19015 2001-09-07 Miguel de Icaza <miguel@ximian.com>
19017 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
19019 (FieldExpr, PropertyExprs): New resolved expressions.
19020 (SimpleName::MemberStaticCheck): Perform static checks for access
19021 to non-static fields on static methods. Maybe this should be
19022 generalized for MemberAccesses.
19023 (SimpleName::ResolveSimpleName): More work on simple name
19026 * cs-parser.jay (primary_expression/qualified_identifier): track
19027 the parameter index.
19029 * codegen.cs (CodeGen::Save): Catch save exception, report error.
19030 (EmitContext::EmitBoolExpression): Chain to expression generation
19031 instead of temporary hack.
19032 (::EmitStatementExpression): Put generic expression code generation.
19034 * assign.cs (Assign::Emit): Implement variable assignments to
19035 local variables, parameters and fields.
19037 2001-09-06 Miguel de Icaza <miguel@ximian.com>
19039 * statement.cs (Block::GetVariableInfo): New method, returns the
19040 VariableInfo for a variable name in a block.
19041 (Block::GetVariableType): Implement in terms of GetVariableInfo
19043 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
19044 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
19046 2001-09-06 Ravi Pratap <ravi@ximian.com>
19048 * cs-parser.jay (operator_declaration): Continue on my quest : update
19049 to take attributes argument.
19050 (event_declaration): Ditto.
19051 (enum_declaration): Ditto.
19052 (indexer_declaration): Ditto.
19054 * class.cs (Operator::Operator): Update constructor accordingly.
19055 (Event::Event): Ditto.
19057 * delegate.cs (Delegate::Delegate): Same here.
19059 * enum.cs (Enum::Enum): Same here.
19061 2001-09-05 Ravi Pratap <ravi@ximian.com>
19063 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
19065 * ../tests/cs0658.cs : New file to demonstrate error 0658.
19067 * attribute.cs (Attributes): New class to encapsulate all attributes which were
19068 being passed around as an arraylist.
19069 (Attributes::AddAttribute): Method to add attribute sections.
19071 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
19072 (struct_declaration): Update accordingly.
19073 (constant_declaration): Update.
19074 (field_declaration): Update.
19075 (method_header): Update.
19076 (fixed_parameter): Update.
19077 (parameter_array): Ditto.
19078 (property_declaration): Ditto.
19079 (destructor_declaration): Ditto.
19081 * class.cs (Struct::Struct): Update constructors accordingly.
19082 (Class::Class): Ditto.
19083 (Field::Field): Ditto.
19084 (Method::Method): Ditto.
19085 (Property::Property): Ditto.
19086 (TypeContainer::OptAttribute): update property's return type.
19088 * interface.cs (Interface.opt_attributes): New member.
19089 (Interface::Interface): Update to take the extra Attributes argument.
19091 * parameter.cs (Parameter::Parameter): Ditto.
19093 * constant.cs (Constant::Constant): Ditto.
19095 * interface.cs (InterfaceMemberBase): New OptAttributes field.
19096 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
19097 the attributes as a parameter.
19098 (InterfaceProperty): Update constructor call.
19099 (InterfaceEvent): Ditto.
19100 (InterfaceMethod): Ditto.
19101 (InterfaceIndexer): Ditto.
19103 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
19104 pass the attributes too.
19105 (interface_event_declaration): Ditto.
19106 (interface_property_declaration): Ditto.
19107 (interface_method_declaration): Ditto.
19108 (interface_declaration): Ditto.
19110 2001-09-05 Miguel de Icaza <miguel@ximian.com>
19112 * class.cs (Method::Define): Track the "static Main" definition to
19113 create an entry point.
19115 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
19116 EntryPoint if we find it.
19118 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
19119 (EmitContext::ig): Make this variable public.
19121 * driver.cs: Make the default output file be the first file name
19122 with the .exe extension.
19124 Detect empty compilations
19126 Handle various kinds of output targets. Handle --target and
19127 rename -t to --dumper.
19129 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
19130 methods inherited from Expression return now an Expression. This
19131 will is used during the tree rewriting as we resolve them during
19134 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
19135 the spec. Missing entirely is the information about
19136 accessability of elements of it.
19138 (Expression::ExprClassFromMemberInfo): New constructor for
19139 Expressions that creates a fully initialized Expression based on
19140 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
19143 (Invocation::Resolve): Begin implementing resolution of invocations.
19145 * literal.cs (StringLiteral): Implement Emit.
19147 2001-09-05 Ravi Pratap <ravi@ximian.com>
19149 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
19152 2001-09-04 Ravi Pratap <ravi@ximian.com>
19154 * cs-parser.jay (attribute_arguments): Implement actions.
19155 (attribute): Fix bug in production. Implement action.
19156 (attribute_list): Implement.
19157 (attribute_target): Implement.
19158 (attribute_target_specifier, opt_target_specifier): Implement
19159 (CheckAttributeTarget): New method to check if the attribute target
19161 (attribute_section): Implement.
19162 (opt_attributes): Implement.
19164 * attribute.cs : New file to handle attributes.
19165 (Attribute): Class to hold attribute info.
19167 * cs-parser.jay (opt_attribute_target_specifier): Remove production
19168 (attribute_section): Modify production to use 2 different rules to
19169 achieve the same thing. 1 s/r conflict down !
19170 Clean out commented, useless, non-reducing dimension_separator rules.
19172 * class.cs (TypeContainer.attributes): New member to hold list
19173 of attributes for a type.
19174 (Struct::Struct): Modify to take one more argument, the attribute list.
19175 (Class::Class): Ditto.
19176 (Field::Field): Ditto.
19177 (Method::Method): Ditto.
19178 (Property::Property): Ditto.
19180 * cs-parser.jay (struct_declaration): Update constructor call to
19181 pass in the attributes too.
19182 (class_declaration): Ditto.
19183 (constant_declaration): Ditto.
19184 (field_declaration): Ditto.
19185 (method_header): Ditto.
19186 (fixed_parameter): Ditto.
19187 (parameter_array): Ditto.
19188 (property_declaration): Ditto.
19190 * constant.cs (Constant::Constant): Update constructor similarly.
19191 Use System.Collections.
19193 * parameter.cs (Parameter::Parameter): Update as above.
19195 2001-09-02 Ravi Pratap <ravi@ximian.com>
19197 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
19198 (TypeContainer.delegates): New member to hold list of delegates.
19200 * cs-parser.jay (delegate_declaration): Implement the action correctly
19201 this time as I seem to be on crack ;-)
19203 2001-09-02 Miguel de Icaza <miguel@ximian.com>
19205 * rootcontext.cs (RootContext::IsNamespace): new function, used to
19206 tell whether an identifier represents a namespace.
19208 * expression.cs (NamespaceExpr): A namespace expression, used only
19209 temporarly during expression resolution.
19210 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
19211 utility functions to resolve names on expressions.
19213 2001-09-01 Miguel de Icaza <miguel@ximian.com>
19215 * codegen.cs: Add hook for StatementExpressions.
19217 * class.cs: Fix inverted test for static flag in methods.
19219 2001-09-02 Ravi Pratap <ravi@ximian.com>
19221 * class.cs (Operator::CheckUnaryOperator): Correct error number used
19222 to make it coincide with MS' number.
19223 (Operator::CheckBinaryOperator): Ditto.
19225 * ../errors/errors.txt : Remove error numbers added earlier.
19227 * ../errors/cs1019.cs : Test case for error # 1019
19229 * ../errros/cs1020.cs : Test case for error # 1020
19231 * cs-parser.jay : Clean out commented cruft.
19232 (dimension_separators, dimension_separator): Comment out. Ostensibly not
19233 used anywhere - non-reducing rule.
19234 (namespace_declarations): Non-reducing rule - comment out.
19236 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
19237 with TypeContainer::AddEnum.
19239 * delegate.cs : New file for delegate handling classes.
19240 (Delegate): Class for declaring delegates.
19242 * makefile : Update.
19244 * cs-parser.jay (delegate_declaration): Implement.
19246 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
19248 * class.cs (Event::Define): Implement.
19249 (Event.EventBuilder): New member.
19251 * class.cs (TypeContainer::Populate): Update to define all enums and events
19253 (Events): New property for the events arraylist we hold. Shouldn't we move to using
19254 readonly fields for all these cases ?
19256 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
19258 * class.cs (Property): Revamp to use the convention of making fields readonly.
19259 Accordingly modify code elsewhere.
19261 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
19262 the Define method of the Property class.
19264 * class.cs : Clean up applied patch and update references to variables etc. Fix
19266 (TypeContainer::Populate): Update to define all the properties we have. Also
19267 define all enumerations.
19269 * enum.cs (Define): Implement.
19271 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
19273 * cs-parser.jay (overloadable_operator): The semantic value is an
19274 enum of the Operator class.
19275 (operator_declarator): Implement actions.
19276 (operator_declaration): Implement.
19278 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
19279 validity of definitions.
19280 (Operator::CheckBinaryOperator): Static method to check for binary operators
19281 (TypeContainer::AddOperator): New method to add an operator to a type.
19283 * cs-parser.jay (indexer_declaration): Added line to actually call the
19284 AddIndexer method so it gets added ;-)
19286 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
19287 already taken care of by the MS compiler ?
19289 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
19291 * class.cs (Operator): New class for operator declarations.
19292 (Operator::OpType): Enum for the various operators.
19294 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
19296 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
19297 ostensibly handle this in semantic analysis.
19299 * cs-parser.jay (general_catch_clause): Comment out
19300 (specific_catch_clauses, specific_catch_clause): Ditto.
19301 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
19302 (catch_args, opt_catch_args): New productions.
19303 (catch_clause): Rewrite to use the new productions above
19304 (catch_clauses): Modify accordingly.
19305 (opt_catch_clauses): New production to use in try_statement
19306 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
19307 and re-write the code in the actions to extract the specific and
19308 general catch clauses by being a little smart ;-)
19310 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
19311 Hooray, try and catch statements parse fine !
19313 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19315 * statement.cs (Block::GetVariableType): Fix logic to extract the type
19316 string from the hashtable of variables.
19318 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
19319 I end up making that mistake ;-)
19320 (catch_clauses): Fixed gross error which made Key and Value of the
19321 DictionaryEntry the same : $1 !!
19323 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19325 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
19327 * cs-parser.jay (event_declaration): Correct to remove the semicolon
19328 when the add and remove accessors are specified.
19330 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19332 * cs-parser.jay (IndexerDeclaration): New helper class to hold
19333 information about indexer_declarator.
19334 (indexer_declarator): Implement actions.
19335 (parsing_indexer): New local boolean used to keep track of whether
19336 we are parsing indexers or properties. This is necessary because
19337 implicit_parameters come into picture even for the get accessor in the
19338 case of an indexer.
19339 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
19341 * class.cs (Indexer): New class for indexer declarations.
19342 (TypeContainer::AddIndexer): New method to add an indexer to a type.
19343 (TypeContainer::indexers): New member to hold list of indexers for the
19346 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
19348 * cs-parser.jay (add_accessor_declaration): Implement action.
19349 (remove_accessor_declaration): Implement action.
19350 (event_accessors_declaration): Implement
19351 (variable_declarators): swap statements for first rule - trivial.
19353 * class.cs (Event): New class to hold information about event
19355 (TypeContainer::AddEvent): New method to add an event to a type
19356 (TypeContainer::events): New member to hold list of events.
19358 * cs-parser.jay (event_declaration): Implement actions.
19360 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
19362 * cs-parser.jay (dim_separators): Implement. Make it a string
19363 concatenating all the commas together, just as they appear.
19364 (opt_dim_separators): Modify accordingly
19365 (rank_specifiers): Update accordingly. Basically do the same
19366 thing - instead, collect the brackets here.
19367 (opt_rank_sepcifiers): Modify accordingly.
19368 (array_type): Modify to actually return the complete type string
19369 instead of ignoring the rank_specifiers.
19370 (expression_list): Implement to collect the expressions
19371 (variable_initializer): Implement. We make it a list of expressions
19372 essentially so that we can handle the array_initializer case neatly too.
19373 (variable_initializer_list): Implement.
19374 (array_initializer): Make it a list of variable_initializers
19375 (opt_array_initializer): Modify accordingly.
19377 * expression.cs (New::NType): Add enumeration to help us
19378 keep track of whether we have an object/delegate creation
19379 or an array creation.
19380 (New:NewType, New::Rank, New::Indices, New::Initializers): New
19381 members to hold data about array creation.
19382 (New:New): Modify to update NewType
19383 (New:New): New Overloaded contructor for the array creation
19386 * cs-parser.jay (array_creation_expression): Implement to call
19387 the overloaded New constructor.
19389 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
19391 * class.cs (TypeContainer::Constructors): Return member
19392 constructors instead of returning null.
19394 2001-08-26 Miguel de Icaza <miguel@ximian.com>
19396 * typemanager.cs (InitCoreTypes): Initialize the various core
19397 types after we have populated the type manager with the user
19398 defined types (this distinction will be important later while
19399 compiling corlib.dll)
19401 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
19402 on Expression Classification. Now all expressions have a method
19403 `Resolve' and a method `Emit'.
19405 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
19406 generation from working. Also add some temporary debugging
19409 2001-08-24 Miguel de Icaza <miguel@ximian.com>
19411 * codegen.cs: Lots of code generation pieces. This is only the
19412 beginning, will continue tomorrow with more touches of polish. We
19413 handle the fundamentals of if, while, do, for, return. Others are
19414 trickier and I need to start working on invocations soon.
19416 * gen-treedump.cs: Bug fix, use s.Increment here instead of
19419 * codegen.cs (EmitContext): New struct, used during code
19420 emission to keep a context. Most of the code generation will be
19423 * cs-parser.jay: Add embedded blocks to the list of statements of
19424 this block. So code generation proceeds in a top down fashion.
19426 2001-08-23 Miguel de Icaza <miguel@ximian.com>
19428 * statement.cs: Add support for multiple child blocks.
19430 2001-08-22 Miguel de Icaza <miguel@ximian.com>
19432 * codegen.cs (EmitCode): New function, will emit the code for a
19433 Block of code given a TypeContainer and its ILGenerator.
19435 * statement.cs (Block): Standard public readonly optimization.
19436 (Block::Block constructors): Link children.
19437 (Block::Child): Child Linker.
19438 (Block::EmitVariables): Emits IL variable declarations.
19440 * class.cs: Drop support for MethodGroups here, delay until
19442 (Method::): Applied the same simplification that I did before, and
19443 move from Properties to public readonly fields.
19444 (Method::ParameterTypes): Returns the parameter types for the
19445 function, and implements a cache that will be useful later when I
19446 do error checking and the semantic analysis on the methods is
19448 (Constructor::GetCallingConvention): Renamed from CallingConvetion
19449 and made a method, optional argument tells whether this is a class
19450 or a structure to apply the `has-this' bit.
19451 (Method::GetCallingConvention): Implement, returns the calling
19453 (Method::Define): Defines the type, a second pass is performed
19454 later to populate the methods.
19456 (Constructor::ParameterTypes): implement a cache similar to the
19457 one on Method::ParameterTypes, useful later when we do semantic
19460 (TypeContainer::EmitMethod): New method. Emits methods.
19462 * expression.cs: Removed MethodGroup class from here.
19464 * parameter.cs (Parameters::GetCallingConvention): new method.
19466 2001-08-21 Miguel de Icaza <miguel@ximian.com>
19468 * class.cs (TypeContainer::Populate): Drop RootContext from the
19471 (Constructor::CallingConvention): Returns the calling convention.
19472 (Constructor::ParameterTypes): Returns the constructor parameter
19475 (TypeContainer::AddConstructor): Keep track of default constructor
19476 and the default static constructor.
19478 (Constructor::) Another class that starts using `public readonly'
19479 instead of properties.
19481 (Constructor::IsDefault): Whether this is a default constructor.
19483 (Field::) use readonly public fields instead of properties also.
19485 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
19486 track of static constructors; If none is used, turn on
19487 BeforeFieldInit in the TypeAttributes.
19489 * cs-parser.jay (opt_argument_list): now the return can be null
19490 for the cases where there are no arguments.
19492 (constructor_declarator): If there is no implicit `base' or
19493 `this', then invoke the default parent constructor.
19495 * modifiers.cs (MethodAttr): New static function maps a set of
19496 modifiers flags into a MethodAttributes enum
19497 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
19498 MethodAttr, TypeAttr to represent the various mappings where the
19499 modifiers are used.
19500 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
19502 2001-08-19 Miguel de Icaza <miguel@ximian.com>
19504 * parameter.cs (GetParameterInfo): Fix bug where there would be no
19507 * interface.cs (PopulateIndexer): Implemented the code generator
19508 for interface indexers.
19510 2001-08-17 Miguel de Icaza <miguel@ximian.com>
19512 * interface.cs (InterfaceMemberBase): Now we track the new status
19515 (PopulateProperty): Implement property population. Woohoo! Got
19516 Methods and Properties going today.
19518 Removed all the properties for interfaces, and replaced them with
19519 `public readonly' fields.
19521 2001-08-16 Miguel de Icaza <miguel@ximian.com>
19523 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
19524 initialize their hashtables/arraylists only when they are needed
19525 instead of doing this always.
19527 * parameter.cs: Handle refs and out parameters.
19529 * cs-parser.jay: Use an ArrayList to construct the arguments
19530 instead of the ParameterCollection, and then cast that to a
19533 * parameter.cs: Drop the use of ParameterCollection and use
19534 instead arrays of Parameters.
19536 (GetParameterInfo): Use the Type, not the Name when resolving
19539 2001-08-13 Miguel de Icaza <miguel@ximian.com>
19541 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
19542 and instead use public readonly fields.
19544 * class.cs: Put back walking code for type containers.
19546 2001-08-11 Miguel de Icaza <miguel@ximian.com>
19548 * class.cs (MakeConstant): Code to define constants.
19550 * rootcontext.cs (LookupType): New function. Used to locate types
19553 2001-08-08 Miguel de Icaza <miguel@ximian.com>
19555 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
19556 this System.Reflection code is. Kudos to Microsoft
19558 * typemanager.cs: Implement a type cache and avoid loading all
19559 types at boot time. Wrap in LookupType the internals. This made
19560 the compiler so much faster. Wow. I rule!
19562 * driver.cs: Make sure we always load mscorlib first (for
19563 debugging purposes, nothing really important).
19565 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
19566 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
19568 * rootcontext.cs: Lookup types on their namespace; Lookup types
19569 on namespaces that have been imported using the `using' keyword.
19571 * class.cs (TypeContainer::TypeAttr): Virtualize.
19572 (Class::TypeAttr): Return attributes suitable for this bad boy.
19573 (Struct::TypeAttr): ditto.
19574 Handle nested classes.
19575 (TypeContainer::) Remove all the type visiting code, it is now
19576 replaced with the rootcontext.cs code
19578 * rootcontext.cs (GetClassBases): Added support for structs.
19580 2001-08-06 Miguel de Icaza <miguel@ximian.com>
19582 * interface.cs, statement.cs, class.cs, parameter.cs,
19583 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
19584 Drop use of TypeRefs, and use strings instead.
19586 2001-08-04 Miguel de Icaza <miguel@ximian.com>
19590 * class.cs (Struct::Struct): set the SEALED flags after
19591 checking the modifiers.
19592 (TypeContainer::TypeAttr): new property, returns the
19593 TypeAttributes for a class.
19595 * cs-parser.jay (type_list): Oops, list production was creating a
19596 new list of base types.
19598 * rootcontext.cs (StdLib): New property.
19599 (GetInterfaceTypeByName): returns an interface by type name, and
19600 encapsulates error handling here.
19601 (GetInterfaces): simplified.
19602 (ResolveTree): Encapsulated all the tree resolution here.
19603 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
19606 * driver.cs: Add support for --nostdlib, to avoid loading the
19607 default assemblies.
19608 (Main): Do not put tree resolution here.
19610 * rootcontext.cs: Beginning of the class resolution.
19612 2001-08-03 Miguel de Icaza <miguel@ximian.com>
19614 * rootcontext.cs: Provide better error reporting.
19616 * cs-parser.jay (interface_base): set our $$ to be interfaces.
19618 * rootcontext.cs (CreateInterface): Handle the case where there
19619 are no parent interfaces.
19621 (CloseTypes): Routine to flush types at the end.
19622 (CreateInterface): Track types.
19623 (GetInterfaces): Returns an array of Types from the list of
19624 defined interfaces.
19626 * typemanager.c (AddUserType): Mechanism to track user types (puts
19627 the type on the global type hash, and allows us to close it at the
19630 2001-08-02 Miguel de Icaza <miguel@ximian.com>
19632 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
19633 RecordInterface instead.
19635 * cs-parser.jay: Updated to reflect changes above.
19637 * decl.cs (Definition): Keep track of the TypeBuilder type that
19638 represents this type here. Not sure we will use it in the long
19639 run, but wont hurt for now.
19641 * driver.cs: Smaller changes to accomodate the new code.
19643 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
19646 * rootcontext.cs (CreateInterface): New method, used to create
19647 the System.TypeBuilder type for interfaces.
19648 (ResolveInterfaces): new entry point to resolve the interface
19650 (CodeGen): Property, used to keep track of the code generator.
19652 2001-07-26 Miguel de Icaza <miguel@ximian.com>
19654 * cs-parser.jay: Add a second production for delegate_declaration
19657 (enum_body): Put an opt_comma here instead of putting it on
19658 enum_body or enum_member_declarations so we can handle trailing
19659 commas on enumeration members. Gets rid of a shift/reduce.
19661 (type_list): Need a COMMA in the middle.
19663 (indexer_declaration): Tell tokenizer to recognize get/set
19665 * Remove old targets.
19667 * Re-add the parser target.
19669 2001-07-13 Simon Cozens <simon@simon-cozens.org>
19671 * cs-parser.jay: Add precendence rules for a number of operators
19672 ot reduce the number of shift/reduce conflicts in the grammar.
19674 2001-07-17 Miguel de Icaza <miguel@ximian.com>
19676 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
19679 Get rid of old crufty code.
19681 * rootcontext.cs: Use this to keep track of the parsed
19682 representation and the defined types available to the program.
19684 * gen-treedump.cs: adjust for new convention.
19686 * type.cs: Split out the type manager, and the assembly builder
19689 * typemanager.cs: the type manager will live here now.
19691 * cil-codegen.cs: And the code generator here.
19693 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
19695 * makefile: Fixed up for easy making.
19697 2001-07-13 Simon Cozens <simon@simon-cozens.org>
19699 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
19702 (unary_expression): Expand pre_increment_expression and
19703 post_decrement_expression to reduce a shift/reduce.
19705 2001-07-11 Simon Cozens
19707 * cs-tokenizer.cs: Hex numbers should begin with a 0.
19709 Improve allow_keyword_as_indent name.
19711 2001-06-19 Miguel de Icaza <miguel@ximian.com>
19713 * Adjustments for Beta2.
19715 2001-06-13 Miguel de Icaza <miguel@ximian.com>
19717 * decl.cs: Added `Define' abstract method.
19718 (InTransit): new property, used to catch recursive definitions.
19720 * interface.cs: Implement `Define'.
19722 * modifiers.cs: Map Modifiers.constants to
19723 System.Reflection.TypeAttribute flags.
19725 * class.cs: Keep track of types and user-defined types.
19726 (BuilderInit): New method for creating an assembly
19727 (ResolveType): New function to launch the resolution process, only
19728 used by interfaces for now.
19730 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
19731 that are inserted into the name space.
19733 2001-06-08 Miguel de Icaza <miguel@ximian.com>
19735 * ARGH. I have screwed up my tree so many times due to the use of
19736 rsync rather than using CVS. Going to fix this at once.
19738 * driver.cs: Objetify driver. Load assemblies, use assemblies to
19741 2001-06-07 Miguel de Icaza <miguel@ximian.com>
19743 * Experiment successful: Use System.Type rather that our own
19746 2001-05-25 Miguel de Icaza <miguel@ximian.com>
19748 * cs-parser.jay: Removed nsAliases from here.
19750 Use new namespaces, handle `using XXX;'
19752 * namespace.cs: Reimplemented namespace handling, use a recursive
19753 definition of the class. Now we can keep track of using clauses
19754 and catch invalid using clauses.
19756 2001-05-24 Miguel de Icaza <miguel@ximian.com>
19758 * gen-treedump.cs: Adapted for all the renaming.
19760 * expression.cs (Expression): this class now has a Type property
19761 which returns an expression Type.
19763 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
19764 `Type', as this has a different meaning now in the base
19766 2001-05-22 Miguel de Icaza <miguel@ximian.com>
19768 * interface.cs, class.cs: Removed from all the sources the
19769 references to signature computation, as we can not do method
19770 signature computation during the parsing time, as we are not
19771 trying to solve at that point distinguishing:
19775 void a (NS.Blah x) {}
19778 Which depending on the context might be valid or not, as we do not
19779 know if Blah is the same thing as NS.Blah at that point.
19781 * Redid everything so the code uses TypeRefs now instead of
19782 Types. TypeRefs are just temporary type placeholders, that need
19783 to be resolved. They initially have a pointer to a string and the
19784 current scope in which they are used. This is used later by the
19785 compiler to resolve the reference to an actual Type.
19787 * DeclSpace is no longer a CIR.Type, and neither are
19788 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
19789 are all DeclSpaces, but no Types.
19791 * type.cs (TypeRefManager): This implements the TypeRef manager,
19792 which keeps track of all the types that need to be resolved after
19793 the parsing has finished.
19795 2001-05-13 Miguel de Icaza <miguel@ximian.com>
19797 * ARGH. We are going to have to store `foreach' as a class rather
19798 than resolving it, as we need to verify error 1579 after name
19799 resolution. *OR* we could keep a flag that says `This request to
19800 IEnumerator comes from a foreach statement' which we can then use
19801 to generate the error.
19803 2001-05-10 Miguel de Icaza <miguel@ximian.com>
19805 * class.cs (TypeContainer.AddMethod): we now add methods to the
19806 MethodGroup instead of the method hashtable.
19808 * expression.cs: Add MethodGroup abstraction, which gets us one
19809 step closer to the specification in the way we handle method
19812 * cs-parser.jay (primary_expression): qualified_identifier now
19813 tried to match up an identifier to a local variable reference or
19814 to a parameter reference.
19816 current_local_parameters is now a parser global variable that
19817 points to the current parameters for the block, used during name
19820 (property_declaration): Now creates an implicit `value' argument to
19823 2001-05-09 Miguel de Icaza <miguel@ximian.com>
19825 * parameter.cs: Do not use `param' arguments as part of the
19826 signature, per the spec.
19828 2001-05-08 Miguel de Icaza <miguel@ximian.com>
19830 * decl.cs: Base class for classes, structs and interfaces. This
19831 is the "Declaration Space"
19833 * cs-parser.jay: Use CheckDef for checking declaration errors
19834 instead of having one on each function.
19836 * class.cs: Factor out some code for handling error handling in
19837 accordance to the "Declarations" section in the "Basic Concepts"
19838 chapter in the ECMA C# spec.
19840 * interface.cs: Make all interface member classes derive from
19841 InterfaceMemberBase.
19843 2001-05-07 Miguel de Icaza <miguel@ximian.com>
19845 * Many things: all interfaces are parsed and generated in
19846 gen-treedump. Support for member variables, constructors,
19847 destructors, properties, constants is there.
19849 Beginning of the IL backend, but very little done, just there for
19852 2001-04-29 Miguel de Icaza <miguel@ximian.com>
19854 * cs-parser.jay: Fix labeled statement.
19856 * cs-tokenizer.cs (escape): Escape " and ' always.
19857 ref_line, ref_name: keep track of the line/filename as instructed
19858 by #line by the compiler.
19861 2001-04-27 Miguel de Icaza <miguel@ximian.com>
19863 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
19864 to match the values in System.CodeDOM.
19866 Divid renamed to Divide.
19868 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
19870 (Statements.set): remove.
19872 * System.CodeDOM/CodeCatchClause.cs: always have a valid
19875 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
19876 falseStatements always have valid values.
19878 * cs-parser.jay: Use System.CodeDOM now.