2002-02-11 Ravi Pratap <ravi@ximian.com>
[mono.git] / mcs / mcs / TODO
1 Major tasks:
2 ------------
3
4         Pinned and volatile require type modifiers that can not be encoded
5         with Reflection.Emit.
6
7         Properties and 17.6.3: Finish it.
8
9         Implement base indexer access.
10
11 MethodGroupExpr
12
13         These guys should only appear as part of an Invocation, so we
14         probably can afford to have a special callback:
15
16                 Expression.ResolveAllowMemberGroups
17
18         This is only called by Invocation (or anyone that consumes 
19         MethodGroupExprs)
20
21         And the regular DoResolve and DoResolveLValue do emit the error
22         654 `Method referenced without argument list'.  
23
24         Otherwise, a resolution will return a MethodGroupExpr which is
25         not guaranteed to have set its `Expression.Type' to a non-null
26         value.
27
28 AddressOf
29         Needs an extra argument: `set' or `read', this will help 
30         to track usage errors in variables (since AddressOf does not
31         really know what is it being used for, it could be either)
32
33 Unsafe code:
34         Pointer arithmetic operators (++ and -- are done)
35         Test for ++ and -- for non-builtin-types
36         fixed
37
38 readonly variables and ref/out
39         
40 BUGS
41 ----
42
43 * Check for Final when overriding, if the parent is Final, then we cant
44   allow an override.
45
46 * Add test case for destructors
47
48 * Do not declare a .property on things that are just implementations, that
49   comes from the parent, just do the method.
50
51 * Currently the code path for 108/109 reporting is not being ran for methods
52   as we need to compare method signatures.  But since we retrieve the expensive
53   method arguments in the method, we probably should do 108/109 processing there.
54
55 * Emit warning on hiding members without NEW not only in members.
56
57 * Implement visibility.
58  
59 * Adding variables.
60
61         We do add variables in a number of places, and this is erroneous:
62
63         void a (int b)
64         {
65                 int b;
66         }
67
68         Also:
69
70         void a (int b)
71         {
72                 foreach (int b ...)
73                         ;
74         }
75
76 * Visibility
77
78         I am not reporting errors on visibility yet.
79
80 * Interface indexers
81
82         I have not figured out why the Microsoft version puts an
83         `instance' attribute, and I am not generating this `instance' attribute.
84
85         Explanation: The reason for the `instance' attribute on
86         indexers is that indexers only apply to instances
87
88 * Arrays
89
90         We need to make sure at *compile time* that the arguments in
91         the expression list of an array creation are always positive.
92
93 * Implement dead code elimination in statement.cs
94
95         It is pretty simple to implement dead code elimination in 
96         if/do/while
97
98 * Indexer bugs:
99
100         the following wont work:
101
102         x [0] = x [1] = N
103
104         if x has indexers, the value of x [N] set is set to void.  This needs to be
105         fixed.
106
107 * Array declarations
108
109         Multi-dim arrays are declared as [,] instead of [0..,0..]
110
111 * Break/Continue statements
112
113         A finally block should reset the InLoop/LoopBegin/LoopEnd, as
114         they are logically outside the scope of the loop.
115
116 * Break/continue part 2.
117
118         They should transfer control to the finally block if inside a try/catch
119         block.
120
121 * Method Registration and error CS111
122
123         The way we use the method registration to signal 111 is wrong.
124         
125         Method registration should only be used to register methodbuilders,
126         we need an alternate method of checking for duplicates.
127
128 * We need to catch:
129
130         extern string Property {
131                 get { } 
132         }
133
134         The get there should only have a semicolon
135         
136 *
137 > // CSC sets beforefieldinit
138 > class X {
139 >   // .cctor will be generated by compiler
140 >   public static readonly object O = new System.Object ();
141 >   public static void Main () {}
142 > }
143
144
145 PENDING TASKS
146 -------------
147
148 * Revisit
149
150         Primary-expression, as it has now been split into 
151         non-array-creation-expression and array-creation-expression.
152                 
153 * Static flow analysis
154
155         Required to warn about reachability of code and definite
156         assignemt as well as missing returns on functions.
157
158 * Code cleanup
159
160         The information when registering a method in InternalParameters
161         is duplicated, you can always get the types from the InternalParameters
162
163 * Emit modreq for volatiles
164
165         Handle modreq from public apis.
166
167 OPTIMIZATIONS
168 -------------
169
170 * Use of local temporary in UnaryMutator
171
172         We should get rid of the Localtemporary there for some cases
173
174 * Emitcontext
175
176         Do we really need to instanciate this variable all the time?
177
178         It could be static for all we care, and just use it for making
179         sure that there are no recursive invocations on it.
180
181 * Static-ization
182
183         Since AppDomain exists, maybe we can get rid of all the stuff
184         that is part of the `compiler instance' and just use globals
185         everywhere.
186
187
188 * Constructors
189
190         Currently it calls the parent constructor before initializing fields.
191         It should do it the other way around.
192
193 * Use of EmitBranchable
194
195         Currently I use brfalse/brtrue in the code for statements, instead of
196         using the EmitBranchable function that lives in Binary
197
198 * ConvertImplicit
199
200         Currently ConvertImplicit will not catch things like:
201
202         - IntLiteral in a float context to generate a -FloatLiteral.
203         Instead it will perform an integer load followed by a conversion.
204
205 * Tests
206
207         Write tests for the various reference conversions.  We have
208         test for all the numeric conversions.
209
210 * Remove the tree dumper, cleanup `public readonly' 
211
212         And make all the stuff which is `public readonly' be private unless
213         required.
214
215 * Optimizations
216
217         In Indexers and Properties, probably support an EmitWithDup
218         That emits the code to call Get and then leaves a this pointer
219         in the stack, so that later a Store can be emitted using that
220         this pointer (consider Property++ or Indexer++)
221
222
223 * Optimizations: variable allocation.
224
225         When local variables of a type are required, we should request
226         the variable and later release it when we are done, so that
227         the same local variable slot can be reused later on.
228
229 * Add a cache for the various GetArrayMethod operations.
230
231 * Optimization:
232
233         Do not use StatementCollections, use ArrayLists of Statements,
234         and then "copy" it out to arrays.  Then reuse the existing
235         Statement structures.
236
237 * TypeManager.FindMembers:
238
239         Instead of having hundreds of builder_to_blah hash table, have
240         a single one that maps a TypeBuilder `t' to a set of classes
241         that implement an interface that supports FindMembers.
242
243 RECOMMENDATIONS
244 ---------------
245
246 * Use of lexer.Location in the parser
247
248         Currently we do:
249
250         TOKEN nt TERMINAL nt TERMINAL nt3 {
251                 $$ = new Blah ($2, $4, $6, lexer.Location);
252         }
253
254         This is bad, because the lexer.Location is for the last item in `nt3'
255
256         We need to change that to use this pattern:
257
258         TOKEN { oob_stack.Push (lexer.Location) } nt TERMINAL nt TERMINAL nt3 {
259                 $$ = new Blah ($3, $5, $7, (Location) oob_stack.Pop ());
260         }
261
262         Notice how numbering of the arguments changes as the
263         { oob_stack.Push (lexer.Location) } takes a "slot"  in the productions.
264
265 * local_variable_declaration
266
267         Not sure that this grammar is correct, we might have to
268         resolve this during semantic analysis.
269
270
271 * Try/Catch
272
273         Investigate what is  the right value to return  from `Emit' in
274         there (ie, for the `all code paths return')
275         
276
277 * Optimizations
278
279         Only create one `This' instance per class, and reuse it.
280
281         Maybe keep a pool of constants/literals (zero, 1)?
282
283 ************
284 Potential bug:
285
286         We would need to decode the shortname before we lookup members?
287         
288         Maybe not.
289
290 interface I {
291         void A ();
292 }
293
294 class X : I {
295         void I.A ();
296 }
297
298 class Y : X, I {
299         void I.A () {}
300 }
301
302
303
304 *************
305