OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart2js.semantics_visitor_test; | 5 part of dart2js.semantics_visitor_test; |
6 | 6 |
7 const Map<String, List<Test>> DECL_TESTS = const { | 7 const Map<String, List<Test>> DECL_TESTS = const { |
8 'Function declarations': const [ | 8 'Function declarations': const [ |
9 const Test( | 9 const Test(''' |
10 ''' | |
11 m(a, b) {} | 10 m(a, b) {} |
12 ''', | 11 ''', const [ |
13 const [ | 12 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
14 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 13 element: 'function(m)', parameters: '(a,b)', body: '{}'), |
15 element: 'function(m)', parameters: '(a,b)', body: '{}'), | 14 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
16 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 15 element: 'parameter(m#a)', index: 0), |
17 element: 'parameter(m#a)', index: 0), | 16 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
18 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 17 element: 'parameter(m#b)', index: 1), |
19 element: 'parameter(m#b)', index: 1), | 18 ]), |
20 ]), | 19 const Test(''' |
21 const Test( | |
22 ''' | |
23 m(a, [b]) {} | 20 m(a, [b]) {} |
24 ''', | 21 ''', const [ |
25 const [ | 22 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
26 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 23 element: 'function(m)', parameters: '(a,[b])', body: '{}'), |
27 element: 'function(m)', parameters: '(a,[b])', body: '{}'), | 24 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
28 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 25 element: 'parameter(m#a)', index: 0), |
29 element: 'parameter(m#a)', index: 0), | 26 const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL, |
30 const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL, | 27 element: 'parameter(m#b)', index: 1, constant: 'null'), |
31 element: 'parameter(m#b)', index: 1, constant: 'null'), | 28 ]), |
32 ]), | 29 const Test(''' |
33 const Test( | |
34 ''' | |
35 m(a, [b = null]) {} | 30 m(a, [b = null]) {} |
36 ''', | 31 ''', const [ |
37 const [ | 32 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
38 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 33 element: 'function(m)', parameters: '(a,[b=null])', body: '{}'), |
39 element: 'function(m)', parameters: '(a,[b=null])', body: '{}'), | 34 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
40 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 35 element: 'parameter(m#a)', index: 0), |
41 element: 'parameter(m#a)', index: 0), | 36 const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL, |
42 const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL, | 37 element: 'parameter(m#b)', constant: 'null', index: 1), |
43 element: 'parameter(m#b)', constant: 'null', index: 1), | 38 ]), |
44 ]), | 39 const Test(''' |
45 const Test( | |
46 ''' | |
47 m(a, [b = 42]) {} | 40 m(a, [b = 42]) {} |
48 ''', | 41 ''', const [ |
49 const [ | 42 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
50 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 43 element: 'function(m)', parameters: '(a,[b=42])', body: '{}'), |
51 element: 'function(m)', parameters: '(a,[b=42])', body: '{}'), | 44 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
52 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 45 element: 'parameter(m#a)', index: 0), |
53 element: 'parameter(m#a)', index: 0), | 46 const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL, |
54 const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL, | 47 element: 'parameter(m#b)', constant: 42, index: 1), |
55 element: 'parameter(m#b)', constant: 42, index: 1), | 48 ]), |
56 ]), | 49 const Test(''' |
57 const Test( | |
58 ''' | |
59 m(a, {b}) {} | 50 m(a, {b}) {} |
60 ''', | 51 ''', const [ |
61 const [ | 52 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
62 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 53 element: 'function(m)', parameters: '(a,{b})', body: '{}'), |
63 element: 'function(m)', parameters: '(a,{b})', body: '{}'), | 54 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
64 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 55 element: 'parameter(m#a)', index: 0), |
65 element: 'parameter(m#a)', index: 0), | 56 const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL, |
66 const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL, | 57 element: 'parameter(m#b)', constant: 'null'), |
67 element: 'parameter(m#b)', constant: 'null'), | 58 ]), |
68 ]), | 59 const Test(''' |
69 const Test( | |
70 ''' | |
71 m(a, {b: null}) {} | 60 m(a, {b: null}) {} |
72 ''', | 61 ''', const [ |
73 const [ | 62 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
74 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 63 element: 'function(m)', parameters: '(a,{b: null})', body: '{}'), |
75 element: 'function(m)', parameters: '(a,{b: null})', body: '{}'), | 64 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
76 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 65 element: 'parameter(m#a)', index: 0), |
77 element: 'parameter(m#a)', index: 0), | 66 const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL, |
78 const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL, | 67 element: 'parameter(m#b)', constant: 'null'), |
79 element: 'parameter(m#b)', constant: 'null'), | 68 ]), |
80 ]), | 69 const Test(''' |
81 const Test( | |
82 ''' | |
83 m(a, {b:42}) {} | 70 m(a, {b:42}) {} |
84 ''', | 71 ''', const [ |
85 const [ | 72 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
86 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 73 element: 'function(m)', parameters: '(a,{b: 42})', body: '{}'), |
87 element: 'function(m)', parameters: '(a,{b: 42})', body: '{}'), | 74 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
88 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 75 element: 'parameter(m#a)', index: 0), |
89 element: 'parameter(m#a)', index: 0), | 76 const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL, |
90 const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL, | 77 element: 'parameter(m#b)', constant: 42), |
91 element: 'parameter(m#b)', constant: 42), | 78 ]), |
92 ]), | 79 const Test(''' |
93 const Test( | |
94 ''' | |
95 get m => null; | 80 get m => null; |
96 ''', | 81 ''', const [ |
97 const [ | 82 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_DECL, |
98 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_DECL, | 83 element: 'getter(m)', body: '=>null;'), |
99 element: 'getter(m)', body: '=>null;'), | 84 ]), |
100 ]), | 85 const Test(''' |
101 const Test( | |
102 ''' | |
103 set m(a) {} | 86 set m(a) {} |
104 ''', | 87 ''', const [ |
105 const [ | 88 const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_DECL, |
106 const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_DECL, | 89 element: 'setter(m)', parameters: '(a)', body: '{}'), |
107 element: 'setter(m)', parameters: '(a)', body: '{}'), | 90 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
108 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 91 element: 'parameter(m#a)', index: 0), |
109 element: 'parameter(m#a)', index: 0), | 92 ]), |
110 ]), | 93 const Test.clazz(''' |
111 const Test.clazz( | |
112 ''' | |
113 class C { | 94 class C { |
114 static m(a, b) {} | 95 static m(a, b) {} |
115 } | 96 } |
116 ''', | 97 ''', const [ |
117 const [ | 98 const Visit(VisitKind.VISIT_STATIC_FUNCTION_DECL, |
118 const Visit(VisitKind.VISIT_STATIC_FUNCTION_DECL, | 99 element: 'function(C#m)', parameters: '(a,b)', body: '{}'), |
119 element: 'function(C#m)', parameters: '(a,b)', body: '{}'), | 100 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
120 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 101 element: 'parameter(m#a)', index: 0), |
121 element: 'parameter(m#a)', index: 0), | 102 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
122 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 103 element: 'parameter(m#b)', index: 1), |
123 element: 'parameter(m#b)', index: 1), | 104 ]), |
124 ]), | 105 const Test.clazz(''' |
125 const Test.clazz( | |
126 ''' | |
127 class C { | 106 class C { |
128 static get m => null; | 107 static get m => null; |
129 } | 108 } |
130 ''', | 109 ''', const [ |
131 const [ | 110 const Visit(VisitKind.VISIT_STATIC_GETTER_DECL, |
132 const Visit(VisitKind.VISIT_STATIC_GETTER_DECL, | 111 element: 'getter(C#m)', body: '=>null;'), |
133 element: 'getter(C#m)', body: '=>null;'), | 112 ]), |
134 ]), | 113 const Test.clazz(''' |
135 const Test.clazz( | |
136 ''' | |
137 class C { | 114 class C { |
138 static set m(a) {} | 115 static set m(a) {} |
139 } | 116 } |
140 ''', | 117 ''', const [ |
141 const [ | 118 const Visit(VisitKind.VISIT_STATIC_SETTER_DECL, |
142 const Visit(VisitKind.VISIT_STATIC_SETTER_DECL, | 119 element: 'setter(C#m)', parameters: '(a)', body: '{}'), |
143 element: 'setter(C#m)', parameters: '(a)', body: '{}'), | 120 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
144 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 121 element: 'parameter(m#a)', index: 0), |
145 element: 'parameter(m#a)', index: 0), | 122 ]), |
146 ]), | 123 const Test.clazz(''' |
147 const Test.clazz( | |
148 ''' | |
149 class C { | 124 class C { |
150 m(a, b) {} | 125 m(a, b) {} |
151 } | 126 } |
152 ''', | 127 ''', const [ |
153 const [ | 128 const Visit(VisitKind.VISIT_INSTANCE_METHOD_DECL, |
154 const Visit(VisitKind.VISIT_INSTANCE_METHOD_DECL, | 129 element: 'function(C#m)', parameters: '(a,b)', body: '{}'), |
155 element: 'function(C#m)', parameters: '(a,b)', body: '{}'), | 130 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
156 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 131 element: 'parameter(m#a)', index: 0), |
157 element: 'parameter(m#a)', index: 0), | 132 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
158 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 133 element: 'parameter(m#b)', index: 1), |
159 element: 'parameter(m#b)', index: 1), | 134 ]), |
160 ]), | 135 const Test.clazz(''' |
161 const Test.clazz( | |
162 ''' | |
163 class C { | 136 class C { |
164 get m => null; | 137 get m => null; |
165 } | 138 } |
166 ''', | 139 ''', const [ |
167 const [ | 140 const Visit(VisitKind.VISIT_INSTANCE_GETTER_DECL, |
168 const Visit(VisitKind.VISIT_INSTANCE_GETTER_DECL, | 141 element: 'getter(C#m)', body: '=>null;'), |
169 element: 'getter(C#m)', body: '=>null;'), | 142 ]), |
170 ]), | 143 const Test.clazz(''' |
171 const Test.clazz( | |
172 ''' | |
173 class C { | 144 class C { |
174 set m(a) {} | 145 set m(a) {} |
175 } | 146 } |
176 ''', | 147 ''', const [ |
177 const [ | 148 const Visit(VisitKind.VISIT_INSTANCE_SETTER_DECL, |
178 const Visit(VisitKind.VISIT_INSTANCE_SETTER_DECL, | 149 element: 'setter(C#m)', parameters: '(a)', body: '{}'), |
179 element: 'setter(C#m)', parameters: '(a)', body: '{}'), | 150 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
180 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 151 element: 'parameter(m#a)', index: 0), |
181 element: 'parameter(m#a)', index: 0), | 152 ]), |
182 ]), | 153 const Test.clazz(''' |
183 const Test.clazz( | |
184 ''' | |
185 abstract class C { | 154 abstract class C { |
186 m(a, b); | 155 m(a, b); |
187 } | 156 } |
188 ''', | 157 ''', const [ |
189 const [ | 158 const Visit(VisitKind.VISIT_ABSTRACT_METHOD_DECL, |
190 const Visit(VisitKind.VISIT_ABSTRACT_METHOD_DECL, | 159 element: 'function(C#m)', parameters: '(a,b)'), |
191 element: 'function(C#m)', parameters: '(a,b)'), | 160 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
192 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 161 element: 'parameter(m#a)', index: 0), |
193 element: 'parameter(m#a)', index: 0), | 162 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
194 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 163 element: 'parameter(m#b)', index: 1), |
195 element: 'parameter(m#b)', index: 1), | 164 ]), |
196 ]), | 165 const Test.clazz(''' |
197 const Test.clazz( | |
198 ''' | |
199 abstract class C { | 166 abstract class C { |
200 get m; | 167 get m; |
201 } | 168 } |
202 ''', | 169 ''', const [ |
203 const [ | 170 const Visit(VisitKind.VISIT_ABSTRACT_GETTER_DECL, element: 'getter(C#m)'), |
204 const Visit(VisitKind.VISIT_ABSTRACT_GETTER_DECL, | 171 ]), |
205 element: 'getter(C#m)'), | 172 const Test.clazz(''' |
206 ]), | |
207 const Test.clazz( | |
208 ''' | |
209 abstract class C { | 173 abstract class C { |
210 set m(a); | 174 set m(a); |
211 } | 175 } |
212 ''', | 176 ''', const [ |
213 const [ | 177 const Visit(VisitKind.VISIT_ABSTRACT_SETTER_DECL, |
214 const Visit(VisitKind.VISIT_ABSTRACT_SETTER_DECL, | 178 element: 'setter(C#m)', parameters: '(a)'), |
215 element: 'setter(C#m)', parameters: '(a)'), | 179 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
216 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 180 element: 'parameter(m#a)', index: 0), |
217 element: 'parameter(m#a)', index: 0), | 181 ]), |
218 ]), | 182 const Test(''' |
219 const Test( | |
220 ''' | |
221 m(a, b) {} | 183 m(a, b) {} |
222 ''', | 184 ''', const [ |
223 const [ | 185 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
224 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 186 element: 'function(m)', parameters: '(a,b)', body: '{}'), |
225 element: 'function(m)', parameters: '(a,b)', body: '{}'), | 187 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
226 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 188 element: 'parameter(m#a)', index: 0), |
227 element: 'parameter(m#a)', index: 0), | 189 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
228 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 190 element: 'parameter(m#b)', index: 1), |
229 element: 'parameter(m#b)', index: 1), | 191 ]), |
230 ]), | 192 const Test(''' |
231 const Test( | |
232 ''' | |
233 m() { | 193 m() { |
234 local(a, b) {} | 194 local(a, b) {} |
235 } | 195 } |
236 ''', | 196 ''', const [ |
237 const [ | 197 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
238 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 198 element: 'function(m)', parameters: '()', body: '{local(a,b){}}'), |
239 element: 'function(m)', parameters: '()', body: '{local(a,b){}}'), | 199 const Visit(VisitKind.VISIT_LOCAL_FUNCTION_DECL, |
240 const Visit(VisitKind.VISIT_LOCAL_FUNCTION_DECL, | 200 element: 'function(m#local)', parameters: '(a,b)', body: '{}'), |
241 element: 'function(m#local)', parameters: '(a,b)', body: '{}'), | 201 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
242 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 202 element: 'parameter(local#a)', index: 0), |
243 element: 'parameter(local#a)', index: 0), | 203 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
244 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 204 element: 'parameter(local#b)', index: 1), |
245 element: 'parameter(local#b)', index: 1), | 205 ]), |
246 ]), | 206 const Test(''' |
247 const Test( | |
248 ''' | |
249 m() => (a, b) {}; | 207 m() => (a, b) {}; |
250 ''', | 208 ''', const [ |
251 const [ | 209 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
252 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 210 element: 'function(m)', parameters: '()', body: '=>(a,b){};'), |
253 element: 'function(m)', parameters: '()', body: '=>(a,b){};'), | 211 const Visit(VisitKind.VISIT_CLOSURE_DECL, |
254 const Visit(VisitKind.VISIT_CLOSURE_DECL, | 212 element: 'function(m#)', parameters: '(a,b)', body: '{}'), |
255 element: 'function(m#)', parameters: '(a,b)', body: '{}'), | 213 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
256 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 214 element: 'parameter(#a)', index: 0), |
257 element: 'parameter(#a)', index: 0), | 215 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
258 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 216 element: 'parameter(#b)', index: 1), |
259 element: 'parameter(#b)', index: 1), | 217 ]), |
260 ]), | |
261 ], | 218 ], |
262 'Constructor declarations': const [ | 219 'Constructor declarations': const [ |
263 const Test.clazz( | 220 const Test.clazz(''' |
264 ''' | |
265 class C { | 221 class C { |
266 C(a, b); | 222 C(a, b); |
267 } | 223 } |
268 ''', | 224 ''', const [ |
269 const [ | 225 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL, |
270 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL, | 226 element: 'generative_constructor(C#)', |
271 element: 'generative_constructor(C#)', | 227 parameters: '(a,b)', |
272 parameters: '(a,b)', | 228 body: ';'), |
273 body: ';'), | 229 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
274 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 230 element: 'parameter(#a)', index: 0), |
275 element: 'parameter(#a)', index: 0), | 231 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
276 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 232 element: 'parameter(#b)', index: 1), |
277 element: 'parameter(#b)', index: 1), | 233 const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE, |
278 const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE, | 234 element: 'generative_constructor(Object#)', type: 'Object'), |
279 element: 'generative_constructor(Object#)', type: 'Object'), | 235 ], method: ''), |
280 ], | 236 const Test.clazz(''' |
281 method: ''), | |
282 const Test.clazz( | |
283 ''' | |
284 class C { | 237 class C { |
285 var b; | 238 var b; |
286 C(a, this.b); | 239 C(a, this.b); |
287 } | 240 } |
288 ''', | 241 ''', const [ |
289 const [ | 242 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL, |
290 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL, | 243 element: 'generative_constructor(C#)', |
291 element: 'generative_constructor(C#)', | 244 parameters: '(a,this.b)', |
292 parameters: '(a,this.b)', | 245 body: ';'), |
293 body: ';'), | 246 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
294 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 247 element: 'parameter(#a)', index: 0), |
295 element: 'parameter(#a)', index: 0), | 248 const Visit(VisitKind.VISIT_REQUIRED_INITIALIZING_FORMAL_DECL, |
296 const Visit(VisitKind.VISIT_REQUIRED_INITIALIZING_FORMAL_DECL, | 249 element: 'initializing_formal(#b)', index: 1), |
297 element: 'initializing_formal(#b)', index: 1), | 250 const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE, |
298 const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE, | 251 element: 'generative_constructor(Object#)', type: 'Object'), |
299 element: 'generative_constructor(Object#)', type: 'Object'), | 252 ], method: ''), |
300 ], | 253 const Test.clazz(''' |
301 method: ''), | |
302 const Test.clazz( | |
303 ''' | |
304 class C { | 254 class C { |
305 var b; | 255 var b; |
306 C(a, [this.b = 42]); | 256 C(a, [this.b = 42]); |
307 } | 257 } |
308 ''', | 258 ''', const [ |
309 const [ | 259 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL, |
310 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL, | 260 element: 'generative_constructor(C#)', |
311 element: 'generative_constructor(C#)', | 261 parameters: '(a,[this.b=42])', |
312 parameters: '(a,[this.b=42])', | 262 body: ';'), |
313 body: ';'), | 263 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
314 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 264 element: 'parameter(#a)', index: 0), |
315 element: 'parameter(#a)', index: 0), | 265 const Visit(VisitKind.VISIT_OPTIONAL_INITIALIZING_FORMAL_DECL, |
316 const Visit(VisitKind.VISIT_OPTIONAL_INITIALIZING_FORMAL_DECL, | 266 element: 'initializing_formal(#b)', constant: 42, index: 1), |
317 element: 'initializing_formal(#b)', constant: 42, index: 1), | 267 const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE, |
318 const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE, | 268 element: 'generative_constructor(Object#)', type: 'Object'), |
319 element: 'generative_constructor(Object#)', type: 'Object'), | 269 ], method: ''), |
320 ], | 270 const Test.clazz(''' |
321 method: ''), | |
322 const Test.clazz( | |
323 ''' | |
324 class C { | 271 class C { |
325 var b; | 272 var b; |
326 C(a, {this.b: 42}); | 273 C(a, {this.b: 42}); |
327 } | 274 } |
328 ''', | 275 ''', const [ |
329 const [ | 276 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL, |
330 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL, | 277 element: 'generative_constructor(C#)', |
331 element: 'generative_constructor(C#)', | 278 parameters: '(a,{this.b: 42})', |
332 parameters: '(a,{this.b: 42})', | 279 body: ';'), |
333 body: ';'), | 280 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
334 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 281 element: 'parameter(#a)', index: 0), |
335 element: 'parameter(#a)', index: 0), | 282 const Visit(VisitKind.VISIT_NAMED_INITIALIZING_FORMAL_DECL, |
336 const Visit(VisitKind.VISIT_NAMED_INITIALIZING_FORMAL_DECL, | 283 element: 'initializing_formal(#b)', constant: 42), |
337 element: 'initializing_formal(#b)', constant: 42), | 284 const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE, |
338 const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE, | 285 element: 'generative_constructor(Object#)', type: 'Object'), |
339 element: 'generative_constructor(Object#)', type: 'Object'), | 286 ], method: ''), |
340 ], | 287 const Test.clazz(''' |
341 method: ''), | |
342 const Test.clazz( | |
343 ''' | |
344 class C { | 288 class C { |
345 C(a, b) : super(); | 289 C(a, b) : super(); |
346 } | 290 } |
347 ''', | 291 ''', const [ |
348 const [ | 292 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL, |
349 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL, | 293 element: 'generative_constructor(C#)', |
350 element: 'generative_constructor(C#)', | 294 parameters: '(a,b)', |
351 parameters: '(a,b)', | 295 body: ';'), |
352 body: ';'), | 296 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
353 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 297 element: 'parameter(#a)', index: 0), |
354 element: 'parameter(#a)', index: 0), | 298 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
355 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 299 element: 'parameter(#b)', index: 1), |
356 element: 'parameter(#b)', index: 1), | 300 const Visit(VisitKind.VISIT_SUPER_CONSTRUCTOR_INVOKE, |
357 const Visit(VisitKind.VISIT_SUPER_CONSTRUCTOR_INVOKE, | 301 element: 'generative_constructor(Object#)', |
358 element: 'generative_constructor(Object#)', | 302 type: 'Object', |
359 type: 'Object', | 303 arguments: '()', |
360 arguments: '()', | 304 selector: 'CallStructure(arity=0)'), |
361 selector: 'CallStructure(arity=0)'), | 305 ], method: ''), |
362 ], | 306 const Test.clazz(''' |
363 method: ''), | |
364 const Test.clazz( | |
365 ''' | |
366 class C { | 307 class C { |
367 var field; | 308 var field; |
368 C(a, b) : this.field = a; | 309 C(a, b) : this.field = a; |
369 } | 310 } |
370 ''', | 311 ''', const [ |
371 const [ | 312 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL, |
372 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL, | 313 element: 'generative_constructor(C#)', |
373 element: 'generative_constructor(C#)', | 314 parameters: '(a,b)', |
374 parameters: '(a,b)', | 315 body: ';'), |
375 body: ';'), | 316 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
376 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 317 element: 'parameter(#a)', index: 0), |
377 element: 'parameter(#a)', index: 0), | 318 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
378 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 319 element: 'parameter(#b)', index: 1), |
379 element: 'parameter(#b)', index: 1), | 320 const Visit(VisitKind.VISIT_FIELD_INITIALIZER, |
380 const Visit(VisitKind.VISIT_FIELD_INITIALIZER, | 321 element: 'field(C#field)', rhs: 'a'), |
381 element: 'field(C#field)', rhs: 'a'), | 322 const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE, |
382 const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE, | 323 element: 'generative_constructor(Object#)', type: 'Object'), |
383 element: 'generative_constructor(Object#)', type: 'Object'), | 324 ], method: ''), |
384 ], | 325 const Test.clazz(''' |
385 method: ''), | |
386 const Test.clazz( | |
387 ''' | |
388 class C { | 326 class C { |
389 var field1; | 327 var field1; |
390 var field2; | 328 var field2; |
391 C(a, b) : this.field1 = a, this.field2 = b; | 329 C(a, b) : this.field1 = a, this.field2 = b; |
392 } | 330 } |
393 ''', | 331 ''', const [ |
394 const [ | 332 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL, |
395 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL, | 333 element: 'generative_constructor(C#)', |
396 element: 'generative_constructor(C#)', | 334 parameters: '(a,b)', |
397 parameters: '(a,b)', | 335 body: ';'), |
398 body: ';'), | 336 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
399 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 337 element: 'parameter(#a)', index: 0), |
400 element: 'parameter(#a)', index: 0), | 338 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
401 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 339 element: 'parameter(#b)', index: 1), |
402 element: 'parameter(#b)', index: 1), | 340 const Visit(VisitKind.VISIT_FIELD_INITIALIZER, |
403 const Visit(VisitKind.VISIT_FIELD_INITIALIZER, | 341 element: 'field(C#field1)', rhs: 'a'), |
404 element: 'field(C#field1)', rhs: 'a'), | 342 const Visit(VisitKind.VISIT_FIELD_INITIALIZER, |
405 const Visit(VisitKind.VISIT_FIELD_INITIALIZER, | 343 element: 'field(C#field2)', rhs: 'b'), |
406 element: 'field(C#field2)', rhs: 'b'), | 344 const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE, |
407 const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE, | 345 element: 'generative_constructor(Object#)', type: 'Object'), |
408 element: 'generative_constructor(Object#)', type: 'Object'), | 346 ], method: ''), |
409 ], | 347 const Test.clazz(''' |
410 method: ''), | |
411 const Test.clazz( | |
412 ''' | |
413 class C { | 348 class C { |
414 C(a, b) : this._(a, b); | 349 C(a, b) : this._(a, b); |
415 C._(a, b); | 350 C._(a, b); |
416 } | 351 } |
417 ''', | 352 ''', const [ |
418 const [ | 353 const Visit(VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_DECL, |
419 const Visit(VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_DECL, | 354 element: 'generative_constructor(C#)', |
420 element: 'generative_constructor(C#)', | 355 parameters: '(a,b)', |
421 parameters: '(a,b)', | 356 initializers: ':this._(a,b)'), |
422 initializers: ':this._(a,b)'), | 357 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
423 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 358 element: 'parameter(#a)', index: 0), |
424 element: 'parameter(#a)', index: 0), | 359 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
425 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 360 element: 'parameter(#b)', index: 1), |
426 element: 'parameter(#b)', index: 1), | 361 const Visit(VisitKind.VISIT_THIS_CONSTRUCTOR_INVOKE, |
427 const Visit(VisitKind.VISIT_THIS_CONSTRUCTOR_INVOKE, | 362 element: 'generative_constructor(C#_)', |
428 element: 'generative_constructor(C#_)', | 363 arguments: '(a,b)', |
429 arguments: '(a,b)', | 364 selector: 'CallStructure(arity=2)'), |
430 selector: 'CallStructure(arity=2)'), | 365 ], method: ''), |
431 ], | 366 const Test.clazz(''' |
432 method: ''), | |
433 const Test.clazz( | |
434 ''' | |
435 class C { | 367 class C { |
436 factory C(a, b) => null; | 368 factory C(a, b) => null; |
437 } | 369 } |
438 ''', | 370 ''', const [ |
439 const [ | 371 const Visit(VisitKind.VISIT_FACTORY_CONSTRUCTOR_DECL, |
440 const Visit(VisitKind.VISIT_FACTORY_CONSTRUCTOR_DECL, | 372 element: 'factory_constructor(C#)', |
441 element: 'factory_constructor(C#)', | 373 parameters: '(a,b)', |
442 parameters: '(a,b)', | 374 body: '=>null;'), |
443 body: '=>null;'), | 375 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
444 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 376 element: 'parameter(#a)', index: 0), |
445 element: 'parameter(#a)', index: 0), | 377 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
446 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 378 element: 'parameter(#b)', index: 1), |
447 element: 'parameter(#b)', index: 1), | 379 ], method: ''), |
448 ], | 380 const Test.clazz(''' |
449 method: ''), | |
450 const Test.clazz( | |
451 ''' | |
452 class C { | 381 class C { |
453 factory C(a, b) = C._; | 382 factory C(a, b) = C._; |
454 C._(a, b); | 383 C._(a, b); |
455 } | 384 } |
456 ''', | 385 ''', const [ |
457 const [ | 386 const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL, |
458 const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL, | 387 element: 'factory_constructor(C#)', |
459 element: 'factory_constructor(C#)', | 388 parameters: '(a,b)', |
460 parameters: '(a,b)', | 389 target: 'generative_constructor(C#_)', |
461 target: 'generative_constructor(C#_)', | 390 type: 'C'), |
462 type: 'C'), | 391 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
463 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 392 element: 'parameter(#a)', index: 0), |
464 element: 'parameter(#a)', index: 0), | 393 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
465 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 394 element: 'parameter(#b)', index: 1), |
466 element: 'parameter(#b)', index: 1), | 395 ], method: ''), |
467 ], | 396 const Test.clazz(''' |
468 method: ''), | |
469 const Test.clazz( | |
470 ''' | |
471 class C { | 397 class C { |
472 factory C(a, b) = D; | 398 factory C(a, b) = D; |
473 } | 399 } |
474 class D<T> { | 400 class D<T> { |
475 D(a, b); | 401 D(a, b); |
476 } | 402 } |
477 ''', | 403 ''', const [ |
478 const [ | 404 const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL, |
479 const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL, | 405 element: 'factory_constructor(C#)', |
480 element: 'factory_constructor(C#)', | 406 parameters: '(a,b)', |
481 parameters: '(a,b)', | 407 target: 'generative_constructor(D#)', |
482 target: 'generative_constructor(D#)', | 408 type: 'D'), |
483 type: 'D'), | 409 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
484 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 410 element: 'parameter(#a)', index: 0), |
485 element: 'parameter(#a)', index: 0), | 411 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
486 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 412 element: 'parameter(#b)', index: 1), |
487 element: 'parameter(#b)', index: 1), | 413 ], method: ''), |
488 ], | 414 const Test.clazz(''' |
489 method: ''), | |
490 const Test.clazz( | |
491 ''' | |
492 class C { | 415 class C { |
493 factory C(a, b) = D<int>; | 416 factory C(a, b) = D<int>; |
494 } | 417 } |
495 class D<T> { | 418 class D<T> { |
496 D(a, b); | 419 D(a, b); |
497 } | 420 } |
498 ''', | 421 ''', const [ |
499 const [ | 422 const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL, |
500 const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL, | 423 element: 'factory_constructor(C#)', |
501 element: 'factory_constructor(C#)', | 424 parameters: '(a,b)', |
502 parameters: '(a,b)', | 425 target: 'generative_constructor(D#)', |
503 target: 'generative_constructor(D#)', | 426 type: 'D<int>'), |
504 type: 'D<int>'), | 427 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
505 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 428 element: 'parameter(#a)', index: 0), |
506 element: 'parameter(#a)', index: 0), | 429 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
507 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 430 element: 'parameter(#b)', index: 1), |
508 element: 'parameter(#b)', index: 1), | 431 ], method: ''), |
509 ], | 432 const Test.clazz(''' |
510 method: ''), | |
511 const Test.clazz( | |
512 ''' | |
513 class C { | 433 class C { |
514 factory C(a, b) = D<int>; | 434 factory C(a, b) = D<int>; |
515 } | 435 } |
516 class D<T> { | 436 class D<T> { |
517 factory D(a, b) = E<D<T>>; | 437 factory D(a, b) = E<D<T>>; |
518 } | 438 } |
519 class E<S> { | 439 class E<S> { |
520 E(a, b); | 440 E(a, b); |
521 } | 441 } |
522 ''', | 442 ''', const [ |
523 const [ | 443 const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL, |
524 const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL, | 444 element: 'factory_constructor(C#)', |
525 element: 'factory_constructor(C#)', | 445 parameters: '(a,b)', |
526 parameters: '(a,b)', | 446 target: 'factory_constructor(D#)', |
527 target: 'factory_constructor(D#)', | 447 type: 'D<int>'), |
528 type: 'D<int>'), | 448 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
529 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 449 element: 'parameter(#a)', index: 0), |
530 element: 'parameter(#a)', index: 0), | 450 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, |
531 const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL, | 451 element: 'parameter(#b)', index: 1), |
532 element: 'parameter(#b)', index: 1), | 452 ], method: ''), |
533 ], | |
534 method: ''), | |
535 ], | 453 ], |
536 "Field declarations": const [ | 454 "Field declarations": const [ |
537 const Test.clazz( | 455 const Test.clazz(''' |
538 ''' | |
539 class C { | 456 class C { |
540 var m; | 457 var m; |
541 } | 458 } |
542 ''', | 459 ''', const [ |
543 const [ | 460 const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL, element: 'field(C#m)'), |
544 const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL, | 461 ]), |
545 element: 'field(C#m)'), | 462 const Test.clazz(''' |
546 ]), | |
547 const Test.clazz( | |
548 ''' | |
549 class C { | 463 class C { |
550 var m, n; | 464 var m, n; |
551 } | 465 } |
552 ''', | 466 ''', const [ |
553 const [ | 467 const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL, element: 'field(C#m)'), |
554 const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL, | 468 const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL, element: 'field(C#n)'), |
555 element: 'field(C#m)'), | 469 ]), |
556 const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL, | 470 const Test.clazz(''' |
557 element: 'field(C#n)'), | |
558 ]), | |
559 const Test.clazz( | |
560 ''' | |
561 class C { | 471 class C { |
562 var m = 42; | 472 var m = 42; |
563 } | 473 } |
564 ''', | 474 ''', const [ |
565 const [ | 475 const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL, |
566 const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL, | 476 element: 'field(C#m)', rhs: 42), |
567 element: 'field(C#m)', rhs: 42), | 477 ]), |
568 ]), | 478 const Test(''' |
569 const Test( | |
570 ''' | |
571 m() { | 479 m() { |
572 var local; | 480 var local; |
573 } | 481 } |
574 ''', | 482 ''', const [ |
575 const [ | 483 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
576 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 484 element: 'function(m)', parameters: '()', body: '{var local;}'), |
577 element: 'function(m)', parameters: '()', body: '{var local;}'), | 485 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL, |
578 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL, | 486 element: 'variable(m#local)'), |
579 element: 'variable(m#local)'), | 487 ]), |
580 ]), | 488 const Test(''' |
581 const Test( | |
582 ''' | |
583 m() { | 489 m() { |
584 var local = 42; | 490 var local = 42; |
585 } | 491 } |
586 ''', | 492 ''', const [ |
587 const [ | 493 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
588 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 494 element: 'function(m)', parameters: '()', body: '{var local=42;}'), |
589 element: 'function(m)', | 495 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL, |
590 parameters: '()', | 496 element: 'variable(m#local)', rhs: 42), |
591 body: '{var local=42;}'), | 497 ]), |
592 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL, | 498 const Test(''' |
593 element: 'variable(m#local)', rhs: 42), | |
594 ]), | |
595 const Test( | |
596 ''' | |
597 m() { | 499 m() { |
598 const local = 42; | 500 const local = 42; |
599 } | 501 } |
600 ''', | 502 ''', const [ |
601 const [ | 503 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
602 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 504 element: 'function(m)', parameters: '()', body: '{const local=42;}'), |
603 element: 'function(m)', | 505 const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL, |
604 parameters: '()', | 506 element: 'variable(m#local)', constant: 42), |
605 body: '{const local=42;}'), | 507 ]), |
606 const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL, | 508 const Test(''' |
607 element: 'variable(m#local)', constant: 42), | |
608 ]), | |
609 const Test( | |
610 ''' | |
611 m() { | 509 m() { |
612 var local1, local2; | 510 var local1, local2; |
613 } | 511 } |
614 ''', | 512 ''', const [ |
615 const [ | 513 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
616 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 514 element: 'function(m)', |
617 element: 'function(m)', | 515 parameters: '()', |
618 parameters: '()', | 516 body: '{var local1,local2;}'), |
619 body: '{var local1,local2;}'), | 517 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL, |
620 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL, | 518 element: 'variable(m#local1)'), |
621 element: 'variable(m#local1)'), | 519 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL, |
622 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL, | 520 element: 'variable(m#local2)'), |
623 element: 'variable(m#local2)'), | 521 ]), |
624 ]), | 522 const Test(''' |
625 const Test( | |
626 ''' | |
627 m() { | 523 m() { |
628 var local1 = 42, local2 = true; | 524 var local1 = 42, local2 = true; |
629 } | 525 } |
630 ''', | 526 ''', const [ |
631 const [ | 527 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
632 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 528 element: 'function(m)', |
633 element: 'function(m)', | 529 parameters: '()', |
634 parameters: '()', | 530 body: '{var local1=42,local2=true;}'), |
635 body: '{var local1=42,local2=true;}'), | 531 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL, |
636 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL, | 532 element: 'variable(m#local1)', rhs: 42), |
637 element: 'variable(m#local1)', rhs: 42), | 533 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL, |
638 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL, | 534 element: 'variable(m#local2)', rhs: true), |
639 element: 'variable(m#local2)', rhs: true), | 535 ]), |
640 ]), | 536 const Test(''' |
641 const Test( | |
642 ''' | |
643 m() { | 537 m() { |
644 const local1 = 42, local2 = true; | 538 const local1 = 42, local2 = true; |
645 } | 539 } |
646 ''', | 540 ''', const [ |
647 const [ | 541 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, |
648 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL, | 542 element: 'function(m)', |
649 element: 'function(m)', | 543 parameters: '()', |
650 parameters: '()', | 544 body: '{const local1=42,local2=true;}'), |
651 body: '{const local1=42,local2=true;}'), | 545 const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL, |
652 const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL, | 546 element: 'variable(m#local1)', constant: 42), |
653 element: 'variable(m#local1)', constant: 42), | 547 const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL, |
654 const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL, | 548 element: 'variable(m#local2)', constant: true), |
655 element: 'variable(m#local2)', constant: true), | 549 ]), |
656 ]), | 550 const Test.clazz(''' |
657 const Test.clazz( | |
658 ''' | |
659 class C { | 551 class C { |
660 static var m; | 552 static var m; |
661 } | 553 } |
662 ''', | 554 ''', const [ |
663 const [ | 555 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, element: 'field(C#m)'), |
664 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, element: 'field(C#m)'), | 556 ]), |
665 ]), | 557 const Test.clazz(''' |
666 const Test.clazz( | |
667 ''' | |
668 class C { | 558 class C { |
669 static var m, n; | 559 static var m, n; |
670 } | 560 } |
671 ''', | 561 ''', const [ |
672 const [ | 562 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, element: 'field(C#m)'), |
673 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, element: 'field(C#m)'), | 563 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, element: 'field(C#n)'), |
674 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, element: 'field(C#n)'), | 564 ]), |
675 ]), | 565 const Test.clazz(''' |
676 const Test.clazz( | |
677 ''' | |
678 class C { | 566 class C { |
679 static var k, l, m, n; | 567 static var k, l, m, n; |
680 } | 568 } |
681 ''', | 569 ''', const [ |
682 const [ | 570 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, element: 'field(C#k)'), |
683 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, element: 'field(C#k)'), | 571 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, element: 'field(C#l)'), |
684 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, element: 'field(C#l)'), | 572 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, element: 'field(C#m)'), |
685 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, element: 'field(C#m)'), | 573 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, element: 'field(C#n)'), |
686 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, element: 'field(C#n)'), | 574 ]), |
687 ]), | 575 const Test.clazz(''' |
688 const Test.clazz( | |
689 ''' | |
690 class C { | 576 class C { |
691 static var m = 42; | 577 static var m = 42; |
692 } | 578 } |
693 ''', | 579 ''', const [ |
694 const [ | 580 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, |
695 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, | 581 element: 'field(C#m)', rhs: 42), |
696 element: 'field(C#m)', rhs: 42), | 582 ]), |
697 ]), | 583 const Test.clazz(''' |
698 const Test.clazz( | |
699 ''' | |
700 class C { | 584 class C { |
701 static var m = 42, n = true; | 585 static var m = 42, n = true; |
702 } | 586 } |
703 ''', | 587 ''', const [ |
704 const [ | 588 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, |
705 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, | 589 element: 'field(C#m)', rhs: 42), |
706 element: 'field(C#m)', rhs: 42), | 590 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, |
707 const Visit(VisitKind.VISIT_STATIC_FIELD_DECL, | 591 element: 'field(C#n)', rhs: true), |
708 element: 'field(C#n)', rhs: true), | 592 ]), |
709 ]), | 593 const Test.clazz(''' |
710 const Test.clazz( | |
711 ''' | |
712 class C { | 594 class C { |
713 static const m = 42; | 595 static const m = 42; |
714 } | 596 } |
715 ''', | 597 ''', const [ |
716 const [ | 598 const Visit(VisitKind.VISIT_STATIC_CONSTANT_DECL, |
717 const Visit(VisitKind.VISIT_STATIC_CONSTANT_DECL, | 599 element: 'field(C#m)', constant: 42), |
718 element: 'field(C#m)', constant: 42), | 600 ]), |
719 ]), | 601 const Test(''' |
720 const Test( | |
721 ''' | |
722 var m; | 602 var m; |
723 ''', | 603 ''', const [ |
724 const [ | 604 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL, element: 'field(m)'), |
725 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL, | 605 ]), |
726 element: 'field(m)'), | 606 const Test(''' |
727 ]), | |
728 const Test( | |
729 ''' | |
730 var m, n; | 607 var m, n; |
731 ''', | 608 ''', const [ |
732 const [ | 609 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL, element: 'field(m)'), |
733 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL, | 610 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL, element: 'field(n)'), |
734 element: 'field(m)'), | 611 ]), |
735 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL, | 612 const Test(''' |
736 element: 'field(n)'), | |
737 ]), | |
738 const Test( | |
739 ''' | |
740 var m = 42; | 613 var m = 42; |
741 ''', | 614 ''', const [ |
742 const [ | 615 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL, |
743 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL, | 616 element: 'field(m)', rhs: 42), |
744 element: 'field(m)', rhs: 42), | 617 ]), |
745 ]), | 618 const Test(''' |
746 const Test( | |
747 ''' | |
748 const m = 42; | 619 const m = 42; |
749 ''', | 620 ''', const [ |
750 const [ | 621 const Visit(VisitKind.VISIT_TOP_LEVEL_CONSTANT_DECL, |
751 const Visit(VisitKind.VISIT_TOP_LEVEL_CONSTANT_DECL, | 622 element: 'field(m)', constant: 42), |
752 element: 'field(m)', constant: 42), | 623 ]), |
753 ]), | |
754 ], | 624 ], |
755 }; | 625 }; |
OLD | NEW |