1 2005-01-26 Martin Baulig <martin@ximian.com>
3 * class.cs (TypeContainer.AttributeTargets): Return the correct
4 AttributeTargets depending on our `Kind' instead of throwing an
5 exception; fixes #71632.
7 2005-01-26 Martin Baulig <martin@ximian.com>
9 * delegate.cs (Delegate.DefineType): Correctly define our type
10 parameters. Fixes #71483.
12 2005-01-25 Raja R Harinath <rharinath@novell.com>
15 * expression.cs (MemberAccess.DoResolve): Don't complain with
16 cs0572 when the LHS of a member access has identical name and type
19 2005-01-25 Marek Safar <marek.safar@seznam.cz>
22 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
24 Create custom PermissionSet only for PermissionSetAttribute.
26 2005-01-24 Marek Safar <marek.safar@seznam.cz>
29 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
30 delegates in static class.
32 2005-01-24 Martin Baulig <martin@ximian.com>
34 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
35 merging an implicit block, just use its reachability.
37 * statement.cs (Block.Resolve): Make the unreachable code check
38 work wrt. implicit blocks; see test-337 from #63842.
40 2005-01-21 Alp Toker <alp@atoker.com>
42 * cs-parser.jay: destructor_declaration's container is PartialContainer
43 not Class when partial types are used, so use Kind prop instead of
46 2005-01-22 Miguel de Icaza <miguel@ximian.com>
48 * cs-parser.jay: Improve error reporting when an interface
51 2005-01-20 Dick Porter <dick@ximian.com>
53 * support.cs: SeekableStreamReader fix from Sandor Dobos
54 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
55 chars are read. Fixes bug 70369.
57 2005-01-20 Raja R Harinath <rharinath@novell.com>
59 * cs-parser.jay (catch_clause): Simplify current_block handling
62 2005-01-17 Miguel de Icaza <miguel@ximian.com>
64 * convert.cs (ImplicitStandardConversionExists): Synchronize the
65 code with ImplicitStandardConversion to handle the implicit
66 conversion of method groups into valid delegate invocations.
68 The problem is that in parameter handling we were using this code
69 path. Fixes bug #64698
71 2005-01-19 Raja R Harinath <rharinath@novell.com>
73 * cs-parser.jay: Fix several infelicities.
74 - Avoid assigning to the parser value stack. Code like
75 '$3 = null' is unclean. Synthesize a value for the code block
77 - Avoid using oob_stack for storing location information. Use ...
78 (_mark_): ... this. New (empty) rule. Saves the current location
80 (foreach_statement): Avoid using oob_stack for current_block
81 handling. Use technique used in for_statement and
82 using_statement. Synthesize a value for the code block to store
83 additional intermediate information.
85 2005-01-13 Miguel de Icaza <miguel@ximian.com>
87 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
88 of a different type is only allowed to private fields of a
89 containing type, not on fields of a base class.
91 See test-174.cs and error cs0122-9.cs
93 2005-01-13 Raja R Harinath <rharinath@novell.com>
95 Fix test-335.cs (bug #58126).
96 * cs-parser.jay (argument): Split out non-expression parts of the
97 rule into 'non_simple_argument'.
98 (invocation_expression): Support parenthesized invocations with
99 multiple arguments, and with single non-simple arguments.
101 2005-01-13 Raja R Harinath <rharinath@novell.com>
103 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
106 2005-01-12 Raja R Harinath <rharinath@novell.com>
108 Fix cs0038-1.cs, cs1640-6.cs.
109 * ecore.cs (Expression.Resolve): Remove special-case for
110 SimpleName in error-handling.
111 (Expression.almostMatchedMembers): Relax access permission to
113 (Expression.MemberLookupFailed): Handle duplicates in
114 almostMatchedMembers list.
115 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
116 * expression.cs (New.DoResolve): Report CS1540 for more cases.
117 * typemanager.cs (GetFullNameSignature): Use the MethodBase
118 overload if the passed in MemberInfo is a MethodBase.
120 2005-01-25 Martin Baulig <martin@ximian.com>
123 (DocUtil.emptyParamList): Removed; use `Type.EmptyTypes' instead.
125 2005-01-12 Marek Safar <marek.safar@seznam.cz>
128 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
129 for non-CAS & merge permission sets properly.
131 2005-01-11 Raja R Harinath <rharinath@novell.com>
133 Improve standard-compliance of simple name and member access
134 resolution. Fixes bugs #52697, #57200, #67520, #69519.
135 * ecore.cs (FullNamedExpression): New abstract base class
136 for Namespaces and TypeExpressions.
137 (ResolveFlags.SimpleName): Remove.
138 (SimpleName): Remove support for dotted names.
139 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
140 DeclSpace.FindType and DeclSpace.LookupType.
141 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
142 (Expression.ExprClassName): Make member function.
143 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
144 a namespace. Remove creation of dotted "SimpleName"s.
145 (MemberAccess.DoResolve): Likewise.
146 * decl.cs (DeclSpace.Cache): Make private.
147 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
148 (DeclSpace.FindType): Update.
149 (DeclSpace.LookupType): Move here from RootContext. Return a
151 * namespace.cs (Namespace): Derive from FullNamedExpression
152 so that it can be part of expression resolution.
153 (Namespace.Lookup): Return an FullNamedExpression.
154 (NamespaceEntry.LookupAlias): Lookup aliases only in current
156 * rootcontext.cs (NamespaceLookup): Remove.
157 (LookupType): Move to DeclSpace.
158 * attribute.cs (CheckAttributeType): Update.
159 * doc.cs (FindDocumentedType): Remove allowAlias argument.
160 (FindDocumentedTypeNonArray): Likewise.
162 2005-01-11 Raja R Harinath <rharinath@novell.com>
164 Fix cs0509.cs, cs1632.cs.
165 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
166 is the same as IsInterface.
167 (TypeContainer.GetClassBases): Likewise.
168 * statement.cs (LabeledStatement.ig): New field.
169 (LabeledStatement.LabelTarget): Save ILGenerator which created the
171 (LabeledStatement.DoEmit): Check that the label was created with
172 the same ILGenerator.
174 2005-01-10 Marek Safar <marek.safar@seznam.cz>
177 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
178 accessors to its properties.
180 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
181 from accessors to property.
183 2005-01-10 Marek Safar <marek.safar@seznam.cz>
186 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
189 2005-01-08 Miguel de Icaza <miguel@ximian.com>
191 * attribute.cs: Check for null and empty strings.
193 I have lost another battle to Paolo.
195 2005-01-07 Marek Safar <marek.safar@seznam.cz>
198 * class.cs (PropertyMethod): Set Parent field in ctors.
199 (SetMethod.InternalParameters): Add unsafe switch hack.
200 Override MarkForDuplicationCheck where it is appropriate.
202 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
203 It says whether container allows members with the same name.
205 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
206 Removed is_method parameter.
208 2005-01-06 Duncan Mak <duncan@ximian.com>
210 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
211 because the previous change led to incorrect reporting of CS1032
212 ("Cannot define/undefine preprocessor symbols after first token in
213 file"). Instead of using `tokens_seen' as the only flag that
214 triggers CS1040, introduce `comments_seen'. This new flag is used
215 to signify having seen comments on the current line, so it is
216 unset after a newline.
218 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
220 * doc.cs : When searching for a type, find nested type too.
221 This fixes bug #71040.
223 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
226 - Warn missing member comment on those classes which also does not
227 have doc comments. Fixed bug #71041.
228 - Don't warn missing doc comment on default constructor.
231 2005-01-06 Duncan Mak <duncan@ximian.com>
233 * cs-tokenizer.cs (xtoken): After handling traditional C-style
234 comments, set `tokens_seen' to true. This allows us to detect
235 misplaced preprocessor directives (i.e. not at the beginning of
236 the a line, nor after whitespaces). In that case, report error
237 CS1040. This fixes bug #56460.
239 * cs-parser.jay (interface_member_declaration): Add checks for
240 IsExplicitImpl, and report CS0541 error if an interface member is
241 defined as an explicit interface declaration.
243 2005-01-06 Marek Safar <marek.safar@seznam.cz>
246 * class.cs (PropertyMethod): Set Parent field in ctors.
247 (SetMethod.InternalParameters): Add unsafe switch hack.
249 * decl.cs (MemberCore.Parent): Cannot be readonly.
251 2005-01-06 Raja R Harinath <rharinath@novell.com>
253 * decl.cs (DeclSpace.ResolveType): Remove.
254 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
255 Merge in code from ...
256 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
257 * class.cs, enum.cs: Update to changes.
259 2005-01-06 Miguel de Icaza <miguel@ximian.com>
261 * anonymous.cs: Ensure that we init the scope of our parent if it
262 has not been initialized yet.
264 2004-12-30 Duncan Mak <duncan@ximian.com>
266 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
267 if field.FieldBuilder is null. Fixes #70758.
269 * convert.cs: Fixed some typos and updated some of the comments.
270 (ImplicitStandardConversionExists):
271 (TryImplicitIntConversion): If `target_type' is an interface and
272 the type of `ic' implements this interface, return true or a new
273 BoxedCast instead of null. This fixes #70468.
275 2004-12-29 Duncan Mak <duncan@ximian.com>
277 * expression.cs (Argument.Emit): Check that Expr is
278 IMemoryLocation before casting to it, and report CS1510 otherwise.
282 2004-12-21 Ben Maurer <bmaurer@ximian.com>
284 * statement.cs (Block.ThisVariable): remove the recursion here, to
285 make the --profile more sane.
287 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
289 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
290 assembly, by JB Evain.
292 2004-12-17 Raja R Harinath <rharinath@novell.com>
294 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
295 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
296 "parent" refers to enclosing type/class. "base" refers to superclass.
298 2004-12-17 Raja R Harinath <rharinath@novell.com>
300 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
301 Ensure that we only have GlobalAttributes.
302 * attribute.cs (Attribute.Emit): Make non-virtual.
303 (GlobalAttribute.Emit): Remove.
304 (Attribute.Resolve): Make virtual.
305 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
306 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
307 the argument. Don't create one.
308 (Attribute.GetObsoleteAttribute): Likewise.
309 (Attribute.GetClsCompliantAttributeValue): Likewise.
310 * class.cs, decl.cs: Update to changes.
312 2004-12-17 Marek Safar <marek.safar@seznam.cz>
314 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
316 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
318 * statement.cs (Foreach.Resolve): Add error 186 report.
320 2004-12-16 Marek Safar <marek.safar@seznam.cz>
322 * expression.cs (Conditional.DoResolve): Add warning 429.
324 * statement.cs (If.Resolve): Add warning 665.
326 2004-12-16 Raja R Harinath <rharinath@novell.com>
328 New invariant: RootContext.Tree.Types.NamespaceEntry == null
329 except when in the parser, and in GlobalAttribute.
330 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
331 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
332 RootContext.Tree.Types.NamespaceEntry once work is done.
333 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
334 and resets RootContext.Tree.Types.NamespaceEntry.
336 2004-12-15 Marek Safar <marek.safar@seznam.cz>
338 * cs-parser.jay: Don't create a block for every variable.
340 2004-12-14 Miguel de Icaza <miguel@ximian.com>
342 * location.cs: Provide extra information.
344 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
345 variables from the captured environment, it is the ldarg_0.
347 2004-12-14 Marek Safar <marek.safar@seznam.cz>
349 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
352 * class.cs: Changed warning level for 169 to avoid developer
353 displeasure from warning flooding. It will be changed back when they
354 fix most of current BCL warnings.
356 * RootContext.cs: Pushed default WarningLevel to 3.
358 * statement.cs: Removed unused variable.
360 2004-12-14 Marek Safar <marek.safar@seznam.cz>
362 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
363 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
364 Add error 502 report.
365 (StaticClass.DefineType): Add error 441 report.
366 (Class.AllowedModifiersProp): New virtual property as temporary
367 extension to AllowedModifiers.
368 (Class.DefineType): Add error 418 report. Moved ModFlags check here
369 to share implementation with StaticClass and don't call virtual
372 * driver.cs (MainDriver): Add error 1558 test.
374 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
375 report. Moved error 36 test here.
377 * statement.cs (Throw.Resolve): Add error 724 report.
379 * typemanager.cs: Add out_attribute_type core type.
381 2004-12-13 Marek Safar <marek.safar@seznam.cz>
383 * class.cs (TypeContainer.VerifyClsCompliance): Add error
385 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
387 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
390 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
392 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
393 Add error 3023 report.
394 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
396 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
399 2004-12-12 John Luke <john.luke@gmail.com>
401 * driver.cs (AddArgs): take -- into account when
402 adding arguments, fixes bug 65710
404 2004-12-12 Martin Baulig <martin@ximian.com>
406 * expression.cs (Unary.TryReduceNegative): Added support for
407 SByteConstant and ByteConstant.
408 (Unary.Reduce): Check error values from TryReduceNegative().
410 2004-12-10 Marek Safar <marek.safar@seznam.cz>
412 * attributes.cs (Attribute.Resolve): Avoid multiple error report
413 and report exception as error 182.
415 2004-12-10 Raja R Harinath <rharinath@novell.com>
417 * driver.cs (Main): Fix message when there are warnings.
419 2004-12-09 Miguel de Icaza <miguel@ximian.com>
421 * delegate.cs: Fixed my fix from yesterday, sorry about that.
423 2004-12-09 Marek Safar <marek.safar@seznam.cz>
425 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
426 Reduced number of warnings.
428 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
430 2004-12-08 Miguel de Icaza <miguel@ximian.com>
432 * driver.cs: Removed message.
434 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
436 2004-12-08 <vargaz@freemail.hu>
438 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
440 2004-12-08 Martin Baulig <martin@ximian.com>
442 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
443 instead of a CS3002 for properties and indexer.
445 2004-12-08 Martin Baulig <martin@ximian.com>
447 * decl.cs (MemberName.ToString): Make this work again.
449 2004-12-08 Marek Safar <marek.safar@seznam.cz>
451 * attribute.cs (Resolve): Add error 591 detection.
453 * class.cs (FieldMember.Define): Add error 1547 detection.
454 (Indexer.Define): Add error 620 detection.
455 (Operator.Define): Add error 590 detection.
457 * ecore.cs: Missing argument for error 79.
459 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
462 2004-12-07 Marek Safar <marek.safar@seznam.cz>
465 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
468 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
470 * cs-parser.jay : handle doc comments on implicit/explicit operators.
471 Some operator comments were suppressed.
472 * doc.cs : Implicit/explicit operator name in doc comments are like
473 "op_Explicit(type)~returnType", so added suffix handling.
475 2005-01-21 Alp Toker <alp@atoker.com>
477 * cs-parser.jay: destructor_declaration's container is PartialContainer
478 not Class when partial types are used, so use Kind prop instead of 'is'.
480 2004-12-12 Martin Baulig <martin@ximian.com>
482 * expression.cs (Unary.TryReduceNegative): Added support for
483 SByteConstant and ByteConstant.
484 (Unary.Reduce): Check error values from TryReduceNegative().
486 2004-12-11 Martin Baulig <martin@ximian.com>
488 * support.cs (ReflectionParameters.ParameterName): If we have a
489 `gpd', call `ParameterName' on it.
491 * parameter.cs (Parameter.GetParameterAttributes): New static method.
493 * pending.cs (PendingImplementation.DefineProxy): Call
494 DefineParameter() for all of the MethodBuilder's arguments.
496 2004-12-09 Martin Baulig <martin@ximian.com>
498 * doc.cs (DocUtil): Make this a static class.
500 2004-12-09 Martin Baulig <martin@ximian.com>
502 * expression.cs (Invocation.InferType): Moved the type inference
503 implementation into TypeManager.
505 * generics.cs (TypeManager): Moved the type inference
508 2004-12-09 Martin Baulig <martin@ximian.com>
510 * typemanager.cs (TypeManager): Make this a partial class.
513 (TypeManager): Move the generics part of `TypeManager' here.
515 2004-12-08 Martin Baulig <martin@ximian.com>
517 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
518 instead of a CS3002 for properties and indexer. Added CS3024
519 check for generic interfaces.
521 * attributes.cs (AttributeTester.AnalyzeTypeCompliance): Generic
522 instances are not CLS-compliant.
524 2004-12-08 Martin Baulig <martin@ximian.com>
527 (void_pointer_expression): New rule for `void*', `void**' etc.
528 (typeof_expression): Add `void_pointer_expression'; fixes #66846.
530 2004-12-08 Martin Baulig <martin@ximian.com>
532 * expression.cs (Invocation.InferType): Removed the hack for
533 MethodCore.MayUnify().
535 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Make
538 * class.cs (MethodCore.MayUnify): Use
539 TypeManager.MayBecomeEqualGenericTypes().
541 2004-12-08 Martin Baulig <martin@ximian.com>
543 * expression.cs (Is.DoResolve, As.DoResolve): If we're a type
544 parameter, box it. Fixes #69233.
546 2004-12-08 Martin Baulig <martin@ximian.com>
548 * generic.cs (ConstructedType.CheckConstraints): Valuetypes always
549 have the ctor constraint. Fixes #68326.
551 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
553 * cs-parser.jay : interface comment was not consumed because of
554 extra opt_semicolon before doc handling.
556 2004-12-03 Raja R Harinath <rharinath@novell.com>
558 Fix test-327.cs, test-328.cs, and put in early infrastructure
559 for eventually fixing #52697.
560 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
561 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
563 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
564 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
565 (VerifyUsing, error246): Update.
566 * rootcontext.cs (RootContext.NamespaceLookup): Just use
567 'NamespaceEntry.LookupNamespaceOrType'.
569 2004-12-07 Martin Baulig <martin@ximian.com>
571 * driver.cs: Call it "BETA SOFTWARE" :-)
573 2004-12-06 Raja R Harinath <rharinath@novell.com>
575 Fix crash on cs0657-17.cs.
576 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
577 Use RootContext.Tree.Types, not 'new RootTypes ()'.
578 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
579 the case where the NamespaceEntry gets overwritten.
581 2004-12-06 Marek Safar <marek.safar@seznam.cz>
584 * ecore.cs (ResolveBoolean): Tiny refactoring.
586 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
587 of right expression resolving when left is false constant and
588 operator is LogicalAnd OR true constant and operator is LogicalOr.
590 * statement.cs (ResolveUnreachable): Always reports warning.
592 2004-12-05 Miguel de Icaza <miguel@ximian.com>
594 * class.cs: Distinguish between 1721 and 1722 (just a little help
597 2004-12-03 Miguel de Icaza <miguel@ximian.com>
599 * delegate.cs: Only allow this on new versions of the language.
601 2004-12-02 Duncan Mak <duncan@ximian.com>
603 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
605 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
606 here as a static method. Take an additional bool out parameter
607 `must_do_cs1540_check' for signaling to InstanceResolve.
608 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
609 member field from PropertyExpr class and made it an argument of
611 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
612 check for MarshalByRefObject, and report CS0122 instead of CS1540.
613 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
614 and `remove_accessor' as well as InstanceResolve: report CS0122
619 2004-12-07 Martin Baulig <martin@ximian.com>
621 * decl.cs (DeclSpace.AddToContainer): Report correct errors CS0694
622 and CS0692 where appropriate.
624 2004-12-06 Martin Baulig <martin@ximian.com>
626 * class.cs (MethodCore.MayUnify): Moved the CS0408 check here from
627 IsDuplicateImplementation() and improved it.
629 * expression.cs (Invocation.InferTypeArguments): Added
630 `Type[] inferred_class_types' argument (for MethodCore.MayUnify)
631 and removed the "ref" modifier from `infered_types'.
633 * decl.cs (MemberName.ToString): Removed the exception.
635 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
637 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
638 comments are allowed.
640 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
642 * delegate.cs: Add checks for subtypes in paramaters and return values
643 in VerifyMethod () to add support for Covariance/Contravariance
646 2004-12-02 Miguel de Icaza <miguel@ximian.com>
648 * report.cs: Remove extra closing parenthesis.
650 * convert.cs (Error_CannotImplicitConversion): If the name of the
651 types are the same, provide some extra information.
653 2004-12-02 Marek Safar <marek.safar@seznam.cz>
656 * attribute.cs (Resolve): Improved implementation of params
659 * support.cs (ParameterData): Add HasParams to be faster.
661 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
663 all things are for /doc support:
665 * doc.cs: new file that supports XML documentation generation.
666 * mcs.exe.sources: added doc.cs.
668 Handle /doc command line option.
669 Report error 2006 instead of 5 for missing file name for /doc.
670 Generate XML documentation when required, after type resolution.
672 Added support for picking up documentation (/// and /** ... */),
673 including a new XmlCommentState enumeration.
675 Added lines to fill Documentation element for field, constant,
676 property, indexer, method, constructor, destructor, operator, event
677 and class, struct, interface, delegate, enum.
678 Added lines to warn incorrect comment.
680 Added Documentation field (passed only when /doc was specified).
682 Added DocComment, DocCommentHeader, GenerateDocComment() and
683 OnGenerateDocComment() and some supporting private members for
684 /doc feature to MemberCore.
686 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
688 Added overriden DocCommentHeader.
690 Added overriden DocCommentHeader and GenerateDocComment().
692 2004-12-01 Miguel de Icaza <miguel@ximian.com>
694 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
695 unwrapping the enumeration values, chain to
696 DoConstantNumericPromotions again, so we can promote things to the
697 fundamental types (takes care of enums that are bytes, sbytes).
701 2004-12-01 Raja R Harinath <rharinath@novell.com>
703 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
704 Fix long-standing bug in type-lookup. Use FindType instead of
705 LookupType when ec.ResolvingTypeTree.
706 (Attribute.ResolveType, Attribute.Resolve)
707 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
709 (Attributes.Search): Remove internal version. Update.
710 (Attributes.SearchMulti): Update.
711 (Attributes.GetClsCompliantAttribute): Remove.
712 (Attributes.GetIndexerNameAttribute): Remove.
713 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
714 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
715 * class.cs (Indexer.Define): Likewise.
717 2004-12-01 Marek Safar <marek.safar@seznam.cz>
720 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
721 MarshallByReference members access.
723 * expression.cs: Use CheckMarshallByRefAccess;
724 Better error CS0197 message.
726 * report.cs: Print whole related error message.
728 2004-11-29 Marek Safar <marek.safar@seznam.cz>
730 * class (GetClassBases): Better error 60 report.
731 (EventProperty): Disabled warning 67 detection.
733 2004-11-29 Marek Safar <marek.safar@seznam.cz>
736 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
738 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
741 2004-11-29 Marek Safar <marek.safar@seznam.cz>
744 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
746 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
748 2004-11-26 Miguel de Icaza <miguel@ximian.com>
750 * attribute.cs (Attribute.Resolve): Refine error reporting and
751 report a cs0117 if the identifier does not exist, to distinguish
752 from 0617 which is a miss-use of the actual identifier.
754 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
755 between cs0070 and cs0079.
757 * class.cs (MemberBase.DoDefine): When reporting a wrong
758 accessibility level, we use MethodCore to compare instead of
759 Method (this was a regression in some refactoring effort).
761 So now we correctly report cs0056 again.
763 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
764 testing the target_type (which was known to be object_type) and
765 not the source type (which is anonymous_method).
767 Fixed reporting of error cs1660.
769 * expression.cs (UserCast.Source): Expose the underlying cast.
771 * statement.cs (Switch.SwitchGoverningType): Sort the list of
772 allowed types to find a match to int32 first (most common).
774 In addition, it ignores any ImplicitUserConversions that did an
775 internal implicit conversion (as the switch statement allows only
776 one integral conversion to exist).
778 * class.cs (PartialContainer.Create): rename `name' to
779 `member_name' for clarity. Then replace the string calls with a
780 call to MemberName.GetPartialName, as now using
781 MemberName.ToString is an error (this is due to the side effects
782 it had, that were fixed in the past).
784 This will restore the error reporting on a number of partial class
785 errors that were missusing this (and getting an exception as a
786 results, which is now just a plain textual warning, because
787 yyparse debug output would crash otherwise).
789 2004-11-26 Raja R Harinath <rharinath@novell.com>
791 * Makefile (PROGRAM_INSTALL_DIR): Remove.
793 2004-11-25 Ben Maurer <bmaurer@ximian.com>
795 * rootcontext.cs (LookupType): Make sure to cache lookups that
796 don't give us a negative result. This saves about 5% of corlib
799 2004-11-25 Miguel de Icaza <miguel@ximian.com>
801 * report.cs (AbstractMessage.Print): messages are sent to stderr
803 * class.cs (TypeContainer.GetClassBases): It is an error to have a
804 non-interface in the list of interfaces (at this point, either
805 parent was properly set, or a base class is being listed in the
808 This flags error 1722, and resolves the crash from bug 69259.
810 2004-11-25 Ben Maurer <bmaurer@ximian.com>
812 * statement.cs (Using.EmitExpressionFinally): make this work right
813 for valuetypes. Fixes 69926.
815 2004-11-25 Miguel de Icaza <miguel@ximian.com>
817 * const.cs (Const.ChangeType): Cope with the "0 literal can be
818 converted to an enum" here, before we try to change the underlying
819 type. This code exists, but it is a different code path than the
820 one used while encoding constants.
822 (ImplicitReferenceConversionExists): In addition, resynchronized
823 the code here, so it matches the same code in
824 ImplicitReferenceConversionExists for the `from any class-type S
825 to any interface-type T'.
827 2004-11-25 Marek Safar <marek.safar@seznam.cz>
829 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
831 2004-11-24 Miguel de Icaza <miguel@ximian.com>
833 * cs-parser.jay: Use verbosity accordingly.
835 2004-11-24 Marek Safar <marek.safar@seznam.cz>
837 * expression.cs (Unary.ResolveOperator): Do not report warning;
838 AddressOf reads from variable.
840 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
842 2004-11-24 Marek Safar <marek.safar@seznam.cz>
846 * attribute.cs (Attributable): Removed CheckTargets.
847 (Attributes.Emit): Explicit attribute targets are tested here.
849 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
850 not enabled for interfaces.
852 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
853 (GetAssemblyName): Ouch next bug there.
855 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
857 * expression.cs: Error 275 added.
859 2004-11-23 Marek Safar <marek.safar@seznam.cz>
861 Fix bug #69177 (Implemented decimal constant support)
863 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
864 (BinaryFold): Add DecimalConstant.
866 * const.cs (Define): Decimal constant
868 (ChangeType): Add decimal type handling.
869 (LookupConstantValue): Don't set value for decimal type but
870 emit DecimalConstantAttribute. Needed for constant optimization.
872 * constant.cs (ToDecimal): New method.
873 (ConvertToDecimal): New method.
874 (IntConstant): Implemented ConvertToDecimal.
875 (DecimalConstant.Emit): Emit optimized version for decimals in
878 * expression.cs (ResolveOperator): Changed order of constant
879 reduction to work correctly with native types which have
880 overloaded operators.
881 (ResolveMemberAccess): Extract constant value from attribute
884 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
886 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
887 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
888 (ChangeType): Decimal is special.
889 (TypeToCoreType): Add decimal type.
891 2004-11-22 Marek Safar <marek.safar@seznam.cz>
893 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
896 2004-11-22 Marek Safar <marek.safar@seznam.cz>
898 * class.cs (EventField.ApplyAttributeBuilder): Fix error
901 2004-11-19 Marek Safar <marek.safar@seznam.cz>
903 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
905 * pending.cs (PendingImplementation): Grab only interfaces.
907 2004-11-19 Marek Safar <marek.safar@seznam.cz>
909 * statement.cs (ForeachHelperMethods): Add location member and
912 2004-11-18 Marek Safar <marek.safar@seznam.cz>
914 * expression.cs (DoResolveBase): Fixed wrong warning for out
917 2004-12-04 Martin Baulig <martin@ximian.com>
919 * convert.cs (Convert.TypeParameter_to_Null): Use the constraints
920 to check whether the conversion is ok.
922 * typemanager.cs (TypeManager.GetTypeArguments): Just return
923 `Type.EmptyTypes' if we're not a generic TypeContainer.
925 2004-11-25 Miguel de Icaza <miguel@ximian.com>
927 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
928 old bug: when converting from the null literal to a pointer,
929 return an EmptyCast, not the NullLiteral.
931 This fixes #69921, the recent null_type changes probably made this
934 2004-12-03 Martin Baulig <martin@ximian.com>
936 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
937 method as our child, call AnonymousMethod.Compatible() on it.
939 2004-12-02 Miguel de Icaza <miguel@ximian.com>
941 * class.cs (FieldBase): Use an unused bit field from the field to
942 encode the `has_offset' property from the FieldMember. This saves
943 a couple of Ks on bootstrap compilation.
945 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
946 method as our child, return the AnonymousMethod resolved
949 * expression.cs (New.DoResolve): Allow return values from
950 NewDelegate to also include AnonymousMethods.
954 2004-11-29 Raja R Harinath <rharinath@novell.com>
956 * decl.cs (MemberCore.MemberName): Remove readonly to fix an error
958 * rootcontext.cs (ResolveCore::interfaces_first_stage): Add
959 System.Runtime.InteropServices._Exception, since it's a base
960 interface of the core type System.Exception in the net_2_0 profile.
962 2004-11-27 Martin Baulig <martin@ximian.com>
964 * ecore.cs (Expression.StoreFromPtr): Use `stobj' for generic parameters.
966 2004-11-26 Raja R Harinath <rharinath@novell.com>
968 * Makefile: Convert to use executable.make.
969 * gmcs.exe.sources: New.
971 2004-11-25 Martin Baulig <martin@ximian.com>
973 * expression.cs (Invocation.InferType): Added support for byref types.
975 2004-11-25 Martin Baulig <martin@ximian.com>
977 * statement.cs (Foreach.FetchMethodMoveNext): Wrap `mi.ReturnType'
978 in TypeManager.TypeToCoreType().
980 2004-11-25 Martin Baulig <martin@ximian.com>
982 * iterators.cs (Iterator.DoDefineMembers): Override and lookup the
983 "Dispose" method from the `current_type'.
984 (Iterator.EmitMoveNext): Use the `dispose_method' we looked up in
985 DoDefineMembers() instead of using the MethodBuilder; this is
986 required for generic iterators.
988 * class.cs (TypeContainer.DoDefineMembers): Make this virtual.
990 2004-11-24 Martin Baulig <martin@ximian.com>
992 * ecore.cs (Expression.LoadFromPtr): Use `ldobj' for generic parameters.
994 2004-11-20 Martin Baulig <martin@ximian.com>
996 * expression.cs (Invocation.InferType): Correctly infer generic
997 instances; see gen-103.cs.
998 (Invocation.InferTypeArguments): If a generic method doesn't have
999 any unbound type parameters, we don't need to infer anything.
1001 2004-11-19 Raja R Harinath <rharinath@novell.com>
1003 * Makefile (gmcs.exe): Update to new location of bootstrap mcs.exe.
1005 2004-11-17 Raja R Harinath <rharinath@novell.com>
1007 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
1008 (TypeHandle.GetMemberCache): New.
1009 (TypeHandle.TypeHandle): Update.
1010 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
1011 (TypeManager.LookupParentInterfacesCache):
1012 Rename from LookupInterfaceCache. Optimize slightly.
1013 (TypeManager.MemberLookup_FindMembers): Update.
1014 * decl.cs (MemberCache.MemberCache): Set Container to null in the
1016 (AddCacheContents): Rename from AddHashtable.
1017 * class.cs (TypeContainer.parent_container): Remove.
1018 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
1019 (TypeContainer.DoDefineMembers): Don't initialize it.
1020 Update to name changes.
1022 2004-11-17 Miguel de Icaza <miguel@ximian.com>
1024 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
1025 that factors the code to check access modifiers on override.
1027 (PropertyBase): Use the code here.
1029 Patch from Lluis S'anchez, fixes bug #69361.
1031 2004-11-15 Miguel de Icaza <miguel@ximian.com>
1033 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
1034 routine that is used to report the use of a captured variable
1035 whose address has been taken.
1037 There are two checks: one when variables are being captured and
1038 the other check is when the address of a variable is taken.
1040 (because an anonymous methods might be resolved before *or* after
1041 the address has been taken) and
1043 * expression.cs (Conditional.DoResolve): Remove the special
1044 casing that Martin added to trueExpr and falseExpr being both
1045 NullLiteral. We get the right behavior now just by introducing
1046 the null_type into the compiler.
1048 * convert.cs (ExplicitConversion): Change the code to use
1049 null_type instead of testing `expr is NullLiteral'.
1050 (ImplicitConversionStandard): use null_type too.
1051 (ImplicitReferenceConversionExists): use null_type too.
1052 (ImplicitReferenceConversion): use null_type too.
1054 * literal.cs: The type of `NullLiteral' is now null_type instead
1056 (Resolve): Set the type here.
1058 * typemanager.cs: Introduce null_type.
1060 2004-11-18 Martin Baulig <martin@ximian.com>
1063 (RootContext.LookupType): Return a `Type', not a `TypeExpr'.
1065 2004-11-18 Martin Baulig <martin@ximian.com>
1067 * ecore.cs (TypeExpr.DoResolveAsTypeStep): Make this protected.
1069 2004-11-18 Martin Baulig <martin@ximian.com>
1071 * generic.cs (Constraints.Resolve): Take an `EmitContext' instead
1072 of a `DeclSpace'. If one of our constraints is a `ConstructedType',
1073 call ResolveConstructedType() on it to resolve it without checking
1075 (Constraints.ResolveTypes): Check them here.
1076 (ConstructedType.DoResolveAsTypeStep): Fully resolve ourselves,
1077 but don't check constraints.
1078 (ConstructedType.ResolveAsTypeTerminal): Override this and also
1079 check constraints here.
1080 (ConstructedType.ResolveConstructedType): New public method. This
1081 is called from DoResolveAsTypeStep() and Constraints.Resolve() to
1082 resolve ourselves without checking constraints.
1084 * ecore.cs (Expression.ResolveAsTypeTerminal): Make this virtual.
1086 2004-11-18 Martin Baulig <martin@ximian.com>
1089 (DeclSpace.CurrentType): Changed type from `TypeExpr' to `Type'.
1091 * delegate.cs (Delegate.DefineType): Always create the EmitContext.
1093 2004-11-18 Martin Baulig <martin@ximian.com>
1095 * ecore.cs (TypeExpr.ResolveType): Removed.
1096 (Expression.ResolveAsTypeTerminal): We always return a fully
1097 resolved `TypeExpr', so we can just access its `Type'.
1099 * class.cs (TypeContainer.DefineType): Resolve `CurrentType' here.
1101 2004-11-17 Martin Baulig <martin@ximian.com>
1103 * ecore.cs (IAlias.Type): Replaced with ResolveAsType() to make
1104 sure we don't return any unresolved TypeExpr's.
1105 (TypeAliasExpression): The .ctor now takes an `IAlias' instead of
1107 (Expression.ResolveAsTypeTerminal): Make sure `te.Type != null'.
1109 * expression.cs (MemberAccess.ResolveAsTypeStep): Don't return any
1110 unresolved `ConstructedType's.
1112 2004-11-17 Martin Baulig <martin@ximian.com>
1114 * ecore.cs (TypeExpr.ResolveType): Don't make this virtual.
1116 2004-11-17 Martin Baulig <martin@ximian.com>
1119 (Expression.ResolveAsTypeTerminal): Removed the `bool silent' argument.
1121 * decl.cs (DeclSpace.ResolveType): Removed.
1122 (DeclSpace.ResolveTypeExpr): Removed the `bool silent' argument.
1124 2004-11-17 Martin Baulig <martin@ximian.com>
1126 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
1127 direction, like FindMembers() does. Fixes #69546, testcase is in
1130 2004-11-16 Martin Baulig <martin@ximian.com>
1132 This is based on a patch from Marek Safar, see bug #69082.
1133 Fixes bugs #63705 and #67130.
1135 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
1136 method; create a MemberCache for an interface type and cache the
1139 * decl.cs (IMemberContainer.ParentContainer): Removed.
1140 (IMemberContainer.ParentCache): New property.
1141 (MemberCache.SetupCacheForInterface): Removed.
1142 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
1143 to create a cache for an interface's "parent".
1145 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
1148 2004-11-14 Ben Maurer <bmaurer@ximian.com>
1150 * statement.cs: Avoid adding bools to a hashtable.
1152 2004-11-15 Martin Baulig <martin@ximian.com>
1154 * decl.cs (MemberName.GetPartialName): Removed, use GetTypeName() instead.
1156 2004-11-11 Martin Baulig <martin@ximian.com>
1158 * typemanager.cs (TypeManager.GetMethodName): New method.
1160 * class.cs (MethodData.Define): Include the generic arity in the
1161 name of an explicit interface; also add it to the method name.
1163 * pending.cs (PendingImplementation.InterfaceMethod): The method
1164 name now includes the generic arity.
1166 2004-11-07 Miguel de Icaza <miguel@ximian.com>
1168 * expression.cs (Invocation.OverloadResolve): Flag error if we are
1169 calling an unsafe method from a safe location.
1171 2004-11-06 Marek Safar <marek.safar@seznam.cz>
1174 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
1176 2004-11-06 Miguel de Icaza <miguel@ximian.com>
1178 * namespace.cs (VerifyUsing): use GetPartialName instead of
1181 2004-11-05 Miguel de Icaza <miguel@ximian.com>
1183 * statement.cs (Return.Resolve): Fix regression in typo: if
1184 `in_exc', we have to request a NeedReturnLabel, this was a typo
1185 introduced in the anonymous method check-in. Fixes #69131.
1187 * Indexers were using the ShortName when defining themselves,
1188 causing a regression in the compiler bootstrap when applying the
1189 patch from 2004-11-02 (first part), now they use their full name
1190 and the bug is gone.
1192 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
1194 * driver.cs: Strip the path from the names of embedded resources. Fixes
1197 2004-11-04 Raja R Harinath <rharinath@novell.com>
1199 Fix error message regression: cs0104-2.cs.
1200 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
1201 (AliasEntry.Resolve): Update.
1202 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
1204 (RootContext.LookupType): Update.
1206 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
1208 * cs-parser.jay: Add support for handling accessor modifiers
1209 * class: Add support port accessor modifiers and error checking,
1210 define PropertyMethod.Define as virtual (not abstract anymore)
1211 * ecore.cs: Add checking for proeprties access with access modifiers
1212 * iterators.cs: Modify Accessor constructor call based in the modified
1214 2004-11-02 Ben Maurer <bmaurer@ximian.com>
1216 * expression.cs (StringConcat): Handle being called twice,
1217 as when we have a concat in a field init with more than two
1220 2004-11-02 Miguel de Icaza <miguel@ximian.com>
1222 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
1223 special case explicit implementations, we should always produce
1224 the .property or .event declaration.
1226 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
1227 since it will not return correct data if people use this
1228 unresolved in the presence of using statements (see test-313).
1230 * class.cs (MethodData.Define): If we are an explicit interface
1231 implementation, set the method name to the full name of the
1232 interface plus the name of the method.
1234 Notice that using the method.MethodName.GetFullName() does not
1235 work, as it will only contain the name as declared on the source
1236 file (it can be a shorthand in the presence of using statements)
1237 and not the fully qualifed type name, for example:
1241 class D : ICloneable {
1242 object ICloneable.Clone () {
1246 Would produce a method called `ICloneable.Clone' instead of
1247 `System.ICloneable.Clone'.
1249 * namespace.cs (Alias.Resolve): Use GetPartialName.
1251 2004-11-01 Marek Safar <marek.safar@seznam.cz>
1253 * cs-parser.jay: Add error 1055 report.
1255 2004-11-01 Miguel de Icaza <miguel@ximian.com>
1257 * assign.cs (Assign.DoResolve): Only do the transform of
1258 assignment into a New if the types are compatible, if not, fall
1259 through and let the implicit code deal with the errors and with
1260 the necessary conversions.
1262 2004-11-01 Marek Safar <marek.safar@seznam.cz>
1264 * cs-parser.jay: Add error 1031 report.
1266 * cs-tokenizer.cs: Add location for error 1038.
1268 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1270 * cs-parser.jay: Add error 1016 report.
1272 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1274 * cs-parser.jay: Add errors 1575,1611 report.
1276 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1278 * cs-parser.jay: Add error 1001 report.
1280 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1283 * attribute.cs (GetMarshal): Add method argument for
1284 caller identification.
1286 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
1287 agument for GetMarshal and RuntimeMissingSupport.
1289 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1291 * attribute.cs (ExtractSecurityPermissionSet): Removed
1292 TypeManager.code_access_permission_type.
1294 * typemanager.cs: Removed TypeManager.code_access_permission_type.
1296 2004-10-27 Miguel de Icaza <miguel@ximian.com>
1298 * expression.cs (LocalVariableReference.DoResolveLValue): Check
1299 for obsolete use of a variable here. Fixes regression on errors
1300 cs0619-25 and cs0619-26.
1302 2004-10-27 Marek Safar <marek.safar@seznam.cz>
1304 Fix #62358, implemented security attribute encoding.
1306 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
1307 Tests permitted SecurityAction for assembly or other types.
1308 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
1309 data from SecurityPermissionAttribute to PermisionSet class.
1311 * class.cs (ApplyAttributeBuilder): Added special handling
1312 for System.Security.Permissions.SecurityAttribute based types.
1314 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
1315 special handling for System.Security.Permissions.SecurityAttribute
1318 * enum.cs (ApplyAttributeBuilder): Added special handling
1319 for System.Security.Permissions.SecurityAttribute based types.
1321 * parameter.cs (ApplyAttributeBuilder): Added special handling
1322 for System.Security.Permissions.SecurityAttribute based types.
1324 * rootcontext.cs: Next 2 core types.
1326 * typemanager.cs (TypeManager.security_permission_attr_type):
1327 Built in type for the SecurityPermission Attribute.
1328 (code_access_permission_type): Build in type.
1330 2004-10-17 Miguel de Icaza <miguel@ximian.com>
1332 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
1333 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
1334 all of this information into
1335 EmitContext.EmitCapturedVariableInstance.
1337 * codegen.cs (EmitCapturedVariableInstance): move here the
1338 funcionality of emitting an ldarg.0 in the presence of a
1339 remapping. This centralizes the instance emit code.
1341 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
1342 then emit a load of this: it means that we have reached the
1343 topmost ScopeInfo: the one that contains the pointer to the
1344 instance of the class hosting the anonymous method.
1346 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
1347 captures to the topmost CaptureContext.
1349 2004-10-12 Miguel de Icaza <miguel@ximian.com>
1351 * expression.cs (LocalVariableReference): Move the knowledge about
1352 the iterators into codegen's EmitCapturedVariableInstance.
1354 2004-10-11 Miguel de Icaza <miguel@ximian.com>
1356 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
1357 all code paths return a value from an anonymous method (it is the
1358 same as the 161 error, but for anonymous methods).
1360 2004-10-08 Miguel de Icaza <miguel@ximian.com>
1362 The introduction of anonymous methods in the compiler changed
1363 various ways of doing things in the compiler. The most
1364 significant one is the hard split between the resolution phase
1365 and the emission phases of the compiler.
1367 For instance, routines that referenced local variables no
1368 longer can safely create temporary variables during the
1369 resolution phase: they must do so from the emission phase,
1370 since the variable might have been "captured", hence access to
1371 it can not be done with the local-variable operations from the runtime.
1375 (Block.Flags): New flag `IsTopLevel' to indicate that this block
1376 is a toplevel block.
1378 (ToplevelBlock): A new kind of Block, these are the blocks that
1379 are created by the parser for all toplevel method bodies. These
1380 include methods, accessors and anonymous methods.
1382 These contain some extra information not found in regular blocks:
1383 A pointer to an optional CaptureContext (for tracking captured
1384 local variables and parameters). A pointer to the parent
1387 (Return.Resolve): Catch missmatches when returning a value from an
1388 anonymous method (error 1662).
1389 Invoke NeedReturnLabel from the Resolve phase instead of the emit
1392 (Break.Resolve): ditto.
1394 (SwitchLabel): instead of defining the labels during the
1395 resolution phase, we now turned the public ILLabel and ILLabelCode
1396 labels into methods called GetILLabelCode() and GetILLabel() that
1397 only define the label during the Emit phase.
1399 (GotoCase): Track the SwitchLabel instead of the computed label
1400 (its contained therein). Emit the code by using
1401 SwitchLabel.GetILLabelCode ().
1403 (LocalInfo.Flags.Captured): A new flag has been introduce to track
1404 whether the Local has been captured or not.
1406 (LocalInfo.IsCaptured): New property, used to tell whether the
1407 local has been captured.
1409 * anonymous.cs: Vastly updated to contain the anonymous method
1412 The main classes here are: CaptureContext which tracks any
1413 captured information for a toplevel block and ScopeInfo used to
1414 track the activation frames for various local variables.
1416 Each toplevel block has an optional capture context associated
1417 with it. When a method contains an anonymous method both the
1418 toplevel method and the anonymous method will create a capture
1419 context. When variables or parameters are captured, they are
1420 recorded on the CaptureContext that owns them, for example:
1424 MyDelegate d = delegate {
1429 Here `a' will be recorded as captured on the toplevel
1430 CapturedContext, the inner captured context will not have anything
1431 (it will only have data if local variables or parameters from it
1432 are captured in a nested anonymous method.
1434 The ScopeInfo is used to track the activation frames for local
1435 variables, for example:
1437 for (int i = 0; i < 10; i++)
1438 for (int j = 0; j < 10; j++){
1439 MyDelegate d = delegate {
1444 At runtime this captures a single captured variable `i', but it
1445 captures 10 different versions of the variable `j'. The variable
1446 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
1447 recorded on a child.
1449 The toplevel ScopeInfo will also track information like the `this'
1450 pointer if instance variables were referenced (this is necessary
1451 as the anonymous method lives inside a nested class in the host
1452 type of the method).
1454 (AnonymousMethod): Expanded to track the Toplevel, implement
1455 `AnonymousMethod.Compatible' to tell whether an anonymous method
1456 can be converted to a target delegate type.
1458 The routine now also produces the anonymous method content
1460 (AnonymousDelegate): A helper class that derives from
1461 DelegateCreation, this is used to generate the code necessary to
1462 produce the delegate for the anonymous method that was created.
1464 * assign.cs: API adjustments for new changes in
1465 Convert.ImplicitStandardConversionExists.
1467 * class.cs: Adjustments to cope with the fact that now toplevel
1468 blocks are of type `ToplevelBlock'.
1470 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
1471 insteda of standard blocks.
1473 Flag errors if params arguments are passed to anonymous methods.
1475 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
1476 `CurrentAnonymousMethod' which points to the current Anonymous
1477 Method. The variable points to the AnonymousMethod class that
1478 holds the code being compiled. It is set in the new EmitContext
1479 created for the anonymous method.
1481 (EmitContext.Phase): Introduce a variable and an enumeration to
1482 assist in enforcing some rules about when and where we are allowed
1483 to invoke certain methods (EmitContext.NeedsReturnLabel is the
1484 only one that enfonces this right now).
1486 (EmitContext.HaveCaptureInfo): new helper method that returns
1487 whether we have a CapturedContext initialized.
1489 (EmitContext.CaptureVariable): New method used to register that a
1490 LocalInfo must be flagged for capturing.
1492 (EmitContext.CapturedParameter): New method used to register that a
1493 parameters must be flagged for capturing.
1495 (EmitContext.CapturedField): New method used to register that a
1496 field must be flagged for capturing.
1498 (EmitContext.HaveCapturedVariables,
1499 EmitContext.HaveCapturedFields): Return whether there are captured
1500 variables or fields.
1502 (EmitContext.EmitMethodHostInstance): This is used to emit the
1503 instance for the anonymous method. The instance might be null
1504 (static methods), this (for anonymous methods that capture nothing
1505 and happen to live side-by-side with the current method body) or a
1506 more complicated expression if the method has a CaptureContext.
1508 (EmitContext.EmitTopBlock): Routine that drives the emission of
1509 code: it will first resolve the top block, then emit any metadata
1510 and then emit the code. The split is done so that we can extract
1511 any anonymous methods and flag any captured variables/parameters.
1513 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
1514 during this phase, the ILGenerator should not be used as labels
1515 and local variables declared here might not be accessible to any
1516 code that is part of an anonymous method.
1518 Exceptions to this include the temporary variables that are
1519 created by some statements internally for holding temporary
1522 (EmitContext.EmitMeta): New routine, in charge of emitting all the
1525 (EmitContext.TemporaryReturn): This method is typically called
1526 from the Emit phase, and its the only place where we allow the
1527 ReturnLabel to be defined other than the EmitMeta. The reason is
1528 that otherwise we would have to duplicate a lot of logic in the
1529 Resolve phases of various methods that today is on the Emit
1532 (EmitContext.NeedReturnLabel): This no longer creates the label,
1533 as the ILGenerator is not valid during the resolve phase.
1535 (EmitContext.EmitThis): Extended the knowledge in this class to
1536 work in anonymous methods in addition to iterators.
1538 (EmitContext.EmitCapturedVariableInstance): This emits whatever
1539 code is necessary on the stack to access the instance to a local
1540 variable (the variable will be accessed as a field).
1542 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
1543 EmitContext.EmitAddressOfParameter): Routines to support
1544 parameters (not completed at this point).
1546 Removals: Removed RemapLocal and RemapLocalLValue. We probably
1547 will also remove the parameters.
1549 * convert.cs (Convert): Define a `ConstantEC' which points to a
1550 null. This is just to prefity some code that uses
1551 ImplicitStandardConversion code and do not have an EmitContext
1554 The idea is to flag explicitly that at that point in time, it is
1555 known that the conversion will not trigger the delegate checking
1556 code in implicit conversions (which requires a valid
1559 Everywhere: pass new EmitContext parameter since
1560 ImplicitStandardConversionExists now requires it to check for
1561 anonymous method conversions.
1563 (Convert.ImplicitStandardConversionExists): If the type of an
1564 expression is the anonymous_method_type, and the type is a
1565 delegate, we invoke the AnonymousMethod.Compatible method to check
1566 whether an implicit conversion is possible.
1568 (Convert.ImplicitConversionStandard): Only do implicit method
1569 group conversions if the language level is not ISO_1.
1571 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
1572 MethodInfo for the Invoke method. used by Delegate and
1575 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
1576 method conversions if the target type is a delegate.
1578 Removed extra debugging nops.
1580 (LocalVariableReference): Turn the `local_info' into a public
1583 Add `prepared' field, the same hack used for FieldExprs to cope
1584 with composed assignments, as Local variables do not necessarily
1585 operate purely on the stack as they used to: they can be captured
1588 Add `temp' for a temporary result, like fields.
1590 Refactor DoResolve and DoResolveLValue into DoResolveBase.
1592 It now copes with Local variables that are captured and emits the
1593 proper instance variable to load it from a field in the captured
1596 (ParameterReference.DoResolveBase): During the resolve phase,
1597 capture parameters if we are in an anonymous method.
1599 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
1600 anonymous method, use the EmitContext helper routines to emit the
1601 parameter reference.
1603 * iterators.cs: Set RemapToProxy to true/false during the
1606 * parameters.cs (GetParameterByName): New helper method.
1608 * typemanager.cs (anonymous_method_type) a new type that
1609 represents an anonyous method. This is always an internal type,
1610 used as a fencepost to test against the anonymous-methodness of an
1613 2004-10-20 Marek Safar <marek.safar@seznam.cz>
1615 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
1617 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
1619 2004-11-10 Martin Baulig <martin@ximian.com>
1621 * expression.cs (Invocation.BetterFunction): If two methods have
1622 equal parameter types, but only one of them is generic, the
1623 non-generic one wins.
1624 (New.DoResolve): Don't set `is_struct' to false if we're a generic
1625 instance; just use `Type.IsValueType' to determine whether
1626 something is a struct or not.
1627 (MemberAccess.DoResolveAsTypeStep): Don't modify the `args' field,
1628 so we can be called multiple times.
1630 2004-11-10 Martin Baulig <martin@ximian.com>
1632 * generic.cs (TypeParameter.DefineConstraints): New public method.
1633 (TypeParameter.CheckAccessLevel): Override this and return true.
1634 (ConstructedType.ResolveType): Renamed to DoResolveType(), don't
1635 override ResolveType() anymore.
1636 (ConstructedType.DoResolveAsTypeStep): Call DoResolveType() here.
1638 2004-11-10 Martin Baulig <martin@ximian.com>
1640 * rootcontext.cs (RootContext.LookupType): If we're a nested type,
1641 call DeclSpace.ResolveNestedType() on it.
1643 2004-11-10 Martin Baulig <martin@ximian.com>
1645 * support.cs (ReflectionParameters.ParameterModifier): If `gpd' is
1646 non-null, call ParameterModifier() on it.
1648 2004-11-10 Martin Baulig <martin@ximian.com>
1651 (Iterators): Added `current_type' and `this_type' fields.
1652 (Iterators.DefineIterator): Create a new EmitContext and store it
1653 in `ec'; compute `this_type'.
1655 2004-11-10 Martin Baulig <martin@ximian.com>
1658 (TypeManager.IsPrivateAccessible): New public method.
1659 (Closure.Filter): Use IsPrivateAccessible() instead of IsEqual().
1661 2004-11-10 Martin Baulig <martin@ximian.com>
1663 * class.cs (TypeContainer.DefineType): Call
1664 TypeBuilder.DefineGenericParameters() before resolving the type
1666 (MethodData.parent_method): New protected field.
1667 (MethodData..ctor): Added `MethodInfo parent_method' argument.
1668 (MethodData.Define): Compute `parent_method'.
1671 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
1672 (MemberCore.GetClsCompliantAttributeValue): Likewise.
1673 (DeclSpace.ec): New protected field; store the EmitContext here.
1674 (DeclSpace.EmitContext): New public property.
1675 (DeclSpace.ResolveType): Un-comment from the [Obsolte] attribute.
1676 (DeclSpace.ResolveNestedType): New public method.
1677 (DeclSpace.ResolveTypeExpr): Just call ResolveAsTypeTerminal() here.
1678 (DeclSpace.NestedAccessible): Added `Type tb' argument.
1679 (DeclSpace.FamilyAccessible): Likewise.
1680 (DeclSpace.FindType): Call ResolveNestedType() for nested types.
1681 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
1684 * delegate.cs (Delegate.Define): Store the EmitContext in the `ec'
1687 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
1688 (Enum.Emit): Don't create a new EmitContext.
1690 2004-10-18 Martin Baulig <martin@ximian.com>
1692 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
1693 `Type' directly, but call ResolveType() on it.
1694 (Catch.Resolve): Likewise.
1695 (Foreach.Resolve): Likewise.
1697 2004-10-18 Martin Baulig <martin@ximian.com>
1699 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
1700 `Type' directly, but call ResolveType() on it.
1701 (Probe.DoResolve): Likewise.
1702 (ArrayCreation.LookupType): Likewise.
1703 (TypeOf.DoResolve): Likewise.
1704 (SizeOf.DoResolve): Likewise.
1706 2004-10-18 Raja R Harinath <rharinath@novell.com>
1708 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
1711 2004-10-17 John Luke <john.luke@gmail.com>
1713 * class.cs (Operator.GetSignatureForError): use CSharpName
1715 * parameter.cs (Parameter.GetSignatureForError): Returns
1716 correct name even if was not defined.
1718 2004-10-13 Raja R Harinath <rharinath@novell.com>
1721 * class.cs (TypeContainer.EmitContext): New property.
1722 (DefineNestedTypes): Create an emitcontext for each part.
1723 (MethodCore.DoDefineParameters): Use container's emitcontext.
1724 Pass type array to InternalParameters.
1725 (MemberBase.DoDefine): Use container's emitcontext.
1726 (FieldMember.Define): Likewise.
1727 (Event.Define): Likewise.
1728 (SetMethod.GetParameterInfo): Change argument to EmitContext.
1729 Pass type array to InternalParameters.
1730 (SetIndexerMethod.GetParameterInfo): Likewise.
1731 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
1732 * delegate.cs (Define): Pass emitcontext to
1733 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
1734 array to InternalParameters.
1735 * expression.cs (ParameterReference.DoResolveBase): Pass
1736 emitcontext to GetParameterInfo.
1737 (ComposedCast.DoResolveAsTypeStep): Remove check on
1738 ec.ResolvingTypeTree.
1739 * parameter.cs (Parameter.Resolve): Change argument to
1740 EmitContext. Use ResolveAsTypeTerminal.
1741 (Parameter.GetSignature): Change argument to EmitContext.
1742 (Parameters.ComputeSignature): Likewise.
1743 (Parameters.ComputeParameterTypes): Likewise.
1744 (Parameters.GetParameterInfo): Likewise.
1745 (Parameters.ComputeAndDefineParameterTypes): Likewise.
1746 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
1747 * support.cs (InternalParameters..ctor): Remove variant that takes
1749 * typemanager.cs (system_intptr_expr): New.
1750 (InitExpressionTypes): Initialize it.
1752 2004-10-12 Chris Toshok <toshok@ximian.com>
1754 * cs-parser.jay: fix location for try_statement and catch_clause.
1756 2004-10-18 Martin Baulig <martin@ximian.com>
1758 * class.cs (FieldMember.Define): Don't access the TypeExpr's
1759 `Type' directly, but call ResolveType() on it.
1760 (MemberBase.DoDefine): Likewise.
1762 * expression.cs (New.DoResolve): Don't access the TypeExpr's
1763 `Type' directly, but call ResolveType() on it.
1764 (ComposedCast.DoResolveAsTypeStep): Likewise.
1766 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
1767 `Type' directly, but call ResolveType() on it.
1769 2004-10-17 John Luke <john.luke@gmail.com>
1771 * class.cs (Operator.GetSignatureForError): use CSharpName
1773 * parameter.cs (Parameter.GetSignatureForError): Returns
1774 correct name even if was not defined.
1776 2004-10-13 Raja R Harinath <rharinath@novell.com>
1779 * class.cs (TypeContainer.EmitContext): New property.
1780 (DefineNestedTypes): Create an emitcontext for each part.
1781 (MethodCore.DoDefineParameters): Use container's emitcontext.
1782 Pass type array to InternalParameters.
1783 (MemberBase.DoDefine): Use container's emitcontext.
1784 (FieldMember.Define): Likewise.
1785 (Event.Define): Likewise.
1786 (SetMethod.GetParameterInfo): Change argument to EmitContext.
1787 Pass type array to InternalParameters.
1788 (SetIndexerMethod.GetParameterInfo): Likewise.
1789 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
1790 * delegate.cs (Define): Pass emitcontext to
1791 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
1792 array to InternalParameters.
1793 * expression.cs (ParameterReference.DoResolveBase): Pass
1794 emitcontext to GetParameterInfo.
1795 (ComposedCast.DoResolveAsTypeStep): Remove check on
1796 ec.ResolvingTypeTree.
1797 * parameter.cs (Parameter.Resolve): Change argument to
1798 EmitContext. Use ResolveAsTypeTerminal.
1799 (Parameter.GetSignature): Change argument to EmitContext.
1800 (Parameters.ComputeSignature): Likewise.
1801 (Parameters.ComputeParameterTypes): Likewise.
1802 (Parameters.GetParameterInfo): Likewise.
1803 (Parameters.ComputeAndDefineParameterTypes): Likewise.
1804 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
1805 * support.cs (InternalParameters..ctor): Remove variant that takes
1807 * typemanager.cs (system_intptr_expr): New.
1808 (InitExpressionTypes): Initialize it.
1810 2004-10-12 Chris Toshok <toshok@ximian.com>
1812 * cs-parser.jay: fix location for try_statement and catch_clause.
1814 2004-10-07 Raja R Harinath <rharinath@novell.com>
1816 More DeclSpace.ResolveType avoidance.
1817 * decl.cs (MemberCore.InUnsafe): New property.
1818 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
1819 with newly created EmitContext.
1820 (FieldMember.Define): Likewise.
1821 * delegate.cs (Delegate.Define): Likewise.
1822 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
1823 only if normal name-lookup fails.
1824 (TypeExpr.DoResolve): Enable error-checking.
1825 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
1826 (SizeOf.DoResolve): Likewise.
1827 (ComposedCast.DoResolveAsTypeStep): Likewise.
1828 (StackAlloc.DoResolve): Likewise.
1829 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
1830 (Block.Unsafe): New property.
1831 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
1832 (Unsafe): Set 'unsafe' flag of contained block.
1833 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
1834 (Fixed.Resolve): Likewise.
1835 (Catch.Resolve): Likewise.
1836 (Using.ResolveLocalVariableDecls): Likewise.
1837 (Foreach.Resolve): Likewise.
1839 2004-10-05 John Luke <john.luke@gmail.com>
1841 * cs-parser.jay: add location to error CS0175
1843 2004-10-04 Miguel de Icaza <miguel@ximian.com>
1845 * ecore.cs (Expression.Constantity): Add support for turning null
1848 * const.cs (Const.Define): Allow constants to be reference types
1849 as long as the value is Null.
1851 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
1853 * namespace.cs (NamespaceEntry.Using): No matter which warning
1854 level is set, check if this namespace name has already been added.
1856 2004-10-03 Ben Maurer <bmaurer@ximian.com>
1858 * expression.cs: reftype [!=]= null should always use br[true,false].
1861 2004-10-03 Marek Safar <marek.safar@seznam.cz>
1864 * attribute.cs: Enum conversion moved to
1865 GetAttributeArgumentExpression to be applied to the all
1868 2004-10-01 Raja R Harinath <rharinath@novell.com>
1870 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
1871 * class.c (TypeContainer.DefineType): Flag error if
1872 base types aren't accessible due to access permissions.
1873 * decl.cs (DeclSpace.ResolveType): Move logic to
1874 Expression.ResolveAsTypeTerminal.
1875 (DeclSpace.ResolveTypeExpr): Thin layer over
1876 Expression.ResolveAsTypeTerminal.
1877 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
1878 Refactor code into NestedAccess. Use it.
1879 (DeclSpace.NestedAccess): New.
1880 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
1881 argument to silence errors. Check access permissions.
1882 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
1883 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
1884 (Cast.DoResolve): Likewise.
1885 (New.DoResolve): Likewise.
1886 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
1887 (TypeOf.DoResolve): Likewise.
1889 * expression.cs (Invocation.BetterConversion): Return the Type of
1890 the better conversion. Implement section 14.4.2.3 more faithfully.
1891 (Invocation.BetterFunction): Make boolean. Make correspondence to
1892 section 14.4.2.2 explicit.
1893 (Invocation.OverloadResolve): Update.
1894 (Invocation): Remove is_base field.
1895 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
1896 (Invocation.Emit): Likewise.
1898 2004-09-24 Marek Safar <marek.safar@seznam.cz>
1900 * cs-parser.jay: Reverted 642 warning fix.
1902 2004-09-23 Marek Safar <marek.safar@seznam.cz>
1905 * decl.cs (FindMemberWithSameName): Indexer can have more than
1908 2004-09-23 Marek Safar <marek.safar@seznam.cz>
1910 * expression.cs (LocalVariableReference.DoResolveLValue):
1911 Do not report warning 219 for out values.
1912 (EmptyExpression.Null): New member to avoid extra allocations.
1914 2004-09-23 Marek Safar <marek.safar@seznam.cz>
1916 * cs-parser.jay: Fix wrong warning 642 report.
1918 * cs-tokenizer.cs (CheckNextToken): New helper;
1919 Inspect next character if is same as expected.
1921 2004-09-23 Martin Baulig <martin@ximian.com>
1923 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
1924 (Convert.ImplicitReferenceConversionExists): Likewise.
1926 2004-11-09 Raja R Harinath <rharinath@novell.com>
1928 * Makefile (DISTFILES): Comment out a few missing files.
1930 2004-10-29 Raja R Harinath <rharinath@novell.com>
1932 * Makefile (bootstrap_libs,bootstrap_libfiles): New.
1933 (bootstrap-libs): New target. Invokes the net_2_0_bootstrap profile.
1934 (gmcs.exe): Invoke bootstrap-libs.
1935 (clean-local): Clean the net_2_0_bootstrap profile too.
1936 (PROGRAM_INSTALL_DIR): New.
1937 (install-local): Use it.
1939 2004-10-13 Martin Baulig <martin@ximian.com>
1941 * generic.cs (TypeManager.InflatedConstraints): New nested class.
1942 (TypeParameter.DefineType): If we're a method type parameter and
1943 that method is overriding something, "inflate" its constraints.
1945 2004-10-12 Martin Baulig <martin@ximian.com>
1947 * expression.cs (MemberAccess.DoResolve): If we're a SimpleName
1948 and have type arguments, create and resolve a ConstructedType.
1950 2004-10-12 Martin Baulig <martin@ximian.com>
1952 * decl.cs (MemberCache.FindMemberToOverride): Use
1953 TypeManager.IsEqual() to compare the parameters and Type.Equals()
1954 to compare the invocationType.
1956 * typemanager.cs (TypeManager.IsEqual): Added support for arrays.
1957 When comparing two type parameters, only do the signature-only
1958 comparision for method type parameters.
1960 2004-10-11 Martin Baulig <martin@ximian.com>
1962 * report.cs: Don't make --fatal abort on warnings, we have
1963 -warnaserror for that.
1965 2004-10-11 Martin Baulig <martin@ximian.com>
1968 (TypeManager.IsEqualGenericType): Removed, use IsEqual() instead.
1969 (TypeManager.IsEqual): Call ourself recursively instead of using
1972 2004-10-11 Martin Baulig <martin@ximian.com>
1974 * class.cs (TypeContainer.DefineType): Only call TypeParameter.Define()
1975 on our own type parameters, not on the ones we inherit from a containing
1978 * expression.cs (Invocation.InferType): Use `==', not `Equals()' for
1981 * generic.cs (TypeParameter.Define): We may only be called once.
1983 * pending.cs (Pending.InterfaceMethod): Call TypeManager.Real_IsEqual()
1984 instead of TypeManager.IsEqual().
1986 2004-09-28 Martin Baulig <martin@ximian.com>
1989 (GenericConstraints.EffectiveBaseClass): New public property.
1990 (TypeParameter.GenericConstraints): New public property.
1991 (ConstructedType.CheckConstraints): Improved.
1993 * convert.cs (Convert.TypeParam_EffectiveBaseType): New private method.
1994 (Convert.TypeParameterConversion): New private method; use this in
1995 ImplicitReferenceConversion() and ImplicitReferenceConversionExists()
1996 for all conversions related to type parameters.
1998 2004-09-24 Martin Baulig <martin@ximian.com>
2000 * convert.cs (Convert.ImplicitReferenceConversion): Added implicit
2001 type parameter conversions for type parameters which are known to
2004 2004-09-24 Martin Baulig <martin@ximian.com>
2006 * generic.cs (GenericConstraints): Added `IsReferenceType' and
2007 `IsValueType' properties.
2009 * support.cs (ReflectionConstraints): Use
2010 Type.GetGenericParameterConstraints() instead of the old hack.
2012 2004-09-24 Martin Baulig <martin@ximian.com>
2014 * generic.cs (GenericConstraints): Moved here and made it an
2017 * support.cs (GenericConstraints): Moved to generic.cs.
2019 2004-09-24 Martin Baulig <martin@ximian.com>
2022 (ReflectionConstraints): Un-nested this class and made it public.
2025 (TypeManager.GetTypeParameterConstraints): New public method.
2026 (TypeManager.HasConstructorConstraint): Use the attributes.
2028 2004-09-24 Martin Baulig <martin@ximian.com>
2030 * support.cs (GenericConstraints): Replaced `HasConstructor',
2031 `IsReferenceType' and `IsValueType' with `Attributes'.
2032 (ReflectionParameters.ReflectionConstraints): Removed the Create()
2033 method and made the .ctor public.
2035 * generic.cs (Constraints.Attributes): New public property.
2036 (Constraints): Renamed `HasConstructor' -> `HasConstructorConstraint',
2037 `IsReferenceType' -> `HasReferenceTypeConstraint' and
2038 `IsValueType' -> `HasValueTypeConstraint'.
2040 2004-09-23 Martin Baulig <martin@ximian.com>
2042 * generic.cs (Constraints): Reflect latest runtime changes.
2044 2004-09-23 Martin Baulig <martin@ximian.com>
2046 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
2047 (Convert.ImplicitReferenceConversionExists): Likewise.
2049 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2051 * class.cs (Operator.Define): Add error 448 and 559 report.
2053 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2055 * class.cs (MemberBase.IsTypePermitted): New protected
2056 method for checking error CS0610.
2058 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2060 * class.cs (TypeContainer.HasExplicitLayout): New property
2061 Returns whether container has StructLayout attribute set Explicit.
2062 (FieldMember): New abstract class for consts and fields.
2063 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
2064 (Field): Reuse FieldMember.
2066 * const.cs (Const): Reuse FieldMember.
2068 * rootcontext.cs: EmitConstants call moved to class.
2070 2004-09-22 Martin Baulig <martin@ximian.com>
2072 Marek and me just fixed one of our oldest bugs: #28562 :-)
2074 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
2076 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
2077 we're an EnumConstant, just return that.
2078 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
2079 an EnumConstant. In this case, we need to use GetValueAsEnumType()
2080 to get the value which'll actually be written into the attribute.
2081 However, we have to use GetValue() to access the attribute's value
2084 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2086 * constant.cs (Constant.IsNegative): New abstract property
2089 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
2090 (StackAlloc.DoResolve): Reused IsNegative.
2092 2004-09-22 Martin Baulig <martin@ximian.com>
2094 * typemanager.cs (TypeManager.LookupGenericTypeContainer): New
2095 public method; like LookupTypeContainer, but also works for
2098 * report.cs (Report.SymbolRelatedToPreviousError): Use
2099 TypeManager.LookupGenericTypeContainer().
2101 2004-09-22 Martin Baulig <martin@ximian.com>
2103 Thanks to Peter Sestoft for this bug report.
2105 * expression.cs (Conditional): If both the `trueExpr' and the
2106 `falseExpr' is a NullLiteral, return a NullLiteral.
2108 2004-09-22 Martin Baulig <martin@ximian.com>
2110 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
2111 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
2112 for the "get_Current" call.
2114 2004-09-21 Martin Baulig <martin@ximian.com>
2116 * convert.cs (Convert.ImplicitReferenceConversion): When
2117 converting to an interface type, first check whether we're
2118 converting from a reference type.
2120 2004-09-14 Martin Baulig <martin@ximian.com>
2122 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
2124 2004-09-14 Marek Safar <marek.safar@seznam.cz>
2127 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
2128 called and is obsolete then this member suppress message
2129 when call is inside next [Obsolete] method or type.
2131 * expression.cs: Use TestObsoleteMethodUsage member.
2133 2004-09-14 Martin Baulig <martin@ximian.com>
2135 * genericparser.cs: Removed.
2137 2004-09-13 Marek Safar <marek.safar@seznam.cz>
2139 * class.cs (MethodCore.CheckBase): Fix bug #65757.
2141 2004-09-12 Marek Safar <marek.safar@seznam.cz>
2143 * attribute.cs (Attribute.Resolve): Add error 653 report.
2145 * class.cs (Class.ApplyAttributeBuilder): Add error 641
2147 (Method.ApplyAttributeBuilder): Add error 685 report.
2148 (Operator.Define): Add error 564 report.
2150 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
2152 * expression.cs (Invocation.DoResolve): Add error
2155 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
2158 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2160 * class.cs (ConstructorInitializer.Resolve):
2161 Wrong error number (515->516).
2163 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2165 * class.cs (Indexer.Define): Add error 631 report.
2167 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2169 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
2171 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2173 * expression.cs (Probe.DoResolve): Add error CS0241 report.
2175 2004-09-10 Marek Safar <marek.safar@seznam.cz>
2177 * cs-parser.jay: Added error CS0241 report.
2179 2004-09-10 Raja R Harinath <rharinath@novell.com>
2181 * cs-parser.jay (fixed_statement): Introduce a scope for the
2182 declaration in the 'fixed' statement.
2184 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2186 * cs-parser.jay: Added CS0230 error report.
2188 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2190 * cs-parser.jay: Added errors CS0231 and CS0257 report.
2192 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2194 * expression.cs (Argument.Resolve): Added error CS0192 and
2197 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2199 C# 2.0 #pragma warning feature
2201 * cs-tokenizer.cs (PreProcessPragma): New method;
2202 Handles #pragma directive.
2204 * report.cs (WarningRegions): New class; Support
2205 class for #pragma warning directive. It tests whether
2206 warning is enabled for a given line.
2208 2004-09-08 Miguel de Icaza <miguel@ximian.com>
2210 * const.cs: Add more descriptive error report, tahnks to
2213 2004-09-08 Marek Safar <marek.safar@seznam.cz>
2215 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
2217 2004-09-07 Miguel de Icaza <miguel@ximian.com>
2219 * expression.cs: Apply patch from Ben: Remove dead code from
2220 ArrayCreation, and remove the TurnintoConstant call in const.cs,
2221 as that code just threw an exception anwyays.
2223 * const.cs: Remove the call to the turnintoconstant, for details
2226 * literal.cs: The type of the null-literal is the null type; So
2227 we use a placeholder type (literal.cs:System.Null, defined here)
2230 * expression.cs (Conditional.DoResolve): Remove some old code that
2231 is no longer needed, conversions have been fixed.
2233 (ArrayCreationExpression.DoResolve): Return false if we fail to
2234 resolve the inner expression.
2236 2004-09-07 Raja R Harinath <rharinath@novell.com>
2239 * cs-parser.jay (delegate_declaration): Record a delegate
2240 declaration as a type declaration.
2241 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
2243 2004-09-06 Miguel de Icaza <miguel@ximian.com>
2245 * parameter.cs: Do not crash if the type can not be resolved.
2247 * expression.cs: Report errors with unsafe pointers, fixes #64896
2249 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
2251 * expression.cs: Pointer arith always needs to do a conv.i
2252 if the operand is a long. fix 65320
2254 2004-09-04 Marek Safar <marek.safar@seznam.cz>
2256 Fixed cs0619-37.cs, cs0619-38.cs
2258 * enum.cs (GetObsoleteAttribute): Removed.
2260 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
2261 on Enum member is double staged. The first is tested member
2264 2004-09-04 Marek Safar <marek.safar@seznam.cz>
2266 Fixed #56986, #63631, #65231
2268 * class.cs: (TypeContainer.AddToMemberContainer): New method,
2269 adds member to name container.
2270 (TypeContainer.AddToTypeContainer): New method, adds type to
2272 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
2273 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
2274 AddOperator): Simplified by reusing AddToMemberContainer.
2275 (TypeContainer.UserDefinedStaticConstructor): Changed to property
2277 (Method.CheckForDuplications): Fixed implementation to test all
2279 (MemberBase): Detection whether member is explicit interface
2280 implementation is now in constructor.
2281 (MemberBase.UpdateMemberName): Handles IndexerName.
2282 (Accessor): Changed to keep also location information.
2283 (AbstractPropertyEventMethod): Is derived from MemberCore.
2284 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
2285 will be emited or not.
2286 (PropertyBase.AreAccessorsDuplicateImplementation):
2287 Tests whether accessors are not in collision with some method.
2288 (Operator): Is derived from MethodCore to simplify common
2291 * decl.cs (Flags.TestMethodDuplication): Test for duplication
2293 (DeclSpace.AddToContainer): Adds the member to defined_names
2294 table. It tests for duplications and enclosing name conflicts.
2296 * enum.cs (EnumMember): Clean up to reuse the base structures
2298 2004-09-03 Martin Baulig <martin@ximian.com>
2300 Merged latest changes into gmcs. Please keep this comment in
2301 here, it makes it easier for me to see what changed in MCS since
2302 the last time I merged.
2304 2004-09-03 Martin Baulig <martin@ximian.com>
2306 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
2307 into TypeContainer, to make partial classes work again.
2309 2004-09-03 Martin Baulig <martin@ximian.com>
2311 * rootcontext.cs (RootContext.V2): Removed.
2313 2004-03-23 Martin Baulig <martin@ximian.com>
2315 * expression.cs (Invocation.OverloadResolve): Added `bool
2316 may_fail' argument and use it instead of the Location.IsNull() hack.
2318 2004-09-09 Martin Baulig <martin@ximian.com>
2320 * cs-parser.jay (namespace_declaration): Fixed CS0134 reporting.
2322 2004-09-09 Martin Baulig <martin@ximian.com>
2324 * generic.cs (TypeParameter.DefineType): Added support for
2325 explicit interface methods.
2327 2004-09-09 Martin Baulig <martin@ximian.com>
2329 * README.Changes: New document. Started to list important changes
2330 between MCS and GMCS here.
2332 2004-09-08 Martin Baulig <martin@ximian.com>
2335 (TypeContainer.CheckRecursiveDefinition): New protected method.
2336 (TypeContainer.DefineType): Move the CS0146 check into
2337 CheckRecursiveDefinition().
2339 2004-09-06 Martin Baulig <martin@ximian.com>
2341 * generic.cs (ConstructedType.CheckConstraints): Allow builtin
2342 types for the constructor constraint.
2344 2004-09-03 Martin Baulig <martin@ximian.com>
2346 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
2347 into TypeContainer, to make partial classes work again.
2349 2004-09-03 Martin Baulig <martin@ximian.com>
2351 * rootcontext.cs (RootContext.V2): Removed.
2353 2004-03-23 Martin Baulig <martin@ximian.com>
2355 * expression.cs (Invocation.OverloadResolve): Added `bool
2356 may_fail' argument and use it instead of the Location.IsNull() hack.
2358 2004-09-03 Martin Baulig <martin@ximian.com>
2360 Merged latest changes into gmcs. Please keep this comment in
2361 here, it makes it easier for me to see what changed in MCS since
2362 the last time I merged.
2364 2004-09-03 Raja R Harinath <rharinath@novell.com>
2367 * expression.cs (BetterConversion): Don't allow either conversion
2368 to be null. Remove redundant implicit conversion test when 'q ==
2369 null' -- when this function is invoked, we already know that the
2370 implicit conversion exists.
2371 (BetterFunction): Assume that 'best' is non-null. Remove
2372 redundant reimplementation of IsApplicable when 'best' is null.
2373 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
2374 number of arguments.
2375 (IsAncestralType): Extract from OverloadResolve.
2376 (OverloadResolve): Make robust to the MethodGroupExpr being
2377 unsorted. Implement all the logic of Section 14.5.5.1, and
2378 support overloading of methods from multiple applicable types.
2379 Clean up logic somewhat. Don't pass null methods to BetterFunction.
2381 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
2382 (RealError, Warning): Append type of report to related symbol.
2384 2004-09-03 Marek Safar <marek.safar@seznam.cz>
2386 * enum.cs: Fixed CLS-Compliance checks for enum members.
2387 Error tests cs3008-8.cs, cs3014-8.cs
2389 2004-09-02 Marek Safar <marek.safar@seznam.cz>
2391 Fixed bug #62342, #63102
2392 * class.cs: ImplementIndexer uses member.IsExplicitImpl
2393 like ImplementMethod.
2395 2004-09-02 Marek Safar <marek.safar@seznam.cz>
2397 * attribute.cs (Attribute.GetAttributeArgumentExpression):
2400 2004-09-02 Martin Baulig <martin@ximian.com>
2402 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
2403 TypeManager.GetArgumentTypes() rather than calling GetParameters()
2406 2004-09-01 Marek Safar <marek.safar@seznam.cz>
2408 C# 2.0 Static classes implemented
2410 * class.cs (TypeContainer): instance_constructors,
2411 initialized_fields, initialized_static_fields,
2412 default_constructor, base_inteface_types are protected to be
2413 accessible from StaticClass.
2414 (TypeContainer.DefineDefaultConstructor): New virtual method
2415 for custom default constructor generating
2416 (StaticClass): New class to handle "Static classes" feature.
2418 * cs-parser.jay: Handle static keyword on class like instance
2421 * driver.cs: Added "/langversion" command line switch with two
2422 options (iso-1, default).
2424 2004-08-31 Marek Safar <marek.safar@seznam.cz>
2426 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
2428 2004-08-31 Miguel de Icaza <miguel@ximian.com>
2430 * delegate.cs: Style.
2432 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
2434 * delegate.cs: Add seperate instance expr field for miguel.
2436 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
2438 * PointerArithmetic (Resolve): make sure we are not doing
2439 pointer arith on void*. Also, make sure we are resolved
2440 by not setting eclass until resolve.
2442 All callers: Make sure that PointerArithmetic gets resolved.
2444 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
2446 * ArrayCreation (LookupType): If the type does not resolve
2447 to an array, give an error.
2449 2004-08-27 Marek Safar <marek.safar@seznam.cz>
2451 * statement.cs (Try.Resolve): Fixed bug #64222
2453 2004-08-27 Martin Baulig <martin@ximian.com>
2456 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
2459 2004-08-26 Marek Safar <marek.safar@seznam.cz>
2461 * ecore.cs (Constantify): Get underlying type via
2462 System.Enum.GetUnderlyingType to avoid StackOverflow on the
2463 Windows in special cases.
2465 2004-08-26 Marek Safar <marek.safar@seznam.cz>
2467 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
2468 for obtaining also private methods.
2469 (GetRemoveMethod): Used GetRemoveMethod (true)
2470 for obtaining also private methods.
2472 2004-09-02 Martin Baulig <martin@ximian.com>
2474 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
2475 TypeManager.GetArgumentTypes() rather than calling GetParameters()
2478 2004-08-27 Martin Baulig <martin@ximian.com>
2481 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
2484 2004-08-25 Martin Baulig <martin@ximian.com>
2486 * support.cs (ReflectionParameters..ctor): If this is a generic
2487 method, retrieve and store its type parameters.
2488 (InternalParameters..ctor): Added `TypeParameter[]' argument.
2489 (ReflectionParameters.GenericConstraints): The argument specifies
2490 the type parameter, not the method parameter.
2491 (InternalParameters.GenericConstraints): Likewise.
2493 * generic.cs (TypeParameter.DefineType): Correctly handle
2494 constraints wrt. generic methods in interfaces and their
2497 2004-08-24 Martin Baulig <martin@ximian.com>
2499 * generic.cs (TypeParameter.IsSubclassOf): New public method.
2500 (Constraints.IsSubclassOf): New internal method.
2502 * typemanager.cs (TypeManager.FindMembers): Added special support
2503 for GenericTypeParameterBuilder's.
2504 (TypeManager.IsSubclassOf, IsFamilyAccessible): Added support for
2507 2004-08-24 Martin Baulig <martin@ximian.com>
2510 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
2511 this for accessibility checks.
2512 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
2513 IsNestedFamilyAccessible.
2514 (TypeManager.IsSubclassOf): New method, do what the name actually
2517 2004-08-24 Martin Baulig <martin@ximian.com>
2519 * expression.cs (MemberAccess.DoResolve): When resolving ourselves
2520 as a SimpleName, include the generic arity.
2522 2004-08-24 Martin Baulig <martin@ximian.com>
2524 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
2525 MethodAttributes.HideBySig for operators.
2527 2004-08-23 Martin Baulig <martin@ximian.com>
2529 Back to the old error reporting system :-)
2531 * report.cs (Message): Removed.
2532 (Report.MessageData, ErrorData, WarningData): Removed.
2533 (Report.Error, Warning): Back to the old system.
2535 2004-08-23 Martin Baulig <martin@ximian.com>
2537 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
2539 * class.cs (TypeContainer.ParentContainer): New public virtual
2540 method; replaces the explicit interface implementation.
2541 (ClassPart.ParentContainer): Override.
2543 2004-08-23 Martin Baulig <martin@ximian.com>
2545 * statement.cs (Switch): Added support for constant switches; see
2546 #59428 or test-285.cs.
2548 2004-08-22 Marek Safar <marek.safar@seznam.cz>
2551 * statement.cs (GetEnumeratorFilter): Removed useless
2552 logic because C# specs is strict. GetEnumerator must be
2555 2004-08-22 Martin Baulig <martin@ximian.com>
2557 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2558 a switch and may break, reset the barrier. Fixes #59867.
2560 2004-08-22 Marek Safar <marek.safar@seznam.cz>
2562 CLS-Compliance speed up (~5% for corlib)
2564 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
2565 New method. Tests container for CLS-Compliant names
2567 * class.cs (TypeContainer.VerifyClsName): New method.
2568 Checks whether container name is CLS Compliant.
2569 (Constructor): Implements IMethodData.
2571 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
2572 low-case table for CLS Compliance test.
2573 (MemberCache.VerifyClsParameterConflict): New method.
2574 Checks method parameters for CS3006 error.
2576 * enum.cs (EnumMember): Is derived from MemberCore.
2577 (Enum.VerifyClsName): Optimized for better performance.
2579 2004-08-06 Marek Safar <marek.safar@seznam.cz>
2581 * report.cs: Renamed Error_T to Error and changed all
2584 2004-08-06 Marek Safar <marek.safar@seznam.cz>
2586 * class.cs (TypeContainer.IndexerArrayList): New inner class
2587 container for indexers.
2588 (TypeContainer.DefaultIndexerName): New constant for default
2589 indexer name. Replaced all "Item" with this constant.
2590 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
2592 * typemanager.cs (TypeManager.default_member_ctor): Cache here
2593 DefaultMemberAttribute constructor.
2595 2004-08-05 Martin Baulig <martin@ximian.com>
2597 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
2600 2004-08-05 Marek Safar <marek.safar@seznam.cz>
2602 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
2603 multi platforms problem.
2605 * compiler.csproj: Included shared files.
2607 2004-08-04 Marek Safar <marek.safar@seznam.cz>
2609 Fix bug 60333, 55971 in the more general way
2610 * attribute.cs (Attribute.GetAttributeArgumentExpression):
2611 Added arg_type argument for constant conversion.
2612 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
2614 2004-08-04 Marek Safar <marek.safar@seznam.cz>
2617 * class.cs (TypeContainer ): New inner classes MethodArrayList,
2618 OperatorArrayList, MethodCoreArrayList for typecontainer
2619 containers. Changed class member types to these new types.
2620 (MethodArrayList.DefineMembers): Added test for CS0659.
2622 2004-08-04 Miguel de Icaza <miguel@ximian.com>
2624 * cfold.cs: Synchronize the folding with the code in expression.cs
2625 Binary.DoNumericPromotions for uint operands.
2627 * attribute.cs: Revert patch from Raja, it introduced a regression
2628 while building Blam-1.2.1 (hard to isolate a test case).
2630 2004-08-04 Marek Safar <marek.safar@seznam.cz>
2634 (TypeContainer.Define): Renamed to DefineContainerMembers because of
2636 (MethodCore.parent_method): New member. The method we're overriding
2637 if this is an override method.
2638 (MethodCore.CheckBase): Moved from Method class and made common.
2639 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
2641 (MethodCore.CheckForDuplications): New abstract method. For custom
2642 member duplication search in a container
2643 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
2644 method and its return type.
2645 (Event.conflict_symbol): New member. Symbol with same name in the
2649 (MemberCache.FindMemberWithSameName): New method. The method
2650 is looking for conflict with inherited symbols.
2652 2004-08-04 Martin Baulig <martin@ximian.com>
2654 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
2656 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
2658 2004-08-03 Marek Safar <marek.safar@seznam.cz>
2660 * report.cs (Message): New enum for better error, warning reference in
2662 (MessageData): New inner abstract class. It generally handles printing of
2663 error and warning messages.
2664 Removed unused Error, Warning, Message methods.
2666 2004-08-03 Marek Safar <marek.safar@seznam.cz>
2668 Fix for cs0592-8.cs test
2670 (Attributable.ValidAttributeTargets): Made public.
2671 (Attribute.ExplicitTarget): New member for explicit target value.
2672 (Attribute.CheckTargets): Now we translate explicit attribute
2673 target to Target here.
2675 2004-08-03 Ben Maurer <bmaurer@ximian.com>
2677 * ecore.cs (MethodGroupExpr): new IsBase property.
2679 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
2681 * delegate.cs (DelegateCreation): store a MethodGroupExpr
2682 rather than an instance expr.
2684 (DelegateCreation.Emit): Use the method group rather than
2685 the instance expression. Also, if you have base.Foo as the
2686 method for a delegate, make sure to emit ldftn, not ldftnvirt.
2688 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
2690 (NewDelegate.DoResolve): Only check for the existance of Invoke
2691 if the method is going to be needed. Use MethodGroupExpr.
2693 (NewDelegate.Emit): Remove, DelegateCreation implements this.
2695 * expression.cs: For pointer arith., make sure to use
2696 the size of the type, not the size of the pointer to
2699 2004-08-03 Marek Safar <marek.safar@seznam.cz>
2702 * class.cs (Class): Added error CS0502 test.
2704 2004-08-03 John Luke <jluke@cfl.rr.com>
2705 Raja R Harinath <rharinath@novell.com>
2708 * attribute.cs (Attribute.complained_before): New flag.
2709 (Attribute.ResolveType, Attribute.Resolve),
2710 (Attribute.DefinePInvokeMethod): Set it.
2711 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
2713 2004-08-03 Martin Baulig <martin@ximian.com>
2715 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
2716 use a user-defined operator; we still need to do numeric
2717 promotions in case one argument is a builtin type and the other
2718 one has an implicit conversion to that type. Fixes #62322.
2720 2004-08-18 Martin Baulig <martin@ximian.com>
2722 * class.cs (Method.Define): Use the correct method name when
2723 creating the MethodBuilder for a generic method.
2725 2004-08-17 Martin Baulig <martin@ximian.com>
2727 * generic.cs (Constraints): Support type parameter constraints.
2729 2004-08-16 Martin Baulig <martin@ximian.com>
2731 * cs-tokenizer.cs (Tokenizer.TypeOfParsing): New public property.
2732 (Token.GENERIC_DIMENSION): New token; this is returned if we
2733 encounter an unbound generic type in a typeof() expression.
2735 * cs-parser.jay (opt_type_argument_list): Added GENERIC_DIMENSION;
2736 this token is only generated while parsing a typeof() expression.
2737 (typeof_expression): Removed the old unbound_type hack.
2739 * generic.cs (TypeArguments.IsUnbound): New public property.
2741 * decl.cs (MemberName): Added support for unbound types.
2743 2004-08-14 Martin Baulig <martin@ximian.com>
2746 (TypeManager.IsEqualGenericInstance): New static method.
2747 (TypeManager.IsSubclassOrNestedChildOf, IsSubclassOf): This is
2748 just used to check accessibility, so follow the rules of 26.1.6.
2750 * expression.cs (MemberAccess.ResolveAsTypeStep): Return a
2751 ConstructedType instead of a TypeExpression if we have type arguments.
2753 * cs-parser.jay (typeof_expression): Support unbound generic types.
2755 * ecore.cs (UnboundTypeExpression): New public class.
2757 2004-08-12 Martin Baulig <martin@ximian.com>
2759 * typemanager.cs (TypeManager.IsNestedChildOf): Use
2760 TypeManager.IsEqual() rather than `=='.
2762 * decl.cs (DeclSpace.CheckAccessLevel): Use `tb.FullName' for
2763 generic instances as well.
2765 2004-08-12 Martin Baulig <martin@ximian.com>
2767 * expression.cs (Invocation.InferType): We can only infer method
2768 type parameters. Fixes #62647.
2770 2004-08-11 Martin Baulig <martin@ximian.com>
2772 * class.cs (TypeContainer.DefineType): Create the TypeBuilder
2773 before resolving the base classes.
2775 2004-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2777 * Makefile: install .mdb file too.
2779 2004-08-05 Martin Baulig <martin@ximian.com>
2781 * ecore.cs (FieldExpr.DoResolveLValue): If we're resolving a field
2782 initializer, the current type is just the TypeBuilder, not the
2783 instantiated generic type.
2784 (FieldExpr.IsFieldInitializer): New public property.
2786 2004-08-04 Martin Baulig <martin@ximian.com>
2788 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
2790 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
2792 2004-08-03 Martin Baulig <martin@ximian.com>
2794 * class.cs (MethodData.Define): If we're an explicit
2795 implementation, remove the generic arity from the type name.
2797 2004-08-03 Martin Baulig <martin@ximian.com>
2799 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
2800 use a user-defined operator; we still need to do numeric
2801 promotions in case one argument is a builtin type and the other
2802 one has an implicit conversion to that type. Fixes #62322.
2804 2004-08-02 Martin Baulig <martin@ximian.com>
2806 * class.cs (TypeContainer.ifaces): Make this a `Type[]', not a
2808 (TypeContainer.GetClassBases): Return the unexpanded list of
2809 interfaces; we expand them later.
2810 (TypeContainer.DefineType): After creating the TypeBuilder, call
2811 TypeManager.ExpandInterfaces() to get an expanded and resolved
2814 * ecore.cs (TypeExpr.GetInterfaces): Removed
2816 * generics.cs (Constraints.InterfaceConstraints): Remove.
2817 (TypeParameter.DefineType): Call TypeManager.RegisterBuilder() to
2818 register the interface constraints.
2821 (TypeManager.AddUserType): Removed the `ifaces' argument.
2822 (TypeManager.AddTypeParameter): Likewise.
2823 (TypeManager.AddUserInterface): Removed, was unused.
2824 (TypeManager.RegisterBuilder): Take a `Type[]' instead of a
2825 `TypeExpr[]' array for the interfaces.
2826 (TypeManager.ExpandInterfaces): Call this after the TypeBuilder
2827 has been defined, returns a list of the resolved interfaces types.
2828 (TypeManager.GetInterfaces): Return a `Type[]', not a `TypeExpr[]'.
2829 (TypeManager.GetExplicitInterfaces): Likewise.
2831 2004-08-02 Martin Baulig <martin@ximian.com>
2833 * expression.cs (Invocation.EmitCall): If we're invoking a method
2834 on a type parameter, use the new `Constrained' prefix opcode.
2836 2004-08-02 Martin Baulig <martin@ximian.com>
2838 * statement.cs (LocalInfo.Flags): Added `IsThis'.
2839 (LocalInfo.IsThis): New public property.
2840 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
2842 2004-08-01 Martin Baulig <martin@ximian.com>
2844 * class.cs (TypeContainer.GetClassBases): Don't set the default
2845 here since we may get called from GetPartialBases().
2846 (TypeContainer.DefineType): If GetClassBases() didn't return a
2847 parent, use the default one.
2849 2004-07-30 Martin Baulig <martin@ximian.com>
2851 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
2853 * class.cs (SourceMethod): New public class, derive from the
2854 symbol writer's ISourceMethod.
2855 (Method): Use the new symbol writer API.
2857 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
2858 as argument and use the new symbol writer.
2861 (SourceFile): Implement the symbol writer's ISourceFile.
2862 (Location.SymbolDocument): Removed.
2863 (Location.SourceFile): New public property.
2865 * symbolwriter.cs: Use the new symbol writer API.
2867 2004-07-30 Raja R Harinath <rharinath@novell.com>
2869 * Makefile (install-local): Remove. Functionality moved to
2872 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
2874 * Makefile: Install mcs.exe.config file together with mcs.exe.
2875 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
2876 correct runtime version.
2878 2004-07-25 Martin Baulig <martin@ximian.com>
2881 (TypeContainer.RegisterOrder): Removed, this was unused.
2882 (TypeContainer, interface_order): Removed.
2883 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
2884 TypeContainer as argument since we can also be called with a
2885 `PartialContainer' for a partial class/struct/interface.
2886 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
2887 of checking whether we're an `Interface' - we could be a
2889 (PartialContainer.Register): Override; call
2890 AddClass()/AddStruct()/AddInterface() on our parent.
2892 * cs-parser.jay (interface_member_declaration): Add things to the
2893 `current_container', not the `current_class'.
2895 * rootcontext.cs (RegisterOrder): The overloaded version which
2896 takes an `Interface' was unused, removed.
2898 * typemanager.cs (TypeManager.LookupInterface): Return a
2899 `TypeContainer', not an `Interface'.
2900 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
2901 contain a `PartialContainer' for an interface, so check it's
2902 `Kind' to figure out what it is.
2904 2004-07-25 Martin Baulig <martin@ximian.com>
2906 * class.cs (Class.DefaultTypeAttributes): New public constant.
2907 (Struct.DefaultTypeAttributes): Likewise.
2908 (Interface.DefaultTypeAttributes): Likewise.
2909 (PartialContainer.TypeAttr): Override this and add the
2910 DefaultTypeAttributes.
2912 2004-07-25 Martin Baulig <martin@ximian.com>
2914 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
2915 we can just use the `Parent' field instead.
2917 2004-07-25 Martin Baulig <martin@ximian.com>
2919 * class.cs (TypeContainer.Emit): Renamed to EmitType().
2921 2004-07-25 Martin Baulig <martin@ximian.com>
2923 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
2924 our parts before defining any methods.
2925 (TypeContainer.VerifyImplements): Make this virtual.
2926 (ClassPart.VerifyImplements): Override and call VerifyImplements()
2927 on our PartialContainer.
2929 2004-07-25 Martin Baulig <martin@ximian.com>
2931 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
2933 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
2934 argument, we can just use the `Parent' field instead.
2937 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
2938 (MemberBase.DoDefine): Likewise.
2940 2004-07-24 Martin Baulig <martin@ximian.com>
2942 * decl.cs (MemberCore.Parent): New public field.
2943 (DeclSpace.Parent): Moved to MemberCore.
2945 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
2946 (MemberBase.ctor): Added TypeContainer argument, pass it to our
2948 (FieldBase, Field, Operator): Likewise.
2949 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
2950 (EventField, Event): Likewise.
2952 2004-07-23 Martin Baulig <martin@ximian.com>
2954 * class.cs (PartialContainer): New public class.
2955 (ClassPart): New public class.
2956 (TypeContainer): Added support for partial classes.
2957 (TypeContainer.GetClassBases): Splitted some of the functionality
2958 out into GetNormalBases() and GetPartialBases().
2960 * cs-tokenizer.cs (Token.PARTIAL): New token.
2961 (Tokenizer.consume_identifier): Added some hacks to recognize
2962 `partial', but only if it's immediately followed by `class',
2963 `struct' or `interface'.
2965 * cs-parser.jay: Added support for partial clases.
2967 2004-07-23 Martin Baulig <martin@ximian.com>
2969 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
2970 a `DeclSpace' and also made it readonly.
2971 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
2972 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
2973 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
2975 * cs-parser.jay: Pass the `current_class', not the
2976 `current_container' (at the moment, this is still the same thing)
2977 to a new Method, Property, Event, Indexer or Constructor.
2979 2004-07-23 Martin Baulig <martin@ximian.com>
2981 * cs-parser.jay (CSharpParser): Added a new `current_class' field
2982 and removed the `current_interface' one.
2983 (struct_declaration, class_declaration, interface_declaration):
2984 Set `current_class' to the newly created class/struct/interface;
2985 set their `Bases' and call Register() before parsing their body.
2987 2004-07-23 Martin Baulig <martin@ximian.com>
2989 * class.cs (Kind): New public enum.
2990 (TypeContainer): Made this class abstract.
2991 (TypeContainer.Kind): New public readonly field.
2992 (TypeContainer.CheckDef): New public method; moved here from
2994 (TypeContainer.Register): New public abstract method.
2995 (TypeContainer.GetPendingImplementations): New public abstract
2997 (TypeContainer.GetClassBases): Removed the `is_class' and
2998 `is_iface' parameters.
2999 (TypeContainer.DefineNestedTypes): Formerly known as
3001 (ClassOrStruct): Made this class abstract.
3003 * tree.cs (RootTypes): New public type.
3005 2004-07-20 Martin Baulig <martin@ximian.com>
3007 * tree.cs (Tree.RecordNamespace): Removed.
3008 (Tree.Namespaces): Removed.
3010 * rootcontext.cs (RootContext.IsNamespace): Removed.
3012 * cs-parser.jay (namespace_declaration): Just create a new
3013 NamespaceEntry here.
3015 2004-07-21 Lluis Sanchez Gual <lluis@novell.com>
3017 * Makefile: Install gmcs.exe.config file together with gmcs.exe.
3018 * gmcs.exe.config: Renamed from mcs.exe.config. Added supportedRuntime
3019 entry to make sure it runs in the correct runtime version.
3021 2004-07-18 Martin Baulig <martin@ximian.com>
3023 * generic.cs (ConstructedType.CheckConstraints): Improved
3024 constraints checking.
3026 2004-07-18 Martin Baulig <martin@ximian.com>
3028 * expression.cs (Invocation.BetterMethod): Call
3029 TypeManager.TypeToCoreType() on all types and removed my previous
3030 hack; we're already doig the right thing here.
3032 2004-07-17 Martin Baulig <martin@ximian.com>
3034 * decl.cs (MemberName.MakeName): Create the "class`1" names here.
3036 2004-07-16 Martin Baulig <martin@ximian.com>
3038 * iterators.cs: Added generics support.
3040 2004-07-16 Martin Baulig <martin@ximian.com>
3042 * iterators.cs: Rewrote this. We're now using one single Proxy
3043 class for both the IEnumerable and the IEnumerator interface and
3044 `Iterator' derives from Class so we can use the high-level API.
3046 * class.cs (TypeContainer.AddIterator): New method.
3047 (TypeContainer.DoDefineType): New protected virtual method, which
3048 is called from DefineType().
3049 (TypeContainer.DoDefineMembers): Call DefineType() and
3050 DefineMembers() on all our iterators.
3051 (TypeContainer.Emit): Call Emit() on all our iterators.
3052 (TypeContainer.CloseType): Call CloseType() on all our iterators.
3054 * codegen.cs (EmitContext.CurrentIterator): New public field.
3056 2004-07-15 Martin Baulig <martin@ximian.com>
3059 (TypeManager.not_supported_exception_type): New type.
3061 2004-07-14 Martin Baulig <martin@ximian.com>
3064 (TypeManager.generic_ienumerable_type): New type.
3065 (TypeManager.generic_ienumerator_type): New type.
3068 (RootContext.interfaces_first_stage): Added
3069 "System.Collections.Generic.IEnumerator`1" and
3070 "System.Collections.Generic.IEnumerable`1".
3072 2004-07-14 Martin Baulig <martin@ximian.com>
3074 * iterators.cs: Use real error numbers.
3076 2004-07-14 Martin Baulig <martin@ximian.com>
3078 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
3079 requires this to be a System.Collection.IEnumerable and not a
3080 class implementing that interface.
3081 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
3083 2004-07-13 Marek Safar <marek.safar@seznam.cz>
3085 * class.cs: Fixed previous fix, it broke some error tests.
3087 2004-07-12 Martin Baulig <martin@ximian.com>
3089 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
3092 2004-07-14 Martin Baulig <martin@ximian.com>
3094 * decl.cs, expression.cs, generic.cs: Use a backqoute (`) and not
3095 an exclamation mark (!) for the generic arity to reflect the
3096 latest spec changes; ie. use "System.Collections.Generic.IList`1".
3098 2004-07-13 Martin Baulig <martin@ximian.com>
3100 * cs-tokenizer.cs (Tokenizer.parse_less_than): Allow array rank
3101 specifiers being part of a type argument.
3103 2004-07-13 Martin Baulig <martin@ximian.com>
3105 * expression.cs (MemberAccess.ResolveAsTypeStep): Use the full `!'
3106 name for generic types.
3108 2004-07-13 Martin Baulig <martin@ximian.com>
3110 * assign.cs (Assign.DoResolve): Moved the CS0131 check up a little
3113 2004-07-09 Miguel de Icaza <miguel@ximian.com>
3115 * assign.cs (LocalTemporary): Add new argument: is_address,If
3116 `is_address' is true, then the value that we store is the address
3117 to the real value, and not the value itself.
3119 * ecore.cs (PropertyExpr): use the new local temporary
3120 stuff to allow us to handle X.Y += z (where X is a struct)
3122 2004-07-08 Martin Baulig <martin@ximian.com>
3124 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
3125 not always return, just like we're doing in Using.Resolve().
3127 2004-07-07 Miguel de Icaza <miguel@ximian.com>
3129 * cs-parser.jay (fixed_statement): flag this as Pinned.
3131 2004-07-06 Miguel de Icaza <miguel@ximian.com>
3133 * typemanager.cs (TypeManager): Removed MakePinned method, this
3134 mechanism is replaced with the .NET 2.x compatible mechanism of
3135 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
3137 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
3138 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
3139 `IsFixed' property which has a different meaning.
3141 2004-07-02 Raja R Harinath <rharinath@novell.com>
3143 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
3144 visible from inside a nested class, not just the names of the
3145 immediately enclosing class.
3148 2004-06-24 Raja R Harinath <rharinath@novell.com>
3150 * expression.cs (BetterConversion): Remove buggy special-case
3151 handling of "implicit constant expression conversions". At this
3152 point, we already know that the conversion is possible -- we're
3153 only checking to see which is better.
3155 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3157 * cs-parser.jay: Added error CS0210 test.
3159 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3161 * cs-parser.jay: Added error CS0134 test.
3163 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3166 * cs-parser.jay: Added error CS0145 test.
3168 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3170 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
3172 2004-06-23 Ben Maurer <bmaurer@ximian.com>
3174 * expression.cs (StackAlloc.Resolve): The argument may not
3175 be a constant; deal with this case.
3177 2004-06-23 Marek Safar <marek.safar@seznam.cz>
3179 * attribute.cs (IndexerName_GetIndexerName): Renamed to
3180 GetIndexerAttributeValue.
3181 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
3183 * class.cs (Indexer.Define): Added error tests for CS0415,
3186 2004-06-23 Miguel de Icaza <miguel@ximian.com>
3188 * attribute.cs (Attribute.Resolve): Keep field code in sync with
3191 2004-06-23 Martin Baulig <martin@ximian.com>
3193 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
3194 neither return nor throw, reset the barrier as well. Fixes #60457.
3196 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
3198 * class.cs : EventAttributes is now set to None by default.
3199 This fixes bug #60459.
3201 2004-06-18 Marek Safar <marek.safar@seznam.cz>
3204 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
3205 Don't throw exception but return null (it's sufficient now).
3207 2004-06-18 Marek Safar <marek.safar@seznam.cz>
3209 * typemanager.cs (GetArgumentTypes): Faster implementation.
3211 2004-06-18 Martin Baulig <martin@ximian.com>
3213 * attribute.cs (Attribute.Resolve): Check whether we're an
3214 EmptyCast which a Constant child. Fixes #60333.
3216 2004-06-17 Ben Maurer <bmaurer@ximian.com>
3218 * statement.cs (EmitCollectionForeach): Account for the fact that
3219 not all valuetypes are in areas which we can take the address of.
3220 For these variables, we store to a temporary variable. Also, make
3221 sure that we dont emit a `callvirt' on a valuetype method.
3223 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3225 * expression.cs (StackAlloc.DoReSolve): Added test for
3226 negative parameter (CS0247).
3228 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3231 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
3233 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3236 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
3239 2004-06-14 Marek Safar <marek.safar@seznam.cz>
3241 Fix bug #58254 & cs1555.cs, cs1556.cs
3242 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
3244 2004-06-14 Marek Safar <marek.safar@seznam.cz>
3246 * cs-parser.jay: Added error CS1669 test for indexers.
3248 2004-06-18 Martin Baulig <martin@ximian.com>
3250 * generics.cs (GenericMethod.ctor): Don't take an Attributes
3251 argument. Fixes #60441.
3253 2004-06-16 Ben Maurer <bmaurer@ximian.com>
3254 * ecore.cs (MethodGroupExpr.Name): Revert Martin's patch.
3255 The name needs to have the actual name of the method in order
3256 for other tests (such as the one in OverloadResolve for Invoke
3257 on a delegate) to work. As well, it does not really help
3258 error reporting because the method group had multiple methods.
3259 * Makefile: Remove MCS_DEBUG, you can enable with the DEBUG_FLAGS.
3260 Make profiling work.
3262 2004-06-13 Martin Baulig <martin@ximian.com>
3264 * cs-parser.jay: Don't allow generic attributes.
3266 2004-06-13 Martin Baulig <martin@ximian.com>
3268 * class.cs (MemberBase.DoDefineBase): New protected method.
3269 (MemberBase.DoDefine): Compute the `flags' in the new
3270 DoDefineBase() which must be called first.
3271 (Method.Define): Call DoDefineBase() first so we have the flags
3272 when defining the generic method.
3274 * cs-parser.jay (interface_method_declaration): Support generic methods.
3276 2004-06-13 Martin Baulig <martin@ximian.com>
3278 * decl.cs (TypeName): Removed.
3279 (MemberName): Removed TypeName and MemberNow; now we just have
3282 * cs-parser.jay: Don't distinguish between type arguments and type
3283 parameters in the grammar and simplified the rules a bit. The
3284 reduce/reduce conflicts are now gone (except the one we inherited
3287 2004-06-11 Martin Baulig <martin@ximian.com>
3289 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
3290 call this twice: for params and varargs methods.
3292 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3295 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
3297 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3299 * attribute.cs (Attribute.GetValidTargets): Made public.
3302 (AbstractPropertyEventMethod): New class for better code sharing.
3303 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
3305 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
3307 2004-06-09 Martin Baulig <martin@ximian.com>
3309 * cs-parser.jay: Removed a reduce/reduce conflict.
3311 2004-06-03 Martin Baulig <martin@ximian.com>
3313 * generic.cs (ConstructedType.GetMemberAccess): Renamed to
3314 GetSimpleName() and return a SimpleName.
3316 * ecore.cs (SimpleName.Arguments): New public field.
3317 (SimpleName): Added overloaded ctor which takes an additional
3318 TypeArguments argument.
3319 (SimpleName.SimpleNameResolve): Added support for generic methods.
3320 (MethodGroupExpr.ResolveGeneric): New public method. The code was
3321 formerly in MemberAccess.DoResolve(), but we also need it in
3322 SimpleNameResolve().
3324 * expression.cs (MemberAccess.DoResolve): Use the new
3325 MethodGroupExpr.ResolveGeneric().
3327 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3329 * decl.cs: If possible, use lookuptypedirect here. We can only do
3330 this if there is no `.' after the namespace. Avoids using
3331 LookupType, which does lots of slow processing.
3332 (FindNestedType) New method, does what it says :-).
3333 * namespace.cs: use LookupTypeDirect.
3334 * rootcontext.cs: use membercache, if possible.
3335 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
3337 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3340 According to the spec,
3342 In a member access of the form E.I, if E is a single identifier,
3343 and if the meaning of E as a simple-name (§7.5.2) is a constant,
3344 field, property, localvariable, or parameter with the same type as
3345 the meaning of E as a type-name (§3.8), then both possible
3346 meanings of E are permitted.
3348 We did not check that E as a simple-name had the same type as E as
3351 This trivial check gives us 5-7% on bootstrap time.
3353 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3355 * expression.cs (Invocation.OverloadResolve): Avoid the
3356 use of hashtables and boxing here by allocating on demand.
3358 2004-05-30 Martin Baulig <martin@ximian.com>
3360 * rootcontext.cs (RootContext.LookupType): Don't cache things if
3361 we're doing a silent lookup. Don't try to lookup nested types in
3362 TypeManager.object_type (thanks to Ben Maurer).
3364 2004-05-30 Martin Baulig <martin@ximian.com>
3366 Committing a patch from Ben Maurer.
3368 * rootcontext.cs (RootContext.LookupType): Cache negative results.
3370 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3372 * convert.cs: add a trivial cache for overload operator resolution.
3374 2004-05-31 Marek Safar <marek.safar@seznam.cz>
3377 (AttributeTester.GetObsoleteAttribute): Returns instance of
3378 ObsoleteAttribute when type is obsolete.
3381 (TypeContainer.VerifyObsoleteAttribute): Override.
3382 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
3383 (MethodCode.VerifyObsoleteAttribute): Override.
3384 (MemberBase.VerifyObsoleteAttribute): Override.
3387 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
3388 and report proper error.
3391 (Delegate.VerifyObsoleteAttribute): Override.
3394 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
3395 and report proper error.
3396 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
3399 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
3403 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
3404 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
3405 Added test for ObsoleteAttribute.
3408 (Catch): Derived from Statement.
3410 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3412 * decl.cs: If possible, use lookuptypedirect here. We can only do
3413 this if there is no `.' after the namespace. Avoids using
3414 LookupType, which does lots of slow processing.
3415 (FindNestedType) New method, does what it says :-).
3416 * namespace.cs: use LookupTypeDirect.
3417 * rootcontext.cs: use membercache, if possible.
3418 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
3420 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3423 According to the spec,
3425 In a member access of the form E.I, if E is a single identifier,
3426 and if the meaning of E as a simple-name (§7.5.2) is a constant,
3427 field, property, localvariable, or parameter with the same type as
3428 the meaning of E as a type-name (§3.8), then both possible
3429 meanings of E are permitted.
3431 We did not check that E as a simple-name had the same type as E as
3434 This trivial check gives us 5-7% on bootstrap time.
3436 2004-05-30 Marek Safar <marek.safar@seznam.cz>
3438 Fixed bug #59071 & cs0160.cs
3439 * statement.cs (Try.Resolve): Check here whether order of catch
3440 clauses matches their dependencies.
3442 2004-05-30 Marek Safar <marek.safar@seznam.cz>
3445 * ecore.cs (SimpleName.SimpleNameResolve): Added test for
3448 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3450 * expression.cs (Invocation.OverloadResolve): Avoid the
3451 use of hashtables and boxing here by allocating on demand.
3453 2004-05-30 Martin Baulig <martin@ximian.com>
3455 * rootcontext.cs (RootContext.LookupType): Don't cache things if
3456 we're doing a silent lookup. Don't try to lookup nested types in
3457 TypeManager.object_type (thanks to Ben Maurer).
3459 2004-05-30 Martin Baulig <martin@ximian.com>
3461 Committing a patch from Ben Maurer.
3463 * rootcontext.cs (RootContext.LookupType): Cache negative results.
3465 2004-05-29 Martin Baulig <martin@ximian.com>
3467 * class.cs (IMethodData.ShouldIgnore): New method.
3469 * typemanager.cs (TypeManager.MethodFlags): Don't take a
3470 `Location' argument, we don't need it anywhere. Use
3471 `IMethodData.ShouldIgnore ()' instead of
3472 `MethodData.GetMethodFlags ()'.
3473 (TypeManager.AddMethod): Removed.
3474 (TypeManager.AddMethod2): Renamed to AddMethod.
3476 2004-05-29 Martin Baulig <martin@ximian.com>
3478 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
3480 * convert.cs (Convert.ImplicitReferenceConversion): If we're
3481 converting from a class type S to an interface type and we already
3482 have an object on the stack, don't box it again. Fixes #52578.
3484 2004-05-29 Martin Baulig <martin@ximian.com>
3486 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
3487 Added support for `params' parameters. Fixes #59267.
3489 2004-05-29 Martin Baulig <martin@ximian.com>
3491 * literal.cs (NullPointer): Provide a private .ctor which sets
3492 `type' to TypeManager.object_type. Fixes #59048.
3494 2004-05-29 Martin Baulig <martin@ximian.com>
3496 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
3497 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
3499 * ecore.cs (EventExpr.instance_expr): Make the field private.
3501 2004-05-26 Marek Safar <marek.safar@seznam.cz>
3503 Fixed bug #50080 & cs0214-2.cs
3504 * expression.cs (Cast.DoResolve): Check unsafe context here.
3506 * statement.cs (Resolve.DoResolve): Likewise.
3508 2004-05-26 Martin Baulig <martin@ximian.com>
3510 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
3512 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
3513 (RootContext.LookupType): Pass down the `silent' flag.
3515 2004-05-25 Martin Baulig <martin@ximian.com>
3518 (MethodGroupExpr.IdenticalTypeName): New public property.
3519 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
3520 expression actually refers to a type.
3522 2004-05-25 Martin Baulig <martin@ximian.com>
3524 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
3525 for #56176 and made it actually work.
3527 2004-05-25 Martin Baulig <martin@ximian.com>
3529 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
3530 (FieldExpr, PropertyExpr): Override and implement
3531 CacheTemporaries. Fixes #52279.
3533 2004-05-25 Miguel de Icaza <miguel@ximian.com>
3535 * location.cs: In the new compiler listing a file twice is a
3536 warning, not an error.
3538 2004-05-24 Martin Baulig <martin@ximian.com>
3540 * enum.cs (Enum.DefineType): For the `BaseType' to be a
3541 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
3543 2004-05-24 Martin Baulig <martin@ximian.com>
3545 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
3546 walking the `using' list. Fixes #53921.
3548 2004-05-24 Martin Baulig <martin@ximian.com>
3550 * const.cs (Const.LookupConstantValue): Added support for
3551 EmptyCast's; fixes #55251.
3553 2004-05-24 Martin Baulig <martin@ximian.com>
3555 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
3556 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
3557 which does the CS0135 check. The reason is that we first need to
3558 check whether the variable actually exists.
3560 2004-05-24 Martin Baulig <martin@ximian.com>
3562 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
3563 than RootContext.LookupType() to find the explicit interface
3566 2004-05-24 Raja R Harinath <rharinath@novell.com>
3568 * Makefile: Simplify. Use executable.make.
3569 * mcs.exe.sources: New file. List of sources of mcs.exe.
3571 2004-05-24 Anders Carlsson <andersca@gnome.org>
3575 Use the invariant culture when doing String.Compare for CLS case
3578 2004-05-23 Martin Baulig <martin@ximian.com>
3580 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
3581 don't have any dots. Fixes #52622, added cs0246-8.cs.
3583 * namespace.cs (NamespaceEntry.Lookup): Likewise.
3585 2004-05-23 Marek Safar <marek.safar@seznam.cz>
3587 * class.cs (MemberBase.Define): Reuse MemberType member for
3588 resolved type. Other methods can use it too.
3590 2004-05-23 Martin Baulig <martin@ximian.com>
3592 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
3593 the variable also exists in the current block (otherwise, we need
3594 to report a CS0103). Fixes #58670.
3596 2004-05-23 Martin Baulig <martin@ximian.com>
3598 * flowanalysis.cs (Reachability.Reachable): Compute this
3599 on-the-fly rather than storing it as a field.
3601 2004-05-23 Martin Baulig <martin@ximian.com>
3603 * flowanalysis.cs (Reachability.And): Manually compute the
3604 resulting `barrier' from the reachability.
3606 2004-05-23 Marek Safar <marek.safar@seznam.cz>
3609 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
3610 instance of ObsoleteAttribute when symbol is obsolete.
3613 (IMethodData): Extended interface for ObsoleteAttribute support.
3615 2004-05-22 Marek Safar <marek.safar@seznam.cz>
3617 * attribute.cs: Fix bug #55970
3619 2004-05-22 Marek Safar <marek.safar@seznam.cz>
3623 (GetObsoleteAttribute): New method. Creates the instance of
3625 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
3626 ObsoleteAttribute when member is obsolete.
3627 (AttributeTester.Report_ObsoleteMessage): Common method for
3628 Obsolete error/warning reporting.
3631 (TypeContainer.base_classs_type): New member for storing parent type.
3634 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
3635 for this MemberCore.
3637 2004-05-21 Marek Safar <marek.safar@seznam.cz>
3639 * attribute.cs, const.cs: Fix bug #58590
3641 2004-05-21 Martin Baulig <martin@ximian.com>
3643 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
3644 out parameters if the end of the method is unreachable. Fixes
3647 2004-05-21 Marek Safar <marek.safar@seznam.cz>
3649 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
3650 Hari was right, why extra method.
3652 2004-05-21 Marek Safar <marek.safar@seznam.cz>
3654 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
3656 2004-05-20 Martin Baulig <martin@ximian.com>
3658 * delegate.cs: Convert this file to Unix mode - like the original
3661 2004-05-20 Martin Baulig <martin@ximian.com>
3663 * attribute.cs: Convert this file to Unix mode - like the original
3666 2004-05-19 Marek Safar <marek.safar@seznam.cz>
3668 Fix bug #58688 (MCS does not report error when the same attribute
3671 * attribute.cs (Attribute.Emit): Distinction between null and default.
3673 2004-05-19 Raja R Harinath <rharinath@novell.com>
3675 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
3676 of a top-level attribute without an attribute target.
3677 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
3679 (Attribute.Conditional_GetConditionName),
3680 (Attribute.Obsolete_GetObsoleteMessage): Update.
3681 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
3682 part of ScanForIndexerName.
3683 (Attribute.CanIgnoreInvalidAttribute): New function.
3684 (Attribute.ScanForIndexerName): Move to ...
3685 (Attributes.ScanForIndexerName): ... here.
3686 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
3687 (Attributes.Search): New internal variant that can choose not to
3688 complain if types aren't resolved. The original signature now
3690 (Attributes.GetClsCompliantAttribute): Use internal variant, with
3691 complaints suppressed.
3692 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
3693 only if it not useful.
3694 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
3695 top-level for attributes that are shared between the assembly
3696 and a top-level class.
3697 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
3698 * class.cs: Update to reflect changes.
3699 (DefineIndexers): Fuse loops.
3700 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
3701 a couple more variants of attribute names.
3703 2004-05-18 Marek Safar <marek.safar@seznam.cz>
3705 Fix bug #52585 (Implemented explicit attribute declaration)
3708 (Attributable.ValidAttributeTargets): New abstract method. It gets
3709 list of valid attribute targets for explicit target declaration.
3710 (Attribute.Target): It holds target itself.
3711 (AttributeSection): Removed.
3712 (Attribute.CheckTargets): New method. It checks whether attribute
3713 target is valid for the current element.
3716 (EventProperty): New class. For events that are declared like
3717 property (with add and remove accessors).
3718 (EventField): New class. For events that are declared like field.
3721 * cs-parser.jay: Implemented explicit attribute target declaration.
3723 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
3724 Override ValidAttributeTargets.
3727 (ReturnParameter): Class for applying custom attributes on
3729 (ParameterAtribute): New class. Class for applying custom
3730 attributes on the parameter type.
3732 2004-05-17 Miguel de Icaza <miguel@ximian.com>
3734 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
3737 (Method): Allow UNSAFE here.
3739 * modifiers.cs: Support unsafe reporting.
3741 2004-05-17 Marek Safar <marek.safar@seznam.cz>
3743 * decl.cs: Fix bug #58478.
3745 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3747 * statement.cs: When checking for unreachable code on an EmptyStatement,
3748 set the location. Fixes bug #58488.
3750 2004-05-13 Miguel de Icaza <miguel@ximian.com>
3752 * driver.cs: Add -pkg handling.
3754 From Gonzalo: UseShelLExecute=false
3756 2004-05-12 Marek Safar <marek.safar@seznam.cz>
3759 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
3761 (Attribute.IsClsCompliaceRequired): Moved to base for better
3763 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
3764 when attribute is AttributeUsageAttribute.
3765 (Attribute.GetValidTargets): Simplified.
3766 (Attribute.GetAttributeUsage): New method returns AttributeUsage
3767 attribute for this type.
3768 (Attribute.ApplyAttributes): Method renamed to Emit and make
3770 (GlobalAttributeSection): New class for special handling of global
3771 attributes (assembly, module).
3772 (AttributeSection.Emit): New method.
3774 * class.cs: Implemented Attributable abstract methods.
3775 (MethodCore.LabelParameters): Moved to Parameter class.
3776 (Accessor): Is back simple class.
3777 (PropertyMethod): Implemented Attributable abstract class.
3778 (DelegateMethod): Implemented Attributable abstract class.
3779 (Event): New constructor for disctintion between normal Event
3780 and Event with accessors.
3782 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
3784 * codegen.cs, const.cs, decl.cs, delegate.cs:
3785 (CommonAssemblyModulClass): Implemented Attributable abstract class
3788 * enum.cs: Implement IAttributeSupport interface.
3789 (EnumMember): New class for emum members. Implemented Attributable
3793 (ParameterBase): Is abstract.
3794 (ReturnParameter): New class for easier [return:] attribute handling.
3796 * typemanager.cs: Removed builder_to_attr.
3798 2004-05-11 Raja R Harinath <rharinath@novell.com>
3801 * attribute.cs (Attribute.GetPositionalValue): New function.
3802 * class.cs (TypeContainer.VerifyMembers): New function.
3803 (TypeContainer.Emit): Use it.
3804 (ClassOrStruct): New base class for Class and Struct.
3805 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
3806 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
3808 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
3809 then each non-static field should have a FieldOffset attribute.
3810 Otherwise, none of the fields should have a FieldOffset attribute.
3811 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
3812 and FieldOffset attributes.
3813 * typemanager.cs (TypeManager.struct_layout_attribute_type)
3814 (TypeManager.field_offset_attribute_type): New core types.
3815 (TypeManager.InitCoreTypes): Initialize them.
3817 2004-05-11 Michal Moskal <malekith@pld-linux.org>
3819 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
3820 Return correct type.
3823 2004-05-09 Miguel de Icaza <miguel@ximian.com>
3825 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
3826 be implicitly converted to ulong.
3828 * expression.cs: The logic for allowing operator &, | and ^ worked
3829 was wrong, it worked before because we did not report an error in
3830 an else branch. Fixes 57895.
3832 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
3833 allow volatile fields to be reference types.
3835 2004-05-07 Miguel de Icaza <miguel@ximian.com>
3837 * driver.cs: Add support for /debug-
3839 2004-05-07 Raja R Harinath <rharinath@novell.com>
3841 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
3842 Add a 'complain' parameter to silence errors.
3843 (Attribute.Resolve): Update to changes. Put in sanity check to catch
3844 silently overlooked type-resolutions.
3845 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
3847 (Attributes.Search): New function.
3848 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
3849 (Attributes.GetAttributeFullName): Remove hack.
3850 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
3851 Update to reflect changes.
3852 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3853 Use Attributes.Search instead of nested loops.
3855 2004-05-07 Marek Safar <marek.safar@seznam.cz>
3858 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
3859 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
3860 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
3862 * report.cs: (Report.Warning): Renamed to Warning_T because of
3863 parameter collision.
3865 2004-05-05 Raja R Harinath <rharinath@novell.com>
3867 * expression.cs (MemberAccess.ResolveMemberAccess):
3868 Exit with non-zero status after Report.Error.
3869 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
3871 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
3873 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
3875 * support.cs: Don't hang when the file is empty.
3877 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
3879 * support.cs: In SeekableStreamReader, compute the preamble size of the
3880 underlying stream. Position changes should take into account that initial
3883 2004-05-03 Todd Berman <tberman@sevenl.net>
3885 * driver.cs: remove unused GetSysVersion function.
3887 2004-05-03 Todd Berman <tberman@sevenl.net>
3889 * driver.cs: Remove the hack from saturday, as well as the hack
3890 from jackson (LoadAssemblyFromGac), also adds the CWD to the
3891 link_paths to get that bit proper.
3893 2004-05-01 Todd Berman <tberman@sevenl.net>
3895 * driver.cs: Try a LoadFrom before a Load, this checks the current
3896 path. This is currently a bug in mono that is be fixed, however, this
3897 provides a workaround for now. This will be removed when the bug
3900 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
3902 * CryptoConvert.cs: Updated to latest version. Fix issue with
3903 incomplete key pairs (#57941).
3905 2004-05-01 Todd Berman <tberman@sevenl.net>
3907 * driver.cs: Remove '.' from path_chars, now System.* loads properly
3910 2004-04-30 Jackson Harper <jackson@ximian.com>
3912 * codegen.cs: Open keys readonly.
3914 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3916 * typemanager.cs: don't report cyclic struct layout when a struct
3917 contains 2 or more fields of the same type. Failed for Pango.AttrShape
3918 which has 2 Pango.Rectangle fields.
3920 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
3922 * expression.cs: Handle IntPtr comparisons with IL code
3923 rather than a method call.
3925 2004-04-29 Martin Baulig <martin@ximian.com>
3927 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
3928 the list of PropertyInfo's in class hierarchy and find the
3929 accessor. Fixes #56013.
3931 2004-04-29 Martin Baulig <martin@ximian.com>
3933 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
3935 2004-04-29 Martin Baulig <martin@ximian.com>
3937 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
3939 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
3941 2004-04-29 Martin Baulig <martin@ximian.com>
3943 * class.cs (ConstructorInitializer.Resolve): Check whether the
3944 parent .ctor is accessible. Fixes #52146.
3946 2004-04-29 Martin Baulig <martin@ximian.com>
3948 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
3950 * statement.cs (Using.EmitLocalVariableDecls): Use
3951 TypeManager.idisposable_type, not typeof (IDisposable).
3952 (Foreach.EmitCollectionForeach): Added support for valuetypes.
3954 2004-04-29 Martin Baulig <martin@ximian.com>
3956 * class.cs (Event.Define): Don't emit the field and don't set
3957 RTSpecialName and SpecialName for events on interfaces. Fixes
3960 2004-04-29 Raja R Harinath <rharinath@novell.com>
3962 Refactor Attribute.ApplyAttributes.
3963 * attribute.cs (Attributable): New base class for objects that can
3964 have Attributes applied on them.
3965 (Attribute): Make AttributeUsage fields public.
3966 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
3967 (Attribute.IsInternalCall): New property.
3968 (Attribute.UsageAttr): Convert to a public read-only property.
3969 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
3970 (Attribute.ResolveType, Attribute.Resolve)
3971 (Attribute.ScanForIndexerName): Update to reflect changes.
3972 (Attribute.CheckAttributeTarget): Re-format.
3973 (Attribute.ApplyAttributes): Refactor, to various
3974 Attributable.ApplyAttributeBuilder methods.
3975 * decl.cs (MemberCore): Make Attributable.
3976 * class.cs (Accessor): Make Attributable.
3977 (MethodData.ApplyAttributes): Use proper attribute types, not
3979 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
3980 (TypeContainer.ApplyAttributeBuilder)
3981 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
3982 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
3983 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
3984 (Operator.ApplyAttributeBuilder): New factored-out methods.
3985 * const.cs (Const.ApplyAttributeBuilder): Likewise.
3986 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
3987 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
3988 * parameter.cs (ParameterBase): New Attributable base class
3989 that can also represent Return types.
3990 (Parameter): Update to the changes.
3992 2004-04-29 Jackson Harper <jackson@ximian.com>
3994 * driver.cs: Prefer the corlib system version when looking for
3995 assemblies in the GAC. This is still a hack, but its a better hack
3998 2004-04-29 Marek Safar <marek.safar@seznam.cz>
4000 * decl.cs, enum.cs: Improved error 3005 reporting.
4002 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
4003 (related_symbols): New private member for list of symbols
4004 related to reported error/warning.
4006 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
4008 2004-04-29 Martin Baulig <martin@ximian.com>
4010 * ecore.cs (Expression.Constantify): If we're an enum and
4011 TypeManager.TypeToCoreType() doesn't give us another type, use
4012 t.UnderlyingSystemType. Fixes #56178.
4014 2004-04-29 Martin Baulig <martin@ximian.com>
4016 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
4017 interfaces and for each interface, only add members directly
4018 declared in that interface. Fixes #53255.
4020 2004-04-28 Martin Baulig <martin@ximian.com>
4022 * expression.cs (ConditionalLogicalOperator): Use a temporary
4023 variable for `left' to avoid that we evaluate it more than once;
4026 2004-04-28 Martin Baulig <martin@ximian.com>
4028 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
4031 2004-04-28 Martin Baulig <martin@ximian.com>
4033 * statement.cs (LocalInfo.Resolve): Check whether the type is not
4036 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
4037 whether the type is not void (CS1547).
4039 2004-04-28 Martin Baulig <martin@ximian.com>
4041 * expression.cs (Unary.DoResolveLValue): Override this and report
4042 CS0131 for anything but Operator.Indirection.
4044 2004-04-28 Martin Baulig <martin@ximian.com>
4046 Committing a patch from Ben Maurer; see bug #50820.
4048 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4051 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4054 2004-04-28 Martin Baulig <martin@ximian.com>
4056 Committing a patch from Ben Maurer; see bug #50820.
4058 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4061 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4064 2004-04-28 Martin Baulig <martin@ximian.com>
4066 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
4067 (Block.AddLabel): Call DoLookupLabel() to only search in the
4070 2004-04-28 Martin Baulig <martin@ximian.com>
4072 * cfold.cs (ConstantFold.BinaryFold): Added special support for
4073 comparing StringConstants and NullLiterals in Equality and Inequality.
4075 2004-04-28 Jackson Harper <jackson@ximian.com>
4077 * driver.cs: Attempt to load referenced assemblies from the
4078 GAC. This is the quick and dirty version of this method that
4079 doesnt take into account versions and just takes the first
4080 canidate found. Will be good enough for now as we will not have more
4081 then one version installed into the GAC until I update this method.
4083 2004-04-28 Martin Baulig <martin@ximian.com>
4085 * typemanager.cs (TypeManager.CheckStructCycles): New public
4086 static method to check for cycles in the struct layout.
4088 * rootcontext.cs (RootContext.PopulateTypes): Call
4089 TypeManager.CheckStructCycles() for each TypeContainer.
4090 [Note: We only need to visit each type once.]
4092 2004-04-28 Martin Baulig <martin@ximian.com>
4094 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
4096 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
4097 success and added `out object value'. Use a `bool resolved' field
4098 to check whether we've already been called rather than
4099 `ConstantValue != null' since this breaks for NullLiterals.
4101 2004-04-28 Raja R Harinath <rharinath@novell.com>
4103 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
4104 setting of this flag, since the 'set' method may be non-public.
4106 2004-04-28 Raja R Harinath <rharinath@novell.com>
4108 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
4109 check on current_vector.Block.
4111 2004-04-27 Martin Baulig <martin@ximian.com>
4113 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
4114 a field initializer. Fixes #56459.
4116 2004-04-27 Martin Baulig <martin@ximian.com>
4118 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
4119 we're not attempting to use an indexer. Fixes #52154.
4121 2004-04-27 Martin Baulig <martin@ximian.com>
4123 * statement.cs (Return): Don't create a return label if we don't
4124 need it; reverts my change from January 20th. Thanks to Ben
4127 2004-04-27 Martin Baulig <martin@ximian.com>
4129 According to the spec, `goto' can only leave a nested scope, but
4132 * statement.cs (Block.LookupLabel): Only lookup in the current
4133 block, don't recurse into parent or child blocks.
4134 (Block.AddLabel): Check in parent and child blocks, report
4135 CS0140/CS0158 if we find a duplicate.
4136 (Block): Removed this indexer for label lookups.
4137 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
4138 this already does the error reporting for us.
4141 (FlowBranching.UsageVector.Block): New public variable; may be null.
4142 (FlowBranching.CreateSibling): Added `Block' argument.
4143 (FlowBranching.LookupLabel): New public virtual method. Lookup a
4144 label for the target of a `goto' and check whether we're not
4145 leaving a `finally'.
4147 2004-04-27 Martin Baulig <martin@ximian.com>
4149 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
4150 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
4153 2004-04-27 Martin Baulig <martin@ximian.com>
4155 * statement.cs (Block.AddLabel): Also check for implicit blocks
4156 and added a CS0158 check.
4158 2004-04-27 Martin Baulig <martin@ximian.com>
4160 * flowanalysis.cs (FlowBranchingLoop): New class.
4161 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
4162 UsageVector's instead of an ArrayList.
4163 (FlowBranching.Label): Likewise.
4164 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
4165 (FlowBranching.AddBreakVector): New method.
4167 2004-04-27 Miguel de Icaza <miguel@ximian.com>
4169 * attribute.cs: Small regression fix: only convert the type if we
4170 the type is different, fixes System.Drawing build.
4172 2004-04-27 Martin Baulig <martin@ximian.com>
4174 * attribute.cs (Attribute.Resolve): If we have a constant value
4175 for a named field or property, implicity convert it to the correct
4178 2004-04-27 Raja R Harinath <rharinath@novell.com>
4180 * statement.cs (Block.Block): Implicit blocks share
4181 'child_variable_names' fields with parent blocks.
4182 (Block.AddChildVariableNames): Remove.
4183 (Block.AddVariable): Mark variable as "used by a child block" in
4184 every surrounding block.
4185 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
4186 been used in a child block, complain about violation of "Invariant
4187 meaning in blocks" rule.
4188 * cs-parser.jay (declare_local_variables): Don't use
4189 AddChildVariableNames.
4190 (foreach_statement): Don't create an implicit block: 'foreach'
4193 2004-04-23 Miguel de Icaza <miguel@ximian.com>
4195 * convert.cs (ImplicitNumericConversion): 0 is also positive when
4196 converting from 0L to ulong. Fixes 57522.
4198 2004-04-22 Marek Safar <marek.safar@seznam.cz>
4200 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
4201 derived class hides via 'new' keyword field from base class (test-242.cs).
4202 TODO: Handle this in the more general way.
4204 * class.cs (CheckBase): Ditto.
4206 2004-04-22 Marek Safar <marek.safar@seznam.cz>
4208 * decl.cs (caching_flags): New member for storing cached values
4210 (MemberCore.Flags): New enum where bit flags for caching_flags
4212 (MemberCore.cls_compliance): Moved to caching_flags.
4213 (DeclSpace.Created): Moved to caching_flags.
4215 * class.cs: Use caching_flags instead of DeclSpace.Created
4217 2004-04-21 Miguel de Icaza <miguel@ximian.com>
4219 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
4220 if we are only a derived class, not a nested class.
4222 * typemanager.cs: Same as above, but do this at the MemberLookup
4223 level (used by field and methods, properties are handled in
4224 PropertyExpr). Allow for the qualified access if we are a nested
4227 2004-04-21 Marek Safar <marek.safar@seznam.cz>
4229 * class.cs: Refactoring.
4230 (IMethodData): New inteface; Holds links to parent members
4231 to avoid member duplication (reduced memory allocation).
4232 (Method): Implemented IMethodData interface.
4233 (PropertyBase): New inner classes for get/set methods.
4234 (PropertyBase.PropertyMethod): Implemented IMethodData interface
4235 (Event): New inner classes for add/remove methods.
4236 (Event.DelegateMethod): Implemented IMethodData interface.
4238 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
4239 EmitContext (related to class.cs refactoring).
4241 2004-04-21 Raja R Harinath <rharinath@novell.com>
4243 * delegate.cs (Delegate.VerifyApplicability): If the number of
4244 arguments are the same as the number of parameters, first try to
4245 verify applicability ignoring any 'params' modifier on the last
4249 2004-04-08 Martin Baulig <martin@ximian.com>
4251 Merged latest changes into gmcs. Please keep this comment in
4252 here, it makes it easier for me to see what changed in MCS since
4253 the last time I merged.
4255 2004-04-16 Raja R Harinath <rharinath@novell.com>
4257 * class.cs (TypeContainer.AddIndexer): Use
4258 'ExplicitInterfaceName' to determine if interface name was
4259 explicitly specified. 'InterfaceType' is not initialized at this time.
4260 (TypeContainer.DefineIndexers): Remove use of temporary list. The
4261 Indexers array is already in the required order. Initialize
4262 'IndexerName' only if there are normal indexers.
4263 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
4264 (TypeContainer.Emit): Emit DefaultMember attribute only if
4265 IndexerName is initialized.
4268 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
4270 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
4273 2004-04-15 Raja R Harinath <rharinath@novell.com>
4275 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
4279 * attribute.cs (Attribute.Resolve): Check for duplicate named
4283 2004-04-15 Miguel de Icaza <miguel@ximian.com>
4285 * iterators.cs (MarkYield): track whether we are in an exception,
4286 and generate code accordingly. Use a temporary value to store the
4287 result for our state.
4289 I had ignored a bit the interaction of try/catch with iterators
4290 since their behavior was not entirely obvious, but now it is
4291 possible to verify that our behavior is the same as MS .NET 2.0
4295 2004-04-14 Miguel de Icaza <miguel@ximian.com>
4297 * iterators.cs: Avoid creating temporaries if there is no work to
4300 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
4301 Enumerations, use TypeManager.EnumToUnderlying and call
4304 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
4307 (This.Emit): Use EmitContext.EmitThis to emit our
4310 (This.EmitAssign): Ditto.
4312 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
4313 codepaths, we will move all the functionality into
4316 (FieldExpr.EmitAssign): Ditto.
4318 This fixes several hidden bugs that I uncovered while doing a code
4319 review of this today.
4321 * codegen.cs (EmitThis): reworked so the semantics are more clear
4322 and also support value types "this" instances.
4324 * iterators.cs: Changed so that for iterators in value types, we
4325 do not pass the value type as a parameter.
4327 Initialization of the enumerator helpers is now done in the caller
4328 instead of passing the parameters to the constructors and having
4329 the constructor set the fields.
4331 The fields have now `assembly' visibility instead of private.
4333 2004-04-11 Miguel de Icaza <miguel@ximian.com>
4335 * expression.cs (Argument.Resolve): Check if fields passed as ref
4336 or out are contained in a MarshalByRefObject.
4338 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
4339 another compiler type.
4341 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
4343 * class.cs (Indexer.Define): use the new name checking method.
4344 Also, return false on an error.
4345 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
4346 (is_identifier_[start/part]_character): make static.
4348 2004-04-10 Miguel de Icaza <miguel@ximian.com>
4350 * expression.cs (Binary.ResolveOperator): Do no append strings
4351 twice: since we can be invoked more than once (array evaluation)
4352 on the same concatenation, take care of this here. Based on a fix
4353 from Ben (bug #56454)
4355 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
4357 * codegen.cs: Fix another case where CS1548 must be reported (when
4358 delay-sign isn't specified and no private is available #56564). Fix
4359 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
4360 error when MCS is used on the MS runtime and we need to delay-sign
4361 (which seems unsupported by AssemblyBuilder - see #56621).
4363 2004-04-08 Marek Safar <marek.safar@seznam.cz>
4365 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
4366 (TypeManager.ComputeNamespaces): Faster implementation for
4369 * compiler.csproj: Updated AssemblyName to mcs.
4371 2004-05-11 Jackson Harper <jackson@ximian.com>
4373 * Makefile: Preserve MONO_PATH
4375 2004-05-11 Jackson Harper <jackson@ximian.com>
4377 * Makefile: Use mono and mcs to build gmcs
4379 2004-05-03 Miguel de Icaza <miguel@ximian.com>
4381 * codegen.cs: Add patch from Robert Shade
4382 <rshade@dvsconsulting.com>, use FileAccess.Read on the keyfile, to
4385 2004-05-02 Sebastien Pouliot <sebastien@ximian.com>
4387 * CryptoConvert.cs: Updated to latest version. Fix issue with
4388 incomplete key pairs (#57941).
4390 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
4392 * codegen.cs: Fix another case where CS1548 must be reported (when
4393 delay-sign isn't specified and no private is available #56564). Fix
4394 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
4395 error when MCS is used on the MS runtime and we need to delay-sign
4396 (which seems unsupported by AssemblyBuilder - see #56621).
4398 2004-04-29 Jackson Harper <jackson@ximian.com>
4400 * Makefile: Set MONO_PATH to use the bootstrap corlib
4401 * driver.cs: Check the GAC for referenced assemblies.
4403 2004-04-29 Martin Baulig <martin@ximian.com>
4405 * Makefile (gmcs.exe): Set MONO_PATH to use `../class/lib/net_2_0'.
4407 2004-04-07 Martin Baulig <martin@ximian.com>
4409 * expression.cs (Binary.ResolveOperator): Added special case for
4410 Equality/Inequality between a type parameter and a null literal.
4412 2004-04-07 Martin Baulig <martin@ximian.com>
4414 * convert.cs: Check null literal -> type parameter conversions.
4416 2004-04-07 Martin Baulig <martin@ximian.com>
4418 * generic.cs (ConstructedType.CheckConstraints): Enforce the
4419 `class' and `struct' constraints.
4421 2004-04-07 Martin Baulig <martin@ximian.com>
4423 * generic.cs (SpecialConstraint): New public enum.
4424 (Constraints.Resolve): Added support for the `class' and `struct'
4427 * cs-parser.jay (type_parameter_constraint): Added support for the
4428 `class' and `struct' constraints.
4430 2004-04-07 Martin Baulig <martin@ximian.com>
4432 * support.cs (GenericConstraints): Replaced `Types' by
4433 `ClassConstraint' and `InterfaceConstraints'; added
4434 `HasClassConstraint'.
4436 2004-04-07 Martin Baulig <martin@ximian.com>
4439 (Constraints.InterfaceConstraints): New public property.
4440 (Constraints.Types): Make this property public
4441 (TypeParameter): Implement IMemberContainer.
4442 (TypeParameter.Define): Take a `GenericTypeParameterBuilder'
4443 instead of a TypeBuilder/MethodBuilder; pass the interface
4444 constraints to TypeManager.AddTypeParameter().
4445 (TypeParameter.DefineType): Just take an EmitContext and no
4446 TypeBuilder/MethodBuilder. Use the new public API.
4448 * typemanager.cs (TypeManager.AddTypeParameter): Added
4449 `TypeExpr[]' argument; add the interfaces to the
4450 `builder_to_ifaces' hash.
4451 (TypeManager.LookupMemberContainer): For
4452 GenericTypeParameterBuilders, get the TypeParameter from the
4453 `builder_to_type_param'.
4454 (TypeManager.FindMembers): For GenericTypeParameterBuilders, get
4455 the TypeParameter and call FindMembers on it.
4457 2004-04-07 Martin Baulig <martin@ximian.com>
4460 (MethodCore.GenericMethod): Moved this field here from Method.
4461 (MethodCore.IsDuplicateImplementation): Take the number of type
4462 parameters into account if we're a generic method.
4464 * expression.cs (Invocation.InferTypeArguments): Don't return true
4465 if `arguments' is null; we still need to check whether we actually
4466 don't need to infer anything in this case.
4467 (MemberAccess): Merged the functionality from GenericMemberAccess
4470 * generic.cs (GenericMemberAccess): Removed.
4472 2004-04-05 Martin Baulig <martin@ximian.com>
4474 * decl.cs (MemberCore): For generic classes, interfaces and
4475 structs, `Name' now includes the number of type parameters
4477 (DeclSpace.FindType): Removed the `num_type_args' argument; we now
4478 encode the number of type arguments in the type name.
4480 * expression.cs (Expression.MemberLookup): Removed the
4481 `num_type_args' argument; we now encode the number of type
4482 arguments in the type name.
4484 * ecore.cs (SimpleName): Encode the number of type arguments in
4485 the type name itself.
4487 * generic.cs (ConstructedType): Likewise.
4489 * tree.cs (Tree.RecordDecl): Take a `string' instead of a
4490 `MemberName'; we now include the number of type parameters in the
4493 * typemanager.cs (TypeManager.CheckGeneric): Removed.
4494 (TypeManager.MemberLookup): Removed the
4495 `num_type_args' argument; we now encode the number of type
4496 arguments in the type name.
4498 2004-04-03 Martin Baulig <martin@ximian.com>
4500 * decl.cs (MemberCore.ctor): Take a MemberName instead of a sting.
4501 (MemberCore.MemberName): Moved here from MemberBase.
4502 (DeclSpace.SetParameterInfo): Just take the constraints as an
4503 ArrayList; we already have the type parameters in our
4504 `MemberName'; also do the CS0080 reporting here.
4506 * cs-parser.jay (struct_declaration): Use `member_name' instead of
4507 `IDENTIFIER opt_type_parameter_list'; when constructing our
4508 `MemberName', it'll already include our type parameters.
4509 (class_declaration, interface_declaration): Likewise.
4510 (delegate_declaration): Likewise.
4511 (MakeName): Take a MemberName and return a MemberName.
4512 The following two changes are required to avoid shift/reduce conflicts:
4513 (member_name): Don't include a TypeName anymore; ie. this is now
4514 just 'IDENTIFIER opt_type_parameter_list'.
4515 (property_declaration, event_declaration): Use a
4516 `namespace_or_type_name' instead of a `member_name'.
4518 2004-04-03 Martin Baulig <martin@ximian.com>
4520 * decl.cs (MemberName): Renamed to `TypeName' and created a new
4522 (TypeName): Formerly known as MemberName.
4524 * namespace.cs (NamespaceEntry.UsingAlias): Take a `TypeName'
4525 instead of a `MemberName'.
4527 * cs-parser.jay (namespace_or_type_name): Create a TypeName.
4528 (member_name): New rule; create a MemberName.
4530 2004-04-02 Martin Baulig <martin@ximian.com>
4532 * namespace.cs (NamespaceEntry.VerifyUsing): Added error checking
4533 (CS0305 and CS0308).
4535 2004-04-02 Martin Baulig <martin@ximian.com>
4537 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Added
4538 support for nested types.
4540 2004-04-02 Martin Baulig <martin@ximian.com>
4542 * ecore.cs (IAlias): New public interface.
4543 (TypeExpr, TypeExpression): Implement IAlias.
4544 (TypeAliasExpression): New public class.
4546 * namespace.cs (Namespace): Implement IAlias.
4547 (Namespace.Lookup): Return an IAlias instead on an object.
4548 (Namespace.DefineName): Take an IAlias instead of an object.
4549 (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
4551 (NamespaceEntry.UsingAlias): Take a Membername instead of an
4553 (NamespaceEntry.LookupAlias): Return an IAlias instead on an
4555 (NamespaceEntry.Lookup): Likewise.
4557 * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
4560 * decl.cs (DeclSpace): Implement IAlias.
4561 (DeclSpace.LookupAlias): Return an IAlias instead of a string.
4563 * generic.cs (ConstructedType): Improved error checking.
4565 2004-04-02 Martin Baulig <martin@ximian.com>
4567 * convert.cs: Added type parameter conversions.
4570 (UnboxCast.Emit): Emit an `unbox.any' for type params.
4571 (ClassCast.Emit): If the source type is a type parameter, box it.
4572 If the target type is a type parameter, emit an `unbox.any'
4573 instead of a `classcast'.1
4575 2004-04-01 Martin Baulig <martin@ximian.com>
4577 * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
4579 2004-04-01 Martin Baulig <martin@ximian.com>
4581 * generic.cs (ConstructedType.CheckConstraints): Use
4582 Convert.ImplicitStandardConversionExists(); user-defined implicit
4583 conversions are not allowed according to the spec.
4585 2004-03-30 Martin Baulig <martin@ximian.com>
4587 * expression.cs (New): Added support for type parameters.
4590 (TypeManager.activator_type): New public static field.
4591 (TypeManager.activator_create_instance): Likewise.
4593 2004-03-30 Martin Baulig <martin@ximian.com>
4595 * typemanager.cs (TypeManager.HasConstructorConstraint): New
4598 2004-03-30 Martin Baulig <martin@ximian.com>
4600 * generic.cs (ConstructedType.CheckConstraints): Actually follow
4601 the spec here: the argument type must be convertible to the
4604 2004-03-30 Martin Baulig <martin@ximian.com>
4607 (TypeParameter.Define, TypeParameter.DefineMethod): Call
4608 TypeManager.AddTypeParameter().
4609 (ConstructedType.CheckConstraints): Re-enable this and actually
4610 check whether we have a constructor constraint.
4613 (TypeManager.builder_to_type_param): New static field.
4614 (TypeManager.AddTypeParameter): New static method.
4615 (TypeManager.LookupTypeParameter): New public method.
4617 2004-03-30 Martin Baulig <martin@ximian.com>
4619 * generic.cs (TypeParameter.DefineType): Return a boolean and use
4620 the new API to actually define the constructor constraint.
4623 (TypeManager.new_constraint_attr_type): New static field.
4624 (TypeManager.InitCoreTypes): Initialize it.
4626 2004-03-30 Martin Baulig <martin@ximian.com>
4628 * generic.cs (Constraints): Completed error checking, use correct
4631 2004-03-29 Martin Baulig <martin@ximian.com>
4633 * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
4635 * expression.cs (Invocation.InferTypeArguments): Added overloaded
4636 public version which takes a `ParameterData pd' instead of an
4639 2004-03-29 Martin Baulig <martin@ximian.com>
4641 * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
4644 2004-03-29 Martin Baulig <martin@ximian.com>
4646 * expression.cs (Argument.ResolveMethodGroup): If we're a
4647 ConstructedType, call GetMemberAccess() on it.
4649 2004-03-29 Martin Baulig <martin@ximian.com>
4651 * class.cs (MethodBase.CheckGenericOverride): New abstract method.
4652 (MethodCore.CheckGenericOverride): When overriding a generic
4653 method, check whether the constraints match.
4655 * support.cs (GenericConstraints): New public interface.
4656 (ParameterData.GenericConstraints): New public method.
4658 * parameter.cs (Parameter.Resolve): Check whether we're a generic
4659 method parameter and compute our constraints if appropriate.
4660 (Parameter.GenericConstraints): New public property.
4662 * generic.cs (Constraints): Implement GenericConstraints.
4664 2004-03-29 Martin Baulig <martin@ximian.com>
4666 * decl.cs (MemberCache.FindMemberToOverride): Use
4667 `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
4669 2004-03-29 Martin Baulig <martin@ximian.com>
4671 * generic.cs (GenericMethod.Define): Resolve our type parameters.
4673 2004-03-29 Martin Baulig <martin@ximian.com>
4675 * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
4676 not allowed on non-generic declarations").
4678 2004-03-29 Martin Baulig <martin@ximian.com>
4680 * expression.cs (Invocation.InferTypeArguments): Added overloaded
4681 public version of this method.
4683 * class.cs (MethodCore.IsDuplicateImplementation): Use
4684 Invocation.InferTypeArguments() to check this.
4686 2004-03-29 Martin Baulig <martin@ximian.com>
4688 * convert.cs: Use TypeManager.IsDelegateType() instead of
4689 comparing types correctly.
4691 2004-03-29 Martin Baulig <martin@ximian.com>
4693 * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
4694 types directly to make it work for generic instances.
4696 * typemanager.cs (TypeManager.IsSubclassOf): New static method.
4698 2004-03-29 Martin Baulig <martin@ximian.com>
4700 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
4703 2004-03-24 Martin Baulig <martin@ximian.com>
4705 * decl.cs (DeclSpace.FindType): Also use
4706 TypeManager.CheckGeneric() for types from the using clauses.
4708 2004-03-23 Martin Baulig <martin@ximian.com>
4710 * expression.cs (Invocation.OverloadResolve): Added `bool
4711 may_fail' argument and use it instead of the Location.IsNull() hack.
4713 2004-03-23 Martin Baulig <martin@ximian.com>
4715 * expression.cs (Invocation.InferType): Use correct type inference
4718 2004-03-23 Martin Baulig <martin@ximian.com>
4720 * ecore.cs (MethodGroupExpr.Name): Use
4721 TypeManager.CSharpSignature() instead of just the name.
4723 * expression.cs (Invocation.OverloadResolve): Provide better error
4725 (Invocation.DoResolve): OverloadResolve() never returns null
4726 without reporting an error, so removed the error -6 reporting here.
4728 2004-03-23 Martin Baulig <martin@ximian.com>
4730 * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
4733 * cs-parser.jay (delegate_declaration): Support generic delegates.
4735 * delegate.cs: Support generic delegates.
4737 2004-03-22 Martin Baulig <martin@ximian.com>
4739 * expression.cs (Invocation.InferParamsTypeArguments): New static
4740 method; does type inference for params arguments.
4742 2004-03-21 Martin Baulig <martin@ximian.com>
4744 * typemanager.cs (TypeManager.IsGenericMethod): New public static
4745 method; checks whether a method is a generic method.
4747 * expression.cs (Invocation.InferTypeArguments): New static method;
4748 infer type arguments for generic method invocation.
4750 * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
4751 property; we set this to true if we're resolving a generic method
4752 invocation and the user specified type arguments, ie. we're not
4753 doing type inference.
4755 2004-03-20 Martin Baulig <martin@ximian.com>
4757 * class.cs (MethodData.DeclaringType): New public property.
4758 (MethodData.Define): Set DeclaringType here.
4759 (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
4760 instead of OperatorMethodBuilder.DeclaringType.
4762 2004-03-20 Martin Baulig <martin@ximian.com>
4764 * cs-tokenizer.cs (xtoken): Return a special
4765 Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
4767 * cs-parser.jay (default_value_expression): Switch to the new
4770 2004-03-19 Martin Baulig <martin@ximian.com>
4772 * decl.cs (MemberName): New class. We use this to "construct"
4773 namespace_or_type_name's.
4775 * generics.cs (TypeArguments.GetDeclarations): New public method;
4776 returns the type arguments as a string[] and reports a CS0081 if
4777 one of them is not an identifier.
4779 * class.cs (MemberBase): The .ctor now takes the name as a
4780 MemberName instead of a string.
4781 (MemberBase.ExplicitInterfaceName): Changed type from string to
4783 (MemberBase.DoDefine): If we're an explicit implementation, the
4784 InterfaceType may be a generic instance.
4786 * cs-parser.jay (namespace_or_type_name): Return a MemberName.
4787 (namespace_name): Call MemberName.GetName () to transform the
4788 MemberName into a string and ensure we don't have any type
4790 (type_name): Call MemberName.GetTypeExpression() to transfrom the
4791 MemberName into an expression.
4792 (method_header): Use namespace_or_type_name instead of member_name.
4794 2004-04-07 Miguel de Icaza <miguel@ximian.com>
4796 * rootcontext.cs: Add new types to the boot resolution.
4798 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
4799 MulticastDelegate is not allowed.
4801 * typemanager.cs: Add new types to lookup: System.TypedReference
4804 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
4805 check for TypedReference or ArgIterator, they are not allowed.
4807 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
4808 makes us properly catch 1510 in some conditions (see bug 56016 for
4811 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
4813 * CryptoConvert.cs: update from corlib version
4816 2004-04-05 Miguel de Icaza <miguel@ximian.com>
4818 * class.cs (Indexer.Define): Check indexername declaration
4820 2004-04-05 Marek Safar <marek.safar@seznam.cz>
4822 * attribute.cs (IsClsCompliant): Fixed problem with handling
4823 all three states (compliant, not-compliant, undetected).
4825 2004-03-30 Marek Safar <marek.safar@seznam.cz>
4827 * attribute.cs (Attribute): Location is now public.
4828 (Resolve): Store resolved arguments (pos_values) in attribute class.
4829 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
4830 (GetClsCompliantAttributeValue): New method that gets
4831 CLSCompliantAttribute value.
4832 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
4833 if exists else null.
4834 (AttributeTester): New class for CLS-Compliant verification routines.
4836 * class.cs (Emit): Add CLS-Compliant verification.
4837 (Method.GetSignatureForError): Implemented.
4838 (Constructor.GetSignatureForError): Implemented
4839 (Constructor.HasCompliantArgs): Returns if constructor has
4840 CLS-Compliant arguments.
4841 (Constructor.Emit): Override.
4842 (Construcor.IsIdentifierClsCompliant): New method; For constructors
4843 is needed to test only parameters.
4844 (FieldBase.GetSignatureForError): Implemented.
4845 (TypeContainer): New member for storing base interfaces.
4846 (TypeContainer.FindMembers): Search in base interfaces too.
4848 * codegen.cs (GetClsComplianceAttribute): New method that gets
4849 assembly or module CLSCompliantAttribute value.
4850 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
4852 (ModuleClass.Emit): Add error 3012 test.
4854 * const.cs (Emit): Override and call base for CLS-Compliant tests.
4856 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
4857 state for all decl types.
4858 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
4859 if CLS-Compliant tests are required.
4860 (IsClsCompliaceRequired): New method. Analyze whether code
4861 must be CLS-Compliant.
4862 (IsExposedFromAssembly): New method. Returns true when MemberCore
4863 is exposed from assembly.
4864 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
4865 value or gets cached value.
4866 (HasClsCompliantAttribute): New method. Returns true if MemberCore
4867 is explicitly marked with CLSCompliantAttribute.
4868 (IsIdentifierClsCompliant): New abstract method. This method is
4869 used to testing error 3005.
4870 (IsIdentifierAndParamClsCompliant): New method. Common helper method
4871 for identifier and parameters CLS-Compliant testing.
4872 (VerifyClsCompliance): New method. The main virtual method for
4873 CLS-Compliant verifications.
4874 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
4875 null. I don't know why is null (too many public members !).
4876 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
4877 and get value of first CLSCompliantAttribute that found.
4879 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
4880 (VerifyClsCompliance): Override and add extra tests.
4882 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
4883 clscheck- disable CLS-Compliant verification event if assembly is has
4884 CLSCompliantAttribute(true).
4886 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
4887 ApllyAttribute is now called in emit section as in the other cases.
4888 Possible future Emit integration.
4889 (IsIdentifierClsCompliant): New override.
4890 (VerifyClsCompliance): New override.
4891 (GetEnumeratorName): Returns full enum name.
4893 * parameter.cs (GetSignatureForError): Implemented.
4895 * report.cs (WarningData): New struct for Warning message information.
4896 (LocationOfPreviousError): New method.
4897 (Warning): New method. Reports warning based on the warning table.
4898 (Error_T): New method. Reports error based on the error table.
4900 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
4901 verifications are done here.
4903 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
4905 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
4906 CLSCompliantAttribute.
4907 (all_imported_types): New member holds all imported types from other
4909 (LoadAllImportedTypes): New method fills static table with exported types
4910 from all referenced assemblies.
4911 (Modules): New property returns all assembly modules.
4913 2004-03-30 Miguel de Icaza <miguel@ximian.com>
4915 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
4916 throwing a parser error.
4918 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
4919 which removes the hardcoded get_/set_ prefixes for properties, as
4920 IL allows for the properties to be named something else.
4924 * expression.cs: Do not override operand before we know if it is
4927 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
4929 * typemanager.cs: support for pinned variables.
4931 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
4933 * decl.cs, typemanager.cs: Avoid using an arraylist
4934 as a buffer if there is only one result set.
4936 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
4938 * expression.cs: Make sure you cant call a static method
4939 with an instance expression, bug #56174.
4941 2004-03-29 Miguel de Icaza <miguel@ximian.com>
4943 * class.cs (IsDuplicateImplementation): Improve error reporting to
4944 flag 663 (method only differs in parameter modifier).
4946 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
4947 in preprocessor directives.
4949 * location.cs (LookupFile): Allow for the empty path.
4951 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
4952 better approach for some of that patch, but its failing with the
4953 CharSet enumeration. For now try/catch will do.
4955 * typemanager.cs: Do not crash if a struct does not have fields.
4958 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
4960 * expression.cs: cs0213, cant fix a fixed expression.
4963 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
4965 * cs-parser.jay: detect invalid embeded statements gracefully.
4968 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
4970 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
4973 the invocation type may not be a subclass of the tye of the item/
4974 The type of the item must be a subclass of the invocation item.
4979 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
4981 * attribute.cs: Added methods to get a string and a bool from an
4982 attribute. Required to information from AssemblyKeyFileAttribute,
4983 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
4984 * codegen.cs: Modified AssemblyName creation to include support for
4985 strongnames. Catch additional exceptions to report them as CS1548.
4986 * compiler.csproj: Updated include CryptoConvert.cs.
4987 * compiler.csproj.user: Removed file - user specific configuration.
4988 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
4989 Mono.Security assembly. The original class is maintained and tested in
4990 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
4991 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
4992 like CSC 8.0 (C# v2) supports.
4993 * Makefile: Added CryptoConvert.cs to mcs sources.
4994 * rootcontext.cs: Added new options for strongnames.
4996 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
4998 * driver.cs: For --expect-error, report error code `2'
4999 if the program compiled with no errors, error code `1' if
5000 it compiled with an error other than the one expected.
5002 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
5004 * compiler.csproj: Updated for Visual Studio .NET 2003.
5005 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
5006 * compiler.sln: Updated for Visual Studio .NET 2003.
5008 2004-03-24 Ravi Pratap M <ravi@ximian.com>
5010 * expression.cs: Fix bug #47234. We basically need to apply the
5011 rule that we prefer the conversion of null to a reference type
5012 when faced with a conversion to 'object' (csc behaviour).
5014 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5016 * statement.cs: Shorter form for foreach, eliminates
5017 a local variable. r=Martin.
5019 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5021 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
5022 checks if we can use brtrue/brfalse to test for 0.
5023 * expression.cs: use the above in the test for using brtrue/brfalse.
5026 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5028 * expression.cs: Rewrite string concat stuff. Benefits:
5030 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
5031 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
5032 rather than a concat chain.
5034 * typemanager.cs: Add lookups for more concat overloads.
5036 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5038 * expression.cs: Emit shorter il code for array init.
5055 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
5057 * statement.cs: Before, two switch blocks would be merged if the
5058 total size of the blocks (end_item - begin_item + 1) was less than
5059 two times the combined sizes of the blocks.
5061 Now, it will only merge if after the merge at least half of the
5066 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
5068 * class.cs : csc build fix for GetMethods(). See bug #52503.
5070 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
5072 * expression.cs: Make sure fp comparisons work with NaN.
5073 This fixes bug #54303. Mig approved this patch a long
5074 time ago, but we were not able to test b/c the runtime
5077 2004-03-19 Miguel de Icaza <miguel@ximian.com>
5079 * ecore.cs (TypExpr.GetHashCode): implement this overload.
5081 2004-03-19 Martin Baulig <martin@ximian.com>
5083 * class.cs (MemberCore.IsDuplicateImplementation): Check whether
5084 two overloads may unify for some type parameter substitutions and
5085 report a CS0408 if appropriate.
5087 2004-03-19 Martin Baulig <martin@ximian.com>
5089 * class.cs (MemberCore.IsDuplicateImplementation): Report the
5090 error here and not in our caller.
5092 2004-03-19 Martin Baulig <martin@ximian.com>
5094 * interface.cs: Completely killed this file.
5095 (Interface): We're now a TypeContainer and live in class.cs.
5097 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
5098 argument; we're now also called for interfaces.
5099 (TypeContainer.DefineMembers): Allow this method being called
5101 (TypeContainer.GetMethods): New public method; formerly known as
5102 Interface.GetMethod(). This is used by PendingImplementation.
5103 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
5104 it's now private and non-static.
5105 (Interface): Moved this here; it's now implemented similar to
5107 (Method, Property, Event, Indexer): Added `bool is_interface'
5108 argument to their .ctor's.
5109 (MemberBase.IsInterface): New public field.
5111 * cs-parser.jay: Create normal Method, Property, Event, Indexer
5112 instances instead of InterfaceMethod, InterfaceProperty, etc.
5113 (opt_interface_base): Removed; we now use `opt_class_base' instead.
5114 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
5116 2004-03-19 Martin Baulig <martin@ximian.com>
5118 * class.cs (MethodCore.IsDuplicateImplementation): New private
5119 method which does the CS0111 checking.
5120 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
5121 Use IsDuplicateImplementation().
5123 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
5125 * decl.cs (FindMemberToOverride): New method to find the correct
5126 method or property to override in the base class.
5128 - Make Method/Property use the above method to find the
5129 version in the base class.
5130 - Remove the InheritableMemberSignatureCompare as it is now
5133 This patch makes large code bases much faster to compile, as it is
5134 O(n) rather than O(n^2) to do this validation.
5136 Also, it fixes bug 52458 which is that nested classes are not
5137 taken into account when finding the base class member.
5139 Reviewed/Approved by Martin.
5141 2004-03-17 Martin Baulig <martin@ximian.com>
5143 * expression.cs (MemberAccess.DoResolve): Take the parent's number
5144 of type arguments into account; use the `real_num_type_args'
5145 approach like in DoResolveAsTypeStep().
5147 * generic.cs (GenericMemberAccess.DoResolve): Make this work for
5150 2004-03-17 Marek Safar <marek.safar@seznam.cz>
5152 * interface.cs: In all interface classes removed redundant
5153 member initialization.
5155 2004-03-16 Martin Baulig <martin@ximian.com>
5157 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
5159 2004-03-15 Miguel de Icaza <miguel@ximian.com>
5161 * decl.cs (DefineTypeAndParents): New helper method to define a
5162 type's containers before the type itself is defined; This is a
5163 bug exposed by the recent changes to Windows.Forms when an
5164 implemented interface was defined inside a class that had not been
5167 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
5169 (Check): Loop correctly to report errors modifiers
5170 (UNSAFE was not in the loop, since it was the same as TOP).
5172 * interface.cs: Every interface member now takes a ModFlags,
5173 instead of a "is_new" bool, which we set on the base MemberCore.
5175 Every place where we called "UnsafeOk" in the interface, now we
5176 call the proper member (InterfaceMethod.UnsafeOK) instead to get
5177 the unsafe settings from the member declaration instead of the
5178 container interface.
5180 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
5182 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
5183 `set_indexer_name' to the pending bits (one per type).
5185 We fixed a bug today that was picking the wrong method to
5186 override, since for properties the existing InterfaceMethod code
5187 basically ignored the method name. Now we make sure that the
5188 method name is one of the valid indexer names.
5190 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
5192 * support.cs (SeekableStreamReader): Keep track of stream byte
5193 positions and don't mix them with character offsets to the buffer.
5195 Patch from Gustavo Giráldez
5197 2004-03-15 Marek Safar <marek.safar@seznam.cz>
5199 * interface.cs (InterfaceSetGetBase): Removed double member
5200 initialization, base class does it as well.
5202 2004-03-13 Martin Baulig <martin@ximian.com>
5204 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
5205 when compiling corlib.
5207 2004-03-13 Miguel de Icaza <miguel@ximian.com>
5209 * convert.cs (ExplicitConversion): We were reporting an error on
5210 certain conversions (object_type source to a value type, when the
5211 expression was `null') before we had a chance to pass it through
5212 the user defined conversions.
5214 * driver.cs: Replace / and \ in resource specifications to dots.
5217 * class.cs: Add check for duplicate operators. Fixes 52477
5219 2004-03-11 Miguel de Icaza <miguel@ximian.com>
5221 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
5222 that are in the middle of the statements, not only at the end.
5225 * class.cs (TypeContainer.AddField): No longer set the
5226 `HaveStaticConstructor' flag, now we call it
5227 `UserDefineStaticConstructor' to diferentiate the slightly
5228 semantic difference.
5230 The situation is that we were not adding BeforeFieldInit (from
5231 Modifiers.TypeAttr) to classes that could have it.
5232 BeforeFieldInit should be set to classes that have no static
5237 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
5239 And most importantly Zoltan's comment:
5241 http://bugzilla.ximian.com/show_bug.cgi?id=44229
5243 "I think beforefieldinit means 'it's ok to initialize the type sometime
5244 before its static fields are used', i.e. initialization does not need
5245 to be triggered by the first access to the type. Setting this flag
5246 helps the JIT to compile better code, since it can run the static
5247 constructor at JIT time, and does not need to generate code to call it
5248 (possibly lots of times) at runtime. Unfortunately, mcs does not set
5249 this flag for lots of classes like String.
5251 csc sets this flag if the type does not have an explicit static
5252 constructor. The reasoning seems to be that if there are only static
5253 initalizers for a type, and no static constructor, then the programmer
5254 does not care when this initialization happens, so beforefieldinit
5257 This bug prevents the AOT compiler from being usable, since it
5258 generates so many calls to mono_runtime_class_init that the AOT code
5259 is much slower than the JITted code. The JITted code is faster,
5260 because it does not generate these calls if the vtable is type is
5261 already initialized, which is true in the majority of cases. But the
5262 AOT compiler can't do this."
5264 2004-03-10 Miguel de Icaza <miguel@ximian.com>
5266 * class.cs (MethodData.Emit): Refactor the code so symbolic
5267 information is generated for destructors; For some reasons we
5268 were taking a code path that did not generate symbolic information
5271 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
5273 * class.cs: Create a Constructor.CheckBase method that
5274 takes care of all validation type code. The method
5275 contains some code that was moved from Define.
5277 It also includes new code that checks for duplicate ctors.
5278 This fixes bug #55148.
5280 2004-03-09 Joshua Tauberer <tauberer@for.net>
5282 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
5283 a { ... }-style array creation invokes EmitStaticInitializers
5284 which is not good for reference-type arrays. String, decimal
5285 and now null constants (NullCast) are not counted toward
5286 static initializers.
5288 2004-03-05 Martin Baulig <martin@ximian.com>
5290 * location.cs (SourceFile.HasLineDirective): New public field;
5291 specifies whether the file contains or is referenced by a "#line"
5293 (Location.DefineSymbolDocuments): Ignore source files which
5294 either contain or are referenced by a "#line" directive.
5296 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
5298 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
5299 direct access to our parent, so check the method inline there.
5301 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
5303 * expression.cs (Invocation.EmitCall): Miguel's last commit
5304 caused a regression. If you had:
5309 In Foo the implict this would be null.
5311 2004-02-27 Miguel de Icaza <miguel@ximian.com>
5313 * expression.cs (Invocation.EmitCall): If the method is not
5314 virtual, do not emit a CallVirt to it, use Call.
5316 * typemanager.cs (GetFullNameSignature): Improve the method to
5317 cope with ".ctor" and replace it with the type name.
5319 * class.cs (ConstructorInitializer.Resolve): Now the method takes
5320 as an argument the ConstructorBuilder where it is being defined,
5321 to catch the recursive constructor invocations.
5323 2004-03-16 Martin Baulig <martin@ximian.com>
5325 * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
5326 ConstructedType, call ResolveType() on it to get the type rather
5327 than just using `expr.Type'.
5329 2004-03-16 Martin Baulig <martin@ximian.com>
5331 * generics.cs (ConstructedType.GetMemberAccess): Take the
5332 EmitContext instead on the TypeExpr and use
5333 ec.TypeContainer.CurrentType/ec.ContainerType.
5335 2004-03-16 Martin Baulig <martin@ximian.com>
5337 * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
5338 parameters before aliases.
5340 2004-03-16 Martin Baulig <martin@ximian.com>
5342 * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
5343 New oublic function; checks whether two generic instances may become
5344 equal under some instantiations (26.3.1).
5346 * class.cs (TypeContainer.Define): Call
5347 TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
5350 2004-03-16 Martin Baulig <martin@ximian.com>
5352 * class.cs (TypeContainer.GetClassBases): Moved
5353 Error_TypeParameterAsBase() here and also check whether the base
5354 class is not an attribute.
5356 2004-03-16 Martin Baulig <martin@ximian.com>
5358 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
5360 2004-03-16 Martin Baulig <martin@ximian.com>
5362 * class.cs (Error_TypeParameterAsBase): Use correct error number
5365 2004-03-16 Martin Baulig <martin@ximian.com>
5367 * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
5370 * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
5373 2004-03-15 Martin Baulig <martin@ximian.com>
5375 * typemanager.cs (TypeManager.GetFullName): New public method.
5376 (TypeManager.MemberLookup): Added `int_num_type_arguments'
5377 argument; only return members with the correct number of type
5379 (TypeManager.CheckGeneric): Allow -1 to bypass the check.
5380 (TypeManager.FilterWithClosure): Call CheckGeneric() to check
5381 whether the number of type arguments matches.
5383 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
5384 not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
5386 * expression.cs (MemberAccess): Added public `NumTypeArguments'
5387 field; it's set by the protected .ctor when we're actually a
5388 GenericMemberAccess.
5389 (MemberAccess.ResolveAsTypeStep): Compute the total number of type
5390 arguments and pass it to MemberLookupFinal ().
5392 * ecore.cs (Expression.MemberLookup): Added `int
5393 num_type_arguments' argument; only return members with the correct
5394 number of type arguments.
5395 (Expression.MemberLookupFailed): Check whether the MemberLookup
5396 failed because we did not have the correct number of type
5397 arguments; report CS0305 in this case.
5399 * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
5400 `e.ResolveAsTypeTerminal()' already did so.
5402 2004-03-15 Martin Baulig <martin@ximian.com>
5404 * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
5405 we're a ConstructedType; in this case, the caller must report an
5406 error (for instance CS0131).
5408 * generic.cs (TypeArguments): Added Location argument to the .ctor.
5409 (TypeArguments.Resolve): Actually report errors here.
5411 2004-03-15 Miguel de Icaza <miguel@ximian.com>
5413 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
5414 `set_indexer_name' to the pending bits (one per type).
5416 We fixed a bug today that was picking the wrong method to
5417 override, since for properties the existing InterfaceMethod code
5418 basically ignored the method name. Now we make sure that the
5419 method name is one of the valid indexer names.
5421 2004-03-15 Martin Baulig <martin@ximian.com>
5423 * typemanager.cs (TypeManager.IndexerPropertyName): Added support
5424 for generic instances.
5426 2004-03-13 Martin Baulig <martin@ximian.com>
5428 * class.cs (TypeContainer.DefineType): Call
5429 TypeManager.AddUserType() immediately after creating the
5430 TypeBuilder; pass all type parameters when creating the
5433 * decl.cs (DeclSpace.FindNestedType): New public method.
5434 (DeclSpace.FindType): Added `int num_type_args' argument; only
5435 return types with the correct number of type parameters.
5436 (DeclSpace.CountTypeParams): New public property.
5438 * ecore.cs (SimpleName.ctor): Added overloaded version which takes
5439 the number of type parameters; defaults to zero.
5441 * generic.cs (TypeArguments.Count): New public property.
5442 (ConstructedType.DoResolveAsTypeStep): First call
5443 ds.FindNestedType() to find out whether we're nested in the
5444 current generic type; in this case, we inherit all type parameters
5445 from the current class.
5447 * rootcontext.cs (RootContext.NamespaceLookup): Added `int
5448 num_type_args' argument.
5449 (RootContext.LookupType): Added overloaded version which takes the
5450 number of type arguments; only return types with the correct
5451 number of type arguments.
5453 * typemanager.cs (TypeManager.CheckGeneric): New public function;
5454 checks whether `Type t' has `int num_type_args'.
5456 2004-03-13 Martin Baulig <martin@ximian.com>
5458 * generic.cs (GenericMethod.DefineType): New method; calls
5459 DefineType() on all the type parameters.
5461 * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
5462 (MethodData.Define): If we're a generic method, call
5463 GenericMethod.DefineType() to define the type parameters.
5465 2004-03-10 Martin Baulig <martin@ximian.com>
5467 * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
5468 instead of IsAssignableFrom.
5470 2004-03-10 Martin Baulig <martin@ximian.com>
5472 * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
5474 * support.cs (ParameterData.HasArrayParameter): New property.
5475 (ReflectionParameters.ctor): Take a MethodBase instead of a
5476 ParameterInfo[]. If we have any type parameters, get the generic
5477 method definition and ask it whether we have variable arguments.
5479 2004-02-26 Miguel de Icaza <miguel@ximian.com>
5481 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
5482 routines to check if a type is an enumerable/enumerator allow
5483 classes that implement the IEnumerable or IEnumerator interfaces.
5485 * class.cs (Property, Operator): Implement IIteratorContainer, and
5486 implement SetYields.
5488 (Property.Define): Do the block swapping for get_methods in the
5489 context of iterators. We need to check if Properties also
5490 include indexers or not.
5492 (Operator): Assign the Block before invoking the
5493 OperatorMethod.Define, so we can trigger the Iterator code
5496 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
5497 Property and Operator classes are not created when we parse the
5498 declarator but until we have the block completed, so we use a
5499 singleton SimpleIteratorContainer.Simple to flag whether the
5500 SetYields has been invoked.
5502 We propagate this setting then to the Property or the Operator to
5503 allow the `yield' to function.
5505 2004-02-25 Marek Safar <marek.safar@seznam.cz>
5507 * codegen.cs: Implemented attribute support for modules.
5508 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
5509 Assembly/Module functionality.
5511 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
5512 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
5513 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
5515 2004-02-16 Marek Safar <marek.safar@seznam.cz>
5517 * interface.cs (FindMembers): The operation is performed on all base
5518 interfaces and not only on the first. It is required for future CLS Compliance patch.
5520 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
5522 * statement.cs, codegen.cs:
5523 This patch deals with patterns such as:
5525 public class List : IEnumerable {
5527 public MyEnumerator GetEnumerator () {
5528 return new MyEnumerator(this);
5531 IEnumerator IEnumerable.GetEnumerator () {
5535 public struct MyEnumerator : IEnumerator {
5540 Before, there were a few things we did wrong:
5541 1) we would emit callvirt on a struct, which is illegal
5542 2) we emited ldarg when we needed to emit ldarga
5543 3) we would mistakenly call the interface methods on an enumerator
5544 type that derived from IEnumerator and was in another assembly. For example:
5546 public class MyEnumerator : IEnumerator
5548 Would have the interface methods called, even if there were public impls of the
5549 method. In a struct, this lead to invalid IL code.
5551 2004-02-11 Marek Safar <marek.safar@seznam.cz>
5553 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
5556 * delegate.cs (Define): Fixed crash when delegate type is undefined.
5558 2004-02-11 Miguel de Icaza <miguel@ximian.com>
5560 * cs-parser.jay: Fix small regression: we were not testing V2
5561 compiler features correctly.
5563 * interface.cs: If the emit context is null, then create one
5565 2004-02-09 Marek Safar <marek.safar@seznam.cz>
5567 * decl.cs (GetSignatureForError): New virtual method to get full name
5570 * attribute.cs (IAttributeSupport): New interface for attribute setting.
5571 Now it is possible to rewrite ApplyAttributes method to be less if/else.
5573 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
5574 Duplicated members and code in these classes has been removed.
5575 Better encapsulation in these classes.
5577 2004-02-07 Miguel de Icaza <miguel@ximian.com>
5579 * assign.cs (Assign.DoResolve): When dealing with compound
5580 assignments, there is a new rule in ECMA C# 2.4 (might have been
5581 there before, but it is documented here) that states that in:
5585 If b is of type int, and the `op' is a shift-operator, then the
5586 above is evaluated as:
5590 * expression.cs (Binary.ResolveOperator): Instead of testing for
5591 int/uint/long/ulong, try to implicitly convert to any of those
5592 types and use that in pointer arithmetic.
5594 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
5595 method to print information for from the type, not from the
5596 null-method we were given.
5598 2004-02-01 Duncan Mak <duncan@ximian.com>
5600 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
5601 parsing for cmd, fixes bug #53694.
5603 2004-02-04 Marek Safar <marek.safar@seznam.cz>
5605 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
5606 in the member name duplication tests. Property and operator name duplication
5607 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
5609 2004-02-03 Marek Safar <marek.safar@seznam.cz>
5611 * interface.cs (PopulateMethod): Fixed crash when interface method
5612 returns not existing type (error test cs0246-3.cs).
5614 2004-02-02 Ravi Pratap M <ravi@ximian.com>
5616 * cs-parser.jay (interface_accessors): Re-write actions to also
5617 store attributes attached to get and set methods. Fix spelling
5620 (inteface_property_declaration): Modify accordingly.
5622 (InterfaceAccessorInfo): New helper class to store information to pass
5623 around between rules that use interface_accessors.
5625 * interface.cs (Emit): Apply attributes on the get and set
5626 accessors of properties and indexers too.
5628 * attribute.cs (ApplyAttributes): Modify accordingly to use the
5629 right MethodBuilder when applying attributes to the get and set accessors.
5631 2004-01-31 Miguel de Icaza <miguel@ximian.com>
5633 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
5635 2004-01-26 Miguel de Icaza <miguel@ximian.com>
5637 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
5639 2004-01-25 Miguel de Icaza <miguel@ximian.com>
5641 * cs-parser.jay: Remove YIELD token, instead use the new grammar
5642 changes that treat `yield' specially when present before `break'
5645 * cs-tokenizer.cs: yield is no longer a keyword.
5647 2004-01-23 Marek Safar <marek.safar@seznam.cz>
5649 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
5650 setting for default constructors.
5651 For default constructors are almost every time set wrong Modifier. The
5652 generated IL code has been alright. But inside mcs this values was
5653 wrong and this was reason why several of my CLS Compliance tests
5656 2004-02-27 Martin Baulig <martin@ximian.com>
5658 * generics.cs (ConstructedType.ResolveType): Make the nested type
5659 stuff actually work.
5661 2004-02-25 Martin Baulig <martin@ximian.com>
5663 * decl.cs (DeclSpace.CurrentTypeParameters): New protected
5664 property; returns the type parameters just from the current type,
5665 ie. with the ones from outer classes.
5666 (DeclSpace.LookupGeneric): First search in the current class, then
5668 (DeclSpace.initialize_type_params): When hiding a type parameter
5669 from an outer class, put it into the `type_param_list' anyways.
5671 * expression.cs (MemberAccess.expr): Made this field protected.
5673 * class.cs (TypeContainer.Define): The `CurrentType' just contains
5674 the type parameters from the current class.
5676 * generic.cs (ConstructedType.ResolveType): Support nested generic
5677 types by taking the type parameters which we inherit from outer
5678 classes into account.
5679 (GenericMemberAccess.ResolveAsTypeStep): Override this and added
5680 support for nested generic types.
5682 2004-02-23 Martin Baulig <martin@ximian.com>
5684 * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
5685 field and check whether we're nested inside a generic type.
5686 (DeclSpace.ResolveType): If we're resolving to a generic type
5687 definition, create a ConstructedType and return its resolved type.
5688 (DeclSpace.initialize_type_params): New private method;
5689 initializes the `type_param_list' field from the type parameters
5690 from this and all enclosing classes.
5691 (DeclSpace.TypeParameters): Call initialize_type_params() unless
5692 we're already initialized.
5694 2004-02-23 Martin Baulig <martin@ximian.com>
5696 * class.cs (Method.Define): Create the generic method before
5698 (Memberbase.DoDefine): Added DeclSpace argument (in addition to
5699 the TypeContainer one); we use this for generic methods.
5701 * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
5702 parent's TypeBuilder.
5704 2004-02-18 Martin Baulig <martin@ximian.com>
5706 * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
5707 to check for equality.
5709 2004-02-05 Martin Baulig <martin@ximian.com>
5711 * ecore.cs (FieldExpr.DoResolveLValue): If we have an
5712 `ec.TypeContainer.CurrentType', use it instead of
5713 `ec.ContainerType' to check whether we're in the type's ctor.
5715 2004-01-29 Martin Baulig <martin@ximian.com>
5717 * expression.cs (Invocation.DoResolve): If we're a
5718 `ConstructedType', then we're actually a generic method, so
5719 rewrite the expr as a GenericMemberAccess.
5721 * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
5722 here; manually parse it into a string.
5724 2004-01-28 Martin Baulig <martin@ximian.com>
5726 * typemanager.cs (TypeManager.IsEqual): New static method.
5727 (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
5728 check for equality instead of using `=='.
5730 2004-01-26 Martin Baulig <martin@ximian.com>
5732 * decl.cs (DeclSpace.CurrentType): New public field.
5734 * expression.cs (This.ResolveBase): If we have an
5735 `ec.TypeContainer.CurrentType', use it instead of
5738 * class.cs (TypeContainer.DefineType): If we're a generic type,
5739 create the `CurrentType' (unresolved).
5740 (TypeContainer.GenericType): New private field.
5741 (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
5742 it and store it in `GenericType' before creating the MemberCache.
5743 (TypeContainer.GetMembers): If we have a `GenericType', call
5744 TypeManager.FindMembers() on it.
5746 * interface.cs (Interface.GenericType): New private field.
5747 (Interface.DefineType): If we're a generic type, create the
5748 `CurrentType' (unresolved).
5749 (Interface.DefineMembers): If we have a `CurrentType', resolve it
5750 and store it in `GenericType' before creating the MemberCache.
5751 (Interface.GetMembers): If we have a `GenericType', call
5752 TypeManager.FindMembers() on it.
5754 2004-01-22 Martin Baulig <martin@ximian.com>
5756 * cs-parser.jay (namespace_or_type_name): Return an Expression,
5757 not a QualifiedIdentifier. This is what `type_name_expression'
5758 was previously doing.
5759 (type_name_expression): Removed; the code is now in
5760 `namespace_or_type_name'.
5761 (qualified_identifier): Removed, use `namespace_or_type_name'
5763 (QualifiedIdentifier): Removed this class.
5765 2004-01-22 Martin Baulig <martin@ximian.com>
5767 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
5768 not a string as alias name.
5770 2004-01-21 Miguel de Icaza <miguel@ximian.com>
5772 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
5773 #52730 bug, and instead compute correctly the need to use a
5774 temporary variable when requesting an address based on the
5775 static/instace modified of the field and the constructor.
5777 2004-01-21 Martin Baulig <martin@ximian.com>
5779 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
5780 class and namespace before looking up aliases. Fixes #52517.
5782 2004-01-21 Martin Baulig <martin@ximian.com>
5784 * flowanalysis.cs (UsageVector.Merge): Allow variables being
5785 assinged in a 'try'; fixes exception4.cs.
5787 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5788 * class.cs : Implemented parameter-less constructor for TypeContainer
5790 * decl.cs: Attributes are now stored here. New property OptAttributes
5792 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
5794 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
5796 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5798 * typemanager.cs (CSharpSignature): Now reports also inner class name.
5799 (CSharpSignature): New method for indexer and property signature.
5801 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5803 * pending.cs (IsVirtualFilter): Faster implementation.
5805 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5807 * typemanager.cs: Avoid inclusion of same assembly more than once.
5809 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5811 * cs-parser.jay: Fixed problem where the last assembly attribute
5812 has been applied also to following declaration (class, struct, etc.)
5814 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5816 * class.cs: Added error CS0538, CS0539 reporting.
5817 Fixed crash on Microsoft runtime when field type is void.
5819 * cs-parser.jay: Added error CS0537 reporting.
5821 * pending.cs: Added error CS0535 reporting.
5822 Improved error report for errors CS0536, CS0534.
5824 2004-01-20 Miguel de Icaza <miguel@ximian.com>
5826 Merge a few bits from the Anonymous Method MCS tree.
5828 * statement.cs (ToplevelBlock): New class for toplevel methods,
5829 will hold anonymous methods, lifted variables.
5831 * cs-parser.jay: Create toplevel blocks for delegates and for
5832 regular blocks of code.
5834 2004-01-20 Martin Baulig <martin@ximian.com>
5836 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
5837 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
5838 and `NeedExplicitReturn'; added `IsLastStatement'.
5839 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
5840 have a `ReturnLabel' or we're not unreachable.
5842 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
5843 child's reachability; don't just override ours with it. Fixes
5844 #58058 (lluis's example).
5845 (FlowBranching): Added public InTryOrCatch(), InCatch(),
5846 InFinally(), InLoop(), InSwitch() and
5847 BreakCrossesTryCatchBoundary() methods.
5849 * statement.cs (Return): Do all error checking in Resolve().
5850 Unless we are the last statement in a top-level block, always
5851 create a return label and jump to it.
5852 (Break, Continue): Do all error checking in Resolve(); also make
5853 sure we aren't leaving a `finally'.
5854 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
5855 statement in a top-level block.
5856 (Block.Flags): Added `IsDestructor'.
5857 (Block.IsDestructor): New public property.
5859 2004-01-20 Martin Baulig <martin@ximian.com>
5861 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
5863 2004-01-20 Martin Baulig <martin@ximian.com>
5865 * statement.cs (Statement.ResolveUnreachable): New public method.
5866 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
5867 (Block.Resolve): Resolve unreachable statements.
5869 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
5871 * expression.cs: We need to fix the case where we do
5872 not have a temp variable here.
5874 * assign.cs: Only expression compound assignments need
5875 temporary variables.
5877 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
5879 * flowanalysis.cs: Reduce memory allocation in a few ways:
5880 - A block with no variables should not allocate a bit
5882 - A method with no out parameters does not need any tracking
5883 for assignment of the parameters, so we need not allocate
5886 public readonly Type[] VariableTypes;
5887 public readonly string[] VariableNames;
5888 Are redundant. The data is already stored in the variable
5889 map, so we need not allocate another array for it.
5890 - We need to add alot of checks for if (params | locals) == null
5891 due to the first two changes.
5893 2004-01-18 Miguel de Icaza <miguel@ximian.com>
5895 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
5896 implement IMemoryLocation, we store a copy on a local variable and
5897 take the address of it. Patch from Benjamin Jemlich
5899 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
5900 to use a special "type_name_expression" rule which reduces the
5901 number of "QualifiedIdentifier" classes created, and instead
5902 directly creates MemberAccess expressions.
5904 2004-01-17 Miguel de Icaza <miguel@ximian.com>
5906 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
5907 that fixes #52853. Null literal assignment to ValueType
5909 * class.cs (MethodData.Emit): Instead of checking the name of the
5910 method to determine if its a destructor, create a new derived
5911 class from Method called Destructor, and test for that.
5913 * cs-parser.jay: Create a Destructor object instead of a Method.
5915 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
5919 2004-01-16 Miguel de Icaza <miguel@ximian.com>
5921 * expression.cs (Binary.ResolveOperator): Perform an implicit
5922 conversion from MethodGroups to their delegate types on the
5925 * delegate.cs: Introduce a new class DelegateCreation that is the
5926 base class for `NewDelegate' and `ImplicitDelegateCreation',
5927 factor some code in here.
5929 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
5930 conversion from MethodGroups to compatible delegate types.
5932 * ecore.cs (Expression.Resolve): Do not flag error 654
5933 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
5934 we allow conversions from MethodGroups to delegate types now.
5936 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
5937 assignments in v2 either.
5939 2004-01-10 Miguel de Icaza <miguel@ximian.com>
5941 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
5942 static read-only fields in ctors.
5944 Applied patch from Benjamin Jemlich
5946 * expression.cs (UnaryMutator): Avoid leaking local variables.
5948 2004-01-09 Miguel de Icaza <miguel@ximian.com>
5950 * cs-tokenizer.cs (IsCastToken): Allow the various native types
5951 here to return true, as they can be used like this:
5955 Fixed 49836 and all the other dups
5957 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
5959 * driver.cs: Implement /win32res and /win32icon.
5961 2004-01-08 Miguel de Icaza <miguel@ximian.com>
5963 * cs-parser.jay: Add a rule to improve error handling for the
5964 common mistake of placing modifiers after the type.
5966 2004-01-07 Miguel de Icaza <miguel@ximian.com>
5968 * cs-parser.jay (interface_event_declaration): Catch
5969 initialization of events on interfaces, and report cs0068
5971 * cs-parser.jay (interface_event_declaration): Catch
5972 initialization of events.
5974 * ecore.cs: Better report missing constructors.
5976 * expression.cs (Binary.ResolveOperator): My previous bug fix had
5977 the error reporting done in the wrong place. Fix.
5979 * expression.cs (Binary.ResolveOperator): Catch the
5980 operator + (E x, E y) error earlier, and later allow for implicit
5981 conversions in operator +/- (E e, U x) from U to the underlying
5984 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
5985 52596, if the container class is abstract, the default constructor
5986 is protected otherwise its public (before, we were always public).
5988 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
5991 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
5992 Jemlich that fixes bug #52597, MCS was generating invalid code for
5993 idisposable structs. Thanks to Ben for following up with this
5996 2004-01-06 Miguel de Icaza <miguel@ximian.com>
5998 * driver.cs: Allow assemblies without code to be generated, fixes
6001 2004-01-07 Nick Drochak <ndrochak@gol.com>
6003 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
6005 2004-01-05 Miguel de Icaza <miguel@ximian.com>
6007 * cs-parser.jay: Add rules to improve error reporting if fields or
6008 methods are declared at the namespace level (error 116)
6010 * Add rules to catch event add/remove
6012 2004-01-04 David Sheldon <dave-mono@earth.li>
6014 * expression.cs: Added matching ")" to error message for
6017 2004-01-03 Todd Berman <tberman@gentoo.org>
6019 * ecore.cs, attribute.cs:
6020 Applying fix from #52429.
6022 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6024 * ecore.cs, expression.cs, statement.cs:
6025 Total rewrite of how we handle branching. We
6026 now handle complex boolean expressions with fewer
6027 jumps. As well if (x == 0) no longer emits a ceq.
6029 if (x is Foo) is much faster now, because we generate
6032 Overall, we get a pretty big improvement on our benchmark
6033 tests. The code we generate is smaller and more readable.
6035 I did a full two-stage bootstrap. The patch was reviewed
6036 by Martin and Miguel.
6038 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6040 * cs-parser.jay: Make primary_expression not take a QI.
6041 we dont need this because the member_access rule covers
6042 us here. So we replace the rule with just IDENTIFIER.
6044 This has two good effects. First, we remove a s/r conflict.
6045 Second, we allocate many fewer QualifiedIdentifier objects.
6047 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6049 * attribute.cs: Handle MarshalAs attributes as pseudo, and
6050 set the correct information via SRE. This prevents
6051 hanging on the MS runtime. Fixes #29374.
6053 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6055 * convert.cs: correctly handle conversions to value types
6056 from Enum and ValueType as unboxing conversions.
6058 Fixes bug #52569. Patch by Benjamin Jemlich.
6060 2004-01-02 Ravi Pratap <ravi@ximian.com>
6062 * expression.cs (BetterConversion): Prefer int -> uint
6063 over int -> ulong (csc's behaviour). This fixed bug #52046.
6065 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
6067 * decl.cs (MemberCache.FindMembers): now returns a
6070 * typemanager.cs: In general, go with with ^^.
6071 (CopyNewMethods): take an IList.
6072 (RealMemberLookup): Only allocate an arraylist
6073 if we copy from two sets of methods.
6075 This change basically does two things:
6076 1) Fewer array lists allocated due to CopyNewMethods.
6077 2) the explicit cast in MemberList costed ALOT.
6079 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
6081 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
6082 a hashtable to avoid needless string allocations when an identifier is
6083 used more than once (the common case).
6085 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6087 * pending.cs: MS's TypeBuilder.GetInterfaces ()
6088 is broken, it will not return anything. So, we
6089 have to use the information we have in mcs to
6092 * typemanager.cs: Add a cache for GetInterfaces,
6093 since this will now be used more often (due to ^^)
6095 (GetExplicitInterfaces) New method that gets the
6096 declared, not effective, interfaces on a type
6097 builder (eg, if you have interface IFoo, interface
6098 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
6101 This patch makes MCS able to bootstrap itself on
6104 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6106 * expression.cs: Remove the Nop's that Miguel put
6109 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6111 * report.cs, codegen.cs: Give the real stack trace to
6112 the error when an exception is thrown.
6114 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6116 * decl.cs: only allocate hashtables for ifaces if
6119 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6121 * expression.cs: fix the error from cs0121-2.cs
6122 (a parent interface has two child interfaces that
6123 have a function with the same name and 0 params
6124 and the function is called through the parent).
6126 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
6128 * class.cs, rootcontext.cs, typmanager.cs: do not
6131 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
6133 * codegen.cs: remove stack for the ec flow branching.
6134 It is already a linked list, so no need.
6136 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
6138 * Makefile: Allow custom profiler here.
6140 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6142 * typemanager.cs (LookupType):
6143 - Use a static char [], because split takes
6144 a param array for args, so it was allocating
6146 - Do not store true in a hashtable, it boxes.
6148 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6150 * flowanalysis.cs: bytify common enums.
6152 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6154 * modifiers.cs: Add a new set of flags for the
6155 flags allowed on explicit interface impls.
6156 * cs-parser.jay: catch the use of modifiers in
6157 interfaces correctly.
6158 * class.cs: catch private void IFoo.Blah ().
6160 All related to bug #50572.
6162 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6164 * decl.cs: Rewrite the consistant accessability checking.
6165 Accessability is not linear, it must be implemented in
6166 a tableish way. Fixes #49704.
6168 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6170 * expression.cs: Handle negation in a checked context.
6171 We must use subtraction from zero. Fixes #38674.
6173 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
6175 * class.cs: Ignore static void main in DLLs.
6176 * rootcontext.cs: Handle the target type here,
6177 since we are have to access it from class.cs
6178 * driver.cs: account for the above.
6180 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
6182 * report.cs: Give line numbers and files if available.
6184 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
6186 * driver.cs: Implement /addmodule.
6188 * typemanager.cs: Change 'modules' field so it now contains Modules not
6191 2003-12-20 Martin Baulig <martin@ximian.com>
6193 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
6194 (FieldBase.IsAssigned): Removed this field.
6195 (FieldBase.SetAssigned): New public method.
6196 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
6198 2003-12-20 Martin Baulig <martin@ximian.com>
6200 * expression.cs (LocalVariableReference.DoResolve): Don't set
6201 `vi.Used' if we're called from DoResolveLValue().
6203 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
6204 returns the usage vector it just merged into the current one -
6205 pass this one to UsageWarning().
6206 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
6207 of the `EmitContext', don't call this recursively on our children.
6209 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
6211 * driver.cs: Implement /target:module.
6213 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
6215 * support.cs (CharArrayHashtable): New helper class.
6217 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
6218 char arrays, not strings, so we can avoid creating a string in
6219 consume_identifier if the identifier is a keyword.
6221 2003-12-16 Martin Baulig <martin@ximian.com>
6223 * statement.cs (LocalInfo.Assigned): Removed this property.
6224 (LocalInfo.Flags): Removed `Assigned'.
6225 (LocalInfo.IsAssigned): New public method; takes the EmitContext
6226 and uses flow analysis.
6227 (Block.UsageWarning): Made this method private.
6228 (Block.Resolve): Call UsageWarning() if appropriate.
6230 * expression.cs (LocalVariableReference.DoResolve): Always set
6231 LocalInfo.Used here.
6233 2003-12-13 Martin Baulig <martin@ximian.com>
6235 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
6236 any value here; we're now using flow analysis to figure out
6237 whether a statement/block returns a value.
6239 2003-12-13 Martin Baulig <martin@ximian.com>
6241 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
6243 (FlowBranching.MergeFinally): Don't call
6244 `branching.CheckOutParameters()' here, this is called in
6246 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
6247 when adding the `finally' vector.
6249 2003-12-13 Martin Baulig <martin@ximian.com>
6252 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
6253 actually work and also fix #48962.
6255 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
6257 * decl.cs: Do not check System.Object for nested types,
6258 since we know it does not have any. Big bang for buck:
6263 corlib: 17.99 seconds
6267 corlib: 17.39 seconds
6269 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
6271 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
6272 time we are returning 0 members, so we save alot here.
6274 2003-12-11 Martin Baulig <martin@ximian.com>
6276 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
6277 `MergeChild()', also just take the `FlowBranching' as argument;
6278 call Merge() on it and return the result.
6279 (FlowBranching.Merge): We don't need to do anything if we just
6282 2003-12-11 Martin Baulig <martin@ximian.com>
6284 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
6285 them in an `ArrayList' to reduce memory usage. Thanks to Ben
6286 Maurer for this idea.
6288 2003-12-11 Martin Baulig <martin@ximian.com>
6290 * flowanalysis.cs (MergeResult): This class is now gone; we now
6291 use the `UsageVector' for this. The reason for this is that if a
6292 branching just has one sibling, we don't need to "merge" them at
6293 all - that's the next step to do.
6294 (FlowBranching.Merge): We now return a `UsageVector' instead of a
6297 2003-12-11 Martin Baulig <martin@ximian.com>
6299 Reworked flow analyis and made it more precise and bug-free. The
6300 most important change is that we're now using a special `Reachability'
6301 class instead of having "magic" meanings of `FlowReturns'. I'll
6302 do some more cleanups and optimizations and also add some more
6303 documentation this week.
6305 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
6306 largely reworked this class.
6307 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
6308 the new `Reachability' class instead of having "magic" values here.
6309 (FlowBranching): We're now using an instance of `Reachability'
6310 instead of having separate `Returns', `Breaks' etc. fields.
6312 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
6313 based on flow analysis; ignore the return value of block.Emit ().
6315 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
6317 * driver.cs typemanager.cs: Find the mono extensions to corlib even
6318 if they are private.
6320 2003-12-09 Martin Baulig <martin@ximian.com>
6322 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
6323 call them directly on the UsageVector.
6325 2003-12-09 Martin Baulig <martin@ximian.com>
6327 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
6328 Changed return type from `FlowReturns' to `Reachability'.
6330 2003-12-09 Martin Baulig <martin@ximian.com>
6332 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
6333 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
6334 `Reachable' fields with a single `Reachability' one.
6336 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6338 * class.cs (FindMembers): Remove foreach's.
6351 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6356 This patch does a few things:
6357 1. EmptyStatement is now a singleton, so it is never reallocated.
6358 2. All blah is EmptyStatement constructs have been changed to
6359 blah == EmptyStatement.Value, which is much faster and valid
6360 now that EmptyStatement is a singleton.
6361 3. When resolving a block, rather than allocating a new array for
6362 the non-empty statements, empty statements are replaced with
6363 EmptyStatement.Value
6364 4. Some recursive functions have been made non-recursive.
6365 Mainly the performance impact is from (3), however (1) and (2) are needed for
6366 this to work. (4) does not make a big difference in normal situations, however
6367 it makes the profile look saner.
6372 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6373 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6374 Total memory allocated: 56397 KB
6377 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
6378 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
6379 Total memory allocated: 55666 KB
6381 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6383 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
6384 than the hashtable in a hashtable version
6386 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
6387 we always end up concating a string. This results in a huge perf
6388 loss, because many strings have to be tracked by the GC. In this
6389 patch, we first use a hashtable that works with two keys, so that
6390 the strings do not need to be concat'ed.
6401 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6403 * Makefile: Add a new target `do-time' that does a quick and simple
6404 profile, leaving easy to parse output.
6406 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
6408 * codegen.cs (Init): Create the dynamic assembly with
6409 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
6411 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
6413 * support.cs: Make the PtrHashtable use only one
6414 instance of its comparer.
6416 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
6418 * typemanager.cs: Fix lookup of GetNamespaces.
6420 2003-11-29 Miguel de Icaza <miguel@ximian.com>
6422 * expression.cs: Removed redundant line.
6424 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
6425 ArrayLists, use for loops with bounds.
6427 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
6430 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
6431 arraylists, use for loop with bounds.
6433 The above three changes give us a 0.071 second performance
6434 improvement out of 3.294 seconds down to 3.223. On my machine
6435 the above changes reduced the memory usage by 1,387 KB during
6438 * cs-parser.jay (QualifiedIdentifier): New class used to represent
6439 QualifiedIdentifiers. Before we created a new string through
6440 concatenation, and mostly later on, the result would be
6441 manipulated by DecomposeQI through string manipulation.
6443 This reduced the compiler memory usage for bootstrapping from
6444 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
6445 compile times in 0.05 seconds.
6447 2003-11-28 Dick Porter <dick@ximian.com>
6449 * support.cs: Do string compares with the Invariant culture.
6457 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
6458 the comparison is done with the Invariant culture.
6460 2003-11-27 Miguel de Icaza <miguel@ximian.com>
6462 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
6463 GetEnumerator method.
6465 (ProbeCollectionType): Iterate starting at the most specific type
6466 upwards looking for a GetEnumerator
6468 * expression.cs: Shift count can be up to 31 for int/uint and 63
6471 2003-11-26 Miguel de Icaza <miguel@ximian.com>
6473 * statement.cs (Block.LookupLabel): Also look for the label on the
6474 children blocks. Use a hash table to keep track of visited
6477 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
6478 we actually did transform the other operand, otherwise fall back
6479 to the common codepath that casts to long.
6481 * cs-tokenizer.cs: Use the same code pattern as the int case.
6482 Maybe I should do the parsing myself, and avoid depending on the
6483 Parse routines to get this done.
6485 2003-11-25 Miguel de Icaza <miguel@ximian.com>
6487 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
6488 which fixes bug 51347. This time test it.
6490 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
6491 attributes for example can not tell the difference between these.
6492 The difference was only a syntax feature of the language.
6494 * attribute.cs: Apply attributes to delegates.
6496 * delegate.cs: Call the apply attributes method.
6498 2003-11-24 Miguel de Icaza <miguel@ximian.com>
6500 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
6501 comparing 0 vs Byte.MinValue, not the value
6503 (ImplicitConversionRequired): When reporting a conversion error,
6504 use error 31 to print out the constant error instead of the
6507 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
6508 which fixes bug 51347.
6510 2003-11-22 Miguel de Icaza <miguel@ximian.com>
6512 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
6513 which fixes the -warnaserror command line option.
6515 2003-11-21 Miguel de Icaza <miguel@ximian.com>
6517 * cfold.cs (DoNumericPromotions): During constant folding of
6518 additions on UIntConstant, special case intconstants with
6519 IntConstants like we do on the expression binary operator.
6521 2003-11-12 Miguel de Icaza <miguel@ximian.com>
6523 * convert.cs (ImplicitReferenceConversion): We were missing a case
6524 (System.Enum are not value types or class types, so we need to
6525 classify them separatedly).
6527 * driver.cs: We do not support error 2007.
6529 2003-11-12 Jackson Harper <jackson@ximian.com>
6531 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
6532 system directory. Also use the full file name so users can
6533 libraries names mscorlib-o-tron.dll in a non system dir.
6535 2004-01-04 David Sheldon <dave-mono@earth.li>
6537 * expression.cs: Added matching ")" to error message for CS0077.
6539 2003-12-19 Martin Baulig <martin@ximian.com>
6541 * typemanager.cs (TypeManager.IsEqualGenericType): New public
6542 static method; see documentation in the method.
6543 (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
6545 * convert.cs (Convert.ImplicitReferenceConversion,
6546 Convert.ImplicitReferenceConversionExists): Add support for
6547 generic type declarations; see gen-36.cs.
6549 2003-12-19 Martin Baulig <martin@ximian.com>
6551 * pending.cs (Pending.InterfaceMethod): Use
6552 `Type.IsAssignableFrom()' instead of `=='.
6554 2003-12-18 Martin Baulig <martin@ximian.com>
6556 * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
6559 * convert.cs (Convert.ImplicitStandardConversionExists): Use
6560 `expr_type.Equals (target_type)' instead of `=='.
6562 2003-12-08 Martin Baulig <martin@ximian.com>
6564 * generics.cs (Constraints.Types): Removed.
6565 (Constraints.Resolve): Just resolve everything to TypeExpr's, not
6567 (Constraints.ResolveTypes): New public method; resolves the
6568 TypeExpr's to Type's.
6569 (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
6570 longer takes the constraints.
6571 (TypeParameter.DefineMethod): Likewise.
6572 (TypeParameter.DefineType): New public method. Calls
6573 `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
6576 2003-12-08 Martin Baulig <martin@ximian.com>
6578 * convert.cs (Convert.ImplicitConversionStandard): Use
6579 `expr_type.Equals (target_type)' instead of `=='.
6581 2003-12-08 Martin Baulig <martin@ximian.com>
6583 * typemanager.cs (TypeManager.GetReferenceType): Call
6584 `Type.MakeByRefType ()'.
6586 2003-12-08 Martin Baulig <martin@ximian.com>
6588 * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
6589 just has some special meaning in some situations. For instance,
6590 it is allowed to use `where' as the name of a variable etc.
6592 2003-12-04 Martin Baulig <martin@ximian.com>
6594 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
6595 `Type.MakeArrayType()' for array types.
6597 2003-11-18 Miguel de Icaza <miguel@ximian.com>
6599 * expression.cs (Invocation.VerifyArgumentsCompat): Remove
6602 (SizeOf.DoResolve): assign the `type_queried' field. This gets
6605 2003-11-16 Martin Baulig <martin@ximian.com>
6607 * codegen.cs (EmitContext.IsGeneric): Removed.
6609 * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
6610 ResolveGeneric() on the DeclSpace.
6612 2003-11-16 Martin Baulig <martin@ximian.com>
6614 * generic.cs (TypeArguments.Resolve):
6615 `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
6616 `ResolveType()' on it to get the Type.
6618 2003-11-15 Martin Baulig <martin@ximian.com>
6620 * generic.cs (ConstructedType.GetInterfaces): Override this.
6622 2003-11-14 Martin Baulig <martin@ximian.com>
6624 * interface.cs (Interface.DefineType): Define all type parameters
6625 before adding the interfaces we inherit.
6627 2003-11-11 Martin Baulig <martin@ximian.com>
6629 * generic.cs (ConstructedType.ResolveType): Always call
6630 `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
6632 2003-11-10 Martin Baulig <martin@ximian.com>
6634 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
6635 (TypeManager.InitCoreTypes): Initialize them here, but instead of
6636 calling `ResolveType()' on them, directly assign their `Type'.
6638 2003-11-08 Martin Baulig <martin@ximian.com>
6640 * generic.cs (ConstructedType): Override `IsClass' etc.
6642 2003-11-08 Martin Baulig <martin@ximian.com>
6644 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
6645 return value and the `out parent' parameter.
6646 (TypeContainer.DefineType): Moved the CS0644 check into
6647 GetClassBases(). Don't pass the interface types to the
6648 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
6649 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
6651 * ecore.cs (TypeExpr.IsAttribute): New property.
6652 (TypeExpr.GetInterfaces): New method.
6654 * interface.cs (Interface.GetInterfaceTypeByName): Return a
6655 TypeExpr instead of a Type.
6656 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
6657 (Interface.DefineType): Don't pass the interface types to the
6658 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
6659 them later and then call `TypeBulider.AddInterfaceImplementation()'.
6661 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
6662 instead of a `Type[]'.
6663 (TypeManager.RegisterBuilder): Likewise.
6664 (TypeManager.AddUserInterface): Likewise.
6665 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
6666 `Type[]' and also return a `TypeExpr[]'.
6667 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
6669 2003-11-08 Martin Baulig <martin@ximian.com>
6671 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
6674 2003-11-08 Martin Baulig <martin@ximian.com>
6676 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
6677 TypeManager.ResolveExpressionTypes().
6679 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
6680 instead of an Expression.
6681 (TypeExpr): This is now an abstract base class for `TypeExpression'.
6682 (TypeExpression): New public class; formerly known as `TypeExpr'.
6684 * expression.cs (ComposedCast): Derive from TypeExpr.
6686 * typemanager.cs (TypeManager.system_*_expr): These are now
6687 TypExpr's instead of Expression's.
6688 (TypeManager.ResolveExpressionTypes): New public static function;
6689 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
6692 2003-11-06 Miguel de Icaza <miguel@ximian.com>
6694 * expression.cs (New.DoResolve): Do not dereference value that
6695 might be a null return.
6697 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
6698 sure that the constant value has the right type. Fixes an
6699 unreported bug, similar to 50425.
6701 * const.cs (Const.LookupConstantValue): Call
6702 ImplicitStandardConversionExists before doing a conversion to
6703 avoid havng the TypeManager.ChangeType do conversions.
6705 Reduced the number of casts used
6707 (Const.ChangeType): New routine to enable reuse of the constant
6708 type changing code from statement.
6710 * typemanager.cs (ChangeType): Move common initialization to
6711 static global variables.
6715 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
6716 every value type to go through, even if it was void. Fix that.
6718 * cs-tokenizer.cs: Use is_identifier_start_character on the start
6719 character of the define, and the is_identifier_part_character for
6720 the rest of the string.
6722 2003-11-05 Miguel de Icaza <miguel@ximian.com>
6724 * expression.cs (UnaryMutator.EmitCode): When I updated
6725 LocalVariableReference.DoResolve, I overdid it, and dropped an
6726 optimization done on local variable references.
6728 2003-11-04 Miguel de Icaza <miguel@ximian.com>
6730 * ecore.cs: Convert the return from Ldlen into an int.
6732 2003-10-20 Miguel de Icaza <miguel@ximian.com>
6734 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
6735 the accessibility, this is a special case for toplevel non-public
6736 classes (internal for instance).
6738 2003-10-20 Nick Drochak <ndrochak@gol.com>
6740 * ecore.cs: Fix typo and build. Needed another right paren.
6742 2003-10-19 Miguel de Icaza <miguel@ximian.com>
6744 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
6745 `internal' case regular and protected, but not allowing protected
6746 to be evaluated later. Bug 49840
6748 2003-10-15 Miguel de Icaza <miguel@ximian.com>
6750 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
6751 to kb.Nlast, and not the kb.nFirst to isolate the switch
6754 Extract the underlying type, so enumerations of long/ulong are
6755 treated like long/ulong.
6757 2003-10-14 Miguel de Icaza <miguel@ximian.com>
6759 * expression.cs (New): Overload the meaning of RequestedType to
6760 track the possible creation of the NewDelegate type, since
6761 DoResolve is invoked more than once for new constructors on field
6764 See bugs: #48800 and #37014
6766 * cs-parser.jay (declare_local_constants): Take an arraylist
6767 instead of a single constant.
6769 (local_constant_declaration): It should take a
6770 constant_declarators, not a constant_declarator. Fixes 49487
6772 * convert.cs: Fix error report.
6774 2003-10-13 Jackson Harper <jackson@ximian.com>
6776 * typemanager.cs (TypeToCoreType): Add float and double this fixes
6779 2003-11-03 Martin Baulig <martin@ximian.com>
6781 * expression.cs (ArrayAccess.GetStoreOpcode): Added
6782 `out bool has_type_arg'; if set, we need to pass the type to
6784 (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
6785 Stelem_Any/Ldelem_Any for generic parameters.
6787 2003-11-02 Martin Baulig <martin@ximian.com>
6789 * expression.cs (Invocation.EmitCall): Use
6790 `TypeManager.IsValueType()' to check whether it's a value type.
6791 Don't set `struct_call' when calling a method on a type parameter.
6793 2003-11-02 Martin Baulig <martin@ximian.com>
6795 * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
6796 and removed the TypeBuilder argument.
6798 * typemanager.cs (TypeManager.IsValueType): Return
6799 `t.IsGenericParameter || t.IsValueType'.
6801 2003-10-25 Martin Baulig <martin@ximian.com>
6803 * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
6804 call ConstructedType.Resolve() on it.
6806 * generic.cs (ConstructedType.Resolve): Set `type' on success.
6808 2003-10-25 Martin Baulig <martin@ximian.com>
6810 * class.cs (TypeContainer.GetClassBases): Changed
6811 `out Type parent' into `out TypeExpr parent'. Moved CS0644 and
6812 CS8214 reporting here.
6813 (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
6814 instead of a `Type' for our parent. In case of a recursive
6815 declaration (see tests/gen-23.cs for an example), our parent is a
6816 ConstructedType and it doesn't have its type set. So, first
6817 create our own TypeBuilder, then call constructed.Resolve() to get
6818 the parent's type and finally TypeBuilder.SetParent() it.
6820 * ecore.cs (TypeExpr.Name): New public virtual property.
6823 (ConstructedType): We're now a TypeExpr and not just an Expression.
6824 (ConstructedType.ResolveAsTypeStep): Don't resolve our type
6825 arguments here; this is done later.
6826 (ConstructedType.Resolve): New public method to resolve the type
6827 arguments and bind them.
6829 2003-10-21 Martin Baulig <martin@ximian.com>
6831 * convert.cs: Use `TypeManager.IsValueType' instead of
6832 'type.IsValueType' everywhere.
6834 * typemanager.cs (TypeManager.IsValueType): Return true for type
6835 parameters. The reason for this is that we need to box a type
6836 parameter when converting it to a reference type.
6838 * cs-parser.jay: Added support for default value expressions.
6840 * generics.cs (DefaultValueExpression): New public class.
6842 2003-10-17 Martin Baulig <martin@ximian.com>
6844 * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
6845 TypeContainer so we can also use this for Interfaces.
6846 (TypeParameter.Resolve): Likewise.
6848 * interface.cs (Interface.DefineType): Added support for generic
6851 * cs-parser.jay: Added support for generic structs and interfaces.
6853 2003-10-17 Martin Baulig <martin@ximian.com>
6855 * generic.cs (GenericMemberAccess.DoResolve): We can now actually
6856 call generic methods :-)
6858 2003-10-16 Martin Baulig <martin@ximian.com>
6860 * cs-parser.jay (namespace_or_type_name): Only create a
6861 GenericMemberAccess if we actually have type arguments.
6863 2003-10-13 Martin Baulig <martin@ximian.com>
6865 * class.cs (Method.Define): If we're a generic method, call
6866 TypeBuilder.DefineGenericMethod () before resolving
6868 (MethodData): Added .ctor which takes an additional MethodBuilder
6869 argument; this is used for generic methods.
6870 (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
6871 we already have a MethodBuilder.
6873 2003-10-10 Martin Baulig <martin@ximian.com>
6875 * class.cs (Method): Added .ctor which takes a `GenericMethod'
6876 instead of a `DeclSpace'. This is used for generic methods.
6878 * cs-parser.jay (method_header): Added support for generic
6879 methods; create a `GenericMethod' instance and pass it to the
6880 `Method's .ctor; it'll be used as the `DeclSpace' to lookup
6881 parameters and locals.
6883 * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
6884 since we already have the location. Check whether we're a generic
6885 type declaration or a generic method and create the correct type
6888 * generic.cs (TypeParameter.DefineMethod): New public method.
6889 (GenericMethod): New public class; derives from DeclSpace and is
6890 used for generic methods.
6892 2003-10-09 Martin Baulig <martin@ximian.com>
6894 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
6896 (MethodCore.DoDefineParameters): Removed the TypeContainer
6897 argument; use the DeclSpace which was passed to the .ctor instead.
6898 (MethodCore.CheckParameter): Take a DeclSpace instead of a
6899 TypeContainer; we only need a DeclSpace here.
6901 2003-10-09 Martin Baulig <martin@ximian.com>
6903 * class.cs (MethodData): Added additional `DeclSpace ds' argument
6905 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
6906 EmitContext's .ctor.
6908 2003-10-09 Martin Baulig <martin@ximian.com>
6910 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
6911 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
6912 AsAccessible(), moved them as well.
6914 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
6916 2003-10-07 Miguel de Icaza <miguel@ximian.com>
6918 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
6919 generation for >=, as spotted by Paolo, bug 48679.
6920 Patch from David Waite.
6922 * cs-tokenizer.cs: Add handling for #pragma.
6924 * cs-parser.jay: Allow for both yield and yield return in the
6925 syntax. The anti-cobolization of C# fight will go on!
6927 * class.cs (TypeBuilder.DefineType): Catch error condition here
6928 (Parent.DefineType erroring out and returning null).
6930 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
6931 coping with enumerations variables, we were mistakenly processing
6932 them as a regular value type instead of built-in types. Fixes the
6935 * typemanager.cs (IsBuiltinOrEnum): New method.
6937 2003-09-30 Miguel de Icaza <miguel@ximian.com>
6939 * cs-parser.jay: Upgrade: yield now needs the return clause.
6941 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
6943 * cs-parser.jay : Renamed yyName to yyNames related to jay.
6945 2003-09-29 Martin Baulig <martin@ximian.com>
6947 * typemanager.cs (TypeManager.GetMethodFlags): Added support for
6948 inflated generic methods.
6950 * generics.cs (ConstructedType): Distinguish between open and
6951 closed constructed types; correctly resolve the arguments.
6953 2003-09-22 Martin Baulig <martin@ximian.com>
6955 * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
6956 all type arguments meet their constraints.
6958 2003-09-19 Martin Baulig <martin@ximian.com>
6960 * decl.cs (MemberCache.SetupCacheForInterface): Take a
6961 `MemberCache parent' argument. Normally, an interface doesn't
6962 have a parent type except System.Object, but we use this in gmcs
6963 for generic type parameters.
6965 2003-09-18 Martin Baulig <martin@ximian.com>
6967 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
6968 on `type.IsInterface'; don't check whether the type has a parent
6969 to determine whether it's an interface.
6971 2003-09-17 Martin Baulig <martin@ximian.com>
6973 * generic.cs (ConstructedType.ToString): Always use `name' as the
6976 2003-09-15 Martin Baulig <martin@ximian.com>
6978 * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
6980 * generic.cs (Constraints.Resolve): New public method; this is
6981 called to resolve the constraint types and to check whether all
6982 the constraints are correct.
6983 (Constraints.Types): New public property.
6984 (TypeParameter.Resolve): New public method; resolves all the
6987 * class.cs (TypeContainer.DefineType): Call
6988 TypeParameter.Resolve() before actually defining the type.
6990 2003-09-15 Martin Baulig <martin@ximian.com>
6992 * class.cs (TypeContainer.DefineType): Added an error flag to
6993 avoid reporting duplicate CS0146's ("class definition is
6996 * driver.cs (Driver.MainDriver): Abort if
6997 RootContext.ResolveTree() reported any errors.
6999 2003-09-07 Martin Baulig <martin@ximian.com>
7001 * report.cs (Error, Warning): Added overloaded versions which take
7002 a `params object[] args' and call String.Format().
7004 2003-09-07 Martin Baulig <martin@ximian.com>
7006 * decl.cs (DeclSpace..ctor): Don't call
7007 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
7008 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
7009 (DeclSpace.RecordDecl): New method.
7011 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
7013 2003-09-02 Ravi Pratap <ravi@ximian.com>
7015 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
7016 value attributes to be applied to ParameterBuilders.
7018 * class.cs (MethodCore.LabelParameters): Make static and more
7019 generic so that it can be used from other places - like interface
7020 methods, for instance.
7022 * interface.cs (Interface.Emit): Call LabelParameters before
7023 emitting attributes on the InterfaceMethod.
7025 2003-09-07 Martin Baulig <martin@ximian.com>
7027 * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
7028 if the number of type parameters doesn't match.
7030 2003-09-04 Martin Baulig <martin@ximian.com>
7032 * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
7033 for arrays of generic type params (ie. `!0[]').
7035 2003-09-04 Martin Baulig <martin@ximian.com>
7037 * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
7040 2003-09-04 Martin Baulig <martin@ximian.com>
7042 * decl.cs (DeclSpace.LookupGeneric): New method.
7043 (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
7046 * generic.cs (TypeParameterExpr): Take a TypeParameter as
7047 argument, not just a string.
7048 (TypeParameter.Define): New public method; this is called to
7049 actually define the generic parameter; after this, you can use the
7050 new `Type' property to get the type.
7052 2003-09-04 Martin Baulig <martin@ximian.com>
7054 * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
7055 is now an ArrayList; initialize the result of the `TypeParameters'
7057 (DeclSpace.GetGenericData): Removed.
7058 (DeclSpace.LookupGeneric): Temporarily removed; we need to
7059 implement this in a different way.
7060 (DeclSpace.GetTypeParameters): Removed; there's now a
7061 `TypeParameters' property.
7062 (DeclSpace.TypeParameters): New public property.
7064 * generic.cs (Constraints): Make this class public.
7065 (TypeParameter): New public class.
7067 2003-09-04 Martin Baulig <martin@ximian.com>
7069 * decl.cs (DeclSpace.GetTypeParameters): New method to return the
7072 * class.cs (TypeContainer.DefineType): Call
7073 TypeBuilder.DefineGenericParameter () on all generic parameters if
7074 this is a generic type.
7076 2003-08-28 Martin Baulig <martin@ximian.com>
7078 * sample-stack.il: Compile this with ilasm: "ilasm /dll
7081 * sample-hello.cs: Compile this with gmcs: "gmcs
7082 /r:sample-stack.dll sample-hello.cs".
7084 2003-08-28 Martin Baulig <martin@ximian.com>
7086 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
7087 the parameters to the generic type.
7089 2003-08-28 Martin Baulig <martin@ximian.com>
7091 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
7093 2003-08-28 Martin Baulig <martin@ximian.com>
7095 * cs-parser.jay (opt_type_argument_list): Use
7096 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
7097 (primary_expression): Replace `qualified_identifier' with `type_name'.
7098 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
7100 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
7101 parser to check whether it is syntactically a type parameter list;
7102 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
7105 2003-08-26 Martin Baulig <martin@ximian.com>
7107 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
7108 resolving aliases; fixes #47927.
7110 2003-08-26 Martin Baulig <martin@ximian.com>
7112 * statement.cs (Using.DoResolve): This is internally emitting a
7113 try/finally clause, so we need to set ec.NeedExplicitReturn if we
7114 do not always return. Fixes #47681.
7116 2003-08-26 Martin Baulig <martin@ximian.com>
7118 * decl.cs (MemberCore): Moved WarningNotHiding(),
7119 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
7121 (AdditionResult): Make this nested in DeclSpace.
7122 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
7123 argument; call NamespaceEntry.Define() unless we're nested in a
7126 * namespace.cs (Namespace.DefineName): New public function. This
7127 is called from DeclSpace's .ctor to add
7128 (Namespace.Lookup): Include DeclSpaces in the lookup.
7130 * class.cs (Operator): Derive from MemberBase, not MemberCore.
7132 * const.cs (Const): Derive from MemberBase, not MemberCore.
7134 2003-08-25 Martin Baulig <martin@ximian.com>
7136 * convert.cs (Convert.ExplicitReferenceConversion): When
7137 converting from an interface type to a class, unbox if the target
7138 type is a struct type. Fixes #47822.
7140 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7142 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
7145 2003-08-22 Martin Baulig <martin@ximian.com>
7147 * class.cs (TypeManager.DefineType): When defining a nested type,
7148 call DefineType() on our parent; fixes #47801.
7150 2003-08-22 Martin Baulig <martin@ximian.com>
7152 * class.cs (MethodData.Define): While checking if a method is an
7153 interface implementation, improve the test a bit more to fix #47654.
7155 2003-08-22 Martin Baulig <martin@ximian.com>
7157 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
7158 correctly; fixes #47722.
7160 2003-08-22 Martin Baulig <martin@ximian.com>
7162 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
7163 LocalVariableReference, ensure it's not read-only. Fixes #47536.
7165 * statement.cs (Fixed.DoResolve): Make all variables read-only.
7167 2003-08-22 Martin Baulig <martin@ximian.com>
7169 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
7170 can only be assigned in static constructors. Fixes #47161.
7172 2003-08-22 Martin Baulig <martin@ximian.com>
7174 Rewrote and improved the flow analysis code.
7176 * flowbranching.cs (FlowBranching): Make this class abstract.
7177 (FlowBranching.CreateBranching): New static function to create a
7179 (FlowBranchingBlock, FlowBranchingException): New classes.
7180 (FlowBranching.UsageVector.Type): New public readonly field.
7181 (FlowBranching.UsageVector.Breaks): Removed the setter.
7182 (FlowBranching.UsageVector.Returns): Removed the setter.
7183 (FlowBranching.UsageVector): Added Break(), Return(),
7184 NeverReachable() and Throw() methods to modify the reachability.
7185 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
7186 done by FlowBranching.Merge().
7187 (FlowBranching.UsageVector.MergeChild): New method; merges the
7188 merge result into the current vector.
7189 (FlowBranching.Merge): New abstract method to merge a branching.
7191 2003-08-12 Martin Baulig <martin@ximian.com>
7193 * expression.cs (Indirection.CacheTemporaries): Create the
7194 LocalTemporary with the pointer type, not its element type.
7196 2003-08-10 Miguel de Icaza <miguel@ximian.com>
7198 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
7199 token was a keyword or not.
7201 Add `error' options where an IDENTIFIER was expected; Provide
7202 CheckToken and CheckIdentifierToken convenience error reporting
7205 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
7207 * decl.cs: Rename `NamespaceEntry Namespace' public field into
7208 NameSpaceEntry NameSpaceEntry.
7210 (LookupInterfaceOrClass): Avoid creating a full qualified name
7211 from namespace and name: avoid doing lookups when we know the
7212 namespace is non-existant. Use new Tree.LookupByNamespace which
7213 looks up DeclSpaces based on their namespace, name pair.
7215 * driver.cs: Provide a new `parser verbose' to display the
7216 exception thrown during parsing. This is turned off by default
7217 now, so the output of a failure from mcs is more graceful.
7219 * namespace.cs: Track all the namespaces defined in a hashtable
7222 (IsNamespace): New method
7224 2003-08-09 Miguel de Icaza <miguel@ximian.com>
7226 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
7227 we know that we need to concatenate (full typename can never be
7232 * statement.cs: Use a bitfield; Do not initialize to null things
7233 which are done by the constructor by default.
7235 * cs-parser.jay: bug fix, parameter was 4, not 3.
7237 * expression.cs: Just use the property;
7239 * statement.cs: No need for GetVariableInfo method.
7241 2003-08-08 Martin Baulig <martin@ximian.com>
7243 * flowanalysis.cs (FlowReturns): This is now nested in the
7244 `FlowBranching' class.
7245 (MyBitVector): Moved this here from statement.cs.
7246 (FlowBranching.SiblingType): New enum type.
7247 (FlowBranching.CreateSibling): Added `SiblingType' argument.
7249 2003-08-07 Martin Baulig <martin@ximian.com>
7251 * flowanalysis.cs (FlowBranchingType): This is now nested in the
7252 `FlowBranching' class and called `BranchingType'.
7254 2003-08-07 Martin Baulig <martin@ximian.com>
7256 * flowanalysis.cs: Moved all the control flow analysis code into
7259 2003-08-07 Martin Baulig <martin@ximian.com>
7261 * assign.cs (Assign.DoResolve): `target' must either be an
7262 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
7265 2003-08-07 Miguel de Icaza <miguel@ximian.com>
7267 * expression.cs (BinaryMethod): This kind of expression is created by the
7268 Binary class if it determines that the operator has to be handled
7271 (BinaryDelegate): This kind of expression is created if we are
7272 dealing with a + or - operator on delegates.
7274 (Binary): remove method, argumetns, and DelegateOperator: when
7275 dealing with methods,
7277 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
7279 * statement.cs (Block): use bitfields for the three extra booleans
7280 we had in use. Remove unused topblock parameter.
7282 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
7284 * assign.cs: Drop extra unneeded tests.
7286 2003-08-06 Miguel de Icaza <miguel@ximian.com>
7288 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
7290 * statement.cs (Foreach): Use VariableStorage instead of
7293 * codegen.cs (VariableStorage): New class used by clients that
7294 require a variable stored: locals or fields for variables that
7295 need to live across yield.
7297 Maybe provide a convenience api for EmitThis+EmitLoad?
7299 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
7302 2003-08-05 Miguel de Icaza <miguel@ximian.com>
7304 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
7305 RemapParameterLValue): New methods that are used to turn a
7306 precomputed FieldInfo into an expression like this:
7310 The idea is to use this instead of making LocalVariableReference
7311 have more than one meaning.
7313 * cs-parser.jay: Add error production to BASE.
7315 * ecore.cs: Deal with TypeManager.GetField returning null, which
7316 is now a valid return value.
7318 (FieldExprNoAddress): New expression for Fields whose address can
7321 * expression.cs (LocalVariableReference): During the resolve
7322 phases, create new expressions if we are in a remapping context.
7323 Remove code that dealt with remapping here.
7325 (ParameterReference): same.
7327 (ProxyInstance): New expression, like the `This' expression, but
7328 it is born fully resolved. We know what we are doing, so remove
7329 the errors that are targeted to user-provided uses of `this'.
7331 * statement.cs (Foreach): our variable is now stored as an
7332 Expression; During resolution, follow the protocol, dont just
7333 assume it will return this.
7335 2003-08-06 Martin Baulig <martin@ximian.com>
7337 * support.cs (SeekableStreamReader.cs): New public class.
7339 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
7340 SeekableStreamReader instead of the normal StreamReader.
7342 2003-08-04 Martin Baulig <martin@ximian.com>
7344 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
7345 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
7346 deambiguate casts and delegate invocations.
7347 (parenthesized_expression): Use the new tokens to ensure this is
7348 not a cast of method invocation.
7350 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
7351 when reading a `)' and Deambiguate_CloseParens () was previously
7354 * expression.cs (ParenthesizedExpression): New class. This is
7355 just used for the CS0075 test.
7356 (Binary.DoResolve): Check for CS0075.
7358 2003-07-29 Ravi Pratap <ravi@ximian.com>
7360 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
7361 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
7362 reference comparison.
7364 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
7365 examine the ReturnType for equality - this is necessary in the
7366 cases of implicit and explicit operators whose signature also
7367 includes the return type.
7369 2003-07-26 Miguel de Icaza <miguel@ximian.com>
7371 * namespace.cs: Cache the result of the namespace computation,
7372 instead of computing it every time.
7374 2003-07-24 Miguel de Icaza <miguel@ximian.com>
7376 * decl.cs: Use a global arraylist that we reuse over invocations
7377 to avoid excesive memory consumption. Reduces memory usage on an
7378 mcs compile by one meg (45 average).
7380 * typemanager.cs (LookupTypeReflection): In .NET pointers are
7381 private, work around that.
7383 2003-07-23 Miguel de Icaza <miguel@ximian.com>
7385 * literal.cs (IntLiteral): Define Zero and One static literals.
7387 * cs-parser.jay (integer_literal): use static literals to reduce
7388 memory usage for the most used literals (0, 1 and -1). 211kb
7389 reduced in memory usage.
7391 Replace all calls to `new ArrayList' with `new
7392 ArrayList(4)' which is a good average number for most allocations,
7393 and also requires only 16 bytes of memory for its buffer by
7396 This reduced MCS memory usage in seven megabytes for the RSS after
7399 2003-07-28 Ravi Pratap <ravi@ximian.com>
7401 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
7402 handle params methods the correct way by forming only one
7403 applicable set with params and normal methods in them. Earlier we
7404 were looking at params methods only if we found no normal methods
7405 which was not the correct thing to do.
7407 (Invocation.BetterFunction): Take separate arguments indicating
7408 when candidate and the best method are params methods in their
7411 This fixes bugs #43367 and #46199.
7413 * attribute.cs: Documentation updates.
7415 (CheckAttribute): Rename to CheckAttributeTarget.
7416 (GetValidPlaces): Rename to GetValidTargets.
7418 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
7419 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
7423 2003-07-28 Miguel de Icaza <miguel@ximian.com>
7425 * codegen.cs: Compute IsGeneric correctly.
7427 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
7430 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
7431 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
7432 regressions, and I was chasing more bugs than I required.
7434 * interface.cs: Use expressions for base type names (like classes
7435 and structs have been doing for a while now), and resolve that.
7436 This patch should probably go into head as well.
7438 This makes it one less user of FindType.
7440 2003-07-24 Miguel de Icaza <miguel@ximian.com>
7442 This compiler can not self host currently. Need to fix that.
7444 * Makefile: compile to `gmcs.exe'
7446 * driver.cs: Turn on v2 by default on gmcs.
7448 * generic.cs (ConstructedType): Does no longer take a container
7449 type argument; That will be taken care of later.
7451 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
7452 Use SimpleName to resolve for now, so we can continue the work on
7453 the parser, until we get Type.GetType that understands generics.
7455 (ConstructedType.ToString): Implement
7457 (TypeArguments.Resolve): Resolve the child expressions as types.
7459 * cs-parser.jay: Rename interface_constraints to
7460 type_parameter_constraints
7462 (namespace_or_type_name): Only use constructed types for the basic
7463 construction, we will deal with identifier<...> later.
7465 (type/type_name): No longer call DecomposeQI, as
7466 namespace_or_type_name is always decoded now.
7468 2003-07-22 Ravi Pratap <ravi@ximian.com>
7470 * expression.cs (Invocation.OverloadResolve): Follow the spec more
7471 closely: we eliminate methods in base types when we have an
7472 applicable method in a top-level type.
7474 Please see section 14.5.5.1 for an exact description of what goes
7477 This fixes bug #45127 and a host of other related to corlib compilation.
7479 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
7480 array is the method corresponding to the top-level type (this is
7481 because of the changes made to icall.c) so we change this
7484 (MethodGroupExpr.Name): This too.
7486 * typemanager.cs (GetElementType): New method which does the right
7487 thing when compiling corlib.
7489 * everywhere: Make use of the above in the relevant places.
7491 2003-07-22 Martin Baulig <martin@ximian.com>
7493 * cs-parser.jay (invocation_expression): Moved
7494 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
7495 `cast_expression', but create a InvocationOrCast which later
7496 resolves to either an Invocation or a Cast.
7498 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
7499 method; call this before EmitStatement() to make sure that this
7500 expression can be used as a statement.
7502 * expression.cs (InvocationOrCast): New class; resolves to either
7503 an Invocation or a Cast.
7505 * statement.cs (StatementExpression): Call ResolveStatement() on
7506 the ExpressionStatement before emitting it.
7508 2003-07-21 Martin Baulig <martin@ximian.com>
7510 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
7511 `ref' and `out' attributes match; fixes #46220.
7512 (MemberAccess.ResolveMemberAccess): You can't reference a type
7513 through an expression; fixes #33180.
7514 (Indexers.GetIndexersForType): Don't return the indexers from
7515 interfaces the class implements; fixes #46502.
7517 2003-07-21 Martin Baulig <martin@ximian.com>
7519 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
7520 CS0661 checks; fixes bug #30442.
7522 2003-07-21 Martin Baulig <martin@ximian.com>
7524 * decl.cs (AdditionResult): Added `Error'.
7526 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
7528 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
7529 cs0031.cs actually work.
7531 2003-07-20 Miguel de Icaza <miguel@ximian.com>
7533 * cs-parser.jay (namespace_name): do not use
7534 namespace_or_type_name, use qualified_identifier, because
7535 namespace_or_type_name will soon return a composed expression
7536 instead of a string.
7538 (namespace_or_type_name): Instead of returning a string, now this
7539 production returns an expression.
7541 * codegen.cs (EmitContext): Setup IsGeneric property based on
7542 whether our DeclSpace is generic, our the method is generic.
7544 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
7545 the method is generic.
7547 * cs-parser.jay (type_arguments, opt_type_argument_list,
7548 type_parameters, type_parameter_list, opt_type_parameter_list,
7549 type_parameter,, opt_type_parameter_constraints_clauses,
7550 type_parameter_constraints_clauses,
7551 type_parameter_constraint_clause, type_parameter_constraint,
7552 interface_constraints): Add new production
7554 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
7555 DeclSpace is generic or not.
7557 (DeclSpace.SetParameterInfo): New routine, used to set the
7558 parameter info for a type.
7560 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
7561 returns a GenericTypeExpr
7563 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
7564 generic, lookup the generic argument.
7566 * attribute.cs: Do not allow TypeParameterExpressions in
7569 * class.cs: Do not allow the Main method to be defined in a
7572 * expression.cs (SizeOf): Do not allow generic types to be used as
7573 arguments to sizeof.
7575 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
7576 it: whether a type is generic or not. Only works for types we are
7577 currently building for now.
7579 2003-07-20 Martin Baulig <martin@ximian.com>
7581 * namespace.cs: Fixed that bug which caused a crash when compiling
7584 2003-07-20 Miguel de Icaza <miguel@ximian.com>
7586 * typemanager.cs (LookupTypeReflection): Never expose types which
7587 are NotPublic, NestedPrivate, NestedAssembly, or
7588 NestedFamANDAssem. We used to return these, and later do a check
7589 that would report a meaningful error, but the problem is that we
7590 would not get the real match, if there was a name override.
7592 2003-07-18 Miguel de Icaza <miguel@ximian.com>
7594 * namespace.cs (Namespace, Name): Do not compute the namespace
7595 name dynamically, compute it in the constructor. This reduced
7596 memory usage by 1697 KB.
7598 * driver.cs: Use --pause to pause at the end.
7600 2003-07-17 Peter Williams <peter@newton.cx>
7602 * Makefile: Change the name of the test target so that it doesn't
7603 conflict with the recursive test target.
7605 2003-07-17 Miguel de Icaza <miguel@ximian.com>
7607 * expression.cs (LocalVariableReference.Emit, EmitAssign,
7608 AddressOf): Do not use EmitThis, that was wrong, use the actual
7611 2003-07-15 Miguel de Icaza <miguel@ximian.com>
7613 * class.cs (MethodData.Define): While checking if a method is an
7614 interface implementation, improve the test: If we are not public
7615 (use new test here: use the computed MethodAttributes directly,
7616 instead of the parsed modifier flags) check if the `implementing'
7617 method comes from an interface or not.
7619 * pending.cs (VerifyPendingMethods): Slightly better error
7622 * makefile: add test target that does the mcs bootstrap.
7624 2003-07-16 Ravi Pratap <ravi@ximian.com>
7626 * interface.cs (Define): Do nothing here since there are no
7627 members to populate etc. Move the attribute emission out of here
7628 since this was just totally the wrong place to put it. Attribute
7629 application happens during the 'Emit' phase, not in the 'Define'
7632 (Emit): Add this method and move the attribute emission here
7634 * rootcontext.cs (EmitCode): Call the Emit method on interface
7637 2003-07-14 Ravi Pratap M <ravi@ximian.com>
7639 * expression.cs (OverloadResolve): Report error only if Location
7640 is not 'Null' which means that there was a probe going on.
7642 2003-07-14 Martin Baulig <martin@ximian.com>
7644 * expression.cs (ConditionalLogicalOperator): New public class to
7645 implement user defined conditional logical operators.
7646 This is section 14.11.2 in the spec and bug #40505.
7648 2003-07-14 Martin Baulig <martin@ximian.com>
7650 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
7652 2003-07-14 Martin Baulig <martin@ximian.com>
7654 * codegen.cs (EmitContext.InFixedInitializer): New public field.
7656 * ecore.cs (IVariable.VerifyFixed): New interface method.
7658 * expression.cs (Unary.ResolveOperator): When resolving the `&'
7659 operator, check whether the variable is actually fixed. Fixes bug
7660 #36055. Set a variable definitely assigned when taking its
7661 address as required by the spec.
7663 * statement.cs (LocalInfo.IsFixed): New field.
7664 (LocalInfo.MakePinned): Set `IsFixed' to true.
7666 2003-07-14 Ravi Pratap M <ravi@ximian.com>
7668 * attribute.cs (Attribute.Resolve): While doing a Member lookup
7669 for .ctors, ensure that we only ask for members declared in the
7670 attribute type (BindingFlags.DeclaredOnly).
7674 * expression.cs (Error_WrongNumArguments): Report error 1501
7675 correctly the way CSC does.
7677 2003-07-13 Martin Baulig <martin@ximian.com>
7679 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
7680 lookup on the fully qualified name, to make things like "X.X" work
7681 where "X.X" is a fully qualified type name, but we also have a
7682 namespace "X" in the using list. Fixes #41975.
7684 2003-07-13 Martin Baulig <martin@ximian.com>
7686 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
7687 function. If we're a CompoundAssign, we need to create an embedded
7688 CompoundAssign, not an embedded Assign.
7689 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
7692 2003-07-13 Martin Baulig <martin@ximian.com>
7694 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
7695 work to fix bug #46088.
7697 2003-07-13 Ravi Pratap <ravi@ximian.com>
7699 * class.cs (Operator.Emit): Do not emit attributes here - it is
7700 taken care of by the Method class that we delegate too. This takes
7703 2003-07-10 Martin Baulig <martin@ximian.com>
7705 * expression.cs (TypeOfVoid): New class.
7706 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
7708 2003-07-10 Martin Baulig <martin@ximian.com>
7710 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
7713 2003-07-10 Martin Baulig <martin@ximian.com>
7715 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
7716 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
7718 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
7720 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
7722 2003-07-10 Martin Baulig <martin@ximian.com>
7724 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
7725 of decimal. Fixes #42850.
7727 NOTE: I also fixed the created byte blob, but this doesn't work on
7728 the MS runtime and csc never produces any byte blobs for decimal
7731 2003-07-10 Martin Baulig <martin@ximian.com>
7733 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
7734 structs; fixes #32068.
7735 (Block.AddChildVariableNames): Fixed #44302.
7737 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7739 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
7741 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7743 * attribute.cs: And this test is onger needed.
7745 2003-07-08 Martin Baulig <martin@ximian.com>
7747 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
7748 inaccessible types. Fixes #36313.
7750 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
7752 * namespace.cs (NamespaceEntry): Create implicit entries for all
7753 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
7754 implicit entries for N1.N2 and N1.
7756 2003-07-08 Martin Baulig <martin@ximian.com>
7758 Rewrote the handling of namespaces to fix a lot of the issues
7759 wrt. `using' aliases etc.
7761 * namespace.cs (Namespace): Splitted this class into a
7762 per-assembly `Namespace' and a per-file `NamespaceEntry'.
7764 * typemanager.cs (TypeManager.IsNamespace): Removed.
7765 (TypeManager.ComputeNamespaces): Only compute namespaces from
7766 loaded assemblies here, not the namespaces from the assembly we're
7767 currently compiling.
7769 2003-07-08 Martin Baulig <martin@ximian.com>
7771 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
7773 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7775 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
7778 I thought about the memory savings here, but LookupTypeReflection
7779 is used under already very constrained scenarios. Compiling
7780 corlib or mcs only exposes one hit, so it would not really reduce
7781 any memory consumption.
7783 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7785 * typemanager.cs: fixes bug #45889 by only adding public types from
7786 other assemblies to the list of known types.
7788 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7790 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
7791 on the type we resolved.
7793 2003-07-05 Martin Baulig <martin@ximian.com>
7795 * pending.cs (PendingImplementation.ParentImplements): Don't
7796 create the proxy if the parent is abstract.
7798 * class.cs (TypeContainer.DefineIndexers): Process explicit
7799 interface implementations first. Fixes #37714.
7801 2003-07-04 Miguel de Icaza <miguel@ximian.com>
7803 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
7804 defined recursively; but since we modify the input parameters
7805 (left is set to `this' temporarily), we reset this value if the
7806 left_is_explicit is false, which gives the original semantics to
7809 * literal.cs (NullPointer): new class used to represent a null
7810 literal in a pointer context.
7812 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
7813 type is a pointer, use a NullPointer object instead of a
7814 NullLiteral. Closes 43687
7816 (ExplicitConversion): Convert pointer values using
7817 the conv opcode to the proper type.
7819 * ecore.cs (New): change ValueTypeVariable property into a method,
7820 that returns whether the valuetype is suitable for being used.
7822 * expression.cs (Binary.DoNumericPromotions): Only return if we
7823 the int constant was a valid uint, and we can return both left and
7824 right as uints. If not, we continue processing, to trigger the
7825 type conversion. This fixes 39018.
7827 * statement.cs (Block.EmitMeta): During constant resolution, set
7828 the CurrentBlock property on the emitcontext, so that we resolve
7829 constants propertly.
7831 2003-07-02 Martin Baulig <martin@ximian.com>
7833 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
7834 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
7836 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
7837 than emitting it here.
7839 * statement.cs: Fixed some more flow analysis bugs.
7841 2003-07-02 Martin Baulig <martin@ximian.com>
7843 * class.cs (MethodData.Define): When implementing interface
7844 methods, set Final unless we're Virtual.
7846 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
7847 check work for interface methods.
7849 2003-07-01 Martin Baulig <martin@ximian.com>
7851 * ecore.cs (EmitContext.This): Replaced this property with a
7852 GetThis() method which takes a Location argument. This ensures
7853 that we get the correct error location for a CS0188.
7855 2003-07-01 Miguel de Icaza <miguel@ximian.com>
7857 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
7858 ImplicitStandardConversion.
7860 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
7862 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
7864 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
7867 2003-06-30 Miguel de Icaza <miguel@ximian.com>
7869 * class.cs (Constructor.Define): Turn off initlocals for unsafe
7872 (MethodData.Define): Turn off initlocals for unsafe methods.
7874 2003-06-29 Miguel de Icaza <miguel@ximian.com>
7876 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
7877 complete; Fixes #37521.
7879 * delegate.cs: Use Modifiers.TypeAttr to compute the
7880 TypeAttributes, instead of rolling our own. This makes the flags
7881 correct for the delegates.
7883 2003-06-28 Miguel de Icaza <miguel@ximian.com>
7885 * class.cs (Constructor.Define): Set the private flag for static
7886 constructors as well.
7888 * cs-parser.jay (statement_expression): Set the return value to
7889 null, to avoid a crash when we catch an error.
7891 2003-06-24 Miguel de Icaza <miguel@ximian.com>
7893 * cs-parser.jay: Applied patch from Jackson that adds support for
7894 extern and unsafe modifiers to destructor declarations.
7896 * expression.cs: Report error 21 if the user is trying to index a
7899 * driver.cs: Add an error message, suggested by the bug report.
7901 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
7902 if we do not have a ": this ()" constructor initializer. Fixes 45149
7904 2003-06-14 Miguel de Icaza <miguel@ximian.com>
7906 * namespace.cs: Add some information to reduce FAQs.
7908 2003-06-13 Miguel de Icaza <miguel@ximian.com>
7910 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
7911 underlying enumeration types. Fixes #43915.
7913 * expression.cs: Treat ushort/short as legal values to be used in
7916 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
7918 * delegate.cs: transfer custom attributes for paramenters from
7919 the delegate declaration to Invoke and BeginInvoke.
7921 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
7923 * attribute.cs: handle custom marshalers and emit marshal info
7926 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
7928 * makefile.gnu: Added anonymous.cs to the compiler sources.
7930 2003-05-28 Miguel de Icaza <miguel@ximian.com>
7932 * iterators.cs: Change the name of the proxy class to include two
7935 * cs-parser.jay: Update grammar to include anonymous methods.
7937 * anonymous.cs: new file.
7939 2003-05-27 Miguel de Icaza <miguel@ximian.com>
7941 * class.cs (Field.Define): Add missing test for pointers and
7944 2003-05-27 Ravi Pratap <ravi@ximian.com>
7946 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
7947 we use the stobj opcode.
7949 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
7950 since it wasn't the correct fix.
7952 It still is puzzling that we are required to use stobj for IntPtr
7953 which seems to be a ValueType.
7955 2003-05-26 Miguel de Icaza <miguel@ximian.com>
7957 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
7958 during regular simple name resolution. Now, the trick is that
7959 instead of returning for processing the simplename, we do a
7960 TypeManager.LookupType (ie, a rooted lookup as opposed to a
7961 contextual lookup type). If a match is found, return that, if
7962 not, return for further composition.
7964 This fixes long-standing 30485.
7966 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
7967 using the address to initialize an object, do an Stobj instead of
7968 using the regular Stelem.
7970 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
7971 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
7972 Because if we are a BaseIndexerAccess that value will be true.
7975 * statement.cs (GotoCase.Resolve): Return after reporting an
7976 error, do not attempt to continue.
7978 * expression.cs (PointerArithmetic.Emit): If our operand is a
7979 long, convert our constants to match the operand before
7980 multiplying. Convert to I type before adding. Fixes 43670.
7982 2003-05-14 Ravi Pratap <ravi@ximian.com>
7984 * enum.cs (ImplicitConversionExists) : Rename to
7985 ImplicitEnumConversionExists to remove ambiguity.
7987 * ecore.cs (NullCast): New type of cast expression class which
7988 basically is very similar to EmptyCast with the difference being
7989 it still is a constant since it is used only to cast a null to
7993 * convert.cs (ImplicitReferenceConversion): When casting a null
7994 literal, we return a NullCast.
7996 * literal.cs (NullLiteralTyped): Remove - I don't see why this
7997 should be around anymore.
7999 The renaming (reported was slightly wrong). Corrections:
8001 ConvertImplicitStandard -> ImplicitConversionStandard
8002 ConvertExplicitStandard -> ExplicitConversionStandard
8004 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
8005 before passing them in !
8007 * convert.cs (ImplicitConversionStandard): When comparing for
8008 equal expr and target types, ensure that expr is not a
8011 In general, we must not be checking (expr_type ==
8012 target_type) in the top level conversion methods
8013 (ImplicitConversion, ExplicitConversion etc). This checking is
8014 done in the methods that they delegate to.
8016 2003-05-20 Miguel de Icaza <miguel@ximian.com>
8018 * convert.cs: Move Error_CannotConvertType,
8019 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
8020 ImplicitNumericConversion, ImplicitConversionExists,
8021 ImplicitUserConversionExists, StandardConversionExists,
8022 FindMostEncompassedType, FindMostSpecificSource,
8023 FindMostSpecificTarget, ImplicitUserConversion,
8024 ExplicitUserConversion, GetConversionOperators,
8025 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
8026 TryImplicitIntConversion, Error_CannotConvertImplicit,
8027 ConvertImplicitRequired, ConvertNumericExplicit,
8028 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
8029 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
8032 Perform the following renames:
8034 StandardConversionExists -> ImplicitStandardConversionExists
8035 ConvertImplicit -> ImplicitConversion
8036 ConvertImplicitStandard -> ImplicitStandardConversion
8037 TryImplicitIntConversion -> ImplicitIntConversion
8038 ConvertImplicitRequired -> ImplicitConversionRequired
8039 ConvertNumericExplicit -> ExplicitNumericConversion
8040 ConvertReferenceExplicit -> ExplicitReferenceConversion
8041 ConvertExplicit -> ExplicitConversion
8042 ConvertExplicitStandard -> ExplicitStandardConversion
8044 2003-05-19 Martin Baulig <martin@ximian.com>
8046 * statement.cs (TypeInfo.StructInfo): Made this type protected.
8047 (TypeInfo): Added support for structs having structs as fields.
8049 * ecore.cs (FieldExpr): Implement IVariable.
8050 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
8051 VariableInfo for the field.
8053 2003-05-18 Martin Baulig <martin@ximian.com>
8055 * expression.cs (This.DoResolve): Report a CS0027 if we're
8056 emitting a field initializer.
8058 2003-05-18 Martin Baulig <martin@ximian.com>
8060 * expression.cs (This.ResolveBase): New public function.
8061 (This.DoResolve): Check for CS0188.
8063 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
8066 * ecore.cs (MethodGroupExpr.DoResolve): Set the
8067 `instance_expression' to null if we don't have any non-static
8070 2003-05-18 Martin Baulig <martin@ximian.com>
8072 Reworked the way how local variables and parameters are handled by
8073 the flow analysis code.
8075 * statement.cs (TypeInfo, VariableMap): New public classes.
8076 (VariableInfo): New public class. This is now responsible for
8077 checking whether a variable has been assigned. It is used for
8078 parameters and local variables.
8079 (Block.EmitMeta): Take the InternalParameters as argument; compute
8080 the layout of the flow vectors here.
8081 (Block.LocalMap, Block.ParameterMap): New public properties.
8082 (FlowBranching): The .ctor doesn't get the InternalParameters
8083 anymore since Block.EmitMeta() now computes the layout of the flow
8085 (MyStructInfo): This class is now known as `StructInfo' and nested
8086 in `TypeInfo'; we don't access this directly anymore.
8088 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
8089 property and removed IsAssigned(), IsFieldAssigned(),
8090 SetAssigned() and SetFieldAssigned(); we now call them on the
8091 VariableInfo so we don't need to duplicate this code everywhere.
8093 * expression.cs (ParameterReference): Added `Block block' argument
8095 (LocalVariableReference, ParameterReference, This): The new
8096 VariableInfo class is now responsible for all the definite
8099 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
8100 IsParameterAssigned, SetParameterAssigned): Removed.
8102 2003-05-18 Martin Baulig <martin@ximian.com>
8104 * typemanager.cs (InitCoreTypes): Try calling
8105 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
8106 the 3-args-version. Corlib now also needs our `void_type'.
8107 (GetMethod): Added overloaded version which takes an optional
8108 `bool report_errors' to allow lookups of optional methods.
8110 2003-05-12 Martin Baulig <martin@ximian.com>
8112 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
8113 only used for locals and not for parameters.
8115 2003-05-12 Miguel de Icaza <miguel@ximian.com>
8117 * support.cs (InternalParameters.ParameterType): Return the
8118 ExternalType of the parameter.
8120 * parameter.cs (Parameter.ExternalType): drop the two arguments,
8123 2003-05-11 Miguel de Icaza <miguel@ximian.com>
8125 * class.cs (MethodData.Define): Do not set the `newslot' on
8126 interface members, if they are also flagged as "override".
8128 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
8129 better code for ++i and i++. This only works for static fields
8130 and local variables.
8132 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
8133 want to pull the DeclSpace out of the builder_to_declspace instead
8134 of the TypeBuilder (like in TypeContainer.FindMembers).
8136 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
8137 instead of LookupTypeContainer. Fixes the crash on .NET for
8138 looking up interface members.
8140 * const.cs: Create our own emit context during the Definition
8141 stage, so that constants are evaluated in the proper context, when
8142 a recursive definition happens.
8144 2003-05-11 Martin Baulig <martin@ximian.com>
8146 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
8147 new block for a switch section.
8148 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
8149 the adding/lookup in the switch block. Fixes #39828.
8151 2003-05-09 Miguel de Icaza <miguel@ximian.com>
8153 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
8154 functionality: I needed to convert the data after I had performed
8155 the add/sub operation into the operands type size.
8157 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
8158 pass the type for the box operation, otherwise the resulting
8159 object would have been of type object.
8161 (BoxedCast): Add constructor to specify the type to box as.
8163 2003-05-07 Miguel de Icaza <miguel@ximian.com>
8165 * iterators.cs: I was reusing the `count' variable inadvertently,
8166 take steps to not allow this to happen.
8168 2003-05-06 Miguel de Icaza <miguel@ximian.com>
8170 * attribute.cs (Attribute.Resolve): Params attributes are encoded
8171 by creating an array at the point where the params starts and
8172 putting all those arguments there, then adjusting the size of the
8175 2003-05-05 Miguel de Icaza <miguel@ximian.com>
8177 * expression.cs (New.AddressOf): Implement interface
8178 IMemoryLocation. This is used when the `new' operator is used in
8179 the context of an invocation to a method on a value type.
8181 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
8184 * namespace.cs: Also check the using aliases here.
8186 * driver.cs: Move the test for using validity after the types have
8187 been entered, so we do a single pass that also includes the using
8190 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
8191 in the regular case. CreateSiblingForFinally is doing extra
8194 * attribute.cs (GetAttributeArgumentExpression): Store the result
8195 on an out value, and use the return value to indicate failure
8196 instead of using null (which is a valid return for Constant.GetValue).
8198 * statement.cs: Perform the analysis flow for the increment
8199 portion after the statement, because this will be the real flow of
8200 execution. Fixes #42385
8202 * codegen.cs (EmitContext.EmitArgument,
8203 EmitContext.EmitStoreArgument): New helper functions when the
8204 RemapToProxy flag is set.
8206 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
8209 Add support for remapping parameters.
8211 * iterators.cs: Propagate parameter values; Store parameter
8212 values in the proxy classes.
8214 2003-05-04 Miguel de Icaza <miguel@ximian.com>
8216 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
8217 need a proxy reference; I do not know what I was thinking
8219 * cs-parser.jay (constructor_initializer): catch another error,
8220 and display nice message.
8222 (field_declaration): catch void field declaration
8223 to flag a better error.
8225 * class.cs (MemberBase.CheckBase): Report an error instead of a
8226 warning if a new protected member is declared in a struct.
8227 (Field.Define): catch the error of readonly/volatile.
8229 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
8231 (FieldExpr.AddressOf): ditto. Catch error where the address of a
8232 volatile variable is taken
8234 2003-05-02 Miguel de Icaza <miguel@ximian.com>
8236 * statement.cs (Fixed.Resolve): Report an error if we are not in
8239 2003-05-01 Miguel de Icaza <miguel@ximian.com>
8241 * typemanager.cs: reuse the code that handles type clashes for
8242 delegates and enumerations.
8244 * class.cs (Report28): Always report.
8246 * expression.cs (EncodeAsAttribute): Allow nulls here.
8248 2003-04-28 Miguel de Icaza <miguel@ximian.com>
8250 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
8251 the functionality for testing whether an expression is valid for
8252 an attribute here. Also handle the case of arrays of elements
8255 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
8256 encoding a linear array into an array of objects that are suitable
8257 to be passed to an CustomAttributeBuilder.
8259 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
8261 * ecore.cs: (FieldExpr): Handle field remapping here.
8263 * iteratators.cs: Pass the instance variable (if the method is an
8264 instance method) to the constructors, so we can access the field
8265 variables on the class.
8267 TODO: Test this with structs. I think the THIS variable on
8268 structs might have to be a pointer, and not a refenrece
8270 2003-04-27 Miguel de Icaza <miguel@ximian.com>
8272 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
8273 local variables to fields in a proxy class.
8275 * iterators.cs (PopulateProxy): Rename our internal fields to
8277 Create a <THIS> field if we are an instance method, so we can
8278 reference our parent container variables.
8279 (MapVariable): Called back from the EmitContext code to enter a
8280 new variable to field mapping into the proxy class (we just create
8284 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
8285 for using the remapped locals to fields.
8287 I placed the code here, because that gives the same semantics to
8288 local variables, and only changes the Emit code.
8290 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
8291 statements inside iterators.
8292 (VariableInfo): Add a FieldBuilder for the cases when we are
8293 remapping local variables to fields in a proxy class
8295 * ecore.cs (SimpleNameResolve): Avoid testing two times for
8296 current_block != null.
8298 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
8299 not cope with strings, as it has been moved to the
8300 TableSwitchEmit. Fixed bug in switch generation.
8302 * expression.cs (New.DoResolve): Provide more context for the user
8303 when reporting an error.
8305 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
8308 * expression.cs (MemberAccess.DoResolve): When we get a type back,
8309 check the permissions for it. Note than in a type-resolution
8310 context the check was already present in DeclSpace.ResolveType,
8311 but was missing from the MemberAccess.
8313 (ArrayCreation.CheckIndices): warn if the user has
8314 more nested levels of expressions, but there are no more
8315 dimensions specified. Avoids crash on bug 41906.
8317 2003-04-26 Miguel de Icaza <miguel@ximian.com>
8319 * statement.cs (Block): replace Implicit bool, for a generic
8321 New flag: `Unchecked'. This is used during the EmitMeta phase
8322 (which is out-of-line with the regular Resolve/Emit process for a
8323 statement, as this is done ahead of time, but still gets a chance
8324 to call constant resolve).
8326 (Block.Flags): new enum for adding a new flag.
8328 (Block.EmitMeta): track the state of unchecked.
8330 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
8331 to enable constant resolution to work there as well.
8333 2003-04-22 Miguel de Icaza <miguel@ximian.com>
8335 * typemanager.cs (ienumerable_type): Also look up
8336 System.Collections.IEnumerable.
8338 2003-04-21 Miguel de Icaza <miguel@ximian.com>
8340 TODO: Test more than one conditional per method.
8342 * class.cs (Indexer.Define): Report the location where the user is
8343 referencing the unsupported feature.
8345 (MethodData): Overload the use of `conditionals' to
8346 minimize the creation of needless ArrayLists. This saves roughly
8347 212kb on my machine.
8349 (Method): Implement the new IIteratorContainer interface.
8350 (Method.SetYields): Implement the method by setting the ModFlags
8351 to contain METHOD_YIELDS.
8353 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
8354 which just got set to null.
8356 * iterators.cs: New file.
8358 (Yield, YieldBreak): New statements.
8360 * statement.cs (Return.Resolve): Flag an error if we are used in
8363 * codegen.cs (InIterator): New flag set if the code is being
8364 compiled in an iterator method.
8366 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
8367 internal modifier, and we just use it to avoid adding extra
8368 fields, as this is seldom used.
8370 * cs-parser.jay: Add yield_statement (yield and yield break).
8372 * driver.cs: New flag -v2 to turn on version 2 features.
8374 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
8375 hashtable when v2 is enabled.
8377 2003-04-20 Miguel de Icaza <miguel@ximian.com>
8379 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
8380 there is already a namespace defined with this name.
8382 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
8383 people upgraded their corlibs.
8385 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
8386 always use fully qualified types, no need to use the compiler
8389 (TypeManager.IsNamespace): Use binarysearch.
8391 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
8392 AddDelegate): I did not quite use the new IsValid API properly: I
8393 have to pass the short-name and the fullname. I was passing only
8394 the basename instead of the fullname sometimes.
8396 (TypeContainer.DefineType): call NamespaceClash.
8398 * interface.cs (Interface.DefineType): use NamespaceClash before
8401 * delegate.cs (Delegate.DefineType): use NamespaceClash before
8404 * enum.cs: (Enum.DefineType): use NamespaceClash before
8407 * typemanager.cs (: 3-line patch that gives us some tasty 11%
8408 speed increase. First, use the negative_hits cache when we get a
8409 negative. Second, add the type with its full original name
8410 instead of the new . and + encoded name (reflection uses + to
8411 separate type from a nested type). Use LookupTypeReflection
8412 directly which bypasses the type->name hashtable (that we already
8413 know does not contain the type.
8415 * decl.cs (DeclSpace.ResolveTypeExpr): track the
8416 location/container type.
8418 * driver.cs: When passing utf8, use directly the UTF8Encoding.
8420 2003-04-19 Miguel de Icaza <miguel@ximian.com>
8422 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
8424 * delegate.cs (NewDelegate.Resolve): Test whether an instance
8425 method is being referenced in the method group from a static
8426 context, and report error 120 if so.
8428 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
8431 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
8432 is created, we create the A namespace).
8434 * cs-parser.jay: A namespace also introduces a DeclarationFound.
8437 2003-04-18 Miguel de Icaza <miguel@ximian.com>
8439 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
8440 invocation to ModuleBuilder.GetType with the same values will
8441 return a new type instance, so we need to cache its return
8444 * expression.cs (Binary.ResolveOperator): Only allow the compare
8445 operators on enums if they are of the same type.
8447 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
8448 types of ValueType on their own case. Before we were giving them
8449 the same treatment as objects.
8451 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
8452 fullname. Short name is used to compare against container name.
8453 Fullname is used to check against defined namespace names.
8455 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
8456 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
8458 (Method.CheckBase): Call parent.
8459 (MemberBase.CheckBase): Check for protected members on sealed
8461 (PropertyBase.CheckBase): Call parent.
8462 (Field.Define): Call parent.
8464 * report.cs: Negative error codes are now mapped to 8000 - code,
8465 so that the display is render more nicely.
8467 * typemanager.cs: Do not use try/catch, instead report a regular
8470 (GetPointerType, GetReferenceType): These methods provide
8471 mechanisms to obtain the T* and T& from a T. We had the code
8472 previously scattered around the code base, and it also used
8473 TypeManager.LookupType that would go through plenty of caches.
8474 This one goes directly to the type source.
8476 In some places we did the Type.GetType followed by
8477 ModuleBuilder.GetType, but not in others, so this unifies the
8480 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
8481 statements now that we have namespace information.
8483 * typemanager.cs (IsNamespace): New method, returns whether the
8484 string presented is a namespace or not.
8486 (ComputeNamespaces): New public entry point, computes the list of
8487 available namespaces, using the GetNamespaces API call in Mono, or
8488 the slower version in MS.NET.
8490 Now before we start the semantic analysis phase, we have a
8491 complete list of namespaces including everything that the user has
8494 Deleted old code to cache namespaces in .nsc files.
8496 2003-04-17 Miguel de Icaza <miguel@ximian.com>
8498 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
8499 class/struct location definition Location for the implicit
8500 constructor location.
8502 (Operator.Define): Use the location of the operator for the
8503 implicit Method definition.
8505 (Constructor.Emit): use the constructor location for the implicit
8506 base initializer constructor.
8508 * ecore.cs: Remove ITypeExpression. This interface is now gone,
8509 and the Expression class now contains two new methods:
8511 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
8512 isolate type lookup from the rest of the resolution process.
8514 Since we use Expressions to hold type definitions due to the way
8515 we parse the input we have historically overloaded Resolve to
8516 perform the Type lookups if a special flag is passed. Now this is
8517 eliminated and two methods take their place.
8519 The differences in the two methods between xStep and xTerminal is
8520 that xStep is involved in our current lookup system that uses
8521 SimpleNames to compose a name, while xTerminal is used just to
8522 catch the case where the simplename lookup failed.
8524 2003-04-16 Miguel de Icaza <miguel@ximian.com>
8526 * expression.cs (ResolveMemberAccess): Remove redundant code.
8527 TypeExpr expressions are always born fully resolved.
8529 * interface.cs (PopulateMethod): Do not lookup the types twice.
8530 We were doing it once during SemanticAnalysis and once during
8533 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
8534 in local variable type definitions, were being returned as a
8535 SimpleName (we decomposed everything into a string), that is
8536 because primary_expression was being used instead of a type in the
8537 grammar (reduce/reduce conflicts).
8539 The part that was wrong is that we converted the expression into a
8540 string (an oversimplification in one hand, compounded with primary
8541 expressions doing string concatenation).
8547 Would return "A.B.C[]" as a SimpleName. This stopped things like
8548 using clauses from working on this particular context. And a type
8549 was being matched directly against "A.B.C[]".
8551 We now use the correct approach, and allow for ComposedCast to be
8552 part of the unary expression. So the "A.B.C []" become a composed
8553 cast of "A.B.C" (as a nested group of MemberAccess with a
8554 SimpleName at the end) plus the rank composition "[]".
8558 2003-04-10 Miguel de Icaza <miguel@ximian.com>
8560 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
8561 for the access level checking.
8563 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
8564 `TypeContainer container', because I kept getting confused when I
8565 was debugging this code.
8567 * expression.cs (Indexers): Instead of tracking getters/setters,
8568 we now track them in parallel. We create one arraylist less, but
8569 most importantly it is possible now for the LValue code to find a
8570 matching get for a set.
8572 (IndexerAccess.DoResolveLValue): Update the code.
8573 GetIndexersForType has been modified already to extract all the
8574 indexers from a type. The code assumed it did not.
8576 Also make the code set the correct return type for the indexer.
8577 This was fixed a long time ago for properties, but was missing for
8578 indexers. It used to be void_type.
8580 (Binary.Emit): Test first for doubles instead of
8581 floats, as they are more common.
8583 (Binary.EmitBranchable): Use the .un version of the branch opcodes
8584 when dealing with floats and the <=, >= operators. This fixes bug
8587 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
8588 to load the array value by emitting a load on the foreach variable
8589 type. This was incorrect.
8591 We now emit the code to load an element using the the array
8592 variable type, and then we emit the conversion operator.
8596 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
8598 * attribute.cs: Avoid allocation of ArrayLists in the common case.
8600 2003-04-09 Miguel de Icaza <miguel@ximian.com>
8602 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
8603 test for protection before we test for signatures.
8605 (MethodSignature.ToString): implement.
8607 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
8608 to the case where we reduced into a LongConstant.
8610 * decl.cs (CheckAccessLevel): If the type is an array, we can not
8611 depend on whether the information is acurrate, because the
8612 Microsoft runtime will always claim that the array type is public,
8613 regardless of the real state.
8615 If the type is a pointer, another problem happens: the type is
8616 reported as non-public in Microsoft.
8618 In both cases we have to call CheckAccessLevel recursively with
8619 the underlying type as the argument to be tested.
8621 2003-04-08 Miguel de Icaza <miguel@ximian.com>
8623 * assign.cs (Assign.Emit): If we are dealing with a compound
8624 assignment expression, we should use the code path that stores the
8625 intermediate result in a temporary value. This fixes #40903.
8627 *expression.cs (Indirection.ToString): Provide ToString method for
8630 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
8632 * class.cs: Null out fields holding references to Block objects so
8633 they can be garbage collected.
8635 * expression.cs (OverloadResolve): Remove unused local.
8637 2003-04-07 Martin Baulig <martin@ximian.com>
8639 * codegen.cs (EmitContext.CurrentFile): New public field.
8640 (EmitContext.Mark): Use the CurrentFile to check whether the
8641 location is in the correct file.
8642 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
8644 2003-04-07 Martin Baulig <martin@ximian.com>
8646 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
8648 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
8649 location. [FIXME: The location argument which gets passed to this
8650 method is sometimes wrong!]
8652 2003-04-07 Nick Drochak <ndrochak@gol.com>
8654 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
8656 2003-04-07 Miguel de Icaza <miguel@ximian.com>
8658 * expression.cs (Indirection.EmitAssign): We were using the
8659 temporary, but returning immediately instead of continuing the
8662 2003-04-06 Martin Baulig <martin@ximian.com>
8664 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
8665 if it's a nested child, but also deriving from the outer class.
8668 * typemanager.cs (IsNestedChildOf): Make this work if it's a
8669 nested child, but also deriving from the outer class. See
8671 (FilterWithClosure): We may access private members of the outer
8672 class if we're a nested child and deriving from the outer class.
8673 (RealMemberLookup): Only set `closure_private_ok' if the
8674 `original_bf' contained BindingFlags.NonPublic.
8676 2003-04-05 Martin Baulig <martin@ximian.com>
8678 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
8679 probe if its a type parameter, and if so, flag an error.
8681 * decl.cs: Move here the SetParameterInfo code from class.cs.
8682 Handle IsGeneric here.
8684 Handle a variety of errors in the parameter info definition.
8686 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
8687 type parameters here.
8689 * cs-parser.jay (class_declaration): report errors for parameters
8692 2003-01-21 Miguel de Icaza <miguel@ximian.com>
8694 * generic.cs: New file, contains support code for generics.
8696 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
8697 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
8699 Update parser for the above removals.
8701 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
8702 now taken care of in the parser.
8704 2003-04-02 Miguel de Icaza <miguel@ximian.com>
8706 * class.cs (Event.Define): Do not allow abstract events to have
8709 2003-04-01 Miguel de Icaza <miguel@ximian.com>
8711 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
8712 block in event declarations.
8714 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
8715 value type, get its address.
8717 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
8718 leaving a class on the stack instead of a boolean value (int
8719 0/1). Change the code so we compare against null, and then the
8720 result against zero.
8722 * class.cs (TypeContainer.GetClassBases): We were checking for the
8723 parent class being sealed too late.
8725 * expression.cs (Binary.Emit): For <= and >= when dealing with
8726 floating point values, use cgt.un and clt.un instead of cgt and
8729 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
8731 * statement.cs: Apply the same optimization as MS: skip the
8732 GetEnumerator returning an IEnumerator, and use the one returning a
8733 CharEnumerator instead. This allows us to avoid the try-finally block
8736 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
8738 * cs-parser.jay: Attributes cannot be applied to
8739 namespaces. Fixes #40473
8741 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8744 (Add*): check if the name is valid using the full name for constants,
8745 fields, properties and events.
8747 2003-03-28 Miguel de Icaza <miguel@ximian.com>
8749 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
8750 char constants to be part of the enumeration.
8752 * expression.cs (Conditional.DoResolve): Add support for operator
8753 true. Implements the missing functionality from 14.12
8755 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
8756 operator true/false as required by the spec.
8758 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
8759 implicit conversion to boolean.
8761 * statement.cs (Statement.ResolveBoolean): A boolean expression is
8762 also one where the type implements `operator true'.
8764 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
8765 get an expression that will invoke operator true based on an
8768 (GetConversionOperators): Removed the hack that called op_True
8771 (Expression.ResolveBoolean): Move this from Statement.
8773 2003-03-17 Miguel de Icaza <miguel@ximian.com>
8775 * ecore.cs (FieldExpr): do not allow initialization of initonly
8776 fields on derived classes
8778 2003-03-13 Martin Baulig <martin@ximian.com>
8780 * statement.cs (Block.Emit): Call ig.BeginScope() and
8781 ig.EndScope() when compiling with debugging info; call
8782 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
8784 2003-03-08 Miguel de Icaza <miguel@ximian.com>
8786 * expression.cs (Indexers): Do not construct immediately, allow
8787 for new members to be appended as we go. Fixes 38143
8789 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8791 * expression.cs: save/restore context when resolving an unchecked
8794 2003-03-05 Miguel de Icaza <miguel@ximian.com>
8796 * cfold.cs: Catch division by zero in modulus operator during
8799 2003-03-03 Miguel de Icaza <miguel@ximian.com>
8801 * interface.cs (Interface.DefineMembers): Avoid defining members
8804 2003-02-27 Miguel de Icaza <miguel@ximian.com>
8806 * driver.cs: handle the +/- options for -noconfig
8808 * statement.cs (Unckeched.Resolve): Also track the state of
8809 unchecked in the Resolve phase.
8811 2003-02-27 Martin Baulig <martin@ximian.com>
8813 * ecore.cs (Expression.MemberLookup): Don't create a
8814 MethodGroupExpr for something which is not a method. Fixes #38291.
8816 2003-02-25 Miguel de Icaza <miguel@ximian.com>
8818 * class.cs (MemberBase.CheckParameters): Also check that the type
8819 is unmanaged if it is a pointer.
8821 * expression.cs (SizeOf.Resolve): Add location information.
8823 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
8824 a managed type is declared.
8826 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
8827 parameter modifiers as well. Fixes bug 38606
8829 * class.cs: Very sad. Am backing out the speed up changes
8830 introduced by the ArrayList -> Array in the TypeContainer, as they
8831 were not actually that much faster, and introduced a bug (no error
8832 reports on duplicated methods).
8834 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
8835 source first, this will guarantee that we have a valid expression
8836 before calling in lower levels functions that will require a
8837 resolved object. Then use this original_source in the
8838 target.ResolveLValue instead of the original source that was
8841 Another change. Use target.Resolve instead of LValueResolve.
8842 Although we are resolving for LValues, we will let the Assign code
8843 take care of that (it will be called again from Resolve). This
8844 basically allows code like this:
8846 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
8847 class Y { void A (X x) { x [0] += o; }
8849 The problem was that the indexer was trying to resolve for
8850 set_Item (idx, object o) and never finding one. The real set_Item
8851 was set_Item (idx, X). By delaying the process we get the right
8856 2003-02-23 Martin Baulig <martin@ximian.com>
8858 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
8859 while calling DoEmit ().
8861 * codegen.cs (EmitContext.Mark): Don't mark locations in other
8862 source files; if you use the #line directive inside a method, the
8863 compiler stops emitting line numbers for the debugger until it
8864 reaches the end of the method or another #line directive which
8865 restores the original file.
8867 2003-02-23 Martin Baulig <martin@ximian.com>
8869 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
8871 2003-02-23 Martin Baulig <martin@ximian.com>
8873 * statement.cs (Block.AddChildVariableNames): We need to call this
8874 recursively, not just for our immediate children.
8876 2003-02-23 Martin Baulig <martin@ximian.com>
8878 * class.cs (Event.Define): Always make the field private, like csc does.
8880 * typemanager.cs (TypeManager.RealMemberLookup): Make events
8881 actually work, fixes bug #37521.
8883 2003-02-23 Miguel de Icaza <miguel@ximian.com>
8885 * delegate.cs: When creating the various temporary "Parameters"
8886 classes, make sure that we call the ComputeAndDefineParameterTypes
8887 on those new parameters (just like we do with the formal ones), to
8888 allow them to be resolved in the context of the DeclSpace.
8890 This fixes the bug that Dick observed in Bugzilla #38530.
8892 2003-02-22 Miguel de Icaza <miguel@ximian.com>
8894 * expression.cs (ResolveMemberAccess): When resolving a constant,
8895 do not attempt to pull a constant if the value was not able to
8896 generate a valid constant.
8898 * const.cs (LookupConstantValue): Do not report more errors than required.
8900 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8902 * expression.cs: fixes bug #38328.
8904 2003-02-18 Miguel de Icaza <miguel@ximian.com>
8906 * class.cs: Changed all the various members that can be part of a
8907 class from being an ArrayList to be an Array of the right type.
8908 During the DefineType type_list, interface_list, delegate_list and
8909 enum_list are turned into types, interfaces, delegates and enums
8912 And during the member population, indexer_list, event_list,
8913 constant_list, field_list, instance_constructor_list, method_list,
8914 operator_list and property_list are turned into their real arrays.
8916 Although we could probably perform this operation earlier, for
8917 good error reporting we need to keep the lists and remove the
8918 lists for longer than required.
8920 This optimization was triggered by Paolo profiling the compiler
8921 speed on the output of `gen-sample-program.pl' perl script.
8923 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
8924 not crash in methods like MemberLookupFailed that use this field.
8926 This problem arises when the compiler fails to resolve a type
8927 during interface type definition for example.
8929 2003-02-18 Miguel de Icaza <miguel@ximian.com>
8931 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
8932 inherit from System.Object, so we have to stop at null, not only
8933 when reaching System.Object.
8935 2003-02-17 Miguel de Icaza <miguel@ximian.com>
8937 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
8938 DeclaredOnly because the parent indexer might have had a different
8939 name, but did not loop until the top of the hierarchy was reached.
8941 The problem this one fixes is 35492: when a class implemented an
8942 indexer from an interface, we were getting the interface method
8943 (which was abstract) and we were flagging an error (can not invoke
8946 This also keeps bug 33089 functioning, and test-148 functioning.
8948 * typemanager.cs (IsSpecialMethod): The correct way of figuring
8949 out if a method is special is to see if it is declared in a
8950 property or event, or whether it is one of the predefined operator
8951 names. This should fix correctly #36804.
8953 2003-02-15 Miguel de Icaza <miguel@ximian.com>
8955 The goal here is to remove the dependency on EmptyCast.Peel ().
8956 Killing it completely.
8958 The problem is that currently in a number of places where
8959 constants are expected, we have to "probe" for an EmptyCast, and
8960 Peel, which is not the correct thing to do, as this will be
8961 repetitive and will likely lead to errors.
8963 The idea is to remove any EmptyCasts that are used in casts that
8964 can be reduced to constants, so we only have to cope with
8967 This bug hunt was triggered by Bug 37363 and the desire to remove
8968 the duplicate pattern where we were "peeling" emptycasts to check
8969 whether they were constants. Now constants will always be
8972 * ecore.cs: Use an enumconstant here instead of wrapping with
8975 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
8976 throwing me off. By handling this we can get rid of a few hacks.
8978 * statement.cs (Switch): Removed Peel() code.
8980 2003-02-14 Miguel de Icaza <miguel@ximian.com>
8982 * class.cs: Location information for error 508
8984 * expression.cs (New.DoResolve): Add a guard against double
8985 resolution of an expression.
8987 The New DoResolve might be called twice when initializing field
8988 expressions (see EmitFieldInitializers, the call to
8989 GetInitializerExpression will perform a resolve on the expression,
8990 and later the assign will trigger another resolution
8992 This leads to bugs (#37014)
8994 * delegate.cs: The signature for EndInvoke should contain any ref
8995 or out parameters as well. We were not doing this in the past.
8997 * class.cs (Field.Define): Do not overwrite the type definition
8998 inside the `volatile' group. Turns out that volatile enumerations
8999 were changing the type here to perform a validity test, which
9002 2003-02-12 Miguel de Icaza <miguel@ximian.com>
9004 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
9005 and structs, we do not want to load the instance variable
9007 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
9008 enum_type has to be handled like an object reference (implicit
9009 conversions exists from this to object), but the regular IsClass
9010 and IsValueType tests will never return true for this one.
9012 Also we use TypeManager.IsValueType instead of type.IsValueType,
9013 just for consistency with the rest of the code (this is only
9014 needed if we ever use the construct exposed by test-180.cs inside
9015 corlib, which we dont today).
9017 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
9019 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
9022 2003-02-09 Martin Baulig <martin@ximian.com>
9024 * namespace.cs (Namespace..ctor): Added SourceFile argument.
9025 (Namespace.DefineNamespaces): New static public method; this is
9026 called when we're compiling with debugging to add all namespaces
9029 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
9030 pass it to the Namespace's .ctor.
9032 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
9033 and MethodBase arguments; pass the namespace ID to the symwriter;
9034 pass the MethodBase instead of the token to the symwriter.
9035 (SymbolWriter.DefineNamespace): New method to add a namespace to
9038 2003-02-09 Martin Baulig <martin@ximian.com>
9040 * symbolwriter.cs: New file. This is a wrapper around
9041 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
9042 methods here in near future.
9044 2003-02-09 Martin Baulig <martin@ximian.com>
9046 * codegen.cs (EmitContext.Mark): Just pass the arguments to
9047 ILGenerator.MarkSequencePoint() which are actually used by the
9050 2003-02-09 Martin Baulig <martin@ximian.com>
9052 * location.cs (SourceFile): New public sealed class. This
9053 contains the name and an index which is used in the location's token.
9054 (Location): Reserve an appropriate number of bits in the token for
9055 the source file instead of walking over that list, this gives us a
9056 really huge performance improvement when compiling with debugging.
9058 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
9059 `SourceFile' argument instead of a string.
9060 (Driver.ProcessFile): Add all the files via Location.AddFile(),
9061 but don't parse/tokenize here, we need to generate the list of all
9062 source files before we do that.
9063 (Driver.ProcessFiles): New static function. Parses/tokenizes all
9066 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
9067 instead of a string.
9069 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
9072 2003-02-09 Martin Baulig <martin@ximian.com>
9074 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
9075 filename on `#line default'.
9077 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
9079 * statement.cs: don't clear the pinned var when the fixed statement
9080 returns from the method (fixes bug#37752).
9082 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
9084 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
9087 2003-02-07 Martin Baulig <martin@ximian.com>
9089 * driver.cs: Removed the `--debug-args' command line argument.
9091 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
9092 automatically by the AsssemblyBuilder.
9093 (CodeGen.InitializeSymbolWriter): We don't need to call any
9094 initialization function on the symbol writer anymore. This method
9095 doesn't take any arguments.
9097 2003-02-03 Miguel de Icaza <miguel@ximian.com>
9099 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
9100 from referenced assemblies as well.
9102 2003-02-02 Martin Baulig <martin@ximian.com>
9104 * class.cs (MethodData.Emit): Generate debugging info for external methods.
9106 2003-02-02 Martin Baulig <martin@ximian.com>
9108 * class.cs (Constructor.Emit): Open the symbol writer before
9109 emitting the constructor initializer.
9110 (ConstructorInitializer.Emit): Call ec.Mark() to allow
9111 single-stepping through constructor initializers.
9113 2003-01-30 Miguel de Icaza <miguel@ximian.com>
9115 * class.cs: Handle error 549: do not allow virtual methods in
9118 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
9120 * decl.cs: Check access levels when resolving types
9122 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
9124 * statement.cs: Add parameters and locals set in catch blocks that might
9125 return to set vector
9127 2003-01-29 Miguel de Icaza <miguel@ximian.com>
9129 * class.cs (Operator): Set the SpecialName flags for operators.
9131 * expression.cs (Invocation.DoResolve): Only block calls to
9132 accessors and operators on SpecialName methods.
9134 (Cast.TryReduce): Handle conversions from char constants.
9137 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
9139 * statement.cs: small memory and time optimization in FlowBranching.
9141 2003-01-28 Pedro Mart <yoros@wanadoo.es>
9143 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
9144 problem that the last fix but in the other sid (Set).
9146 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
9147 access when there is no indexer in the hierarchy.
9149 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
9151 * class.cs: Combine some if statements.
9153 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9155 * driver.cs: fixed bug #37187.
9157 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
9159 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
9160 any indexer, it's needed to build a list with all the indexers in the
9161 hierarchy (AllGetters), else we have problems. Fixes #35653.
9163 2003-01-23 Miguel de Icaza <miguel@ximian.com>
9165 * class.cs (MethodData.Define): It is wrong for an interface
9166 implementation to be static in both cases: explicit and implicit.
9167 We were only handling this in one case.
9169 Improve the if situation there to not have negations.
9171 * class.cs (Field.Define): Turns out that we do not need to check
9172 the unsafe bit on field definition, only on usage. Remove the test.
9174 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9176 * driver.cs: use assembly.Location instead of Codebase (the latest
9177 patch made mcs fail when using MS assemblies).
9179 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
9181 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
9182 get the path to *corlib.dll.
9184 2003-01-21 Nick Drochak <ndrochak@gol.com>
9188 * typemanager.cs: Remove compiler warnings
9190 2003-01-20 Duncan Mak <duncan@ximian.com>
9192 * AssemblyInfo.cs: Bump the version number to 0.19.
9194 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9196 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
9198 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
9200 * class.cs (Constructor::Emit): Emit debugging info for constructors.
9202 2003-01-17 Miguel de Icaza <miguel@ximian.com>
9204 * cs-parser.jay: Small fix: we were not comparing the constructor
9205 name correctly. Thanks to Zoltan for the initial pointer.
9207 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
9209 * cs-tokenizer.cs: Set file name when specified with #line
9211 2003-01-15 Miguel de Icaza <miguel@ximian.com>
9213 * cs-parser.jay: Only perform the constructor checks here if we
9214 are named like the class; This will help provider a better
9215 error. The constructor path is taken when a type definition is
9216 not found, but most likely the user forgot to add the type, so
9217 report that rather than the constructor error.
9219 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
9221 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
9224 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
9226 * cs-parser.jay: Add cleanup call.
9228 2003-01-13 Duncan Mak <duncan@ximian.com>
9230 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
9231 consistent with other methods.
9233 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
9235 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
9237 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
9239 * attribute.cs: only set GuidAttr to true when we have a
9242 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9246 * typemanager.cs: fixes to allow mcs compile corlib with the new
9247 Type.IsSubclassOf fix.
9249 2003-01-08 Miguel de Icaza <miguel@ximian.com>
9251 * expression.cs (LocalVariableReference.DoResolve): Classify a
9252 constant as a value, not as a variable. Also, set the type for
9255 * cs-parser.jay (fixed_statement): take a type instead of a
9256 pointer_type, so we can produce a better error message later.
9258 * statement.cs (Fixed.Resolve): Flag types that are not pointers
9261 (For.DoEmit): Make inifinite loops have a
9262 non-conditional branch back.
9264 (Fixed.DoEmit): First populate the pinned variables, then emit the
9265 statement, then clear the variables. Before I was emitting the
9266 code once for each fixed piece.
9269 2003-01-08 Martin Baulig <martin@ximian.com>
9271 * statement.cs (FlowBranching.MergeChild): A break in a
9272 SWITCH_SECTION does not leave a loop. Fixes #36155.
9274 2003-01-08 Martin Baulig <martin@ximian.com>
9276 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
9277 lives in the same number space than `param_map'. Fixes #36154.
9279 2003-01-07 Miguel de Icaza <miguel@ximian.com>
9281 * cs-parser.jay (constructor_declaration): Set the
9282 Constructor.ModFlags before probing for it. This makes the
9283 compiler report 514, 515 and 132 (the code was there, but got
9286 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
9287 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
9288 (GotoCase.Resolve): Set `Returns' to ALWAYS.
9290 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
9292 * enum.cs: create the enum static fields using the enum type.
9294 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
9296 * class.cs: don't try to create the ParamBuilder for the return
9297 type if it's not needed (and handle it breaking for the ms runtime
9300 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
9302 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
9304 2002-12-29 Miguel de Icaza <miguel@ximian.com>
9306 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
9307 the command. This showed up while compiling the JANET source
9308 code, which used \r as its only newline separator.
9310 2002-12-28 Miguel de Icaza <miguel@ximian.com>
9312 * class.cs (Method.Define): If we are an operator (because it
9313 reuses our code), then set the SpecialName and HideBySig. #36128
9315 2002-12-22 Miguel de Icaza <miguel@ximian.com>
9317 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
9318 exception, report error 120 `object reference required'.
9320 * driver.cs: Add --pause option, used during to measure the size
9321 of the process as it goes with --timestamp.
9323 * expression.cs (Invocation.DoResolve): Do not allow methods with
9324 SpecialName to be invoked.
9326 2002-12-21 Miguel de Icaza <miguel@ximian.com>
9328 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
9329 number before adding it.
9331 2002-12-21 Ravi Pratap <ravi@ximian.com>
9333 * ecore.cs (StandardImplicitConversion): When in an unsafe
9334 context, we allow conversion between void * to any other pointer
9335 type. This fixes bug #35973.
9337 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
9339 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
9340 is not thrown when extensionless outputs are used
9342 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9344 * rootcontext.cs: fixed compilation of corlib.
9346 2002-12-19 Miguel de Icaza <miguel@ximian.com>
9348 * attribute.cs (Attributes.Contains): Add new method.
9350 * class.cs (MethodCore.LabelParameters): if the parameter is an
9351 `out' parameter, check that no attribute `[In]' has been passed.
9353 * enum.cs: Handle the `value__' name in an enumeration.
9355 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
9357 * decl.cs: Added special case to allow overrides on "protected
9360 2002-12-18 Ravi Pratap <ravi@ximian.com>
9362 * attribute.cs (Attributes.AddAttributeSection): Rename to this
9363 since it makes much more sense.
9365 (Attributes.ctor): Don't require a Location parameter.
9367 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
9369 * attribute.cs (ApplyAttributes): Remove extra Location parameters
9370 since we already have that information per attribute.
9372 * everywhere : make appropriate changes.
9374 * class.cs (LabelParameters): Write the code which actually
9375 applies attributes to the return type. We can't do this on the MS
9376 .NET runtime so we flag a warning in the case an exception is
9379 2002-12-18 Miguel de Icaza <miguel@ximian.com>
9381 * const.cs: Handle implicit null conversions here too.
9383 2002-12-17 Ravi Pratap <ravi@ximian.com>
9385 * class.cs (MethodCore.LabelParameters): Remove the extra
9386 Type [] parameter since it is completely unnecessary. Instead
9387 pass in the method's attributes so that we can extract
9388 the "return" attribute.
9390 2002-12-17 Miguel de Icaza <miguel@ximian.com>
9392 * cs-parser.jay (parse): Use Report.Error to flag errors instead
9393 of ignoring it and letting the compile continue.
9395 * typemanager.cs (ChangeType): use an extra argument to return an
9396 error condition instead of throwing an exception.
9398 2002-12-15 Miguel de Icaza <miguel@ximian.com>
9400 * expression.cs (Unary.TryReduce): mimic the code for the regular
9401 code path. Perform an implicit cast in the cases where we can
9402 implicitly convert to one of the integral types, and then reduce
9403 based on that constant. This fixes bug #35483.
9405 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9407 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
9409 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9411 * namespace.cs: fixed bug #35489.
9413 2002-12-12 Miguel de Icaza <miguel@ximian.com>
9415 * class.cs: Remove some dead code.
9417 * cs-parser.jay: Estimate the number of methods needed
9418 (RootContext.MethodCount);
9420 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
9421 numbers instead of StringBuilders.
9423 * support.cs (PtrHashtable): Add constructor with initial size;
9424 We can now reduce reallocations of the method table.
9426 2002-12-10 Ravi Pratap <ravi@ximian.com>
9428 * attribute.cs (ApplyAttributes): Keep track of the emitted
9429 attributes on a per-target basis. This fixes bug #35413.
9431 2002-12-10 Miguel de Icaza <miguel@ximian.com>
9433 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
9434 default to the Windows 1252 encoding.
9436 (UnixParseOption): Support version, thanks to Alp for the missing
9439 * AssemblyInfo.cs: Add nice assembly information.
9441 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
9444 * cs-parser.jay: Allow a trailing comma before the close bracked
9445 in the attribute_section production.
9447 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
9448 address of the instance was being taken, I will take this out,
9449 because we take the address of the object immediately here.
9451 2002-12-09 Ravi Pratap <ravi@ximian.com>
9453 * typemanager.cs (AreMultipleAllowed): Take care of the most
9454 obvious case where attribute type is not in the current assembly -
9457 2002-12-08 Miguel de Icaza <miguel@ximian.com>
9459 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
9460 definitions, instead of doing that afterwards.
9462 Also we use a nice little hack, depending on the constructor, we
9463 know if we are a "composed" name or a simple name. Hence, we
9464 avoid the IndexOf test, and we avoid
9466 * codegen.cs: Add code to assist in a bug reporter to track down
9467 the source of a compiler crash.
9469 2002-12-07 Ravi Pratap <ravi@ximian.com>
9471 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
9472 types have been emitted for a given element and flag an error
9473 if something which does not have AllowMultiple set is used more
9476 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
9477 attribute types and their corresponding AllowMultiple properties
9479 (AreMultipleAllowed): Check the property for a given type.
9481 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
9482 property in the case we have a TypeContainer.
9484 (Attributes.AddAttribute): Detect duplicates and just skip on
9485 adding them. This trivial fix catches a pretty gross error in our
9486 attribute emission - global attributes were being emitted twice!
9488 Bugzilla bug #33187 is now fixed.
9490 2002-12-06 Miguel de Icaza <miguel@ximian.com>
9492 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
9495 * expression.cs (Binary.ResolveOperator): I can only use the
9496 Concat (string, string, string) and Concat (string, string,
9497 string, string) if the child is actually a concatenation of
9500 2002-12-04 Miguel de Icaza <miguel@ximian.com>
9502 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
9503 context where we need a 2-character lookahead.
9505 * pending.cs (PendingImplementation): Rework so we can keep track
9506 of interface types all the time, and flag those which were
9507 implemented by parents as optional.
9509 2002-12-03 Miguel de Icaza <miguel@ximian.com>
9511 * expression.cs (Binary.ResolveOperator): Use
9512 String.Concat(string,string,string) or
9513 String.Concat(string,string,string,string) when possible.
9515 * typemanager: More helper methods.
9518 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
9520 * pending.cs: remove the bogus return from GetMissingInterfaces()
9521 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
9523 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9525 * namespace.cs: avoid duplicated 'using xxx' being added to
9526 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
9527 when we get more than one 'using' statement for the same namespace.
9528 Report a CS0105 warning for it.
9530 2002-11-30 Miguel de Icaza <miguel@ximian.com>
9532 * cs-tokenizer.cs (consume_identifier): use read directly, instead
9533 of calling getChar/putback, uses internal knowledge of it.
9535 (xtoken): Reorder tokenizer so most common patterns are checked
9536 first. This reduces the compilation time in another 5% (from 8.11s
9537 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
9539 The parsing time is 22% of the compilation in mcs, and from that
9540 64% is spent on the tokenization process.
9542 I tried using a binary search for keywords, but this is slower
9543 than the hashtable. Another option would be to do a couple of
9546 * Not use a StringBuilder, instead use an array of chars,
9547 with a set value. Notice that this way we could catch
9548 the 645 error without having to do it *afterwards*.
9550 * We could write a hand-parser to avoid the hashtable
9551 compares altogether.
9553 The identifier consumption process takes 37% of the tokenization
9554 time. Another 15% is spent on is_number. 56% of the time spent
9555 on is_number is spent on Int64.Parse:
9557 * We could probably choose based on the string length to
9558 use Int32.Parse or Int64.Parse and avoid all the 64-bit
9561 Another 3% is spend on wrapping `xtoken' in the `token' function.
9563 Handle 0xa0 as whitespace (#34752)
9565 2002-11-26 Miguel de Icaza <miguel@ximian.com>
9567 * typemanager.cs (IsCLRType): New routine to tell whether a type
9568 is one of the builtin types.
9570 Maybe it needs to use TypeCodes to be faster. Maybe we could use
9571 typecode in more places instead of doing pointer comparissions.
9572 We could leverage some knowledge about the way the typecodes are
9575 New code to cache namespaces in assemblies, it is currently not
9576 invoked, to be used soon.
9578 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
9580 * expression.cs (Binary.ResolveOperator): specially handle
9581 strings, and do not perform user-defined operator overloading for
9584 2002-11-24 Miguel de Icaza <miguel@ximian.com>
9586 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
9587 internalcall as it is a pretty simple operation; Avoid whenever
9588 possible to call Char.IsLetter.
9590 (consume_identifier): Cut by half the number of
9591 hashtable calls by merging the is_keyword and GetKeyword behavior.
9593 Do not short-circuit, because if we do, we
9594 report errors (ie, #if false && true would produce an invalid
9598 2002-11-24 Martin Baulig <martin@ximian.com>
9600 * expression.cs (Cast.TryReduce): If we're in checked syntax,
9601 check constant ranges and report a CS0221. Fixes #33186.
9603 2002-11-24 Martin Baulig <martin@ximian.com>
9605 * cs-parser.jay: Make this work for uninitialized variable
9606 declarations in the `for' initializer. Fixes #32416.
9608 2002-11-24 Martin Baulig <martin@ximian.com>
9610 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
9611 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
9613 2002-11-24 Martin Baulig <martin@ximian.com>
9615 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
9616 argument; if true, we also check for user-defined conversions.
9617 This is only needed if both arguments are of a user-defined type.
9618 Fixes #30443, added test-175.cs.
9619 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
9621 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
9623 2002-11-24 Martin Baulig <martin@ximian.com>
9625 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
9626 function to get the store opcode.
9627 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
9628 only emit the Ldelema if the store opcode is Stobj. You must run
9629 both test-34 and test-167 to test this. Fixes #34529.
9631 2002-11-23 Martin Baulig <martin@ximian.com>
9633 * ecore.cs (Expression.MemberLookup): Added additional
9634 `qualifier_type' argument which is used when we're being called
9635 from MemberAccess.DoResolve() and null if we're called from a
9637 (Expression.MemberLookupFailed): New method to report errors; this
9638 does the CS1540 check and reports the correct error message.
9640 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
9641 argument for the CS1540 check and redone the way how we're dealing
9642 with private members. See the comment in the source code for details.
9643 (FilterWithClosure): Reverted this back to revision 1.197; renamed
9644 `closure_start_type' to `closure_qualifier_type' and check whether
9645 it's not null. It was not this filter being broken, it was just
9646 being called with the wrong arguments.
9648 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
9649 and pass it the correct `qualifier_type'; this also does the error
9652 2002-11-22 Miguel de Icaza <miguel@ximian.com>
9654 * expression.cs (Invocation.EmitParams): If the we are dealing
9655 with a non-built-in value type, load its address as well.
9657 (ArrayCreation): Use a a pretty constant instead
9658 of the hardcoded value 2. Use 6 instead of 2 for the number of
9659 static initializers.
9661 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
9662 because they are not really value types, just glorified integers.
9664 * driver.cs: Do not append .exe, the CSC compiler does not do it.
9666 * ecore.cs: Remove redundant code for enumerations, make them use
9667 the same code path as everything else, fixes the casting issue
9668 with enumerations in Windows.Forms.
9670 * attribute.cs: Do only cast to string if it is a string, the
9671 validation happens later.
9673 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
9674 people upgrade their corlibs.
9676 * ecore.cs: Oops, enumerations were not following the entire code path
9678 2002-11-21 Miguel de Icaza <miguel@ximian.com>
9680 * typemanager.cs (FilterWithClosure): Commented out the test for
9681 1540 in typemanager.cs, as it has problems when accessing
9682 protected methods from a parent class (see test-174.cs).
9684 * attribute.cs (Attribute.ValidateGuid): new method.
9685 (Attribute.Resolve): Use above.
9687 2002-11-19 Miguel de Icaza <miguel@ximian.com>
9689 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
9691 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
9692 handling for enumerations, as we only needed the TypeContainer
9693 functionality to begin with (this is required for the fix below to
9694 work for enums that reference constants in a container class for
9697 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
9699 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
9700 a valid TypeBuilder to perform lookups on.o
9702 * class.cs (InheritableMemberSignatureCompare): Use true in the
9703 call to GetGetMethod and GetSetMethod, because we are comparing
9704 the signature, and we need to get the methods *even* if they are
9707 (PropertyBase.CheckBase): ditto.
9709 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
9710 GotoCase.Resolve): Use Peel on EmpytCasts.
9712 * ecore.cs (EmptyCast): drop child, add Peel method.
9714 2002-11-17 Martin Baulig <martin@ximian.com>
9716 * ecore.cs (EmptyCast.Child): New public property.
9718 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
9719 label resolved to an EmptyCast. Fixes #34162.
9720 (GotoCase.Resolve): Likewise.
9721 (Block.EmitMeta): Likewise.
9723 2002-11-17 Martin Baulig <martin@ximian.com>
9725 * expression.cs (Invocation.BetterConversion): Prefer int over
9726 uint; short over ushort; long over ulong for integer literals.
9727 Use ImplicitConversionExists instead of StandardConversionExists
9728 since we also need to check for user-defined implicit conversions.
9729 Fixes #34165. Added test-173.cs.
9731 2002-11-16 Martin Baulig <martin@ximian.com>
9733 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
9734 with the `true' and `false' literals. Fixes #33151.
9736 2002-11-16 Martin Baulig <martin@ximian.com>
9738 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
9739 October 22nd; don't do the cs1540 check for static members.
9741 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
9742 now using our own filter here and doing the cs1540 check again.
9744 2002-11-16 Martin Baulig <martin@ximian.com>
9746 * support.cs (InternalParameters): Don't crash if we don't have
9747 any fixed parameters. Fixes #33532.
9749 2002-11-16 Martin Baulig <martin@ximian.com>
9751 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
9752 when looking up static methods to make this work on Windows.
9755 2002-11-16 Martin Baulig <martin@ximian.com>
9757 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
9758 a setter rather than using PropertyInfo.CanWrite.
9760 2002-11-15 Nick Drochak <ndrochak@gol.com>
9762 * class.cs: Allow acces to block member by subclasses. Fixes build
9765 2002-11-14 Martin Baulig <martin@ximian.com>
9767 * class.cs (Constructor.Emit): Added the extern/block check.
9770 2002-11-14 Martin Baulig <martin@ximian.com>
9772 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
9773 iteration while looking for indexers, this is needed because the
9774 indexer may have a different name in our base classes. Fixed the
9775 error reporting (no indexers at all, not get accessor, no
9776 overloaded match). Fixes bug #33089.
9777 (IndexerAccess.DoResolveLValue): Likewise.
9779 2002-11-14 Martin Baulig <martin@ximian.com>
9781 * class.cs (PropertyBase.CheckBase): Make this work for multiple
9782 indexers. Fixes the first part of bug #33089.
9783 (MethodSignature.InheritableMemberSignatureCompare): Added support
9786 2002-11-13 Ravi Pratap <ravi@ximian.com>
9788 * attribute.cs (Attribute.Resolve): Catch the
9789 NullReferenceException and report it since it isn't supposed to
9792 2002-11-12 Miguel de Icaza <miguel@ximian.com>
9794 * expression.cs (Binary.EmitBranchable): Also handle the cases for
9795 LogicalOr and LogicalAnd that can benefit from recursively
9796 handling EmitBranchable. The code now should be nice for Paolo.
9798 2002-11-08 Miguel de Icaza <miguel@ximian.com>
9800 * typemanager.cs (LookupType): Added a negative-hit hashtable for
9801 the Type lookups, as we perform quite a number of lookups on
9802 non-Types. This can be removed once we can deterministically tell
9803 whether we have a type or a namespace in advance.
9805 But this might require special hacks from our corlib.
9809 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
9810 and double which avoids a conversion from an integer to a double.
9812 * expression.cs: tiny optimization, avoid calling IsConstant,
9813 because it effectively performs the lookup twice.
9815 2002-11-06 Miguel de Icaza <miguel@ximian.com>
9817 But a bogus return here to keep the semantics of the old code
9818 until the Mono runtime is fixed.
9820 * pending.cs (GetMissingInterfaces): New method used to remove all
9821 the interfaces that are already implemented by our parent
9822 classes from the list of pending methods.
9824 * interface.cs: Add checks for calls after ResolveTypeExpr.
9826 2002-11-05 Miguel de Icaza <miguel@ximian.com>
9828 * class.cs (Class.Emit): Report warning 67: event not used if the
9829 warning level is beyond 3.
9831 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
9832 being a NullLiteral.
9834 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
9837 * class.cs (TypeContainer.GetClassBases): Cover a missing code
9838 path that might fail if a type can not be resolved.
9840 * expression.cs (Binary.Emit): Emit unsigned versions of the
9843 * driver.cs: use error 5.
9845 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
9847 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
9849 2002-11-01 Miguel de Icaza <miguel@ximian.com>
9851 * cs-parser.jay (switch_section): A beautiful patch from Martin
9852 Baulig that fixed 33094.
9854 2002-10-31 Miguel de Icaza <miguel@ximian.com>
9856 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
9857 Check whether the base is abstract and report an error if so.
9859 * expression.cs (IndexerAccess.DoResolveLValue,
9860 IndexerAccess.DoResolve): ditto.
9862 (Invocation.DoResolve): ditto.
9864 (Invocation.FullMethodDesc): Improve the report string.
9866 * statement.cs (Block): Eliminate IsVariableDefined as it is
9867 basically just a wrapper for GetVariableInfo.
9869 * ecore.cs (SimpleName): Use new
9871 * support.cs (ReflectionParamter.ParameterType): We unwrap the
9872 type, as we return the actual parameter ref/unref state on a
9875 2002-10-30 Miguel de Icaza <miguel@ximian.com>
9877 * support.cs: Return proper flags REF/OUT fixing the previous
9880 * expression.cs: Reverted last patch, that was wrong. Is_ref is
9881 not used to mean `ref' but `ref or out' in ParameterReference
9883 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
9884 full type signature instead of calling TypeManger.CSharpName
9887 * support.cs (InternalParameters.ParameterDesc): Do not compare
9888 directly to the modflags, because REF/OUT will actually be bitsets
9891 * delegate.cs (VerifyMethod): Check also the modifiers.
9893 * cs-tokenizer.cs: Fix bug where floating point values with an
9894 exponent where a sign was missing was ignored.
9896 * driver.cs: Allow multiple assemblies to be specified in a single
9899 2002-10-28 Miguel de Icaza <miguel@ximian.com>
9901 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
9902 because identifiers after a parenthesis would end up in this kind
9903 of production, and we needed to desamiguate it for having casts
9906 (UserDefinedType *) xxx
9908 2002-10-24 Miguel de Icaza <miguel@ximian.com>
9910 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
9911 we should set on the Bindingflags.NonPublic, but not turn on
9912 private_ok. private_ok controls whether a Private member is
9913 returned (this is chekced on the filter routine), while the
9914 BindingFlags.NonPublic just controls whether private/protected
9915 will be allowed. This fixes the problem part of the problem of
9916 private properties being allowed to be used in derived classes.
9918 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
9919 so we can call the children DoResolveLValue method (this will
9920 properly signal errors on lvalue assignments to base properties)
9922 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
9923 getter are null, and we have a property info, we know that this
9924 happened because the lookup failed, so we report an error 122 for
9925 protection level violation.
9927 We also silently return if setter and getter are null in the
9928 resolve functions, this condition only happens if we have flagged
9929 the error before. This is the other half of the problem.
9931 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
9932 not have accessibility information, that is why we were returning
9933 true in the filter function in typemanager.cs.
9935 To properly report 122 (property is inaccessible because of its
9936 protection level) correctly, we report this error in ResolveAccess
9937 by failing if both the setter and the getter are lacking (ie, the
9940 DoResolve and DoLResolve have been modified to check for both
9941 setter/getter being null and returning silently, the reason being
9942 that I did not want to put the knowledge about this error in upper
9945 int old = Report.Errors;
9946 x = new PropertyExpr (...);
9947 if (old != Report.Errors)
9952 So the property expr is returned, but it is invalid, so the error
9953 will be flagged during the resolve process.
9955 * class.cs: Remove InheritablePropertySignatureCompare from the
9956 class, as we no longer depend on the property signature to compute
9957 whether it is possible to implement a method or not.
9959 The reason is that calling PropertyInfo.GetGetMethod will return
9960 null (in .NET, in Mono it works, and we should change this), in
9961 cases where the Get Method does not exist in that particular
9966 class X { public virtual int A { get { return 1; } } }
9968 class Z : Y { public override int A { get { return 2; } } }
9970 Would fail in Z because the parent (Y) would not have the property
9971 defined. So we avoid this completely now (because the alternative
9972 fix was ugly and slow), and we now depend exclusively on the
9975 (PropertyBase.CheckBase): Use a method-base mechanism to find our
9976 reference method, instead of using the property.
9978 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
9979 routines are gone now.
9981 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
9982 names, they were incorrectly named.
9984 * cs-tokenizer.cs: Return are more gentle token on failure.
9986 * pending.cs (PendingImplementation.InterfaceMethod): This routine
9987 had an out-of-sync index variable, which caused it to remove from
9988 the list of pending methods the wrong method sometimes.
9990 2002-10-22 Miguel de Icaza <miguel@ximian.com>
9992 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
9993 CanWrite, because those refer to this particular instance of the
9994 property, and do not take into account the fact that we can
9995 override single members of a property.
9997 Constructor requires an EmitContext. The resolution process does
9998 not happen here, but we need to compute the accessors before,
9999 because the resolution does not always happen for properties.
10001 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
10002 subclass, before we did not update this flag, but we did update
10005 (GetAccessors): Drop this routine, as it did not work in the
10006 presence of partially overwritten set/get methods.
10008 Notice that this broke the cs1540 detection, but that will require
10011 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10015 * driver.cs: issue a warning instead of an error if we don't support
10016 debugging for the platform. Also ignore a couple of errors that may
10017 arise when trying to write the symbols. Undo my previous patch.
10019 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10021 * driver.cs: ignore /debug switch except for Unix platforms.
10023 2002-10-23 Nick Drochak <ndrochak@gol.com>
10025 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
10027 2002-10-21 Miguel de Icaza <miguel@ximian.com>
10029 * driver.cs: Do not make mcs-debug conditional, so we do not break
10030 builds that use it.
10032 * statement.cs (UsageVector.MergeChildren): I would like Martin to
10033 review this patch. But basically after all the children variables
10034 have been merged, the value of "Breaks" was not being set to
10035 new_breaks for Switch blocks. I think that it should be set after
10036 it has executed. Currently I set this to the value of new_breaks,
10037 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
10038 conservative, but I do not understand this code very well.
10040 I did not break anything in the build, so that is good ;-)
10042 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
10044 2002-10-20 Mark Crichton <crichton@gimp.org>
10046 * cfold.cs: Fixed compile blocker. Really fixed it this time.
10048 2002-10-20 Nick Drochak <ndrochak@gol.com>
10050 * cfold.cs: Fixed compile blocker.
10052 2002-10-20 Miguel de Icaza <miguel@ximian.com>
10054 * driver.cs: I was chekcing the key, not the file.
10056 2002-10-19 Ravi Pratap <ravi@ximian.com>
10058 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
10059 message that we were generating - we just need to silently return
10062 2002-10-19 Miguel de Icaza <miguel@ximian.com>
10064 * class.cs (Event.Define): Change my previous commit, as this
10065 breaks the debugger. This is a temporary hack, as it seems like
10066 the compiler is generating events incorrectly to begin with.
10068 * expression.cs (Binary.ResolveOperator): Added support for
10069 "U operator - (E x, E y)"
10071 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
10074 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
10075 init-only variables, but this path did not take into account that
10076 there might be also instance readonly variables. Correct this
10079 This fixes bug 32253
10081 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
10084 * driver.cs: Change the extension for modules to `netmodule'
10086 * cs-parser.jay: Improved slightly the location tracking for
10087 the debugger symbols.
10089 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
10090 modifiers that were specified instead of the hardcoded value
10091 (FamAndAssem). This was basically ignoring the static modifier,
10092 and others. Fixes 32429.
10094 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
10095 fixed a bug in the process (32476)
10097 * expression.cs (ArrayAccess.EmitAssign): Patch from
10098 hwang_rob@yahoo.ca that fixes bug 31834.3
10100 2002-10-18 Miguel de Icaza <miguel@ximian.com>
10102 * driver.cs: Make the module extension .netmodule.
10104 2002-10-16 Miguel de Icaza <miguel@ximian.com>
10106 * driver.cs: Report an error if the resource file is not found
10107 instead of crashing.
10109 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
10110 false, like Emit does.
10112 2002-10-16 Nick Drochak <ndrochak@gol.com>
10114 * typemanager.cs: Remove unused private member. Also reported mcs
10115 bug to report this as a warning like csc.
10117 2002-10-15 Martin Baulig <martin@gnome.org>
10119 * statement.cs (Statement.Emit): Made this a virtual method; emits
10120 the line number info and calls DoEmit().
10121 (Statement.DoEmit): New protected abstract method, formerly knows
10122 as Statement.Emit().
10124 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
10126 2002-10-11 Miguel de Icaza <miguel@ximian.com>
10128 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
10129 have fixed a remaining problem: not every AddXXXX was adding a
10130 fully qualified name.
10132 Now everyone registers a fully qualified name in the DeclSpace as
10133 being defined instead of the partial name.
10135 Downsides: we are slower than we need to be due to the excess
10136 copies and the names being registered this way.
10138 The reason for this is that we currently depend (on the corlib
10139 bootstrap for instance) that types are fully qualified, because
10140 we dump all the types in the namespace, and we should really have
10141 types inserted into the proper namespace, so we can only store the
10142 basenames in the defined_names array.
10144 2002-10-10 Martin Baulig <martin@gnome.org>
10146 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
10147 from bug #31834, see the bug report for a testcase which is
10150 2002-10-10 Martin Baulig <martin@gnome.org>
10152 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
10153 flow analysis code for this.
10155 * statement.cs (Do, While, For): Tell the flow analysis code about
10157 (FlowBranching.UsageVector): Added support for infinite loops.
10158 (Block.Resolve): Moved the dead code elimination here and use flow
10161 2002-10-09 Miguel de Icaza <miguel@ximian.com>
10163 * class.cs (Field.Define): Catch cycles on struct type
10166 * typemanager.cs (IsUnmanagedtype): Do not recursively check
10167 fields if the fields are static. We only need to check instance
10170 * expression.cs (As.DoResolve): Test for reference type.
10172 * statement.cs (Using.ResolveExpression): Use
10173 ConvertImplicitRequired, not ConvertImplicit which reports an
10175 (Using.ResolveLocalVariableDecls): ditto.
10177 * expression.cs (Binary.ResolveOperator): Report errors in a few
10178 places where we had to.
10180 * typemanager.cs (IsUnmanagedtype): Finish implementation.
10182 2002-10-08 Miguel de Icaza <miguel@ximian.com>
10184 * expression.cs: Use StoreFromPtr instead of extracting the type
10185 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
10187 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
10188 an enumeration value to a System.Enum, but System.Enum is not a
10189 value type, but an class type, so we need to box.
10191 (Expression.ConvertExplicit): One codepath could return
10192 errors but not flag them. Fix this. Fixes #31853
10194 * parameter.cs (Resolve): Do not allow void as a parameter type.
10196 2002-10-06 Martin Baulig <martin@gnome.org>
10198 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
10199 if it's a class type and not a struct. Fixes #31815.
10201 2002-10-06 Martin Baulig <martin@gnome.org>
10203 * statement.cs: Reworked the flow analysis code a bit to make it
10204 usable for dead code elimination.
10206 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10208 * cs-parser.jay: allow empty source files. Fixes bug #31781.
10210 2002-10-04 Miguel de Icaza <miguel@ximian.com>
10212 * expression.cs (ComposedCast.DoResolveType): A quick workaround
10213 to fix the test 165, will investigate deeper.
10215 2002-10-04 Martin Baulig <martin@gnome.org>
10217 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
10218 finally blocks actually work.
10219 (Try.Resolve): We don't need to create a sibling for `finally' if
10220 there is no finally block.
10222 2002-10-04 Martin Baulig <martin@gnome.org>
10224 * class.cs (Constructor.Define): The default accessibility for a
10225 non-default constructor is private, not public.
10227 2002-10-04 Miguel de Icaza <miguel@ximian.com>
10229 * class.cs (Constructor): Make AllowedModifiers public, add
10232 * cs-parser.jay: Perform the modifiers test here, as the
10233 constructor for the Constructor class usually receives a zero
10234 because of the way we create it (first we create, later we
10235 customize, and we were never checking the modifiers).
10237 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
10238 is a version of LookupTypeReflection that includes the type-name
10239 cache. This can be used as a fast path for functions that know
10240 the fully qualified name and are only calling into *.GetType() to
10241 obtain a composed type.
10243 This is also used by TypeManager.LookupType during its type
10246 (LookupType): We now also track the real type name, as sometimes
10247 we can get a quey for the real type name from things like
10248 ComposedCast. This fixes bug 31422.
10250 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
10251 complete type fullname, it does not have to go through the type
10252 resolution system to obtain the composed version of the type (for
10253 obtaining arrays or pointers).
10255 (Conditional.Emit): Use the EmitBoolExpression to
10256 generate nicer code, as requested by Paolo.
10258 (ArrayCreation.CheckIndices): Use the patch from
10259 hwang_rob@yahoo.ca to validate the array initializers.
10261 2002-10-03 Miguel de Icaza <miguel@ximian.com>
10263 * class.cs (ConstructorInitializer.Emit): simplify code by using
10264 Invocation.EmitCall, and at the same time, fix the bugs in calling
10265 parent constructors that took variable arguments.
10267 * ecore.cs (Expression.ConvertNumericExplicit,
10268 Expression.ImplicitNumericConversion): Remove the code that
10269 manually wrapped decimal (InternalTypeConstructor call is now gone
10272 * expression.cs (Cast.TryReduce): Also handle decimal types when
10273 trying to perform a constant fold on the type.
10275 * typemanager.cs (IsUnmanagedtype): Partially implemented.
10277 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
10278 that only turned off an error report, and did nothing else.
10280 2002-10-02 Miguel de Icaza <miguel@ximian.com>
10282 * driver.cs: Handle and ignore /fullpaths
10284 2002-10-01 Miguel de Icaza <miguel@ximian.com>
10286 * expression.cs (Binary.ResolveOperator): Catch the case where
10287 DoNumericPromotions returns true,
10289 (Binary.DoNumericPromotions): Simplify the code, and the tests.
10291 2002-09-27 Miguel de Icaza <miguel@ximian.com>
10293 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
10296 2002-09-26 Miguel de Icaza <miguel@ximian.com>
10298 * ecore.cs (ConvertNumericExplicit): It is not enough that the
10299 conversion exists, but it is also required that the conversion be
10300 performed. This manifested in "(Type64Enum) 2".
10302 * class.cs (TypeManager.AddMethod): The fix is not to change
10303 AddEnum, because that one was using a fully qualified name (every
10304 DeclSpace derivative does), but to change the AddMethod routine
10305 that was using an un-namespaced name. This now correctly reports
10306 the duplicated name.
10308 Revert patch until I can properly fix it. The issue
10309 is that we have a shared Type space across all namespaces
10310 currently, which is wrong.
10312 Options include making the Namespace a DeclSpace, and merge
10313 current_namespace/current_container in the parser.
10315 2002-09-25 Miguel de Icaza <miguel@ximian.com>
10317 * cs-parser.jay: Improve error reporting when we get a different
10318 kind of expression in local_variable_type and
10319 local_variable_pointer_type.
10321 Propagate this to avoid missleading errors being reported.
10323 * ecore.cs (ImplicitReferenceConversion): treat
10324 TypeManager.value_type as a target just like object_type. As
10329 Is valid, and needs to result in the int 1 being boxed before it
10330 is assigned to the value type v.
10332 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
10333 to validate the enumeration name.
10335 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
10336 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
10337 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
10339 * ecore.cs (TryImplicitIntConversion): When doing an
10340 implicit-enumeration-conversion, check if the type is 64-bits and
10341 perform a conversion before passing to EnumConstant.
10343 2002-09-23 Miguel de Icaza <miguel@ximian.com>
10345 * decl.cs (Error_AmbiguousTypeReference); New routine used to
10346 report ambiguous type references. Unlike the MS version, we
10347 report what the ambiguity is. Innovation at work ;-)
10349 (DeclSpace.FindType): Require a location argument to
10350 display when we display an ambiguous error.
10352 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
10354 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
10356 * expression.cs (EmitDynamicInitializers): Apply patch from
10357 hwang_rob@yahoo.ca that fixes the order in which we emit our
10360 2002-09-21 Martin Baulig <martin@gnome.org>
10362 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
10363 delegate takes no arguments.
10365 2002-09-20 Miguel de Icaza <miguel@ximian.com>
10367 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
10370 * expression.cs: Extract the underlying type.
10372 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
10374 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
10376 2002-09-19 Miguel de Icaza <miguel@ximian.com>
10378 * class.cs (TypeContainer.DefineType): We can not use the nice
10379 PackingSize with the size set to 1 DefineType method, because it
10380 will not allow us to define the interfaces that the struct
10383 This completes the fixing of bug 27287
10385 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
10386 means also structs. This fixes part of the problem.
10387 (Expresion.ImplicitReferenceConversionExists): ditto.
10389 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
10390 error if there were no errors reported during the type lookup
10391 process, to avoid duplicates or redundant errors. Without this
10392 you would get an ambiguous errors plus a type not found. We have
10393 beaten the user enough with the first error.
10395 (DeclSparce.FindType): Emit a warning if we have an ambiguous
10398 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
10399 during the resolution process, stop the lookup, this avoids
10400 repeated error reports (same error twice).
10402 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
10404 * typemanager.cs (LookupType): Redo the type lookup code to match
10405 the needs of System.Reflection.
10407 The issue is that System.Reflection requires references to nested
10408 types to begin with a "+" sign instead of a dot. So toplevel
10409 types look like: "NameSpace.TopLevelClass", and nested ones look
10410 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
10413 2002-09-19 Martin Baulig <martin@gnome.org>
10415 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
10416 says that a method always returns or always throws an exception,
10417 don't report the CS0161.
10419 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
10420 set `Returns = new_returns'.
10422 2002-09-19 Martin Baulig <martin@gnome.org>
10424 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
10425 to an enum constant, check for a CS0176.
10427 2002-09-18 Miguel de Icaza <miguel@ximian.com>
10429 * class.cs (TypeContainer.CheckPairedOperators): Now we check
10430 for operators that must be in pairs and report errors.
10432 * ecore.cs (SimpleName.DoResolveType): During the initial type
10433 resolution process, when we define types recursively, we must
10434 check first for types in our current scope before we perform
10435 lookups in the enclosing scopes.
10437 * expression.cs (MakeByteBlob): Handle Decimal blobs.
10439 (Invocation.VerifyArgumentsCompat): Call
10440 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
10441 I thought we were supposed to always call this, but there are a
10442 few places in the code where we dont do it.
10444 2002-09-17 Miguel de Icaza <miguel@ximian.com>
10446 * driver.cs: Add support in -linkres and -resource to specify the
10447 name of the identifier.
10449 2002-09-16 Miguel de Icaza <miguel@ximian.com>
10451 * ecore.cs (StandardConversionExists): Sync with the conversion
10452 code: allow anything-* to void* conversions.
10454 (FindMostSpecificSource): Use an Expression argument
10455 instead of a Type, because we might be handed over a Literal which
10456 gets a few more implicit conversions that plain types do not. So
10457 this information was being lost.
10459 Also, we drop the temporary type-holder expression when not
10462 2002-09-17 Martin Baulig <martin@gnome.org>
10464 * class.cs (PropertyBase.CheckBase): Don't check the base class if
10465 this is an explicit interface implementation.
10467 2002-09-17 Martin Baulig <martin@gnome.org>
10469 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
10470 different `IndexerName' attributes.
10472 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
10473 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
10474 virtual CommonResolve().
10476 2002-09-16 Miguel de Icaza <miguel@ximian.com>
10478 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
10479 and convert that to the UnderlyingType.
10481 * statement.cs (Foreach.Resolve): Indexers are just like variables
10482 or PropertyAccesses.
10484 * cs-tokenizer.cs (consume_string): Track line numbers and columns
10485 inside quoted strings, we were not doing this before.
10487 2002-09-16 Martin Baulig <martin@gnome.org>
10489 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
10490 resolve it. This is needed for the definite assignment check of the
10491 instance expression, fixes bug #29846.
10492 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
10494 2002-09-16 Nick Drochak <ndrochak@gol.com>
10496 * parameter.cs: Fix compile error. Cannot reference static member
10497 from an instance object. Is this an mcs bug?
10499 2002-09-14 Martin Baulig <martin@gnome.org>
10501 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
10502 multiple times. Fixes bug #30295, added test-166.cs.
10504 2002-09-14 Martin Baulig <martin@gnome.org>
10506 * statement.cs (Block.Emit): Don't emit unreachable code.
10507 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
10508 `break' statements.
10509 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
10511 2002-09-14 Martin Baulig <martin@gnome.org>
10513 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
10516 2002-09-14 Martin Baulig <martin@gnome.org>
10518 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
10519 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
10520 be false on the ms runtime.
10522 2002-09-13 Martin Baulig <martin@gnome.org>
10524 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
10525 the CS0038 error message.
10527 2002-09-12 Miguel de Icaza <miguel@ximian.com>
10529 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
10530 constant inside, return it.
10532 2002-09-12 Martin Baulig <martin@gnome.org>
10534 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
10535 implicit conversion can be done between enum types.
10537 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
10538 check whether an implicit conversion to the current enum's UnderlyingType
10539 exists and report an error if not.
10541 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
10542 without debugging support.
10544 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
10545 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
10547 2002-09-12 Martin Baulig <martin@gnome.org>
10549 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
10551 * ecore.cs (IMemberExpr.DeclaringType): New property.
10552 (SimpleName.SimpleNameResolve): Check whether we're accessing a
10553 nonstatic member of an outer type (CS0038).
10555 2002-09-11 Miguel de Icaza <miguel@ximian.com>
10557 * driver.cs: Activate the using-error detector at warning level
10558 4 (at least for MS-compatible APIs).
10560 * namespace.cs (VerifyUsing): Small buglett fix.
10562 * pending.cs (PendingImplementation): pass the container pointer.
10564 * interface.cs (GetMethods): Allow for recursive definition. Long
10565 term, I would like to move every type to support recursive
10566 definitions, not the current ordering mechanism that we have right
10569 The situation is this: Attributes are handled before interfaces,
10570 so we can apply attributes to interfaces. But some attributes
10571 implement interfaces, we will now handle the simple cases
10572 (recursive definitions will just get an error).
10574 * parameter.cs: Only invalidate types at the end if we fail to
10577 2002-09-09 Martin Baulig <martin@gnome.org>
10579 * ecore.cs (PropertyExpr.Emit): Also check for
10580 TypeManager.system_int_array_get_length so this'll also work when
10581 compiling corlib. Fixes #30003.
10583 2002-09-09 Martin Baulig <martin@gnome.org>
10585 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
10586 and throw an exception if we can't get the type's size. Fixed #30040,
10589 2002-09-09 Martin Baulig <martin@gnome.org>
10591 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
10593 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
10594 context. Fixes bug #30027.
10596 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
10597 virtual functions. Fixes bug #30043, added test-164.cs.
10599 2002-09-08 Ravi Pratap <ravi@ximian.com>
10601 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
10603 2002-09-08 Nick Drochak <ndrochak@gol.com>
10605 * driver.cs: Use an object to get the windows codepage since it's not a
10608 2002-09-08 Miguel de Icaza <miguel@ximian.com>
10610 * statement.cs (For.Emit): for infinite loops (test == null)
10611 return whether there is a break inside, not always "true".
10613 * namespace.cs (UsingEntry): New struct to hold the name of the
10614 using definition, the location where it is defined, and whether it
10615 has been used in a successful type lookup.
10617 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
10622 2002-09-06 Ravi Pratap <ravi@ximian.com>
10624 * attribute.cs : Fix incorrect code which relied on catching
10625 a NullReferenceException to detect a null being passed in
10626 where an object was expected.
10628 2002-09-06 Miguel de Icaza <miguel@ximian.com>
10630 * statement.cs (Try): flag the catch variable as assigned
10632 * expression.cs (Cast): Simplified by using ResolveType instead of
10633 manually resolving.
10635 * statement.cs (Catch): Fix bug by using ResolveType.
10637 2002-09-06 Ravi Pratap <ravi@ximian.com>
10639 * expression.cs (BetterConversion): Special case for when we have
10640 a NullLiteral as the argument and we have to choose between string
10641 and object types - we choose string the way csc does.
10643 * attribute.cs (Attribute.Resolve): Catch the
10644 NullReferenceException and report error #182 since the Mono
10645 runtime no more has the bug and having this exception raised means
10646 we tried to select a constructor which takes an object and is
10649 2002-09-05 Ravi Pratap <ravi@ximian.com>
10651 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
10652 message (1502, 1503) when we can't locate a method after overload
10653 resolution. This is much more informative and closes the bug
10656 * interface.cs (PopulateMethod): Return if there are no argument
10657 types. Fixes a NullReferenceException bug.
10659 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
10660 expressions too. Previously we were checking only in one place for
10661 positional arguments leaving out named arguments.
10663 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
10664 type to the enum type is not allowed. Remove code corresponding to
10667 (ConvertNumericExplicit): Allow explicit conversions from
10668 the underlying type to enum type. This precisely follows the spec
10669 and closes a bug filed by Gonzalo.
10671 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10674 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
10676 2002-09-03 Miguel de Icaza <miguel@ximian.com>
10678 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
10679 it was important that we stored the right value after the
10680 reduction in `converted'.
10682 2002-09-04 Martin Baulig <martin@gnome.org>
10684 * location.cs (Location.SymbolDocument): Use full pathnames for the
10687 2002-08-30 Miguel de Icaza <miguel@ximian.com>
10689 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
10690 of the expression resolve mechanism, because that will catch the
10691 SimpleName error failures.
10693 (Conditional): If we can not resolve the
10694 expression, return, do not crash.
10696 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10699 (location): display token name instead of its number.
10701 2002-08-28 Martin Baulig <martin@gnome.org>
10703 * expression.cs (Binary.ResolveOperator): Don't silently return
10704 but return an error if an operator cannot be applied between two
10707 2002-08-28 Martin Baulig <martin@gnome.org>
10709 * class.cs (Constructor.Define): Set the permission attributes
10710 correctly instead of making all constructors public.
10712 2002-08-28 Martin Baulig <martin@gnome.org>
10714 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
10715 for private members before reporting a CS0103; if we find anything,
10718 2002-08-28 Martin Baulig <martin@gnome.org>
10720 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
10721 to check whether `closure_start_type == closure_invocation_type',
10722 we also need to check whether `m.DeclaringType == closure_invocation_type'
10723 before bypassing the permission checks. We might be accessing
10724 protected/private members from the base class.
10725 (TypeManager.RealMemberLookup): Only set private_ok if private
10726 members were requested via BindingFlags.NonPublic.
10728 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
10730 * expression.cs (MemberAccess.ResolveMemberAccess): Set
10731 MethodGroupExpr.IsExplicitImpl if appropriate.
10732 (Invocation.DoResolve): Don't report the CS0120 for explicit
10733 interface implementations.
10735 2002-08-27 Martin Baulig <martin@gnome.org>
10737 * expression.cs (Invocation.DoResolve): If this is a static
10738 method and we don't have an InstanceExpression, we must report
10741 2002-08-25 Martin Baulig <martin@gnome.org>
10743 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
10744 `==' between a valuetype and an object.
10746 2002-08-25 Miguel de Icaza <miguel@ximian.com>
10748 * ecore.cs (TypeExpr): Provide a ToString method.
10750 2002-08-24 Martin Baulig <martin@gnome.org>
10752 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
10753 now called proggie.dbg and it's a binary file.
10755 2002-08-23 Martin Baulig <martin@gnome.org>
10757 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
10759 2002-08-23 Martin Baulig <martin@gnome.org>
10761 * struct.cs (MyStructInfo.ctor): Make this work with empty
10762 structs; it's not allowed to use foreach() on null.
10764 2002-08-23 Martin Baulig <martin@gnome.org>
10766 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
10767 writer the full pathname of the generated assembly.
10769 2002-08-23 Martin Baulig <martin@gnome.org>
10771 * statements.cs (FlowBranching.UsageVector.MergeChildren):
10772 A `finally' block never returns or breaks; improved handling of
10775 2002-08-23 Martin Baulig <martin@gnome.org>
10777 * statement.cs (Throw.Resolve): Allow `throw null'.
10779 2002-08-23 Martin Baulig <martin@gnome.org>
10781 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
10782 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
10783 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
10784 MemberLookup would return a wrong event if this is an explicit
10785 interface implementation and the class has an event with the same
10788 2002-08-23 Martin Baulig <martin@gnome.org>
10790 * statement.cs (Block.AddChildVariableNames): New public method.
10791 (Block.AddChildVariableName): Likewise.
10792 (Block.IsVariableNameUsedInChildBlock): Likewise.
10793 (Block.AddVariable): Check whether a variable name has already
10794 been used in a child block.
10796 * cs-parser.jay (declare_local_variables): Mark all variable names
10797 from the current block as being used in a child block in the
10800 2002-08-23 Martin Baulig <martin@gnome.org>
10802 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
10803 find the symbol writer.
10805 * driver.cs: csc also allows the arguments to /define being
10806 separated by commas, not only by semicolons.
10808 2002-08-23 Martin Baulig <martin@gnome.org>
10810 * interface.cs (Interface.GetMembers): Added static check for events.
10812 2002-08-15 Martin Baulig <martin@gnome.org>
10814 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
10815 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
10817 * ecore.cs (Expression.MemberLookup): Added documentation and explained
10818 why the MethodData.EmitDestructor() change was necessary.
10820 2002-08-20 Martin Baulig <martin@gnome.org>
10822 * class.cs (TypeContainer.FindMembers): Added static check for events.
10824 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
10826 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
10827 use Type.GetEvents(), not Type.FindMembers().
10829 2002-08-20 Martin Baulig <martin@gnome.org>
10831 * decl.cs (MemberCache): Added a special method cache which will
10832 be used for method-only searched. This ensures that a method
10833 search will return a MethodInfo with the correct ReflectedType for
10836 2002-08-20 Martin Baulig <martin@gnome.org>
10838 * decl.cs (DeclSpace.FindMembers): Made this public.
10840 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10842 * delegate.cs: fixed build on windows.
10843 [FIXME: Filed as bug #29150: MCS must report these errors.]
10845 2002-08-19 Ravi Pratap <ravi@ximian.com>
10847 * ecore.cs (StandardConversionExists): Return a false
10848 if we are trying to convert the void type to anything else
10849 since that is not allowed.
10851 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
10852 we flag error 70 in the event an event is trying to be accessed
10853 directly from outside the declaring type.
10855 2002-08-20 Martin Baulig <martin@gnome.org>
10857 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
10858 MemberCache from typemanager.cs to decl.cs.
10860 2002-08-19 Martin Baulig <martin@gnome.org>
10862 * class.cs (TypeContainer): Implement IMemberContainer.
10863 (TypeContainer.DefineMembers): Create the MemberCache.
10864 (TypeContainer.FindMembers): Do better BindingFlags checking; only
10865 return public members if BindingFlags.Public was given, check
10866 whether members are static.
10868 2002-08-16 Martin Baulig <martin@gnome.org>
10870 * decl.cs (DeclSpace.Define): Splitted this in Define and
10871 DefineMembers. DefineMembers is called first and initializes the
10874 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
10875 DefineMembers() on all our DeclSpaces.
10877 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
10878 but call DefineMembers() on all nested interfaces. We call their
10879 Define() in our new Define() function.
10881 * interface.cs (Interface): Implement IMemberContainer.
10882 (Interface.Define): Moved all code except the attribute stuf to
10884 (Interface.DefineMembers): Initialize the member cache.
10886 * typemanager.cs (IMemberFinder): Removed this interface, we don't
10887 need this anymore since we can use MemberCache.FindMembers directly.
10889 2002-08-19 Martin Baulig <martin@gnome.org>
10891 * typemanager.cs (MemberCache): When creating the cache for an
10892 interface type, add all inherited members.
10893 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
10894 to `out bool used_cache' and documented it.
10895 (TypeManager.MemberLookup): If we already used the cache in the first
10896 iteration, we don't need to do the interfaces check.
10898 2002-08-19 Martin Baulig <martin@gnome.org>
10900 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
10901 here from IMemberFinder and don't implement this interface anymore.
10902 (DeclSpace.MemberCache): Moved here from IMemberFinder.
10904 * typemanager.cs (IMemberFinder): This interface is now only used by
10905 classes which actually support the member cache.
10906 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
10907 since we only put DeclSpaces into this Hashtable.
10908 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
10909 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
10911 2002-08-16 Martin Baulig <martin@gnome.org>
10913 * typemanager.cs (ICachingMemberFinder): Removed.
10914 (IMemberFinder.MemberCache): New property.
10915 (TypeManager.FindMembers): Merged this with RealFindMembers().
10916 This function will never be called from TypeManager.MemberLookup()
10917 so we can't use the cache here, just the IMemberFinder.
10918 (TypeManager.MemberLookup_FindMembers): Check whether the
10919 IMemberFinder has a MemberCache and call the cache's FindMembers
10921 (MemberCache): Rewrote larger parts of this yet another time and
10922 cleaned it up a bit.
10924 2002-08-15 Miguel de Icaza <miguel@ximian.com>
10926 * driver.cs (LoadArgs): Support quoting.
10928 (Usage): Show the CSC-like command line arguments.
10930 Improved a few error messages.
10932 2002-08-15 Martin Baulig <martin@gnome.org>
10934 * typemanager.cs (IMemberContainer.Type): New property.
10935 (IMemberContainer.IsInterface): New property.
10937 The following changes are conditional to BROKEN_RUNTIME, which is
10938 defined at the top of the file.
10940 * typemanager.cs (MemberCache.MemberCache): Don't add the base
10941 class'es members, but add all members from TypeHandle.ObjectType
10942 if we're an interface.
10943 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
10944 is the current type.
10945 (MemberCache.CacheEntry.Container): Removed this field.
10946 (TypeHandle.GetMembers): Include inherited members.
10948 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10950 * typemanager.cs: fixed compilation and added a comment on a field that
10953 2002-08-15 Martin Baulig <martin@gnome.org>
10955 * class.cs (ConstructorInitializer.Resolve): In the
10956 Expression.MemberLookup call, use the queried_type as
10959 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
10960 declared' attribute, it's always true.
10961 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
10962 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
10963 temporary wrapper for FindMembers which tells MemberLookup whether
10964 members from the base classes are included in the return value.
10965 This will go away soon.
10966 (TypeManager.MemberLookup): Use this temporary hack here; once the
10967 new MemberCache is completed, we don't need to do the DeclaredOnly
10968 looping here anymore since the MemberCache will take care of this.
10969 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
10970 (MemberCache): When creating the MemberCache for a class, get
10971 members from the current class and all its base classes.
10972 (MemberCache.CacheEntry.Container): New field. This is a
10973 temporary hack until the Mono runtime is fixed to distinguish
10974 between ReflectedType and DeclaringType. It allows us to use MCS
10975 with both the MS runtime and the unfixed Mono runtime without
10976 problems and without accecting performance.
10977 (MemberCache.SearchMembers): The DeclaredOnly looping from
10978 TypeManager.MemberLookup is now done here.
10980 2002-08-14 Martin Baulig <martin@gnome.org>
10982 * statement.cs (MyStructInfo.MyStructInfo): Don't call
10983 Type.GetFields on dynamic types but get the fields from the
10984 corresponding TypeContainer.
10985 (MyStructInfo.GetStructInfo): Added check for enum types.
10987 * typemanager.cs (MemberList.IsSynchronized): Implemented.
10988 (MemberList.SyncRoot): Implemented.
10989 (TypeManager.FilterWithClosure): No need to check permissions if
10990 closure_start_type == closure_invocation_type, don't crash if
10991 closure_invocation_type is null.
10993 2002-08-13 Martin Baulig <martin@gnome.org>
10995 Rewrote TypeContainer.FindMembers to use a member cache. This
10996 gives us a speed increase of about 35% for the self-hosting MCS
10997 build and of about 15-20% for the class libs (both on GNU/Linux).
10999 * report.cs (Timer): New class to get enhanced profiling. This
11000 whole class is "TIMER" conditional since it remarkably slows down
11003 * class.cs (MemberList): New class. This is an IList wrapper
11004 which we're now using instead of passing MemberInfo[]'s around to
11005 avoid copying this array unnecessarily.
11006 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
11007 (ICachingMemberFinder, IMemberContainer): New interface.
11008 (TypeManager.FilterWithClosure): If `criteria' is null, the name
11009 has already been checked, otherwise use it for the name comparision.
11010 (TypeManager.FindMembers): Renamed to RealMemberFinder and
11011 provided wrapper which tries to use ICachingMemberFinder.FindMembers
11012 if possible. Returns a MemberList, not a MemberInfo [].
11013 (TypeHandle): New class, implements IMemberContainer. We create
11014 one instance of this class per type, it contains a MemberCache
11015 which is used to do the member lookups.
11016 (MemberCache): New class. Each instance of this class contains
11017 all members of a type and a name-based hash table.
11018 (MemberCache.FindMembers): This is our new member lookup
11019 function. First, it looks up all members of the requested name in
11020 the hash table. Then, it walks this list and sorts out all
11021 applicable members and returns them.
11023 2002-08-13 Martin Baulig <martin@gnome.org>
11025 In addition to a nice code cleanup, this gives us a performance
11026 increase of about 1.4% on GNU/Linux - not much, but it's already
11027 half a second for the self-hosting MCS compilation.
11029 * typemanager.cs (IMemberFinder): New interface. It is used by
11030 TypeManager.FindMembers to call FindMembers on a TypeContainer,
11031 Enum, Delegate or Interface.
11032 (TypeManager.finder_to_member_finder): New PtrHashtable.
11033 (TypeManager.finder_to_container): Removed.
11034 (TypeManager.finder_to_delegate): Removed.
11035 (TypeManager.finder_to_interface): Removed.
11036 (TypeManager.finder_to_enum): Removed.
11038 * interface.cs (Interface): Implement IMemberFinder.
11040 * delegate.cs (Delegate): Implement IMemberFinder.
11042 * enum.cs (Enum): Implement IMemberFinder.
11044 * class.cs (TypeContainer): Implement IMemberFinder.
11046 2002-08-12 Martin Baulig <martin@gnome.org>
11048 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
11050 2002-08-12 Martin Baulig <martin@gnome.org>
11052 * ecore.cs (ITypeExpression): New interface for expressions which
11054 (TypeExpression): Renamed to TypeLookupExpression.
11055 (Expression.DoResolve): If we're doing a types-only lookup, the
11056 expression must implement the ITypeExpression interface and we
11057 call DoResolveType() on it.
11058 (SimpleName): Implement the new ITypeExpression interface.
11059 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
11060 hack, the situation that we're only looking up types can't happen
11061 anymore when this method is called. Moved the type lookup code to
11062 DoResolveType() and call it.
11063 (SimpleName.DoResolveType): This ITypeExpression interface method
11064 is now doing the types-only lookup.
11065 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
11066 (ResolveFlags): Added MaskExprClass.
11068 * expression.cs (MemberAccess): Implement the ITypeExpression
11070 (MemberAccess.DoResolve): Added support for a types-only lookup
11071 when we're called via ITypeExpression.DoResolveType().
11072 (ComposedCast): Implement the ITypeExpression interface.
11074 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
11075 Expression.Resolve() with ResolveFlags.Type instead.
11077 2002-08-12 Martin Baulig <martin@gnome.org>
11079 * interface.cs (Interface.Define): Apply attributes.
11081 * attribute.cs (Attribute.ApplyAttributes): Added support for
11082 interface attributes.
11084 2002-08-11 Martin Baulig <martin@gnome.org>
11086 * statement.cs (Block.Emit): Only check the "this" variable if we
11087 do not always throw an exception.
11089 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
11090 whether the property has a set accessor.
11092 2002-08-11 Martin Baulig <martin@gnome.org>
11094 Added control flow analysis support for structs.
11096 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
11097 with control flow analysis turned off.
11098 (IVariable): New interface.
11099 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
11100 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
11101 (FieldExpr.DoResolve): Resolve the instance expression with flow
11102 analysis turned off and do the definite assignment check after the
11103 resolving when we know what the expression will resolve to.
11105 * expression.cs (LocalVariableReference, ParameterReference):
11106 Implement the new IVariable interface, only call the flow analysis
11107 code if ec.DoFlowAnalysis is true.
11108 (This): Added constructor which takes a Block argument. Implement
11109 the new IVariable interface.
11110 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
11111 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
11112 This does the definite assignment checks for struct members.
11114 * class.cs (Constructor.Emit): If this is a non-static `struct'
11115 constructor which doesn't have any initializer, call
11116 Block.AddThisVariable() to tell the flow analysis code that all
11117 struct elements must be initialized before control returns from
11120 * statement.cs (MyStructInfo): New public class.
11121 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
11122 argument to this indexer. If non-zero, check an individual struct
11123 member, not the whole struct.
11124 (FlowBranching.CheckOutParameters): Check struct members.
11125 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
11126 overloaded versions of these methods which take an additional
11127 `int field_idx' argument to check struct members.
11128 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
11129 overloaded versions of these methods which take an additional
11130 `string field_name' argument to check struct member.s
11131 (VariableInfo): Implement the IVariable interface.
11132 (VariableInfo.StructInfo): New public property. Returns the
11133 MyStructInfo instance of the variable if it's a struct or null.
11134 (Block.AddThisVariable): New public method. This is called from
11135 Constructor.Emit() for non-static `struct' constructor which do
11136 not have any initializer. It creates a special variable for the
11137 "this" instance variable which will be checked by the flow
11138 analysis code to ensure that all of the struct's fields are
11139 initialized before control returns from the constructor.
11140 (UsageVector): Added support for struct members. If a
11141 variable/parameter is a struct with N members, we reserve a slot
11142 in the usage vector for each member. A struct is considered fully
11143 initialized if either the struct itself (slot 0) or all its
11144 members are initialized.
11146 2002-08-08 Martin Baulig <martin@gnome.org>
11148 * driver.cs (Driver.MainDriver): Only report an error CS5001
11149 if there were no compilation errors.
11151 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
11152 `UnsafeContext' property to determine whether the parent is in
11153 unsafe context rather than checking the parent's ModFlags:
11154 classes nested in an unsafe class are unsafe as well.
11156 2002-08-08 Martin Baulig <martin@gnome.org>
11158 * statement.cs (UsageVector.MergeChildren): Distinguish between
11159 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
11160 we return. Added test17() and test18() to test-154.cs.
11162 2002-08-08 Martin Baulig <martin@gnome.org>
11164 * typemanager.cs (TypeManager.FilterWithClosure): If we have
11165 Family access, make sure the invoking type isn't a subclass of the
11166 queried type (that'd be a CS1540).
11168 * ecore.cs (Expression.MemberLookup): Added overloaded version of
11169 this method which takes an additional `Type invocation_type'.
11171 * expression.cs (BaseAccess.DoResolve): Use the base type as
11172 invocation and query type.
11173 (MemberAccess.DoResolve): If the lookup failed and we're about to
11174 report a CS0122, try a lookup with the ec.ContainerType - if this
11175 succeeds, we must report a CS1540.
11177 2002-08-08 Martin Baulig <martin@gnome.org>
11179 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
11180 (MethodGroupExpr): Implement the IMemberExpr interface.
11182 * expression (MemberAccess.ResolveMemberAccess): No need to have
11183 any special code for MethodGroupExprs anymore, they're now
11186 2002-08-08 Martin Baulig <martin@gnome.org>
11188 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
11189 Family, FamANDAssem and FamORAssem permissions.
11190 (TypeManager.IsSubclassOrNestedChildOf): New public method.
11192 2002-08-08 Martin Baulig <martin@gnome.org>
11194 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
11195 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
11198 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
11200 * driver.cs: implemented /resource option to embed managed resources.
11202 2002-08-07 Martin Baulig <martin@gnome.org>
11204 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
11205 (FieldBase.HasFieldInitializer): New public property.
11206 (FieldBase.GetInitializerExpression): New public method. Resolves and
11207 returns the field initializer and makes sure it is only resolved once.
11208 (TypeContainer.EmitFieldInitializers): Call
11209 FieldBase.GetInitializerExpression to get the initializer, this ensures
11210 that it isn't resolved multiple times.
11212 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
11213 the resolving process (SimpleName/MemberLookup) that we're currently
11214 emitting a field initializer (which must not access any instance members,
11215 this is an error CS0236).
11217 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
11218 argument, if the `IsFieldInitializer' flag is set, we must report and
11219 error CS0236 and not an error CS0120.
11221 2002-08-07 Martin Baulig <martin@gnome.org>
11223 * ecore.cs (IMemberExpr): New public interface.
11224 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
11225 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
11226 if the expression is an IMemberExpr.
11228 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
11229 to be null, implicitly default to `this' if we're non-static in
11230 this case. Simplified the code a lot by using the new IMemberExpr
11231 interface. Also fixed bug #28176 here.
11233 2002-08-06 Martin Baulig <martin@gnome.org>
11235 * cs-parser.jay (SimpleLookup): Removed. We need to create
11236 ParameterReferences during semantic analysis so that we can do a
11237 type-only search when resolving Cast, TypeOf and SizeOf.
11238 (block): Pass the `current_local_parameters' to the Block's
11241 * class.cs (ConstructorInitializer): Added `Parameters parameters'
11242 argument to the constructor.
11243 (ConstructorInitializer.Resolve): Create a temporary implicit
11244 block with the parameters.
11246 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
11247 references here if we aren't doing a type-only search.
11249 * statement.cs (Block): Added constructor which takes a
11250 `Parameters parameters' argument.
11251 (Block.Parameters): New public property.
11253 * support.cs (InternalParameters.Parameters): Renamed `parameters'
11254 to `Parameters' and made it public readonly.
11256 2002-08-06 Martin Baulig <martin@gnome.org>
11258 * ecore.cs (Expression.Warning): Made this public as well.
11260 * report.cs (Report.Debug): Print the contents of collections.
11262 2002-08-06 Martin Baulig <martin@gnome.org>
11264 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
11265 used to tell Resolve() which kinds of expressions it may return.
11266 (Expression.Resolve): Added overloaded version of this method which
11267 takes a `ResolveFlags flags' argument. This can be used to tell
11268 Resolve() which kinds of expressions it may return. Reports a
11270 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
11271 ResolveFlags.SimpleName.
11272 (Expression.Error118): Added overloaded version of this method which
11273 takes a `ResolveFlags flags' argument. It uses the flags to determine
11274 which kinds of expressions are allowed.
11276 * expression.cs (Argument.ResolveMethodGroup): New public method.
11277 Resolves an argument, but allows a MethodGroup to be returned.
11278 This is used when invoking a delegate.
11280 * TODO: Updated a bit.
11282 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11284 Fixed compilation with csc.
11286 * ecore.cs: Expression.Error made public. Is this correct? Should
11287 Warning be made public too?
11289 * expression.cs: use ea.Location instead of ea.loc.
11290 [FIXME: Filed as bug #28607: MCS must report these errors.]
11292 2002-08-06 Martin Baulig <martin@gnome.org>
11294 * ecore.cs (Expression.loc): Moved the location here instead of
11295 duplicating it in all derived classes.
11296 (Expression.Location): New public property.
11297 (Expression.Error, Expression.Warning): Made them non-static and
11298 removed the location argument.
11299 (Expression.Warning): Added overloaded version which takes an
11300 `int level' argument.
11301 (Expression.Error118): Make this non-static and removed the
11302 expression and location arguments.
11303 (TypeExpr): Added location argument to the constructor.
11305 * expression.cs (StaticCallExpr): Added location argument to
11307 (Indirection, PointerArithmetic): Likewise.
11308 (CheckedExpr, UnCheckedExpr): Likewise.
11309 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
11310 (StringPtr): Likewise.
11313 2002-08-05 Martin Baulig <martin@gnome.org>
11315 * expression.cs (BaseAccess.DoResolve): Actually report errors.
11317 * assign.cs (Assign.DoResolve): Check whether the source
11318 expression is a value or variable.
11320 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
11321 while resolving the corresponding blocks.
11323 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
11324 an error, don't silently return null.
11326 * statement.cs (Block.AddVariable): Do the error reporting here
11327 and distinguish between CS0128 and CS0136.
11328 (Block.DoResolve): Report all unused labels (warning CS0164).
11329 (LabeledStatement): Pass the location to the constructor.
11330 (LabeledStatement.HasBeenReferenced): New property.
11331 (LabeledStatement.Resolve): Set it to true here.
11333 * statement.cs (Return.Emit): Return success even after reporting
11334 a type mismatch error (CS0126 or CS0127), this is what csc does and
11335 it avoids confusing the users with any consecutive errors.
11337 2002-08-05 Martin Baulig <martin@gnome.org>
11339 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
11341 * const.cs (Const.LookupConstantValue): Catch circular definitions.
11343 * expression.cs (MemberAccess.DoResolve): Silently return if an
11344 error has already been reported.
11346 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
11347 error has already been reported.
11349 2002-08-05 Martin Baulig <martin@gnome.org>
11351 * statement.cs (UsageVector): Only initialize the `parameters'
11352 vector if we actually have any "out" parameters.
11354 2002-08-05 Martin Baulig <martin@gnome.org>
11356 * expression.cs (Binary.ResolveOperator): When combining delegates,
11357 they must have the same type.
11359 2002-08-05 Martin Baulig <martin@gnome.org>
11361 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
11362 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
11363 work with the ms runtime and we also don't need it: if we're a
11364 PropertyBuilder and not in the `indexer_arguments' hash, then we
11365 are a property and not an indexer.
11367 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
11368 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
11369 since the latter one doesn't work with the ms runtime.
11371 2002-08-03 Martin Baulig <martin@gnome.org>
11373 Fixed bugs #27998 and #22735.
11375 * class.cs (Method.IsOperator): New public field.
11376 (Method.CheckBase): Report CS0111 if there's already a method
11377 with the same parameters in the current class. Report CS0508 when
11378 attempting to change the return type of an inherited method.
11379 (MethodData.Emit): Report CS0179 if a method doesn't have a body
11380 and it's not marked abstract or extern.
11381 (PropertyBase): New abstract base class for Property and Indexer.
11382 (PropertyBase.CheckBase): Moved here from Property and made it work
11384 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
11385 the same so we can reuse it there.
11386 (Property, Indexer): Derive from PropertyBase.
11387 (MethodSignature.inheritable_property_signature_filter): New delegate
11388 to find properties and indexers.
11390 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
11391 argument and improved error reporting.
11393 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
11394 EmptyReadOnlyParameters and made it a property.
11396 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
11397 version of this method which takes a `PropertyInfo indexer'.
11398 (TypeManager.RegisterIndexer): New method.
11400 * class.cs: Added myself as author of this file :-)
11402 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11404 * class.cs: fixed compilation on windoze.
11406 2002-08-03 Martin Baulig <martin@gnome.org>
11408 * interface.cs (Interface.GetInterfaceBases): Check whether all
11409 base interfaces are at least as accessible than the current one.
11411 * class.cs (TypeContainer.GetClassBases): Check whether base types
11412 are at least as accessible than the current type.
11413 (TypeContainer.AsAccessible): Implemented and made non-static.
11414 (MemberBase.CheckParameters): Report errors if the accessibility
11417 * delegate.cs (Delegate.Delegate): The default visibility is
11418 internal for top-level types and private for nested types.
11419 (Delegate.Define): Report errors if the accessibility checks fail.
11421 * enum.cs (Enum.Enum): The default visibility is internal for
11422 top-level types and private for nested types.
11423 (Enum.DefineType): Compute the correct visibility.
11425 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
11426 function which takes a `bool is_toplevel' instead of a TypeContainer.
11428 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
11431 2002-08-02 Martin Baulig <martin@gnome.org>
11433 * expression.cs (LocalVariableReferenc): Added constructor which
11434 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
11435 (LocalVariableReference.IsReadOnly): New property.
11436 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
11437 variable is readonly, use our own readonly flag to do this; you can
11438 use the new constructor to get a writable reference to a read-only
11441 * cs-parser.jay (foreach_statement, using_statement): Get a writable
11442 reference to the local variable.
11444 2002-08-01 Miguel de Icaza <miguel@ximian.com>
11446 * rootcontext.cs (ResolveCore): Also include System.Exception
11448 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
11449 we reach an EmptyStatement.
11451 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
11454 * expression.cs (Binary.ResolveOperator): Check error result in
11457 use brtrue/brfalse directly and avoid compares to null.
11459 2002-08-02 Martin Baulig <martin@gnome.org>
11461 * class.cs (TypeContainer.Define): Define all nested interfaces here.
11462 Fixes bug #28407, added test-155.cs.
11464 2002-08-01 Martin Baulig <martin@gnome.org>
11466 * class.cs (Event.EmitDefaultMethod): Make this work with static
11467 events. Fixes #28311, added verify-3.cs.
11469 2002-08-01 Martin Baulig <martin@gnome.org>
11471 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
11472 `is_disposable' fields.
11473 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
11474 `hm.is_disposable' if we're using the collection pattern.
11475 (Foreach.EmitCollectionForeach): Use the correct type for the
11476 enumerator's local variable, only emit the try/finally block if
11477 necessary (fixes #27713).
11479 2002-08-01 Martin Baulig <martin@gnome.org>
11481 * ecore.cs (Expression.report118): Renamed to Error118 and made
11484 * statement.cs (Throw.Resolve): Check whether the expression is of
11485 the correct type (CS0118) and whether the type derives from
11486 System.Exception (CS0155).
11487 (Catch.Resolve): New method. Do the type lookup here and check
11488 whether it derives from System.Exception (CS0155).
11489 (Catch.CatchType, Catch.IsGeneral): New public properties.
11491 * typemanager.cs (TypeManager.exception_type): Added.
11493 2002-07-31 Miguel de Icaza <miguel@ximian.com>
11495 * driver.cs: Updated About function.
11497 2002-07-31 Martin Baulig <martin@gnome.org>
11499 Implemented Control Flow Analysis.
11501 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
11502 (EmitContext.CurrentBranching): Added.
11503 (EmitContext.StartFlowBranching): Added.
11504 (EmitContext.EndFlowBranching): Added.
11505 (EmitContext.KillFlowBranching): Added.
11506 (EmitContext.IsVariableAssigned): Added.
11507 (EmitContext.SetVariableAssigned): Added.
11508 (EmitContext.IsParameterAssigned): Added.
11509 (EmitContext.SetParameterAssigned): Added.
11510 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
11511 Added control flow analysis stuff here.
11513 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
11514 resolve the expression as lvalue.
11515 (LocalVariableReference.DoResolve): Check whether the variable has
11516 already been assigned.
11517 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
11518 the parameter as assigned here.
11519 (ParameterReference.DoResolve): Check whether the parameter has already
11521 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
11522 expression as lvalue.
11524 * statement.cs (FlowBranching): New class for the flow analysis code.
11525 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
11526 (LabeledStatement.IsDefined): New public property.
11527 (LabeledStatement.AddUsageVector): New public method to tell flow
11528 analyis that the label may be reached via a forward jump.
11529 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
11531 (VariableInfo.Number): New public field. This is used by flow analysis
11532 to number all locals of a block.
11533 (Block.CountVariables): New public property. This is the number of
11534 local variables in this block (including the locals from all parent
11536 (Block.EmitMeta): Number all the variables.
11538 * statement.cs: Added flow analysis support to all classes.
11540 2002-07-31 Martin Baulig <martin@gnome.org>
11542 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
11543 To get debugging messages, compile mcs with /define:MCS_DEBUG and
11544 then use this argument.
11546 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
11548 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
11549 use this to specify /define options.
11551 2002-07-29 Martin Baulig <martin@gnome.org>
11553 * statement.cs (Fixed): Moved all code that does variable lookups
11554 and resolvings from Emit to Resolve.
11556 * statement.cs (For): Moved all code that does variable lookups
11557 and resolvings from Emit to Resolve.
11559 * statement.cs (Using): Moved all code that does variable lookups
11560 and resolvings from Emit to Resolve.
11562 2002-07-29 Martin Baulig <martin@gnome.org>
11564 * attribute.cs (Attribute.Resolve): Explicitly catch a
11565 System.NullReferenceException when creating the
11566 CustromAttributeBuilder and report a different warning message.
11568 2002-07-29 Martin Baulig <martin@gnome.org>
11570 * support.cs (ParameterData.ParameterName): Added method to
11571 get the name of a parameter.
11573 * typemanager.cs (TypeManager.IsValueType): New public method.
11575 2002-07-29 Martin Baulig <martin@gnome.org>
11577 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
11578 is a flag which specifies that it's either ref or out.
11579 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
11580 the out parameter to `out Parameter.Modifier mod', also set the
11581 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
11583 * support.cs (InternalParameters.ParameterModifier): Distinguish
11584 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
11585 Parameter.Modifier.ISBYREF flag if it's either ref or out.
11587 * expression.cs (Argument.GetParameterModifier): Distinguish
11588 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
11589 Parameter.Modifier.ISBYREF flag if it's either ref or out.
11591 2002-07-29 Martin Baulig <martin@gnome.org>
11593 * expression.cs (ParameterReference.ParameterReference): Added
11594 `Location loc' argument to the constructor.
11596 * cs-parser.jay: Pass location to ParameterReference.
11598 2002-07-28 Miguel de Icaza <miguel@ximian.com>
11600 * statement.cs (Try): Initialize the location.
11602 * cs-parser.jay: pass location to Try.
11604 * expression.cs (Unary.Reduce): Change the prototype to return
11605 whether a constant fold could be performed or not. The result is
11606 returned in an out parameters. In the case of Indirection and
11607 AddressOf, we want to perform the full tests.
11609 2002-07-26 Miguel de Icaza <miguel@ximian.com>
11611 * statement.cs (Statement.Emit): Flag dead code.
11613 2002-07-27 Andrew Birkett <andy@nobugs.org>
11615 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
11617 2002-07-27 Martin Baulig <martin@gnome.org>
11619 * class.cs (MethodData.Define): Put back call to
11620 TypeManager.AddMethod(), accidentally commented this out.
11622 * report.cs (Debug): New public method to print debugging information,
11623 this is `[Conditional ("DEBUG")]'.
11625 2002-07-26 Martin Baulig <martin@gnome.org>
11627 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
11628 (switch_statement): Push the current_block to the switch_stack and
11629 pop it again when we're done with the switch.
11630 (switch_section): The new block is a child of the current_block.
11631 Fixes bug #24007, added test-152.cs.
11633 2002-07-27 Martin Baulig <martin@gnome.org>
11635 * expression.cs (Invocation.EmitArguments): When calling a varargs
11636 function with only its fixed arguments, we need to pass an empty
11639 2002-07-27 Martin Baulig <martin@gnome.org>
11641 Mono 0.13 has been released.
11643 2002-07-25 Miguel de Icaza <miguel@ximian.com>
11645 * driver.cs: Rename --resource to --linkres, because that is what
11646 we do currently, we dont support --resource yet.
11648 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
11650 2002-07-25 Martin Baulig <martin@gnome.org>
11652 * class.cs (MethodData): New public class. This is a `method builder'
11653 class for a method or one accessor of a Property/Indexer/Event.
11654 (MethodData.GetMethodFlags): Moved here from MemberBase.
11655 (MethodData.ApplyAttributes): Likewise.
11656 (MethodData.ApplyObsoleteAttribute): Likewise.
11657 (MethodData.ApplyConditionalAttribute): Likewise.
11658 (MethodData.ApplyDllImportAttribute): Likewise.
11659 (MethodData.CheckAbstractAndExternal): Likewise.
11660 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
11661 (MethodData.Emit): Formerly known as Method.Emit().
11662 (MemberBase): Moved everything which was specific to a single
11663 accessor/method to MethodData.
11664 (Method): Create a new MethodData and call Define() and Emit() on it.
11665 (Property, Indexer, Event): Create a new MethodData objects for each
11666 accessor and call Define() and Emit() on them.
11668 2002-07-25 Martin Baulig <martin@gnome.org>
11670 Made MethodCore derive from MemberBase to reuse the code from there.
11671 MemberBase now also checks for attributes.
11673 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
11674 (MemberBase.GetMethodFlags): Moved here from class Method and marked
11676 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
11677 `CallingConventions cc' and `Attributes opt_attrs' arguments.
11678 (MemberBase.ApplyAttributes): New virtual method; applies the
11679 attributes to a method or accessor.
11680 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
11681 (MemberBase.ApplyConditionalAttribute): Likewise.
11682 (MemberBase.ApplyDllImportAttribute): Likewise.
11683 (MemberBase.CheckAbstractAndExternal): Likewise.
11684 (MethodCore.ParameterTypes): This is now a property instead of a
11685 method, it's initialized from DoDefineParameters().
11686 (MethodCore.ParameterInfo): Removed the set accessor.
11687 (MethodCore.DoDefineParameters): New protected virtual method to
11688 initialize ParameterTypes and ParameterInfo.
11689 (Method.GetReturnType): We can now simply return the MemberType.
11690 (Method.GetMethodFlags): Override the MemberBase version and add
11691 the conditional flags.
11692 (Method.CheckBase): Moved some code from Define() here, call
11693 DoDefineParameters() here.
11694 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
11695 here to avoid some larger code duplication.
11696 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
11697 ensure that abstract and external accessors don't declare a body.
11699 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
11700 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
11701 lookup in the attribute's parent classes, so we need to abort as soon
11702 as we found the first match.
11703 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
11704 the attribute has no arguments.
11706 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
11709 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11711 * cs-parser.jay: reverted previous patch.
11713 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11715 * cs-parser.jay: fixed bug #22119.
11717 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11719 * attribute.cs: fixed compilation. The error was:
11720 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
11721 be assigned to before control leaves the current method."
11722 [FIXME: Filed as bug #28186: MCS must report this error.]
11724 2002-07-25 Martin Baulig <martin@gnome.org>
11726 * attribute.cs (Attribute.Conditional_GetConditionName): New static
11727 method to pull the condition name ouf of a Conditional attribute.
11728 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
11729 the obsolete message and error flag out of an Obsolete attribute.
11731 * class.cs (Method.GetMethodFlags): New public method to get the
11732 TypeManager.MethodFlags for this method.
11733 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
11735 (Method.Define): Get and apply the Obsolete and Conditional attributes;
11736 if we're overriding a virtual function, set the new private variable
11737 `parent_method'; call the new TypeManager.AddMethod().
11739 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
11740 the MethodBuilder and the Method in a PtrHashtable.
11741 (TypeManager.builder_to_method): Added for this purpose.
11742 (TypeManager.MethodFlags): Added IsObsoleteError.
11743 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
11744 Obsolete and Conditional arguments in MethodBuilders. If we discover
11745 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
11746 the message from the attribute.
11748 2002-07-24 Martin Baulig <martin@gnome.org>
11750 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
11751 preprocessor directives, ensure that the argument to #define/#undef is
11752 exactly one identifier and that it's actually an identifier.
11754 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
11757 2002-07-24 Martin Baulig <martin@gnome.org>
11759 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
11760 initialize it to TypeManager.object_type in the constructor.
11761 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
11762 of the `hm.get_current' method if we're using the collection pattern.
11763 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
11764 for the explicit conversion to make it work when we're using the collection
11765 pattern and the `Current' property has a different return type than `object'.
11768 2002-07-24 Martin Baulig <martin@gnome.org>
11770 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
11771 does not match, but don't report any errors. This method is called in
11772 order for all methods in a MethodGroupExpr until a matching method is
11773 found, so we don't want to bail out if the first method doesn't match.
11774 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
11775 matches, report the 123. Fixes #28070.
11777 2002-07-24 Martin Baulig <martin@gnome.org>
11779 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
11780 TypeManager.TypeToCoreType() to the top of the method so the
11781 following equality checks will work. Fixes #28107.
11783 2002-07-24 Martin Baulig <martin@gnome.org>
11785 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
11786 operand is of type uint, and the other operand is of type sbyte,
11787 short or int, the operands are converted to type long." -
11788 Actually do what this comment already told us. Fixes bug #28106,
11791 2002-07-24 Martin Baulig <martin@gnome.org>
11793 * class.cs (MethodBase): New abstract class. This is now a base
11794 class for Property, Indexer and Event to avoid some code duplication
11795 in their Define() and DefineMethods() methods.
11796 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
11797 generic methods for Define() and DefineMethods().
11798 (FieldBase): Derive from MemberBase, not MemberCore.
11799 (Property): Derive from MemberBase, not MemberCore.
11800 (Property.DefineMethod): Moved all the code from this method to the
11801 new MethodBase.DefineAccessor(), just call it with appropriate
11803 (Property.Define): Call the new Property.DoDefine(), this does some
11804 sanity checks and we don't need to duplicate the code everywhere.
11805 (Event): Derive from MemberBase, not MemberCore.
11806 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
11807 accessors, this will also make them work with interface events.
11808 (Indexer): Derive from MemberBase, not MemberCore.
11809 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
11810 (Indexer.Define): Use the new MethodBase functions.
11812 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
11813 argument to the constructor.
11814 (Interface.FindMembers): Added support for interface events.
11815 (Interface.PopluateEvent): Implemented.
11817 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
11819 2002-07-22 Miguel de Icaza <miguel@ximian.com>
11821 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
11822 but this is required to check for a method name being the same as
11823 the containing class.
11827 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11829 * interface.cs: initialize variable.
11831 2002-07-23 Martin Baulig <martin@gnome.org>
11833 Implemented the IndexerName attribute in interfaces.
11835 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
11836 name if this is an explicit interface implementation.
11837 (Indexer.InterfaceIndexerName): New public variable. If we're
11838 implementing an interface indexer, this is the IndexerName in that
11839 interface. Otherwise, it's the IndexerName.
11840 (Indexer.DefineMethod): If we're implementing interface indexer,
11841 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
11842 and Pending.ImplementIndexer methods.
11843 (Indexer.Define): Also define the PropertyBuilder if we're
11844 implementing an interface indexer and this is neither an explicit
11845 interface implementation nor do the IndexerName match the one in
11848 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
11849 If a method is defined here, then we always need to create a proxy
11850 for it. This is used when implementing interface indexers.
11851 (Pending.IsInterfaceIndexer): New public method.
11852 (Pending.ImplementIndexer): New public method.
11853 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
11854 This is used when implementing interface indexers to define a proxy
11856 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
11857 define a proxy if necessary.
11859 * interface.cs (Interface.IndexerName): New public variable.
11860 (Interface.PopulateIndexer): Set the IndexerName.
11861 (Interface.DefineIndexers): New private method. Populate all the
11862 indexers and make sure their IndexerNames match.
11864 * typemanager.cs (IndexerPropertyName): Added support for interface
11867 2002-07-22 Martin Baulig <martin@gnome.org>
11869 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
11870 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
11871 ret if HasReturnLabel.
11872 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
11875 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
11876 and set the ec.LoopBeginTryCatchLevel.
11877 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
11878 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
11879 the current ec.TryCatchLevel, the branch goes out of an exception
11880 block. In this case, we need to use Leave and not Br.
11882 2002-07-22 Martin Baulig <martin@gnome.org>
11884 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
11885 block unless the block does not always return or it is contained in
11886 another try { ... } catch { ... } block. Fixes bug #26506.
11887 Added verify-1.cs to the test suite.
11889 2002-07-22 Martin Baulig <martin@gnome.org>
11891 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
11892 then we do not always return. Fixes bug #24985.
11894 2002-07-22 Martin Baulig <martin@gnome.org>
11896 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
11897 lookup on a per-class level; ie. walk up the class hierarchy until we
11898 found at least one applicable method, then choose the best among them.
11899 Fixes bug #24463 and test-29.cs.
11901 2002-07-22 Martin Baulig <martin@gnome.org>
11903 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
11904 return types of the methods. The return type is not part of the
11905 signature and we must not check it to make the `new' modifier work.
11906 Fixes bug #27999, also added test-147.cs.
11907 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
11909 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
11910 on the method's return type.
11912 2002-07-21 Martin Baulig <martin@gnome.org>
11914 * assign.cs: Make this work if the rightmost source is a constant and
11915 we need to do an implicit type conversion. Also adding a few more tests
11916 to test-38.cs which should have caught this.
11918 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
11919 target in the makefile for this. The makefile.gnu is primarily intended
11920 for end-users who don't want to debug the compiler.
11922 2002-07-21 Martin Baulig <martin@gnome.org>
11924 * assign.cs: Improved the Assign class so it can now handle embedded
11925 assignments (X = Y = Z = something). As a side-effect this'll now also
11926 consume less local variables. test-38.cs now passes with MCS, added
11927 a few new test cases to that test.
11929 2002-07-20 Martin Baulig <martin@gnome.org>
11931 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
11932 instructions. Fixes bug #27977, also added test-146.cs.
11934 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11936 * cs-tokenizer.cs: fixed getHex ().
11938 2002-07-19 Martin Baulig <martin@gnome.org>
11940 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
11941 not Type.GetType() to lookup the array type. This is needed when
11942 we're constructing an array of a user-defined type.
11943 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
11944 single-dimensional arrays, but also for single-dimensial arrays of
11947 2002-07-19 Martin Baulig <martin@gnome.org>
11949 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
11950 this function is called, it's not allowed to share LocalBuilders
11951 among ILGenerators.
11953 2002-07-19 Martin Baulig <martin@gnome.org>
11955 * expression.cs (Argument.Resolve): Report an error 118 when trying
11956 to pass a type as argument.
11958 2002-07-18 Martin Baulig <martin@gnome.org>
11960 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
11961 Conv_R_Un for the signed `long' type.
11963 2002-07-15 Miguel de Icaza <miguel@ximian.com>
11965 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
11966 `expr' for the temporary result, as that will fail if we do
11967 multiple resolves on the same expression.
11969 2002-07-05 Miguel de Icaza <miguel@ximian.com>
11971 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
11972 ec.TypeContainer for looking up aliases.
11974 * class.cs (TypeContainer): Remove LookupAlias from here.
11976 * decl.cs (DeclSpace); Move here.
11978 2002-07-01 Miguel de Icaza <miguel@ximian.com>
11980 * class.cs (FindMembers): Only call filter if the constructor
11981 bulider is not null.
11983 Also handle delegates in `NestedTypes' now. Now we will perform
11984 type lookups using the standard resolution process. This also
11987 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
11988 This uses Expressions (the limited kind that can be parsed by the
11989 tree) instead of strings.
11991 * expression.cs (ComposedCast.ToString): Implement, used to flag
11992 errors since now we have to render expressions.
11994 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
11997 * ecore.cs (SimpleName.ToString): ditto.
11999 * cs-parser.jay: Instead of using strings to assemble types, use
12000 Expressions to assemble the type (using SimpleName, ComposedCast,
12001 MemberAccess). This should fix the type lookups in declarations,
12002 because we were using a different code path for this.
12004 * statement.cs (Block.Resolve): Continue processing statements
12005 even when there is an error.
12007 2002-07-17 Miguel de Icaza <miguel@ximian.com>
12009 * class.cs (Event.Define): Also remove the `remove' method from
12010 the list of pending items.
12012 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
12013 generate more compact code.
12015 2002-07-17 Martin Baulig <martin@gnome.org>
12017 * const.cs (Const.LookupConstantValue): Add support for constant
12018 `unchecked' and `checked' expressions.
12019 Also adding test case test-140.cs for this.
12021 2002-07-17 Martin Baulig <martin@gnome.org>
12023 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
12024 check whether mi.ReturnType implements the IEnumerator interface; the
12025 `==' and the IsAssignableFrom() will fail in this situation.
12027 2002-07-16 Ravi Pratap <ravi@ximian.com>
12029 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
12032 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12034 * expression.cs: fixed bug #27811.
12036 2002-07-14 Miguel de Icaza <miguel@ximian.com>
12038 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
12039 Molaro: when we are a ref, the value already contains a pointer
12040 value, do not take the address of it.
12042 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
12043 * removed mb-parser.jay and mb-tokenizer.cs
12045 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
12047 * expression.cs: check against the building corlib void type.
12049 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
12051 * ecore.cs: fix for valuetype static readonly fields: when
12052 initializing them, we need their address, not the address of a copy.
12054 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
12056 * typemanager.cs: register also enum_type in corlib.
12058 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
12060 * class.cs: allow calling this (but not base) initializers in structs.
12062 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
12064 * ecore.cs: make sure we compare against the building base types
12067 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
12069 * typemanager.cs: fix TypeToCoreType() to handle void and object
12070 (corlib gets no more typerefs after this change).
12072 2002-07-12 Miguel de Icaza <miguel@ximian.com>
12074 * expression.cs (ArrayCreation.EmitArrayArguments): use
12075 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
12077 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
12078 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
12079 array indexes, the runtime actually forbids them.
12081 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
12082 for array arguments here.
12084 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
12085 instead of the default for ValueTypes.
12087 (New.DoEmit): Use IsValueType instead of
12088 IsSubclassOf (value_type)
12089 (New.DoResolve): ditto.
12090 (Invocation.EmitCall): ditto.
12092 * assign.cs (Assign): ditto.
12094 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
12095 Statements *are* currently doing part of their resolution during
12098 Expressions do always resolve during resolve, but statements are
12099 only required to propagate resolution to their children.
12101 2002-07-11 Miguel de Icaza <miguel@ximian.com>
12103 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
12105 (LoadAssembly): Do not add the dll if it is already specified
12107 (MainDriver): Add the System directory to the link path at the end,
12108 after all the other -L arguments.
12110 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
12111 wrong opcode for loading bytes and bools (ldelem.i1 instead of
12112 ldelem.u1) and using the opposite for sbytes.
12114 This fixes Digger, and we can finally run it.
12116 * driver.cs (UnixParseOption): Move the option parsing here.
12117 (CSCParseOption): Implement CSC-like parsing of options.
12119 We now support both modes of operation, the old Unix way, and the
12120 new CSC-like way. This should help those who wanted to make cross
12121 platform makefiles.
12123 The only thing broken is that /r:, /reference: and /lib: are not
12124 implemented, because I want to make those have the same semantics
12125 as the CSC compiler has, and kill once and for all the confussion
12126 around this. Will be doing this tomorrow.
12128 * statement.cs (Unsafe.Resolve): The state is checked during
12129 resolve, not emit, so we have to set the flags for IsUnsfe here.
12131 2002-07-10 Miguel de Icaza <miguel@ximian.com>
12133 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
12134 not catch the Error_ObjectRefRequired in SimpleName (as it is
12135 possible to have a class/instance variable name that later gets
12136 deambiguated), we have to check this here.
12138 2002-07-10 Ravi Pratap <ravi@ximian.com>
12140 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
12141 make static and put into Expression.
12143 (Event.Define): Register the private field of the event with the
12144 TypeManager so that GetFieldFromEvent can get at it.
12146 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
12147 keep track of the private field associated with an event which
12150 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
12153 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
12155 2002-07-10 Miguel de Icaza <miguel@ximian.com>
12157 * expression.cs (Binary.EmitBranchable): this routine emits the
12158 Binary expression in a branchable context. This basically means:
12159 we need to branch somewhere, not just get the value on the stack.
12161 This works together with Statement.EmitBoolExpression.
12163 * statement.cs (Statement.EmitBoolExpression): Use
12166 2002-07-09 Miguel de Icaza <miguel@ximian.com>
12168 * statement.cs (For): Reduce the number of jumps in loops.
12170 (For): Implement loop inversion for the For statement.
12172 (Break): We can be breaking out of a Try/Catch controlled section
12173 (foreach might have an implicit try/catch clause), so we need to
12174 use Leave instead of Br.
12176 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
12177 now). If the instace expression supports IMemoryLocation, we use
12178 the AddressOf method from the IMemoryLocation to extract the
12179 address instead of emitting the instance.
12181 This showed up with `This', as we were emitting the instance
12182 always (Emit) instead of the Address of This. Particularly
12183 interesting when This is a value type, as we dont want the Emit
12184 effect (which was to load the object).
12186 2002-07-08 Miguel de Icaza <miguel@ximian.com>
12188 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
12190 * statement.cs (Checked): Set the CheckedState during the resolve
12191 process too, as the ConvCast operations track the checked state on
12192 the resolve process, and not emit.
12194 * cs-parser.jay (namespace_member_declaration): Flag that we have
12195 found a declaration when we do. This is used to flag error 1529
12197 * driver.cs: Report ok when we display the help only.
12199 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
12201 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
12203 2002-07-04 Miguel de Icaza <miguel@ximian.com>
12205 * cs-tokenizer.cs (define): We also have to track locally the
12206 defines. AllDefines is just used for the Conditional Attribute,
12207 but we also need the local defines for the current source code.
12209 2002-07-03 Miguel de Icaza <miguel@ximian.com>
12211 * statement.cs (While, For, Do): These loops can exit through a
12212 Break statement, use this information to tell whether the
12213 statement is the last piece of code.
12215 (Break): Flag that we break.
12217 * codegen.cs (EmitContexts): New `Breaks' state variable.
12219 2002-07-03 Martin Baulig <martin@gnome.org>
12221 * class.cs (TypeContainer.MethodModifiersValid): Allow override
12222 modifiers in method declarations in structs. Otherwise, you won't
12223 be able to override things like Object.Equals().
12225 2002-07-02 Miguel de Icaza <miguel@ximian.com>
12227 * class.cs (Method, Property, Indexer): Do not allow the public
12228 modifier to be used in explicit interface implementations.
12230 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
12231 override modifiers in method declarations in structs
12233 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
12235 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
12236 integer or real overflow, report an error
12238 2002-07-02 Martin Baulig <martin@gnome.org>
12240 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
12241 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
12242 to tell the runtime about our newly created System.Object and
12243 System.ValueType types.
12245 2002-07-02 Miguel de Icaza <miguel@ximian.com>
12247 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
12248 struct instead of Ldarg/Starg.
12250 2002-07-02 Martin Baulig <martin@gnome.org>
12252 * expression.cs (Indirection.Indirection): Call
12253 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
12255 2002-07-02 Martin Baulig <martin@gnome.org>
12257 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
12258 ValueType, call TypeManager.TypeToCoreType() on it.
12259 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
12260 the OpCodes.Newarr argument.
12262 2002-07-02 Martin Baulig <martin@gnome.org>
12264 * expression.cs (Invocation.EmitCall): When compiling corlib,
12265 replace all calls to the system's System.Array type to calls to
12266 the newly created one.
12268 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
12269 System.Array methods.
12270 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
12271 from the system's System.Array type which must be replaced.
12273 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
12275 * typemanager.cs: load unverifiable_code_ctor so we can build
12276 corlib using the correct type. Avoid using GetTypeCode() with
12278 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
12279 TypeManager.object_type to allow building corlib.
12281 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
12283 * ecore.cs: handle System.Enum separately in LoadFromPtr().
12285 2002-07-01 Martin Baulig <martin@gnome.org>
12287 * class.cs: Make the last change actually work, we need to check
12288 whether `ifaces != null' to avoid a crash.
12290 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
12292 * class.cs: when we build structs without fields that implement
12293 interfaces, we need to add the interfaces separately, since there is
12294 no API to both set the size and add the interfaces at type creation
12297 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
12299 * expression.cs: the dimension arguments to the array constructors
12300 need to be converted if they are a long.
12302 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
12304 * class.cs: don't emit ldarg.0 if there is no parent constructor
12305 (fixes showstopper for corlib).
12307 2002-06-29 Martin Baulig <martin@gnome.org>
12309 MCS now compiles corlib on GNU/Linux :-)
12311 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
12312 ie. check for MethodImplOptions.InternalCall.
12314 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
12315 and TypeManager.attribute_type are null, so we must explicitly check
12316 whether parent is not null to find out whether it's an attribute type.
12317 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
12318 and SetBuilder, not only if the property is neither abstract nor external.
12319 This is necessary to set the MethodImplOptions on the accessor methods.
12320 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
12321 SetBuilder, see Property.Emit().
12323 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
12324 populate "System.Object", "System.ValueType" and "System.Attribute" since
12325 they've already been populated from BootCorlib_PopulateCoreTypes().
12327 2002-06-29 Martin Baulig <martin@gnome.org>
12329 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
12330 is the NullLiteral, we also need to make sure that target_type is not
12333 2002-06-29 Martin Baulig <martin@gnome.org>
12335 * rootcontext.cs (RootContext.ResolveCore): We must initialize
12336 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
12337 before calling BootstrapCorlib_ResolveDelegate ().
12339 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12341 * statement.cs: fixed build-breaker. All tests passed ok.
12343 2002-06-27 Martin Baulig <martin@gnome.org>
12345 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
12346 for System.Decimal when compiling corlib.
12348 2002-06-27 Martin Baulig <martin@gnome.org>
12350 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
12351 switch blocks which contain nothing but a default clause.
12353 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
12355 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
12357 2002-06-27 Martin Baulig <martin@gnome.org>
12359 * ecore.cs (PropertyExpr.PropertyExpr): Call
12360 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
12362 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
12363 is already a TypeBuilder.
12365 2002-06-27 Martin Baulig <martin@gnome.org>
12367 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
12368 `target_type == TypeManager.array_type', not IsAssignableFrom() in
12369 the "from an array-type to System.Array" case. This makes it work
12370 when compiling corlib.
12372 2002-06-27 Martin Baulig <martin@gnome.org>
12374 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
12375 non-static PropertyExpr, set its InstanceExpression. This makes
12376 the `ICollection.Count' property work in System/Array.cs.
12378 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
12380 * driver.cs: Made error handling more consistent. Errors now
12381 tracked by Report class, so many methods which used to return int
12382 now return void. Main() now prints success/failure and
12383 errors/warnings message.
12385 Renamed '--probe' compiler argument to '--expect-error'. Removed
12386 the magic number return values (123 and 124). Now, if the
12387 expected error occurs, the compiler exits with success (exit value
12388 0). If the compilation completes without seeing that particular
12389 error, the compiler exits with failure (exit value 1). The
12390 makefile in mcs/errors has been changed to handle the new behaviour.
12392 * report.cs: Made 'expected error' number a property and renamed
12393 it from 'Probe' to 'ExpectedError'.
12395 * genericparser.cs: Removed error handling support, since it is
12396 now all done by Report class.
12398 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
12399 class, so parse() no longer returns an int.
12401 * namespace.cs: Use Report.Error instead of GenericParser.error
12403 2002-06-22 Miguel de Icaza <miguel@ximian.com>
12405 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
12406 TypeContainer.AddOperator): At the front of the list put the
12407 explicit implementations, so they get resolved/defined first.
12409 2002-06-21 Miguel de Icaza <miguel@ximian.com>
12411 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
12412 interface type is implemented by this TypeContainer. Used during
12413 explicit interface implementation.
12415 (Property.Define, Indexer.Define, Method.Define): Validate that
12416 the given interface in the explicit implementation is one of the
12417 base classes for the containing type.
12419 Also if we are explicitly implementing an interface, but there is
12420 no match in the pending implementation table, report an error.
12422 (Property.Define): Only define the property if we are
12423 not explicitly implementing a property from an interface. Use the
12424 correct name also for those properties (the same CSC uses,
12425 although that is really not needed).
12427 (Property.Emit): Do not emit attributes for explicitly implemented
12428 properties, as there is no TypeBuilder.
12430 (Indexer.Emit): ditto.
12432 Hiding then means that we do not really *implement* a pending
12433 implementation, which makes code fail.
12435 2002-06-22 Martin Baulig <martin@gnome.org>
12437 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
12438 the return value of Object.GetType(). [FIXME: we need to do this whenever
12439 we get a type back from the reflection library].
12441 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
12443 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
12445 2002-06-20 Miguel de Icaza <miguel@ximian.com>
12447 * attribute.cs: Return null if we can not look up the type.
12449 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
12450 the interface types found.
12452 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
12453 interface types found.
12455 * typemanager.cs (GetInterfaces): Make this routine returns alll
12456 the interfaces and work around the lame differences between
12457 System.Type and System.Reflection.Emit.TypeBuilder in the results
12458 result for GetInterfaces.
12460 (ExpandInterfaces): Given an array of interface types, expand and
12461 eliminate repeated ocurrences of an interface. This expands in
12462 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
12465 2002-06-21 Martin Baulig <martin@gnome.org>
12467 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
12470 2002-06-21 Martin Baulig <martin@gnome.org>
12472 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
12473 and called with one of the core types, return the corresponding typebuilder for
12476 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
12479 2002-06-21 Martin Baulig <martin@gnome.org>
12481 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
12482 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
12483 (Expression.ConvertReferenceExplicit): Likewise.
12485 * expression.cs (ElementAccess.DoResolve): Likewise.
12486 (ElementAccess.DoResolveLValue): Likewise.
12488 2002-06-10 Martin Baulig <martin@gnome.org>
12490 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
12491 add the "value" parameter to the parameter list.
12493 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
12496 2002-06-19 Miguel de Icaza <miguel@ximian.com>
12498 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
12499 the argument to an int, uint, long or ulong, per the spec. Also
12500 catch negative constants in array creation.
12502 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
12504 * class.cs: do not allow the same interface to appear twice in
12505 the definition list.
12507 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
12509 * ecore.cs: don't use ldlen with System.Array.
12511 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
12513 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
12515 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
12517 * modifiers.cs: produce correct field attributes for protected
12518 internal. Easy fix so miguel can work on ther harder stuff:-)
12520 2002-06-18 Miguel de Icaza <miguel@ximian.com>
12522 * pending.cs: New file. Move the code from class.cs here.
12523 Support clearning the pending flag for all methods (when not doing
12524 explicit interface implementation).
12526 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
12528 * rootcontext.cs: added a couple more types needed to bootstrap.
12530 2002-06-17 Miguel de Icaza <miguel@ximian.com>
12532 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
12533 constructor in the type, instead of any constructor in the type
12534 hierarchy. Thanks to Paolo for finding this bug (it showed up as
12535 a bug in the Mono runtime when applying the params attribute).
12537 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
12538 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
12540 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
12542 * expression.cs (Unary.ResolveOperator): Use TypeManager
12543 to resolve the type.
12545 2002-06-13 Ravi Pratap <ravi@ximian.com>
12547 * cs-parser.jay (enum_member_declaration): Pass in the attributes
12550 * enum.cs (AddEnumMember): Add support to store the attributes associated
12551 with each member too.
12553 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
12554 field builders too - this takes care of the enum member case.
12556 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
12558 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
12559 address-of operator on both value types and pointers.
12561 2002-06-10 Martin Baulig <martin@gnome.org>
12563 * interface.cs (Interface.PopulateIndexer): Add the indexer's
12564 PropertyBuilder to the `property_builders' list.
12566 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
12567 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
12568 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
12569 find any indexers which are inherited from an interface.
12571 2002-06-09 Martin Baulig <martin@gnome.org>
12573 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
12574 the same type as the constant if necessary. There's also a test-130.cs
12577 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
12579 * typemanager.cs (TypeManager.ChangeType): Previously known as
12580 Enum.ChangeEnumType().
12582 2002-06-09 Martin Baulig <martin@gnome.org>
12584 * expression.cs (Cast.TryReduce): Added support for consts.
12586 2002-06-08 Ravi Pratap <ravi@ximian.com>
12588 * class.cs (Accessor): Hold attributes information so we can pass
12591 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
12592 Modify to pass in attributes attached to the methods.
12594 (add_accessor_declaration, remove_accessor_declaration): Ditto.
12596 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
12597 to handle the Accessor kind :-)
12599 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
12601 2002-06-08 Martin Baulig <martin@gnome.org>
12603 * expression.cs (Unary.TryReduceNegative): Added support for
12606 2002-06-08 Martin Baulig <martin@gnome.org>
12608 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
12609 name can't be found in the `defined_names' - the caller will do a
12610 MemberLookup in this case and thus find methods in System.Enum
12611 such as Enum.IsDefined().
12613 2002-06-08 Martin Baulig <martin@gnome.org>
12615 * enum.cs (Enum.ChangeEnumType): This is a custom version of
12616 Convert.ChangeType() which works with TypeBuilder created types.
12617 (Enum.LookupEnumValue, Enum.Define): Use it here.
12619 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
12620 `TypeBuilder.BaseType != null' check.
12621 (TypeContainer.FindMembers): Only lookup parent members if we
12622 actually have a parent.
12623 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
12624 (ConstructorInitializer.Resolve): Likewise.
12626 * interface.cs (Interface.FindMembers): Added
12627 `TypeBuilder.BaseType != null' check.
12629 * rootcontext.cs (RootContext.ResolveCore): Added
12630 "System.Runtime.CompilerServices.IndexerNameAttribute" to
12631 classes_second_stage.
12633 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
12634 debug_type and trace_type when compiling with --nostdlib.
12636 2002-06-07 Martin Baulig <martin@gnome.org>
12638 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
12639 (AddField): Set it to true when adding a non-static field.
12640 (DefineType): Use `have_nonstatic_fields' to find out whether we
12641 have non-static fields, not `Fields != null'.
12643 2002-06-02 Miguel de Icaza <miguel@ximian.com>
12645 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
12646 dereferencing a null on the static-field code path)
12648 2002-05-30 Martin Baulig <martin@gnome.org>
12650 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
12651 to take command line arguments. Use reflection to call the new
12652 custom `Initialize' function on the symbol writer and pass it the
12653 command line arguments.
12655 * driver.cs (--debug-args): New command line argument to pass command
12656 line arguments to the symbol writer.
12658 2002-05-28 Miguel de Icaza <miguel@ximian.com>
12660 * assign.cs (DoResolve): Forgot to do the implicit conversion to
12661 the target type for indexers and properties. Thanks to Joe for
12664 2002-05-27 Miguel de Icaza <miguel@ximian.com>
12666 * typemanager.cs (MethodFlags): returns the method flags
12667 (Obsolete/ShouldIgnore) that control warning emission and whether
12668 the invocation should be made, or ignored.
12670 * expression.cs (Invocation.Emit): Remove previous hack, we should
12671 not do this on matching a base type, we should do this based on an attribute
12673 Only emit calls to System.Diagnostics.Debug and
12674 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
12675 on the command line.
12677 * rootcontext.cs: Global settings for tracing and debugging.
12679 * cs-tokenizer.cs (define): New utility function to track
12680 defines. Set the global settings for TRACE and DEBUG if found.
12682 2002-05-25 Ravi Pratap <ravi@ximian.com>
12684 * interface.cs (Populate*): Pass in the TypeContainer as well as
12685 the DeclSpace as parameters so that we can create EmitContexts and
12686 then use that to apply attributes etc.
12688 (PopulateMethod, PopulateEvent, PopulateProperty)
12689 (PopulateIndexer): Apply attributes everywhere.
12691 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
12694 (ApplyAttributes): Update accordingly.
12696 We now apply interface attributes for all members too.
12698 2002-05-26 Miguel de Icaza <miguel@ximian.com>
12700 * class.cs (Indexer.Define); Correctly check if we are explicit
12701 implementation (instead of checking the Name for a ".", we
12702 directly look up if the InterfaceType was specified).
12704 Delay the creation of the PropertyBuilder.
12706 Only create the PropertyBuilder if we are not an explicit
12707 interface implementation. This means that explicit interface
12708 implementation members do not participate in regular function
12709 lookups, and hence fixes another major ambiguity problem in
12710 overload resolution (that was the visible effect).
12712 (DefineMethod): Return whether we are doing an interface
12715 * typemanager.cs: Temporary hack until we get attributes in
12716 interfaces (Ravi is working on that) and we get IndexerName
12717 support in interfaces.
12719 * interface.cs: Register the indexers as properties.
12721 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
12722 warning, I have verified that this is a bug in the .NET runtime
12723 (JavaScript suffers of the same problem).
12725 * typemanager.cs (MemberLookup): When looking up members for
12726 interfaces, the parent of an interface is the implicit
12727 System.Object (so we succeed in searches of Object methods in an
12728 interface method invocation. Example: IEnumerable x; x.ToString
12731 2002-05-25 Miguel de Icaza <miguel@ximian.com>
12733 * class.cs (Event): Events should also register if they do
12734 implement the methods that an interface requires.
12736 * typemanager.cs (MemberLookup); use the new GetInterfaces
12739 (GetInterfaces): The code used to lookup interfaces for a type is
12740 used in more than one place, factor it here.
12742 * driver.cs: Track the errors at the bottom of the file, we kept
12745 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
12746 instance if the method we are calling is static!
12748 2002-05-24 Miguel de Icaza <miguel@ximian.com>
12750 * attribute.cs (ApplyAttributes): Make this function filter out
12751 the IndexerName attribute (as that attribute in reality is never
12752 applied) and return the string constant for the IndexerName
12755 * class.cs (TypeContainer.Emit): Validate that all the indexers
12756 have the same IndexerName attribute, and if so, set the
12757 DefaultName attribute on the class.
12759 * typemanager.cs: The return value might contain other stuff (not
12760 only methods). For instance, consider a method with an "Item"
12761 property and an Item method.
12763 * class.cs: If there is a problem with the parameter types,
12766 2002-05-24 Ravi Pratap <ravi@ximian.com>
12768 * ecore.cs (ImplicitConversionExists): Wrapper function which also
12769 looks at user defined conversion after making a call to
12770 StandardConversionExists - we need this for overload resolution.
12772 * expression.cs : Update accordingly the various method calls.
12774 This fixes 2 bugs filed against implicit user defined conversions
12776 2002-05-22 Miguel de Icaza <miguel@ximian.com>
12778 * statement.cs: Track the result of the assignment.
12780 2002-05-21 Miguel de Icaza <miguel@ximian.com>
12782 * expression.cs (MemberAccess): Improved error reporting for
12783 inaccessible members.
12785 2002-05-22 Martin Baulig <martin@gnome.org>
12787 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
12788 itself with debugging support.
12790 2002-05-22 Martin Baulig <martin@gnome.org>
12792 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
12793 Removed, this isn't needed anymore.
12795 2002-05-20 Martin Baulig <martin@gnome.org>
12797 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
12798 be underlying type for an enum.
12800 2002-05-20 Miguel de Icaza <miguel@ximian.com>
12802 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
12803 that splits out the loading of just the core types.
12805 * rootcontext.cs (ResolveCore): Split the struct resolution in
12806 two, so we can load the enumeration underlying types before any
12809 * expression.cs (Is): Bandaid until we fix properly Switch (see
12810 bug #24985 for details).
12812 * typemanager.cs (ImplementsInterface): The hashtable will contain
12813 a null if there are no interfaces implemented.
12815 2002-05-18 Miguel de Icaza <miguel@ximian.com>
12817 * cs-parser.jay (indexer_declarator): It is fine to have array
12820 2002-05-17 Miguel de Icaza <miguel@ximian.com>
12822 * typemanager.cs: (RegisterBuilder): New function used to register
12823 TypeBuilders that implement interfaces. Since
12824 TypeBuilder.GetInterfaces (as usual) does not work with lame
12826 (AddUserType): register interfaces.
12828 (ImplementsInterface): Use the builder_to_ifaces hash if we are
12829 dealing with TypeBuilder. Also, arrays are showing up as
12830 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
12831 methods can not be invoked on them!
12833 * ecore.cs (ExplicitReferenceConversionExists): Made public.
12834 (ImplicitReferenceConversionExists): Split out from
12835 StandardConversionExists.
12837 * expression.cs (As): We were only implementing one of the three
12838 cases for the as operator. We now implement them all.
12839 (Is): Implement the various other cases for Is as well.
12841 * typemanager.cs (CACHE): New define used to control if we want or
12842 not the FindMembers cache. Seems to have a negative impact on
12843 performance currently
12845 (MemberLookup): Nested types have full acess to
12846 enclosing type members
12848 Remove code that coped with instance/static returns for events, we
12849 now catch this in RealFindMembers.
12851 (RealFindMembers): only perform static lookup if the instance
12852 lookup did not return a type or an event.
12854 2002-05-17 Miguel de Icaza <miguel@ximian.com>
12856 * assign.cs (CompoundAssign): We pass more semantic information
12857 now to Compound Assignments than we did before: now we have all
12858 the information at hand, and now we resolve the target *before* we
12859 do the expression expansion, which allows the "CacheValue" method
12860 to have the effect we intended (before, a [x] += 1 would generate
12861 two differen ArrayAccess expressions from the ElementAccess,
12862 during the resolution process).
12864 (CompoundAssign.DoResolve): Resolve target and original_source here.
12866 2002-05-16 Miguel de Icaza <miguel@ximian.com>
12868 * expression.cs (ArrayAccess): dropped debugging information.
12870 * typemanager.cs: Small bug fix: I was always returning i_members,
12871 instead of one of i_members or s_members (depending on which had
12874 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
12875 method is invoked before any code generation takes place, and it
12876 is a mechanism to inform that the expression will be invoked more
12877 than once, and that the method should use temporary values to
12878 avoid having side effects
12880 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
12882 * ecore.cs (Expression.CacheTemporaries): Provide empty default
12885 * expression.cs (Indirection, ArrayAccess): Add support for
12886 CacheTemporaries in these two bad boys.
12888 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
12889 ldobj or ldind_ref.
12890 (StoreFromPtr): Handle stobj as well.
12892 * expression.cs (UnaryMutator): Share more code.
12894 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
12895 down: I was not tracking the Filter function as well, which
12896 was affecting the results of the cache.
12898 2002-05-15 Miguel de Icaza <miguel@ximian.com>
12900 * attribute.cs: Remove the hack to handle the CharSet property on
12903 2002-05-14 Miguel de Icaza <miguel@ximian.com>
12905 * attribute.cs (DoResolve): More uglyness, we now only try to
12906 resolve the attribute partially, to extract the CharSet
12907 information (only if we are a StructLayout attribute). Otherwise
12909 (GetExtraTypeInfo): Add some code to conditionally kill in the
12910 future this. I am more and more convinced that the .NET
12911 framework has special code to handle the attribute setting on
12914 * expression.cs (IsParamsMethodApplicable): Revert my previous
12915 foreach change here, it was wrong.
12917 2002-05-13 Miguel de Icaza <miguel@ximian.com>
12919 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
12920 (pp_expr): do not abort on unknown input, just return.
12921 (eval): abort if there are pending chars.
12923 * attribute.cs (Attribute.Resolve): Positional parameters are
12924 optional. Deal with that case.
12926 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
12927 the Ansi/Unicode/Auto information for the type.
12929 (TypeContainer.DefineType): instantiate the EmitContext here, as
12930 we will be using it during the type definition (to resolve
12931 attributes) and during the emit phase.
12933 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
12934 to pull type information out of the attributes
12936 (Attribute.Resolve): track the constructor builder, and allow for
12937 multiple invocations (structs and classes will use this).
12939 * ecore.cs (MemberLookupFinal): new version with all the
12940 parameters customizable.
12942 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
12943 constructors. Return if the result value is null (as the error
12944 would have been flagged already by MemberLookupFinal)
12946 Do not allow instances of abstract classes or interfaces to be
12949 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
12950 We have to compare the assembly property here when dealing with
12951 FamANDAssem and Assembly access modifiers, because we might be
12952 creating an assembly from *modules* (that means that we are not
12953 getting TypeBuilders for types defined in other modules that are
12954 part of this assembly).
12956 (Method.Emit): If the method is marked abstract and has a body,
12959 (TypeContainer.DefineMembers): If both the defined member and the
12960 parent name match are methods, then do not emit any warnings: let
12961 the Method.Define routine take care of flagging warnings. But if
12962 there is a mismatch (method overrides something else, or method is
12963 overriwritten by something, then emit warning).
12965 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
12966 set to null, this means `do not check for the return type on the
12969 (Method.Define): set the return type for the method signature to
12970 null, so that we get methods with the same name and parameters and
12971 different return types. This is used to flag warning 114 (you are
12972 hiding a method, and you probably want to use the new/override
12975 * typemanager.cs (MemberLookup): Implemented proper access
12976 control, closing a long standing set of bug reports. The problem
12977 was that the Framework only has two bits: Public and NonPublic,
12978 and NonPublic includes private and protected methods, but we need
12979 to enforce the FamANDAssem, FamOrAssem and Family.
12981 2002-05-11 Miguel de Icaza <miguel@ximian.com>
12983 * statement.cs (GotoCase): Return true: Ammounts to giving up
12984 knowledge on whether we return or not, and letting the other case
12985 be responsible for it.
12987 2002-05-10 Miguel de Icaza <miguel@ximian.com>
12989 * driver.cs: Do not load directories for each file processed, only
12990 do it if there is a pattern.
12992 * ecore.cs: Report readonly assigns here as well, as we might have
12993 been resolved only by MemberAccess.
12995 (SimpleName.SimpleNameResolve): Also be useful for LValue
12996 resolution. We need this to propagate assign to local readonly variables
12998 * typemanager.cs: Use a ptrhashtable for the criteria, because we
12999 do not want to reuse potential criteria memory.
13001 * class.cs (MyEventBuilder): Set reflected_type;
13003 * ecore.cs (Constantify): Added support for constifying bools.
13005 (RootContext.LookupType): Added a cache for values looked up in
13006 the declaration space.
13008 * typemanager.cs (FindMembers): Now is a front-end to
13009 RealFindMembers, and provides a two-level hashtable-based cache to
13012 15% performance improvement: from 22.5 to 19.2 seconds.
13014 * expression.cs (IsParamsMethodApplicable): use foreach.
13015 (Invocation.DoResolve): ditto.
13016 (New.DoResolve): ditto.
13017 (ArrayCreation.DoResolve): ditto.
13019 * ecore.cs (FindMostEncompassingType): use foreach.
13021 * delegate.cs (NewDelegate.DoResolve): Use foreach
13023 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
13024 (RemoveMethods): use foreach.
13026 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
13027 nested foreach statements instead of for, and also break out of
13028 the inner loop once a match is found.
13030 (Invocation.OverloadResolve): Use foreach, simplify the code.
13032 2002-05-08 Miguel de Icaza <miguel@ximian.com>
13034 * cfold.cs (BinaryFold): During an enumeration evaluation context,
13035 we actually unwrap the expression to allow for extra information
13038 * expression.cs: Use Shr_Un on unsigned operations.
13040 2002-05-08 Ravi Pratap <ravi@ximian.com>
13042 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
13043 applicable operators was not being considered correctly. This closes
13044 the bug Miguel reported.
13046 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
13048 * attribute.cs: check that the type derives from System.Attribute
13049 and report the correct error in that case (moved the duplicate code to
13050 its own method, too).
13052 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
13054 * attribute.cs: lookup attribute type name as the spec says: first the
13055 bare attribute name and then name + "Attribute" (nant compiles with
13056 mcs after this fix).
13058 2002-05-07 Miguel de Icaza <miguel@ximian.com>
13060 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
13061 Because of the way we parse things, we should try to see if a
13062 UIntConstant can fit in an integer.
13064 2002-05-07 Ravi Pratap <ravi@ximian.com>
13066 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
13067 when we are in an explicit context.
13069 (ConvertReferenceExplicit): When converting from Iface type S to Class
13070 T make sure the rules are implemented as an OR.
13072 * parameter.cs (ParameterType): Make it a property for now although the
13073 purpose really isn't anything immediate.
13075 * expression.cs (Is*Applicable): Do better checking on the parameter type
13076 of a ref/out parameter. The ones from the system assemblies are already
13077 marked with the correct type so we don't need to do any correction.
13079 * ecore.cs (StandardConversionExists): Conversion from Interface types to
13080 the object type is standard too so include that.
13082 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13084 * ecore.cs (StandardConversionExists): Augment with missing code:
13085 deal with IntConstant, LongConstants and Enumerations.
13087 * assign.cs: Report the error, instead of failing silently
13089 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
13090 typecontainer that they are declared, because the
13091 typecontainer/namespace will have the list of using clauses that
13092 need to be applied.
13094 Assembly Attributes were escaping the normal registration
13097 (EmitCode): Apply attributes within an EmitContext that represents
13098 the container they were declared on.
13100 * cs-parser.jay: Track bases for structs. How did I get this wrong?
13102 2002-05-06 Ravi Pratap <ravi@ximian.com>
13104 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
13105 Revamp completely - make much cleaner as we now operate only
13108 (FindMostSpecificSource, FindMostSpecificTarget): New methods
13109 to implement the logic detailed in the spec more correctly.
13111 (UserDefinedConversion): Update accordingly.
13113 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13115 * statement.cs: Return flow analysis information up.
13117 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
13120 (token): Do not consume an extra character before calling
13123 2002-05-06 Piers Haken <piersh@friskit.com>
13125 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
13127 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13129 * class.cs (Constructor.Emit): Set the IsStatic flag in the
13130 EmitContext during the instance constructor initializer
13131 resolution, to stop access to instance variables.
13133 This is mandated by the spec, last paragraph of the `constructor
13134 initializers' section.
13136 2002-05-05 Miguel de Icaza <miguel@ximian.com>
13138 * cs-parser.jay, class.cs (Accessor): new class used to represent
13139 an accessor (get or set). In the past we used `null' to represent
13140 a missing accessor. But this is ambiguous because there was no
13141 way to tell in abstract indexers/properties if one of them was
13144 Now there is a way of addressing that.
13146 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
13147 instead of FindMembers.
13149 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
13150 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
13152 * attribute.cs: Treat indexers and properties as the same in terms
13153 of applying attributes
13155 * ecore.cs (FindMostEncompassedType): Use statically initialized
13156 EmptyExpressions()s like we do elsewhere to avoid creating useless
13157 objects (and we take this out of the tight loop).
13159 (GetConversionOperators): Move the code to extract the actual
13160 operators to a separate routine to clean things up.
13162 2002-05-04 Miguel de Icaza <miguel@ximian.com>
13164 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
13165 events are always registered FieldBuilders.
13167 * class.cs (FieldBase): New class shared by Fields
13169 * delegate.cs: If we are a toplevel delegate, use our full name.
13170 If we are a nested delegate, then only use our tail name.
13172 2002-05-02 Ravi Pratap <ravi@ximian.com>
13174 * expression.cs (IsApplicable): Ensure that we add the "&" to
13175 ref/out types before comparing it with the type of the argument.
13177 (IsParamsMethodApplicable): Ditto.
13179 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
13182 * delegate.cs : Handle the case when we have more than one applicable
13183 method. Flag an error only when we finish checking all.
13185 2002-05-02 Miguel de Icaza <miguel@ximian.com>
13187 * expression.cs: Add support for boolean static initializers.
13189 2002-05-01 Miguel de Icaza <miguel@ximian.com>
13191 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
13193 * parameter.cs (ComputeParameterTypes,
13194 ComputeAndDefineParameterTypes): Better error handling: now we
13195 clear the `types' cache if we fail during any of the type lookups.
13196 We also return the status code correctly to our caller
13198 * delegate.cs: If we fail to define a delegate, abort the extra
13201 * expression.cs (Binary.ResolveOperator): for
13202 operator==(object,object) and operator !=(object, object) we also
13203 have to verify that there is an implicit conversion from one to
13206 (ArrayAccess.DoResolve): Array Access can operate on
13209 2002-04-30 Miguel de Icaza <miguel@ximian.com>
13211 * assign.cs (CompoundAssign): A new class used as a "flag" that
13212 the assignment actually is happening as part of a compound
13213 assignment operator.
13215 During compound assignment, a few new rules exist to enable things
13222 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
13223 to the type of x) if y is implicitly convertible to the type of x,
13224 and the operator is a builtin operator and the return type of the
13225 operator is explicitly convertible to the type of x.
13227 * rootcontext.cs: Reset warning level to 2. 4 catches various
13228 "interesting" features in mcs, we must clean this up at some
13229 point, but currently am trying to kill other bugs ;-)
13231 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
13232 in container classes as well.
13234 * expression.cs (Binary.ResolveOperator): Handle string case
13235 before anything else (as operator overloading does emit an error
13236 before doing anything else).
13238 This code could go away when we move to a table driven model, but
13239 i could not come up with a good plan last night.
13241 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
13243 * typemanager.cs (CSharpName): reimplementation using regex.
13244 * class.cs: added null check for fields in Emit
13245 * rootcontext.cs: set warninglevel to 4
13247 2002-04-29 Miguel de Icaza <miguel@ximian.com>
13249 * typemanager.cs (CSharpName): reimplemented with Lupus
13252 2002-04-28 Miguel de Icaza <miguel@ximian.com>
13254 * statement.cs (If): correclty implement Resolve, because we were
13255 not catching sem errors in there. The same process is needed
13257 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
13260 (Statement.Warning_DeadCodeFound): Factorize code.
13261 (While): Report dead code here too.
13263 (Statement): Added Resolve virtual method to allow
13264 for resolution split from the emit code.
13266 2002-04-26 Miguel de Icaza <miguel@ximian.com>
13268 * statement.cs (EmitBoolExpression): No longer try to resolve the
13270 (MakeBoolean): New utility function that resolve, implicitly
13271 converts to boolean and tags the expression.
13274 (If, Do): Implement dead code elimination.
13275 (While): Implement loop inversion
13277 (Do, While, For, If): Resolve the expression prior to calling our
13280 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
13283 - added method Report28 (warning: program has more than one entry point)
13284 - added method IsEntryPoint, implements paragraph 10.1 of the spec
13285 - modified method Method.Define, the part at the end of the method
13287 * rootcontext.cs: added static public Location EntryPointLocation;
13289 * ../errors/cs0028.cs : Add test case for the above warning.
13292 - modified method CSharpName to allow arrays of primitive type to
13293 be printed nicely (e.g. instead of System.Int32[][] it now prints
13295 - added method CSharpSignature: returns the signature of a method
13296 in string format to be used in reporting errors, warnings, etc.
13298 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
13301 2002-04-26 Ravi Pratap <ravi@ximian.com>
13303 * delegate.cs (Define): Fix extremely silly bug where I was
13304 setting the type of the 'object' parameter of the BeginInvoke
13305 method to System.IAsyncResult instead of System.Object ;-)
13307 2002-04-26 Miguel de Icaza <miguel@ximian.com>
13309 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
13312 (Constructor.Emit): return if we fail to initialize the
13313 constructor. Another door closed!
13315 * expression.cs (New.DoResolve): Improve error message (from -6 to
13316 1501). Use DeclaredOnly lookup to find the exact constructor.
13318 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
13319 loop. This is useful.
13321 * cs-parser.jay: Adjust the default parameters so that destructors
13322 have the proper signature.
13324 2002-04-26 Martin Baulig <martin@gnome.org>
13326 * driver.cs (LoadAssembly): If `assembly' contains any characters
13327 which are only valid in path names and not in assembly names
13328 (currently slash, backslash and point), use Assembly.LoadFrom ()
13329 instead of Assembly.Load () on the `assembly' (before iteration
13330 over the link_paths).
13332 2002-04-26 Martin Baulig <martin@gnome.org>
13334 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
13336 2002-04-25 Miguel de Icaza <miguel@ximian.com>
13338 * class.cs (Property): use the new typemanager.MemberLookup
13340 (TypeContainer.MemberLookup): Implement using the
13341 TypeManager.MemberLookup now.
13343 * typemanager.cs: Make MemberLookup a function of the TypeManager,
13344 and return MemberInfos, so that these can be used without an
13345 EmitContext (what we had before).
13347 2002-04-24 Miguel de Icaza <miguel@ximian.com>
13349 * expression.cs: Fix the case where the argument to params if the
13350 type of the params. I omitted handling this before. Fixed
13352 2002-04-22 Miguel de Icaza <miguel@ximian.com>
13354 * driver.cs: Call BootCorlib_PopulateCoreType
13356 * class.cs (Property.CheckBase): Check for properties only, not
13359 * interface.cs: Temporary hack: try/catch around the
13360 CustomAttributeBuilder, because I am getting an exception that I
13363 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
13364 types whose definitions are required to be there (attributes are
13365 defined before standard types).
13367 Compute definitions as we boot the various types, as they are used
13368 immediately (value_type class will need object_type, but if we do
13369 not initialize object_type, we will pass a null, which will let
13370 the runtime pick the System.Object from the existing corlib, which
13371 is not what we want).
13373 2002-04-22 Patrik Torstensson <totte@labs2.com>
13375 * cs-tokenizer.cs: fixed a number of trim() issues.
13377 2002-04-22 Ravi Pratap <ravi@ximian.com>
13379 * expression.cs (Argument.Type): Ensure that we return the correct
13380 type when we have out or ref parameters [in which case we
13383 2002-04-22 Miguel de Icaza <miguel@ximian.com>
13385 * class.cs (Property, Indexer): Allow extern modifier in there.
13387 * typemanager.cs (InitBaseTypes): Initializes object_type and
13388 value_type, since those will be used early on during the bootstrap
13389 process to compile corlib.
13391 (InitCoreTypes): Move code from here to InitBaseTypes.
13393 2002-04-21 Miguel de Icaza <miguel@ximian.com>
13395 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
13396 single-dimension arrays as using the ldlen opcode.
13398 Daniel Lewis discovered this optimization.
13400 * typemanager.cs: Add signature for System.Array::get_Length
13402 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13404 * statement.cs: report the error when the foreach does not apply to an
13405 array nor a collection.
13407 2002-04-19 Miguel de Icaza <miguel@ximian.com>
13409 * expression.cs: Add implicit conversions to the operator ~.
13411 * constant.cs (DecimalConstant.Emit): Emit decimal value.
13413 * typemanager.cs: Locate the decimal constructor.
13415 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13417 * attribute.cs: use the new property of TypeOf.
13418 * expression.cs: added 'get' property around typearg.
13420 These changes fix a build breaker reported by NickD. Is this the
13421 correct way to fix? If not, please, revert my changes and make it
13424 2002-04-17 Miguel de Icaza <miguel@ximian.com>
13426 * attribute.cs: Add support for typeof in attribute invocations.
13427 I am not sure that this is right though.
13429 2002-04-14 Duncan Mak <duncan@ximian.com>
13431 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
13432 Binary.Operator.Division case.
13434 2002-04-13 Ravi Pratap <ravi@ximian.com>
13436 * class.cs (DefineType): Ensure that we do a proper check on
13437 attribute types and also register it with the TypeManager.
13439 (TypeContainer.Targets): The default for attribute types is
13440 AttributeTargets.All.
13442 * attribute.cs (ApplyAttributes): Registering the attribute type
13443 is done elsewhere, not when we discover we have a Usage attribute.
13445 2002-04-12 Ravi Pratap <ravi@ximian.com>
13447 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
13448 and get rid of is_delegate parameter.
13450 * everywhere : update.
13452 2002-04-12 Ravi Pratap <ravi@ximian.com>
13454 * cs-parser.jay (compilation_unit): Revamp completely to use
13455 some new ideas that I got from Rhys' grammar to solve the problems
13456 with assembly level attributes.
13458 (outer_declaration): New grammar production.
13460 (attribute_sections): Add.
13462 (opt_attributes): Base on attribute_sections
13464 (namespace_declaration): Allow opt_attributes to tackle the case
13465 when we have assembly level attributes - we are clever in this
13468 * attribute.cs (ApplyAttributes): Do not worry about assembly
13469 attributes in the non-global context.
13471 * rootcontext.cs (AddGlobalAttributes): Go back to using this
13472 instead of SetGlobalAttributes.
13474 * class.cs, rootcontext.cs : Ensure we define and generate
13475 attribute types before anything else.
13477 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
13478 and flag the new error -20 for the case when the attribute type
13479 does not have valid targets specified. csc does not catch this.
13481 * ../errors/errors.txt : update for error # -20
13483 2002-04-11 Ravi Pratap <ravi@ximian.com>
13485 * support.cs (InternalParameters.ParameterModifier): Do some null
13486 checking and return sane values.
13488 * class.cs (Method.Define): If we are a PInvoke method, ensure
13489 that we are static and extern. Report error # 601
13491 * ../errors/cs0601.cs : Add test case for the above error.
13493 2002-04-07 Ravi Pratap <ravi@ximian.com>
13495 * rootcontext.cs (attribute_types): We need to keep type of
13496 all attribute types separately and emit code for them first.
13498 (RegisterAttribute) : Implement.
13500 * class.cs (DefineType): Check if the current Type is a custom
13501 attribute type and register it accordingly.
13503 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
13504 adding the first attribute twice and rename to
13506 (SetGlobalAttributes): this.
13508 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
13511 * attribute.cs (ApplyAttributes): Take an additional argument telling us
13512 if we are processing global arguments. Hmm, I am unsure of this.
13514 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13516 * expression.cs: added static array of strings to avoid calling
13517 Enum.ToString () for Operator in Binary. Significant recover of
13520 2002-04-10 Miguel de Icaza <miguel@ximian.com>
13522 * class.cs (FindMembers): Allow the Builders of the various
13523 members to be null. If they are skip them. This only happens
13524 during the PInvoke declaration.
13526 2002-04-09 Miguel de Icaza <miguel@ximian.com>
13528 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
13529 failure, so we do not keep going afterwards.
13531 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
13532 wanted to pass `false' as the `is_delegate' argument. If this is
13533 the case, why not use delegate_type == null to mean `is_delegate =
13534 false' and anything else as is_delegate = true.
13536 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
13538 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
13539 code for the section, not the beginning of the tests.
13541 2002-04-08 Miguel de Icaza <miguel@ximian.com>
13543 * cfold.cs: Handle operator + (Enum x, Underlying x)
13545 * expression.cs (Binary): same. Warn about errors where we have
13546 Enum/Enum in operator + as well.
13548 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
13551 - added support for switch(bool)
13552 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
13553 - add TableSwitchEmit() to handle table-based switch statements
13555 2002-04-05 Ravi Pratap <ravi@ximian.com>
13557 * expression.cs (Invocation.OverloadResolve): Factor out code which
13558 does parameter compatibility checking with arguments so that we can
13559 re-use the code even from Delegate.VerifyApplicability
13561 (VerifyArgumentsCompat): Move above code here.
13563 * delegate.cs (VerifyApplicability): Get rid of duplicate code
13564 and instead make a call to the above method.
13566 2002-03-31 Ravi Pratap <ravi@ximian.com>
13568 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
13569 We use it to keep track of classes which are attribute types.
13571 2002-04-02 Miguel de Icaza <miguel@ximian.com>
13573 * delegate.cs (Delegate.Define): Correctly define the types in the
13574 presence of fixed and array parameters.
13576 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
13579 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
13580 include NonPublic after the first iteration.
13582 * class.cs (Indexer.CheckBase): Only check if both parents are
13585 * cs-parser.jay (accessor_body): If empty, set to null.
13587 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
13588 same code path here to resolve constants names that we did have in
13589 MemberAccess.DoResolve. There is too much code duplicated here.
13591 2002-04-01 Miguel de Icaza <miguel@ximian.com>
13593 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
13595 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
13598 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
13599 tokens, numbers and strings.
13601 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
13604 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
13605 asyncronous parameters and the regular parameters.
13607 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
13608 specify the target directory.
13610 * expression.cs: (This.DoResolve): Simplify
13611 (As.Emit): Optimize, do not generate IsInst if the expression is
13612 always of the given type.
13614 (Is.DoResolve): Bug fix, we were reporting both always/never for
13617 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
13618 creating too many unnecessary arrays.
13620 2002-03-31 Miguel de Icaza <miguel@ximian.com>
13622 * class.cs (EmitFieldInitializer): Use Assign expression to assign
13623 fields instead of rolling our own initializer. Takes care of all
13624 implicit conversions, and drops unnecessary static checks/argument.
13626 2002-03-31 Dick Porter <dick@ximian.com>
13628 * driver.cs: use the GetDirectories() return values properly, and
13629 use "/" as path separator.
13631 2002-03-30 Miguel de Icaza <miguel@ximian.com>
13633 * expression.cs (Unary): Optimize - - expr into expr.
13634 (Binary): Optimize a + (-b) into a -b.
13636 * codegen.cs (CodeGen): Made all methods static.
13638 2002-03-29 Miguel de Icaza <miguel@ximian.com>
13642 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
13643 TypeBuilder property.
13645 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
13648 * tree.cs: Removed the various RecordXXXX, and replaced with a
13649 single RecordDecl. Removed all the accessor methods, and just
13650 left a single access point Type
13652 * enum.cs: Rename DefineEnum to DefineType.
13654 * decl.cs: New abstract method `DefineType' used to unify the
13655 Defines for Enumerations, Interfaces, TypeContainers and
13658 (FindType): Moved LookupInterfaceOrClass here. Moved the
13659 LookupBaseClasses method that used to live in class.cs and
13660 interface.cs here, and renamed to FindType.
13662 * delegate.cs: Implement DefineType. Take advantage of the
13663 refactored pattern for locating the parent builder without taking
13664 the parent_builder argument (which we know does not work if we are
13665 nested, and triggering a toplevel definition).
13667 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13669 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
13670 accessibility of a member has changed during override and report
13673 * class.cs (Method.Define, Property.Define): Only complain on
13674 overrides if the method is private, any other accessibility is
13675 fine (and since we just checked the permission is the same, we are
13678 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
13679 and elif are processed always. The other pre-processing
13680 directives are only processed if we are "taking" the path
13682 2002-03-29 Martin Baulig <martin@gnome.org>
13684 * class.cs (Method.Emit): Only emit symbolic debugging info if the
13685 current location is not Null.
13687 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
13688 a separate method so we can profile it.
13690 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
13691 `span.Seconds' are just seconds, but no minutes or hours.
13692 (MainDriver): Profile the CodeGen.SaveSymbols calls.
13694 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13696 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
13697 Remove the gratuitous set of Final:
13699 // If an interface implementation, then we can set Final.
13700 if (((flags & MethodAttributes.Abstract) == 0) &&
13701 implementing.DeclaringType.IsInterface)
13702 flags |= MethodAttributes.Final;
13704 I do not know what I was smoking when I used that.
13707 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
13708 step into fixing the name resolution issues for delegates and
13709 unifying the toplevel name resolution.
13711 2002-03-28 Martin Baulig <martin@gnome.org>
13713 * class.cs (Method.Emit): If we have a symbol writer, call its
13714 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
13715 tell it about the current method.
13717 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
13718 writer that we're going to emit the first byte of IL code for a new
13719 statement (a new source line).
13720 (EmitContext.EmitTopBlock): If we have a symbol writer, call
13721 EmitContext.Mark() before emitting any code.
13723 * location.cs (SymbolDocument): Return null when we're Null.
13725 * statement.cs (Statement): Moved the `Location loc' variable here.
13726 (Statement.EmitBoolExpression): If we have a symbol writer, call
13727 ec.Mark() before emitting any code to tell it that we're at the
13728 beginning of a new statement.
13729 (StatementExpression): Added `Location' argument to the constructor.
13730 (Block): Added public readonly variable `StartLocation' and public
13731 variable `EndLocation'. The latter is to be set using SetEndLocation().
13732 (Block): Added constructor which takes a start and end location.
13733 (Block.SetEndLocation): New method. This sets the end location.
13734 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
13735 local variables we create.
13736 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
13737 each statement and do also mark the begin and end of the block.
13739 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
13740 tell it the current lexer.Location, use Location.Null for the end of the
13742 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
13743 current block, set its end location using SetEndLocation().
13744 (statement_expression): StatementExpression constructor now takes the
13745 lexer.Location as additional argument.
13746 (for_statement, declare_local_variables): Likewise.
13747 (declare_local_variables): When creating a new implicit block, use the
13748 new Block constructor and pass it the lexer.Location.
13750 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13752 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
13753 members also on the parent interfaces recursively.
13755 2002-03-27 Miguel de Icaza <miguel@ximian.com>
13757 * report.cs: Use new formats, since Gonzalo finished the missing
13760 * expression.cs (Binary.ResolveOperator): added missing operator|
13761 operator& and operator^ for bool/bool.
13763 * cs-parser.jay: CheckDef now takes a Location argument that is
13764 used to report errors more precisly (instead of reporting the end
13765 of a definition, we try to track something which is a lot closer
13766 to the source of the problem).
13768 * cs-tokenizer.cs: Track global token use, so we can properly flag
13769 the use of #define/#undef after the first token has been seen.
13771 Also, rename the reportXXXX to Error_DescriptiveName
13773 * decl.cs (DeclSpace.IsTopLevel): Move property here from
13774 TypeContainer, so that Enum and Interface can use this too.
13776 * class.cs (TypeContainer.LookupInterfaceOrClass,
13777 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
13778 `builder' argument. Typically this was used to pass the parent
13779 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
13782 The problem is that a nested class could trigger the definition of
13783 a toplevel class, and the builder would be obviously wrong in that
13786 So we drop this argument, and we compute dynamically the
13787 TypeBuilder/ModuleBuilder (the correct information was available
13788 to us anyways from DeclSpace.Parent)
13790 * interface.cs (Interface.DefineInterface): Drop builder
13791 parameter cleanup like class.cs
13793 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
13796 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
13799 (Try.Emit): Propagate the returns value from the statement.
13801 (Return.Emit): Even if we are leavning
13803 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
13805 * modifiers.cs: Fix the computation of MethodAttributes flags.
13807 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
13809 * driver.cs: allow compilation of files that start with '/'.
13810 Add a default case when checking the argument of --target.
13812 2002-03-25 Miguel de Icaza <miguel@ximian.com>
13814 * interface.cs: Implement the same search algorithm for types in
13815 the interface code.
13817 * delegate.cs: Do not allow multiple definition.
13819 * Recovered ChangeLog that got accidentally amputated
13821 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
13823 * rootcontext.cs: Load manually enum to allow core classes to
13824 contain enumerations.
13826 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
13827 Update to new static methods in TypeManager.
13829 * typemanager.cs (GetMethod, GetConstructor): Use our
13830 implementation of FindMembers to find the members, since during
13831 corlib compilation, the types are TypeBuilders and GetMethod and
13832 GetConstructor do not work.
13834 Make all methods in TypeManager static.
13836 (InitCodeHelpers): Split the functionality from
13837 the InitCodeTypes function.
13839 * driver.cs: Call InitCodeHelpers after we have populated the
13842 * cs-parser.jay (delegate_declaration): we did not used to compute
13843 the delegate name correctly for void delegates.
13845 2002-03-24 Miguel de Icaza <miguel@ximian.com>
13847 * rootcontext.cs (RootContext): Init the interface_resolve_order
13848 and type_container_resolve_order always.
13850 (ResolveCore, BootstrapCorlib_ResolveClass,
13851 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
13852 compiler when compiling with --nostdlib
13854 * class.cs (TypeContainer.DefineType): Check that our parent is
13855 not null. This test is most important when we are bootstraping
13858 * codegen.cs: Split out the symbol writing code.
13860 2002-03-25 Martin Baulig <martin@gnome.org>
13862 * driver.cs (-g): Made -g an alias for --debug.
13864 2002-03-24 Martin Baulig <martin@gnome.org>
13866 * codegen.cs (SymbolWriter): New public variable. Returns the
13867 current symbol writer.
13868 (CodeGen): Added `bool want_debugging_support' argument to the
13869 constructor. If true, tell the ModuleBuild that we want debugging
13870 support and ask it for the ISymbolWriter.
13871 (Save): If we have a symbol writer, call it's Close() method after
13872 saving the assembly.
13874 * driver.c (--debug): New command line argument to create a
13875 debugger information file.
13877 * location.cs (SymbolDocument): New public property. Returns an
13878 ISymbolDocumentWriter object for the current source file or null
13879 if we don't have a symbol writer.
13881 2002-03-21 Miguel de Icaza <miguel@ximian.com>
13883 * driver.cs (LoadAssembly): Correctly return when all the paths
13884 have been tried and not before.
13886 * statement.cs (Switch.Emit): return the actual coverage for this
13887 statement (returns/not-returns)
13889 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
13890 switch of the statement if we are the last switch section. That
13891 kills two problems: try/catch problems (we used to emit an empty
13892 nop at the end) and switch statements where all branches would
13895 2002-03-19 Miguel de Icaza <miguel@ximian.com>
13897 * driver.cs: Add default assemblies (the equivalent to the
13898 Microsoft CSC.RSP file)
13900 * cs-tokenizer.cs: When updating `cols and setting it to zero,
13901 also update tokens_seen and set it to false.
13903 * driver.cs: Implement --recurse for Mike.
13905 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
13906 correctly splitting out the paths.
13908 2002-03-18 Miguel de Icaza <miguel@ximian.com>
13910 * interface.cs (Interface.PopulateProperty): Instead of using
13911 `parent' as the declaration space for the set parameters, use
13914 * support.cs (InternalParameters): InternalParameters constructor
13915 takes a DeclSpace instead of a TypeContainer.
13917 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
13918 types are being initialized, load the address of it before calling
13921 (New): Provide a mechanism to disable the generation of local
13922 value type temporaries when the caller will be providing us with
13923 an address to store it.
13925 (ArrayCreation.EmitDynamicInitializers): Use it.
13927 2002-03-17 Miguel de Icaza <miguel@ximian.com>
13929 * expression.cs (Invocation.EmitArguments): Only probe for array
13930 property if there is more than one argument. Sorry about that.
13932 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
13933 empty param arrays.
13935 * class.cs (Method.LabelParameters): Fix incorrect code path that
13936 prevented the `ParamArrayAttribute' from being applied to the
13939 2002-03-16 Miguel de Icaza <miguel@ximian.com>
13941 * support.cs (ReflectionParameters): Correctly compute whether the
13942 last argument is a params array. Fixes the problem with
13945 * typemanager.cs: Make the assemblies array always be non-null
13946 (empty, but non-null)
13948 * tree.cs (RecordDecl): New function that abstracts the recording
13949 of names. This reports error 101, and provides a pointer to the
13950 previous declaration. Fixes a crash in the compiler.
13952 * cs-parser.jay (constructor_declaration): Update to new grammar,
13953 and provide a constructor_body that can be empty.
13955 2002-03-15 Miguel de Icaza <miguel@ximian.com>
13957 * driver.cs: Add support for --resources.
13959 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
13960 Make all types for the various array helper methods be integer.
13962 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
13963 CheckState to ConvCast.
13965 (ConvCast): Now it takes a `checked' state argument, to avoid
13966 depending on the emit context for the conversion, and just using
13967 the resolve time setting.
13969 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
13970 instead of Invocation.EmitArguments. We do not emit the original
13971 arguments, instead we emit those which have been converted to
13972 unsigned int expressions.
13974 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
13976 * codegen.cs: ditto.
13978 * expression.cs (LocalVariableReference): Drop the use of the
13979 Store function that depended on the variable index.
13981 * statement.cs (VariableInfo): Drop the `Idx' property from this
13982 class, as this is not taking into account the indexes for
13983 temporaries tat we generate during the execution, getting the
13986 * class.cs: First emit class initializers, then call the parent
13989 * expression.cs (Binary): Fix opcode emision.
13990 (UnaryMutator.EmitCode): Support checked code generation
13992 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
13993 matches for events for both the Static and Instance scans,
13994 pointing to the same element. Fix that.
13996 2002-03-14 Miguel de Icaza <miguel@ximian.com>
13998 * rootcontext.cs (ResolveTree): Always set the
13999 interface_resolve_order, because nested interfaces will be calling
14002 * class.cs (GetInterfaceOrClass): Track the same resolution
14003 process used by TypeManager.LookupType. This fixes the nested
14004 type lookups in class declarations (separate path from
14007 (TypeContainer.DefineType): Also define nested interfaces.
14008 (TypeContainer.RegisterOrder): New public function used to
14009 register the order in which child interfaces need to be closed.
14011 Nested interfaces need to be closed after their parents have been
14014 * interface.cs (InterfaceAttr): Put all the logic for computing
14015 the interface attribute here.
14017 (DefineInterface): Register our interface order with the
14018 RootContext or with the TypeContainer depending on the case.
14020 2002-03-12 Miguel de Icaza <miguel@ximian.com>
14022 * cs-parser.jay: rework foreach statement to work with the new
14023 changes to the policy on SimpleNames.
14025 * report.cs: support Stacktrace on warnings as well.
14027 * makefile: drop --unsafe and /unsafe from the compile.
14029 2002-03-13 Ravi Pratap <ravi@ximian.com>
14031 * ecore.cs (StandardConversionExists): Modify to take an Expression
14032 as the first parameter. Ensure we do null -> reference type conversion
14035 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
14036 temporary Expression objects.
14038 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
14040 * interface.cs: workaround bug in method overloading resolution
14041 (there is already a bugzilla bug for it).
14043 2002-03-12 Miguel de Icaza <miguel@ximian.com>
14045 We could also solve this problem by having a separate path for
14046 performing type lookups, instead of DoResolve, we could have a
14047 ResolveType entry point, and only participating pieces of the
14048 production (simplename, deref, array) would implement this.
14050 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
14051 signal SimpleName to only resolve type names and not attempt to
14052 resolve anything else.
14054 * expression.cs (Cast): Set the flag.
14056 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
14058 * class.cs: Only report 108 if there is no `new' modifier.
14060 * cs-parser.jay: rework foreach statement to work with the new
14061 changes to the policy on SimpleNames.
14063 * report.cs: support Stacktrace on warnings as well.
14065 * makefile: drop --unsafe and /unsafe from the compile.
14067 2002-03-11 Miguel de Icaza <miguel@ximian.com>
14069 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
14070 lookups here, instead of doing that at parse time. This means
14071 that our grammar will not introduce `LocalVariableReferences' as
14072 expressions at this point. That solves the problem of code like
14076 static void Main ()
14080 This is only half the fix. The full fix requires parameters to
14081 also be handled in this way.
14083 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
14084 makes the use more obvious of the DeclSpace. The
14085 ec.TypeContainer.TypeBuilder is now only used to pull the
14086 TypeBuilder for it.
14088 My theory is that I can get rid of the TypeBuilder completely from
14089 the EmitContext, and have typecasts where it is used (from
14090 DeclSpace to where it matters).
14092 The only pending problem is that the code that implements Aliases
14093 is on TypeContainer, and probably should go in DeclSpace.
14095 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
14096 lookups here, instead of doing that at parse time. This means
14097 that our grammar will not introduce `LocalVariableReferences' as
14098 expressions at this point. That solves the problem of code like
14102 static void Main ()
14106 This is only half the fix. The full fix requires parameters to
14107 also be handled in this way.
14109 * class.cs (Property.DefineMethod): When implementing an interface
14110 method, set newslot, when implementing an abstract method, do not
14111 set the flag (before we tried never setting it, or always setting
14112 it, which is the difference).
14113 (Indexer.DefineMethod): same.
14114 (Method.DefineMethod): same.
14116 * ecore.cs: Only set the status used flag if we get back a Field.
14118 * attribute.cs: Temporary hack, so Paolo can keep working.
14120 2002-03-08 Ravi Pratap <ravi@ximian.com>
14122 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
14123 the unmanaged type in the case we have a MarshalAs attribute.
14125 (Resolve): Handle the case when we are parsing the special MarshalAs
14126 attribute [we need to store the unmanaged type to use later]
14128 * typemanager.cs (marshal_as_attr_type): Built in type for the
14129 MarshalAs Attribute.
14131 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
14132 on parameters and accordingly set the marshalling info.
14134 2002-03-09 Miguel de Icaza <miguel@ximian.com>
14136 * class.cs: Optimizing slightly by removing redundant code after
14137 we switched to the `NoTypes' return value.
14138 (Property.DefineMethod): use NoTypes here too.
14140 This fixes the bug I introduced in my last batch of changes.
14142 2002-03-05 Ravi Pratap <ravi@ximian.com>
14144 * tree.cs (RecordEnum): Add. We now keep track of enums too.
14146 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
14147 Enums since those are types too.
14149 * cs-parser.jay (enum_declaration): Record enums as we parse them.
14151 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
14152 thanks to a call during the lookup process.
14154 2002-03-07 Miguel de Icaza <miguel@ximian.com>
14156 * statement.cs (Foreach): Lots of work to accomodate a particular
14157 kind of foreach statement that I had not kept in mind. It is
14158 possible to have foreachs on classes that provide a GetEnumerator
14159 method that return objects that implement the "pattern" for using
14160 a foreach, there is no need to support GetEnumerator
14163 This is needed to compile nant.
14165 * decl.cs: Only report 114 if the member is not `Finalize' and if
14166 the warning level is at least 2.
14168 * class.cs: Moved the compare function from Method to
14171 (MethodSignature.InheritableMemberSignatureCompare): Add new
14172 filter function that is used to extract inheritable methods from a
14175 (Method.Define): Use the new `inheritable_method_signature_filter'
14178 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
14181 2002-03-06 Miguel de Icaza <miguel@ximian.com>
14183 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
14185 * cs-parser.jay: Add opt_semicolon to the interface declaration.
14187 * expression.cs: Pass location information to
14188 ConvertImplicitStandard.
14190 * class.cs: Added debugging code to track return values from
14193 2002-03-05 Miguel de Icaza <miguel@ximian.com>
14195 * expression.cs (Is.DoResolve): If either side of the `is' is an
14196 interface, do not flag the warning.
14198 * ecore.cs (ImplicitReferenceConversion): We need a separate test
14201 * report.cs: Allow for --fatal to be used with --probe.
14203 * typemanager.cs (NoTypes): Move the definition for the empty Type
14206 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
14208 (TypeContainer.DefineProxy): New function used to proxy to parent
14209 implementations when implementing interfaces.
14210 (TypeContainer.ParentImplements): used to lookup if our parent
14211 implements a public function that is required by an interface.
14212 (TypeContainer.VerifyPendingMethods): Hook this up.
14214 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
14215 `modules' and `assemblies' arraylists into arrays. We only grow
14216 these are the very early start up of the program, so this improves
14217 the speedof LookupType (nicely measured).
14219 * expression.cs (MakeByteBlob): Replaced unsafe code with
14220 BitConverter, as suggested by Paolo.
14222 * cfold.cs (ConstantFold.Binary): Special case: perform constant
14223 folding of string concatenation, but if either side is a string,
14224 and the other is not, then return null, and let the runtime use
14225 the concatenation on the string plus the object (using
14226 `Object.ToString').
14228 2002-03-04 Miguel de Icaza <miguel@ximian.com>
14230 Constant Folding has been implemented now.
14232 * expression.cs (Unary.Reduce): Do not throw an exception, catch
14233 the error instead on types that are not supported in one's
14236 * constant.cs (Constant and all children): New set of functions to
14237 perform implict and explicit conversions.
14239 * ecore.cs (EnumConstant): Implement the new functions to perform
14240 conversion by proxying to the child expression.
14242 * codegen.cs: (ConstantCheckState): Constant evaluation has its
14243 own separate setting that can not be turned off from the command
14244 line using --unchecked or --checked and is only controlled using
14245 the checked/unchecked statements and expressions. This setting is
14246 used by the constant folder to flag errors.
14248 * expression.cs (CheckedExpr, UncheckedExpr): Set the
14249 ConstantCheckState as well.
14251 During Resolve, they also have to flag the state, because the
14252 constant folder runs completely in the Resolve phase.
14254 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
14257 2002-03-01 Miguel de Icaza <miguel@ximian.com>
14259 * cfold.cs: New file, this file contains the constant folder.
14261 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
14262 argument to track whether we are using the resulting address to
14263 load or store a value and provide better error messages.
14265 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
14266 new AddressOf arguments.
14268 * statement.cs (Foreach.EmitCollectionForeach): Update
14270 * expression.cs (Argument.Emit): Call AddressOf with proper
14271 arguments to track usage.
14273 (New.DoEmit): Call AddressOf with new arguments.
14275 (Unary.Emit): Adjust AddressOf call.
14277 2002-03-01 Ravi Pratap <ravi@ximian.com>
14279 * cs-parser.jay (member_access): Change the case for pre-defined types
14280 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
14283 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
14286 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
14287 essentially like methods and apply attributes like MethodImplOptions to them too.
14289 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
14292 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
14293 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
14296 * Update code everywhere accordingly.
14298 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
14300 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
14302 2002-02-28 Ravi Pratap <ravi@ximian.com>
14304 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
14305 try performing lookups against those instead of jumping straight into using
14306 the 'using' clauses.
14308 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
14310 (LookupType): Perform lookups in implicit parents too.
14312 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
14313 sequence as RootContext.LookupType.
14315 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
14316 the various cases of namespace lookups into this method.
14318 2002-03-01 Miguel de Icaza <miguel@ximian.com>
14320 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
14321 in positional arguments)
14323 * class.cs (Operator): Update the AllowedModifiers to contain
14326 * cs-parser.jay: Update operator declaration to allow for the
14327 operator body to be empty.
14329 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
14332 2002-02-27 Miguel de Icaza <miguel@ximian.com>
14334 * class.cs (Method.Emit): Label parameters.
14336 * driver.cs: Return 1 or 0 as the program exit code.
14338 2002-02-26 Miguel de Icaza <miguel@ximian.com>
14340 * expression.cs: Special case the `null' object when trying to
14341 auto-compute the type, as anything can be explicitly converted to
14344 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
14345 spotting this Paolo.
14347 (Expression.ImplicitNumericConversion): Perform comparissions of
14348 the type using the underlying type in the case of an enumeration
14349 rather than using the enumeration type for the compare.
14351 Cope with the underlying == type case, which is not possible to
14354 (Expression.ConvertNumericExplicit): Perform comparissions of
14355 the type using the underlying type in the case of an enumeration
14356 rather than using the enumeration type for the compare.
14358 * driver.cs: If the user does not supply an extension, assume .exe
14360 * cs-parser.jay (if_statement): Rewrote so that we can track the
14361 location for the if statement.
14363 * expression.cs (Binary.ConstantFold): Only concat strings when
14364 the operation is "+", not everything ;-)
14366 * statement.cs (Statement.EmitBoolExpression): Take a location
14368 (If, While, Do): Track location.
14370 * expression.cs (Binary.ResolveOperator): In the object + string
14371 case, I was missing a call to ConvertImplicit
14373 2002-02-25 Ravi Pratap <ravi@ximian.com>
14375 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
14376 Location arguments. Ensure we use RootContext.LookupType to do our work
14377 and not try to do a direct Type.GetType and ModuleBuilder.GetType
14379 * interface.cs (PopulateMethod): Handle the type of the parameter being
14382 * expression.cs (Invocation.BetterFunction): Handle the case when we
14383 have a params method with no fixed arguments and a call is made with no
14386 2002-02-25 Miguel de Icaza <miguel@ximian.com>
14388 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
14389 the verbatim-string-literal
14391 * support.cs (InternalParameters.ParameterModifier): handle null
14393 (InternalParameters.ParameterType): ditto.
14395 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
14396 duplicating the name of the variable parameter.
14397 (GetParameterByName): Fix bug where we were not looking up array
14398 paramters if they were the only present (thanks Paolo!).
14399 (GetParameterInfo): We only have an empty set of types if both
14400 fixed and array are set to null.
14401 (GetParameterInfo-idx): Handle FixedParameter == null
14403 * cs-parser.jay: Handle the case where there is no catch
14404 statements (missing null test).
14406 2002-02-22 Miguel de Icaza <miguel@ximian.com>
14408 * driver.cs (MainDriver): Be conservative on our command line
14411 Catch DirectoryNotFoundException when calling GetFiles.
14413 (SplitPathAndPattern): Used to split the input specification into
14414 a path and a pattern that we can feed to Directory.GetFiles.
14416 2002-02-21 Miguel de Icaza <miguel@ximian.com>
14418 * statement.cs (Fixed): Implement the last case of the Fixed
14419 statement (string handling).
14421 * expression.cs (StringPtr): New class used to return a char * to
14422 a string; Used by the Fixed statement.
14424 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
14426 * expression.cs (Binary.ResolveOperator): Remove redundant
14427 MemberLookup pn parent type.
14428 Optimize union call, we do not need a union if the types are the same.
14429 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
14432 Specialize the use of MemberLookup everywhere, instead of using
14433 the default settings.
14435 (StackAlloc): Implement stackalloc keyword.
14437 * cs-parser.jay: Add rule to parse stackalloc.
14439 * driver.cs: Handle /h, /help, /?
14441 * expression.cs (MakeByteBlob): Removed the hacks we had in place
14442 before we supported unsafe code.
14444 * makefile: add --unsafe to the self compilation of mcs.
14446 2002-02-20 Miguel de Icaza <miguel@ximian.com>
14448 * expression.cs (PointerArithmetic): New class that is used to
14449 perform pointer arithmetic.
14450 (Binary.Resolve): Handle pointer arithmetic
14451 Handle pointer comparission.
14452 (ArrayPtr): Utility expression class that is used to take the
14453 address of an array.
14455 (ElementAccess): Implement array access for pointers
14457 * statement.cs (Fixed): Implement fixed statement for arrays, we
14458 are missing one more case before we are done.
14460 * expression.cs (Indirection): Implement EmitAssign and set the
14461 ExprClass to Variable. This allows pointer dereferences to be
14462 treated as variables, and to have values assigned to them.
14464 * ecore.cs (Expression.StoreFromPtr): New utility function to
14465 store values dereferencing.
14467 2002-02-20 Ravi Pratap <ravi@ximian.com>
14469 * expression.cs (Binary.ResolveOperator): Ensure that we are
14470 not trying to operate on a void type - this fixes the reported
14473 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
14474 the parent implementation is sealed.
14476 * ../errors/cs0239.cs : Add.
14478 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
14480 * typemanager.cs (unverifiable_code_type): Corresponds to
14481 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
14482 which have unsafe code in them.
14484 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
14487 2002-02-19 Miguel de Icaza <miguel@ximian.com>
14489 * cs-tokenizer.cs: Add support for @"litreal strings"
14491 Make tokenizer accept pre-processor directives
14492 on any column (remove the old C-like limitation).
14494 * rootcontext.cs (EmitCode): Emit any global attributes.
14495 (AddGlobalAttributes): Used to keep track of assembly attributes.
14497 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
14499 * cs-parser.jay: Add support for global attributes.
14501 2002-02-17 Miguel de Icaza <miguel@ximian.com>
14503 * expression.cs (Indirection): New helper class. Unary will
14504 create Indirection classes to be able to implement the
14505 IMemoryLocation interface on it.
14507 2002-02-16 Miguel de Icaza <miguel@ximian.com>
14509 * cs-parser.jay (fixed_statement): reference the right statement.
14511 * statement.cs (Fixed.Emit): Finish implementing the fixed
14512 statement for the &x case.
14514 2002-02-14 Miguel de Icaza <miguel@ximian.com>
14516 * class.cs (Property.Define, Method.Define): Remove newslot when
14519 * modifiers.cs: My use of NewSlot when `Abstract' was set was
14520 wrong. NewSlot should only be used if the `new' keyword is present.
14522 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
14523 locating our system dir. Sorry about this.
14525 2002-02-13 Miguel de Icaza <miguel@ximian.com>
14527 * driver.cs (GetSystemDir): Compute correctly the location of our
14528 system assemblies. I was using the compiler directory instead of
14529 the library directory.
14531 2002-02-13 Ravi Pratap <ravi@ximian.com>
14533 * expression.cs (BetterFunction): Put back in what Miguel commented out
14534 since it is the correct fix. The problem is elsewhere ;-)
14536 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
14537 parameters of the parms method are themselves compatible or not !
14539 (StandardConversionExists): Fix very dangerous bug where we were forgetting
14540 to check that a class implements an interface before saying that an implicit
14541 conversion was allowed. Use ImplementsInterface to do the checking.
14543 2002-02-13 Miguel de Icaza <miguel@ximian.com>
14545 * class.cs (Method.Define): Track whether we are an explicit
14546 implementation or not. And only call DefineMethodOverride if we
14547 are an explicit implementation.
14549 (Property.DefineMethod): Ditto.
14551 2002-02-11 Ravi Pratap <ravi@ximian.com>
14553 * expression.cs (BetterFunction): Catch hideous bug which was
14554 preventing us from detecting ambiguous calls due to implicit casts i.e
14557 2002-01-29 Miguel de Icaza <miguel@ximian.com>
14559 * support.cs (Pair): Remove un-needed method. I figured why I was
14560 getting the error in cs-parser.jay, the variable in a foreach loop
14561 is readonly, and the compiler does not really treat this as a variable.
14563 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
14564 instead of EQUALS in grammar.
14566 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
14568 * expression.cs (Unary.DoResolve): Check whether the argument is
14571 2002-01-28 Miguel de Icaza <miguel@ximian.com>
14573 * support.cs: Api for Pair to set a value. Despite the fact that
14574 the variables are public the MS C# compiler refuses to compile
14575 code that accesses the field if the variable is part of a foreach
14578 * statement.cs (Fixed): Begin implementation of the fixed
14581 (Block.AddVariable): Return the VariableInfo on success and null
14582 on failure instead of true/false.
14584 * cs-parser.jay (foreach): Catch errors on variables already
14585 defined (we were ignoring this value before) and properly unwind
14586 the block hierarchy
14588 (fixed_statement): grammar for the fixed statement.
14590 2002-01-25 Miguel de Icaza <miguel@ximian.com>
14592 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
14593 pointer types to be incretemented.
14595 (SizeOf): Implement.
14597 * cs-parser.jay (pointer_member_access): Implement
14598 expr->IDENTIFIER production.
14600 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
14601 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
14604 (Unary): Implement indirection.
14606 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
14607 use in non-unsafe context).
14609 (SimpleName.DoResolve): Check for pointers in field access on safe
14612 (Expression.LoadFromPtr): Factor the load-indirect code in this
14613 function. This was duplicated in UnboxCast and ParameterReference
14615 2002-01-24 Miguel de Icaza <miguel@ximian.com>
14617 * expression.cs (ComposedCast): report an error if a pointer cast
14618 is used in a safe region.
14620 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
14621 pointer type casts in unsafe context.
14623 * codegen.cs (EmitContext): Set up IsUnsafe.
14625 * cs-parser.jay (non_expression_type): Add productions for pointer
14628 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
14629 code. We should not use force into static mode if the method is
14630 not virtual. Fixes bug in MIS
14632 * statement.cs (Do.Emit, While.Emit, For.Emit,
14633 Statement.EmitBoolExpression): Add support to Do and While to
14634 propagate infinite loop as `I do return' semantics.
14636 Improve the For case to also test for boolean constants.
14638 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
14639 to the list of attributes we can add.
14641 Remove `EmitContext' argument.
14643 * class.cs (Method.Define): Apply parameter attributes.
14644 (Constructor.Define): Apply parameter attributes.
14645 (MethodCore.LabelParameters): Move here the core of labeling
14648 * support.cs (ReflectionParameters.ParameterModifier,
14649 InternalParameters.ParameterModifier): Use IsByRef on the type and
14650 only return the OUT bit for these parameters instead of in/out/ref
14653 This is because I miss-understood things. The ParameterInfo.IsIn
14654 and IsOut represent whether the parameter has the [In] and [Out]
14657 2002-01-22 Miguel de Icaza <miguel@ximian.com>
14659 * ecore.cs (FieldExpr.Emit): Release temporaries.
14661 * assign.cs (LocalTemporary.Release): new function.
14663 * codegen.cs (EmitContext.GetTemporaryStorage,
14664 EmitContext.FreeTemporaryStorage): Rework the way we deal with
14665 temporary storage. Now we can "put back" localbuilders when we
14668 2002-01-21 Miguel de Icaza <miguel@ximian.com>
14670 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
14671 need to make a copy of the variable to generate verifiable code.
14673 2002-01-19 Miguel de Icaza <miguel@ximian.com>
14675 * driver.cs: Compute dynamically the system directory.
14677 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
14678 Slower, but more generally useful. Used by the abstract
14679 registering implementation.
14681 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
14682 the rules for the special rule on Type/instances. First check if
14683 we have the same name, and if so, try that special static path
14684 rather than the instance path.
14686 2002-01-18 Miguel de Icaza <miguel@ximian.com>
14688 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
14691 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
14692 Enum, ValueType, Delegate or Array for non-corlib compiles.
14694 * cs-tokenizer.cs: Catch long identifiers (645)
14696 * typemanager.cs (IndexerPropetyName): Ravi never tested this
14699 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
14700 fix, we were returning too early, so we were not registering
14701 pending methods from abstract classes.
14703 Do not register pending methods if the class is abstract.
14705 * expression.cs (Conditional.DoResolve): Report circular implicit
14706 conversions when we neecd to compute it for conditional
14709 (Is.DoResolve): If the expression is always of the provided type,
14710 flag warning 183. If the expression can not ever be of the
14711 provided type flag warning 184.
14713 * class.cs: Catch 169 as well.
14715 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
14718 2002-01-18 Nick Drochak <ndrochak@gol.com>
14720 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
14722 2002-01-17 Miguel de Icaza <miguel@ximian.com>
14724 * interface.cs: (PopulateMethod): Check for pointers being defined
14725 only if the unsafe context is active.
14726 (PopulateProperty): ditto.
14727 (PopulateIndexer): ditto.
14729 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
14730 specified. If pointers are present, make sure that they are
14731 present in an unsafe context.
14732 (Constructor, Constructor.Define): ditto.
14733 (Field, Field.Define): ditto.
14734 (Property, Property.Define): ditto.
14735 (Event, Event.Define): ditto.
14737 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
14738 hashtable if there are classes or structs defined.
14740 * expression.cs (LocalVariableReference.DoResolve): Simplify this
14741 code, as the constant resolution moved.
14743 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
14744 the metadata, so we can flag error 133.
14746 * decl.cs (MemberCore.UnsafeOK): New function to test that a
14747 pointer is being declared in an unsafe context.
14749 2002-01-16 Miguel de Icaza <miguel@ximian.com>
14751 * modifiers.cs (Modifiers.Check): Require a Location argument.
14752 Report error 227 for Unsafe use.
14754 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
14756 * statement.cs (For.Emit): If the test is null, then report that
14757 we do `return', as we wont reach anything afterwards.
14759 (Switch.SwitchGoverningType): Track the expression that matched
14762 * driver.cs: Allow negative numbers as an error code to flag.
14764 * cs-parser.jay: Handle 1551.
14766 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
14768 2002-01-15 Miguel de Icaza <miguel@ximian.com>
14770 * cs-parser.jay: Report 1518 (type declaration can only contain
14771 class, struct, interface, enum or delegate)
14773 (switch_label): Report 1523 (keywords `case' or `default' must
14776 (opt_switch_sections): Report 1522 (empty switch)
14778 * driver.cs: Report 1515 (response file specified multiple times)
14779 Report 1516 (Source file specified multiple times).
14781 * expression.cs (Argument.Resolve): Signal 1510
14783 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
14784 access not allowed in static code)
14786 2002-01-11 Ravi Pratap <ravi@ximian.com>
14788 * typemanager.cs (IsPointerType): Utility method which we are going
14791 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
14792 the object type, so we take care of that.
14794 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
14796 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
14797 added to non-params parameters :-)
14799 * typemanager.cs (CSharpName): Include 'void' type too.
14801 (void_ptr_type): Include in the set of core types.
14803 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
14806 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
14809 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
14810 completely forgotten about it.
14812 2002-01-10 Ravi Pratap <ravi@ximian.com>
14814 * cs-parser.jay (pointer_type): Add. This begins our implementation
14815 of parsing rules for unsafe code.
14817 (unsafe_statement): Implement.
14819 (embedded_statement): Modify to include the above.
14821 * statement.cs (Unsafe): Implement new class for unsafe blocks.
14823 * codegen.cs (EmitContext.InUnsafe): Add. This determines
14824 if the current context is an unsafe one.
14826 * cs-parser.jay (local_variable_pointer_type): Since local variable types
14827 are handled differently, we need separate rules for them.
14829 (local_variable_declaration): Update to use local_variable_pointer_type
14830 to allow variable declarations of unmanaged pointer types.
14832 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
14833 in unsafe contexts.
14835 * ../errors/cs0214.cs : Add.
14837 2002-01-16 Nick Drochak <ndrochak@gol.com>
14839 * makefile: remove 'response' file when cleaning.
14841 2002-01-15 Miguel de Icaza <miguel@ximian.com>
14843 * cs-parser.jay: Report 1524.
14845 2002-01-14 Miguel de Icaza <miguel@ximian.com>
14847 * typemanager.cs (RegisterMethod): drop checking if we have
14848 registered this from here
14850 2002-01-12 Miguel de Icaza <miguel@ximian.com>
14852 * class.cs (Method.EmitDestructor): Implement calling our base
14855 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
14856 value of InFinally.
14858 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
14859 this routine and will wrap the call in a try/catch block. Deal
14862 2002-01-11 Miguel de Icaza <miguel@ximian.com>
14864 * ecore.cs (Expression.MemberLookup): instead of taking a
14865 parameter `same_type' that was used to tell whether we could
14866 access private members we compute our containing type from the
14869 (FieldExpr): Added partial support for volatile fields. This does
14870 not work for volatile fields exposed from assemblies, as I can not
14871 figure out how to extract the modreq from it.
14873 Updated all the source files to use this.
14875 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
14876 because it is referenced by MemberLookup very often.
14878 2002-01-09 Ravi Pratap <ravi@ximian.com>
14880 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
14881 TypeBuilder.GetCustomAttributes to retrieve what we need.
14883 Get rid of redundant default_member_attr_type as this is the same as
14884 default_member_type which already exists.
14886 * interface.cs, attribute.cs : Update accordingly.
14888 2002-01-08 Miguel de Icaza <miguel@ximian.com>
14890 * typemanager.cs: Enable IndexerPropertyName again. It does not
14891 work for TYpeBuilders though. Ravi, can you please fix this?
14893 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
14895 * expression.cs (Argument.Emit): Handle the case of ref objects
14896 being passed to ref functions;
14898 (ParameterReference.EmitLoad): Loads the content of the pointer
14899 without dereferencing.
14901 2002-01-07 Miguel de Icaza <miguel@ximian.com>
14903 * cs-tokenizer.cs: Implemented the pre-processing expressions.
14905 2002-01-08 Ravi Pratap <ravi@ximian.com>
14907 * class.cs (Indexer.DefineMethod): Incorporate the interface
14908 type in the name of the method if we are doing explicit interface
14911 * expression.cs (ConversionExists): Remove as it is completely obsolete.
14913 (BetterConversion): Fix extremely trivial bug where we were referring to
14914 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
14917 * ../errors/bug16.cs : Add although we have fixed it.
14919 2002-01-07 Miguel de Icaza <miguel@ximian.com>
14921 * expression.cs (BaseIndexer): Begin implementation.
14923 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
14925 * cs-parser.jay (indexer_declarator): Use qualified_identifier
14926 production directly to remove a shift/reduce, and implement
14927 explicit interface implementation.
14929 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
14930 after a floating point suffix.
14932 * expression.cs (DoNumericPromotions): Improved the conversion for
14933 uint/uint. If we have a constant, we avoid doing a typecast to a
14936 * class.cs (Indexer): Implement explicit interface implementation
14939 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
14941 * class.cs: make the default instance constructor public and hidebysig.
14943 2001-01-03 Ravi Pratap <ravi@ximian.com>
14945 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
14946 so we can call it from elsewhere.
14948 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
14949 we emit it internally if the class has a defined indexer; otherwise the user
14950 emits it by decorating the class definition with the DefaultMemberAttribute.
14952 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
14953 attribute is not used on a type which defines an indexer.
14955 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
14956 character when we skip whitespace.
14958 * ../errors/cs0646.cs : Add.
14960 2002-01-03 Miguel de Icaza <miguel@ximian.com>
14962 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
14965 * makefile: Add practical target `mcs3.exe' which builds the third
14966 generation compiler.
14968 * expression.cs (New): Fix structures constructor calling.
14970 * class.cs (Property, Method, Indexer): Emit Final flag on the
14971 method if we are an interface implementation and we are not
14974 * ecore.cs (PropertyExpr): New public field `IsBase', tells
14975 whether this property is referencing a `base' method.
14977 * expression.cs (Invocation.EmitCall): take an extra argument:
14978 is_base, this is used to determine whether the `call' or
14979 `callvirt' opcode should be used.
14982 * delegate.cs: update EmitCall.
14984 * class.cs (Method.Define): Set NewSlot for the cases where we are
14985 not implementing an interface method.
14987 (Property.Define): ditto.
14989 2002-01-02 Miguel de Icaza <miguel@ximian.com>
14991 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
14992 'r'. Allows mcs to parse itself fully.
14994 2002-01-02 Ravi Pratap <ravi@ximian.com>
14996 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
14997 of the number of initializers that require the InitializeArray method.
14999 (CheckIndices): Store the Expression in all cases - not the plain value. Also
15000 update the above field where necessary.
15002 (MakeByteBlob): Update accordingly.
15004 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
15007 (EmitDynamicInitializers): Update in accordance with the new optimization.
15009 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
15010 same OpCode applies.
15012 * cs-parser.jay : Fix some glaring errors I introduced.
15014 2002-01-01 Ravi Pratap <ravi@ximian.com>
15016 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
15017 so that we can check for name clashes there too.
15019 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
15020 for interface indexers.
15022 * interfaces.cs (Define): Emit the default member attribute.
15024 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
15025 variable was being referred to while setting the value ;-)
15027 2002-01-01 Miguel de Icaza <miguel@ximian.com>
15029 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
15030 byte-by-byte information when we know the data is zero.
15032 Make the block always a multiple of 4, because
15033 DefineInitializedData has a bug.
15035 * assign.cs: Fix, we should assign from the temporary, not from
15038 * expression.cs (MakeByteBlob): Fix my incorrect code.
15040 2001-12-31 Miguel de Icaza <miguel@ximian.com>
15042 * typemanager.cs (EnumToUnderlying): This function is used to get
15043 the underlying type from an enumeration, because it does not
15046 * constant.cs: Use the I4_S form for values between -128 and 127.
15048 * statement.cs (Block.LookupLabel): Looks up a label.
15049 (Block): Drop support for labeled blocks.
15051 (LabeledStatement): New kind of statement that represents a label
15054 (Goto): Finally implement this bad boy.
15056 * cs-parser.jay: Update to reflect new mechanism to implement
15059 2001-12-30 Miguel de Icaza <miguel@ximian.com>
15061 * codegen.cs (EmitContext.This): a codegen property that keeps the
15062 a single instance of this instead of creating many different this
15065 * delegate.cs (Delegate.DoResolve): Update to use the property;
15067 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
15069 * expression.cs (BaseAccess.DoResolve): Ditto.
15071 2001-12-29 Ravi Pratap <ravi@ximian.com>
15073 * typemanager.cs (methodimpl_attr_type): Add to hold the type
15074 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
15076 (InitCoreTypes): Update accordingly.
15078 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
15079 so we can quickly store the state.
15081 (ApplyAttributes): Set the correct implementation flags
15082 for InternalCall methods.
15084 2001-12-29 Miguel de Icaza <miguel@ximian.com>
15086 * expression.cs (EmitCall): if a method is not virtual, then do
15087 not use callvirt on it.
15089 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
15090 user defined stuff) requires the use of stobj, which takes an
15091 address on the stack instead of an array and an index. So emit
15092 the Ldelema operation for it.
15094 (EmitStoreOpcode): Use stobj for valuetypes.
15096 (UnaryMutator.EmitCode): Use the right 1 value depending on
15097 whether we are dealing with int64/uint64, float or doubles.
15099 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
15100 constructors that I implemented last night.
15102 (Constructor.IsDefault): Fix to work properly for static
15105 * cs-parser.jay (CheckDef): report method signature errors.
15106 Update error number 103 to be 132.
15108 * decl.cs: New AdditionResult enumeration value: MethodExists.
15109 Although we do this check for methods later on in the semantic
15110 analysis, catching repeated default constructors is so easy that
15111 we catch these here.
15113 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
15116 (ParameterReference.EmitAssign, Emit): handle
15119 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
15120 (ArrayAccess.EmitStoreOpcode): ditto.
15122 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
15124 * expression.cs (MakeByteBlob): Complete all the missing types
15125 (uint, short, ushort, byte, sbyte)
15127 * class.cs: Only init instance field initializers on instance
15130 Rename `constructors' to instance_constructors.
15132 (TypeContainer.AddConstructor): Only add constructors to the list
15133 if it is not static.
15135 Make sure that we handle default_static_constructor independently
15136 everywhere where we handle instance_constructors
15138 2001-12-28 Miguel de Icaza <miguel@ximian.com>
15140 * class.cs: Do not lookup or create a base initializer for a
15141 static constructor.
15143 (ConstructorInitializer.Resolve): use the proper type to lookup
15146 * cs-parser.jay: Report error 1585 (modifiers between type and name).
15148 * enum.cs, interface.cs: Remove CloseType, this is taken care by
15151 * decl.cs: CloseType is now an virtual method, the default
15152 implementation just closes this type.
15154 2001-12-28 Ravi Pratap <ravi@ximian.com>
15156 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
15157 to PreserveSig by default. Also emit HideBySig on such methods.
15159 Basically, set the defaults to standard values.
15161 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
15162 argument, if candidate is better, it can't be worse than the best !
15164 (Invocation): Re-write bits to differentiate between methods being
15165 applicable in their expanded form and their normal form - for params
15168 Get rid of use_standard everywhere as only standard conversions are allowed
15169 in overload resolution.
15171 More spec conformance.
15173 2001-12-27 Miguel de Icaza <miguel@ximian.com>
15175 * driver.cs: Add --timestamp, to see where the compiler spends
15178 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
15179 `this' in static code.
15181 (SimpleName.DoResolve): Implement in terms of a helper function
15182 that allows static-references to be passed upstream to
15185 (Expression.ResolveWithSimpleName): Resolve specially simple
15186 names when called by MemberAccess to implement the special
15189 (Expression.ImplicitReferenceConversion): Handle conversions from
15190 Null to reference types before others, as Null's type is
15193 * expression.cs (Invocation.EmitCall): Handle the special case of
15194 calling methods declared on a reference type from a ValueType
15195 (Base classes System.Object and System.Enum)
15197 (MemberAccess.Resolve): Only perform lookups on Enumerations if
15198 the left hand side is a TypeExpr, not on every enumeration.
15200 (Binary.Resolve): If types are reference types, then do a cast to
15201 object on operators != and == of both arguments.
15203 * typemanager.cs (FindMembers): Extract instance and static
15204 members if requested.
15206 * interface.cs (PopulateProperty): Use void_type instead of null
15207 as the return type for the setter method.
15209 (PopulateIndexer): ditto.
15211 2001-12-27 Ravi Pratap <ravi@ximian.com>
15213 * support.cs (ReflectionParameters): Fix minor bug where we
15214 were examining the wrong parameter for the ParamArray attribute.
15216 Cope with requests for the type of the parameter at position
15217 greater than the params parameter's. We now return the element
15218 type of the params array as that makes more sense.
15220 * expression.cs (Invocation.IsParamsMethodApplicable): Update
15221 accordingly as we no longer have to extract the element type
15224 (Invocation.OverloadResolve): Update.
15226 2001-12-27 Miguel de Icaza <miguel@ximian.com>
15228 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
15229 against IEnumerator, test whether the return value is a descendant
15230 of the IEnumerator interface.
15232 * class.cs (Indexer.Define): Use an auxiliary method to implement
15233 the other bits of the method definition. Begin support for
15234 explicit interface implementation.
15236 (Property.DefineMethod): Use TypeManager.void_type instead of null
15237 for an empty return value.
15239 2001-12-26 Miguel de Icaza <miguel@ximian.com>
15241 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
15242 dealing with a FieldExpr which is composed of a FieldBuilder, in
15243 the code path we did extract the constant, but we should have
15244 obtained the underlying value to be able to cast it (otherwise we
15245 end up in an infinite loop, this is what Ravi was running into).
15247 (ArrayCreation.UpdateIndices): Arrays might be empty.
15249 (MemberAccess.ResolveMemberAccess): Add support for section
15250 14.5.4.1 that deals with the special case of E.I when E is a type
15251 and something else, that I can be a reference to a static member.
15253 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
15254 handle a particular array type to create byte blobs, it is just
15255 something we dont generate byteblobs for.
15257 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
15260 * location.cs (Push): remove the key from the hashtable that we
15261 are about to add. This happens for empty files.
15263 * driver.cs: Dispose files after we have parsed them.
15265 (tokenize): new function that only runs the tokenizer on its
15266 input, for speed testing.
15268 2001-12-26 Ravi Pratap <ravi@ximian.com>
15270 * class.cs (Event.Define): Define the private field only if there
15271 are no accessors defined.
15273 * expression.cs (ResolveMemberAccess): If there is no associated
15274 field with the event, that means we have an event defined with its
15275 own accessors and we should flag error cs0070 since transforming
15276 ourselves into a field is not valid in that case.
15278 * ecore.cs (SimpleName.DoResolve): Same as above.
15280 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
15281 and charset to sane values.
15283 2001-12-25 Ravi Pratap <ravi@ximian.com>
15285 * assign.cs (DoResolve): Perform check on events only if they
15286 are being accessed outside the declaring type.
15288 * cs-parser.jay (event_declarations): Update rules to correctly
15289 set the type of the implicit parameter etc.
15291 (add_accessor, remove_accessor): Set current local parameters.
15293 * expression.cs (Binary): For delegate addition and subtraction,
15294 cast the return value from the method into the appropriate delegate
15297 2001-12-24 Ravi Pratap <ravi@ximian.com>
15299 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
15300 of these as the workaround is unnecessary.
15302 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
15303 delegate data - none of that is needed at all.
15305 Re-write bits to extract the instance expression and the delegate method
15308 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
15311 * attribute.cs (ApplyAttributes): New method to take care of common tasks
15312 of attaching attributes instead of duplicating code everywhere.
15314 * everywhere : Update code to do attribute emission using the above method.
15316 2001-12-23 Miguel de Icaza <miguel@ximian.com>
15318 * expression.cs (IsParamsMethodApplicable): if there are not
15319 parameters, return immediately.
15321 * ecore.cs: The 0 literal can be implicity converted to an enum
15324 (SimpleName.DoResolve): First lookup the type, then lookup the
15327 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
15328 want to get its address. If the InstanceExpression is not
15329 addressable, store the result in a temporary variable, then get
15332 * codegen.cs: Only display 219 errors on warning level or above.
15334 * expression.cs (ArrayAccess): Make it implement the
15335 IMemoryLocation interface.
15337 (Binary.DoResolve): handle the operator == (object a, object b)
15338 and operator != (object a, object b) without incurring into a
15339 BoxedCast (because 5 != o should never be performed).
15341 Handle binary enumerator operators.
15343 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
15344 value type, otherwise use Ldelem_ref.
15346 Use precomputed names;
15348 (AddressOf): Implement address of
15350 * cs-parser.jay (labeled_statement): Fix recursive block
15351 addition by reworking the production.
15353 * expression.cs (New.DoEmit): New has a special case:
15355 If we are dealing with a ValueType, we have a few
15356 situations to deal with:
15358 * The target of New is a ValueType variable, that is
15359 easy, we just pass this as the variable reference
15361 * The target of New is being passed as an argument,
15362 to a boxing operation or a function that takes a
15365 In this case, we need to create a temporary variable
15366 that is the argument of New.
15369 2001-12-23 Ravi Pratap <ravi@ximian.com>
15371 * rootcontext.cs (LookupType): Check that current_type is not null before
15372 going about looking at nested types.
15374 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
15375 not implement the IAssignMethod interface any more.
15377 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
15378 where we tranform them into FieldExprs if they are being resolved from within
15379 the declaring type.
15381 * ecore.cs (SimpleName.DoResolve): Do the same here.
15383 * assign.cs (DoResolve, Emit): Clean up code considerably.
15385 * ../errors/bug10.cs : Add.
15387 * ../errors/cs0070.cs : Add.
15389 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
15391 * assign.cs : Get rid of EventIsLocal everywhere.
15393 2001-12-23 Miguel de Icaza <miguel@ximian.com>
15395 * ecore.cs (ConvertIntLiteral): finished the implementation.
15397 * statement.cs (SwitchLabel): Convert the value we are using as a
15398 key before looking up the table.
15400 2001-12-22 Miguel de Icaza <miguel@ximian.com>
15402 * codegen.cs (EmitTopBlock): Require a Location argument now.
15404 * cs-parser.jay (constructor_declarator): We need to setup
15405 current_local_parameters before we parse the
15406 opt_constructor_initializer, to allow the variables to be bound
15407 to the constructor arguments.
15409 * rootcontext.cs (LookupType): First lookup nested classes in our
15410 class and our parents before we go looking outside our class.
15412 * expression.cs (ConstantFold): Extract/debox the values at the
15415 * rootcontext.cs (EmitCode): Resolve the constants first before we
15416 resolve the types. This is not really needed, but it helps debugging.
15418 * statement.cs: report location.
15420 * cs-parser.jay: pass location to throw statement.
15422 * driver.cs: Small bug fix.
15424 * report.cs: Updated format to be 4-zero filled digits.
15426 2001-12-22 Ravi Pratap <ravi@ximian.com>
15428 * expression.cs (CheckIndices): Fix minor bug where the wrong
15429 variable was being referred to ;-)
15431 (DoEmit): Do not call EmitStaticInitializers when the
15432 underlying type is System.Object.
15434 2001-12-21 Ravi Pratap <ravi@ximian.com>
15436 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
15437 and do the usual workaround for SRE.
15439 * class.cs (MyEventBuilder.EventType): New member to get at the type
15440 of the event, quickly.
15442 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
15444 * assign.cs (Assign.DoResolve): Handle the case when the target
15445 is an EventExpr and perform the necessary checks.
15447 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
15450 (SimpleName.MemberStaticCheck): Include check for EventExpr.
15452 (EventExpr): Set the type in the constructor itself since we
15453 are meant to be born fully resolved.
15455 (EventExpr.Define): Revert code I wrote earlier.
15457 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
15458 instance expression is null. The instance expression is a This in that case
15459 or a null, depending on whether it is a static method or not.
15461 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
15462 refers to more than one method.
15464 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
15465 and accordingly flag errors.
15467 2001-12-21 Miguel de Icaza <miguel@ximian.com>
15469 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
15471 2001-12-22 Miguel de Icaza <miguel@ximian.com>
15473 * location.cs (ToString): Provide useful rutine.
15475 2001-12-21 Miguel de Icaza <miguel@ximian.com>
15477 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
15478 objects, return the actual integral boxed.
15480 * statement.cs (SwitchLabel): define an ILLabel for each
15483 (Switch.CheckSwitch): If the value is a Literal, extract
15484 the underlying literal.
15486 Also in the unused hashtable we had, add the SwitchLabel so we can
15487 quickly look this value up.
15489 * constant.cs: Implement a bunch of new constants. Rewrite
15490 Literal based on this. Made changes everywhere to adapt to this.
15492 * expression.cs (Expression.MakeByteBlob): Optimize routine by
15493 dereferencing array only once, and also copes with enumrations.
15495 bytes are two bytes wide, not one.
15497 (Cast): Perform constant conversions.
15499 * ecore.cs (TryImplicitIntConversion): Return literals instead of
15500 wrappers to the literals here.
15502 * expression.cs (DoNumericPromotions): long literals can converted
15503 to ulong implicity (this is taken care of elsewhere, but I was
15504 missing this spot).
15506 * ecore.cs (Expression.Literalize): Make the return type Literal,
15507 to improve type checking.
15509 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
15511 2001-12-20 Miguel de Icaza <miguel@ximian.com>
15513 * literal.cs: Revert code from ravi that checked the bounds. The
15514 bounds are sane by the definition of the type itself.
15516 * typemanager.cs: Fix implementation of ImplementsInterface. We
15517 need to actually look up in our parent hierarchy for interfaces
15520 * const.cs: Use the underlying type for enumerations
15522 * delegate.cs: Compute the basename for the delegate creation,
15523 that should fix the delegate test case, and restore the correct
15524 Type Lookup semantics in rootcontext
15526 * rootcontext.cs: Revert Ravi's last patch. The correct way of
15527 referencing a nested type with the Reflection API is using the "+"
15530 * cs-parser.jay: Do not require EOF token at the end.
15532 2001-12-20 Ravi Pratap <ravi@ximian.com>
15534 * rootcontext.cs (LookupType): Concatenate type names with
15535 a '.' instead of a '+' The test suite passes again.
15537 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
15538 field of the enumeration.
15540 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
15541 the case when the member is an EventExpr.
15543 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
15544 static has an associated instance expression.
15546 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
15548 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
15550 * class.cs (Event.Define): Register event and perform appropriate checks
15553 We define the Add and Remove methods even if the use provides none because
15554 in that case, we provide default implementations ourselves.
15556 Define a private field of the type of the event. This is done by the CSC compiler
15557 and we should be doing it too ;-)
15559 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
15560 More methods we use in code we generate.
15562 (multicast_delegate_type, delegate_type): Two separate types since the distinction
15565 (InitCoreTypes): Update accordingly for the above.
15567 * class.cs (Event.Emit): Generate code for default accessors that we provide
15569 (EmitDefaultMethod): Do the job in the above.
15571 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
15574 2001-12-20 Miguel de Icaza <miguel@ximian.com>
15576 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
15577 builders even if we were missing one.
15579 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
15580 pass the Basename as our class name instead of the Name. The
15581 basename will be correctly composed for us.
15583 * parameter.cs (Paramters): Now takes a Location argument.
15585 * decl.cs (DeclSpace.LookupType): Removed convenience function and
15586 make all the code call directly LookupType in RootContext and take
15587 this chance to pass the Location information everywhere.
15589 * Everywhere: pass Location information.
15591 2001-12-19 Miguel de Icaza <miguel@ximian.com>
15593 * class.cs (Constructor.Define): Updated way of detecting the
15594 length of the parameters.
15596 (TypeContainer.DefineType): Use basename as the type name for
15599 (TypeContainer.Define): Do not recursively define types here, as
15600 definition is taken care in order by the RootContext.
15602 * tree.cs: Keep track of namespaces in a per-file basis.
15604 * parameter.cs (Parameter.ComputeSignature): Update to use
15607 (Parameters.GetSignature): ditto.
15609 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
15610 instead of a TypeContainer.
15612 (Interface.SemanticAnalysis): Use `this' instead of our parent to
15613 resolve names. Because we need to be resolve in our context, not
15616 * driver.cs: Implement response files.
15618 * class.cs (TypeContainer.DefineType): If we are defined, do not
15619 redefine ourselves.
15621 (Event.Emit): Emit the code for add/remove handlers.
15622 (Event.Define): Save the MethodBuilders for add/remove.
15624 * typemanager.cs: Use pair here too.
15626 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
15627 DictionaryEntry requires the first argument to be non-null.
15629 (enum_declaration): Compute full name for registering the
15632 (delegate_declaration): Instead of using
15633 formal_parameter_list, use opt_formal_parameter_list as the list
15636 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
15637 (EventParsing): New property that controls whether `add' and
15638 `remove' are returned as tokens or identifiers (for events);
15640 2001-12-19 Ravi Pratap <ravi@ximian.com>
15642 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
15643 use MyEventBuilder only and let it wrap the real builder for us.
15645 (MyEventBuilder): Revamp constructor etc.
15647 Implement all operations that we perform on EventBuilder in precisely the same
15650 (FindMembers): Update to use the EventBuilder member.
15652 (Event.Emit): Update accordingly.
15654 2001-12-18 Ravi Pratap <ravi@ximian.com>
15656 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
15657 by calling the appropriate methods.
15659 (GetCustomAttributes): Make stubs as they cannot possibly do anything
15662 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
15664 2001-12-17 Ravi Pratap <ravi@ximian.com>
15666 * delegate.cs (Delegate.Populate): Check that the return type
15667 and various parameters types are indeed accessible.
15669 * class.cs (Constructor.Define): Same here.
15671 (Field.Define): Ditto.
15673 (Event.Define): Ditto.
15675 (Operator.Define): Check that the underlying Method defined itself
15676 correctly - so it's MethodBuilder should not be null.
15678 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
15679 expression happens to be null.
15681 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
15682 members but as of now we don't seem to be able to do anything really useful with it.
15684 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
15685 not the EventBuilder.
15687 2001-12-18 Miguel de Icaza <miguel@ximian.com>
15689 * cs-tokenizer.cs: Add support for defines.
15690 Add support for #if, #elif, #else, #endif
15692 (eval_var): evaluates a variable.
15693 (eval): stubbed for evaluating functions.
15695 * cs-parser.jay: Pass the defines information
15697 * driver.cs: Add --define command line option.
15699 * decl.cs: Move MemberCore here.
15701 Make it the base class for DeclSpace. This allows us to catch and
15702 report 108 and 109 for everything now.
15704 * class.cs (TypeContainer.Define): Extract all the members
15705 before populating and emit the warning 108 (new keyword required
15706 to override) instead of having each member implement this.
15708 (MemberCore.Define): New abstract method, we will be using this in
15709 the warning reporting engine in Populate.
15711 (Operator.Define): Adjust to new MemberCore protocol.
15713 * const.cs (Const): This does not derive from Expression, it is a
15714 temporary object we use to create fields, it is a MemberCore.
15716 * class.cs (Method.Define): Allow the entry point to be in a
15719 * driver.cs: Rewrite the argument handler to clean it up a bit.
15721 * rootcontext.cs: Made it just an auxiliary namespace feature by
15722 making everything static.
15724 * driver.cs: Adapt code to use RootContext type name instead of
15727 * delegate.cs: Remove RootContext argument.
15729 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
15732 * class.cs (Event.Define): The lookup can fail.
15734 * cs-tokenizer.cs: Begin implementation of pre-procesor.
15736 * expression.cs: Resolve the this instance before invoking the code.
15738 2001-12-17 Miguel de Icaza <miguel@ximian.com>
15740 * cs-parser.jay: Add a production in element_access that allows
15741 the thing to become a "type" reference. This way we can parse
15742 things like "(string [])" as a type.
15744 Note that this still does not handle the more complex rules of
15748 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
15750 * ecore.cs: (CopyNewMethods): new utility function used to
15751 assemble the list of methods from running FindMembers.
15753 (MemberLookup): Rework FindMembers so that
15755 2001-12-16 Miguel de Icaza <miguel@ximian.com>
15757 * class.cs (TypeContainer): Remove Delegates who fail to be
15760 * delegate.cs (Populate): Verify that we dont get null return
15761 values. TODO: Check for AsAccessible.
15763 * cs-parser.jay: Use basename to emit error 574 (destructor should
15764 have the same name as container class), not the full name.
15766 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
15767 possible representation.
15769 Also implements integer type suffixes U and L.
15771 2001-12-15 Miguel de Icaza <miguel@ximian.com>
15773 * expression.cs (ArrayCreation.DoResolve): We need to do the
15774 argument resolution *always*.
15776 * decl.cs: Make this hold the namespace. Hold the root context as
15778 (LookupType): Move here.
15780 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
15782 * location.cs (Row, Name): Fixed the code, it was always returning
15783 references to the first file.
15785 * interface.cs: Register properties defined through interfaces.
15787 * driver.cs: Add support for globbing on the command line
15789 * class.cs (Field): Make it derive from MemberCore as well.
15792 2001-12-15 Ravi Pratap <ravi@ximian.com>
15794 * class.cs (Event::Define): Check that the type of the event is a delegate
15795 type else flag error #66.
15797 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
15800 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
15801 values of EntryPoint, CharSet etc etc.
15803 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
15805 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
15806 be null and we should ignore this. I am not sure if this is really clean. Apparently,
15807 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
15808 which needs this to do its work.
15810 * ../errors/cs0066.cs : Add.
15812 2001-12-14 Miguel de Icaza <miguel@ximian.com>
15814 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
15817 * class.cs: (MethodSignature.MethodSignature): Removed hack that
15818 clears out the parameters field.
15819 (MemberSignatureCompare): Cleanup
15821 (MemberCore): New base class used to share code between MethodCore
15824 (RegisterRequiredImplementations) BindingFlags.Public requires
15825 either BindingFlags.Instace or Static. Use instance here.
15827 (Property): Refactored code to cope better with the full spec.
15829 * parameter.cs (GetParameterInfo): Return an empty array instead
15832 * class.cs (Property): Abstract or extern properties have no bodies.
15834 * parameter.cs (GetParameterInfo): return a zero-sized array.
15836 * class.cs (TypeContainer.MethodModifiersValid): Move all the
15837 method modifier validation to the typecontainer so we can reuse
15838 this on properties.
15840 (MethodCore.ParameterTypes): return an empty sized array of types.
15842 (Property.Define): Test property modifier validity.
15844 Add tests for sealed/override too.
15846 (Method.Emit): abstract or extern methods have no bodies.
15848 2001-12-14 Ravi Pratap <ravi@ximian.com>
15850 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
15853 (Method::Define, ::Emit): Modify accordingly.
15855 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
15857 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
15859 * makefile: Pass in /unsafe.
15861 2001-12-13 Miguel de Icaza <miguel@ximian.com>
15863 * class.cs (MakeKey): Kill routine.
15865 * class.cs (TypeContainer.Define): Correctly define explicit
15866 method implementations (they require the full interface name plus
15869 * typemanager.cs: Deply the PtrHashtable here and stop using the
15870 lame keys. Things work so much better.
15872 This of course broke everyone who depended on `RegisterMethod' to
15873 do the `test for existance' test. This has to be done elsewhere.
15875 * support.cs (PtrHashtable): A hashtable that avoid comparing with
15876 the object stupid Equals method (because, that like fails all over
15877 the place). We still do not use it.
15879 * class.cs (TypeContainer.SetRequiredInterface,
15880 TypeContainer.RequireMethods): Killed these two routines and moved
15881 all the functionality to RegisterRequiredImplementations.
15883 (TypeContainer.RegisterRequiredImplementations): This routine now
15884 registers all the implementations required in an array for the
15885 interfaces and abstract methods. We use an array of structures
15886 which can be computed ahead of time to reduce memory usage and we
15887 also assume that lookups are cheap as most classes will not
15888 implement too many interfaces.
15890 We also avoid creating too many MethodSignatures.
15892 (TypeContainer.IsInterfaceMethod): Update and optionally does not
15893 clear the "pending" bit if we find that there are problems with
15896 (TypeContainer.VerifyPendingMethods): Update to report errors of
15897 methods that look like implementations but are not.
15899 (TypeContainer.Define): Add support for explicit interface method
15902 2001-12-12 Miguel de Icaza <miguel@ximian.com>
15904 * typemanager.cs: Keep track of the parameters here instead of
15905 being a feature of the TypeContainer.
15907 * class.cs: Drop the registration of parameters here, as
15908 InterfaceMethods are also interface declarations.
15910 * delegate.cs: Register methods with the TypeManager not only with
15911 the TypeContainer. This code was buggy.
15913 * interface.cs: Full registation here.
15915 2001-12-11 Miguel de Icaza <miguel@ximian.com>
15917 * expression.cs: Remove reducer for binary expressions, it can not
15920 * const.cs: Put here the code that used to go into constant.cs
15922 * constant.cs: Put here the code for constants, this is a new base
15923 class for Literals.
15925 * literal.cs: Make Literal derive from Constant.
15927 2001-12-09 Miguel de Icaza <miguel@ximian.com>
15929 * statement.cs (Return.Emit): Report error 157 if the user
15930 attempts to return from a finally block.
15932 (Return.Emit): Instead of emitting a return, jump to the end of
15935 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
15936 LocalBuilder to store the result of the function. ReturnLabel is
15937 the target where we jump.
15940 2001-12-09 Radek Doulik <rodo@ximian.com>
15942 * cs-parser.jay: remember alias in current namespace
15944 * ecore.cs (SimpleName::DoResolve): use aliases for types or
15947 * class.cs (LookupAlias): lookup alias in my_namespace
15949 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
15951 (LookupAlias): lookup alias in this and if needed in parent
15954 2001-12-08 Miguel de Icaza <miguel@ximian.com>
15958 * rootcontext.cs: (ModuleBuilder) Made static, first step into
15959 making things static. I need this to avoid passing the
15960 TypeContainer when calling ParameterType.
15962 * support.cs (InternalParameters.ParameterType): Remove ugly hack
15963 that did string manipulation to compute the type and then call
15964 GetType. Use Parameter.ParameterType instead.
15966 * cs-tokenizer.cs: Consume the suffix for floating values.
15968 * expression.cs (ParameterReference): figure out whether this is a
15969 reference parameter or not. Kill an extra variable by computing
15970 the arg_idx during emission.
15972 * parameter.cs (Parameters.GetParameterInfo): New overloaded
15973 function that returns whether a parameter is an out/ref value or not.
15975 (Parameter.ParameterType): The type of the parameter (base,
15976 without ref/out applied).
15978 (Parameter.Resolve): Perform resolution here.
15979 (Parameter.ExternalType): The full type (with ref/out applied).
15981 * statement.cs (Using.Emit, Using.EmitExpression): Implement
15982 support for expressions on the using statement.
15984 2001-12-07 Miguel de Icaza <miguel@ximian.com>
15986 * statement.cs (Using.EmitLocalVariableDecls): Split the
15987 localvariable handling of the using statement.
15989 (Block.EmitMeta): Keep track of variable count across blocks. We
15990 were reusing slots on separate branches of blocks.
15992 (Try.Emit): Emit the general code block, we were not emitting it.
15994 Check the type of the declaration to be an IDisposable or
15995 something that can be implicity converted to it.
15997 Emit conversions if required.
15999 * ecore.cs (EmptyExpression): New utility class.
16000 (Expression.ImplicitConversionExists): New utility function.
16002 2001-12-06 Miguel de Icaza <miguel@ximian.com>
16004 * statement.cs (Using): Implement.
16006 * expression.cs (LocalVariableReference): Support read only variables.
16008 * statement.cs: Remove the explicit emit for the Leave opcode.
16009 (VariableInfo): Add a readonly field.
16011 2001-12-05 Miguel de Icaza <miguel@ximian.com>
16013 * ecore.cs (ConvCast): new class used to encapsulate the various
16014 explicit integer conversions that works in both checked and
16015 unchecked contexts.
16017 (Expression.ConvertNumericExplicit): Use new ConvCast class to
16018 properly generate the overflow opcodes.
16020 2001-12-04 Miguel de Icaza <miguel@ximian.com>
16022 * statement.cs: The correct type for the EmptyExpression is the
16023 element_type, not the variable type. Ravi pointed this out.
16025 2001-12-04 Ravi Pratap <ravi@ximian.com>
16027 * class.cs (Method::Define): Handle PInvoke methods specially
16028 by using DefinePInvokeMethod instead of the usual one.
16030 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
16031 above to do the task of extracting information and defining the method.
16033 2001-12-04 Ravi Pratap <ravi@ximian.com>
16035 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
16036 of the condition for string type.
16038 (Emit): Move that here.
16040 (ArrayCreation::CheckIndices): Keep string literals in their expression
16043 (EmitDynamicInitializers): Handle strings appropriately.
16045 2001-12-04 Miguel de Icaza <miguel@ximian.com>
16047 * codegen.cs (EmitContext): Replace multiple variables with a
16048 single pointer to the current Switch statement.
16050 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
16053 2001-12-03 Miguel de Icaza <miguel@ximian.com>
16057 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
16060 (Foreach.Emit): Foreach on arrays was not setting
16061 up the loop variables (for break/continue).
16063 (GotoCase): Semi-implented.
16065 2001-12-03 Ravi Pratap <ravi@ximian.com>
16067 * attribute.cs (CheckAttribute): Handle system attributes by using
16068 Attribute.GetAttributes to examine information we need.
16070 (GetValidPlaces): Same here.
16072 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
16074 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
16076 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
16078 (Method::Define): Set appropriate flags if we have a DllImport attribute.
16080 (Method::Emit): Handle the case when we are a PInvoke method.
16082 2001-12-03 Miguel de Icaza <miguel@ximian.com>
16084 * expression.cs: Use ResolveWithSimpleName on compound names.
16086 2001-12-02 Ravi Pratap <ravi@ximian.com>
16088 * constant.cs (EmitConstant): Make sure we resolve the associated expression
16089 before trying to reduce it.
16091 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
16093 * constant.cs (LookupConstantValue): Implement.
16095 (EmitConstant): Use the above in emitting the constant.
16097 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
16098 that are user-defined by doing a LookupConstantValue on them.
16100 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
16103 2001-11-29 Miguel de Icaza <miguel@ximian.com>
16105 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
16107 (BaseAccess.DoResolve): Implement.
16109 (MemberAccess.DoResolve): Split this routine into a
16110 ResolveMemberAccess routine that can be used independently
16112 2001-11-28 Miguel de Icaza <miguel@ximian.com>
16114 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
16115 As that share bits of the implementation. Is returns a boolean,
16116 while As returns the Type that is being probed.
16118 2001-12-01 Ravi Pratap <ravi@ximian.com>
16120 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
16121 instead of a Literal - much easier.
16123 (EnumInTransit): Remove - utterly useless :-)
16125 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
16127 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
16129 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
16130 chain when we have no associated expression.
16132 2001-11-30 Ravi Pratap <ravi@ximian.com>
16134 * constant.cs (Define): Use Location while reporting the errror.
16136 Also emit a warning when 'new' is used and there is no inherited
16139 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
16142 (LookupEnumValue): Implement to lookup an enum member's value and define it
16145 (Populate): Re-write accordingly to use the above routine.
16147 2001-11-27 Miguel de Icaza <miguel@ximian.com>
16149 * expression.cs (This): Fix prototype for DoResolveLValue to
16150 override the base class DoResolveLValue.
16152 * cs-parser.cs: Report errors cs574 and cs575 (destructor
16155 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
16156 (we need to load the address of the field here). This fixes
16159 (FieldExpr.DoResolveLValue): Call the DoResolve
16160 function to initialize the Instance expression.
16162 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
16163 correctly the GetEnumerator operation on a value type.
16165 * cs-parser.jay: Add more simple parsing error catches.
16167 * statement.cs (Switch): Add support for string switches.
16168 Handle null specially.
16170 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
16172 2001-11-28 Ravi Pratap <ravi@ximian.com>
16174 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
16176 (declare_local_constant): New helper function.
16178 * statement.cs (AddConstant): Keep a separate record of constants
16180 (IsConstant): Implement to determine if a variable is a constant.
16182 (GetConstantExpression): Implement.
16184 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
16186 * statement.cs (IsVariableDefined): Re-write.
16188 2001-11-27 Ravi Pratap <ravi@ximian.com>
16190 * class.cs (TypeContainer::FindMembers): Look for constants
16191 in the case when we are looking for MemberTypes.Field
16193 * expression.cs (MemberAccess::DoResolve): Check that in the
16194 case we are a FieldExpr and a Literal, we are not being accessed
16195 by an instance reference.
16197 * cs-parser.jay (local_constant_declaration): Implement.
16199 (declaration_statement): Implement for constant declarations.
16201 2001-11-26 Miguel de Icaza <miguel@ximian.com>
16203 * statement.cs (Switch): Catch double defaults.
16205 (Switch): More work on the switch() statement
16206 implementation. It works for integral values now, need to finish
16210 2001-11-24 Miguel de Icaza <miguel@ximian.com>
16212 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
16213 integer literals into other integer literals. To be used by
16216 2001-11-24 Ravi Pratap <ravi@ximian.com>
16218 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
16221 (EmitDynamicInitializers): Cope with the above since we extract data
16222 directly from ArrayData now.
16224 (ExpectInitializers): Keep track of whether initializers are mandatory
16227 (Bounds): Make it a hashtable to prevent the same dimension being
16228 recorded for every element in that dimension.
16230 (EmitDynamicInitializers): Fix bug which prevented the Set array method
16233 Also fix bug which was causing the indices to be emitted in the reverse
16236 2001-11-24 Miguel de Icaza <miguel@ximian.com>
16238 * expression.cs (ArrayCreation): Implement the bits that Ravi left
16239 unfinished. They do not work, because the underlying code is
16242 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16244 * cs-parser.jay: Remove bogus fixme.
16246 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
16247 on Switch statement.
16249 2001-11-23 Ravi Pratap <ravi@ximian.com>
16251 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
16254 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
16255 parameter. Apparently, any expression is allowed.
16257 (ValidateInitializers): Update accordingly.
16259 (CheckIndices): Fix some tricky bugs thanks to recursion.
16261 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
16262 I was being completely brain-dead.
16264 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
16265 and re-write acordingly.
16267 (DelegateInvocation): Re-write accordingly.
16269 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
16271 (MakeByteBlob): Handle types more correctly.
16273 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
16274 initialization from expressions but it is incomplete because I am a complete
16277 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16279 * statement.cs (If.Emit): Fix a bug that generated incorrect code
16280 on If. Basically, we have to return `true' (ie, we do return to
16281 our caller) only if both branches of the if return.
16283 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
16284 short-circuit operators, handle them as short circuit operators.
16286 (Cast.DoResolve): Resolve type.
16287 (Cast.Cast): Take an expression as the target type.
16289 * cs-parser.jay (cast_expression): Remove old hack that only
16290 allowed a limited set of types to be handled. Now we take a
16291 unary_expression and we resolve to a type during semantic
16294 Use the grammar productions from Rhys to handle casts (this is
16295 not complete like Rhys syntax yet, we fail to handle that corner
16296 case that C# has regarding (-x), but we will get there.
16298 2001-11-22 Ravi Pratap <ravi@ximian.com>
16300 * class.cs (EmitFieldInitializer): Take care of the case when we have a
16301 field which is an array type.
16303 * cs-parser.jay (declare_local_variables): Support array initialization too.
16305 * typemanager.cs (MakeKey): Implement.
16307 (everywhere): Use the above appropriately.
16309 * cs-parser.jay (for_statement): Update for array initialization while
16310 declaring variables.
16312 * ecore.cs : The error message was correct, it's the variable's names that
16313 were misleading ;-) Make the code more readable.
16315 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
16316 the correct type etc.
16318 (ConvertExplicit): Handle Enum types by examining the underlying type.
16320 2001-11-21 Ravi Pratap <ravi@ximian.com>
16322 * parameter.cs (GetCallingConvention): Always return
16323 CallingConventions.Standard for now.
16325 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16327 * expression.cs (Binary.ResolveOperator): Update the values of `l'
16328 and `r' after calling DoNumericPromotions.
16330 * ecore.cs: Fix error message (the types were in the wrong order).
16332 * statement.cs (Foreach.ProbeCollectionType): Need to pass
16333 BindingFlags.Instance as well
16335 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
16336 implicit int literal conversion in an empty cast so that we
16337 propagate the right type upstream.
16339 (UnboxCast): new class used to unbox value types.
16340 (Expression.ConvertExplicit): Add explicit type conversions done
16343 (Expression.ImplicitNumericConversion): Oops, forgot to test for
16344 the target type before applying the implicit LongLiterals to ULong
16347 2001-11-21 Miguel de Icaza <miguel@ximian.com>
16349 * cs-parser.jay (for_statement): Reworked the way For works: now
16350 we declare manually any variables that are introduced in
16351 for_initializer to solve the problem of having out-of-band code
16352 emition (that is what got for broken).
16354 (declaration_statement): Perform the actual variable declaration
16355 that used to be done in local_variable_declaration here.
16357 (local_variable_declaration): Do not declare anything, just pass
16358 the information on a DictionaryEntry
16360 2001-11-20 Ravi Pratap <ravi@ximian.com>
16362 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
16363 re-write of the logic to now make it recursive.
16365 (UpdateIndices): Re-write accordingly.
16367 Store element data in a separate ArrayData list in the above methods.
16369 (MakeByteBlob): Implement to dump the array data into a byte array.
16371 2001-11-19 Ravi Pratap <ravi@ximian.com>
16373 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
16376 * constant.cs (Define): Implement.
16378 (EmitConstant): Re-write fully.
16380 Pass in location info.
16382 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
16385 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
16386 DictionaryEntry since we need location info too.
16388 (constant_declaration): Update accordingly.
16390 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
16391 code into another method : UpdateIndices.
16393 2001-11-18 Ravi Pratap <ravi@ximian.com>
16395 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
16396 some type checking etc.
16398 2001-11-17 Ravi Pratap <ravi@ximian.com>
16400 * expression.cs (ArrayCreation::ValidateInitializers): Implement
16401 bits to provide dimension info if the user skips doing that.
16403 Update second constructor to store the rank correctly.
16405 2001-11-16 Ravi Pratap <ravi@ximian.com>
16407 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
16408 and try to implement.
16410 * ../errors/cs0150.cs : Add.
16412 * ../errors/cs0178.cs : Add.
16414 2001-11-16 Miguel de Icaza <miguel@ximian.com>
16416 * statement.cs: Implement foreach on multi-dimensional arrays.
16418 * parameter.cs (Parameters.GetParameterByName): Also lookup the
16419 name of the params argument.
16421 * expression.cs: Use EmitStoreOpcode to get the right opcode while
16422 initializing the array.
16424 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
16425 we can use this elsewhere.
16427 * statement.cs: Finish implementation of foreach for single
16430 * cs-parser.jay: Use an out-of-band stack to pass information
16431 around, I wonder why I need this.
16433 foreach_block: Make the new foreach_block the current_block.
16435 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
16436 function used to return a static Parameters structure. Used for
16437 empty parameters, as those are created very frequently.
16439 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
16441 2001-11-15 Ravi Pratap <ravi@ximian.com>
16443 * interface.cs : Default modifier is private, not public. The
16444 make verify test passes again.
16446 2001-11-15 Ravi Pratap <ravi@ximian.com>
16448 * support.cs (ReflectionParameters): Fix logic to determine
16449 whether the last parameter is a params one. Test 9 passes again.
16451 * delegate.cs (Populate): Register the builders we define with
16452 RegisterParameterForBuilder. Test 19 passes again.
16454 * cs-parser.jay (property_declaration): Reference $6 instead
16455 of $$ to get at the location.
16457 (indexer_declaration): Similar stuff.
16459 (attribute): Ditto.
16461 * class.cs (Property): Register parameters for the Get and Set methods
16462 if they exist. Test 23 passes again.
16464 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
16465 call to EmitArguments as we are sure there aren't any params arguments.
16466 Test 32 passes again.
16468 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
16469 IndexOutOfRangeException.
16471 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
16472 Test 33 now passes again.
16474 2001-11-15 Miguel de Icaza <miguel@ximian.com>
16476 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
16477 broke a bunch of things. Will have to come up with a better way
16478 of tracking locations.
16480 * statement.cs: Implemented foreach for single dimension arrays.
16482 2001-11-09 Miguel de Icaza <miguel@ximian.com>
16484 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
16485 an error. This removes the lookup from the critical path.
16487 * cs-parser.jay: Removed use of temporary_loc, which is completely
16490 2001-11-14 Miguel de Icaza <miguel@ximian.com>
16492 * support.cs (ReflectionParameters.ParameterModifier): Report
16493 whether the argument is a PARAMS argument or not.
16495 * class.cs: Set the attribute `ParamArrayAttribute' on the
16496 parameter argument.
16498 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
16499 and cons_param_array_attribute (ConstructorInfo for
16500 ParamArrayAttribute).,
16502 * codegen.cs: Emit the return using the `Return' statement, that
16503 way we can report the error correctly for missing return values.
16505 * class.cs (Method.Emit): Clean up.
16507 * expression.cs (Argument.Resolve): Take another argument: the
16508 location where this argument is used. Notice that this is not
16509 part of the "Argument" class as to reduce the size of the
16510 structure (we know the approximate location anyways).
16512 Test if the argument is a variable-reference, if not, then
16513 complain with a 206.
16515 (Argument.Emit): Emit addresses of variables.
16517 (Argument.FullDesc): Simplify.
16519 (Invocation.DoResolve): Update for Argument.Resolve.
16521 (ElementAccess.DoResolve): ditto.
16523 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
16524 method should be virtual, as this method is always virtual.
16526 (NewDelegate.DoResolve): Update for Argument.Resolve.
16528 * class.cs (ConstructorInitializer.DoResolve): ditto.
16530 * attribute.cs (Attribute.Resolve): ditto.
16532 2001-11-13 Miguel de Icaza <miguel@ximian.com>
16534 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
16536 * expression.cs (ParameterReference): Drop IStackStorage and implement
16537 IAssignMethod instead.
16539 (LocalVariableReference): ditto.
16541 * ecore.cs (FieldExpr): Drop IStackStorage and implement
16542 IAssignMethod instead.
16544 2001-11-13 Miguel de Icaza <miguel@ximian.com>
16546 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
16547 enumerations that are used in heavily used structures derive from
16548 byte in a laughable and pathetic attempt to reduce memory usage.
16549 This is the kind of pre-optimzations that you should not do at
16550 home without adult supervision.
16552 * expression.cs (UnaryMutator): New class, used to handle ++ and
16553 -- separatedly from the other unary operators. Cleans up the
16554 code, and kills the ExpressionStatement dependency in Unary.
16556 (Unary): Removed `method' and `Arguments' from this class, making
16557 it smaller, and moving it all to SimpleCall, so I can reuse this
16558 code in other locations and avoid creating a lot of transient data
16559 strucutres when not required.
16561 * cs-parser.jay: Adjust for new changes.
16563 2001-11-11 Miguel de Icaza <miguel@ximian.com>
16565 * enum.cs (Enum.Populate): If there is a failure during
16568 * cs-parser.jay (opt_enum_base): we used to catch type errors
16569 here, but this is really incorrect. The type error should be
16570 catched during semantic analysis.
16572 2001-12-11 Ravi Pratap <ravi@ximian.com>
16574 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
16575 current_local_parameters as expected since I, in my stupidity, had forgotten
16578 * attribute.cs (GetValidPlaces): Fix stupid bug.
16580 * class.cs (Method::Emit): Perform check on applicability of attributes.
16582 (Constructor::Emit): Ditto.
16584 (Field::Emit): Ditto.
16586 (Field.Location): Store location information.
16588 (Property, Event, Indexer, Operator): Ditto.
16590 * cs-parser.jay (field_declaration): Pass in location for each field.
16592 * ../errors/cs0592.cs : Add.
16594 2001-11-12 Ravi Pratap <ravi@ximian.com>
16596 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
16598 (InitCoreTypes): Update accordingly.
16600 (RegisterAttrType, LookupAttr): Implement.
16602 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
16603 info about the same.
16605 (Resolve): Update to populate the above as necessary.
16607 (Error592): Helper.
16609 (GetValidPlaces): Helper to the above.
16611 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
16613 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
16615 2001-11-12 Ravi Pratap <ravi@ximian.com>
16617 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
16619 * ../errors/cs0617.cs : Add.
16621 2001-11-11 Ravi Pratap <ravi@ximian.com>
16623 * enum.cs (Emit): Rename to Populate to be more consistent with what
16624 we expect it to do and when exactly it is called.
16626 * class.cs, rootcontext.cs : Update accordingly.
16628 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
16629 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
16631 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
16633 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
16634 of a fieldinfo using the above, when dealing with a FieldBuilder.
16636 2001-11-10 Ravi Pratap <ravi@ximian.com>
16638 * ../errors/cs0031.cs : Add.
16640 * ../errors/cs1008.cs : Add.
16642 * ../errrors/cs0543.cs : Add.
16644 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
16647 (FindMembers): Implement.
16649 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
16650 enums and delegates too.
16652 (enum_types): Rename to builder_to_enum.
16654 (delegate_types): Rename to builder_to_delegate.
16656 * delegate.cs (FindMembers): Implement.
16658 2001-11-09 Ravi Pratap <ravi@ximian.com>
16660 * typemanager.cs (IsEnumType): Implement.
16662 * enum.cs (Emit): Re-write parts to account for the underlying type
16663 better and perform checking etc.
16665 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
16666 of the underlying type.
16668 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
16671 * enum.cs (error31): Helper to report error #31.
16673 * cs-parser.jay (enum_declaration): Store location of each member too.
16675 * enum.cs (member_to_location): New hashtable.
16677 (AddEnumMember): Update location hashtable.
16679 (Emit): Use the location of each member while reporting errors.
16681 2001-11-09 Miguel de Icaza <miguel@ximian.com>
16683 * cs-parser.jay: A for_initializer if is a
16684 local_variable_declaration really ammount to have an implicit
16685 block with the variable declaration and no initializer for for.
16687 * statement.cs (For.Emit): Cope with null initializers.
16689 This fixes the infinite loop on for initializers.
16691 2001-11-08 Miguel de Icaza <miguel@ximian.com>
16693 * enum.cs: More cleanup.
16695 * ecore.cs: Remove dead code.
16697 * class.cs (Property.Emit): More simplification.
16698 (Event.Emit): ditto.
16700 Reworked to have less levels of indentation.
16702 2001-11-08 Ravi Pratap <ravi@ximian.com>
16704 * class.cs (Property): Emit attributes.
16714 * enum.cs (Emit): Ditto.
16716 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
16719 * class.cs (Field, Event, etc.): Move attribute generation into the
16720 Emit method everywhere.
16722 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
16723 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
16724 as we had no way of defining nested enums !
16726 * rootcontext.cs : Adjust code accordingly.
16728 * typemanager.cs (AddEnumType): To keep track of enum types separately.
16730 2001-11-07 Ravi Pratap <ravi@ximian.com>
16732 * expression.cs (EvalConstantExpression): Move into ecore.cs
16734 * enum.cs (Enum): Rename some members and make them public and readonly
16735 according to our convention.
16737 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
16740 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
16742 (Enum::Emit): Write a simple version for now which doesn't try to compute
16743 expressions. I shall modify this to be more robust in just a while.
16745 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
16747 (TypeContainer::CloseType): Create the Enum types too.
16749 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
16751 * expression.cs (EvalConstantExpression): Get rid of completely.
16753 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
16754 user-defined values and other cases.
16756 (IsValidEnumLiteral): Helper function.
16758 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
16759 out there in the case we had a literal FieldExpr.
16761 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
16763 (Literalize): Revamp a bit to take two arguments.
16765 (EnumLiteral): New class which derives from Literal to wrap enum literals.
16767 2001-11-06 Ravi Pratap <ravi@ximian.com>
16769 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
16771 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
16773 (Resolve): Use the above to ensure we have proper initializers.
16775 2001-11-05 Ravi Pratap <ravi@ximian.com>
16777 * expression.cs (Expression::EvalConstantExpression): New method to
16778 evaluate constant expressions.
16780 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
16782 2001-11-07 Miguel de Icaza <miguel@ximian.com>
16784 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
16787 (Binary.ResolveOperator): Handle operator != (object a, object b)
16788 and operator == (object a, object b);
16790 (Binary.DoNumericPromotions): Indicate whether the numeric
16791 promotion was possible.
16793 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
16796 Made the ArrayAccess implement interface IAssignMethod instead of
16797 IStackStore as the order in which arguments are passed reflects
16800 * assign.cs: Instead of using expr.ExprClass to select the way of
16801 assinging, probe for the IStackStore/IAssignMethod interfaces.
16803 * typemanager.cs: Load InitializeArray definition.
16805 * rootcontext.cs (RootContext.MakeStaticData): Used to define
16806 static data that can be used to initialize arrays.
16808 2001-11-05 Miguel de Icaza <miguel@ximian.com>
16810 * expression.cs: Handle operator== and operator!= for booleans.
16812 (Conditioal.Reduce): Implement reducer for the ?: operator.
16814 (Conditional.Resolve): Implement dead code elimination.
16816 (Binary.Resolve): Catch string literals and return a new
16817 concatenated string.
16819 (Unary.Reduce): Implement reduction of unary expressions.
16821 * ecore.cs: Split out the expression core handling here.
16823 (Expression.Reduce): New method used to perform constant folding
16824 and CSE. This is needed to support constant-expressions.
16826 * statement.cs (Statement.EmitBoolExpression): Pass true and false
16827 targets, and optimize for !x.
16829 2001-11-04 Ravi Pratap <ravi@ximian.com>
16831 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
16832 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
16833 set custom atttributes.
16835 * literal.cs (Literal::GetValue): New abstract method to return the actual
16836 value of the literal, cast as an object.
16838 (*Literal): Implement GetValue method.
16840 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
16841 expressions to the arraylist but objects of type Argument.
16843 * class.cs (TypeContainer::Emit): Emit our attributes too.
16845 (Method::Emit, Constructor::Emit): Ditto.
16847 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
16848 to be ignoring earlier.
16850 2001-11-03 Ravi Pratap <ravi@ximian.com>
16852 * attribute.cs (AttributeSection::Define): Implement to do the business
16853 of constructing a CustomAttributeBuilder.
16855 (Attribute): New trivial class. Increases readability of code.
16857 * cs-parser.jay : Update accordingly.
16859 (positional_argument_list, named_argument_list, named_argument): New rules
16861 (attribute_arguments): Use the above so that we are more correct.
16863 2001-11-02 Ravi Pratap <ravi@ximian.com>
16865 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
16866 to perform all checks for a method with a params parameter.
16868 (Invocation::OverloadResolve): Update to use the above method and therefore
16869 cope correctly with params method invocations.
16871 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
16874 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
16875 constructors in our parent too because we can't afford to miss out on
16878 * attribute.cs (AttributeSection): New name for the class Attribute
16880 Other trivial changes to improve readability.
16882 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
16883 use the new class names.
16885 2001-11-01 Ravi Pratap <ravi@ximian.com>
16887 * class.cs (Method::Define): Complete definition for params types too
16889 (Indexer::Define): Ditto.
16891 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
16892 Cope everywhere with a request for info about the array parameter.
16894 2001-11-01 Ravi Pratap <ravi@ximian.com>
16896 * tree.cs (RecordNamespace): Fix up to check for the correct key.
16898 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
16899 local_variable_type to extract the string corresponding to the type.
16901 (local_variable_type): Fixup the action to use the new helper method.
16903 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
16906 * expression.cs : Clean out code which uses the above.
16908 2001-10-31 Ravi Pratap <ravi@ximian.com>
16910 * typemanager.cs (RegisterMethod): Check if we already have an existing key
16911 and bale out if necessary by returning a false.
16913 (RegisterProperty): Ditto.
16915 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
16916 and print out appropriate error messages.
16918 * interface.cs (everywhere): Ditto.
16920 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
16921 location to constructor.
16923 * class.cs (Property, Event, Indexer): Update accordingly.
16925 * ../errors/cs111.cs : Added.
16927 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
16928 of a method, as laid down by the spec.
16930 (Invocation::OverloadResolve): Use the above method.
16932 2001-10-31 Ravi Pratap <ravi@ximian.com>
16934 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
16935 now take a TypeContainer and a Parameters object.
16937 (ParameterData): Modify return type of ParameterModifier method to be
16938 Parameter.Modifier and not a string.
16940 (ReflectionParameters, InternalParameters): Update accordingly.
16942 * expression.cs (Argument::GetParameterModifier): Same here.
16944 * support.cs (InternalParameters::ParameterType): Find a better way of determining
16945 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
16946 symbol in it at all so maybe this is only for now.
16948 2001-10-30 Ravi Pratap <ravi@ximian.com>
16950 * support.cs (InternalParameters): Constructor now takes an extra argument
16951 which is the actual Parameters class.
16953 (ParameterDesc): Update to provide info on ref/out modifiers.
16955 * class.cs (everywhere): Update call to InternalParameters to pass in
16956 the second argument too.
16958 * support.cs (ParameterData): Add ParameterModifier, which is a method
16959 to return the modifier info [ref/out etc]
16961 (InternalParameters, ReflectionParameters): Implement the above.
16963 * expression.cs (Argument::ParameterModifier): Similar function to return
16964 info about the argument's modifiers.
16966 (Invocation::OverloadResolve): Update to take into account matching modifiers
16969 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
16970 a new SetFormalParameters object which we pass to InternalParameters.
16972 2001-10-30 Ravi Pratap <ravi@ximian.com>
16974 * expression.cs (NewArray): Merge into the ArrayCreation class.
16976 2001-10-29 Ravi Pratap <ravi@ximian.com>
16978 * expression.cs (NewArray): Merge classes NewBuiltinArray and
16979 NewUserdefinedArray into one as there wasn't much of a use in having
16982 * expression.cs (Argument): Change field's name to ArgType from Type.
16984 (Type): New readonly property which returns the proper type, taking into
16985 account ref/out modifiers.
16987 (everywhere): Adjust code accordingly for the above.
16989 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
16990 whether we are emitting for a ref or out parameter.
16992 * expression.cs (Argument::Emit): Use the above field to set the state.
16994 (LocalVariableReference::Emit): Update to honour the flag and emit the
16997 * parameter.cs (Attributes): Set the correct flags for ref parameters.
16999 * expression.cs (Argument::FullDesc): New function to provide a full desc.
17001 * support.cs (ParameterData): Add method ParameterDesc to the interface.
17003 (ReflectionParameters, InternalParameters): Implement the above method.
17005 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
17008 (Invocation::FullMethodDesc): Ditto.
17010 2001-10-29 Miguel de Icaza <miguel@ximian.com>
17012 * cs-parser.jay: Add extra production for the second form of array
17015 * expression.cs (ArrayCreation): Update to reflect the above
17018 * Small changes to prepare for Array initialization.
17020 2001-10-28 Miguel de Icaza <miguel@ximian.com>
17022 * typemanager.cs (ImplementsInterface): interface might be null;
17023 Deal with this problem;
17025 Also, we do store negative hits on the cache (null values), so use
17026 this instead of calling t.GetInterfaces on the type everytime.
17028 2001-10-28 Ravi Pratap <ravi@ximian.com>
17030 * typemanager.cs (IsBuiltinType): New method to help determine the same.
17032 * expression.cs (New::DoResolve): Get rid of array creation code and instead
17033 split functionality out into different classes.
17035 (New::FormArrayType): Move into NewBuiltinArray.
17037 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
17040 (NewBuiltinArray): New class to handle creation of built-in arrays.
17042 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
17043 account creation of one-dimensional arrays.
17045 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
17047 (NewUserdefinedArray::DoResolve): Implement.
17049 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
17051 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
17052 we maintain inside the TypeManager. This is necessary to perform lookups on the
17055 (LookupType): Update to perform GetType on the module builders too.
17057 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
17059 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
17061 2001-10-23 Ravi Pratap <ravi@ximian.com>
17063 * expression.cs (New::DoResolve): Implement guts of array creation.
17065 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
17067 2001-10-27 Miguel de Icaza <miguel@ximian.com>
17069 * expression.cs: Fix bug I introduced lsat night that broke
17072 (Expression.Resolve): Report a 246 error (can not resolve name)
17073 if we find a SimpleName in the stream.
17075 (Expression.ResolveLValue): Ditto.
17077 (Expression.ResolveWithSimpleName): This function is a variant of
17078 ResolveName, this one allows SimpleNames to be returned without a
17079 warning. The only consumer of SimpleNames is MemberAccess
17081 2001-10-26 Miguel de Icaza <miguel@ximian.com>
17083 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
17084 might arrive here. I have my doubts that this is correct.
17086 * statement.cs (Lock): Implement lock statement.
17088 * cs-parser.jay: Small fixes to support `lock' and `using'
17090 * cs-tokenizer.cs: Remove extra space
17092 * driver.cs: New flag --checked, allows to turn on integer math
17095 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
17096 Threading.Monitor.Exit
17098 2001-10-23 Miguel de Icaza <miguel@ximian.com>
17100 * expression.cs (IndexerAccess::DoResolveLValue): Set the
17101 Expression Class to be IndexerAccess.
17103 Notice that Indexer::DoResolve sets the eclass to Value.
17105 2001-10-22 Miguel de Icaza <miguel@ximian.com>
17107 * class.cs (TypeContainer::Emit): Emit code for indexers.
17109 * assign.cs (IAssignMethod): New interface implemented by Indexers
17110 and Properties for handling assignment.
17112 (Assign::Emit): Simplify and reuse code.
17114 * expression.cs (IndexerAccess, PropertyExpr): Implement
17115 IAssignMethod, clean up old code.
17117 2001-10-22 Ravi Pratap <ravi@ximian.com>
17119 * typemanager.cs (ImplementsInterface): New method to determine if a type
17120 implements a given interface. Provides a nice cache too.
17122 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
17125 (ConvertReferenceExplicit): Ditto.
17127 * delegate.cs (Delegate::Populate): Update to define the parameters on the
17128 various methods, with correct names etc.
17130 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
17131 Operator.UnaryNegation.
17133 * cs-parser.jay (operator_declarator): Be a little clever in the case where
17134 we have a unary plus or minus operator.
17136 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
17139 * everywhere : update accordingly.
17141 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
17144 * class.cs (Method::Define): For the case where we are implementing a method
17145 inherited from an interface, we need to set the MethodAttributes.Final flag too.
17146 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
17148 2001-10-21 Ravi Pratap <ravi@ximian.com>
17150 * interface.cs (FindMembers): Implement to work around S.R.E
17153 * typemanager.cs (IsInterfaceType): Implement.
17155 (FindMembers): Update to handle interface types too.
17157 * expression.cs (ImplicitReferenceConversion): Re-write bits which
17158 use IsAssignableFrom as that is not correct - it doesn't work.
17160 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
17161 and accordingly override EmitStatement.
17163 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
17164 using the correct logic :-)
17166 2001-10-19 Ravi Pratap <ravi@ximian.com>
17168 * ../errors/cs-11.cs : Add to demonstrate error -11
17170 2001-10-17 Miguel de Icaza <miguel@ximian.com>
17172 * assign.cs (Assign::Resolve): Resolve right hand side first, and
17173 then pass this as a hint to ResolveLValue.
17175 * expression.cs (FieldExpr): Add Location information
17177 (FieldExpr::LValueResolve): Report assignment to readonly
17180 (Expression::ExprClassFromMemberInfo): Pass location information.
17182 (Expression::ResolveLValue): Add new method that resolves an
17185 (Expression::DoResolveLValue): Default invocation calls
17188 (Indexers): New class used to keep track of indexers in a given
17191 (IStackStore): Renamed from LValue, as it did not really describe
17192 what this did. Also ResolveLValue is gone from this interface and
17193 now is part of Expression.
17195 (ElementAccess): Depending on the element access type
17197 * typemanager.cs: Add `indexer_name_type' as a Core type
17198 (System.Runtime.CompilerServices.IndexerNameAttribute)
17200 * statement.cs (Goto): Take a location.
17202 2001-10-18 Ravi Pratap <ravi@ximian.com>
17204 * delegate.cs (Delegate::VerifyDelegate): New method to verify
17205 if two delegates are compatible.
17207 (NewDelegate::DoResolve): Update to take care of the case when
17208 we instantiate a delegate from another delegate.
17210 * typemanager.cs (FindMembers): Don't even try to look up members
17211 of Delegate types for now.
17213 2001-10-18 Ravi Pratap <ravi@ximian.com>
17215 * delegate.cs (NewDelegate): New class to take care of delegate
17218 * expression.cs (New): Split the delegate related code out into
17219 the NewDelegate class.
17221 * delegate.cs (DelegateInvocation): New class to handle delegate
17224 * expression.cs (Invocation): Split out delegate related code into
17225 the DelegateInvocation class.
17227 2001-10-17 Ravi Pratap <ravi@ximian.com>
17229 * expression.cs (New::DoResolve): Implement delegate creation fully
17230 and according to the spec.
17232 (New::DoEmit): Update to handle delegates differently.
17234 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
17235 because of which we were printing out arguments in reverse order !
17237 * delegate.cs (VerifyMethod): Implement to check if the given method
17238 matches the delegate.
17240 (FullDelegateDesc): Implement.
17242 (VerifyApplicability): Implement.
17244 * expression.cs (Invocation::DoResolve): Update to accordingly handle
17245 delegate invocations too.
17247 (Invocation::Emit): Ditto.
17249 * ../errors/cs1593.cs : Added.
17251 * ../errors/cs1594.cs : Added.
17253 * delegate.cs (InstanceExpression, TargetMethod): New properties.
17255 2001-10-16 Ravi Pratap <ravi@ximian.com>
17257 * typemanager.cs (intptr_type): Core type for System.IntPtr
17259 (InitCoreTypes): Update for the same.
17261 (iasyncresult_type, asynccallback_type): Ditto.
17263 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
17266 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
17269 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
17270 the builders for the 4 members of a delegate type :-)
17272 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
17275 * expression.cs (New::DoResolve): Implement guts for delegate creation.
17277 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
17279 2001-10-15 Miguel de Icaza <miguel@ximian.com>
17281 * statement.cs (Break::Emit): Implement.
17282 (Continue::Emit): Implement.
17284 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
17285 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
17286 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
17287 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
17290 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
17291 properties that track the label for the current loop (begin of the
17292 loop and end of the loop).
17294 2001-10-15 Ravi Pratap <ravi@ximian.com>
17296 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
17297 use of emitting anything at all.
17299 * class.cs, rootcontext.cs : Get rid of calls to the same.
17301 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
17303 (Populate): Define the constructor correctly and set the implementation
17306 * typemanager.cs (delegate_types): New hashtable to hold delegates that
17309 (AddDelegateType): Implement.
17311 (IsDelegateType): Implement helper method.
17313 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
17315 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
17316 and accordingly handle it.
17318 * delegate.cs (Populate): Take TypeContainer argument.
17319 Implement bits to define the Invoke method. However, I still haven't figured out
17320 how to take care of the native int bit :-(
17322 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
17323 Qualify the name of the delegate, not its return type !
17325 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
17328 (StandardConversionExists): Checking for array types turns out to be recursive.
17330 (ConvertReferenceExplicit): Implement array conversion.
17332 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
17334 2001-10-12 Ravi Pratap <ravi@ximian.com>
17336 * cs-parser.jay (delegate_declaration): Store the fully qualified
17337 name as it is a type declaration.
17339 * delegate.cs (ReturnType, Name): Rename members to these. Make them
17342 (DefineDelegate): Renamed from Define. Does the same thing essentially,
17343 as TypeContainer::DefineType.
17345 (Populate): Method in which all the definition of the various methods (Invoke)
17348 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
17351 (CloseDelegate): Finally creates the delegate.
17353 * class.cs (TypeContainer::DefineType): Update to define delegates.
17354 (Populate, Emit and CloseType): Do the same thing here too.
17356 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
17357 delegates in all these operations.
17359 2001-10-14 Miguel de Icaza <miguel@ximian.com>
17361 * expression.cs: LocalTemporary: a new expression used to
17362 reference a temporary that has been created.
17364 * assign.cs: Handle PropertyAccess back here, so that we can
17365 provide the proper semantic access to properties.
17367 * expression.cs (Expression::ConvertReferenceExplicit): Implement
17368 a few more explicit conversions.
17370 * modifiers.cs: `NEW' modifier maps to HideBySig.
17372 * expression.cs (PropertyExpr): Make this into an
17373 ExpressionStatement, and support the EmitStatement code path.
17375 Perform get/set error checking, clean up the interface.
17377 * assign.cs: recognize PropertyExprs as targets, and if so, turn
17378 them into toplevel access objects.
17380 2001-10-12 Miguel de Icaza <miguel@ximian.com>
17382 * expression.cs: PropertyExpr::PropertyExpr: use work around the
17385 * typemanager.cs: Keep track here of our PropertyBuilders again to
17386 work around lameness in SRE.
17388 2001-10-11 Miguel de Icaza <miguel@ximian.com>
17390 * expression.cs (LValue::LValueResolve): New method in the
17391 interface, used to perform a second resolution pass for LValues.
17393 (This::DoResolve): Catch the use of this in static methods.
17395 (This::LValueResolve): Implement.
17397 (This::Store): Remove warning, assigning to `this' in structures
17400 (Invocation::Emit): Deal with invocation of
17401 methods on value types. We need to pass the address to structure
17402 methods rather than the object itself. (The equivalent code to
17403 emit "this" for structures leaves the entire structure on the
17404 stack instead of a pointer to it).
17406 (ParameterReference::DoResolve): Compute the real index for the
17407 argument based on whether the method takes or not a `this' pointer
17408 (ie, the method is static).
17410 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
17411 value types returned from functions when we need to invoke a
17412 method on the sturcture.
17415 2001-10-11 Ravi Pratap <ravi@ximian.com>
17417 * class.cs (TypeContainer::DefineType): Method to actually do the business of
17418 defining the type in the Modulebuilder or Typebuilder. This is to take
17419 care of nested types which need to be defined on the TypeBuilder using
17420 DefineNestedMethod.
17422 (TypeContainer::GetClassBases): Implement. Essentially the code from the
17423 methods in RootContext, only ported to be part of TypeContainer.
17425 (TypeContainer::GetInterfaceOrClass): Ditto.
17427 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
17429 * interface.cs (Interface::DefineInterface): New method. Does exactly
17430 what RootContext.CreateInterface did earlier, only it takes care of nested types
17433 (Interface::GetInterfaces): Move from RootContext here and port.
17435 (Interface::GetInterfaceByName): Same here.
17437 * rootcontext.cs (ResolveTree): Re-write.
17439 (PopulateTypes): Re-write.
17441 * class.cs (TypeContainer::Populate): Populate nested types too.
17442 (TypeContainer::Emit): Emit nested members too.
17444 * typemanager.cs (AddUserType): Do not make use of the FullName property,
17445 instead just use the name argument passed in as it is already fully
17448 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
17449 to TypeContainer mapping to see if a type is user-defined.
17451 * class.cs (TypeContainer::CloseType): Implement.
17453 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
17454 the default constructor.
17456 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
17459 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
17461 * interface.cs (CloseType): Create the type here.
17463 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
17466 Remove all the methods which are now in TypeContainer.
17468 2001-10-10 Ravi Pratap <ravi@ximian.com>
17470 * delegate.cs (Define): Re-write bits to define the delegate
17473 2001-10-10 Miguel de Icaza <miguel@ximian.com>
17475 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
17477 * expression.cs (ImplicitReferenceConversion): handle null as well
17478 as a source to convert to any reference type.
17480 * statement.cs (Return): Perform any implicit conversions to
17481 expected return type.
17483 Validate use of return statement.
17485 * codegen.cs (EmitContext): Pass the expected return type here.
17487 * class.cs (Method, Constructor, Property): Pass expected return
17488 type to EmitContext.
17490 2001-10-09 Miguel de Icaza <miguel@ximian.com>
17492 * expression.cs: Make DoResolve take an EmitContext instead of a
17495 Replaced `l' and `location' for `loc', for consistency.
17497 (Error, Warning): Remove unneeded Tc argument.
17499 * assign.cs, literal.cs, constant.cs: Update to new calling
17502 * codegen.cs: EmitContext now contains a flag indicating whether
17503 code is being generated in a static method or not.
17505 * cs-parser.jay: DecomposeQI, new function that replaces the old
17506 QualifiedIdentifier. Now we always decompose the assembled
17507 strings from qualified_identifier productions into a group of
17510 2001-10-08 Miguel de Icaza <miguel@ximian.com>
17512 * rootcontext.cs: Deal with field-less struct types correctly now
17513 by passing the size option to Define Type.
17515 * class.cs: Removed hack that created one static field.
17517 2001-10-07 Miguel de Icaza <miguel@ximian.com>
17519 * statement.cs: Moved most of the code generation here.
17521 2001-10-09 Ravi Pratap <ravi@ximian.com>
17523 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
17526 (ElementAccess): Remove useless bits for now - keep checks as the spec
17529 2001-10-08 Ravi Pratap <ravi@ximian.com>
17531 * expression.cs (ElementAccess::DoResolve): Remove my crap code
17532 and start performing checks according to the spec.
17534 2001-10-07 Ravi Pratap <ravi@ximian.com>
17536 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
17537 rank_specifiers instead.
17539 (rank_specifiers): Change the order in which the rank specifiers are stored
17541 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
17543 * expression.cs (ElementAccess): Implement the LValue interface too.
17545 2001-10-06 Ravi Pratap <ravi@ximian.com>
17547 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
17548 except that user defined conversions are not included.
17550 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
17551 perform the conversion of the return type, if necessary.
17553 (New::DoResolve): Check whether we are creating an array or an object
17554 and accordingly do the needful.
17556 (New::Emit): Same here.
17558 (New::DoResolve): Implement guts of array creation.
17560 (New::FormLookupType): Helper function.
17562 2001-10-07 Miguel de Icaza <miguel@ximian.com>
17564 * codegen.cs: Removed most of the code generation here, and move the
17565 corresponding code generation bits to the statement classes.
17567 Added support for try/catch/finalize and throw.
17569 * cs-parser.jay: Added support for try/catch/finalize.
17571 * class.cs: Catch static methods having the flags override,
17572 virtual or abstract.
17574 * expression.cs (UserCast): This user cast was not really doing
17575 what it was supposed to do. Which is to be born in fully resolved
17576 state. Parts of the resolution were being performed at Emit time!
17580 2001-10-05 Miguel de Icaza <miguel@ximian.com>
17582 * expression.cs: Implicity convert the result from UserCast.
17584 2001-10-05 Ravi Pratap <ravi@ximian.com>
17586 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
17587 prevented it from working correctly.
17589 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
17590 merely ConvertImplicit.
17592 2001-10-05 Miguel de Icaza <miguel@ximian.com>
17594 * typemanager.cs: Make the LookupTypeContainer function static,
17595 and not per-instance.
17597 * class.cs: Make static FindMembers (the one that takes a Type
17600 * codegen.cs: Add EmitForeach here.
17602 * cs-parser.jay: Make foreach a toplevel object instead of the
17603 inline expansion, as we need to perform semantic analysis on it.
17605 2001-10-05 Ravi Pratap <ravi@ximian.com>
17607 * expression.cs (Expression::ImplicitUserConversion): Rename to
17608 UserDefinedConversion.
17610 (Expression::UserDefinedConversion): Take an extra argument specifying
17611 whether we look for explicit user conversions too.
17613 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
17615 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
17617 (ExplicitUserConversion): Make it a call to UserDefinedConversion
17618 with the appropriate arguments.
17620 * cs-parser.jay (cast_expression): Record location too.
17622 * expression.cs (Cast): Record location info.
17624 (Expression::ConvertExplicit): Take location argument.
17626 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
17627 to determine if we are doing explicit conversions.
17629 (UserCast::Emit): Update accordingly.
17631 (Expression::ConvertExplicit): Report an error if everything fails.
17633 * ../errors/cs0030.cs : Add.
17635 2001-10-04 Miguel de Icaza <miguel@ximian.com>
17637 * modifiers.cs: If the ABSTRACT keyword is present, also set the
17638 virtual and newslot bits.
17640 * class.cs (TypeContainer::RegisterRequiredImplementations):
17641 Record methods we need.
17643 (TypeContainer::MakeKey): Helper function to make keys for
17644 MethodBases, since the Methodbase key is useless.
17646 (TypeContainer::Populate): Call RegisterRequiredImplementations
17647 before defining the methods.
17649 Create a mapping for method_builders_to_methods ahead of time
17650 instead of inside a tight loop.
17652 (::RequireMethods): Accept an object as the data to set into the
17653 hashtable so we can report interface vs abstract method mismatch.
17655 2001-10-03 Miguel de Icaza <miguel@ximian.com>
17657 * report.cs: Make all of it static.
17659 * rootcontext.cs: Drop object_type and value_type computations, as
17660 we have those in the TypeManager anyways.
17662 Drop report instance variable too, now it is a global.
17664 * driver.cs: Use try/catch on command line handling.
17666 Add --probe option to debug the error reporting system with a test
17669 * report.cs: Add support for exiting program when a probe
17670 condition is reached.
17672 2001-10-03 Ravi Pratap <ravi@ximian.com>
17674 * expression.cs (Binary::DoNumericPromotions): Fix the case when
17675 we do a forcible conversion regardless of type, to check if
17676 ForceConversion returns a null.
17678 (Binary::error19): Use location to report error.
17680 (Unary::error23): Use location here too.
17682 * ../errors/cs0019.cs : Check in.
17684 * ../errors/cs0023.cs : Check in.
17686 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
17687 case of a non-null MethodInfo object with a length of 0 !
17689 (Binary::ResolveOperator): Flag error if overload resolution fails to find
17690 an applicable member - according to the spec :-)
17691 Also fix logic to find members in base types.
17693 (Unary::ResolveOperator): Same here.
17695 (Unary::report23): Change name to error23 and make first argument a TypeContainer
17696 as I was getting thoroughly confused between this and error19 :-)
17698 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
17699 (::FindMostEncompassedType): Implement.
17700 (::FindMostEncompassingType): Implement.
17701 (::StandardConversionExists): Implement.
17703 (UserImplicitCast): Re-vamp. We now need info about most specific
17704 source and target types so that we can do the necessary conversions.
17706 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
17707 mathematical union with no duplicates.
17709 2001-10-03 Miguel de Icaza <miguel@ximian.com>
17711 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
17712 in order from base classes to child classes, so that we can in
17713 child classes look up in our parent for method names and
17714 attributes (required for handling abstract, virtual, new, override
17715 constructs: we need to instrospect our base class, and if we dont
17716 populate the classes in order, the introspection might be
17717 incorrect. For example, a method could query its parent before
17718 the parent has any methods and would determine that the parent has
17719 no abstract methods (while it could have had them)).
17721 (RootContext::CreateType): Record the order in which we define the
17724 2001-10-02 Miguel de Icaza <miguel@ximian.com>
17726 * class.cs (TypeContainer::Populate): Also method definitions can
17727 fail now, keep track of this.
17729 (TypeContainer::FindMembers): Implement support for
17730 DeclaredOnly/noDeclaredOnly flag.
17732 (Constructor::Emit) Return the ConstructorBuilder.
17734 (Method::Emit) Return the MethodBuilder.
17735 Check for abstract or virtual methods to be public.
17737 * rootcontext.cs (RootContext::CreateType): Register all the
17738 abstract methods required for the class to be complete and the
17739 interface methods that must be implemented.
17741 * cs-parser.jay: Report error 501 (method requires body if it is
17742 not marked abstract or extern).
17744 * expression.cs (TypeOf::Emit): Implement.
17746 * typemanager.cs: runtime_handle_type, new global type.
17748 * class.cs (Property::Emit): Generate code for properties.
17750 2001-10-02 Ravi Pratap <ravi@ximian.com>
17752 * expression.cs (Unary::ResolveOperator): Find operators on base type
17753 too - we now conform exactly to the spec.
17755 (Binary::ResolveOperator): Same here.
17757 * class.cs (Operator::Define): Fix minor quirk in the tests.
17759 * ../errors/cs0215.cs : Added.
17761 * ../errors/cs0556.cs : Added.
17763 * ../errors/cs0555.cs : Added.
17765 2001-10-01 Miguel de Icaza <miguel@ximian.com>
17767 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
17768 single integer which is really efficient
17770 2001-10-01 Ravi Pratap <ravi@ximian.com>
17772 * expression.cs (Expression::ImplicitUserConversion): Use location
17773 even in the case when we are examining True operators.
17775 * class.cs (Operator::Define): Perform extensive checks to conform
17776 with the rules for operator overloading in the spec.
17778 * expression.cs (Expression::ImplicitReferenceConversion): Implement
17779 some of the other conversions mentioned in the spec.
17781 * typemanager.cs (array_type): New static member for the System.Array built-in
17784 (cloneable_interface): For System.ICloneable interface.
17786 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
17787 we start resolving the tree and populating types.
17789 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
17791 2001-10-01 Miguel de Icaza <miguel@ximian.com>
17793 * expression.cs (Expression::ExprClassFromMemberInfo,
17794 Expression::Literalize): Create literal expressions from
17795 FieldInfos which are literals.
17797 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
17798 type casts, because they were wrong. The test suite in tests
17801 (ImplicitNumericConversion): ushort to ulong requires a widening
17804 Int32 constant to long requires widening cast as well.
17806 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
17807 for integers because the type on the stack is not i4.
17809 2001-09-30 Miguel de Icaza <miguel@ximian.com>
17811 * expression.cs (report118): require location argument.
17813 * parameter.cs: Do not dereference potential null value.
17815 * class.cs: Catch methods that lack the `new' keyword when
17816 overriding a name. Report warnings when `new' is used without
17817 anything being there to override.
17819 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
17821 * class.cs: Only add constructor to hashtable if it is non-null
17822 (as now constructors can fail on define).
17824 (TypeManager, Class, Struct): Take location arguments.
17826 Catch field instance initialization in structs as errors.
17828 accepting_filter: a new filter for FindMembers that is static so
17829 that we dont create an instance per invocation.
17831 (Constructor::Define): Catch errors where a struct constructor is
17834 * cs-parser.jay: Pass location information for various new
17837 * delegate.cs (Delegate): take a location argument.
17839 * driver.cs: Do not call EmitCode if there were problesm in the
17840 Definition of the types, as many Builders wont be there.
17842 * decl.cs (Decl::Decl): Require a location argument.
17844 * cs-tokenizer.cs: Handle properly hex constants that can not fit
17845 into integers, and find the most appropiate integer for it.
17847 * literal.cs: Implement ULongLiteral.
17849 * rootcontext.cs: Provide better information about the location of
17850 failure when CreateType fails.
17852 2001-09-29 Miguel de Icaza <miguel@ximian.com>
17854 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
17857 * expression.cs (Binary::CheckShiftArguments): Add missing type
17859 (Binary::ResolveOperator): Add type to the logical and and logical
17860 or, Bitwise And/Or and Exclusive Or code paths, it was missing
17863 (Binary::DoNumericPromotions): In the case where either argument
17864 is ulong (and most signed types combined with ulong cause an
17865 error) perform implicit integer constant conversions as well.
17867 2001-09-28 Miguel de Icaza <miguel@ximian.com>
17869 * expression.cs (UserImplicitCast): Method should always be
17871 (Invocation::BetterConversion): Simplified test for IntLiteral.
17873 (Expression::ImplicitNumericConversion): Split this routine out.
17874 Put the code that performs implicit constant integer conversions
17877 (Expression::Resolve): Become a wrapper around DoResolve so we can
17878 check eclass and type being set after resolve.
17880 (Invocation::Badness): Remove this dead function
17882 (Binary::ResolveOperator): Do not compute the expensive argumnets
17883 unless we have a union for it.
17885 (Probe::Emit): Is needs to do an isinst and then
17886 compare against null.
17888 (::CanConvert): Added Location argument. If the Location argument
17889 is null (Location.Null), then we do not report errors. This is
17890 used by the `probe' mechanism of the Explicit conversion. We do
17891 not want to generate an error for something that the user
17892 explicitly requested to be casted. But the pipeline for an
17893 explicit cast first tests for potential implicit casts.
17895 So for now, if the Location is null, it means `Probe only' to
17896 avoid adding another argument. Might have to revise this
17899 (ClassCast): New class used to type cast objects into arbitrary
17900 classes (used in Explicit Reference Conversions).
17902 Implement `as' as well.
17904 Reverted all the patches from Ravi below: they were broken:
17906 * The use of `level' as a mechanism to stop recursive
17907 invocations is wrong. That was there just to catch the
17908 bug with a strack trace but not as a way of addressing
17911 To fix the problem we have to *understand* what is going
17912 on and the interactions and come up with a plan, not
17913 just get things going.
17915 * The use of the type conversion cache that I proposed
17916 last night had an open topic: How does this work across
17917 protection domains. A user defined conversion might not
17918 be public in the location where we are applying the
17919 conversion, a different conversion might be selected
17920 (ie, private A->B (better) but public B->A (worse),
17921 inside A, A->B applies, but outside it, B->A will
17924 * On top of that (ie, even if the above is solved),
17925 conversions in a cache need to be abstract. Ie, `To
17926 convert from an Int to a Short use an OpcodeCast', not
17927 `To convert from an Int to a Short use the OpcodeCast on
17928 the variable 5' (which is what this patch was doing).
17930 2001-09-28 Ravi Pratap <ravi@ximian.com>
17932 * expression.cs (Invocation::ConversionExists): Re-write to use
17933 the conversion cache
17935 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
17936 cache all conversions done, not just user-defined ones.
17938 (Invocation::BetterConversion): The real culprit. Use ConversionExists
17939 to determine if a conversion exists instead of acutually trying to
17940 perform the conversion. It's faster too.
17942 (Expression::ConvertExplicit): Modify to use ConversionExists to check
17943 and only then attempt the implicit conversion.
17945 2001-09-28 Ravi Pratap <ravi@ximian.com>
17947 * expression.cs (ConvertImplicit): Use a cache for conversions
17948 already found. Check level of recursion and bail out if necessary.
17950 2001-09-28 Miguel de Icaza <miguel@ximian.com>
17952 * typemanager.cs (string_concat_string_string, string_concat_object_object):
17953 Export standard methods that we expect for string operations.
17955 * statement.cs (Block::UsageWarning): Track usage of variables and
17956 report the errors for not used variables.
17958 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
17961 2001-09-27 Miguel de Icaza <miguel@ximian.com>
17963 * codegen.cs: remove unnneded code
17965 * expression.cs: Removed BuiltinTypeAccess class
17967 Fix the order in which implicit conversions are
17970 The previous fixed dropped support for boxed conversions (adding a
17971 test to the test suite now)
17973 (UserImplicitCast::CanConvert): Remove test for source being null,
17974 that code is broken. We should not feed a null to begin with, if
17975 we do, then we should track the bug where the problem originates
17976 and not try to cover it up here.
17978 Return a resolved expression of type UserImplicitCast on success
17979 rather than true/false. Ravi: this is what I was talking about,
17980 the pattern is to use a static method as a "constructor" for
17983 Also, do not create arguments until the very last minute,
17984 otherwise we always create the arguments even for lookups that
17985 will never be performed.
17987 (UserImplicitCast::Resolve): Eliminate, objects of type
17988 UserImplicitCast are born in a fully resolved state.
17990 * typemanager.cs (InitCoreTypes): Init also value_type
17991 (System.ValueType).
17993 * expression.cs (Cast::Resolve): First resolve the child expression.
17995 (LValue): Add new method AddressOf to be used by
17998 Change the argument of Store to take an EmitContext instead of an
17999 ILGenerator, because things like FieldExpr need to be able to call
18000 their children expression to generate the instance code.
18002 (Expression::Error, Expression::Warning): Sugar functions for
18005 (Expression::MemberLookup): Accept a TypeContainer instead of a
18006 Report as the first argument.
18008 (Expression::ResolvePrimary): Killed. I still want to improve
18009 this as currently the code is just not right.
18011 (Expression::ResolveMemberAccess): Simplify, but it is still
18014 (Unary::Resolve): Catch errors in AddressOf operators.
18016 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
18017 index to a byte for the short-version, or the compiler will choose
18018 the wrong Emit call, which generates the wrong data.
18020 (ParameterReference::Emit, ::Store): same.
18022 (FieldExpr::AddressOf): Implement.
18024 * typemanager.cs: TypeManager: made public variable instead of
18027 * driver.cs: document --fatal.
18029 * report.cs (ErrorMessage, WarningMessage): new names for the old
18030 Error and Warning classes.
18032 * cs-parser.jay (member_access): Turn built-in access to types
18033 into a normal simplename
18035 2001-09-27 Ravi Pratap <ravi@ximian.com>
18037 * expression.cs (Invocation::BetterConversion): Fix to cope
18038 with q being null, since this was introducing a bug.
18040 * expression.cs (ConvertImplicit): Do built-in conversions first.
18042 2001-09-27 Ravi Pratap <ravi@ximian.com>
18044 * expression.cs (UserImplicitCast::Resolve): Fix bug.
18046 2001-09-27 Ravi Pratap <ravi@ximian.com>
18048 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
18049 I had introduced long ago (what's new ?).
18051 * expression.cs (UserImplicitCast::CanConvert): Static method to do
18052 the work of all the checking.
18053 (ConvertImplicit): Call CanConvert and only then create object if necessary.
18054 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
18056 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
18057 that is the right way.
18059 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
18060 overloading resolution. Use everywhere instead of cutting and pasting code.
18062 (Binary::ResolveOperator): Use MakeUnionSet.
18064 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
18065 we have to convert to bool types. Not complete yet.
18067 2001-09-27 Miguel de Icaza <miguel@ximian.com>
18069 * typemanager.cs (TypeManager::CSharpName): support ushort.
18071 * expression.cs (Expression::TryImplicitIntConversion): Attempts
18072 to provide an expression that performsn an implicit constant int
18073 conversion (section 6.1.6).
18074 (Expression::ConvertImplicitRequired): Reworked to include
18075 implicit constant expression conversions.
18077 (Expression::ConvertNumericExplicit): Finished.
18079 (Invocation::Emit): If InstanceExpression is null, then it means
18080 that we perform a call on this.
18082 2001-09-26 Miguel de Icaza <miguel@ximian.com>
18084 * expression.cs (Unary::Emit): Remove some dead code.
18085 (Probe): Implement Resolve and Emit for `is'.
18086 (Expression::ConvertImplicitRequired): Attempt to do constant
18087 expression conversions here. Maybe should be moved to
18088 ConvertImplicit, but I am not sure.
18089 (Expression::ImplicitLongConstantConversionPossible,
18090 Expression::ImplicitIntConstantConversionPossible): New functions
18091 that tell whether is it possible to apply an implicit constant
18092 expression conversion.
18094 (ConvertNumericExplicit): Started work on explicit numeric
18097 * cs-parser.jay: Update operator constants.
18099 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
18100 (Parameters::GetSignature): Hook up VerifyArgs here.
18101 (Parameters::VerifyArgs): Verifies that no two arguments have the
18104 * class.cs (Operator): Update the operator names to reflect the
18105 ones that the spec expects (as we are just stringizing the
18108 * expression.cs (Unary::ResolveOperator): Fix bug: Use
18109 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
18110 previous usage did only work for our methods.
18111 (Expression::ConvertImplicit): Handle decimal implicit numeric
18112 conversions as well.
18113 (Expression::InternalTypeConstructor): Used to invoke constructors
18114 on internal types for default promotions.
18116 (Unary::Emit): Implement special handling for the pre/post
18117 increment/decrement for overloaded operators, as they need to have
18118 the same semantics as the other operators.
18120 (Binary::ResolveOperator): ditto.
18121 (Invocation::ConversionExists): ditto.
18122 (UserImplicitCast::Resolve): ditto.
18124 2001-09-26 Ravi Pratap <ravi@ximian.com>
18126 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
18127 operator, return after emitting body. Regression tests pass again !
18129 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
18130 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
18131 (Invocation::OverloadResolve): Ditto.
18132 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
18134 * everywhere : update calls to the above methods accordingly.
18136 2001-09-26 Miguel de Icaza <miguel@ximian.com>
18138 * assign.cs (Assign): Make it inherit from ExpressionStatement.
18140 * expression.cs (ExpressionStatement): New base class used for
18141 expressions that can appear in statements, so that we can provide
18142 an alternate path to generate expression that do not leave a value
18145 (Expression::Emit, and all the derivatives): We no longer return
18146 whether a value is left on the stack or not. Every expression
18147 after being emitted leaves a single value on the stack.
18149 * codegen.cs (EmitContext::EmitStatementExpression): Use the
18150 facilties of ExpressionStatement if possible.
18152 * cs-parser.jay: Update statement_expression.
18154 2001-09-25 Miguel de Icaza <miguel@ximian.com>
18156 * driver.cs: Change the wording of message
18158 2001-09-25 Ravi Pratap <ravi@ximian.com>
18160 * expression.cs (Binary::ResolveOperator): Had forgottten to set
18161 the type of the expression to the return type of the method if
18162 we have an overloaded operator match ! The regression tests pass again !
18163 (Unary::ResolveOperator): Ditto.
18165 * expression.cs (Invocation::ConversionExists): Correct the member lookup
18166 to find "op_Implicit", not "implicit" ;-)
18167 (UserImplicitCast): New class to take care of user-defined implicit conversions.
18168 (ConvertImplicit, ForceConversion): Take TypeContainer argument
18170 * everywhere : Correct calls to the above accordingly.
18172 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
18173 (ConvertImplicit): Do user-defined conversion if it exists.
18175 2001-09-24 Miguel de Icaza <miguel@ximian.com>
18177 * assign.cs: track location.
18178 (Resolve): Use implicit conversions on assignment.
18180 * literal.cs: Oops. Not good, Emit of short access values should
18181 pass (Bytes) or the wrong argument will be selected.
18183 * expression.cs (Unary::Emit): Emit code for -expr.
18185 (Unary::ResolveOperator): Handle `Substract' for non-constants
18186 (substract from zero from the non-constants).
18187 Deal with Doubles as well.
18189 (Expression::ConvertImplicitRequired): New routine that reports an
18190 error if no implicit conversion exists.
18192 (Invocation::OverloadResolve): Store the converted implicit
18193 expressions if we make them
18195 2001-09-24 Ravi Pratap <ravi@ximian.com>
18197 * class.cs (ConstructorInitializer): Take a Location argument.
18198 (ConstructorBaseInitializer): Same here.
18199 (ConstructorThisInitializer): Same here.
18201 * cs-parser.jay : Update all calls accordingly.
18203 * expression.cs (Unary, Binary, New): Take location argument.
18204 Update accordingly everywhere.
18206 * cs-parser.jay : Update all calls to the above to take a location
18209 * class.cs : Ditto.
18211 2001-09-24 Ravi Pratap <ravi@ximian.com>
18213 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
18214 (Invocation::BetterConversion): Same here
18215 (Invocation::ConversionExists): Ditto.
18217 (Invocation::ConversionExists): Implement.
18219 2001-09-22 Ravi Pratap <ravi@ximian.com>
18221 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
18222 Also take an additional TypeContainer argument.
18224 * All over : Pass in TypeContainer as argument to OverloadResolve.
18226 * typemanager.cs (CSharpName): Update to check for the string type and return
18229 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
18232 2001-09-21 Ravi Pratap <ravi@ximian.com>
18234 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
18235 (Invocation::BetterFunction): Implement.
18236 (Invocation::BetterConversion): Implement.
18237 (Invocation::ConversionExists): Skeleton, no implementation yet.
18239 Okay, things work fine !
18241 2001-09-21 Miguel de Icaza <miguel@ximian.com>
18243 * typemanager.cs: declare and load enum_type, delegate_type and
18246 * expression.cs (Expression::Emit): Now emit returns a value that
18247 tells whether a value is left on the stack or not. This strategy
18248 might be reveted tomorrow with a mechanism that would address
18249 multiple assignments.
18250 (Expression::report118): Utility routine to report mismatches on
18253 (Unary::Report23): Report impossible type/operator combination
18256 (Unary::IsIncrementableNumber): Whether the type can be
18257 incremented or decremented with add.
18258 (Unary::ResolveOperator): Also allow enumerations to be bitwise
18260 (Unary::ResolveOperator): Implement ++, !, ~,
18262 (Invocation::Emit): Deal with new Emit convetion.
18264 * All Expression derivatives: Updated their Emit method to return
18265 whether they leave values on the stack or not.
18267 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
18268 stack for expressions that are statements.
18270 2001-09-20 Miguel de Icaza <miguel@ximian.com>
18272 * expression.cs (LValue): New interface. Must be implemented by
18274 (LocalVariableReference, ParameterReference, FieldExpr): Implement
18277 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
18278 interface for generating code, simplifies the code.
18280 2001-09-20 Ravi Pratap <ravi@ximian.com>
18282 * expression.cs (everywhere): Comment out return statements in ::Resolve
18283 methods to avoid the warnings.
18285 2001-09-20 Miguel de Icaza <miguel@ximian.com>
18287 * driver.cs (parse): Report error 2001 if we can not open the
18290 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
18293 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
18296 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
18297 otherwise nested blocks end up with the same index.
18299 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
18301 * expression.cs: Instead of having FIXMEs in the Resolve
18302 functions, throw exceptions so it is obvious that we are facing a
18305 * cs-parser.jay (invocation_expression): Pass Location information.
18307 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
18308 Use a basename for those routines because .NET does not like paths
18311 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
18314 2001-09-19 Miguel de Icaza <miguel@ximian.com>
18316 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
18317 are loading the correct data types (throws an exception if not).
18318 (TypeManager::InitCoreTypes): Use CoreLookupType
18320 * expression.cs (Unary::ResolveOperator): return the child
18321 expression for expressions which are just +expr.
18322 (Unary::ResolveOperator): Return negative literals for -LITERAL
18323 expressions (otherwise they are Unary {Literal}).
18324 (Invocation::Badness): Take into account `Implicit constant
18325 expression conversions'.
18327 * literal.cs (LongLiteral): Implement long literal class.
18328 (IntLiteral): export the `Value' of the intliteral.
18330 2001-09-19 Ravi Pratap <ravi@ximian.com>
18332 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
18334 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
18335 instead of 'Operator'
18337 * expression.cs (Binary::ResolveOperator): Update accordingly.
18338 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
18341 * cs-parser.jay (unary_expression): Update to use the new names.
18343 * gen-treedump.cs (GetUnary): Same here.
18345 * expression.cs (Unary::Resolve): Implement.
18346 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
18347 operators are found instead of making noise ;-)
18348 (Unary::ResolveOperator): New method to do precisely the same thing which
18349 Binary::ResolveOperator does for Binary expressions.
18350 (Unary.method, .Arguments): Add.
18351 (Unary::OperName): Implement.
18352 (Unary::ForceConversion): Copy and Paste !
18354 * class.cs (Operator::Define): Fix a small bug for the case when we have
18357 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
18358 for the inbuilt operators. Only overloading works for now ;-)
18360 2001-09-18 Miguel de Icaza <miguel@ximian.com>
18362 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
18363 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
18365 * expression.cs (This::Emit): Implement.
18366 (This::Resolve): Implement.
18367 (TypeOf:Resolve): Implement.
18368 (Expression::ResolveSimpleName): Add an implicit this to instance
18370 (MemberAccess::Resolve): Deal with Parameters and Fields.
18371 Bind instance variable to Field expressions.
18372 (FieldExpr::Instance): New field used to track the expression that
18373 represents the object instance.
18374 (FieldExpr::Resolve): Track potential errors from MemberLookup not
18376 (FieldExpr::Emit): Implement.
18378 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
18379 the last instruction contains a return opcode to avoid generating
18380 the last `ret' instruction (this generates correct code, and it is
18381 nice to pass the peverify output).
18383 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
18384 initializer for static and instance variables.
18385 (Constructor::Emit): Allow initializer to be null in the case of
18386 static constructors. Only emit initializer for instance
18389 (TypeContainer::FindMembers): Return a null array if there are no
18392 Also fix the code for the MemberTypes.Method branch, as it was not
18393 scanning that for operators (or tried to access null variables before).
18395 * assign.cs (Assign::Emit): Handle instance and static fields.
18399 * driver.cs: Stop compilation if there are parse errors.
18401 * cs-parser.jay (constructor_declaration): Provide default base
18402 initializer for non-static constructors.
18403 (constructor_declarator): Do not provide a default base
18404 initializers if none was specified.
18405 Catch the fact that constructors should not have parameters.
18407 * class.cs: Do not emit parent class initializers for static
18408 constructors, that should be flagged as an error.
18410 2001-09-18 Ravi Pratap <ravi@ximian.com>
18412 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
18413 Move back code into TypeContainer::Populate.
18415 2001-09-18 Ravi Pratap <ravi@ximian.com>
18417 * class.cs (TypeContainer::AddConstructor): Fix the check to
18418 compare against Name, not Basename.
18419 (Operator::OpType): Change Plus and Minus to Add and Subtract.
18421 * cs-parser.jay : Update accordingly.
18423 * class.cs (TypeContainer::FindMembers): For the case where we are searching
18424 for methods, don't forget to look into the operators too.
18425 (RegisterMethodBuilder): Helper method to take care of this for
18426 methods, constructors and operators.
18427 (Operator::Define): Completely revamp.
18428 (Operator.OperatorMethod, MethodName): New fields.
18429 (TypeContainer::Populate): Move the registering of builders into
18430 RegisterMethodBuilder.
18431 (Operator::Emit): Re-write.
18433 * expression.cs (Binary::Emit): Comment out code path to emit method
18434 invocation stuff for the case when we have a user defined operator. I am
18435 just not able to get it right !
18437 2001-09-17 Miguel de Icaza <miguel@ximian.com>
18439 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
18442 (Expression::MemberLookup): Provide a version that allows to
18443 specify the MemberTypes and BindingFlags.
18445 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
18446 so it was not fetching variable information from outer blocks.
18448 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
18449 Beforefieldinit as it was buggy.
18451 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
18452 that Ravi put here.
18454 * class.cs (Constructor::Emit): Only emit if block is not null.
18455 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
18456 deal with this by semantically definining it as if the user had
18459 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
18460 constructors as we now "emit" them at a higher level.
18462 (TypeContainer::DefineDefaultConstructor): Used to define the
18463 default constructors if none was provided.
18465 (ConstructorInitializer): Add methods Resolve and Emit.
18467 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
18469 2001-09-17 Ravi Pratap <ravi@ximian.com>
18471 * class.cs (TypeContainer::EmitDefaultConstructor): Register
18472 the default constructor builder with our hashtable for methodbuilders
18475 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
18476 and argument_count is 0 in which case we have a match.
18477 (Binary::ResolveOperator): More null checking and miscellaneous coding
18480 2001-09-17 Ravi Pratap <ravi@ximian.com>
18482 * rootcontext.cs (IsNameSpace): Compare against null.
18484 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
18486 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
18487 and Unary::Operator.
18489 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
18492 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
18493 we have overloaded operators.
18494 (Binary::ResolveOperator): Implement the part which does the operator overload
18497 * class.cs (Operator::Emit): Implement.
18498 (TypeContainer::Emit): Emit the operators we have too.
18500 * expression.cs (Binary::Emit): Update to emit the appropriate code for
18501 the case when we have a user-defined operator.
18503 2001-09-17 Miguel de Icaza <miguel@ximian.com>
18505 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
18507 2001-09-16 Ravi Pratap <ravi@ximian.com>
18509 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
18510 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
18511 (Constructor::Emit): Implement.
18512 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
18513 if we have no work to do.
18514 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
18517 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
18518 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
18520 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
18523 2001-09-15 Ravi Pratap <ravi@ximian.com>
18525 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
18527 (Tree::RecordNamespace): Method to do what the name says ;-)
18528 (Tree::Namespaces): Property to get at the namespaces hashtable.
18530 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
18533 * rootcontext.cs (IsNamespace): Fixed it :-)
18535 2001-09-14 Miguel de Icaza <miguel@ximian.com>
18537 * class.cs (TypeContainer::FindMembers): Add support for
18539 (MethodCore): New class that encapsulates both the shared aspects
18540 of a Constructor and a Method.
18541 (Method, Constructor): Factored pieces into MethodCore.
18543 * driver.cs: Added --fatal which makes errors throw exceptions.
18544 Load System assembly as well as part of the standard library.
18546 * report.cs: Allow throwing exceptions on errors for debugging.
18548 * modifiers.cs: Do not use `parent', instead use the real type
18549 container to evaluate permission settings.
18551 * class.cs: Put Ravi's patch back in. He is right, and we will
18552 have to cope with the
18554 2001-09-14 Ravi Pratap <ravi@ximian.com>
18556 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
18557 FamORAssem, not FamANDAssem.
18559 2001-09-14 Miguel de Icaza <miguel@ximian.com>
18561 * driver.cs: Added --parse option that only parses its input files
18564 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
18565 incorrect. IsTopLevel is not used to tell whether an object is
18566 root_types or not (that can be achieved by testing this ==
18567 root_types). But to see if this is a top-level *class* (not
18568 necessarly our "toplevel" container).
18570 2001-09-14 Ravi Pratap <ravi@ximian.com>
18572 * enum.cs (Enum::Define): Modify to call the Lookup method on the
18573 parent instead of a direct call to GetType.
18575 2001-09-14 Ravi Pratap <ravi@ximian.com>
18577 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
18578 Modifiers.TypeAttr. This should just be a call to that method.
18580 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
18581 object so that we can determine if we are top-level or not.
18583 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
18586 * enum.cs (Enum::Define): Ditto.
18588 * modifiers.cs (FieldAttr): Re-write.
18590 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
18591 (TypeContainer::HaveStaticConstructor): New property to provide access
18592 to precisely that info.
18594 * modifiers.cs (MethodAttr): Re-write.
18595 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
18597 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
18598 of top-level types as claimed.
18600 2001-09-13 Miguel de Icaza <miguel@ximian.com>
18602 * expression.cs (MemberLookup): Fruitless attempt to lookup
18603 constructors. Maybe I need to emit default constructors? That
18604 might be it (currently .NET emits this for me automatically).
18605 (Invocation::OverloadResolve): Cope with Arguments == null.
18606 (Invocation::EmitArguments): new function, shared by the new
18607 constructor and us.
18608 (Invocation::Emit): Handle static and instance methods. Emit
18609 proper call instruction for virtual or non-virtual invocations.
18610 (New::Emit): Implement.
18611 (New::Resolve): Implement.
18612 (MemberAccess:Resolve): Implement.
18613 (MethodGroupExpr::InstanceExpression): used conforming to the spec
18614 to track instances.
18615 (FieldExpr::Resolve): Set type.
18617 * support.cs: Handle empty arguments.
18619 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
18620 SimpleLookup): Auxiliary routines to help parse a qualifier
18623 Update qualifier_identifier rule.
18625 * codegen.cs: Removed debugging messages.
18627 * class.cs: Make this a global thing, this acts just as a "key" to
18628 objects that we might have around.
18630 (Populate): Only initialize method_builders_to_methods once.
18632 * expression.cs (PropertyExpr): Initialize type from the
18635 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
18636 Resolve pattern. Attempt to implicitly convert value to boolean.
18639 * expression.cs: Set the type for the int32/int32 argument case.
18640 (Binary::ResolveOperator): Set the return type to boolean for
18641 comparission operators
18643 * typemanager.cs: Remove debugging print code.
18645 (Invocation::Resolve): resolve type.
18647 * class.cs: Allocate a MemberInfo of the correct size, as the code
18648 elsewhere depends on the test to reflect the correct contents.
18650 (Method::) Keep track of parameters, due to System.Reflection holes
18652 (TypeContainer::Populate): Keep track of MethodBuilders to Method
18655 (TypeContainer::FindMembers): Use ArrayList and then copy an array
18656 of the exact size and return that.
18658 (Class::LookupMethodByBuilder): New function that maps
18659 MethodBuilders to its methods. Required to locate the information
18660 on methods because System.Reflection bit us again.
18662 * support.cs: New file, contains an interface ParameterData and
18663 two implementations: ReflectionParameters and InternalParameters
18664 used to access Parameter information. We will need to grow this
18667 * expression.cs (Invocation::GetParameterData): implement a cache
18668 and a wrapper around the ParameterData creation for methods.
18669 (Invocation::OverloadResolve): Use new code.
18671 2001-09-13 Ravi Pratap <ravi@ximian.com>
18673 * class.cs (TypeContainer::EmitField): Remove and move into
18674 (Field::Define): here and modify accordingly.
18675 (Field.FieldBuilder): New member.
18676 (TypeContainer::Populate): Update accordingly.
18677 (TypeContainer::FindMembers): Implement.
18679 2001-09-13 Miguel de Icaza <miguel@ximian.com>
18681 * statement.cs: (VariableInfo::VariableType): New field to be
18682 initialized with the full type once it is resolved.
18684 2001-09-12 Miguel de Icaza <miguel@ximian.com>
18686 * parameter.cs (GetParameterInfo): Use a type cache to compute
18687 things only once, and to reuse this information
18689 * expression.cs (LocalVariableReference::Emit): Implement.
18690 (OpcodeCast::Emit): fix.
18692 (ParameterReference::Resolve): Implement.
18693 (ParameterReference::Emit): Implement.
18695 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
18696 that are expressions need to stay as Expressions.
18698 * typemanager.cs (CSharpName): Returns the C# name of a type if
18701 * expression.cs (Expression::ConvertImplicit): New function that
18702 implements implicit type conversions.
18704 (Expression::ImplicitReferenceConversion): Implements implicit
18705 reference conversions.
18707 (EmptyCast): New type for transparent casts.
18709 (OpcodeCast): New type for casts of types that are performed with
18710 a sequence of bytecodes.
18712 (BoxedCast): New type used for casting value types into reference
18713 types. Emits a box opcode.
18715 (Binary::DoNumericPromotions): Implements numeric promotions of
18716 and computation of the Binary::Type.
18718 (Binary::EmitBranchable): Optimization.
18720 (Binary::Emit): Implement code emission for expressions.
18722 * typemanager.cs (TypeManager): Added two new core types: sbyte
18725 2001-09-12 Ravi Pratap <ravi@ximian.com>
18727 * class.cs (TypeContainer::FindMembers): Method which does exactly
18728 what Type.FindMembers does, only we don't have to use reflection. No
18729 implementation yet.
18731 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
18732 typecontainer objects as we need to get at them.
18733 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
18735 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
18736 typecontainer object.
18738 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
18739 of just a Report object.
18741 2001-09-11 Ravi Pratap <ravi@ximian.com>
18743 * class.cs (Event::Define): Go back to using the prefixes "add_" and
18745 (TypeContainer::Populate): Now define the delegates of the type too.
18746 (TypeContainer.Delegates): Property to access the list of delegates defined
18749 * delegates.cs (Delegate::Define): Implement partially.
18751 * modifiers.cs (TypeAttr): Handle more flags.
18753 2001-09-11 Ravi Pratap <ravi@ximian.com>
18755 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
18757 (Operator::Define): Re-write logic to get types by using the LookupType method
18758 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
18759 (Indexer::Define): Ditto.
18760 (Event::Define): Ditto.
18761 (Property::Define): Ditto.
18763 2001-09-10 Ravi Pratap <ravi@ximian.com>
18765 * class.cs (TypeContainer::Populate): Now define operators too.
18766 (TypeContainer.Operators): New property to access the list of operators
18768 (Operator.OperatorMethodBuilder): New member to hold the method builder
18769 for the operator we are defining.
18770 (Operator::Define): Implement.
18772 2001-09-10 Ravi Pratap <ravi@ximian.com>
18774 * class.cs (Event::Define): Make the prefixes of the accessor methods
18775 addOn_ and removeOn_
18777 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
18778 of the location being passed in too. Ideally, this should go later since all
18779 error reporting should be done through the Report object.
18781 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
18782 (Populate): Iterate thru the indexers we have and define them too.
18783 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
18784 for the get and set accessors.
18785 (Indexer::Define): Implement.
18787 2001-09-09 Miguel de Icaza <miguel@ximian.com>
18789 * expression.cs (Binary::Resolve): Beginning of it. I scratched
18790 my previous implementation, did not work.
18792 * typemanager.cs: Add a couple of missing types (the longs).
18794 * literal.cs: Use TypeManager.bool_type instead of getting it.
18796 * expression.cs (EventExpr): New kind of expressions.
18797 (Expressio::ExprClassFromMemberInfo): finish
18799 2001-09-08 Miguel de Icaza <miguel@ximian.com>
18801 * assign.cs: Emit stores to static fields differently.
18803 2001-09-08 Ravi Pratap <ravi@ximian.com>
18805 * Merge in changes and adjust code to tackle conflicts. Backed out my
18806 code in Assign::Resolve ;-)
18808 2001-09-08 Ravi Pratap <ravi@ximian.com>
18810 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
18811 instead Report.Error and also pass in the location.
18812 (CSharpParser::Lexer): New readonly property to return the reference
18813 to the Tokenizer object.
18814 (declare_local_variables): Use Report.Error with location instead of plain
18818 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
18819 (Operator.CheckBinaryOperator): Ditto.
18821 * cs-parser.jay (operator_declarator): Update accordingly.
18823 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
18824 (CheckBinaryOperator): Same here.
18826 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
18827 on the name without any prefixes of namespace names etc. This is because we
18828 already might have something already fully qualified like
18829 'System.Console.WriteLine'
18831 * assign.cs (Resolve): Begin implementation. Stuck ;-)
18833 2001-09-07 Ravi Pratap <ravi@ximian.com>
18835 * cs-tokenizer.cs (location): Return a string which also contains
18838 * expression.cs (ElementAccess): New class for expressions of the
18839 type 'element access.'
18840 (BaseAccess): New class for expressions of the type 'base access.'
18841 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
18844 * cs-parser.jay (element_access): Implement action.
18845 (base_access): Implement actions.
18846 (checked_expression, unchecked_expression): Implement.
18848 * cs-parser.jay (local_variable_type): Correct and implement.
18849 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
18851 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
18853 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
18854 name and the specifiers.
18856 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
18858 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
18859 making them all public ;-)
18861 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
18864 2001-09-07 Miguel de Icaza <miguel@ximian.com>
18866 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
18868 (FieldExpr, PropertyExprs): New resolved expressions.
18869 (SimpleName::MemberStaticCheck): Perform static checks for access
18870 to non-static fields on static methods. Maybe this should be
18871 generalized for MemberAccesses.
18872 (SimpleName::ResolveSimpleName): More work on simple name
18875 * cs-parser.jay (primary_expression/qualified_identifier): track
18876 the parameter index.
18878 * codegen.cs (CodeGen::Save): Catch save exception, report error.
18879 (EmitContext::EmitBoolExpression): Chain to expression generation
18880 instead of temporary hack.
18881 (::EmitStatementExpression): Put generic expression code generation.
18883 * assign.cs (Assign::Emit): Implement variable assignments to
18884 local variables, parameters and fields.
18886 2001-09-06 Miguel de Icaza <miguel@ximian.com>
18888 * statement.cs (Block::GetVariableInfo): New method, returns the
18889 VariableInfo for a variable name in a block.
18890 (Block::GetVariableType): Implement in terms of GetVariableInfo
18892 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
18893 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
18895 2001-09-06 Ravi Pratap <ravi@ximian.com>
18897 * cs-parser.jay (operator_declaration): Continue on my quest : update
18898 to take attributes argument.
18899 (event_declaration): Ditto.
18900 (enum_declaration): Ditto.
18901 (indexer_declaration): Ditto.
18903 * class.cs (Operator::Operator): Update constructor accordingly.
18904 (Event::Event): Ditto.
18906 * delegate.cs (Delegate::Delegate): Same here.
18908 * enum.cs (Enum::Enum): Same here.
18910 2001-09-05 Ravi Pratap <ravi@ximian.com>
18912 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
18914 * ../tests/cs0658.cs : New file to demonstrate error 0658.
18916 * attribute.cs (Attributes): New class to encapsulate all attributes which were
18917 being passed around as an arraylist.
18918 (Attributes::AddAttribute): Method to add attribute sections.
18920 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
18921 (struct_declaration): Update accordingly.
18922 (constant_declaration): Update.
18923 (field_declaration): Update.
18924 (method_header): Update.
18925 (fixed_parameter): Update.
18926 (parameter_array): Ditto.
18927 (property_declaration): Ditto.
18928 (destructor_declaration): Ditto.
18930 * class.cs (Struct::Struct): Update constructors accordingly.
18931 (Class::Class): Ditto.
18932 (Field::Field): Ditto.
18933 (Method::Method): Ditto.
18934 (Property::Property): Ditto.
18935 (TypeContainer::OptAttribute): update property's return type.
18937 * interface.cs (Interface.opt_attributes): New member.
18938 (Interface::Interface): Update to take the extra Attributes argument.
18940 * parameter.cs (Parameter::Parameter): Ditto.
18942 * constant.cs (Constant::Constant): Ditto.
18944 * interface.cs (InterfaceMemberBase): New OptAttributes field.
18945 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
18946 the attributes as a parameter.
18947 (InterfaceProperty): Update constructor call.
18948 (InterfaceEvent): Ditto.
18949 (InterfaceMethod): Ditto.
18950 (InterfaceIndexer): Ditto.
18952 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
18953 pass the attributes too.
18954 (interface_event_declaration): Ditto.
18955 (interface_property_declaration): Ditto.
18956 (interface_method_declaration): Ditto.
18957 (interface_declaration): Ditto.
18959 2001-09-05 Miguel de Icaza <miguel@ximian.com>
18961 * class.cs (Method::Define): Track the "static Main" definition to
18962 create an entry point.
18964 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
18965 EntryPoint if we find it.
18967 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
18968 (EmitContext::ig): Make this variable public.
18970 * driver.cs: Make the default output file be the first file name
18971 with the .exe extension.
18973 Detect empty compilations
18975 Handle various kinds of output targets. Handle --target and
18976 rename -t to --dumper.
18978 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
18979 methods inherited from Expression return now an Expression. This
18980 will is used during the tree rewriting as we resolve them during
18983 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
18984 the spec. Missing entirely is the information about
18985 accessability of elements of it.
18987 (Expression::ExprClassFromMemberInfo): New constructor for
18988 Expressions that creates a fully initialized Expression based on
18989 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
18992 (Invocation::Resolve): Begin implementing resolution of invocations.
18994 * literal.cs (StringLiteral): Implement Emit.
18996 2001-09-05 Ravi Pratap <ravi@ximian.com>
18998 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
19001 2001-09-04 Ravi Pratap <ravi@ximian.com>
19003 * cs-parser.jay (attribute_arguments): Implement actions.
19004 (attribute): Fix bug in production. Implement action.
19005 (attribute_list): Implement.
19006 (attribute_target): Implement.
19007 (attribute_target_specifier, opt_target_specifier): Implement
19008 (CheckAttributeTarget): New method to check if the attribute target
19010 (attribute_section): Implement.
19011 (opt_attributes): Implement.
19013 * attribute.cs : New file to handle attributes.
19014 (Attribute): Class to hold attribute info.
19016 * cs-parser.jay (opt_attribute_target_specifier): Remove production
19017 (attribute_section): Modify production to use 2 different rules to
19018 achieve the same thing. 1 s/r conflict down !
19019 Clean out commented, useless, non-reducing dimension_separator rules.
19021 * class.cs (TypeContainer.attributes): New member to hold list
19022 of attributes for a type.
19023 (Struct::Struct): Modify to take one more argument, the attribute list.
19024 (Class::Class): Ditto.
19025 (Field::Field): Ditto.
19026 (Method::Method): Ditto.
19027 (Property::Property): Ditto.
19029 * cs-parser.jay (struct_declaration): Update constructor call to
19030 pass in the attributes too.
19031 (class_declaration): Ditto.
19032 (constant_declaration): Ditto.
19033 (field_declaration): Ditto.
19034 (method_header): Ditto.
19035 (fixed_parameter): Ditto.
19036 (parameter_array): Ditto.
19037 (property_declaration): Ditto.
19039 * constant.cs (Constant::Constant): Update constructor similarly.
19040 Use System.Collections.
19042 * parameter.cs (Parameter::Parameter): Update as above.
19044 2001-09-02 Ravi Pratap <ravi@ximian.com>
19046 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
19047 (TypeContainer.delegates): New member to hold list of delegates.
19049 * cs-parser.jay (delegate_declaration): Implement the action correctly
19050 this time as I seem to be on crack ;-)
19052 2001-09-02 Miguel de Icaza <miguel@ximian.com>
19054 * rootcontext.cs (RootContext::IsNamespace): new function, used to
19055 tell whether an identifier represents a namespace.
19057 * expression.cs (NamespaceExpr): A namespace expression, used only
19058 temporarly during expression resolution.
19059 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
19060 utility functions to resolve names on expressions.
19062 2001-09-01 Miguel de Icaza <miguel@ximian.com>
19064 * codegen.cs: Add hook for StatementExpressions.
19066 * class.cs: Fix inverted test for static flag in methods.
19068 2001-09-02 Ravi Pratap <ravi@ximian.com>
19070 * class.cs (Operator::CheckUnaryOperator): Correct error number used
19071 to make it coincide with MS' number.
19072 (Operator::CheckBinaryOperator): Ditto.
19074 * ../errors/errors.txt : Remove error numbers added earlier.
19076 * ../errors/cs1019.cs : Test case for error # 1019
19078 * ../errros/cs1020.cs : Test case for error # 1020
19080 * cs-parser.jay : Clean out commented cruft.
19081 (dimension_separators, dimension_separator): Comment out. Ostensibly not
19082 used anywhere - non-reducing rule.
19083 (namespace_declarations): Non-reducing rule - comment out.
19085 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
19086 with TypeContainer::AddEnum.
19088 * delegate.cs : New file for delegate handling classes.
19089 (Delegate): Class for declaring delegates.
19091 * makefile : Update.
19093 * cs-parser.jay (delegate_declaration): Implement.
19095 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
19097 * class.cs (Event::Define): Implement.
19098 (Event.EventBuilder): New member.
19100 * class.cs (TypeContainer::Populate): Update to define all enums and events
19102 (Events): New property for the events arraylist we hold. Shouldn't we move to using
19103 readonly fields for all these cases ?
19105 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
19107 * class.cs (Property): Revamp to use the convention of making fields readonly.
19108 Accordingly modify code elsewhere.
19110 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
19111 the Define method of the Property class.
19113 * class.cs : Clean up applied patch and update references to variables etc. Fix
19115 (TypeContainer::Populate): Update to define all the properties we have. Also
19116 define all enumerations.
19118 * enum.cs (Define): Implement.
19120 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
19122 * cs-parser.jay (overloadable_operator): The semantic value is an
19123 enum of the Operator class.
19124 (operator_declarator): Implement actions.
19125 (operator_declaration): Implement.
19127 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
19128 validity of definitions.
19129 (Operator::CheckBinaryOperator): Static method to check for binary operators
19130 (TypeContainer::AddOperator): New method to add an operator to a type.
19132 * cs-parser.jay (indexer_declaration): Added line to actually call the
19133 AddIndexer method so it gets added ;-)
19135 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
19136 already taken care of by the MS compiler ?
19138 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
19140 * class.cs (Operator): New class for operator declarations.
19141 (Operator::OpType): Enum for the various operators.
19143 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
19145 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
19146 ostensibly handle this in semantic analysis.
19148 * cs-parser.jay (general_catch_clause): Comment out
19149 (specific_catch_clauses, specific_catch_clause): Ditto.
19150 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
19151 (catch_args, opt_catch_args): New productions.
19152 (catch_clause): Rewrite to use the new productions above
19153 (catch_clauses): Modify accordingly.
19154 (opt_catch_clauses): New production to use in try_statement
19155 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
19156 and re-write the code in the actions to extract the specific and
19157 general catch clauses by being a little smart ;-)
19159 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
19160 Hooray, try and catch statements parse fine !
19162 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19164 * statement.cs (Block::GetVariableType): Fix logic to extract the type
19165 string from the hashtable of variables.
19167 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
19168 I end up making that mistake ;-)
19169 (catch_clauses): Fixed gross error which made Key and Value of the
19170 DictionaryEntry the same : $1 !!
19172 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19174 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
19176 * cs-parser.jay (event_declaration): Correct to remove the semicolon
19177 when the add and remove accessors are specified.
19179 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19181 * cs-parser.jay (IndexerDeclaration): New helper class to hold
19182 information about indexer_declarator.
19183 (indexer_declarator): Implement actions.
19184 (parsing_indexer): New local boolean used to keep track of whether
19185 we are parsing indexers or properties. This is necessary because
19186 implicit_parameters come into picture even for the get accessor in the
19187 case of an indexer.
19188 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
19190 * class.cs (Indexer): New class for indexer declarations.
19191 (TypeContainer::AddIndexer): New method to add an indexer to a type.
19192 (TypeContainer::indexers): New member to hold list of indexers for the
19195 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
19197 * cs-parser.jay (add_accessor_declaration): Implement action.
19198 (remove_accessor_declaration): Implement action.
19199 (event_accessors_declaration): Implement
19200 (variable_declarators): swap statements for first rule - trivial.
19202 * class.cs (Event): New class to hold information about event
19204 (TypeContainer::AddEvent): New method to add an event to a type
19205 (TypeContainer::events): New member to hold list of events.
19207 * cs-parser.jay (event_declaration): Implement actions.
19209 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
19211 * cs-parser.jay (dim_separators): Implement. Make it a string
19212 concatenating all the commas together, just as they appear.
19213 (opt_dim_separators): Modify accordingly
19214 (rank_specifiers): Update accordingly. Basically do the same
19215 thing - instead, collect the brackets here.
19216 (opt_rank_sepcifiers): Modify accordingly.
19217 (array_type): Modify to actually return the complete type string
19218 instead of ignoring the rank_specifiers.
19219 (expression_list): Implement to collect the expressions
19220 (variable_initializer): Implement. We make it a list of expressions
19221 essentially so that we can handle the array_initializer case neatly too.
19222 (variable_initializer_list): Implement.
19223 (array_initializer): Make it a list of variable_initializers
19224 (opt_array_initializer): Modify accordingly.
19226 * expression.cs (New::NType): Add enumeration to help us
19227 keep track of whether we have an object/delegate creation
19228 or an array creation.
19229 (New:NewType, New::Rank, New::Indices, New::Initializers): New
19230 members to hold data about array creation.
19231 (New:New): Modify to update NewType
19232 (New:New): New Overloaded contructor for the array creation
19235 * cs-parser.jay (array_creation_expression): Implement to call
19236 the overloaded New constructor.
19238 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
19240 * class.cs (TypeContainer::Constructors): Return member
19241 constructors instead of returning null.
19243 2001-08-26 Miguel de Icaza <miguel@ximian.com>
19245 * typemanager.cs (InitCoreTypes): Initialize the various core
19246 types after we have populated the type manager with the user
19247 defined types (this distinction will be important later while
19248 compiling corlib.dll)
19250 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
19251 on Expression Classification. Now all expressions have a method
19252 `Resolve' and a method `Emit'.
19254 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
19255 generation from working. Also add some temporary debugging
19258 2001-08-24 Miguel de Icaza <miguel@ximian.com>
19260 * codegen.cs: Lots of code generation pieces. This is only the
19261 beginning, will continue tomorrow with more touches of polish. We
19262 handle the fundamentals of if, while, do, for, return. Others are
19263 trickier and I need to start working on invocations soon.
19265 * gen-treedump.cs: Bug fix, use s.Increment here instead of
19268 * codegen.cs (EmitContext): New struct, used during code
19269 emission to keep a context. Most of the code generation will be
19272 * cs-parser.jay: Add embedded blocks to the list of statements of
19273 this block. So code generation proceeds in a top down fashion.
19275 2001-08-23 Miguel de Icaza <miguel@ximian.com>
19277 * statement.cs: Add support for multiple child blocks.
19279 2001-08-22 Miguel de Icaza <miguel@ximian.com>
19281 * codegen.cs (EmitCode): New function, will emit the code for a
19282 Block of code given a TypeContainer and its ILGenerator.
19284 * statement.cs (Block): Standard public readonly optimization.
19285 (Block::Block constructors): Link children.
19286 (Block::Child): Child Linker.
19287 (Block::EmitVariables): Emits IL variable declarations.
19289 * class.cs: Drop support for MethodGroups here, delay until
19291 (Method::): Applied the same simplification that I did before, and
19292 move from Properties to public readonly fields.
19293 (Method::ParameterTypes): Returns the parameter types for the
19294 function, and implements a cache that will be useful later when I
19295 do error checking and the semantic analysis on the methods is
19297 (Constructor::GetCallingConvention): Renamed from CallingConvetion
19298 and made a method, optional argument tells whether this is a class
19299 or a structure to apply the `has-this' bit.
19300 (Method::GetCallingConvention): Implement, returns the calling
19302 (Method::Define): Defines the type, a second pass is performed
19303 later to populate the methods.
19305 (Constructor::ParameterTypes): implement a cache similar to the
19306 one on Method::ParameterTypes, useful later when we do semantic
19309 (TypeContainer::EmitMethod): New method. Emits methods.
19311 * expression.cs: Removed MethodGroup class from here.
19313 * parameter.cs (Parameters::GetCallingConvention): new method.
19315 2001-08-21 Miguel de Icaza <miguel@ximian.com>
19317 * class.cs (TypeContainer::Populate): Drop RootContext from the
19320 (Constructor::CallingConvention): Returns the calling convention.
19321 (Constructor::ParameterTypes): Returns the constructor parameter
19324 (TypeContainer::AddConstructor): Keep track of default constructor
19325 and the default static constructor.
19327 (Constructor::) Another class that starts using `public readonly'
19328 instead of properties.
19330 (Constructor::IsDefault): Whether this is a default constructor.
19332 (Field::) use readonly public fields instead of properties also.
19334 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
19335 track of static constructors; If none is used, turn on
19336 BeforeFieldInit in the TypeAttributes.
19338 * cs-parser.jay (opt_argument_list): now the return can be null
19339 for the cases where there are no arguments.
19341 (constructor_declarator): If there is no implicit `base' or
19342 `this', then invoke the default parent constructor.
19344 * modifiers.cs (MethodAttr): New static function maps a set of
19345 modifiers flags into a MethodAttributes enum
19346 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
19347 MethodAttr, TypeAttr to represent the various mappings where the
19348 modifiers are used.
19349 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
19351 2001-08-19 Miguel de Icaza <miguel@ximian.com>
19353 * parameter.cs (GetParameterInfo): Fix bug where there would be no
19356 * interface.cs (PopulateIndexer): Implemented the code generator
19357 for interface indexers.
19359 2001-08-17 Miguel de Icaza <miguel@ximian.com>
19361 * interface.cs (InterfaceMemberBase): Now we track the new status
19364 (PopulateProperty): Implement property population. Woohoo! Got
19365 Methods and Properties going today.
19367 Removed all the properties for interfaces, and replaced them with
19368 `public readonly' fields.
19370 2001-08-16 Miguel de Icaza <miguel@ximian.com>
19372 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
19373 initialize their hashtables/arraylists only when they are needed
19374 instead of doing this always.
19376 * parameter.cs: Handle refs and out parameters.
19378 * cs-parser.jay: Use an ArrayList to construct the arguments
19379 instead of the ParameterCollection, and then cast that to a
19382 * parameter.cs: Drop the use of ParameterCollection and use
19383 instead arrays of Parameters.
19385 (GetParameterInfo): Use the Type, not the Name when resolving
19388 2001-08-13 Miguel de Icaza <miguel@ximian.com>
19390 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
19391 and instead use public readonly fields.
19393 * class.cs: Put back walking code for type containers.
19395 2001-08-11 Miguel de Icaza <miguel@ximian.com>
19397 * class.cs (MakeConstant): Code to define constants.
19399 * rootcontext.cs (LookupType): New function. Used to locate types
19402 2001-08-08 Miguel de Icaza <miguel@ximian.com>
19404 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
19405 this System.Reflection code is. Kudos to Microsoft
19407 * typemanager.cs: Implement a type cache and avoid loading all
19408 types at boot time. Wrap in LookupType the internals. This made
19409 the compiler so much faster. Wow. I rule!
19411 * driver.cs: Make sure we always load mscorlib first (for
19412 debugging purposes, nothing really important).
19414 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
19415 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
19417 * rootcontext.cs: Lookup types on their namespace; Lookup types
19418 on namespaces that have been imported using the `using' keyword.
19420 * class.cs (TypeContainer::TypeAttr): Virtualize.
19421 (Class::TypeAttr): Return attributes suitable for this bad boy.
19422 (Struct::TypeAttr): ditto.
19423 Handle nested classes.
19424 (TypeContainer::) Remove all the type visiting code, it is now
19425 replaced with the rootcontext.cs code
19427 * rootcontext.cs (GetClassBases): Added support for structs.
19429 2001-08-06 Miguel de Icaza <miguel@ximian.com>
19431 * interface.cs, statement.cs, class.cs, parameter.cs,
19432 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
19433 Drop use of TypeRefs, and use strings instead.
19435 2001-08-04 Miguel de Icaza <miguel@ximian.com>
19439 * class.cs (Struct::Struct): set the SEALED flags after
19440 checking the modifiers.
19441 (TypeContainer::TypeAttr): new property, returns the
19442 TypeAttributes for a class.
19444 * cs-parser.jay (type_list): Oops, list production was creating a
19445 new list of base types.
19447 * rootcontext.cs (StdLib): New property.
19448 (GetInterfaceTypeByName): returns an interface by type name, and
19449 encapsulates error handling here.
19450 (GetInterfaces): simplified.
19451 (ResolveTree): Encapsulated all the tree resolution here.
19452 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
19455 * driver.cs: Add support for --nostdlib, to avoid loading the
19456 default assemblies.
19457 (Main): Do not put tree resolution here.
19459 * rootcontext.cs: Beginning of the class resolution.
19461 2001-08-03 Miguel de Icaza <miguel@ximian.com>
19463 * rootcontext.cs: Provide better error reporting.
19465 * cs-parser.jay (interface_base): set our $$ to be interfaces.
19467 * rootcontext.cs (CreateInterface): Handle the case where there
19468 are no parent interfaces.
19470 (CloseTypes): Routine to flush types at the end.
19471 (CreateInterface): Track types.
19472 (GetInterfaces): Returns an array of Types from the list of
19473 defined interfaces.
19475 * typemanager.c (AddUserType): Mechanism to track user types (puts
19476 the type on the global type hash, and allows us to close it at the
19479 2001-08-02 Miguel de Icaza <miguel@ximian.com>
19481 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
19482 RecordInterface instead.
19484 * cs-parser.jay: Updated to reflect changes above.
19486 * decl.cs (Definition): Keep track of the TypeBuilder type that
19487 represents this type here. Not sure we will use it in the long
19488 run, but wont hurt for now.
19490 * driver.cs: Smaller changes to accomodate the new code.
19492 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
19495 * rootcontext.cs (CreateInterface): New method, used to create
19496 the System.TypeBuilder type for interfaces.
19497 (ResolveInterfaces): new entry point to resolve the interface
19499 (CodeGen): Property, used to keep track of the code generator.
19501 2001-07-26 Miguel de Icaza <miguel@ximian.com>
19503 * cs-parser.jay: Add a second production for delegate_declaration
19506 (enum_body): Put an opt_comma here instead of putting it on
19507 enum_body or enum_member_declarations so we can handle trailing
19508 commas on enumeration members. Gets rid of a shift/reduce.
19510 (type_list): Need a COMMA in the middle.
19512 (indexer_declaration): Tell tokenizer to recognize get/set
19514 * Remove old targets.
19516 * Re-add the parser target.
19518 2001-07-13 Simon Cozens <simon@simon-cozens.org>
19520 * cs-parser.jay: Add precendence rules for a number of operators
19521 ot reduce the number of shift/reduce conflicts in the grammar.
19523 2001-07-17 Miguel de Icaza <miguel@ximian.com>
19525 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
19528 Get rid of old crufty code.
19530 * rootcontext.cs: Use this to keep track of the parsed
19531 representation and the defined types available to the program.
19533 * gen-treedump.cs: adjust for new convention.
19535 * type.cs: Split out the type manager, and the assembly builder
19538 * typemanager.cs: the type manager will live here now.
19540 * cil-codegen.cs: And the code generator here.
19542 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
19544 * makefile: Fixed up for easy making.
19546 2001-07-13 Simon Cozens <simon@simon-cozens.org>
19548 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
19551 (unary_expression): Expand pre_increment_expression and
19552 post_decrement_expression to reduce a shift/reduce.
19554 2001-07-11 Simon Cozens
19556 * cs-tokenizer.cs: Hex numbers should begin with a 0.
19558 Improve allow_keyword_as_indent name.
19560 2001-06-19 Miguel de Icaza <miguel@ximian.com>
19562 * Adjustments for Beta2.
19564 2001-06-13 Miguel de Icaza <miguel@ximian.com>
19566 * decl.cs: Added `Define' abstract method.
19567 (InTransit): new property, used to catch recursive definitions.
19569 * interface.cs: Implement `Define'.
19571 * modifiers.cs: Map Modifiers.constants to
19572 System.Reflection.TypeAttribute flags.
19574 * class.cs: Keep track of types and user-defined types.
19575 (BuilderInit): New method for creating an assembly
19576 (ResolveType): New function to launch the resolution process, only
19577 used by interfaces for now.
19579 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
19580 that are inserted into the name space.
19582 2001-06-08 Miguel de Icaza <miguel@ximian.com>
19584 * ARGH. I have screwed up my tree so many times due to the use of
19585 rsync rather than using CVS. Going to fix this at once.
19587 * driver.cs: Objetify driver. Load assemblies, use assemblies to
19590 2001-06-07 Miguel de Icaza <miguel@ximian.com>
19592 * Experiment successful: Use System.Type rather that our own
19595 2001-05-25 Miguel de Icaza <miguel@ximian.com>
19597 * cs-parser.jay: Removed nsAliases from here.
19599 Use new namespaces, handle `using XXX;'
19601 * namespace.cs: Reimplemented namespace handling, use a recursive
19602 definition of the class. Now we can keep track of using clauses
19603 and catch invalid using clauses.
19605 2001-05-24 Miguel de Icaza <miguel@ximian.com>
19607 * gen-treedump.cs: Adapted for all the renaming.
19609 * expression.cs (Expression): this class now has a Type property
19610 which returns an expression Type.
19612 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
19613 `Type', as this has a different meaning now in the base
19615 2001-05-22 Miguel de Icaza <miguel@ximian.com>
19617 * interface.cs, class.cs: Removed from all the sources the
19618 references to signature computation, as we can not do method
19619 signature computation during the parsing time, as we are not
19620 trying to solve at that point distinguishing:
19624 void a (NS.Blah x) {}
19627 Which depending on the context might be valid or not, as we do not
19628 know if Blah is the same thing as NS.Blah at that point.
19630 * Redid everything so the code uses TypeRefs now instead of
19631 Types. TypeRefs are just temporary type placeholders, that need
19632 to be resolved. They initially have a pointer to a string and the
19633 current scope in which they are used. This is used later by the
19634 compiler to resolve the reference to an actual Type.
19636 * DeclSpace is no longer a CIR.Type, and neither are
19637 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
19638 are all DeclSpaces, but no Types.
19640 * type.cs (TypeRefManager): This implements the TypeRef manager,
19641 which keeps track of all the types that need to be resolved after
19642 the parsing has finished.
19644 2001-05-13 Miguel de Icaza <miguel@ximian.com>
19646 * ARGH. We are going to have to store `foreach' as a class rather
19647 than resolving it, as we need to verify error 1579 after name
19648 resolution. *OR* we could keep a flag that says `This request to
19649 IEnumerator comes from a foreach statement' which we can then use
19650 to generate the error.
19652 2001-05-10 Miguel de Icaza <miguel@ximian.com>
19654 * class.cs (TypeContainer.AddMethod): we now add methods to the
19655 MethodGroup instead of the method hashtable.
19657 * expression.cs: Add MethodGroup abstraction, which gets us one
19658 step closer to the specification in the way we handle method
19661 * cs-parser.jay (primary_expression): qualified_identifier now
19662 tried to match up an identifier to a local variable reference or
19663 to a parameter reference.
19665 current_local_parameters is now a parser global variable that
19666 points to the current parameters for the block, used during name
19669 (property_declaration): Now creates an implicit `value' argument to
19672 2001-05-09 Miguel de Icaza <miguel@ximian.com>
19674 * parameter.cs: Do not use `param' arguments as part of the
19675 signature, per the spec.
19677 2001-05-08 Miguel de Icaza <miguel@ximian.com>
19679 * decl.cs: Base class for classes, structs and interfaces. This
19680 is the "Declaration Space"
19682 * cs-parser.jay: Use CheckDef for checking declaration errors
19683 instead of having one on each function.
19685 * class.cs: Factor out some code for handling error handling in
19686 accordance to the "Declarations" section in the "Basic Concepts"
19687 chapter in the ECMA C# spec.
19689 * interface.cs: Make all interface member classes derive from
19690 InterfaceMemberBase.
19692 2001-05-07 Miguel de Icaza <miguel@ximian.com>
19694 * Many things: all interfaces are parsed and generated in
19695 gen-treedump. Support for member variables, constructors,
19696 destructors, properties, constants is there.
19698 Beginning of the IL backend, but very little done, just there for
19701 2001-04-29 Miguel de Icaza <miguel@ximian.com>
19703 * cs-parser.jay: Fix labeled statement.
19705 * cs-tokenizer.cs (escape): Escape " and ' always.
19706 ref_line, ref_name: keep track of the line/filename as instructed
19707 by #line by the compiler.
19710 2001-04-27 Miguel de Icaza <miguel@ximian.com>
19712 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
19713 to match the values in System.CodeDOM.
19715 Divid renamed to Divide.
19717 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
19719 (Statements.set): remove.
19721 * System.CodeDOM/CodeCatchClause.cs: always have a valid
19724 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
19725 falseStatements always have valid values.
19727 * cs-parser.jay: Use System.CodeDOM now.