Copied remotely
[mono.git] / mcs / mcs / PLAN
1 Missing:
2
3         Support parameters.
4
5 Removal:
6
7         Probably remove the parameter mapping as well for iterators,
8         and just embed the knowledge on the parameter class.
9
10 Moving Iterators/Anonymous to a more comprehensive Field-based setup
11 --------------------------------------------------------------------
12         IDEA:
13
14         Maybe turn LocalVariableReference into Field access?
15
16
17         One issue to consider if iterators/references in anon-methods
18         to a setup where we use a FieldExpr plus a "clever" instance
19         expression is that the LocalVariableReference will transform
20         itself into something else during Resolve, but the resulting
21         information must still be tracked in the LocalInfo
22
23         I believe this is because:
24
25         EmitMeta should not generate locals for things that have been
26         captured, so it is important to track this information.
27
28         Which means that we eliminate the knowledge about captured
29         information from LocalVariableReference/ParameterReference
30         during the Emit phase, but we still need it during the resolve
31         phase.
32
33 Iterators:
34
35         In foreach, I do not like the if (.. InIterator) special
36         handling that we have there, it should be handled differently.
37
38 Block.Parameters
39 ----------------
40
41         Maybe move this to Topblock?  There is a fixme there.
42
43
44 Clean Up
45 --------
46
47         Move MapVariable from CodeGen into Block?
48
49 Improve test:
50
51         Necesitamos que a-capture8.cs pruebe si la asignacion funciona o no.
52
53 Audit:
54
55         Al emitir instancias de variables
56         (EmitCaptureVariableInstance) parece ser que el loop de iteracion:
57
58         while (si.ScopeBlock.ID != li.Block.ID)
59
60         está mas actulizado que el codigo similar para parámetros, es posible
61         que sea bitrot de parámetros o que en los parámetros usamos otra estrategia
62         (lo segundo es más razonable).
63         
64 Iteradores:
65
66         En algún lugar no pongo el `FieldBuilder' a un valor con los
67         iteradores, ver expression.cs: 3616, local_info.FieldBuilder es nulo.
68
69 Parameters:
70
71         a-parameter4.cs falla por que no se liga el método anónimo
72         anidado con el padre.
73
74 Cleanup:
75
76                         CaptureContext cc = ContextForParameter (ec.CurrentBlock.Toplevel, name);
77                         if (cc != this){
78                                 cc.EmitParameter (ec, name);
79                                 return;
80                         }
81
82         That should be a static method, and call the instance method
83         in the right CaptureContext, instead of having the CaptureContext
84         compute that itself.
85
86 Refactor:
87
88         The code that links ScopeInfos together, its replicated in 3 places.
89
90 MakePinned is gone:
91
92         Need to audit the code now that use DeclareLocal, and that this uses
93         a differnent code path than the main mcs.
94
95 Parameters:
96
97         We can optimize and make sure that we point to a separate class that
98         only holds the parameters.
99
100 We need to nest anonymous method hosts as anonymous classes, currently
101 they are all toplevel.
102
103 Need to fix the order in which types are closed: currently we are not
104 compatible with the MS requirement that the parent has to be created
105 before the children are.
106
107 Would be nice to name the anonymous methods after the method container name.
108
109 Problems:
110
111         We cluster blocks at the scope level, not at the level the declaration
112         when its really needed:
113
114         ie:
115
116                 int a = 0;
117                 if (a == 1)
118                         ;
119                 int b = 0
120
121         We consider those:
122
123                 int a;
124                 {
125                         int b;
126                 }
127
128         So we cluster them on separate anonymous helper classes, which
129         means the resulting is not as efficient.
130
131 Optimization from MS:
132
133         When creating an anonymous method that is static, cache its value.
134         
135         I do not like the call to DoInit() in anonymous.cs, move it?
136
137         Parameter assignment seems too simple.
138
139 Tests and pending features:
140
141         Support access to parameters of a delegate (see a11.cs)
142
143         How do parameters map to nested anonymous methods?
144
145         Helper classes should be nested classes of the original host class.
146         (permission: access private fields from another part)
147         
148         Switch statement is broken (because it uses ILGenerator during
149         the Resolve phase, which with the `anonymous' branch is no longer
150         the case: so we have to delay the creation of labels until they 
151         are needed, during the Emit phase).
152
153         Iteratorks are broken.
154
155 Validation:
156
157         For testing, set ec.IG == null during resolve, restore value
158         for emit.
159
160         Currently it is commented out: there is a bug in the
161         statement.cs changes (see the old-statement.cs, the compiler
162         fails during bootstrap)
163
164         Need to set `S.R.CompilerServices.CompilerGeneratedAttribute'
165         on classes that the compiler generates.