1 2006-08-15 Marek Safar <marek.safar@seznam.cz>
3 * expression.cs (SizeOf.DoResolve): Check for void type. Fixed enum types
5 * class.cs, ecore.cs, statement.cs: Merged to one error message.
7 2006-08-13 Miguel de Icaza <miguel@novell.com>
9 * assign.cs: Catch attempts to assign to a method groups in += and
12 2006-08-13 Marek Safar <marek.safar@seznam.cz>
15 * cs-parser.jay: Don't destroy current array type by typeof of array's.
17 2006-08-12 Marek Safar <marek.safar@seznam.cz>
19 * class.cs (Method.Define): Issue a warning when generic method looks like
21 * decl.cs (MemberCore.GetSignatureForError): Print member type arguments
24 2006-08-09 Marek Safar <marek.safar@seznam.cz>
26 * anonymous.cs(AnonymousDelegate.Emit): Uses Constructor filter when
28 * decl.cs (MemberCache.FindMembers): When container is interface we need to
29 search all base interfaces as a member can be ambiguous.
30 * delegate.cs (Delegate.FindMembers): Fixed to return valid data for
31 Constructor member type filter.
32 (Delegate.ResolveConstructorMethod) Uses Constructor filter.
33 * ecore.cs: (Expression.MemberLookup): Implemented ambiguity error/warning
34 reporting for returned memberinfos.
36 * typemanager.cs (TypeManager.LookupBaseInterfacesCache): Uses TypeManager
37 version to work on all runtimes.
38 (TypeManager.RealMemberLookup): Removed members filtering.
40 2006-08-08 Raja R Harinath <rharinath@novell.com>
42 * ecore.cs (FieldExpr.EmitAssign): Release temporary.
43 (PropertyExpr.EmitAssign): Likewise.
44 * expression.cs (Indirection.EmitAssign): Likewise.
45 (LocalVariableReference.EmitAssign): Likewise.
46 (ParameterReference.EmitAssign): Likewise.
47 (Invocation.EmitArguments): Likewise.
48 (ArrayAccess.EmitAssign): Likewise.
49 (IndexerAccess.EmitAssign): Likewise.
50 (This.EmitAssign): Likewise.
51 (ConditionalLogicalOperator.Emit): Likewise.
54 * codegen.cs (EmitContext.GetTemporaryLocal): Simplify. Use Stack
55 instead of ArrayList. If the hashtable has a LocalBuilder, don't
56 leave it in after returning it.
57 (EmitContext.FreeTemporaryLocal): Simplify. Update to changes.
59 2006-08-06 Marek Safar <marek.safar@seznam.cz>
61 * expresssion.cs (IndexerAccess.DoResolve): Fixed to report correct error
64 2006-08-03 Raja R Harinath <rharinath@novell.com>
66 Fix cs0146-3.cs and cs0146-4.cs.
67 * class.cs (TypeManager.CheckRecursiveDefinition): Check that
68 enclosing types don't depend on the current type.
70 2006-08-02 Raja R Harinath <rharinath@novell.com>
73 * class.cs (TypeContainer.DoDefineMembers): Use
74 FindBaseMemberWithSameName on Parent, since we're interested in
75 whether we hide inherited members or not.
76 (FindBaseMemberWithSameName): Make slightly more robust.
78 Fix the non-generic testcase from #77396
79 * decl.cs (DeclSpace.DeclContainer): Remove override.
81 * namespace.cs (NamespaceEntry.Doppelganger): Create slave
82 declspaces for doppelgangers too.
83 (UsingEntry): Implement IResolveContext.
84 (UsingEntry.Resolve): Don't set ToplevelTypes.Namespace. Use
85 'this' as the resolve context.
86 (LocalAliasEntry): Likewise.
88 Implement parts of #77403
89 * roottypes.cs (RootDeclSpace): New. Used to represent the
90 toplevel declaration space. Each namespace declaration introduces
91 a "partial" root declaretion space.
92 * namespace.cs (NamespaceEntry.SlaveDeclSpace): New.
93 (NamespaceEntry.ctor): Create a SlaveDeclSpace if necessary.
94 * cs-parser.jay (CSharpParser.ctor): Initialize 'current_class'
95 from 'current_namespace.SlaveDeclSpace'.
96 (namespace_declaration): Likewise.
97 * class.cs (TypeContainer.ctor): Remove parent==ToplevelTypes
98 check. It can't happen now.
99 * decl.cs (DeclSpace.LookupType): Likewise.
100 * driver.cs (MainDriver): Sanity check.
102 2006-08-01 Raja R Harinath <rharinath@novell.com>
104 * decl.cs (DeclSpace.FindNestedType): Remove.
105 (DeclSpace.LookupNestedTypeINHierarchy): Use PartialContainer and
106 LookupTypeContainer to get the container of the nested type.
107 * class.cs (TypeContainer.FindNestedType): Make non-override.
109 2006-07-31 Raja R Harinath <rharinath@novell.com>
111 * decl.cs (DeclSpace.PartialContainer): Move field from ...
112 * class.cs (TypeContainer.PartialContainer): ... here.
113 (TypeContainer.AddBasesForPart): New helper.
114 (MemberBase.ParentContainer): Remove. Use Parent.PartialContainer
116 * cs-parser.jay (current_class): Convert to DeclSpace.
117 (struct_declaration, interface_declaration, class_declaration):
118 Use AddBasesForPart instead of .Bases directly.
119 * const.cs, iterators.cs: Update to changes.
121 2006-07-28 Raja R Harinath <rharinath@novell.com>
123 * class.cs (TypeContainer.AddMemberType): Rename from
125 (TypeContainer.AddMember): Rename from AddToMemberContainer.
126 (AddTypeContainer): New. Combine AddClassOrStruct and
128 (AddPartial): Update. Add 'is_partial' argument.
129 * roottypes.cs: Update to changes.
130 * cs-parser.jay (push_current_class): New helper for handling
131 current_container and current_class.
132 (struct_declaration, interface_declaration, class_declaration):
135 2006-07-26 Raja R Harinath <rharinath@novell.com>
137 * roottypes.cs: Rename from tree.cs.
139 Rename RootContext.Tree.Types to RootContext.ToplevelTypes.
140 * tree.cs (Tree, ITreeDump): Remove types.
141 * rootcontext.cs (tree, Tree): Remove fields.
142 (root, ToplevelTypes): New.
143 * *.cs: Update to rename.
145 * tree.cs (Tree.RecordDecl): Remove.
146 (RootTypes.AddToTypeContainer): Record the toplevel type in its
148 * class.cs, cs-parser.jay: Remove mention of RecordDecl.
150 2006-07-23 Raja R Harinath <harinath@gmail.com>
152 * codegen.cs (EmitContext.Flags): Move InCatch, InFinally,
153 DoFlowAnalysis and OmitStructFlowAnalysis here.
154 (ec.With): Rename from WithUnsafe and generalize.
155 (ec.WithCheckState): Remove. All users can be handled by 'With'.
156 (ec.WithFlowAnalyis): New.
157 * ecore.cs, expression.cs, statement.cs: Update.
159 2006-07-22 Raja R Harinath <harinath@gmail.com>
161 * statement.cs (Block.ResolveMeta): Simplify slightly.
163 * codegen.cs (EmitContext.Flags): New enum. Used to represent the
164 multiple boolean fields. Convert InUnsafe, constant_check_state,
165 check_state to flags.
166 (CheckState, ConstantCheckState): Update.
167 (InUnsafe): New read-only property.
168 (FlagsHandle): Rename from CheckStateHandle and convert to handle
170 (WithUnsafe): New helper similar to WithCheckState.
171 * statement.cs (Block.ResolveMeta): Use WithUnsafe.
172 (Unsafe.Resolve, Unsafe.DoEmit): Likewise.
174 2006-07-21 Raja R Harinath <rharinath@novell.com>
176 Make comparisons use the same IL irrespective of whether they're
177 in a 'checked' or 'unchecked' context: one of the issues in #78899
178 * codegen.cs (EmitContext.CheckState): Make read-only property.
179 (EmitContext.ConstantCheckState): Likewise.
180 (EmitContext.CheckStateHandle, EmitContext.WithCheckState): New
181 helper that implement a save/restore stack for CheckState
182 values. This is the only way to change check-state.
183 * ecore.cs (Expression.ExpressionToArrayArgument): Use WithCheckState.
184 * expression.cs (CheckedExpr.DoResolve, CheckedExpr.Emit): Likewise.
185 (CheckedExpr.EmitBranchable): New forwarding method.
186 (UnCheckedExpr): Likewise.
187 * statement.cs (Block.ResolveMeta): Use WithCheckState.
188 (Unchecked.Resolve, Unchecked.DoEmit): Likewise.
189 (Checked.Resolve, checked.DoEmit): Likewise.
191 2006-07-20 Miguel de Icaza <miguel@novell.com>
193 * anonymous.cs: Cache the resolved anonymous delegate, and return
194 this so that the ResolveTopBlock is only triggered once, not
197 Currently we trigger ResolvetopBlock twice due to a first pass of
198 argument check compatibility, and a second pass that does the
201 2006-07-16 Marek Safar <marek.safar@seznam.cz>
204 * driver.cs (MainDriver): When a file extension is missing,
207 2006-07-15 Marek Safar <marek.safar@seznam.cz>
209 * annonymous.cs (AnonymousMethod.CreateScopeType): Fixed nested type
211 * rootcontext.cs (Reset): Add helper_classes.
213 2006-07-15 Marek Safar <marek.safar@seznam.cz>
216 * statement.cs (Switch.SimpleSwitchEmit): Handle case null at any position
219 2006-07-13 Miguel de Icaza <miguel@novell.com>
221 * statement.cs (Lock): Handle expressions of type
222 TypeManager.null_type specially. Fixes #78770
224 2006-07-08 Marek Safar <marek.safar@seznam.cz>
226 * expression.cs (Binary.ResolveOperator): Don't crash when null is assigned
229 2006-07-08 Marek Safar <marek.safar@seznam.cz>
231 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Fixed to look
232 for accessors as well.
233 * ecore.cs (EventExpr): Add AccessorTable.
235 2006-07-01 Marek Safar <marek.safar@seznam.cz>
238 * attribute.cs, class.cs, ecore.cs : Add missing location of related symbol
239 for CS0122 where appropriate.
240 * typemanager.cs (IsNestedChildOf): Type can be null in the case of top
242 (Filter): Assembly can be null in the case of top level attributes.
244 2006-06-25 Marek Safar <marek.safar@seznam.cz>
248 * ecore.cs (Expression.MemberLookupFailed): Don't crash when failed lookup
249 is done at global level.
251 2006-06-24 Marek Safar <marek.safar@seznam.cz>
253 A fix for #77002, Implemented TypeForwarder support.
255 * attribute.cs (Attribute.GetArgumentType): Reads type argument.
256 * expression.cs (TypeOf.TypeArgument): Exposes typeof type.
257 * typemanager.cs (): Add type_forwarder_attr_type.
259 2006-06-24 Marek Safar <marek.safar@seznam.cz>
261 * report.cs: Add CS0469 warning.
263 2006-06-21 Martin Baulig <martin@ximian.com>
265 * codegen.cs (CodeGen.Save): Moved the symbol file generation into
266 the `try'-block, so we also report CS0016 etc. there.
268 2006-06-21 Martin Baulig <martin@ximian.com>
271 (Delegate.VerifyMethod): Allow `params' methods; fixes #78678.
273 2006-06-21 Martin Baulig <martin@ximian.com>
275 * expression.cs (Unary.ResolveOperator): In `Operator.AddressOf',
276 also report CS1686 for parameters.
278 2006-06-21 Martin Baulig <martin@ximian.com>
280 * statement.cs (GotoCase.Resolve): Report a warning (CS0469)
281 instead of an error if the value is not implicitly convertible to
282 the switch types; fixes #77964.
284 2006-06-21 Raja R Harinath <rharinath@novell.com>
287 * class.cs (FieldBase.ResolveInitializer): Stop resolution if
288 FieldBuilder is null.
291 * expression.cs (Binary.CheckShiftArguments): Don't overwrite original
292 'left' and 'right' before error-checking.
294 2006-06-16 Juraj Skripsky <js@hotfeet.ch>
296 * ecore.cs (SimpleName.Error_ObjectRefRequired): Do not truncate the name.
298 (MemberExpr.EmitInstance): Use GetSignatureForError () to get full name.
299 (FieldExpr.DoResolve): likewise.
300 (PropertyExpr.InstanceResolve): likewise.
301 (EventExpr.InstanceResolve): likewise.
303 2006-06-04 Marek Safar <marek.safar@seznam.cz>
305 * parameter.cs (Parameter.ApplyAttributeBuilder): More DefaultValue
306 attribute applicable tests for attribute argument.
308 2006-06-02 Raja R Harinath <rharinath@novell.com>
311 * expression.cs (Binary.DoNumericPromotions): Remove and rewrite.
312 (Binary.OverloadResolve_PredefinedIntegral): New.
313 (Binary.OverloadResolve_PredefinedFloating): New.
314 (Binary.OverloadResolve_PredefinedString): New.
315 (Binary.ResolveOperator): Use those instead of DoNumericPromotions.
316 Follow the standard more closely, and treat numeric promotions in
317 terms of overload resolution.
318 (Binary.CheckShiftArguments): Simplify.
320 2006-06-01 Raja R Harinath <rharinath@novell.com>
322 * flowanalysis.cs (MyBitVector): Simplify representation.
323 (MyBitVector.Clone): Avoid allocating BitArray.
324 (MyBitVector.operator&): Rename from MyBitVector.And and make symmetric.
325 (MyBitVector.operator|): Likewise, with MyBitVector.Or.
326 (*): Update. Change all references to MyBitVector.And and
327 MyBitVector.Or to &= and |=.
329 2006-05-29 Raja R Harinath <rharinath@novell.com>
332 * cs-parser.jay (formal_parameter_list): Extend the pattern below
333 to param arguments too.
335 2006-05-26 Miguel de Icaza <miguel@novell.com>
337 * cs-parser.jay: Catch another parsing form for arglist being
338 followed by other arguments. Fixes #78313.
340 2006-05-24 Raja R Harinath <rharinath@novell.com>
342 * flowanalysis.cs (FlowBranchingToplevel.AddReturnOrigin): Move
343 checking of out parameters to ...
344 (FlowBranchingToplevel.Merge): ... here.
345 (FlowBranchingException.AddBreakOrigin): If 'finally_vector' is
346 set, propagate the origin upward, and only complain if there was
348 (FlowBranchingException.AddContinueOrigin): Likewise.
349 (FlowBranchingException.AddReturnOrigin): Likewise.
350 (FlowBranchingException.AddGotoOrigin): Likewise.
352 2006-05-23 Raja R Harinath <rharinath@novell.com>
354 * flowanalysis.cs (UsageVector.MergeOrigins): If an origin is
355 unreachable, skip it.
356 (FlowBranchingException.Merge): Always propagate jumps, even if
357 the finally block renders subsequent code unreachable.
359 2006-05-18 Raja R Harinath <rharinath@novell.com>
362 * statement.cs (Goto.Resolve): Move responsibility for resolving
363 'goto' to FlowBranching.AddGotoOrigin.
364 (Goto.SetResolvedTarget): New. Callback to set the
365 LabeledStatement that's the target of the goto.
366 (Goto.DoEmit): Use Leave instead of Br when crossing an
367 unwind-protect boundary.
368 * flowanalysis.cs (FlowBranching.AddGotoOrigin): Rename from
369 LookupLabel and adjust to new semantics.
370 (FlowBranchingToplevel.AddGotoOrigin): Likewise.
371 (FlowBranchingBlock.AddGotoOrigin): Likewise. Use
372 Goto.SetResolvedTarget to update target.
373 (FlowBranchingLabeled.AddGotoOrigin): Likewise.
374 (FlowBranchingException.AddGotoOrigin): Rewrite to be similar to
375 AddBreakOrigin & co. Delay propagation until ...
376 (FlowBranchingException.Merge): ... this.
378 * statement.cs (Block.Resolve): Always depend on flow-branching to
379 determine unreachability. Kill workaround that originally emitted
380 only one statement after an "unreachable" label (see infloop in
383 Fix #77869, #76148, #77755, #75255 and a host of other bugs.
384 This is still "wrong", but anything better would probably need a
385 multi-pass algorithm.
386 * flowanalysis.cs (FlowBranchingLabeled): Salt away a copy of the
387 usage vector. Force current usage vector to be reachable, to
388 optimistically signify backward jumps.
389 (FlowBranchingLabeled.LookupLabel): Note if a backward jump is
391 (FlowBranchingLabeled.Merge): New. If no backward jump was
392 detected, return the original salted-away usage vector instead,
393 updated with appropriate changes. Print unreachable warning if
395 * statement.cs (Block.Resolve): Don't print unreachable warning on
398 2006-05-17 Gert Driesen <drieseng@users.sourceforge.net>
400 * driver.cs: Pass filename without path to AssemblyBuilder's
401 AddResourceFile. Fixes bug #78407.
403 2006-05-17 Raja R Harinath <rharinath@novell.com>
405 * statement.cs (LabeledStatement.Resolve): Move merging of origins ...
406 * flowanalysis.cs (FlowBranchingLabeled): ... here.
407 (FlowBranching.MergeChild): Overwrite
408 reachability information from Labeled branchings too.
410 2006-05-16 Raja R Harinath <rharinath@novell.com>
412 * statement.cs (Goto.Resolve): Merge jump origins here ...
413 * flowanalysis.cs (FlowBranching.Label): ... rather than here.
415 * flowanalysis.cs (FlowBranching.LookupLabel): Move CS0159 check ...
416 (FlowBranchingToplevel.LookupLabel): ... here. Add CS1632 check.
417 (FlowBranchingGoto.LookupLabel): New. Handle back jumps.
418 (FlowBranchingBlock.LookupLabel): Call LabeledStatement.AddReference
420 * statement.cs (Goto.Resolve): ... not here.
421 (Goto.Emit): Remove CS1632 check.
423 2006-05-14 Marek Safar <marek.safar@seznam.cz>
425 * ecore.cs (Expression.ResolveAsTypeTerminal): Fixed type in the obsolete
428 2006-05-11 Raja R Harinath <rharinath@novell.com>
430 * flowanalysis.cs (UsageVector.MergeJumpOrigins): Kill.
431 (FlowBranchingBlock.Label): Use UsageVector.MergeOrigins.
432 (FlowBranchingException.Label): Likewise.
434 * flowanalysis.cs (MyBitVector.SetAll): New. Sets all bits to the
436 (MyBitVector.Or): Use it to avoid losing information (Count).
437 (FlowBranching.MergeOrigins): Likewise.
439 * flowanalysis.cs (UsageVector.IsDirty): Remove.
440 (UsageVector.Parameters, UsageVector.ParameterVector): Likewise.
441 (UsageVector.Locals, UsageVector.LocalVector): Likewise.
442 (UsageVector.ToString): Simplify.
443 (UsageVector.MergeSiblings): Move here from ...
444 (FlowBranching.Merge): ... here.
445 (FlowBranchingToplevel.CheckOutParameters): Take an UsageVector,
448 2006-05-10 Raja R Harinath <rharinath@novell.com>
450 * flowanalysis.cs (UsageVector.MergeOrigins): Simplify, now that a
451 null bitvector is treated as all-true.
453 * flowanalysis.cs (MyBitVector.And, MyBitVector.Or): Make lazier.
454 (MyBitVector): Rationalize invariants. 'vector != null' implies
455 that we have our own copy of the bitvector. Otherwise,
456 'InheritsFrom == null' implies all inherited bits are true.
458 2006-05-09 Marek Safar <marek.safar@seznam.cz>
460 * statement.cs (LocalInfo): Add IsConstant.
461 (LocalInfo.DeclareLocal): Moved from EmitMeta and changed to don't emit
462 local variable for constants.
464 2006-05-09 Raja R Harinath <rharinath@novell.com>
466 * flowanalysis.cs (MyBitVector.Empty): New.
467 (MyBitVector): Don't allow InheritedFrom to be null.
468 (MyBitVector.And, MyBitVector.Or): Treat 'null' as all-ones.
469 (UsageVector, FlowBranching): Update to changes.
471 * flowanalysis.cs (FlowBranching.InTryWithCatch): Don't terminate
472 recursion. The 'Parent == null' condition isn't sufficient for
474 (FlowBranching.AddBreakOrigin): Likewise.
475 (FlowBranching.AddContinueOrigin): Likewise.
476 (FlowBranching.AddReturnOrigin): Likewise.
477 (FlowBranching.StealFinallyClauses): Likewise.
478 (FlowBranching.MergeTopBlock): Move to FlowBranchingToplevel.
479 (FlowBranching.CheckOutParameters): Likewise.
480 (FlowBranchingToplevel): Terminate all the above recursions here.
481 (FlowBranchingToplevel.End): Rename from MergeTopBlock.
482 * codegen.cs (EmitContext.ResolveTopBlock): Update to changes.
484 * flowanalysis.cs (BranchingType.Toplevel): New. Represents a
486 (FlowBranchingToplevel): New. Empty for now.
487 (FlowBranching.MergeTopBlock): Update.
488 * codegen.cs (EmitContext.ResolveTopBlock): Create a Toplevel
489 branching for the anonymous delegate.
490 (EmitContext.StartFlowBranching): Add ToplevelBlock variant.
492 * flowanalysis.cs (UsageVector.MergeOrigins): Reorganize.
493 (UsageVector.MergeJumpOrigins): Don't ignore current reachability
494 information at the start of the merge. Reorganize.
496 2006-05-07 Marek Safar <marek.safar@seznam.cz>
498 * class.cs (MethodData.Define): Method cannot implement interface accessor.
500 2006-05-07 Marek Safar <marek.safar@seznam.cz>
502 * expression.cs (QualifiedAliasMember.ResolveAsTypeStep): Pass location
503 to newly introduced ctor.
505 * namespace.cs (Namespace.Error_NamespaceDoesNotExist): Moved an error
506 message to one place.
507 (GlobalRootNamespace.Error_NamespaceDoesNotExist): Custom message for
510 2006-05-07 Marek Safar <marek.safar@seznam.cz>
512 * const.cs (Const.Error_ExpressionMustBeConstant): Better error message.
514 * ecore.cs (Expression.ResolveAsConstant): Updated.
516 * statement.cs (ResolveMeta): Updated.
518 2006-05-06 Marek Safar <marek.safar@seznam.cz>
520 * cs-parser.jay: __arglist cannot be used in initializer.
522 2006-05-06 Marek Safar <marek.safar@seznam.cz>
525 * namespace.cs (LocalAliasEntry.DoResolve): Don't allow to access nested
528 2006-05-05 Raja R Harinath <rharinath@novell.com>
530 * statement.cs (EmptyStatement.ResolveUnreachable): Override.
531 (LabeledStatement): Add 'name' parameter.
532 (LabeledStatement.Name, LabeledStatement.JumpOrigins): New.
533 (Block.AddLabel): Update to changes.
534 * cs-parser.jay (labeled_statement): Likewise.
536 * flowanalysis.cs (BranchingType.Labeled): New.
537 (UsageVector.MergeOrigins): Remove unused 'branching' argument.
538 (FlowBranchingLabeled): New. Does nothing for now, but will
539 eventually handle 'goto' flows.
540 * codegen.cs (StartFlowBranching): Add new LabeledStatement variant.
541 * statement.cs (LabeledStatement.Resolve): Create a FlowBranching
542 that's terminated ...
543 (Block.Resolve): ... here.
545 * flowanalysis.cs (UsageVector.MergeFinally): Remove.
546 (UsageVector.MergeFinallyOrigins): Likewise.
547 (FlowBranching.InTryOrCatch): Likewise.
548 (FlowBranching.AddFinallyVector): Likewise.
549 (FlowBranchingException): Update to changes.
552 * statement.cs (Return.Resolve): Move error checking to ...
553 * flowbranching.cs (FlowBranching.AddReturnOrigin): ... this.
554 (FlowBranchingException): Handle return origins like break and
556 (FlowBranching.UsageVector.CheckOutParameters): Remove.
558 2006-05-04 Marek Safar <marek.safar@seznam.cz>
561 * class.cs (TypeContainer.FindMembers): Includes event method in the methods
564 2006-05-04 Marek Safar <marek.safar@seznam.cz>
567 * class.cs (MethodData.Define): Do public accessor check only when method
568 implements an interface.
570 2006-05-04 Raja R Harinath <rharinath@novell.com>
572 Remove special handling of 'break'
573 * flowanalysis.cs (Reachability): Remove all mention of 'breaks'.
574 (Reachability.Meet): Simplify. Remove 'do_breaks' argument.
575 (UsageVector.Break): Remove.
576 (FlowBranching.Merge): Use 'Reachable.IsUnreachable' to determine
578 (FlowBranchingBreakable.Merge): Don't ResetBreaks.
580 * statement.cs (Break.Resolve): Call UsageVector.Goto (), not
581 UsageVector.Breaks (). Don't set NeedsReturnLabel.
583 2006-05-03 Marek Safar <marek.safar@seznam.cz>
586 * pending.cs (PendingImplementation.BaseImplements): A found member cannot
587 be the interface member.
589 2006-05-03 Marek Safar <marek.safar@seznam.cz>
592 * constant.cs (LongConstant.EmitLong): Fixed to catch also negative values
593 for emitting small (int) values.
595 2006-05-03 Raja R Harinath <rharinath@novell.com>
598 * flowanalysis.cs (FlowBranchingException.Merge): Ensure
599 control-flow passes through the 'finally' after merging-in all the
600 control-flows from 'try' and the 'catch' clauses.
602 * flowanalysis.cs (FlowBranching.IsLoop): Remove.
603 (FlowBranching.IsTryOrCatch): Remove 'is_return' parameter. It's
604 always true at the only non-recursive entry point.
605 (FlowBranching.CreateBranching) [BranchingType.Loop]: Return a
606 FlowBranchingBreakable.
607 (FlowBranchingLoop): Remove.
608 * statement.cs (Return.DoResolve): Update to changes.
611 * flowanalysis.cs (FlowBranching.BranchingType.Embedded): New.
612 (FlowBranching.CreateBranching): Handle it: create a
613 FlowBranchingContinuable.
614 (FlowBranching.BreakCrossesExceptionBoundary): Remove.
615 (FlowBranching.AddContinueOrigin): Similar to AddBreakOrigin,
616 except that it handles the 'continue' command.
617 (FlowBranching.UsageVector.MergeOrigins): Rename from
619 (FlowBranchingContinuable): Similar to FlowBranchingBreakable,
620 except that it overrides AddContinueOrigin.
621 (FlowBranchingException): Override AddContinueOrigin, similar to
623 * statement.cs (While.Resolve, Foreach.ArrayForeach.Resolve):
624 Create a new branching around the embedded statement.
625 (Do.Resolve, For.Resolve): Likewise. Do reachability analysis for
626 control flow after the embedded statement.
627 (Continue.Resolve): Move all error checking to AddContinueOrigin.
629 * flowanalysis.cs (FlowBranching.IsSwitch): Remove.
630 (FlowBranching.CreateBranching) [BranchingType.Switch]: Create a
631 FlowBranchingBreakable.
632 (FlowBranchingSwitch): Remove.
635 * statement.cs (Break.Resolve): Simplify. Move responsibility for
636 error reporting to ...
637 * flowanalysis.cs (FlowBranching.AddBreakOrigin) ... this.
638 Rename from 'AddBreakVector'. Add new location argument. Return
639 a bool indicating whether the 'break' crosses an unwind-protect.
640 (FlowBranchingException.AddBreakOrigin): Add.
641 (FlowBranchingException.Merge): Propagate 'break's to surrounding
642 flowbranching after updating with the effects of the 'finally'
644 (FlowBranchingBreakable): New common base class for
645 FlowBranchingLoop and FlowBranchingSwitch.
647 * statement.cs (Foreach.ArrayForeach.Resolve): Set barrier after
649 (Foreach.CollectionForeach.Resolve): Remove extraneous flowbranching.
651 2006-05-02 Raja R Harinath <rharinath@novell.com>
653 * statement.cs (Do.Resolve): If the loop is infinite, set the
655 (While.Resolve, For.Resolve): Set a barrier after the embedded
656 statement. There's no direct control flow that goes from the end
657 of the embedded statement to the end of the loop.
658 * flowanalysis.cs (FlowBranching.Infinite): Remove.
659 (FlowBranchingLoop.Merge): Don't look at 'Infinite'. The changes
660 above ensure that the reachability is correctly computed.
662 * flowanalysis.cs (Reachability.ResetBarrier): Remove.
663 (UsageVector.MergeBreakOrigins): If the current path is
664 unreachable, treat it as if all parameters/locals are initialized.
665 (FlowBranchingLoop.Merge): Don't clear any barriers. Handle
666 infinite loops before merging-in break origins.
668 * flowanalysis.cs (Reachability.Meet): Simplify code handling 'returns'.
669 (Reachability.Reachable): Split part into ...
670 (Reachability.Unreachable): ... this. Simplify.
671 (Reachability.IsUnreachable): Use 'Unreachable' instead.
673 * flowanalysis.cs (Reachability.SetReturnsSometimes): Remove.
674 (Reachability.SetThrowsSometimes): Likewise.
675 (FlowBranchingBlock.MergeTopBlock): Don't compare against
676 TriState.Always, use corresponding property.
677 * statement.cs (Lock.Resolve, Try.Resolve, Using.Resolve): Likewise.
678 (Block.Resolve): Likewise. Remove some redundant checks.
680 2006-05-02 Raja R Harinath <harinath@gmail.com>
682 * flowanalysis.cs (UsageVector.Throw): Set barrier too.
683 (Reachability.Meet): Don't bother checking AlwaysThrows --
684 barrier is always set.
685 (FlowBranchingBlock.Merge): Likewise.
687 2006-05-01 Raja R Harinath <harinath@gmail.com>
689 * codegen.cs (EmitContext.ResolveTopBlock): Remove redundant
690 checks for unreachable.
692 2006-05-01 Marek Safar <marek.safar@seznam.cz>
695 * flowanalysis.cs (UsageVector.IsAssigned): Add flag to ignore short path.
697 * statement.cs (Block.UsageWarning): Uses newly introduced flag to detect
698 whether field is really assigned.
700 2006-04-30 Raja R Harinath <harinath@gmail.com>
702 * flowanalysis.cs (Reachability): Make 4-argument constructor
704 (Reachability.Meet): Rename from 'And'. Remove static variant.
705 (Reachability.Always): Rename from the highly misleading
706 'Reachability.Never'.
707 (FlowBranching.Merge): Update to changes. Mark an impossible
708 situation with a 'throw'.
709 (*): Update to changes.
711 2006-04-29 Raja R Harinath <harinath@gmail.com>
713 * flowanalysis.cs (TriState): Rename from FlowBranching.FlowReturns.
715 (FlowBranching.TriState_Meet): Rename from AndFlowReturns. Simplify.
716 (FlowBranching.TriState_Max): Rename from OrFlowReturns. Simplify.
717 (*): Update to changes.
718 * statement.cs: Update to changes.
720 2006-04-28 Marek Safar <marek.safar@seznam.cz>
723 *class.cs (Method.FindOutBaseMethod): Base method cannot be property method.
725 2006-04-28 Raja R Harinath <harinath@gmail.com>
727 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't create a
730 * flowanalysis.cs (UsageVector.MergeChild): Change FlowBranching
731 argument to two arguments: an usage-vector and a bool. Move call
732 to FlowBranching.Merge () ...
733 (FlowBranching.MergeChild, FlowBranching.MergeTopBlock): ... here.
735 * flowanalysis.cs (UsageVector.MergeChild): Move special-case
736 handling of loop and switch reachability to ...
737 (FlowBranchingLoop.Merge, FlowBranchingSwitch.Merge): ... these.
739 2006-04-27 Raja R Harinath <harinath@gmail.com>
741 * flowanalysis.cs (FlowBranching.InLoop): Move special-case
742 handling to FlowBranchingLoop.InLoop.
743 (FlowBranching.InSwitch): Likewise, to FlowBranchingSwitch.
745 2006-04-26 Marek Safar <marek.safar@seznam.cz>
748 * anonymous.cs (AnonymousMethod.DoResolve): Moved the check whether
749 anonymous method is allowed from AnonymousContainer here.
751 * attribute.cs, codegen.cs (EmitContext): Add IsAnonymousMethodAllowed.
753 2006-04-24 Raja R Harinath <rharinath@novell.com>
756 * flowanalysis.cs (MyBitVector.Or): Add null check on argument.
758 2006-04-23 Marek Safar <marek.safar@seznam.cz>
761 * constant.cs (FloatConstant.Reduce): Add range checking for checked context.
762 (DoubleConstant.Reduce): Ditto.
764 2006-04-23 Raja R Harinath <rharinath@novell.com>
766 * expression.cs (LocalVariableReference.DoResolveBase): Simplify.
767 Remove 'lvalue_right_side' argument. Move parts to ...
768 (LocalVariableReference.ResolveLocalInfo, LocalVariable.DoResolve)
769 (LocalVariable.DoResolveLValue): ... these.
771 2006-04-21 Raja R Harinath <rharinath@novell.com>
774 * codegen.cs (EmitContext.InRefOutArgumentResolving): Remove.
775 * expression.cs (EmptyExpression.LValueMemberOutAccess): New.
776 (LocalVariableReference.DoResolveBase): Use it to implement new
778 (IndexerAccess.DoResolveLValue): Handle LValueMemberOutAccess.
779 (Argument.Resolve): Simplify. Move CS1510 check ...
780 * ecore.cs (Expression.ResolveLValue): ... here.
781 (UnboxCast.DoResolveLValue): Handle LValueMemberOutAccess.
782 (PropertyExpr.DoResolveLValue): Likewise.
783 (FieldExpr.Report_AssignToReadonly): Likewise.
784 (FieldExpr.DoResolve): Add 'out_access' argument. Use
785 LValueMemberAccess or LValueMemberOutAccess on instance depending
787 (FieldExpr.DoResolveLValue): Pass 'out_access' argument to
788 DoResolve as appropriate.
790 2006-04-20 Raja R Harinath <rharinath@novell.com>
793 * expression.cs (Invocation.VerifyArgumentsCompat): Don't try
794 implicit conversions on 'out' and 'ref' arguments.
796 * expression.cs (Invocation.VerifyArgumentsCompat): Reorganize to
797 improve clarity. Remove dead code.
800 * statement.cs (Block.UsageWarning): Allow VariableInfo to be null.
801 (Catch.Resolve): Resolve VarBlock if it exists.
803 2006-04-19 Miguel de Icaza <miguel@novell.com>
805 * statement.cs (Foreach.EmitFinally): Do not emit the enumerator
806 twice, this was some residual code, the enumerator was emitted
807 properly in the two branche of if later.
809 2006-04-19 Raja R Harinath <rharinath@novell.com>
811 * expression.cs (Cast.ResolveLValue): Remove. The result of a
812 cast is never an lvalue.
813 (Cast.DoResolve, Cast.ResolveRest): Combine.
814 (Argument.Emit): Simplify slightly. Move 'Expr is
815 IMemoryLocation' check ...
816 (Argument.Resolve): ... here.
817 (Argument.Error_LValueRequired): Remove. Inline into only user.
819 Simplifications. Fix cs0191-2.cs
820 * ecore.cs (FieldExpr.DoResolve): Move handling of CS0192, CS0198,
821 CS1649 and CS1651 to ...
822 (FieldExpr.Report_AssignToReadonly): ... this. Simplify by moving
823 the actual selection of the error code and message to a lookup
824 table. Add a dummy return value to simplify callsites.
825 (FieldExpr.ResolveLValue): Don't allow a constructor to write to
826 readonly fields of other instances of the same type. Move CS0197
828 * expression.cs (Argument.Resolve): ... here. Simplify code.
829 Ensure that ec.InRefOutArgumentResolving is only set during LValue
830 resolution of an out or ref argument. The code simplification
831 above uses this invariant.
833 2006-04-18 Raja R Harinath <rharinath@novell.com>
835 Possibly fix #77752. Fix cs1690-[4-7].cs.
836 * ecore.cs (Expression.CheckMarshalByRefAccess): Renamed from
837 CheckMarshallByRefAccess. Drop parameter.
838 (FieldExpr.CheckMarshalByRefAccess): Update. Change CS1690 to a
840 (FieldExpr.DoResolve): Call CheckMarshalByRefAccess on
842 * report.cs (AllWarnings): Add CS1690.
843 * expression.cs (Argument.Resolve): Use EmptyExpression.OutAccess
845 (LocalVariableReference.DoResolveBase): Update.
847 2006-04-09 Marek Safar <marek.safar@seznam.cz>
849 * class.cs (MethodOrOperator): Moved common parts from method class.
850 detect obsolete attributes.
851 (Method.Define): Simplified as it reuses code from base.
852 (Constructor.ValidAttributeTargets): Fixed issue found during
854 (Destructor.ValidAttributeTargets): Fixed issue found during
856 (Operator): Finished refactoring set off by #78020. Operator class is now
857 ordinary method class.
859 * anonymous.cs: Updated.
861 * decl.cs (DeclSpace): Add IsGeneric
863 2006-04-09 Marek Safar <marek.safar@seznam.cz>
865 * class.cs (Constructor.Emit): Don't emit the attributes twice.
867 2006-04-09 Marek Safar <marek.safar@seznam.cz>
869 * class.cs (Operator.Emit): Extracted code from MethodData to correctly
870 detect obsolete attributes.
871 (Method.CreateEmitContext): Moved to MethodOrOperator.
873 2006-04-09 Marek Safar <marek.safar@seznam.cz>
876 * class.cs (TypeContainer.MemberCoreArrayList.DefineContainerMembers): Throw
877 customized exception to make crash detection easier.
878 (MethodOrOperator): Started to work on new base class for methods and
880 (Method): Derives from MethodOrOperator.
881 (Constructor.Emit): Emits its own attributes.
882 (AbstractPropertyEventMethod.Emit): Ditto.
883 (Operator): Derives from MethodOrOperator, will refactor fully in extra
885 (Operator.Emit): It's temporary more tricky than should be.
887 * doc.cs (GetMethodDocCommentName): Updated after operator changes.
889 * report.cs (InternalErrorException): Add ctor with inner exception.
891 2006-04-08 Marek Safar <marek.safar@seznam.cz>
894 * ecore.cs (SimpleName.ResolveAsTypeStep): Report better error when type is
897 2006-04-07 Marek Safar <marek.safar@seznam.cz>
900 * expression.cs (ArrayCreation.GetAttributableValue): Creates correctly typed
903 2006-04-06 Marek Safar <marek.safar@seznam.cz>
905 * class.cs (Class.ApplyAttributeBuilder): Report an error when ComImport
906 attribute is present and Guid not.
907 (Interface.ApplyAttributeBuilder): Ditto.
909 * attribute.cs: Add error message.
911 2006-04-06 Marek Safar <marek.safar@seznam.cz>
915 * attribute.cs (Attribute.AttachTo): The attribute can have multiple
916 sources (it's composite) so hold them in extra array as they are used in
917 Emit phase only. It worked in the previous versions by mistake.
918 (Attribute.Emit): Emit attribute for more owners when exist.
920 * codegen.cs, class.cs: Updated to don't re-attach attribute twice as now
921 it has now different behaviour.
923 2006-04-04 Marek Safar <marek.safar@seznam.cz>
925 * constant.cs (Constant.IsDefaultInitializer): New method.
929 * expression.cs (ArrayCreation.CheckIndices): Add an optimization to don't
930 re-initialize default values. It saves KBs almost for every assembly.
931 Thanks Zoltan for the idea.
932 (ArrayCreation.ResolveInitializers): Renamed from ValidateInitializers.
933 (ArrayCreation.DoResolve): Resolve only once.
934 (ArrayCreation.Emit): Emit static initializer only when it is faster.
935 (ArrayCreation.GetAttributableValue): Cope with optimized values.
937 2006-04-03 Zoltan Varga <vargaz@gmail.com>
939 * report.cs (Warning, Error): Add 0-, 1-, and 2- argument specializations.
942 2006-04-01 Marek Safar <marek.safar@seznam.cz>
944 * assign.cs (Assign.DoResolve): Assignment to same variable can occur
945 in an embedded statement too.
947 2006-04-01 Raja R Harinath <rharinath@novell.com>
950 * statement.cs (Switch.EmitObjectInteger) [ulong]: Remove bad cast.
952 2006-04-01 Marek Safar <marek.safar@seznam.cz>
956 * class.cs (TypeContainer.AddPartial): Don't report an error when modifier
959 * modifiers.cs: Add DEFAULT_ACCESS_MODIFER.
961 2006-03-31 Marek Safar <marek.safar@seznam.cz>
963 * assign.cs (LocalTemporary): Don't require ILGenerator in the resolve
966 * anonymous.cs, assign.cs, ecore.cs, expression.cs: Updated after
967 LocalTemporary change.
969 * class.cs (ClassOrStruct.DefineDefaultConstructor): Moved from
971 (ClassOrStruct.DefineFieldInitializers): Implemented static field
972 initializers optimization.
973 (ClassOrStruct.TypeAttr): Moved from modifiers.
974 (Constructor.CheckBase): Don't crash when static ctor has parameters.
975 (FieldBase.ResolveInitializer): Resolves initializer.
976 (FieldBase.HasDefaultInitializer): New property.
978 * cs-parser.jay: Removed message.
980 * expression.cs (CompilerGeneratedThis): New specialization.
982 * modifiers.cs (TypeAttr): Moved to ClassOrStruct.TypeAttr
984 2006-03-28 Marek Safar <marek.safar@seznam.cz>
986 * cs-parser.jay, cs-tokenizer.cs: On demand Stack allocation.
988 2006-03-27 Marek Safar <marek.safar@seznam.cz>
990 * ecore.cs (Expression.ResolveAsConstant): Clean up, enum constants should
991 be now EnumConstants only.
993 2006-03-27 Marek Safar <marek.safar@seznam.cz>
995 * attribute.cs, driver.cs: Reset more caches.
997 2006-03-26 Marek Safar <marek.safar@seznam.cz>
999 * cs-tokenizer.cs (adjust_real): Uses float.Parse for float literals.
1001 2006-03-26 Marek Safar <marek.safar@seznam.cz>
1003 * constant.cs (Constant.Reduce): Replaced EmitContext with single bool
1004 for easier reuse. Updated all overrides.
1005 (IntegralConstant): New base class for all integral constants.
1006 (IntegralConstant.Error_ValueCannotBeConverted): When assigned value if out
1007 of the constant range, report custom error.
1008 (UIntConstant.Reduce): Fixed uint conversion.
1010 * ecore.cs, literal.cs: Reduce updates.
1012 2006-03-26 Marek Safar <marek.safar@seznam.cz>
1016 * class.cs (Constructor.Define): Removed extra if for default ctors.
1017 A patch from Atsushi Enomoto.
1019 2006-03-26 Marek Safar <marek.safar@seznam.cz>
1021 * attribute.cs (Attribute.ResolveConstructor): Conversion was moved to
1022 GetAttributableValue.
1024 * constant.cs (Constant.GetAttributableValue): Does implicit conversion
1027 * convert.cs (ImplicitConversionRequired): Error message moved to
1030 * ecore.cs (Expression.GetAttributableValue): Add type parameter for
1031 automatic implicit conversion of an output value.
1032 (EnumConstant.GetAttributableValue): Don't reduce the enum constants.
1034 * expression.cs (ArrayCreation.GetAttributableValue): Add element type
1036 (TypeOf.GetAttributableValue): Add extra handling for object type.
1038 * literal.cs (DoubleLiteral.Error_ValueCannotBeConverted): Doubles can have
1039 special error message.
1041 2006-03-25 Marek Safar <marek.safar@seznam.cz>
1043 * class.cs (Constructor.Emit): Don't crash when struct ctor is
1045 (Constructor.ApplyAttributeBuilder): Transform MethodImplAttribute to be
1046 compatible with MS runtime.
1048 2006-03-23 Marek Safar <marek.safar@seznam.cz>
1050 * attribute.cs (Attribute.ResolveConstructor): Check for an invalid
1051 attribute arguments here.
1053 * class.cs (Indexer.Define): The check was moved to attribute class.
1055 2006-03-22 Marek Safar <marek.safar@seznam.cz>
1057 * assign.cs, class.cs, codegen.cs, convert.cs, decl.cs, ecore.cs,
1058 expression.cs, typemanager.cs: Minor changes from gmcs to make merging
1061 2006-03-22 Raja R Harinath <rharinath@novell.com>
1063 Support ParameterDefaultValueAttribute in gmcs. Also applied to
1064 mcs to keep code differences small.
1065 * attribute.cs (Attribute.GetParameterDefaultValue): New.
1066 * typemanager.cs (parameter_default_value_attribute_type): New.
1067 * parameter.cs (Parameter.ApplyAttributeBuilder): Use them. Add
1070 2006-03-21 Marek Safar <marek.safar@seznam.cz>
1072 * expression.cs (StringConcat.Append): Reverted back to no warning state.
1074 2006-03-21 Marek Safar <marek.safar@seznam.cz>
1076 * const.cs (Error_ConstantCanBeInitializedWithNullOnly): Share a message.
1078 * statement.cs (Block.ResolveMeta): Look for wrong object constants in
1081 2006-03-21 Atsushi Enomoto <atsushi@ximian.com>
1083 * doc-bootstrap.cs : fix build.
1085 2006-03-20 Marek Safar <marek.safar@seznam.cz>
1087 * expression.cs (StringConcat.Append): Issue a warning when empty string
1090 2006-03-20 Marek Safar <marek.safar@seznam.cz>
1092 * assign.cs (CompoundAssign.ResolveSource): Removed.
1094 * attribute.cs (ResolvePossibleAttributeType): Updated after MemberAccess
1097 * class.cs (TypeContainer.FindMethods): Removed.
1098 (TypeContainer.CheckMemberUsage): Made static.
1100 * codegen.cs (GetAssemblyName): Uses Length for empty string test.
1102 * constant.cs (CheckRange): Removed unused type argument.
1103 (CheckUnsigned): Removed unused type argument.
1105 * cs-parser.jay: Updated after MemberAccess clean up.
1106 Uses Length for empty string test.
1108 * cs-tokenizer.cs: Uses Length for empty string test.
1109 (IsCastToken): Made static.
1110 (is_hex): Made static.
1111 (real_type_suffix): Made static.
1113 * decl.cs (SetupCache): Made static.
1114 (OnGenerateDocComment): Removed unused ds argument.
1116 * delegate.cs (VerifyDelegate): Removed unused argument.
1118 * doc.cs: Uses Length for empty string test.
1120 * driver.cs: Uses Length for empty string test.
1122 * enum.cs (IsValidEnumType): Made static
1124 * expression.cs (EnumLiftUp): Removed unused argument.
1125 (ResolveMethodGroup): Ditto.
1126 (BetterConversion): Ditto.
1127 (GetVarargsTypes): Ditto.
1128 (UpdateIndices): Ditto.
1129 (ValidateInitializers): Ditto.
1130 (MemberAccess.ctor): Ditto.
1131 (GetIndexersForType): Ditto.
1133 * flowanalysis.cs: (MergeFinally): Removed unused argument.
1135 * iterators.cs: Updated after MemberAccess clean up.
1137 * location.cs: Uses Length for empty string test.
1139 * namespace.cs: Uses Length for empty string test.
1141 * report.cs (CheckWarningCode): Made static.
1143 * statement.cs (LabeledStatement): Removed unused argument.
1145 * typemanager.cs (FilterNone): Removed.
1147 2006-03-18 Marek Safar <marek.safar@seznam.cz>
1149 * codegen.cs (EmitContext.TestObsoleteMethodUsage): Removed as it become
1152 * class.cs: Updated.
1154 2006-03-18 Marek Safar <marek.safar@seznam.cz>
1156 * cs-parser.jay.cs: __arglist is not allowed for delegates.
1158 2006-03-18 Marek Safar <marek.safar@seznam.cz>
1162 * expression.cs (VerifyArgumentsCompat): Reverted to double error
1163 reporting, it's more tricky than I thought.
1165 2006-03-18 Marek Safar <marek.safar@seznam.cz>
1169 * anonymous.cs.cs (AnonymousMethod): Add host to allow access to
1171 (AnonymousMethod.ImplicitStandardConversionExists): New method.
1172 (AnonymousMethod.Compatible): Moved parameter resolving to DoResolve.
1173 Add more error reporting; Fixed issue with params.
1175 * convert.cs (ImplicitStandardConversionExists): Returned conversion check.
1177 * cs-parser.jay: AnonymousMethod requires host container.
1179 * delegate.cs (NewDelegate.DoResolve): Updated after Compatible changes.
1181 2006-03-18 Raja R Harinath <harinath@gmail.com>
1183 * class.cs: Change 'TypeContainer ds' constructor argument to
1184 'DeclSpace parent'. Some classes were missed below due to
1185 different naming convention.
1187 * class.cs (MemberCore.Parent): Delete. This makes the
1188 ParentContainer changes below enforceable by the compiler.
1190 Treat pointers to enclosing declaration space as 'DeclSpace', not
1192 * class.cs, const.cs, delegate.cs, enum.cs, iterator.cs: Change
1193 'TypeContainer parent' constructor argument to 'DeclSpace parent'.
1195 * statement.cs (LocalInfo..ctor): Use DeclSpace argument instead
1197 (Block.AddThisVariable): Likewise.
1198 * class.cs (MethodData.Define, MethodData.Emit): Likewise.
1199 (AbstractPropertyEventMethod.Emit): Likewise.
1200 (AbstractPropertyEventMethod.EmitMethod): Likewise.
1201 (GetMethod.Define, SetMethod.Define): Likewise.
1202 (PropertyMethod.Define, DelegateMethod.Define): Likewise.
1203 (DelegateMethod.EmitMethod): Likewise.
1205 Fix regression test-partial-13.cs.
1206 Rationalize use of PartialContainer. Ensure that the partial
1207 class semantics can be tied to type-correctness, i.e., any
1208 violation will cause a compile error.
1209 * class.cs, const.cs: Access all fields that belong to class
1210 TypeContainer via ParentContainer. Arguments of EmitContexts and
1211 Resolve()-like functions still use 'Parent'.
1213 * class.cs (SourceMethod): Use DeclSpace, not TypeContainer.
1214 (*.CreateEmitContext): Change TypeContainer argument to DeclSpace.
1215 (PropertyMethod.CheckModifiers): Remove unused argument.
1216 * codegen.cs (EmitContext..ctor): Change TypeContainer argument to
1219 2006-03-17 Raja R Harinath <harinath@gmail.com>
1221 Make semantics of PartialContainer simpler.
1222 * decl.cs (DeclSpace.IsPartial): Remove.
1223 * class.cs (TypeContainer.IsPartial): Likewise.
1224 (TypeContainer..ctor): Set PartialContainer to point to self.
1225 (TypeContainer.GetClsCompliantAttributeValue): Don't use IsPartial.
1226 (TypeContainer.FindNestedType): Likewise.
1227 (MemberCore.ParentContainer): Simplify. Remove deprecation.
1229 2006-03-17 Marek Safar <marek.safar@seznam.cz>
1231 * typemanager.cs.cs (GetInterfaces): Don't recreate 0-sized arrays.
1233 2006-03-15 Marek Safar <marek.safar@seznam.cz>
1235 * class.cs (FieldMember.Emit): ParentContainer is real parent for partial
1238 2006-03-15 Marek Safar <marek.safar@seznam.cz>
1240 * class.cs (Operator.Define): An error for base conversion was not
1243 2006-03-14 Atsushi Enomoto <atsushi@ximian.com>
1245 * iterator.cs : yield break is allowed in try statement which has
1246 catch clauses. Fixed bug #77767.
1248 2006-03-13 Marek Safar <marek.safar@seznam.cz>
1250 A fix for #77593, #77574.
1252 * class.cs (MethodCore.CheckBase): Another if for operator.
1254 2006-03-09 Marek Safar <marek.safar@seznam.cz>
1256 * anonymous.cs (AnonymousMethod.Compatible): Don't crash when parameters
1259 * delegate.cs (Delegate.GetInvokeMethod): Use emitcontext free MemberLookup.
1260 (DelegateCreation.ImplicitStandardConversionExists): New method for just
1263 *ecore.cs (Expression.MemberLookup): Don't ask for emitcontext when it's
1266 * assign.cs, constant.cs, convert.cs, delegate.cs, expression.cs:
1267 Updated after another emitcontext usage was clean up. It should help us to
1268 synchronize with gmcs easier.
1270 2006-03-04 Marek Safar <marek.safar@seznam.cz>
1274 * class.cs (SetMethod.DefineParameters): Uses new parameters type ctor.
1275 (Event.Define): ditto
1276 (SetIndexerMethod.DefineParameters): Uses Parameters.MergeGenerated.
1278 * delegate.cs (Delegate.Define): Uses Parameters.MergeGenerated.
1279 Removed redundant code and set NewSlot for Invoke method too.
1281 * parameter.cs (Parameters.ctor): Add custom, type ctor.
1282 (Parameters.MergeGenerated): New method. Use this method when you merge
1283 compiler generated argument with user arguments.
1285 2006-03-03 Marek Safar <marek.safar@seznam.cz>
1287 * attribute.cs (ResolveAsTypeTerminal): Removed.
1289 * ecore.cs (Expression.ResolveAsTypeTerminal): Make virtual to allow
1290 specialization for predefined types; 30% speed up.
1291 Finally placed obsolete check to right place.
1292 (Expression.ResolveType): Removed.
1294 * enum.cs, expression.cs, parameter.cs, statement.cs, typemanager.cs:
1295 Updated after ResolveType was removed.
1297 * expression.cs (Cast.ctor): Check void cast.
1298 (Binary.ResolveAsTypeTerminal): Is never type.
1299 (Conditional.ResolveAsTypeTerminal): Is never type.
1301 * rootcontext.cs (ResolveCore): Set base type to simplify some code later.
1303 2006-03-01 Raja R Harinath <rharinath@novell.com>
1306 * expression.cs (ParameterReference.DoResolveBase): Change return
1308 (ParameterReference.DoResolve, ParameterReference.DoResolveLValue):
1312 * ecore.cs (PropertyExpr.InstanceResolve): Fix CS1540 check.
1315 * typemanager.cs (GetFullNameSignature): Don't nullref on
1316 protected accessors.
1318 2006-02-27 Marek Safar <marek.safar@seznam.cz>
1320 * attribute.cs (Attribute.PosArguments, Attribute.NamedArguments): Use
1321 these two separated members to simplify the code.
1322 (Attribute.Resolve): Refactored to use new fields and methods.
1323 (Attribute.ResolveConstructor): Extracted from ResolveArguments and
1324 implemented obsolete attribute checking.
1325 (Attribute.ResolveNamedArguments): Extracted from ResolveArguments and
1326 implemented obsolete checking again. It look line never ending quest ;-)
1327 (GlobalAttribute.ResolveConstructor): Need to override as the rest.
1329 * cfold.cs (BinaryFold): TryReduce throws an exception to indicate error.
1331 * constanct.cs (TryReduce): Throws OverflowException to indicate error.
1333 *class.cs (Property.Define): Add RegisterProperty call.
1335 * cs-parser.jay: Replaced ArrayList with fixed array for attribute
1336 argument groups (only 2).
1338 * ecore.cs (Expression.GetAttributableValue): New virtual method used for
1339 encoding expression to arguments.
1340 (Expression.ExprClassToResolveFlags): Just turned to property.
1342 * expression.cs (ArrayCreation.ValidateInitializers): Slightly optimized.
1343 (ArrayCreation.GetAttributableValue): Renamed from EncodeAsAttribute and
1344 optimized as well as implemented support for zero-length attributes.
1346 * typemanager.cs (TypeManager.RegisterProperty, TypeManager.GetProperty):
1347 Add caching of PropertyInfo's.
1349 2006-02-25 Marek Safar <marek.safar@seznam.cz>
1351 * delegate.cs (DelegateCreation.ResolveMethodGroupExpr): Don't report
1352 error multiple times.
1354 2006-02-25 Marek Safar <marek.safar@seznam.cz>
1356 New partial class implementation.
1357 A fix for #77027, #77029, #77403
1359 * attribute.cs (Attributable): Made attributes protected.
1361 * class.cs (TypeContainer): Add PartialContainer and partial_parts as
1362 the replacements of ClassPart and PartialContainer.
1363 (TypeContainer.AddClassOrStruct): Call RecordDecl here.
1364 (TypeContainer.AddInterface): Ditto.
1365 (TypeContainer.AddPartial): The main method for partial classes. It checks
1366 for errors and merges ModFlags and attributes. At the end class is added to
1368 (TYpeContainer.DefineDefaultConstructor): Checks whether default ctor is
1370 (TypeContainer.GetClsCompliantAttributeValue): Cope with partial class too.
1371 (TypeContainer.GetNormalPartialBases): Resolves base classes and interfaces
1372 from the rest of partial classes.
1373 (TypeContainer.GetClassBases): Simplified.
1374 (TypeContainer.DefineTypeBuilder): New method, mostly extracted from
1376 (TypeContainer.DefineDefaultConstructor): Is used by derived classes.
1377 (TypeContainer.HasExplicitLayout): Uses Flags now.
1378 (PartialContainer): Removed.
1379 (ClassOrStruct.AddToContainer): Moved enclosing member name check here.
1380 (StaticClass): Was merged with Class.
1381 (Class.GetClassBases): class and static class bases are verified here.
1382 (Class.TypeAttr): Added static attributes when class is static.
1383 (Struct.RegisterFieldForInitialization): Moved from TypeContainer.
1384 (MemberBase): In some cases we need to call parent container for partial
1385 class. It should be eliminated but it's not easy now.
1387 * cs-parser.jay: Replaced all PartialContainer with AddPartial.
1389 * decls.cs (MemberCore.DocComment): Introduced new property as is used by
1390 partial classed to accumulate class comments.
1391 (MemberCore.GetClsCompliantAttributeValue): Moved from TypeContainer.
1393 * doc.cs (GenerateTypeDocComment): Partial classes clean up.
1395 * driver.cs (MainDriver): Tree.GetDecl was removed.
1397 * modifiers.cs (Modifiers): Add partial modifier.
1399 * tree.cs (Tree.decl): Removed.
1400 (RootTypes): Started to use this class more often for root types
1403 2006-02-22 Marek Safar <marek.safar@seznam.cz>
1407 * attribute.cs (AttributeTester.GetCoClassAttribute): Don't crash when
1408 external interface does not have an attribute.
1410 2006-02-22 Marek Safar <marek.safar@seznam.cz>
1412 Another prerequisites for new partial classs implementation.
1414 * attribute.cs (Attribute.Equal): Implemented.
1415 (Attribute.Emit): Changed as attributes can be applied more than twice.
1416 (Attributes.Emit): Check for duplicate attributes here.
1418 * class.cs, decl.cs, delegate.cs, doc.cs, enum.cs: Don't pass DeclSpace
1419 as a parameter, clean-up.
1421 2006-02-11 Marek Safar <marek.safar@seznam.cz>
1425 * class.cs (TypeContainer.DefineType): Cannot use ResolveType because it
1426 contains obsolete attribute check which can in some cases look for base
1427 type of current class which is not initialized yet.
1428 (TypeContainer.BaseType): Replacement of ptype.
1430 * decl.cs (MemberCore.CheckObsoleteType): Reuse existing code.
1432 2006-02-11 Marek Safar <marek.safar@seznam.cz>
1434 First of prerequisites for new partial classs implemention.
1436 * attribute.cs (Attributable): Extended by ResolveContext;
1437 Attributes finally have correct context for resolving in all cases.
1438 (AttachTo): Attribute owner is assigned here.
1440 * codegen.cs (IResolveContext): Introduce new interface to hold
1441 all information needed in resolving phase.
1442 (EmitContext): Implements IResolveContext; more clean-up needed here.
1444 * decl.cs (MemberCore): Implemented IResolveContext.
1446 * anonymous.cs, attribute.cs, class.cs, codegen.cs, const.cs,
1447 decl.cs, ecore.cs, enum.cs, expression.cs, iterators.cs, namespace.cs,
1448 parameter.cs, statement.cs, tree.cs, typemanager.cs:
1449 Refactored to use new IResolveContext instead of EmitContext; cleanup
1451 2006-02-06 Miguel de Icaza <miguel@novell.com>
1453 * codegen.cs (EmitScopeInitFromBlock): check here the
1454 capture_context, there is no need to make two calls to the
1457 * anonymous.cs: Add some debugging messages that might help me
1458 track other instances of this problem in the future (the
1459 regression of test 467).
1461 * cs-parser.jay: track the variable block, as we need to initalize
1462 any captured variables declared in this block for the "catch"
1463 portion of the "Try" statement.
1465 * statement.cs (Try.Emit): If the "Catch" has a VarBlock, emit any
1466 scope initialization for captured variables.
1468 Also, move the emit for the variables after the block location has
1471 2006-02-06 Marek Safar <marek.safar@seznam.cz>
1473 * ecore.cs (PropertyExpr.FindAccessors): Just made flags const.
1475 2006-02-02 Miguel de Icaza <miguel@novell.com>
1477 * anonymous.cs (CaptureContext.EmitInitScope): I was wrong in the
1478 commit yesterday, the initialization for the roots is necessary.
1479 What is not necessary is the scope activation.
1481 2006-02-02 Raja R Harinath <rharinath@novell.com>
1483 * ecore.cs (PropertyExpr.DoResolveLValue): Add CS0206 check.
1484 * expression.cs (IndexerAccess.DoResolveLValue): Add CS1612 and
1486 (Argument.Resolve): Remove CS0206 checks.
1488 2006-02-01 Miguel de Icaza <miguel@novell.com>
1490 * anonymous.cs (CaptureContext.EmitInitScope): Do not emit the
1491 scopes for all the roots, the scopes will now be emitted when the
1492 Blocks are entered. [This change was wrong, fixed on 2006-02-02]
1494 (CaptureContext.EmitScopeInitFromBlock): Simply emit the ScopeInfo
1495 code. This reduces a lot of existing cruft.
1497 * statement.cs (Block.Emit): Call EmitScopeInitFromBlock here, so
1498 that the ScopeInfo is generated as we enter the scope, not at the
1499 time of use, which is what we used to do before.
1501 * codegen.cs (EmitScopeInitFromBlock): New routine, this is called
1502 every time a Block is about to be emitted if we have a
1505 2006-02-01 Raja R Harinath <rharinath@novell.com>
1507 * typemanager.cs (NoTypes, NoTypeExprs): Remove.
1509 * *.cs: Use Type.EmptyTypes instead of TypeManager.NoTypes.
1511 * typemanager.cs (cons_param_array_attribute): Make private.
1512 (Reset): Set it to null.
1513 (InitCoreHelpers): Don't initialize it.
1514 (ConsParamArrayAttribute): New. Initialize it as needed.
1515 * parameter.cs (ParamsParameter.ApplyAttribute): Update to change.
1517 2006-01-31 Miguel de Icaza <miguel@novell.com>
1519 * expression.cs: There might be errors reported during the
1520 selection of applicable methods. If there are errors, do not
1521 continue execution as it will lead the compiler to crash.
1523 2006-01-30 Miguel de Icaza <miguel@novell.com>
1525 * expression.cs: Member access is not allowed on anonymous
1526 methods. Fixes #77402.
1528 2006-01-30 Raja R Harinath <rharinath@novell.com>
1531 * cs-parser.jay (VariableDeclaration): Don't set
1532 current_array_type to null.
1533 (field_declaration, event_declaration, declaration_statement):
1534 Set it to null here.
1536 2006-01-28 Raja R Harinath <harinath@gmail.com>
1538 * typemanager.cs (GenericParameterPosition): New.
1541 2006-01-28 Atsushi Enomoto <atsushi@ximian.com>
1543 * doc.cs : To process "include" elements, first we should create
1544 another list than XmlNodeList, because it could result in node
1545 removal, which could result in that the XmlNodeList gives up
1548 (Also made code identical to gmcs again.)
1550 2006-01-25 Miguel de Icaza <miguel@novell.com>
1552 * ecore.cs: Introduce an error report that we were not catching
1553 before, if not silent, we must report the error. Gonzalo ran into
1556 2006-01-23 Miguel de Icaza <miguel@novell.com>
1558 A fix for bug: #76957
1560 * iterators.cs (MoveNextMethod.CreateMethodHost): call
1561 ComputeMethodHost before creating the method, this is a new
1564 * anonymous.cs (AnonymousContainer): Now we track all the scopes
1565 that this method references (RegisterScope). The actual scope
1566 where the method is hosted is computed with the ComputeMethodHost
1567 before we create the method.
1569 Moved the Deepest routine here.
1571 (AnonymousContainer.ComputeMethodHost): New routine used to
1572 compute the proper ScopeInfo that will host the anonymous method.
1574 (ScopeInfo): Deal with multiple roots. The problem was that we
1575 did not have a unique root where all ScopeInfos could be hanged
1576 from. Remove `topmost' ScopeInfo, and instead keep an arraylist
1579 Remove AdjustMethodScope which is now computed at the end. Remove
1580 LinkScope which did a partial link, instead link all ScopeInfos
1581 before code generation from the new "LinkScopes" routine.
1583 Simplify all the Add* routines as they no longer need to maintain
1584 the tree, they just need to record that they are using variables
1587 (IsAncestor, GetAncestorScopes, GetParentScope, LinkScope): New
1588 routines to produce the forest of ScopeInfo trees.
1590 * class.cs (TypeContainer.AppendMethod): This is just like
1591 AddMethod, but ensures that an interface implementation method
1592 (IEnumerable.XXX) is not inserted at the beginning of the queue of
1593 methods, but at the end.
1595 We use this functionality to ensure that the generated MoveNext
1596 method in the iterator class is resolved/emitted before the
1597 enumerator methods created.
1599 This is required because the MoveNext method computes the right
1600 ScopeInfo for the method. And the other methods will eventually
1601 need to resolve and fetch information computed from the anonymous
1604 2006-01-21 Raja R Harinath <harinath@gmail.com>
1605 Carlos Alberto Cortez <calberto.cortez@gmail.com>
1608 * namespace.cs (NamespaceEntry.UsingExternalAliases): Don't add to
1610 (NamespaceEntry.LookupAlias): Lookup 'extern_aliases' hash too.
1611 (NamespaceEntry.VerifyUsing): Resolve external aliases too.
1613 2006-01-18 Raja R Harinath <rharinath@novell.com>
1615 Fix #76656, cs0231-2.cs.
1616 * cs-parser.jay (formal_parameter_list): Make error case catch
1618 (parenthesized_expression_0): Add CS1026 check.
1619 (invocation_expression): Remove unused { $$ = lexer.Location }.
1621 2006-01-17 Raja R Harinath <rharinath@novell.com>
1624 * cs-parser.jay (statement_expression): Don't list out the
1625 individual statement-expressions. Convert syntax error into
1628 2006-01-16 Raja R Harinath <rharinath@novell.com>
1631 * ecore.cs (MemberAccess.CheckIntermediateModification): Remove.
1632 (UnboxCast.DoResolveLValue): New. Move CS0445 check from
1633 CheckIntermediateModification.
1634 (FieldExpr.DoResolve): Add new two-argument version that
1635 allows us to resolve the InstanceExpression as an lvalue.
1636 The one-argument variant is now just a wrapper.
1637 (FieldExpr.DoResolveLValue): Use two-argument DoResolve.
1638 Resolve the lhs as an lvalue if the it has a value type.
1639 (FieldExpr.AssignToReadonly): Move CS1648 and CS1650 checks
1640 from Assign.DoResolve.
1641 (PropertyExpr.InstanceResolve): Allow InstanceExpression to be
1642 resolved as an lvalue.
1643 (PropertyExpr.DoResolve): Update.
1644 (PropertyExpr.DoResolveLValue): Resolve the lhs as an lvalue if it
1645 has a value type. Move CS1612 check here from
1646 CheckIntermediateModification.
1647 * assign.cs (Assign.DoResolve): Remove CS1648 and CS1650 checks.
1648 * expression.cs (EmptyExpression.OutAccess): New. Used as the
1649 'right_side' of a ResolveLValue on an 'out' argument.
1650 (EmptyExpression.LValueMemberAccess): New. Used as the
1651 'right_side' of a propagated ResolveLValue on a value type.
1652 (LocalVariableReference.DoResolveBase): Recognize
1653 EmptyExpression.OutAccess and EmptyExpression.LValueMemberAccess.
1655 (Argument.Resolve): Use EmptyExpression.OutAccess rather than
1656 EmptyExpression.Null.
1658 2006-01-16 Atsushi Enomoto <atsushi@ximian.com>
1660 * typemanager.cs : added IsGenericParameter(). In mcs it always
1662 * doc.cs : for generic parameters, use GenericParameterPosition,
1665 2006-01-12 Ben Maurer <bmaurer@andrew.cmu.edu>
1667 * expression.cs: Fix Console.WriteLine ((this = x).foo);
1669 2006-01-12 Miguel de Icaza <miguel@novell.com>
1671 This fixes the problem where we used ldfld instead of ldflda to
1672 load the "THIS" pointer on captured parameters, when THIS is a
1673 value type. See bug #77205.
1675 * iterators.cs (CapturedThisReference.Emit): Pass false to
1676 EmitThis (we do not need the address).
1678 * codegen.cs (EmitThis): it needs to know whether we need the
1679 address of `this' or not. This is used by value types.
1681 * expression.cs (This.AddressOf): Pass true to the EmitThis call,
1682 every other call passes false.
1684 2006-01-12 Raja R Harinath <rharinath@novell.com>
1687 * typemanager.cs (TryGetBaseDefinition): Rename from the mis-named
1689 * expression.cs (Invocation.OverloadResolve): Update.
1690 (Invocation.DoResolve): Avoid double resolution of invocation.
1692 2006-01-11 Raja R Harinath <rharinath@novell.com>
1695 * expression.cs (Unary.Emit): When in /checked+ mode, don't emit
1696 unary negation of floating point types as 0-expr; negation cannot
1697 overflow in floating point types.
1700 * expression.cs (MemberAccess.DoResolve): Disallow the use of '.'
1701 on operands of 'void' type.
1704 * cfold.cs (BinaryFold): Implement folding of BinaryOr, BinaryAnd
1705 and ExclusiveOr for boolean constants too.
1707 2006-01-09 Raja R Harinath <rharinath@novell.com>
1710 * expression.cs (Invocation.OverloadResolve): Replace reflected
1711 override methods with their base virtual methods, rather than
1713 * typemanager.cs (TypeManager.GetOverride): New.
1715 2006-01-05 Jb Evain <jbevain@gmail.com>
1717 * class.cs (Property.Define, Indexer.Define): do not tag the
1718 properties as SpecialName | RTSpecialName.
1720 2006-01-04 Miguel de Icaza <miguel@novell.com>
1722 * class.cs (MethodCore.IsDuplicateImplementation): This method was
1723 doing a low-level comparission of parameter types. It was lacking
1724 a check for __argslist.
1726 2005-12-30 Miguel de Icaza <miguel@novell.com>
1728 * expression.cs (ParameterReference.DoResolveBase): Allow
1729 reference parameters if they are local to this block.
1731 This allows the ref and out parameters of a delegate to be used in
1732 an anonymous method, for example:
1734 delegate void set (out int x);
1736 set s = delegate (out int x){
1740 This is used by functionality introduced late in the C# language.
1742 * anonymous.cs (AnonymousMethod.Compatible): Allow anonymous
1743 method that take ref and out parameters.
1745 Fixes #77119 which was a late change in the spec.
1747 2005-12-23 Miguel de Icaza <miguel@novell.com>
1749 * anonymous.cs (ScopeInfo.LinkScope): Do not link the scope to its
1750 parent if its the same scope. Fixes #77060.
1752 2005-12-21 Miguel de Icaza <miguel@novell.com>
1754 * driver.cs: Report the case of no source files and no -out:
1757 2005-12-20 Raja R Harinath <rharinath@novell.com>
1760 * expression.cs (ComposedCast.GetSignatureForError): Define.
1762 2005-12-18 Carlos Alberto Cortez <calberto.cortez@gmail.com>
1766 * namespace.cs (NamespaceEntry): Add extern_aliases as a
1767 ListDictionary, to contain the ExternAliasEntry entries (in
1768 addition to the NamespaceEntry.aliases hashtable). This field is
1769 shared between the original entry and its doppelganger (bodyless
1771 (NamespaceEntry.UsingExternalAlias): Add the extern alias entry to
1772 extern_aliases field.
1773 (NamespaceEntry.Lookup): Move the IsImplicit check after the
1774 lookup in extern_aliases.
1776 2005-12-16 Raja R Harinath <rharinath@novell.com>
1779 * class.cs (TypeContainer.Mark_HasEquals): New.
1780 (TypeContainer.Mark_HasGetHashCode): New.
1781 (ClassPart): Override them.
1782 (MethodCore.CheckBase): Use them instead of referring to Parent.Methods.
1785 * enum.cs (EnumMember.EnumMember): Pass the parent_enum as the
1786 'parent' argument to the base constructor.
1788 Remove all mention of TypeContainer from decl.cs.
1789 * decl.cs (MemberCore.Parent): Change into a DeclSpace.
1790 (MemberCore.MemberCore): Change type of 'parent' argument to DeclSpace.
1791 (DeclSpace.DeclSpace): Likewise.
1792 (DeclSpace.DefineMembers): Remove unused argument.
1793 * cs-parser.jay (pop_current_class): Update to changes. Simplify
1794 debugging check -- we don't care if the debug code throws an
1795 InvalidCastException instead of an InternalErrorException.
1796 * class.cs (TypeContainer.DefineMembers): Update to changes.
1797 (TypeContainer.DoDefineMembers): Likewise.
1798 (TypeContainer.GetMethods): Likewise.
1799 (PropertyMember.Define): Likewise.
1800 (MemberBase.Parent): New property that forwards to
1801 MemberCore.Parent, but ensures that we get a TypeContainer.
1802 * rootcontext.cs (RootContext.PopulateCoreType): Update to changes.
1803 (RootContext.PopulateTypes): Likewise. Remove special case code
1804 for !RootContext.StdLib: DefineMembers is idempotent.
1806 2005-12-14 Miguel de Icaza <miguel@novell.com>
1808 * convert.cs (ExplicitConversionCore): Check the return value from
1809 ExplicitConversionCore which can return null on failure. Fixes #76914
1811 2005-12-13 Marek Safar <marek.safar@seznam.cz>
1813 * class.cs (Method.ApplyAttributeBuilder): Test out modifier properly.
1815 2005-12-11 Atsushi Enomoto <atsushi@ximian.com>
1817 * doc.cs : The search for referenced namespace was insufficient to
1818 get global one as it used to do. Fixed bug #76965.
1820 2005-12-10 Atsushi Enomoto <atsushi@ximian.com>
1822 * doc.cs : check name in cref in the last phase that whether it is
1825 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
1827 * cs-tokenizer.cs : reverted the latest change: it somehow broke
1830 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
1832 * doc.cs : so it turned out that we cannot skip override check for
1833 interface members. Fixed bug #76954.
1835 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
1837 * cs-tokenizer.cs : fixed bug #75984:
1838 - #warning and #error should not be handled when the source line
1840 - #line is not checked strictly when the source line is disabled.
1841 - #define and #undef is on the other hand checked strictly at any
1844 2005-12-08 Atsushi Enomoto <atsushi@ximian.com>
1846 * cs-tokenizer.cs : missing Location (actually, filename) in one of
1849 2005-12-05 Marek Safar <marek.safar@seznam.cz>
1851 * attribute.cs (GlobalAttribute.ctor): Pass NamespaceEntry only.
1853 * class.cs (EmitFieldInitializers): Simplified and fixed to work with
1855 (FieldBase.EmitInitializer): Moved from TypeContainer and simplified.
1856 (FieldBase.Initializer): Initializer is now optional.
1857 (EventField.Define): Only event field can have initializer.
1859 * codegen.cs (EmitContext): DeclSpace is not readonly (small hack).
1861 * const.cs (Const): Reuse initializer.
1863 * cs-parser.jay: Updated after FieldBase changes.
1864 Added current_array_type to simplify array initializers.
1866 * ecore.cs (NullCast.IsDefaultValue): Implemented.
1868 * expression.cs, iterators.cs: Updated.
1870 * namespace.cs (NamespaceEntry): Made UsingFound private.
1872 2005-12-05 Marek Safar <marek.safar@seznam.cz>
1874 * parameterCollection.cs: Obsolete, removed.
1875 * parser.cs: Obsolete, removed.
1877 2005-12-05 Marek Safar <marek.safar@seznam.cz>
1880 * class.cs (Constructor.Emit): Set obsolete checking for whole context.
1882 * enum.cs (Enum.Define): Set obsolete context here.
1884 2005-12-05 Atsushi Enomoto <atsushi@ximian.com>
1887 - FindDocumentedMember() now expects 1) paramList as null
1888 when "we don't have to check the number of parameters" and
1889 2) Type.EmptyTypes when "there is no arguments".
1890 - Introduced FoundMember struct to hold the exact type which was
1891 used to find the documented member (the above change broke
1892 test-xml-044; it might be better just to use DeclaringType than
1893 what MS does, like this change does, but it depends on usage.)
1895 2005-12-05 Atsushi Enomoto <atsushi@ximian.com>
1897 * doc.cs : documented member might be from DeclaringType for nested
1898 types. Fixed bug #76782.
1900 2005-12-03 Ben Maurer <bmaurer@ximian.com>
1902 * anonymous.cs: Have the param code handle leaving copies on the
1903 stack etc. Allows anonymous params to take part in the assignment
1904 code (++, +=, etc). Fixes bug #76550
1906 * expression.cs: Handle the prepare_for_load/leave_copy by passing
1907 it down to the anon code.
1909 * iterators.cs: Use dummy var here
1911 * codegen.cs: Handle new vars
1913 2005-12-01 Marek Safar <marek.safar@seznam.cz>
1916 * class.cs (MethodData.Define): Set proper Obsolete context.
1918 * ecore.cs (FieldExpr.ResolveMemberAccess): Don't check [Obsolete] in
1920 (FieldExpr.DoResolve): Ditto.
1922 2005-12-01 Marek Safar <marek.safar@seznam.cz>
1925 * class.cs (MethodCore.DoDefineParameters): Test [Obsolete] only when
1926 parent is not obsolete.
1928 2005-12-01 Atsushi Enomoto <atsushi@ximian.com>
1930 * doc.cs : (FindDocumentedMember) find parameterless members first
1931 and get CS0419 in the early stage. Fixed first case of bug #76727.
1933 2005-11-30 Marek Safar <marek.safar@seznam.cz>
1936 * ecore.cs (Expression.ResolveAsConstant): Report constant error only when
1937 no error was reported.
1939 *expression.cs (Binary.DoResolve): left can be null.
1941 2005-11-22 Marek Safar <marek.safar@seznam.cz>
1944 * class.cs (MethodData.Emit): Parameters should be labeled first.
1946 2005-11-21 Marek Safar <marek.safar@seznam.cz>
1949 * parameter.cs (Parameter.ApplyAttributeBuilder): Fixed `ref' detection.
1951 2005-11-18 Marek Safar <marek.safar@seznam.cz>
1953 * attribute.cs (AreParametersCompliant): Moved to Parameter.
1955 * class.cs (MethodCore): Parameter clean up.
1956 (IMethodData): Added ParameterInfo.
1957 (MethodData): Parameter clean up.
1958 (Indexer.Define): Parameter clean up.
1970 * typemanager.cs: Parameter clean up.
1972 * delegate.cs (Define): Get rid of duplicated code.
1974 * expression.cs (ParameterReference): Removed useless parameters
1976 (Invocation): Ditto.
1978 * parameter.cs (ParamsParameter): New class, params specialization.
1979 (ArglistParameter): Attemp to separate arglist.
1980 (Parameter): Refactored to be reusable and faster.
1981 (Parameter.Modifier): Made understandable.
1982 (Parameters): Changed to be used as a class for `this' assembly
1983 parameters. Refactored to use new specialized classes.
1985 * support.cs (ParameterData): Added Types property.
1986 (InternalParameters): Deleted.
1988 2005-08-20 Martin Baulig <martin@ximian.com>
1990 Merging this patch from GMCS to fix #75867.
1992 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
1993 scope if we don't already have it.
1995 2005-11-17 Martin Baulig <martin@ximian.com>
1998 (CaptureContext.EmitMethodHostInstance): Use `Ldarg_0' if we
1999 inherit the scope from our parent. Fixes #76653.
2001 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
2003 * doc.cs : the previous patch does not actually fix the bug.
2004 PropertyInfo override check is now implemented and really fixed it.
2005 * expression.cs : Invocation.IsAncestralType() is used from doc.cs.
2007 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
2009 * doc.cs : apply "override filter" also to properties.
2012 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
2014 * doc.cs : renamed FindMembers() to FindMethodBase(). For interfaces,
2015 no need to check overrides. For classes, omit those results from
2016 interfaces since they must exist in the class. Fixed bug #76726.
2018 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
2020 * typemanager.cs : (GetFullNameSignature) differentiate indexers
2021 with different parameters. Fixed the second problem in #76685.
2023 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
2025 * doc.cs : (FindDocumentedMember) pass invocation_type as well (to
2026 get expected 'protected' access in CheckValidFamilyAccess()).
2029 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
2031 * doc.cs : (GenerateTypeDocComment) Fields could be FixedField.
2032 Fixed bug #76705. CS1569 was incorrectly commented out.
2034 2005-11-14 Atsushi Enomoto <atsushi@ximian.com>
2036 * doc.cs : use Invocation.IsOverride() to do real override check.
2037 * expression.cs : made Invocation.IsOverride() internal.
2039 2005-11-14 Atsushi Enomoto <atsushi@ximian.com>
2041 * doc.cs : use TypeManager.FindMembers() instead of (possible)
2042 TypeBuilder.FindMembers() and filter overriden base members out.
2045 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
2047 * doc.cs : ref/out parameters are represented as '@' (instead of
2048 '&' in type FullName). Fixed bug #76630 (additionally crefs).
2050 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
2052 * doc.cs : when there was no '.' in cref to methods in doc comment,
2053 then parameters were missing in the output. Fixed bug #76691.
2055 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
2057 * driver.cs : don't output docs when there is an error.
2060 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
2063 Now it should detect indexers. Fixed primary concern in bug #76685.
2064 Fixed CS0419 message to not show the identical member signature in
2067 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
2069 * doc.cs : (FindDocumentedMember) use TypeManager.MemberLookup()
2070 instead of Type.FindMembers() since it does not handle events.
2073 2005-11-12 Gert Driesen <drieseng@users.sourceforge.net>
2075 * codegen.cs: Fixed typo (speficied -> specified).
2077 2005-11-11 Marek Safar <marek.safar@seznam.cz>
2080 * doc.cs (FindDocumentedTypeNonArray): Don't resolve again.
2082 2005-11-11 Marek Safar <marek.safar@seznam.cz>
2084 * attribute.cs: Changed error message.
2086 * cs-tokenizer.cs: One more check.
2088 2005-11-10 Marek Safar <marek.safar@seznam.cz>
2090 * statement.cs (Block.Resolve): Ignore empty statement.
2092 2005-11-10 Marek Safar <marek.safar@seznam.cz>
2094 * report.cs: Made error/warning methods more strict to avoid
2097 * anonymous.cs, attribute.cs, class.cs, codegen.cs, constant.cs,
2098 convert.cs, cs-parser.jay, cs-tokenizer.cs, decl.cs, delegate.cs,
2099 doc.cs, driver.cs, ecore.cs, expression.cs, location.cs,
2100 namespace.cs, parameter.cs, statement.cs, typemanager.cs: Updated.
2102 2005-11-08 Marek Safar <marek.safar@seznam.cz>
2104 * attribute.cs (Attribute.GetCoClassAttributeValue): New method.
2105 (AttributeTester.GetCoClassAttribute): Get CoClassAttribute.
2107 * class.cs (TypeContainer.IsComImport): New property.
2108 (Constructor.Define): Create proper ctor for ComImport types.
2110 * expression.cs (New.CheckComImport): Fixed.
2112 2005-11-07 Miguel de Icaza <miguel@novell.com>
2114 * anonymous.cs (CaptureContext.AddParameterToContext): The fact
2115 that a parameter has been captured does not mean that we do not
2116 have to do the rest of the processing. This fixes the second part
2117 of #76592. If there was another anonymous method capturing
2118 values in the past, the Scope would never be set for the second
2119 method that captured the same parameter.
2121 (CaptureContext.EmitAssignParameter): When `leave_copy' is passed,
2122 properly manipulate the stack. Second part of fix for #76592.
2124 * expression.cs (New): Add support for invoking "new" on
2125 interfaces that have been flagged with the ComImport attribute and
2126 the CoClass. Fixes #76637
2128 * statement.cs (Try.DoEmit): When a variable is captured, do not
2129 try to emit the vi.LocalBuilder variable as it has been captured.
2130 Create a temporary variable and store the results on the
2131 FieldBuilder. Fixes #76642
2133 2005-11-07 Marek Safar <marek.safar@seznam.cz>
2135 * class.cs (CheckPairedOperators): Made compilable with csc 2.0.
2137 * ecore.cs (InstanceResolve): Fixed CS1540 detection.
2139 * expression.cs (Binary.DoResolve): Added && optimalization.
2141 * typemanager.cs (AddUserType): Removed useless argument.
2143 2005-11-04 Marek Safar <marek.safar@seznam.cz>
2145 * statement.cs (Block.variables): Uses ListDictionary.
2147 2005-11-03 Marek Safar <marek.safar@seznam.cz>
2150 * class.cs (PartialContainer.EmitType): Customized to emit
2151 security attributes.
2152 (ClassPart.ApplyAttributeBuilder): Transform security attribute
2153 for partial classes.
2155 2005-11-03 Marek Safar <marek.safar@seznam.cz>
2158 * expression.cs (ElementAccess.DoResolveLValue): Fixed buffer
2159 access has to be fixed.
2161 * typemanager.cs (IsUnmanagedType): Wrong common field type.
2163 2005-11-01 Marek Safar <marek.safar@seznam.cz>
2166 * ecore.cs (NullCast.Reduce): Implemented.
2168 * expression.cs (ArrayCreation.CheckIndices): Correcly check
2171 * statement.cs (SwitchLabel.ResolveAndReduce): Catch null
2173 (Foreach.Resolve): Catch null properly.
2175 2005-10-29 Marek Safar <marek.safar@seznam.cz>
2177 * cs-tokenizer.cs: Warning text fix.
2179 * driver.cs: AllWarningNumbers exposed on public interface.
2181 * report.cs (): Reviewed warning numbers.
2182 (IsValidWarning): Use binary search.
2184 2005-10-29 Marek Safar <marek.safar@seznam.cz>
2186 * driver.cs: Implemeted resource visibility.
2187 (Resources): New class for code sharing between /res: and
2190 2005-10-28 Marek Safar <marek.safar@seznam.cz>
2193 * cfold.cs (ConstantFold.BinaryFold): Implemented null cast
2196 * convert (Convert.ImplicitReferenceConversion): NullCast holds
2199 * ecore.cs (NullCast): Child is contant only.
2201 * literal.cs (NullLiteral.Reduce): null can be converted to any
2204 2005-10-28 Kornél Pál <kornelpal@hotmail.com>
2206 * driver.cs: Use Encoding.Default as default code page instead
2209 2005-10-27 Raja R Harinath <rharinath@novell.com>
2212 * expression.cs (Invocation.Error_InvalidArguments): Handle
2213 __arglist parameters.
2214 (Invocation.VerifyArgumentsCompat): Likewise.
2215 * support.cs (ReflectionParameters.GetSignatureForError): Print
2216 __arglist parameters.
2217 (InternalParamters.GetSignatureForError): Likewise.
2218 * parameter.cs (Parameters.GetSignatureForError): Likewise.
2220 2005-10-26 Marek Safar <marek.safar@seznam.cz>
2222 * attribute.cs (GetPropertyValue): Made public.
2224 * codegen.cs (AssemblyClass): ResolveClsCompliance renamed to
2226 Add new property WrapNonExceptionThrows to handle 2.0 assembly
2228 (AssemblyClass.Emit): Emit RuntimeCompatibilityAttribute when it
2231 * driver.cs: Reflect method name change.
2233 * statement.cs (Try.Resolve): Warn when try has both general
2236 * typemanager.cs: runtime_compatibility_attr_type new predefined
2239 2005-10-26 Raja R Harinath <harinath@gmail.com>
2242 * pending.cs (InterfaceMethod): Allow tm.args [i] to be null --
2243 treat it as an empty parameter list.
2245 2005-10-26 Raja R Harinath <rharinath@novell.com>
2248 * ecore.cs (SimpleName.DoSimpleNameResolve): Make fall-back
2249 ResolveAsTypeStep silent.
2250 * statement.cs (Block.AddConstant): Mark block as used.
2251 (Block.ResolveMeta): Avoid piling on error messages
2252 if a constant initializer resolution fails.
2254 2005-10-25 Raja R Harinath <rharinath@novell.com>
2256 * namespace.cs (RootNamespace.VerifyUsingForAll, Namespace.VerifyUsing):
2258 (NamespaceEntry.VerifyAllUsing): New.
2259 (NamespaceEntry.AliasEntry.Resolve): New. Handles common error
2260 behaviour. Delegates actual resolution of alias to ...
2261 (NamespaceEntry.DoResolve): ... this. Renamed from Resolve.
2262 (NamespaceEntry.LocalAliasEntry, NamespaceEntry.ExternAliasEntry):
2264 * driver.cs (Driver.MainDriver): Update.
2266 * namespace.cs (NamespaceEntry.DefineNamespace): Remove.
2267 (NamespaceEntry.SymbolFileID): Make into a on-demand computed
2269 (Namespace.DefineNamespaces, RootNamespace.DefineNamespacesForAll):
2271 * symbolwriter.cs (SymbolWriter.Initialize): Don't call
2272 RootNamespace.DefineNamespacesForAll.
2274 2005-10-24 Raja R Harinath <harinath@gmail.com>
2276 * typemanager.cs (assemblies, external_aliases, modules)
2277 (AddAssembly, AddExternAlias, AddModule GetAssemblies, Modules)
2278 (ComputeNamespaces, GetRootNamespace): Remove extra staging
2279 overhead. Move resposibility ...
2280 * namespace.cs (GlobalRootNamespace): ... here. Update to changes.
2281 * driver.cs, attribute.cs, codegen.cs: Update to changes.
2283 2005-10-23 Raja R Harinath <harinath@gmail.com>
2285 * namespace.cs (RootNamespace.all_namespaces): Renamed from
2286 cached_namespaces. Improve usage.
2287 (RootNamespace.Reset, RootNamespace.RegisterNamespace)
2288 (RootNamespace.VerifyUsingForAll, RootNamespace.DefineNamespacesForAll):
2289 Move from GlobalRootNamespace and simplify.
2290 (RootNamespace.Global): Make instance variable.
2291 (RootNamespace.RootNamespace): Add "alias name" parameter.
2292 (GlobalRootNamespace): Simplify drastically.
2293 (Namespace.Lookup): Don't use GetNamespace.
2294 * typemanager.cs (GetRootNamespace): Rename from
2295 ComputeNamespaceForAlias.
2296 (NamespaceClash): Use Global.IsNamespace instead of GetNamespace.
2298 2005-10-23 Marek Safar <marek.safar@seznam.cz>
2300 * anonymous.cs (AnonymousContainer): Don't crash when container
2303 2005-10-23 Marek Safar <marek.safar@seznam.cz>
2305 * expression.cs (Binary.DoResolve): Warn when comparing same
2308 2005-10-23 Marek Safar <marek.safar@seznam.cz>
2311 * expression.cs (Binary.DoResolve): It looks like there are no
2312 convetsion rules in enum context.
2314 2005-10-19 Carlos Alberto Cortez <calberto.cortez@gmail.com>
2316 Add support for extern alias qualifiers.
2317 * typemanager.cs: Move some LookupTypeReflection code
2318 to namespace.cs, to have cleaner code. Added some methods
2319 to help us keep track of the extern aliased references.
2320 * driver.cs: Add suport for extern alias assemblies on command
2321 line and check for their warnings/errors. Also keep track of the
2322 extern aliased assemblies.
2323 * namespace.cs: Move the global functionality of Namespace
2324 to GlobalRootNamespace/RootNamespace. Now the global namespace
2325 is GlobalRootNamespace.Globa. Also the code moved from
2326 typemanager.cs lives in GlobalRootNames.cs/RootNamespace.cs.
2327 Finally added LocalAliasEntry (AliasEntry before) and
2328 ExternAliasEntry, to handle alias statements.
2329 * cs-parser.jay: Add support in the grammar for extern alias
2331 * doc.cs, delegate.cs, expression.cs ecore.cs, symbolwriter.cs:
2332 Update callings to Namespace (now in GlobalRootNamespace).
2334 2005-10-18 Raja R Harinath <rharinath@novell.com>
2337 * class.cs (TypeContainer.DefineType): Move updating of
2338 topological sort earlier in the code.
2339 * decl.cs (DeclSpace.ResolveBaseTypeExpr): Don't use TypeBuilder.
2341 2005-10-18 Marek Safar <marek.safar@seznam.cz>
2344 * cfold.cs (BinaryFold): Reduce constant in enum conversion.
2346 * constant.cs (Constant.TryReduce): Moved from Cast class.
2347 (Reduce): Made little bit more OO and fixed missing conversions.
2349 * ecore.cs (Reduce): Implemented.
2350 (Binary.EnumLiftUp): New method to upgrade values to enum values.
2352 * literal.cs (Reduce): Implemented.
2354 * class.cs: Reverted Miguel's wrong commit.
2356 2005-10-14 Miguel de Icaza <miguel@novell.com>
2358 * ecore.cs (GetMemberType): Report the correct mapping for the MemberCore
2360 2005-10-14 Atsushi Enomoto <atsushi@ximian.com>
2362 * cs-parser.jay, expression.cs : CS0214 was missing error location
2363 for constants. Fixed bug #76404.
2365 2005-10-11 Marek Safar <marek.safar@seznam.cz>
2368 * convert.cs (ExplicitConversionCore): Fixed object->enum
2371 2005-10-10 Raja R Harinath <rharinath@novell.com>
2373 * ecore.cs (PropertyExpr.Emit): Use Invocation.EmitCall to emit
2375 (PropertyExpr.EmitCall): Likewise.
2376 * expression.cs (Invocation.EmitArguments): Handle case where
2378 (Invocation.EmitCall): Avoid allocating temporary variable if
2379 there are no arguments.
2381 2005-10-07 Raja R Harinath <rharinath@novell.com>
2384 * convert.cs (ImplicitConversionStandard): Move conversion of
2385 void* to arbitrary pointer types ...
2386 (ExplicitConversionStandard): .. here.
2387 * ecore.cs (Expression.Error_ValueCannotBeConverted): Fix CS0266
2388 error to always print typenames.
2390 2005-10-07 Raja R Harinath <rharinath@novell.com>
2392 * convert.cs (GetConversionOperator): Rename from
2393 GetConversionOperators. Move operator selection code from ...
2394 (UserDefinedConversion): ... here.
2396 2005-10-06 Marek Safar <marek.safar@seznam.cz>
2398 * convert.cs (ExplicitConversionCore): Removed duplicate enum
2401 2005-10-05 Marek Safar <marek.safar@seznam.cz>
2403 * assign.cs (Assign.DoResolve): Error method changed.
2405 * cfold.cs (DoConstantNumericPromotions): Error method changed.
2407 * const.cs (ResolveValue): Reset in_transit immediately.
2409 * constant.cs: Error method changed.
2411 * convert.cs: Removed useless location parameter.
2412 (ExplicitNumericConversion): Don't do double enum check.
2413 (ExplicitConversionCore): Renamed from ExplicitConversion.
2414 (ExplicitUnsafe): Extracted from ExplicitConversion.
2415 (ExplicitConversion): Uses for error reporting.
2417 * ecore.cs (Error_ValueCannotBeConverted): More logic for more
2419 (ResolveBoolean): Uses common error method.
2420 (CastToDecimal): Get rid of ec.
2421 (CastFromDecimal): Optimized.
2422 (ConvCast): Get rid of ec.
2424 * enum.cs (ResolveValue): Reset in_transit immediately.
2425 (Emit): Return after first error.
2427 * expression.cs: Convert changes.
2429 * literal.cs: Error method changed.
2431 * statement.cs: Error method changed.
2433 2005-10-03 Raja R Harinath <rharinath@novell.com>
2435 * support.cs (SeekableStreamReader.Position): Don't error out when
2436 the requested position is just beyond the end of the current
2439 2005-09-28 Raja R Harinath <rharinath@novell.com>
2441 * support.cs (SeekableStreamReader): Simplify drastically. Don't
2442 try to keep in sync with the byte count of the underlying Stream.
2443 However, this limits us to a window size of 2048 characters: i.e.,
2444 the maximum lookahead of our lexer/parser can be 2048 characters.
2446 2005-09-28 Marek Safar <marek.safar@seznam.cz>
2449 * driver.cs: Fix compilation files with full root path.
2451 2005-09-25 Miguel de Icaza <miguel@novell.com>
2453 * report.cs (SymbolRelatedToPreviousError): Format the output so
2454 it does not use an open parenthesis that is never closed.
2456 * driver.cs: Follow coding guidelines
2458 2005-09-27 Marek Safar <marek.safar@seznam.cz>
2461 * const.cs (Const.ResolveValue): Check for assigning non-null
2462 value to reference type.
2464 2005-09-27 Marek Safar <marek.safar@seznam.cz>
2466 * anonymous.cs: Implemented ExprClassName.
2468 * assign.cs (Assign.DoResolve): Don't chrash when type is not
2471 * attribute.cs (ResolveArguments): Enabled MethodImplOptions
2474 * class.cs (StaticClass.DefineContainerMembers): Report protected
2477 * codegen.cs: if(ed) PRODUCTION.
2479 * convert.cs (Error_CannotImplicitConversion): Better error
2482 * cs-parser.jay: More error checks.
2484 * cs-tokenizer.cs (consume_identifier): Fixed Miguel's revert.
2486 * driver.cs (CSCParseOption): Enabled wrong option check.
2488 * ecore.cs (Expression.ExprClassName): Turned to property.
2489 (MemberExpr.CheckIntermediateModification): For checking boxed
2490 value types modification.
2492 * statement.cs (Fixed.Resolve): Expression type must be
2493 convertible to fixed type.
2494 (CollectionForeach.GetEnumeratorFilter,TryType):
2495 Small refactoring for easier error checking.
2497 2005-09-26 Marek Safar <marek.safar@seznam.cz>
2499 * attribute.cs (Attribute.Resolve): Check Obsolete attribute for
2502 * class.cs (GeneratedBaseInitializer): New class for customization
2503 compiler generated initializers.
2504 (MemberBase.DoDefine): Check Obsolete attribute here.
2505 (FieldMember.DoDefine): Ditto.
2507 * const.cs (ExternalConstant.CreateDecimal): Builder for decimal
2510 * decl.cs (MemberCore.EmitContext): Returns valid current ec.
2511 (MemberCore.GetObsoleteAttribute): Removed argument.
2512 (MemberCore.CheckObsoleteness): Obsolete attributes are hierarchic.
2513 (MemberCore.CheckObsoleteType): New helper.
2517 * statement.cs: Updates after MemberCore changes.
2519 * ecore.cs (TypeExpr.ResolveType): Check type obsoleteness here.
2520 (FieldExpr.ResolveMemberAccess): Fixed decimal constants checks.
2522 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't check
2523 obsolete attribute for compiler construct.
2524 (As.DoResolve): Cache result.
2526 * iterators.cs (Define_Constructor): Use GeneratedBaseInitializer.
2528 2005-09-26 Raja R Harinath <rharinath@novell.com>
2531 * expression.cs (This.VerifyFixed): In a value type T, the type of
2532 'this' is T&, iow, 'this' is either an out or ref parameter. In a
2533 value type R, 'this' is treated as a value parameter.
2535 2005-09-22 Miguel de Icaza <miguel@novell.com>
2537 * statement.cs (Lock): Use the TemporaryVariable class instead of
2538 manually using local variables as those do not work when variables
2541 * ecore.cs: Moved the TemporaryVariable class from being a nested
2542 class inside Foreach to be a public class that can be employed in
2545 2005-09-19 Marek Safar <marek.safar@seznam.cz>
2547 * cs-parser.jay: interface_accessors replaced by
2548 accessor_declarations.
2550 * ecore.cs, literal.cs, statement.cs: NullLiteral holds null
2553 * statement.cs (GotoCase.Resolve): Convert null constant to
2555 (SwitchLabel.ResolveAndReduce): Ditto.
2556 (SwitchLabel.NullStringCase): Custom null stamp.
2557 (Switch.SimpleSwitchEmit): Fix from NullLiteral to NullStringCase.
2559 typemanager.cs (CSharpSignature): Don't skip first argument
2562 2005-09-18 Miguel de Icaza <miguel@novell.com>
2564 * driver.cs: Set InEmacs based on the environment variable EMACS.
2566 * location.cs (InEmacs): in this mode, do not report column
2567 location as it confuses Emacs.
2569 2005-09-16 Marek Safar <marek.safar@seznam.cz>
2571 * cfold.cs, constant.cs, convert.cs, ecore.cs,
2572 expression.cs, iterators.cs, literal.cs: Store constants and
2575 * class.cs (MemberBase.ShortName): Pass location.
2577 * cs-parser.jay: Some location fixes.
2579 * ecore.cs (Expression.Location): Made virtual.
2581 2005-09-05 Miguel de Icaza <miguel@novell.com>
2583 * expression.cs (Cast.TryReduce): Only reduce to an EnumConstant
2584 if the underlying types are the same, otherwise we need to produce
2585 code that will do the proper cast.
2587 This was exposed by Marek's constant rewrite which produced
2588 invalid code for the call site:
2591 void Method (X v) {}
2595 This fixes test-49.cs
2597 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
2599 * attribute.cs : (Attribute.IsValidArgumentType): array of string/
2600 Type/Object should be allowed as well. Fixed bug #75968.
2602 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
2604 * expression.cs : (Binary.DoResolve): when one is enum constant and
2605 another is constant 0, then return enum one *as enum type*.
2608 2005-09-02 Raja R Harinath <rharinath@novell.com>
2610 * attribute.cs (GetMarshal): Work even if "DefineCustom" is
2614 * ecore.cs (SimpleNameResolve.DoSimpleNameResolve): Disable
2615 flow-branching for LocalVariableReferences in case we were invoked
2616 from a MemberAccess.
2617 * expression.cs (LocalVariableReference.VerifyAssigned): New.
2619 (LocalVariableReference.DoResolveBase): ... this.
2620 (MemberAccess.Resolve): Do the check that was disabled during
2623 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
2626 (PartialContainer.Create): check abstract/sealed/static strictly
2627 but abstract/sealed can exist only at one side. Fixed bug #75883.
2629 2005-09-01 Kornél Pál <kornelpal@hotmail.com>
2632 * attribute.cs (Attribute.GetMarshal): If ArraySubType is not
2633 specified, don't default to UnmanagedType.I4.
2635 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
2637 * expression.cs : conditional operator should check possibly
2638 incorrect assign expression. Fixed bug #75946.
2640 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
2642 * cs-tokenizer.cs, cs-parser.jay, driver.cs, support.cs :
2643 Reverting the change. gmcs is much complex than mcs on this matter.
2645 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
2647 * cs-tokenizer.cs : To read another token ahead of the actual
2648 consumption, use new SavedToken and cache token instead of moving
2649 back the stream with SeekableStreamReader (it seemed problematic).
2651 driver.cs : Thus use StreamReader directly.
2652 * support.cs : Thus removed SeekableStreamReader.
2654 2005-08-30 Raja R Harinath <rharinath@novell.com>
2657 * anonymous.cs (ScopeInfo.MakeFieldName): New helper.
2658 (ScopeInfo.EmitScopeType): Use it to construct field names from
2659 names of captured locals.
2662 * ecore.cs (BoxedCast.BoxedCast) [1-argument variant]: Remove.
2663 * convert.cs (ImplicitReferenceConversion, TryImplicitIntConversion):
2664 Pass 'target_type' to BoxedCast. Don't default to 'object'.
2665 (ExplicitConversion): Remove enum cases already handled by
2666 implicit conversion. Move implicit conversion check to the beginning.
2667 * delegate.cs (DelegateCreation.ResolveMethodGroupExpr): Update.
2668 * expression.cs (ArrayCreation.EmitDynamicInitializers):
2669 Don't treat System.Enum as a struct.
2671 2005-08-30 Jb Evain <jbevain@gmail.com>
2673 * attribute.cs: handles as expression in parameters.
2675 2005-08-30 Raja R Harinath <rharinath@novell.com>
2678 * class.cs (TypeContainer.VerifyClsName): Don't use a
2679 PartialContainer when verifying CLS compliance.
2680 (AbstractPropertyEventMethod): Set Parent here, ...
2681 (PropertyMethod): ... not here.
2683 2005-08-30 Atsushi Enomoto <atsushi@ximian.com>
2685 * attribute.cs : escaped attribute name should not be allowed to be
2686 resolved (e.g. @class as classAttribute). Fixed bug #75930.
2688 2005-08-29 Raja R Harinath <rharinath@novell.com>
2691 * convert.cs (ImplicitStandardConversionExists): Allow zero also
2692 when converting a long constant to unsigned long.
2693 * expression.cs (Invocation.OverloadResolve): Add sanity check to
2694 detect where IsApplicable and VerifyArgumentsCompat disagree.
2696 2005-08-29 Raja R Harinath <rharinath@novell.com>
2697 and Carlos Alberto Cortez <carlos@unixmexico.org>
2700 * class.cs (TypeContainer.CanElideInitializer): New helper.
2701 (TypeContainer.EmitFieldInitializers): Use it to determine if we
2702 can safely emitting the initializer of a field.
2704 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
2706 * statement.cs : (Continue.Resolve()) Unlike break, continue is not
2707 allowed inside a switch (without loop). Fixed bug #75433.
2709 2005-08-26 Kornél Pál <kornelpal@hotmail.com>
2711 * AssemblyInfo.cs: Using Consts.MonoVersion instead of MonoVersion.cs.
2712 * mcs.exe.sources: Using Consts.MonoVersion instead of MonoVersion.cs.
2714 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
2716 * driver.cs : kinda reverting the default encoding changes (not exact
2717 revert since I noticed that "codepage:reset" might not work fine).
2719 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
2721 * class.cs : (AbstractPropertyEventMethod) SetupName() now takes
2722 Location. Now getter and setter store location correctly.
2723 (errors/cs0111-12.cs now reports the expected location.)
2725 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
2727 * driver.cs : Use default encoding on the environment.
2728 Removed (now that) extra parameter for SeekableStreamReader.
2729 * support.cs : (SeekableStreamReader) third .ctor() argument for
2730 StreamReader is not required (always true). preamble size could
2731 be acquired in simpler and safe way.
2733 2005-08-24 Atsushi Enomoto <atsushi@ximian.com>
2735 * cs-parser.jay: report CS0642 at warning level 3
2736 and report CS0642 for an if else statement also
2737 fixes bug #74745. Patch by John Luke (and a bit
2739 Removed extra CS0642 warning check for "while",
2741 * statement.cs: In Block.Resolve(), CS0642 check
2742 is reimplemented to check a sequence of an empty
2743 statement and a block.
2745 Both fix bug #66777.
2747 2005-08-24 Marek Safar <marek.safar@seznam.cz>
2749 * attribute.cs (GetMethodObsoleteAttribute): Disabled obsolete properties
2750 detection until I fix it.
2752 * cs-tokenizer.cs: Changed error message.
2754 * cs-parser.jay: Fixed 2 error locations.
2756 * ecore.cs (Error_TypeDoesNotContainDefinition): Share error message.
2757 (PropertyExpr.Error_PropertyNotFound): First attempt to detect non C#
2760 * enum.cs (GetSignatureForError): Fixed.
2762 * expression.cs (Invocation.IsSpecialMethodInvocation): Improved special
2766 * typemanager.cs (RegisterProperty): Removed.
2768 * statement.cs (CheckInvariantMeaningInBlock): Changed error message.
2770 2005-08-24 Raja R Harinath <rharinath@novell.com>
2773 * expression.cs (ArrayAccess.EmitLoadOpcode): Emit ldelem.i for pointers.
2774 (ArrayAccess.GetStoreOpcode): Return stelem.i for pointers.
2776 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
2778 * expression.cs : tiny fix is required for not warning positive ulong.
2781 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
2783 * expression.cs : add CS0652 check for constant and integral
2784 expression. Fixed bug #53974.
2786 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
2788 * expression.cs : in DoNumericPromotions(), check if there is implicit
2789 conversion overload for string (to check CS0034). Fixed bug #52492.
2791 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
2793 * cs-tokenizer.cs : Check newline in char constant. Fixed bug #75245.
2795 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
2797 * ecore.cs : report location when it is *not* Null.
2799 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
2805 Added OmitStructFlowAnalysis to EmitContext to handle CS0165 check
2806 correctly. Fixed bug #75721.
2808 2005-08-23 Raja R Harinath <rharinath@novell.com>
2810 * support.cs (SeekableStreamReader.Position): Avoid an expensive
2811 loop that performs 'min (pos, char_count)'.
2814 * expression.cs (Unary.ResolveOperator): Don't discard implicit
2815 converted value in Operator.OnesComplement.
2817 2005-08-22 Ben Maurer <bmaurer@ximian.com>
2819 * anonymous.cs: If the anon method is pulled into a helper class,
2820 it needs to be `internal' not `private'. Fixes runtime behavior on
2823 2005-08-20 Martin Baulig <martin@ximian.com>
2825 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
2826 scope if we don't already have it.
2828 * expression.cs (Invocation.EmitCall): Use `ec.EmitThis ()' rather
2829 than `ig.Emit (OpCodes.Ldarg_0)' to make it work inside iterators;
2832 2005-08-17 Marek Safar <marek.safar@seznam.cz>
2835 * decl.cs (DeclSpace.VerifyClsCompliance): Skip when collision object
2838 2005-08-16 Marek Safar <marek.safar@seznam.cz>
2840 The big constants rewrite
2841 Fix #75746, #75685 and more
2842 As a side effect saved 1MB for MWF ;-)
2844 * attribute.cs (GetAttributeArgumentExpression): Use ToType, GetTypedValue.
2845 (GetMarshal, GetMethodImplOptions, GetLayoutKindValue): Values are not
2846 enum based for corlib compilation.
2848 * cfold.cs (BinaryFold): Convert operand for enum additions. Fixed enum
2851 * class.cs (FixedField.Define): Use ResolveAsConstant.
2853 * const.cs (IConstant): Interface constants and enums.
2854 (Const.ResolveValue): New method for constant resolvning.
2855 (ExternalConstant): Constants from imported assemblies.
2857 * constant.cs (Constant.GetTypedValue): Used to get constant with forced
2858 conversion; like enums.
2859 (Constant.ToType): Converts this constant to different type.
2860 (Constant.Increment): Adds 1.
2862 * convert.cs (ImplicitConversionRequired): Simplified.
2864 * cs-parser.jay: Create EnumMember directly.
2866 * decl.cs (MemberCore.CheckObsoleteness): Checks for ObsoleteAttribute presence.
2868 * doc.cs (GenerateEnumDocComment): Removed.
2870 * ecore.cs (Expression.ResolveAsConstant): New constant specific method.
2871 (ConvertIntLiteral): Removed.
2872 (FieldExpr.ResolveMemberAccess): Refactored to remove constant specific if(s).
2874 * enum.cs (EnumMember): Implement IConstant.
2875 (Enum.IsValidEnumConstant): Removed.
2876 (Enum.GetNextDefaultValue): Removed.
2877 (Enum.FindMembers): Updated.
2878 (Enum.GenerateDocComment): Iterate enum members.
2880 * expression.cs (Cast.TryReduce): Handle enums correctly.
2881 (New.Constantify): Made public.
2882 (MemberAccess.DoResolve): Removed contant specific if(s).
2884 * literal.cs (NullLiteral): Implement new abstract methods.
2886 * statement.cs (GotoCase.Resolve): Use new constant methods.
2887 (SwitchLabel.ResolveAndReduce): Use new constant methods.
2889 * typemanager.cs (LookupEnum): Removed.
2890 (IsEnumType): Fixed to work with corlib.
2891 (RegisterConstant): Removed.
2892 (LookupConstant): Removed.
2893 (GetConstant): Changed to work with IConstant.
2895 2005-08-04 Atsushi Enomoto <atsushi@ximian.com>
2897 * location.cs : Fixed overflown (>255) column number.
2899 2005-08-03 Raja R Harinath <rharinath@novell.com>
2901 First cut of the qualified-alias-member feature.
2902 * cs-tokenizer.cs (Tokenizer.is_punct): Recognize the double-colon
2904 * cs-parser.jay (DOUBLE_COLON): New token.
2905 (namespace_or_type_name): Add rule for recognizing
2906 qualified-alias-members.
2907 (primary_expression): Likewise.
2908 (element_access): Allow QualifiedAliasMember as a possible
2909 type-bearing expression.
2910 (local_variable_type, local_variable_pointer_type): Likewise.
2911 * namespace.cs (NamespaceEntry.LookupAlias): New. Looks up
2912 aliases in the current and enclosing namespace declarations.
2913 (NamespaceEntry.UsingAlias): Add CS0440 warning.
2914 * decl.cs (MemberName.is_double_colon): New.
2915 (MemberName.MemberName): Add new constructor for alias-member.
2916 (MemberName.GetTypeExpression): Generate QualifiedAliasMember too.
2917 * expression.cs (QualifiedAliasMember): New expression type.
2919 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
2921 * location.cs : it borked when no argument was specified.
2923 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
2925 * location.cs : tiny ToString() format fix.
2927 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
2929 * statement.cs : oops, it was missing.
2931 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
2933 A set of fixes for precise line/column location.
2936 "token" field now holds a file/line "delta", a line number offset
2937 from the segment, and a column number. See also:
2938 http://lists.ximian.com/pipermail/mono-devel-list/2004-
2939 December/009508.html
2940 Removed static IsNull. Use instance IsNull property instead.
2942 For some tokens it stores Location. For Identifier it stores
2943 LocatedToken which is a pair of string name and location.
2944 Column numbers are adjusted only at getChar().
2946 Use Location.ToString() for reporting (it now contains column).
2948 Largely modified to use LocatedToken instead of
2949 string (IDENTIFIER), and to acquire Location from some tokens.
2950 * namespace.cs, decl.cs, ecore.cs, class.cs, delegate.cs,
2951 iterators.cs, const.cs, anonymous.cs, tree.cs, enum.cs,
2953 Now MemberName holds Location. DeclSpace.ctor() receives Location
2954 as a parameter. Removed extra parameters to all derived classes.
2955 Replaced Location.IsNull() with instance property.
2956 * assign.cs, expression.cs :
2957 Added .ctor() overload that omits Location.
2959 Added "nameEscaped" flag that indicates the identifier was escaped
2960 in the source file. This fixes bug #57047.
2962 2005-08-02 Marek Safar <marek.safar@seznam.cz>
2964 * attribute.cs (AttributeTester.GetImportedIgnoreCaseClsType):
2965 New method, looking for lo-case imported cls type.
2967 * decl.cs (DeclSpace.VerifyClsCompliance): Check CS3005 for types
2970 * driver.cs: Removed VerifyTopLevelNameClsCompliance usage.
2972 * enum (Enum.VerifyClsCompliance): Hardcode non-compliant types.
2974 * typemanager.cs (TypeManager.AllClsTopLevelTypes): Renamed from
2976 (TypeManager.LoadAllImportedTypes): Lo-case imported types.
2978 Optimized to save 3.5 MB for SWF compilation.
2980 2005-08-01 Marek Safar <marek.safar@seznam.cz>
2982 * class.cs (AddToTypeContainer): Use inheritance insted of if(s).
2983 (PartialContainer.Create): Moved logic AddToContainer.
2984 (PartialContainer.MarkForDuplicationCheck): Shares name.
2986 * decl.cs (DeclSpace.AddToContainer): Check name collisions at one
2989 * namespace.cs (Namespace.AddDeclSpace): Lazy declspaces
2991 (Namespace.GetSignatureForError): New method.
2993 * tree.cs (Tree.RecordDecl): Moved to AddToContainer.
2994 (RootTypes.AddToTypeContainer): se inheritance insted of if(s).
2996 2005-08-01 Raja R Harinath <rharinath@novell.com>
2999 * ecore.cs (Expression.MemberLookupFailed): Use queried_type for
3000 member lookup rather than qualifier_type, since qualifier_type can
3003 2005-08-01 Marek Safar <marek.safar@seznam.cz>
3005 * enum.cs (Enum.VerifyClsName): Fixed to allow not CLSCompliant
3008 2005-07-31 Miguel de Icaza <miguel@novell.com>
3010 * statement.cs: Copy the local exception into the exception
3011 captured local. Fixes 75674
3013 2005-07-31 Raja R Harinath <harinath@gmail.com>
3016 * expression.cs (Invocation.OverloadResolve): Don't report error
3017 CS1501 if error CS1502 has been reported.
3018 (New.DoResolve): Delegate CS1501 reporting to
3019 Invocation.OverloadResolve.
3022 * statement.cs (Block.CheckInvariantMeaningInBlock): Verify
3023 invariant-meaning-in-block property in an enclosing block if
3026 2005-07-29 Marek Safar <marek.safar@seznam.cz>
3028 * statement.cs (SwitchLabel.ResolveAndReduce): Refactored.
3029 (SwitchLabel.Erorr_AlreadyOccurs): Share error message.
3030 (Switch.CheckSwitch): Just save 50kb for SWF.
3032 2005-07-27 Martin Baulig <martin@ximian.com>
3034 * anonymous.cs (CaptureContext.AddField): Added
3035 `AnonymousContainer am' argument; compute its toplevel scope if
3036 it's not already computed. Fixes #75649.
3038 2005-07-26 Raja R Harinath <rharinath@novell.com>
3041 * class.cs (Constructor.Emit): Reset block to null if the block
3044 2005-07-25 Marek Safar <marek.safar@seznam.cz>
3046 * class.cs (TypeContainer.VerifyMembers): Be compatible in warning 169.
3048 2005-07-25 Marek Safar <marek.safar@seznam.cz>
3050 * class.cs (MethodData.Define): Check whether accessor implementing
3051 interface is public.
3053 * driver.cs (Driver.parse): Try to be smart and check for `MZ' header.
3055 2005-07-22 Marek Safar <marek.safar@seznam.cz>
3058 * namespace.cs (LookupType): Moved same type check to...
3060 * typemanager.cs (LookupTypeReflection): Don't allow to import more types
3063 2005-07-21 Raja R Harinath <rharinath@novell.com>
3065 * namespace.cs (NamespaceLookupType): Avoid a string allocation when we
3066 already found a typebuilder.
3067 * class.cs (MethodCore.IsDuplicateImplementation): Compare
3068 MemberNames, not strings.
3070 * const.cs (Error_ExpressionMustBeConst):
3071 Rename from Error_EpressionMustBeConst.
3072 * const.cs, class.cs, statement.cd: Update.
3074 2005-07-21 Marek Safar <marek.safar@seznam.cz>
3078 * const.cs (Const.LookupConstantValue): Report missing contant expression
3080 (Error_EpressionMustBeConstant): Only one error method.
3082 * class.cs, statement.c: Updated.
3084 2005-07-20 Raja R Harinath <rharinath@novell.com>
3086 * statement.cs (Block.Flags): Add back HasVarargs.
3087 (Block.flags): Make protected.
3088 (ToplevelBlock.HasVarargs): Convert to a property that updates flags.
3090 * typemanager.cs (types, typecontainers, user_types): Remove.
3091 (UserTypes, TypeContainers): Likewise.
3092 (HandleDuplicate, AddDelegateType, AddEnumType): Likewise.
3093 (CleanUp, Reset): Update.
3094 (AddUserType): Combine variants. Now, only updates builder_to_declspace.
3095 (GetNestedType): Use Type.GetNestedType.
3096 (CoreLookupType): Take two arguments, the namespace and the
3097 basename of the type. Update to use the Namespace.Lookup
3099 (InitEnumUnderlyingTypes, InitCoreTypes): Update.
3100 (RealMemberLookup): Use IsNestedChildOf instead of playing with
3101 string concatenation and substring matches.
3102 * class.cs, enum.cs, delegate.cs: Update to changes.
3104 2005-07-20 Marek Safar <marek.safar@seznam.cz>
3106 * constant.cs (Constant.Error_ConstantValueCannotBeConverted): Moved from
3107 Expression and made virtual.
3109 * convert.cs (ImplicitReferenceConversionExists): Skip for value types.
3110 (ImplicitStandardConversionExists): Fixed `byte' typo ?
3112 * ecore.cs (Expression.Error_ConstantValueCannotBeConverted): Moved.
3114 * literal.cs (NullLiteral.Error_ConstantValueCannotBeConverted): Customize
3117 * convert.cs, ecore.cs, enum.cs: Reflect Error_ConstantValueCannotBeConverted
3120 2005-07-18 Marek Safar <marek.safar@seznam.cz>
3123 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Check whether
3124 AssemblyCultureAttribute is not used on executable.
3127 * typemanager.cs: Add System.Reflection.AssemblyCultureAttribute.
3129 2005-07-16 Raja R Harinath <rharinath@novell.com>
3132 * expression.cs (Binary.Warning_UnintendeReferenceComparison):
3133 New. Reports CS0252/CS0253.
3134 Mostly taken from preliminary patch by Duncak Mak.
3135 (Binary.DoResolveOperator): Store results of operator lookup.
3136 Use them to detect if we need to warn about unintended reference
3139 2005-07-15 Raja R Harinath <rharinath@novell.com>
3142 * namespace.cs (Namespace.Lookup): Add back location parameter.
3143 (Namespace.LookupType): Add CS0436 report. Add location parameter.
3144 * delegate.cs, ecore.cs, expression.cs: Update to changes.
3146 * codegen.cs (EmitContext.DeclSpace): Make readonly.
3147 * namespace.cs (Namespace.Lookup): Carve out type lookup into ...
3148 (Namespace.LookupType): ... this.
3149 (NamespaceEntry.GetUsingTable): Allocate only one zero-sized array
3151 * typemanager.cs (LookupTypeReflection): Remove buggy code that
3152 purported to handle pointers.
3153 (char_ptr_type, void_ptr_type): Use GetPointerType rather than
3156 2005-07-15 Marek Safar <marek.safar@seznam.cz>
3158 * expression.cs (MemberAccess.ResolveNamespaceOrType): Don't report nested
3161 2005-07-15 Raja R Harinath <rharinath@novell.com>
3163 * namespace.cs (Namespace.Lookup): Drop location parameter.
3164 (NamespaceEntry.LookupAlias): Remove. Merge into ...
3165 (NamespaceEntry.Lookup): ... this.
3166 (NamespaceEntry.Error_AmbiguousTypeReference):
3167 Move here from DeclSpace.
3168 (NamespaceEntry.LookupNamespaceOrType): Move support for dotted
3170 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): ... here.
3171 * decl.cs (DeclSpace.ErrorAmbiguousTypeReference):
3172 Move to NamespaceEntry.
3173 * delegate.cs, expression.cs: Update to changes.
3175 2005-07-14 Marek Safar <marek.safar@seznam.cz>
3177 * attribute.cs (Attribute.ResolveAttributeType): Renamed from
3178 CheckAttributeType and refactored.
3179 (Attribute.ResolvePossibleAttributeType): Changed to reuse
3180 ResolveAsTypeTerminal error handling.
3181 (ResolveAsTypeTerminal): Introduced because of global attributes extra
3183 (GetSignatureForError): Print errors in same way.
3186 * codegen.cs: Reflect attribute GetSignatureForError change.
3189 * expression.cs: Add silent parameter to ResolveAsTypeStep.
3191 * namespace.cs (UsingEntry): Refactored to make fields private.
3194 statement.cs: Error_UnexpectedKind has extra parameter.
3196 2005-07-14 Raja R Harinath <rharinath@novell.com>
3198 * ecore.cs (IAlias): Remove.
3199 * decl.cs (DeclSpace): Don't derive from IAlias. Remove members
3200 that implement the interface.
3201 * namespace.cs (Namespace): Likewise.
3202 (Namespace.declspaces): Renamed from 'defined_names'.
3203 (Namespace.AddDeclSpace): Renamed from 'DefineName'. Take a
3204 DeclSpace instead of an IAlias.
3205 * tree.cs (Tree.AddDecl): Update.
3207 2005-07-12 Raja R Harinath <rharinath@novell.com>
3209 * statement.cs (Block.Flags); Remove HasVarargs.
3210 (Block.HasVarargs): Move to ToplevelBlock.
3211 (Block.ThisVariable, Block.AddThisVariable): Likewise.
3212 (Block.Variables): Make protected. Initialize variable hashtable
3214 (Block.AddVariable): Update.
3215 (Block.Resolve): Update to changes.
3216 (ToplevelBlock.HasVarargs): New boolean.
3217 (ToplevelBlock.ThisVariable): Move here from Block.
3218 (ToplevelBlock.AddThisVariable): Likewise.
3219 (ToplevelBlock.IsThisAssigned): New. Forwards call to this_variable.
3220 * expression.cs (This.ResolveBase): Update to changes.
3221 (ArglistAccess.DoResolve): Likewise.
3223 2005-07-11 Marek Safar <marek.safar@seznam.cz>
3226 * ecore.cs, class.cs: Use SetAssigned instead of direct access.
3228 * class.cs (TypeContainer.VerifyMembers): Distinguish between
3229 not used and not used & assigned.
3230 (FieldBase.ASSIGNED): Moved to MemberCore.Flags.
3232 2005-07-11 Marek Safar <marek.safar@seznam.cz>
3235 * expression.cs (Is.DoResolve): null is never provided type.
3237 2005-07-08 Marek Safar <marek.safar@seznam.cz>
3240 * cs-parser.jay: Less strict event error rule to catch more errors.
3242 2005-07-08 Martin Baulig <martin@ximian.com>
3244 Fix test-iter-10.cs - distinguish whether we `yield' in a property
3245 gettter (allowed) or setter (not allowed).
3247 * class.cs (Accessor): Implement IIteratorContainer.
3248 (Accessor.Yields): New public field.
3249 (PropertyBase.PropertyMethod.Define): Handle iterators on a
3253 (get_accessor_declaration, set_accessor_declaration): Set the
3254 `yields' flag on the accessor, not the property.
3255 (property_declaration): Do the iterators check on a per-accessor
3256 basis and not for the whole property.
3258 2005-07-08 Martin Baulig <martin@ximian.com>
3260 * anonymous.cs (CaptureContext.EmitParameterInstance): Correctly
3261 handle parameters in nested scopes; fixes #74808; see gtest-188.cs.
3263 2005-07-07 Marek Safar <marek.safar@seznam.cz>
3266 * attribute.cs (orig_sec_assembly): Holds original version of assembly.
3267 (ExtractSecurityPermissionSet): Cope with self referencing security
3268 attributes properly.
3270 * driver.cs (SetOutputFile): Made public property OutputFile.
3272 2005-07-07 Raja R Harinath <rharinath@novell.com>
3275 * class.cs (TypeContainer.first_nonstatic_field): Rename from
3276 has_nonstatic_fields. Make into a FieldBase pointer.
3277 (TypeContainer.AddField): Add CS0282 check.
3278 (TypeContainer.EmitType): Update.
3280 2005-07-06 Miguel de Icaza <miguel@novell.com>
3282 * cs-tokenizer.cs (consume_identifier): Do not create strings to
3283 compare if they start with __.
3285 2005-07-06 Raja R Harinath <rharinath@novell.com>
3287 * statement.cs (Switch.SwitchGoverningType): Only look at
3288 UserCasts that don't need implicit standard conversions to one of
3289 the allowed switch types (Fixes test-322.cs).
3290 (LocalInfo.Resolve): Re-enable sanity-test.
3292 2005-07-06 Marek Safar <marek.safar@seznam.cz>
3294 * cs-tokenizer.cs (consume_identifier): Detect double undescores
3296 * ecore.cs (FieldExpr.AddressOf): Changed volatile error to warning.
3298 * expression.cs (Invocation.DoResolve): Report error CS0245 here.
3300 2005-07-06 Raja R Harinath <rharinath@novell.com>
3303 * ecore.cs (SimpleName.GetSignatureForError): Add.
3304 * expression.cs (MemberAccess.DoResolve): Don't clobber 'expr' field.
3305 (MemberAccess.GetSignatureForError): Add.
3307 2005-07-05 Marek Safar <marek.safar@seznam.cz>
3309 The big error and warning messages review.
3339 * typemanager.cs: Updated.
3341 * class.cs: (MethodCore.SetYields): Moved here to share.
3342 (PropertyMethod.Define): Moved iterator setup here.
3344 * iterators.cs: Add orig_method to have full access to parent
3347 2005-07-05 Raja R Harinath <rharinath@novell.com>
3349 Make 'fixed variable' handling standards compliant. Fix #70807, #72729.
3350 * ecore.cs (IVariable.VerifyFixed): Remove 'is_expression' parameter.
3351 (FieldExpr.VerifyFixed): Ensure that the field is part of a fixed
3352 variable of struct type.
3353 * expression.cs (Unary.ResolveOperator): Update to change.
3354 (Indirection.VerifyFixed): Likewise.
3355 (LocalVariableReference.VerifyFixed): A local variable is always fixed.
3356 (ParameterReference.VerifyFixed): Value parameters are fixed.
3357 (This.VerifyFixed): Treat 'this' as a value parameter.
3358 * statement.cs (LocalInfo.IsFixed): Remove.
3360 2005-07-01 Martin Baulig <martin@ximian.com>
3362 * iterators.cs (Iterator.CapturedThisReference.Emit): Use
3363 `ec.EmitThis ()' to get the correct scope.
3365 2005-07-01 Martin Baulig <martin@ximian.com>
3367 * ecore.cs (FieldExpr.DoResolve): Don't capture the field if it's
3368 instance is a ParameterReference; fixes #75299.
3370 2005-07-01 Martin Baulig <martin@ximian.com>
3372 Reverted Marek's latest patch (r46725):
3373 - it contains structural changes which are neither mentioned in
3374 the ChangeLog nor explained anywhere; for example the additional
3375 argument of EmitContext's and Iterator's .ctor's and the
3376 TypeContainer.DefineMembers() change.
3377 - structural changes like this should go in in seperate patches
3378 and not be hidden in a huge patch which just seems to affect
3379 warnings and errors.
3380 a big and hard to understand patch.
3381 - it breaks iterators and causes regressions, for instance in
3384 2005-06-30 Raja R Harinath <rharinath@novell.com>
3387 * expression.cs (Indexers.map): Remove.
3388 (Indexers.Append): Filter out inaccessible setters and getters.
3389 (IndexerAccess.DoResolve, IndexerAccess.DoResolveLValue): Update.
3392 * ecore.cs (MemberExpr.EmitInstance): New. Add CS0120 check.
3394 (FieldExpr.EmitInstance, PropertyExpr.EmitInstance): ... these.
3395 (FieldExpr.Emit, PropertyExpr.Emit): Update.
3396 (FieldExpr.EmitAssign, PropertyExpr.EmitAssign): Update.
3397 * expression.cs (Invocation.EmitCall): Add CS0120 check.
3399 2005-06-30 Marek Safar <marek.safar@seznam.cz>
3402 * class.cs (FieldBase.GetInitializerExpression): One more field
3405 2005-06-28 Miguel de Icaza <miguel@novell.com>
3407 * pending.cs: Do not define a proxy if the base method is virtual,
3408 it will be picked up by the runtime (bug 75270).
3410 2005-06-08 Martin Baulig <martin@ximian.com>
3412 The big Iterators rewrite :-)
3414 * iterators.cs: Rewrite this to use the anonymous methods framework.
3416 * rootcontext.cs (RootContext.DefineTypes): Define Delegates
3417 before the TypeContainers; see 2test-21.cs.
3420 (TypeContainer.DefineType): Don't create a new EmitContext if we
3421 already have one (this only happens if we're an Iterator).
3422 (TypeContainer.Define): Also call Define() on all our iterators.
3423 (Method.CreateEmitContext): Added support for iterators.
3426 (AnonymousContainer): New abstract base class for `AnonymousMethod'.
3427 (AnonymousContainer.CreateMethodHost): Moved here from
3428 AnonymousMethod and made abstract.
3429 (AnonymousContainer.CreateScopeType): New abstract method.
3430 (AnonymousContainer.IsIterator): New public property.
3431 (ScopeInfo.EmitScopeType): Call CreateScopeType() on our Host to
3432 get the ScopeTypeBuilder rather than manually defining it here.
3433 (ScopeInfo.EmitScopeInstance): New public method; correctly handle
3436 * driver.cs (Driver.MainDriver): Call TypeManager.InitCodeHelpers()
3437 before RootContext.DefineTypes().
3439 * codegen.cs (EmitContext.RemapToProxy): Removed.
3440 (EmitContext.CurrentAnonymousMethod): Changed type from
3441 AnonymousMethod -> AnonymousContainer.
3442 (EmitContext.ResolveTopBlock): Protect from being called twice.
3443 (EmitContext.MapVariable, RemapParameter(LValue)): Removed.
3444 (EmitContext.EmitThis): Removed the iterators hacks; use the
3445 anonymous methods framework for that.
3448 (ToplevelBlock.Container): Make this a property, not a field.
3449 (ToplevelBlock.ReParent): New public method; move the
3450 ToplevelBlock into a new container.
3451 (Foreach.TemporaryVariable): Simplify.
3453 2005-06-05 Martin Baulig <martin@ximian.com>
3455 * statement.cs (LocalInfo.CompilerGenerated): New flag.
3456 (Block.AddTemporaryVariable): New public method; creates a new
3457 `LocalInfo' for a temporary variable.
3458 (Block.EmitMeta): Create the LocalBuilders for all the temporary
3460 (Foreach.TemporaryVariable): Use Block.AddTemporaryVariable() for
3461 non-iterator variables.
3463 2005-06-05 Martin Baulig <martin@ximian.com>
3465 * statement.cs (Foreach.TemporaryVariable): Create the
3466 LocalBuilder in the Emit phase and not in Resolve since in some
3467 situations, we don't have an ILGenerator during Resolve; see
3468 2test-19.cs for an example.
3470 2005-06-04 Martin Baulig <martin@ximian.com>
3472 **** Merged r45395 from GCS ****
3474 The big Foreach rewrite - Part II.
3476 * typemanager.cs (TypeManager.object_getcurrent_void): Replaced
3477 with `PropertyInfo ienumerator_getcurrent'.
3479 * codegen.cs (VariableStorage): Removed.
3482 (Foreach): Derive from Statement, not ExceptionStatement.
3483 (Foreach.CollectionForeach): New nested class. Moved all the code
3484 dealing with collection foreach here.
3485 (Foreach.ForeachHelperMethods): Removed.
3486 (Foreach.TemporaryVariable): Implement IMemoryLocation.
3488 2005-05-23 Martin Baulig <martin@ximian.com>
3490 * statement.cs (Try.DoResolve): Don't create a `finally' if we
3491 don't need to. Fix #75014.
3493 2005-05-20 Martin Baulig <martin@ximian.com>
3495 Merged r44808 from GMCS.
3497 * class.cs (TypeContainer.CircularDepException): Removed.
3498 (TypeContainer.DefineType): Removed the `InTransit' stuff.
3499 (TypeContainer.CheckRecursiveDefinition): Check for circular class
3500 (CS0146) and interface (CS0529) dependencies here.
3502 2005-06-21 Raja R Harinath <rharinath@novell.com>
3504 * expression.cs (Invocation.EmitCall): Fix initialization
3505 'this_call' to reflect current behaviour. Fix indentation.
3507 * convert.cs (FindMostEncompassedType): Add two trivial special
3508 cases (number_of_types == 0 || number_of_types == 1).
3509 (FindMostEncompasingType): Likewise.
3511 2005-06-17 Raja R Harinath <rharinath@novell.com>
3513 Some cleanups preparing for the fix of #75283.
3514 * ecore.cs (PropertyExpr.InstanceResolve): Tighten conditions for
3516 (EventExpr.InstanceResolve): Likewise.
3517 (EventExpr.DoResolve): Remove redundant checks.
3519 2005-06-10 Duncan Mak <duncan@novell.com>
3521 * cs-tokenizer.cs (process_directives): New flag for controlling
3522 the processing of preprocessor directives.
3523 (x_token): After seeing a '#', return Token.NONE instead of going
3524 to handle_preprocessing_directive() when not processing
3525 directives. This avoids unnecessary processing during the token peek in
3530 * cs-tokenizer.cs (handle_preprocessing_directive, xtoken): Use
3531 the existing error reporting methods instead of Report.Error.
3533 * convert.cs (priv_fmt_expr): Remove. It's not needed anymore
3534 after Raja's rewrite.
3536 2005-06-08 Miguel de Icaza <miguel@novell.com>
3538 * class.cs: Small fix.
3540 2005-06-08 Raja R Harinath <rharinath@novell.com>
3543 * class.cs (GetPartialBases): Fix return value check of
3546 2005-06-07 Raja R Harinath <rharinath@novell.com>
3548 Ensure that partial classes are registered in their enclosing
3549 namespace. Initial part of fix of #75160.
3550 * tree.cs (Tree.RecordDecl): Add new namespace argument.
3551 Register declspace with namespace here, not in
3552 DeclSpace.RecordDecl.
3553 * cs-parser.jay: Pass namespace to RecordDecl.
3554 * class.cs (PartialContainer.Create): Likewise.
3555 (ClassPart.DefineType): New sanity-check. Throws an exception if
3557 * decl.cs (Declspace.RecordDecl): Remove.
3558 * namespace.cs (NamespaceEntry.DefineName): Remove.
3560 2005-06-06 Marek Safar <marek.safar@seznam.cz>
3562 * rootcontext.cs: Reset TargetExt as well.
3564 2005-06-03 Raja R Harinath <rharinath@novell.com>
3566 * ecore.cs (Expression.Resolve): Emit CS0654 error when
3569 2005-06-02 Raja R Harinath <rharinath@novell.com>
3571 Fix #75080, cs0119.cs.
3572 * ecore.cs (Expression.ExprClassToResolveFlags): New. Broken out
3574 (Expression.Resolve): ... this. Use it. Remove bogus code
3575 allowing ExprClass.Type and ExprClass.Namespace for
3576 ResolveFlags.VariableOrValue.
3577 (Expression.Resolve) [1-argument variant]: Change default resolve
3578 flags based on language version.
3579 (Expression.Error_UnexpectedKind): Use a simple string array
3580 rather than an ArrayList.
3581 * expression.cs (TypeOf.DoResolve): Set eclass to ExprClass.Value,
3583 (TypeOfVoid.DoResolve): Likewise.
3584 (MemberAccess.DoResolve) [3-argument variant]: Make private. Drop
3585 flags argument -- it always has the same value.
3587 2005-05-31 Raja R Harinath <rharinath@novell.com>
3590 * ecore.cs (Expression.ResolveLValue): Add a Location parameter.
3591 Use it in the error message.
3592 * assign.cs, expression.cs, statement.cs: Update.
3594 2005-05-30 Raja R Harinath <rharinath@novell.com>
3597 * ecore.cs (Expression.MemberLookupFailed): Add CS0122 check in
3598 the "almostMatchedMember" case too.
3599 * typemanager.cs (Closure.CheckValidFamilyAccess): Add anything
3600 that failed the accessibility checks to 'almost_match'.
3602 2005-05-27 Vladimir Vukicevic <vladimir@pobox.com>
3604 * attribute.cs: Use internal MethodBuilder methods to set
3605 ExactSpelling and SetLastError on PInvoke methods, instead
3606 of passing them via charset. Fixes #75060.
3608 2005-05-27 Raja R Harinath <rharinath@novell.com>
3610 * parameter.cs (Parameter): Remove TODO comment.
3611 (Parameter.DefineParameter): Remove Location parameter.
3612 (Parameters.LabelParameters): Likewise.
3613 * class.cs (Constructor.Emit): Update to change.
3614 (MethodData.Emit): Likewise.
3615 * anonymous.cs (AnonymousMethod.EmitMethod): Likewise.
3616 * delegate.cs (Delegate.Define, Delegate.Emit): Likewise.
3618 2005-05-27 Atsushi Enomoto <atsushi@ximian.com>
3621 Removed Parameters.Location and added Parameter.Location instead.
3622 Removed Location parameter from Emit() and GetSignature().
3629 Modified all related calls.
3631 2005-05-26 Raja R Harinath <rharinath@novell.com>
3633 Improve user-defined conversion handling.
3634 * convert.cs (GetConversionOperators): Rewrite. Return only the
3635 applicable operators.
3636 (AddConversionOperators): New. Helper for GetConversionOperators.
3637 (FindMostEncompassedType, FindMostEncompassingType): Verify that
3638 there is only one most encompassed/encompassing type.
3639 (FindMostSpecificSource, FindMostSpecificTarget): Remove
3640 "applicable operator" handling.
3641 (UserConversion): Move cache here from GetConversionOperators.
3642 Directly cache the chosen operator, rather than the whole
3644 (ExplicitNumericConversion): Fix buggy implementation of Decimal
3645 case. Allow conversion of decimal to sbyte and byte too.
3646 * expression.cs (EmptyExpression.Grab, EmptyExpression.Release):
3647 New static methods. Used to avoid allocating EmptyExpressions in
3650 2005-05-24 Duncan Mak <duncan@novell.com>
3652 * ecore.cs (CastFromDecimal): New class for casting a decimal to
3653 another class, used in Convert.ExplicitNumericConversion.
3654 (CastToDecimal): New class, similar to above, but casts to
3655 System.Decimal, used in Convert.ImplicitNumericConversion and also
3656 in explicit convesion from double/float to decimal.
3658 * convert.cs (ImplicitNumericConversion): Handle implicit
3659 conversions to System.Decimal.
3660 (ExplicitNumericConversion): handle explicit conversions to
3665 2005-05-20 Miguel de Icaza <miguel@novell.com>
3667 * typemanager.cs (EnumToUnderlying): Do not throw if we do not
3668 know the type at this stage, just break through. Fixes #75008
3670 2005-05-19 Martin Baulig <martin@ximian.com>
3673 (ImplicitDelegateCreation.Check): Added `bool check_only' argument
3674 to disable error reporting.
3676 * convert.cs (Convert.ImplicitStandardConversionExists): Use it
3677 here since we don't want to report an error; see the new test-336.cs.
3679 2005-05-19 Raja R Harinath <rharinath@novell.com>
3681 * statement.cs (ToplevelBlock.GetParameterReference)
3682 (ToplevelBlock.IsParameterReference,ToplevelBlock.IsLocalParameter):
3683 Move here from class Block.
3684 * ecore.cs (SimpleName.SimpleNameResolve): Update to changes.
3685 * expression.cs (ParameterReference.DoResolveBase): Likewise.
3687 2005-05-18 Martin Baulig <martin@ximian.com>
3692 (FlowBranching.Reachability): Add non-static public And() and Or()
3694 (FlowBranchingSwitch): New class; do the `break_origins' thing
3695 like in FlowBranchingLoop.
3696 (FlowBranching.UsageVector.MergeBreakOrigins): Also merge the
3697 reachability, not just locals and parameters.
3698 (FlowBranching.MergeChild): Remove some of the hacks for loop and
3699 switch; MergeBreakOrigins() now takes care of that.
3701 2005-05-18 Martin Baulig <martin@ximian.com>
3703 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
3704 a loop and may leave it, reset the barrier; fixes #74974.
3706 2005-05-17 Marek Safar <marek.safar@seznam.cz>
3708 * attribute.cs (Attribute.ResolveArguments): GuidAttribute check
3711 * cs-parser.jay: Catch more lexical errors.
3713 * report.cs: Add one more Error method.
3716 * typemanager.cs: Register System.Runtime.InteropServices.GuidAttribute
3718 2005-05-17 Martin Baulig <martin@ximian.com>
3720 * expression.cs (Argument.Resolve): Turn on flow analysis; fix
3723 2005-05-16 Raja R Harinath <rharinath@novell.com>
3725 Fix test-382.cs. Emit values of decimal constants.
3726 * class.cs (TypeContainer.RegisterFieldForInitialization): New.
3728 (TypeContainer.AddField): ... this.
3729 (TypeContainer.EmitFieldInitializers): Allow the list of fields
3730 with initializers to include 'Const's.
3731 (ClassPart.RegisterFieldForInitialization): Forward to
3733 * const.cs (Const.Const): Pass initializer to base class.
3734 (Const.Define): In case of decimal constants, register them for
3735 initialization in a static constructor.
3737 2005-05-14 Martin Baulig <martin@ximian.com>
3739 * statement.cs (Block.Resolve): Correctly handle unreachable code;
3740 do not call ResolveUnreachable() on unreachable statements in
3741 here, see the comment in the source code.
3743 2005-05-13 Raja R Harinath <rharinath@novell.com>
3746 * expression.cs (BinaryResolveOperator): If one of the operands of
3747 an equality comparison is 'null' and the other is a pointer type,
3748 convert the null to a NullPointer.
3749 * convert.cs (ImplicitReferenceConversion): If the expression is a
3750 NullLiteral and the target type is a pointer type, return a
3751 NullPointer instead.
3752 (ImplicitConversionStandard): Likewise.
3754 2005-05-13 Marek Safar <marek.safar@seznam.cz>
3756 * cs-parser.jay: Set readonly context based on special constructs.
3758 * expression.cs (LocalVariableReference.DoResolveBase): Improved
3759 readonly variable error handling.
3761 * rootcontext.cs (EmitCode): Don't verify members when error
3764 * statement.cs (LocalInfo): Add reaodnly context information.
3765 (SetReadOnlyContext, GetReadOnlyContext): New methods.
3767 2005-05-13 Raja R Harinath <rharinath@novell.com>
3769 * statement.cs (Block.Resolve): Revert change below. Modify fix
3770 for #74041 to initialize 'resolved' to false only for explicit
3771 blocks. Fixes #74873.
3773 2005-05-12 Raja R Harinath <harinath@gmail.com>
3776 * typemanager.cs (unmanaged_enclosing_types): New.
3777 (IsUnmanagedType): Avoid infloops by using
3778 'unmanaged_enclosing_types' to talk with recursive invocations.
3780 2005-05-13 Martin Baulig <martin@ximian.com>
3782 * statement.cs (Block.Resolve): Make the `bool unresolved' flag an
3783 instance variable, not a local. Fix #74873.
3784 (Block.ResolveUnreachable): Set it to true here.
3786 2005-05-11 Duncan Mak <duncan@novell.com>
3788 * cs-tokenizer.cs (get_cmd_arg): Check that 'c' is not -1 before
3789 continuing to process for 'arg'.
3790 (handle_preprocessing_directive): Check the argument of the #endif
3791 directive and report error CS1025 if there are any trailing
3794 According to the C# spec, having even whitespace after the #endif
3795 directive is illegal; however, because we call arg.TrimEnd ()
3796 beforehand, we have the same behavior as csc, allowing whitespace
3797 after the directive.
3801 2005-05-11 Marek Safar <marek.safar@seznam.cz>
3805 * class.cs (ConstructorInitializer.GetOverloadedConstructor): Removed.
3806 (Constructor.GetObsoleteAttribute): Implemented correctly.
3808 2005-05-10 Martin Baulig <martin@ximian.com>
3810 * support.cs (ReflectionParameters.ParameterModifier): Use
3811 `Parameter.Modifier.REF' if we both have `ParameterAttributes.Out'
3812 and `ParameterAttributes.In'. Fixes #74884.
3814 2005-05-10 Marek Safar <marek.safar@seznam.cz>
3816 * class.cs (Method.Define): Catch attempt for Finalizer declaration.
3818 * expression.cs (Argument.GetParameterModifier): Turned to property.
3819 (Invocation.Error_InvalidArguments): Add more descriptive errors.
3821 * parameter.cs (Parameter.GetModifierSignature): Translates modifier to
3824 2005-05-09 Raja R Harinath <rharinath@novell.com>
3827 * decl.cs (MemberCache.AddMethods): Register override methods,
3828 rather than non-override methods.
3829 * typemanager.cs (RegisterOverride): New.
3830 (IsOverride): Update.
3832 2005-05-09 Marek Safar <marek.safar@seznam.cz>
3836 * ecore.cs (SimpleName.SimpleNameResolve): Add in_transit to catch
3837 recursive declaration.
3839 * statement.cs (Block.ResolveMeta): Report any error in resolving.
3841 2005-05-06 Marek Safar <marek.safar@seznam.cz>
3843 * cfold (DoConstantNumericPromotions): Don't try to convert 0 enum.
3845 * expression.cs (Binary.DoResolve): (x && 0) is always 0.
3847 2005-05-05 Raja R Harinath <rharinath@novell.com>
3850 * decl.cs (DeclSpace.FamilyAccessible):
3851 Use TypeManager.IsNestedFamilyAccessible.
3853 Fix reopened #64812.
3854 * typemanager.cs (Closure.Filter): Introduce checks for 'protected
3857 2005-05-04 Raja R Harinath <rharinath@novell.com>
3858 Abin Thomas <projectmonokochi@rediffmail.com>
3859 Anoob V E <projectmonokochi@rediffmail.com>
3860 Harilal P R <projectmonokochi@rediffmail.com>
3863 * typemanager.cs (Closure.CheckValidFamilyAccess): Don't blindly
3864 allow access to all static members.
3866 2005-05-04 Martin Baulig <martin@ximian.com>
3868 * ecore.cs (FieldExpr.DoResolveLValue): Always call fb.SetAssigned().
3870 2005-05-04 Martin Baulig <martin@ximian.com>
3874 * statement.cs (Switch.SimpleSwitchEmit): Always emit the default
3875 section at the end; make things work if `default' is not the last
3878 2005-05-04 Martin Baulig <martin@ximian.com>
3882 * statement.cs (Switch): Replaced the `got_default' field with a
3883 `default_section' one.
3884 (Switch.CheckSwitch): Set `default_section' here.
3885 (Switch.Resolve): If we're a constant switch and the constant is
3886 not found, use the default section.
3888 2005-05-03 Martin Baulig <martin@ximian.com>
3890 * expression.cs (ArrayAccess.EmitGetLength): New public method.
3892 * statement.cs (Foreach.ArrayForeach): New nested class.
3893 (Foreach.TemporaryVariable): New nested class.
3894 (Foreach.EmitArrayForeach): Removed; this is now in the new
3897 2005-05-03 Raja R Harinath <rharinath@novell.com>
3899 * pending.cs (BaseImplements): Move the #74773 fix here. This is
3901 (VerifyPendingMethods): Revert change below.
3903 * typemanager.cs (IsOverride, RegisterNonOverride): New.
3904 * decl.cs (MemberCache.AddMethod): Register "non-override" methods
3905 that used to trigger warning -28. Remove warning -28.
3906 * expression.cs (Invocation.OverloadResolve): Use
3907 TypeManager.IsOverride to distinguish override methods.
3910 * pending.cs (VerifyPendingMethods): If a base type implements the
3911 requested interface, don't bother checking individual methods of
3912 the base type. As a side-effect, this prevents the creation of
3913 unnecessary proxies.
3915 2005-05-02 Martin Baulig <martin@ximian.com>
3919 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
3920 Also `And' the locals if the old vector is null.
3921 (FlowBranching.UsageVector.BitVector.And): Allow `vector' being
3922 null; in this case we basically reset all the variables.
3924 2005-05-02 Martin Baulig <martin@ximian.com>
3928 * flowanalysis.cs (FlowBranching.UsageVector.MergeBreakOrigins):
3929 Added `FlowBranching branching' argument; always `and' the
3930 variables instead of `or'ing them unless we're an infinite loop.
3932 * statement.cs (While.Resolve): Create a new sibling unless we're
3935 2005-05-02 Martin Baulig <martin@ximian.com>
3939 * class.cs (ConstructorInitializer.Resolve): Added `Block block'
3940 arguments; use it instead of creating a new TopLevelBlock.
3941 (Constructor.Emit): Call `block.ResolveMeta ()' before resolving
3942 our ConstructorInitializer.
3945 (TopLevelBlock.TopLevelBranching): New public property.
3946 (TopLevelBlock.ResolveMeta): New public method; call ResolveMeta()
3947 and create our `TopLevelBranching'.
3949 * codegen.cs (EmitContext.ResolveTopBlock): If we're not an
3950 anonymous method host, use `block.TopLevelBranching' rather than
3951 creating a new branching.
3953 2005-04-20 Miguel de Icaza <miguel@novell.com>
3955 * anonymous.cs (ScopeInfo.AddChild): when adding a new child to
3956 a ScopeInfo, if any of the current children is a child of the new
3957 entry, move those children there.
3959 2005-04-30 Martin Baulig <martin@ximian.com>
3961 * statement.cs (Switch.SimpleSwitchEmit): Reset `default_at_end'
3962 at the beginning of a SwitchSection. Fix #73335.
3964 2005-04-27 Marek Safar <marek.safar@seznam.cz>
3967 * class.cs (EmitFieldInitializers): Use FieldExpr in initializer.
3969 * ecore.cs (FieldExpr): Add a new ctor with in_initializer.
3970 (FieldExpr.DoResolve): Obsolete members are ignored for field
3973 2005-04-26 Marek Safar <marek.safar@seznam.cz>
3975 * attribute.cs (AreOverloadedMethodParamsClsCompliant): Add array
3976 of arrays detection.
3978 * class.cs (Interface.VerifyClsCompliance): Add base interfaces
3980 (Field.VerifyClsCompliance): Volatile fields are not compliant.
3982 * decl.cs (MemberCache.VerifyClsParameterConflict): Add array of
3985 2005-04-25 Ben Maurer <bmaurer@ximian.com>
3987 * cs-parser.jay: Use the prefered version of -unsafe in error
3990 2005-04-22 Marek Safar <marek.safar@seznam.cz>
3992 * driver.cs (CompilerCallableEntryPoint.Invoke): Reset under any
3995 2005-04-20 John Luke <john.luke@gmail.com>
3997 * driver.cs: fix typo in error message, --outout to --output
3999 2005-04-20 Marek Safar <marek.safar@seznam.cz>
4001 * codegen.cs (InRefOutArgumentResolving): New field.
4003 * ecore.cs (FieldExpr.DoResolve): Check for assigning to readonly
4004 fields outside contructor.
4006 * expression.cs (Argument.Resolve): Set InRefOutArgumentResolving.
4008 2005-04-19 Miguel de Icaza <miguel@novell.com>
4010 * anonymous.cs (CaptureContext.EmitParameterInstance): The
4011 parameter code was not completed ever, so it was not as up-to-date
4012 as local variables. Must finish it.
4014 The bug fix was to compare the Toplevel of the block, not the
4015 current block. Thanks for Ben for pointing this out.
4017 2005-04-19 Raja R Harinath <rharinath@novell.com>
4019 * decl.cs (AddMethods): Use the declaring type of the problem
4020 method to determine if we want to squash a warning.
4022 2005-04-19 Marek Safar <marek.safar@seznam.cz>
4024 * attribute.cs: Removed debug output.
4026 * decl.cs (MemberCache.AddMethods): Fixed Finalize ignoring.
4028 * driver.cs (Driver.parse): Synchronize parser ErrorOutput with
4031 2005-04-18 Raja R Harinath <rharinath@novell.com>
4034 * expression.cs (Binary.EqualsNullIsReferenceEquals): New.
4035 (Binary.DoResolveOperator): Use it to avoid blindly optimizing out
4036 all null comparisons against reference types.
4038 2005-04-18 Marek Safar <marek.safar@seznam.cz>
4041 * class.cs (TypeContainer.CircularDepException) New nested
4043 (GetPartialBases, GetNormalBases, GetClassBases): Removed error.
4044 (TypeContainer.DefineType): Removed error, reset InTransit before
4046 (Class.DefineType): Throw exception when is in Transit.
4047 Catch exception and report error.
4048 (Struct.DefineType): Throw exception when is in Transit.
4049 Catch exception and report error.
4050 (Interface.DefineType): Throw exception when is in Transit.
4051 Catch exception and report error.
4053 * codegen.cs: Add InCatch,InFinally to EmitContext to easily
4054 handle nested exception handlers.
4056 * flowanalysis.cs (InTryWithCatch): New method, search for try with
4059 * iterators.cs (Yield.CheckContext): Add CS1626 report. Updated
4060 InFinally and InCatch storage.
4062 * statement.cs (Throw.Resolve): Use InCatch, InFinally from ec.
4063 (Catch.Resolve): Set and Restore ec.InCatch.
4064 (Try.Resolve): Set and Restore ec.InFinally.
4065 (Try.HasCatch): True when try has catch.
4067 2005-04-17 Atsushi Enomoto <atsushi@ximian.com>
4069 * doc.cs : In some cases FilterName returns MonoEvent and MonoField
4070 for the same event member, so exclude such cases from warning 419.
4073 2005-04-16 Miguel de Icaza <miguel@novell.com>
4075 * expression.cs (Binary.ResolveOperator): Apply patch from John
4076 Luke to fix bug 59864: operators &, | and ^ on enumerations
4077 require that the same enum type on both sides.
4079 * driver.cs: Add warnings to old flag usage, this is to assist
4080 people who produce Makefiles and hope that the Makefiles will be
4083 * class.cs (TypeContainer.EmitType): Moved the definition of the
4084 special $PRIVATE$ field from the resolve phase to the Emit phase.
4085 During resolve we do not know if we are a struct with
4086 HasExplicitLayout, we know this only after the attributes for the
4089 Set the FieldOffset to zero on the dummy field that we create for
4090 the class. Fixes 74590.
4092 2005-04-16 Raja R Harinath <rharinath@novell.com>
4095 * ecore.cs (PropertyExpr.resolved): New.
4096 (DoResolve): Use it to handle a case of double resolution here.
4097 Handle a case of identical-name-and-type-name.
4098 * expression.cs (ArrayCreation.CheckIndices): Avoid double
4099 resolution by storing the results of expression resolution back
4100 into the "probes" array.
4102 2005-04-15 Raja R Harinath <rharinath@novell.com>
4104 Fix cs0208-7.cs and cs0208-8.cs.
4105 * typemanager.cs (IsUnmanagedType): Arrays are not allowed
4106 (cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve
4107 error reporting to point out the reason a struct is not unmanaged.
4109 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
4111 * doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and
4112 just use TypeExpr.Type. This fixes bug #74595 when merged to gmcs.
4114 2005-04-13 Raja R Harinath <rharinath@novell.com>
4117 * ecore.cs (PropertyExpr.InstanceResolve): Handle a case of
4118 IdenticalNameAndTypeName here.
4119 (EventExpr.InstanceResolve): Likewise.
4121 2005-04-13 Marek Safar <marek.safar@seznam.cz>
4123 C# 2.0 DefaultCharSetAttribute implementation
4125 * attribute.cs (Attribute.ResolveAsTypeStep): New protected method
4126 which allows us to set GlobalNamespace for every resolve.
4127 (Attribute.ResolveArguments): Cut from Resolve.
4128 (Attribute.GetCharSetValue): Returns CharSet named argument.
4129 (Attribute.DefinePInvokeMethod): Gets default charset from
4131 (GlobalAttribute.ResolveAsTypeStep): Override.
4132 (GlobalAttribute.ResolveArguments): Override.
4134 * class.cs (TypeAttr): Is protected.
4136 * codegen.cs (ModuleClass.DefaultCharSet): New member.
4137 (ModuleClass.DefaultCharSetType): New memeber.
4138 (ModuleClass.ResolveAttributes): Resolves DefaultCharSetAttribute.
4140 * decl.cs (Decl.TypeAttr): New protected virtual. Returns default
4141 charset from module.
4143 * delegate.cs (TypeAttr): Override.
4144 (Delegate.DefineType): Use this TypeAttr.
4146 * driver.cs (Driver.MainDriver): Call Module.ResolveAttributes
4147 at very early stage (before types are defined) to resolve model
4148 module attributes. It will probably not work with corlib but it
4151 * enum.cs (Enum.TypeAttr): New protected virtual. Returns default
4152 charset from module.
4154 * typemanager.cs (default_charset_type): New type.
4156 2005-04-13 Raja R Harinath <rharinath@novell.com>
4158 * decl.cs (MemberCache.AddMethods): Don't warn if
4159 System.Object.Finalize has buggy MethodAttributes.
4161 * typemanager.cs (IsUnmanagedType): Restore !IsValueType check
4164 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
4166 * doc.cs : detect ambiguous reference to overloaded members.
4167 Fixed bug #71603. MS 1.1 csc does not detect it.
4169 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
4171 * doc.cs : delegates must not be referenced with parameters.
4174 2005-04-12 Miguel de Icaza <miguel@novell.com>
4176 * typemanager.cs (IsUnmanagedType): Arrays are allowed.
4178 2005-04-10 Miguel de Icaza <miguel@novell.com>
4180 * driver.cs (MainDriver): Stop processing if the CLS stage found
4183 (CompilerCallableEntryPoint.InvokeCompiler): Always
4184 reset after execution; Take a TextWriter argument for the
4187 * report.cs: Use the error stream instead of hardcoding stderr.
4189 2005-04-09 Miguel de Icaza <miguel@novell.com>
4191 * class.cs: Reduce code paths to test, too small of an
4192 optimization to make it worth the extra testing. Always perform
4195 2005-04-08 Raja R Harinath <rharinath@novell.com>
4198 * class.cs (OperatorArrayList.CheckPairedOperators): Skip
4199 operators that had errors reported on them.
4201 2005-04-08 Marek Safar <marek.safar@seznam.cz>
4203 * attribute.cs (Attribute.IsValidArgumentType): Test valid named
4205 (Attribute.Resolve): Add named argument type checking.
4207 * class.cs (FixedField.Define): Use IsPrimitiveType
4209 * expression.cs (Binary.ResolveOperator): Reflect IsCLRType renaming.
4211 * iterators.cs (Iterator.DefineIterator): Add check for arglist and
4212 unsafe parameter types.
4214 * statement.cs (Using.ResolveExpression): Add better error description.
4216 * typemanager.cs (IsCLRType): Renamed to IsPrimitiveType.
4218 2005-04-08 Raja R Harinath <rharinath@novell.com>
4221 * attribute.cs (Attribute.GetAttributeUsage): Resolve
4222 AttributeUsageAttribute in the emitcontext of the attribute class,
4223 not in the emitcontext of the attributable entity it was attached to.
4224 * cs-parser.jay: Use 'current_class', not 'current_container',
4225 when creating a GlobalAttribute.
4227 2005-04-08 Alp Toker <alp@atoker.com>
4229 * pending.cs: The fix to #58413 failed to compile methods implementing
4230 interfaces with/without params modifiers and vice versa, even though
4231 params modifiers aren't part of the signature. Make the modifier check
4232 less strict as in csc.
4234 2005-04-07 Abin Thomas <projectmonokochi@rediffmail.com>
4235 Anoob V E <projectmonokochi@rediffmail.com>
4236 Harilal P R <projectmonokochi@rediffmail.com>
4239 * pending.cs (TypeAndMethods.mods): New. Store the parameter
4240 modifiers of pending methods.
4241 (PendingImplementation.PendingImplementation): Initialize it.
4242 Add Parameter.Modifier [][] mods and initialize it with ParameterData.
4243 (PendingImplementation.InterFaceMethod): Repalce Type[] argument
4244 with ParameterData. Add check for modifiers.
4245 * class.cs (MethodData.Define): Update to changes.
4247 2005-04-07 Raja R Harinath <rharinath@novell.com>
4249 * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat.
4251 2005-04-07 Marek Safar <marek.safar@seznam.cz>
4253 * class.cs (PropertyMethod.Define): Check private accessor in abstract
4256 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't allow RequiredAttribute
4259 * typemanager.cs: Registered RequiredAttributeAttribute.
4261 2005-04-06 Marek Safar <marek.safar@seznam.cz>
4263 * class.cs (VerifyMembers): Doesn't need EmitContext argument.
4264 Warning CS0169 is back at level 3.
4265 (IMethodData.SetMemberIsUsed): New method.
4267 * decl.cs (IsUsed): New value; moved from FieldBase.Status
4268 (SetMemberIsUsed, IsUsed): New methods, encapsulate IsUsed.
4270 * delegate.cs (ResolveMethodGroupExpr): Call SetMemberIsUsed.
4272 * ecore.cs (FieldExpr.ResolveMemberAccess): Call SetMemberIsUsed for
4274 (PropertyExpr.ResolveAccessors): Call SetMemberIsUsed when delegate
4277 * expression.cs (OverloadResolve): Call SetMemberIsUsed. when method
4280 * rootcontext.cs (RootContext.EmitCode): Call VerifyMembers in extra run
4281 to avoid the problems with nested types.
4283 2005-04-05 Abin Thomas <projectmonokochi@rediffmail.com>
4284 Anoob V.E <projectmonokochi@rediffmail.com>
4285 Harilal P.R <projectmonokochi@rediffmail.com>
4286 Raja R Harinath <rharinath@novell.com>
4289 * delegate.cs (Define): Emit ParamArrayAttribute for 'params'
4291 * typemanager (GetConstructor): Make public.
4293 2005-04-05 John Luke <john.luke@gmail.com>
4294 Raja R Harinath <rharinath@novell.com>
4297 * typemanager.cs (IsUnmanagedType): Check non-public fields of a
4298 struct too. Return false quicker in a few cases.
4299 (VerifyUnManaged): Use it.
4301 2005-04-05 Raja R Harinath <rharinath@novell.com>
4304 * statement.cs (Block.Resolve): Initialize 'unreachable' to false,
4305 not 'unreachable_seen'.
4307 2005-04-04 Marek Safar <marek.safar@seznam.cz>
4309 * attribute.cs (Attribute.GetValue): Removed unused.
4311 * codegen.cs (CodeGen.TrimExt): Removed unused.
4313 * cs-parser.jay (output): Removed unused.
4315 * cs-tokenizer.cs (hex_digits): Removed unused.
4317 * enum.cs (MapToInternalType, GetEnumeratorName): Removed unused.
4319 * expression.cs (Indirection.LoadExprValue): Removed unused.
4320 (ArrayCreation.ExpressionToArrayArgument): Removed unused.
4322 * iterators.cs (Iterator.param_types): Removed unused.
4324 * statement.cs (Goto.block): Removed unused.
4325 (ToplevelBlock.did): Removed unused.
4326 (Switch.ResolveConstantSwitch): Removed unused.
4328 2005-04-01 Ben Maurer <bmaurer@ximian.com>
4330 * rootcontext.cs: Allow mcs to bootstrap with the compilation
4333 2005-04-01 Raja R Harinath <rharinath@novell.com>
4335 Fix #74232 and cs0208-3.cs.
4336 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0208 check.
4337 * typemanager.cs (IsUnmanagedType): Don't allow 'object' as an
4338 unmanaged type. Don't use FieldBuilders when 't' is a
4339 TypeBuilder. Use ModFlags and MemberType fields.
4340 * class.cs (MemberBase.member_type): Rename from MemberType.
4341 (MemberBase.MemberType): New property. Determines member_type on
4343 (MemberBase.DoDefine): Don't initialize MemberType here.
4344 (FieldMember.Define): Likewise.
4346 2005-04-01 Marek Safar <marek.safar@seznam.cz>
4349 * class.cs (Event.Emit): Call Add/Remove emit even for interfaces.
4350 Attributes are emitted there.
4352 2005-04-01 Raja R Harinath <rharinath@novell.com>
4354 * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
4355 keyword in 'partial enum' too.
4356 * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
4358 Report from Kamil Skalski <nazgul@omega.pl>.
4361 * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
4362 have partial containers too.
4364 * ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning
4365 in block' checks to Block.CheckInvariantMeaningInBlock.
4366 * statement.cs (Block.GetKnownVariableInfo): Make private.
4367 (Block.IsVariableUsedInChildBlock): Remove.
4368 (Block.IsVariableUsedInBlock): Likewise.
4369 (Block.CheckInvariantMeaningInBlock): New. Show location of
4370 conflicting declaration.
4371 (Block.AddVariable): Make error messages less long-winded and more
4372 specific. Show location of conflicting declaration.
4373 * parameter.cs (Parameters.Location): New readonly property.
4375 2005-03-31 Raja R Harinath <rharinath@novell.com>
4377 Clean up semantics of invoking ResolveMemberAccess.
4378 * ecore.cs (SimpleName.DoSimpleNameResolve): If a MemberExpression
4379 can have an instance, ensure that we pass in a non-TypeExpression
4380 to ResolveMemberAccess. Tighten up IdenticalNameAndTypeName checks.
4381 (MemberExpr.DoSimpleNameResolve): Remove type_is_inferred
4382 argument. Update to changes and simplify.
4383 (FieldExpr.Emitinstance): Remove CS0120 check.
4384 (PropertyExpr.EmitInstance): Likewise.
4385 * expression.cs (Argument.Resolve): Likewise.
4386 (Invocation.DoResolve): Update to changes in semantics of
4389 2005-03-31 Marek Safar <marek.safar@seznam.cz>
4392 * class.cs (AbstractPropertyEventMethod.EmitMethod): Enable emit method
4395 * decl.cs (MemberCache.AddMethods): Fix infinite loop.
4397 2005-03-31 Raja R Harinath <rharinath@novell.com>
4399 Fix difference in behaviour with commandline invocation.
4400 * driver.cs (Driver.Reset): New.
4401 (CompilerCallableEntryPoint): Call it.
4403 * statement.cs (If.Resolve): Avoid spurious "uninitialized
4404 variable" warnings if the boolean expression failed to resolve.
4406 2005-03-30 Sebastien Pouliot <sebastien@ximian.com>
4408 * attribute.cs: Fix the union of several permissions when some of them
4409 are unrestricted (so the result isn't an unrestricted permission set).
4412 2005-03-30 Raja R Harinath <rharinath@novell.com>
4414 * ecore.cs (MemberExpr): New class. Convert from interface
4416 (MemberExpr.ResolveMemberAccess): Refactor and move here from
4417 MemberAccess.ResolveMemberAccess. Tighten up pre-conditions and
4419 (MethodGroupExpr, FieldExpr, PropertyExpr, EventExpr): Update.
4420 (MethodGroupExpr.IsExplicitImpl): Remove.
4421 (Expression.GetFieldFromEvent): Remove.
4422 (SimpleName.MemberStaticCheck): Remove.
4423 (SimpleName.DoSimpleNameResolve): Update to changes.
4424 * expression.cs (MemberAccess.ResolveMemberAccess): Refactor.
4425 (MemberAccess.IdenticalNameAndTypeName): Remove.
4426 (MemberAccess.error176): Move to MemberExpr.
4427 (MemberAccess.DoResolve): Update to changes.
4428 (BaseAccess.DoResolve): Likewise.
4430 2005-03-30 Marek Safar <marek.safar@seznam.cz>
4432 C# 2.0 Conditional attribute class implementation
4434 * attribute.cs (AttributeTester.IsAttributeExcluded): New method.
4435 Analyzes class whether it has attribute which has ConditionalAttribute
4436 and its condition is not defined.
4438 * class.cs (Class.ApplyAttributeBuilder): Add IsAttributeExcluded check.
4439 (Class.IsExcluded): New method. Search for at least one defined
4440 condition in ConditionalAttribute of attribute class.
4442 2005-03-30 Raja R Harinath <rharinath@novell.com>
4444 * ecore.cs (PropertyExpr): Derive from Expression, not
4445 ExpressionStatement.
4446 (PropertyExpr.EmitStatement): Remove.
4448 2005-03-29 Raja R Harinath <rharinath@novell.com>
4451 * expression.cs (MemberAccess.ResolveMemberAccess): Allow the
4452 internal field "value__" of an enum be private. The examples for
4453 "value__" that I found on MSDN all used FieldAttributes.Private.
4455 * decl.cs (MemberCache.AddMethods): Use C# terminology in warning.
4456 Don't mention IL method attribute names.
4458 Fix #47991. Remove a TODO.
4459 * statement.cs (Block.Toplevel): Make into a field.
4460 (Block.Parameters): Move into ToplevelBlock.
4461 (Block.known_variables): Rename from child_variable_names.
4462 (Block.Block): Remove variants that take Parameters. Initialize
4463 'Toplevel' with the immediately surrounding toplevel block.
4464 (Block.AddKnownVariable): Rename from AddChildVariableName. Add a
4465 LocalInfo parameter.
4466 (Block.GetKnownVariableInfo): New.
4467 (Block.IsVariableNameUsedInChildBlock): Update.
4468 (Block.IsVariableNameUsedInBlock): New. Checks if a name is used in
4469 the block, even though it may not be in scope.
4470 (Block.AddVariable): Remove Parameters parameter. Use
4471 Toplevel.Parameters instead.
4472 (Block.AddConstant): Remove Parameters parameter.
4473 (Block.GetParameterReference): Update to use Toplevel.Parameters.
4474 (Block.IsParamaterReference): Likewise.
4475 (Block.IsLocalParameter): Likewise. Simplify a lot.
4476 (ToplevelBlock.Parameters): New. Moved from Block.
4477 (ToplevelBlock.ToplevelBlock): Update to changes. Always
4478 initialize Parameters to a non-null value.
4479 * cs-parser.jay: Update to changes.
4480 * ecore.cs (SimpleName.SimpleNameResolve): Emit cs0136 error for
4481 simple names that mean different things in the same block. Use
4482 Block.IsVariableNameUsedInBlock.
4484 2005-03-28 Raja R Harinath <rharinath@novell.com>
4486 * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer.
4487 (TypeHandle.TypeHandle): Use LookupMemberCache rather than
4488 GetTypeHandle. It is possible for a reflected type to derive from
4489 a TypeBuilder (e.g., int[] derives from the TypeBuilder
4490 System.Array during mscorlib compilation).
4491 * decl.cs (MemberCache.MemberCache): If the base cache doesn't
4492 contain a method_hash, don't create one either. Don't create a
4493 deep copy of the base cache's method_hash.
4494 (MemberCache.SetupCache): Rename back from DeepCopy.
4495 (MemberCache.AddMethods): Rewrite, now that method_hash isn't
4496 already initialized. If we see an override function, add its
4497 underlying base virtual function to the member_hash too.
4499 * enum.cs (Enum.LookupEnumValue): Remove debugging code.
4501 2005-03-26 Raja R Harinath <harinath@acm.org>
4504 * assign.cs (Assign.DoResolve): When the RHS of an assignment
4505 fails to resolve, ensure that the LHS is still resolved as an
4508 2005-03-25 Raja R Harinath <harinath@acm.org>
4510 * enum.cs (Enum.DefineType): Set ec.InEnumContext and
4512 (Enum.current_ec): Remove.
4513 (Enum.LookupEnumValue): Remove EmitContext argument.
4514 Just uses the one created during DefineType.
4515 (Enum.FindMembers): Update.
4516 * expression.cs (MemberAccess.DoResolve): Update.
4518 2005-03-22 Marek Safar <marek.safar@seznam.cz>
4520 * assign.cs (Assign.DoResolve): Check for CS1717 when
4521 source and target are same (uses Equals).
4523 * expression.cs (LocalVariableReference, ParameterReference,
4524 This): Implemented Equals, GetHashCode.
4526 * statement.cs (Block.GetParameterReference): Removed useless
4529 2005-03-22 Raja R Harinath <rharinath@novell.com>
4532 * statement.cs (Block.AddVariable): Ensure that we skip implicit
4533 blocks before deciding whether the error is cs0136 or cs0128.
4535 * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
4536 (using_alias_directive, using_namespace_directive): Pass
4537 MemberName, not an expression to Namespace.UsingAlias and
4539 (MakeName): Use the MemberName of the namespace.
4540 * namespace.cs (Namespace.MemberName): New.
4541 (UsingEntry.UsingEntry): Take a MemberName, not an expression.
4542 (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
4544 * decl.cs (MemberName.Name): Make readonly.
4545 (MemberName.FromDotted): New "constructor".
4546 (MemberName.Equals, MemberName.GetHashCode): Implement overrides.
4547 (MemberCore.Name): Compute from MemberName on demand.
4548 (MemberCore.SetMemberName): Provide a way to change the
4550 (MemberCore.AddToContainer): Don't take a fullname parameter.
4551 * class.cs (TypeContainer.AddToMemberContainer): Don't add the
4552 fully qualified name of the container to the member name.
4553 (TypeContainer.AddToTypeContainer): Use a fully qualified name
4554 only if the type is a member of the root container.
4555 (TypeContainer.AddMethod, TypeContainer.AddProperty): Use
4556 MemberName.Left rather than searching for an embedded ".".
4557 (PartialContainer.CreatePart): Update to changes in RootContext.
4558 (MemberBase.ShortName): Turn into a property. Use
4559 MemberCore.SetMemberName.
4560 (MemberBase.ExplicitInterfaceName): Remove.
4561 (MemberBase.UpdateMemberName): Remove.
4562 (AbstractPropertyEventMethod.UpdateName): Use SetMemberName.
4563 (PropertyBase.SetMemberName): New override.
4564 * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key.
4565 (Tree.GetDecl): New.
4566 (Tree.AllDecls): Rename from Decls.
4567 * attribute.cs, enum.cs, report.cs: Update to changes.
4568 * driver.cs (MainDriver): Use MemberName.FromDotted on
4569 RootContext.MainClass.
4571 2005-03-21 Marek Safar <marek.safar@seznam.cz>
4573 * class.cs (FixedField.Define): Check for CS1664 and more sanity
4576 * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708.
4578 2005-03-18 Marek Safar <marek.safar@seznam.cz>
4580 * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
4581 property accessor modifiers.
4583 * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
4584 fixed buffer attribute (CS1716).
4585 (PropertyMethod.HasCustomAccessModifier): When property accessor
4586 has custom modifier.
4588 * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
4590 (PropertyExpr.DoResolveLValue): Add CS0272.
4592 2005-03-17 Miguel de Icaza <miguel@novell.com>
4594 * convert.cs: When converting to a pointer, use the proper Conv.U
4595 or Conv.I depending on the source data type.
4597 * cs-tokenizer.cs: Make the size for large decimal constants,
4600 2005-03-17 Martin Baulig <martin@ximian.com>
4602 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
4603 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
4605 2005-03-17 Martin Baulig <martin@ximian.com>
4607 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
4608 to bool so we can return an error condition.
4609 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
4612 2005-03-16 Zoltan Varga <vargaz@freemail.hu>
4614 * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping
4617 2005-03-16 Raja R Harinath <rharinath@novell.com>
4619 Remove TypeManager.LookupType and TypeManager.LookupTypeDirect.
4620 Refactor to avoid traversing the list of assemblies, and to avoid
4621 string concatenation.
4622 * typemanager.cs (guid_attr_type): Remove.
4623 (negative_hits, pointers, references): Remove hashes.
4625 (GetConstructedType): New. Uses type_hash to handle constructed
4626 types (arrays, references, pointers).
4627 (GetReferenceType, GetPointerType): Use it.
4628 (GetNestedType): New. Uses type_hash to handle nested types of
4630 (LookupType, LookupTypeDirect): Remove.
4631 (CoreLookupType): Inline parts of old LookupTypeDirect code. Use
4632 'types' hash and LookupTypeReflection directly.
4633 (params_string, params_object): Use GetConstructedType.
4634 * namespace.cs (Namespace.cached_types): New. Cache of reflected
4636 (Namespace.Lookup): Use cached_types.
4637 (NamespaceEntry.LookupNamespaceOrType): Inline the functionality
4638 provided by old TypeManager.LookupType.
4639 * rootcontext.cs (MakeFQN): Remove.
4640 * decl.cs (DeclSpace.MakeFQN): Likewise.
4641 (DeclSpace.LookupType): Use TypeManager.GetNestedType.
4642 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
4643 TypeManager.GetConstructedType.
4644 * tree.cs (decl_ns_hash, LookupByNamespace): Remove.
4646 2005-03-15 Marek Safar <marek.safar@seznam.cz>
4648 * class.cs (MethodCore.CheckBase): Report CS1715 for properties and
4651 * cs-parser.jay: Reports CS1527 for any namespace element.
4653 * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
4656 * expression.cs (ParameterReference.IsAssigned): Changed error to
4658 (Error_WrongNumArguments): Moved CS0245 detection here.
4660 * statement.cs (Return.Resolve): Add CS1622 report.
4662 2005-03-11 Marek Safar <marek.safar@seznam.cz>
4664 * class.cs (StaticClass.DefineContainerMembers): Added CS0720.
4666 2005-03-11 Zoltan Varga <vargaz@freemail.hu>
4668 * attribute.cs expression.cs: Get rid of some allocations.
4670 2004-03-11 Atsushi Enomoto <atsushi@ximian.com>
4672 * doc.cs : just eliminate the latest change.
4674 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
4676 * doc.cs : commented out the latest change. It breaks xml-030.cs
4678 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
4680 * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will
4681 fail. So invoke CreateType() in FindDocumentedType().
4683 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
4685 * cs-tokenizer.cs : added IsKeyword().
4686 * doc.cs : Detect keyword incorrectly used as identifier.
4687 Allow identifiers prefixed by @.
4689 2005-03-10 Marek Safar <marek.safar@seznam.cz>
4691 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
4692 It caused exception in namespace resolving (again!).
4694 * class.cs (Class.ctor): Removed exit.
4695 (PropertyMethod.ctor): ditto.
4697 * codegen.cs (Codegen.Reset): Reset static data.
4698 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
4700 * cs-tokenizer.cs (Cleanup): Removed.
4702 * driver.cs (GetSystemDir): Rewrote to one line command.
4703 It caused problem with unloaded dynamic modules.
4704 (UnixParseOption): Removed Exit.
4705 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
4706 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
4707 Now can be mcs used as library.
4709 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
4712 * location.cs (Reset): Reset static data.
4714 * namespace.cs (Reset): Reset static data.
4716 * report.cs (Report.Reset): Reset static data.
4718 * rootcontext.cs (RootContext.Reset): Reset static data.
4720 * tree.cs (RootTypes.ctor): Use Location.Null
4722 * typemanager.cs (TypeManager.Reset): Reset static data.
4723 (CoreLookupType): Removed Exit.
4724 (TypeHandle.Reset): Reset static data.
4726 2005-03-10 Raja R Harinath <rharinath@novell.com>
4729 * typemanager.cs (ComputeNamespaces): Import namespaces from
4730 referenced modules too.
4732 2005-03-09 Raja R Harinath <rharinath@novell.com>
4734 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
4737 2005-03-09 Raja R Harinath <rharinath@novell.com>
4739 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
4740 enclosing DeclSpace. This ensures that a name-lookup populates
4741 more caches and there are fewer 'TypeExpression's. Carve out
4742 nested type lookup into ...
4743 (LookupNestedTypeInHierarchy): ... this.
4745 2005-03-09 Raja R Harinath <rharinath@novell.com>
4747 Clean up a few partial-class semantics.
4748 Fixes test-357.cs and cs1618-2.cs.
4749 * cs-parser.jay (struct_declaration): Use 'current_class' as
4750 parent of newly-created struct. Remove call to Register ().
4751 Use 'pop_current_class' to complete handing the current struct.
4752 (interface_declaration): Likewise.
4753 (class_declaration): Likewise.
4754 (enum_declaration): Use 'current_class' as parent of newly created
4756 (delegate_declaration): Likewise.
4757 (pop_current_class): New function. This is used to handle closing
4758 up the 'current_class' and 'current_container', and pointing them
4759 to the enclosing class/container.
4760 (CSharpParser): Initialize 'current_class' too.
4761 * decl.cs (MemberCore): Add check for invariant: a partial
4762 container is not a parsed entity, and thus does not enclose any
4764 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
4765 (DeclSpace.BaseTypeExpr): Use it.
4766 (DeclSpace.LookupType): Add check for invariant.
4767 * class.cs (TypeContainer): Add check for invariant: a nested
4768 class should have the same NamespaceEntry as its enclosing class.
4769 (TypeContainer.EmitFieldInitializers): Make virtual.
4770 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
4772 (TypeContainer.Register): Remove.
4773 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
4774 null. Use TypeResolveEmitContext for resolving base types and
4775 interfaces. Move initialization of Parts.TypeBuilder here from
4777 (TypeContainer.DefineNestedTypes): ... here.
4778 (PartialContainer): Take a Namespace not a NamespaceEntry.
4779 (PartialContainer.Create): Don't use Register. Call the
4780 appropriate Add... function directly.
4781 (ClassPart): Take both the PartialContainer and the enclosing
4782 class as constructor arguments.
4783 (ClassPart.EmitFieldInitializers): Override.
4784 (ClassPart.PartFindNestedTypes): Remove.
4785 (FieldBase.GetInitializerExpression): Resolve the initializer
4786 expression in the emit context of the enclosing class.
4787 * tree.cs (RootTypes): Remove Register ().
4789 2005-03-08 Marek Safar <marek.safar@seznam.cz>
4791 * cs-parser.jay: Removed CS0134.
4793 * driver.cs: Removed CS1901.
4795 * expression.cs (SizeOf.DoResolve): Don't report CS0233
4796 for predefined types.
4798 2005-03-07 Duncan Mak <duncan@novell.com>
4800 * codegen.cs (Save): Catch UnauthorizedAccessException as
4801 well. Fixes bug #73454.
4803 2005-03-07 Marek Safar <marek.safar@seznam.cz>
4805 * cs-tokenizer.cs (xtoken): Add CS1035.
4807 * class.cs (MethodData.Define): Add CS0683.
4808 (FieldMember.ctor): Add CS0681.
4810 2005-03-07 Raja R Harinath <rharinath@novell.com>
4812 * ecore.cs (SimpleName.DoResolve): Rename from
4813 SimpleName.DoResolveAllowStatic.
4814 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
4815 Pass 'intermediate' flag to MemberStaticCheck.
4816 (SimpleName.MemberStaticCheck): Skip "static check" only in case
4817 of "intermediate" lookups via MemberAccess.
4818 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
4819 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
4821 2005-03-07 Raja R Harinath <rharinath@novell.com>
4824 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
4825 slipped in because of variable names that are identical to a
4826 builtin type's BCL equivalent ('string String;', 'int Int32;').
4827 (PropertyExpr.EmitInstance): Likewise.
4829 2005-03-04 Marek Safar <marek.safar@seznam.cz>
4831 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
4833 * report.cs (warning_ignore_table): Made public.
4835 2005-03-04 Raja R Harinath <rharinath@novell.com>
4838 * class.cs (MethodData.Emit): Pass 'container' to
4839 container.GetObsoleteAttribute instead of 'container.Parent'.
4841 2005-03-03 Marek Safar <marek.safar@seznam.cz>
4843 * cs-parser.jay: Add 1534 error test.
4845 * iterators.cs (Yield.CheckContext): Add error 1629.
4846 (Iterator.ctor): Save unsafe modifier.
4847 (MoveNextMethod.DoEmit): Restore unsafe context.
4849 * namespace.cs (UsingAlias): Better error message.
4851 2005-03-03 Dan Winship <danw@novell.com>
4853 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
4854 the warning message [#73219]
4856 2005-03-03 Raja R Harinath <rharinath@novell.com>
4858 Fix compile with MCS 1.0.0.0.
4859 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
4860 w_restore to not depend on string constant folding.
4862 2005-03-03 Raja R Harinath <rharinath@novell.com>
4864 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
4865 CS0246 check to users who passed 'silent = false'.
4866 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
4868 (SimpleName.SimpleNameResolve): Update.
4869 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
4870 (MemberAccess.IdenticalNameAndTypeName): Update.
4871 * doc.cs (FindDocumentedTypeNonArray): Update.
4873 2005-03-03 Raja R Harinath <rharinath@novell.com>
4875 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
4876 * parameters.cs (ComputeAndDefineParameters): Remove.
4877 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
4878 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
4879 Use GetParameterInfo.
4881 2005-03-02 Marek Safar <marek.safar@seznam.cz>
4883 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
4885 2005-03-02 Raja R Harinath <rharinath@novell.com>
4887 Unify DeclSpace.LookupType and DeclSpace.FindType.
4888 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
4889 is in charge of defining nested types on demand.
4890 (DeclSpace.LookupType): Use it when the current_type is a
4891 TypeBuilder. Use LookupTypeDirect for reflected types.
4892 (DeclSpace.FindType): Remove.
4893 (DeclSpace.LookupInterfaceOrClass): Likewise.
4894 (DeclSpace.DefineTypeAndParents): Likewise.
4895 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
4896 DeclSpace.LookupType.
4897 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
4898 * typemanager.cs (LookupType): Simplify.
4899 (AddUserType): Remove type from negative_hits.
4900 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
4901 * class.cs (TypeContainer.FindMembers): Move handling of nested
4903 (TypeContainer.FindMembers_NestedTypes): ... here.
4904 (TypeContainer.FindNestedType): Implement override.
4905 (ClassPart.FindNestedType): Delegate to PartialContainer.
4906 (ClassPart.PartFindNestedType): Looks up the nested types of the
4909 2005-03-02 Martin Baulig <martin@ximian.com>
4911 * class.cs (TypeContainer.DoDefineMembers): We also need a default
4912 static constructor in static classes.
4914 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
4916 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
4917 sizeParamIndex is not specified.
4919 2005-03-01 Marek Safar <marek.safar@seznam.cz>
4922 * report.cs (WarningMessage.IsEnabled): Missing null check.
4924 2005-02-28 Marek Safar <marek.safar@seznam.cz>
4926 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
4927 in the fields and not in the properties.
4929 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
4931 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
4934 2005-02-28 Marek Safar <marek.safar@seznam.cz>
4936 * attribute.cs: Small refactoring (improved robustness).
4937 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
4938 (ValidateGuid): Removed.
4939 (Resolve): Removed referenced to above mentioned.
4940 (GetAttributeUsage): Made private and changed to work without
4942 (GetIndexerAttributeValue): Don't crash.
4943 (GetConditionalAttributeValue): Ditto.
4944 (GetClsCompliantAttributeValue): Ditto.
4945 (ExtractSecurityPermissionSet): All attributes exceptions are
4947 (GetPropertyValue): New helper.
4948 (GetMethodImplOptions): New method.
4949 (DefinePInvokeMethod): Reuse common code. Implemented handling of
4950 some missing properties.
4952 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
4953 (Method.ApplyAttributeBuilder): Updated.
4955 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
4958 2005-02-28 Raja R Harinath <rharinath@novell.com>
4961 * report.cs (Report.SymbolRelatedToPreviousError): Handle
4962 non-simple types (array, pointer, reference).
4964 2005-02-28 Marek Safar <marek.safar@seznam.cz>
4966 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
4968 * class.cs (MethodCore.IsDuplicateImplementation): Special error
4970 (Method.CheckBase): Catch wrong destructor here.
4971 (MethodData.Define): Add errors 550, 668.
4973 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
4975 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
4977 * pending.cs (VerifyPendingMethods): Add error 551.
4979 * typemanager.cs (CSharpName): Next error report helper.
4981 2005-02-25 Marek Safar <marek.safar@seznam.cz>
4983 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
4984 attributes. Removed useless attribute double check.
4985 It saves almost 2MBs for corlib.
4987 2005-02-25 Raja R Harinath <rharinath@novell.com>
4990 * statement.cs (ExpressionStatement.Resolve): Make robust to being
4991 called twice in case of error.
4993 2005-02-23 Chris Toshok <toshok@ximian.com>
4995 Fix compiler portions of #72827.
4996 * statement.cs (Block.Emit): call Begin/EndScope on the
4997 EmitContext instead of the ILGenerator.
4999 * codegen.cs (EmitContext.BeginScope): new method, call
5000 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
5002 (EmitContext.BeginScope): same, but EndScope and CloseScope
5004 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
5005 offset and call the superclass's OpenScope(int) with it.
5006 (SymbolWriter.CloseScope): get the current il
5007 offset and call superclass's CloseScope(int) with it.
5009 2005-02-23 Marek Safar <marek.safar@seznam.cz>
5011 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
5012 CS1677 for out and ref as well.
5014 * class.cs (Method.Define): Add error CS1599 detection.
5016 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
5018 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
5020 * delegate.cs (Delegate.Define): Add error CS1599 detection.
5022 * support.cs.cs (ModifierDesc): New helper method.
5024 2005-02-23 Raja R Harinath <rharinath@novell.com>
5025 Abin Thomas <projectmonokochi@rediffmail.com>
5026 Anoob V E <projectmonokochi@rediffmail.com>
5027 Harilal P R <projectmonokochi@rediffmail.com>
5030 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
5031 MemberLookup (used for error reporting) actually returns a result.
5032 Fix error report number (122, not 112).
5034 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
5035 Anoob V E <projectmonokochi@rediffmail.com>
5036 Harilal P R <projectmonokochi@rediffmail.com>
5039 * pending.cs (PendingImplementation.GetAbstractMethods):
5040 Find NonPublic members too.
5042 2005-02-22 Marek Safar <marek.safar@seznam.cz>
5044 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
5047 * class.cs (MethodCore.CheckMethodAgainstBase):
5048 Add error 239 report.
5050 2005-02-21 Raja R Harinath <rharinath@novell.com>
5053 * expression.cs (Invocation.IsApplicable): Make public.
5054 (Invocation.IsParamsMethodApplicable): Likewise.
5055 * delegate.cs (Delegate.VerifyApplicability): Don't use
5056 Invocation.VerifyArgumentCompat for parameter applicability
5057 testing. Use Invocation.IsApplicable and
5058 Invocation.IsParamsMethodApplicable.
5060 2005-02-21 Marek Safar <marek.safar@seznam.cz>
5062 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
5064 * class.cs (Operator.Define): Add error 217 report.
5066 2005-02-21 Raja R Harinath <rharinath@novell.com>
5068 * namespace.cs (UsingEntry.Resolve): Undo change below.
5070 2005-02-21 Raja R Harinath <rharinath@novell.com>
5073 * ecore.cs (Expression.MemberLookupFailed): Add argument to
5074 disable the error message when the extended MemberLookup also
5076 (Expression.MemberLookupFinal): Update.
5077 (SimpleName.DoSimpleNameResolve): Update.
5078 * expression.cs (MemberAccess.ResolveNamespaceOrType):
5079 Don't use MemberLookupFinal.
5080 (New.DoResolve): Update.
5081 (BaseAccess.CommonResolve): Update.
5083 2005-02-21 Raja R Harinath <rharinath@novell.com>
5086 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
5087 occured previously, don't resolve again.
5089 2005-02-21 Marek Safar <marek.safar@seznam.cz>
5092 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
5093 argument. Call ResolveAttributeUsage for unresolved.
5094 when types doesn't match ctor arguments.
5096 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
5097 for nested attribute classes.
5098 (Class.attribute_usage): Removed.
5099 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
5100 for attribute class.
5102 * ecore.cs (IsAttribute): Removed.
5104 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
5106 * rootcontext.cs (RegisterAttribute): Removed, attributes are
5108 (attribute_types): Removed.
5109 (EmitCode): Global attributes are emited as the latest.
5111 2005-02-18 Marek Safar <marek.safar@seznam.cz>
5113 * class.cs (EmitFieldInitializers): Don't emit field initializer
5114 for default values when optimilization is on.
5116 * constant.cs (Constant.IsDefaultValue): New property.
5118 * driver.cs: Add /optimize handling.
5122 * literal.cs: Implement new IsDefaultValue property.
5124 * rootcontext.cs (Optimize): New field, holds /optimize option.
5126 2005-02-18 Raja R Harinath <rharinath@novell.com>
5128 Fix crasher in re-opened #72347.
5129 * namespace.cs (Namespace.Lookup): Return null if
5130 DeclSpace.DefineType returns null.
5133 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
5135 2005-02-18 Raja R Harinath <rharinath@novell.com>
5137 Fix remainder of #63202. Change semantics of DoResolveLValue: it
5138 now returns null if it cannot resolve to an lvalue.
5139 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
5140 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
5141 returned null. Remove check for SimpleName.
5142 (EventExpr.DoResolveLValue): New.
5143 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
5144 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
5146 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
5148 (Unary.ResolveOperator): Move CS0211 check ...
5149 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
5151 (Unary.DoResolveLValue): Simplify.
5152 (AddressOf.DoResolveLValue): New.
5153 (ArrayAccess.DoResolveLValue): New.
5155 2005-02-16 Marek Safar <marek.safar@seznam.cz>
5157 * attribute.cs (Attribute.Resolve): Add arguments casting for
5158 when types doesn't match ctor arguments.
5160 2005-02-16 Raja R Harinath <rharinath@novell.com>
5162 Fix parts of #63202.
5163 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
5164 lookup of operator in base type. Ensure that all checks happen
5165 when the operator resolves to an "op_..." method.
5167 2005-02-15 Raja R Harinath <rharinath@novell.com>
5170 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
5171 'ignore_cs0104' parameter. Pass it to ...
5172 (NamespaceEntry.Lookup): ... this.
5173 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
5174 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
5175 (TypeLookupExpression.DoResolveAsTypeStep): Update.
5176 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
5177 Update. Request that cs0104 errors be ignored.
5178 (ComposedCast.ResolveAsTypeStep): Update.
5180 2005-02-14 Raja R Harinath <rharinath@novell.com>
5183 * expression.cs (Invocation.BetterFunction): Remove support for
5184 comparing virtual functions and their overrides.
5185 (Invocation.IsOverride): New.
5186 (Invocation.OverloadResolve): Don't consider 'override' functions
5187 during candidate selection. Store them in a lookaside list.
5188 If the selected method is a 'virtual' function, use the list to
5189 find any overrides that are closer to the LHS type.
5191 2005-02-14 Marek Safar <marek.safar@seznam.cz>
5193 * expression.cs (New.DoResolve): Add complex core type reduction.
5194 (New.Constantify): Converts complex core type syntax like 'new int ()'
5197 2005-02-14 Raja R Harinath <rharinath@novell.com>
5199 * decl.cs (EntryType.EntryType): New constructor to create an
5200 updated copy of a cache entry.
5201 (MemberCache.AddMethods): Use it.
5202 (MemberCache.ClearDeclaredOnly): Remove.
5203 (MemberCache.MemberCache): Update.
5205 2005-02-11 Miguel de Icaza <miguel@novell.com>
5207 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
5208 variable. This one is represents the actual low-level declaration
5209 of the method, as opposed to the semantic level `IsStatic'.
5211 An anonymous method which is hosted into a static method might be
5212 actually an instance method. IsStatic would reflect the
5213 container, while MethodIsStatic represents the actual code
5216 * expression.cs (ParameterReference): Use the new MethodIsStatic
5217 instead of IsStatic.
5219 * anonymous.cs (AnonymousMethod.Compatible): Pass the
5220 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
5221 set on the current EmitContext.
5223 * expression.cs (Cast): Overload DoResolveLValue so we can pass
5224 resolve our casted expression as an LValue. This triggers the
5225 proper LValue processing that is later required by Assign.
5229 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
5231 2005-02-11 Marek Safar <marek.safar@seznam.cz>
5233 C# 2.0 Fixed buffer implementation
5235 * anonymous.cs: Update after RegisterHelperClass renaming.
5237 * attribute.cs (AttributeTester.fixed_buffer_cache):
5238 Cache of external fixed buffers.
5239 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
5240 implementation if field is fixed buffer else null.
5243 (TypeContainer.AddField): Accept FieldMember instead of Field.
5244 (FieldBase.IsFieldClsCompliant): Extracted code from
5245 VerifyClsCompliance descendant customization.
5246 (FixedField): New class handles fixed buffer fields.
5247 (FixedFieldExternal): Keeps information about imported fixed
5249 (IFixedField): Make access to internal or external fixed buffer
5252 * cs-parser.jay: Add fixed buffer parsing.
5254 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
5257 * expression.cs (Indirection): Extended implementation to accept
5259 (PointerArithmetic.Emit): Get element from fixed buffer as well.
5260 (ElementAccess.MakePointerAccess): Get type as parameter.
5261 (DoResolve): Add fixed buffer field expression conversion.
5262 (DoResolveLValue): Ditto.
5263 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
5264 (ArrayPtr): Derives from FixedBufferPtr.
5265 (ArrayPtr.Emit): Add extra emit for array elements.
5267 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
5269 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
5270 for compiler generated types.
5271 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
5273 * statement.cs (Fixed): Refactored to be easier add fixed buffer
5274 and consume less memory.
5275 (Fixed.Resolve): Add fixed buffer case.
5277 * typemanager.cs (compiler_generated_attr_ctor,
5278 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
5279 (HasElementType): Add our own implementation to work on every
5282 2005-02-11 Miguel de Icaza <miguel@novell.com>
5284 * anonymous.cs (CaptureContext): Track whether `this' has been
5287 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
5288 only captured `this' if it was implicitly done (instance
5289 methods/variables were used).
5291 * codegen.cs (EmitContext.CaptureThis): New method to flag that
5292 `this' must be captured.
5294 2005-01-30 Miguel de Icaza <miguel@novell.com>
5296 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
5297 is null it means that there has been no need to capture anything,
5298 so we just create a sibling.
5300 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
5302 Just a partial fix. The other half is fairly elusive.
5304 2005-02-10 Raja R Harinath <rharinath@novell.com>
5306 Fix #52586, cs0121-4.cs.
5307 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
5308 and return a hashtable.
5309 (MemberCache.ClearDeclaredOnly): New.
5310 (MemberCache.MemberCache): Update to change. Make a deep copy of
5311 the method_hash of a base type too.
5312 (MemberCache.AddMethods): Adapt to having a deep copy of the base
5313 type methods. Overwrite entries with the same MethodHandle so
5314 that the ReflectedType is correct. The process leaves in base
5315 virtual functions and their overrides as distinct entries.
5316 (CacheEntry): Now a class instead of a struct. It shouldn't alter
5317 matters since it was boxed in a ArrayList before.
5318 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
5320 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
5321 case of a virtual function and its override (choose the overload
5323 (Invocation.OverloadResolve): Avoid 'override' members during
5324 'applicable_type' calculation.
5326 2005-02-09 Raja R Harinath <rharinath@novell.com>
5328 Combine two near-redundant caches.
5329 * typemanager.cs (method_params): Rename from method_internal_params.
5330 (TypeManager.GetParameterData): New. Replace
5331 Invocation.GetParameterData.
5332 (TypeManager.LookupParametersByBuilder): Remove.
5333 * expression.cs (Invocation.method_parameter_cache): Remove.
5334 (Invocation.GetParameterData): Remove.
5336 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
5339 2005-02-08 Raja R Harinath <rharinath@novell.com>
5342 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
5343 TypeManager.multicast_delegate_type is null, resolve it by looking
5344 up "System.MulticastDelegate".
5345 * rootcontext.cs (RootContext.ResolveCore): Simplify.
5347 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
5348 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
5349 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
5352 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
5353 (LabeledStatement.AddReference): New. Set 'referenced'.
5354 (Goto.Resolve): Use it.
5356 2005-02-05 John Luke <john.luke@gmail.com>
5358 * driver.cs: remove duplicate -doc line in Usage ()
5360 2005-02-04 Raja R Harinath <rharinath@novell.com>
5362 * location.cs (Location.AddFile): Fix CS2002 error report.
5364 2005-02-02 Martin Baulig <martin@ximian.com>
5366 * delegate.cs (Delegate.DefineType): Report an internal error if
5367 TypeManager.multicast_delegate_type is null. See bug #72015 for
5370 2005-02-02 Raja R Harinath <rharinath@novell.com>
5372 Fix a crasher in a variant of #31984.
5373 * const.cs (Constant.CheckBase): New override that defers the
5374 new-or-override check in case the base type hasn't been populated
5376 (Constant.Define): Ensure the new-or-override check is performed.
5378 2005-02-01 Duncan Mak <duncan@ximian.com>
5380 * const.cs (LookupConstantValue): Check that `ce' is not null
5381 before calling GetValue ().
5383 2005-02-01 Raja R Harinath <rharinath@novell.com>
5385 Fix test-334.cs (#69519).
5386 * cs-parser.jay (using_alias_directive): Pass in an expression to
5387 NamespaceEntry.UsingAlias.
5388 (using_namespace_directive): Pass in an expression to
5389 NamespaceEntry.Using.
5390 (namespace_name): Don't flatten to a string.
5391 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
5392 (NamespaceEntry.AliasEntry.Resolve): Lookup using
5394 (NamespaceEntry.UsingEntry): Likewise.
5395 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
5397 (NamespaceEntry.LookupForUsing): Remove.
5398 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
5400 (NamespaceEntry.Lookup): Remove support for dotted names.
5402 2005-02-01 Raja R Harinath <rharinath@novell.com>
5404 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
5406 (NamespaceEntry.ImplicitParent): Compute on demand.
5407 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
5408 parallels the current.
5409 (NamespaceEntry.LookupForUsing): Use it.
5410 (NamespaceEntry.Lookup): If the current namespace-entry is
5411 implicit, don't search aliases and using tables.
5413 2005-02-01 Raja R Harinath <rharinath@novell.com>
5416 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
5418 (TypeContainer.BaseCache): Compute on demand.
5419 (TypeContainer.FindMembers): Define constants and types if they're
5420 not already created.
5421 (FieldMember.Define): Move resetting of ec.InUnsafe before error
5423 * const.cs (Constant.Define): Make idempotent.
5425 2005-01-29 Miguel de Icaza <miguel@novell.com>
5427 * pending.cs: Produce better code (no nops produced by using Ldarg
5430 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
5431 i - 1' it should be arg + 1.
5435 2005-01-28 Raja R Harinath <rharinath@novell.com>
5437 * attribute.cs (Attribute.CheckAttributeType): Make private
5439 (Attribute.ResolveType): Make virtual.
5440 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
5441 handling of RootContext.Tree.Types.
5443 2005-01-27 Raja R Harinath <rharinath@novell.com>
5445 Update attribute-handling to use the SimpleName/MemberAccess
5447 * cs-parser.jay (attribute): Pass in an expression to the
5448 constructors of Attribute and GlobalAttribute.
5449 * attribute.cs (Attribute): Take an expression for the name.
5450 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
5451 passed in attribute name expression.
5452 (Attribute.CheckAttributeType): Use it.
5453 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
5454 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
5455 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
5456 argument to prevent error messages if the lookup fails.
5458 2005-01-27 Marek Safar <marek.safar@seznam.cz>
5460 * expression.cs (Indirection): Implemented IVariable interface
5461 to support indirection in AddressOf operator.
5462 (PointerArithmetic.Emit): Add optimalization for case where
5463 result can be precomputed.
5465 2005-01-26 Martin Baulig <martin@ximian.com>
5467 * class.cs (TypeContainer.AttributeTargets): Return the correct
5468 AttributeTargets depending on our `Kind' instead of throwing an
5469 exception; fixes #71632.
5471 2005-01-26 Marek Safar <marek.safar@seznam.cz>
5474 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
5477 2005-01-25 Raja R Harinath <rharinath@novell.com>
5480 * expression.cs (MemberAccess.DoResolve): Don't complain with
5481 cs0572 when the LHS of a member access has identical name and type
5484 2005-01-25 Marek Safar <marek.safar@seznam.cz>
5487 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
5489 Create custom PermissionSet only for PermissionSetAttribute.
5491 2005-01-24 Marek Safar <marek.safar@seznam.cz>
5494 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
5495 delegates in static class.
5497 2005-01-24 Martin Baulig <martin@ximian.com>
5499 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
5500 merging an implicit block, just use its reachability.
5502 * statement.cs (Block.Resolve): Make the unreachable code check
5503 work wrt. implicit blocks; see test-337 from #63842.
5505 2005-01-21 Alp Toker <alp@atoker.com>
5507 * cs-parser.jay: destructor_declaration's container is PartialContainer
5508 not Class when partial types are used, so use Kind prop instead of
5511 2005-01-22 Miguel de Icaza <miguel@ximian.com>
5513 * cs-parser.jay: Improve error reporting when an interface
5516 2005-01-20 Dick Porter <dick@ximian.com>
5518 * support.cs: SeekableStreamReader fix from Sandor Dobos
5519 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
5520 chars are read. Fixes bug 70369.
5522 2005-01-20 Raja R Harinath <rharinath@novell.com>
5524 * cs-parser.jay (catch_clause): Simplify current_block handling
5527 2005-01-17 Miguel de Icaza <miguel@ximian.com>
5529 * convert.cs (ImplicitStandardConversionExists): Synchronize the
5530 code with ImplicitStandardConversion to handle the implicit
5531 conversion of method groups into valid delegate invocations.
5533 The problem is that in parameter handling we were using this code
5534 path. Fixes bug #64698
5536 2005-01-19 Raja R Harinath <rharinath@novell.com>
5538 * cs-parser.jay: Fix several infelicities.
5539 - Avoid assigning to the parser value stack. Code like
5540 '$3 = null' is unclean. Synthesize a value for the code block
5542 - Avoid using oob_stack for storing location information. Use ...
5543 (_mark_): ... this. New (empty) rule. Saves the current location
5545 (foreach_statement): Avoid using oob_stack for current_block
5546 handling. Use technique used in for_statement and
5547 using_statement. Synthesize a value for the code block to store
5548 additional intermediate information.
5550 2005-01-13 Miguel de Icaza <miguel@ximian.com>
5552 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
5553 of a different type is only allowed to private fields of a
5554 containing type, not on fields of a base class.
5556 See test-174.cs and error cs0122-9.cs
5558 2005-01-13 Raja R Harinath <rharinath@novell.com>
5560 Fix test-335.cs (bug #58126).
5561 * cs-parser.jay (argument): Split out non-expression parts of the
5562 rule into 'non_simple_argument'.
5563 (invocation_expression): Support parenthesized invocations with
5564 multiple arguments, and with single non-simple arguments.
5566 2005-01-13 Raja R Harinath <rharinath@novell.com>
5568 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
5571 2005-01-12 Raja R Harinath <rharinath@novell.com>
5573 Fix cs0038-1.cs, cs1640-6.cs.
5574 * ecore.cs (Expression.Resolve): Remove special-case for
5575 SimpleName in error-handling.
5576 (Expression.almostMatchedMembers): Relax access permission to
5578 (Expression.MemberLookupFailed): Handle duplicates in
5579 almostMatchedMembers list.
5580 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
5581 * expression.cs (New.DoResolve): Report CS1540 for more cases.
5582 * typemanager.cs (GetFullNameSignature): Use the MethodBase
5583 overload if the passed in MemberInfo is a MethodBase.
5585 2005-01-12 Marek Safar <marek.safar@seznam.cz>
5588 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
5589 for non-CAS & merge permission sets properly.
5591 2005-01-11 Raja R Harinath <rharinath@novell.com>
5593 Improve standard-compliance of simple name and member access
5594 resolution. Fixes bugs #52697, #57200, #67520, #69519.
5595 * ecore.cs (FullNamedExpression): New abstract base class
5596 for Namespaces and TypeExpressions.
5597 (ResolveFlags.SimpleName): Remove.
5598 (SimpleName): Remove support for dotted names.
5599 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
5600 DeclSpace.FindType and DeclSpace.LookupType.
5601 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
5602 (Expression.ExprClassName): Make member function.
5603 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
5604 a namespace. Remove creation of dotted "SimpleName"s.
5605 (MemberAccess.DoResolve): Likewise.
5606 * decl.cs (DeclSpace.Cache): Make private.
5607 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
5608 (DeclSpace.FindType): Update.
5609 (DeclSpace.LookupType): Move here from RootContext. Return a
5610 FullNamedExpression.
5611 * namespace.cs (Namespace): Derive from FullNamedExpression
5612 so that it can be part of expression resolution.
5613 (Namespace.Lookup): Return an FullNamedExpression.
5614 (NamespaceEntry.LookupAlias): Lookup aliases only in current
5616 * rootcontext.cs (NamespaceLookup): Remove.
5617 (LookupType): Move to DeclSpace.
5618 * attribute.cs (CheckAttributeType): Update.
5619 * doc.cs (FindDocumentedType): Remove allowAlias argument.
5620 (FindDocumentedTypeNonArray): Likewise.
5622 2005-01-11 Raja R Harinath <rharinath@novell.com>
5624 Fix cs0509.cs, cs1632.cs.
5625 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
5626 is the same as IsInterface.
5627 (TypeContainer.GetClassBases): Likewise.
5628 * statement.cs (LabeledStatement.ig): New field.
5629 (LabeledStatement.LabelTarget): Save ILGenerator which created the
5631 (LabeledStatement.DoEmit): Check that the label was created with
5632 the same ILGenerator.
5634 2005-01-10 Marek Safar <marek.safar@seznam.cz>
5637 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
5638 accessors to its properties.
5640 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
5641 from accessors to property.
5643 2005-01-10 Marek Safar <marek.safar@seznam.cz>
5646 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
5649 2005-01-08 Miguel de Icaza <miguel@ximian.com>
5651 * attribute.cs: Check for null and empty strings.
5653 I have lost another battle to Paolo.
5655 2005-01-07 Marek Safar <marek.safar@seznam.cz>
5658 * class.cs (PropertyMethod): Set Parent field in ctors.
5659 (SetMethod.InternalParameters): Add unsafe switch hack.
5660 Override MarkForDuplicationCheck where it is appropriate.
5662 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
5663 It says whether container allows members with the same name.
5665 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
5666 Removed is_method parameter.
5668 2005-01-06 Duncan Mak <duncan@ximian.com>
5670 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
5671 because the previous change led to incorrect reporting of CS1032
5672 ("Cannot define/undefine preprocessor symbols after first token in
5673 file"). Instead of using `tokens_seen' as the only flag that
5674 triggers CS1040, introduce `comments_seen'. This new flag is used
5675 to signify having seen comments on the current line, so it is
5676 unset after a newline.
5678 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
5680 * doc.cs : When searching for a type, find nested type too.
5681 This fixes bug #71040.
5683 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
5686 - Warn missing member comment on those classes which also does not
5687 have doc comments. Fixed bug #71041.
5688 - Don't warn missing doc comment on default constructor.
5691 2005-01-06 Duncan Mak <duncan@ximian.com>
5693 * cs-tokenizer.cs (xtoken): After handling traditional C-style
5694 comments, set `tokens_seen' to true. This allows us to detect
5695 misplaced preprocessor directives (i.e. not at the beginning of
5696 the a line, nor after whitespaces). In that case, report error
5697 CS1040. This fixes bug #56460.
5699 * cs-parser.jay (interface_member_declaration): Add checks for
5700 IsExplicitImpl, and report CS0541 error if an interface member is
5701 defined as an explicit interface declaration.
5703 2005-01-06 Marek Safar <marek.safar@seznam.cz>
5706 * class.cs (PropertyMethod): Set Parent field in ctors.
5707 (SetMethod.InternalParameters): Add unsafe switch hack.
5709 * decl.cs (MemberCore.Parent): Cannot be readonly.
5711 2005-01-06 Raja R Harinath <rharinath@novell.com>
5713 * decl.cs (DeclSpace.ResolveType): Remove.
5714 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
5715 Merge in code from ...
5716 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
5717 * class.cs, enum.cs: Update to changes.
5719 2005-01-06 Miguel de Icaza <miguel@ximian.com>
5721 * anonymous.cs: Ensure that we init the scope of our parent if it
5722 has not been initialized yet.
5724 2004-12-30 Duncan Mak <duncan@ximian.com>
5726 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
5727 if field.FieldBuilder is null. Fixes #70758.
5729 * convert.cs: Fixed some typos and updated some of the comments.
5730 (ImplicitStandardConversionExists):
5731 (TryImplicitIntConversion): If `target_type' is an interface and
5732 the type of `ic' implements this interface, return true or a new
5733 BoxedCast instead of null. This fixes #70468.
5735 2004-12-29 Duncan Mak <duncan@ximian.com>
5737 * expression.cs (Argument.Emit): Check that Expr is
5738 IMemoryLocation before casting to it, and report CS1510 otherwise.
5742 2004-12-21 Ben Maurer <bmaurer@ximian.com>
5744 * statement.cs (Block.ThisVariable): remove the recursion here, to
5745 make the --profile more sane.
5747 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
5749 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
5750 assembly, by JB Evain.
5752 2004-12-17 Raja R Harinath <rharinath@novell.com>
5754 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
5755 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
5756 "parent" refers to enclosing type/class. "base" refers to superclass.
5758 2004-12-17 Raja R Harinath <rharinath@novell.com>
5760 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
5761 Ensure that we only have GlobalAttributes.
5762 * attribute.cs (Attribute.Emit): Make non-virtual.
5763 (GlobalAttribute.Emit): Remove.
5764 (Attribute.Resolve): Make virtual.
5765 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
5766 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
5767 the argument. Don't create one.
5768 (Attribute.GetObsoleteAttribute): Likewise.
5769 (Attribute.GetClsCompliantAttributeValue): Likewise.
5770 * class.cs, decl.cs: Update to changes.
5772 2004-12-17 Marek Safar <marek.safar@seznam.cz>
5774 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
5776 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
5778 * statement.cs (Foreach.Resolve): Add error 186 report.
5780 2004-12-16 Marek Safar <marek.safar@seznam.cz>
5782 * expression.cs (Conditional.DoResolve): Add warning 429.
5784 * statement.cs (If.Resolve): Add warning 665.
5786 2004-12-16 Raja R Harinath <rharinath@novell.com>
5788 New invariant: RootContext.Tree.Types.NamespaceEntry == null
5789 except when in the parser, and in GlobalAttribute.
5790 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
5791 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
5792 RootContext.Tree.Types.NamespaceEntry once work is done.
5793 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
5794 and resets RootContext.Tree.Types.NamespaceEntry.
5796 2004-12-15 Marek Safar <marek.safar@seznam.cz>
5798 * cs-parser.jay: Don't create a block for every variable.
5800 2004-12-14 Miguel de Icaza <miguel@ximian.com>
5802 * location.cs: Provide extra information.
5804 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
5805 variables from the captured environment, it is the ldarg_0.
5807 2004-12-14 Marek Safar <marek.safar@seznam.cz>
5809 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
5812 * class.cs: Changed warning level for 169 to avoid developer
5813 displeasure from warning flooding. It will be changed back when they
5814 fix most of current BCL warnings.
5816 * RootContext.cs: Pushed default WarningLevel to 3.
5818 * statement.cs: Removed unused variable.
5820 2004-12-14 Marek Safar <marek.safar@seznam.cz>
5822 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
5823 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
5824 Add error 502 report.
5825 (StaticClass.DefineType): Add error 441 report.
5826 (Class.AllowedModifiersProp): New virtual property as temporary
5827 extension to AllowedModifiers.
5828 (Class.DefineType): Add error 418 report. Moved ModFlags check here
5829 to share implementation with StaticClass and don't call virtual
5832 * driver.cs (MainDriver): Add error 1558 test.
5834 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
5835 report. Moved error 36 test here.
5837 * statement.cs (Throw.Resolve): Add error 724 report.
5839 * typemanager.cs: Add out_attribute_type core type.
5841 2004-12-13 Marek Safar <marek.safar@seznam.cz>
5843 * class.cs (TypeContainer.VerifyClsCompliance): Add error
5845 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
5847 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
5850 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
5852 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
5853 Add error 3023 report.
5854 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
5856 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
5859 2004-12-12 John Luke <john.luke@gmail.com>
5861 * driver.cs (AddArgs): take -- into account when
5862 adding arguments, fixes bug 65710
5864 2004-12-12 Martin Baulig <martin@ximian.com>
5866 * expression.cs (Unary.TryReduceNegative): Added support for
5867 SByteConstant and ByteConstant.
5868 (Unary.Reduce): Check error values from TryReduceNegative().
5870 2004-12-10 Marek Safar <marek.safar@seznam.cz>
5872 * attributes.cs (Attribute.Resolve): Avoid multiple error report
5873 and report exception as error 182.
5875 2004-12-10 Raja R Harinath <rharinath@novell.com>
5877 * driver.cs (Main): Fix message when there are warnings.
5879 2004-12-09 Miguel de Icaza <miguel@ximian.com>
5881 * delegate.cs: Fixed my fix from yesterday, sorry about that.
5883 2004-12-09 Marek Safar <marek.safar@seznam.cz>
5885 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
5886 Reduced number of warnings.
5888 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
5890 2004-12-08 Miguel de Icaza <miguel@ximian.com>
5892 * driver.cs: Removed message.
5894 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
5896 2004-12-08 <vargaz@freemail.hu>
5898 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
5900 2004-12-08 Martin Baulig <martin@ximian.com>
5902 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
5903 instead of a CS3002 for properties and indexer.
5905 2004-12-08 Martin Baulig <martin@ximian.com>
5907 * decl.cs (MemberName.ToString): Make this work again.
5909 2004-12-08 Marek Safar <marek.safar@seznam.cz>
5911 * attribute.cs (Resolve): Add error 591 detection.
5913 * class.cs (FieldMember.Define): Add error 1547 detection.
5914 (Indexer.Define): Add error 620 detection.
5915 (Operator.Define): Add error 590 detection.
5917 * ecore.cs: Missing argument for error 79.
5919 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
5922 2004-12-07 Marek Safar <marek.safar@seznam.cz>
5925 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
5928 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
5930 * cs-parser.jay : handle doc comments on implicit/explicit operators.
5931 Some operator comments were suppressed.
5932 * doc.cs : Implicit/explicit operator name in doc comments are like
5933 "op_Explicit(type)~returnType", so added suffix handling.
5935 2004-12-07 Martin Baulig <martin@ximian.com>
5938 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
5939 (MemberCore.GetClsCompliantAttributeValue): Likewise.
5940 (DeclSpace.ec): New protected field; store the EmitContext here.
5941 (DeclSpace.EmitContext): New public property; moved here from
5943 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
5946 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
5947 (Enum.Emit): Don't create a new EmitContext.
5949 * delegate.cs (Delegate.DefineType): Always create the
5952 * iterators.cs (Iterators.DefineIterator): Create a new
5953 EmitContext and store it in `ec'.
5955 2004-08-24 Martin Baulig <martin@ximian.com>
5958 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
5959 this for accessibility checks.
5960 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
5961 IsNestedFamilyAccessible.
5962 (TypeManager.IsSubclassOf): New method, do what the name actually
5965 2004-12-06 Raja R Harinath <rharinath@novell.com>
5967 Fix crash on cs0657-17.cs.
5968 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
5969 Use RootContext.Tree.Types, not 'new RootTypes ()'.
5970 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
5971 the case where the NamespaceEntry gets overwritten.
5973 2004-12-06 Marek Safar <marek.safar@seznam.cz>
5975 Fixed #69195, #56821
5976 * ecore.cs (ResolveBoolean): Tiny refactoring.
5978 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
5979 of right expression resolving when left is false constant and
5980 operator is LogicalAnd OR true constant and operator is LogicalOr.
5982 * statement.cs (ResolveUnreachable): Always reports warning.
5984 2004-12-05 Miguel de Icaza <miguel@ximian.com>
5986 * class.cs: Distinguish between 1721 and 1722 (just a little help
5987 for the programmer).
5989 2004-12-03 Miguel de Icaza <miguel@ximian.com>
5991 * delegate.cs: Only allow this on new versions of the language.
5993 2004-12-02 Duncan Mak <duncan@ximian.com>
5995 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
5997 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
5998 here as a static method. Take an additional bool out parameter
5999 `must_do_cs1540_check' for signaling to InstanceResolve.
6000 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
6001 member field from PropertyExpr class and made it an argument of
6003 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
6004 check for MarshalByRefObject, and report CS0122 instead of CS1540.
6005 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
6006 and `remove_accessor' as well as InstanceResolve: report CS0122
6011 2004-12-03 Raja R Harinath <rharinath@novell.com>
6013 Fix test-327.cs, test-328.cs, and put in early infrastructure
6014 for eventually fixing #52697.
6015 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
6016 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
6018 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
6019 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
6020 (VerifyUsing, error246): Update.
6021 * rootcontext.cs (RootContext.NamespaceLookup): Just use
6022 'NamespaceEntry.LookupNamespaceOrType'.
6024 2004-12-03 Martin Baulig <martin@ximian.com>
6026 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
6027 method as our child, call AnonymousMethod.Compatible() on it.
6029 2004-12-03 Raja R Harinath <rharinath@novell.com>
6031 Disable XML documentation support in 'basic' profile.
6032 * decl.cs, class.cs [BOOTSTRAP_WITH_OLDLIB]: Don't import System.Xml.
6033 Redirect XmlElement to System.Object.
6034 * driver.cs, enum.cs, rootcontext.cs: Don't reference System.Xml.
6035 * doc.cs [BOOTSTRAP_WITH_OLDLIB]: Disable compile.
6036 * mcs.exe.sources: Add doc-bootstrap.cs.
6037 * doc-bootstrap.cs: New file. Contains empty stub implementation
6040 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
6042 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
6043 comments are allowed.
6045 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
6047 * delegate.cs: Add checks for subtypes in paramaters and return values
6048 in VerifyMethod () to add support for Covariance/Contravariance
6051 2004-12-02 Miguel de Icaza <miguel@ximian.com>
6053 * report.cs: Remove extra closing parenthesis.
6055 * convert.cs (Error_CannotImplicitConversion): If the name of the
6056 types are the same, provide some extra information.
6058 * class.cs (FieldBase): Use an unused bit field from the field to
6059 encode the `has_offset' property from the FieldMember. This saves
6060 a couple of Ks on bootstrap compilation.
6062 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
6063 method as our child, return the AnonymousMethod resolved
6066 * expression.cs (New.DoResolve): Allow return values from
6067 NewDelegate to also include AnonymousMethods.
6071 2004-12-02 Marek Safar <marek.safar@seznam.cz>
6074 * attribute.cs (Resolve): Improved implementation of params
6075 attribute arguments.
6077 * support.cs (ParameterData): Add HasParams to be faster.
6079 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
6081 all things are for /doc support:
6083 * doc.cs: new file that supports XML documentation generation.
6084 * mcs.exe.sources: added doc.cs.
6086 Handle /doc command line option.
6087 Report error 2006 instead of 5 for missing file name for /doc.
6088 Generate XML documentation when required, after type resolution.
6090 Added support for picking up documentation (/// and /** ... */),
6091 including a new XmlCommentState enumeration.
6093 Added lines to fill Documentation element for field, constant,
6094 property, indexer, method, constructor, destructor, operator, event
6095 and class, struct, interface, delegate, enum.
6096 Added lines to warn incorrect comment.
6098 Added Documentation field (passed only when /doc was specified).
6100 Added DocComment, DocCommentHeader, GenerateDocComment() and
6101 OnGenerateDocComment() and some supporting private members for
6102 /doc feature to MemberCore.
6104 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
6106 Added overriden DocCommentHeader.
6108 Added overriden DocCommentHeader and GenerateDocComment().
6110 2004-12-01 Miguel de Icaza <miguel@ximian.com>
6112 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
6113 unwrapping the enumeration values, chain to
6114 DoConstantNumericPromotions again, so we can promote things to the
6115 fundamental types (takes care of enums that are bytes, sbytes).
6119 2004-12-01 Raja R Harinath <rharinath@novell.com>
6121 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
6122 Fix long-standing bug in type-lookup. Use FindType instead of
6123 LookupType when ec.ResolvingTypeTree.
6124 (Attribute.ResolveType, Attribute.Resolve)
6125 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
6127 (Attributes.Search): Remove internal version. Update.
6128 (Attributes.SearchMulti): Update.
6129 (Attributes.GetClsCompliantAttribute): Remove.
6130 (Attributes.GetIndexerNameAttribute): Remove.
6131 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
6132 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
6133 * class.cs (Indexer.Define): Likewise.
6135 2004-12-01 Marek Safar <marek.safar@seznam.cz>
6138 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
6139 MarshallByReference members access.
6141 * expression.cs: Use CheckMarshallByRefAccess;
6142 Better error CS0197 message.
6144 * report.cs: Print whole related error message.
6146 2004-11-30 Raja R Harinath <rharinath@novell.com>
6148 * Makefile (mcs.exe) [PROFILE=default]: Keep a copy of mcs.exe in
6149 the current directory to help debugging.
6151 2004-11-29 Marek Safar <marek.safar@seznam.cz>
6153 * class (GetClassBases): Better error 60 report.
6154 (EventProperty): Disabled warning 67 detection.
6156 2004-11-29 Marek Safar <marek.safar@seznam.cz>
6159 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
6161 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
6164 2004-11-29 Marek Safar <marek.safar@seznam.cz>
6167 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
6169 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
6171 2004-11-26 Miguel de Icaza <miguel@ximian.com>
6173 * attribute.cs (Attribute.Resolve): Refine error reporting and
6174 report a cs0117 if the identifier does not exist, to distinguish
6175 from 0617 which is a miss-use of the actual identifier.
6177 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
6178 between cs0070 and cs0079.
6180 * class.cs (MemberBase.DoDefine): When reporting a wrong
6181 accessibility level, we use MethodCore to compare instead of
6182 Method (this was a regression in some refactoring effort).
6184 So now we correctly report cs0056 again.
6186 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
6187 testing the target_type (which was known to be object_type) and
6188 not the source type (which is anonymous_method).
6190 Fixed reporting of error cs1660.
6192 * expression.cs (UserCast.Source): Expose the underlying cast.
6194 * statement.cs (Switch.SwitchGoverningType): Sort the list of
6195 allowed types to find a match to int32 first (most common).
6197 In addition, it ignores any ImplicitUserConversions that did an
6198 internal implicit conversion (as the switch statement allows only
6199 one integral conversion to exist).
6201 * class.cs (PartialContainer.Create): rename `name' to
6202 `member_name' for clarity. Then replace the string calls with a
6203 call to MemberName.GetPartialName, as now using
6204 MemberName.ToString is an error (this is due to the side effects
6205 it had, that were fixed in the past).
6207 This will restore the error reporting on a number of partial class
6208 errors that were missusing this (and getting an exception as a
6209 results, which is now just a plain textual warning, because
6210 yyparse debug output would crash otherwise).
6212 2004-11-26 Raja R Harinath <rharinath@novell.com>
6214 * Makefile (PROGRAM_INSTALL_DIR): Remove.
6216 2004-11-25 Ben Maurer <bmaurer@ximian.com>
6218 * rootcontext.cs (LookupType): Make sure to cache lookups that
6219 don't give us a negative result. This saves about 5% of corlib
6222 2004-11-25 Miguel de Icaza <miguel@ximian.com>
6224 * report.cs (AbstractMessage.Print): messages are sent to stderr
6226 * class.cs (TypeContainer.GetClassBases): It is an error to have a
6227 non-interface in the list of interfaces (at this point, either
6228 parent was properly set, or a base class is being listed in the
6229 interfaces section).
6231 This flags error 1722, and resolves the crash from bug 69259.
6233 2004-11-25 Ben Maurer <bmaurer@ximian.com>
6235 * statement.cs (Using.EmitExpressionFinally): make this work right
6236 for valuetypes. Fixes 69926.
6238 2004-11-25 Miguel de Icaza <miguel@ximian.com>
6240 * const.cs (Const.ChangeType): Cope with the "0 literal can be
6241 converted to an enum" here, before we try to change the underlying
6242 type. This code exists, but it is a different code path than the
6243 one used while encoding constants.
6245 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
6246 old bug: when converting from the null literal to a pointer,
6247 return an EmptyCast, not the NullLiteral.
6249 This fixes #69921, the recent null_type changes probably made this
6252 (ImplicitReferenceConversionExists): In addition, resynchronized
6253 the code here, so it matches the same code in
6254 ImplicitReferenceConversionExists for the `from any class-type S
6255 to any interface-type T'.
6258 2004-11-25 Marek Safar <marek.safar@seznam.cz>
6260 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
6262 2004-11-24 Miguel de Icaza <miguel@ximian.com>
6264 * cs-parser.jay: Use verbosity accordingly.
6266 2004-11-24 Marek Safar <marek.safar@seznam.cz>
6268 * expression.cs (Unary.ResolveOperator): Do not report warning;
6269 AddressOf reads from variable.
6271 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
6273 2004-11-24 Marek Safar <marek.safar@seznam.cz>
6277 * attribute.cs (Attributable): Removed CheckTargets.
6278 (Attributes.Emit): Explicit attribute targets are tested here.
6280 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
6281 not enabled for interfaces.
6283 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
6284 (GetAssemblyName): Ouch next bug there.
6286 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
6288 * expression.cs: Error 275 added.
6290 2004-11-23 Marek Safar <marek.safar@seznam.cz>
6292 Fix bug #69177 (Implemented decimal constant support)
6294 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
6295 (BinaryFold): Add DecimalConstant.
6297 * const.cs (Define): Decimal constant
6299 (ChangeType): Add decimal type handling.
6300 (LookupConstantValue): Don't set value for decimal type but
6301 emit DecimalConstantAttribute. Needed for constant optimization.
6303 * constant.cs (ToDecimal): New method.
6304 (ConvertToDecimal): New method.
6305 (IntConstant): Implemented ConvertToDecimal.
6306 (DecimalConstant.Emit): Emit optimized version for decimals in
6309 * expression.cs (ResolveOperator): Changed order of constant
6310 reduction to work correctly with native types which have
6311 overloaded operators.
6312 (ResolveMemberAccess): Extract constant value from attribute
6315 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
6317 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
6318 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
6319 (ChangeType): Decimal is special.
6320 (TypeToCoreType): Add decimal type.
6322 2004-11-22 Marek Safar <marek.safar@seznam.cz>
6324 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
6327 2004-11-22 Marek Safar <marek.safar@seznam.cz>
6329 * class.cs (EventField.ApplyAttributeBuilder): Fix error
6332 2004-11-19 Marek Safar <marek.safar@seznam.cz>
6334 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
6336 * pending.cs (PendingImplementation): Grab only interfaces.
6338 2004-11-19 Marek Safar <marek.safar@seznam.cz>
6340 * statement.cs (ForeachHelperMethods): Add location member and
6341 error 202 detection.
6343 2004-11-19 Raja R Harinath <rharinath@novell.com>
6345 * Makefile (EXTRA_DISTFILES): Remove mcs.exe.config. It's
6346 automatically handled by executable.make.
6347 (PROGRAM): Make profile-specific.
6349 2004-11-18 Marek Safar <marek.safar@seznam.cz>
6351 * expression.cs (DoResolveBase): Fixed wrong warning for out
6354 2004-11-18 Martin Baulig <martin@ximian.com>
6356 Merged latest changes into gmcs. Please keep this comment in
6357 here, it makes it easier for me to see what changed in MCS since
6358 the last time I merged.
6360 2004-11-17 Raja R Harinath <rharinath@novell.com>
6362 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
6363 (TypeHandle.GetMemberCache): New.
6364 (TypeHandle.TypeHandle): Update.
6365 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
6366 (TypeManager.LookupParentInterfacesCache):
6367 Rename from LookupInterfaceCache. Optimize slightly.
6368 (TypeManager.MemberLookup_FindMembers): Update.
6369 * decl.cs (MemberCache.MemberCache): Set Container to null in the
6371 (AddCacheContents): Rename from AddHashtable.
6372 * class.cs (TypeContainer.parent_container): Remove.
6373 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
6374 (TypeContainer.DoDefineMembers): Don't initialize it.
6375 Update to name changes.
6377 2004-11-17 Miguel de Icaza <miguel@ximian.com>
6379 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
6380 that factors the code to check access modifiers on override.
6382 (PropertyBase): Use the code here.
6384 Patch from Lluis S'anchez, fixes bug #69361.
6386 2004-11-15 Miguel de Icaza <miguel@ximian.com>
6388 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
6389 routine that is used to report the use of a captured variable
6390 whose address has been taken.
6392 There are two checks: one when variables are being captured and
6393 the other check is when the address of a variable is taken.
6395 (because an anonymous methods might be resolved before *or* after
6396 the address has been taken) and
6398 * expression.cs (Conditional.DoResolve): Remove the special
6399 casing that Martin added to trueExpr and falseExpr being both
6400 NullLiteral. We get the right behavior now just by introducing
6401 the null_type into the compiler.
6403 * convert.cs (ExplicitConversion): Change the code to use
6404 null_type instead of testing `expr is NullLiteral'.
6405 (ImplicitConversionStandard): use null_type too.
6406 (ImplicitReferenceConversionExists): use null_type too.
6407 (ImplicitReferenceConversion): use null_type too.
6409 * literal.cs: The type of `NullLiteral' is now null_type instead
6411 (Resolve): Set the type here.
6413 * typemanager.cs: Introduce null_type.
6415 2004-11-17 Martin Baulig <martin@ximian.com>
6417 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
6418 direction, like FindMembers() does. Fixes #69546, testcase is in
6421 2004-11-16 Martin Baulig <martin@ximian.com>
6423 This is based on a patch from Marek Safar, see bug #69082.
6424 Fixes bugs #63705 and #67130.
6426 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
6427 method; create a MemberCache for an interface type and cache the
6430 * decl.cs (IMemberContainer.ParentContainer): Removed.
6431 (IMemberContainer.ParentCache): New property.
6432 (MemberCache.SetupCacheForInterface): Removed.
6433 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
6434 to create a cache for an interface's "parent".
6436 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
6439 2004-11-16 Martin Baulig <martin@ximian.com>
6441 Merged back from gmcs; these changes already went into gmcs a
6442 couple of weeks ago.
6445 (TypeManager.AddUserType): Removed the `ifaces' argument.
6446 (TypeManager.RegisterBuilder): Take a `Type []' instead of a
6448 (TypeManager.AddUserInterface): Removed.
6449 (TypeManager.ExpandInterfaces): Return a `Type []' instead of a
6451 (TypeManager.GetInterfaces): Likewise.
6452 (TypeManager.GetExplicitInterfaces): Likewise.
6454 * ecore.cs (TypeExpr.GetInterfaces): Removed.
6456 * class.cs (TypeContainer.base_class_type): Replaced with `ptype'.
6457 (TypeContainer.base_inteface_types): Replaced with `ifaces'.
6459 2004-11-14 Ben Maurer <bmaurer@ximian.com>
6461 * statement.cs: Avoid adding bools to a hashtable.
6463 2004-11-07 Miguel de Icaza <miguel@ximian.com>
6465 * expression.cs (Invocation.OverloadResolve): Flag error if we are
6466 calling an unsafe method from a safe location.
6468 2004-11-06 Marek Safar <marek.safar@seznam.cz>
6471 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
6473 2004-11-06 Miguel de Icaza <miguel@ximian.com>
6475 * namespace.cs (VerifyUsing): use GetPartialName instead of
6478 2004-11-05 Miguel de Icaza <miguel@ximian.com>
6480 * statement.cs (Return.Resolve): Fix regression in typo: if
6481 `in_exc', we have to request a NeedReturnLabel, this was a typo
6482 introduced in the anonymous method check-in. Fixes #69131.
6484 * Indexers were using the ShortName when defining themselves,
6485 causing a regression in the compiler bootstrap when applying the
6486 patch from 2004-11-02 (first part), now they use their full name
6487 and the bug is gone.
6489 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
6491 * driver.cs: Strip the path from the names of embedded resources. Fixes
6494 2004-11-04 Raja R Harinath <rharinath@novell.com>
6496 Fix error message regression: cs0104-2.cs.
6497 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
6498 (AliasEntry.Resolve): Update.
6499 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
6501 (RootContext.LookupType): Update.
6503 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
6505 * cs-parser.jay: Add support for handling accessor modifiers
6506 * class: Add support port accessor modifiers and error checking,
6507 define PropertyMethod.Define as virtual (not abstract anymore)
6508 * ecore.cs: Add checking for proeprties access with access modifiers
6509 * iterators.cs: Modify Accessor constructor call based in the modified
6511 2004-11-02 Ben Maurer <bmaurer@ximian.com>
6513 * expression.cs (StringConcat): Handle being called twice,
6514 as when we have a concat in a field init with more than two
6517 2004-11-02 Miguel de Icaza <miguel@ximian.com>
6519 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
6520 special case explicit implementations, we should always produce
6521 the .property or .event declaration.
6523 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
6524 since it will not return correct data if people use this
6525 unresolved in the presence of using statements (see test-313).
6527 * class.cs (MethodData.Define): If we are an explicit interface
6528 implementation, set the method name to the full name of the
6529 interface plus the name of the method.
6531 Notice that using the method.MethodName.GetFullName() does not
6532 work, as it will only contain the name as declared on the source
6533 file (it can be a shorthand in the presence of using statements)
6534 and not the fully qualifed type name, for example:
6538 class D : ICloneable {
6539 object ICloneable.Clone () {
6543 Would produce a method called `ICloneable.Clone' instead of
6544 `System.ICloneable.Clone'.
6546 * namespace.cs (Alias.Resolve): Use GetPartialName.
6548 2004-11-01 Marek Safar <marek.safar@seznam.cz>
6550 * cs-parser.jay: Add error 1055 report.
6552 2004-11-01 Miguel de Icaza <miguel@ximian.com>
6554 * assign.cs (Assign.DoResolve): Only do the transform of
6555 assignment into a New if the types are compatible, if not, fall
6556 through and let the implicit code deal with the errors and with
6557 the necessary conversions.
6559 2004-11-01 Marek Safar <marek.safar@seznam.cz>
6561 * cs-parser.jay: Add error 1031 report.
6563 * cs-tokenizer.cs: Add location for error 1038.
6565 2004-10-31 Marek Safar <marek.safar@seznam.cz>
6567 * cs-parser.jay: Add error 1016 report.
6569 2004-10-31 Marek Safar <marek.safar@seznam.cz>
6571 * cs-parser.jay: Add errors 1575,1611 report.
6573 2004-10-31 Marek Safar <marek.safar@seznam.cz>
6575 * cs-parser.jay: Add error 1001 report.
6577 2004-10-31 Marek Safar <marek.safar@seznam.cz>
6580 * attribute.cs (GetMarshal): Add method argument for
6581 caller identification.
6583 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
6584 agument for GetMarshal and RuntimeMissingSupport.
6586 2004-10-31 Marek Safar <marek.safar@seznam.cz>
6588 * attribute.cs (ExtractSecurityPermissionSet): Removed
6589 TypeManager.code_access_permission_type.
6591 * typemanager.cs: Removed TypeManager.code_access_permission_type.
6593 2004-10-27 Miguel de Icaza <miguel@ximian.com>
6595 * expression.cs (LocalVariableReference.DoResolveLValue): Check
6596 for obsolete use of a variable here. Fixes regression on errors
6597 cs0619-25 and cs0619-26.
6599 2004-10-27 Marek Safar <marek.safar@seznam.cz>
6601 Fix #62358, implemented security attribute encoding.
6603 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
6604 Tests permitted SecurityAction for assembly or other types.
6605 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
6606 data from SecurityPermissionAttribute to PermisionSet class.
6608 * class.cs (ApplyAttributeBuilder): Added special handling
6609 for System.Security.Permissions.SecurityAttribute based types.
6611 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
6612 special handling for System.Security.Permissions.SecurityAttribute
6615 * enum.cs (ApplyAttributeBuilder): Added special handling
6616 for System.Security.Permissions.SecurityAttribute based types.
6618 * parameter.cs (ApplyAttributeBuilder): Added special handling
6619 for System.Security.Permissions.SecurityAttribute based types.
6621 * rootcontext.cs: Next 2 core types.
6623 * typemanager.cs (TypeManager.security_permission_attr_type):
6624 Built in type for the SecurityPermission Attribute.
6625 (code_access_permission_type): Build in type.
6627 2004-10-17 Miguel de Icaza <miguel@ximian.com>
6629 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
6630 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
6631 all of this information into
6632 EmitContext.EmitCapturedVariableInstance.
6634 * codegen.cs (EmitCapturedVariableInstance): move here the
6635 funcionality of emitting an ldarg.0 in the presence of a
6636 remapping. This centralizes the instance emit code.
6638 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
6639 then emit a load of this: it means that we have reached the
6640 topmost ScopeInfo: the one that contains the pointer to the
6641 instance of the class hosting the anonymous method.
6643 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
6644 captures to the topmost CaptureContext.
6646 2004-10-12 Miguel de Icaza <miguel@ximian.com>
6648 * expression.cs (LocalVariableReference): Move the knowledge about
6649 the iterators into codegen's EmitCapturedVariableInstance.
6651 2004-10-11 Miguel de Icaza <miguel@ximian.com>
6653 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
6654 all code paths return a value from an anonymous method (it is the
6655 same as the 161 error, but for anonymous methods).
6657 2004-10-08 Miguel de Icaza <miguel@ximian.com>
6659 The introduction of anonymous methods in the compiler changed
6660 various ways of doing things in the compiler. The most
6661 significant one is the hard split between the resolution phase
6662 and the emission phases of the compiler.
6664 For instance, routines that referenced local variables no
6665 longer can safely create temporary variables during the
6666 resolution phase: they must do so from the emission phase,
6667 since the variable might have been "captured", hence access to
6668 it can not be done with the local-variable operations from the runtime.
6672 (Block.Flags): New flag `IsTopLevel' to indicate that this block
6673 is a toplevel block.
6675 (ToplevelBlock): A new kind of Block, these are the blocks that
6676 are created by the parser for all toplevel method bodies. These
6677 include methods, accessors and anonymous methods.
6679 These contain some extra information not found in regular blocks:
6680 A pointer to an optional CaptureContext (for tracking captured
6681 local variables and parameters). A pointer to the parent
6684 (Return.Resolve): Catch missmatches when returning a value from an
6685 anonymous method (error 1662).
6686 Invoke NeedReturnLabel from the Resolve phase instead of the emit
6689 (Break.Resolve): ditto.
6691 (SwitchLabel): instead of defining the labels during the
6692 resolution phase, we now turned the public ILLabel and ILLabelCode
6693 labels into methods called GetILLabelCode() and GetILLabel() that
6694 only define the label during the Emit phase.
6696 (GotoCase): Track the SwitchLabel instead of the computed label
6697 (its contained therein). Emit the code by using
6698 SwitchLabel.GetILLabelCode ().
6700 (LocalInfo.Flags.Captured): A new flag has been introduce to track
6701 whether the Local has been captured or not.
6703 (LocalInfo.IsCaptured): New property, used to tell whether the
6704 local has been captured.
6706 * anonymous.cs: Vastly updated to contain the anonymous method
6709 The main classes here are: CaptureContext which tracks any
6710 captured information for a toplevel block and ScopeInfo used to
6711 track the activation frames for various local variables.
6713 Each toplevel block has an optional capture context associated
6714 with it. When a method contains an anonymous method both the
6715 toplevel method and the anonymous method will create a capture
6716 context. When variables or parameters are captured, they are
6717 recorded on the CaptureContext that owns them, for example:
6721 MyDelegate d = delegate {
6726 Here `a' will be recorded as captured on the toplevel
6727 CapturedContext, the inner captured context will not have anything
6728 (it will only have data if local variables or parameters from it
6729 are captured in a nested anonymous method.
6731 The ScopeInfo is used to track the activation frames for local
6732 variables, for example:
6734 for (int i = 0; i < 10; i++)
6735 for (int j = 0; j < 10; j++){
6736 MyDelegate d = delegate {
6741 At runtime this captures a single captured variable `i', but it
6742 captures 10 different versions of the variable `j'. The variable
6743 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
6744 recorded on a child.
6746 The toplevel ScopeInfo will also track information like the `this'
6747 pointer if instance variables were referenced (this is necessary
6748 as the anonymous method lives inside a nested class in the host
6749 type of the method).
6751 (AnonymousMethod): Expanded to track the Toplevel, implement
6752 `AnonymousMethod.Compatible' to tell whether an anonymous method
6753 can be converted to a target delegate type.
6755 The routine now also produces the anonymous method content
6757 (AnonymousDelegate): A helper class that derives from
6758 DelegateCreation, this is used to generate the code necessary to
6759 produce the delegate for the anonymous method that was created.
6761 * assign.cs: API adjustments for new changes in
6762 Convert.ImplicitStandardConversionExists.
6764 * class.cs: Adjustments to cope with the fact that now toplevel
6765 blocks are of type `ToplevelBlock'.
6767 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
6768 insteda of standard blocks.
6770 Flag errors if params arguments are passed to anonymous methods.
6772 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
6773 `CurrentAnonymousMethod' which points to the current Anonymous
6774 Method. The variable points to the AnonymousMethod class that
6775 holds the code being compiled. It is set in the new EmitContext
6776 created for the anonymous method.
6778 (EmitContext.Phase): Introduce a variable and an enumeration to
6779 assist in enforcing some rules about when and where we are allowed
6780 to invoke certain methods (EmitContext.NeedsReturnLabel is the
6781 only one that enfonces this right now).
6783 (EmitContext.HaveCaptureInfo): new helper method that returns
6784 whether we have a CapturedContext initialized.
6786 (EmitContext.CaptureVariable): New method used to register that a
6787 LocalInfo must be flagged for capturing.
6789 (EmitContext.CapturedParameter): New method used to register that a
6790 parameters must be flagged for capturing.
6792 (EmitContext.CapturedField): New method used to register that a
6793 field must be flagged for capturing.
6795 (EmitContext.HaveCapturedVariables,
6796 EmitContext.HaveCapturedFields): Return whether there are captured
6797 variables or fields.
6799 (EmitContext.EmitMethodHostInstance): This is used to emit the
6800 instance for the anonymous method. The instance might be null
6801 (static methods), this (for anonymous methods that capture nothing
6802 and happen to live side-by-side with the current method body) or a
6803 more complicated expression if the method has a CaptureContext.
6805 (EmitContext.EmitTopBlock): Routine that drives the emission of
6806 code: it will first resolve the top block, then emit any metadata
6807 and then emit the code. The split is done so that we can extract
6808 any anonymous methods and flag any captured variables/parameters.
6810 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
6811 during this phase, the ILGenerator should not be used as labels
6812 and local variables declared here might not be accessible to any
6813 code that is part of an anonymous method.
6815 Exceptions to this include the temporary variables that are
6816 created by some statements internally for holding temporary
6819 (EmitContext.EmitMeta): New routine, in charge of emitting all the
6822 (EmitContext.TemporaryReturn): This method is typically called
6823 from the Emit phase, and its the only place where we allow the
6824 ReturnLabel to be defined other than the EmitMeta. The reason is
6825 that otherwise we would have to duplicate a lot of logic in the
6826 Resolve phases of various methods that today is on the Emit
6829 (EmitContext.NeedReturnLabel): This no longer creates the label,
6830 as the ILGenerator is not valid during the resolve phase.
6832 (EmitContext.EmitThis): Extended the knowledge in this class to
6833 work in anonymous methods in addition to iterators.
6835 (EmitContext.EmitCapturedVariableInstance): This emits whatever
6836 code is necessary on the stack to access the instance to a local
6837 variable (the variable will be accessed as a field).
6839 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
6840 EmitContext.EmitAddressOfParameter): Routines to support
6841 parameters (not completed at this point).
6843 Removals: Removed RemapLocal and RemapLocalLValue. We probably
6844 will also remove the parameters.
6846 * convert.cs (Convert): Define a `ConstantEC' which points to a
6847 null. This is just to prefity some code that uses
6848 ImplicitStandardConversion code and do not have an EmitContext
6851 The idea is to flag explicitly that at that point in time, it is
6852 known that the conversion will not trigger the delegate checking
6853 code in implicit conversions (which requires a valid
6856 Everywhere: pass new EmitContext parameter since
6857 ImplicitStandardConversionExists now requires it to check for
6858 anonymous method conversions.
6860 (Convert.ImplicitStandardConversionExists): If the type of an
6861 expression is the anonymous_method_type, and the type is a
6862 delegate, we invoke the AnonymousMethod.Compatible method to check
6863 whether an implicit conversion is possible.
6865 (Convert.ImplicitConversionStandard): Only do implicit method
6866 group conversions if the language level is not ISO_1.
6868 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
6869 MethodInfo for the Invoke method. used by Delegate and
6872 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
6873 method conversions if the target type is a delegate.
6875 Removed extra debugging nops.
6877 (LocalVariableReference): Turn the `local_info' into a public
6880 Add `prepared' field, the same hack used for FieldExprs to cope
6881 with composed assignments, as Local variables do not necessarily
6882 operate purely on the stack as they used to: they can be captured
6885 Add `temp' for a temporary result, like fields.
6887 Refactor DoResolve and DoResolveLValue into DoResolveBase.
6889 It now copes with Local variables that are captured and emits the
6890 proper instance variable to load it from a field in the captured
6893 (ParameterReference.DoResolveBase): During the resolve phase,
6894 capture parameters if we are in an anonymous method.
6896 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
6897 anonymous method, use the EmitContext helper routines to emit the
6898 parameter reference.
6900 * iterators.cs: Set RemapToProxy to true/false during the
6903 * parameters.cs (GetParameterByName): New helper method.
6905 * typemanager.cs (anonymous_method_type) a new type that
6906 represents an anonyous method. This is always an internal type,
6907 used as a fencepost to test against the anonymous-methodness of an
6910 2004-10-20 Marek Safar <marek.safar@seznam.cz>
6912 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
6914 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
6916 2004-10-18 Martin Baulig <martin@ximian.com>
6918 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
6919 `Type' directly, but call ResolveType() on it.
6920 (Catch.Resolve): Likewise.
6921 (Foreach.Resolve): Likewise.
6923 2004-10-18 Martin Baulig <martin@ximian.com>
6925 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
6926 `Type' directly, but call ResolveType() on it.
6927 (Probe.DoResolve): Likewise.
6928 (ArrayCreation.LookupType): Likewise.
6929 (TypeOf.DoResolve): Likewise.
6930 (SizeOf.DoResolve): Likewise.
6932 2004-10-18 Martin Baulig <martin@ximian.com>
6934 * expression.cs (Invocation.BetterFunction): Put back
6935 TypeManager.TypeToCoreType().
6937 2004-10-18 Raja R Harinath <rharinath@novell.com>
6939 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
6942 2004-10-18 Martin Baulig <martin@ximian.com>
6944 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
6945 `Type' directly, but call ResolveType() on it.
6947 2004-10-18 Martin Baulig <martin@ximian.com>
6949 * class.cs (FieldMember.Define): Don't access the TypeExpr's
6950 `Type' directly, but call ResolveType() on it.
6951 (MemberBase.DoDefine): Likewise.
6953 * expression.cs (New.DoResolve): Don't access the TypeExpr's
6954 `Type' directly, but call ResolveType() on it.
6955 (ComposedCast.DoResolveAsTypeStep): Likewise.
6957 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
6958 `Type' directly, but call ResolveType() on it.
6960 2004-10-17 John Luke <john.luke@gmail.com>
6962 * class.cs (Operator.GetSignatureForError): use CSharpName
6964 * parameter.cs (Parameter.GetSignatureForError): Returns
6965 correct name even if was not defined.
6967 2004-10-13 Raja R Harinath <rharinath@novell.com>
6970 * class.cs (TypeContainer.EmitContext): New property.
6971 (DefineNestedTypes): Create an emitcontext for each part.
6972 (MethodCore.DoDefineParameters): Use container's emitcontext.
6973 Pass type array to InternalParameters.
6974 (MemberBase.DoDefine): Use container's emitcontext.
6975 (FieldMember.Define): Likewise.
6976 (Event.Define): Likewise.
6977 (SetMethod.GetParameterInfo): Change argument to EmitContext.
6978 Pass type array to InternalParameters.
6979 (SetIndexerMethod.GetParameterInfo): Likewise.
6980 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
6981 * delegate.cs (Define): Pass emitcontext to
6982 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
6983 array to InternalParameters.
6984 * expression.cs (ParameterReference.DoResolveBase): Pass
6985 emitcontext to GetParameterInfo.
6986 (ComposedCast.DoResolveAsTypeStep): Remove check on
6987 ec.ResolvingTypeTree.
6988 * parameter.cs (Parameter.Resolve): Change argument to
6989 EmitContext. Use ResolveAsTypeTerminal.
6990 (Parameter.GetSignature): Change argument to EmitContext.
6991 (Parameters.ComputeSignature): Likewise.
6992 (Parameters.ComputeParameterTypes): Likewise.
6993 (Parameters.GetParameterInfo): Likewise.
6994 (Parameters.ComputeAndDefineParameterTypes): Likewise.
6995 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
6996 * support.cs (InternalParameters..ctor): Remove variant that takes
6998 * typemanager.cs (system_intptr_expr): New.
6999 (InitExpressionTypes): Initialize it.
7001 2004-10-12 Chris Toshok <toshok@ximian.com>
7003 * cs-parser.jay: fix location for try_statement and catch_clause.
7005 2004-10-11 Martin Baulig <martin@ximian.com>
7007 * report.cs: Don't make --fatal abort on warnings, we have
7008 -warnaserror for that.
7010 2004-10-07 Raja R Harinath <rharinath@novell.com>
7012 More DeclSpace.ResolveType avoidance.
7013 * decl.cs (MemberCore.InUnsafe): New property.
7014 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
7015 with newly created EmitContext.
7016 (FieldMember.Define): Likewise.
7017 * delegate.cs (Delegate.Define): Likewise.
7018 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
7019 only if normal name-lookup fails.
7020 (TypeExpr.DoResolve): Enable error-checking.
7021 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
7022 (SizeOf.DoResolve): Likewise.
7023 (ComposedCast.DoResolveAsTypeStep): Likewise.
7024 (StackAlloc.DoResolve): Likewise.
7025 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
7026 (Block.Unsafe): New property.
7027 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
7028 (Unsafe): Set 'unsafe' flag of contained block.
7029 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
7030 (Fixed.Resolve): Likewise.
7031 (Catch.Resolve): Likewise.
7032 (Using.ResolveLocalVariableDecls): Likewise.
7033 (Foreach.Resolve): Likewise.
7035 2004-10-05 John Luke <john.luke@gmail.com>
7037 * cs-parser.jay: add location to error CS0175
7039 2004-10-04 Miguel de Icaza <miguel@ximian.com>
7041 * ecore.cs (Expression.Constantity): Add support for turning null
7044 * const.cs (Const.Define): Allow constants to be reference types
7045 as long as the value is Null.
7047 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
7049 * namespace.cs (NamespaceEntry.Using): No matter which warning
7050 level is set, check if this namespace name has already been added.
7052 2004-10-03 Ben Maurer <bmaurer@ximian.com>
7054 * expression.cs: reftype [!=]= null should always use br[true,false].
7057 2004-10-03 Marek Safar <marek.safar@seznam.cz>
7060 * attribute.cs: Enum conversion moved to
7061 GetAttributeArgumentExpression to be applied to the all
7064 2004-10-01 Raja R Harinath <rharinath@novell.com>
7066 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
7067 * class.c (TypeContainer.DefineType): Flag error if
7068 base types aren't accessible due to access permissions.
7069 * decl.cs (DeclSpace.ResolveType): Move logic to
7070 Expression.ResolveAsTypeTerminal.
7071 (DeclSpace.ResolveTypeExpr): Thin layer over
7072 Expression.ResolveAsTypeTerminal.
7073 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
7074 Refactor code into NestedAccess. Use it.
7075 (DeclSpace.NestedAccess): New.
7076 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
7077 argument to silence errors. Check access permissions.
7078 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
7079 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
7080 (Cast.DoResolve): Likewise.
7081 (New.DoResolve): Likewise.
7082 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
7083 (TypeOf.DoResolve): Likewise.
7085 * expression.cs (Invocation.BetterConversion): Return the Type of
7086 the better conversion. Implement section 14.4.2.3 more faithfully.
7087 (Invocation.BetterFunction): Make boolean. Make correspondence to
7088 section 14.4.2.2 explicit.
7089 (Invocation.OverloadResolve): Update.
7090 (Invocation): Remove is_base field.
7091 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
7092 (Invocation.Emit): Likewise.
7094 2004-09-27 Raja R Harinath <rharinath@novell.com>
7096 * README: Update to changes.
7098 2004-09-24 Marek Safar <marek.safar@seznam.cz>
7100 * cs-parser.jay: Reverted 642 warning fix.
7102 2004-09-23 Marek Safar <marek.safar@seznam.cz>
7105 * decl.cs (FindMemberWithSameName): Indexer can have more than
7108 2004-09-23 Marek Safar <marek.safar@seznam.cz>
7110 * expression.cs (LocalVariableReference.DoResolveLValue):
7111 Do not report warning 219 for out values.
7112 (EmptyExpression.Null): New member to avoid extra allocations.
7114 2004-09-23 Marek Safar <marek.safar@seznam.cz>
7116 * cs-parser.jay: Fix wrong warning 642 report.
7118 * cs-tokenizer.cs (CheckNextToken): New helper;
7119 Inspect next character if is same as expected.
7121 2004-09-23 Martin Baulig <martin@ximian.com>
7123 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
7124 (Convert.ImplicitReferenceConversionExists): Likewise.
7126 2004-09-23 Marek Safar <marek.safar@seznam.cz>
7128 * class.cs (Operator.Define): Add error 448 and 559 report.
7130 2004-09-22 Marek Safar <marek.safar@seznam.cz>
7132 * class.cs (MemberBase.IsTypePermitted): New protected
7133 method for checking error CS0610.
7135 2004-09-22 Marek Safar <marek.safar@seznam.cz>
7137 * class.cs (TypeContainer.HasExplicitLayout): New property
7138 Returns whether container has StructLayout attribute set Explicit.
7139 (FieldMember): New abstract class for consts and fields.
7140 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
7141 (Field): Reuse FieldMember.
7143 * const.cs (Const): Reuse FieldMember.
7145 * rootcontext.cs: EmitConstants call moved to class.
7147 2004-09-22 Martin Baulig <martin@ximian.com>
7149 Thanks to Peter Sestoft for this bug report.
7151 * expression.cs (Conditional): If both the `trueExpr' and the
7152 `falseExpr' is a NullLiteral, return a NullLiteral.
7154 2004-09-22 Martin Baulig <martin@ximian.com>
7156 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
7157 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
7158 for the "get_Current" call.
7160 2004-09-22 Martin Baulig <martin@ximian.com>
7162 Marek and me just fixed one of our oldest bugs: #28562 :-)
7164 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
7166 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
7167 we're an EnumConstant, just return that.
7168 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
7169 an EnumConstant. In this case, we need to use GetValueAsEnumType()
7170 to get the value which'll actually be written into the attribute.
7171 However, we have to use GetValue() to access the attribute's value
7174 2004-09-22 Marek Safar <marek.safar@seznam.cz>
7176 * constant.cs (Constant.IsNegative): New abstract property
7179 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
7180 (StackAlloc.DoResolve): Reused IsNegative.
7182 2004-09-21 Martin Baulig <martin@ximian.com>
7184 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
7185 if we're used in an iterator, we may be called from different
7188 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
7189 we actually have an exception block.
7191 2004-09-20 John Luke <jluke@cfl.rr.com>
7193 * class.cs, cs-parser.jay: Improve the error report for 1520:
7194 report the actual line where the error happens, not where the
7197 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
7198 Pass location information that was available elsewhere.
7200 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
7202 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
7203 runtime to delay sign assemblies.
7205 2004-09-19 Miguel de Icaza <miguel@ximian.com>
7207 * cs-parser.jay: Do not report the stack trace, this is barely
7210 2004-08-22 John Luke <john.luke@gmail.com>
7212 * driver.cs : check that a resource id is not already used
7213 before adding it, report CS1508 if it is, bug #63637
7215 2004-09-19 Miguel de Icaza <miguel@ximian.com>
7217 * ecore.cs: Removed dead code.
7219 2004-09-18 Marek Safar <marek.safar@seznam.cz>
7221 * class.cs: Do not report warning CS0067 on the interfaces.
7223 2004-09-16 Marek Safar <marek.safar@seznam.cz>
7225 * cs-parser.jay: Add error 504 report.
7227 2004-09-16 Marek Safar <marek.safar@seznam.cz>
7229 * rootcontext.cs: WarningLevel is 4 by default now.
7231 * statement.cs (Fixed.Resolve): Do not null
7234 2004-09-16 Marek Safar <marek.safar@seznam.cz>
7237 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
7238 deep search when property is not virtual.
7239 (PropertyExpr.ResolveAccessors): Make one call for both
7242 2004-09-15 Marek Safar <marek.safar@seznam.cz>
7245 * statement.cs: Error 152 report constains also location.
7247 2004-09-15 Marek Safar <marek.safar@seznam.cz>
7250 * const.cs: Explicitly set constant as static.
7252 2004-09-15 Marek Safar <marek.safar@seznam.cz>
7255 * cs-parser.jay: Add error 1017 report.
7257 2004-09-15 Marek Safar <marek.safar@seznam.cz>
7259 Fixed bug #59980, #64224
7260 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
7262 * typemanager.cs (IsSpecialMethod): Simplified
7264 2004-09-14 Marek Safar <marek.safar@seznam.cz>
7266 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
7267 condition with better params.
7269 2004-09-14 Marek Safar <marek.safar@seznam.cz>
7272 * attribute.cs (Resolve): Property has to have both
7275 2004-09-14 Martin Baulig <martin@ximian.com>
7277 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
7279 2004-09-14 Marek Safar <marek.safar@seznam.cz>
7282 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
7283 called and is obsolete then this member suppress message
7284 when call is inside next [Obsolete] method or type.
7286 * expression.cs: Use TestObsoleteMethodUsage member.
7288 2004-09-14 Martin Baulig <martin@ximian.com>
7290 * cs-parser.jay: Sync a bit with the GMCS version.
7292 2004-09-14 Martin Baulig <martin@ximian.com>
7294 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
7295 (CSharpParser.yacc_verbose_flag): New public field.
7297 * genericparser.cs: Removed.
7299 2004-09-14 Raja R Harinath <rharinath@novell.com>
7301 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
7303 2004-09-13 Marek Safar <marek.safar@seznam.cz>
7305 * class.cs (MethodCore.CheckBase): Fix bug #65757.
7307 2004-09-10 Martin Baulig <martin@ximian.com>
7309 Backported my MemberName changes from GMCS into MCS.
7311 - we are now using a special `MemberName' class instead of using
7312 strings; in GMCS, the `MemberName' also contains the type
7315 - changed the grammar rules a bit:
7316 * the old `member_name' is now a `namespace_or_type_name':
7317 The rule is that we use `namespace_or_type_name' everywhere
7318 where we expect either a "member name" (GetEnumerator) or a
7319 "member name" with an explicit interface name
7320 (IEnumerable.GetEnumerator).
7321 In GMCS, the explicit interface name may include type arguments
7322 (IEnumerable<T>.GetEnumerator).
7323 * we use `member_name' instead of just `IDENTIFIER' for
7325 The rule is that we use `member_name' wherever a member may
7326 have type parameters in GMCS.
7328 * decl.cs (MemberName): New public class.
7329 (MemberCore.MemberName): New public readonly field.
7330 (MemberCore.ctor): Take a `MemberName' argument, not a string.
7331 (DeclSpace): Likewise.
7333 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
7334 * enum.cs (Enum.ctor): Likewise.
7336 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
7338 (AliasEntry.ctor): Take a MemberName, not an Expression.
7339 (AliasEntry.UsingAlias): Likewise.
7341 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
7342 (IMethodData.MemberName): Changed type from string to MemberName.
7343 (MemberBase.ExplicitInterfaceName): Likewise.
7344 (AbstractPropertyEventMethod.SetupName): Make this private.
7345 (AbstractPropertyEventMethod.ctor): Added `string prefix'
7346 argument; compute the member name here.
7347 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
7348 on the `member.MemberName' and the `prefix'.
7350 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
7352 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
7353 thus, we get a `MemberName' instead of a `string'. These
7354 declarations may have type parameters in GMCS.
7355 (interface_method_declaration, delegate_declaration): Likewise.
7356 (class_declaration, interface_declaration): Likewise.
7357 (method_header): Use `namespace_or_type_name' instead of
7358 `member_name'. We may be an explicit interface implementation.
7359 (property_declaration, event_declaration): Likewise.
7360 (member_name): This is now just an `IDENTIFIER', not a
7361 `namespace_or_type_name'.
7362 (type_name, interface_type): Removed.
7363 (namespace_or_type_name): Return a MemberName, not an Expression.
7364 (primary_expression): Use `member_name' instead of `IDENTIFIER';
7365 call GetTypeExpression() on the MemberName to get an expression.
7366 (IndexerDeclaration.interface_type): Changed type from string to
7368 (MakeName): Operate on MemberName's instead of string's.
7370 2004-09-13 Raja R Harinath <rharinath@novell.com>
7373 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
7374 (NamespaceEntry.Lookup): Add new argument to flag if we want the
7375 lookup to avoid symbols introduced by 'using'.
7376 * rootcontext.cs (NamespaceLookup): Update.
7378 2004-09-12 Marek Safar <marek.safar@seznam.cz>
7380 * class.cs (TypeContainer.DoDefineMembers): Do not call
7381 DefineDefaultConstructor for static classes.
7383 2004-09-12 Marek Safar <marek.safar@seznam.cz>
7385 * attribute.cs (Attribute.Resolve): Add error 653 report.
7387 * class.cs (Class.ApplyAttributeBuilder): Add error 641
7389 (Method.ApplyAttributeBuilder): Add error 685 report.
7390 (Operator.Define): Add error 564 report.
7392 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
7394 * expression.cs (Invocation.DoResolve): Add error
7397 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
7400 2004-09-11 Marek Safar <marek.safar@seznam.cz>
7402 * class.cs (ConstructorInitializer.Resolve):
7403 Wrong error number (515->516).
7405 2004-09-11 Marek Safar <marek.safar@seznam.cz>
7407 * class.cs (Indexer.Define): Add error 631 report.
7409 2004-09-11 Marek Safar <marek.safar@seznam.cz>
7411 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
7413 2004-09-11 Marek Safar <marek.safar@seznam.cz>
7415 * expression.cs (Probe.DoResolve): Add error CS0241 report.
7417 2004-09-10 Marek Safar <marek.safar@seznam.cz>
7419 * cs-parser.jay: Added error CS0241 report.
7421 2004-09-10 Raja R Harinath <rharinath@novell.com>
7423 * cs-parser.jay (fixed_statement): Introduce a scope for the
7424 declaration in the 'fixed' statement.
7426 2004-09-09 Marek Safar <marek.safar@seznam.cz>
7428 * cs-parser.jay: Added CS0230 error report.
7430 2004-09-09 Marek Safar <marek.safar@seznam.cz>
7432 * cs-parser.jay: Added errors CS0231 and CS0257 report.
7434 2004-09-09 Marek Safar <marek.safar@seznam.cz>
7436 * expression.cs (Argument.Resolve): Added error CS0192 and
7439 2004-09-09 Marek Safar <marek.safar@seznam.cz>
7441 C# 2.0 #pragma warning feature
7443 * cs-tokenizer.cs (PreProcessPragma): New method;
7444 Handles #pragma directive.
7446 * report.cs (WarningRegions): New class; Support
7447 class for #pragma warning directive. It tests whether
7448 warning is enabled for a given line.
7450 2004-09-08 Miguel de Icaza <miguel@ximian.com>
7452 * const.cs: Add more descriptive error report, tahnks to
7455 2004-09-08 Marek Safar <marek.safar@seznam.cz>
7457 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
7459 2004-09-07 Miguel de Icaza <miguel@ximian.com>
7461 * expression.cs: Apply patch from Ben: Remove dead code from
7462 ArrayCreation, and remove the TurnintoConstant call in const.cs,
7463 as that code just threw an exception anwyays.
7465 * const.cs: Remove the call to the turnintoconstant, for details
7468 * literal.cs: The type of the null-literal is the null type; So
7469 we use a placeholder type (literal.cs:System.Null, defined here)
7472 * expression.cs (Conditional.DoResolve): Remove some old code that
7473 is no longer needed, conversions have been fixed.
7475 (ArrayCreationExpression.DoResolve): Return false if we fail to
7476 resolve the inner expression.
7478 2004-09-07 Raja R Harinath <rharinath@novell.com>
7481 * cs-parser.jay (delegate_declaration): Record a delegate
7482 declaration as a type declaration.
7483 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
7485 2004-09-06 Miguel de Icaza <miguel@ximian.com>
7487 * parameter.cs: Do not crash if the type can not be resolved.
7489 * expression.cs: Report errors with unsafe pointers, fixes #64896
7491 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
7493 * expression.cs: Pointer arith always needs to do a conv.i
7494 if the operand is a long. fix 65320
7496 2004-09-04 Marek Safar <marek.safar@seznam.cz>
7498 Fixed cs0619-37.cs, cs0619-38.cs
7500 * enum.cs (GetObsoleteAttribute): Removed.
7502 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
7503 on Enum member is double staged. The first is tested member
7506 2004-09-04 Marek Safar <marek.safar@seznam.cz>
7508 Fixed #56986, #63631, #65231
7510 * class.cs: (TypeContainer.AddToMemberContainer): New method,
7511 adds member to name container.
7512 (TypeContainer.AddToTypeContainer): New method, adds type to
7514 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
7515 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
7516 AddOperator): Simplified by reusing AddToMemberContainer.
7517 (TypeContainer.UserDefinedStaticConstructor): Changed to property
7519 (Method.CheckForDuplications): Fixed implementation to test all
7521 (MemberBase): Detection whether member is explicit interface
7522 implementation is now in constructor.
7523 (MemberBase.UpdateMemberName): Handles IndexerName.
7524 (Accessor): Changed to keep also location information.
7525 (AbstractPropertyEventMethod): Is derived from MemberCore.
7526 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
7527 will be emited or not.
7528 (PropertyBase.AreAccessorsDuplicateImplementation):
7529 Tests whether accessors are not in collision with some method.
7530 (Operator): Is derived from MethodCore to simplify common
7533 * decl.cs (Flags.TestMethodDuplication): Test for duplication
7535 (DeclSpace.AddToContainer): Adds the member to defined_names
7536 table. It tests for duplications and enclosing name conflicts.
7538 * enum.cs (EnumMember): Clean up to reuse the base structures
7540 2004-09-03 Martin Baulig <martin@ximian.com>
7542 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
7543 into TypeContainer, to make partial classes work again.
7545 2004-09-03 Martin Baulig <martin@ximian.com>
7547 * rootcontext.cs (RootContext.V2): Removed.
7549 2004-03-23 Martin Baulig <martin@ximian.com>
7551 * expression.cs (Invocation.OverloadResolve): Added `bool
7552 may_fail' argument and use it instead of the Location.IsNull() hack.
7554 2004-09-03 Martin Baulig <martin@ximian.com>
7556 Merged latest changes into gmcs. Please keep this comment in
7557 here, it makes it easier for me to see what changed in MCS since
7558 the last time I merged.
7560 2004-09-03 Raja R Harinath <rharinath@novell.com>
7563 * expression.cs (BetterConversion): Don't allow either conversion
7564 to be null. Remove redundant implicit conversion test when 'q ==
7565 null' -- when this function is invoked, we already know that the
7566 implicit conversion exists.
7567 (BetterFunction): Assume that 'best' is non-null. Remove
7568 redundant reimplementation of IsApplicable when 'best' is null.
7569 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
7570 number of arguments.
7571 (IsAncestralType): Extract from OverloadResolve.
7572 (OverloadResolve): Make robust to the MethodGroupExpr being
7573 unsorted. Implement all the logic of Section 14.5.5.1, and
7574 support overloading of methods from multiple applicable types.
7575 Clean up logic somewhat. Don't pass null methods to BetterFunction.
7577 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
7578 (RealError, Warning): Append type of report to related symbol.
7580 2004-09-03 Marek Safar <marek.safar@seznam.cz>
7582 * enum.cs: Fixed CLS-Compliance checks for enum members.
7583 Error tests cs3008-8.cs, cs3014-8.cs
7585 2004-09-02 Marek Safar <marek.safar@seznam.cz>
7587 Fixed bug #62342, #63102
7588 * class.cs: ImplementIndexer uses member.IsExplicitImpl
7589 like ImplementMethod.
7591 2004-09-02 Marek Safar <marek.safar@seznam.cz>
7593 * attribute.cs (Attribute.GetAttributeArgumentExpression):
7596 2004-09-02 Martin Baulig <martin@ximian.com>
7598 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
7599 TypeManager.GetArgumentTypes() rather than calling GetParameters()
7602 2004-09-01 Marek Safar <marek.safar@seznam.cz>
7604 C# 2.0 Static classes implemented
7606 * class.cs (TypeContainer): instance_constructors,
7607 initialized_fields, initialized_static_fields,
7608 default_constructor, base_inteface_types are protected to be
7609 accessible from StaticClass.
7610 (TypeContainer.DefineDefaultConstructor): New virtual method
7611 for custom default constructor generating
7612 (StaticClass): New class to handle "Static classes" feature.
7614 * cs-parser.jay: Handle static keyword on class like instance
7617 * driver.cs: Added "/langversion" command line switch with two
7618 options (iso-1, default).
7620 2004-08-31 Marek Safar <marek.safar@seznam.cz>
7622 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
7624 2004-08-31 Miguel de Icaza <miguel@ximian.com>
7626 * delegate.cs: Style.
7628 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
7630 * delegate.cs: Add seperate instance expr field for miguel.
7632 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
7634 * PointerArithmetic (Resolve): make sure we are not doing
7635 pointer arith on void*. Also, make sure we are resolved
7636 by not setting eclass until resolve.
7638 All callers: Make sure that PointerArithmetic gets resolved.
7640 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
7642 * ArrayCreation (LookupType): If the type does not resolve
7643 to an array, give an error.
7645 2004-08-27 Marek Safar <marek.safar@seznam.cz>
7647 * statement.cs (Try.Resolve): Fixed bug #64222
7649 2004-08-27 Martin Baulig <martin@ximian.com>
7652 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
7655 2004-08-26 Marek Safar <marek.safar@seznam.cz>
7657 * ecore.cs (Constantify): Get underlying type via
7658 System.Enum.GetUnderlyingType to avoid StackOverflow on the
7659 Windows in special cases.
7661 2004-08-26 Marek Safar <marek.safar@seznam.cz>
7663 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
7664 for obtaining also private methods.
7665 (GetRemoveMethod): Used GetRemoveMethod (true)
7666 for obtaining also private methods.
7668 2004-08-24 Martin Baulig <martin@ximian.com>
7670 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
7671 MethodAttributes.HideBySig for operators.
7673 2004-08-23 Martin Baulig <martin@ximian.com>
7675 Back to the old error reporting system :-)
7677 * report.cs (Message): Removed.
7678 (Report.MessageData, ErrorData, WarningData): Removed.
7679 (Report.Error, Warning): Back to the old system.
7681 2004-08-23 Martin Baulig <martin@ximian.com>
7683 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
7685 * class.cs (TypeContainer.ParentContainer): New public virtual
7686 method; replaces the explicit interface implementation.
7687 (ClassPart.ParentContainer): Override.
7689 2004-08-23 Martin Baulig <martin@ximian.com>
7691 * statement.cs (Switch): Added support for constant switches; see
7692 #59428 or test-285.cs.
7694 2004-08-22 Marek Safar <marek.safar@seznam.cz>
7697 * statement.cs (GetEnumeratorFilter): Removed useless
7698 logic because C# specs is strict. GetEnumerator must be
7701 2004-08-22 Martin Baulig <martin@ximian.com>
7703 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
7704 a switch and may break, reset the barrier. Fixes #59867.
7706 2004-08-22 Marek Safar <marek.safar@seznam.cz>
7708 CLS-Compliance speed up (~5% for corlib)
7710 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
7711 New method. Tests container for CLS-Compliant names
7713 * class.cs (TypeContainer.VerifyClsName): New method.
7714 Checks whether container name is CLS Compliant.
7715 (Constructor): Implements IMethodData.
7717 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
7718 low-case table for CLS Compliance test.
7719 (MemberCache.VerifyClsParameterConflict): New method.
7720 Checks method parameters for CS3006 error.
7722 * enum.cs (EnumMember): Is derived from MemberCore.
7723 (Enum.VerifyClsName): Optimized for better performance.
7725 2004-08-06 Marek Safar <marek.safar@seznam.cz>
7727 * report.cs: Renamed Error_T to Error and changed all
7730 2004-08-06 Marek Safar <marek.safar@seznam.cz>
7732 * class.cs (TypeContainer.IndexerArrayList): New inner class
7733 container for indexers.
7734 (TypeContainer.DefaultIndexerName): New constant for default
7735 indexer name. Replaced all "Item" with this constant.
7736 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
7738 * typemanager.cs (TypeManager.default_member_ctor): Cache here
7739 DefaultMemberAttribute constructor.
7741 2004-08-05 Martin Baulig <martin@ximian.com>
7743 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
7746 2004-08-05 Marek Safar <marek.safar@seznam.cz>
7748 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
7749 multi platforms problem.
7751 * compiler.csproj: Included shared files.
7753 2004-08-04 Marek Safar <marek.safar@seznam.cz>
7755 Fix bug 60333, 55971 in the more general way
7756 * attribute.cs (Attribute.GetAttributeArgumentExpression):
7757 Added arg_type argument for constant conversion.
7758 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
7760 2004-08-04 Marek Safar <marek.safar@seznam.cz>
7763 * class.cs (TypeContainer ): New inner classes MethodArrayList,
7764 OperatorArrayList, MethodCoreArrayList for typecontainer
7765 containers. Changed class member types to these new types.
7766 (MethodArrayList.DefineMembers): Added test for CS0659.
7768 2004-08-04 Miguel de Icaza <miguel@ximian.com>
7770 * cfold.cs: Synchronize the folding with the code in expression.cs
7771 Binary.DoNumericPromotions for uint operands.
7773 * attribute.cs: Revert patch from Raja, it introduced a regression
7774 while building Blam-1.2.1 (hard to isolate a test case).
7776 2004-08-04 Marek Safar <marek.safar@seznam.cz>
7780 (TypeContainer.Define): Renamed to DefineContainerMembers because of
7782 (MethodCore.parent_method): New member. The method we're overriding
7783 if this is an override method.
7784 (MethodCore.CheckBase): Moved from Method class and made common.
7785 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
7787 (MethodCore.CheckForDuplications): New abstract method. For custom
7788 member duplication search in a container
7789 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
7790 method and its return type.
7791 (Event.conflict_symbol): New member. Symbol with same name in the
7795 (MemberCache.FindMemberWithSameName): New method. The method
7796 is looking for conflict with inherited symbols.
7798 2004-08-04 Martin Baulig <martin@ximian.com>
7800 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
7802 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
7804 2004-08-03 Marek Safar <marek.safar@seznam.cz>
7806 * report.cs (Message): New enum for better error, warning reference in
7808 (MessageData): New inner abstract class. It generally handles printing of
7809 error and warning messages.
7810 Removed unused Error, Warning, Message methods.
7812 2004-08-03 Marek Safar <marek.safar@seznam.cz>
7814 Fix for cs0592-8.cs test
7816 (Attributable.ValidAttributeTargets): Made public.
7817 (Attribute.ExplicitTarget): New member for explicit target value.
7818 (Attribute.CheckTargets): Now we translate explicit attribute
7819 target to Target here.
7821 2004-08-03 Ben Maurer <bmaurer@ximian.com>
7823 * ecore.cs (MethodGroupExpr): new IsBase property.
7825 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
7827 * delegate.cs (DelegateCreation): store a MethodGroupExpr
7828 rather than an instance expr.
7830 (DelegateCreation.Emit): Use the method group rather than
7831 the instance expression. Also, if you have base.Foo as the
7832 method for a delegate, make sure to emit ldftn, not ldftnvirt.
7834 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
7836 (NewDelegate.DoResolve): Only check for the existance of Invoke
7837 if the method is going to be needed. Use MethodGroupExpr.
7839 (NewDelegate.Emit): Remove, DelegateCreation implements this.
7841 * expression.cs: For pointer arith., make sure to use
7842 the size of the type, not the size of the pointer to
7845 2004-08-03 Marek Safar <marek.safar@seznam.cz>
7848 * class.cs (Class): Added error CS0502 test.
7850 2004-08-03 John Luke <jluke@cfl.rr.com>
7851 Raja R Harinath <rharinath@novell.com>
7854 * attribute.cs (Attribute.complained_before): New flag.
7855 (Attribute.ResolveType, Attribute.Resolve),
7856 (Attribute.DefinePInvokeMethod): Set it.
7857 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
7859 2004-08-03 Martin Baulig <martin@ximian.com>
7861 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
7862 use a user-defined operator; we still need to do numeric
7863 promotions in case one argument is a builtin type and the other
7864 one has an implicit conversion to that type. Fixes #62322.
7866 2004-08-02 Martin Baulig <martin@ximian.com>
7868 * statement.cs (LocalInfo.Flags): Added `IsThis'.
7869 (LocalInfo.IsThis): New public property.
7870 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
7872 2004-08-01 Martin Baulig <martin@ximian.com>
7874 * class.cs (TypeContainer.GetClassBases): Don't set the default
7875 here since we may get called from GetPartialBases().
7876 (TypeContainer.DefineType): If GetClassBases() didn't return a
7877 parent, use the default one.
7879 2004-07-30 Duncan Mak <duncan@ximian.com>
7881 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
7883 2004-07-30 Martin Baulig <martin@ximian.com>
7885 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
7887 * class.cs (SourceMethod): New public class, derive from the
7888 symbol writer's ISourceMethod.
7889 (Method): Use the new symbol writer API.
7891 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
7892 as argument and use the new symbol writer.
7895 (SourceFile): Implement the symbol writer's ISourceFile.
7896 (Location.SymbolDocument): Removed.
7897 (Location.SourceFile): New public property.
7899 * symbolwriter.cs: Use the new symbol writer API.
7901 2004-07-30 Raja R Harinath <rharinath@novell.com>
7903 * Makefile (install-local): Remove. Functionality moved to
7906 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
7908 * Makefile: Install mcs.exe.config file together with mcs.exe.
7909 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
7910 correct runtime version.
7912 2004-07-25 Martin Baulig <martin@ximian.com>
7915 (TypeContainer.RegisterOrder): Removed, this was unused.
7916 (TypeContainer, interface_order): Removed.
7917 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
7918 TypeContainer as argument since we can also be called with a
7919 `PartialContainer' for a partial class/struct/interface.
7920 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
7921 of checking whether we're an `Interface' - we could be a
7923 (PartialContainer.Register): Override; call
7924 AddClass()/AddStruct()/AddInterface() on our parent.
7926 * cs-parser.jay (interface_member_declaration): Add things to the
7927 `current_container', not the `current_class'.
7929 * rootcontext.cs (RegisterOrder): The overloaded version which
7930 takes an `Interface' was unused, removed.
7932 * typemanager.cs (TypeManager.LookupInterface): Return a
7933 `TypeContainer', not an `Interface'.
7934 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
7935 contain a `PartialContainer' for an interface, so check it's
7936 `Kind' to figure out what it is.
7938 2004-07-25 Martin Baulig <martin@ximian.com>
7940 * class.cs (Class.DefaultTypeAttributes): New public constant.
7941 (Struct.DefaultTypeAttributes): Likewise.
7942 (Interface.DefaultTypeAttributes): Likewise.
7943 (PartialContainer.TypeAttr): Override this and add the
7944 DefaultTypeAttributes.
7946 2004-07-25 Martin Baulig <martin@ximian.com>
7948 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
7949 we can just use the `Parent' field instead.
7951 2004-07-25 Martin Baulig <martin@ximian.com>
7953 * class.cs (TypeContainer.Emit): Renamed to EmitType().
7955 2004-07-25 Martin Baulig <martin@ximian.com>
7957 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
7958 our parts before defining any methods.
7959 (TypeContainer.VerifyImplements): Make this virtual.
7960 (ClassPart.VerifyImplements): Override and call VerifyImplements()
7961 on our PartialContainer.
7963 2004-07-25 Martin Baulig <martin@ximian.com>
7965 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
7967 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
7968 argument, we can just use the `Parent' field instead.
7971 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
7972 (MemberBase.DoDefine): Likewise.
7974 2004-07-24 Martin Baulig <martin@ximian.com>
7976 * decl.cs (MemberCore.Parent): New public field.
7977 (DeclSpace.Parent): Moved to MemberCore.
7979 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
7980 (MemberBase.ctor): Added TypeContainer argument, pass it to our
7982 (FieldBase, Field, Operator): Likewise.
7983 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
7984 (EventField, Event): Likewise.
7986 2004-07-23 Martin Baulig <martin@ximian.com>
7988 * class.cs (PartialContainer): New public class.
7989 (ClassPart): New public class.
7990 (TypeContainer): Added support for partial classes.
7991 (TypeContainer.GetClassBases): Splitted some of the functionality
7992 out into GetNormalBases() and GetPartialBases().
7994 * cs-tokenizer.cs (Token.PARTIAL): New token.
7995 (Tokenizer.consume_identifier): Added some hacks to recognize
7996 `partial', but only if it's immediately followed by `class',
7997 `struct' or `interface'.
7999 * cs-parser.jay: Added support for partial clases.
8001 2004-07-23 Martin Baulig <martin@ximian.com>
8003 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
8004 a `DeclSpace' and also made it readonly.
8005 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
8006 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
8007 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
8009 * cs-parser.jay: Pass the `current_class', not the
8010 `current_container' (at the moment, this is still the same thing)
8011 to a new Method, Property, Event, Indexer or Constructor.
8013 2004-07-23 Martin Baulig <martin@ximian.com>
8015 * cs-parser.jay (CSharpParser): Added a new `current_class' field
8016 and removed the `current_interface' one.
8017 (struct_declaration, class_declaration, interface_declaration):
8018 Set `current_class' to the newly created class/struct/interface;
8019 set their `Bases' and call Register() before parsing their body.
8021 2004-07-23 Martin Baulig <martin@ximian.com>
8023 * class.cs (Kind): New public enum.
8024 (TypeContainer): Made this class abstract.
8025 (TypeContainer.Kind): New public readonly field.
8026 (TypeContainer.CheckDef): New public method; moved here from
8028 (TypeContainer.Register): New public abstract method.
8029 (TypeContainer.GetPendingImplementations): New public abstract
8031 (TypeContainer.GetClassBases): Removed the `is_class' and
8032 `is_iface' parameters.
8033 (TypeContainer.DefineNestedTypes): Formerly known as
8035 (ClassOrStruct): Made this class abstract.
8037 * tree.cs (RootTypes): New public type.
8039 2004-07-20 Martin Baulig <martin@ximian.com>
8041 * tree.cs (Tree.RecordNamespace): Removed.
8042 (Tree.Namespaces): Removed.
8044 * rootcontext.cs (RootContext.IsNamespace): Removed.
8046 * cs-parser.jay (namespace_declaration): Just create a new
8047 NamespaceEntry here.
8049 2004-07-20 Martin Baulig <martin@ximian.com>
8051 * statement.cs (ExceptionStatement): New abstract class. This is
8052 now used as a base class for everyone who's using `finally'.
8053 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
8054 our local variables before using them.
8056 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
8057 virtual method. This is used by Yield.Resolve() to "steal" an
8058 outer block's `finally' clauses.
8059 (FlowBranchingException): The .ctor now takes an ExceptionStatement
8062 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
8063 version which takes an ExceptionStatement. This version must be
8064 used to create exception branchings.
8067 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
8068 (Iterator.EmitMoveNext): Added exception support; protect the
8069 block with a `fault' clause, properly handle 'finally' clauses.
8070 (Iterator.EmitDispose): Run all the `finally' clauses here.
8072 2004-07-20 Martin Baulig <martin@ximian.com>
8074 * iterator.cs: This is the first of a set of changes in the
8075 iterator code. Match the spec more closely: if we're an
8076 IEnumerable, then GetEnumerator() must be called. The first time
8077 GetEnumerator() is called, it returns the current instance; all
8078 subsequent invocations (if any) must create a copy.
8080 2004-07-19 Miguel de Icaza <miguel@ximian.com>
8082 * expression.cs: Resolve the constant expression before returning
8085 2004-07-19 Martin Baulig <martin@ximian.com>
8087 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
8088 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
8089 the return type of the new EmitContext.
8091 2004-07-18 Martin Baulig <martin@ximian.com>
8093 * class.cs (Property.Define): Fix iterators.
8095 * iterators.cs (Iterator.Define): Moved the
8096 `container.AddInterator (this)' call here from the .ctor; only do
8097 it if we resolved successfully.
8099 2004-07-17 Miguel de Icaza <miguel@ximian.com>
8101 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
8102 `true' for preprocessing directives that we parse. The return
8103 value indicates whether we should return to regular tokenizing or
8104 not, not whether it was parsed successfully.
8106 In the past if we were in: #if false ... #line #endif, we would
8107 resume parsing after `#line'. See bug 61604.
8109 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
8110 building: IsEnumType should return true only for enums, not for
8111 enums or System.Enum itself. This fixes #61593.
8113 Likely what happened is that corlib was wrong: mcs depended on
8114 this bug in some places. The bug got fixed, we had to add the
8115 hack, which caused bug 61593.
8117 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
8118 that was a workaround for the older conditions.
8120 2004-07-16 Ben Maurer <bmaurer@ximian.com>
8122 * assign.cs: IAssignMethod has a new interface, as documented
8123 inline. All assignment code now uses this new api.
8125 * ecore.cs, expression.cs: All classes which implement
8126 IAssignMethod now use the new interface.
8128 * expression.cs (Invocation): add a hack to EmitCall so that
8129 IndexerAccess can be the target of a compound assignment without
8130 evaluating its arguments twice.
8132 * statement.cs: Handle changes in Invocation api.
8134 2004-07-16 Martin Baulig <martin@ximian.com>
8136 * iterators.cs: Rewrote this. We're now using one single Proxy
8137 class for both the IEnumerable and the IEnumerator interface and
8138 `Iterator' derives from Class so we can use the high-level API.
8140 * class.cs (TypeContainer.AddIterator): New method.
8141 (TypeContainer.DoDefineType): New protected virtual method, which
8142 is called from DefineType().
8143 (TypeContainer.DoDefineMembers): Call DefineType() and
8144 DefineMembers() on all our iterators.
8145 (TypeContainer.Emit): Call Emit() on all our iterators.
8146 (TypeContainer.CloseType): Call CloseType() on all our iterators.
8148 * codegen.cs (EmitContext.CurrentIterator): New public field.
8150 2004-07-15 Martin Baulig <martin@ximian.com>
8153 (TypeManager.not_supported_exception_type): New type.
8155 2004-07-14 Martin Baulig <martin@ximian.com>
8157 * iterators.cs: Use real error numbers.
8159 2004-07-14 Martin Baulig <martin@ximian.com>
8161 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
8162 requires this to be a System.Collection.IEnumerable and not a
8163 class implementing that interface.
8164 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
8166 2004-07-13 Marek Safar <marek.safar@seznam.cz>
8168 * class.cs: Fixed previous fix, it broke some error tests.
8170 2004-07-12 Martin Baulig <martin@ximian.com>
8172 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
8175 2004-07-09 Miguel de Icaza <miguel@ximian.com>
8177 * assign.cs (LocalTemporary): Add new argument: is_address,If
8178 `is_address' is true, then the value that we store is the address
8179 to the real value, and not the value itself.
8181 * ecore.cs (PropertyExpr): use the new local temporary
8182 stuff to allow us to handle X.Y += z (where X is a struct)
8184 2004-07-08 Martin Baulig <martin@ximian.com>
8186 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
8187 not always return, just like we're doing in Using.Resolve().
8189 2004-07-07 Miguel de Icaza <miguel@ximian.com>
8191 * cs-parser.jay (fixed_statement): flag this as Pinned.
8193 2004-07-06 Miguel de Icaza <miguel@ximian.com>
8195 * typemanager.cs (TypeManager): Removed MakePinned method, this
8196 mechanism is replaced with the .NET 2.x compatible mechanism of
8197 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
8199 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
8200 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
8201 `IsFixed' property which has a different meaning.
8203 2004-07-02 Raja R Harinath <rharinath@novell.com>
8205 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
8206 visible from inside a nested class, not just the names of the
8207 immediately enclosing class.
8210 2004-06-24 Raja R Harinath <rharinath@novell.com>
8212 * expression.cs (BetterConversion): Remove buggy special-case
8213 handling of "implicit constant expression conversions". At this
8214 point, we already know that the conversion is possible -- we're
8215 only checking to see which is better.
8217 2004-06-24 Marek Safar <marek.safar@seznam.cz>
8219 * cs-parser.jay: Added error CS0210 test.
8221 2004-06-24 Marek Safar <marek.safar@seznam.cz>
8223 * cs-parser.jay: Added error CS0134 test.
8225 2004-06-24 Marek Safar <marek.safar@seznam.cz>
8228 * cs-parser.jay: Added error CS0145 test.
8230 2004-06-24 Marek Safar <marek.safar@seznam.cz>
8232 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
8234 2004-06-23 Ben Maurer <bmaurer@ximian.com>
8236 * expression.cs (StackAlloc.Resolve): The argument may not
8237 be a constant; deal with this case.
8239 2004-06-23 Marek Safar <marek.safar@seznam.cz>
8241 * attribute.cs (IndexerName_GetIndexerName): Renamed to
8242 GetIndexerAttributeValue.
8243 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
8245 * class.cs (Indexer.Define): Added error tests for CS0415,
8248 2004-06-23 Miguel de Icaza <miguel@ximian.com>
8250 * attribute.cs (Attribute.Resolve): Keep field code in sync with
8253 2004-06-23 Martin Baulig <martin@ximian.com>
8255 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
8256 neither return nor throw, reset the barrier as well. Fixes #60457.
8258 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
8260 * class.cs : EventAttributes is now set to None by default.
8261 This fixes bug #60459.
8263 2004-06-18 Marek Safar <marek.safar@seznam.cz>
8266 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
8267 Don't throw exception but return null (it's sufficient now).
8269 2004-06-18 Marek Safar <marek.safar@seznam.cz>
8271 * typemanager.cs (GetArgumentTypes): Faster implementation.
8273 2004-06-18 Martin Baulig <martin@ximian.com>
8275 * attribute.cs (Attribute.Resolve): Check whether we're an
8276 EmptyCast which a Constant child. Fixes #60333.
8278 2004-06-17 Ben Maurer <bmaurer@ximian.com>
8280 * statement.cs (EmitCollectionForeach): Account for the fact that
8281 not all valuetypes are in areas which we can take the address of.
8282 For these variables, we store to a temporary variable. Also, make
8283 sure that we dont emit a `callvirt' on a valuetype method.
8285 2004-06-15 Marek Safar <marek.safar@seznam.cz>
8287 * expression.cs (StackAlloc.DoReSolve): Added test for
8288 negative parameter (CS0247).
8290 2004-06-15 Marek Safar <marek.safar@seznam.cz>
8293 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
8295 2004-06-15 Marek Safar <marek.safar@seznam.cz>
8298 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
8301 2004-06-14 Marek Safar <marek.safar@seznam.cz>
8303 Fix bug #58254 & cs1555.cs, cs1556.cs
8304 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
8306 2004-06-14 Marek Safar <marek.safar@seznam.cz>
8308 * cs-parser.jay: Added error CS1669 test for indexers.
8310 2004-06-11 Martin Baulig <martin@ximian.com>
8312 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
8313 call this twice: for params and varargs methods.
8315 2004-06-11 Marek Safar <marek.safar@seznam.cz>
8318 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
8320 2004-06-11 Marek Safar <marek.safar@seznam.cz>
8322 * attribute.cs (Attribute.GetValidTargets): Made public.
8325 (AbstractPropertyEventMethod): New class for better code sharing.
8326 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
8328 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
8330 2004-06-11 Raja R Harinath <rharinath@novell.com>
8333 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
8334 that the call to Resolve is part of a MemberAccess.
8335 (Expression.Resolve): Use it for SimpleName resolution.
8336 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
8337 Add 'intermediate' boolean argument.
8338 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
8339 error message when the SimpleName can be resolved ambiguously
8340 between an expression and a type.
8341 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
8343 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
8344 call on the left-side.
8346 2004-06-11 Marek Safar <marek.safar@seznam.cz>
8349 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
8351 2004-06-11 Marek Safar <marek.safar@seznam.cz>
8353 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
8355 2004-06-11 Martin Baulig <martin@ximian.com>
8357 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
8358 varargs methods if applicable.
8360 2004-06-11 Martin Baulig <martin@ximian.com>
8362 * expression.cs (Invocation.EmitCall): Don't use
8363 `method.CallingConvention == CallingConventions.VarArgs' since the
8364 method could also have `CallingConventions.HasThis'.
8366 2004-06-11 Marek Safar <marek.safar@seznam.cz>
8368 * class.cs (Event.GetSignatureForError): Implemented.
8369 Fixed crash in error test cs3010.cs
8371 2004-06-10 Miguel de Icaza <miguel@ximian.com>
8373 * cs-tokenizer.cs: Change the way we track __arglist to be
8374 consistent with the other keywords.
8376 2004-06-09 Miguel de Icaza <miguel@ximian.com>
8378 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
8381 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
8383 * codegen.cs: Check that all referenced assemblies have a strongname
8384 before strongnaming the compiled assembly. If not report error CS1577.
8385 Fix bug #56563. Patch by Jackson Harper.
8386 * typemanager.cs: Added a method to return all referenced assemblies.
8387 Fix bug #56563. Patch by Jackson Harper.
8389 2004-06-08 Marek Safar <marek.safar@seznam.cz>
8392 (Method.ApplyAttributeBuilder): Moved and added conditional
8393 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
8396 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
8398 2004-06-08 Marek Safar <marek.safar@seznam.cz>
8401 * class.cs: (EventField.attribute_targets): Changed default target.
8403 2004-06-08 Martin Baulig <martin@ximian.com>
8405 * expression.cs (Invocation.EmitCall): Enable varargs methods.
8407 2004-06-08 Martin Baulig <martin@ximian.com>
8409 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
8411 2004-06-07 Martin Baulig <martin@ximian.com>
8413 Added support for varargs methods.
8415 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
8418 * cs-parser.jay: Added support for `__arglist'.
8420 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
8422 * expression.cs (Argument.AType): Added `ArgList'.
8423 (Invocation): Added support for varargs methods.
8424 (ArglistAccess): New public class.
8425 (Arglist): New public class.
8427 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
8429 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
8430 a method's top-level block if the method has varargs.
8432 * support.cs (ReflectionParameters, InternalParameters): Added
8433 support for varargs methods.
8435 2004-06-07 Miguel de Icaza <miguel@ximian.com>
8437 * class.cs: Provide location in indexer error report.
8439 * driver.cs: Use standard names.
8441 * namespace.cs: Catch the use of using after a namespace has been
8442 declared also on using aliases.
8444 2004-06-03 Raja R Harinath <rharinath@novell.com>
8447 * typemanager.cs (closure_private_ok, closure_invocation_type)
8448 (closure_qualifier_type, closure_invocation_assembly)
8449 (FilterWithClosure): Move to ...
8450 (Closure): New internal nested class.
8451 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
8452 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
8453 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
8454 (MemberLookup, MemberLookupFailed): Use it.
8455 * expression.cs (New.DoResolve): Treat the lookup for the
8456 constructor as being qualified by the 'new'ed type.
8457 (Indexers.GetIndexersForTypeOrInterface): Update.
8459 2004-06-03 Marek Safar <marek.safar@seznam.cz>
8462 (GetConditionalAttributeValue): New method. Returns
8463 condition of ConditionalAttribute.
8464 (SearchMulti): New method. Returns all attributes of type 't'.
8465 Use it when attribute is AllowMultiple = true.
8466 (IsConditionalMethodExcluded): New method.
8469 (Method.IsExcluded): Implemented. Returns true if method has conditional
8470 attribute and the conditions is not defined (method is excluded).
8471 (IMethodData): Extended interface for ConditionalAttribute support.
8472 (PropertyMethod.IsExcluded): Implemented.
8475 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
8478 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
8481 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
8483 * expression.cs (ArrayCreationExpression): Make this just an
8484 `expression'. It can't be a statement, so the code here was
8487 2004-06-02 Marek Safar <marek.safar@seznam.cz>
8490 * typemanager.cs (GetFullNameSignature): New method for
8493 2004-06-02 Marek Safar <marek.safar@seznam.cz>
8496 * class.cs (MemberBase.GetSignatureForError): New virtual method.
8497 Use this method when MethodBuilder is null.
8498 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
8499 Added test for error CS0626 (MONO reports error for this situation).
8500 (IMethodData.GetSignatureForError): Extended interface.
8502 2004-06-01 Marek Safar <marek.safar@seznam.cz>
8505 (AttributeTester.GetObsoleteAttribute): Returns instance of
8506 ObsoleteAttribute when type is obsolete.
8509 (TypeContainer.VerifyObsoleteAttribute): Override.
8510 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
8511 (MethodCode.VerifyObsoleteAttribute): Override.
8512 (MemberBase.VerifyObsoleteAttribute): Override.
8515 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
8516 and report proper error.
8519 Delegate.VerifyObsoleteAttribute): Override.
8522 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
8523 and report proper error.
8524 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
8527 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
8531 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
8532 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
8533 Added test for ObsoleteAttribute.
8536 (Catch): Derived from Statement.
8538 2004-06-01 Marek Safar <marek.safar@seznam.cz>
8540 Fixed bug #59071 & cs0160.cs
8542 * statement.cs (Try.Resolve): Check here whether order of catch
8543 clauses matches their dependencies.
8545 2004-05-31 Miguel de Icaza <miguel@ximian.com>
8547 * Reverted patch to namespace.cs (Use lookuptypedirect). This
8548 caused a regression: #59343. Referencing nested classes from an
8549 assembly stopped working.
8551 2004-05-31 Martin Baulig <martin@ximian.com>
8553 MCS is now frozen for beta 2.
8555 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
8557 * convert.cs: add a trivial cache for overload operator resolution.
8559 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
8561 * decl.cs: If possible, use lookuptypedirect here. We can only do
8562 this if there is no `.' after the namespace. Avoids using
8563 LookupType, which does lots of slow processing.
8564 (FindNestedType) New method, does what it says :-).
8565 * namespace.cs: use LookupTypeDirect.
8566 * rootcontext.cs: use membercache, if possible.
8567 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
8569 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
8572 According to the spec,
8574 In a member access of the form E.I, if E is a single identifier,
8575 and if the meaning of E as a simple-name (§7.5.2) is a constant,
8576 field, property, localvariable, or parameter with the same type as
8577 the meaning of E as a type-name (§3.8), then both possible
8578 meanings of E are permitted.
8580 We did not check that E as a simple-name had the same type as E as
8583 This trivial check gives us 5-7% on bootstrap time.
8585 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
8587 * expression.cs (Invocation.OverloadResolve): Avoid the
8588 use of hashtables and boxing here by allocating on demand.
8590 2004-05-30 Martin Baulig <martin@ximian.com>
8592 * rootcontext.cs (RootContext.LookupType): Don't cache things if
8593 we're doing a silent lookup. Don't try to lookup nested types in
8594 TypeManager.object_type (thanks to Ben Maurer).
8596 2004-05-30 Martin Baulig <martin@ximian.com>
8598 Committing a patch from Ben Maurer.
8600 * rootcontext.cs (RootContext.LookupType): Cache negative results.
8602 2004-05-29 Martin Baulig <martin@ximian.com>
8604 * class.cs (IMethodData.ShouldIgnore): New method.
8606 * typemanager.cs (TypeManager.MethodFlags): Don't take a
8607 `Location' argument, we don't need it anywhere. Use
8608 `IMethodData.ShouldIgnore ()' instead of
8609 `MethodData.GetMethodFlags ()'.
8610 (TypeManager.AddMethod): Removed.
8611 (TypeManager.AddMethod2): Renamed to AddMethod.
8613 2004-05-29 Martin Baulig <martin@ximian.com>
8615 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
8617 * convert.cs (Convert.ImplicitReferenceConversion): If we're
8618 converting from a class type S to an interface type and we already
8619 have an object on the stack, don't box it again. Fixes #52578.
8621 2004-05-29 Martin Baulig <martin@ximian.com>
8623 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
8624 Added support for `params' parameters. Fixes #59267.
8626 2004-05-29 Martin Baulig <martin@ximian.com>
8628 * literal.cs (NullPointer): Provide a private .ctor which sets
8629 `type' to TypeManager.object_type. Fixes #59048.
8631 2004-05-29 Martin Baulig <martin@ximian.com>
8633 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
8634 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
8636 * ecore.cs (EventExpr.instance_expr): Make the field private.
8638 2004-05-26 Marek Safar <marek.safar@seznam.cz>
8640 Fixed bug #50080 & cs0214-2.cs
8641 * expression.cs (Cast.DoResolve): Check unsafe context here.
8643 * statement.cs (Resolve.DoResolve): Likewise.
8645 2004-05-26 Martin Baulig <martin@ximian.com>
8647 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
8649 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
8650 (RootContext.LookupType): Pass down the `silent' flag.
8652 2004-05-25 Martin Baulig <martin@ximian.com>
8655 (MethodGroupExpr.IdenticalTypeName): New public property.
8656 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
8657 expression actually refers to a type.
8659 2004-05-25 Martin Baulig <martin@ximian.com>
8661 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
8662 for #56176 and made it actually work.
8664 2004-05-25 Martin Baulig <martin@ximian.com>
8666 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
8667 (FieldExpr, PropertyExpr): Override and implement
8668 CacheTemporaries. Fixes #52279.
8670 2004-05-25 Miguel de Icaza <miguel@ximian.com>
8672 * location.cs: In the new compiler listing a file twice is a
8673 warning, not an error.
8675 2004-05-24 Martin Baulig <martin@ximian.com>
8677 * enum.cs (Enum.DefineType): For the `BaseType' to be a
8678 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
8680 2004-05-24 Martin Baulig <martin@ximian.com>
8682 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
8683 walking the `using' list. Fixes #53921.
8685 2004-05-24 Martin Baulig <martin@ximian.com>
8687 * const.cs (Const.LookupConstantValue): Added support for
8688 EmptyCast's; fixes #55251.
8690 2004-05-24 Martin Baulig <martin@ximian.com>
8692 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
8693 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
8694 which does the CS0135 check. The reason is that we first need to
8695 check whether the variable actually exists.
8697 2004-05-24 Martin Baulig <martin@ximian.com>
8699 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
8700 than RootContext.LookupType() to find the explicit interface
8703 2004-05-24 Raja R Harinath <rharinath@novell.com>
8705 * Makefile: Simplify. Use executable.make.
8706 * mcs.exe.sources: New file. List of sources of mcs.exe.
8708 2004-05-24 Anders Carlsson <andersca@gnome.org>
8712 Use the invariant culture when doing String.Compare for CLS case
8715 2004-05-23 Martin Baulig <martin@ximian.com>
8717 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
8718 don't have any dots. Fixes #52622, added cs0246-8.cs.
8720 * namespace.cs (NamespaceEntry.Lookup): Likewise.
8722 2004-05-23 Marek Safar <marek.safar@seznam.cz>
8724 * class.cs (MemberBase.Define): Reuse MemberType member for
8725 resolved type. Other methods can use it too.
8727 2004-05-23 Martin Baulig <martin@ximian.com>
8729 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
8730 the variable also exists in the current block (otherwise, we need
8731 to report a CS0103). Fixes #58670.
8733 2004-05-23 Martin Baulig <martin@ximian.com>
8735 * flowanalysis.cs (Reachability.Reachable): Compute this
8736 on-the-fly rather than storing it as a field.
8738 2004-05-23 Martin Baulig <martin@ximian.com>
8740 * flowanalysis.cs (Reachability.And): Manually compute the
8741 resulting `barrier' from the reachability.
8743 2004-05-23 Marek Safar <marek.safar@seznam.cz>
8746 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
8747 instance of ObsoleteAttribute when symbol is obsolete.
8750 (IMethodData): Extended interface for ObsoleteAttribute support.
8752 2004-05-22 Marek Safar <marek.safar@seznam.cz>
8754 * attribute.cs: Fix bug #55970
8756 2004-05-22 Marek Safar <marek.safar@seznam.cz>
8760 (GetObsoleteAttribute): New method. Creates the instance of
8762 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
8763 ObsoleteAttribute when member is obsolete.
8764 (AttributeTester.Report_ObsoleteMessage): Common method for
8765 Obsolete error/warning reporting.
8768 (TypeContainer.base_classs_type): New member for storing parent type.
8771 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
8772 for this MemberCore.
8774 2004-05-21 Marek Safar <marek.safar@seznam.cz>
8776 * attribute.cs, const.cs: Fix bug #58590
8778 2004-05-21 Martin Baulig <martin@ximian.com>
8780 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
8781 out parameters if the end of the method is unreachable. Fixes
8784 2004-05-21 Marek Safar <marek.safar@seznam.cz>
8786 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
8787 Hari was right, why extra method.
8789 2004-05-21 Marek Safar <marek.safar@seznam.cz>
8791 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
8793 2004-05-20 Martin Baulig <martin@ximian.com>
8795 Merged this back from gmcs to keep the differences to a minumum.
8797 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
8798 instead of a Declspace.
8799 (Attribute.ResolveType): Likewise.
8800 (Attributes.Search): Likewise.
8801 (Attributes.Contains): Likewise.
8802 (Attributes.GetClsCompliantAttribute): Likewise.
8804 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
8806 (MethodData.ApplyAttributes): Take an EmitContext instead of a
8809 2004-05-19 Marek Safar <marek.safar@seznam.cz>
8811 Fix bug #58688 (MCS does not report error when the same attribute
8814 * attribute.cs (Attribute.Emit): Distinction between null and default.
8816 2004-05-19 Raja R Harinath <rharinath@novell.com>
8818 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
8819 of a top-level attribute without an attribute target.
8820 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
8822 (Attribute.Conditional_GetConditionName),
8823 (Attribute.Obsolete_GetObsoleteMessage): Update.
8824 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
8825 part of ScanForIndexerName.
8826 (Attribute.CanIgnoreInvalidAttribute): New function.
8827 (Attribute.ScanForIndexerName): Move to ...
8828 (Attributes.ScanForIndexerName): ... here.
8829 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
8830 (Attributes.Search): New internal variant that can choose not to
8831 complain if types aren't resolved. The original signature now
8833 (Attributes.GetClsCompliantAttribute): Use internal variant, with
8834 complaints suppressed.
8835 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
8836 only if it not useful.
8837 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
8838 top-level for attributes that are shared between the assembly
8839 and a top-level class.
8840 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
8841 * class.cs: Update to reflect changes.
8842 (DefineIndexers): Fuse loops.
8843 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
8844 a couple more variants of attribute names.
8846 2004-05-18 Marek Safar <marek.safar@seznam.cz>
8848 Fix bug #52585 (Implemented explicit attribute declaration)
8851 (Attributable.ValidAttributeTargets): New abstract method. It gets
8852 list of valid attribute targets for explicit target declaration.
8853 (Attribute.Target): It holds target itself.
8854 (AttributeSection): Removed.
8855 (Attribute.CheckTargets): New method. It checks whether attribute
8856 target is valid for the current element.
8859 (EventProperty): New class. For events that are declared like
8860 property (with add and remove accessors).
8861 (EventField): New class. For events that are declared like field.
8864 * cs-parser.jay: Implemented explicit attribute target declaration.
8866 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
8867 Override ValidAttributeTargets.
8870 (ReturnParameter): Class for applying custom attributes on
8872 (ParameterAtribute): New class. Class for applying custom
8873 attributes on the parameter type.
8875 2004-05-17 Miguel de Icaza <miguel@ximian.com>
8877 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
8880 (Method): Allow UNSAFE here.
8882 * modifiers.cs: Support unsafe reporting.
8884 2004-05-17 Marek Safar <marek.safar@seznam.cz>
8886 * decl.cs: Fix bug #58478.
8888 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8890 * statement.cs: When checking for unreachable code on an EmptyStatement,
8891 set the location. Fixes bug #58488.
8893 2004-05-13 Miguel de Icaza <miguel@ximian.com>
8895 * driver.cs: Add -pkg handling.
8897 From Gonzalo: UseShelLExecute=false
8899 2004-05-12 Marek Safar <marek.safar@seznam.cz>
8902 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
8904 (Attribute.IsClsCompliaceRequired): Moved to base for better
8906 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
8907 when attribute is AttributeUsageAttribute.
8908 (Attribute.GetValidTargets): Simplified.
8909 (Attribute.GetAttributeUsage): New method returns AttributeUsage
8910 attribute for this type.
8911 (Attribute.ApplyAttributes): Method renamed to Emit and make
8913 (GlobalAttributeSection): New class for special handling of global
8914 attributes (assembly, module).
8915 (AttributeSection.Emit): New method.
8917 * class.cs: Implemented Attributable abstract methods.
8918 (MethodCore.LabelParameters): Moved to Parameter class.
8919 (Accessor): Is back simple class.
8920 (PropertyMethod): Implemented Attributable abstract class.
8921 (DelegateMethod): Implemented Attributable abstract class.
8922 (Event): New constructor for disctintion between normal Event
8923 and Event with accessors.
8925 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
8927 * codegen.cs, const.cs, decl.cs, delegate.cs:
8928 (CommonAssemblyModulClass): Implemented Attributable abstract class
8931 * enum.cs: Implement IAttributeSupport interface.
8932 (EnumMember): New class for emum members. Implemented Attributable
8936 (ParameterBase): Is abstract.
8937 (ReturnParameter): New class for easier [return:] attribute handling.
8939 * typemanager.cs: Removed builder_to_attr.
8941 2004-05-11 Raja R Harinath <rharinath@novell.com>
8944 * attribute.cs (Attribute.GetPositionalValue): New function.
8945 * class.cs (TypeContainer.VerifyMembers): New function.
8946 (TypeContainer.Emit): Use it.
8947 (ClassOrStruct): New base class for Class and Struct.
8948 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
8949 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
8951 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
8952 then each non-static field should have a FieldOffset attribute.
8953 Otherwise, none of the fields should have a FieldOffset attribute.
8954 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
8955 and FieldOffset attributes.
8956 * typemanager.cs (TypeManager.struct_layout_attribute_type)
8957 (TypeManager.field_offset_attribute_type): New core types.
8958 (TypeManager.InitCoreTypes): Initialize them.
8960 2004-05-11 Michal Moskal <malekith@pld-linux.org>
8962 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
8963 Return correct type.
8966 2004-05-09 Miguel de Icaza <miguel@ximian.com>
8968 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
8969 be implicitly converted to ulong.
8971 * expression.cs: The logic for allowing operator &, | and ^ worked
8972 was wrong, it worked before because we did not report an error in
8973 an else branch. Fixes 57895.
8975 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
8976 allow volatile fields to be reference types.
8978 2004-05-07 Miguel de Icaza <miguel@ximian.com>
8980 * driver.cs: Add support for /debug-
8982 2004-05-07 Raja R Harinath <rharinath@novell.com>
8984 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
8985 Add a 'complain' parameter to silence errors.
8986 (Attribute.Resolve): Update to changes. Put in sanity check to catch
8987 silently overlooked type-resolutions.
8988 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
8990 (Attributes.Search): New function.
8991 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
8992 (Attributes.GetAttributeFullName): Remove hack.
8993 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
8994 Update to reflect changes.
8995 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
8996 Use Attributes.Search instead of nested loops.
8998 2004-05-07 Marek Safar <marek.safar@seznam.cz>
9001 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
9002 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
9003 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
9005 * report.cs: (Report.Warning): Renamed to Warning_T because of
9006 parameter collision.
9008 2004-05-05 Raja R Harinath <rharinath@novell.com>
9010 * expression.cs (MemberAccess.ResolveMemberAccess):
9011 Exit with non-zero status after Report.Error.
9012 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
9014 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
9016 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
9018 * support.cs: Don't hang when the file is empty.
9020 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
9022 * support.cs: In SeekableStreamReader, compute the preamble size of the
9023 underlying stream. Position changes should take into account that initial
9026 2004-05-03 Todd Berman <tberman@sevenl.net>
9028 * driver.cs: remove unused GetSysVersion function.
9030 2004-05-03 Todd Berman <tberman@sevenl.net>
9032 * driver.cs: Remove the hack from saturday, as well as the hack
9033 from jackson (LoadAssemblyFromGac), also adds the CWD to the
9034 link_paths to get that bit proper.
9036 2004-05-01 Todd Berman <tberman@sevenl.net>
9038 * driver.cs: Try a LoadFrom before a Load, this checks the current
9039 path. This is currently a bug in mono that is be fixed, however, this
9040 provides a workaround for now. This will be removed when the bug
9043 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
9045 * CryptoConvert.cs: Updated to latest version. Fix issue with
9046 incomplete key pairs (#57941).
9048 2004-05-01 Todd Berman <tberman@sevenl.net>
9050 * driver.cs: Remove '.' from path_chars, now System.* loads properly
9053 2004-04-30 Jackson Harper <jackson@ximian.com>
9055 * codegen.cs: Open keys readonly.
9057 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9059 * typemanager.cs: don't report cyclic struct layout when a struct
9060 contains 2 or more fields of the same type. Failed for Pango.AttrShape
9061 which has 2 Pango.Rectangle fields.
9063 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
9065 * expression.cs: Handle IntPtr comparisons with IL code
9066 rather than a method call.
9068 2004-04-29 Martin Baulig <martin@ximian.com>
9070 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
9071 the list of PropertyInfo's in class hierarchy and find the
9072 accessor. Fixes #56013.
9074 2004-04-29 Martin Baulig <martin@ximian.com>
9076 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
9078 2004-04-29 Martin Baulig <martin@ximian.com>
9080 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
9082 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
9084 2004-04-29 Martin Baulig <martin@ximian.com>
9086 * class.cs (ConstructorInitializer.Resolve): Check whether the
9087 parent .ctor is accessible. Fixes #52146.
9089 2004-04-29 Martin Baulig <martin@ximian.com>
9091 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
9093 * statement.cs (Using.EmitLocalVariableDecls): Use
9094 TypeManager.idisposable_type, not typeof (IDisposable).
9095 (Foreach.EmitCollectionForeach): Added support for valuetypes.
9097 2004-04-29 Martin Baulig <martin@ximian.com>
9099 * class.cs (Event.Define): Don't emit the field and don't set
9100 RTSpecialName and SpecialName for events on interfaces. Fixes
9103 2004-04-29 Raja R Harinath <rharinath@novell.com>
9105 Refactor Attribute.ApplyAttributes.
9106 * attribute.cs (Attributable): New base class for objects that can
9107 have Attributes applied on them.
9108 (Attribute): Make AttributeUsage fields public.
9109 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
9110 (Attribute.IsInternalCall): New property.
9111 (Attribute.UsageAttr): Convert to a public read-only property.
9112 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
9113 (Attribute.ResolveType, Attribute.Resolve)
9114 (Attribute.ScanForIndexerName): Update to reflect changes.
9115 (Attribute.CheckAttributeTarget): Re-format.
9116 (Attribute.ApplyAttributes): Refactor, to various
9117 Attributable.ApplyAttributeBuilder methods.
9118 * decl.cs (MemberCore): Make Attributable.
9119 * class.cs (Accessor): Make Attributable.
9120 (MethodData.ApplyAttributes): Use proper attribute types, not
9122 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
9123 (TypeContainer.ApplyAttributeBuilder)
9124 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
9125 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
9126 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
9127 (Operator.ApplyAttributeBuilder): New factored-out methods.
9128 * const.cs (Const.ApplyAttributeBuilder): Likewise.
9129 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
9130 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
9131 * parameter.cs (ParameterBase): New Attributable base class
9132 that can also represent Return types.
9133 (Parameter): Update to the changes.
9135 2004-04-29 Jackson Harper <jackson@ximian.com>
9137 * driver.cs: Prefer the corlib system version when looking for
9138 assemblies in the GAC. This is still a hack, but its a better hack
9141 2004-04-29 Marek Safar <marek.safar@seznam.cz>
9143 * decl.cs, enum.cs: Improved error 3005 reporting.
9145 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
9146 (related_symbols): New private member for list of symbols
9147 related to reported error/warning.
9149 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
9151 2004-04-29 Martin Baulig <martin@ximian.com>
9153 * ecore.cs (Expression.Constantify): If we're an enum and
9154 TypeManager.TypeToCoreType() doesn't give us another type, use
9155 t.UnderlyingSystemType. Fixes #56178.
9157 2004-04-29 Martin Baulig <martin@ximian.com>
9159 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
9160 interfaces and for each interface, only add members directly
9161 declared in that interface. Fixes #53255.
9163 2004-04-28 Martin Baulig <martin@ximian.com>
9165 * expression.cs (ConditionalLogicalOperator): Use a temporary
9166 variable for `left' to avoid that we evaluate it more than once;
9169 2004-04-28 Martin Baulig <martin@ximian.com>
9171 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
9174 2004-04-28 Martin Baulig <martin@ximian.com>
9176 * statement.cs (LocalInfo.Resolve): Check whether the type is not
9179 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
9180 whether the type is not void (CS1547).
9182 2004-04-28 Martin Baulig <martin@ximian.com>
9184 * expression.cs (Unary.DoResolveLValue): Override this and report
9185 CS0131 for anything but Operator.Indirection.
9187 2004-04-28 Martin Baulig <martin@ximian.com>
9189 Committing a patch from Ben Maurer; see bug #50820.
9191 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
9194 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
9197 2004-04-28 Martin Baulig <martin@ximian.com>
9199 Committing a patch from Ben Maurer; see bug #50820.
9201 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
9204 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
9207 2004-04-28 Martin Baulig <martin@ximian.com>
9209 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
9210 (Block.AddLabel): Call DoLookupLabel() to only search in the
9213 2004-04-28 Martin Baulig <martin@ximian.com>
9215 * cfold.cs (ConstantFold.BinaryFold): Added special support for
9216 comparing StringConstants and NullLiterals in Equality and Inequality.
9218 2004-04-28 Jackson Harper <jackson@ximian.com>
9220 * driver.cs: Attempt to load referenced assemblies from the
9221 GAC. This is the quick and dirty version of this method that
9222 doesnt take into account versions and just takes the first
9223 canidate found. Will be good enough for now as we will not have more
9224 then one version installed into the GAC until I update this method.
9226 2004-04-28 Martin Baulig <martin@ximian.com>
9228 * typemanager.cs (TypeManager.CheckStructCycles): New public
9229 static method to check for cycles in the struct layout.
9231 * rootcontext.cs (RootContext.PopulateTypes): Call
9232 TypeManager.CheckStructCycles() for each TypeContainer.
9233 [Note: We only need to visit each type once.]
9235 2004-04-28 Martin Baulig <martin@ximian.com>
9237 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
9239 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
9240 success and added `out object value'. Use a `bool resolved' field
9241 to check whether we've already been called rather than
9242 `ConstantValue != null' since this breaks for NullLiterals.
9244 2004-04-28 Raja R Harinath <rharinath@novell.com>
9246 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
9247 setting of this flag, since the 'set' method may be non-public.
9249 2004-04-28 Raja R Harinath <rharinath@novell.com>
9251 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
9252 check on current_vector.Block.
9254 2004-04-27 Martin Baulig <martin@ximian.com>
9256 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
9257 a field initializer. Fixes #56459.
9259 2004-04-27 Martin Baulig <martin@ximian.com>
9261 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
9262 we're not attempting to use an indexer. Fixes #52154.
9264 2004-04-27 Martin Baulig <martin@ximian.com>
9266 * statement.cs (Return): Don't create a return label if we don't
9267 need it; reverts my change from January 20th. Thanks to Ben
9270 2004-04-27 Martin Baulig <martin@ximian.com>
9272 According to the spec, `goto' can only leave a nested scope, but
9275 * statement.cs (Block.LookupLabel): Only lookup in the current
9276 block, don't recurse into parent or child blocks.
9277 (Block.AddLabel): Check in parent and child blocks, report
9278 CS0140/CS0158 if we find a duplicate.
9279 (Block): Removed this indexer for label lookups.
9280 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
9281 this already does the error reporting for us.
9284 (FlowBranching.UsageVector.Block): New public variable; may be null.
9285 (FlowBranching.CreateSibling): Added `Block' argument.
9286 (FlowBranching.LookupLabel): New public virtual method. Lookup a
9287 label for the target of a `goto' and check whether we're not
9288 leaving a `finally'.
9290 2004-04-27 Martin Baulig <martin@ximian.com>
9292 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
9293 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
9296 2004-04-27 Martin Baulig <martin@ximian.com>
9298 * statement.cs (Block.AddLabel): Also check for implicit blocks
9299 and added a CS0158 check.
9301 2004-04-27 Martin Baulig <martin@ximian.com>
9303 * flowanalysis.cs (FlowBranchingLoop): New class.
9304 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
9305 UsageVector's instead of an ArrayList.
9306 (FlowBranching.Label): Likewise.
9307 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
9308 (FlowBranching.AddBreakVector): New method.
9310 2004-04-27 Miguel de Icaza <miguel@ximian.com>
9312 * attribute.cs: Small regression fix: only convert the type if we
9313 the type is different, fixes System.Drawing build.
9315 2004-04-27 Martin Baulig <martin@ximian.com>
9317 * attribute.cs (Attribute.Resolve): If we have a constant value
9318 for a named field or property, implicity convert it to the correct
9321 2004-04-27 Raja R Harinath <rharinath@novell.com>
9323 * statement.cs (Block.Block): Implicit blocks share
9324 'child_variable_names' fields with parent blocks.
9325 (Block.AddChildVariableNames): Remove.
9326 (Block.AddVariable): Mark variable as "used by a child block" in
9327 every surrounding block.
9328 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
9329 been used in a child block, complain about violation of "Invariant
9330 meaning in blocks" rule.
9331 * cs-parser.jay (declare_local_variables): Don't use
9332 AddChildVariableNames.
9333 (foreach_statement): Don't create an implicit block: 'foreach'
9336 2004-04-23 Miguel de Icaza <miguel@ximian.com>
9338 * convert.cs (ImplicitNumericConversion): 0 is also positive when
9339 converting from 0L to ulong. Fixes 57522.
9341 2004-04-22 Marek Safar <marek.safar@seznam.cz>
9343 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
9344 derived class hides via 'new' keyword field from base class (test-242.cs).
9345 TODO: Handle this in the more general way.
9347 * class.cs (CheckBase): Ditto.
9349 2004-04-22 Marek Safar <marek.safar@seznam.cz>
9351 * decl.cs (caching_flags): New member for storing cached values
9353 (MemberCore.Flags): New enum where bit flags for caching_flags
9355 (MemberCore.cls_compliance): Moved to caching_flags.
9356 (DeclSpace.Created): Moved to caching_flags.
9358 * class.cs: Use caching_flags instead of DeclSpace.Created
9360 2004-04-21 Miguel de Icaza <miguel@ximian.com>
9362 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
9363 if we are only a derived class, not a nested class.
9365 * typemanager.cs: Same as above, but do this at the MemberLookup
9366 level (used by field and methods, properties are handled in
9367 PropertyExpr). Allow for the qualified access if we are a nested
9370 2004-04-21 Marek Safar <marek.safar@seznam.cz>
9372 * class.cs: Refactoring.
9373 (IMethodData): New inteface; Holds links to parent members
9374 to avoid member duplication (reduced memory allocation).
9375 (Method): Implemented IMethodData interface.
9376 (PropertyBase): New inner classes for get/set methods.
9377 (PropertyBase.PropertyMethod): Implemented IMethodData interface
9378 (Event): New inner classes for add/remove methods.
9379 (Event.DelegateMethod): Implemented IMethodData interface.
9381 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
9382 EmitContext (related to class.cs refactoring).
9384 2004-04-21 Raja R Harinath <rharinath@novell.com>
9386 * delegate.cs (Delegate.VerifyApplicability): If the number of
9387 arguments are the same as the number of parameters, first try to
9388 verify applicability ignoring any 'params' modifier on the last
9392 2004-04-16 Raja R Harinath <rharinath@novell.com>
9394 * class.cs (TypeContainer.AddIndexer): Use
9395 'ExplicitInterfaceName' to determine if interface name was
9396 explicitly specified. 'InterfaceType' is not initialized at this time.
9397 (TypeContainer.DefineIndexers): Remove use of temporary list. The
9398 Indexers array is already in the required order. Initialize
9399 'IndexerName' only if there are normal indexers.
9400 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
9401 (TypeContainer.Emit): Emit DefaultMember attribute only if
9402 IndexerName is initialized.
9405 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
9407 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
9410 2004-04-15 Raja R Harinath <rharinath@novell.com>
9412 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
9416 * attribute.cs (Attribute.Resolve): Check for duplicate named
9420 2004-04-15 Miguel de Icaza <miguel@ximian.com>
9422 * iterators.cs (MarkYield): track whether we are in an exception,
9423 and generate code accordingly. Use a temporary value to store the
9424 result for our state.
9426 I had ignored a bit the interaction of try/catch with iterators
9427 since their behavior was not entirely obvious, but now it is
9428 possible to verify that our behavior is the same as MS .NET 2.0
9432 2004-04-14 Miguel de Icaza <miguel@ximian.com>
9434 * iterators.cs: Avoid creating temporaries if there is no work to
9437 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
9438 Enumerations, use TypeManager.EnumToUnderlying and call
9441 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
9444 (This.Emit): Use EmitContext.EmitThis to emit our
9447 (This.EmitAssign): Ditto.
9449 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
9450 codepaths, we will move all the functionality into
9453 (FieldExpr.EmitAssign): Ditto.
9455 This fixes several hidden bugs that I uncovered while doing a code
9456 review of this today.
9458 * codegen.cs (EmitThis): reworked so the semantics are more clear
9459 and also support value types "this" instances.
9461 * iterators.cs: Changed so that for iterators in value types, we
9462 do not pass the value type as a parameter.
9464 Initialization of the enumerator helpers is now done in the caller
9465 instead of passing the parameters to the constructors and having
9466 the constructor set the fields.
9468 The fields have now `assembly' visibility instead of private.
9470 2004-04-11 Miguel de Icaza <miguel@ximian.com>
9472 * expression.cs (Argument.Resolve): Check if fields passed as ref
9473 or out are contained in a MarshalByRefObject.
9475 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
9476 another compiler type.
9478 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
9480 * class.cs (Indexer.Define): use the new name checking method.
9481 Also, return false on an error.
9482 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
9483 (is_identifier_[start/part]_character): make static.
9485 2004-04-10 Miguel de Icaza <miguel@ximian.com>
9487 * expression.cs (Binary.ResolveOperator): Do no append strings
9488 twice: since we can be invoked more than once (array evaluation)
9489 on the same concatenation, take care of this here. Based on a fix
9490 from Ben (bug #56454)
9492 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
9494 * codegen.cs: Fix another case where CS1548 must be reported (when
9495 delay-sign isn't specified and no private is available #56564). Fix
9496 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
9497 error when MCS is used on the MS runtime and we need to delay-sign
9498 (which seems unsupported by AssemblyBuilder - see #56621).
9500 2004-04-08 Marek Safar <marek.safar@seznam.cz>
9502 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
9503 (TypeManager.ComputeNamespaces): Faster implementation for
9506 * compiler.csproj: Updated AssemblyName to mcs.
9508 2004-04-07 Miguel de Icaza <miguel@ximian.com>
9510 * rootcontext.cs: Add new types to the boot resolution.
9512 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
9513 MulticastDelegate is not allowed.
9515 * typemanager.cs: Add new types to lookup: System.TypedReference
9518 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
9519 check for TypedReference or ArgIterator, they are not allowed.
9521 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
9522 makes us properly catch 1510 in some conditions (see bug 56016 for
9525 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
9527 * CryptoConvert.cs: update from corlib version
9530 2004-04-05 Miguel de Icaza <miguel@ximian.com>
9532 * class.cs (Indexer.Define): Check indexername declaration
9534 2004-04-05 Marek Safar <marek.safar@seznam.cz>
9536 * attribute.cs (IsClsCompliant): Fixed problem with handling
9537 all three states (compliant, not-compliant, undetected).
9539 2004-03-30 Marek Safar <marek.safar@seznam.cz>
9541 * attribute.cs (Attribute): Location is now public.
9542 (Resolve): Store resolved arguments (pos_values) in attribute class.
9543 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
9544 (GetClsCompliantAttributeValue): New method that gets
9545 CLSCompliantAttribute value.
9546 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
9547 if exists else null.
9548 (AttributeTester): New class for CLS-Compliant verification routines.
9550 * class.cs (Emit): Add CLS-Compliant verification.
9551 (Method.GetSignatureForError): Implemented.
9552 (Constructor.GetSignatureForError): Implemented
9553 (Constructor.HasCompliantArgs): Returns if constructor has
9554 CLS-Compliant arguments.
9555 (Constructor.Emit): Override.
9556 (Construcor.IsIdentifierClsCompliant): New method; For constructors
9557 is needed to test only parameters.
9558 (FieldBase.GetSignatureForError): Implemented.
9559 (TypeContainer): New member for storing base interfaces.
9560 (TypeContainer.FindMembers): Search in base interfaces too.
9562 * codegen.cs (GetClsComplianceAttribute): New method that gets
9563 assembly or module CLSCompliantAttribute value.
9564 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
9566 (ModuleClass.Emit): Add error 3012 test.
9568 * const.cs (Emit): Override and call base for CLS-Compliant tests.
9570 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
9571 state for all decl types.
9572 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
9573 if CLS-Compliant tests are required.
9574 (IsClsCompliaceRequired): New method. Analyze whether code
9575 must be CLS-Compliant.
9576 (IsExposedFromAssembly): New method. Returns true when MemberCore
9577 is exposed from assembly.
9578 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
9579 value or gets cached value.
9580 (HasClsCompliantAttribute): New method. Returns true if MemberCore
9581 is explicitly marked with CLSCompliantAttribute.
9582 (IsIdentifierClsCompliant): New abstract method. This method is
9583 used to testing error 3005.
9584 (IsIdentifierAndParamClsCompliant): New method. Common helper method
9585 for identifier and parameters CLS-Compliant testing.
9586 (VerifyClsCompliance): New method. The main virtual method for
9587 CLS-Compliant verifications.
9588 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
9589 null. I don't know why is null (too many public members !).
9590 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
9591 and get value of first CLSCompliantAttribute that found.
9593 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
9594 (VerifyClsCompliance): Override and add extra tests.
9596 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
9597 clscheck- disable CLS-Compliant verification event if assembly is has
9598 CLSCompliantAttribute(true).
9600 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
9601 ApllyAttribute is now called in emit section as in the other cases.
9602 Possible future Emit integration.
9603 (IsIdentifierClsCompliant): New override.
9604 (VerifyClsCompliance): New override.
9605 (GetEnumeratorName): Returns full enum name.
9607 * parameter.cs (GetSignatureForError): Implemented.
9609 * report.cs (WarningData): New struct for Warning message information.
9610 (LocationOfPreviousError): New method.
9611 (Warning): New method. Reports warning based on the warning table.
9612 (Error_T): New method. Reports error based on the error table.
9614 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
9615 verifications are done here.
9617 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
9619 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
9620 CLSCompliantAttribute.
9621 (all_imported_types): New member holds all imported types from other
9623 (LoadAllImportedTypes): New method fills static table with exported types
9624 from all referenced assemblies.
9625 (Modules): New property returns all assembly modules.
9627 2004-03-30 Miguel de Icaza <miguel@ximian.com>
9629 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
9630 throwing a parser error.
9632 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
9633 which removes the hardcoded get_/set_ prefixes for properties, as
9634 IL allows for the properties to be named something else.
9638 * expression.cs: Do not override operand before we know if it is
9641 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
9643 * typemanager.cs: support for pinned variables.
9645 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
9647 * decl.cs, typemanager.cs: Avoid using an arraylist
9648 as a buffer if there is only one result set.
9650 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
9652 * expression.cs: Make sure you cant call a static method
9653 with an instance expression, bug #56174.
9655 2004-03-29 Miguel de Icaza <miguel@ximian.com>
9657 * class.cs (IsDuplicateImplementation): Improve error reporting to
9658 flag 663 (method only differs in parameter modifier).
9660 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
9661 in preprocessor directives.
9663 * location.cs (LookupFile): Allow for the empty path.
9665 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
9666 better approach for some of that patch, but its failing with the
9667 CharSet enumeration. For now try/catch will do.
9669 * typemanager.cs: Do not crash if a struct does not have fields.
9672 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
9674 * expression.cs: cs0213, cant fix a fixed expression.
9677 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
9679 * cs-parser.jay: detect invalid embeded statements gracefully.
9682 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
9684 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
9687 the invocation type may not be a subclass of the tye of the item/
9688 The type of the item must be a subclass of the invocation item.
9693 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
9695 * attribute.cs: Added methods to get a string and a bool from an
9696 attribute. Required to information from AssemblyKeyFileAttribute,
9697 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
9698 * codegen.cs: Modified AssemblyName creation to include support for
9699 strongnames. Catch additional exceptions to report them as CS1548.
9700 * compiler.csproj: Updated include CryptoConvert.cs.
9701 * compiler.csproj.user: Removed file - user specific configuration.
9702 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
9703 Mono.Security assembly. The original class is maintained and tested in
9704 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
9705 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
9706 like CSC 8.0 (C# v2) supports.
9707 * Makefile: Added CryptoConvert.cs to mcs sources.
9708 * rootcontext.cs: Added new options for strongnames.
9710 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
9712 * driver.cs: For --expect-error, report error code `2'
9713 if the program compiled with no errors, error code `1' if
9714 it compiled with an error other than the one expected.
9716 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
9718 * compiler.csproj: Updated for Visual Studio .NET 2003.
9719 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
9720 * compiler.sln: Updated for Visual Studio .NET 2003.
9722 2004-03-24 Ravi Pratap M <ravi@ximian.com>
9724 * expression.cs: Fix bug #47234. We basically need to apply the
9725 rule that we prefer the conversion of null to a reference type
9726 when faced with a conversion to 'object' (csc behaviour).
9728 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
9730 * statement.cs: Shorter form for foreach, eliminates
9731 a local variable. r=Martin.
9733 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
9735 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
9736 checks if we can use brtrue/brfalse to test for 0.
9737 * expression.cs: use the above in the test for using brtrue/brfalse.
9740 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
9742 * expression.cs: Rewrite string concat stuff. Benefits:
9744 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
9745 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
9746 rather than a concat chain.
9748 * typemanager.cs: Add lookups for more concat overloads.
9750 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
9752 * expression.cs: Emit shorter il code for array init.
9769 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
9771 * statement.cs: Before, two switch blocks would be merged if the
9772 total size of the blocks (end_item - begin_item + 1) was less than
9773 two times the combined sizes of the blocks.
9775 Now, it will only merge if after the merge at least half of the
9780 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
9782 * class.cs : csc build fix for GetMethods(). See bug #52503.
9784 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
9786 * expression.cs: Make sure fp comparisons work with NaN.
9787 This fixes bug #54303. Mig approved this patch a long
9788 time ago, but we were not able to test b/c the runtime
9791 2004-03-19 Miguel de Icaza <miguel@ximian.com>
9793 * ecore.cs (TypExpr.GetHashCode): implement this overload.
9795 2004-03-19 Martin Baulig <martin@ximian.com>
9797 * class.cs (MemberCore.IsDuplicateImplementation): Report the
9798 error here and not in our caller.
9800 2004-03-19 Martin Baulig <martin@ximian.com>
9802 * interface.cs: Completely killed this file.
9803 (Interface): We're now a TypeContainer and live in class.cs.
9805 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
9806 argument; we're now also called for interfaces.
9807 (TypeContainer.DefineMembers): Allow this method being called
9809 (TypeContainer.GetMethods): New public method; formerly known as
9810 Interface.GetMethod(). This is used by PendingImplementation.
9811 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
9812 it's now private and non-static.
9813 (Interface): Moved this here; it's now implemented similar to
9815 (Method, Property, Event, Indexer): Added `bool is_interface'
9816 argument to their .ctor's.
9817 (MemberBase.IsInterface): New public field.
9819 * cs-parser.jay: Create normal Method, Property, Event, Indexer
9820 instances instead of InterfaceMethod, InterfaceProperty, etc.
9821 (opt_interface_base): Removed; we now use `opt_class_base' instead.
9822 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
9824 2004-03-19 Martin Baulig <martin@ximian.com>
9826 * class.cs (MethodCore.IsDuplicateImplementation): New private
9827 method which does the CS0111 checking.
9828 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
9829 Use IsDuplicateImplementation().
9831 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
9833 * decl.cs (FindMemberToOverride): New method to find the correct
9834 method or property to override in the base class.
9836 - Make Method/Property use the above method to find the
9837 version in the base class.
9838 - Remove the InheritableMemberSignatureCompare as it is now
9841 This patch makes large code bases much faster to compile, as it is
9842 O(n) rather than O(n^2) to do this validation.
9844 Also, it fixes bug 52458 which is that nested classes are not
9845 taken into account when finding the base class member.
9847 Reviewed/Approved by Martin.
9849 2004-03-17 Marek Safar <marek.safar@seznam.cz>
9851 * interface.cs: In all interface classes removed redundant
9852 member initialization.
9854 2004-03-16 Martin Baulig <martin@ximian.com>
9856 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
9858 2004-03-15 Miguel de Icaza <miguel@ximian.com>
9860 * decl.cs (DefineTypeAndParents): New helper method to define a
9861 type's containers before the type itself is defined; This is a
9862 bug exposed by the recent changes to Windows.Forms when an
9863 implemented interface was defined inside a class that had not been
9866 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
9868 (Check): Loop correctly to report errors modifiers
9869 (UNSAFE was not in the loop, since it was the same as TOP).
9871 * interface.cs: Every interface member now takes a ModFlags,
9872 instead of a "is_new" bool, which we set on the base MemberCore.
9874 Every place where we called "UnsafeOk" in the interface, now we
9875 call the proper member (InterfaceMethod.UnsafeOK) instead to get
9876 the unsafe settings from the member declaration instead of the
9877 container interface.
9879 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
9881 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
9882 `set_indexer_name' to the pending bits (one per type).
9884 We fixed a bug today that was picking the wrong method to
9885 override, since for properties the existing InterfaceMethod code
9886 basically ignored the method name. Now we make sure that the
9887 method name is one of the valid indexer names.
9889 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
9891 * support.cs (SeekableStreamReader): Keep track of stream byte
9892 positions and don't mix them with character offsets to the buffer.
9894 Patch from Gustavo Giráldez
9896 2004-03-15 Marek Safar <marek.safar@seznam.cz>
9898 * interface.cs (InterfaceSetGetBase): Removed double member
9899 initialization, base class does it as well.
9901 2004-03-13 Martin Baulig <martin@ximian.com>
9903 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
9904 when compiling corlib.
9906 2004-03-13 Miguel de Icaza <miguel@ximian.com>
9908 * convert.cs (ExplicitConversion): We were reporting an error on
9909 certain conversions (object_type source to a value type, when the
9910 expression was `null') before we had a chance to pass it through
9911 the user defined conversions.
9913 * driver.cs: Replace / and \ in resource specifications to dots.
9916 * class.cs: Add check for duplicate operators. Fixes 52477
9918 2004-03-11 Miguel de Icaza <miguel@ximian.com>
9920 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
9921 that are in the middle of the statements, not only at the end.
9924 * class.cs (TypeContainer.AddField): No longer set the
9925 `HaveStaticConstructor' flag, now we call it
9926 `UserDefineStaticConstructor' to diferentiate the slightly
9927 semantic difference.
9929 The situation is that we were not adding BeforeFieldInit (from
9930 Modifiers.TypeAttr) to classes that could have it.
9931 BeforeFieldInit should be set to classes that have no static
9936 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
9938 And most importantly Zoltan's comment:
9940 http://bugzilla.ximian.com/show_bug.cgi?id=44229
9942 "I think beforefieldinit means 'it's ok to initialize the type sometime
9943 before its static fields are used', i.e. initialization does not need
9944 to be triggered by the first access to the type. Setting this flag
9945 helps the JIT to compile better code, since it can run the static
9946 constructor at JIT time, and does not need to generate code to call it
9947 (possibly lots of times) at runtime. Unfortunately, mcs does not set
9948 this flag for lots of classes like String.
9950 csc sets this flag if the type does not have an explicit static
9951 constructor. The reasoning seems to be that if there are only static
9952 initalizers for a type, and no static constructor, then the programmer
9953 does not care when this initialization happens, so beforefieldinit
9956 This bug prevents the AOT compiler from being usable, since it
9957 generates so many calls to mono_runtime_class_init that the AOT code
9958 is much slower than the JITted code. The JITted code is faster,
9959 because it does not generate these calls if the vtable is type is
9960 already initialized, which is true in the majority of cases. But the
9961 AOT compiler can't do this."
9963 2004-03-10 Miguel de Icaza <miguel@ximian.com>
9965 * class.cs (MethodData.Emit): Refactor the code so symbolic
9966 information is generated for destructors; For some reasons we
9967 were taking a code path that did not generate symbolic information
9970 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
9972 * class.cs: Create a Constructor.CheckBase method that
9973 takes care of all validation type code. The method
9974 contains some code that was moved from Define.
9976 It also includes new code that checks for duplicate ctors.
9977 This fixes bug #55148.
9979 2004-03-09 Joshua Tauberer <tauberer@for.net>
9981 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
9982 a { ... }-style array creation invokes EmitStaticInitializers
9983 which is not good for reference-type arrays. String, decimal
9984 and now null constants (NullCast) are not counted toward
9985 static initializers.
9987 2004-03-05 Martin Baulig <martin@ximian.com>
9989 * location.cs (SourceFile.HasLineDirective): New public field;
9990 specifies whether the file contains or is referenced by a "#line"
9992 (Location.DefineSymbolDocuments): Ignore source files which
9993 either contain or are referenced by a "#line" directive.
9995 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
9997 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
9998 direct access to our parent, so check the method inline there.
10000 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
10002 * expression.cs (Invocation.EmitCall): Miguel's last commit
10003 caused a regression. If you had:
10008 In Foo the implict this would be null.
10010 2004-02-27 Miguel de Icaza <miguel@ximian.com>
10012 * expression.cs (Invocation.EmitCall): If the method is not
10013 virtual, do not emit a CallVirt to it, use Call.
10015 * typemanager.cs (GetFullNameSignature): Improve the method to
10016 cope with ".ctor" and replace it with the type name.
10018 * class.cs (ConstructorInitializer.Resolve): Now the method takes
10019 as an argument the ConstructorBuilder where it is being defined,
10020 to catch the recursive constructor invocations.
10022 2004-02-26 Miguel de Icaza <miguel@ximian.com>
10024 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
10025 routines to check if a type is an enumerable/enumerator allow
10026 classes that implement the IEnumerable or IEnumerator interfaces.
10028 * class.cs (Property, Operator): Implement IIteratorContainer, and
10029 implement SetYields.
10031 (Property.Define): Do the block swapping for get_methods in the
10032 context of iterators. We need to check if Properties also
10033 include indexers or not.
10035 (Operator): Assign the Block before invoking the
10036 OperatorMethod.Define, so we can trigger the Iterator code
10039 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
10040 Property and Operator classes are not created when we parse the
10041 declarator but until we have the block completed, so we use a
10042 singleton SimpleIteratorContainer.Simple to flag whether the
10043 SetYields has been invoked.
10045 We propagate this setting then to the Property or the Operator to
10046 allow the `yield' to function.
10048 2004-02-25 Marek Safar <marek.safar@seznam.cz>
10050 * codegen.cs: Implemented attribute support for modules.
10051 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
10052 Assembly/Module functionality.
10054 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
10055 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
10056 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
10058 2004-02-16 Marek Safar <marek.safar@seznam.cz>
10060 * interface.cs (FindMembers): The operation is performed on all base
10061 interfaces and not only on the first. It is required for future CLS Compliance patch.
10063 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
10065 * statement.cs, codegen.cs:
10066 This patch deals with patterns such as:
10068 public class List : IEnumerable {
10070 public MyEnumerator GetEnumerator () {
10071 return new MyEnumerator(this);
10074 IEnumerator IEnumerable.GetEnumerator () {
10078 public struct MyEnumerator : IEnumerator {
10083 Before, there were a few things we did wrong:
10084 1) we would emit callvirt on a struct, which is illegal
10085 2) we emited ldarg when we needed to emit ldarga
10086 3) we would mistakenly call the interface methods on an enumerator
10087 type that derived from IEnumerator and was in another assembly. For example:
10089 public class MyEnumerator : IEnumerator
10091 Would have the interface methods called, even if there were public impls of the
10092 method. In a struct, this lead to invalid IL code.
10094 2004-02-11 Marek Safar <marek.safar@seznam.cz>
10096 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
10099 * delegate.cs (Define): Fixed crash when delegate type is undefined.
10101 2004-02-11 Miguel de Icaza <miguel@ximian.com>
10103 * cs-parser.jay: Fix small regression: we were not testing V2
10104 compiler features correctly.
10106 * interface.cs: If the emit context is null, then create one
10108 2004-02-09 Marek Safar <marek.safar@seznam.cz>
10110 * decl.cs (GetSignatureForError): New virtual method to get full name
10111 for error messages.
10113 * attribute.cs (IAttributeSupport): New interface for attribute setting.
10114 Now it is possible to rewrite ApplyAttributes method to be less if/else.
10116 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
10117 Duplicated members and code in these classes has been removed.
10118 Better encapsulation in these classes.
10120 2004-02-07 Miguel de Icaza <miguel@ximian.com>
10122 * assign.cs (Assign.DoResolve): When dealing with compound
10123 assignments, there is a new rule in ECMA C# 2.4 (might have been
10124 there before, but it is documented here) that states that in:
10128 If b is of type int, and the `op' is a shift-operator, then the
10129 above is evaluated as:
10133 * expression.cs (Binary.ResolveOperator): Instead of testing for
10134 int/uint/long/ulong, try to implicitly convert to any of those
10135 types and use that in pointer arithmetic.
10137 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
10138 method to print information for from the type, not from the
10139 null-method we were given.
10141 2004-02-01 Duncan Mak <duncan@ximian.com>
10143 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
10144 parsing for cmd, fixes bug #53694.
10146 2004-02-04 Marek Safar <marek.safar@seznam.cz>
10148 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
10149 in the member name duplication tests. Property and operator name duplication
10150 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
10152 2004-02-03 Marek Safar <marek.safar@seznam.cz>
10154 * interface.cs (PopulateMethod): Fixed crash when interface method
10155 returns not existing type (error test cs0246-3.cs).
10157 2004-02-02 Ravi Pratap M <ravi@ximian.com>
10159 * cs-parser.jay (interface_accessors): Re-write actions to also
10160 store attributes attached to get and set methods. Fix spelling
10163 (inteface_property_declaration): Modify accordingly.
10165 (InterfaceAccessorInfo): New helper class to store information to pass
10166 around between rules that use interface_accessors.
10168 * interface.cs (Emit): Apply attributes on the get and set
10169 accessors of properties and indexers too.
10171 * attribute.cs (ApplyAttributes): Modify accordingly to use the
10172 right MethodBuilder when applying attributes to the get and set accessors.
10174 2004-01-31 Miguel de Icaza <miguel@ximian.com>
10176 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
10178 2004-01-26 Miguel de Icaza <miguel@ximian.com>
10180 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
10182 2004-01-25 Miguel de Icaza <miguel@ximian.com>
10184 * cs-parser.jay: Remove YIELD token, instead use the new grammar
10185 changes that treat `yield' specially when present before `break'
10186 or `return' tokens.
10188 * cs-tokenizer.cs: yield is no longer a keyword.
10190 2004-01-23 Marek Safar <marek.safar@seznam.cz>
10192 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
10193 setting for default constructors.
10194 For default constructors are almost every time set wrong Modifier. The
10195 generated IL code has been alright. But inside mcs this values was
10196 wrong and this was reason why several of my CLS Compliance tests
10199 2004-01-22 Martin Baulig <martin@ximian.com>
10201 * cs-parser.jay (namespace_or_type_name): Return an Expression,
10202 not a QualifiedIdentifier. This is what `type_name_expression'
10203 was previously doing.
10204 (type_name_expression): Removed; the code is now in
10205 `namespace_or_type_name'.
10206 (qualified_identifier): Removed, use `namespace_or_type_name'
10208 (QualifiedIdentifier): Removed this class.
10210 2004-01-22 Martin Baulig <martin@ximian.com>
10212 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
10213 not a string as alias name.
10215 2004-01-21 Miguel de Icaza <miguel@ximian.com>
10217 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
10218 #52730 bug, and instead compute correctly the need to use a
10219 temporary variable when requesting an address based on the
10220 static/instace modified of the field and the constructor.
10222 2004-01-21 Martin Baulig <martin@ximian.com>
10224 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
10225 class and namespace before looking up aliases. Fixes #52517.
10227 2004-01-21 Martin Baulig <martin@ximian.com>
10229 * flowanalysis.cs (UsageVector.Merge): Allow variables being
10230 assinged in a 'try'; fixes exception4.cs.
10232 2004-01-21 Marek Safar <marek.safar@seznam.cz>
10233 * class.cs : Implemented parameter-less constructor for TypeContainer
10235 * decl.cs: Attributes are now stored here. New property OptAttributes
10237 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
10239 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
10241 2004-01-21 Marek Safar <marek.safar@seznam.cz>
10243 * typemanager.cs (CSharpSignature): Now reports also inner class name.
10244 (CSharpSignature): New method for indexer and property signature.
10246 2004-01-21 Marek Safar <marek.safar@seznam.cz>
10248 * pending.cs (IsVirtualFilter): Faster implementation.
10250 2004-01-21 Marek Safar <marek.safar@seznam.cz>
10252 * typemanager.cs: Avoid inclusion of same assembly more than once.
10254 2004-01-21 Marek Safar <marek.safar@seznam.cz>
10256 * cs-parser.jay: Fixed problem where the last assembly attribute
10257 has been applied also to following declaration (class, struct, etc.)
10259 2004-01-21 Marek Safar <marek.safar@seznam.cz>
10261 * class.cs: Added error CS0538, CS0539 reporting.
10262 Fixed crash on Microsoft runtime when field type is void.
10264 * cs-parser.jay: Added error CS0537 reporting.
10266 * pending.cs: Added error CS0535 reporting.
10267 Improved error report for errors CS0536, CS0534.
10269 2004-01-20 Miguel de Icaza <miguel@ximian.com>
10271 Merge a few bits from the Anonymous Method MCS tree.
10273 * statement.cs (ToplevelBlock): New class for toplevel methods,
10274 will hold anonymous methods, lifted variables.
10276 * cs-parser.jay: Create toplevel blocks for delegates and for
10277 regular blocks of code.
10279 2004-01-20 Martin Baulig <martin@ximian.com>
10281 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
10282 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
10283 and `NeedExplicitReturn'; added `IsLastStatement'.
10284 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
10285 have a `ReturnLabel' or we're not unreachable.
10287 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
10288 child's reachability; don't just override ours with it. Fixes
10289 #58058 (lluis's example).
10290 (FlowBranching): Added public InTryOrCatch(), InCatch(),
10291 InFinally(), InLoop(), InSwitch() and
10292 BreakCrossesTryCatchBoundary() methods.
10294 * statement.cs (Return): Do all error checking in Resolve().
10295 Unless we are the last statement in a top-level block, always
10296 create a return label and jump to it.
10297 (Break, Continue): Do all error checking in Resolve(); also make
10298 sure we aren't leaving a `finally'.
10299 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
10300 statement in a top-level block.
10301 (Block.Flags): Added `IsDestructor'.
10302 (Block.IsDestructor): New public property.
10304 2004-01-20 Martin Baulig <martin@ximian.com>
10306 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
10308 2004-01-20 Martin Baulig <martin@ximian.com>
10310 * statement.cs (Statement.ResolveUnreachable): New public method.
10311 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
10312 (Block.Resolve): Resolve unreachable statements.
10314 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
10316 * expression.cs: We need to fix the case where we do
10317 not have a temp variable here.
10319 * assign.cs: Only expression compound assignments need
10320 temporary variables.
10322 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
10324 * flowanalysis.cs: Reduce memory allocation in a few ways:
10325 - A block with no variables should not allocate a bit
10327 - A method with no out parameters does not need any tracking
10328 for assignment of the parameters, so we need not allocate
10331 public readonly Type[] VariableTypes;
10332 public readonly string[] VariableNames;
10333 Are redundant. The data is already stored in the variable
10334 map, so we need not allocate another array for it.
10335 - We need to add alot of checks for if (params | locals) == null
10336 due to the first two changes.
10338 2004-01-18 Miguel de Icaza <miguel@ximian.com>
10340 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
10341 implement IMemoryLocation, we store a copy on a local variable and
10342 take the address of it. Patch from Benjamin Jemlich
10344 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
10345 to use a special "type_name_expression" rule which reduces the
10346 number of "QualifiedIdentifier" classes created, and instead
10347 directly creates MemberAccess expressions.
10349 2004-01-17 Miguel de Icaza <miguel@ximian.com>
10351 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
10352 that fixes #52853. Null literal assignment to ValueType
10354 * class.cs (MethodData.Emit): Instead of checking the name of the
10355 method to determine if its a destructor, create a new derived
10356 class from Method called Destructor, and test for that.
10358 * cs-parser.jay: Create a Destructor object instead of a Method.
10360 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
10364 2004-01-16 Miguel de Icaza <miguel@ximian.com>
10366 * expression.cs (Binary.ResolveOperator): Perform an implicit
10367 conversion from MethodGroups to their delegate types on the
10368 Addition operation.
10370 * delegate.cs: Introduce a new class DelegateCreation that is the
10371 base class for `NewDelegate' and `ImplicitDelegateCreation',
10372 factor some code in here.
10374 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
10375 conversion from MethodGroups to compatible delegate types.
10377 * ecore.cs (Expression.Resolve): Do not flag error 654
10378 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
10379 we allow conversions from MethodGroups to delegate types now.
10381 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
10382 assignments in v2 either.
10384 2004-01-10 Miguel de Icaza <miguel@ximian.com>
10386 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
10387 static read-only fields in ctors.
10389 Applied patch from Benjamin Jemlich
10391 * expression.cs (UnaryMutator): Avoid leaking local variables.
10393 2004-01-09 Miguel de Icaza <miguel@ximian.com>
10395 * cs-tokenizer.cs (IsCastToken): Allow the various native types
10396 here to return true, as they can be used like this:
10398 (XXX) int.MEMBER ()
10400 Fixed 49836 and all the other dups
10402 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
10404 * driver.cs: Implement /win32res and /win32icon.
10406 2004-01-08 Miguel de Icaza <miguel@ximian.com>
10408 * cs-parser.jay: Add a rule to improve error handling for the
10409 common mistake of placing modifiers after the type.
10411 2004-01-07 Miguel de Icaza <miguel@ximian.com>
10413 * cs-parser.jay (interface_event_declaration): Catch
10414 initialization of events on interfaces, and report cs0068
10416 * cs-parser.jay (interface_event_declaration): Catch
10417 initialization of events.
10419 * ecore.cs: Better report missing constructors.
10421 * expression.cs (Binary.ResolveOperator): My previous bug fix had
10422 the error reporting done in the wrong place. Fix.
10424 * expression.cs (Binary.ResolveOperator): Catch the
10425 operator + (E x, E y) error earlier, and later allow for implicit
10426 conversions in operator +/- (E e, U x) from U to the underlying
10429 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
10430 52596, if the container class is abstract, the default constructor
10431 is protected otherwise its public (before, we were always public).
10433 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
10436 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
10437 Jemlich that fixes bug #52597, MCS was generating invalid code for
10438 idisposable structs. Thanks to Ben for following up with this
10441 2004-01-06 Miguel de Icaza <miguel@ximian.com>
10443 * driver.cs: Allow assemblies without code to be generated, fixes
10446 2004-01-07 Nick Drochak <ndrochak@gol.com>
10448 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
10450 2004-01-05 Miguel de Icaza <miguel@ximian.com>
10452 * cs-parser.jay: Add rules to improve error reporting if fields or
10453 methods are declared at the namespace level (error 116)
10455 * Add rules to catch event add/remove
10457 2004-01-04 David Sheldon <dave-mono@earth.li>
10459 * expression.cs: Added matching ")" to error message for
10462 2004-01-03 Todd Berman <tberman@gentoo.org>
10464 * ecore.cs, attribute.cs:
10465 Applying fix from #52429.
10467 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
10469 * ecore.cs, expression.cs, statement.cs:
10470 Total rewrite of how we handle branching. We
10471 now handle complex boolean expressions with fewer
10472 jumps. As well if (x == 0) no longer emits a ceq.
10474 if (x is Foo) is much faster now, because we generate
10477 Overall, we get a pretty big improvement on our benchmark
10478 tests. The code we generate is smaller and more readable.
10480 I did a full two-stage bootstrap. The patch was reviewed
10481 by Martin and Miguel.
10483 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
10485 * cs-parser.jay: Make primary_expression not take a QI.
10486 we dont need this because the member_access rule covers
10487 us here. So we replace the rule with just IDENTIFIER.
10489 This has two good effects. First, we remove a s/r conflict.
10490 Second, we allocate many fewer QualifiedIdentifier objects.
10492 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
10494 * attribute.cs: Handle MarshalAs attributes as pseudo, and
10495 set the correct information via SRE. This prevents
10496 hanging on the MS runtime. Fixes #29374.
10498 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
10500 * convert.cs: correctly handle conversions to value types
10501 from Enum and ValueType as unboxing conversions.
10503 Fixes bug #52569. Patch by Benjamin Jemlich.
10505 2004-01-02 Ravi Pratap <ravi@ximian.com>
10507 * expression.cs (BetterConversion): Prefer int -> uint
10508 over int -> ulong (csc's behaviour). This fixed bug #52046.
10510 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
10512 * decl.cs (MemberCache.FindMembers): now returns a
10515 * typemanager.cs: In general, go with with ^^.
10516 (CopyNewMethods): take an IList.
10517 (RealMemberLookup): Only allocate an arraylist
10518 if we copy from two sets of methods.
10520 This change basically does two things:
10521 1) Fewer array lists allocated due to CopyNewMethods.
10522 2) the explicit cast in MemberList costed ALOT.
10524 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
10526 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
10527 a hashtable to avoid needless string allocations when an identifier is
10528 used more than once (the common case).
10530 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
10532 * pending.cs: MS's TypeBuilder.GetInterfaces ()
10533 is broken, it will not return anything. So, we
10534 have to use the information we have in mcs to
10537 * typemanager.cs: Add a cache for GetInterfaces,
10538 since this will now be used more often (due to ^^)
10540 (GetExplicitInterfaces) New method that gets the
10541 declared, not effective, interfaces on a type
10542 builder (eg, if you have interface IFoo, interface
10543 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
10546 This patch makes MCS able to bootstrap itself on
10549 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
10551 * expression.cs: Remove the Nop's that Miguel put
10554 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
10556 * report.cs, codegen.cs: Give the real stack trace to
10557 the error when an exception is thrown.
10559 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
10561 * decl.cs: only allocate hashtables for ifaces if
10564 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
10566 * expression.cs: fix the error from cs0121-2.cs
10567 (a parent interface has two child interfaces that
10568 have a function with the same name and 0 params
10569 and the function is called through the parent).
10571 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
10573 * class.cs, rootcontext.cs, typmanager.cs: do not
10576 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
10578 * codegen.cs: remove stack for the ec flow branching.
10579 It is already a linked list, so no need.
10581 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
10583 * Makefile: Allow custom profiler here.
10585 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
10587 * typemanager.cs (LookupType):
10588 - Use a static char [], because split takes
10589 a param array for args, so it was allocating
10591 - Do not store true in a hashtable, it boxes.
10593 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
10595 * flowanalysis.cs: bytify common enums.
10597 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
10599 * modifiers.cs: Add a new set of flags for the
10600 flags allowed on explicit interface impls.
10601 * cs-parser.jay: catch the use of modifiers in
10602 interfaces correctly.
10603 * class.cs: catch private void IFoo.Blah ().
10605 All related to bug #50572.
10607 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
10609 * decl.cs: Rewrite the consistant accessability checking.
10610 Accessability is not linear, it must be implemented in
10611 a tableish way. Fixes #49704.
10613 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
10615 * expression.cs: Handle negation in a checked context.
10616 We must use subtraction from zero. Fixes #38674.
10618 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
10620 * class.cs: Ignore static void main in DLLs.
10621 * rootcontext.cs: Handle the target type here,
10622 since we are have to access it from class.cs
10623 * driver.cs: account for the above.
10625 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
10627 * report.cs: Give line numbers and files if available.
10629 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
10631 * driver.cs: Implement /addmodule.
10633 * typemanager.cs: Change 'modules' field so it now contains Modules not
10636 2003-12-20 Martin Baulig <martin@ximian.com>
10638 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
10639 (FieldBase.IsAssigned): Removed this field.
10640 (FieldBase.SetAssigned): New public method.
10641 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
10643 2003-12-20 Martin Baulig <martin@ximian.com>
10645 * expression.cs (LocalVariableReference.DoResolve): Don't set
10646 `vi.Used' if we're called from DoResolveLValue().
10648 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
10649 returns the usage vector it just merged into the current one -
10650 pass this one to UsageWarning().
10651 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
10652 of the `EmitContext', don't call this recursively on our children.
10654 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
10656 * driver.cs: Implement /target:module.
10658 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
10660 * support.cs (CharArrayHashtable): New helper class.
10662 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
10663 char arrays, not strings, so we can avoid creating a string in
10664 consume_identifier if the identifier is a keyword.
10666 2003-12-16 Martin Baulig <martin@ximian.com>
10668 * statement.cs (LocalInfo.Assigned): Removed this property.
10669 (LocalInfo.Flags): Removed `Assigned'.
10670 (LocalInfo.IsAssigned): New public method; takes the EmitContext
10671 and uses flow analysis.
10672 (Block.UsageWarning): Made this method private.
10673 (Block.Resolve): Call UsageWarning() if appropriate.
10675 * expression.cs (LocalVariableReference.DoResolve): Always set
10676 LocalInfo.Used here.
10678 2003-12-13 Martin Baulig <martin@ximian.com>
10680 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
10681 any value here; we're now using flow analysis to figure out
10682 whether a statement/block returns a value.
10684 2003-12-13 Martin Baulig <martin@ximian.com>
10686 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
10688 (FlowBranching.MergeFinally): Don't call
10689 `branching.CheckOutParameters()' here, this is called in
10691 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
10692 when adding the `finally' vector.
10694 2003-12-13 Martin Baulig <martin@ximian.com>
10697 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
10698 actually work and also fix #48962.
10700 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
10702 * decl.cs: Do not check System.Object for nested types,
10703 since we know it does not have any. Big bang for buck:
10706 Run 1: 8.35 seconds
10707 Run 2: 8.32 seconds
10708 corlib: 17.99 seconds
10710 Run 1: 8.17 seconds
10711 Run 2: 8.17 seconds
10712 corlib: 17.39 seconds
10714 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
10716 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
10717 time we are returning 0 members, so we save alot here.
10719 2003-12-11 Martin Baulig <martin@ximian.com>
10721 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
10722 `MergeChild()', also just take the `FlowBranching' as argument;
10723 call Merge() on it and return the result.
10724 (FlowBranching.Merge): We don't need to do anything if we just
10727 2003-12-11 Martin Baulig <martin@ximian.com>
10729 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
10730 them in an `ArrayList' to reduce memory usage. Thanks to Ben
10731 Maurer for this idea.
10733 2003-12-11 Martin Baulig <martin@ximian.com>
10735 * flowanalysis.cs (MergeResult): This class is now gone; we now
10736 use the `UsageVector' for this. The reason for this is that if a
10737 branching just has one sibling, we don't need to "merge" them at
10738 all - that's the next step to do.
10739 (FlowBranching.Merge): We now return a `UsageVector' instead of a
10742 2003-12-11 Martin Baulig <martin@ximian.com>
10744 Reworked flow analyis and made it more precise and bug-free. The
10745 most important change is that we're now using a special `Reachability'
10746 class instead of having "magic" meanings of `FlowReturns'. I'll
10747 do some more cleanups and optimizations and also add some more
10748 documentation this week.
10750 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
10751 largely reworked this class.
10752 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
10753 the new `Reachability' class instead of having "magic" values here.
10754 (FlowBranching): We're now using an instance of `Reachability'
10755 instead of having separate `Returns', `Breaks' etc. fields.
10757 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
10758 based on flow analysis; ignore the return value of block.Emit ().
10760 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
10762 * driver.cs typemanager.cs: Find the mono extensions to corlib even
10763 if they are private.
10765 2003-12-09 Martin Baulig <martin@ximian.com>
10767 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
10768 call them directly on the UsageVector.
10770 2003-12-09 Martin Baulig <martin@ximian.com>
10772 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
10773 Changed return type from `FlowReturns' to `Reachability'.
10775 2003-12-09 Martin Baulig <martin@ximian.com>
10777 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
10778 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
10779 `Reachable' fields with a single `Reachability' one.
10781 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
10783 * class.cs (FindMembers): Remove foreach's.
10788 Run 1: 8.74 seconds
10789 Run 2: 8.71 seconds
10792 Run 1: 8.64 seconds
10793 Run 2: 8.58 seconds
10796 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
10801 This patch does a few things:
10802 1. EmptyStatement is now a singleton, so it is never reallocated.
10803 2. All blah is EmptyStatement constructs have been changed to
10804 blah == EmptyStatement.Value, which is much faster and valid
10805 now that EmptyStatement is a singleton.
10806 3. When resolving a block, rather than allocating a new array for
10807 the non-empty statements, empty statements are replaced with
10808 EmptyStatement.Value
10809 4. Some recursive functions have been made non-recursive.
10810 Mainly the performance impact is from (3), however (1) and (2) are needed for
10811 this to work. (4) does not make a big difference in normal situations, however
10812 it makes the profile look saner.
10817 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
10818 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
10819 Total memory allocated: 56397 KB
10822 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
10823 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
10824 Total memory allocated: 55666 KB
10826 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
10828 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
10829 than the hashtable in a hashtable version
10831 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
10832 we always end up concating a string. This results in a huge perf
10833 loss, because many strings have to be tracked by the GC. In this
10834 patch, we first use a hashtable that works with two keys, so that
10835 the strings do not need to be concat'ed.
10839 Run 1: 8.74 seconds
10840 Run 2: 8.71 seconds
10843 Run 1: 8.65 seconds
10844 Run 2: 8.56 seconds
10846 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
10848 * Makefile: Add a new target `do-time' that does a quick and simple
10849 profile, leaving easy to parse output.
10851 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
10853 * codegen.cs (Init): Create the dynamic assembly with
10854 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
10856 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
10858 * support.cs: Make the PtrHashtable use only one
10859 instance of its comparer.
10861 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
10863 * typemanager.cs: Fix lookup of GetNamespaces.
10865 2003-11-29 Miguel de Icaza <miguel@ximian.com>
10867 * expression.cs: Removed redundant line.
10869 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
10870 ArrayLists, use for loops with bounds.
10872 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
10875 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
10876 arraylists, use for loop with bounds.
10878 The above three changes give us a 0.071 second performance
10879 improvement out of 3.294 seconds down to 3.223. On my machine
10880 the above changes reduced the memory usage by 1,387 KB during
10881 compiler bootstrap.
10883 * cs-parser.jay (QualifiedIdentifier): New class used to represent
10884 QualifiedIdentifiers. Before we created a new string through
10885 concatenation, and mostly later on, the result would be
10886 manipulated by DecomposeQI through string manipulation.
10888 This reduced the compiler memory usage for bootstrapping from
10889 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
10890 compile times in 0.05 seconds.
10892 2003-11-28 Dick Porter <dick@ximian.com>
10894 * support.cs: Do string compares with the Invariant culture.
10902 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
10903 the comparison is done with the Invariant culture.
10905 2003-11-27 Miguel de Icaza <miguel@ximian.com>
10907 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
10908 GetEnumerator method.
10910 (ProbeCollectionType): Iterate starting at the most specific type
10911 upwards looking for a GetEnumerator
10913 * expression.cs: Shift count can be up to 31 for int/uint and 63
10916 2003-11-26 Miguel de Icaza <miguel@ximian.com>
10918 * statement.cs (Block.LookupLabel): Also look for the label on the
10919 children blocks. Use a hash table to keep track of visited
10922 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
10923 we actually did transform the other operand, otherwise fall back
10924 to the common codepath that casts to long.
10926 * cs-tokenizer.cs: Use the same code pattern as the int case.
10927 Maybe I should do the parsing myself, and avoid depending on the
10928 Parse routines to get this done.
10930 2003-11-25 Miguel de Icaza <miguel@ximian.com>
10932 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
10933 which fixes bug 51347. This time test it.
10935 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
10936 attributes for example can not tell the difference between these.
10937 The difference was only a syntax feature of the language.
10939 * attribute.cs: Apply attributes to delegates.
10941 * delegate.cs: Call the apply attributes method.
10943 2003-11-24 Miguel de Icaza <miguel@ximian.com>
10945 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
10946 comparing 0 vs Byte.MinValue, not the value
10948 (ImplicitConversionRequired): When reporting a conversion error,
10949 use error 31 to print out the constant error instead of the
10952 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
10953 which fixes bug 51347.
10955 2003-11-22 Miguel de Icaza <miguel@ximian.com>
10957 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
10958 which fixes the -warnaserror command line option.
10960 2003-11-21 Miguel de Icaza <miguel@ximian.com>
10962 * cfold.cs (DoNumericPromotions): During constant folding of
10963 additions on UIntConstant, special case intconstants with
10964 IntConstants like we do on the expression binary operator.
10966 2003-11-12 Miguel de Icaza <miguel@ximian.com>
10968 * convert.cs (ImplicitReferenceConversion): We were missing a case
10969 (System.Enum are not value types or class types, so we need to
10970 classify them separatedly).
10972 * driver.cs: We do not support error 2007.
10974 2003-11-12 Jackson Harper <jackson@ximian.com>
10976 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
10977 system directory. Also use the full file name so users can
10978 libraries names mscorlib-o-tron.dll in a non system dir.
10980 2003-11-10 Martin Baulig <martin@ximian.com>
10982 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
10983 (TypeManager.InitCoreTypes): Initialize them here, but instead of
10984 calling `ResolveType()' on them, directly assign their `Type'.
10986 2003-11-08 Martin Baulig <martin@ximian.com>
10988 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
10989 return value and the `out parent' parameter.
10990 (TypeContainer.DefineType): Moved the CS0644 check into
10991 GetClassBases(). Don't pass the interface types to the
10992 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
10993 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
10995 * ecore.cs (TypeExpr.IsAttribute): New property.
10996 (TypeExpr.GetInterfaces): New method.
10998 * interface.cs (Interface.GetInterfaceTypeByName): Return a
10999 TypeExpr instead of a Type.
11000 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
11001 (Interface.DefineType): Don't pass the interface types to the
11002 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
11003 them later and then call `TypeBulider.AddInterfaceImplementation()'.
11005 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
11006 instead of a `Type[]'.
11007 (TypeManager.RegisterBuilder): Likewise.
11008 (TypeManager.AddUserInterface): Likewise.
11009 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
11010 `Type[]' and also return a `TypeExpr[]'.
11011 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
11013 2003-11-08 Martin Baulig <martin@ximian.com>
11015 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
11018 2003-11-08 Martin Baulig <martin@ximian.com>
11020 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
11021 TypeManager.ResolveExpressionTypes().
11023 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
11024 instead of an Expression.
11025 (TypeExpr): This is now an abstract base class for `TypeExpression'.
11026 (TypeExpression): New public class; formerly known as `TypeExpr'.
11028 * expression.cs (ComposedCast): Derive from TypeExpr.
11030 * typemanager.cs (TypeManager.system_*_expr): These are now
11031 TypExpr's instead of Expression's.
11032 (TypeManager.ResolveExpressionTypes): New public static function;
11033 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
11036 2003-11-06 Miguel de Icaza <miguel@ximian.com>
11038 * expression.cs (New.DoResolve): Do not dereference value that
11039 might be a null return.
11041 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
11042 sure that the constant value has the right type. Fixes an
11043 unreported bug, similar to 50425.
11045 * const.cs (Const.LookupConstantValue): Call
11046 ImplicitStandardConversionExists before doing a conversion to
11047 avoid havng the TypeManager.ChangeType do conversions.
11049 Reduced the number of casts used
11051 (Const.ChangeType): New routine to enable reuse of the constant
11052 type changing code from statement.
11054 * typemanager.cs (ChangeType): Move common initialization to
11055 static global variables.
11059 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
11060 every value type to go through, even if it was void. Fix that.
11062 * cs-tokenizer.cs: Use is_identifier_start_character on the start
11063 character of the define, and the is_identifier_part_character for
11064 the rest of the string.
11066 2003-11-05 Miguel de Icaza <miguel@ximian.com>
11068 * expression.cs (UnaryMutator.EmitCode): When I updated
11069 LocalVariableReference.DoResolve, I overdid it, and dropped an
11070 optimization done on local variable references.
11072 2003-11-04 Miguel de Icaza <miguel@ximian.com>
11074 * ecore.cs: Convert the return from Ldlen into an int.
11076 2003-10-20 Miguel de Icaza <miguel@ximian.com>
11078 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
11079 the accessibility, this is a special case for toplevel non-public
11080 classes (internal for instance).
11082 2003-10-20 Nick Drochak <ndrochak@gol.com>
11084 * ecore.cs: Fix typo and build. Needed another right paren.
11086 2003-10-19 Miguel de Icaza <miguel@ximian.com>
11088 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
11089 `internal' case regular and protected, but not allowing protected
11090 to be evaluated later. Bug 49840
11092 2003-10-15 Miguel de Icaza <miguel@ximian.com>
11094 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
11095 to kb.Nlast, and not the kb.nFirst to isolate the switch
11098 Extract the underlying type, so enumerations of long/ulong are
11099 treated like long/ulong.
11101 2003-10-14 Miguel de Icaza <miguel@ximian.com>
11103 * expression.cs (New): Overload the meaning of RequestedType to
11104 track the possible creation of the NewDelegate type, since
11105 DoResolve is invoked more than once for new constructors on field
11108 See bugs: #48800 and #37014
11110 * cs-parser.jay (declare_local_constants): Take an arraylist
11111 instead of a single constant.
11113 (local_constant_declaration): It should take a
11114 constant_declarators, not a constant_declarator. Fixes 49487
11116 * convert.cs: Fix error report.
11118 2003-10-13 Jackson Harper <jackson@ximian.com>
11120 * typemanager.cs (TypeToCoreType): Add float and double this fixes
11123 2003-10-09 Martin Baulig <martin@ximian.com>
11125 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
11127 (MethodCore.DoDefineParameters): Removed the TypeContainer
11128 argument; use the DeclSpace which was passed to the .ctor instead.
11129 (MethodCore.CheckParameter): Take a DeclSpace instead of a
11130 TypeContainer; we only need a DeclSpace here.
11132 2003-10-09 Martin Baulig <martin@ximian.com>
11134 * class.cs (MethodData): Added additional `DeclSpace ds' argument
11136 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
11137 EmitContext's .ctor.
11139 2003-10-09 Martin Baulig <martin@ximian.com>
11141 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
11142 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
11143 AsAccessible(), moved them as well.
11145 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
11147 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
11149 * cs-parser.jay : Renamed yyName to yyNames related to jay.
11151 2003-10-07 Miguel de Icaza <miguel@ximian.com>
11153 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
11154 generation for >=, as spotted by Paolo, bug 48679.
11155 Patch from David Waite.
11157 * cs-tokenizer.cs: Add handling for #pragma.
11159 * cs-parser.jay: Allow for both yield and yield return in the
11160 syntax. The anti-cobolization of C# fight will go on!
11162 * class.cs (TypeBuilder.DefineType): Catch error condition here
11163 (Parent.DefineType erroring out and returning null).
11165 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
11166 coping with enumerations variables, we were mistakenly processing
11167 them as a regular value type instead of built-in types. Fixes the
11170 * typemanager.cs (IsBuiltinOrEnum): New method.
11172 2003-09-30 Miguel de Icaza <miguel@ximian.com>
11174 * cs-parser.jay: Upgrade: yield now needs the return clause.
11176 2003-09-19 Martin Baulig <martin@ximian.com>
11178 * decl.cs (MemberCache.SetupCacheForInterface): Take a
11179 `MemberCache parent' argument. Normally, an interface doesn't
11180 have a parent type except System.Object, but we use this in gmcs
11181 for generic type parameters.
11183 2003-09-18 Martin Baulig <martin@ximian.com>
11185 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
11186 on `type.IsInterface'; don't check whether the type has a parent
11187 to determine whether it's an interface.
11189 2003-09-15 Martin Baulig <martin@ximian.com>
11191 * class.cs (TypeContainer.DefineType): Added an error flag to
11192 avoid reporting duplicate CS0146's ("class definition is
11195 * driver.cs (Driver.MainDriver): Abort if
11196 RootContext.ResolveTree() reported any errors.
11198 2003-09-07 Martin Baulig <martin@ximian.com>
11200 * report.cs (Error, Warning): Added overloaded versions which take
11201 a `params object[] args' and call String.Format().
11203 2003-09-07 Martin Baulig <martin@ximian.com>
11205 * decl.cs (DeclSpace..ctor): Don't call
11206 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
11207 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
11208 (DeclSpace.RecordDecl): New method.
11210 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
11212 2003-09-02 Ravi Pratap <ravi@ximian.com>
11214 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
11215 value attributes to be applied to ParameterBuilders.
11217 * class.cs (MethodCore.LabelParameters): Make static and more
11218 generic so that it can be used from other places - like interface
11219 methods, for instance.
11221 * interface.cs (Interface.Emit): Call LabelParameters before
11222 emitting attributes on the InterfaceMethod.
11224 2003-08-26 Martin Baulig <martin@ximian.com>
11226 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
11227 resolving aliases; fixes #47927.
11229 2003-08-26 Martin Baulig <martin@ximian.com>
11231 * statement.cs (Using.DoResolve): This is internally emitting a
11232 try/finally clause, so we need to set ec.NeedExplicitReturn if we
11233 do not always return. Fixes #47681.
11235 2003-08-26 Martin Baulig <martin@ximian.com>
11237 * decl.cs (MemberCore): Moved WarningNotHiding(),
11238 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
11240 (AdditionResult): Make this nested in DeclSpace.
11241 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
11242 argument; call NamespaceEntry.Define() unless we're nested in a
11245 * namespace.cs (Namespace.DefineName): New public function. This
11246 is called from DeclSpace's .ctor to add
11247 (Namespace.Lookup): Include DeclSpaces in the lookup.
11249 * class.cs (Operator): Derive from MemberBase, not MemberCore.
11251 * const.cs (Const): Derive from MemberBase, not MemberCore.
11253 2003-08-25 Martin Baulig <martin@ximian.com>
11255 * convert.cs (Convert.ExplicitReferenceConversion): When
11256 converting from an interface type to a class, unbox if the target
11257 type is a struct type. Fixes #47822.
11259 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11261 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
11264 2003-08-22 Martin Baulig <martin@ximian.com>
11266 * class.cs (TypeManager.DefineType): When defining a nested type,
11267 call DefineType() on our parent; fixes #47801.
11269 2003-08-22 Martin Baulig <martin@ximian.com>
11271 * class.cs (MethodData.Define): While checking if a method is an
11272 interface implementation, improve the test a bit more to fix #47654.
11274 2003-08-22 Martin Baulig <martin@ximian.com>
11276 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
11277 correctly; fixes #47722.
11279 2003-08-22 Martin Baulig <martin@ximian.com>
11281 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
11282 LocalVariableReference, ensure it's not read-only. Fixes #47536.
11284 * statement.cs (Fixed.DoResolve): Make all variables read-only.
11286 2003-08-22 Martin Baulig <martin@ximian.com>
11288 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
11289 can only be assigned in static constructors. Fixes #47161.
11291 2003-08-22 Martin Baulig <martin@ximian.com>
11293 Rewrote and improved the flow analysis code.
11295 * flowbranching.cs (FlowBranching): Make this class abstract.
11296 (FlowBranching.CreateBranching): New static function to create a
11297 new flow branching.
11298 (FlowBranchingBlock, FlowBranchingException): New classes.
11299 (FlowBranching.UsageVector.Type): New public readonly field.
11300 (FlowBranching.UsageVector.Breaks): Removed the setter.
11301 (FlowBranching.UsageVector.Returns): Removed the setter.
11302 (FlowBranching.UsageVector): Added Break(), Return(),
11303 NeverReachable() and Throw() methods to modify the reachability.
11304 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
11305 done by FlowBranching.Merge().
11306 (FlowBranching.UsageVector.MergeChild): New method; merges the
11307 merge result into the current vector.
11308 (FlowBranching.Merge): New abstract method to merge a branching.
11310 2003-08-12 Martin Baulig <martin@ximian.com>
11312 * expression.cs (Indirection.CacheTemporaries): Create the
11313 LocalTemporary with the pointer type, not its element type.
11315 2003-08-10 Miguel de Icaza <miguel@ximian.com>
11317 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
11318 token was a keyword or not.
11320 Add `error' options where an IDENTIFIER was expected; Provide
11321 CheckToken and CheckIdentifierToken convenience error reporting
11324 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
11326 * decl.cs: Rename `NamespaceEntry Namespace' public field into
11327 NameSpaceEntry NameSpaceEntry.
11329 (LookupInterfaceOrClass): Avoid creating a full qualified name
11330 from namespace and name: avoid doing lookups when we know the
11331 namespace is non-existant. Use new Tree.LookupByNamespace which
11332 looks up DeclSpaces based on their namespace, name pair.
11334 * driver.cs: Provide a new `parser verbose' to display the
11335 exception thrown during parsing. This is turned off by default
11336 now, so the output of a failure from mcs is more graceful.
11338 * namespace.cs: Track all the namespaces defined in a hashtable
11341 (IsNamespace): New method
11343 2003-08-09 Miguel de Icaza <miguel@ximian.com>
11345 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
11346 we know that we need to concatenate (full typename can never be
11351 * statement.cs: Use a bitfield; Do not initialize to null things
11352 which are done by the constructor by default.
11354 * cs-parser.jay: bug fix, parameter was 4, not 3.
11356 * expression.cs: Just use the property;
11358 * statement.cs: No need for GetVariableInfo method.
11360 2003-08-08 Martin Baulig <martin@ximian.com>
11362 * flowanalysis.cs (FlowReturns): This is now nested in the
11363 `FlowBranching' class.
11364 (MyBitVector): Moved this here from statement.cs.
11365 (FlowBranching.SiblingType): New enum type.
11366 (FlowBranching.CreateSibling): Added `SiblingType' argument.
11368 2003-08-07 Martin Baulig <martin@ximian.com>
11370 * flowanalysis.cs (FlowBranchingType): This is now nested in the
11371 `FlowBranching' class and called `BranchingType'.
11373 2003-08-07 Martin Baulig <martin@ximian.com>
11375 * flowanalysis.cs: Moved all the control flow analysis code into
11378 2003-08-07 Martin Baulig <martin@ximian.com>
11380 * assign.cs (Assign.DoResolve): `target' must either be an
11381 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
11384 2003-08-07 Miguel de Icaza <miguel@ximian.com>
11386 * expression.cs (BinaryMethod): This kind of expression is created by the
11387 Binary class if it determines that the operator has to be handled
11390 (BinaryDelegate): This kind of expression is created if we are
11391 dealing with a + or - operator on delegates.
11393 (Binary): remove method, argumetns, and DelegateOperator: when
11394 dealing with methods,
11396 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
11398 * statement.cs (Block): use bitfields for the three extra booleans
11399 we had in use. Remove unused topblock parameter.
11401 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
11403 * assign.cs: Drop extra unneeded tests.
11405 2003-08-06 Miguel de Icaza <miguel@ximian.com>
11407 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
11409 * statement.cs (Foreach): Use VariableStorage instead of
11412 * codegen.cs (VariableStorage): New class used by clients that
11413 require a variable stored: locals or fields for variables that
11414 need to live across yield.
11416 Maybe provide a convenience api for EmitThis+EmitLoad?
11418 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
11421 2003-08-05 Miguel de Icaza <miguel@ximian.com>
11423 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
11424 RemapParameterLValue): New methods that are used to turn a
11425 precomputed FieldInfo into an expression like this:
11429 The idea is to use this instead of making LocalVariableReference
11430 have more than one meaning.
11432 * cs-parser.jay: Add error production to BASE.
11434 * ecore.cs: Deal with TypeManager.GetField returning null, which
11435 is now a valid return value.
11437 (FieldExprNoAddress): New expression for Fields whose address can
11440 * expression.cs (LocalVariableReference): During the resolve
11441 phases, create new expressions if we are in a remapping context.
11442 Remove code that dealt with remapping here.
11444 (ParameterReference): same.
11446 (ProxyInstance): New expression, like the `This' expression, but
11447 it is born fully resolved. We know what we are doing, so remove
11448 the errors that are targeted to user-provided uses of `this'.
11450 * statement.cs (Foreach): our variable is now stored as an
11451 Expression; During resolution, follow the protocol, dont just
11452 assume it will return this.
11454 2003-08-06 Martin Baulig <martin@ximian.com>
11456 * support.cs (SeekableStreamReader.cs): New public class.
11458 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
11459 SeekableStreamReader instead of the normal StreamReader.
11461 2003-08-04 Martin Baulig <martin@ximian.com>
11463 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
11464 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
11465 deambiguate casts and delegate invocations.
11466 (parenthesized_expression): Use the new tokens to ensure this is
11467 not a cast of method invocation.
11469 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
11470 when reading a `)' and Deambiguate_CloseParens () was previously
11473 * expression.cs (ParenthesizedExpression): New class. This is
11474 just used for the CS0075 test.
11475 (Binary.DoResolve): Check for CS0075.
11477 2003-07-29 Ravi Pratap <ravi@ximian.com>
11479 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
11480 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
11481 reference comparison.
11483 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
11484 examine the ReturnType for equality - this is necessary in the
11485 cases of implicit and explicit operators whose signature also
11486 includes the return type.
11488 2003-07-26 Miguel de Icaza <miguel@ximian.com>
11490 * namespace.cs: Cache the result of the namespace computation,
11491 instead of computing it every time.
11493 2003-07-24 Miguel de Icaza <miguel@ximian.com>
11495 * decl.cs: Use a global arraylist that we reuse over invocations
11496 to avoid excesive memory consumption. Reduces memory usage on an
11497 mcs compile by one meg (45 average).
11499 * typemanager.cs (LookupTypeReflection): In .NET pointers are
11500 private, work around that.
11502 2003-07-23 Miguel de Icaza <miguel@ximian.com>
11504 * literal.cs (IntLiteral): Define Zero and One static literals.
11506 * cs-parser.jay (integer_literal): use static literals to reduce
11507 memory usage for the most used literals (0, 1 and -1). 211kb
11508 reduced in memory usage.
11510 Replace all calls to `new ArrayList' with `new
11511 ArrayList(4)' which is a good average number for most allocations,
11512 and also requires only 16 bytes of memory for its buffer by
11515 This reduced MCS memory usage in seven megabytes for the RSS after
11518 2003-07-28 Ravi Pratap <ravi@ximian.com>
11520 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
11521 handle params methods the correct way by forming only one
11522 applicable set with params and normal methods in them. Earlier we
11523 were looking at params methods only if we found no normal methods
11524 which was not the correct thing to do.
11526 (Invocation.BetterFunction): Take separate arguments indicating
11527 when candidate and the best method are params methods in their
11530 This fixes bugs #43367 and #46199.
11532 * attribute.cs: Documentation updates.
11534 (CheckAttribute): Rename to CheckAttributeTarget.
11535 (GetValidPlaces): Rename to GetValidTargets.
11537 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
11538 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
11542 2003-07-28 Martin Baulig <martin@ximian.com>
11544 * class.cs (TypeContainer.DefineMembers): Use the base type's full
11545 name when looking up the base class of a nested class. Fixes #46977.
11547 2003-07-26 Martin Baulig <martin@ximian.com>
11549 * expression.cs (Indexers.Indexer): New nested struct; contains
11550 getter, setter and the indexer's type.
11551 (Indexers.Properties): This is now an ArrayList of
11552 Indexers.Indexer's.
11553 (IndexerAccess.DoResolveLValue): Correctly set the type if the
11554 indexer doesn't have any getters.
11556 * assign.cs (Assign.DoResolve): Also do the implicit conversions
11557 for embedded property and indexer assignments.
11559 2003-07-26 Martin Baulig <martin@ximian.com>
11561 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
11562 preprocessor directive is not the first non-whitespace character
11565 2003-07-26 Martin Baulig <martin@ximian.com>
11567 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
11568 namespace parsing, follow the spec more closely.
11570 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
11571 NamespaceEntry.Lookup().
11573 2003-07-25 Martin Baulig <martin@ximian.com>
11575 * MethodCore.cs (OverridesSomething): New public field; it's set
11576 from TypeContainer.DefineMembers if this method overrides
11577 something (which doesn't need to be a method). Fix #39462.
11579 2003-07-25 Ravi Pratap <ravi@ximian.com>
11581 * typemanager.cs (GetMembers): Ensure that the list of members is
11582 reversed. This keeps things in sync.
11584 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
11585 find an AttributeUsage attribute.
11587 * expression.cs (Invocation.OverloadResolve): Perform the check
11588 which disallows Invoke to be directly called on a Delegate.
11590 (Error_InvokeOnDelegate): Report error cs1533.
11592 2003-07-25 Martin Baulig <martin@ximian.com>
11594 * expression.cs (Indexers.GetIndexersForType): Only look in the
11595 interface hierarchy if the requested type is already an
11596 interface. Fixes #46788 while keeping #46502 fixed.
11598 2003-07-25 Martin Baulig <martin@ximian.com>
11600 * class.cs (TypeContainer.DefineMembers): Check whether all
11601 readonly fields have been assigned and report warning CS0649 if
11604 * statement.cs (LocalInfo.IsFixed): Always return true if this is
11607 2003-07-24 Ravi Pratap <ravi@ximian.com>
11609 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
11610 returned from GetMethods to make things consistent with the
11611 assumptions MCS makes about ordering of methods.
11613 This should comprehensively fix bug #45127 and it does :-)
11615 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
11616 ordering is actually reverse.
11618 * Clean up some debug messages I left lying around.
11620 * interface.cs (Populate*): Get rid of code which emits attributes
11621 since the stage in which we emit attributes is the 'Emit' stage,
11622 not the define stage.
11624 (Emit): Move attribute emission for interface members here.
11626 2003-07-22 Ravi Pratap <ravi@ximian.com>
11628 * expression.cs (Invocation.OverloadResolve): Follow the spec more
11629 closely: we eliminate methods in base types when we have an
11630 applicable method in a top-level type.
11632 Please see section 14.5.5.1 for an exact description of what goes
11635 This fixes bug #45127 and a host of other related to corlib compilation.
11637 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
11638 array is the method corresponding to the top-level type (this is
11639 because of the changes made to icall.c) so we change this
11642 (MethodGroupExpr.Name): This too.
11644 * typemanager.cs (GetElementType): New method which does the right
11645 thing when compiling corlib.
11647 * everywhere: Make use of the above in the relevant places.
11649 2003-07-22 Martin Baulig <martin@ximian.com>
11651 * cs-parser.jay (invocation_expression): Moved
11652 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
11653 `cast_expression', but create a InvocationOrCast which later
11654 resolves to either an Invocation or a Cast.
11656 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
11657 method; call this before EmitStatement() to make sure that this
11658 expression can be used as a statement.
11660 * expression.cs (InvocationOrCast): New class; resolves to either
11661 an Invocation or a Cast.
11663 * statement.cs (StatementExpression): Call ResolveStatement() on
11664 the ExpressionStatement before emitting it.
11666 2003-07-21 Martin Baulig <martin@ximian.com>
11668 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
11669 `ref' and `out' attributes match; fixes #46220.
11670 (MemberAccess.ResolveMemberAccess): You can't reference a type
11671 through an expression; fixes #33180.
11672 (Indexers.GetIndexersForType): Don't return the indexers from
11673 interfaces the class implements; fixes #46502.
11675 2003-07-21 Martin Baulig <martin@ximian.com>
11677 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
11678 CS0661 checks; fixes bug #30442.
11680 2003-07-21 Martin Baulig <martin@ximian.com>
11682 * decl.cs (AdditionResult): Added `Error'.
11684 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
11686 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
11687 makes cs0031.cs actually work.
11689 2003-07-20 Martin Baulig <martin@ximian.com>
11691 * namespace.cs: Fixed that bug which caused a crash when compiling
11692 the debugger's GUI.
11694 2003-07-20 Miguel de Icaza <miguel@ximian.com>
11696 * typemanager.cs (LookupTypeReflection): Never expose types which
11697 are NotPublic, NestedPrivate, NestedAssembly, or
11698 NestedFamANDAssem. We used to return these, and later do a check
11699 that would report a meaningful error, but the problem is that we
11700 would not get the real match, if there was a name override.
11702 2003-07-18 Miguel de Icaza <miguel@ximian.com>
11704 * namespace.cs (Namespace, Name): Do not compute the namespace
11705 name dynamically, compute it in the constructor. This reduced
11706 memory usage by 1697 KB.
11708 * driver.cs: Use --pause to pause at the end.
11710 2003-07-17 Peter Williams <peter@newton.cx>
11712 * Makefile: Change the name of the test target so that it doesn't
11713 conflict with the recursive test target.
11715 2003-07-17 Miguel de Icaza <miguel@ximian.com>
11717 * expression.cs (LocalVariableReference.Emit, EmitAssign,
11718 AddressOf): Do not use EmitThis, that was wrong, use the actual
11721 2003-07-15 Miguel de Icaza <miguel@ximian.com>
11723 * class.cs (MethodData.Define): While checking if a method is an
11724 interface implementation, improve the test: If we are not public
11725 (use new test here: use the computed MethodAttributes directly,
11726 instead of the parsed modifier flags) check if the `implementing'
11727 method comes from an interface or not.
11729 * pending.cs (VerifyPendingMethods): Slightly better error
11732 * makefile: add test target that does the mcs bootstrap.
11734 2003-07-16 Ravi Pratap <ravi@ximian.com>
11736 * interface.cs (Define): Do nothing here since there are no
11737 members to populate etc. Move the attribute emission out of here
11738 since this was just totally the wrong place to put it. Attribute
11739 application happens during the 'Emit' phase, not in the 'Define'
11742 (Emit): Add this method and move the attribute emission here
11744 * rootcontext.cs (EmitCode): Call the Emit method on interface
11747 2003-07-14 Ravi Pratap M <ravi@ximian.com>
11749 * expression.cs (OverloadResolve): Report error only if Location
11750 is not 'Null' which means that there was a probe going on.
11752 2003-07-14 Martin Baulig <martin@ximian.com>
11754 * expression.cs (ConditionalLogicalOperator): New public class to
11755 implement user defined conditional logical operators.
11756 This is section 14.11.2 in the spec and bug #40505.
11758 2003-07-14 Martin Baulig <martin@ximian.com>
11760 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
11762 2003-07-14 Martin Baulig <martin@ximian.com>
11764 * codegen.cs (EmitContext.InFixedInitializer): New public field.
11766 * ecore.cs (IVariable.VerifyFixed): New interface method.
11768 * expression.cs (Unary.ResolveOperator): When resolving the `&'
11769 operator, check whether the variable is actually fixed. Fixes bug
11770 #36055. Set a variable definitely assigned when taking its
11771 address as required by the spec.
11773 * statement.cs (LocalInfo.IsFixed): New field.
11774 (LocalInfo.MakePinned): Set `IsFixed' to true.
11776 2003-07-14 Ravi Pratap M <ravi@ximian.com>
11778 * attribute.cs (Attribute.Resolve): While doing a Member lookup
11779 for .ctors, ensure that we only ask for members declared in the
11780 attribute type (BindingFlags.DeclaredOnly).
11784 * expression.cs (Error_WrongNumArguments): Report error 1501
11785 correctly the way CSC does.
11787 2003-07-13 Martin Baulig <martin@ximian.com>
11789 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
11790 lookup on the fully qualified name, to make things like "X.X" work
11791 where "X.X" is a fully qualified type name, but we also have a
11792 namespace "X" in the using list. Fixes #41975.
11794 2003-07-13 Martin Baulig <martin@ximian.com>
11796 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
11797 function. If we're a CompoundAssign, we need to create an embedded
11798 CompoundAssign, not an embedded Assign.
11799 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
11802 2003-07-13 Martin Baulig <martin@ximian.com>
11804 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
11805 work to fix bug #46088.
11807 2003-07-13 Ravi Pratap <ravi@ximian.com>
11809 * class.cs (Operator.Emit): Do not emit attributes here - it is
11810 taken care of by the Method class that we delegate too. This takes
11811 care of bug #45876.
11813 2003-07-10 Martin Baulig <martin@ximian.com>
11815 * expression.cs (TypeOfVoid): New class.
11816 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
11818 2003-07-10 Martin Baulig <martin@ximian.com>
11820 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
11823 2003-07-10 Martin Baulig <martin@ximian.com>
11825 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
11826 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
11828 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
11830 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
11832 2003-07-10 Martin Baulig <martin@ximian.com>
11834 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
11835 of decimal. Fixes #42850.
11837 NOTE: I also fixed the created byte blob, but this doesn't work on
11838 the MS runtime and csc never produces any byte blobs for decimal
11841 2003-07-10 Martin Baulig <martin@ximian.com>
11843 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
11844 structs; fixes #32068.
11845 (Block.AddChildVariableNames): Fixed #44302.
11847 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11849 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
11851 2003-07-07 Miguel de Icaza <miguel@ximian.com>
11853 * attribute.cs: And this test is onger needed.
11855 2003-07-08 Martin Baulig <martin@ximian.com>
11857 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
11858 inaccessible types. Fixes #36313.
11860 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
11862 * namespace.cs (NamespaceEntry): Create implicit entries for all
11863 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
11864 implicit entries for N1.N2 and N1.
11866 2003-07-08 Martin Baulig <martin@ximian.com>
11868 Rewrote the handling of namespaces to fix a lot of the issues
11869 wrt. `using' aliases etc.
11871 * namespace.cs (Namespace): Splitted this class into a
11872 per-assembly `Namespace' and a per-file `NamespaceEntry'.
11874 * typemanager.cs (TypeManager.IsNamespace): Removed.
11875 (TypeManager.ComputeNamespaces): Only compute namespaces from
11876 loaded assemblies here, not the namespaces from the assembly we're
11877 currently compiling.
11879 2003-07-08 Martin Baulig <martin@ximian.com>
11881 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
11883 2003-07-07 Miguel de Icaza <miguel@ximian.com>
11885 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
11888 I thought about the memory savings here, but LookupTypeReflection
11889 is used under already very constrained scenarios. Compiling
11890 corlib or mcs only exposes one hit, so it would not really reduce
11891 any memory consumption.
11893 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11895 * typemanager.cs: fixes bug #45889 by only adding public types from
11896 other assemblies to the list of known types.
11898 2003-07-07 Miguel de Icaza <miguel@ximian.com>
11900 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
11901 on the type we resolved.
11903 2003-07-05 Martin Baulig <martin@ximian.com>
11905 * pending.cs (PendingImplementation.ParentImplements): Don't
11906 create the proxy if the parent is abstract.
11908 * class.cs (TypeContainer.DefineIndexers): Process explicit
11909 interface implementations first. Fixes #37714.
11911 2003-07-04 Miguel de Icaza <miguel@ximian.com>
11913 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
11914 defined recursively; but since we modify the input parameters
11915 (left is set to `this' temporarily), we reset this value if the
11916 left_is_explicit is false, which gives the original semantics to
11919 * literal.cs (NullPointer): new class used to represent a null
11920 literal in a pointer context.
11922 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
11923 type is a pointer, use a NullPointer object instead of a
11924 NullLiteral. Closes 43687
11926 (ExplicitConversion): Convert pointer values using
11927 the conv opcode to the proper type.
11929 * ecore.cs (New): change ValueTypeVariable property into a method,
11930 that returns whether the valuetype is suitable for being used.
11932 * expression.cs (Binary.DoNumericPromotions): Only return if we
11933 the int constant was a valid uint, and we can return both left and
11934 right as uints. If not, we continue processing, to trigger the
11935 type conversion. This fixes 39018.
11937 * statement.cs (Block.EmitMeta): During constant resolution, set
11938 the CurrentBlock property on the emitcontext, so that we resolve
11939 constants propertly.
11941 2003-07-02 Martin Baulig <martin@ximian.com>
11943 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
11944 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
11946 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
11947 than emitting it here.
11949 * statement.cs: Fixed some more flow analysis bugs.
11951 2003-07-02 Martin Baulig <martin@ximian.com>
11953 * class.cs (MethodData.Define): When implementing interface
11954 methods, set Final unless we're Virtual.
11956 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
11957 check work for interface methods.
11959 2003-07-01 Martin Baulig <martin@ximian.com>
11961 * ecore.cs (EmitContext.This): Replaced this property with a
11962 GetThis() method which takes a Location argument. This ensures
11963 that we get the correct error location for a CS0188.
11965 2003-07-01 Miguel de Icaza <miguel@ximian.com>
11967 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
11968 ImplicitStandardConversion.
11970 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
11972 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
11974 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
11977 2003-06-30 Miguel de Icaza <miguel@ximian.com>
11979 * class.cs (Constructor.Define): Turn off initlocals for unsafe
11982 (MethodData.Define): Turn off initlocals for unsafe methods.
11984 2003-06-29 Miguel de Icaza <miguel@ximian.com>
11986 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
11987 complete; Fixes #37521.
11989 * delegate.cs: Use Modifiers.TypeAttr to compute the
11990 TypeAttributes, instead of rolling our own. This makes the flags
11991 correct for the delegates.
11993 2003-06-28 Miguel de Icaza <miguel@ximian.com>
11995 * class.cs (Constructor.Define): Set the private flag for static
11996 constructors as well.
11998 * cs-parser.jay (statement_expression): Set the return value to
11999 null, to avoid a crash when we catch an error.
12001 2003-06-24 Miguel de Icaza <miguel@ximian.com>
12003 * cs-parser.jay: Applied patch from Jackson that adds support for
12004 extern and unsafe modifiers to destructor declarations.
12006 * expression.cs: Report error 21 if the user is trying to index a
12009 * driver.cs: Add an error message, suggested by the bug report.
12011 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
12012 if we do not have a ": this ()" constructor initializer. Fixes 45149
12014 2003-06-14 Miguel de Icaza <miguel@ximian.com>
12016 * namespace.cs: Add some information to reduce FAQs.
12018 2003-06-13 Miguel de Icaza <miguel@ximian.com>
12020 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
12021 underlying enumeration types. Fixes #43915.
12023 * expression.cs: Treat ushort/short as legal values to be used in
12024 bitwise operations.
12026 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
12028 * delegate.cs: transfer custom attributes for paramenters from
12029 the delegate declaration to Invoke and BeginInvoke.
12031 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
12033 * attribute.cs: handle custom marshalers and emit marshal info
12036 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
12038 * makefile.gnu: Added anonymous.cs to the compiler sources.
12040 2003-05-28 Miguel de Icaza <miguel@ximian.com>
12042 * iterators.cs: Change the name of the proxy class to include two
12045 * cs-parser.jay: Update grammar to include anonymous methods.
12047 * anonymous.cs: new file.
12049 2003-05-27 Miguel de Icaza <miguel@ximian.com>
12051 * class.cs (Field.Define): Add missing test for pointers and
12054 2003-05-27 Ravi Pratap <ravi@ximian.com>
12056 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
12057 we use the stobj opcode.
12059 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
12060 since it wasn't the correct fix.
12062 It still is puzzling that we are required to use stobj for IntPtr
12063 which seems to be a ValueType.
12065 2003-05-26 Miguel de Icaza <miguel@ximian.com>
12067 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
12068 during regular simple name resolution. Now, the trick is that
12069 instead of returning for processing the simplename, we do a
12070 TypeManager.LookupType (ie, a rooted lookup as opposed to a
12071 contextual lookup type). If a match is found, return that, if
12072 not, return for further composition.
12074 This fixes long-standing 30485.
12076 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
12077 using the address to initialize an object, do an Stobj instead of
12078 using the regular Stelem.
12080 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
12081 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
12082 Because if we are a BaseIndexerAccess that value will be true.
12085 * statement.cs (GotoCase.Resolve): Return after reporting an
12086 error, do not attempt to continue.
12088 * expression.cs (PointerArithmetic.Emit): If our operand is a
12089 long, convert our constants to match the operand before
12090 multiplying. Convert to I type before adding. Fixes 43670.
12092 2003-05-14 Ravi Pratap <ravi@ximian.com>
12094 * enum.cs (ImplicitConversionExists) : Rename to
12095 ImplicitEnumConversionExists to remove ambiguity.
12097 * ecore.cs (NullCast): New type of cast expression class which
12098 basically is very similar to EmptyCast with the difference being
12099 it still is a constant since it is used only to cast a null to
12101 (eg. (string) null)
12103 * convert.cs (ImplicitReferenceConversion): When casting a null
12104 literal, we return a NullCast.
12106 * literal.cs (NullLiteralTyped): Remove - I don't see why this
12107 should be around anymore.
12109 The renaming (reported was slightly wrong). Corrections:
12111 ConvertImplicitStandard -> ImplicitConversionStandard
12112 ConvertExplicitStandard -> ExplicitConversionStandard
12114 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
12115 before passing them in !
12117 * convert.cs (ImplicitConversionStandard): When comparing for
12118 equal expr and target types, ensure that expr is not a
12121 In general, we must not be checking (expr_type ==
12122 target_type) in the top level conversion methods
12123 (ImplicitConversion, ExplicitConversion etc). This checking is
12124 done in the methods that they delegate to.
12126 2003-05-20 Miguel de Icaza <miguel@ximian.com>
12128 * convert.cs: Move Error_CannotConvertType,
12129 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
12130 ImplicitNumericConversion, ImplicitConversionExists,
12131 ImplicitUserConversionExists, StandardConversionExists,
12132 FindMostEncompassedType, FindMostSpecificSource,
12133 FindMostSpecificTarget, ImplicitUserConversion,
12134 ExplicitUserConversion, GetConversionOperators,
12135 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
12136 TryImplicitIntConversion, Error_CannotConvertImplicit,
12137 ConvertImplicitRequired, ConvertNumericExplicit,
12138 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
12139 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
12142 Perform the following renames:
12144 StandardConversionExists -> ImplicitStandardConversionExists
12145 ConvertImplicit -> ImplicitConversion
12146 ConvertImplicitStandard -> ImplicitStandardConversion
12147 TryImplicitIntConversion -> ImplicitIntConversion
12148 ConvertImplicitRequired -> ImplicitConversionRequired
12149 ConvertNumericExplicit -> ExplicitNumericConversion
12150 ConvertReferenceExplicit -> ExplicitReferenceConversion
12151 ConvertExplicit -> ExplicitConversion
12152 ConvertExplicitStandard -> ExplicitStandardConversion
12154 2003-05-19 Martin Baulig <martin@ximian.com>
12156 * statement.cs (TypeInfo.StructInfo): Made this type protected.
12157 (TypeInfo): Added support for structs having structs as fields.
12159 * ecore.cs (FieldExpr): Implement IVariable.
12160 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
12161 VariableInfo for the field.
12163 2003-05-18 Martin Baulig <martin@ximian.com>
12165 * expression.cs (This.DoResolve): Report a CS0027 if we're
12166 emitting a field initializer.
12168 2003-05-18 Martin Baulig <martin@ximian.com>
12170 * expression.cs (This.ResolveBase): New public function.
12171 (This.DoResolve): Check for CS0188.
12173 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
12176 * ecore.cs (MethodGroupExpr.DoResolve): Set the
12177 `instance_expression' to null if we don't have any non-static
12180 2003-05-18 Martin Baulig <martin@ximian.com>
12182 Reworked the way how local variables and parameters are handled by
12183 the flow analysis code.
12185 * statement.cs (TypeInfo, VariableMap): New public classes.
12186 (VariableInfo): New public class. This is now responsible for
12187 checking whether a variable has been assigned. It is used for
12188 parameters and local variables.
12189 (Block.EmitMeta): Take the InternalParameters as argument; compute
12190 the layout of the flow vectors here.
12191 (Block.LocalMap, Block.ParameterMap): New public properties.
12192 (FlowBranching): The .ctor doesn't get the InternalParameters
12193 anymore since Block.EmitMeta() now computes the layout of the flow
12195 (MyStructInfo): This class is now known as `StructInfo' and nested
12196 in `TypeInfo'; we don't access this directly anymore.
12198 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
12199 property and removed IsAssigned(), IsFieldAssigned(),
12200 SetAssigned() and SetFieldAssigned(); we now call them on the
12201 VariableInfo so we don't need to duplicate this code everywhere.
12203 * expression.cs (ParameterReference): Added `Block block' argument
12205 (LocalVariableReference, ParameterReference, This): The new
12206 VariableInfo class is now responsible for all the definite
12209 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
12210 IsParameterAssigned, SetParameterAssigned): Removed.
12212 2003-05-18 Martin Baulig <martin@ximian.com>
12214 * typemanager.cs (InitCoreTypes): Try calling
12215 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
12216 the 3-args-version. Corlib now also needs our `void_type'.
12217 (GetMethod): Added overloaded version which takes an optional
12218 `bool report_errors' to allow lookups of optional methods.
12220 2003-05-12 Martin Baulig <martin@ximian.com>
12222 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
12223 only used for locals and not for parameters.
12225 2003-05-12 Miguel de Icaza <miguel@ximian.com>
12227 * support.cs (InternalParameters.ParameterType): Return the
12228 ExternalType of the parameter.
12230 * parameter.cs (Parameter.ExternalType): drop the two arguments,
12233 2003-05-11 Miguel de Icaza <miguel@ximian.com>
12235 * class.cs (MethodData.Define): Do not set the `newslot' on
12236 interface members, if they are also flagged as "override".
12238 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
12239 better code for ++i and i++. This only works for static fields
12240 and local variables.
12242 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
12243 want to pull the DeclSpace out of the builder_to_declspace instead
12244 of the TypeBuilder (like in TypeContainer.FindMembers).
12246 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
12247 instead of LookupTypeContainer. Fixes the crash on .NET for
12248 looking up interface members.
12250 * const.cs: Create our own emit context during the Definition
12251 stage, so that constants are evaluated in the proper context, when
12252 a recursive definition happens.
12254 2003-05-11 Martin Baulig <martin@ximian.com>
12256 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
12257 new block for a switch section.
12258 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
12259 the adding/lookup in the switch block. Fixes #39828.
12261 2003-05-09 Miguel de Icaza <miguel@ximian.com>
12263 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
12264 functionality: I needed to convert the data after I had performed
12265 the add/sub operation into the operands type size.
12267 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
12268 pass the type for the box operation, otherwise the resulting
12269 object would have been of type object.
12271 (BoxedCast): Add constructor to specify the type to box as.
12273 2003-05-07 Miguel de Icaza <miguel@ximian.com>
12275 * iterators.cs: I was reusing the `count' variable inadvertently,
12276 take steps to not allow this to happen.
12278 2003-05-06 Miguel de Icaza <miguel@ximian.com>
12280 * attribute.cs (Attribute.Resolve): Params attributes are encoded
12281 by creating an array at the point where the params starts and
12282 putting all those arguments there, then adjusting the size of the
12285 2003-05-05 Miguel de Icaza <miguel@ximian.com>
12287 * expression.cs (New.AddressOf): Implement interface
12288 IMemoryLocation. This is used when the `new' operator is used in
12289 the context of an invocation to a method on a value type.
12291 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
12294 * namespace.cs: Also check the using aliases here.
12296 * driver.cs: Move the test for using validity after the types have
12297 been entered, so we do a single pass that also includes the using
12300 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
12301 in the regular case. CreateSiblingForFinally is doing extra
12304 * attribute.cs (GetAttributeArgumentExpression): Store the result
12305 on an out value, and use the return value to indicate failure
12306 instead of using null (which is a valid return for Constant.GetValue).
12308 * statement.cs: Perform the analysis flow for the increment
12309 portion after the statement, because this will be the real flow of
12310 execution. Fixes #42385
12312 * codegen.cs (EmitContext.EmitArgument,
12313 EmitContext.EmitStoreArgument): New helper functions when the
12314 RemapToProxy flag is set.
12316 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
12319 Add support for remapping parameters.
12321 * iterators.cs: Propagate parameter values; Store parameter
12322 values in the proxy classes.
12324 2003-05-04 Miguel de Icaza <miguel@ximian.com>
12326 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
12327 need a proxy reference; I do not know what I was thinking
12329 * cs-parser.jay (constructor_initializer): catch another error,
12330 and display nice message.
12332 (field_declaration): catch void field declaration
12333 to flag a better error.
12335 * class.cs (MemberBase.CheckBase): Report an error instead of a
12336 warning if a new protected member is declared in a struct.
12337 (Field.Define): catch the error of readonly/volatile.
12339 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
12341 (FieldExpr.AddressOf): ditto. Catch error where the address of a
12342 volatile variable is taken
12344 2003-05-02 Miguel de Icaza <miguel@ximian.com>
12346 * statement.cs (Fixed.Resolve): Report an error if we are not in
12349 2003-05-01 Miguel de Icaza <miguel@ximian.com>
12351 * typemanager.cs: reuse the code that handles type clashes for
12352 delegates and enumerations.
12354 * class.cs (Report28): Always report.
12356 * expression.cs (EncodeAsAttribute): Allow nulls here.
12358 2003-04-28 Miguel de Icaza <miguel@ximian.com>
12360 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
12361 the functionality for testing whether an expression is valid for
12362 an attribute here. Also handle the case of arrays of elements
12365 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
12366 encoding a linear array into an array of objects that are suitable
12367 to be passed to an CustomAttributeBuilder.
12369 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
12371 * ecore.cs: (FieldExpr): Handle field remapping here.
12373 * iteratators.cs: Pass the instance variable (if the method is an
12374 instance method) to the constructors, so we can access the field
12375 variables on the class.
12377 TODO: Test this with structs. I think the THIS variable on
12378 structs might have to be a pointer, and not a refenrece
12380 2003-04-27 Miguel de Icaza <miguel@ximian.com>
12382 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
12383 local variables to fields in a proxy class.
12385 * iterators.cs (PopulateProxy): Rename our internal fields to
12387 Create a <THIS> field if we are an instance method, so we can
12388 reference our parent container variables.
12389 (MapVariable): Called back from the EmitContext code to enter a
12390 new variable to field mapping into the proxy class (we just create
12394 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
12395 for using the remapped locals to fields.
12397 I placed the code here, because that gives the same semantics to
12398 local variables, and only changes the Emit code.
12400 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
12401 statements inside iterators.
12402 (VariableInfo): Add a FieldBuilder for the cases when we are
12403 remapping local variables to fields in a proxy class
12405 * ecore.cs (SimpleNameResolve): Avoid testing two times for
12406 current_block != null.
12408 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
12409 not cope with strings, as it has been moved to the
12410 TableSwitchEmit. Fixed bug in switch generation.
12412 * expression.cs (New.DoResolve): Provide more context for the user
12413 when reporting an error.
12415 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
12418 * expression.cs (MemberAccess.DoResolve): When we get a type back,
12419 check the permissions for it. Note than in a type-resolution
12420 context the check was already present in DeclSpace.ResolveType,
12421 but was missing from the MemberAccess.
12423 (ArrayCreation.CheckIndices): warn if the user has
12424 more nested levels of expressions, but there are no more
12425 dimensions specified. Avoids crash on bug 41906.
12427 2003-04-26 Miguel de Icaza <miguel@ximian.com>
12429 * statement.cs (Block): replace Implicit bool, for a generic
12431 New flag: `Unchecked'. This is used during the EmitMeta phase
12432 (which is out-of-line with the regular Resolve/Emit process for a
12433 statement, as this is done ahead of time, but still gets a chance
12434 to call constant resolve).
12436 (Block.Flags): new enum for adding a new flag.
12438 (Block.EmitMeta): track the state of unchecked.
12440 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
12441 to enable constant resolution to work there as well.
12443 2003-04-22 Miguel de Icaza <miguel@ximian.com>
12445 * typemanager.cs (ienumerable_type): Also look up
12446 System.Collections.IEnumerable.
12448 2003-04-21 Miguel de Icaza <miguel@ximian.com>
12450 TODO: Test more than one conditional per method.
12452 * class.cs (Indexer.Define): Report the location where the user is
12453 referencing the unsupported feature.
12455 (MethodData): Overload the use of `conditionals' to
12456 minimize the creation of needless ArrayLists. This saves roughly
12457 212kb on my machine.
12459 (Method): Implement the new IIteratorContainer interface.
12460 (Method.SetYields): Implement the method by setting the ModFlags
12461 to contain METHOD_YIELDS.
12463 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
12464 which just got set to null.
12466 * iterators.cs: New file.
12468 (Yield, YieldBreak): New statements.
12470 * statement.cs (Return.Resolve): Flag an error if we are used in
12471 an iterator method.
12473 * codegen.cs (InIterator): New flag set if the code is being
12474 compiled in an iterator method.
12476 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
12477 internal modifier, and we just use it to avoid adding extra
12478 fields, as this is seldom used.
12480 * cs-parser.jay: Add yield_statement (yield and yield break).
12482 * driver.cs: New flag -v2 to turn on version 2 features.
12484 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
12485 hashtable when v2 is enabled.
12487 2003-04-20 Miguel de Icaza <miguel@ximian.com>
12489 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
12490 there is already a namespace defined with this name.
12492 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
12493 people upgraded their corlibs.
12495 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
12496 always use fully qualified types, no need to use the compiler
12499 (TypeManager.IsNamespace): Use binarysearch.
12501 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
12502 AddDelegate): I did not quite use the new IsValid API properly: I
12503 have to pass the short-name and the fullname. I was passing only
12504 the basename instead of the fullname sometimes.
12506 (TypeContainer.DefineType): call NamespaceClash.
12508 * interface.cs (Interface.DefineType): use NamespaceClash before
12511 * delegate.cs (Delegate.DefineType): use NamespaceClash before
12514 * enum.cs: (Enum.DefineType): use NamespaceClash before
12517 * typemanager.cs (: 3-line patch that gives us some tasty 11%
12518 speed increase. First, use the negative_hits cache when we get a
12519 negative. Second, add the type with its full original name
12520 instead of the new . and + encoded name (reflection uses + to
12521 separate type from a nested type). Use LookupTypeReflection
12522 directly which bypasses the type->name hashtable (that we already
12523 know does not contain the type.
12525 * decl.cs (DeclSpace.ResolveTypeExpr): track the
12526 location/container type.
12528 * driver.cs: When passing utf8, use directly the UTF8Encoding.
12530 2003-04-19 Miguel de Icaza <miguel@ximian.com>
12532 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
12534 * delegate.cs (NewDelegate.Resolve): Test whether an instance
12535 method is being referenced in the method group from a static
12536 context, and report error 120 if so.
12538 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
12541 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
12542 is created, we create the A namespace).
12544 * cs-parser.jay: A namespace also introduces a DeclarationFound.
12547 2003-04-18 Miguel de Icaza <miguel@ximian.com>
12549 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
12550 invocation to ModuleBuilder.GetType with the same values will
12551 return a new type instance, so we need to cache its return
12554 * expression.cs (Binary.ResolveOperator): Only allow the compare
12555 operators on enums if they are of the same type.
12557 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
12558 types of ValueType on their own case. Before we were giving them
12559 the same treatment as objects.
12561 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
12562 fullname. Short name is used to compare against container name.
12563 Fullname is used to check against defined namespace names.
12565 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
12566 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
12568 (Method.CheckBase): Call parent.
12569 (MemberBase.CheckBase): Check for protected members on sealed
12571 (PropertyBase.CheckBase): Call parent.
12572 (Field.Define): Call parent.
12574 * report.cs: Negative error codes are now mapped to 8000 - code,
12575 so that the display is render more nicely.
12577 * typemanager.cs: Do not use try/catch, instead report a regular
12580 (GetPointerType, GetReferenceType): These methods provide
12581 mechanisms to obtain the T* and T& from a T. We had the code
12582 previously scattered around the code base, and it also used
12583 TypeManager.LookupType that would go through plenty of caches.
12584 This one goes directly to the type source.
12586 In some places we did the Type.GetType followed by
12587 ModuleBuilder.GetType, but not in others, so this unifies the
12588 processing as well.
12590 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
12591 statements now that we have namespace information.
12593 * typemanager.cs (IsNamespace): New method, returns whether the
12594 string presented is a namespace or not.
12596 (ComputeNamespaces): New public entry point, computes the list of
12597 available namespaces, using the GetNamespaces API call in Mono, or
12598 the slower version in MS.NET.
12600 Now before we start the semantic analysis phase, we have a
12601 complete list of namespaces including everything that the user has
12604 Deleted old code to cache namespaces in .nsc files.
12606 2003-04-17 Miguel de Icaza <miguel@ximian.com>
12608 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
12609 class/struct location definition Location for the implicit
12610 constructor location.
12612 (Operator.Define): Use the location of the operator for the
12613 implicit Method definition.
12615 (Constructor.Emit): use the constructor location for the implicit
12616 base initializer constructor.
12618 * ecore.cs: Remove ITypeExpression. This interface is now gone,
12619 and the Expression class now contains two new methods:
12621 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
12622 isolate type lookup from the rest of the resolution process.
12624 Since we use Expressions to hold type definitions due to the way
12625 we parse the input we have historically overloaded Resolve to
12626 perform the Type lookups if a special flag is passed. Now this is
12627 eliminated and two methods take their place.
12629 The differences in the two methods between xStep and xTerminal is
12630 that xStep is involved in our current lookup system that uses
12631 SimpleNames to compose a name, while xTerminal is used just to
12632 catch the case where the simplename lookup failed.
12634 2003-04-16 Miguel de Icaza <miguel@ximian.com>
12636 * expression.cs (ResolveMemberAccess): Remove redundant code.
12637 TypeExpr expressions are always born fully resolved.
12639 * interface.cs (PopulateMethod): Do not lookup the types twice.
12640 We were doing it once during SemanticAnalysis and once during
12643 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
12644 in local variable type definitions, were being returned as a
12645 SimpleName (we decomposed everything into a string), that is
12646 because primary_expression was being used instead of a type in the
12647 grammar (reduce/reduce conflicts).
12649 The part that was wrong is that we converted the expression into a
12650 string (an oversimplification in one hand, compounded with primary
12651 expressions doing string concatenation).
12657 Would return "A.B.C[]" as a SimpleName. This stopped things like
12658 using clauses from working on this particular context. And a type
12659 was being matched directly against "A.B.C[]".
12661 We now use the correct approach, and allow for ComposedCast to be
12662 part of the unary expression. So the "A.B.C []" become a composed
12663 cast of "A.B.C" (as a nested group of MemberAccess with a
12664 SimpleName at the end) plus the rank composition "[]".
12668 2003-04-10 Miguel de Icaza <miguel@ximian.com>
12670 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
12671 for the access level checking.
12673 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
12674 `TypeContainer container', because I kept getting confused when I
12675 was debugging this code.
12677 * expression.cs (Indexers): Instead of tracking getters/setters,
12678 we now track them in parallel. We create one arraylist less, but
12679 most importantly it is possible now for the LValue code to find a
12680 matching get for a set.
12682 (IndexerAccess.DoResolveLValue): Update the code.
12683 GetIndexersForType has been modified already to extract all the
12684 indexers from a type. The code assumed it did not.
12686 Also make the code set the correct return type for the indexer.
12687 This was fixed a long time ago for properties, but was missing for
12688 indexers. It used to be void_type.
12690 (Binary.Emit): Test first for doubles instead of
12691 floats, as they are more common.
12693 (Binary.EmitBranchable): Use the .un version of the branch opcodes
12694 when dealing with floats and the <=, >= operators. This fixes bug
12697 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
12698 to load the array value by emitting a load on the foreach variable
12699 type. This was incorrect.
12701 We now emit the code to load an element using the the array
12702 variable type, and then we emit the conversion operator.
12706 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
12708 * attribute.cs: Avoid allocation of ArrayLists in the common case.
12710 2003-04-09 Miguel de Icaza <miguel@ximian.com>
12712 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
12713 test for protection before we test for signatures.
12715 (MethodSignature.ToString): implement.
12717 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
12718 to the case where we reduced into a LongConstant.
12720 * decl.cs (CheckAccessLevel): If the type is an array, we can not
12721 depend on whether the information is acurrate, because the
12722 Microsoft runtime will always claim that the array type is public,
12723 regardless of the real state.
12725 If the type is a pointer, another problem happens: the type is
12726 reported as non-public in Microsoft.
12728 In both cases we have to call CheckAccessLevel recursively with
12729 the underlying type as the argument to be tested.
12731 2003-04-08 Miguel de Icaza <miguel@ximian.com>
12733 * assign.cs (Assign.Emit): If we are dealing with a compound
12734 assignment expression, we should use the code path that stores the
12735 intermediate result in a temporary value. This fixes #40903.
12737 *expression.cs (Indirection.ToString): Provide ToString method for
12740 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
12742 * class.cs: Null out fields holding references to Block objects so
12743 they can be garbage collected.
12745 * expression.cs (OverloadResolve): Remove unused local.
12747 2003-04-07 Martin Baulig <martin@ximian.com>
12749 * codegen.cs (EmitContext.CurrentFile): New public field.
12750 (EmitContext.Mark): Use the CurrentFile to check whether the
12751 location is in the correct file.
12752 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
12754 2003-04-07 Martin Baulig <martin@ximian.com>
12756 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
12758 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
12759 location. [FIXME: The location argument which gets passed to this
12760 method is sometimes wrong!]
12762 2003-04-07 Nick Drochak <ndrochak@gol.com>
12764 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
12766 2003-04-07 Miguel de Icaza <miguel@ximian.com>
12768 * expression.cs (Indirection.EmitAssign): We were using the
12769 temporary, but returning immediately instead of continuing the
12772 2003-04-06 Martin Baulig <martin@ximian.com>
12774 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
12775 if it's a nested child, but also deriving from the outer class.
12778 * typemanager.cs (IsNestedChildOf): Make this work if it's a
12779 nested child, but also deriving from the outer class. See
12781 (FilterWithClosure): We may access private members of the outer
12782 class if we're a nested child and deriving from the outer class.
12783 (RealMemberLookup): Only set `closure_private_ok' if the
12784 `original_bf' contained BindingFlags.NonPublic.
12786 2003-04-05 Martin Baulig <martin@ximian.com>
12788 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
12790 2003-04-02 Miguel de Icaza <miguel@ximian.com>
12792 * class.cs (Event.Define): Do not allow abstract events to have
12795 2003-04-01 Miguel de Icaza <miguel@ximian.com>
12797 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
12798 block in event declarations.
12800 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
12801 value type, get its address.
12803 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
12804 leaving a class on the stack instead of a boolean value (int
12805 0/1). Change the code so we compare against null, and then the
12806 result against zero.
12808 * class.cs (TypeContainer.GetClassBases): We were checking for the
12809 parent class being sealed too late.
12811 * expression.cs (Binary.Emit): For <= and >= when dealing with
12812 floating point values, use cgt.un and clt.un instead of cgt and
12815 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
12817 * statement.cs: Apply the same optimization as MS: skip the
12818 GetEnumerator returning an IEnumerator, and use the one returning a
12819 CharEnumerator instead. This allows us to avoid the try-finally block
12822 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
12824 * cs-parser.jay: Attributes cannot be applied to
12825 namespaces. Fixes #40473
12827 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12830 (Add*): check if the name is valid using the full name for constants,
12831 fields, properties and events.
12833 2003-03-28 Miguel de Icaza <miguel@ximian.com>
12835 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
12836 char constants to be part of the enumeration.
12838 * expression.cs (Conditional.DoResolve): Add support for operator
12839 true. Implements the missing functionality from 14.12
12841 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
12842 operator true/false as required by the spec.
12844 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
12845 implicit conversion to boolean.
12847 * statement.cs (Statement.ResolveBoolean): A boolean expression is
12848 also one where the type implements `operator true'.
12850 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
12851 get an expression that will invoke operator true based on an
12854 (GetConversionOperators): Removed the hack that called op_True
12857 (Expression.ResolveBoolean): Move this from Statement.
12859 2003-03-17 Miguel de Icaza <miguel@ximian.com>
12861 * ecore.cs (FieldExpr): do not allow initialization of initonly
12862 fields on derived classes
12864 2003-03-13 Martin Baulig <martin@ximian.com>
12866 * statement.cs (Block.Emit): Call ig.BeginScope() and
12867 ig.EndScope() when compiling with debugging info; call
12868 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
12870 2003-03-08 Miguel de Icaza <miguel@ximian.com>
12872 * expression.cs (Indexers): Do not construct immediately, allow
12873 for new members to be appended as we go. Fixes 38143
12875 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12877 * expression.cs: save/restore context when resolving an unchecked
12880 2003-03-05 Miguel de Icaza <miguel@ximian.com>
12882 * cfold.cs: Catch division by zero in modulus operator during
12885 2003-03-03 Miguel de Icaza <miguel@ximian.com>
12887 * interface.cs (Interface.DefineMembers): Avoid defining members
12890 2003-02-27 Miguel de Icaza <miguel@ximian.com>
12892 * driver.cs: handle the +/- options for -noconfig
12894 * statement.cs (Unckeched.Resolve): Also track the state of
12895 unchecked in the Resolve phase.
12897 2003-02-27 Martin Baulig <martin@ximian.com>
12899 * ecore.cs (Expression.MemberLookup): Don't create a
12900 MethodGroupExpr for something which is not a method. Fixes #38291.
12902 2003-02-25 Miguel de Icaza <miguel@ximian.com>
12904 * class.cs (MemberBase.CheckParameters): Also check that the type
12905 is unmanaged if it is a pointer.
12907 * expression.cs (SizeOf.Resolve): Add location information.
12909 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
12910 a managed type is declared.
12912 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
12913 parameter modifiers as well. Fixes bug 38606
12915 * class.cs: Very sad. Am backing out the speed up changes
12916 introduced by the ArrayList -> Array in the TypeContainer, as they
12917 were not actually that much faster, and introduced a bug (no error
12918 reports on duplicated methods).
12920 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
12921 source first, this will guarantee that we have a valid expression
12922 before calling in lower levels functions that will require a
12923 resolved object. Then use this original_source in the
12924 target.ResolveLValue instead of the original source that was
12927 Another change. Use target.Resolve instead of LValueResolve.
12928 Although we are resolving for LValues, we will let the Assign code
12929 take care of that (it will be called again from Resolve). This
12930 basically allows code like this:
12932 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
12933 class Y { void A (X x) { x [0] += o; }
12935 The problem was that the indexer was trying to resolve for
12936 set_Item (idx, object o) and never finding one. The real set_Item
12937 was set_Item (idx, X). By delaying the process we get the right
12942 2003-02-23 Martin Baulig <martin@ximian.com>
12944 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
12945 while calling DoEmit ().
12947 * codegen.cs (EmitContext.Mark): Don't mark locations in other
12948 source files; if you use the #line directive inside a method, the
12949 compiler stops emitting line numbers for the debugger until it
12950 reaches the end of the method or another #line directive which
12951 restores the original file.
12953 2003-02-23 Martin Baulig <martin@ximian.com>
12955 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
12957 2003-02-23 Martin Baulig <martin@ximian.com>
12959 * statement.cs (Block.AddChildVariableNames): We need to call this
12960 recursively, not just for our immediate children.
12962 2003-02-23 Martin Baulig <martin@ximian.com>
12964 * class.cs (Event.Define): Always make the field private, like csc does.
12966 * typemanager.cs (TypeManager.RealMemberLookup): Make events
12967 actually work, fixes bug #37521.
12969 2003-02-23 Miguel de Icaza <miguel@ximian.com>
12971 * delegate.cs: When creating the various temporary "Parameters"
12972 classes, make sure that we call the ComputeAndDefineParameterTypes
12973 on those new parameters (just like we do with the formal ones), to
12974 allow them to be resolved in the context of the DeclSpace.
12976 This fixes the bug that Dick observed in Bugzilla #38530.
12978 2003-02-22 Miguel de Icaza <miguel@ximian.com>
12980 * expression.cs (ResolveMemberAccess): When resolving a constant,
12981 do not attempt to pull a constant if the value was not able to
12982 generate a valid constant.
12984 * const.cs (LookupConstantValue): Do not report more errors than required.
12986 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12988 * expression.cs: fixes bug #38328.
12990 2003-02-18 Miguel de Icaza <miguel@ximian.com>
12992 * class.cs: Changed all the various members that can be part of a
12993 class from being an ArrayList to be an Array of the right type.
12994 During the DefineType type_list, interface_list, delegate_list and
12995 enum_list are turned into types, interfaces, delegates and enums
12998 And during the member population, indexer_list, event_list,
12999 constant_list, field_list, instance_constructor_list, method_list,
13000 operator_list and property_list are turned into their real arrays.
13002 Although we could probably perform this operation earlier, for
13003 good error reporting we need to keep the lists and remove the
13004 lists for longer than required.
13006 This optimization was triggered by Paolo profiling the compiler
13007 speed on the output of `gen-sample-program.pl' perl script.
13009 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
13010 not crash in methods like MemberLookupFailed that use this field.
13012 This problem arises when the compiler fails to resolve a type
13013 during interface type definition for example.
13015 2003-02-18 Miguel de Icaza <miguel@ximian.com>
13017 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
13018 inherit from System.Object, so we have to stop at null, not only
13019 when reaching System.Object.
13021 2003-02-17 Miguel de Icaza <miguel@ximian.com>
13023 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
13024 DeclaredOnly because the parent indexer might have had a different
13025 name, but did not loop until the top of the hierarchy was reached.
13027 The problem this one fixes is 35492: when a class implemented an
13028 indexer from an interface, we were getting the interface method
13029 (which was abstract) and we were flagging an error (can not invoke
13032 This also keeps bug 33089 functioning, and test-148 functioning.
13034 * typemanager.cs (IsSpecialMethod): The correct way of figuring
13035 out if a method is special is to see if it is declared in a
13036 property or event, or whether it is one of the predefined operator
13037 names. This should fix correctly #36804.
13039 2003-02-15 Miguel de Icaza <miguel@ximian.com>
13041 The goal here is to remove the dependency on EmptyCast.Peel ().
13042 Killing it completely.
13044 The problem is that currently in a number of places where
13045 constants are expected, we have to "probe" for an EmptyCast, and
13046 Peel, which is not the correct thing to do, as this will be
13047 repetitive and will likely lead to errors.
13049 The idea is to remove any EmptyCasts that are used in casts that
13050 can be reduced to constants, so we only have to cope with
13053 This bug hunt was triggered by Bug 37363 and the desire to remove
13054 the duplicate pattern where we were "peeling" emptycasts to check
13055 whether they were constants. Now constants will always be
13058 * ecore.cs: Use an enumconstant here instead of wrapping with
13061 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
13062 throwing me off. By handling this we can get rid of a few hacks.
13064 * statement.cs (Switch): Removed Peel() code.
13066 2003-02-14 Miguel de Icaza <miguel@ximian.com>
13068 * class.cs: Location information for error 508
13070 * expression.cs (New.DoResolve): Add a guard against double
13071 resolution of an expression.
13073 The New DoResolve might be called twice when initializing field
13074 expressions (see EmitFieldInitializers, the call to
13075 GetInitializerExpression will perform a resolve on the expression,
13076 and later the assign will trigger another resolution
13078 This leads to bugs (#37014)
13080 * delegate.cs: The signature for EndInvoke should contain any ref
13081 or out parameters as well. We were not doing this in the past.
13083 * class.cs (Field.Define): Do not overwrite the type definition
13084 inside the `volatile' group. Turns out that volatile enumerations
13085 were changing the type here to perform a validity test, which
13088 2003-02-12 Miguel de Icaza <miguel@ximian.com>
13090 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
13091 and structs, we do not want to load the instance variable
13093 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
13094 enum_type has to be handled like an object reference (implicit
13095 conversions exists from this to object), but the regular IsClass
13096 and IsValueType tests will never return true for this one.
13098 Also we use TypeManager.IsValueType instead of type.IsValueType,
13099 just for consistency with the rest of the code (this is only
13100 needed if we ever use the construct exposed by test-180.cs inside
13101 corlib, which we dont today).
13103 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
13105 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
13108 2003-02-09 Martin Baulig <martin@ximian.com>
13110 * namespace.cs (Namespace..ctor): Added SourceFile argument.
13111 (Namespace.DefineNamespaces): New static public method; this is
13112 called when we're compiling with debugging to add all namespaces
13113 to the symbol file.
13115 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
13116 pass it to the Namespace's .ctor.
13118 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
13119 and MethodBase arguments; pass the namespace ID to the symwriter;
13120 pass the MethodBase instead of the token to the symwriter.
13121 (SymbolWriter.DefineNamespace): New method to add a namespace to
13124 2003-02-09 Martin Baulig <martin@ximian.com>
13126 * symbolwriter.cs: New file. This is a wrapper around
13127 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
13128 methods here in near future.
13130 2003-02-09 Martin Baulig <martin@ximian.com>
13132 * codegen.cs (EmitContext.Mark): Just pass the arguments to
13133 ILGenerator.MarkSequencePoint() which are actually used by the
13136 2003-02-09 Martin Baulig <martin@ximian.com>
13138 * location.cs (SourceFile): New public sealed class. This
13139 contains the name and an index which is used in the location's token.
13140 (Location): Reserve an appropriate number of bits in the token for
13141 the source file instead of walking over that list, this gives us a
13142 really huge performance improvement when compiling with debugging.
13144 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
13145 `SourceFile' argument instead of a string.
13146 (Driver.ProcessFile): Add all the files via Location.AddFile(),
13147 but don't parse/tokenize here, we need to generate the list of all
13148 source files before we do that.
13149 (Driver.ProcessFiles): New static function. Parses/tokenizes all
13152 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
13153 instead of a string.
13155 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
13158 2003-02-09 Martin Baulig <martin@ximian.com>
13160 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
13161 filename on `#line default'.
13163 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
13165 * statement.cs: don't clear the pinned var when the fixed statement
13166 returns from the method (fixes bug#37752).
13168 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
13170 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
13173 2003-02-07 Martin Baulig <martin@ximian.com>
13175 * driver.cs: Removed the `--debug-args' command line argument.
13177 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
13178 automatically by the AsssemblyBuilder.
13179 (CodeGen.InitializeSymbolWriter): We don't need to call any
13180 initialization function on the symbol writer anymore. This method
13181 doesn't take any arguments.
13183 2003-02-03 Miguel de Icaza <miguel@ximian.com>
13185 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
13186 from referenced assemblies as well.
13188 2003-02-02 Martin Baulig <martin@ximian.com>
13190 * class.cs (MethodData.Emit): Generate debugging info for external methods.
13192 2003-02-02 Martin Baulig <martin@ximian.com>
13194 * class.cs (Constructor.Emit): Open the symbol writer before
13195 emitting the constructor initializer.
13196 (ConstructorInitializer.Emit): Call ec.Mark() to allow
13197 single-stepping through constructor initializers.
13199 2003-01-30 Miguel de Icaza <miguel@ximian.com>
13201 * class.cs: Handle error 549: do not allow virtual methods in
13204 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
13206 * decl.cs: Check access levels when resolving types
13208 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
13210 * statement.cs: Add parameters and locals set in catch blocks that might
13211 return to set vector
13213 2003-01-29 Miguel de Icaza <miguel@ximian.com>
13215 * class.cs (Operator): Set the SpecialName flags for operators.
13217 * expression.cs (Invocation.DoResolve): Only block calls to
13218 accessors and operators on SpecialName methods.
13220 (Cast.TryReduce): Handle conversions from char constants.
13223 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
13225 * statement.cs: small memory and time optimization in FlowBranching.
13227 2003-01-28 Pedro Mart <yoros@wanadoo.es>
13229 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
13230 problem that the last fix but in the other sid (Set).
13232 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
13233 access when there is no indexer in the hierarchy.
13235 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
13237 * class.cs: Combine some if statements.
13239 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13241 * driver.cs: fixed bug #37187.
13243 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
13245 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
13246 any indexer, it's needed to build a list with all the indexers in the
13247 hierarchy (AllGetters), else we have problems. Fixes #35653.
13249 2003-01-23 Miguel de Icaza <miguel@ximian.com>
13251 * class.cs (MethodData.Define): It is wrong for an interface
13252 implementation to be static in both cases: explicit and implicit.
13253 We were only handling this in one case.
13255 Improve the if situation there to not have negations.
13257 * class.cs (Field.Define): Turns out that we do not need to check
13258 the unsafe bit on field definition, only on usage. Remove the test.
13260 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13262 * driver.cs: use assembly.Location instead of Codebase (the latest
13263 patch made mcs fail when using MS assemblies).
13265 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
13267 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
13268 get the path to *corlib.dll.
13270 2003-01-21 Nick Drochak <ndrochak@gol.com>
13274 * typemanager.cs: Remove compiler warnings
13276 2003-01-20 Duncan Mak <duncan@ximian.com>
13278 * AssemblyInfo.cs: Bump the version number to 0.19.
13280 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13282 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
13284 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
13286 * class.cs (Constructor::Emit): Emit debugging info for constructors.
13288 2003-01-17 Miguel de Icaza <miguel@ximian.com>
13290 * cs-parser.jay: Small fix: we were not comparing the constructor
13291 name correctly. Thanks to Zoltan for the initial pointer.
13293 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
13295 * cs-tokenizer.cs: Set file name when specified with #line
13297 2003-01-15 Miguel de Icaza <miguel@ximian.com>
13299 * cs-parser.jay: Only perform the constructor checks here if we
13300 are named like the class; This will help provider a better
13301 error. The constructor path is taken when a type definition is
13302 not found, but most likely the user forgot to add the type, so
13303 report that rather than the constructor error.
13305 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
13307 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
13310 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
13312 * cs-parser.jay: Add cleanup call.
13314 2003-01-13 Duncan Mak <duncan@ximian.com>
13316 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
13317 consistent with other methods.
13319 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
13321 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
13323 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
13325 * attribute.cs: only set GuidAttr to true when we have a
13328 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13332 * typemanager.cs: fixes to allow mcs compile corlib with the new
13333 Type.IsSubclassOf fix.
13335 2003-01-08 Miguel de Icaza <miguel@ximian.com>
13337 * expression.cs (LocalVariableReference.DoResolve): Classify a
13338 constant as a value, not as a variable. Also, set the type for
13341 * cs-parser.jay (fixed_statement): take a type instead of a
13342 pointer_type, so we can produce a better error message later.
13344 * statement.cs (Fixed.Resolve): Flag types that are not pointers
13347 (For.DoEmit): Make inifinite loops have a
13348 non-conditional branch back.
13350 (Fixed.DoEmit): First populate the pinned variables, then emit the
13351 statement, then clear the variables. Before I was emitting the
13352 code once for each fixed piece.
13355 2003-01-08 Martin Baulig <martin@ximian.com>
13357 * statement.cs (FlowBranching.MergeChild): A break in a
13358 SWITCH_SECTION does not leave a loop. Fixes #36155.
13360 2003-01-08 Martin Baulig <martin@ximian.com>
13362 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
13363 lives in the same number space than `param_map'. Fixes #36154.
13365 2003-01-07 Miguel de Icaza <miguel@ximian.com>
13367 * cs-parser.jay (constructor_declaration): Set the
13368 Constructor.ModFlags before probing for it. This makes the
13369 compiler report 514, 515 and 132 (the code was there, but got
13372 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
13373 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
13374 (GotoCase.Resolve): Set `Returns' to ALWAYS.
13376 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
13378 * enum.cs: create the enum static fields using the enum type.
13380 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
13382 * class.cs: don't try to create the ParamBuilder for the return
13383 type if it's not needed (and handle it breaking for the ms runtime
13386 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
13388 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
13390 2002-12-29 Miguel de Icaza <miguel@ximian.com>
13392 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
13393 the command. This showed up while compiling the JANET source
13394 code, which used \r as its only newline separator.
13396 2002-12-28 Miguel de Icaza <miguel@ximian.com>
13398 * class.cs (Method.Define): If we are an operator (because it
13399 reuses our code), then set the SpecialName and HideBySig. #36128
13401 2002-12-22 Miguel de Icaza <miguel@ximian.com>
13403 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
13404 exception, report error 120 `object reference required'.
13406 * driver.cs: Add --pause option, used during to measure the size
13407 of the process as it goes with --timestamp.
13409 * expression.cs (Invocation.DoResolve): Do not allow methods with
13410 SpecialName to be invoked.
13412 2002-12-21 Miguel de Icaza <miguel@ximian.com>
13414 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
13415 number before adding it.
13417 2002-12-21 Ravi Pratap <ravi@ximian.com>
13419 * ecore.cs (StandardImplicitConversion): When in an unsafe
13420 context, we allow conversion between void * to any other pointer
13421 type. This fixes bug #35973.
13423 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
13425 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
13426 is not thrown when extensionless outputs are used
13428 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13430 * rootcontext.cs: fixed compilation of corlib.
13432 2002-12-19 Miguel de Icaza <miguel@ximian.com>
13434 * attribute.cs (Attributes.Contains): Add new method.
13436 * class.cs (MethodCore.LabelParameters): if the parameter is an
13437 `out' parameter, check that no attribute `[In]' has been passed.
13439 * enum.cs: Handle the `value__' name in an enumeration.
13441 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
13443 * decl.cs: Added special case to allow overrides on "protected
13446 2002-12-18 Ravi Pratap <ravi@ximian.com>
13448 * attribute.cs (Attributes.AddAttributeSection): Rename to this
13449 since it makes much more sense.
13451 (Attributes.ctor): Don't require a Location parameter.
13453 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
13455 * attribute.cs (ApplyAttributes): Remove extra Location parameters
13456 since we already have that information per attribute.
13458 * everywhere : make appropriate changes.
13460 * class.cs (LabelParameters): Write the code which actually
13461 applies attributes to the return type. We can't do this on the MS
13462 .NET runtime so we flag a warning in the case an exception is
13465 2002-12-18 Miguel de Icaza <miguel@ximian.com>
13467 * const.cs: Handle implicit null conversions here too.
13469 2002-12-17 Ravi Pratap <ravi@ximian.com>
13471 * class.cs (MethodCore.LabelParameters): Remove the extra
13472 Type [] parameter since it is completely unnecessary. Instead
13473 pass in the method's attributes so that we can extract
13474 the "return" attribute.
13476 2002-12-17 Miguel de Icaza <miguel@ximian.com>
13478 * cs-parser.jay (parse): Use Report.Error to flag errors instead
13479 of ignoring it and letting the compile continue.
13481 * typemanager.cs (ChangeType): use an extra argument to return an
13482 error condition instead of throwing an exception.
13484 2002-12-15 Miguel de Icaza <miguel@ximian.com>
13486 * expression.cs (Unary.TryReduce): mimic the code for the regular
13487 code path. Perform an implicit cast in the cases where we can
13488 implicitly convert to one of the integral types, and then reduce
13489 based on that constant. This fixes bug #35483.
13491 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13493 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
13495 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13497 * namespace.cs: fixed bug #35489.
13499 2002-12-12 Miguel de Icaza <miguel@ximian.com>
13501 * class.cs: Remove some dead code.
13503 * cs-parser.jay: Estimate the number of methods needed
13504 (RootContext.MethodCount);
13506 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
13507 numbers instead of StringBuilders.
13509 * support.cs (PtrHashtable): Add constructor with initial size;
13510 We can now reduce reallocations of the method table.
13512 2002-12-10 Ravi Pratap <ravi@ximian.com>
13514 * attribute.cs (ApplyAttributes): Keep track of the emitted
13515 attributes on a per-target basis. This fixes bug #35413.
13517 2002-12-10 Miguel de Icaza <miguel@ximian.com>
13519 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
13520 default to the Windows 1252 encoding.
13522 (UnixParseOption): Support version, thanks to Alp for the missing
13525 * AssemblyInfo.cs: Add nice assembly information.
13527 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
13530 * cs-parser.jay: Allow a trailing comma before the close bracked
13531 in the attribute_section production.
13533 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
13534 address of the instance was being taken, I will take this out,
13535 because we take the address of the object immediately here.
13537 2002-12-09 Ravi Pratap <ravi@ximian.com>
13539 * typemanager.cs (AreMultipleAllowed): Take care of the most
13540 obvious case where attribute type is not in the current assembly -
13543 2002-12-08 Miguel de Icaza <miguel@ximian.com>
13545 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
13546 definitions, instead of doing that afterwards.
13548 Also we use a nice little hack, depending on the constructor, we
13549 know if we are a "composed" name or a simple name. Hence, we
13550 avoid the IndexOf test, and we avoid
13552 * codegen.cs: Add code to assist in a bug reporter to track down
13553 the source of a compiler crash.
13555 2002-12-07 Ravi Pratap <ravi@ximian.com>
13557 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
13558 types have been emitted for a given element and flag an error
13559 if something which does not have AllowMultiple set is used more
13562 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
13563 attribute types and their corresponding AllowMultiple properties
13565 (AreMultipleAllowed): Check the property for a given type.
13567 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
13568 property in the case we have a TypeContainer.
13570 (Attributes.AddAttribute): Detect duplicates and just skip on
13571 adding them. This trivial fix catches a pretty gross error in our
13572 attribute emission - global attributes were being emitted twice!
13574 Bugzilla bug #33187 is now fixed.
13576 2002-12-06 Miguel de Icaza <miguel@ximian.com>
13578 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
13579 instead of pp_and).
13581 * expression.cs (Binary.ResolveOperator): I can only use the
13582 Concat (string, string, string) and Concat (string, string,
13583 string, string) if the child is actually a concatenation of
13586 2002-12-04 Miguel de Icaza <miguel@ximian.com>
13588 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
13589 context where we need a 2-character lookahead.
13591 * pending.cs (PendingImplementation): Rework so we can keep track
13592 of interface types all the time, and flag those which were
13593 implemented by parents as optional.
13595 2002-12-03 Miguel de Icaza <miguel@ximian.com>
13597 * expression.cs (Binary.ResolveOperator): Use
13598 String.Concat(string,string,string) or
13599 String.Concat(string,string,string,string) when possible.
13601 * typemanager: More helper methods.
13604 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
13606 * pending.cs: remove the bogus return from GetMissingInterfaces()
13607 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
13609 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13611 * namespace.cs: avoid duplicated 'using xxx' being added to
13612 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
13613 when we get more than one 'using' statement for the same namespace.
13614 Report a CS0105 warning for it.
13616 2002-11-30 Miguel de Icaza <miguel@ximian.com>
13618 * cs-tokenizer.cs (consume_identifier): use read directly, instead
13619 of calling getChar/putback, uses internal knowledge of it.
13621 (xtoken): Reorder tokenizer so most common patterns are checked
13622 first. This reduces the compilation time in another 5% (from 8.11s
13623 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
13625 The parsing time is 22% of the compilation in mcs, and from that
13626 64% is spent on the tokenization process.
13628 I tried using a binary search for keywords, but this is slower
13629 than the hashtable. Another option would be to do a couple of
13632 * Not use a StringBuilder, instead use an array of chars,
13633 with a set value. Notice that this way we could catch
13634 the 645 error without having to do it *afterwards*.
13636 * We could write a hand-parser to avoid the hashtable
13637 compares altogether.
13639 The identifier consumption process takes 37% of the tokenization
13640 time. Another 15% is spent on is_number. 56% of the time spent
13641 on is_number is spent on Int64.Parse:
13643 * We could probably choose based on the string length to
13644 use Int32.Parse or Int64.Parse and avoid all the 64-bit
13647 Another 3% is spend on wrapping `xtoken' in the `token' function.
13649 Handle 0xa0 as whitespace (#34752)
13651 2002-11-26 Miguel de Icaza <miguel@ximian.com>
13653 * typemanager.cs (IsCLRType): New routine to tell whether a type
13654 is one of the builtin types.
13656 Maybe it needs to use TypeCodes to be faster. Maybe we could use
13657 typecode in more places instead of doing pointer comparissions.
13658 We could leverage some knowledge about the way the typecodes are
13661 New code to cache namespaces in assemblies, it is currently not
13662 invoked, to be used soon.
13664 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
13666 * expression.cs (Binary.ResolveOperator): specially handle
13667 strings, and do not perform user-defined operator overloading for
13670 2002-11-24 Miguel de Icaza <miguel@ximian.com>
13672 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
13673 internalcall as it is a pretty simple operation; Avoid whenever
13674 possible to call Char.IsLetter.
13676 (consume_identifier): Cut by half the number of
13677 hashtable calls by merging the is_keyword and GetKeyword behavior.
13679 Do not short-circuit, because if we do, we
13680 report errors (ie, #if false && true would produce an invalid
13684 2002-11-24 Martin Baulig <martin@ximian.com>
13686 * expression.cs (Cast.TryReduce): If we're in checked syntax,
13687 check constant ranges and report a CS0221. Fixes #33186.
13689 2002-11-24 Martin Baulig <martin@ximian.com>
13691 * cs-parser.jay: Make this work for uninitialized variable
13692 declarations in the `for' initializer. Fixes #32416.
13694 2002-11-24 Martin Baulig <martin@ximian.com>
13696 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
13697 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
13699 2002-11-24 Martin Baulig <martin@ximian.com>
13701 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
13702 argument; if true, we also check for user-defined conversions.
13703 This is only needed if both arguments are of a user-defined type.
13704 Fixes #30443, added test-175.cs.
13705 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
13707 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
13709 2002-11-24 Martin Baulig <martin@ximian.com>
13711 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
13712 function to get the store opcode.
13713 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
13714 only emit the Ldelema if the store opcode is Stobj. You must run
13715 both test-34 and test-167 to test this. Fixes #34529.
13717 2002-11-23 Martin Baulig <martin@ximian.com>
13719 * ecore.cs (Expression.MemberLookup): Added additional
13720 `qualifier_type' argument which is used when we're being called
13721 from MemberAccess.DoResolve() and null if we're called from a
13723 (Expression.MemberLookupFailed): New method to report errors; this
13724 does the CS1540 check and reports the correct error message.
13726 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
13727 argument for the CS1540 check and redone the way how we're dealing
13728 with private members. See the comment in the source code for details.
13729 (FilterWithClosure): Reverted this back to revision 1.197; renamed
13730 `closure_start_type' to `closure_qualifier_type' and check whether
13731 it's not null. It was not this filter being broken, it was just
13732 being called with the wrong arguments.
13734 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
13735 and pass it the correct `qualifier_type'; this also does the error
13738 2002-11-22 Miguel de Icaza <miguel@ximian.com>
13740 * expression.cs (Invocation.EmitParams): If the we are dealing
13741 with a non-built-in value type, load its address as well.
13743 (ArrayCreation): Use a a pretty constant instead
13744 of the hardcoded value 2. Use 6 instead of 2 for the number of
13745 static initializers.
13747 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
13748 because they are not really value types, just glorified integers.
13750 * driver.cs: Do not append .exe, the CSC compiler does not do it.
13752 * ecore.cs: Remove redundant code for enumerations, make them use
13753 the same code path as everything else, fixes the casting issue
13754 with enumerations in Windows.Forms.
13756 * attribute.cs: Do only cast to string if it is a string, the
13757 validation happens later.
13759 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
13760 people upgrade their corlibs.
13762 * ecore.cs: Oops, enumerations were not following the entire code path
13764 2002-11-21 Miguel de Icaza <miguel@ximian.com>
13766 * typemanager.cs (FilterWithClosure): Commented out the test for
13767 1540 in typemanager.cs, as it has problems when accessing
13768 protected methods from a parent class (see test-174.cs).
13770 * attribute.cs (Attribute.ValidateGuid): new method.
13771 (Attribute.Resolve): Use above.
13773 2002-11-19 Miguel de Icaza <miguel@ximian.com>
13775 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
13777 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
13778 handling for enumerations, as we only needed the TypeContainer
13779 functionality to begin with (this is required for the fix below to
13780 work for enums that reference constants in a container class for
13783 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
13785 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
13786 a valid TypeBuilder to perform lookups on.o
13788 * class.cs (InheritableMemberSignatureCompare): Use true in the
13789 call to GetGetMethod and GetSetMethod, because we are comparing
13790 the signature, and we need to get the methods *even* if they are
13793 (PropertyBase.CheckBase): ditto.
13795 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
13796 GotoCase.Resolve): Use Peel on EmpytCasts.
13798 * ecore.cs (EmptyCast): drop child, add Peel method.
13800 2002-11-17 Martin Baulig <martin@ximian.com>
13802 * ecore.cs (EmptyCast.Child): New public property.
13804 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
13805 label resolved to an EmptyCast. Fixes #34162.
13806 (GotoCase.Resolve): Likewise.
13807 (Block.EmitMeta): Likewise.
13809 2002-11-17 Martin Baulig <martin@ximian.com>
13811 * expression.cs (Invocation.BetterConversion): Prefer int over
13812 uint; short over ushort; long over ulong for integer literals.
13813 Use ImplicitConversionExists instead of StandardConversionExists
13814 since we also need to check for user-defined implicit conversions.
13815 Fixes #34165. Added test-173.cs.
13817 2002-11-16 Martin Baulig <martin@ximian.com>
13819 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
13820 with the `true' and `false' literals. Fixes #33151.
13822 2002-11-16 Martin Baulig <martin@ximian.com>
13824 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
13825 October 22nd; don't do the cs1540 check for static members.
13827 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
13828 now using our own filter here and doing the cs1540 check again.
13830 2002-11-16 Martin Baulig <martin@ximian.com>
13832 * support.cs (InternalParameters): Don't crash if we don't have
13833 any fixed parameters. Fixes #33532.
13835 2002-11-16 Martin Baulig <martin@ximian.com>
13837 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
13838 when looking up static methods to make this work on Windows.
13841 2002-11-16 Martin Baulig <martin@ximian.com>
13843 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
13844 a setter rather than using PropertyInfo.CanWrite.
13846 2002-11-15 Nick Drochak <ndrochak@gol.com>
13848 * class.cs: Allow acces to block member by subclasses. Fixes build
13851 2002-11-14 Martin Baulig <martin@ximian.com>
13853 * class.cs (Constructor.Emit): Added the extern/block check.
13856 2002-11-14 Martin Baulig <martin@ximian.com>
13858 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
13859 iteration while looking for indexers, this is needed because the
13860 indexer may have a different name in our base classes. Fixed the
13861 error reporting (no indexers at all, not get accessor, no
13862 overloaded match). Fixes bug #33089.
13863 (IndexerAccess.DoResolveLValue): Likewise.
13865 2002-11-14 Martin Baulig <martin@ximian.com>
13867 * class.cs (PropertyBase.CheckBase): Make this work for multiple
13868 indexers. Fixes the first part of bug #33089.
13869 (MethodSignature.InheritableMemberSignatureCompare): Added support
13872 2002-11-13 Ravi Pratap <ravi@ximian.com>
13874 * attribute.cs (Attribute.Resolve): Catch the
13875 NullReferenceException and report it since it isn't supposed to
13878 2002-11-12 Miguel de Icaza <miguel@ximian.com>
13880 * expression.cs (Binary.EmitBranchable): Also handle the cases for
13881 LogicalOr and LogicalAnd that can benefit from recursively
13882 handling EmitBranchable. The code now should be nice for Paolo.
13884 2002-11-08 Miguel de Icaza <miguel@ximian.com>
13886 * typemanager.cs (LookupType): Added a negative-hit hashtable for
13887 the Type lookups, as we perform quite a number of lookups on
13888 non-Types. This can be removed once we can deterministically tell
13889 whether we have a type or a namespace in advance.
13891 But this might require special hacks from our corlib.
13895 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
13896 and double which avoids a conversion from an integer to a double.
13898 * expression.cs: tiny optimization, avoid calling IsConstant,
13899 because it effectively performs the lookup twice.
13901 2002-11-06 Miguel de Icaza <miguel@ximian.com>
13903 But a bogus return here to keep the semantics of the old code
13904 until the Mono runtime is fixed.
13906 * pending.cs (GetMissingInterfaces): New method used to remove all
13907 the interfaces that are already implemented by our parent
13908 classes from the list of pending methods.
13910 * interface.cs: Add checks for calls after ResolveTypeExpr.
13912 2002-11-05 Miguel de Icaza <miguel@ximian.com>
13914 * class.cs (Class.Emit): Report warning 67: event not used if the
13915 warning level is beyond 3.
13917 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
13918 being a NullLiteral.
13920 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
13923 * class.cs (TypeContainer.GetClassBases): Cover a missing code
13924 path that might fail if a type can not be resolved.
13926 * expression.cs (Binary.Emit): Emit unsigned versions of the
13929 * driver.cs: use error 5.
13931 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
13933 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
13935 2002-11-01 Miguel de Icaza <miguel@ximian.com>
13937 * cs-parser.jay (switch_section): A beautiful patch from Martin
13938 Baulig that fixed 33094.
13940 2002-10-31 Miguel de Icaza <miguel@ximian.com>
13942 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
13943 Check whether the base is abstract and report an error if so.
13945 * expression.cs (IndexerAccess.DoResolveLValue,
13946 IndexerAccess.DoResolve): ditto.
13948 (Invocation.DoResolve): ditto.
13950 (Invocation.FullMethodDesc): Improve the report string.
13952 * statement.cs (Block): Eliminate IsVariableDefined as it is
13953 basically just a wrapper for GetVariableInfo.
13955 * ecore.cs (SimpleName): Use new
13957 * support.cs (ReflectionParamter.ParameterType): We unwrap the
13958 type, as we return the actual parameter ref/unref state on a
13961 2002-10-30 Miguel de Icaza <miguel@ximian.com>
13963 * support.cs: Return proper flags REF/OUT fixing the previous
13966 * expression.cs: Reverted last patch, that was wrong. Is_ref is
13967 not used to mean `ref' but `ref or out' in ParameterReference
13969 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
13970 full type signature instead of calling TypeManger.CSharpName
13973 * support.cs (InternalParameters.ParameterDesc): Do not compare
13974 directly to the modflags, because REF/OUT will actually be bitsets
13977 * delegate.cs (VerifyMethod): Check also the modifiers.
13979 * cs-tokenizer.cs: Fix bug where floating point values with an
13980 exponent where a sign was missing was ignored.
13982 * driver.cs: Allow multiple assemblies to be specified in a single
13985 2002-10-28 Miguel de Icaza <miguel@ximian.com>
13987 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
13988 because identifiers after a parenthesis would end up in this kind
13989 of production, and we needed to desamiguate it for having casts
13992 (UserDefinedType *) xxx
13994 2002-10-24 Miguel de Icaza <miguel@ximian.com>
13996 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
13997 we should set on the Bindingflags.NonPublic, but not turn on
13998 private_ok. private_ok controls whether a Private member is
13999 returned (this is chekced on the filter routine), while the
14000 BindingFlags.NonPublic just controls whether private/protected
14001 will be allowed. This fixes the problem part of the problem of
14002 private properties being allowed to be used in derived classes.
14004 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
14005 so we can call the children DoResolveLValue method (this will
14006 properly signal errors on lvalue assignments to base properties)
14008 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
14009 getter are null, and we have a property info, we know that this
14010 happened because the lookup failed, so we report an error 122 for
14011 protection level violation.
14013 We also silently return if setter and getter are null in the
14014 resolve functions, this condition only happens if we have flagged
14015 the error before. This is the other half of the problem.
14017 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
14018 not have accessibility information, that is why we were returning
14019 true in the filter function in typemanager.cs.
14021 To properly report 122 (property is inaccessible because of its
14022 protection level) correctly, we report this error in ResolveAccess
14023 by failing if both the setter and the getter are lacking (ie, the
14026 DoResolve and DoLResolve have been modified to check for both
14027 setter/getter being null and returning silently, the reason being
14028 that I did not want to put the knowledge about this error in upper
14031 int old = Report.Errors;
14032 x = new PropertyExpr (...);
14033 if (old != Report.Errors)
14038 So the property expr is returned, but it is invalid, so the error
14039 will be flagged during the resolve process.
14041 * class.cs: Remove InheritablePropertySignatureCompare from the
14042 class, as we no longer depend on the property signature to compute
14043 whether it is possible to implement a method or not.
14045 The reason is that calling PropertyInfo.GetGetMethod will return
14046 null (in .NET, in Mono it works, and we should change this), in
14047 cases where the Get Method does not exist in that particular
14052 class X { public virtual int A { get { return 1; } } }
14054 class Z : Y { public override int A { get { return 2; } } }
14056 Would fail in Z because the parent (Y) would not have the property
14057 defined. So we avoid this completely now (because the alternative
14058 fix was ugly and slow), and we now depend exclusively on the
14061 (PropertyBase.CheckBase): Use a method-base mechanism to find our
14062 reference method, instead of using the property.
14064 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
14065 routines are gone now.
14067 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
14068 names, they were incorrectly named.
14070 * cs-tokenizer.cs: Return are more gentle token on failure.
14072 * pending.cs (PendingImplementation.InterfaceMethod): This routine
14073 had an out-of-sync index variable, which caused it to remove from
14074 the list of pending methods the wrong method sometimes.
14076 2002-10-22 Miguel de Icaza <miguel@ximian.com>
14078 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
14079 CanWrite, because those refer to this particular instance of the
14080 property, and do not take into account the fact that we can
14081 override single members of a property.
14083 Constructor requires an EmitContext. The resolution process does
14084 not happen here, but we need to compute the accessors before,
14085 because the resolution does not always happen for properties.
14087 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
14088 subclass, before we did not update this flag, but we did update
14091 (GetAccessors): Drop this routine, as it did not work in the
14092 presence of partially overwritten set/get methods.
14094 Notice that this broke the cs1540 detection, but that will require
14097 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14101 * driver.cs: issue a warning instead of an error if we don't support
14102 debugging for the platform. Also ignore a couple of errors that may
14103 arise when trying to write the symbols. Undo my previous patch.
14105 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14107 * driver.cs: ignore /debug switch except for Unix platforms.
14109 2002-10-23 Nick Drochak <ndrochak@gol.com>
14111 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
14113 2002-10-21 Miguel de Icaza <miguel@ximian.com>
14115 * driver.cs: Do not make mcs-debug conditional, so we do not break
14116 builds that use it.
14118 * statement.cs (UsageVector.MergeChildren): I would like Martin to
14119 review this patch. But basically after all the children variables
14120 have been merged, the value of "Breaks" was not being set to
14121 new_breaks for Switch blocks. I think that it should be set after
14122 it has executed. Currently I set this to the value of new_breaks,
14123 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
14124 conservative, but I do not understand this code very well.
14126 I did not break anything in the build, so that is good ;-)
14128 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
14130 2002-10-20 Mark Crichton <crichton@gimp.org>
14132 * cfold.cs: Fixed compile blocker. Really fixed it this time.
14134 2002-10-20 Nick Drochak <ndrochak@gol.com>
14136 * cfold.cs: Fixed compile blocker.
14138 2002-10-20 Miguel de Icaza <miguel@ximian.com>
14140 * driver.cs: I was chekcing the key, not the file.
14142 2002-10-19 Ravi Pratap <ravi@ximian.com>
14144 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
14145 message that we were generating - we just need to silently return
14148 2002-10-19 Miguel de Icaza <miguel@ximian.com>
14150 * class.cs (Event.Define): Change my previous commit, as this
14151 breaks the debugger. This is a temporary hack, as it seems like
14152 the compiler is generating events incorrectly to begin with.
14154 * expression.cs (Binary.ResolveOperator): Added support for
14155 "U operator - (E x, E y)"
14157 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
14160 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
14161 init-only variables, but this path did not take into account that
14162 there might be also instance readonly variables. Correct this
14165 This fixes bug 32253
14167 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
14170 * driver.cs: Change the extension for modules to `netmodule'
14172 * cs-parser.jay: Improved slightly the location tracking for
14173 the debugger symbols.
14175 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
14176 modifiers that were specified instead of the hardcoded value
14177 (FamAndAssem). This was basically ignoring the static modifier,
14178 and others. Fixes 32429.
14180 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
14181 fixed a bug in the process (32476)
14183 * expression.cs (ArrayAccess.EmitAssign): Patch from
14184 hwang_rob@yahoo.ca that fixes bug 31834.3
14186 2002-10-18 Miguel de Icaza <miguel@ximian.com>
14188 * driver.cs: Make the module extension .netmodule.
14190 2002-10-16 Miguel de Icaza <miguel@ximian.com>
14192 * driver.cs: Report an error if the resource file is not found
14193 instead of crashing.
14195 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
14196 false, like Emit does.
14198 2002-10-16 Nick Drochak <ndrochak@gol.com>
14200 * typemanager.cs: Remove unused private member. Also reported mcs
14201 bug to report this as a warning like csc.
14203 2002-10-15 Martin Baulig <martin@gnome.org>
14205 * statement.cs (Statement.Emit): Made this a virtual method; emits
14206 the line number info and calls DoEmit().
14207 (Statement.DoEmit): New protected abstract method, formerly knows
14208 as Statement.Emit().
14210 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
14212 2002-10-11 Miguel de Icaza <miguel@ximian.com>
14214 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
14215 have fixed a remaining problem: not every AddXXXX was adding a
14216 fully qualified name.
14218 Now everyone registers a fully qualified name in the DeclSpace as
14219 being defined instead of the partial name.
14221 Downsides: we are slower than we need to be due to the excess
14222 copies and the names being registered this way.
14224 The reason for this is that we currently depend (on the corlib
14225 bootstrap for instance) that types are fully qualified, because
14226 we dump all the types in the namespace, and we should really have
14227 types inserted into the proper namespace, so we can only store the
14228 basenames in the defined_names array.
14230 2002-10-10 Martin Baulig <martin@gnome.org>
14232 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
14233 from bug #31834, see the bug report for a testcase which is
14236 2002-10-10 Martin Baulig <martin@gnome.org>
14238 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
14239 flow analysis code for this.
14241 * statement.cs (Do, While, For): Tell the flow analysis code about
14243 (FlowBranching.UsageVector): Added support for infinite loops.
14244 (Block.Resolve): Moved the dead code elimination here and use flow
14247 2002-10-09 Miguel de Icaza <miguel@ximian.com>
14249 * class.cs (Field.Define): Catch cycles on struct type
14252 * typemanager.cs (IsUnmanagedtype): Do not recursively check
14253 fields if the fields are static. We only need to check instance
14256 * expression.cs (As.DoResolve): Test for reference type.
14258 * statement.cs (Using.ResolveExpression): Use
14259 ConvertImplicitRequired, not ConvertImplicit which reports an
14261 (Using.ResolveLocalVariableDecls): ditto.
14263 * expression.cs (Binary.ResolveOperator): Report errors in a few
14264 places where we had to.
14266 * typemanager.cs (IsUnmanagedtype): Finish implementation.
14268 2002-10-08 Miguel de Icaza <miguel@ximian.com>
14270 * expression.cs: Use StoreFromPtr instead of extracting the type
14271 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
14273 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
14274 an enumeration value to a System.Enum, but System.Enum is not a
14275 value type, but an class type, so we need to box.
14277 (Expression.ConvertExplicit): One codepath could return
14278 errors but not flag them. Fix this. Fixes #31853
14280 * parameter.cs (Resolve): Do not allow void as a parameter type.
14282 2002-10-06 Martin Baulig <martin@gnome.org>
14284 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
14285 if it's a class type and not a struct. Fixes #31815.
14287 2002-10-06 Martin Baulig <martin@gnome.org>
14289 * statement.cs: Reworked the flow analysis code a bit to make it
14290 usable for dead code elimination.
14292 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14294 * cs-parser.jay: allow empty source files. Fixes bug #31781.
14296 2002-10-04 Miguel de Icaza <miguel@ximian.com>
14298 * expression.cs (ComposedCast.DoResolveType): A quick workaround
14299 to fix the test 165, will investigate deeper.
14301 2002-10-04 Martin Baulig <martin@gnome.org>
14303 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
14304 finally blocks actually work.
14305 (Try.Resolve): We don't need to create a sibling for `finally' if
14306 there is no finally block.
14308 2002-10-04 Martin Baulig <martin@gnome.org>
14310 * class.cs (Constructor.Define): The default accessibility for a
14311 non-default constructor is private, not public.
14313 2002-10-04 Miguel de Icaza <miguel@ximian.com>
14315 * class.cs (Constructor): Make AllowedModifiers public, add
14318 * cs-parser.jay: Perform the modifiers test here, as the
14319 constructor for the Constructor class usually receives a zero
14320 because of the way we create it (first we create, later we
14321 customize, and we were never checking the modifiers).
14323 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
14324 is a version of LookupTypeReflection that includes the type-name
14325 cache. This can be used as a fast path for functions that know
14326 the fully qualified name and are only calling into *.GetType() to
14327 obtain a composed type.
14329 This is also used by TypeManager.LookupType during its type
14332 (LookupType): We now also track the real type name, as sometimes
14333 we can get a quey for the real type name from things like
14334 ComposedCast. This fixes bug 31422.
14336 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
14337 complete type fullname, it does not have to go through the type
14338 resolution system to obtain the composed version of the type (for
14339 obtaining arrays or pointers).
14341 (Conditional.Emit): Use the EmitBoolExpression to
14342 generate nicer code, as requested by Paolo.
14344 (ArrayCreation.CheckIndices): Use the patch from
14345 hwang_rob@yahoo.ca to validate the array initializers.
14347 2002-10-03 Miguel de Icaza <miguel@ximian.com>
14349 * class.cs (ConstructorInitializer.Emit): simplify code by using
14350 Invocation.EmitCall, and at the same time, fix the bugs in calling
14351 parent constructors that took variable arguments.
14353 * ecore.cs (Expression.ConvertNumericExplicit,
14354 Expression.ImplicitNumericConversion): Remove the code that
14355 manually wrapped decimal (InternalTypeConstructor call is now gone
14358 * expression.cs (Cast.TryReduce): Also handle decimal types when
14359 trying to perform a constant fold on the type.
14361 * typemanager.cs (IsUnmanagedtype): Partially implemented.
14363 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
14364 that only turned off an error report, and did nothing else.
14366 2002-10-02 Miguel de Icaza <miguel@ximian.com>
14368 * driver.cs: Handle and ignore /fullpaths
14370 2002-10-01 Miguel de Icaza <miguel@ximian.com>
14372 * expression.cs (Binary.ResolveOperator): Catch the case where
14373 DoNumericPromotions returns true,
14375 (Binary.DoNumericPromotions): Simplify the code, and the tests.
14377 2002-09-27 Miguel de Icaza <miguel@ximian.com>
14379 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
14382 2002-09-26 Miguel de Icaza <miguel@ximian.com>
14384 * ecore.cs (ConvertNumericExplicit): It is not enough that the
14385 conversion exists, but it is also required that the conversion be
14386 performed. This manifested in "(Type64Enum) 2".
14388 * class.cs (TypeManager.AddMethod): The fix is not to change
14389 AddEnum, because that one was using a fully qualified name (every
14390 DeclSpace derivative does), but to change the AddMethod routine
14391 that was using an un-namespaced name. This now correctly reports
14392 the duplicated name.
14394 Revert patch until I can properly fix it. The issue
14395 is that we have a shared Type space across all namespaces
14396 currently, which is wrong.
14398 Options include making the Namespace a DeclSpace, and merge
14399 current_namespace/current_container in the parser.
14401 2002-09-25 Miguel de Icaza <miguel@ximian.com>
14403 * cs-parser.jay: Improve error reporting when we get a different
14404 kind of expression in local_variable_type and
14405 local_variable_pointer_type.
14407 Propagate this to avoid missleading errors being reported.
14409 * ecore.cs (ImplicitReferenceConversion): treat
14410 TypeManager.value_type as a target just like object_type. As
14415 Is valid, and needs to result in the int 1 being boxed before it
14416 is assigned to the value type v.
14418 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
14419 to validate the enumeration name.
14421 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
14422 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
14423 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
14425 * ecore.cs (TryImplicitIntConversion): When doing an
14426 implicit-enumeration-conversion, check if the type is 64-bits and
14427 perform a conversion before passing to EnumConstant.
14429 2002-09-23 Miguel de Icaza <miguel@ximian.com>
14431 * decl.cs (Error_AmbiguousTypeReference); New routine used to
14432 report ambiguous type references. Unlike the MS version, we
14433 report what the ambiguity is. Innovation at work ;-)
14435 (DeclSpace.FindType): Require a location argument to
14436 display when we display an ambiguous error.
14438 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
14440 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
14442 * expression.cs (EmitDynamicInitializers): Apply patch from
14443 hwang_rob@yahoo.ca that fixes the order in which we emit our
14446 2002-09-21 Martin Baulig <martin@gnome.org>
14448 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
14449 delegate takes no arguments.
14451 2002-09-20 Miguel de Icaza <miguel@ximian.com>
14453 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
14456 * expression.cs: Extract the underlying type.
14458 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
14460 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
14462 2002-09-19 Miguel de Icaza <miguel@ximian.com>
14464 * class.cs (TypeContainer.DefineType): We can not use the nice
14465 PackingSize with the size set to 1 DefineType method, because it
14466 will not allow us to define the interfaces that the struct
14469 This completes the fixing of bug 27287
14471 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
14472 means also structs. This fixes part of the problem.
14473 (Expresion.ImplicitReferenceConversionExists): ditto.
14475 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
14476 error if there were no errors reported during the type lookup
14477 process, to avoid duplicates or redundant errors. Without this
14478 you would get an ambiguous errors plus a type not found. We have
14479 beaten the user enough with the first error.
14481 (DeclSparce.FindType): Emit a warning if we have an ambiguous
14484 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
14485 during the resolution process, stop the lookup, this avoids
14486 repeated error reports (same error twice).
14488 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
14490 * typemanager.cs (LookupType): Redo the type lookup code to match
14491 the needs of System.Reflection.
14493 The issue is that System.Reflection requires references to nested
14494 types to begin with a "+" sign instead of a dot. So toplevel
14495 types look like: "NameSpace.TopLevelClass", and nested ones look
14496 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
14499 2002-09-19 Martin Baulig <martin@gnome.org>
14501 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
14502 says that a method always returns or always throws an exception,
14503 don't report the CS0161.
14505 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
14506 set `Returns = new_returns'.
14508 2002-09-19 Martin Baulig <martin@gnome.org>
14510 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
14511 to an enum constant, check for a CS0176.
14513 2002-09-18 Miguel de Icaza <miguel@ximian.com>
14515 * class.cs (TypeContainer.CheckPairedOperators): Now we check
14516 for operators that must be in pairs and report errors.
14518 * ecore.cs (SimpleName.DoResolveType): During the initial type
14519 resolution process, when we define types recursively, we must
14520 check first for types in our current scope before we perform
14521 lookups in the enclosing scopes.
14523 * expression.cs (MakeByteBlob): Handle Decimal blobs.
14525 (Invocation.VerifyArgumentsCompat): Call
14526 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
14527 I thought we were supposed to always call this, but there are a
14528 few places in the code where we dont do it.
14530 2002-09-17 Miguel de Icaza <miguel@ximian.com>
14532 * driver.cs: Add support in -linkres and -resource to specify the
14533 name of the identifier.
14535 2002-09-16 Miguel de Icaza <miguel@ximian.com>
14537 * ecore.cs (StandardConversionExists): Sync with the conversion
14538 code: allow anything-* to void* conversions.
14540 (FindMostSpecificSource): Use an Expression argument
14541 instead of a Type, because we might be handed over a Literal which
14542 gets a few more implicit conversions that plain types do not. So
14543 this information was being lost.
14545 Also, we drop the temporary type-holder expression when not
14548 2002-09-17 Martin Baulig <martin@gnome.org>
14550 * class.cs (PropertyBase.CheckBase): Don't check the base class if
14551 this is an explicit interface implementation.
14553 2002-09-17 Martin Baulig <martin@gnome.org>
14555 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
14556 different `IndexerName' attributes.
14558 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
14559 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
14560 virtual CommonResolve().
14562 2002-09-16 Miguel de Icaza <miguel@ximian.com>
14564 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
14565 and convert that to the UnderlyingType.
14567 * statement.cs (Foreach.Resolve): Indexers are just like variables
14568 or PropertyAccesses.
14570 * cs-tokenizer.cs (consume_string): Track line numbers and columns
14571 inside quoted strings, we were not doing this before.
14573 2002-09-16 Martin Baulig <martin@gnome.org>
14575 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
14576 resolve it. This is needed for the definite assignment check of the
14577 instance expression, fixes bug #29846.
14578 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
14580 2002-09-16 Nick Drochak <ndrochak@gol.com>
14582 * parameter.cs: Fix compile error. Cannot reference static member
14583 from an instance object. Is this an mcs bug?
14585 2002-09-14 Martin Baulig <martin@gnome.org>
14587 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
14588 multiple times. Fixes bug #30295, added test-166.cs.
14590 2002-09-14 Martin Baulig <martin@gnome.org>
14592 * statement.cs (Block.Emit): Don't emit unreachable code.
14593 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
14594 `break' statements.
14595 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
14597 2002-09-14 Martin Baulig <martin@gnome.org>
14599 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
14602 2002-09-14 Martin Baulig <martin@gnome.org>
14604 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
14605 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
14606 be false on the ms runtime.
14608 2002-09-13 Martin Baulig <martin@gnome.org>
14610 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
14611 the CS0038 error message.
14613 2002-09-12 Miguel de Icaza <miguel@ximian.com>
14615 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
14616 constant inside, return it.
14618 2002-09-12 Martin Baulig <martin@gnome.org>
14620 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
14621 implicit conversion can be done between enum types.
14623 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
14624 check whether an implicit conversion to the current enum's UnderlyingType
14625 exists and report an error if not.
14627 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
14628 without debugging support.
14630 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
14631 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
14633 2002-09-12 Martin Baulig <martin@gnome.org>
14635 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
14637 * ecore.cs (IMemberExpr.DeclaringType): New property.
14638 (SimpleName.SimpleNameResolve): Check whether we're accessing a
14639 nonstatic member of an outer type (CS0038).
14641 2002-09-11 Miguel de Icaza <miguel@ximian.com>
14643 * driver.cs: Activate the using-error detector at warning level
14644 4 (at least for MS-compatible APIs).
14646 * namespace.cs (VerifyUsing): Small buglett fix.
14648 * pending.cs (PendingImplementation): pass the container pointer.
14650 * interface.cs (GetMethods): Allow for recursive definition. Long
14651 term, I would like to move every type to support recursive
14652 definitions, not the current ordering mechanism that we have right
14655 The situation is this: Attributes are handled before interfaces,
14656 so we can apply attributes to interfaces. But some attributes
14657 implement interfaces, we will now handle the simple cases
14658 (recursive definitions will just get an error).
14660 * parameter.cs: Only invalidate types at the end if we fail to
14663 2002-09-09 Martin Baulig <martin@gnome.org>
14665 * ecore.cs (PropertyExpr.Emit): Also check for
14666 TypeManager.system_int_array_get_length so this'll also work when
14667 compiling corlib. Fixes #30003.
14669 2002-09-09 Martin Baulig <martin@gnome.org>
14671 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
14672 and throw an exception if we can't get the type's size. Fixed #30040,
14675 2002-09-09 Martin Baulig <martin@gnome.org>
14677 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
14679 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
14680 context. Fixes bug #30027.
14682 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
14683 virtual functions. Fixes bug #30043, added test-164.cs.
14685 2002-09-08 Ravi Pratap <ravi@ximian.com>
14687 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
14689 2002-09-08 Nick Drochak <ndrochak@gol.com>
14691 * driver.cs: Use an object to get the windows codepage since it's not a
14694 2002-09-08 Miguel de Icaza <miguel@ximian.com>
14696 * statement.cs (For.Emit): for infinite loops (test == null)
14697 return whether there is a break inside, not always "true".
14699 * namespace.cs (UsingEntry): New struct to hold the name of the
14700 using definition, the location where it is defined, and whether it
14701 has been used in a successful type lookup.
14703 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
14708 2002-09-06 Ravi Pratap <ravi@ximian.com>
14710 * attribute.cs : Fix incorrect code which relied on catching
14711 a NullReferenceException to detect a null being passed in
14712 where an object was expected.
14714 2002-09-06 Miguel de Icaza <miguel@ximian.com>
14716 * statement.cs (Try): flag the catch variable as assigned
14718 * expression.cs (Cast): Simplified by using ResolveType instead of
14719 manually resolving.
14721 * statement.cs (Catch): Fix bug by using ResolveType.
14723 2002-09-06 Ravi Pratap <ravi@ximian.com>
14725 * expression.cs (BetterConversion): Special case for when we have
14726 a NullLiteral as the argument and we have to choose between string
14727 and object types - we choose string the way csc does.
14729 * attribute.cs (Attribute.Resolve): Catch the
14730 NullReferenceException and report error #182 since the Mono
14731 runtime no more has the bug and having this exception raised means
14732 we tried to select a constructor which takes an object and is
14735 2002-09-05 Ravi Pratap <ravi@ximian.com>
14737 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
14738 message (1502, 1503) when we can't locate a method after overload
14739 resolution. This is much more informative and closes the bug
14742 * interface.cs (PopulateMethod): Return if there are no argument
14743 types. Fixes a NullReferenceException bug.
14745 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
14746 expressions too. Previously we were checking only in one place for
14747 positional arguments leaving out named arguments.
14749 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
14750 type to the enum type is not allowed. Remove code corresponding to
14753 (ConvertNumericExplicit): Allow explicit conversions from
14754 the underlying type to enum type. This precisely follows the spec
14755 and closes a bug filed by Gonzalo.
14757 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14760 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
14762 2002-09-03 Miguel de Icaza <miguel@ximian.com>
14764 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
14765 it was important that we stored the right value after the
14766 reduction in `converted'.
14768 2002-09-04 Martin Baulig <martin@gnome.org>
14770 * location.cs (Location.SymbolDocument): Use full pathnames for the
14773 2002-08-30 Miguel de Icaza <miguel@ximian.com>
14775 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
14776 of the expression resolve mechanism, because that will catch the
14777 SimpleName error failures.
14779 (Conditional): If we can not resolve the
14780 expression, return, do not crash.
14782 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14785 (location): display token name instead of its number.
14787 2002-08-28 Martin Baulig <martin@gnome.org>
14789 * expression.cs (Binary.ResolveOperator): Don't silently return
14790 but return an error if an operator cannot be applied between two
14793 2002-08-28 Martin Baulig <martin@gnome.org>
14795 * class.cs (Constructor.Define): Set the permission attributes
14796 correctly instead of making all constructors public.
14798 2002-08-28 Martin Baulig <martin@gnome.org>
14800 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
14801 for private members before reporting a CS0103; if we find anything,
14804 2002-08-28 Martin Baulig <martin@gnome.org>
14806 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
14807 to check whether `closure_start_type == closure_invocation_type',
14808 we also need to check whether `m.DeclaringType == closure_invocation_type'
14809 before bypassing the permission checks. We might be accessing
14810 protected/private members from the base class.
14811 (TypeManager.RealMemberLookup): Only set private_ok if private
14812 members were requested via BindingFlags.NonPublic.
14814 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
14816 * expression.cs (MemberAccess.ResolveMemberAccess): Set
14817 MethodGroupExpr.IsExplicitImpl if appropriate.
14818 (Invocation.DoResolve): Don't report the CS0120 for explicit
14819 interface implementations.
14821 2002-08-27 Martin Baulig <martin@gnome.org>
14823 * expression.cs (Invocation.DoResolve): If this is a static
14824 method and we don't have an InstanceExpression, we must report
14827 2002-08-25 Martin Baulig <martin@gnome.org>
14829 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
14830 `==' between a valuetype and an object.
14832 2002-08-25 Miguel de Icaza <miguel@ximian.com>
14834 * ecore.cs (TypeExpr): Provide a ToString method.
14836 2002-08-24 Martin Baulig <martin@gnome.org>
14838 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
14839 now called proggie.dbg and it's a binary file.
14841 2002-08-23 Martin Baulig <martin@gnome.org>
14843 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
14845 2002-08-23 Martin Baulig <martin@gnome.org>
14847 * struct.cs (MyStructInfo.ctor): Make this work with empty
14848 structs; it's not allowed to use foreach() on null.
14850 2002-08-23 Martin Baulig <martin@gnome.org>
14852 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
14853 writer the full pathname of the generated assembly.
14855 2002-08-23 Martin Baulig <martin@gnome.org>
14857 * statements.cs (FlowBranching.UsageVector.MergeChildren):
14858 A `finally' block never returns or breaks; improved handling of
14861 2002-08-23 Martin Baulig <martin@gnome.org>
14863 * statement.cs (Throw.Resolve): Allow `throw null'.
14865 2002-08-23 Martin Baulig <martin@gnome.org>
14867 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
14868 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
14869 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
14870 MemberLookup would return a wrong event if this is an explicit
14871 interface implementation and the class has an event with the same
14874 2002-08-23 Martin Baulig <martin@gnome.org>
14876 * statement.cs (Block.AddChildVariableNames): New public method.
14877 (Block.AddChildVariableName): Likewise.
14878 (Block.IsVariableNameUsedInChildBlock): Likewise.
14879 (Block.AddVariable): Check whether a variable name has already
14880 been used in a child block.
14882 * cs-parser.jay (declare_local_variables): Mark all variable names
14883 from the current block as being used in a child block in the
14886 2002-08-23 Martin Baulig <martin@gnome.org>
14888 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
14889 find the symbol writer.
14891 * driver.cs: csc also allows the arguments to /define being
14892 separated by commas, not only by semicolons.
14894 2002-08-23 Martin Baulig <martin@gnome.org>
14896 * interface.cs (Interface.GetMembers): Added static check for events.
14898 2002-08-15 Martin Baulig <martin@gnome.org>
14900 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
14901 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
14903 * ecore.cs (Expression.MemberLookup): Added documentation and explained
14904 why the MethodData.EmitDestructor() change was necessary.
14906 2002-08-20 Martin Baulig <martin@gnome.org>
14908 * class.cs (TypeContainer.FindMembers): Added static check for events.
14910 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
14912 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
14913 use Type.GetEvents(), not Type.FindMembers().
14915 2002-08-20 Martin Baulig <martin@gnome.org>
14917 * decl.cs (MemberCache): Added a special method cache which will
14918 be used for method-only searched. This ensures that a method
14919 search will return a MethodInfo with the correct ReflectedType for
14922 2002-08-20 Martin Baulig <martin@gnome.org>
14924 * decl.cs (DeclSpace.FindMembers): Made this public.
14926 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14928 * delegate.cs: fixed build on windows.
14929 [FIXME: Filed as bug #29150: MCS must report these errors.]
14931 2002-08-19 Ravi Pratap <ravi@ximian.com>
14933 * ecore.cs (StandardConversionExists): Return a false
14934 if we are trying to convert the void type to anything else
14935 since that is not allowed.
14937 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
14938 we flag error 70 in the event an event is trying to be accessed
14939 directly from outside the declaring type.
14941 2002-08-20 Martin Baulig <martin@gnome.org>
14943 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
14944 MemberCache from typemanager.cs to decl.cs.
14946 2002-08-19 Martin Baulig <martin@gnome.org>
14948 * class.cs (TypeContainer): Implement IMemberContainer.
14949 (TypeContainer.DefineMembers): Create the MemberCache.
14950 (TypeContainer.FindMembers): Do better BindingFlags checking; only
14951 return public members if BindingFlags.Public was given, check
14952 whether members are static.
14954 2002-08-16 Martin Baulig <martin@gnome.org>
14956 * decl.cs (DeclSpace.Define): Splitted this in Define and
14957 DefineMembers. DefineMembers is called first and initializes the
14960 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
14961 DefineMembers() on all our DeclSpaces.
14963 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
14964 but call DefineMembers() on all nested interfaces. We call their
14965 Define() in our new Define() function.
14967 * interface.cs (Interface): Implement IMemberContainer.
14968 (Interface.Define): Moved all code except the attribute stuf to
14970 (Interface.DefineMembers): Initialize the member cache.
14972 * typemanager.cs (IMemberFinder): Removed this interface, we don't
14973 need this anymore since we can use MemberCache.FindMembers directly.
14975 2002-08-19 Martin Baulig <martin@gnome.org>
14977 * typemanager.cs (MemberCache): When creating the cache for an
14978 interface type, add all inherited members.
14979 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
14980 to `out bool used_cache' and documented it.
14981 (TypeManager.MemberLookup): If we already used the cache in the first
14982 iteration, we don't need to do the interfaces check.
14984 2002-08-19 Martin Baulig <martin@gnome.org>
14986 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
14987 here from IMemberFinder and don't implement this interface anymore.
14988 (DeclSpace.MemberCache): Moved here from IMemberFinder.
14990 * typemanager.cs (IMemberFinder): This interface is now only used by
14991 classes which actually support the member cache.
14992 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
14993 since we only put DeclSpaces into this Hashtable.
14994 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
14995 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
14997 2002-08-16 Martin Baulig <martin@gnome.org>
14999 * typemanager.cs (ICachingMemberFinder): Removed.
15000 (IMemberFinder.MemberCache): New property.
15001 (TypeManager.FindMembers): Merged this with RealFindMembers().
15002 This function will never be called from TypeManager.MemberLookup()
15003 so we can't use the cache here, just the IMemberFinder.
15004 (TypeManager.MemberLookup_FindMembers): Check whether the
15005 IMemberFinder has a MemberCache and call the cache's FindMembers
15007 (MemberCache): Rewrote larger parts of this yet another time and
15008 cleaned it up a bit.
15010 2002-08-15 Miguel de Icaza <miguel@ximian.com>
15012 * driver.cs (LoadArgs): Support quoting.
15014 (Usage): Show the CSC-like command line arguments.
15016 Improved a few error messages.
15018 2002-08-15 Martin Baulig <martin@gnome.org>
15020 * typemanager.cs (IMemberContainer.Type): New property.
15021 (IMemberContainer.IsInterface): New property.
15023 The following changes are conditional to BROKEN_RUNTIME, which is
15024 defined at the top of the file.
15026 * typemanager.cs (MemberCache.MemberCache): Don't add the base
15027 class'es members, but add all members from TypeHandle.ObjectType
15028 if we're an interface.
15029 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
15030 is the current type.
15031 (MemberCache.CacheEntry.Container): Removed this field.
15032 (TypeHandle.GetMembers): Include inherited members.
15034 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15036 * typemanager.cs: fixed compilation and added a comment on a field that
15039 2002-08-15 Martin Baulig <martin@gnome.org>
15041 * class.cs (ConstructorInitializer.Resolve): In the
15042 Expression.MemberLookup call, use the queried_type as
15045 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
15046 declared' attribute, it's always true.
15047 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
15048 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
15049 temporary wrapper for FindMembers which tells MemberLookup whether
15050 members from the base classes are included in the return value.
15051 This will go away soon.
15052 (TypeManager.MemberLookup): Use this temporary hack here; once the
15053 new MemberCache is completed, we don't need to do the DeclaredOnly
15054 looping here anymore since the MemberCache will take care of this.
15055 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
15056 (MemberCache): When creating the MemberCache for a class, get
15057 members from the current class and all its base classes.
15058 (MemberCache.CacheEntry.Container): New field. This is a
15059 temporary hack until the Mono runtime is fixed to distinguish
15060 between ReflectedType and DeclaringType. It allows us to use MCS
15061 with both the MS runtime and the unfixed Mono runtime without
15062 problems and without accecting performance.
15063 (MemberCache.SearchMembers): The DeclaredOnly looping from
15064 TypeManager.MemberLookup is now done here.
15066 2002-08-14 Martin Baulig <martin@gnome.org>
15068 * statement.cs (MyStructInfo.MyStructInfo): Don't call
15069 Type.GetFields on dynamic types but get the fields from the
15070 corresponding TypeContainer.
15071 (MyStructInfo.GetStructInfo): Added check for enum types.
15073 * typemanager.cs (MemberList.IsSynchronized): Implemented.
15074 (MemberList.SyncRoot): Implemented.
15075 (TypeManager.FilterWithClosure): No need to check permissions if
15076 closure_start_type == closure_invocation_type, don't crash if
15077 closure_invocation_type is null.
15079 2002-08-13 Martin Baulig <martin@gnome.org>
15081 Rewrote TypeContainer.FindMembers to use a member cache. This
15082 gives us a speed increase of about 35% for the self-hosting MCS
15083 build and of about 15-20% for the class libs (both on GNU/Linux).
15085 * report.cs (Timer): New class to get enhanced profiling. This
15086 whole class is "TIMER" conditional since it remarkably slows down
15089 * class.cs (MemberList): New class. This is an IList wrapper
15090 which we're now using instead of passing MemberInfo[]'s around to
15091 avoid copying this array unnecessarily.
15092 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
15093 (ICachingMemberFinder, IMemberContainer): New interface.
15094 (TypeManager.FilterWithClosure): If `criteria' is null, the name
15095 has already been checked, otherwise use it for the name comparision.
15096 (TypeManager.FindMembers): Renamed to RealMemberFinder and
15097 provided wrapper which tries to use ICachingMemberFinder.FindMembers
15098 if possible. Returns a MemberList, not a MemberInfo [].
15099 (TypeHandle): New class, implements IMemberContainer. We create
15100 one instance of this class per type, it contains a MemberCache
15101 which is used to do the member lookups.
15102 (MemberCache): New class. Each instance of this class contains
15103 all members of a type and a name-based hash table.
15104 (MemberCache.FindMembers): This is our new member lookup
15105 function. First, it looks up all members of the requested name in
15106 the hash table. Then, it walks this list and sorts out all
15107 applicable members and returns them.
15109 2002-08-13 Martin Baulig <martin@gnome.org>
15111 In addition to a nice code cleanup, this gives us a performance
15112 increase of about 1.4% on GNU/Linux - not much, but it's already
15113 half a second for the self-hosting MCS compilation.
15115 * typemanager.cs (IMemberFinder): New interface. It is used by
15116 TypeManager.FindMembers to call FindMembers on a TypeContainer,
15117 Enum, Delegate or Interface.
15118 (TypeManager.finder_to_member_finder): New PtrHashtable.
15119 (TypeManager.finder_to_container): Removed.
15120 (TypeManager.finder_to_delegate): Removed.
15121 (TypeManager.finder_to_interface): Removed.
15122 (TypeManager.finder_to_enum): Removed.
15124 * interface.cs (Interface): Implement IMemberFinder.
15126 * delegate.cs (Delegate): Implement IMemberFinder.
15128 * enum.cs (Enum): Implement IMemberFinder.
15130 * class.cs (TypeContainer): Implement IMemberFinder.
15132 2002-08-12 Martin Baulig <martin@gnome.org>
15134 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
15136 2002-08-12 Martin Baulig <martin@gnome.org>
15138 * ecore.cs (ITypeExpression): New interface for expressions which
15140 (TypeExpression): Renamed to TypeLookupExpression.
15141 (Expression.DoResolve): If we're doing a types-only lookup, the
15142 expression must implement the ITypeExpression interface and we
15143 call DoResolveType() on it.
15144 (SimpleName): Implement the new ITypeExpression interface.
15145 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
15146 hack, the situation that we're only looking up types can't happen
15147 anymore when this method is called. Moved the type lookup code to
15148 DoResolveType() and call it.
15149 (SimpleName.DoResolveType): This ITypeExpression interface method
15150 is now doing the types-only lookup.
15151 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
15152 (ResolveFlags): Added MaskExprClass.
15154 * expression.cs (MemberAccess): Implement the ITypeExpression
15156 (MemberAccess.DoResolve): Added support for a types-only lookup
15157 when we're called via ITypeExpression.DoResolveType().
15158 (ComposedCast): Implement the ITypeExpression interface.
15160 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
15161 Expression.Resolve() with ResolveFlags.Type instead.
15163 2002-08-12 Martin Baulig <martin@gnome.org>
15165 * interface.cs (Interface.Define): Apply attributes.
15167 * attribute.cs (Attribute.ApplyAttributes): Added support for
15168 interface attributes.
15170 2002-08-11 Martin Baulig <martin@gnome.org>
15172 * statement.cs (Block.Emit): Only check the "this" variable if we
15173 do not always throw an exception.
15175 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
15176 whether the property has a set accessor.
15178 2002-08-11 Martin Baulig <martin@gnome.org>
15180 Added control flow analysis support for structs.
15182 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
15183 with control flow analysis turned off.
15184 (IVariable): New interface.
15185 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
15186 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
15187 (FieldExpr.DoResolve): Resolve the instance expression with flow
15188 analysis turned off and do the definite assignment check after the
15189 resolving when we know what the expression will resolve to.
15191 * expression.cs (LocalVariableReference, ParameterReference):
15192 Implement the new IVariable interface, only call the flow analysis
15193 code if ec.DoFlowAnalysis is true.
15194 (This): Added constructor which takes a Block argument. Implement
15195 the new IVariable interface.
15196 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
15197 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
15198 This does the definite assignment checks for struct members.
15200 * class.cs (Constructor.Emit): If this is a non-static `struct'
15201 constructor which doesn't have any initializer, call
15202 Block.AddThisVariable() to tell the flow analysis code that all
15203 struct elements must be initialized before control returns from
15206 * statement.cs (MyStructInfo): New public class.
15207 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
15208 argument to this indexer. If non-zero, check an individual struct
15209 member, not the whole struct.
15210 (FlowBranching.CheckOutParameters): Check struct members.
15211 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
15212 overloaded versions of these methods which take an additional
15213 `int field_idx' argument to check struct members.
15214 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
15215 overloaded versions of these methods which take an additional
15216 `string field_name' argument to check struct member.s
15217 (VariableInfo): Implement the IVariable interface.
15218 (VariableInfo.StructInfo): New public property. Returns the
15219 MyStructInfo instance of the variable if it's a struct or null.
15220 (Block.AddThisVariable): New public method. This is called from
15221 Constructor.Emit() for non-static `struct' constructor which do
15222 not have any initializer. It creates a special variable for the
15223 "this" instance variable which will be checked by the flow
15224 analysis code to ensure that all of the struct's fields are
15225 initialized before control returns from the constructor.
15226 (UsageVector): Added support for struct members. If a
15227 variable/parameter is a struct with N members, we reserve a slot
15228 in the usage vector for each member. A struct is considered fully
15229 initialized if either the struct itself (slot 0) or all its
15230 members are initialized.
15232 2002-08-08 Martin Baulig <martin@gnome.org>
15234 * driver.cs (Driver.MainDriver): Only report an error CS5001
15235 if there were no compilation errors.
15237 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
15238 `UnsafeContext' property to determine whether the parent is in
15239 unsafe context rather than checking the parent's ModFlags:
15240 classes nested in an unsafe class are unsafe as well.
15242 2002-08-08 Martin Baulig <martin@gnome.org>
15244 * statement.cs (UsageVector.MergeChildren): Distinguish between
15245 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
15246 we return. Added test17() and test18() to test-154.cs.
15248 2002-08-08 Martin Baulig <martin@gnome.org>
15250 * typemanager.cs (TypeManager.FilterWithClosure): If we have
15251 Family access, make sure the invoking type isn't a subclass of the
15252 queried type (that'd be a CS1540).
15254 * ecore.cs (Expression.MemberLookup): Added overloaded version of
15255 this method which takes an additional `Type invocation_type'.
15257 * expression.cs (BaseAccess.DoResolve): Use the base type as
15258 invocation and query type.
15259 (MemberAccess.DoResolve): If the lookup failed and we're about to
15260 report a CS0122, try a lookup with the ec.ContainerType - if this
15261 succeeds, we must report a CS1540.
15263 2002-08-08 Martin Baulig <martin@gnome.org>
15265 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
15266 (MethodGroupExpr): Implement the IMemberExpr interface.
15268 * expression (MemberAccess.ResolveMemberAccess): No need to have
15269 any special code for MethodGroupExprs anymore, they're now
15272 2002-08-08 Martin Baulig <martin@gnome.org>
15274 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
15275 Family, FamANDAssem and FamORAssem permissions.
15276 (TypeManager.IsSubclassOrNestedChildOf): New public method.
15278 2002-08-08 Martin Baulig <martin@gnome.org>
15280 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
15281 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
15284 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
15286 * driver.cs: implemented /resource option to embed managed resources.
15288 2002-08-07 Martin Baulig <martin@gnome.org>
15290 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
15291 (FieldBase.HasFieldInitializer): New public property.
15292 (FieldBase.GetInitializerExpression): New public method. Resolves and
15293 returns the field initializer and makes sure it is only resolved once.
15294 (TypeContainer.EmitFieldInitializers): Call
15295 FieldBase.GetInitializerExpression to get the initializer, this ensures
15296 that it isn't resolved multiple times.
15298 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
15299 the resolving process (SimpleName/MemberLookup) that we're currently
15300 emitting a field initializer (which must not access any instance members,
15301 this is an error CS0236).
15303 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
15304 argument, if the `IsFieldInitializer' flag is set, we must report and
15305 error CS0236 and not an error CS0120.
15307 2002-08-07 Martin Baulig <martin@gnome.org>
15309 * ecore.cs (IMemberExpr): New public interface.
15310 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
15311 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
15312 if the expression is an IMemberExpr.
15314 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
15315 to be null, implicitly default to `this' if we're non-static in
15316 this case. Simplified the code a lot by using the new IMemberExpr
15317 interface. Also fixed bug #28176 here.
15319 2002-08-06 Martin Baulig <martin@gnome.org>
15321 * cs-parser.jay (SimpleLookup): Removed. We need to create
15322 ParameterReferences during semantic analysis so that we can do a
15323 type-only search when resolving Cast, TypeOf and SizeOf.
15324 (block): Pass the `current_local_parameters' to the Block's
15327 * class.cs (ConstructorInitializer): Added `Parameters parameters'
15328 argument to the constructor.
15329 (ConstructorInitializer.Resolve): Create a temporary implicit
15330 block with the parameters.
15332 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
15333 references here if we aren't doing a type-only search.
15335 * statement.cs (Block): Added constructor which takes a
15336 `Parameters parameters' argument.
15337 (Block.Parameters): New public property.
15339 * support.cs (InternalParameters.Parameters): Renamed `parameters'
15340 to `Parameters' and made it public readonly.
15342 2002-08-06 Martin Baulig <martin@gnome.org>
15344 * ecore.cs (Expression.Warning): Made this public as well.
15346 * report.cs (Report.Debug): Print the contents of collections.
15348 2002-08-06 Martin Baulig <martin@gnome.org>
15350 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
15351 used to tell Resolve() which kinds of expressions it may return.
15352 (Expression.Resolve): Added overloaded version of this method which
15353 takes a `ResolveFlags flags' argument. This can be used to tell
15354 Resolve() which kinds of expressions it may return. Reports a
15356 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
15357 ResolveFlags.SimpleName.
15358 (Expression.Error118): Added overloaded version of this method which
15359 takes a `ResolveFlags flags' argument. It uses the flags to determine
15360 which kinds of expressions are allowed.
15362 * expression.cs (Argument.ResolveMethodGroup): New public method.
15363 Resolves an argument, but allows a MethodGroup to be returned.
15364 This is used when invoking a delegate.
15366 * TODO: Updated a bit.
15368 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15370 Fixed compilation with csc.
15372 * ecore.cs: Expression.Error made public. Is this correct? Should
15373 Warning be made public too?
15375 * expression.cs: use ea.Location instead of ea.loc.
15376 [FIXME: Filed as bug #28607: MCS must report these errors.]
15378 2002-08-06 Martin Baulig <martin@gnome.org>
15380 * ecore.cs (Expression.loc): Moved the location here instead of
15381 duplicating it in all derived classes.
15382 (Expression.Location): New public property.
15383 (Expression.Error, Expression.Warning): Made them non-static and
15384 removed the location argument.
15385 (Expression.Warning): Added overloaded version which takes an
15386 `int level' argument.
15387 (Expression.Error118): Make this non-static and removed the
15388 expression and location arguments.
15389 (TypeExpr): Added location argument to the constructor.
15391 * expression.cs (StaticCallExpr): Added location argument to
15393 (Indirection, PointerArithmetic): Likewise.
15394 (CheckedExpr, UnCheckedExpr): Likewise.
15395 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
15396 (StringPtr): Likewise.
15399 2002-08-05 Martin Baulig <martin@gnome.org>
15401 * expression.cs (BaseAccess.DoResolve): Actually report errors.
15403 * assign.cs (Assign.DoResolve): Check whether the source
15404 expression is a value or variable.
15406 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
15407 while resolving the corresponding blocks.
15409 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
15410 an error, don't silently return null.
15412 * statement.cs (Block.AddVariable): Do the error reporting here
15413 and distinguish between CS0128 and CS0136.
15414 (Block.DoResolve): Report all unused labels (warning CS0164).
15415 (LabeledStatement): Pass the location to the constructor.
15416 (LabeledStatement.HasBeenReferenced): New property.
15417 (LabeledStatement.Resolve): Set it to true here.
15419 * statement.cs (Return.Emit): Return success even after reporting
15420 a type mismatch error (CS0126 or CS0127), this is what csc does and
15421 it avoids confusing the users with any consecutive errors.
15423 2002-08-05 Martin Baulig <martin@gnome.org>
15425 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
15427 * const.cs (Const.LookupConstantValue): Catch circular definitions.
15429 * expression.cs (MemberAccess.DoResolve): Silently return if an
15430 error has already been reported.
15432 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
15433 error has already been reported.
15435 2002-08-05 Martin Baulig <martin@gnome.org>
15437 * statement.cs (UsageVector): Only initialize the `parameters'
15438 vector if we actually have any "out" parameters.
15440 2002-08-05 Martin Baulig <martin@gnome.org>
15442 * expression.cs (Binary.ResolveOperator): When combining delegates,
15443 they must have the same type.
15445 2002-08-05 Martin Baulig <martin@gnome.org>
15447 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
15448 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
15449 work with the ms runtime and we also don't need it: if we're a
15450 PropertyBuilder and not in the `indexer_arguments' hash, then we
15451 are a property and not an indexer.
15453 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
15454 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
15455 since the latter one doesn't work with the ms runtime.
15457 2002-08-03 Martin Baulig <martin@gnome.org>
15459 Fixed bugs #27998 and #22735.
15461 * class.cs (Method.IsOperator): New public field.
15462 (Method.CheckBase): Report CS0111 if there's already a method
15463 with the same parameters in the current class. Report CS0508 when
15464 attempting to change the return type of an inherited method.
15465 (MethodData.Emit): Report CS0179 if a method doesn't have a body
15466 and it's not marked abstract or extern.
15467 (PropertyBase): New abstract base class for Property and Indexer.
15468 (PropertyBase.CheckBase): Moved here from Property and made it work
15470 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
15471 the same so we can reuse it there.
15472 (Property, Indexer): Derive from PropertyBase.
15473 (MethodSignature.inheritable_property_signature_filter): New delegate
15474 to find properties and indexers.
15476 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
15477 argument and improved error reporting.
15479 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
15480 EmptyReadOnlyParameters and made it a property.
15482 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
15483 version of this method which takes a `PropertyInfo indexer'.
15484 (TypeManager.RegisterIndexer): New method.
15486 * class.cs: Added myself as author of this file :-)
15488 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15490 * class.cs: fixed compilation on windoze.
15492 2002-08-03 Martin Baulig <martin@gnome.org>
15494 * interface.cs (Interface.GetInterfaceBases): Check whether all
15495 base interfaces are at least as accessible than the current one.
15497 * class.cs (TypeContainer.GetClassBases): Check whether base types
15498 are at least as accessible than the current type.
15499 (TypeContainer.AsAccessible): Implemented and made non-static.
15500 (MemberBase.CheckParameters): Report errors if the accessibility
15503 * delegate.cs (Delegate.Delegate): The default visibility is
15504 internal for top-level types and private for nested types.
15505 (Delegate.Define): Report errors if the accessibility checks fail.
15507 * enum.cs (Enum.Enum): The default visibility is internal for
15508 top-level types and private for nested types.
15509 (Enum.DefineType): Compute the correct visibility.
15511 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
15512 function which takes a `bool is_toplevel' instead of a TypeContainer.
15514 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
15517 2002-08-02 Martin Baulig <martin@gnome.org>
15519 * expression.cs (LocalVariableReferenc): Added constructor which
15520 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
15521 (LocalVariableReference.IsReadOnly): New property.
15522 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
15523 variable is readonly, use our own readonly flag to do this; you can
15524 use the new constructor to get a writable reference to a read-only
15527 * cs-parser.jay (foreach_statement, using_statement): Get a writable
15528 reference to the local variable.
15530 2002-08-01 Miguel de Icaza <miguel@ximian.com>
15532 * rootcontext.cs (ResolveCore): Also include System.Exception
15534 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
15535 we reach an EmptyStatement.
15537 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
15540 * expression.cs (Binary.ResolveOperator): Check error result in
15543 use brtrue/brfalse directly and avoid compares to null.
15545 2002-08-02 Martin Baulig <martin@gnome.org>
15547 * class.cs (TypeContainer.Define): Define all nested interfaces here.
15548 Fixes bug #28407, added test-155.cs.
15550 2002-08-01 Martin Baulig <martin@gnome.org>
15552 * class.cs (Event.EmitDefaultMethod): Make this work with static
15553 events. Fixes #28311, added verify-3.cs.
15555 2002-08-01 Martin Baulig <martin@gnome.org>
15557 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
15558 `is_disposable' fields.
15559 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
15560 `hm.is_disposable' if we're using the collection pattern.
15561 (Foreach.EmitCollectionForeach): Use the correct type for the
15562 enumerator's local variable, only emit the try/finally block if
15563 necessary (fixes #27713).
15565 2002-08-01 Martin Baulig <martin@gnome.org>
15567 * ecore.cs (Expression.report118): Renamed to Error118 and made
15570 * statement.cs (Throw.Resolve): Check whether the expression is of
15571 the correct type (CS0118) and whether the type derives from
15572 System.Exception (CS0155).
15573 (Catch.Resolve): New method. Do the type lookup here and check
15574 whether it derives from System.Exception (CS0155).
15575 (Catch.CatchType, Catch.IsGeneral): New public properties.
15577 * typemanager.cs (TypeManager.exception_type): Added.
15579 2002-07-31 Miguel de Icaza <miguel@ximian.com>
15581 * driver.cs: Updated About function.
15583 2002-07-31 Martin Baulig <martin@gnome.org>
15585 Implemented Control Flow Analysis.
15587 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
15588 (EmitContext.CurrentBranching): Added.
15589 (EmitContext.StartFlowBranching): Added.
15590 (EmitContext.EndFlowBranching): Added.
15591 (EmitContext.KillFlowBranching): Added.
15592 (EmitContext.IsVariableAssigned): Added.
15593 (EmitContext.SetVariableAssigned): Added.
15594 (EmitContext.IsParameterAssigned): Added.
15595 (EmitContext.SetParameterAssigned): Added.
15596 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
15597 Added control flow analysis stuff here.
15599 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
15600 resolve the expression as lvalue.
15601 (LocalVariableReference.DoResolve): Check whether the variable has
15602 already been assigned.
15603 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
15604 the parameter as assigned here.
15605 (ParameterReference.DoResolve): Check whether the parameter has already
15607 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
15608 expression as lvalue.
15610 * statement.cs (FlowBranching): New class for the flow analysis code.
15611 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
15612 (LabeledStatement.IsDefined): New public property.
15613 (LabeledStatement.AddUsageVector): New public method to tell flow
15614 analyis that the label may be reached via a forward jump.
15615 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
15617 (VariableInfo.Number): New public field. This is used by flow analysis
15618 to number all locals of a block.
15619 (Block.CountVariables): New public property. This is the number of
15620 local variables in this block (including the locals from all parent
15622 (Block.EmitMeta): Number all the variables.
15624 * statement.cs: Added flow analysis support to all classes.
15626 2002-07-31 Martin Baulig <martin@gnome.org>
15628 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
15629 To get debugging messages, compile mcs with /define:MCS_DEBUG and
15630 then use this argument.
15632 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
15634 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
15635 use this to specify /define options.
15637 2002-07-29 Martin Baulig <martin@gnome.org>
15639 * statement.cs (Fixed): Moved all code that does variable lookups
15640 and resolvings from Emit to Resolve.
15642 * statement.cs (For): Moved all code that does variable lookups
15643 and resolvings from Emit to Resolve.
15645 * statement.cs (Using): Moved all code that does variable lookups
15646 and resolvings from Emit to Resolve.
15648 2002-07-29 Martin Baulig <martin@gnome.org>
15650 * attribute.cs (Attribute.Resolve): Explicitly catch a
15651 System.NullReferenceException when creating the
15652 CustromAttributeBuilder and report a different warning message.
15654 2002-07-29 Martin Baulig <martin@gnome.org>
15656 * support.cs (ParameterData.ParameterName): Added method to
15657 get the name of a parameter.
15659 * typemanager.cs (TypeManager.IsValueType): New public method.
15661 2002-07-29 Martin Baulig <martin@gnome.org>
15663 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
15664 is a flag which specifies that it's either ref or out.
15665 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
15666 the out parameter to `out Parameter.Modifier mod', also set the
15667 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
15669 * support.cs (InternalParameters.ParameterModifier): Distinguish
15670 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
15671 Parameter.Modifier.ISBYREF flag if it's either ref or out.
15673 * expression.cs (Argument.GetParameterModifier): Distinguish
15674 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
15675 Parameter.Modifier.ISBYREF flag if it's either ref or out.
15677 2002-07-29 Martin Baulig <martin@gnome.org>
15679 * expression.cs (ParameterReference.ParameterReference): Added
15680 `Location loc' argument to the constructor.
15682 * cs-parser.jay: Pass location to ParameterReference.
15684 2002-07-28 Miguel de Icaza <miguel@ximian.com>
15686 * statement.cs (Try): Initialize the location.
15688 * cs-parser.jay: pass location to Try.
15690 * expression.cs (Unary.Reduce): Change the prototype to return
15691 whether a constant fold could be performed or not. The result is
15692 returned in an out parameters. In the case of Indirection and
15693 AddressOf, we want to perform the full tests.
15695 2002-07-26 Miguel de Icaza <miguel@ximian.com>
15697 * statement.cs (Statement.Emit): Flag dead code.
15699 2002-07-27 Andrew Birkett <andy@nobugs.org>
15701 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
15703 2002-07-27 Martin Baulig <martin@gnome.org>
15705 * class.cs (MethodData.Define): Put back call to
15706 TypeManager.AddMethod(), accidentally commented this out.
15708 * report.cs (Debug): New public method to print debugging information,
15709 this is `[Conditional ("DEBUG")]'.
15711 2002-07-26 Martin Baulig <martin@gnome.org>
15713 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
15714 (switch_statement): Push the current_block to the switch_stack and
15715 pop it again when we're done with the switch.
15716 (switch_section): The new block is a child of the current_block.
15717 Fixes bug #24007, added test-152.cs.
15719 2002-07-27 Martin Baulig <martin@gnome.org>
15721 * expression.cs (Invocation.EmitArguments): When calling a varargs
15722 function with only its fixed arguments, we need to pass an empty
15725 2002-07-27 Martin Baulig <martin@gnome.org>
15727 Mono 0.13 has been released.
15729 2002-07-25 Miguel de Icaza <miguel@ximian.com>
15731 * driver.cs: Rename --resource to --linkres, because that is what
15732 we do currently, we dont support --resource yet.
15734 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
15736 2002-07-25 Martin Baulig <martin@gnome.org>
15738 * class.cs (MethodData): New public class. This is a `method builder'
15739 class for a method or one accessor of a Property/Indexer/Event.
15740 (MethodData.GetMethodFlags): Moved here from MemberBase.
15741 (MethodData.ApplyAttributes): Likewise.
15742 (MethodData.ApplyObsoleteAttribute): Likewise.
15743 (MethodData.ApplyConditionalAttribute): Likewise.
15744 (MethodData.ApplyDllImportAttribute): Likewise.
15745 (MethodData.CheckAbstractAndExternal): Likewise.
15746 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
15747 (MethodData.Emit): Formerly known as Method.Emit().
15748 (MemberBase): Moved everything which was specific to a single
15749 accessor/method to MethodData.
15750 (Method): Create a new MethodData and call Define() and Emit() on it.
15751 (Property, Indexer, Event): Create a new MethodData objects for each
15752 accessor and call Define() and Emit() on them.
15754 2002-07-25 Martin Baulig <martin@gnome.org>
15756 Made MethodCore derive from MemberBase to reuse the code from there.
15757 MemberBase now also checks for attributes.
15759 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
15760 (MemberBase.GetMethodFlags): Moved here from class Method and marked
15762 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
15763 `CallingConventions cc' and `Attributes opt_attrs' arguments.
15764 (MemberBase.ApplyAttributes): New virtual method; applies the
15765 attributes to a method or accessor.
15766 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
15767 (MemberBase.ApplyConditionalAttribute): Likewise.
15768 (MemberBase.ApplyDllImportAttribute): Likewise.
15769 (MemberBase.CheckAbstractAndExternal): Likewise.
15770 (MethodCore.ParameterTypes): This is now a property instead of a
15771 method, it's initialized from DoDefineParameters().
15772 (MethodCore.ParameterInfo): Removed the set accessor.
15773 (MethodCore.DoDefineParameters): New protected virtual method to
15774 initialize ParameterTypes and ParameterInfo.
15775 (Method.GetReturnType): We can now simply return the MemberType.
15776 (Method.GetMethodFlags): Override the MemberBase version and add
15777 the conditional flags.
15778 (Method.CheckBase): Moved some code from Define() here, call
15779 DoDefineParameters() here.
15780 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
15781 here to avoid some larger code duplication.
15782 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
15783 ensure that abstract and external accessors don't declare a body.
15785 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
15786 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
15787 lookup in the attribute's parent classes, so we need to abort as soon
15788 as we found the first match.
15789 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
15790 the attribute has no arguments.
15792 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
15795 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15797 * cs-parser.jay: reverted previous patch.
15799 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15801 * cs-parser.jay: fixed bug #22119.
15803 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15805 * attribute.cs: fixed compilation. The error was:
15806 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
15807 be assigned to before control leaves the current method."
15808 [FIXME: Filed as bug #28186: MCS must report this error.]
15810 2002-07-25 Martin Baulig <martin@gnome.org>
15812 * attribute.cs (Attribute.Conditional_GetConditionName): New static
15813 method to pull the condition name ouf of a Conditional attribute.
15814 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
15815 the obsolete message and error flag out of an Obsolete attribute.
15817 * class.cs (Method.GetMethodFlags): New public method to get the
15818 TypeManager.MethodFlags for this method.
15819 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
15821 (Method.Define): Get and apply the Obsolete and Conditional attributes;
15822 if we're overriding a virtual function, set the new private variable
15823 `parent_method'; call the new TypeManager.AddMethod().
15825 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
15826 the MethodBuilder and the Method in a PtrHashtable.
15827 (TypeManager.builder_to_method): Added for this purpose.
15828 (TypeManager.MethodFlags): Added IsObsoleteError.
15829 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
15830 Obsolete and Conditional arguments in MethodBuilders. If we discover
15831 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
15832 the message from the attribute.
15834 2002-07-24 Martin Baulig <martin@gnome.org>
15836 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
15837 preprocessor directives, ensure that the argument to #define/#undef is
15838 exactly one identifier and that it's actually an identifier.
15840 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
15843 2002-07-24 Martin Baulig <martin@gnome.org>
15845 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
15846 initialize it to TypeManager.object_type in the constructor.
15847 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
15848 of the `hm.get_current' method if we're using the collection pattern.
15849 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
15850 for the explicit conversion to make it work when we're using the collection
15851 pattern and the `Current' property has a different return type than `object'.
15854 2002-07-24 Martin Baulig <martin@gnome.org>
15856 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
15857 does not match, but don't report any errors. This method is called in
15858 order for all methods in a MethodGroupExpr until a matching method is
15859 found, so we don't want to bail out if the first method doesn't match.
15860 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
15861 matches, report the 123. Fixes #28070.
15863 2002-07-24 Martin Baulig <martin@gnome.org>
15865 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
15866 TypeManager.TypeToCoreType() to the top of the method so the
15867 following equality checks will work. Fixes #28107.
15869 2002-07-24 Martin Baulig <martin@gnome.org>
15871 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
15872 operand is of type uint, and the other operand is of type sbyte,
15873 short or int, the operands are converted to type long." -
15874 Actually do what this comment already told us. Fixes bug #28106,
15877 2002-07-24 Martin Baulig <martin@gnome.org>
15879 * class.cs (MethodBase): New abstract class. This is now a base
15880 class for Property, Indexer and Event to avoid some code duplication
15881 in their Define() and DefineMethods() methods.
15882 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
15883 generic methods for Define() and DefineMethods().
15884 (FieldBase): Derive from MemberBase, not MemberCore.
15885 (Property): Derive from MemberBase, not MemberCore.
15886 (Property.DefineMethod): Moved all the code from this method to the
15887 new MethodBase.DefineAccessor(), just call it with appropriate
15889 (Property.Define): Call the new Property.DoDefine(), this does some
15890 sanity checks and we don't need to duplicate the code everywhere.
15891 (Event): Derive from MemberBase, not MemberCore.
15892 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
15893 accessors, this will also make them work with interface events.
15894 (Indexer): Derive from MemberBase, not MemberCore.
15895 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
15896 (Indexer.Define): Use the new MethodBase functions.
15898 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
15899 argument to the constructor.
15900 (Interface.FindMembers): Added support for interface events.
15901 (Interface.PopluateEvent): Implemented.
15903 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
15905 2002-07-22 Miguel de Icaza <miguel@ximian.com>
15907 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
15908 but this is required to check for a method name being the same as
15909 the containing class.
15913 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15915 * interface.cs: initialize variable.
15917 2002-07-23 Martin Baulig <martin@gnome.org>
15919 Implemented the IndexerName attribute in interfaces.
15921 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
15922 name if this is an explicit interface implementation.
15923 (Indexer.InterfaceIndexerName): New public variable. If we're
15924 implementing an interface indexer, this is the IndexerName in that
15925 interface. Otherwise, it's the IndexerName.
15926 (Indexer.DefineMethod): If we're implementing interface indexer,
15927 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
15928 and Pending.ImplementIndexer methods.
15929 (Indexer.Define): Also define the PropertyBuilder if we're
15930 implementing an interface indexer and this is neither an explicit
15931 interface implementation nor do the IndexerName match the one in
15934 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
15935 If a method is defined here, then we always need to create a proxy
15936 for it. This is used when implementing interface indexers.
15937 (Pending.IsInterfaceIndexer): New public method.
15938 (Pending.ImplementIndexer): New public method.
15939 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
15940 This is used when implementing interface indexers to define a proxy
15942 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
15943 define a proxy if necessary.
15945 * interface.cs (Interface.IndexerName): New public variable.
15946 (Interface.PopulateIndexer): Set the IndexerName.
15947 (Interface.DefineIndexers): New private method. Populate all the
15948 indexers and make sure their IndexerNames match.
15950 * typemanager.cs (IndexerPropertyName): Added support for interface
15953 2002-07-22 Martin Baulig <martin@gnome.org>
15955 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
15956 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
15957 ret if HasReturnLabel.
15958 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
15961 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
15962 and set the ec.LoopBeginTryCatchLevel.
15963 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
15964 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
15965 the current ec.TryCatchLevel, the branch goes out of an exception
15966 block. In this case, we need to use Leave and not Br.
15968 2002-07-22 Martin Baulig <martin@gnome.org>
15970 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
15971 block unless the block does not always return or it is contained in
15972 another try { ... } catch { ... } block. Fixes bug #26506.
15973 Added verify-1.cs to the test suite.
15975 2002-07-22 Martin Baulig <martin@gnome.org>
15977 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
15978 then we do not always return. Fixes bug #24985.
15980 2002-07-22 Martin Baulig <martin@gnome.org>
15982 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
15983 lookup on a per-class level; ie. walk up the class hierarchy until we
15984 found at least one applicable method, then choose the best among them.
15985 Fixes bug #24463 and test-29.cs.
15987 2002-07-22 Martin Baulig <martin@gnome.org>
15989 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
15990 return types of the methods. The return type is not part of the
15991 signature and we must not check it to make the `new' modifier work.
15992 Fixes bug #27999, also added test-147.cs.
15993 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
15995 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
15996 on the method's return type.
15998 2002-07-21 Martin Baulig <martin@gnome.org>
16000 * assign.cs: Make this work if the rightmost source is a constant and
16001 we need to do an implicit type conversion. Also adding a few more tests
16002 to test-38.cs which should have caught this.
16004 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
16005 target in the makefile for this. The makefile.gnu is primarily intended
16006 for end-users who don't want to debug the compiler.
16008 2002-07-21 Martin Baulig <martin@gnome.org>
16010 * assign.cs: Improved the Assign class so it can now handle embedded
16011 assignments (X = Y = Z = something). As a side-effect this'll now also
16012 consume less local variables. test-38.cs now passes with MCS, added
16013 a few new test cases to that test.
16015 2002-07-20 Martin Baulig <martin@gnome.org>
16017 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
16018 instructions. Fixes bug #27977, also added test-146.cs.
16020 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
16022 * cs-tokenizer.cs: fixed getHex ().
16024 2002-07-19 Martin Baulig <martin@gnome.org>
16026 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
16027 not Type.GetType() to lookup the array type. This is needed when
16028 we're constructing an array of a user-defined type.
16029 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
16030 single-dimensional arrays, but also for single-dimensial arrays of
16033 2002-07-19 Martin Baulig <martin@gnome.org>
16035 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
16036 this function is called, it's not allowed to share LocalBuilders
16037 among ILGenerators.
16039 2002-07-19 Martin Baulig <martin@gnome.org>
16041 * expression.cs (Argument.Resolve): Report an error 118 when trying
16042 to pass a type as argument.
16044 2002-07-18 Martin Baulig <martin@gnome.org>
16046 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
16047 Conv_R_Un for the signed `long' type.
16049 2002-07-15 Miguel de Icaza <miguel@ximian.com>
16051 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
16052 `expr' for the temporary result, as that will fail if we do
16053 multiple resolves on the same expression.
16055 2002-07-05 Miguel de Icaza <miguel@ximian.com>
16057 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
16058 ec.TypeContainer for looking up aliases.
16060 * class.cs (TypeContainer): Remove LookupAlias from here.
16062 * decl.cs (DeclSpace); Move here.
16064 2002-07-01 Miguel de Icaza <miguel@ximian.com>
16066 * class.cs (FindMembers): Only call filter if the constructor
16067 bulider is not null.
16069 Also handle delegates in `NestedTypes' now. Now we will perform
16070 type lookups using the standard resolution process. This also
16073 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
16074 This uses Expressions (the limited kind that can be parsed by the
16075 tree) instead of strings.
16077 * expression.cs (ComposedCast.ToString): Implement, used to flag
16078 errors since now we have to render expressions.
16080 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
16083 * ecore.cs (SimpleName.ToString): ditto.
16085 * cs-parser.jay: Instead of using strings to assemble types, use
16086 Expressions to assemble the type (using SimpleName, ComposedCast,
16087 MemberAccess). This should fix the type lookups in declarations,
16088 because we were using a different code path for this.
16090 * statement.cs (Block.Resolve): Continue processing statements
16091 even when there is an error.
16093 2002-07-17 Miguel de Icaza <miguel@ximian.com>
16095 * class.cs (Event.Define): Also remove the `remove' method from
16096 the list of pending items.
16098 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
16099 generate more compact code.
16101 2002-07-17 Martin Baulig <martin@gnome.org>
16103 * const.cs (Const.LookupConstantValue): Add support for constant
16104 `unchecked' and `checked' expressions.
16105 Also adding test case test-140.cs for this.
16107 2002-07-17 Martin Baulig <martin@gnome.org>
16109 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
16110 check whether mi.ReturnType implements the IEnumerator interface; the
16111 `==' and the IsAssignableFrom() will fail in this situation.
16113 2002-07-16 Ravi Pratap <ravi@ximian.com>
16115 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
16118 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
16120 * expression.cs: fixed bug #27811.
16122 2002-07-14 Miguel de Icaza <miguel@ximian.com>
16124 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
16125 Molaro: when we are a ref, the value already contains a pointer
16126 value, do not take the address of it.
16128 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
16129 * removed mb-parser.jay and mb-tokenizer.cs
16131 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
16133 * expression.cs: check against the building corlib void type.
16135 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
16137 * ecore.cs: fix for valuetype static readonly fields: when
16138 initializing them, we need their address, not the address of a copy.
16140 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
16142 * typemanager.cs: register also enum_type in corlib.
16144 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
16146 * class.cs: allow calling this (but not base) initializers in structs.
16148 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
16150 * ecore.cs: make sure we compare against the building base types
16153 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
16155 * typemanager.cs: fix TypeToCoreType() to handle void and object
16156 (corlib gets no more typerefs after this change).
16158 2002-07-12 Miguel de Icaza <miguel@ximian.com>
16160 * expression.cs (ArrayCreation.EmitArrayArguments): use
16161 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
16163 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
16164 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
16165 array indexes, the runtime actually forbids them.
16167 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
16168 for array arguments here.
16170 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
16171 instead of the default for ValueTypes.
16173 (New.DoEmit): Use IsValueType instead of
16174 IsSubclassOf (value_type)
16175 (New.DoResolve): ditto.
16176 (Invocation.EmitCall): ditto.
16178 * assign.cs (Assign): ditto.
16180 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
16181 Statements *are* currently doing part of their resolution during
16184 Expressions do always resolve during resolve, but statements are
16185 only required to propagate resolution to their children.
16187 2002-07-11 Miguel de Icaza <miguel@ximian.com>
16189 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
16191 (LoadAssembly): Do not add the dll if it is already specified
16193 (MainDriver): Add the System directory to the link path at the end,
16194 after all the other -L arguments.
16196 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
16197 wrong opcode for loading bytes and bools (ldelem.i1 instead of
16198 ldelem.u1) and using the opposite for sbytes.
16200 This fixes Digger, and we can finally run it.
16202 * driver.cs (UnixParseOption): Move the option parsing here.
16203 (CSCParseOption): Implement CSC-like parsing of options.
16205 We now support both modes of operation, the old Unix way, and the
16206 new CSC-like way. This should help those who wanted to make cross
16207 platform makefiles.
16209 The only thing broken is that /r:, /reference: and /lib: are not
16210 implemented, because I want to make those have the same semantics
16211 as the CSC compiler has, and kill once and for all the confussion
16212 around this. Will be doing this tomorrow.
16214 * statement.cs (Unsafe.Resolve): The state is checked during
16215 resolve, not emit, so we have to set the flags for IsUnsfe here.
16217 2002-07-10 Miguel de Icaza <miguel@ximian.com>
16219 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
16220 not catch the Error_ObjectRefRequired in SimpleName (as it is
16221 possible to have a class/instance variable name that later gets
16222 deambiguated), we have to check this here.
16224 2002-07-10 Ravi Pratap <ravi@ximian.com>
16226 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
16227 make static and put into Expression.
16229 (Event.Define): Register the private field of the event with the
16230 TypeManager so that GetFieldFromEvent can get at it.
16232 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
16233 keep track of the private field associated with an event which
16236 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
16239 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
16241 2002-07-10 Miguel de Icaza <miguel@ximian.com>
16243 * expression.cs (Binary.EmitBranchable): this routine emits the
16244 Binary expression in a branchable context. This basically means:
16245 we need to branch somewhere, not just get the value on the stack.
16247 This works together with Statement.EmitBoolExpression.
16249 * statement.cs (Statement.EmitBoolExpression): Use
16252 2002-07-09 Miguel de Icaza <miguel@ximian.com>
16254 * statement.cs (For): Reduce the number of jumps in loops.
16256 (For): Implement loop inversion for the For statement.
16258 (Break): We can be breaking out of a Try/Catch controlled section
16259 (foreach might have an implicit try/catch clause), so we need to
16260 use Leave instead of Br.
16262 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
16263 now). If the instace expression supports IMemoryLocation, we use
16264 the AddressOf method from the IMemoryLocation to extract the
16265 address instead of emitting the instance.
16267 This showed up with `This', as we were emitting the instance
16268 always (Emit) instead of the Address of This. Particularly
16269 interesting when This is a value type, as we dont want the Emit
16270 effect (which was to load the object).
16272 2002-07-08 Miguel de Icaza <miguel@ximian.com>
16274 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
16276 * statement.cs (Checked): Set the CheckedState during the resolve
16277 process too, as the ConvCast operations track the checked state on
16278 the resolve process, and not emit.
16280 * cs-parser.jay (namespace_member_declaration): Flag that we have
16281 found a declaration when we do. This is used to flag error 1529
16283 * driver.cs: Report ok when we display the help only.
16285 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
16287 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
16289 2002-07-04 Miguel de Icaza <miguel@ximian.com>
16291 * cs-tokenizer.cs (define): We also have to track locally the
16292 defines. AllDefines is just used for the Conditional Attribute,
16293 but we also need the local defines for the current source code.
16295 2002-07-03 Miguel de Icaza <miguel@ximian.com>
16297 * statement.cs (While, For, Do): These loops can exit through a
16298 Break statement, use this information to tell whether the
16299 statement is the last piece of code.
16301 (Break): Flag that we break.
16303 * codegen.cs (EmitContexts): New `Breaks' state variable.
16305 2002-07-03 Martin Baulig <martin@gnome.org>
16307 * class.cs (TypeContainer.MethodModifiersValid): Allow override
16308 modifiers in method declarations in structs. Otherwise, you won't
16309 be able to override things like Object.Equals().
16311 2002-07-02 Miguel de Icaza <miguel@ximian.com>
16313 * class.cs (Method, Property, Indexer): Do not allow the public
16314 modifier to be used in explicit interface implementations.
16316 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
16317 override modifiers in method declarations in structs
16319 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
16321 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
16322 integer or real overflow, report an error
16324 2002-07-02 Martin Baulig <martin@gnome.org>
16326 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
16327 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
16328 to tell the runtime about our newly created System.Object and
16329 System.ValueType types.
16331 2002-07-02 Miguel de Icaza <miguel@ximian.com>
16333 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
16334 struct instead of Ldarg/Starg.
16336 2002-07-02 Martin Baulig <martin@gnome.org>
16338 * expression.cs (Indirection.Indirection): Call
16339 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
16341 2002-07-02 Martin Baulig <martin@gnome.org>
16343 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
16344 ValueType, call TypeManager.TypeToCoreType() on it.
16345 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
16346 the OpCodes.Newarr argument.
16348 2002-07-02 Martin Baulig <martin@gnome.org>
16350 * expression.cs (Invocation.EmitCall): When compiling corlib,
16351 replace all calls to the system's System.Array type to calls to
16352 the newly created one.
16354 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
16355 System.Array methods.
16356 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
16357 from the system's System.Array type which must be replaced.
16359 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
16361 * typemanager.cs: load unverifiable_code_ctor so we can build
16362 corlib using the correct type. Avoid using GetTypeCode() with
16364 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
16365 TypeManager.object_type to allow building corlib.
16367 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
16369 * ecore.cs: handle System.Enum separately in LoadFromPtr().
16371 2002-07-01 Martin Baulig <martin@gnome.org>
16373 * class.cs: Make the last change actually work, we need to check
16374 whether `ifaces != null' to avoid a crash.
16376 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
16378 * class.cs: when we build structs without fields that implement
16379 interfaces, we need to add the interfaces separately, since there is
16380 no API to both set the size and add the interfaces at type creation
16383 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
16385 * expression.cs: the dimension arguments to the array constructors
16386 need to be converted if they are a long.
16388 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
16390 * class.cs: don't emit ldarg.0 if there is no parent constructor
16391 (fixes showstopper for corlib).
16393 2002-06-29 Martin Baulig <martin@gnome.org>
16395 MCS now compiles corlib on GNU/Linux :-)
16397 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
16398 ie. check for MethodImplOptions.InternalCall.
16400 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
16401 and TypeManager.attribute_type are null, so we must explicitly check
16402 whether parent is not null to find out whether it's an attribute type.
16403 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
16404 and SetBuilder, not only if the property is neither abstract nor external.
16405 This is necessary to set the MethodImplOptions on the accessor methods.
16406 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
16407 SetBuilder, see Property.Emit().
16409 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
16410 populate "System.Object", "System.ValueType" and "System.Attribute" since
16411 they've already been populated from BootCorlib_PopulateCoreTypes().
16413 2002-06-29 Martin Baulig <martin@gnome.org>
16415 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
16416 is the NullLiteral, we also need to make sure that target_type is not
16419 2002-06-29 Martin Baulig <martin@gnome.org>
16421 * rootcontext.cs (RootContext.ResolveCore): We must initialize
16422 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
16423 before calling BootstrapCorlib_ResolveDelegate ().
16425 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
16427 * statement.cs: fixed build-breaker. All tests passed ok.
16429 2002-06-27 Martin Baulig <martin@gnome.org>
16431 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
16432 for System.Decimal when compiling corlib.
16434 2002-06-27 Martin Baulig <martin@gnome.org>
16436 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
16437 switch blocks which contain nothing but a default clause.
16439 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
16441 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
16443 2002-06-27 Martin Baulig <martin@gnome.org>
16445 * ecore.cs (PropertyExpr.PropertyExpr): Call
16446 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
16448 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
16449 is already a TypeBuilder.
16451 2002-06-27 Martin Baulig <martin@gnome.org>
16453 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
16454 `target_type == TypeManager.array_type', not IsAssignableFrom() in
16455 the "from an array-type to System.Array" case. This makes it work
16456 when compiling corlib.
16458 2002-06-27 Martin Baulig <martin@gnome.org>
16460 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
16461 non-static PropertyExpr, set its InstanceExpression. This makes
16462 the `ICollection.Count' property work in System/Array.cs.
16464 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
16466 * driver.cs: Made error handling more consistent. Errors now
16467 tracked by Report class, so many methods which used to return int
16468 now return void. Main() now prints success/failure and
16469 errors/warnings message.
16471 Renamed '--probe' compiler argument to '--expect-error'. Removed
16472 the magic number return values (123 and 124). Now, if the
16473 expected error occurs, the compiler exits with success (exit value
16474 0). If the compilation completes without seeing that particular
16475 error, the compiler exits with failure (exit value 1). The
16476 makefile in mcs/errors has been changed to handle the new behaviour.
16478 * report.cs: Made 'expected error' number a property and renamed
16479 it from 'Probe' to 'ExpectedError'.
16481 * genericparser.cs: Removed error handling support, since it is
16482 now all done by Report class.
16484 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
16485 class, so parse() no longer returns an int.
16487 * namespace.cs: Use Report.Error instead of GenericParser.error
16489 2002-06-22 Miguel de Icaza <miguel@ximian.com>
16491 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
16492 TypeContainer.AddOperator): At the front of the list put the
16493 explicit implementations, so they get resolved/defined first.
16495 2002-06-21 Miguel de Icaza <miguel@ximian.com>
16497 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
16498 interface type is implemented by this TypeContainer. Used during
16499 explicit interface implementation.
16501 (Property.Define, Indexer.Define, Method.Define): Validate that
16502 the given interface in the explicit implementation is one of the
16503 base classes for the containing type.
16505 Also if we are explicitly implementing an interface, but there is
16506 no match in the pending implementation table, report an error.
16508 (Property.Define): Only define the property if we are
16509 not explicitly implementing a property from an interface. Use the
16510 correct name also for those properties (the same CSC uses,
16511 although that is really not needed).
16513 (Property.Emit): Do not emit attributes for explicitly implemented
16514 properties, as there is no TypeBuilder.
16516 (Indexer.Emit): ditto.
16518 Hiding then means that we do not really *implement* a pending
16519 implementation, which makes code fail.
16521 2002-06-22 Martin Baulig <martin@gnome.org>
16523 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
16524 the return value of Object.GetType(). [FIXME: we need to do this whenever
16525 we get a type back from the reflection library].
16527 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
16529 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
16531 2002-06-20 Miguel de Icaza <miguel@ximian.com>
16533 * attribute.cs: Return null if we can not look up the type.
16535 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
16536 the interface types found.
16538 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
16539 interface types found.
16541 * typemanager.cs (GetInterfaces): Make this routine returns alll
16542 the interfaces and work around the lame differences between
16543 System.Type and System.Reflection.Emit.TypeBuilder in the results
16544 result for GetInterfaces.
16546 (ExpandInterfaces): Given an array of interface types, expand and
16547 eliminate repeated ocurrences of an interface. This expands in
16548 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
16551 2002-06-21 Martin Baulig <martin@gnome.org>
16553 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
16556 2002-06-21 Martin Baulig <martin@gnome.org>
16558 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
16559 and called with one of the core types, return the corresponding typebuilder for
16562 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
16565 2002-06-21 Martin Baulig <martin@gnome.org>
16567 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
16568 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
16569 (Expression.ConvertReferenceExplicit): Likewise.
16571 * expression.cs (ElementAccess.DoResolve): Likewise.
16572 (ElementAccess.DoResolveLValue): Likewise.
16574 2002-06-10 Martin Baulig <martin@gnome.org>
16576 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
16577 add the "value" parameter to the parameter list.
16579 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
16582 2002-06-19 Miguel de Icaza <miguel@ximian.com>
16584 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
16585 the argument to an int, uint, long or ulong, per the spec. Also
16586 catch negative constants in array creation.
16588 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
16590 * class.cs: do not allow the same interface to appear twice in
16591 the definition list.
16593 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
16595 * ecore.cs: don't use ldlen with System.Array.
16597 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
16599 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
16601 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
16603 * modifiers.cs: produce correct field attributes for protected
16604 internal. Easy fix so miguel can work on ther harder stuff:-)
16606 2002-06-18 Miguel de Icaza <miguel@ximian.com>
16608 * pending.cs: New file. Move the code from class.cs here.
16609 Support clearning the pending flag for all methods (when not doing
16610 explicit interface implementation).
16612 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
16614 * rootcontext.cs: added a couple more types needed to bootstrap.
16616 2002-06-17 Miguel de Icaza <miguel@ximian.com>
16618 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
16619 constructor in the type, instead of any constructor in the type
16620 hierarchy. Thanks to Paolo for finding this bug (it showed up as
16621 a bug in the Mono runtime when applying the params attribute).
16623 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
16624 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
16626 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
16628 * expression.cs (Unary.ResolveOperator): Use TypeManager
16629 to resolve the type.
16631 2002-06-13 Ravi Pratap <ravi@ximian.com>
16633 * cs-parser.jay (enum_member_declaration): Pass in the attributes
16636 * enum.cs (AddEnumMember): Add support to store the attributes associated
16637 with each member too.
16639 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
16640 field builders too - this takes care of the enum member case.
16642 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
16644 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
16645 address-of operator on both value types and pointers.
16647 2002-06-10 Martin Baulig <martin@gnome.org>
16649 * interface.cs (Interface.PopulateIndexer): Add the indexer's
16650 PropertyBuilder to the `property_builders' list.
16652 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
16653 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
16654 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
16655 find any indexers which are inherited from an interface.
16657 2002-06-09 Martin Baulig <martin@gnome.org>
16659 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
16660 the same type as the constant if necessary. There's also a test-130.cs
16663 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
16665 * typemanager.cs (TypeManager.ChangeType): Previously known as
16666 Enum.ChangeEnumType().
16668 2002-06-09 Martin Baulig <martin@gnome.org>
16670 * expression.cs (Cast.TryReduce): Added support for consts.
16672 2002-06-08 Ravi Pratap <ravi@ximian.com>
16674 * class.cs (Accessor): Hold attributes information so we can pass
16677 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
16678 Modify to pass in attributes attached to the methods.
16680 (add_accessor_declaration, remove_accessor_declaration): Ditto.
16682 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
16683 to handle the Accessor kind :-)
16685 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
16687 2002-06-08 Martin Baulig <martin@gnome.org>
16689 * expression.cs (Unary.TryReduceNegative): Added support for
16692 2002-06-08 Martin Baulig <martin@gnome.org>
16694 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
16695 name can't be found in the `defined_names' - the caller will do a
16696 MemberLookup in this case and thus find methods in System.Enum
16697 such as Enum.IsDefined().
16699 2002-06-08 Martin Baulig <martin@gnome.org>
16701 * enum.cs (Enum.ChangeEnumType): This is a custom version of
16702 Convert.ChangeType() which works with TypeBuilder created types.
16703 (Enum.LookupEnumValue, Enum.Define): Use it here.
16705 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
16706 `TypeBuilder.BaseType != null' check.
16707 (TypeContainer.FindMembers): Only lookup parent members if we
16708 actually have a parent.
16709 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
16710 (ConstructorInitializer.Resolve): Likewise.
16712 * interface.cs (Interface.FindMembers): Added
16713 `TypeBuilder.BaseType != null' check.
16715 * rootcontext.cs (RootContext.ResolveCore): Added
16716 "System.Runtime.CompilerServices.IndexerNameAttribute" to
16717 classes_second_stage.
16719 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
16720 debug_type and trace_type when compiling with --nostdlib.
16722 2002-06-07 Martin Baulig <martin@gnome.org>
16724 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
16725 (AddField): Set it to true when adding a non-static field.
16726 (DefineType): Use `have_nonstatic_fields' to find out whether we
16727 have non-static fields, not `Fields != null'.
16729 2002-06-02 Miguel de Icaza <miguel@ximian.com>
16731 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
16732 dereferencing a null on the static-field code path)
16734 2002-05-30 Martin Baulig <martin@gnome.org>
16736 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
16737 to take command line arguments. Use reflection to call the new
16738 custom `Initialize' function on the symbol writer and pass it the
16739 command line arguments.
16741 * driver.cs (--debug-args): New command line argument to pass command
16742 line arguments to the symbol writer.
16744 2002-05-28 Miguel de Icaza <miguel@ximian.com>
16746 * assign.cs (DoResolve): Forgot to do the implicit conversion to
16747 the target type for indexers and properties. Thanks to Joe for
16750 2002-05-27 Miguel de Icaza <miguel@ximian.com>
16752 * typemanager.cs (MethodFlags): returns the method flags
16753 (Obsolete/ShouldIgnore) that control warning emission and whether
16754 the invocation should be made, or ignored.
16756 * expression.cs (Invocation.Emit): Remove previous hack, we should
16757 not do this on matching a base type, we should do this based on an attribute
16759 Only emit calls to System.Diagnostics.Debug and
16760 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
16761 on the command line.
16763 * rootcontext.cs: Global settings for tracing and debugging.
16765 * cs-tokenizer.cs (define): New utility function to track
16766 defines. Set the global settings for TRACE and DEBUG if found.
16768 2002-05-25 Ravi Pratap <ravi@ximian.com>
16770 * interface.cs (Populate*): Pass in the TypeContainer as well as
16771 the DeclSpace as parameters so that we can create EmitContexts and
16772 then use that to apply attributes etc.
16774 (PopulateMethod, PopulateEvent, PopulateProperty)
16775 (PopulateIndexer): Apply attributes everywhere.
16777 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
16780 (ApplyAttributes): Update accordingly.
16782 We now apply interface attributes for all members too.
16784 2002-05-26 Miguel de Icaza <miguel@ximian.com>
16786 * class.cs (Indexer.Define); Correctly check if we are explicit
16787 implementation (instead of checking the Name for a ".", we
16788 directly look up if the InterfaceType was specified).
16790 Delay the creation of the PropertyBuilder.
16792 Only create the PropertyBuilder if we are not an explicit
16793 interface implementation. This means that explicit interface
16794 implementation members do not participate in regular function
16795 lookups, and hence fixes another major ambiguity problem in
16796 overload resolution (that was the visible effect).
16798 (DefineMethod): Return whether we are doing an interface
16801 * typemanager.cs: Temporary hack until we get attributes in
16802 interfaces (Ravi is working on that) and we get IndexerName
16803 support in interfaces.
16805 * interface.cs: Register the indexers as properties.
16807 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
16808 warning, I have verified that this is a bug in the .NET runtime
16809 (JavaScript suffers of the same problem).
16811 * typemanager.cs (MemberLookup): When looking up members for
16812 interfaces, the parent of an interface is the implicit
16813 System.Object (so we succeed in searches of Object methods in an
16814 interface method invocation. Example: IEnumerable x; x.ToString
16817 2002-05-25 Miguel de Icaza <miguel@ximian.com>
16819 * class.cs (Event): Events should also register if they do
16820 implement the methods that an interface requires.
16822 * typemanager.cs (MemberLookup); use the new GetInterfaces
16825 (GetInterfaces): The code used to lookup interfaces for a type is
16826 used in more than one place, factor it here.
16828 * driver.cs: Track the errors at the bottom of the file, we kept
16831 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
16832 instance if the method we are calling is static!
16834 2002-05-24 Miguel de Icaza <miguel@ximian.com>
16836 * attribute.cs (ApplyAttributes): Make this function filter out
16837 the IndexerName attribute (as that attribute in reality is never
16838 applied) and return the string constant for the IndexerName
16841 * class.cs (TypeContainer.Emit): Validate that all the indexers
16842 have the same IndexerName attribute, and if so, set the
16843 DefaultName attribute on the class.
16845 * typemanager.cs: The return value might contain other stuff (not
16846 only methods). For instance, consider a method with an "Item"
16847 property and an Item method.
16849 * class.cs: If there is a problem with the parameter types,
16852 2002-05-24 Ravi Pratap <ravi@ximian.com>
16854 * ecore.cs (ImplicitConversionExists): Wrapper function which also
16855 looks at user defined conversion after making a call to
16856 StandardConversionExists - we need this for overload resolution.
16858 * expression.cs : Update accordingly the various method calls.
16860 This fixes 2 bugs filed against implicit user defined conversions
16862 2002-05-22 Miguel de Icaza <miguel@ximian.com>
16864 * statement.cs: Track the result of the assignment.
16866 2002-05-21 Miguel de Icaza <miguel@ximian.com>
16868 * expression.cs (MemberAccess): Improved error reporting for
16869 inaccessible members.
16871 2002-05-22 Martin Baulig <martin@gnome.org>
16873 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
16874 itself with debugging support.
16876 2002-05-22 Martin Baulig <martin@gnome.org>
16878 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
16879 Removed, this isn't needed anymore.
16881 2002-05-20 Martin Baulig <martin@gnome.org>
16883 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
16884 be underlying type for an enum.
16886 2002-05-20 Miguel de Icaza <miguel@ximian.com>
16888 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
16889 that splits out the loading of just the core types.
16891 * rootcontext.cs (ResolveCore): Split the struct resolution in
16892 two, so we can load the enumeration underlying types before any
16895 * expression.cs (Is): Bandaid until we fix properly Switch (see
16896 bug #24985 for details).
16898 * typemanager.cs (ImplementsInterface): The hashtable will contain
16899 a null if there are no interfaces implemented.
16901 2002-05-18 Miguel de Icaza <miguel@ximian.com>
16903 * cs-parser.jay (indexer_declarator): It is fine to have array
16906 2002-05-17 Miguel de Icaza <miguel@ximian.com>
16908 * typemanager.cs: (RegisterBuilder): New function used to register
16909 TypeBuilders that implement interfaces. Since
16910 TypeBuilder.GetInterfaces (as usual) does not work with lame
16912 (AddUserType): register interfaces.
16914 (ImplementsInterface): Use the builder_to_ifaces hash if we are
16915 dealing with TypeBuilder. Also, arrays are showing up as
16916 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
16917 methods can not be invoked on them!
16919 * ecore.cs (ExplicitReferenceConversionExists): Made public.
16920 (ImplicitReferenceConversionExists): Split out from
16921 StandardConversionExists.
16923 * expression.cs (As): We were only implementing one of the three
16924 cases for the as operator. We now implement them all.
16925 (Is): Implement the various other cases for Is as well.
16927 * typemanager.cs (CACHE): New define used to control if we want or
16928 not the FindMembers cache. Seems to have a negative impact on
16929 performance currently
16931 (MemberLookup): Nested types have full acess to
16932 enclosing type members
16934 Remove code that coped with instance/static returns for events, we
16935 now catch this in RealFindMembers.
16937 (RealFindMembers): only perform static lookup if the instance
16938 lookup did not return a type or an event.
16940 2002-05-17 Miguel de Icaza <miguel@ximian.com>
16942 * assign.cs (CompoundAssign): We pass more semantic information
16943 now to Compound Assignments than we did before: now we have all
16944 the information at hand, and now we resolve the target *before* we
16945 do the expression expansion, which allows the "CacheValue" method
16946 to have the effect we intended (before, a [x] += 1 would generate
16947 two differen ArrayAccess expressions from the ElementAccess,
16948 during the resolution process).
16950 (CompoundAssign.DoResolve): Resolve target and original_source here.
16952 2002-05-16 Miguel de Icaza <miguel@ximian.com>
16954 * expression.cs (ArrayAccess): dropped debugging information.
16956 * typemanager.cs: Small bug fix: I was always returning i_members,
16957 instead of one of i_members or s_members (depending on which had
16960 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
16961 method is invoked before any code generation takes place, and it
16962 is a mechanism to inform that the expression will be invoked more
16963 than once, and that the method should use temporary values to
16964 avoid having side effects
16966 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
16968 * ecore.cs (Expression.CacheTemporaries): Provide empty default
16971 * expression.cs (Indirection, ArrayAccess): Add support for
16972 CacheTemporaries in these two bad boys.
16974 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
16975 ldobj or ldind_ref.
16976 (StoreFromPtr): Handle stobj as well.
16978 * expression.cs (UnaryMutator): Share more code.
16980 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
16981 down: I was not tracking the Filter function as well, which
16982 was affecting the results of the cache.
16984 2002-05-15 Miguel de Icaza <miguel@ximian.com>
16986 * attribute.cs: Remove the hack to handle the CharSet property on
16989 2002-05-14 Miguel de Icaza <miguel@ximian.com>
16991 * attribute.cs (DoResolve): More uglyness, we now only try to
16992 resolve the attribute partially, to extract the CharSet
16993 information (only if we are a StructLayout attribute). Otherwise
16995 (GetExtraTypeInfo): Add some code to conditionally kill in the
16996 future this. I am more and more convinced that the .NET
16997 framework has special code to handle the attribute setting on
17000 * expression.cs (IsParamsMethodApplicable): Revert my previous
17001 foreach change here, it was wrong.
17003 2002-05-13 Miguel de Icaza <miguel@ximian.com>
17005 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
17006 (pp_expr): do not abort on unknown input, just return.
17007 (eval): abort if there are pending chars.
17009 * attribute.cs (Attribute.Resolve): Positional parameters are
17010 optional. Deal with that case.
17012 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
17013 the Ansi/Unicode/Auto information for the type.
17015 (TypeContainer.DefineType): instantiate the EmitContext here, as
17016 we will be using it during the type definition (to resolve
17017 attributes) and during the emit phase.
17019 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
17020 to pull type information out of the attributes
17022 (Attribute.Resolve): track the constructor builder, and allow for
17023 multiple invocations (structs and classes will use this).
17025 * ecore.cs (MemberLookupFinal): new version with all the
17026 parameters customizable.
17028 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
17029 constructors. Return if the result value is null (as the error
17030 would have been flagged already by MemberLookupFinal)
17032 Do not allow instances of abstract classes or interfaces to be
17035 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
17036 We have to compare the assembly property here when dealing with
17037 FamANDAssem and Assembly access modifiers, because we might be
17038 creating an assembly from *modules* (that means that we are not
17039 getting TypeBuilders for types defined in other modules that are
17040 part of this assembly).
17042 (Method.Emit): If the method is marked abstract and has a body,
17045 (TypeContainer.DefineMembers): If both the defined member and the
17046 parent name match are methods, then do not emit any warnings: let
17047 the Method.Define routine take care of flagging warnings. But if
17048 there is a mismatch (method overrides something else, or method is
17049 overriwritten by something, then emit warning).
17051 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
17052 set to null, this means `do not check for the return type on the
17055 (Method.Define): set the return type for the method signature to
17056 null, so that we get methods with the same name and parameters and
17057 different return types. This is used to flag warning 114 (you are
17058 hiding a method, and you probably want to use the new/override
17061 * typemanager.cs (MemberLookup): Implemented proper access
17062 control, closing a long standing set of bug reports. The problem
17063 was that the Framework only has two bits: Public and NonPublic,
17064 and NonPublic includes private and protected methods, but we need
17065 to enforce the FamANDAssem, FamOrAssem and Family.
17067 2002-05-11 Miguel de Icaza <miguel@ximian.com>
17069 * statement.cs (GotoCase): Return true: Ammounts to giving up
17070 knowledge on whether we return or not, and letting the other case
17071 be responsible for it.
17073 2002-05-10 Miguel de Icaza <miguel@ximian.com>
17075 * driver.cs: Do not load directories for each file processed, only
17076 do it if there is a pattern.
17078 * ecore.cs: Report readonly assigns here as well, as we might have
17079 been resolved only by MemberAccess.
17081 (SimpleName.SimpleNameResolve): Also be useful for LValue
17082 resolution. We need this to propagate assign to local readonly variables
17084 * typemanager.cs: Use a ptrhashtable for the criteria, because we
17085 do not want to reuse potential criteria memory.
17087 * class.cs (MyEventBuilder): Set reflected_type;
17089 * ecore.cs (Constantify): Added support for constifying bools.
17091 (RootContext.LookupType): Added a cache for values looked up in
17092 the declaration space.
17094 * typemanager.cs (FindMembers): Now is a front-end to
17095 RealFindMembers, and provides a two-level hashtable-based cache to
17098 15% performance improvement: from 22.5 to 19.2 seconds.
17100 * expression.cs (IsParamsMethodApplicable): use foreach.
17101 (Invocation.DoResolve): ditto.
17102 (New.DoResolve): ditto.
17103 (ArrayCreation.DoResolve): ditto.
17105 * ecore.cs (FindMostEncompassingType): use foreach.
17107 * delegate.cs (NewDelegate.DoResolve): Use foreach
17109 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
17110 (RemoveMethods): use foreach.
17112 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
17113 nested foreach statements instead of for, and also break out of
17114 the inner loop once a match is found.
17116 (Invocation.OverloadResolve): Use foreach, simplify the code.
17118 2002-05-08 Miguel de Icaza <miguel@ximian.com>
17120 * cfold.cs (BinaryFold): During an enumeration evaluation context,
17121 we actually unwrap the expression to allow for extra information
17124 * expression.cs: Use Shr_Un on unsigned operations.
17126 2002-05-08 Ravi Pratap <ravi@ximian.com>
17128 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
17129 applicable operators was not being considered correctly. This closes
17130 the bug Miguel reported.
17132 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
17134 * attribute.cs: check that the type derives from System.Attribute
17135 and report the correct error in that case (moved the duplicate code to
17136 its own method, too).
17138 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
17140 * attribute.cs: lookup attribute type name as the spec says: first the
17141 bare attribute name and then name + "Attribute" (nant compiles with
17142 mcs after this fix).
17144 2002-05-07 Miguel de Icaza <miguel@ximian.com>
17146 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
17147 Because of the way we parse things, we should try to see if a
17148 UIntConstant can fit in an integer.
17150 2002-05-07 Ravi Pratap <ravi@ximian.com>
17152 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
17153 when we are in an explicit context.
17155 (ConvertReferenceExplicit): When converting from Iface type S to Class
17156 T make sure the rules are implemented as an OR.
17158 * parameter.cs (ParameterType): Make it a property for now although the
17159 purpose really isn't anything immediate.
17161 * expression.cs (Is*Applicable): Do better checking on the parameter type
17162 of a ref/out parameter. The ones from the system assemblies are already
17163 marked with the correct type so we don't need to do any correction.
17165 * ecore.cs (StandardConversionExists): Conversion from Interface types to
17166 the object type is standard too so include that.
17168 2002-05-06 Miguel de Icaza <miguel@ximian.com>
17170 * ecore.cs (StandardConversionExists): Augment with missing code:
17171 deal with IntConstant, LongConstants and Enumerations.
17173 * assign.cs: Report the error, instead of failing silently
17175 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
17176 typecontainer that they are declared, because the
17177 typecontainer/namespace will have the list of using clauses that
17178 need to be applied.
17180 Assembly Attributes were escaping the normal registration
17183 (EmitCode): Apply attributes within an EmitContext that represents
17184 the container they were declared on.
17186 * cs-parser.jay: Track bases for structs. How did I get this wrong?
17188 2002-05-06 Ravi Pratap <ravi@ximian.com>
17190 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
17191 Revamp completely - make much cleaner as we now operate only
17194 (FindMostSpecificSource, FindMostSpecificTarget): New methods
17195 to implement the logic detailed in the spec more correctly.
17197 (UserDefinedConversion): Update accordingly.
17199 2002-05-06 Miguel de Icaza <miguel@ximian.com>
17201 * statement.cs: Return flow analysis information up.
17203 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
17206 (token): Do not consume an extra character before calling
17209 2002-05-06 Piers Haken <piersh@friskit.com>
17211 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
17213 2002-05-06 Miguel de Icaza <miguel@ximian.com>
17215 * class.cs (Constructor.Emit): Set the IsStatic flag in the
17216 EmitContext during the instance constructor initializer
17217 resolution, to stop access to instance variables.
17219 This is mandated by the spec, last paragraph of the `constructor
17220 initializers' section.
17222 2002-05-05 Miguel de Icaza <miguel@ximian.com>
17224 * cs-parser.jay, class.cs (Accessor): new class used to represent
17225 an accessor (get or set). In the past we used `null' to represent
17226 a missing accessor. But this is ambiguous because there was no
17227 way to tell in abstract indexers/properties if one of them was
17230 Now there is a way of addressing that.
17232 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
17233 instead of FindMembers.
17235 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
17236 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
17238 * attribute.cs: Treat indexers and properties as the same in terms
17239 of applying attributes
17241 * ecore.cs (FindMostEncompassedType): Use statically initialized
17242 EmptyExpressions()s like we do elsewhere to avoid creating useless
17243 objects (and we take this out of the tight loop).
17245 (GetConversionOperators): Move the code to extract the actual
17246 operators to a separate routine to clean things up.
17248 2002-05-04 Miguel de Icaza <miguel@ximian.com>
17250 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
17251 events are always registered FieldBuilders.
17253 * class.cs (FieldBase): New class shared by Fields
17255 * delegate.cs: If we are a toplevel delegate, use our full name.
17256 If we are a nested delegate, then only use our tail name.
17258 2002-05-02 Ravi Pratap <ravi@ximian.com>
17260 * expression.cs (IsApplicable): Ensure that we add the "&" to
17261 ref/out types before comparing it with the type of the argument.
17263 (IsParamsMethodApplicable): Ditto.
17265 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
17268 * delegate.cs : Handle the case when we have more than one applicable
17269 method. Flag an error only when we finish checking all.
17271 2002-05-02 Miguel de Icaza <miguel@ximian.com>
17273 * expression.cs: Add support for boolean static initializers.
17275 2002-05-01 Miguel de Icaza <miguel@ximian.com>
17277 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
17279 * parameter.cs (ComputeParameterTypes,
17280 ComputeAndDefineParameterTypes): Better error handling: now we
17281 clear the `types' cache if we fail during any of the type lookups.
17282 We also return the status code correctly to our caller
17284 * delegate.cs: If we fail to define a delegate, abort the extra
17287 * expression.cs (Binary.ResolveOperator): for
17288 operator==(object,object) and operator !=(object, object) we also
17289 have to verify that there is an implicit conversion from one to
17292 (ArrayAccess.DoResolve): Array Access can operate on
17295 2002-04-30 Miguel de Icaza <miguel@ximian.com>
17297 * assign.cs (CompoundAssign): A new class used as a "flag" that
17298 the assignment actually is happening as part of a compound
17299 assignment operator.
17301 During compound assignment, a few new rules exist to enable things
17308 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
17309 to the type of x) if y is implicitly convertible to the type of x,
17310 and the operator is a builtin operator and the return type of the
17311 operator is explicitly convertible to the type of x.
17313 * rootcontext.cs: Reset warning level to 2. 4 catches various
17314 "interesting" features in mcs, we must clean this up at some
17315 point, but currently am trying to kill other bugs ;-)
17317 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
17318 in container classes as well.
17320 * expression.cs (Binary.ResolveOperator): Handle string case
17321 before anything else (as operator overloading does emit an error
17322 before doing anything else).
17324 This code could go away when we move to a table driven model, but
17325 i could not come up with a good plan last night.
17327 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
17329 * typemanager.cs (CSharpName): reimplementation using regex.
17330 * class.cs: added null check for fields in Emit
17331 * rootcontext.cs: set warninglevel to 4
17333 2002-04-29 Miguel de Icaza <miguel@ximian.com>
17335 * typemanager.cs (CSharpName): reimplemented with Lupus
17338 2002-04-28 Miguel de Icaza <miguel@ximian.com>
17340 * statement.cs (If): correclty implement Resolve, because we were
17341 not catching sem errors in there. The same process is needed
17343 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
17346 (Statement.Warning_DeadCodeFound): Factorize code.
17347 (While): Report dead code here too.
17349 (Statement): Added Resolve virtual method to allow
17350 for resolution split from the emit code.
17352 2002-04-26 Miguel de Icaza <miguel@ximian.com>
17354 * statement.cs (EmitBoolExpression): No longer try to resolve the
17356 (MakeBoolean): New utility function that resolve, implicitly
17357 converts to boolean and tags the expression.
17360 (If, Do): Implement dead code elimination.
17361 (While): Implement loop inversion
17363 (Do, While, For, If): Resolve the expression prior to calling our
17366 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
17369 - added method Report28 (warning: program has more than one entry point)
17370 - added method IsEntryPoint, implements paragraph 10.1 of the spec
17371 - modified method Method.Define, the part at the end of the method
17373 * rootcontext.cs: added static public Location EntryPointLocation;
17375 * ../errors/cs0028.cs : Add test case for the above warning.
17378 - modified method CSharpName to allow arrays of primitive type to
17379 be printed nicely (e.g. instead of System.Int32[][] it now prints
17381 - added method CSharpSignature: returns the signature of a method
17382 in string format to be used in reporting errors, warnings, etc.
17384 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
17387 2002-04-26 Ravi Pratap <ravi@ximian.com>
17389 * delegate.cs (Define): Fix extremely silly bug where I was
17390 setting the type of the 'object' parameter of the BeginInvoke
17391 method to System.IAsyncResult instead of System.Object ;-)
17393 2002-04-26 Miguel de Icaza <miguel@ximian.com>
17395 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
17398 (Constructor.Emit): return if we fail to initialize the
17399 constructor. Another door closed!
17401 * expression.cs (New.DoResolve): Improve error message (from -6 to
17402 1501). Use DeclaredOnly lookup to find the exact constructor.
17404 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
17405 loop. This is useful.
17407 * cs-parser.jay: Adjust the default parameters so that destructors
17408 have the proper signature.
17410 2002-04-26 Martin Baulig <martin@gnome.org>
17412 * driver.cs (LoadAssembly): If `assembly' contains any characters
17413 which are only valid in path names and not in assembly names
17414 (currently slash, backslash and point), use Assembly.LoadFrom ()
17415 instead of Assembly.Load () on the `assembly' (before iteration
17416 over the link_paths).
17418 2002-04-26 Martin Baulig <martin@gnome.org>
17420 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
17422 2002-04-25 Miguel de Icaza <miguel@ximian.com>
17424 * class.cs (Property): use the new typemanager.MemberLookup
17426 (TypeContainer.MemberLookup): Implement using the
17427 TypeManager.MemberLookup now.
17429 * typemanager.cs: Make MemberLookup a function of the TypeManager,
17430 and return MemberInfos, so that these can be used without an
17431 EmitContext (what we had before).
17433 2002-04-24 Miguel de Icaza <miguel@ximian.com>
17435 * expression.cs: Fix the case where the argument to params if the
17436 type of the params. I omitted handling this before. Fixed
17438 2002-04-22 Miguel de Icaza <miguel@ximian.com>
17440 * driver.cs: Call BootCorlib_PopulateCoreType
17442 * class.cs (Property.CheckBase): Check for properties only, not
17445 * interface.cs: Temporary hack: try/catch around the
17446 CustomAttributeBuilder, because I am getting an exception that I
17449 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
17450 types whose definitions are required to be there (attributes are
17451 defined before standard types).
17453 Compute definitions as we boot the various types, as they are used
17454 immediately (value_type class will need object_type, but if we do
17455 not initialize object_type, we will pass a null, which will let
17456 the runtime pick the System.Object from the existing corlib, which
17457 is not what we want).
17459 2002-04-22 Patrik Torstensson <totte@labs2.com>
17461 * cs-tokenizer.cs: fixed a number of trim() issues.
17463 2002-04-22 Ravi Pratap <ravi@ximian.com>
17465 * expression.cs (Argument.Type): Ensure that we return the correct
17466 type when we have out or ref parameters [in which case we
17469 2002-04-22 Miguel de Icaza <miguel@ximian.com>
17471 * class.cs (Property, Indexer): Allow extern modifier in there.
17473 * typemanager.cs (InitBaseTypes): Initializes object_type and
17474 value_type, since those will be used early on during the bootstrap
17475 process to compile corlib.
17477 (InitCoreTypes): Move code from here to InitBaseTypes.
17479 2002-04-21 Miguel de Icaza <miguel@ximian.com>
17481 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
17482 single-dimension arrays as using the ldlen opcode.
17484 Daniel Lewis discovered this optimization.
17486 * typemanager.cs: Add signature for System.Array::get_Length
17488 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
17490 * statement.cs: report the error when the foreach does not apply to an
17491 array nor a collection.
17493 2002-04-19 Miguel de Icaza <miguel@ximian.com>
17495 * expression.cs: Add implicit conversions to the operator ~.
17497 * constant.cs (DecimalConstant.Emit): Emit decimal value.
17499 * typemanager.cs: Locate the decimal constructor.
17501 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
17503 * attribute.cs: use the new property of TypeOf.
17504 * expression.cs: added 'get' property around typearg.
17506 These changes fix a build breaker reported by NickD. Is this the
17507 correct way to fix? If not, please, revert my changes and make it
17510 2002-04-17 Miguel de Icaza <miguel@ximian.com>
17512 * attribute.cs: Add support for typeof in attribute invocations.
17513 I am not sure that this is right though.
17515 2002-04-14 Duncan Mak <duncan@ximian.com>
17517 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
17518 Binary.Operator.Division case.
17520 2002-04-13 Ravi Pratap <ravi@ximian.com>
17522 * class.cs (DefineType): Ensure that we do a proper check on
17523 attribute types and also register it with the TypeManager.
17525 (TypeContainer.Targets): The default for attribute types is
17526 AttributeTargets.All.
17528 * attribute.cs (ApplyAttributes): Registering the attribute type
17529 is done elsewhere, not when we discover we have a Usage attribute.
17531 2002-04-12 Ravi Pratap <ravi@ximian.com>
17533 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
17534 and get rid of is_delegate parameter.
17536 * everywhere : update.
17538 2002-04-12 Ravi Pratap <ravi@ximian.com>
17540 * cs-parser.jay (compilation_unit): Revamp completely to use
17541 some new ideas that I got from Rhys' grammar to solve the problems
17542 with assembly level attributes.
17544 (outer_declaration): New grammar production.
17546 (attribute_sections): Add.
17548 (opt_attributes): Base on attribute_sections
17550 (namespace_declaration): Allow opt_attributes to tackle the case
17551 when we have assembly level attributes - we are clever in this
17554 * attribute.cs (ApplyAttributes): Do not worry about assembly
17555 attributes in the non-global context.
17557 * rootcontext.cs (AddGlobalAttributes): Go back to using this
17558 instead of SetGlobalAttributes.
17560 * class.cs, rootcontext.cs : Ensure we define and generate
17561 attribute types before anything else.
17563 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
17564 and flag the new error -20 for the case when the attribute type
17565 does not have valid targets specified. csc does not catch this.
17567 * ../errors/errors.txt : update for error # -20
17569 2002-04-11 Ravi Pratap <ravi@ximian.com>
17571 * support.cs (InternalParameters.ParameterModifier): Do some null
17572 checking and return sane values.
17574 * class.cs (Method.Define): If we are a PInvoke method, ensure
17575 that we are static and extern. Report error # 601
17577 * ../errors/cs0601.cs : Add test case for the above error.
17579 2002-04-07 Ravi Pratap <ravi@ximian.com>
17581 * rootcontext.cs (attribute_types): We need to keep type of
17582 all attribute types separately and emit code for them first.
17584 (RegisterAttribute) : Implement.
17586 * class.cs (DefineType): Check if the current Type is a custom
17587 attribute type and register it accordingly.
17589 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
17590 adding the first attribute twice and rename to
17592 (SetGlobalAttributes): this.
17594 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
17597 * attribute.cs (ApplyAttributes): Take an additional argument telling us
17598 if we are processing global arguments. Hmm, I am unsure of this.
17600 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
17602 * expression.cs: added static array of strings to avoid calling
17603 Enum.ToString () for Operator in Binary. Significant recover of
17606 2002-04-10 Miguel de Icaza <miguel@ximian.com>
17608 * class.cs (FindMembers): Allow the Builders of the various
17609 members to be null. If they are skip them. This only happens
17610 during the PInvoke declaration.
17612 2002-04-09 Miguel de Icaza <miguel@ximian.com>
17614 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
17615 failure, so we do not keep going afterwards.
17617 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
17618 wanted to pass `false' as the `is_delegate' argument. If this is
17619 the case, why not use delegate_type == null to mean `is_delegate =
17620 false' and anything else as is_delegate = true.
17622 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
17624 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
17625 code for the section, not the beginning of the tests.
17627 2002-04-08 Miguel de Icaza <miguel@ximian.com>
17629 * cfold.cs: Handle operator + (Enum x, Underlying x)
17631 * expression.cs (Binary): same. Warn about errors where we have
17632 Enum/Enum in operator + as well.
17634 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
17637 - added support for switch(bool)
17638 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
17639 - add TableSwitchEmit() to handle table-based switch statements
17641 2002-04-05 Ravi Pratap <ravi@ximian.com>
17643 * expression.cs (Invocation.OverloadResolve): Factor out code which
17644 does parameter compatibility checking with arguments so that we can
17645 re-use the code even from Delegate.VerifyApplicability
17647 (VerifyArgumentsCompat): Move above code here.
17649 * delegate.cs (VerifyApplicability): Get rid of duplicate code
17650 and instead make a call to the above method.
17652 2002-03-31 Ravi Pratap <ravi@ximian.com>
17654 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
17655 We use it to keep track of classes which are attribute types.
17657 2002-04-02 Miguel de Icaza <miguel@ximian.com>
17659 * delegate.cs (Delegate.Define): Correctly define the types in the
17660 presence of fixed and array parameters.
17662 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
17665 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
17666 include NonPublic after the first iteration.
17668 * class.cs (Indexer.CheckBase): Only check if both parents are
17671 * cs-parser.jay (accessor_body): If empty, set to null.
17673 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
17674 same code path here to resolve constants names that we did have in
17675 MemberAccess.DoResolve. There is too much code duplicated here.
17677 2002-04-01 Miguel de Icaza <miguel@ximian.com>
17679 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
17681 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
17684 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
17685 tokens, numbers and strings.
17687 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
17690 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
17691 asyncronous parameters and the regular parameters.
17693 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
17694 specify the target directory.
17696 * expression.cs: (This.DoResolve): Simplify
17697 (As.Emit): Optimize, do not generate IsInst if the expression is
17698 always of the given type.
17700 (Is.DoResolve): Bug fix, we were reporting both always/never for
17703 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
17704 creating too many unnecessary arrays.
17706 2002-03-31 Miguel de Icaza <miguel@ximian.com>
17708 * class.cs (EmitFieldInitializer): Use Assign expression to assign
17709 fields instead of rolling our own initializer. Takes care of all
17710 implicit conversions, and drops unnecessary static checks/argument.
17712 2002-03-31 Dick Porter <dick@ximian.com>
17714 * driver.cs: use the GetDirectories() return values properly, and
17715 use "/" as path separator.
17717 2002-03-30 Miguel de Icaza <miguel@ximian.com>
17719 * expression.cs (Unary): Optimize - - expr into expr.
17720 (Binary): Optimize a + (-b) into a -b.
17722 * codegen.cs (CodeGen): Made all methods static.
17724 2002-03-29 Miguel de Icaza <miguel@ximian.com>
17728 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
17729 TypeBuilder property.
17731 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
17734 * tree.cs: Removed the various RecordXXXX, and replaced with a
17735 single RecordDecl. Removed all the accessor methods, and just
17736 left a single access point Type
17738 * enum.cs: Rename DefineEnum to DefineType.
17740 * decl.cs: New abstract method `DefineType' used to unify the
17741 Defines for Enumerations, Interfaces, TypeContainers and
17744 (FindType): Moved LookupInterfaceOrClass here. Moved the
17745 LookupBaseClasses method that used to live in class.cs and
17746 interface.cs here, and renamed to FindType.
17748 * delegate.cs: Implement DefineType. Take advantage of the
17749 refactored pattern for locating the parent builder without taking
17750 the parent_builder argument (which we know does not work if we are
17751 nested, and triggering a toplevel definition).
17753 2002-03-28 Miguel de Icaza <miguel@ximian.com>
17755 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
17756 accessibility of a member has changed during override and report
17759 * class.cs (Method.Define, Property.Define): Only complain on
17760 overrides if the method is private, any other accessibility is
17761 fine (and since we just checked the permission is the same, we are
17764 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
17765 and elif are processed always. The other pre-processing
17766 directives are only processed if we are "taking" the path
17768 2002-03-29 Martin Baulig <martin@gnome.org>
17770 * class.cs (Method.Emit): Only emit symbolic debugging info if the
17771 current location is not Null.
17773 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
17774 a separate method so we can profile it.
17776 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
17777 `span.Seconds' are just seconds, but no minutes or hours.
17778 (MainDriver): Profile the CodeGen.SaveSymbols calls.
17780 2002-03-28 Miguel de Icaza <miguel@ximian.com>
17782 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
17783 Remove the gratuitous set of Final:
17785 // If an interface implementation, then we can set Final.
17786 if (((flags & MethodAttributes.Abstract) == 0) &&
17787 implementing.DeclaringType.IsInterface)
17788 flags |= MethodAttributes.Final;
17790 I do not know what I was smoking when I used that.
17793 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
17794 step into fixing the name resolution issues for delegates and
17795 unifying the toplevel name resolution.
17797 2002-03-28 Martin Baulig <martin@gnome.org>
17799 * class.cs (Method.Emit): If we have a symbol writer, call its
17800 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
17801 tell it about the current method.
17803 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
17804 writer that we're going to emit the first byte of IL code for a new
17805 statement (a new source line).
17806 (EmitContext.EmitTopBlock): If we have a symbol writer, call
17807 EmitContext.Mark() before emitting any code.
17809 * location.cs (SymbolDocument): Return null when we're Null.
17811 * statement.cs (Statement): Moved the `Location loc' variable here.
17812 (Statement.EmitBoolExpression): If we have a symbol writer, call
17813 ec.Mark() before emitting any code to tell it that we're at the
17814 beginning of a new statement.
17815 (StatementExpression): Added `Location' argument to the constructor.
17816 (Block): Added public readonly variable `StartLocation' and public
17817 variable `EndLocation'. The latter is to be set using SetEndLocation().
17818 (Block): Added constructor which takes a start and end location.
17819 (Block.SetEndLocation): New method. This sets the end location.
17820 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
17821 local variables we create.
17822 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
17823 each statement and do also mark the begin and end of the block.
17825 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
17826 tell it the current lexer.Location, use Location.Null for the end of the
17828 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
17829 current block, set its end location using SetEndLocation().
17830 (statement_expression): StatementExpression constructor now takes the
17831 lexer.Location as additional argument.
17832 (for_statement, declare_local_variables): Likewise.
17833 (declare_local_variables): When creating a new implicit block, use the
17834 new Block constructor and pass it the lexer.Location.
17836 2002-03-28 Miguel de Icaza <miguel@ximian.com>
17838 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
17839 members also on the parent interfaces recursively.
17841 2002-03-27 Miguel de Icaza <miguel@ximian.com>
17843 * report.cs: Use new formats, since Gonzalo finished the missing
17846 * expression.cs (Binary.ResolveOperator): added missing operator|
17847 operator& and operator^ for bool/bool.
17849 * cs-parser.jay: CheckDef now takes a Location argument that is
17850 used to report errors more precisly (instead of reporting the end
17851 of a definition, we try to track something which is a lot closer
17852 to the source of the problem).
17854 * cs-tokenizer.cs: Track global token use, so we can properly flag
17855 the use of #define/#undef after the first token has been seen.
17857 Also, rename the reportXXXX to Error_DescriptiveName
17859 * decl.cs (DeclSpace.IsTopLevel): Move property here from
17860 TypeContainer, so that Enum and Interface can use this too.
17862 * class.cs (TypeContainer.LookupInterfaceOrClass,
17863 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
17864 `builder' argument. Typically this was used to pass the parent
17865 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
17868 The problem is that a nested class could trigger the definition of
17869 a toplevel class, and the builder would be obviously wrong in that
17872 So we drop this argument, and we compute dynamically the
17873 TypeBuilder/ModuleBuilder (the correct information was available
17874 to us anyways from DeclSpace.Parent)
17876 * interface.cs (Interface.DefineInterface): Drop builder
17877 parameter cleanup like class.cs
17879 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
17882 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
17885 (Try.Emit): Propagate the returns value from the statement.
17887 (Return.Emit): Even if we are leavning
17889 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
17891 * modifiers.cs: Fix the computation of MethodAttributes flags.
17893 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
17895 * driver.cs: allow compilation of files that start with '/'.
17896 Add a default case when checking the argument of --target.
17898 2002-03-25 Miguel de Icaza <miguel@ximian.com>
17900 * interface.cs: Implement the same search algorithm for types in
17901 the interface code.
17903 * delegate.cs: Do not allow multiple definition.
17905 * Recovered ChangeLog that got accidentally amputated
17907 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
17909 * rootcontext.cs: Load manually enum to allow core classes to
17910 contain enumerations.
17912 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
17913 Update to new static methods in TypeManager.
17915 * typemanager.cs (GetMethod, GetConstructor): Use our
17916 implementation of FindMembers to find the members, since during
17917 corlib compilation, the types are TypeBuilders and GetMethod and
17918 GetConstructor do not work.
17920 Make all methods in TypeManager static.
17922 (InitCodeHelpers): Split the functionality from
17923 the InitCodeTypes function.
17925 * driver.cs: Call InitCodeHelpers after we have populated the
17928 * cs-parser.jay (delegate_declaration): we did not used to compute
17929 the delegate name correctly for void delegates.
17931 2002-03-24 Miguel de Icaza <miguel@ximian.com>
17933 * rootcontext.cs (RootContext): Init the interface_resolve_order
17934 and type_container_resolve_order always.
17936 (ResolveCore, BootstrapCorlib_ResolveClass,
17937 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
17938 compiler when compiling with --nostdlib
17940 * class.cs (TypeContainer.DefineType): Check that our parent is
17941 not null. This test is most important when we are bootstraping
17944 * codegen.cs: Split out the symbol writing code.
17946 2002-03-25 Martin Baulig <martin@gnome.org>
17948 * driver.cs (-g): Made -g an alias for --debug.
17950 2002-03-24 Martin Baulig <martin@gnome.org>
17952 * codegen.cs (SymbolWriter): New public variable. Returns the
17953 current symbol writer.
17954 (CodeGen): Added `bool want_debugging_support' argument to the
17955 constructor. If true, tell the ModuleBuild that we want debugging
17956 support and ask it for the ISymbolWriter.
17957 (Save): If we have a symbol writer, call it's Close() method after
17958 saving the assembly.
17960 * driver.c (--debug): New command line argument to create a
17961 debugger information file.
17963 * location.cs (SymbolDocument): New public property. Returns an
17964 ISymbolDocumentWriter object for the current source file or null
17965 if we don't have a symbol writer.
17967 2002-03-21 Miguel de Icaza <miguel@ximian.com>
17969 * driver.cs (LoadAssembly): Correctly return when all the paths
17970 have been tried and not before.
17972 * statement.cs (Switch.Emit): return the actual coverage for this
17973 statement (returns/not-returns)
17975 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
17976 switch of the statement if we are the last switch section. That
17977 kills two problems: try/catch problems (we used to emit an empty
17978 nop at the end) and switch statements where all branches would
17981 2002-03-19 Miguel de Icaza <miguel@ximian.com>
17983 * driver.cs: Add default assemblies (the equivalent to the
17984 Microsoft CSC.RSP file)
17986 * cs-tokenizer.cs: When updating `cols and setting it to zero,
17987 also update tokens_seen and set it to false.
17989 * driver.cs: Implement --recurse for Mike.
17991 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
17992 correctly splitting out the paths.
17994 2002-03-18 Miguel de Icaza <miguel@ximian.com>
17996 * interface.cs (Interface.PopulateProperty): Instead of using
17997 `parent' as the declaration space for the set parameters, use
18000 * support.cs (InternalParameters): InternalParameters constructor
18001 takes a DeclSpace instead of a TypeContainer.
18003 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
18004 types are being initialized, load the address of it before calling
18007 (New): Provide a mechanism to disable the generation of local
18008 value type temporaries when the caller will be providing us with
18009 an address to store it.
18011 (ArrayCreation.EmitDynamicInitializers): Use it.
18013 2002-03-17 Miguel de Icaza <miguel@ximian.com>
18015 * expression.cs (Invocation.EmitArguments): Only probe for array
18016 property if there is more than one argument. Sorry about that.
18018 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
18019 empty param arrays.
18021 * class.cs (Method.LabelParameters): Fix incorrect code path that
18022 prevented the `ParamArrayAttribute' from being applied to the
18025 2002-03-16 Miguel de Icaza <miguel@ximian.com>
18027 * support.cs (ReflectionParameters): Correctly compute whether the
18028 last argument is a params array. Fixes the problem with
18031 * typemanager.cs: Make the assemblies array always be non-null
18032 (empty, but non-null)
18034 * tree.cs (RecordDecl): New function that abstracts the recording
18035 of names. This reports error 101, and provides a pointer to the
18036 previous declaration. Fixes a crash in the compiler.
18038 * cs-parser.jay (constructor_declaration): Update to new grammar,
18039 and provide a constructor_body that can be empty.
18041 2002-03-15 Miguel de Icaza <miguel@ximian.com>
18043 * driver.cs: Add support for --resources.
18045 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
18046 Make all types for the various array helper methods be integer.
18048 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
18049 CheckState to ConvCast.
18051 (ConvCast): Now it takes a `checked' state argument, to avoid
18052 depending on the emit context for the conversion, and just using
18053 the resolve time setting.
18055 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
18056 instead of Invocation.EmitArguments. We do not emit the original
18057 arguments, instead we emit those which have been converted to
18058 unsigned int expressions.
18060 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
18062 * codegen.cs: ditto.
18064 * expression.cs (LocalVariableReference): Drop the use of the
18065 Store function that depended on the variable index.
18067 * statement.cs (VariableInfo): Drop the `Idx' property from this
18068 class, as this is not taking into account the indexes for
18069 temporaries tat we generate during the execution, getting the
18072 * class.cs: First emit class initializers, then call the parent
18075 * expression.cs (Binary): Fix opcode emision.
18076 (UnaryMutator.EmitCode): Support checked code generation
18078 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
18079 matches for events for both the Static and Instance scans,
18080 pointing to the same element. Fix that.
18082 2002-03-14 Miguel de Icaza <miguel@ximian.com>
18084 * rootcontext.cs (ResolveTree): Always set the
18085 interface_resolve_order, because nested interfaces will be calling
18088 * class.cs (GetInterfaceOrClass): Track the same resolution
18089 process used by TypeManager.LookupType. This fixes the nested
18090 type lookups in class declarations (separate path from
18093 (TypeContainer.DefineType): Also define nested interfaces.
18094 (TypeContainer.RegisterOrder): New public function used to
18095 register the order in which child interfaces need to be closed.
18097 Nested interfaces need to be closed after their parents have been
18100 * interface.cs (InterfaceAttr): Put all the logic for computing
18101 the interface attribute here.
18103 (DefineInterface): Register our interface order with the
18104 RootContext or with the TypeContainer depending on the case.
18106 2002-03-12 Miguel de Icaza <miguel@ximian.com>
18108 * cs-parser.jay: rework foreach statement to work with the new
18109 changes to the policy on SimpleNames.
18111 * report.cs: support Stacktrace on warnings as well.
18113 * makefile: drop --unsafe and /unsafe from the compile.
18115 2002-03-13 Ravi Pratap <ravi@ximian.com>
18117 * ecore.cs (StandardConversionExists): Modify to take an Expression
18118 as the first parameter. Ensure we do null -> reference type conversion
18121 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
18122 temporary Expression objects.
18124 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
18126 * interface.cs: workaround bug in method overloading resolution
18127 (there is already a bugzilla bug for it).
18129 2002-03-12 Miguel de Icaza <miguel@ximian.com>
18131 We could also solve this problem by having a separate path for
18132 performing type lookups, instead of DoResolve, we could have a
18133 ResolveType entry point, and only participating pieces of the
18134 production (simplename, deref, array) would implement this.
18136 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
18137 signal SimpleName to only resolve type names and not attempt to
18138 resolve anything else.
18140 * expression.cs (Cast): Set the flag.
18142 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
18144 * class.cs: Only report 108 if there is no `new' modifier.
18146 * cs-parser.jay: rework foreach statement to work with the new
18147 changes to the policy on SimpleNames.
18149 * report.cs: support Stacktrace on warnings as well.
18151 * makefile: drop --unsafe and /unsafe from the compile.
18153 2002-03-11 Miguel de Icaza <miguel@ximian.com>
18155 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
18156 lookups here, instead of doing that at parse time. This means
18157 that our grammar will not introduce `LocalVariableReferences' as
18158 expressions at this point. That solves the problem of code like
18162 static void Main ()
18166 This is only half the fix. The full fix requires parameters to
18167 also be handled in this way.
18169 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
18170 makes the use more obvious of the DeclSpace. The
18171 ec.TypeContainer.TypeBuilder is now only used to pull the
18172 TypeBuilder for it.
18174 My theory is that I can get rid of the TypeBuilder completely from
18175 the EmitContext, and have typecasts where it is used (from
18176 DeclSpace to where it matters).
18178 The only pending problem is that the code that implements Aliases
18179 is on TypeContainer, and probably should go in DeclSpace.
18181 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
18182 lookups here, instead of doing that at parse time. This means
18183 that our grammar will not introduce `LocalVariableReferences' as
18184 expressions at this point. That solves the problem of code like
18188 static void Main ()
18192 This is only half the fix. The full fix requires parameters to
18193 also be handled in this way.
18195 * class.cs (Property.DefineMethod): When implementing an interface
18196 method, set newslot, when implementing an abstract method, do not
18197 set the flag (before we tried never setting it, or always setting
18198 it, which is the difference).
18199 (Indexer.DefineMethod): same.
18200 (Method.DefineMethod): same.
18202 * ecore.cs: Only set the status used flag if we get back a Field.
18204 * attribute.cs: Temporary hack, so Paolo can keep working.
18206 2002-03-08 Ravi Pratap <ravi@ximian.com>
18208 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
18209 the unmanaged type in the case we have a MarshalAs attribute.
18211 (Resolve): Handle the case when we are parsing the special MarshalAs
18212 attribute [we need to store the unmanaged type to use later]
18214 * typemanager.cs (marshal_as_attr_type): Built in type for the
18215 MarshalAs Attribute.
18217 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
18218 on parameters and accordingly set the marshalling info.
18220 2002-03-09 Miguel de Icaza <miguel@ximian.com>
18222 * class.cs: Optimizing slightly by removing redundant code after
18223 we switched to the `NoTypes' return value.
18224 (Property.DefineMethod): use NoTypes here too.
18226 This fixes the bug I introduced in my last batch of changes.
18228 2002-03-05 Ravi Pratap <ravi@ximian.com>
18230 * tree.cs (RecordEnum): Add. We now keep track of enums too.
18232 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
18233 Enums since those are types too.
18235 * cs-parser.jay (enum_declaration): Record enums as we parse them.
18237 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
18238 thanks to a call during the lookup process.
18240 2002-03-07 Miguel de Icaza <miguel@ximian.com>
18242 * statement.cs (Foreach): Lots of work to accomodate a particular
18243 kind of foreach statement that I had not kept in mind. It is
18244 possible to have foreachs on classes that provide a GetEnumerator
18245 method that return objects that implement the "pattern" for using
18246 a foreach, there is no need to support GetEnumerator
18249 This is needed to compile nant.
18251 * decl.cs: Only report 114 if the member is not `Finalize' and if
18252 the warning level is at least 2.
18254 * class.cs: Moved the compare function from Method to
18257 (MethodSignature.InheritableMemberSignatureCompare): Add new
18258 filter function that is used to extract inheritable methods from a
18261 (Method.Define): Use the new `inheritable_method_signature_filter'
18264 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
18267 2002-03-06 Miguel de Icaza <miguel@ximian.com>
18269 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
18271 * cs-parser.jay: Add opt_semicolon to the interface declaration.
18273 * expression.cs: Pass location information to
18274 ConvertImplicitStandard.
18276 * class.cs: Added debugging code to track return values from
18279 2002-03-05 Miguel de Icaza <miguel@ximian.com>
18281 * expression.cs (Is.DoResolve): If either side of the `is' is an
18282 interface, do not flag the warning.
18284 * ecore.cs (ImplicitReferenceConversion): We need a separate test
18287 * report.cs: Allow for --fatal to be used with --probe.
18289 * typemanager.cs (NoTypes): Move the definition for the empty Type
18292 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
18294 (TypeContainer.DefineProxy): New function used to proxy to parent
18295 implementations when implementing interfaces.
18296 (TypeContainer.ParentImplements): used to lookup if our parent
18297 implements a public function that is required by an interface.
18298 (TypeContainer.VerifyPendingMethods): Hook this up.
18300 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
18301 `modules' and `assemblies' arraylists into arrays. We only grow
18302 these are the very early start up of the program, so this improves
18303 the speedof LookupType (nicely measured).
18305 * expression.cs (MakeByteBlob): Replaced unsafe code with
18306 BitConverter, as suggested by Paolo.
18308 * cfold.cs (ConstantFold.Binary): Special case: perform constant
18309 folding of string concatenation, but if either side is a string,
18310 and the other is not, then return null, and let the runtime use
18311 the concatenation on the string plus the object (using
18312 `Object.ToString').
18314 2002-03-04 Miguel de Icaza <miguel@ximian.com>
18316 Constant Folding has been implemented now.
18318 * expression.cs (Unary.Reduce): Do not throw an exception, catch
18319 the error instead on types that are not supported in one's
18322 * constant.cs (Constant and all children): New set of functions to
18323 perform implict and explicit conversions.
18325 * ecore.cs (EnumConstant): Implement the new functions to perform
18326 conversion by proxying to the child expression.
18328 * codegen.cs: (ConstantCheckState): Constant evaluation has its
18329 own separate setting that can not be turned off from the command
18330 line using --unchecked or --checked and is only controlled using
18331 the checked/unchecked statements and expressions. This setting is
18332 used by the constant folder to flag errors.
18334 * expression.cs (CheckedExpr, UncheckedExpr): Set the
18335 ConstantCheckState as well.
18337 During Resolve, they also have to flag the state, because the
18338 constant folder runs completely in the Resolve phase.
18340 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
18343 2002-03-01 Miguel de Icaza <miguel@ximian.com>
18345 * cfold.cs: New file, this file contains the constant folder.
18347 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
18348 argument to track whether we are using the resulting address to
18349 load or store a value and provide better error messages.
18351 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
18352 new AddressOf arguments.
18354 * statement.cs (Foreach.EmitCollectionForeach): Update
18356 * expression.cs (Argument.Emit): Call AddressOf with proper
18357 arguments to track usage.
18359 (New.DoEmit): Call AddressOf with new arguments.
18361 (Unary.Emit): Adjust AddressOf call.
18363 2002-03-01 Ravi Pratap <ravi@ximian.com>
18365 * cs-parser.jay (member_access): Change the case for pre-defined types
18366 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
18369 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
18372 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
18373 essentially like methods and apply attributes like MethodImplOptions to them too.
18375 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
18378 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
18379 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
18382 * Update code everywhere accordingly.
18384 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
18386 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
18388 2002-02-28 Ravi Pratap <ravi@ximian.com>
18390 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
18391 try performing lookups against those instead of jumping straight into using
18392 the 'using' clauses.
18394 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
18396 (LookupType): Perform lookups in implicit parents too.
18398 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
18399 sequence as RootContext.LookupType.
18401 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
18402 the various cases of namespace lookups into this method.
18404 2002-03-01 Miguel de Icaza <miguel@ximian.com>
18406 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
18407 in positional arguments)
18409 * class.cs (Operator): Update the AllowedModifiers to contain
18412 * cs-parser.jay: Update operator declaration to allow for the
18413 operator body to be empty.
18415 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
18418 2002-02-27 Miguel de Icaza <miguel@ximian.com>
18420 * class.cs (Method.Emit): Label parameters.
18422 * driver.cs: Return 1 or 0 as the program exit code.
18424 2002-02-26 Miguel de Icaza <miguel@ximian.com>
18426 * expression.cs: Special case the `null' object when trying to
18427 auto-compute the type, as anything can be explicitly converted to
18430 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
18431 spotting this Paolo.
18433 (Expression.ImplicitNumericConversion): Perform comparissions of
18434 the type using the underlying type in the case of an enumeration
18435 rather than using the enumeration type for the compare.
18437 Cope with the underlying == type case, which is not possible to
18440 (Expression.ConvertNumericExplicit): Perform comparissions of
18441 the type using the underlying type in the case of an enumeration
18442 rather than using the enumeration type for the compare.
18444 * driver.cs: If the user does not supply an extension, assume .exe
18446 * cs-parser.jay (if_statement): Rewrote so that we can track the
18447 location for the if statement.
18449 * expression.cs (Binary.ConstantFold): Only concat strings when
18450 the operation is "+", not everything ;-)
18452 * statement.cs (Statement.EmitBoolExpression): Take a location
18454 (If, While, Do): Track location.
18456 * expression.cs (Binary.ResolveOperator): In the object + string
18457 case, I was missing a call to ConvertImplicit
18459 2002-02-25 Ravi Pratap <ravi@ximian.com>
18461 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
18462 Location arguments. Ensure we use RootContext.LookupType to do our work
18463 and not try to do a direct Type.GetType and ModuleBuilder.GetType
18465 * interface.cs (PopulateMethod): Handle the type of the parameter being
18468 * expression.cs (Invocation.BetterFunction): Handle the case when we
18469 have a params method with no fixed arguments and a call is made with no
18472 2002-02-25 Miguel de Icaza <miguel@ximian.com>
18474 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
18475 the verbatim-string-literal
18477 * support.cs (InternalParameters.ParameterModifier): handle null
18479 (InternalParameters.ParameterType): ditto.
18481 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
18482 duplicating the name of the variable parameter.
18483 (GetParameterByName): Fix bug where we were not looking up array
18484 paramters if they were the only present (thanks Paolo!).
18485 (GetParameterInfo): We only have an empty set of types if both
18486 fixed and array are set to null.
18487 (GetParameterInfo-idx): Handle FixedParameter == null
18489 * cs-parser.jay: Handle the case where there is no catch
18490 statements (missing null test).
18492 2002-02-22 Miguel de Icaza <miguel@ximian.com>
18494 * driver.cs (MainDriver): Be conservative on our command line
18497 Catch DirectoryNotFoundException when calling GetFiles.
18499 (SplitPathAndPattern): Used to split the input specification into
18500 a path and a pattern that we can feed to Directory.GetFiles.
18502 2002-02-21 Miguel de Icaza <miguel@ximian.com>
18504 * statement.cs (Fixed): Implement the last case of the Fixed
18505 statement (string handling).
18507 * expression.cs (StringPtr): New class used to return a char * to
18508 a string; Used by the Fixed statement.
18510 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
18512 * expression.cs (Binary.ResolveOperator): Remove redundant
18513 MemberLookup pn parent type.
18514 Optimize union call, we do not need a union if the types are the same.
18515 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
18518 Specialize the use of MemberLookup everywhere, instead of using
18519 the default settings.
18521 (StackAlloc): Implement stackalloc keyword.
18523 * cs-parser.jay: Add rule to parse stackalloc.
18525 * driver.cs: Handle /h, /help, /?
18527 * expression.cs (MakeByteBlob): Removed the hacks we had in place
18528 before we supported unsafe code.
18530 * makefile: add --unsafe to the self compilation of mcs.
18532 2002-02-20 Miguel de Icaza <miguel@ximian.com>
18534 * expression.cs (PointerArithmetic): New class that is used to
18535 perform pointer arithmetic.
18536 (Binary.Resolve): Handle pointer arithmetic
18537 Handle pointer comparission.
18538 (ArrayPtr): Utility expression class that is used to take the
18539 address of an array.
18541 (ElementAccess): Implement array access for pointers
18543 * statement.cs (Fixed): Implement fixed statement for arrays, we
18544 are missing one more case before we are done.
18546 * expression.cs (Indirection): Implement EmitAssign and set the
18547 ExprClass to Variable. This allows pointer dereferences to be
18548 treated as variables, and to have values assigned to them.
18550 * ecore.cs (Expression.StoreFromPtr): New utility function to
18551 store values dereferencing.
18553 2002-02-20 Ravi Pratap <ravi@ximian.com>
18555 * expression.cs (Binary.ResolveOperator): Ensure that we are
18556 not trying to operate on a void type - this fixes the reported
18559 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
18560 the parent implementation is sealed.
18562 * ../errors/cs0239.cs : Add.
18564 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
18566 * typemanager.cs (unverifiable_code_type): Corresponds to
18567 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
18568 which have unsafe code in them.
18570 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
18573 2002-02-19 Miguel de Icaza <miguel@ximian.com>
18575 * cs-tokenizer.cs: Add support for @"litreal strings"
18577 Make tokenizer accept pre-processor directives
18578 on any column (remove the old C-like limitation).
18580 * rootcontext.cs (EmitCode): Emit any global attributes.
18581 (AddGlobalAttributes): Used to keep track of assembly attributes.
18583 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
18585 * cs-parser.jay: Add support for global attributes.
18587 2002-02-17 Miguel de Icaza <miguel@ximian.com>
18589 * expression.cs (Indirection): New helper class. Unary will
18590 create Indirection classes to be able to implement the
18591 IMemoryLocation interface on it.
18593 2002-02-16 Miguel de Icaza <miguel@ximian.com>
18595 * cs-parser.jay (fixed_statement): reference the right statement.
18597 * statement.cs (Fixed.Emit): Finish implementing the fixed
18598 statement for the &x case.
18600 2002-02-14 Miguel de Icaza <miguel@ximian.com>
18602 * class.cs (Property.Define, Method.Define): Remove newslot when
18605 * modifiers.cs: My use of NewSlot when `Abstract' was set was
18606 wrong. NewSlot should only be used if the `new' keyword is present.
18608 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
18609 locating our system dir. Sorry about this.
18611 2002-02-13 Miguel de Icaza <miguel@ximian.com>
18613 * driver.cs (GetSystemDir): Compute correctly the location of our
18614 system assemblies. I was using the compiler directory instead of
18615 the library directory.
18617 2002-02-13 Ravi Pratap <ravi@ximian.com>
18619 * expression.cs (BetterFunction): Put back in what Miguel commented out
18620 since it is the correct fix. The problem is elsewhere ;-)
18622 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
18623 parameters of the parms method are themselves compatible or not !
18625 (StandardConversionExists): Fix very dangerous bug where we were forgetting
18626 to check that a class implements an interface before saying that an implicit
18627 conversion was allowed. Use ImplementsInterface to do the checking.
18629 2002-02-13 Miguel de Icaza <miguel@ximian.com>
18631 * class.cs (Method.Define): Track whether we are an explicit
18632 implementation or not. And only call DefineMethodOverride if we
18633 are an explicit implementation.
18635 (Property.DefineMethod): Ditto.
18637 2002-02-11 Ravi Pratap <ravi@ximian.com>
18639 * expression.cs (BetterFunction): Catch hideous bug which was
18640 preventing us from detecting ambiguous calls due to implicit casts i.e
18643 2002-01-29 Miguel de Icaza <miguel@ximian.com>
18645 * support.cs (Pair): Remove un-needed method. I figured why I was
18646 getting the error in cs-parser.jay, the variable in a foreach loop
18647 is readonly, and the compiler does not really treat this as a variable.
18649 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
18650 instead of EQUALS in grammar.
18652 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
18654 * expression.cs (Unary.DoResolve): Check whether the argument is
18657 2002-01-28 Miguel de Icaza <miguel@ximian.com>
18659 * support.cs: Api for Pair to set a value. Despite the fact that
18660 the variables are public the MS C# compiler refuses to compile
18661 code that accesses the field if the variable is part of a foreach
18664 * statement.cs (Fixed): Begin implementation of the fixed
18667 (Block.AddVariable): Return the VariableInfo on success and null
18668 on failure instead of true/false.
18670 * cs-parser.jay (foreach): Catch errors on variables already
18671 defined (we were ignoring this value before) and properly unwind
18672 the block hierarchy
18674 (fixed_statement): grammar for the fixed statement.
18676 2002-01-25 Miguel de Icaza <miguel@ximian.com>
18678 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
18679 pointer types to be incretemented.
18681 (SizeOf): Implement.
18683 * cs-parser.jay (pointer_member_access): Implement
18684 expr->IDENTIFIER production.
18686 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
18687 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
18690 (Unary): Implement indirection.
18692 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
18693 use in non-unsafe context).
18695 (SimpleName.DoResolve): Check for pointers in field access on safe
18698 (Expression.LoadFromPtr): Factor the load-indirect code in this
18699 function. This was duplicated in UnboxCast and ParameterReference
18701 2002-01-24 Miguel de Icaza <miguel@ximian.com>
18703 * expression.cs (ComposedCast): report an error if a pointer cast
18704 is used in a safe region.
18706 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
18707 pointer type casts in unsafe context.
18709 * codegen.cs (EmitContext): Set up IsUnsafe.
18711 * cs-parser.jay (non_expression_type): Add productions for pointer
18714 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
18715 code. We should not use force into static mode if the method is
18716 not virtual. Fixes bug in MIS
18718 * statement.cs (Do.Emit, While.Emit, For.Emit,
18719 Statement.EmitBoolExpression): Add support to Do and While to
18720 propagate infinite loop as `I do return' semantics.
18722 Improve the For case to also test for boolean constants.
18724 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
18725 to the list of attributes we can add.
18727 Remove `EmitContext' argument.
18729 * class.cs (Method.Define): Apply parameter attributes.
18730 (Constructor.Define): Apply parameter attributes.
18731 (MethodCore.LabelParameters): Move here the core of labeling
18734 * support.cs (ReflectionParameters.ParameterModifier,
18735 InternalParameters.ParameterModifier): Use IsByRef on the type and
18736 only return the OUT bit for these parameters instead of in/out/ref
18739 This is because I miss-understood things. The ParameterInfo.IsIn
18740 and IsOut represent whether the parameter has the [In] and [Out]
18743 2002-01-22 Miguel de Icaza <miguel@ximian.com>
18745 * ecore.cs (FieldExpr.Emit): Release temporaries.
18747 * assign.cs (LocalTemporary.Release): new function.
18749 * codegen.cs (EmitContext.GetTemporaryStorage,
18750 EmitContext.FreeTemporaryStorage): Rework the way we deal with
18751 temporary storage. Now we can "put back" localbuilders when we
18754 2002-01-21 Miguel de Icaza <miguel@ximian.com>
18756 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
18757 need to make a copy of the variable to generate verifiable code.
18759 2002-01-19 Miguel de Icaza <miguel@ximian.com>
18761 * driver.cs: Compute dynamically the system directory.
18763 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
18764 Slower, but more generally useful. Used by the abstract
18765 registering implementation.
18767 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
18768 the rules for the special rule on Type/instances. First check if
18769 we have the same name, and if so, try that special static path
18770 rather than the instance path.
18772 2002-01-18 Miguel de Icaza <miguel@ximian.com>
18774 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
18777 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
18778 Enum, ValueType, Delegate or Array for non-corlib compiles.
18780 * cs-tokenizer.cs: Catch long identifiers (645)
18782 * typemanager.cs (IndexerPropetyName): Ravi never tested this
18785 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
18786 fix, we were returning too early, so we were not registering
18787 pending methods from abstract classes.
18789 Do not register pending methods if the class is abstract.
18791 * expression.cs (Conditional.DoResolve): Report circular implicit
18792 conversions when we neecd to compute it for conditional
18795 (Is.DoResolve): If the expression is always of the provided type,
18796 flag warning 183. If the expression can not ever be of the
18797 provided type flag warning 184.
18799 * class.cs: Catch 169 as well.
18801 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
18804 2002-01-18 Nick Drochak <ndrochak@gol.com>
18806 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
18808 2002-01-17 Miguel de Icaza <miguel@ximian.com>
18810 * interface.cs: (PopulateMethod): Check for pointers being defined
18811 only if the unsafe context is active.
18812 (PopulateProperty): ditto.
18813 (PopulateIndexer): ditto.
18815 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
18816 specified. If pointers are present, make sure that they are
18817 present in an unsafe context.
18818 (Constructor, Constructor.Define): ditto.
18819 (Field, Field.Define): ditto.
18820 (Property, Property.Define): ditto.
18821 (Event, Event.Define): ditto.
18823 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
18824 hashtable if there are classes or structs defined.
18826 * expression.cs (LocalVariableReference.DoResolve): Simplify this
18827 code, as the constant resolution moved.
18829 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
18830 the metadata, so we can flag error 133.
18832 * decl.cs (MemberCore.UnsafeOK): New function to test that a
18833 pointer is being declared in an unsafe context.
18835 2002-01-16 Miguel de Icaza <miguel@ximian.com>
18837 * modifiers.cs (Modifiers.Check): Require a Location argument.
18838 Report error 227 for Unsafe use.
18840 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
18842 * statement.cs (For.Emit): If the test is null, then report that
18843 we do `return', as we wont reach anything afterwards.
18845 (Switch.SwitchGoverningType): Track the expression that matched
18848 * driver.cs: Allow negative numbers as an error code to flag.
18850 * cs-parser.jay: Handle 1551.
18852 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
18854 2002-01-15 Miguel de Icaza <miguel@ximian.com>
18856 * cs-parser.jay: Report 1518 (type declaration can only contain
18857 class, struct, interface, enum or delegate)
18859 (switch_label): Report 1523 (keywords `case' or `default' must
18862 (opt_switch_sections): Report 1522 (empty switch)
18864 * driver.cs: Report 1515 (response file specified multiple times)
18865 Report 1516 (Source file specified multiple times).
18867 * expression.cs (Argument.Resolve): Signal 1510
18869 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
18870 access not allowed in static code)
18872 2002-01-11 Ravi Pratap <ravi@ximian.com>
18874 * typemanager.cs (IsPointerType): Utility method which we are going
18877 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
18878 the object type, so we take care of that.
18880 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
18882 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
18883 added to non-params parameters :-)
18885 * typemanager.cs (CSharpName): Include 'void' type too.
18887 (void_ptr_type): Include in the set of core types.
18889 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
18892 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
18895 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
18896 completely forgotten about it.
18898 2002-01-10 Ravi Pratap <ravi@ximian.com>
18900 * cs-parser.jay (pointer_type): Add. This begins our implementation
18901 of parsing rules for unsafe code.
18903 (unsafe_statement): Implement.
18905 (embedded_statement): Modify to include the above.
18907 * statement.cs (Unsafe): Implement new class for unsafe blocks.
18909 * codegen.cs (EmitContext.InUnsafe): Add. This determines
18910 if the current context is an unsafe one.
18912 * cs-parser.jay (local_variable_pointer_type): Since local variable types
18913 are handled differently, we need separate rules for them.
18915 (local_variable_declaration): Update to use local_variable_pointer_type
18916 to allow variable declarations of unmanaged pointer types.
18918 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
18919 in unsafe contexts.
18921 * ../errors/cs0214.cs : Add.
18923 2002-01-16 Nick Drochak <ndrochak@gol.com>
18925 * makefile: remove 'response' file when cleaning.
18927 2002-01-15 Miguel de Icaza <miguel@ximian.com>
18929 * cs-parser.jay: Report 1524.
18931 2002-01-14 Miguel de Icaza <miguel@ximian.com>
18933 * typemanager.cs (RegisterMethod): drop checking if we have
18934 registered this from here
18936 2002-01-12 Miguel de Icaza <miguel@ximian.com>
18938 * class.cs (Method.EmitDestructor): Implement calling our base
18941 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
18942 value of InFinally.
18944 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
18945 this routine and will wrap the call in a try/catch block. Deal
18948 2002-01-11 Miguel de Icaza <miguel@ximian.com>
18950 * ecore.cs (Expression.MemberLookup): instead of taking a
18951 parameter `same_type' that was used to tell whether we could
18952 access private members we compute our containing type from the
18955 (FieldExpr): Added partial support for volatile fields. This does
18956 not work for volatile fields exposed from assemblies, as I can not
18957 figure out how to extract the modreq from it.
18959 Updated all the source files to use this.
18961 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
18962 because it is referenced by MemberLookup very often.
18964 2002-01-09 Ravi Pratap <ravi@ximian.com>
18966 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
18967 TypeBuilder.GetCustomAttributes to retrieve what we need.
18969 Get rid of redundant default_member_attr_type as this is the same as
18970 default_member_type which already exists.
18972 * interface.cs, attribute.cs : Update accordingly.
18974 2002-01-08 Miguel de Icaza <miguel@ximian.com>
18976 * typemanager.cs: Enable IndexerPropertyName again. It does not
18977 work for TYpeBuilders though. Ravi, can you please fix this?
18979 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
18981 * expression.cs (Argument.Emit): Handle the case of ref objects
18982 being passed to ref functions;
18984 (ParameterReference.EmitLoad): Loads the content of the pointer
18985 without dereferencing.
18987 2002-01-07 Miguel de Icaza <miguel@ximian.com>
18989 * cs-tokenizer.cs: Implemented the pre-processing expressions.
18991 2002-01-08 Ravi Pratap <ravi@ximian.com>
18993 * class.cs (Indexer.DefineMethod): Incorporate the interface
18994 type in the name of the method if we are doing explicit interface
18997 * expression.cs (ConversionExists): Remove as it is completely obsolete.
18999 (BetterConversion): Fix extremely trivial bug where we were referring to
19000 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
19003 * ../errors/bug16.cs : Add although we have fixed it.
19005 2002-01-07 Miguel de Icaza <miguel@ximian.com>
19007 * expression.cs (BaseIndexer): Begin implementation.
19009 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
19011 * cs-parser.jay (indexer_declarator): Use qualified_identifier
19012 production directly to remove a shift/reduce, and implement
19013 explicit interface implementation.
19015 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
19016 after a floating point suffix.
19018 * expression.cs (DoNumericPromotions): Improved the conversion for
19019 uint/uint. If we have a constant, we avoid doing a typecast to a
19022 * class.cs (Indexer): Implement explicit interface implementation
19025 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
19027 * class.cs: make the default instance constructor public and hidebysig.
19029 2001-01-03 Ravi Pratap <ravi@ximian.com>
19031 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
19032 so we can call it from elsewhere.
19034 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
19035 we emit it internally if the class has a defined indexer; otherwise the user
19036 emits it by decorating the class definition with the DefaultMemberAttribute.
19038 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
19039 attribute is not used on a type which defines an indexer.
19041 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
19042 character when we skip whitespace.
19044 * ../errors/cs0646.cs : Add.
19046 2002-01-03 Miguel de Icaza <miguel@ximian.com>
19048 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
19051 * makefile: Add practical target `mcs3.exe' which builds the third
19052 generation compiler.
19054 * expression.cs (New): Fix structures constructor calling.
19056 * class.cs (Property, Method, Indexer): Emit Final flag on the
19057 method if we are an interface implementation and we are not
19060 * ecore.cs (PropertyExpr): New public field `IsBase', tells
19061 whether this property is referencing a `base' method.
19063 * expression.cs (Invocation.EmitCall): take an extra argument:
19064 is_base, this is used to determine whether the `call' or
19065 `callvirt' opcode should be used.
19068 * delegate.cs: update EmitCall.
19070 * class.cs (Method.Define): Set NewSlot for the cases where we are
19071 not implementing an interface method.
19073 (Property.Define): ditto.
19075 2002-01-02 Miguel de Icaza <miguel@ximian.com>
19077 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
19078 'r'. Allows mcs to parse itself fully.
19080 2002-01-02 Ravi Pratap <ravi@ximian.com>
19082 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
19083 of the number of initializers that require the InitializeArray method.
19085 (CheckIndices): Store the Expression in all cases - not the plain value. Also
19086 update the above field where necessary.
19088 (MakeByteBlob): Update accordingly.
19090 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
19093 (EmitDynamicInitializers): Update in accordance with the new optimization.
19095 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
19096 same OpCode applies.
19098 * cs-parser.jay : Fix some glaring errors I introduced.
19100 2002-01-01 Ravi Pratap <ravi@ximian.com>
19102 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
19103 so that we can check for name clashes there too.
19105 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
19106 for interface indexers.
19108 * interfaces.cs (Define): Emit the default member attribute.
19110 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
19111 variable was being referred to while setting the value ;-)
19113 2002-01-01 Miguel de Icaza <miguel@ximian.com>
19115 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
19116 byte-by-byte information when we know the data is zero.
19118 Make the block always a multiple of 4, because
19119 DefineInitializedData has a bug.
19121 * assign.cs: Fix, we should assign from the temporary, not from
19124 * expression.cs (MakeByteBlob): Fix my incorrect code.
19126 2001-12-31 Miguel de Icaza <miguel@ximian.com>
19128 * typemanager.cs (EnumToUnderlying): This function is used to get
19129 the underlying type from an enumeration, because it does not
19132 * constant.cs: Use the I4_S form for values between -128 and 127.
19134 * statement.cs (Block.LookupLabel): Looks up a label.
19135 (Block): Drop support for labeled blocks.
19137 (LabeledStatement): New kind of statement that represents a label
19140 (Goto): Finally implement this bad boy.
19142 * cs-parser.jay: Update to reflect new mechanism to implement
19145 2001-12-30 Miguel de Icaza <miguel@ximian.com>
19147 * codegen.cs (EmitContext.This): a codegen property that keeps the
19148 a single instance of this instead of creating many different this
19151 * delegate.cs (Delegate.DoResolve): Update to use the property;
19153 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
19155 * expression.cs (BaseAccess.DoResolve): Ditto.
19157 2001-12-29 Ravi Pratap <ravi@ximian.com>
19159 * typemanager.cs (methodimpl_attr_type): Add to hold the type
19160 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
19162 (InitCoreTypes): Update accordingly.
19164 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
19165 so we can quickly store the state.
19167 (ApplyAttributes): Set the correct implementation flags
19168 for InternalCall methods.
19170 2001-12-29 Miguel de Icaza <miguel@ximian.com>
19172 * expression.cs (EmitCall): if a method is not virtual, then do
19173 not use callvirt on it.
19175 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
19176 user defined stuff) requires the use of stobj, which takes an
19177 address on the stack instead of an array and an index. So emit
19178 the Ldelema operation for it.
19180 (EmitStoreOpcode): Use stobj for valuetypes.
19182 (UnaryMutator.EmitCode): Use the right 1 value depending on
19183 whether we are dealing with int64/uint64, float or doubles.
19185 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
19186 constructors that I implemented last night.
19188 (Constructor.IsDefault): Fix to work properly for static
19191 * cs-parser.jay (CheckDef): report method signature errors.
19192 Update error number 103 to be 132.
19194 * decl.cs: New AdditionResult enumeration value: MethodExists.
19195 Although we do this check for methods later on in the semantic
19196 analysis, catching repeated default constructors is so easy that
19197 we catch these here.
19199 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
19202 (ParameterReference.EmitAssign, Emit): handle
19205 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
19206 (ArrayAccess.EmitStoreOpcode): ditto.
19208 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
19210 * expression.cs (MakeByteBlob): Complete all the missing types
19211 (uint, short, ushort, byte, sbyte)
19213 * class.cs: Only init instance field initializers on instance
19216 Rename `constructors' to instance_constructors.
19218 (TypeContainer.AddConstructor): Only add constructors to the list
19219 if it is not static.
19221 Make sure that we handle default_static_constructor independently
19222 everywhere where we handle instance_constructors
19224 2001-12-28 Miguel de Icaza <miguel@ximian.com>
19226 * class.cs: Do not lookup or create a base initializer for a
19227 static constructor.
19229 (ConstructorInitializer.Resolve): use the proper type to lookup
19232 * cs-parser.jay: Report error 1585 (modifiers between type and name).
19234 * enum.cs, interface.cs: Remove CloseType, this is taken care by
19237 * decl.cs: CloseType is now an virtual method, the default
19238 implementation just closes this type.
19240 2001-12-28 Ravi Pratap <ravi@ximian.com>
19242 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
19243 to PreserveSig by default. Also emit HideBySig on such methods.
19245 Basically, set the defaults to standard values.
19247 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
19248 argument, if candidate is better, it can't be worse than the best !
19250 (Invocation): Re-write bits to differentiate between methods being
19251 applicable in their expanded form and their normal form - for params
19254 Get rid of use_standard everywhere as only standard conversions are allowed
19255 in overload resolution.
19257 More spec conformance.
19259 2001-12-27 Miguel de Icaza <miguel@ximian.com>
19261 * driver.cs: Add --timestamp, to see where the compiler spends
19264 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
19265 `this' in static code.
19267 (SimpleName.DoResolve): Implement in terms of a helper function
19268 that allows static-references to be passed upstream to
19271 (Expression.ResolveWithSimpleName): Resolve specially simple
19272 names when called by MemberAccess to implement the special
19275 (Expression.ImplicitReferenceConversion): Handle conversions from
19276 Null to reference types before others, as Null's type is
19279 * expression.cs (Invocation.EmitCall): Handle the special case of
19280 calling methods declared on a reference type from a ValueType
19281 (Base classes System.Object and System.Enum)
19283 (MemberAccess.Resolve): Only perform lookups on Enumerations if
19284 the left hand side is a TypeExpr, not on every enumeration.
19286 (Binary.Resolve): If types are reference types, then do a cast to
19287 object on operators != and == of both arguments.
19289 * typemanager.cs (FindMembers): Extract instance and static
19290 members if requested.
19292 * interface.cs (PopulateProperty): Use void_type instead of null
19293 as the return type for the setter method.
19295 (PopulateIndexer): ditto.
19297 2001-12-27 Ravi Pratap <ravi@ximian.com>
19299 * support.cs (ReflectionParameters): Fix minor bug where we
19300 were examining the wrong parameter for the ParamArray attribute.
19302 Cope with requests for the type of the parameter at position
19303 greater than the params parameter's. We now return the element
19304 type of the params array as that makes more sense.
19306 * expression.cs (Invocation.IsParamsMethodApplicable): Update
19307 accordingly as we no longer have to extract the element type
19310 (Invocation.OverloadResolve): Update.
19312 2001-12-27 Miguel de Icaza <miguel@ximian.com>
19314 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
19315 against IEnumerator, test whether the return value is a descendant
19316 of the IEnumerator interface.
19318 * class.cs (Indexer.Define): Use an auxiliary method to implement
19319 the other bits of the method definition. Begin support for
19320 explicit interface implementation.
19322 (Property.DefineMethod): Use TypeManager.void_type instead of null
19323 for an empty return value.
19325 2001-12-26 Miguel de Icaza <miguel@ximian.com>
19327 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
19328 dealing with a FieldExpr which is composed of a FieldBuilder, in
19329 the code path we did extract the constant, but we should have
19330 obtained the underlying value to be able to cast it (otherwise we
19331 end up in an infinite loop, this is what Ravi was running into).
19333 (ArrayCreation.UpdateIndices): Arrays might be empty.
19335 (MemberAccess.ResolveMemberAccess): Add support for section
19336 14.5.4.1 that deals with the special case of E.I when E is a type
19337 and something else, that I can be a reference to a static member.
19339 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
19340 handle a particular array type to create byte blobs, it is just
19341 something we dont generate byteblobs for.
19343 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
19346 * location.cs (Push): remove the key from the hashtable that we
19347 are about to add. This happens for empty files.
19349 * driver.cs: Dispose files after we have parsed them.
19351 (tokenize): new function that only runs the tokenizer on its
19352 input, for speed testing.
19354 2001-12-26 Ravi Pratap <ravi@ximian.com>
19356 * class.cs (Event.Define): Define the private field only if there
19357 are no accessors defined.
19359 * expression.cs (ResolveMemberAccess): If there is no associated
19360 field with the event, that means we have an event defined with its
19361 own accessors and we should flag error cs0070 since transforming
19362 ourselves into a field is not valid in that case.
19364 * ecore.cs (SimpleName.DoResolve): Same as above.
19366 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
19367 and charset to sane values.
19369 2001-12-25 Ravi Pratap <ravi@ximian.com>
19371 * assign.cs (DoResolve): Perform check on events only if they
19372 are being accessed outside the declaring type.
19374 * cs-parser.jay (event_declarations): Update rules to correctly
19375 set the type of the implicit parameter etc.
19377 (add_accessor, remove_accessor): Set current local parameters.
19379 * expression.cs (Binary): For delegate addition and subtraction,
19380 cast the return value from the method into the appropriate delegate
19383 2001-12-24 Ravi Pratap <ravi@ximian.com>
19385 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
19386 of these as the workaround is unnecessary.
19388 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
19389 delegate data - none of that is needed at all.
19391 Re-write bits to extract the instance expression and the delegate method
19394 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
19397 * attribute.cs (ApplyAttributes): New method to take care of common tasks
19398 of attaching attributes instead of duplicating code everywhere.
19400 * everywhere : Update code to do attribute emission using the above method.
19402 2001-12-23 Miguel de Icaza <miguel@ximian.com>
19404 * expression.cs (IsParamsMethodApplicable): if there are not
19405 parameters, return immediately.
19407 * ecore.cs: The 0 literal can be implicity converted to an enum
19410 (SimpleName.DoResolve): First lookup the type, then lookup the
19413 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
19414 want to get its address. If the InstanceExpression is not
19415 addressable, store the result in a temporary variable, then get
19418 * codegen.cs: Only display 219 errors on warning level or above.
19420 * expression.cs (ArrayAccess): Make it implement the
19421 IMemoryLocation interface.
19423 (Binary.DoResolve): handle the operator == (object a, object b)
19424 and operator != (object a, object b) without incurring into a
19425 BoxedCast (because 5 != o should never be performed).
19427 Handle binary enumerator operators.
19429 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
19430 value type, otherwise use Ldelem_ref.
19432 Use precomputed names;
19434 (AddressOf): Implement address of
19436 * cs-parser.jay (labeled_statement): Fix recursive block
19437 addition by reworking the production.
19439 * expression.cs (New.DoEmit): New has a special case:
19441 If we are dealing with a ValueType, we have a few
19442 situations to deal with:
19444 * The target of New is a ValueType variable, that is
19445 easy, we just pass this as the variable reference
19447 * The target of New is being passed as an argument,
19448 to a boxing operation or a function that takes a
19451 In this case, we need to create a temporary variable
19452 that is the argument of New.
19455 2001-12-23 Ravi Pratap <ravi@ximian.com>
19457 * rootcontext.cs (LookupType): Check that current_type is not null before
19458 going about looking at nested types.
19460 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
19461 not implement the IAssignMethod interface any more.
19463 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
19464 where we tranform them into FieldExprs if they are being resolved from within
19465 the declaring type.
19467 * ecore.cs (SimpleName.DoResolve): Do the same here.
19469 * assign.cs (DoResolve, Emit): Clean up code considerably.
19471 * ../errors/bug10.cs : Add.
19473 * ../errors/cs0070.cs : Add.
19475 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
19477 * assign.cs : Get rid of EventIsLocal everywhere.
19479 2001-12-23 Miguel de Icaza <miguel@ximian.com>
19481 * ecore.cs (ConvertIntLiteral): finished the implementation.
19483 * statement.cs (SwitchLabel): Convert the value we are using as a
19484 key before looking up the table.
19486 2001-12-22 Miguel de Icaza <miguel@ximian.com>
19488 * codegen.cs (EmitTopBlock): Require a Location argument now.
19490 * cs-parser.jay (constructor_declarator): We need to setup
19491 current_local_parameters before we parse the
19492 opt_constructor_initializer, to allow the variables to be bound
19493 to the constructor arguments.
19495 * rootcontext.cs (LookupType): First lookup nested classes in our
19496 class and our parents before we go looking outside our class.
19498 * expression.cs (ConstantFold): Extract/debox the values at the
19501 * rootcontext.cs (EmitCode): Resolve the constants first before we
19502 resolve the types. This is not really needed, but it helps debugging.
19504 * statement.cs: report location.
19506 * cs-parser.jay: pass location to throw statement.
19508 * driver.cs: Small bug fix.
19510 * report.cs: Updated format to be 4-zero filled digits.
19512 2001-12-22 Ravi Pratap <ravi@ximian.com>
19514 * expression.cs (CheckIndices): Fix minor bug where the wrong
19515 variable was being referred to ;-)
19517 (DoEmit): Do not call EmitStaticInitializers when the
19518 underlying type is System.Object.
19520 2001-12-21 Ravi Pratap <ravi@ximian.com>
19522 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
19523 and do the usual workaround for SRE.
19525 * class.cs (MyEventBuilder.EventType): New member to get at the type
19526 of the event, quickly.
19528 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
19530 * assign.cs (Assign.DoResolve): Handle the case when the target
19531 is an EventExpr and perform the necessary checks.
19533 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
19536 (SimpleName.MemberStaticCheck): Include check for EventExpr.
19538 (EventExpr): Set the type in the constructor itself since we
19539 are meant to be born fully resolved.
19541 (EventExpr.Define): Revert code I wrote earlier.
19543 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
19544 instance expression is null. The instance expression is a This in that case
19545 or a null, depending on whether it is a static method or not.
19547 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
19548 refers to more than one method.
19550 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
19551 and accordingly flag errors.
19553 2001-12-21 Miguel de Icaza <miguel@ximian.com>
19555 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
19557 2001-12-22 Miguel de Icaza <miguel@ximian.com>
19559 * location.cs (ToString): Provide useful rutine.
19561 2001-12-21 Miguel de Icaza <miguel@ximian.com>
19563 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
19564 objects, return the actual integral boxed.
19566 * statement.cs (SwitchLabel): define an ILLabel for each
19569 (Switch.CheckSwitch): If the value is a Literal, extract
19570 the underlying literal.
19572 Also in the unused hashtable we had, add the SwitchLabel so we can
19573 quickly look this value up.
19575 * constant.cs: Implement a bunch of new constants. Rewrite
19576 Literal based on this. Made changes everywhere to adapt to this.
19578 * expression.cs (Expression.MakeByteBlob): Optimize routine by
19579 dereferencing array only once, and also copes with enumrations.
19581 bytes are two bytes wide, not one.
19583 (Cast): Perform constant conversions.
19585 * ecore.cs (TryImplicitIntConversion): Return literals instead of
19586 wrappers to the literals here.
19588 * expression.cs (DoNumericPromotions): long literals can converted
19589 to ulong implicity (this is taken care of elsewhere, but I was
19590 missing this spot).
19592 * ecore.cs (Expression.Literalize): Make the return type Literal,
19593 to improve type checking.
19595 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
19597 2001-12-20 Miguel de Icaza <miguel@ximian.com>
19599 * literal.cs: Revert code from ravi that checked the bounds. The
19600 bounds are sane by the definition of the type itself.
19602 * typemanager.cs: Fix implementation of ImplementsInterface. We
19603 need to actually look up in our parent hierarchy for interfaces
19606 * const.cs: Use the underlying type for enumerations
19608 * delegate.cs: Compute the basename for the delegate creation,
19609 that should fix the delegate test case, and restore the correct
19610 Type Lookup semantics in rootcontext
19612 * rootcontext.cs: Revert Ravi's last patch. The correct way of
19613 referencing a nested type with the Reflection API is using the "+"
19616 * cs-parser.jay: Do not require EOF token at the end.
19618 2001-12-20 Ravi Pratap <ravi@ximian.com>
19620 * rootcontext.cs (LookupType): Concatenate type names with
19621 a '.' instead of a '+' The test suite passes again.
19623 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
19624 field of the enumeration.
19626 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
19627 the case when the member is an EventExpr.
19629 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
19630 static has an associated instance expression.
19632 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
19634 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
19636 * class.cs (Event.Define): Register event and perform appropriate checks
19639 We define the Add and Remove methods even if the use provides none because
19640 in that case, we provide default implementations ourselves.
19642 Define a private field of the type of the event. This is done by the CSC compiler
19643 and we should be doing it too ;-)
19645 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
19646 More methods we use in code we generate.
19648 (multicast_delegate_type, delegate_type): Two separate types since the distinction
19651 (InitCoreTypes): Update accordingly for the above.
19653 * class.cs (Event.Emit): Generate code for default accessors that we provide
19655 (EmitDefaultMethod): Do the job in the above.
19657 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
19660 2001-12-20 Miguel de Icaza <miguel@ximian.com>
19662 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
19663 builders even if we were missing one.
19665 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
19666 pass the Basename as our class name instead of the Name. The
19667 basename will be correctly composed for us.
19669 * parameter.cs (Paramters): Now takes a Location argument.
19671 * decl.cs (DeclSpace.LookupType): Removed convenience function and
19672 make all the code call directly LookupType in RootContext and take
19673 this chance to pass the Location information everywhere.
19675 * Everywhere: pass Location information.
19677 2001-12-19 Miguel de Icaza <miguel@ximian.com>
19679 * class.cs (Constructor.Define): Updated way of detecting the
19680 length of the parameters.
19682 (TypeContainer.DefineType): Use basename as the type name for
19685 (TypeContainer.Define): Do not recursively define types here, as
19686 definition is taken care in order by the RootContext.
19688 * tree.cs: Keep track of namespaces in a per-file basis.
19690 * parameter.cs (Parameter.ComputeSignature): Update to use
19693 (Parameters.GetSignature): ditto.
19695 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
19696 instead of a TypeContainer.
19698 (Interface.SemanticAnalysis): Use `this' instead of our parent to
19699 resolve names. Because we need to be resolve in our context, not
19702 * driver.cs: Implement response files.
19704 * class.cs (TypeContainer.DefineType): If we are defined, do not
19705 redefine ourselves.
19707 (Event.Emit): Emit the code for add/remove handlers.
19708 (Event.Define): Save the MethodBuilders for add/remove.
19710 * typemanager.cs: Use pair here too.
19712 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
19713 DictionaryEntry requires the first argument to be non-null.
19715 (enum_declaration): Compute full name for registering the
19718 (delegate_declaration): Instead of using
19719 formal_parameter_list, use opt_formal_parameter_list as the list
19722 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
19723 (EventParsing): New property that controls whether `add' and
19724 `remove' are returned as tokens or identifiers (for events);
19726 2001-12-19 Ravi Pratap <ravi@ximian.com>
19728 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
19729 use MyEventBuilder only and let it wrap the real builder for us.
19731 (MyEventBuilder): Revamp constructor etc.
19733 Implement all operations that we perform on EventBuilder in precisely the same
19736 (FindMembers): Update to use the EventBuilder member.
19738 (Event.Emit): Update accordingly.
19740 2001-12-18 Ravi Pratap <ravi@ximian.com>
19742 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
19743 by calling the appropriate methods.
19745 (GetCustomAttributes): Make stubs as they cannot possibly do anything
19748 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
19750 2001-12-17 Ravi Pratap <ravi@ximian.com>
19752 * delegate.cs (Delegate.Populate): Check that the return type
19753 and various parameters types are indeed accessible.
19755 * class.cs (Constructor.Define): Same here.
19757 (Field.Define): Ditto.
19759 (Event.Define): Ditto.
19761 (Operator.Define): Check that the underlying Method defined itself
19762 correctly - so it's MethodBuilder should not be null.
19764 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
19765 expression happens to be null.
19767 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
19768 members but as of now we don't seem to be able to do anything really useful with it.
19770 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
19771 not the EventBuilder.
19773 2001-12-18 Miguel de Icaza <miguel@ximian.com>
19775 * cs-tokenizer.cs: Add support for defines.
19776 Add support for #if, #elif, #else, #endif
19778 (eval_var): evaluates a variable.
19779 (eval): stubbed for evaluating functions.
19781 * cs-parser.jay: Pass the defines information
19783 * driver.cs: Add --define command line option.
19785 * decl.cs: Move MemberCore here.
19787 Make it the base class for DeclSpace. This allows us to catch and
19788 report 108 and 109 for everything now.
19790 * class.cs (TypeContainer.Define): Extract all the members
19791 before populating and emit the warning 108 (new keyword required
19792 to override) instead of having each member implement this.
19794 (MemberCore.Define): New abstract method, we will be using this in
19795 the warning reporting engine in Populate.
19797 (Operator.Define): Adjust to new MemberCore protocol.
19799 * const.cs (Const): This does not derive from Expression, it is a
19800 temporary object we use to create fields, it is a MemberCore.
19802 * class.cs (Method.Define): Allow the entry point to be in a
19805 * driver.cs: Rewrite the argument handler to clean it up a bit.
19807 * rootcontext.cs: Made it just an auxiliary namespace feature by
19808 making everything static.
19810 * driver.cs: Adapt code to use RootContext type name instead of
19813 * delegate.cs: Remove RootContext argument.
19815 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
19818 * class.cs (Event.Define): The lookup can fail.
19820 * cs-tokenizer.cs: Begin implementation of pre-procesor.
19822 * expression.cs: Resolve the this instance before invoking the code.
19824 2001-12-17 Miguel de Icaza <miguel@ximian.com>
19826 * cs-parser.jay: Add a production in element_access that allows
19827 the thing to become a "type" reference. This way we can parse
19828 things like "(string [])" as a type.
19830 Note that this still does not handle the more complex rules of
19834 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
19836 * ecore.cs: (CopyNewMethods): new utility function used to
19837 assemble the list of methods from running FindMembers.
19839 (MemberLookup): Rework FindMembers so that
19841 2001-12-16 Miguel de Icaza <miguel@ximian.com>
19843 * class.cs (TypeContainer): Remove Delegates who fail to be
19846 * delegate.cs (Populate): Verify that we dont get null return
19847 values. TODO: Check for AsAccessible.
19849 * cs-parser.jay: Use basename to emit error 574 (destructor should
19850 have the same name as container class), not the full name.
19852 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
19853 possible representation.
19855 Also implements integer type suffixes U and L.
19857 2001-12-15 Miguel de Icaza <miguel@ximian.com>
19859 * expression.cs (ArrayCreation.DoResolve): We need to do the
19860 argument resolution *always*.
19862 * decl.cs: Make this hold the namespace. Hold the root context as
19864 (LookupType): Move here.
19866 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
19868 * location.cs (Row, Name): Fixed the code, it was always returning
19869 references to the first file.
19871 * interface.cs: Register properties defined through interfaces.
19873 * driver.cs: Add support for globbing on the command line
19875 * class.cs (Field): Make it derive from MemberCore as well.
19878 2001-12-15 Ravi Pratap <ravi@ximian.com>
19880 * class.cs (Event::Define): Check that the type of the event is a delegate
19881 type else flag error #66.
19883 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
19886 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
19887 values of EntryPoint, CharSet etc etc.
19889 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
19891 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
19892 be null and we should ignore this. I am not sure if this is really clean. Apparently,
19893 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
19894 which needs this to do its work.
19896 * ../errors/cs0066.cs : Add.
19898 2001-12-14 Miguel de Icaza <miguel@ximian.com>
19900 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
19903 * class.cs: (MethodSignature.MethodSignature): Removed hack that
19904 clears out the parameters field.
19905 (MemberSignatureCompare): Cleanup
19907 (MemberCore): New base class used to share code between MethodCore
19910 (RegisterRequiredImplementations) BindingFlags.Public requires
19911 either BindingFlags.Instace or Static. Use instance here.
19913 (Property): Refactored code to cope better with the full spec.
19915 * parameter.cs (GetParameterInfo): Return an empty array instead
19918 * class.cs (Property): Abstract or extern properties have no bodies.
19920 * parameter.cs (GetParameterInfo): return a zero-sized array.
19922 * class.cs (TypeContainer.MethodModifiersValid): Move all the
19923 method modifier validation to the typecontainer so we can reuse
19924 this on properties.
19926 (MethodCore.ParameterTypes): return an empty sized array of types.
19928 (Property.Define): Test property modifier validity.
19930 Add tests for sealed/override too.
19932 (Method.Emit): abstract or extern methods have no bodies.
19934 2001-12-14 Ravi Pratap <ravi@ximian.com>
19936 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
19939 (Method::Define, ::Emit): Modify accordingly.
19941 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
19943 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
19945 * makefile: Pass in /unsafe.
19947 2001-12-13 Miguel de Icaza <miguel@ximian.com>
19949 * class.cs (MakeKey): Kill routine.
19951 * class.cs (TypeContainer.Define): Correctly define explicit
19952 method implementations (they require the full interface name plus
19955 * typemanager.cs: Deply the PtrHashtable here and stop using the
19956 lame keys. Things work so much better.
19958 This of course broke everyone who depended on `RegisterMethod' to
19959 do the `test for existance' test. This has to be done elsewhere.
19961 * support.cs (PtrHashtable): A hashtable that avoid comparing with
19962 the object stupid Equals method (because, that like fails all over
19963 the place). We still do not use it.
19965 * class.cs (TypeContainer.SetRequiredInterface,
19966 TypeContainer.RequireMethods): Killed these two routines and moved
19967 all the functionality to RegisterRequiredImplementations.
19969 (TypeContainer.RegisterRequiredImplementations): This routine now
19970 registers all the implementations required in an array for the
19971 interfaces and abstract methods. We use an array of structures
19972 which can be computed ahead of time to reduce memory usage and we
19973 also assume that lookups are cheap as most classes will not
19974 implement too many interfaces.
19976 We also avoid creating too many MethodSignatures.
19978 (TypeContainer.IsInterfaceMethod): Update and optionally does not
19979 clear the "pending" bit if we find that there are problems with
19982 (TypeContainer.VerifyPendingMethods): Update to report errors of
19983 methods that look like implementations but are not.
19985 (TypeContainer.Define): Add support for explicit interface method
19988 2001-12-12 Miguel de Icaza <miguel@ximian.com>
19990 * typemanager.cs: Keep track of the parameters here instead of
19991 being a feature of the TypeContainer.
19993 * class.cs: Drop the registration of parameters here, as
19994 InterfaceMethods are also interface declarations.
19996 * delegate.cs: Register methods with the TypeManager not only with
19997 the TypeContainer. This code was buggy.
19999 * interface.cs: Full registation here.
20001 2001-12-11 Miguel de Icaza <miguel@ximian.com>
20003 * expression.cs: Remove reducer for binary expressions, it can not
20006 * const.cs: Put here the code that used to go into constant.cs
20008 * constant.cs: Put here the code for constants, this is a new base
20009 class for Literals.
20011 * literal.cs: Make Literal derive from Constant.
20013 2001-12-09 Miguel de Icaza <miguel@ximian.com>
20015 * statement.cs (Return.Emit): Report error 157 if the user
20016 attempts to return from a finally block.
20018 (Return.Emit): Instead of emitting a return, jump to the end of
20021 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
20022 LocalBuilder to store the result of the function. ReturnLabel is
20023 the target where we jump.
20026 2001-12-09 Radek Doulik <rodo@ximian.com>
20028 * cs-parser.jay: remember alias in current namespace
20030 * ecore.cs (SimpleName::DoResolve): use aliases for types or
20033 * class.cs (LookupAlias): lookup alias in my_namespace
20035 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
20037 (LookupAlias): lookup alias in this and if needed in parent
20040 2001-12-08 Miguel de Icaza <miguel@ximian.com>
20044 * rootcontext.cs: (ModuleBuilder) Made static, first step into
20045 making things static. I need this to avoid passing the
20046 TypeContainer when calling ParameterType.
20048 * support.cs (InternalParameters.ParameterType): Remove ugly hack
20049 that did string manipulation to compute the type and then call
20050 GetType. Use Parameter.ParameterType instead.
20052 * cs-tokenizer.cs: Consume the suffix for floating values.
20054 * expression.cs (ParameterReference): figure out whether this is a
20055 reference parameter or not. Kill an extra variable by computing
20056 the arg_idx during emission.
20058 * parameter.cs (Parameters.GetParameterInfo): New overloaded
20059 function that returns whether a parameter is an out/ref value or not.
20061 (Parameter.ParameterType): The type of the parameter (base,
20062 without ref/out applied).
20064 (Parameter.Resolve): Perform resolution here.
20065 (Parameter.ExternalType): The full type (with ref/out applied).
20067 * statement.cs (Using.Emit, Using.EmitExpression): Implement
20068 support for expressions on the using statement.
20070 2001-12-07 Miguel de Icaza <miguel@ximian.com>
20072 * statement.cs (Using.EmitLocalVariableDecls): Split the
20073 localvariable handling of the using statement.
20075 (Block.EmitMeta): Keep track of variable count across blocks. We
20076 were reusing slots on separate branches of blocks.
20078 (Try.Emit): Emit the general code block, we were not emitting it.
20080 Check the type of the declaration to be an IDisposable or
20081 something that can be implicity converted to it.
20083 Emit conversions if required.
20085 * ecore.cs (EmptyExpression): New utility class.
20086 (Expression.ImplicitConversionExists): New utility function.
20088 2001-12-06 Miguel de Icaza <miguel@ximian.com>
20090 * statement.cs (Using): Implement.
20092 * expression.cs (LocalVariableReference): Support read only variables.
20094 * statement.cs: Remove the explicit emit for the Leave opcode.
20095 (VariableInfo): Add a readonly field.
20097 2001-12-05 Miguel de Icaza <miguel@ximian.com>
20099 * ecore.cs (ConvCast): new class used to encapsulate the various
20100 explicit integer conversions that works in both checked and
20101 unchecked contexts.
20103 (Expression.ConvertNumericExplicit): Use new ConvCast class to
20104 properly generate the overflow opcodes.
20106 2001-12-04 Miguel de Icaza <miguel@ximian.com>
20108 * statement.cs: The correct type for the EmptyExpression is the
20109 element_type, not the variable type. Ravi pointed this out.
20111 2001-12-04 Ravi Pratap <ravi@ximian.com>
20113 * class.cs (Method::Define): Handle PInvoke methods specially
20114 by using DefinePInvokeMethod instead of the usual one.
20116 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
20117 above to do the task of extracting information and defining the method.
20119 2001-12-04 Ravi Pratap <ravi@ximian.com>
20121 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
20122 of the condition for string type.
20124 (Emit): Move that here.
20126 (ArrayCreation::CheckIndices): Keep string literals in their expression
20129 (EmitDynamicInitializers): Handle strings appropriately.
20131 2001-12-04 Miguel de Icaza <miguel@ximian.com>
20133 * codegen.cs (EmitContext): Replace multiple variables with a
20134 single pointer to the current Switch statement.
20136 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
20139 2001-12-03 Miguel de Icaza <miguel@ximian.com>
20143 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
20146 (Foreach.Emit): Foreach on arrays was not setting
20147 up the loop variables (for break/continue).
20149 (GotoCase): Semi-implented.
20151 2001-12-03 Ravi Pratap <ravi@ximian.com>
20153 * attribute.cs (CheckAttribute): Handle system attributes by using
20154 Attribute.GetAttributes to examine information we need.
20156 (GetValidPlaces): Same here.
20158 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
20160 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
20162 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
20164 (Method::Define): Set appropriate flags if we have a DllImport attribute.
20166 (Method::Emit): Handle the case when we are a PInvoke method.
20168 2001-12-03 Miguel de Icaza <miguel@ximian.com>
20170 * expression.cs: Use ResolveWithSimpleName on compound names.
20172 2001-12-02 Ravi Pratap <ravi@ximian.com>
20174 * constant.cs (EmitConstant): Make sure we resolve the associated expression
20175 before trying to reduce it.
20177 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
20179 * constant.cs (LookupConstantValue): Implement.
20181 (EmitConstant): Use the above in emitting the constant.
20183 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
20184 that are user-defined by doing a LookupConstantValue on them.
20186 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
20189 2001-11-29 Miguel de Icaza <miguel@ximian.com>
20191 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
20193 (BaseAccess.DoResolve): Implement.
20195 (MemberAccess.DoResolve): Split this routine into a
20196 ResolveMemberAccess routine that can be used independently
20198 2001-11-28 Miguel de Icaza <miguel@ximian.com>
20200 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
20201 As that share bits of the implementation. Is returns a boolean,
20202 while As returns the Type that is being probed.
20204 2001-12-01 Ravi Pratap <ravi@ximian.com>
20206 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
20207 instead of a Literal - much easier.
20209 (EnumInTransit): Remove - utterly useless :-)
20211 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
20213 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
20215 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
20216 chain when we have no associated expression.
20218 2001-11-30 Ravi Pratap <ravi@ximian.com>
20220 * constant.cs (Define): Use Location while reporting the errror.
20222 Also emit a warning when 'new' is used and there is no inherited
20225 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
20228 (LookupEnumValue): Implement to lookup an enum member's value and define it
20231 (Populate): Re-write accordingly to use the above routine.
20233 2001-11-27 Miguel de Icaza <miguel@ximian.com>
20235 * expression.cs (This): Fix prototype for DoResolveLValue to
20236 override the base class DoResolveLValue.
20238 * cs-parser.cs: Report errors cs574 and cs575 (destructor
20241 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
20242 (we need to load the address of the field here). This fixes
20245 (FieldExpr.DoResolveLValue): Call the DoResolve
20246 function to initialize the Instance expression.
20248 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
20249 correctly the GetEnumerator operation on a value type.
20251 * cs-parser.jay: Add more simple parsing error catches.
20253 * statement.cs (Switch): Add support for string switches.
20254 Handle null specially.
20256 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
20258 2001-11-28 Ravi Pratap <ravi@ximian.com>
20260 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
20262 (declare_local_constant): New helper function.
20264 * statement.cs (AddConstant): Keep a separate record of constants
20266 (IsConstant): Implement to determine if a variable is a constant.
20268 (GetConstantExpression): Implement.
20270 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
20272 * statement.cs (IsVariableDefined): Re-write.
20274 2001-11-27 Ravi Pratap <ravi@ximian.com>
20276 * class.cs (TypeContainer::FindMembers): Look for constants
20277 in the case when we are looking for MemberTypes.Field
20279 * expression.cs (MemberAccess::DoResolve): Check that in the
20280 case we are a FieldExpr and a Literal, we are not being accessed
20281 by an instance reference.
20283 * cs-parser.jay (local_constant_declaration): Implement.
20285 (declaration_statement): Implement for constant declarations.
20287 2001-11-26 Miguel de Icaza <miguel@ximian.com>
20289 * statement.cs (Switch): Catch double defaults.
20291 (Switch): More work on the switch() statement
20292 implementation. It works for integral values now, need to finish
20296 2001-11-24 Miguel de Icaza <miguel@ximian.com>
20298 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
20299 integer literals into other integer literals. To be used by
20302 2001-11-24 Ravi Pratap <ravi@ximian.com>
20304 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
20307 (EmitDynamicInitializers): Cope with the above since we extract data
20308 directly from ArrayData now.
20310 (ExpectInitializers): Keep track of whether initializers are mandatory
20313 (Bounds): Make it a hashtable to prevent the same dimension being
20314 recorded for every element in that dimension.
20316 (EmitDynamicInitializers): Fix bug which prevented the Set array method
20319 Also fix bug which was causing the indices to be emitted in the reverse
20322 2001-11-24 Miguel de Icaza <miguel@ximian.com>
20324 * expression.cs (ArrayCreation): Implement the bits that Ravi left
20325 unfinished. They do not work, because the underlying code is
20328 2001-11-22 Miguel de Icaza <miguel@ximian.com>
20330 * cs-parser.jay: Remove bogus fixme.
20332 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
20333 on Switch statement.
20335 2001-11-23 Ravi Pratap <ravi@ximian.com>
20337 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
20340 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
20341 parameter. Apparently, any expression is allowed.
20343 (ValidateInitializers): Update accordingly.
20345 (CheckIndices): Fix some tricky bugs thanks to recursion.
20347 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
20348 I was being completely brain-dead.
20350 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
20351 and re-write acordingly.
20353 (DelegateInvocation): Re-write accordingly.
20355 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
20357 (MakeByteBlob): Handle types more correctly.
20359 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
20360 initialization from expressions but it is incomplete because I am a complete
20363 2001-11-22 Miguel de Icaza <miguel@ximian.com>
20365 * statement.cs (If.Emit): Fix a bug that generated incorrect code
20366 on If. Basically, we have to return `true' (ie, we do return to
20367 our caller) only if both branches of the if return.
20369 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
20370 short-circuit operators, handle them as short circuit operators.
20372 (Cast.DoResolve): Resolve type.
20373 (Cast.Cast): Take an expression as the target type.
20375 * cs-parser.jay (cast_expression): Remove old hack that only
20376 allowed a limited set of types to be handled. Now we take a
20377 unary_expression and we resolve to a type during semantic
20380 Use the grammar productions from Rhys to handle casts (this is
20381 not complete like Rhys syntax yet, we fail to handle that corner
20382 case that C# has regarding (-x), but we will get there.
20384 2001-11-22 Ravi Pratap <ravi@ximian.com>
20386 * class.cs (EmitFieldInitializer): Take care of the case when we have a
20387 field which is an array type.
20389 * cs-parser.jay (declare_local_variables): Support array initialization too.
20391 * typemanager.cs (MakeKey): Implement.
20393 (everywhere): Use the above appropriately.
20395 * cs-parser.jay (for_statement): Update for array initialization while
20396 declaring variables.
20398 * ecore.cs : The error message was correct, it's the variable's names that
20399 were misleading ;-) Make the code more readable.
20401 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
20402 the correct type etc.
20404 (ConvertExplicit): Handle Enum types by examining the underlying type.
20406 2001-11-21 Ravi Pratap <ravi@ximian.com>
20408 * parameter.cs (GetCallingConvention): Always return
20409 CallingConventions.Standard for now.
20411 2001-11-22 Miguel de Icaza <miguel@ximian.com>
20413 * expression.cs (Binary.ResolveOperator): Update the values of `l'
20414 and `r' after calling DoNumericPromotions.
20416 * ecore.cs: Fix error message (the types were in the wrong order).
20418 * statement.cs (Foreach.ProbeCollectionType): Need to pass
20419 BindingFlags.Instance as well
20421 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
20422 implicit int literal conversion in an empty cast so that we
20423 propagate the right type upstream.
20425 (UnboxCast): new class used to unbox value types.
20426 (Expression.ConvertExplicit): Add explicit type conversions done
20429 (Expression.ImplicitNumericConversion): Oops, forgot to test for
20430 the target type before applying the implicit LongLiterals to ULong
20433 2001-11-21 Miguel de Icaza <miguel@ximian.com>
20435 * cs-parser.jay (for_statement): Reworked the way For works: now
20436 we declare manually any variables that are introduced in
20437 for_initializer to solve the problem of having out-of-band code
20438 emition (that is what got for broken).
20440 (declaration_statement): Perform the actual variable declaration
20441 that used to be done in local_variable_declaration here.
20443 (local_variable_declaration): Do not declare anything, just pass
20444 the information on a DictionaryEntry
20446 2001-11-20 Ravi Pratap <ravi@ximian.com>
20448 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
20449 re-write of the logic to now make it recursive.
20451 (UpdateIndices): Re-write accordingly.
20453 Store element data in a separate ArrayData list in the above methods.
20455 (MakeByteBlob): Implement to dump the array data into a byte array.
20457 2001-11-19 Ravi Pratap <ravi@ximian.com>
20459 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
20462 * constant.cs (Define): Implement.
20464 (EmitConstant): Re-write fully.
20466 Pass in location info.
20468 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
20471 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
20472 DictionaryEntry since we need location info too.
20474 (constant_declaration): Update accordingly.
20476 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
20477 code into another method : UpdateIndices.
20479 2001-11-18 Ravi Pratap <ravi@ximian.com>
20481 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
20482 some type checking etc.
20484 2001-11-17 Ravi Pratap <ravi@ximian.com>
20486 * expression.cs (ArrayCreation::ValidateInitializers): Implement
20487 bits to provide dimension info if the user skips doing that.
20489 Update second constructor to store the rank correctly.
20491 2001-11-16 Ravi Pratap <ravi@ximian.com>
20493 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
20494 and try to implement.
20496 * ../errors/cs0150.cs : Add.
20498 * ../errors/cs0178.cs : Add.
20500 2001-11-16 Miguel de Icaza <miguel@ximian.com>
20502 * statement.cs: Implement foreach on multi-dimensional arrays.
20504 * parameter.cs (Parameters.GetParameterByName): Also lookup the
20505 name of the params argument.
20507 * expression.cs: Use EmitStoreOpcode to get the right opcode while
20508 initializing the array.
20510 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
20511 we can use this elsewhere.
20513 * statement.cs: Finish implementation of foreach for single
20516 * cs-parser.jay: Use an out-of-band stack to pass information
20517 around, I wonder why I need this.
20519 foreach_block: Make the new foreach_block the current_block.
20521 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
20522 function used to return a static Parameters structure. Used for
20523 empty parameters, as those are created very frequently.
20525 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
20527 2001-11-15 Ravi Pratap <ravi@ximian.com>
20529 * interface.cs : Default modifier is private, not public. The
20530 make verify test passes again.
20532 2001-11-15 Ravi Pratap <ravi@ximian.com>
20534 * support.cs (ReflectionParameters): Fix logic to determine
20535 whether the last parameter is a params one. Test 9 passes again.
20537 * delegate.cs (Populate): Register the builders we define with
20538 RegisterParameterForBuilder. Test 19 passes again.
20540 * cs-parser.jay (property_declaration): Reference $6 instead
20541 of $$ to get at the location.
20543 (indexer_declaration): Similar stuff.
20545 (attribute): Ditto.
20547 * class.cs (Property): Register parameters for the Get and Set methods
20548 if they exist. Test 23 passes again.
20550 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
20551 call to EmitArguments as we are sure there aren't any params arguments.
20552 Test 32 passes again.
20554 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
20555 IndexOutOfRangeException.
20557 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
20558 Test 33 now passes again.
20560 2001-11-15 Miguel de Icaza <miguel@ximian.com>
20562 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
20563 broke a bunch of things. Will have to come up with a better way
20564 of tracking locations.
20566 * statement.cs: Implemented foreach for single dimension arrays.
20568 2001-11-09 Miguel de Icaza <miguel@ximian.com>
20570 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
20571 an error. This removes the lookup from the critical path.
20573 * cs-parser.jay: Removed use of temporary_loc, which is completely
20576 2001-11-14 Miguel de Icaza <miguel@ximian.com>
20578 * support.cs (ReflectionParameters.ParameterModifier): Report
20579 whether the argument is a PARAMS argument or not.
20581 * class.cs: Set the attribute `ParamArrayAttribute' on the
20582 parameter argument.
20584 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
20585 and cons_param_array_attribute (ConstructorInfo for
20586 ParamArrayAttribute).,
20588 * codegen.cs: Emit the return using the `Return' statement, that
20589 way we can report the error correctly for missing return values.
20591 * class.cs (Method.Emit): Clean up.
20593 * expression.cs (Argument.Resolve): Take another argument: the
20594 location where this argument is used. Notice that this is not
20595 part of the "Argument" class as to reduce the size of the
20596 structure (we know the approximate location anyways).
20598 Test if the argument is a variable-reference, if not, then
20599 complain with a 206.
20601 (Argument.Emit): Emit addresses of variables.
20603 (Argument.FullDesc): Simplify.
20605 (Invocation.DoResolve): Update for Argument.Resolve.
20607 (ElementAccess.DoResolve): ditto.
20609 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
20610 method should be virtual, as this method is always virtual.
20612 (NewDelegate.DoResolve): Update for Argument.Resolve.
20614 * class.cs (ConstructorInitializer.DoResolve): ditto.
20616 * attribute.cs (Attribute.Resolve): ditto.
20618 2001-11-13 Miguel de Icaza <miguel@ximian.com>
20620 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
20622 * expression.cs (ParameterReference): Drop IStackStorage and implement
20623 IAssignMethod instead.
20625 (LocalVariableReference): ditto.
20627 * ecore.cs (FieldExpr): Drop IStackStorage and implement
20628 IAssignMethod instead.
20630 2001-11-13 Miguel de Icaza <miguel@ximian.com>
20632 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
20633 enumerations that are used in heavily used structures derive from
20634 byte in a laughable and pathetic attempt to reduce memory usage.
20635 This is the kind of pre-optimzations that you should not do at
20636 home without adult supervision.
20638 * expression.cs (UnaryMutator): New class, used to handle ++ and
20639 -- separatedly from the other unary operators. Cleans up the
20640 code, and kills the ExpressionStatement dependency in Unary.
20642 (Unary): Removed `method' and `Arguments' from this class, making
20643 it smaller, and moving it all to SimpleCall, so I can reuse this
20644 code in other locations and avoid creating a lot of transient data
20645 strucutres when not required.
20647 * cs-parser.jay: Adjust for new changes.
20649 2001-11-11 Miguel de Icaza <miguel@ximian.com>
20651 * enum.cs (Enum.Populate): If there is a failure during
20654 * cs-parser.jay (opt_enum_base): we used to catch type errors
20655 here, but this is really incorrect. The type error should be
20656 catched during semantic analysis.
20658 2001-12-11 Ravi Pratap <ravi@ximian.com>
20660 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
20661 current_local_parameters as expected since I, in my stupidity, had forgotten
20664 * attribute.cs (GetValidPlaces): Fix stupid bug.
20666 * class.cs (Method::Emit): Perform check on applicability of attributes.
20668 (Constructor::Emit): Ditto.
20670 (Field::Emit): Ditto.
20672 (Field.Location): Store location information.
20674 (Property, Event, Indexer, Operator): Ditto.
20676 * cs-parser.jay (field_declaration): Pass in location for each field.
20678 * ../errors/cs0592.cs : Add.
20680 2001-11-12 Ravi Pratap <ravi@ximian.com>
20682 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
20684 (InitCoreTypes): Update accordingly.
20686 (RegisterAttrType, LookupAttr): Implement.
20688 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
20689 info about the same.
20691 (Resolve): Update to populate the above as necessary.
20693 (Error592): Helper.
20695 (GetValidPlaces): Helper to the above.
20697 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
20699 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
20701 2001-11-12 Ravi Pratap <ravi@ximian.com>
20703 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
20705 * ../errors/cs0617.cs : Add.
20707 2001-11-11 Ravi Pratap <ravi@ximian.com>
20709 * enum.cs (Emit): Rename to Populate to be more consistent with what
20710 we expect it to do and when exactly it is called.
20712 * class.cs, rootcontext.cs : Update accordingly.
20714 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
20715 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
20717 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
20719 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
20720 of a fieldinfo using the above, when dealing with a FieldBuilder.
20722 2001-11-10 Ravi Pratap <ravi@ximian.com>
20724 * ../errors/cs0031.cs : Add.
20726 * ../errors/cs1008.cs : Add.
20728 * ../errrors/cs0543.cs : Add.
20730 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
20733 (FindMembers): Implement.
20735 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
20736 enums and delegates too.
20738 (enum_types): Rename to builder_to_enum.
20740 (delegate_types): Rename to builder_to_delegate.
20742 * delegate.cs (FindMembers): Implement.
20744 2001-11-09 Ravi Pratap <ravi@ximian.com>
20746 * typemanager.cs (IsEnumType): Implement.
20748 * enum.cs (Emit): Re-write parts to account for the underlying type
20749 better and perform checking etc.
20751 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
20752 of the underlying type.
20754 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
20757 * enum.cs (error31): Helper to report error #31.
20759 * cs-parser.jay (enum_declaration): Store location of each member too.
20761 * enum.cs (member_to_location): New hashtable.
20763 (AddEnumMember): Update location hashtable.
20765 (Emit): Use the location of each member while reporting errors.
20767 2001-11-09 Miguel de Icaza <miguel@ximian.com>
20769 * cs-parser.jay: A for_initializer if is a
20770 local_variable_declaration really ammount to have an implicit
20771 block with the variable declaration and no initializer for for.
20773 * statement.cs (For.Emit): Cope with null initializers.
20775 This fixes the infinite loop on for initializers.
20777 2001-11-08 Miguel de Icaza <miguel@ximian.com>
20779 * enum.cs: More cleanup.
20781 * ecore.cs: Remove dead code.
20783 * class.cs (Property.Emit): More simplification.
20784 (Event.Emit): ditto.
20786 Reworked to have less levels of indentation.
20788 2001-11-08 Ravi Pratap <ravi@ximian.com>
20790 * class.cs (Property): Emit attributes.
20800 * enum.cs (Emit): Ditto.
20802 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
20805 * class.cs (Field, Event, etc.): Move attribute generation into the
20806 Emit method everywhere.
20808 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
20809 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
20810 as we had no way of defining nested enums !
20812 * rootcontext.cs : Adjust code accordingly.
20814 * typemanager.cs (AddEnumType): To keep track of enum types separately.
20816 2001-11-07 Ravi Pratap <ravi@ximian.com>
20818 * expression.cs (EvalConstantExpression): Move into ecore.cs
20820 * enum.cs (Enum): Rename some members and make them public and readonly
20821 according to our convention.
20823 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
20826 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
20828 (Enum::Emit): Write a simple version for now which doesn't try to compute
20829 expressions. I shall modify this to be more robust in just a while.
20831 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
20833 (TypeContainer::CloseType): Create the Enum types too.
20835 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
20837 * expression.cs (EvalConstantExpression): Get rid of completely.
20839 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
20840 user-defined values and other cases.
20842 (IsValidEnumLiteral): Helper function.
20844 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
20845 out there in the case we had a literal FieldExpr.
20847 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
20849 (Literalize): Revamp a bit to take two arguments.
20851 (EnumLiteral): New class which derives from Literal to wrap enum literals.
20853 2001-11-06 Ravi Pratap <ravi@ximian.com>
20855 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
20857 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
20859 (Resolve): Use the above to ensure we have proper initializers.
20861 2001-11-05 Ravi Pratap <ravi@ximian.com>
20863 * expression.cs (Expression::EvalConstantExpression): New method to
20864 evaluate constant expressions.
20866 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
20868 2001-11-07 Miguel de Icaza <miguel@ximian.com>
20870 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
20873 (Binary.ResolveOperator): Handle operator != (object a, object b)
20874 and operator == (object a, object b);
20876 (Binary.DoNumericPromotions): Indicate whether the numeric
20877 promotion was possible.
20879 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
20882 Made the ArrayAccess implement interface IAssignMethod instead of
20883 IStackStore as the order in which arguments are passed reflects
20886 * assign.cs: Instead of using expr.ExprClass to select the way of
20887 assinging, probe for the IStackStore/IAssignMethod interfaces.
20889 * typemanager.cs: Load InitializeArray definition.
20891 * rootcontext.cs (RootContext.MakeStaticData): Used to define
20892 static data that can be used to initialize arrays.
20894 2001-11-05 Miguel de Icaza <miguel@ximian.com>
20896 * expression.cs: Handle operator== and operator!= for booleans.
20898 (Conditioal.Reduce): Implement reducer for the ?: operator.
20900 (Conditional.Resolve): Implement dead code elimination.
20902 (Binary.Resolve): Catch string literals and return a new
20903 concatenated string.
20905 (Unary.Reduce): Implement reduction of unary expressions.
20907 * ecore.cs: Split out the expression core handling here.
20909 (Expression.Reduce): New method used to perform constant folding
20910 and CSE. This is needed to support constant-expressions.
20912 * statement.cs (Statement.EmitBoolExpression): Pass true and false
20913 targets, and optimize for !x.
20915 2001-11-04 Ravi Pratap <ravi@ximian.com>
20917 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
20918 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
20919 set custom atttributes.
20921 * literal.cs (Literal::GetValue): New abstract method to return the actual
20922 value of the literal, cast as an object.
20924 (*Literal): Implement GetValue method.
20926 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
20927 expressions to the arraylist but objects of type Argument.
20929 * class.cs (TypeContainer::Emit): Emit our attributes too.
20931 (Method::Emit, Constructor::Emit): Ditto.
20933 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
20934 to be ignoring earlier.
20936 2001-11-03 Ravi Pratap <ravi@ximian.com>
20938 * attribute.cs (AttributeSection::Define): Implement to do the business
20939 of constructing a CustomAttributeBuilder.
20941 (Attribute): New trivial class. Increases readability of code.
20943 * cs-parser.jay : Update accordingly.
20945 (positional_argument_list, named_argument_list, named_argument): New rules
20947 (attribute_arguments): Use the above so that we are more correct.
20949 2001-11-02 Ravi Pratap <ravi@ximian.com>
20951 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
20952 to perform all checks for a method with a params parameter.
20954 (Invocation::OverloadResolve): Update to use the above method and therefore
20955 cope correctly with params method invocations.
20957 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
20960 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
20961 constructors in our parent too because we can't afford to miss out on
20964 * attribute.cs (AttributeSection): New name for the class Attribute
20966 Other trivial changes to improve readability.
20968 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
20969 use the new class names.
20971 2001-11-01 Ravi Pratap <ravi@ximian.com>
20973 * class.cs (Method::Define): Complete definition for params types too
20975 (Indexer::Define): Ditto.
20977 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
20978 Cope everywhere with a request for info about the array parameter.
20980 2001-11-01 Ravi Pratap <ravi@ximian.com>
20982 * tree.cs (RecordNamespace): Fix up to check for the correct key.
20984 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
20985 local_variable_type to extract the string corresponding to the type.
20987 (local_variable_type): Fixup the action to use the new helper method.
20989 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
20992 * expression.cs : Clean out code which uses the above.
20994 2001-10-31 Ravi Pratap <ravi@ximian.com>
20996 * typemanager.cs (RegisterMethod): Check if we already have an existing key
20997 and bale out if necessary by returning a false.
20999 (RegisterProperty): Ditto.
21001 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
21002 and print out appropriate error messages.
21004 * interface.cs (everywhere): Ditto.
21006 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
21007 location to constructor.
21009 * class.cs (Property, Event, Indexer): Update accordingly.
21011 * ../errors/cs111.cs : Added.
21013 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
21014 of a method, as laid down by the spec.
21016 (Invocation::OverloadResolve): Use the above method.
21018 2001-10-31 Ravi Pratap <ravi@ximian.com>
21020 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
21021 now take a TypeContainer and a Parameters object.
21023 (ParameterData): Modify return type of ParameterModifier method to be
21024 Parameter.Modifier and not a string.
21026 (ReflectionParameters, InternalParameters): Update accordingly.
21028 * expression.cs (Argument::GetParameterModifier): Same here.
21030 * support.cs (InternalParameters::ParameterType): Find a better way of determining
21031 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
21032 symbol in it at all so maybe this is only for now.
21034 2001-10-30 Ravi Pratap <ravi@ximian.com>
21036 * support.cs (InternalParameters): Constructor now takes an extra argument
21037 which is the actual Parameters class.
21039 (ParameterDesc): Update to provide info on ref/out modifiers.
21041 * class.cs (everywhere): Update call to InternalParameters to pass in
21042 the second argument too.
21044 * support.cs (ParameterData): Add ParameterModifier, which is a method
21045 to return the modifier info [ref/out etc]
21047 (InternalParameters, ReflectionParameters): Implement the above.
21049 * expression.cs (Argument::ParameterModifier): Similar function to return
21050 info about the argument's modifiers.
21052 (Invocation::OverloadResolve): Update to take into account matching modifiers
21055 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
21056 a new SetFormalParameters object which we pass to InternalParameters.
21058 2001-10-30 Ravi Pratap <ravi@ximian.com>
21060 * expression.cs (NewArray): Merge into the ArrayCreation class.
21062 2001-10-29 Ravi Pratap <ravi@ximian.com>
21064 * expression.cs (NewArray): Merge classes NewBuiltinArray and
21065 NewUserdefinedArray into one as there wasn't much of a use in having
21068 * expression.cs (Argument): Change field's name to ArgType from Type.
21070 (Type): New readonly property which returns the proper type, taking into
21071 account ref/out modifiers.
21073 (everywhere): Adjust code accordingly for the above.
21075 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
21076 whether we are emitting for a ref or out parameter.
21078 * expression.cs (Argument::Emit): Use the above field to set the state.
21080 (LocalVariableReference::Emit): Update to honour the flag and emit the
21083 * parameter.cs (Attributes): Set the correct flags for ref parameters.
21085 * expression.cs (Argument::FullDesc): New function to provide a full desc.
21087 * support.cs (ParameterData): Add method ParameterDesc to the interface.
21089 (ReflectionParameters, InternalParameters): Implement the above method.
21091 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
21094 (Invocation::FullMethodDesc): Ditto.
21096 2001-10-29 Miguel de Icaza <miguel@ximian.com>
21098 * cs-parser.jay: Add extra production for the second form of array
21101 * expression.cs (ArrayCreation): Update to reflect the above
21104 * Small changes to prepare for Array initialization.
21106 2001-10-28 Miguel de Icaza <miguel@ximian.com>
21108 * typemanager.cs (ImplementsInterface): interface might be null;
21109 Deal with this problem;
21111 Also, we do store negative hits on the cache (null values), so use
21112 this instead of calling t.GetInterfaces on the type everytime.
21114 2001-10-28 Ravi Pratap <ravi@ximian.com>
21116 * typemanager.cs (IsBuiltinType): New method to help determine the same.
21118 * expression.cs (New::DoResolve): Get rid of array creation code and instead
21119 split functionality out into different classes.
21121 (New::FormArrayType): Move into NewBuiltinArray.
21123 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
21126 (NewBuiltinArray): New class to handle creation of built-in arrays.
21128 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
21129 account creation of one-dimensional arrays.
21131 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
21133 (NewUserdefinedArray::DoResolve): Implement.
21135 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
21137 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
21138 we maintain inside the TypeManager. This is necessary to perform lookups on the
21141 (LookupType): Update to perform GetType on the module builders too.
21143 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
21145 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
21147 2001-10-23 Ravi Pratap <ravi@ximian.com>
21149 * expression.cs (New::DoResolve): Implement guts of array creation.
21151 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
21153 2001-10-27 Miguel de Icaza <miguel@ximian.com>
21155 * expression.cs: Fix bug I introduced lsat night that broke
21158 (Expression.Resolve): Report a 246 error (can not resolve name)
21159 if we find a SimpleName in the stream.
21161 (Expression.ResolveLValue): Ditto.
21163 (Expression.ResolveWithSimpleName): This function is a variant of
21164 ResolveName, this one allows SimpleNames to be returned without a
21165 warning. The only consumer of SimpleNames is MemberAccess
21167 2001-10-26 Miguel de Icaza <miguel@ximian.com>
21169 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
21170 might arrive here. I have my doubts that this is correct.
21172 * statement.cs (Lock): Implement lock statement.
21174 * cs-parser.jay: Small fixes to support `lock' and `using'
21176 * cs-tokenizer.cs: Remove extra space
21178 * driver.cs: New flag --checked, allows to turn on integer math
21181 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
21182 Threading.Monitor.Exit
21184 2001-10-23 Miguel de Icaza <miguel@ximian.com>
21186 * expression.cs (IndexerAccess::DoResolveLValue): Set the
21187 Expression Class to be IndexerAccess.
21189 Notice that Indexer::DoResolve sets the eclass to Value.
21191 2001-10-22 Miguel de Icaza <miguel@ximian.com>
21193 * class.cs (TypeContainer::Emit): Emit code for indexers.
21195 * assign.cs (IAssignMethod): New interface implemented by Indexers
21196 and Properties for handling assignment.
21198 (Assign::Emit): Simplify and reuse code.
21200 * expression.cs (IndexerAccess, PropertyExpr): Implement
21201 IAssignMethod, clean up old code.
21203 2001-10-22 Ravi Pratap <ravi@ximian.com>
21205 * typemanager.cs (ImplementsInterface): New method to determine if a type
21206 implements a given interface. Provides a nice cache too.
21208 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
21211 (ConvertReferenceExplicit): Ditto.
21213 * delegate.cs (Delegate::Populate): Update to define the parameters on the
21214 various methods, with correct names etc.
21216 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
21217 Operator.UnaryNegation.
21219 * cs-parser.jay (operator_declarator): Be a little clever in the case where
21220 we have a unary plus or minus operator.
21222 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
21225 * everywhere : update accordingly.
21227 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
21230 * class.cs (Method::Define): For the case where we are implementing a method
21231 inherited from an interface, we need to set the MethodAttributes.Final flag too.
21232 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
21234 2001-10-21 Ravi Pratap <ravi@ximian.com>
21236 * interface.cs (FindMembers): Implement to work around S.R.E
21239 * typemanager.cs (IsInterfaceType): Implement.
21241 (FindMembers): Update to handle interface types too.
21243 * expression.cs (ImplicitReferenceConversion): Re-write bits which
21244 use IsAssignableFrom as that is not correct - it doesn't work.
21246 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
21247 and accordingly override EmitStatement.
21249 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
21250 using the correct logic :-)
21252 2001-10-19 Ravi Pratap <ravi@ximian.com>
21254 * ../errors/cs-11.cs : Add to demonstrate error -11
21256 2001-10-17 Miguel de Icaza <miguel@ximian.com>
21258 * assign.cs (Assign::Resolve): Resolve right hand side first, and
21259 then pass this as a hint to ResolveLValue.
21261 * expression.cs (FieldExpr): Add Location information
21263 (FieldExpr::LValueResolve): Report assignment to readonly
21266 (Expression::ExprClassFromMemberInfo): Pass location information.
21268 (Expression::ResolveLValue): Add new method that resolves an
21271 (Expression::DoResolveLValue): Default invocation calls
21274 (Indexers): New class used to keep track of indexers in a given
21277 (IStackStore): Renamed from LValue, as it did not really describe
21278 what this did. Also ResolveLValue is gone from this interface and
21279 now is part of Expression.
21281 (ElementAccess): Depending on the element access type
21283 * typemanager.cs: Add `indexer_name_type' as a Core type
21284 (System.Runtime.CompilerServices.IndexerNameAttribute)
21286 * statement.cs (Goto): Take a location.
21288 2001-10-18 Ravi Pratap <ravi@ximian.com>
21290 * delegate.cs (Delegate::VerifyDelegate): New method to verify
21291 if two delegates are compatible.
21293 (NewDelegate::DoResolve): Update to take care of the case when
21294 we instantiate a delegate from another delegate.
21296 * typemanager.cs (FindMembers): Don't even try to look up members
21297 of Delegate types for now.
21299 2001-10-18 Ravi Pratap <ravi@ximian.com>
21301 * delegate.cs (NewDelegate): New class to take care of delegate
21304 * expression.cs (New): Split the delegate related code out into
21305 the NewDelegate class.
21307 * delegate.cs (DelegateInvocation): New class to handle delegate
21310 * expression.cs (Invocation): Split out delegate related code into
21311 the DelegateInvocation class.
21313 2001-10-17 Ravi Pratap <ravi@ximian.com>
21315 * expression.cs (New::DoResolve): Implement delegate creation fully
21316 and according to the spec.
21318 (New::DoEmit): Update to handle delegates differently.
21320 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
21321 because of which we were printing out arguments in reverse order !
21323 * delegate.cs (VerifyMethod): Implement to check if the given method
21324 matches the delegate.
21326 (FullDelegateDesc): Implement.
21328 (VerifyApplicability): Implement.
21330 * expression.cs (Invocation::DoResolve): Update to accordingly handle
21331 delegate invocations too.
21333 (Invocation::Emit): Ditto.
21335 * ../errors/cs1593.cs : Added.
21337 * ../errors/cs1594.cs : Added.
21339 * delegate.cs (InstanceExpression, TargetMethod): New properties.
21341 2001-10-16 Ravi Pratap <ravi@ximian.com>
21343 * typemanager.cs (intptr_type): Core type for System.IntPtr
21345 (InitCoreTypes): Update for the same.
21347 (iasyncresult_type, asynccallback_type): Ditto.
21349 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
21352 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
21355 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
21356 the builders for the 4 members of a delegate type :-)
21358 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
21361 * expression.cs (New::DoResolve): Implement guts for delegate creation.
21363 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
21365 2001-10-15 Miguel de Icaza <miguel@ximian.com>
21367 * statement.cs (Break::Emit): Implement.
21368 (Continue::Emit): Implement.
21370 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
21371 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
21372 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
21373 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
21376 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
21377 properties that track the label for the current loop (begin of the
21378 loop and end of the loop).
21380 2001-10-15 Ravi Pratap <ravi@ximian.com>
21382 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
21383 use of emitting anything at all.
21385 * class.cs, rootcontext.cs : Get rid of calls to the same.
21387 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
21389 (Populate): Define the constructor correctly and set the implementation
21392 * typemanager.cs (delegate_types): New hashtable to hold delegates that
21395 (AddDelegateType): Implement.
21397 (IsDelegateType): Implement helper method.
21399 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
21401 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
21402 and accordingly handle it.
21404 * delegate.cs (Populate): Take TypeContainer argument.
21405 Implement bits to define the Invoke method. However, I still haven't figured out
21406 how to take care of the native int bit :-(
21408 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
21409 Qualify the name of the delegate, not its return type !
21411 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
21414 (StandardConversionExists): Checking for array types turns out to be recursive.
21416 (ConvertReferenceExplicit): Implement array conversion.
21418 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
21420 2001-10-12 Ravi Pratap <ravi@ximian.com>
21422 * cs-parser.jay (delegate_declaration): Store the fully qualified
21423 name as it is a type declaration.
21425 * delegate.cs (ReturnType, Name): Rename members to these. Make them
21428 (DefineDelegate): Renamed from Define. Does the same thing essentially,
21429 as TypeContainer::DefineType.
21431 (Populate): Method in which all the definition of the various methods (Invoke)
21434 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
21437 (CloseDelegate): Finally creates the delegate.
21439 * class.cs (TypeContainer::DefineType): Update to define delegates.
21440 (Populate, Emit and CloseType): Do the same thing here too.
21442 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
21443 delegates in all these operations.
21445 2001-10-14 Miguel de Icaza <miguel@ximian.com>
21447 * expression.cs: LocalTemporary: a new expression used to
21448 reference a temporary that has been created.
21450 * assign.cs: Handle PropertyAccess back here, so that we can
21451 provide the proper semantic access to properties.
21453 * expression.cs (Expression::ConvertReferenceExplicit): Implement
21454 a few more explicit conversions.
21456 * modifiers.cs: `NEW' modifier maps to HideBySig.
21458 * expression.cs (PropertyExpr): Make this into an
21459 ExpressionStatement, and support the EmitStatement code path.
21461 Perform get/set error checking, clean up the interface.
21463 * assign.cs: recognize PropertyExprs as targets, and if so, turn
21464 them into toplevel access objects.
21466 2001-10-12 Miguel de Icaza <miguel@ximian.com>
21468 * expression.cs: PropertyExpr::PropertyExpr: use work around the
21471 * typemanager.cs: Keep track here of our PropertyBuilders again to
21472 work around lameness in SRE.
21474 2001-10-11 Miguel de Icaza <miguel@ximian.com>
21476 * expression.cs (LValue::LValueResolve): New method in the
21477 interface, used to perform a second resolution pass for LValues.
21479 (This::DoResolve): Catch the use of this in static methods.
21481 (This::LValueResolve): Implement.
21483 (This::Store): Remove warning, assigning to `this' in structures
21486 (Invocation::Emit): Deal with invocation of
21487 methods on value types. We need to pass the address to structure
21488 methods rather than the object itself. (The equivalent code to
21489 emit "this" for structures leaves the entire structure on the
21490 stack instead of a pointer to it).
21492 (ParameterReference::DoResolve): Compute the real index for the
21493 argument based on whether the method takes or not a `this' pointer
21494 (ie, the method is static).
21496 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
21497 value types returned from functions when we need to invoke a
21498 method on the sturcture.
21501 2001-10-11 Ravi Pratap <ravi@ximian.com>
21503 * class.cs (TypeContainer::DefineType): Method to actually do the business of
21504 defining the type in the Modulebuilder or Typebuilder. This is to take
21505 care of nested types which need to be defined on the TypeBuilder using
21506 DefineNestedMethod.
21508 (TypeContainer::GetClassBases): Implement. Essentially the code from the
21509 methods in RootContext, only ported to be part of TypeContainer.
21511 (TypeContainer::GetInterfaceOrClass): Ditto.
21513 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
21515 * interface.cs (Interface::DefineInterface): New method. Does exactly
21516 what RootContext.CreateInterface did earlier, only it takes care of nested types
21519 (Interface::GetInterfaces): Move from RootContext here and port.
21521 (Interface::GetInterfaceByName): Same here.
21523 * rootcontext.cs (ResolveTree): Re-write.
21525 (PopulateTypes): Re-write.
21527 * class.cs (TypeContainer::Populate): Populate nested types too.
21528 (TypeContainer::Emit): Emit nested members too.
21530 * typemanager.cs (AddUserType): Do not make use of the FullName property,
21531 instead just use the name argument passed in as it is already fully
21534 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
21535 to TypeContainer mapping to see if a type is user-defined.
21537 * class.cs (TypeContainer::CloseType): Implement.
21539 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
21540 the default constructor.
21542 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
21545 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
21547 * interface.cs (CloseType): Create the type here.
21549 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
21552 Remove all the methods which are now in TypeContainer.
21554 2001-10-10 Ravi Pratap <ravi@ximian.com>
21556 * delegate.cs (Define): Re-write bits to define the delegate
21559 2001-10-10 Miguel de Icaza <miguel@ximian.com>
21561 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
21563 * expression.cs (ImplicitReferenceConversion): handle null as well
21564 as a source to convert to any reference type.
21566 * statement.cs (Return): Perform any implicit conversions to
21567 expected return type.
21569 Validate use of return statement.
21571 * codegen.cs (EmitContext): Pass the expected return type here.
21573 * class.cs (Method, Constructor, Property): Pass expected return
21574 type to EmitContext.
21576 2001-10-09 Miguel de Icaza <miguel@ximian.com>
21578 * expression.cs: Make DoResolve take an EmitContext instead of a
21581 Replaced `l' and `location' for `loc', for consistency.
21583 (Error, Warning): Remove unneeded Tc argument.
21585 * assign.cs, literal.cs, constant.cs: Update to new calling
21588 * codegen.cs: EmitContext now contains a flag indicating whether
21589 code is being generated in a static method or not.
21591 * cs-parser.jay: DecomposeQI, new function that replaces the old
21592 QualifiedIdentifier. Now we always decompose the assembled
21593 strings from qualified_identifier productions into a group of
21596 2001-10-08 Miguel de Icaza <miguel@ximian.com>
21598 * rootcontext.cs: Deal with field-less struct types correctly now
21599 by passing the size option to Define Type.
21601 * class.cs: Removed hack that created one static field.
21603 2001-10-07 Miguel de Icaza <miguel@ximian.com>
21605 * statement.cs: Moved most of the code generation here.
21607 2001-10-09 Ravi Pratap <ravi@ximian.com>
21609 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
21612 (ElementAccess): Remove useless bits for now - keep checks as the spec
21615 2001-10-08 Ravi Pratap <ravi@ximian.com>
21617 * expression.cs (ElementAccess::DoResolve): Remove my crap code
21618 and start performing checks according to the spec.
21620 2001-10-07 Ravi Pratap <ravi@ximian.com>
21622 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
21623 rank_specifiers instead.
21625 (rank_specifiers): Change the order in which the rank specifiers are stored
21627 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
21629 * expression.cs (ElementAccess): Implement the LValue interface too.
21631 2001-10-06 Ravi Pratap <ravi@ximian.com>
21633 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
21634 except that user defined conversions are not included.
21636 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
21637 perform the conversion of the return type, if necessary.
21639 (New::DoResolve): Check whether we are creating an array or an object
21640 and accordingly do the needful.
21642 (New::Emit): Same here.
21644 (New::DoResolve): Implement guts of array creation.
21646 (New::FormLookupType): Helper function.
21648 2001-10-07 Miguel de Icaza <miguel@ximian.com>
21650 * codegen.cs: Removed most of the code generation here, and move the
21651 corresponding code generation bits to the statement classes.
21653 Added support for try/catch/finalize and throw.
21655 * cs-parser.jay: Added support for try/catch/finalize.
21657 * class.cs: Catch static methods having the flags override,
21658 virtual or abstract.
21660 * expression.cs (UserCast): This user cast was not really doing
21661 what it was supposed to do. Which is to be born in fully resolved
21662 state. Parts of the resolution were being performed at Emit time!
21666 2001-10-05 Miguel de Icaza <miguel@ximian.com>
21668 * expression.cs: Implicity convert the result from UserCast.
21670 2001-10-05 Ravi Pratap <ravi@ximian.com>
21672 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
21673 prevented it from working correctly.
21675 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
21676 merely ConvertImplicit.
21678 2001-10-05 Miguel de Icaza <miguel@ximian.com>
21680 * typemanager.cs: Make the LookupTypeContainer function static,
21681 and not per-instance.
21683 * class.cs: Make static FindMembers (the one that takes a Type
21686 * codegen.cs: Add EmitForeach here.
21688 * cs-parser.jay: Make foreach a toplevel object instead of the
21689 inline expansion, as we need to perform semantic analysis on it.
21691 2001-10-05 Ravi Pratap <ravi@ximian.com>
21693 * expression.cs (Expression::ImplicitUserConversion): Rename to
21694 UserDefinedConversion.
21696 (Expression::UserDefinedConversion): Take an extra argument specifying
21697 whether we look for explicit user conversions too.
21699 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
21701 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
21703 (ExplicitUserConversion): Make it a call to UserDefinedConversion
21704 with the appropriate arguments.
21706 * cs-parser.jay (cast_expression): Record location too.
21708 * expression.cs (Cast): Record location info.
21710 (Expression::ConvertExplicit): Take location argument.
21712 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
21713 to determine if we are doing explicit conversions.
21715 (UserCast::Emit): Update accordingly.
21717 (Expression::ConvertExplicit): Report an error if everything fails.
21719 * ../errors/cs0030.cs : Add.
21721 2001-10-04 Miguel de Icaza <miguel@ximian.com>
21723 * modifiers.cs: If the ABSTRACT keyword is present, also set the
21724 virtual and newslot bits.
21726 * class.cs (TypeContainer::RegisterRequiredImplementations):
21727 Record methods we need.
21729 (TypeContainer::MakeKey): Helper function to make keys for
21730 MethodBases, since the Methodbase key is useless.
21732 (TypeContainer::Populate): Call RegisterRequiredImplementations
21733 before defining the methods.
21735 Create a mapping for method_builders_to_methods ahead of time
21736 instead of inside a tight loop.
21738 (::RequireMethods): Accept an object as the data to set into the
21739 hashtable so we can report interface vs abstract method mismatch.
21741 2001-10-03 Miguel de Icaza <miguel@ximian.com>
21743 * report.cs: Make all of it static.
21745 * rootcontext.cs: Drop object_type and value_type computations, as
21746 we have those in the TypeManager anyways.
21748 Drop report instance variable too, now it is a global.
21750 * driver.cs: Use try/catch on command line handling.
21752 Add --probe option to debug the error reporting system with a test
21755 * report.cs: Add support for exiting program when a probe
21756 condition is reached.
21758 2001-10-03 Ravi Pratap <ravi@ximian.com>
21760 * expression.cs (Binary::DoNumericPromotions): Fix the case when
21761 we do a forcible conversion regardless of type, to check if
21762 ForceConversion returns a null.
21764 (Binary::error19): Use location to report error.
21766 (Unary::error23): Use location here too.
21768 * ../errors/cs0019.cs : Check in.
21770 * ../errors/cs0023.cs : Check in.
21772 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
21773 case of a non-null MethodInfo object with a length of 0 !
21775 (Binary::ResolveOperator): Flag error if overload resolution fails to find
21776 an applicable member - according to the spec :-)
21777 Also fix logic to find members in base types.
21779 (Unary::ResolveOperator): Same here.
21781 (Unary::report23): Change name to error23 and make first argument a TypeContainer
21782 as I was getting thoroughly confused between this and error19 :-)
21784 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
21785 (::FindMostEncompassedType): Implement.
21786 (::FindMostEncompassingType): Implement.
21787 (::StandardConversionExists): Implement.
21789 (UserImplicitCast): Re-vamp. We now need info about most specific
21790 source and target types so that we can do the necessary conversions.
21792 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
21793 mathematical union with no duplicates.
21795 2001-10-03 Miguel de Icaza <miguel@ximian.com>
21797 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
21798 in order from base classes to child classes, so that we can in
21799 child classes look up in our parent for method names and
21800 attributes (required for handling abstract, virtual, new, override
21801 constructs: we need to instrospect our base class, and if we dont
21802 populate the classes in order, the introspection might be
21803 incorrect. For example, a method could query its parent before
21804 the parent has any methods and would determine that the parent has
21805 no abstract methods (while it could have had them)).
21807 (RootContext::CreateType): Record the order in which we define the
21810 2001-10-02 Miguel de Icaza <miguel@ximian.com>
21812 * class.cs (TypeContainer::Populate): Also method definitions can
21813 fail now, keep track of this.
21815 (TypeContainer::FindMembers): Implement support for
21816 DeclaredOnly/noDeclaredOnly flag.
21818 (Constructor::Emit) Return the ConstructorBuilder.
21820 (Method::Emit) Return the MethodBuilder.
21821 Check for abstract or virtual methods to be public.
21823 * rootcontext.cs (RootContext::CreateType): Register all the
21824 abstract methods required for the class to be complete and the
21825 interface methods that must be implemented.
21827 * cs-parser.jay: Report error 501 (method requires body if it is
21828 not marked abstract or extern).
21830 * expression.cs (TypeOf::Emit): Implement.
21832 * typemanager.cs: runtime_handle_type, new global type.
21834 * class.cs (Property::Emit): Generate code for properties.
21836 2001-10-02 Ravi Pratap <ravi@ximian.com>
21838 * expression.cs (Unary::ResolveOperator): Find operators on base type
21839 too - we now conform exactly to the spec.
21841 (Binary::ResolveOperator): Same here.
21843 * class.cs (Operator::Define): Fix minor quirk in the tests.
21845 * ../errors/cs0215.cs : Added.
21847 * ../errors/cs0556.cs : Added.
21849 * ../errors/cs0555.cs : Added.
21851 2001-10-01 Miguel de Icaza <miguel@ximian.com>
21853 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
21854 single integer which is really efficient
21856 2001-10-01 Ravi Pratap <ravi@ximian.com>
21858 * expression.cs (Expression::ImplicitUserConversion): Use location
21859 even in the case when we are examining True operators.
21861 * class.cs (Operator::Define): Perform extensive checks to conform
21862 with the rules for operator overloading in the spec.
21864 * expression.cs (Expression::ImplicitReferenceConversion): Implement
21865 some of the other conversions mentioned in the spec.
21867 * typemanager.cs (array_type): New static member for the System.Array built-in
21870 (cloneable_interface): For System.ICloneable interface.
21872 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
21873 we start resolving the tree and populating types.
21875 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
21877 2001-10-01 Miguel de Icaza <miguel@ximian.com>
21879 * expression.cs (Expression::ExprClassFromMemberInfo,
21880 Expression::Literalize): Create literal expressions from
21881 FieldInfos which are literals.
21883 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
21884 type casts, because they were wrong. The test suite in tests
21887 (ImplicitNumericConversion): ushort to ulong requires a widening
21890 Int32 constant to long requires widening cast as well.
21892 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
21893 for integers because the type on the stack is not i4.
21895 2001-09-30 Miguel de Icaza <miguel@ximian.com>
21897 * expression.cs (report118): require location argument.
21899 * parameter.cs: Do not dereference potential null value.
21901 * class.cs: Catch methods that lack the `new' keyword when
21902 overriding a name. Report warnings when `new' is used without
21903 anything being there to override.
21905 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
21907 * class.cs: Only add constructor to hashtable if it is non-null
21908 (as now constructors can fail on define).
21910 (TypeManager, Class, Struct): Take location arguments.
21912 Catch field instance initialization in structs as errors.
21914 accepting_filter: a new filter for FindMembers that is static so
21915 that we dont create an instance per invocation.
21917 (Constructor::Define): Catch errors where a struct constructor is
21920 * cs-parser.jay: Pass location information for various new
21923 * delegate.cs (Delegate): take a location argument.
21925 * driver.cs: Do not call EmitCode if there were problesm in the
21926 Definition of the types, as many Builders wont be there.
21928 * decl.cs (Decl::Decl): Require a location argument.
21930 * cs-tokenizer.cs: Handle properly hex constants that can not fit
21931 into integers, and find the most appropiate integer for it.
21933 * literal.cs: Implement ULongLiteral.
21935 * rootcontext.cs: Provide better information about the location of
21936 failure when CreateType fails.
21938 2001-09-29 Miguel de Icaza <miguel@ximian.com>
21940 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
21943 * expression.cs (Binary::CheckShiftArguments): Add missing type
21945 (Binary::ResolveOperator): Add type to the logical and and logical
21946 or, Bitwise And/Or and Exclusive Or code paths, it was missing
21949 (Binary::DoNumericPromotions): In the case where either argument
21950 is ulong (and most signed types combined with ulong cause an
21951 error) perform implicit integer constant conversions as well.
21953 2001-09-28 Miguel de Icaza <miguel@ximian.com>
21955 * expression.cs (UserImplicitCast): Method should always be
21957 (Invocation::BetterConversion): Simplified test for IntLiteral.
21959 (Expression::ImplicitNumericConversion): Split this routine out.
21960 Put the code that performs implicit constant integer conversions
21963 (Expression::Resolve): Become a wrapper around DoResolve so we can
21964 check eclass and type being set after resolve.
21966 (Invocation::Badness): Remove this dead function
21968 (Binary::ResolveOperator): Do not compute the expensive argumnets
21969 unless we have a union for it.
21971 (Probe::Emit): Is needs to do an isinst and then
21972 compare against null.
21974 (::CanConvert): Added Location argument. If the Location argument
21975 is null (Location.Null), then we do not report errors. This is
21976 used by the `probe' mechanism of the Explicit conversion. We do
21977 not want to generate an error for something that the user
21978 explicitly requested to be casted. But the pipeline for an
21979 explicit cast first tests for potential implicit casts.
21981 So for now, if the Location is null, it means `Probe only' to
21982 avoid adding another argument. Might have to revise this
21985 (ClassCast): New class used to type cast objects into arbitrary
21986 classes (used in Explicit Reference Conversions).
21988 Implement `as' as well.
21990 Reverted all the patches from Ravi below: they were broken:
21992 * The use of `level' as a mechanism to stop recursive
21993 invocations is wrong. That was there just to catch the
21994 bug with a strack trace but not as a way of addressing
21997 To fix the problem we have to *understand* what is going
21998 on and the interactions and come up with a plan, not
21999 just get things going.
22001 * The use of the type conversion cache that I proposed
22002 last night had an open topic: How does this work across
22003 protection domains. A user defined conversion might not
22004 be public in the location where we are applying the
22005 conversion, a different conversion might be selected
22006 (ie, private A->B (better) but public B->A (worse),
22007 inside A, A->B applies, but outside it, B->A will
22010 * On top of that (ie, even if the above is solved),
22011 conversions in a cache need to be abstract. Ie, `To
22012 convert from an Int to a Short use an OpcodeCast', not
22013 `To convert from an Int to a Short use the OpcodeCast on
22014 the variable 5' (which is what this patch was doing).
22016 2001-09-28 Ravi Pratap <ravi@ximian.com>
22018 * expression.cs (Invocation::ConversionExists): Re-write to use
22019 the conversion cache
22021 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
22022 cache all conversions done, not just user-defined ones.
22024 (Invocation::BetterConversion): The real culprit. Use ConversionExists
22025 to determine if a conversion exists instead of acutually trying to
22026 perform the conversion. It's faster too.
22028 (Expression::ConvertExplicit): Modify to use ConversionExists to check
22029 and only then attempt the implicit conversion.
22031 2001-09-28 Ravi Pratap <ravi@ximian.com>
22033 * expression.cs (ConvertImplicit): Use a cache for conversions
22034 already found. Check level of recursion and bail out if necessary.
22036 2001-09-28 Miguel de Icaza <miguel@ximian.com>
22038 * typemanager.cs (string_concat_string_string, string_concat_object_object):
22039 Export standard methods that we expect for string operations.
22041 * statement.cs (Block::UsageWarning): Track usage of variables and
22042 report the errors for not used variables.
22044 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
22047 2001-09-27 Miguel de Icaza <miguel@ximian.com>
22049 * codegen.cs: remove unnneded code
22051 * expression.cs: Removed BuiltinTypeAccess class
22053 Fix the order in which implicit conversions are
22056 The previous fixed dropped support for boxed conversions (adding a
22057 test to the test suite now)
22059 (UserImplicitCast::CanConvert): Remove test for source being null,
22060 that code is broken. We should not feed a null to begin with, if
22061 we do, then we should track the bug where the problem originates
22062 and not try to cover it up here.
22064 Return a resolved expression of type UserImplicitCast on success
22065 rather than true/false. Ravi: this is what I was talking about,
22066 the pattern is to use a static method as a "constructor" for
22069 Also, do not create arguments until the very last minute,
22070 otherwise we always create the arguments even for lookups that
22071 will never be performed.
22073 (UserImplicitCast::Resolve): Eliminate, objects of type
22074 UserImplicitCast are born in a fully resolved state.
22076 * typemanager.cs (InitCoreTypes): Init also value_type
22077 (System.ValueType).
22079 * expression.cs (Cast::Resolve): First resolve the child expression.
22081 (LValue): Add new method AddressOf to be used by
22084 Change the argument of Store to take an EmitContext instead of an
22085 ILGenerator, because things like FieldExpr need to be able to call
22086 their children expression to generate the instance code.
22088 (Expression::Error, Expression::Warning): Sugar functions for
22091 (Expression::MemberLookup): Accept a TypeContainer instead of a
22092 Report as the first argument.
22094 (Expression::ResolvePrimary): Killed. I still want to improve
22095 this as currently the code is just not right.
22097 (Expression::ResolveMemberAccess): Simplify, but it is still
22100 (Unary::Resolve): Catch errors in AddressOf operators.
22102 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
22103 index to a byte for the short-version, or the compiler will choose
22104 the wrong Emit call, which generates the wrong data.
22106 (ParameterReference::Emit, ::Store): same.
22108 (FieldExpr::AddressOf): Implement.
22110 * typemanager.cs: TypeManager: made public variable instead of
22113 * driver.cs: document --fatal.
22115 * report.cs (ErrorMessage, WarningMessage): new names for the old
22116 Error and Warning classes.
22118 * cs-parser.jay (member_access): Turn built-in access to types
22119 into a normal simplename
22121 2001-09-27 Ravi Pratap <ravi@ximian.com>
22123 * expression.cs (Invocation::BetterConversion): Fix to cope
22124 with q being null, since this was introducing a bug.
22126 * expression.cs (ConvertImplicit): Do built-in conversions first.
22128 2001-09-27 Ravi Pratap <ravi@ximian.com>
22130 * expression.cs (UserImplicitCast::Resolve): Fix bug.
22132 2001-09-27 Ravi Pratap <ravi@ximian.com>
22134 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
22135 I had introduced long ago (what's new ?).
22137 * expression.cs (UserImplicitCast::CanConvert): Static method to do
22138 the work of all the checking.
22139 (ConvertImplicit): Call CanConvert and only then create object if necessary.
22140 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
22142 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
22143 that is the right way.
22145 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
22146 overloading resolution. Use everywhere instead of cutting and pasting code.
22148 (Binary::ResolveOperator): Use MakeUnionSet.
22150 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
22151 we have to convert to bool types. Not complete yet.
22153 2001-09-27 Miguel de Icaza <miguel@ximian.com>
22155 * typemanager.cs (TypeManager::CSharpName): support ushort.
22157 * expression.cs (Expression::TryImplicitIntConversion): Attempts
22158 to provide an expression that performsn an implicit constant int
22159 conversion (section 6.1.6).
22160 (Expression::ConvertImplicitRequired): Reworked to include
22161 implicit constant expression conversions.
22163 (Expression::ConvertNumericExplicit): Finished.
22165 (Invocation::Emit): If InstanceExpression is null, then it means
22166 that we perform a call on this.
22168 2001-09-26 Miguel de Icaza <miguel@ximian.com>
22170 * expression.cs (Unary::Emit): Remove some dead code.
22171 (Probe): Implement Resolve and Emit for `is'.
22172 (Expression::ConvertImplicitRequired): Attempt to do constant
22173 expression conversions here. Maybe should be moved to
22174 ConvertImplicit, but I am not sure.
22175 (Expression::ImplicitLongConstantConversionPossible,
22176 Expression::ImplicitIntConstantConversionPossible): New functions
22177 that tell whether is it possible to apply an implicit constant
22178 expression conversion.
22180 (ConvertNumericExplicit): Started work on explicit numeric
22183 * cs-parser.jay: Update operator constants.
22185 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
22186 (Parameters::GetSignature): Hook up VerifyArgs here.
22187 (Parameters::VerifyArgs): Verifies that no two arguments have the
22190 * class.cs (Operator): Update the operator names to reflect the
22191 ones that the spec expects (as we are just stringizing the
22194 * expression.cs (Unary::ResolveOperator): Fix bug: Use
22195 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
22196 previous usage did only work for our methods.
22197 (Expression::ConvertImplicit): Handle decimal implicit numeric
22198 conversions as well.
22199 (Expression::InternalTypeConstructor): Used to invoke constructors
22200 on internal types for default promotions.
22202 (Unary::Emit): Implement special handling for the pre/post
22203 increment/decrement for overloaded operators, as they need to have
22204 the same semantics as the other operators.
22206 (Binary::ResolveOperator): ditto.
22207 (Invocation::ConversionExists): ditto.
22208 (UserImplicitCast::Resolve): ditto.
22210 2001-09-26 Ravi Pratap <ravi@ximian.com>
22212 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
22213 operator, return after emitting body. Regression tests pass again !
22215 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
22216 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
22217 (Invocation::OverloadResolve): Ditto.
22218 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
22220 * everywhere : update calls to the above methods accordingly.
22222 2001-09-26 Miguel de Icaza <miguel@ximian.com>
22224 * assign.cs (Assign): Make it inherit from ExpressionStatement.
22226 * expression.cs (ExpressionStatement): New base class used for
22227 expressions that can appear in statements, so that we can provide
22228 an alternate path to generate expression that do not leave a value
22231 (Expression::Emit, and all the derivatives): We no longer return
22232 whether a value is left on the stack or not. Every expression
22233 after being emitted leaves a single value on the stack.
22235 * codegen.cs (EmitContext::EmitStatementExpression): Use the
22236 facilties of ExpressionStatement if possible.
22238 * cs-parser.jay: Update statement_expression.
22240 2001-09-25 Miguel de Icaza <miguel@ximian.com>
22242 * driver.cs: Change the wording of message
22244 2001-09-25 Ravi Pratap <ravi@ximian.com>
22246 * expression.cs (Binary::ResolveOperator): Had forgottten to set
22247 the type of the expression to the return type of the method if
22248 we have an overloaded operator match ! The regression tests pass again !
22249 (Unary::ResolveOperator): Ditto.
22251 * expression.cs (Invocation::ConversionExists): Correct the member lookup
22252 to find "op_Implicit", not "implicit" ;-)
22253 (UserImplicitCast): New class to take care of user-defined implicit conversions.
22254 (ConvertImplicit, ForceConversion): Take TypeContainer argument
22256 * everywhere : Correct calls to the above accordingly.
22258 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
22259 (ConvertImplicit): Do user-defined conversion if it exists.
22261 2001-09-24 Miguel de Icaza <miguel@ximian.com>
22263 * assign.cs: track location.
22264 (Resolve): Use implicit conversions on assignment.
22266 * literal.cs: Oops. Not good, Emit of short access values should
22267 pass (Bytes) or the wrong argument will be selected.
22269 * expression.cs (Unary::Emit): Emit code for -expr.
22271 (Unary::ResolveOperator): Handle `Substract' for non-constants
22272 (substract from zero from the non-constants).
22273 Deal with Doubles as well.
22275 (Expression::ConvertImplicitRequired): New routine that reports an
22276 error if no implicit conversion exists.
22278 (Invocation::OverloadResolve): Store the converted implicit
22279 expressions if we make them
22281 2001-09-24 Ravi Pratap <ravi@ximian.com>
22283 * class.cs (ConstructorInitializer): Take a Location argument.
22284 (ConstructorBaseInitializer): Same here.
22285 (ConstructorThisInitializer): Same here.
22287 * cs-parser.jay : Update all calls accordingly.
22289 * expression.cs (Unary, Binary, New): Take location argument.
22290 Update accordingly everywhere.
22292 * cs-parser.jay : Update all calls to the above to take a location
22295 * class.cs : Ditto.
22297 2001-09-24 Ravi Pratap <ravi@ximian.com>
22299 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
22300 (Invocation::BetterConversion): Same here
22301 (Invocation::ConversionExists): Ditto.
22303 (Invocation::ConversionExists): Implement.
22305 2001-09-22 Ravi Pratap <ravi@ximian.com>
22307 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
22308 Also take an additional TypeContainer argument.
22310 * All over : Pass in TypeContainer as argument to OverloadResolve.
22312 * typemanager.cs (CSharpName): Update to check for the string type and return
22315 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
22318 2001-09-21 Ravi Pratap <ravi@ximian.com>
22320 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
22321 (Invocation::BetterFunction): Implement.
22322 (Invocation::BetterConversion): Implement.
22323 (Invocation::ConversionExists): Skeleton, no implementation yet.
22325 Okay, things work fine !
22327 2001-09-21 Miguel de Icaza <miguel@ximian.com>
22329 * typemanager.cs: declare and load enum_type, delegate_type and
22332 * expression.cs (Expression::Emit): Now emit returns a value that
22333 tells whether a value is left on the stack or not. This strategy
22334 might be reveted tomorrow with a mechanism that would address
22335 multiple assignments.
22336 (Expression::report118): Utility routine to report mismatches on
22339 (Unary::Report23): Report impossible type/operator combination
22342 (Unary::IsIncrementableNumber): Whether the type can be
22343 incremented or decremented with add.
22344 (Unary::ResolveOperator): Also allow enumerations to be bitwise
22346 (Unary::ResolveOperator): Implement ++, !, ~,
22348 (Invocation::Emit): Deal with new Emit convetion.
22350 * All Expression derivatives: Updated their Emit method to return
22351 whether they leave values on the stack or not.
22353 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
22354 stack for expressions that are statements.
22356 2001-09-20 Miguel de Icaza <miguel@ximian.com>
22358 * expression.cs (LValue): New interface. Must be implemented by
22360 (LocalVariableReference, ParameterReference, FieldExpr): Implement
22363 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
22364 interface for generating code, simplifies the code.
22366 2001-09-20 Ravi Pratap <ravi@ximian.com>
22368 * expression.cs (everywhere): Comment out return statements in ::Resolve
22369 methods to avoid the warnings.
22371 2001-09-20 Miguel de Icaza <miguel@ximian.com>
22373 * driver.cs (parse): Report error 2001 if we can not open the
22376 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
22379 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
22382 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
22383 otherwise nested blocks end up with the same index.
22385 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
22387 * expression.cs: Instead of having FIXMEs in the Resolve
22388 functions, throw exceptions so it is obvious that we are facing a
22391 * cs-parser.jay (invocation_expression): Pass Location information.
22393 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
22394 Use a basename for those routines because .NET does not like paths
22397 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
22400 2001-09-19 Miguel de Icaza <miguel@ximian.com>
22402 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
22403 are loading the correct data types (throws an exception if not).
22404 (TypeManager::InitCoreTypes): Use CoreLookupType
22406 * expression.cs (Unary::ResolveOperator): return the child
22407 expression for expressions which are just +expr.
22408 (Unary::ResolveOperator): Return negative literals for -LITERAL
22409 expressions (otherwise they are Unary {Literal}).
22410 (Invocation::Badness): Take into account `Implicit constant
22411 expression conversions'.
22413 * literal.cs (LongLiteral): Implement long literal class.
22414 (IntLiteral): export the `Value' of the intliteral.
22416 2001-09-19 Ravi Pratap <ravi@ximian.com>
22418 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
22420 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
22421 instead of 'Operator'
22423 * expression.cs (Binary::ResolveOperator): Update accordingly.
22424 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
22427 * cs-parser.jay (unary_expression): Update to use the new names.
22429 * gen-treedump.cs (GetUnary): Same here.
22431 * expression.cs (Unary::Resolve): Implement.
22432 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
22433 operators are found instead of making noise ;-)
22434 (Unary::ResolveOperator): New method to do precisely the same thing which
22435 Binary::ResolveOperator does for Binary expressions.
22436 (Unary.method, .Arguments): Add.
22437 (Unary::OperName): Implement.
22438 (Unary::ForceConversion): Copy and Paste !
22440 * class.cs (Operator::Define): Fix a small bug for the case when we have
22443 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
22444 for the inbuilt operators. Only overloading works for now ;-)
22446 2001-09-18 Miguel de Icaza <miguel@ximian.com>
22448 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
22449 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
22451 * expression.cs (This::Emit): Implement.
22452 (This::Resolve): Implement.
22453 (TypeOf:Resolve): Implement.
22454 (Expression::ResolveSimpleName): Add an implicit this to instance
22456 (MemberAccess::Resolve): Deal with Parameters and Fields.
22457 Bind instance variable to Field expressions.
22458 (FieldExpr::Instance): New field used to track the expression that
22459 represents the object instance.
22460 (FieldExpr::Resolve): Track potential errors from MemberLookup not
22462 (FieldExpr::Emit): Implement.
22464 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
22465 the last instruction contains a return opcode to avoid generating
22466 the last `ret' instruction (this generates correct code, and it is
22467 nice to pass the peverify output).
22469 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
22470 initializer for static and instance variables.
22471 (Constructor::Emit): Allow initializer to be null in the case of
22472 static constructors. Only emit initializer for instance
22475 (TypeContainer::FindMembers): Return a null array if there are no
22478 Also fix the code for the MemberTypes.Method branch, as it was not
22479 scanning that for operators (or tried to access null variables before).
22481 * assign.cs (Assign::Emit): Handle instance and static fields.
22485 * driver.cs: Stop compilation if there are parse errors.
22487 * cs-parser.jay (constructor_declaration): Provide default base
22488 initializer for non-static constructors.
22489 (constructor_declarator): Do not provide a default base
22490 initializers if none was specified.
22491 Catch the fact that constructors should not have parameters.
22493 * class.cs: Do not emit parent class initializers for static
22494 constructors, that should be flagged as an error.
22496 2001-09-18 Ravi Pratap <ravi@ximian.com>
22498 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
22499 Move back code into TypeContainer::Populate.
22501 2001-09-18 Ravi Pratap <ravi@ximian.com>
22503 * class.cs (TypeContainer::AddConstructor): Fix the check to
22504 compare against Name, not Basename.
22505 (Operator::OpType): Change Plus and Minus to Add and Subtract.
22507 * cs-parser.jay : Update accordingly.
22509 * class.cs (TypeContainer::FindMembers): For the case where we are searching
22510 for methods, don't forget to look into the operators too.
22511 (RegisterMethodBuilder): Helper method to take care of this for
22512 methods, constructors and operators.
22513 (Operator::Define): Completely revamp.
22514 (Operator.OperatorMethod, MethodName): New fields.
22515 (TypeContainer::Populate): Move the registering of builders into
22516 RegisterMethodBuilder.
22517 (Operator::Emit): Re-write.
22519 * expression.cs (Binary::Emit): Comment out code path to emit method
22520 invocation stuff for the case when we have a user defined operator. I am
22521 just not able to get it right !
22523 2001-09-17 Miguel de Icaza <miguel@ximian.com>
22525 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
22528 (Expression::MemberLookup): Provide a version that allows to
22529 specify the MemberTypes and BindingFlags.
22531 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
22532 so it was not fetching variable information from outer blocks.
22534 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
22535 Beforefieldinit as it was buggy.
22537 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
22538 that Ravi put here.
22540 * class.cs (Constructor::Emit): Only emit if block is not null.
22541 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
22542 deal with this by semantically definining it as if the user had
22545 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
22546 constructors as we now "emit" them at a higher level.
22548 (TypeContainer::DefineDefaultConstructor): Used to define the
22549 default constructors if none was provided.
22551 (ConstructorInitializer): Add methods Resolve and Emit.
22553 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
22555 2001-09-17 Ravi Pratap <ravi@ximian.com>
22557 * class.cs (TypeContainer::EmitDefaultConstructor): Register
22558 the default constructor builder with our hashtable for methodbuilders
22561 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
22562 and argument_count is 0 in which case we have a match.
22563 (Binary::ResolveOperator): More null checking and miscellaneous coding
22566 2001-09-17 Ravi Pratap <ravi@ximian.com>
22568 * rootcontext.cs (IsNameSpace): Compare against null.
22570 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
22572 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
22573 and Unary::Operator.
22575 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
22578 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
22579 we have overloaded operators.
22580 (Binary::ResolveOperator): Implement the part which does the operator overload
22583 * class.cs (Operator::Emit): Implement.
22584 (TypeContainer::Emit): Emit the operators we have too.
22586 * expression.cs (Binary::Emit): Update to emit the appropriate code for
22587 the case when we have a user-defined operator.
22589 2001-09-17 Miguel de Icaza <miguel@ximian.com>
22591 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
22593 2001-09-16 Ravi Pratap <ravi@ximian.com>
22595 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
22596 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
22597 (Constructor::Emit): Implement.
22598 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
22599 if we have no work to do.
22600 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
22603 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
22604 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
22606 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
22609 2001-09-15 Ravi Pratap <ravi@ximian.com>
22611 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
22613 (Tree::RecordNamespace): Method to do what the name says ;-)
22614 (Tree::Namespaces): Property to get at the namespaces hashtable.
22616 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
22619 * rootcontext.cs (IsNamespace): Fixed it :-)
22621 2001-09-14 Miguel de Icaza <miguel@ximian.com>
22623 * class.cs (TypeContainer::FindMembers): Add support for
22625 (MethodCore): New class that encapsulates both the shared aspects
22626 of a Constructor and a Method.
22627 (Method, Constructor): Factored pieces into MethodCore.
22629 * driver.cs: Added --fatal which makes errors throw exceptions.
22630 Load System assembly as well as part of the standard library.
22632 * report.cs: Allow throwing exceptions on errors for debugging.
22634 * modifiers.cs: Do not use `parent', instead use the real type
22635 container to evaluate permission settings.
22637 * class.cs: Put Ravi's patch back in. He is right, and we will
22638 have to cope with the
22640 2001-09-14 Ravi Pratap <ravi@ximian.com>
22642 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
22643 FamORAssem, not FamANDAssem.
22645 2001-09-14 Miguel de Icaza <miguel@ximian.com>
22647 * driver.cs: Added --parse option that only parses its input files
22650 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
22651 incorrect. IsTopLevel is not used to tell whether an object is
22652 root_types or not (that can be achieved by testing this ==
22653 root_types). But to see if this is a top-level *class* (not
22654 necessarly our "toplevel" container).
22656 2001-09-14 Ravi Pratap <ravi@ximian.com>
22658 * enum.cs (Enum::Define): Modify to call the Lookup method on the
22659 parent instead of a direct call to GetType.
22661 2001-09-14 Ravi Pratap <ravi@ximian.com>
22663 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
22664 Modifiers.TypeAttr. This should just be a call to that method.
22666 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
22667 object so that we can determine if we are top-level or not.
22669 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
22672 * enum.cs (Enum::Define): Ditto.
22674 * modifiers.cs (FieldAttr): Re-write.
22676 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
22677 (TypeContainer::HaveStaticConstructor): New property to provide access
22678 to precisely that info.
22680 * modifiers.cs (MethodAttr): Re-write.
22681 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
22683 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
22684 of top-level types as claimed.
22686 2001-09-13 Miguel de Icaza <miguel@ximian.com>
22688 * expression.cs (MemberLookup): Fruitless attempt to lookup
22689 constructors. Maybe I need to emit default constructors? That
22690 might be it (currently .NET emits this for me automatically).
22691 (Invocation::OverloadResolve): Cope with Arguments == null.
22692 (Invocation::EmitArguments): new function, shared by the new
22693 constructor and us.
22694 (Invocation::Emit): Handle static and instance methods. Emit
22695 proper call instruction for virtual or non-virtual invocations.
22696 (New::Emit): Implement.
22697 (New::Resolve): Implement.
22698 (MemberAccess:Resolve): Implement.
22699 (MethodGroupExpr::InstanceExpression): used conforming to the spec
22700 to track instances.
22701 (FieldExpr::Resolve): Set type.
22703 * support.cs: Handle empty arguments.
22705 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
22706 SimpleLookup): Auxiliary routines to help parse a qualifier
22709 Update qualifier_identifier rule.
22711 * codegen.cs: Removed debugging messages.
22713 * class.cs: Make this a global thing, this acts just as a "key" to
22714 objects that we might have around.
22716 (Populate): Only initialize method_builders_to_methods once.
22718 * expression.cs (PropertyExpr): Initialize type from the
22721 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
22722 Resolve pattern. Attempt to implicitly convert value to boolean.
22725 * expression.cs: Set the type for the int32/int32 argument case.
22726 (Binary::ResolveOperator): Set the return type to boolean for
22727 comparission operators
22729 * typemanager.cs: Remove debugging print code.
22731 (Invocation::Resolve): resolve type.
22733 * class.cs: Allocate a MemberInfo of the correct size, as the code
22734 elsewhere depends on the test to reflect the correct contents.
22736 (Method::) Keep track of parameters, due to System.Reflection holes
22738 (TypeContainer::Populate): Keep track of MethodBuilders to Method
22741 (TypeContainer::FindMembers): Use ArrayList and then copy an array
22742 of the exact size and return that.
22744 (Class::LookupMethodByBuilder): New function that maps
22745 MethodBuilders to its methods. Required to locate the information
22746 on methods because System.Reflection bit us again.
22748 * support.cs: New file, contains an interface ParameterData and
22749 two implementations: ReflectionParameters and InternalParameters
22750 used to access Parameter information. We will need to grow this
22753 * expression.cs (Invocation::GetParameterData): implement a cache
22754 and a wrapper around the ParameterData creation for methods.
22755 (Invocation::OverloadResolve): Use new code.
22757 2001-09-13 Ravi Pratap <ravi@ximian.com>
22759 * class.cs (TypeContainer::EmitField): Remove and move into
22760 (Field::Define): here and modify accordingly.
22761 (Field.FieldBuilder): New member.
22762 (TypeContainer::Populate): Update accordingly.
22763 (TypeContainer::FindMembers): Implement.
22765 2001-09-13 Miguel de Icaza <miguel@ximian.com>
22767 * statement.cs: (VariableInfo::VariableType): New field to be
22768 initialized with the full type once it is resolved.
22770 2001-09-12 Miguel de Icaza <miguel@ximian.com>
22772 * parameter.cs (GetParameterInfo): Use a type cache to compute
22773 things only once, and to reuse this information
22775 * expression.cs (LocalVariableReference::Emit): Implement.
22776 (OpcodeCast::Emit): fix.
22778 (ParameterReference::Resolve): Implement.
22779 (ParameterReference::Emit): Implement.
22781 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
22782 that are expressions need to stay as Expressions.
22784 * typemanager.cs (CSharpName): Returns the C# name of a type if
22787 * expression.cs (Expression::ConvertImplicit): New function that
22788 implements implicit type conversions.
22790 (Expression::ImplicitReferenceConversion): Implements implicit
22791 reference conversions.
22793 (EmptyCast): New type for transparent casts.
22795 (OpcodeCast): New type for casts of types that are performed with
22796 a sequence of bytecodes.
22798 (BoxedCast): New type used for casting value types into reference
22799 types. Emits a box opcode.
22801 (Binary::DoNumericPromotions): Implements numeric promotions of
22802 and computation of the Binary::Type.
22804 (Binary::EmitBranchable): Optimization.
22806 (Binary::Emit): Implement code emission for expressions.
22808 * typemanager.cs (TypeManager): Added two new core types: sbyte
22811 2001-09-12 Ravi Pratap <ravi@ximian.com>
22813 * class.cs (TypeContainer::FindMembers): Method which does exactly
22814 what Type.FindMembers does, only we don't have to use reflection. No
22815 implementation yet.
22817 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
22818 typecontainer objects as we need to get at them.
22819 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
22821 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
22822 typecontainer object.
22824 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
22825 of just a Report object.
22827 2001-09-11 Ravi Pratap <ravi@ximian.com>
22829 * class.cs (Event::Define): Go back to using the prefixes "add_" and
22831 (TypeContainer::Populate): Now define the delegates of the type too.
22832 (TypeContainer.Delegates): Property to access the list of delegates defined
22835 * delegates.cs (Delegate::Define): Implement partially.
22837 * modifiers.cs (TypeAttr): Handle more flags.
22839 2001-09-11 Ravi Pratap <ravi@ximian.com>
22841 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
22843 (Operator::Define): Re-write logic to get types by using the LookupType method
22844 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
22845 (Indexer::Define): Ditto.
22846 (Event::Define): Ditto.
22847 (Property::Define): Ditto.
22849 2001-09-10 Ravi Pratap <ravi@ximian.com>
22851 * class.cs (TypeContainer::Populate): Now define operators too.
22852 (TypeContainer.Operators): New property to access the list of operators
22854 (Operator.OperatorMethodBuilder): New member to hold the method builder
22855 for the operator we are defining.
22856 (Operator::Define): Implement.
22858 2001-09-10 Ravi Pratap <ravi@ximian.com>
22860 * class.cs (Event::Define): Make the prefixes of the accessor methods
22861 addOn_ and removeOn_
22863 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
22864 of the location being passed in too. Ideally, this should go later since all
22865 error reporting should be done through the Report object.
22867 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
22868 (Populate): Iterate thru the indexers we have and define them too.
22869 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
22870 for the get and set accessors.
22871 (Indexer::Define): Implement.
22873 2001-09-09 Miguel de Icaza <miguel@ximian.com>
22875 * expression.cs (Binary::Resolve): Beginning of it. I scratched
22876 my previous implementation, did not work.
22878 * typemanager.cs: Add a couple of missing types (the longs).
22880 * literal.cs: Use TypeManager.bool_type instead of getting it.
22882 * expression.cs (EventExpr): New kind of expressions.
22883 (Expressio::ExprClassFromMemberInfo): finish
22885 2001-09-08 Miguel de Icaza <miguel@ximian.com>
22887 * assign.cs: Emit stores to static fields differently.
22889 2001-09-08 Ravi Pratap <ravi@ximian.com>
22891 * Merge in changes and adjust code to tackle conflicts. Backed out my
22892 code in Assign::Resolve ;-)
22894 2001-09-08 Ravi Pratap <ravi@ximian.com>
22896 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
22897 instead Report.Error and also pass in the location.
22898 (CSharpParser::Lexer): New readonly property to return the reference
22899 to the Tokenizer object.
22900 (declare_local_variables): Use Report.Error with location instead of plain
22904 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
22905 (Operator.CheckBinaryOperator): Ditto.
22907 * cs-parser.jay (operator_declarator): Update accordingly.
22909 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
22910 (CheckBinaryOperator): Same here.
22912 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
22913 on the name without any prefixes of namespace names etc. This is because we
22914 already might have something already fully qualified like
22915 'System.Console.WriteLine'
22917 * assign.cs (Resolve): Begin implementation. Stuck ;-)
22919 2001-09-07 Ravi Pratap <ravi@ximian.com>
22921 * cs-tokenizer.cs (location): Return a string which also contains
22924 * expression.cs (ElementAccess): New class for expressions of the
22925 type 'element access.'
22926 (BaseAccess): New class for expressions of the type 'base access.'
22927 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
22930 * cs-parser.jay (element_access): Implement action.
22931 (base_access): Implement actions.
22932 (checked_expression, unchecked_expression): Implement.
22934 * cs-parser.jay (local_variable_type): Correct and implement.
22935 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
22937 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
22939 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
22940 name and the specifiers.
22942 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
22944 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
22945 making them all public ;-)
22947 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
22950 2001-09-07 Miguel de Icaza <miguel@ximian.com>
22952 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
22954 (FieldExpr, PropertyExprs): New resolved expressions.
22955 (SimpleName::MemberStaticCheck): Perform static checks for access
22956 to non-static fields on static methods. Maybe this should be
22957 generalized for MemberAccesses.
22958 (SimpleName::ResolveSimpleName): More work on simple name
22961 * cs-parser.jay (primary_expression/qualified_identifier): track
22962 the parameter index.
22964 * codegen.cs (CodeGen::Save): Catch save exception, report error.
22965 (EmitContext::EmitBoolExpression): Chain to expression generation
22966 instead of temporary hack.
22967 (::EmitStatementExpression): Put generic expression code generation.
22969 * assign.cs (Assign::Emit): Implement variable assignments to
22970 local variables, parameters and fields.
22972 2001-09-06 Miguel de Icaza <miguel@ximian.com>
22974 * statement.cs (Block::GetVariableInfo): New method, returns the
22975 VariableInfo for a variable name in a block.
22976 (Block::GetVariableType): Implement in terms of GetVariableInfo
22978 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
22979 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
22981 2001-09-06 Ravi Pratap <ravi@ximian.com>
22983 * cs-parser.jay (operator_declaration): Continue on my quest : update
22984 to take attributes argument.
22985 (event_declaration): Ditto.
22986 (enum_declaration): Ditto.
22987 (indexer_declaration): Ditto.
22989 * class.cs (Operator::Operator): Update constructor accordingly.
22990 (Event::Event): Ditto.
22992 * delegate.cs (Delegate::Delegate): Same here.
22994 * enum.cs (Enum::Enum): Same here.
22996 2001-09-05 Ravi Pratap <ravi@ximian.com>
22998 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
23000 * ../tests/cs0658.cs : New file to demonstrate error 0658.
23002 * attribute.cs (Attributes): New class to encapsulate all attributes which were
23003 being passed around as an arraylist.
23004 (Attributes::AddAttribute): Method to add attribute sections.
23006 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
23007 (struct_declaration): Update accordingly.
23008 (constant_declaration): Update.
23009 (field_declaration): Update.
23010 (method_header): Update.
23011 (fixed_parameter): Update.
23012 (parameter_array): Ditto.
23013 (property_declaration): Ditto.
23014 (destructor_declaration): Ditto.
23016 * class.cs (Struct::Struct): Update constructors accordingly.
23017 (Class::Class): Ditto.
23018 (Field::Field): Ditto.
23019 (Method::Method): Ditto.
23020 (Property::Property): Ditto.
23021 (TypeContainer::OptAttribute): update property's return type.
23023 * interface.cs (Interface.opt_attributes): New member.
23024 (Interface::Interface): Update to take the extra Attributes argument.
23026 * parameter.cs (Parameter::Parameter): Ditto.
23028 * constant.cs (Constant::Constant): Ditto.
23030 * interface.cs (InterfaceMemberBase): New OptAttributes field.
23031 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
23032 the attributes as a parameter.
23033 (InterfaceProperty): Update constructor call.
23034 (InterfaceEvent): Ditto.
23035 (InterfaceMethod): Ditto.
23036 (InterfaceIndexer): Ditto.
23038 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
23039 pass the attributes too.
23040 (interface_event_declaration): Ditto.
23041 (interface_property_declaration): Ditto.
23042 (interface_method_declaration): Ditto.
23043 (interface_declaration): Ditto.
23045 2001-09-05 Miguel de Icaza <miguel@ximian.com>
23047 * class.cs (Method::Define): Track the "static Main" definition to
23048 create an entry point.
23050 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
23051 EntryPoint if we find it.
23053 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
23054 (EmitContext::ig): Make this variable public.
23056 * driver.cs: Make the default output file be the first file name
23057 with the .exe extension.
23059 Detect empty compilations
23061 Handle various kinds of output targets. Handle --target and
23062 rename -t to --dumper.
23064 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
23065 methods inherited from Expression return now an Expression. This
23066 will is used during the tree rewriting as we resolve them during
23069 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
23070 the spec. Missing entirely is the information about
23071 accessability of elements of it.
23073 (Expression::ExprClassFromMemberInfo): New constructor for
23074 Expressions that creates a fully initialized Expression based on
23075 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
23078 (Invocation::Resolve): Begin implementing resolution of invocations.
23080 * literal.cs (StringLiteral): Implement Emit.
23082 2001-09-05 Ravi Pratap <ravi@ximian.com>
23084 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
23087 2001-09-04 Ravi Pratap <ravi@ximian.com>
23089 * cs-parser.jay (attribute_arguments): Implement actions.
23090 (attribute): Fix bug in production. Implement action.
23091 (attribute_list): Implement.
23092 (attribute_target): Implement.
23093 (attribute_target_specifier, opt_target_specifier): Implement
23094 (CheckAttributeTarget): New method to check if the attribute target
23096 (attribute_section): Implement.
23097 (opt_attributes): Implement.
23099 * attribute.cs : New file to handle attributes.
23100 (Attribute): Class to hold attribute info.
23102 * cs-parser.jay (opt_attribute_target_specifier): Remove production
23103 (attribute_section): Modify production to use 2 different rules to
23104 achieve the same thing. 1 s/r conflict down !
23105 Clean out commented, useless, non-reducing dimension_separator rules.
23107 * class.cs (TypeContainer.attributes): New member to hold list
23108 of attributes for a type.
23109 (Struct::Struct): Modify to take one more argument, the attribute list.
23110 (Class::Class): Ditto.
23111 (Field::Field): Ditto.
23112 (Method::Method): Ditto.
23113 (Property::Property): Ditto.
23115 * cs-parser.jay (struct_declaration): Update constructor call to
23116 pass in the attributes too.
23117 (class_declaration): Ditto.
23118 (constant_declaration): Ditto.
23119 (field_declaration): Ditto.
23120 (method_header): Ditto.
23121 (fixed_parameter): Ditto.
23122 (parameter_array): Ditto.
23123 (property_declaration): Ditto.
23125 * constant.cs (Constant::Constant): Update constructor similarly.
23126 Use System.Collections.
23128 * parameter.cs (Parameter::Parameter): Update as above.
23130 2001-09-02 Ravi Pratap <ravi@ximian.com>
23132 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
23133 (TypeContainer.delegates): New member to hold list of delegates.
23135 * cs-parser.jay (delegate_declaration): Implement the action correctly
23136 this time as I seem to be on crack ;-)
23138 2001-09-02 Miguel de Icaza <miguel@ximian.com>
23140 * rootcontext.cs (RootContext::IsNamespace): new function, used to
23141 tell whether an identifier represents a namespace.
23143 * expression.cs (NamespaceExpr): A namespace expression, used only
23144 temporarly during expression resolution.
23145 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
23146 utility functions to resolve names on expressions.
23148 2001-09-01 Miguel de Icaza <miguel@ximian.com>
23150 * codegen.cs: Add hook for StatementExpressions.
23152 * class.cs: Fix inverted test for static flag in methods.
23154 2001-09-02 Ravi Pratap <ravi@ximian.com>
23156 * class.cs (Operator::CheckUnaryOperator): Correct error number used
23157 to make it coincide with MS' number.
23158 (Operator::CheckBinaryOperator): Ditto.
23160 * ../errors/errors.txt : Remove error numbers added earlier.
23162 * ../errors/cs1019.cs : Test case for error # 1019
23164 * ../errros/cs1020.cs : Test case for error # 1020
23166 * cs-parser.jay : Clean out commented cruft.
23167 (dimension_separators, dimension_separator): Comment out. Ostensibly not
23168 used anywhere - non-reducing rule.
23169 (namespace_declarations): Non-reducing rule - comment out.
23171 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
23172 with TypeContainer::AddEnum.
23174 * delegate.cs : New file for delegate handling classes.
23175 (Delegate): Class for declaring delegates.
23177 * makefile : Update.
23179 * cs-parser.jay (delegate_declaration): Implement.
23181 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
23183 * class.cs (Event::Define): Implement.
23184 (Event.EventBuilder): New member.
23186 * class.cs (TypeContainer::Populate): Update to define all enums and events
23188 (Events): New property for the events arraylist we hold. Shouldn't we move to using
23189 readonly fields for all these cases ?
23191 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
23193 * class.cs (Property): Revamp to use the convention of making fields readonly.
23194 Accordingly modify code elsewhere.
23196 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
23197 the Define method of the Property class.
23199 * class.cs : Clean up applied patch and update references to variables etc. Fix
23201 (TypeContainer::Populate): Update to define all the properties we have. Also
23202 define all enumerations.
23204 * enum.cs (Define): Implement.
23206 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
23208 * cs-parser.jay (overloadable_operator): The semantic value is an
23209 enum of the Operator class.
23210 (operator_declarator): Implement actions.
23211 (operator_declaration): Implement.
23213 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
23214 validity of definitions.
23215 (Operator::CheckBinaryOperator): Static method to check for binary operators
23216 (TypeContainer::AddOperator): New method to add an operator to a type.
23218 * cs-parser.jay (indexer_declaration): Added line to actually call the
23219 AddIndexer method so it gets added ;-)
23221 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
23222 already taken care of by the MS compiler ?
23224 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
23226 * class.cs (Operator): New class for operator declarations.
23227 (Operator::OpType): Enum for the various operators.
23229 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
23231 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
23232 ostensibly handle this in semantic analysis.
23234 * cs-parser.jay (general_catch_clause): Comment out
23235 (specific_catch_clauses, specific_catch_clause): Ditto.
23236 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
23237 (catch_args, opt_catch_args): New productions.
23238 (catch_clause): Rewrite to use the new productions above
23239 (catch_clauses): Modify accordingly.
23240 (opt_catch_clauses): New production to use in try_statement
23241 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
23242 and re-write the code in the actions to extract the specific and
23243 general catch clauses by being a little smart ;-)
23245 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
23246 Hooray, try and catch statements parse fine !
23248 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
23250 * statement.cs (Block::GetVariableType): Fix logic to extract the type
23251 string from the hashtable of variables.
23253 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
23254 I end up making that mistake ;-)
23255 (catch_clauses): Fixed gross error which made Key and Value of the
23256 DictionaryEntry the same : $1 !!
23258 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
23260 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
23262 * cs-parser.jay (event_declaration): Correct to remove the semicolon
23263 when the add and remove accessors are specified.
23265 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
23267 * cs-parser.jay (IndexerDeclaration): New helper class to hold
23268 information about indexer_declarator.
23269 (indexer_declarator): Implement actions.
23270 (parsing_indexer): New local boolean used to keep track of whether
23271 we are parsing indexers or properties. This is necessary because
23272 implicit_parameters come into picture even for the get accessor in the
23273 case of an indexer.
23274 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
23276 * class.cs (Indexer): New class for indexer declarations.
23277 (TypeContainer::AddIndexer): New method to add an indexer to a type.
23278 (TypeContainer::indexers): New member to hold list of indexers for the
23281 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
23283 * cs-parser.jay (add_accessor_declaration): Implement action.
23284 (remove_accessor_declaration): Implement action.
23285 (event_accessors_declaration): Implement
23286 (variable_declarators): swap statements for first rule - trivial.
23288 * class.cs (Event): New class to hold information about event
23290 (TypeContainer::AddEvent): New method to add an event to a type
23291 (TypeContainer::events): New member to hold list of events.
23293 * cs-parser.jay (event_declaration): Implement actions.
23295 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
23297 * cs-parser.jay (dim_separators): Implement. Make it a string
23298 concatenating all the commas together, just as they appear.
23299 (opt_dim_separators): Modify accordingly
23300 (rank_specifiers): Update accordingly. Basically do the same
23301 thing - instead, collect the brackets here.
23302 (opt_rank_sepcifiers): Modify accordingly.
23303 (array_type): Modify to actually return the complete type string
23304 instead of ignoring the rank_specifiers.
23305 (expression_list): Implement to collect the expressions
23306 (variable_initializer): Implement. We make it a list of expressions
23307 essentially so that we can handle the array_initializer case neatly too.
23308 (variable_initializer_list): Implement.
23309 (array_initializer): Make it a list of variable_initializers
23310 (opt_array_initializer): Modify accordingly.
23312 * expression.cs (New::NType): Add enumeration to help us
23313 keep track of whether we have an object/delegate creation
23314 or an array creation.
23315 (New:NewType, New::Rank, New::Indices, New::Initializers): New
23316 members to hold data about array creation.
23317 (New:New): Modify to update NewType
23318 (New:New): New Overloaded contructor for the array creation
23321 * cs-parser.jay (array_creation_expression): Implement to call
23322 the overloaded New constructor.
23324 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
23326 * class.cs (TypeContainer::Constructors): Return member
23327 constructors instead of returning null.
23329 2001-08-26 Miguel de Icaza <miguel@ximian.com>
23331 * typemanager.cs (InitCoreTypes): Initialize the various core
23332 types after we have populated the type manager with the user
23333 defined types (this distinction will be important later while
23334 compiling corlib.dll)
23336 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
23337 on Expression Classification. Now all expressions have a method
23338 `Resolve' and a method `Emit'.
23340 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
23341 generation from working. Also add some temporary debugging
23344 2001-08-24 Miguel de Icaza <miguel@ximian.com>
23346 * codegen.cs: Lots of code generation pieces. This is only the
23347 beginning, will continue tomorrow with more touches of polish. We
23348 handle the fundamentals of if, while, do, for, return. Others are
23349 trickier and I need to start working on invocations soon.
23351 * gen-treedump.cs: Bug fix, use s.Increment here instead of
23354 * codegen.cs (EmitContext): New struct, used during code
23355 emission to keep a context. Most of the code generation will be
23358 * cs-parser.jay: Add embedded blocks to the list of statements of
23359 this block. So code generation proceeds in a top down fashion.
23361 2001-08-23 Miguel de Icaza <miguel@ximian.com>
23363 * statement.cs: Add support for multiple child blocks.
23365 2001-08-22 Miguel de Icaza <miguel@ximian.com>
23367 * codegen.cs (EmitCode): New function, will emit the code for a
23368 Block of code given a TypeContainer and its ILGenerator.
23370 * statement.cs (Block): Standard public readonly optimization.
23371 (Block::Block constructors): Link children.
23372 (Block::Child): Child Linker.
23373 (Block::EmitVariables): Emits IL variable declarations.
23375 * class.cs: Drop support for MethodGroups here, delay until
23377 (Method::): Applied the same simplification that I did before, and
23378 move from Properties to public readonly fields.
23379 (Method::ParameterTypes): Returns the parameter types for the
23380 function, and implements a cache that will be useful later when I
23381 do error checking and the semantic analysis on the methods is
23383 (Constructor::GetCallingConvention): Renamed from CallingConvetion
23384 and made a method, optional argument tells whether this is a class
23385 or a structure to apply the `has-this' bit.
23386 (Method::GetCallingConvention): Implement, returns the calling
23388 (Method::Define): Defines the type, a second pass is performed
23389 later to populate the methods.
23391 (Constructor::ParameterTypes): implement a cache similar to the
23392 one on Method::ParameterTypes, useful later when we do semantic
23395 (TypeContainer::EmitMethod): New method. Emits methods.
23397 * expression.cs: Removed MethodGroup class from here.
23399 * parameter.cs (Parameters::GetCallingConvention): new method.
23401 2001-08-21 Miguel de Icaza <miguel@ximian.com>
23403 * class.cs (TypeContainer::Populate): Drop RootContext from the
23406 (Constructor::CallingConvention): Returns the calling convention.
23407 (Constructor::ParameterTypes): Returns the constructor parameter
23410 (TypeContainer::AddConstructor): Keep track of default constructor
23411 and the default static constructor.
23413 (Constructor::) Another class that starts using `public readonly'
23414 instead of properties.
23416 (Constructor::IsDefault): Whether this is a default constructor.
23418 (Field::) use readonly public fields instead of properties also.
23420 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
23421 track of static constructors; If none is used, turn on
23422 BeforeFieldInit in the TypeAttributes.
23424 * cs-parser.jay (opt_argument_list): now the return can be null
23425 for the cases where there are no arguments.
23427 (constructor_declarator): If there is no implicit `base' or
23428 `this', then invoke the default parent constructor.
23430 * modifiers.cs (MethodAttr): New static function maps a set of
23431 modifiers flags into a MethodAttributes enum
23432 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
23433 MethodAttr, TypeAttr to represent the various mappings where the
23434 modifiers are used.
23435 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
23437 2001-08-19 Miguel de Icaza <miguel@ximian.com>
23439 * parameter.cs (GetParameterInfo): Fix bug where there would be no
23442 * interface.cs (PopulateIndexer): Implemented the code generator
23443 for interface indexers.
23445 2001-08-17 Miguel de Icaza <miguel@ximian.com>
23447 * interface.cs (InterfaceMemberBase): Now we track the new status
23450 (PopulateProperty): Implement property population. Woohoo! Got
23451 Methods and Properties going today.
23453 Removed all the properties for interfaces, and replaced them with
23454 `public readonly' fields.
23456 2001-08-16 Miguel de Icaza <miguel@ximian.com>
23458 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
23459 initialize their hashtables/arraylists only when they are needed
23460 instead of doing this always.
23462 * parameter.cs: Handle refs and out parameters.
23464 * cs-parser.jay: Use an ArrayList to construct the arguments
23465 instead of the ParameterCollection, and then cast that to a
23468 * parameter.cs: Drop the use of ParameterCollection and use
23469 instead arrays of Parameters.
23471 (GetParameterInfo): Use the Type, not the Name when resolving
23474 2001-08-13 Miguel de Icaza <miguel@ximian.com>
23476 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
23477 and instead use public readonly fields.
23479 * class.cs: Put back walking code for type containers.
23481 2001-08-11 Miguel de Icaza <miguel@ximian.com>
23483 * class.cs (MakeConstant): Code to define constants.
23485 * rootcontext.cs (LookupType): New function. Used to locate types
23488 2001-08-08 Miguel de Icaza <miguel@ximian.com>
23490 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
23491 this System.Reflection code is. Kudos to Microsoft
23493 * typemanager.cs: Implement a type cache and avoid loading all
23494 types at boot time. Wrap in LookupType the internals. This made
23495 the compiler so much faster. Wow. I rule!
23497 * driver.cs: Make sure we always load mscorlib first (for
23498 debugging purposes, nothing really important).
23500 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
23501 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
23503 * rootcontext.cs: Lookup types on their namespace; Lookup types
23504 on namespaces that have been imported using the `using' keyword.
23506 * class.cs (TypeContainer::TypeAttr): Virtualize.
23507 (Class::TypeAttr): Return attributes suitable for this bad boy.
23508 (Struct::TypeAttr): ditto.
23509 Handle nested classes.
23510 (TypeContainer::) Remove all the type visiting code, it is now
23511 replaced with the rootcontext.cs code
23513 * rootcontext.cs (GetClassBases): Added support for structs.
23515 2001-08-06 Miguel de Icaza <miguel@ximian.com>
23517 * interface.cs, statement.cs, class.cs, parameter.cs,
23518 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
23519 Drop use of TypeRefs, and use strings instead.
23521 2001-08-04 Miguel de Icaza <miguel@ximian.com>
23525 * class.cs (Struct::Struct): set the SEALED flags after
23526 checking the modifiers.
23527 (TypeContainer::TypeAttr): new property, returns the
23528 TypeAttributes for a class.
23530 * cs-parser.jay (type_list): Oops, list production was creating a
23531 new list of base types.
23533 * rootcontext.cs (StdLib): New property.
23534 (GetInterfaceTypeByName): returns an interface by type name, and
23535 encapsulates error handling here.
23536 (GetInterfaces): simplified.
23537 (ResolveTree): Encapsulated all the tree resolution here.
23538 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
23541 * driver.cs: Add support for --nostdlib, to avoid loading the
23542 default assemblies.
23543 (Main): Do not put tree resolution here.
23545 * rootcontext.cs: Beginning of the class resolution.
23547 2001-08-03 Miguel de Icaza <miguel@ximian.com>
23549 * rootcontext.cs: Provide better error reporting.
23551 * cs-parser.jay (interface_base): set our $$ to be interfaces.
23553 * rootcontext.cs (CreateInterface): Handle the case where there
23554 are no parent interfaces.
23556 (CloseTypes): Routine to flush types at the end.
23557 (CreateInterface): Track types.
23558 (GetInterfaces): Returns an array of Types from the list of
23559 defined interfaces.
23561 * typemanager.c (AddUserType): Mechanism to track user types (puts
23562 the type on the global type hash, and allows us to close it at the
23565 2001-08-02 Miguel de Icaza <miguel@ximian.com>
23567 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
23568 RecordInterface instead.
23570 * cs-parser.jay: Updated to reflect changes above.
23572 * decl.cs (Definition): Keep track of the TypeBuilder type that
23573 represents this type here. Not sure we will use it in the long
23574 run, but wont hurt for now.
23576 * driver.cs: Smaller changes to accomodate the new code.
23578 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
23581 * rootcontext.cs (CreateInterface): New method, used to create
23582 the System.TypeBuilder type for interfaces.
23583 (ResolveInterfaces): new entry point to resolve the interface
23585 (CodeGen): Property, used to keep track of the code generator.
23587 2001-07-26 Miguel de Icaza <miguel@ximian.com>
23589 * cs-parser.jay: Add a second production for delegate_declaration
23592 (enum_body): Put an opt_comma here instead of putting it on
23593 enum_body or enum_member_declarations so we can handle trailing
23594 commas on enumeration members. Gets rid of a shift/reduce.
23596 (type_list): Need a COMMA in the middle.
23598 (indexer_declaration): Tell tokenizer to recognize get/set
23600 * Remove old targets.
23602 * Re-add the parser target.
23604 2001-07-13 Simon Cozens <simon@simon-cozens.org>
23606 * cs-parser.jay: Add precendence rules for a number of operators
23607 ot reduce the number of shift/reduce conflicts in the grammar.
23609 2001-07-17 Miguel de Icaza <miguel@ximian.com>
23611 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
23614 Get rid of old crufty code.
23616 * rootcontext.cs: Use this to keep track of the parsed
23617 representation and the defined types available to the program.
23619 * gen-treedump.cs: adjust for new convention.
23621 * type.cs: Split out the type manager, and the assembly builder
23624 * typemanager.cs: the type manager will live here now.
23626 * cil-codegen.cs: And the code generator here.
23628 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
23630 * makefile: Fixed up for easy making.
23632 2001-07-13 Simon Cozens <simon@simon-cozens.org>
23634 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
23637 (unary_expression): Expand pre_increment_expression and
23638 post_decrement_expression to reduce a shift/reduce.
23640 2001-07-11 Simon Cozens
23642 * cs-tokenizer.cs: Hex numbers should begin with a 0.
23644 Improve allow_keyword_as_indent name.
23646 2001-06-19 Miguel de Icaza <miguel@ximian.com>
23648 * Adjustments for Beta2.
23650 2001-06-13 Miguel de Icaza <miguel@ximian.com>
23652 * decl.cs: Added `Define' abstract method.
23653 (InTransit): new property, used to catch recursive definitions.
23655 * interface.cs: Implement `Define'.
23657 * modifiers.cs: Map Modifiers.constants to
23658 System.Reflection.TypeAttribute flags.
23660 * class.cs: Keep track of types and user-defined types.
23661 (BuilderInit): New method for creating an assembly
23662 (ResolveType): New function to launch the resolution process, only
23663 used by interfaces for now.
23665 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
23666 that are inserted into the name space.
23668 2001-06-08 Miguel de Icaza <miguel@ximian.com>
23670 * ARGH. I have screwed up my tree so many times due to the use of
23671 rsync rather than using CVS. Going to fix this at once.
23673 * driver.cs: Objetify driver. Load assemblies, use assemblies to
23676 2001-06-07 Miguel de Icaza <miguel@ximian.com>
23678 * Experiment successful: Use System.Type rather that our own
23681 2001-05-25 Miguel de Icaza <miguel@ximian.com>
23683 * cs-parser.jay: Removed nsAliases from here.
23685 Use new namespaces, handle `using XXX;'
23687 * namespace.cs: Reimplemented namespace handling, use a recursive
23688 definition of the class. Now we can keep track of using clauses
23689 and catch invalid using clauses.
23691 2001-05-24 Miguel de Icaza <miguel@ximian.com>
23693 * gen-treedump.cs: Adapted for all the renaming.
23695 * expression.cs (Expression): this class now has a Type property
23696 which returns an expression Type.
23698 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
23699 `Type', as this has a different meaning now in the base
23701 2001-05-22 Miguel de Icaza <miguel@ximian.com>
23703 * interface.cs, class.cs: Removed from all the sources the
23704 references to signature computation, as we can not do method
23705 signature computation during the parsing time, as we are not
23706 trying to solve at that point distinguishing:
23710 void a (NS.Blah x) {}
23713 Which depending on the context might be valid or not, as we do not
23714 know if Blah is the same thing as NS.Blah at that point.
23716 * Redid everything so the code uses TypeRefs now instead of
23717 Types. TypeRefs are just temporary type placeholders, that need
23718 to be resolved. They initially have a pointer to a string and the
23719 current scope in which they are used. This is used later by the
23720 compiler to resolve the reference to an actual Type.
23722 * DeclSpace is no longer a CIR.Type, and neither are
23723 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
23724 are all DeclSpaces, but no Types.
23726 * type.cs (TypeRefManager): This implements the TypeRef manager,
23727 which keeps track of all the types that need to be resolved after
23728 the parsing has finished.
23730 2001-05-13 Miguel de Icaza <miguel@ximian.com>
23732 * ARGH. We are going to have to store `foreach' as a class rather
23733 than resolving it, as we need to verify error 1579 after name
23734 resolution. *OR* we could keep a flag that says `This request to
23735 IEnumerator comes from a foreach statement' which we can then use
23736 to generate the error.
23738 2001-05-10 Miguel de Icaza <miguel@ximian.com>
23740 * class.cs (TypeContainer.AddMethod): we now add methods to the
23741 MethodGroup instead of the method hashtable.
23743 * expression.cs: Add MethodGroup abstraction, which gets us one
23744 step closer to the specification in the way we handle method
23747 * cs-parser.jay (primary_expression): qualified_identifier now
23748 tried to match up an identifier to a local variable reference or
23749 to a parameter reference.
23751 current_local_parameters is now a parser global variable that
23752 points to the current parameters for the block, used during name
23755 (property_declaration): Now creates an implicit `value' argument to
23758 2001-05-09 Miguel de Icaza <miguel@ximian.com>
23760 * parameter.cs: Do not use `param' arguments as part of the
23761 signature, per the spec.
23763 2001-05-08 Miguel de Icaza <miguel@ximian.com>
23765 * decl.cs: Base class for classes, structs and interfaces. This
23766 is the "Declaration Space"
23768 * cs-parser.jay: Use CheckDef for checking declaration errors
23769 instead of having one on each function.
23771 * class.cs: Factor out some code for handling error handling in
23772 accordance to the "Declarations" section in the "Basic Concepts"
23773 chapter in the ECMA C# spec.
23775 * interface.cs: Make all interface member classes derive from
23776 InterfaceMemberBase.
23778 2001-05-07 Miguel de Icaza <miguel@ximian.com>
23780 * Many things: all interfaces are parsed and generated in
23781 gen-treedump. Support for member variables, constructors,
23782 destructors, properties, constants is there.
23784 Beginning of the IL backend, but very little done, just there for
23787 2001-04-29 Miguel de Icaza <miguel@ximian.com>
23789 * cs-parser.jay: Fix labeled statement.
23791 * cs-tokenizer.cs (escape): Escape " and ' always.
23792 ref_line, ref_name: keep track of the line/filename as instructed
23793 by #line by the compiler.
23796 2001-04-27 Miguel de Icaza <miguel@ximian.com>
23798 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
23799 to match the values in System.CodeDOM.
23801 Divid renamed to Divide.
23803 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
23805 (Statements.set): remove.
23807 * System.CodeDOM/CodeCatchClause.cs: always have a valid
23810 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
23811 falseStatements always have valid values.
23813 * cs-parser.jay: Use System.CodeDOM now.