Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
[mono.git] / mcs / mcs / TODO
1 Dead Code Elimination bugs:
2 ---------------------------
3
4         I should also resolve all the children expressions in Switch, Fixed, Using.
5
6 Major tasks:
7 ------------
8
9         Pinned and volatile require type modifiers that can not be encoded
10         with Reflection.Emit.
11
12         Properties and 17.6.3: Finish it.
13
14         Implement base indexer access.
15
16 readonly variables and ref/out
17         
18 BUGS
19 ----
20
21 * Explicit indexer implementation is missing.
22
23 * Check for Final when overriding, if the parent is Final, then we cant
24   allow an override.
25
26 * Interface indexers
27
28         I have not figured out why the Microsoft version puts an
29         `instance' attribute, and I am not generating this `instance' attribute.
30
31         Explanation: The reason for the `instance' attribute on
32         indexers is that indexers only apply to instances
33
34 * Arrays
35
36         We need to make sure at *compile time* that the arguments in
37         the expression list of an array creation are always positive.
38
39 * Indexer bugs:
40
41         the following wont work:
42
43         x [0] = x [1] = N
44
45         if x has indexers, the value of x [N] set is set to void.  This needs to be
46         fixed.
47
48 * Array declarations
49
50         Multi-dim arrays are declared as [,] instead of [0..,0..]
51
52 * Break/Continue statements
53
54         A finally block should reset the InLoop/LoopBegin/LoopEnd, as
55         they are logically outside the scope of the loop.
56
57 * Break/continue part 2.
58
59         They should transfer control to the finally block if inside a try/catch
60         block.
61
62 * Method Registration and error CS111
63
64         The way we use the method registration to signal 111 is wrong.
65         
66         Method registration should only be used to register methodbuilders,
67         we need an alternate method of checking for duplicates.
68
69 * We need to catch:
70
71         extern string Property {
72                 get { } 
73         }
74
75         The get there should only have a semicolon
76         
77 *
78 > // CSC sets beforefieldinit
79 > class X {
80 >   // .cctor will be generated by compiler
81 >   public static readonly object O = new System.Object ();
82 >   public static void Main () {}
83 > }
84
85
86 PENDING TASKS
87 -------------
88
89 * IMprove error handling here:
90
91         public static Process ()
92
93         THat assumes that it is a constructor, check if its the same name
94         as the class, if not report a different error than the one we use now.
95
96 * Merge test 89 and test-34
97
98 * Revisit
99
100         Primary-expression, as it has now been split into 
101         non-array-creation-expression and array-creation-expression.
102                 
103 * Static flow analysis
104
105         Required to warn about reachability of code and definite
106         assignemt as well as missing returns on functions.
107
108 * Code cleanup
109
110         The information when registering a method in InternalParameters
111         is duplicated, you can always get the types from the InternalParameters
112
113 * Emit modreq for volatiles
114
115         Handle modreq from public apis.
116
117 * Emit `pinned' for pinned local variables.
118
119         Both `modreq' and pinned will require special hacks in the compiler.
120
121 * Make sure that we are pinning the right variable
122
123 * Maybe track event usage?  Currently I am not tracking these, although they
124   are fields.
125
126 * Merge tree.cs, rootcontext.cs
127
128 OPTIMIZATIONS
129 -------------
130
131 * Implement loop inversion for `For' as well.
132
133 * There is too much unshared code between MemberAccess.Resolve and SimpleName
134   resolve.  
135  
136 * User Defined Conversions is doing way too many calls to do union sets that are not needed
137
138 * Add test case for destructors
139
140 * Places that use `Ldelema' are basically places where I will be
141   initializing a value type.  I could apply an optimization to 
142   disable the implicit local temporary from being created (by using
143   the method in New).
144
145 * Dropping TypeContainer as an argument to EmitContext
146
147         My theory is that I can get rid of the TypeBuilder completely from
148         the EmitContext, and have typecasts where it is used (from
149         DeclSpace to where it matters).  
150
151         The only pending problem is that the code that implements Aliases
152         is on TypeContainer, and probably should go in DeclSpace.
153
154 * Casts need to trigger a name resolution against types only.
155
156         currently we use a secret hand shake, probably we should use
157         a differen path, and only expressions (memberaccess, simplename)
158         would participate in this protocol.
159
160 * Use of local temporary in UnaryMutator
161
162         We should get rid of the Localtemporary there for some cases
163
164 * Emitcontext
165
166         Do we really need to instanciate this variable all the time?
167
168         It could be static for all we care, and just use it for making
169         sure that there are no recursive invocations on it.
170
171 * Use of EmitBranchable
172
173         Currently I use brfalse/brtrue in the code for statements, instead of
174         using the EmitBranchable function that lives in Binary
175
176 * ConvertImplicit
177
178         Currently ConvertImplicit will not catch things like:
179
180         - IntLiteral in a float context to generate a -FloatLiteral.
181         Instead it will perform an integer load followed by a conversion.
182
183 * Tests
184
185         Write tests for the various reference conversions.  We have
186         test for all the numeric conversions.
187
188 * Optimizations
189
190         In Indexers and Properties, probably support an EmitWithDup
191         That emits the code to call Get and then leaves a this pointer
192         in the stack, so that later a Store can be emitted using that
193         this pointer (consider Property++ or Indexer++)
194
195 * Optimizations: variable allocation.
196
197         When local variables of a type are required, we should request
198         the variable and later release it when we are done, so that
199         the same local variable slot can be reused later on.
200
201 * Add a cache for the various GetArrayMethod operations.
202
203 * TypeManager.FindMembers:
204
205         Instead of having hundreds of builder_to_blah hash table, have
206         a single one that maps a TypeBuilder `t' to a set of classes
207         that implement an interface that supports FindMembers.
208
209 * MakeUnionSet Callers
210
211         If the types are the same, there is no need to compute the unionset,
212         we can just use the list from one of the types.
213
214 * Factor all the FindMembers in all the FindMembers providers.
215
216 * Factor the lookup code for class declarations an interfaces
217   (interface.cs:GetInterfaceByName)
218
219 RECOMMENDATIONS
220 ---------------
221
222 * Use of lexer.Location in the parser
223
224         Currently we do:
225
226         TOKEN nt TERMINAL nt TERMINAL nt3 {
227                 $$ = new Blah ($2, $4, $6, lexer.Location);
228         }
229
230         This is bad, because the lexer.Location is for the last item in `nt3'
231
232         We need to change that to use this pattern:
233
234         TOKEN { oob_stack.Push (lexer.Location) } nt TERMINAL nt TERMINAL nt3 {
235                 $$ = new Blah ($3, $5, $7, (Location) oob_stack.Pop ());
236         }
237
238         Notice how numbering of the arguments changes as the
239         { oob_stack.Push (lexer.Location) } takes a "slot"  in the productions.
240
241 * local_variable_declaration
242
243         Not sure that this grammar is correct, we might have to
244         resolve this during semantic analysis.
245
246 * Idea
247
248         MethodGroupExpr
249
250         These guys should only appear as part of an Invocation, so we
251         probably can afford to have a special callback:
252
253                 Expression.ResolveAllowMemberGroups
254
255         This is only called by Invocation (or anyone that consumes 
256         MethodGroupExprs)
257
258         And the regular DoResolve and DoResolveLValue do emit the error
259         654 `Method referenced without argument list'.  
260
261         Otherwise, a resolution will return a MethodGroupExpr which is
262         not guaranteed to have set its `Expression.Type' to a non-null
263         value.