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 class SemanticDeclarationTestVisitor extends SemanticTestVisitor { | 7 class SemanticDeclarationTestVisitor extends SemanticTestVisitor { |
8 | 8 |
9 SemanticDeclarationTestVisitor(TreeElements elements) : super(elements); | 9 SemanticDeclarationTestVisitor(TreeElements elements) : super(elements); |
10 | 10 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 @override | 229 @override |
230 visitOptionalParameterDeclaration( | 230 visitOptionalParameterDeclaration( |
231 VariableDefinitions node, | 231 VariableDefinitions node, |
232 Node definition, | 232 Node definition, |
233 ParameterElement parameter, | 233 ParameterElement parameter, |
234 ConstantExpression defaultValue, | 234 ConstantExpression defaultValue, |
235 int index, | 235 int index, |
236 arg) { | 236 arg) { |
237 visits.add(new Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL, | 237 visits.add(new Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL, |
238 element: parameter, | 238 element: parameter, |
239 constant: defaultValue != null ? defaultValue.getText() : null, | 239 constant: defaultValue != null ? defaultValue.toDartText() : null, |
240 index: index)); | 240 index: index)); |
241 } | 241 } |
242 | 242 |
243 @override | 243 @override |
244 visitParameterDeclaration( | 244 visitParameterDeclaration( |
245 VariableDefinitions node, | 245 VariableDefinitions node, |
246 Node definition, | 246 Node definition, |
247 ParameterElement parameter, | 247 ParameterElement parameter, |
248 int index, | 248 int index, |
249 arg) { | 249 arg) { |
(...skipping 27 matching lines...) Expand all Loading... |
277 } | 277 } |
278 | 278 |
279 @override | 279 @override |
280 visitLocalConstantDeclaration( | 280 visitLocalConstantDeclaration( |
281 VariableDefinitions node, | 281 VariableDefinitions node, |
282 Node definition, | 282 Node definition, |
283 LocalVariableElement variable, | 283 LocalVariableElement variable, |
284 ConstantExpression constant, | 284 ConstantExpression constant, |
285 arg) { | 285 arg) { |
286 visits.add(new Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL, | 286 visits.add(new Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL, |
287 element: variable, constant: constant.getText())); | 287 element: variable, constant: constant.toDartText())); |
288 } | 288 } |
289 | 289 |
290 @override | 290 @override |
291 visitNamedInitializingFormalDeclaration( | 291 visitNamedInitializingFormalDeclaration( |
292 VariableDefinitions node, | 292 VariableDefinitions node, |
293 Node definition, | 293 Node definition, |
294 InitializingFormalElement initializingFormal, | 294 InitializingFormalElement initializingFormal, |
295 ConstantExpression defaultValue, | 295 ConstantExpression defaultValue, |
296 arg) { | 296 arg) { |
297 visits.add(new Visit(VisitKind.VISIT_NAMED_INITIALIZING_FORMAL_DECL, | 297 visits.add(new Visit(VisitKind.VISIT_NAMED_INITIALIZING_FORMAL_DECL, |
298 element: initializingFormal, | 298 element: initializingFormal, |
299 constant: defaultValue != null ? defaultValue.getText() : null)); | 299 constant: defaultValue != null ? defaultValue.toDartText() : null)); |
300 } | 300 } |
301 | 301 |
302 @override | 302 @override |
303 visitNamedParameterDeclaration( | 303 visitNamedParameterDeclaration( |
304 VariableDefinitions node, | 304 VariableDefinitions node, |
305 Node definition, | 305 Node definition, |
306 ParameterElement parameter, | 306 ParameterElement parameter, |
307 ConstantExpression defaultValue, | 307 ConstantExpression defaultValue, |
308 arg) { | 308 arg) { |
309 visits.add(new Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL, | 309 visits.add(new Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL, |
310 element: parameter, | 310 element: parameter, |
311 constant: defaultValue != null ? defaultValue.getText() : null)); | 311 constant: defaultValue != null ? defaultValue.toDartText() : null)); |
312 } | 312 } |
313 | 313 |
314 @override | 314 @override |
315 visitOptionalInitializingFormalDeclaration( | 315 visitOptionalInitializingFormalDeclaration( |
316 VariableDefinitions node, | 316 VariableDefinitions node, |
317 Node definition, | 317 Node definition, |
318 InitializingFormalElement initializingFormal, | 318 InitializingFormalElement initializingFormal, |
319 ConstantExpression defaultValue, | 319 ConstantExpression defaultValue, |
320 int index, | 320 int index, |
321 arg) { | 321 arg) { |
322 visits.add(new Visit(VisitKind.VISIT_OPTIONAL_INITIALIZING_FORMAL_DECL, | 322 visits.add(new Visit(VisitKind.VISIT_OPTIONAL_INITIALIZING_FORMAL_DECL, |
323 element: initializingFormal, | 323 element: initializingFormal, |
324 constant: defaultValue != null ? defaultValue.getText() : null, | 324 constant: defaultValue != null ? defaultValue.toDartText() : null, |
325 index: index)); | 325 index: index)); |
326 } | 326 } |
327 | 327 |
328 @override | 328 @override |
329 visitInstanceFieldDeclaration( | 329 visitInstanceFieldDeclaration( |
330 VariableDefinitions node, | 330 VariableDefinitions node, |
331 Node definition, | 331 Node definition, |
332 FieldElement field, | 332 FieldElement field, |
333 Node initializer, | 333 Node initializer, |
334 arg) { | 334 arg) { |
335 visits.add(new Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL, | 335 visits.add(new Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL, |
336 element: field, rhs: initializer)); | 336 element: field, rhs: initializer)); |
337 if (initializer != null) { | 337 if (initializer != null) { |
338 apply(initializer, arg); | 338 apply(initializer, arg); |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 @override | 342 @override |
343 visitStaticConstantDeclaration( | 343 visitStaticConstantDeclaration( |
344 VariableDefinitions node, | 344 VariableDefinitions node, |
345 Node definition, | 345 Node definition, |
346 FieldElement field, | 346 FieldElement field, |
347 ConstantExpression constant, | 347 ConstantExpression constant, |
348 arg) { | 348 arg) { |
349 visits.add(new Visit(VisitKind.VISIT_STATIC_CONSTANT_DECL, | 349 visits.add(new Visit(VisitKind.VISIT_STATIC_CONSTANT_DECL, |
350 element: field, constant: constant.getText())); | 350 element: field, constant: constant.toDartText())); |
351 } | 351 } |
352 | 352 |
353 @override | 353 @override |
354 visitStaticFieldDeclaration( | 354 visitStaticFieldDeclaration( |
355 VariableDefinitions node, | 355 VariableDefinitions node, |
356 Node definition, | 356 Node definition, |
357 FieldElement field, | 357 FieldElement field, |
358 Node initializer, | 358 Node initializer, |
359 arg) { | 359 arg) { |
360 visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_DECL, | 360 visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_DECL, |
361 element: field, rhs: initializer)); | 361 element: field, rhs: initializer)); |
362 if (initializer != null) { | 362 if (initializer != null) { |
363 apply(initializer, arg); | 363 apply(initializer, arg); |
364 } | 364 } |
365 } | 365 } |
366 | 366 |
367 @override | 367 @override |
368 visitTopLevelConstantDeclaration( | 368 visitTopLevelConstantDeclaration( |
369 VariableDefinitions node, | 369 VariableDefinitions node, |
370 Node definition, | 370 Node definition, |
371 FieldElement field, | 371 FieldElement field, |
372 ConstantExpression constant, | 372 ConstantExpression constant, |
373 arg) { | 373 arg) { |
374 visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_CONSTANT_DECL, | 374 visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_CONSTANT_DECL, |
375 element: field, constant: constant.getText())); | 375 element: field, constant: constant.toDartText())); |
376 } | 376 } |
377 | 377 |
378 @override | 378 @override |
379 visitTopLevelFieldDeclaration( | 379 visitTopLevelFieldDeclaration( |
380 VariableDefinitions node, | 380 VariableDefinitions node, |
381 Node definition, | 381 Node definition, |
382 FieldElement field, | 382 FieldElement field, |
383 Node initializer, | 383 Node initializer, |
384 arg) { | 384 arg) { |
385 visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL, | 385 visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 MethodElement setter, | 474 MethodElement setter, |
475 NodeList parameters, | 475 NodeList parameters, |
476 Node body, | 476 Node body, |
477 arg) { | 477 arg) { |
478 visits.add(new Visit(VisitKind.VISIT_STATIC_SETTER_DECL, | 478 visits.add(new Visit(VisitKind.VISIT_STATIC_SETTER_DECL, |
479 element: setter, parameters: parameters, body: body)); | 479 element: setter, parameters: parameters, body: body)); |
480 applyParameters(parameters, arg); | 480 applyParameters(parameters, arg); |
481 apply(body, arg); | 481 apply(body, arg); |
482 } | 482 } |
483 } | 483 } |
OLD | NEW |