/
ChangeLog
executable file
·8970 lines (5954 loc) · 307 KB
/
ChangeLog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
2002-08-23 Martin Baulig <martin@gnome.org>
* struct.cs (MyStructInfo.ctor): Make this work with empty
structs; it's not allowed to use foreach() on null.
2002-08-23 Martin Baulig <martin@gnome.org>
* codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
writer the full pathname of the generated assembly.
2002-08-23 Martin Baulig <martin@gnome.org>
* statements.cs (FlowBranching.UsageVector.MergeChildren):
A `finally' block never returns or breaks; improved handling of
unreachable code.
2002-08-23 Martin Baulig <martin@gnome.org>
* statement.cs (Throw.Resolve): Allow `throw null'.
2002-08-23 Martin Baulig <martin@gnome.org>
* expression.cs (MemberAccess.ResolveMemberAccess): If this is an
EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
`ee.EventInfo.DeclaringType == ec.ContainerType'. The
MemberLookup would return a wrong event if this is an explicit
interface implementation and the class has an event with the same
name.
2002-08-23 Martin Baulig <martin@gnome.org>
* statement.cs (Block.AddChildVariableNames): New public method.
(Block.AddChildVariableName): Likewise.
(Block.IsVariableNameUsedInChildBlock): Likewise.
(Block.AddVariable): Check whether a variable name has already
been used in a child block.
* cs-parser.jay (declare_local_variables): Mark all variable names
from the current block as being used in a child block in the
implicit block.
2002-08-23 Martin Baulig <martin@gnome.org>
* codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
find the symbol writer.
* driver.cs: csc also allows the arguments to /define being
separated by commas, not only by semicolons.
2002-08-23 Martin Baulig <martin@gnome.org>
* interface.cs (Interface.GetMembers): Added static check for events.
2002-08-15 Martin Baulig <martin@gnome.org>
* class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
call, use ec.ContainerType.BaseType as queried_type and invocation_type.
* ecore.cs (Expression.MemberLookup): Added documentation and explained
why the MethodData.EmitDestructor() change was necessary.
2002-08-20 Martin Baulig <martin@gnome.org>
* class.cs (TypeContainer.FindMembers): Added static check for events.
* decl.cs (MemberCache.AddMembers): Handle events like normal members.
* typemanager.cs (TypeHandle.GetMembers): When queried for events only,
use Type.GetEvents(), not Type.FindMembers().
2002-08-20 Martin Baulig <martin@gnome.org>
* decl.cs (MemberCache): Added a special method cache which will
be used for method-only searched. This ensures that a method
search will return a MethodInfo with the correct ReflectedType for
inherited methods.
2002-08-20 Martin Baulig <martin@gnome.org>
* decl.cs (DeclSpace.FindMembers): Made this public.
2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* delegate.cs: fixed build on windows.
[FIXME: Filed as bug #29150: MCS must report these errors.]
2002-08-19 Ravi Pratap <ravi@ximian.com>
* ecore.cs (StandardConversionExists): Return a false
if we are trying to convert the void type to anything else
since that is not allowed.
* delegate.cs (DelegateInvocation.DoResolve): Ensure that
we flag error 70 in the event an event is trying to be accessed
directly from outside the declaring type.
2002-08-20 Martin Baulig <martin@gnome.org>
* typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
MemberCache from typemanager.cs to decl.cs.
2002-08-19 Martin Baulig <martin@gnome.org>
* class.cs (TypeContainer): Implement IMemberContainer.
(TypeContainer.DefineMembers): Create the MemberCache.
(TypeContainer.FindMembers): Do better BindingFlags checking; only
return public members if BindingFlags.Public was given, check
whether members are static.
2002-08-16 Martin Baulig <martin@gnome.org>
* decl.cs (DeclSpace.Define): Splitted this in Define and
DefineMembers. DefineMembers is called first and initializes the
MemberCache.
* rootcontext.cs (RootContext.DefineMembers): New function. Calls
DefineMembers() on all our DeclSpaces.
* class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
but call DefineMembers() on all nested interfaces. We call their
Define() in our new Define() function.
* interface.cs (Interface): Implement IMemberContainer.
(Interface.Define): Moved all code except the attribute stuf to
DefineMembers().
(Interface.DefineMembers): Initialize the member cache.
* typemanager.cs (IMemberFinder): Removed this interface, we don't
need this anymore since we can use MemberCache.FindMembers directly.
2002-08-19 Martin Baulig <martin@gnome.org>
* typemanager.cs (MemberCache): When creating the cache for an
interface type, add all inherited members.
(TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
to `out bool used_cache' and documented it.
(TypeManager.MemberLookup): If we already used the cache in the first
iteration, we don't need to do the interfaces check.
2002-08-19 Martin Baulig <martin@gnome.org>
* decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
here from IMemberFinder and don't implement this interface anymore.
(DeclSpace.MemberCache): Moved here from IMemberFinder.
* typemanager.cs (IMemberFinder): This interface is now only used by
classes which actually support the member cache.
(TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
since we only put DeclSpaces into this Hashtable.
(MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
a dynamic type and TypeHandle.GetTypeHandle() otherwise.
2002-08-16 Martin Baulig <martin@gnome.org>
* typemanager.cs (ICachingMemberFinder): Removed.
(IMemberFinder.MemberCache): New property.
(TypeManager.FindMembers): Merged this with RealFindMembers().
This function will never be called from TypeManager.MemberLookup()
so we can't use the cache here, just the IMemberFinder.
(TypeManager.MemberLookup_FindMembers): Check whether the
IMemberFinder has a MemberCache and call the cache's FindMembers
function.
(MemberCache): Rewrote larger parts of this yet another time and
cleaned it up a bit.
2002-08-15 Miguel de Icaza <miguel@ximian.com>
* driver.cs (LoadArgs): Support quoting.
(Usage): Show the CSC-like command line arguments.
Improved a few error messages.
2002-08-15 Martin Baulig <martin@gnome.org>
* typemanager.cs (IMemberContainer.Type): New property.
(IMemberContainer.IsInterface): New property.
The following changes are conditional to BROKEN_RUNTIME, which is
defined at the top of the file.
* typemanager.cs (MemberCache.MemberCache): Don't add the base
class'es members, but add all members from TypeHandle.ObjectType
if we're an interface.
(MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
is the current type.
(MemberCache.CacheEntry.Container): Removed this field.
(TypeHandle.GetMembers): Include inherited members.
2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* typemanager.cs: fixed compilation and added a comment on a field that
is never used.
2002-08-15 Martin Baulig <martin@gnome.org>
* class.cs (ConstructorInitializer.Resolve): In the
Expression.MemberLookup call, use the queried_type as
invocation_type.
* typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
declared' attribute, it's always true.
(IMemberContainer.Parent, IMemberContainer.Name): New properties.
(TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
temporary wrapper for FindMembers which tells MemberLookup whether
members from the base classes are included in the return value.
This will go away soon.
(TypeManager.MemberLookup): Use this temporary hack here; once the
new MemberCache is completed, we don't need to do the DeclaredOnly
looping here anymore since the MemberCache will take care of this.
(TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
(MemberCache): When creating the MemberCache for a class, get
members from the current class and all its base classes.
(MemberCache.CacheEntry.Container): New field. This is a
temporary hack until the Mono runtime is fixed to distinguish
between ReflectedType and DeclaringType. It allows us to use MCS
with both the MS runtime and the unfixed Mono runtime without
problems and without accecting performance.
(MemberCache.SearchMembers): The DeclaredOnly looping from
TypeManager.MemberLookup is now done here.
2002-08-14 Martin Baulig <martin@gnome.org>
* statement.cs (MyStructInfo.MyStructInfo): Don't call
Type.GetFields on dynamic types but get the fields from the
corresponding TypeContainer.
(MyStructInfo.GetStructInfo): Added check for enum types.
* typemanager.cs (MemberList.IsSynchronized): Implemented.
(MemberList.SyncRoot): Implemented.
(TypeManager.FilterWithClosure): No need to check permissions if
closure_start_type == closure_invocation_type, don't crash if
closure_invocation_type is null.
2002-08-13 Martin Baulig <martin@gnome.org>
Rewrote TypeContainer.FindMembers to use a member cache. This
gives us a speed increase of about 35% for the self-hosting MCS
build and of about 15-20% for the class libs (both on GNU/Linux).
* report.cs (Timer): New class to get enhanced profiling. This
whole class is "TIMER" conditional since it remarkably slows down
compilation speed.
* class.cs (MemberList): New class. This is an IList wrapper
which we're now using instead of passing MemberInfo[]'s around to
avoid copying this array unnecessarily.
(IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
(ICachingMemberFinder, IMemberContainer): New interface.
(TypeManager.FilterWithClosure): If `criteria' is null, the name
has already been checked, otherwise use it for the name comparision.
(TypeManager.FindMembers): Renamed to RealMemberFinder and
provided wrapper which tries to use ICachingMemberFinder.FindMembers
if possible. Returns a MemberList, not a MemberInfo [].
(TypeHandle): New class, implements IMemberContainer. We create
one instance of this class per type, it contains a MemberCache
which is used to do the member lookups.
(MemberCache): New class. Each instance of this class contains
all members of a type and a name-based hash table.
(MemberCache.FindMembers): This is our new member lookup
function. First, it looks up all members of the requested name in
the hash table. Then, it walks this list and sorts out all
applicable members and returns them.
2002-08-13 Martin Baulig <martin@gnome.org>
In addition to a nice code cleanup, this gives us a performance
increase of about 1.4% on GNU/Linux - not much, but it's already
half a second for the self-hosting MCS compilation.
* typemanager.cs (IMemberFinder): New interface. It is used by
TypeManager.FindMembers to call FindMembers on a TypeContainer,
Enum, Delegate or Interface.
(TypeManager.finder_to_member_finder): New PtrHashtable.
(TypeManager.finder_to_container): Removed.
(TypeManager.finder_to_delegate): Removed.
(TypeManager.finder_to_interface): Removed.
(TypeManager.finder_to_enum): Removed.
* interface.cs (Interface): Implement IMemberFinder.
* delegate.cs (Delegate): Implement IMemberFinder.
* enum.cs (Enum): Implement IMemberFinder.
* class.cs (TypeContainer): Implement IMemberFinder.
2002-08-12 Martin Baulig <martin@gnome.org>
* ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
2002-08-12 Martin Baulig <martin@gnome.org>
* ecore.cs (ITypeExpression): New interface for expressions which
resolve to a type.
(TypeExpression): Renamed to TypeLookupExpression.
(Expression.DoResolve): If we're doing a types-only lookup, the
expression must implement the ITypeExpression interface and we
call DoResolveType() on it.
(SimpleName): Implement the new ITypeExpression interface.
(SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
hack, the situation that we're only looking up types can't happen
anymore when this method is called. Moved the type lookup code to
DoResolveType() and call it.
(SimpleName.DoResolveType): This ITypeExpression interface method
is now doing the types-only lookup.
(TypeExpr, TypeLookupExpression): Implement ITypeExpression.
(ResolveFlags): Added MaskExprClass.
* expression.cs (MemberAccess): Implement the ITypeExpression
interface.
(MemberAccess.DoResolve): Added support for a types-only lookup
when we're called via ITypeExpression.DoResolveType().
(ComposedCast): Implement the ITypeExpression interface.
* codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
Expression.Resolve() with ResolveFlags.Type instead.
2002-08-12 Martin Baulig <martin@gnome.org>
* interface.cs (Interface.Define): Apply attributes.
* attribute.cs (Attribute.ApplyAttributes): Added support for
interface attributes.
2002-08-11 Martin Baulig <martin@gnome.org>
* statement.cs (Block.Emit): Only check the "this" variable if we
do not always throw an exception.
* ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
whether the property has a set accessor.
2002-08-11 Martin Baulig <martin@gnome.org>
Added control flow analysis support for structs.
* ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
with control flow analysis turned off.
(IVariable): New interface.
(SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
(FieldExpr.DoResolve): Resolve the instance expression with flow
analysis turned off and do the definite assignment check after the
resolving when we know what the expression will resolve to.
* expression.cs (LocalVariableReference, ParameterReference):
Implement the new IVariable interface, only call the flow analysis
code if ec.DoFlowAnalysis is true.
(This): Added constructor which takes a Block argument. Implement
the new IVariable interface.
(MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
This does the definite assignment checks for struct members.
* class.cs (Constructor.Emit): If this is a non-static `struct'
constructor which doesn't have any initializer, call
Block.AddThisVariable() to tell the flow analysis code that all
struct elements must be initialized before control returns from
the constructor.
* statement.cs (MyStructInfo): New public class.
(UsageVector.this [VariableInfo vi]): Added `int field_idx'
argument to this indexer. If non-zero, check an individual struct
member, not the whole struct.
(FlowBranching.CheckOutParameters): Check struct members.
(FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
overloaded versions of these methods which take an additional
`int field_idx' argument to check struct members.
(FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
overloaded versions of these methods which take an additional
`string field_name' argument to check struct member.s
(VariableInfo): Implement the IVariable interface.
(VariableInfo.StructInfo): New public property. Returns the
MyStructInfo instance of the variable if it's a struct or null.
(Block.AddThisVariable): New public method. This is called from
Constructor.Emit() for non-static `struct' constructor which do
not have any initializer. It creates a special variable for the
"this" instance variable which will be checked by the flow
analysis code to ensure that all of the struct's fields are
initialized before control returns from the constructor.
(UsageVector): Added support for struct members. If a
variable/parameter is a struct with N members, we reserve a slot
in the usage vector for each member. A struct is considered fully
initialized if either the struct itself (slot 0) or all its
members are initialized.
2002-08-08 Martin Baulig <martin@gnome.org>
* driver.cs (Driver.MainDriver): Only report an error CS5001
if there were no compilation errors.
* codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
`UnsafeContext' property to determine whether the parent is in
unsafe context rather than checking the parent's ModFlags:
classes nested in an unsafe class are unsafe as well.
2002-08-08 Martin Baulig <martin@gnome.org>
* statement.cs (UsageVector.MergeChildren): Distinguish between
`Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
we return. Added test17() and test18() to test-154.cs.
2002-08-08 Martin Baulig <martin@gnome.org>
* typemanager.cs (TypeManager.FilterWithClosure): If we have
Family access, make sure the invoking type isn't a subclass of the
queried type (that'd be a CS1540).
* ecore.cs (Expression.MemberLookup): Added overloaded version of
this method which takes an additional `Type invocation_type'.
* expression.cs (BaseAccess.DoResolve): Use the base type as
invocation and query type.
(MemberAccess.DoResolve): If the lookup failed and we're about to
report a CS0122, try a lookup with the ec.ContainerType - if this
succeeds, we must report a CS1540.
2002-08-08 Martin Baulig <martin@gnome.org>
* ecore.cs (IMemberExpr): Added `bool IsInstance' property.
(MethodGroupExpr): Implement the IMemberExpr interface.
* expression (MemberAccess.ResolveMemberAccess): No need to have
any special code for MethodGroupExprs anymore, they're now
IMemberExprs.
2002-08-08 Martin Baulig <martin@gnome.org>
* typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
Family, FamANDAssem and FamORAssem permissions.
(TypeManager.IsSubclassOrNestedChildOf): New public method.
2002-08-08 Martin Baulig <martin@gnome.org>
* statement.cs (FlowBranchingType): Added LOOP_BLOCK.
(UsageVector.MergeChildren): `break' breaks unless we're in a switch
or loop block.
Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
* driver.cs: implemented /resource option to embed managed resources.
2002-08-07 Martin Baulig <martin@gnome.org>
* class.cs (FieldBase.Initializer): Renamed to `init' and made private.
(FieldBase.HasFieldInitializer): New public property.
(FieldBase.GetInitializerExpression): New public method. Resolves and
returns the field initializer and makes sure it is only resolved once.
(TypeContainer.EmitFieldInitializers): Call
FieldBase.GetInitializerExpression to get the initializer, this ensures
that it isn't resolved multiple times.
* codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
the resolving process (SimpleName/MemberLookup) that we're currently
emitting a field initializer (which must not access any instance members,
this is an error CS0236).
* ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
argument, if the `IsFieldInitializer' flag is set, we must report and
error CS0236 and not an error CS0120.
2002-08-07 Martin Baulig <martin@gnome.org>
* ecore.cs (IMemberExpr): New public interface.
(FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
(SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
if the expression is an IMemberExpr.
* expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
to be null, implicitly default to `this' if we're non-static in
this case. Simplified the code a lot by using the new IMemberExpr
interface. Also fixed bug #28176 here.
2002-08-06 Martin Baulig <martin@gnome.org>
* cs-parser.jay (SimpleLookup): Removed. We need to create
ParameterReferences during semantic analysis so that we can do a
type-only search when resolving Cast, TypeOf and SizeOf.
(block): Pass the `current_local_parameters' to the Block's
constructor.
* class.cs (ConstructorInitializer): Added `Parameters parameters'
argument to the constructor.
(ConstructorInitializer.Resolve): Create a temporary implicit
block with the parameters.
* ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
references here if we aren't doing a type-only search.
* statement.cs (Block): Added constructor which takes a
`Parameters parameters' argument.
(Block.Parameters): New public property.
* support.cs (InternalParameters.Parameters): Renamed `parameters'
to `Parameters' and made it public readonly.
2002-08-06 Martin Baulig <martin@gnome.org>
* ecore.cs (Expression.Warning): Made this public as well.
* report.cs (Report.Debug): Print the contents of collections.
2002-08-06 Martin Baulig <martin@gnome.org>
* ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
used to tell Resolve() which kinds of expressions it may return.
(Expression.Resolve): Added overloaded version of this method which
takes a `ResolveFlags flags' argument. This can be used to tell
Resolve() which kinds of expressions it may return. Reports a
CS0118 on error.
(Expression.ResolveWithSimpleName): Removed, use Resolve() with
ResolveFlags.SimpleName.
(Expression.Error118): Added overloaded version of this method which
takes a `ResolveFlags flags' argument. It uses the flags to determine
which kinds of expressions are allowed.
* expression.cs (Argument.ResolveMethodGroup): New public method.
Resolves an argument, but allows a MethodGroup to be returned.
This is used when invoking a delegate.
* TODO: Updated a bit.
2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
Fixed compilation with csc.
* ecore.cs: Expression.Error made public. Is this correct? Should
Warning be made public too?
* expression.cs: use ea.Location instead of ea.loc.
[FIXME: Filed as bug #28607: MCS must report these errors.]
2002-08-06 Martin Baulig <martin@gnome.org>
* ecore.cs (Expression.loc): Moved the location here instead of
duplicating it in all derived classes.
(Expression.Location): New public property.
(Expression.Error, Expression.Warning): Made them non-static and
removed the location argument.
(Expression.Warning): Added overloaded version which takes an
`int level' argument.
(Expression.Error118): Make this non-static and removed the
expression and location arguments.
(TypeExpr): Added location argument to the constructor.
* expression.cs (StaticCallExpr): Added location argument to
the constructor.
(Indirection, PointerArithmetic): Likewise.
(CheckedExpr, UnCheckedExpr): Likewise.
(ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
(StringPtr): Likewise.
2002-08-05 Martin Baulig <martin@gnome.org>
* expression.cs (BaseAccess.DoResolve): Actually report errors.
* assign.cs (Assign.DoResolve): Check whether the source
expression is a value or variable.
* statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
while resolving the corresponding blocks.
* interface.cs (Interface.GetInterfaceTypeByName): Actually report
an error, don't silently return null.
* statement.cs (Block.AddVariable): Do the error reporting here
and distinguish between CS0128 and CS0136.
(Block.DoResolve): Report all unused labels (warning CS0164).
(LabeledStatement): Pass the location to the constructor.
(LabeledStatement.HasBeenReferenced): New property.
(LabeledStatement.Resolve): Set it to true here.
* statement.cs (Return.Emit): Return success even after reporting
a type mismatch error (CS0126 or CS0127), this is what csc does and
it avoids confusing the users with any consecutive errors.
2002-08-05 Martin Baulig <martin@gnome.org>
* enum.cs (Enum.LookupEnumValue): Catch circular definitions.
* const.cs (Const.LookupConstantValue): Catch circular definitions.
* expression.cs (MemberAccess.DoResolve): Silently return if an
error has already been reported.
* ecore.cs (Expression.MemberLookupFinal): Silently return if an
error has already been reported.
2002-08-05 Martin Baulig <martin@gnome.org>
* statement.cs (UsageVector): Only initialize the `parameters'
vector if we actually have any "out" parameters.
2002-08-05 Martin Baulig <martin@gnome.org>
* expression.cs (Binary.ResolveOperator): When combining delegates,
they must have the same type.
2002-08-05 Martin Baulig <martin@gnome.org>
* typemanager.cs (TypeManager.GetArgumentTypes): Don't call
PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
work with the ms runtime and we also don't need it: if we're a
PropertyBuilder and not in the `indexer_arguments' hash, then we
are a property and not an indexer.
* class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
Type.IsPointer and Type.IsByRef instead of Type.HasElementType
since the latter one doesn't work with the ms runtime.
2002-08-03 Martin Baulig <martin@gnome.org>
Fixed bugs #27998 and #22735.
* class.cs (Method.IsOperator): New public field.
(Method.CheckBase): Report CS0111 if there's already a method
with the same parameters in the current class. Report CS0508 when
attempting to change the return type of an inherited method.
(MethodData.Emit): Report CS0179 if a method doesn't have a body
and it's not marked abstract or extern.
(PropertyBase): New abstract base class for Property and Indexer.
(PropertyBase.CheckBase): Moved here from Property and made it work
for indexers.
(PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
the same so we can reuse it there.
(Property, Indexer): Derive from PropertyBase.
(MethodSignature.inheritable_property_signature_filter): New delegate
to find properties and indexers.
* decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
argument and improved error reporting.
* parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
EmptyReadOnlyParameters and made it a property.
* typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
version of this method which takes a `PropertyInfo indexer'.
(TypeManager.RegisterIndexer): New method.
* class.cs: Added myself as author of this file :-)
2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* class.cs: fixed compilation on windoze.
2002-08-03 Martin Baulig <martin@gnome.org>
* interface.cs (Interface.GetInterfaceBases): Check whether all
base interfaces are at least as accessible than the current one.
* class.cs (TypeContainer.GetClassBases): Check whether base types
are at least as accessible than the current type.
(TypeContainer.AsAccessible): Implemented and made non-static.
(MemberBase.CheckParameters): Report errors if the accessibility
checks fail.
* delegate.cs (Delegate.Delegate): The default visibility is
internal for top-level types and private for nested types.
(Delegate.Define): Report errors if the accessibility checks fail.
* enum.cs (Enum.Enum): The default visibility is internal for
top-level types and private for nested types.
(Enum.DefineType): Compute the correct visibility.
* modifiers.cs (Modifiers.TypeAttr): Added a version of this
function which takes a `bool is_toplevel' instead of a TypeContainer.
* typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
builtin type.
2002-08-02 Martin Baulig <martin@gnome.org>
* expression.cs (LocalVariableReferenc): Added constructor which
takes additional `VariableInfo vi' and `bool is_readonly' arguments.
(LocalVariableReference.IsReadOnly): New property.
(LocalVariableReference.DoResolveLValue): Report a CS1604 if the
variable is readonly, use our own readonly flag to do this; you can
use the new constructor to get a writable reference to a read-only
variable.
* cs-parser.jay (foreach_statement, using_statement): Get a writable
reference to the local variable.
2002-08-01 Miguel de Icaza <miguel@ximian.com>
* rootcontext.cs (ResolveCore): Also include System.Exception
* statement.cs (Block.Emit): Do not emit the dead-code warnings if
we reach an EmptyStatement.
(Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
is also fine.
* expression.cs (Binary.ResolveOperator): Check error result in
two places.
use brtrue/brfalse directly and avoid compares to null.
2002-08-02 Martin Baulig <martin@gnome.org>
* class.cs (TypeContainer.Define): Define all nested interfaces here.
Fixes bug #28407, added test-155.cs.
2002-08-01 Martin Baulig <martin@gnome.org>
* class.cs (Event.EmitDefaultMethod): Make this work with static
events. Fixes #28311, added verify-3.cs.
2002-08-01 Martin Baulig <martin@gnome.org>
* statement.cs (ForeachHelperMethods): Added `enumerator_type' and
`is_disposable' fields.
(Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
`hm.is_disposable' if we're using the collection pattern.
(Foreach.EmitCollectionForeach): Use the correct type for the
enumerator's local variable, only emit the try/finally block if
necessary (fixes #27713).
2002-08-01 Martin Baulig <martin@gnome.org>
* ecore.cs (Expression.report118): Renamed to Error118 and made
it public static.
* statement.cs (Throw.Resolve): Check whether the expression is of
the correct type (CS0118) and whether the type derives from
System.Exception (CS0155).
(Catch.Resolve): New method. Do the type lookup here and check
whether it derives from System.Exception (CS0155).
(Catch.CatchType, Catch.IsGeneral): New public properties.
* typemanager.cs (TypeManager.exception_type): Added.
2002-07-31 Miguel de Icaza <miguel@ximian.com>
* driver.cs: Updated About function.
2002-07-31 Martin Baulig <martin@gnome.org>
Implemented Control Flow Analysis.
* codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
(EmitContext.CurrentBranching): Added.
(EmitContext.StartFlowBranching): Added.
(EmitContext.EndFlowBranching): Added.
(EmitContext.KillFlowBranching): Added.
(EmitContext.IsVariableAssigned): Added.
(EmitContext.SetVariableAssigned): Added.
(EmitContext.IsParameterAssigned): Added.
(EmitContext.SetParameterAssigned): Added.
(EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
Added control flow analysis stuff here.
* expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
resolve the expression as lvalue.
(LocalVariableReference.DoResolve): Check whether the variable has
already been assigned.
(ParameterReference.DoResolveLValue): Override lvalue resolve to mark
the parameter as assigned here.
(ParameterReference.DoResolve): Check whether the parameter has already
been assigned.
(Argument.Resolve): If it's a `ref' or `out' argument, resolve the
expression as lvalue.
* statement.cs (FlowBranching): New class for the flow analysis code.
(Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
(LabeledStatement.IsDefined): New public property.
(LabeledStatement.AddUsageVector): New public method to tell flow
analyis that the label may be reached via a forward jump.
(GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
flow analysis.
(VariableInfo.Number): New public field. This is used by flow analysis
to number all locals of a block.
(Block.CountVariables): New public property. This is the number of
local variables in this block (including the locals from all parent
blocks).
(Block.EmitMeta): Number all the variables.
* statement.cs: Added flow analysis support to all classes.
2002-07-31 Martin Baulig <martin@gnome.org>
* driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
To get debugging messages, compile mcs with /define:MCS_DEBUG and
then use this argument.
* report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
* makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
use this to specify /define options.
2002-07-29 Martin Baulig <martin@gnome.org>
* statement.cs (Fixed): Moved all code that does variable lookups
and resolvings from Emit to Resolve.
* statement.cs (For): Moved all code that does variable lookups
and resolvings from Emit to Resolve.
* statement.cs (Using): Moved all code that does variable lookups
and resolvings from Emit to Resolve.
2002-07-29 Martin Baulig <martin@gnome.org>
* attribute.cs (Attribute.Resolve): Explicitly catch a
System.NullReferenceException when creating the
CustromAttributeBuilder and report a different warning message.
2002-07-29 Martin Baulig <martin@gnome.org>
* support.cs (ParameterData.ParameterName): Added method to
get the name of a parameter.
* typemanager.cs (TypeManager.IsValueType): New public method.
2002-07-29 Martin Baulig <martin@gnome.org>
* parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
is a flag which specifies that it's either ref or out.
(Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
the out parameter to `out Parameter.Modifier mod', also set the
Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
* support.cs (InternalParameters.ParameterModifier): Distinguish
between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
Parameter.Modifier.ISBYREF flag if it's either ref or out.
* expression.cs (Argument.GetParameterModifier): Distinguish
between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
Parameter.Modifier.ISBYREF flag if it's either ref or out.
2002-07-29 Martin Baulig <martin@gnome.org>
* expression.cs (ParameterReference.ParameterReference): Added
`Location loc' argument to the constructor.
* cs-parser.jay: Pass location to ParameterReference.
2002-07-28 Miguel de Icaza <miguel@ximian.com>
* statement.cs (Try): Initialize the location.
* cs-parser.jay: pass location to Try.
* expression.cs (Unary.Reduce): Change the prototype to return
whether a constant fold could be performed or not. The result is
returned in an out parameters. In the case of Indirection and
AddressOf, we want to perform the full tests.
2002-07-26 Miguel de Icaza <miguel@ximian.com>
* statement.cs (Statement.Emit): Flag dead code.
2002-07-27 Andrew Birkett <andy@nobugs.org>
* expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
2002-07-27 Martin Baulig <martin@gnome.org>
* class.cs (MethodData.Define): Put back call to
TypeManager.AddMethod(), accidentally commented this out.
* report.cs (Debug): New public method to print debugging information,
this is `[Conditional ("DEBUG")]'.
2002-07-26 Martin Baulig <martin@gnome.org>
* cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
(switch_statement): Push the current_block to the switch_stack and
pop it again when we're done with the switch.
(switch_section): The new block is a child of the current_block.
Fixes bug #24007, added test-152.cs.
2002-07-27 Martin Baulig <martin@gnome.org>
* expression.cs (Invocation.EmitArguments): When calling a varargs
function with only its fixed arguments, we need to pass an empty
array.
2002-07-27 Martin Baulig <martin@gnome.org>
Mono 0.13 has been released.
2002-07-25 Miguel de Icaza <miguel@ximian.com>
* driver.cs: Rename --resource to --linkres, because that is what
we do currently, we dont support --resource yet.
* cs-tokenizer.cs: Fix test for reporting endif mismatches.
2002-07-25 Martin Baulig <martin@gnome.org>
* class.cs (MethodData): New public class. This is a `method builder'
class for a method or one accessor of a Property/Indexer/Event.
(MethodData.GetMethodFlags): Moved here from MemberBase.
(MethodData.ApplyAttributes): Likewise.
(MethodData.ApplyObsoleteAttribute): Likewise.
(MethodData.ApplyConditionalAttribute): Likewise.
(MethodData.ApplyDllImportAttribute): Likewise.
(MethodData.CheckAbstractAndExternal): Likewise.
(MethodData.Define): Formerly knows as MemberBase.DefineMethod().
(MethodData.Emit): Formerly known as Method.Emit().
(MemberBase): Moved everything which was specific to a single
accessor/method to MethodData.
(Method): Create a new MethodData and call Define() and Emit() on it.
(Property, Indexer, Event): Create a new MethodData objects for each
accessor and call Define() and Emit() on them.
2002-07-25 Martin Baulig <martin@gnome.org>
Made MethodCore derive from MemberBase to reuse the code from there.
MemberBase now also checks for attributes.
* class.cs (MethodCore): Derive from MemberBase, not MemberCore.
(MemberBase.GetMethodFlags): Moved here from class Method and marked
as virtual.
(MemberBase.DefineAccessor): Renamed to DefineMethod(), added
`CallingConventions cc' and `Attributes opt_attrs' arguments.
(MemberBase.ApplyAttributes): New virtual method; applies the
attributes to a method or accessor.
(MemberBase.ApplyObsoleteAttribute): New protected virtual method.
(MemberBase.ApplyConditionalAttribute): Likewise.
(MemberBase.ApplyDllImportAttribute): Likewise.
(MemberBase.CheckAbstractAndExternal): Likewise.
(MethodCore.ParameterTypes): This is now a property instead of a
method, it's initialized from DoDefineParameters().
(MethodCore.ParameterInfo): Removed the set accessor.
(MethodCore.DoDefineParameters): New protected virtual method to
initialize ParameterTypes and ParameterInfo.
(Method.GetReturnType): We can now simply return the MemberType.
(Method.GetMethodFlags): Override the MemberBase version and add
the conditional flags.
(Method.CheckBase): Moved some code from Define() here, call
DoDefineParameters() here.
(Method.Define): Use DoDefine() and DefineMethod() from MemberBase
here to avoid some larger code duplication.
(Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
ensure that abstract and external accessors don't declare a body.
* attribute.cs (Attribute.GetValidPieces): Make this actually work:
`System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
lookup in the attribute's parent classes, so we need to abort as soon
as we found the first match.
(Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
the attribute has no arguments.
* typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
of a Method.
2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* cs-parser.jay: reverted previous patch.
2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* cs-parser.jay: fixed bug #22119.
2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* attribute.cs: fixed compilation. The error was:
"attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
be assigned to before control leaves the current method."
[FIXME: Filed as bug #28186: MCS must report this error.]
2002-07-25 Martin Baulig <martin@gnome.org>
* attribute.cs (Attribute.Conditional_GetConditionName): New static
method to pull the condition name ouf of a Conditional attribute.
(Attribute.Obsolete_GetObsoleteMessage): New static method to pull
the obsolete message and error flag out of an Obsolete attribute.
* class.cs (Method.GetMethodFlags): New public method to get the
TypeManager.MethodFlags for this method.
(Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
private methods.
(Method.Define): Get and apply the Obsolete and Conditional attributes;
if we're overriding a virtual function, set the new private variable
`parent_method'; call the new TypeManager.AddMethod().
* typemanager.cs (TypeManager.AddMethod): New static method. Stores
the MethodBuilder and the Method in a PtrHashtable.
(TypeManager.builder_to_method): Added for this purpose.
(TypeManager.MethodFlags): Added IsObsoleteError.
(TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
Obsolete and Conditional arguments in MethodBuilders. If we discover
an Obsolete attribute, emit an appropriate warning 618 / error 619 with
the message from the attribute.
2002-07-24 Martin Baulig <martin@gnome.org>
* cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
preprocessor directives, ensure that the argument to #define/#undef is
exactly one identifier and that it's actually an identifier.
Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
did not work ....
2002-07-24 Martin Baulig <martin@gnome.org>