| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library engine.ast_test; | 5 library engine.ast_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/java_core.dart'; | 8 import 'package:analyzer/src/generated/java_core.dart'; |
| 9 import 'package:analyzer/src/generated/java_engine.dart' show Predicate; | 9 import 'package:analyzer/src/generated/java_engine.dart' show Predicate; |
| 10 import 'package:analyzer/src/generated/java_engine.dart'; | 10 import 'package:analyzer/src/generated/java_engine.dart'; |
| (...skipping 2300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2311 AstFactory.simpleFormalParameter3("p"), null)); | 2311 AstFactory.simpleFormalParameter3("p"), null)); |
| 2312 } | 2312 } |
| 2313 | 2313 |
| 2314 void test_visitDefaultFormalParameter_positional_value() { | 2314 void test_visitDefaultFormalParameter_positional_value() { |
| 2315 _assertSource( | 2315 _assertSource( |
| 2316 "p = 0", | 2316 "p = 0", |
| 2317 AstFactory.positionalFormalParameter( | 2317 AstFactory.positionalFormalParameter( |
| 2318 AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0))); | 2318 AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0))); |
| 2319 } | 2319 } |
| 2320 | 2320 |
| 2321 void test_visitDefaultFormalParameter_annotation() { |
| 2322 DefaultFormalParameter parameter = AstFactory.positionalFormalParameter( |
| 2323 AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0)); |
| 2324 parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A"))); |
| 2325 _assertSource('@A p = 0', parameter); |
| 2326 } |
| 2327 |
| 2321 void test_visitDoStatement() { | 2328 void test_visitDoStatement() { |
| 2322 _assertSource( | 2329 _assertSource( |
| 2323 "do {} while (c);", | 2330 "do {} while (c);", |
| 2324 AstFactory.doStatement( | 2331 AstFactory.doStatement( |
| 2325 AstFactory.block(), AstFactory.identifier3("c"))); | 2332 AstFactory.block(), AstFactory.identifier3("c"))); |
| 2326 } | 2333 } |
| 2327 | 2334 |
| 2328 void test_visitDoubleLiteral() { | 2335 void test_visitDoubleLiteral() { |
| 2329 _assertSource("4.2", AstFactory.doubleLiteral(4.2)); | 2336 _assertSource("4.2", AstFactory.doubleLiteral(4.2)); |
| 2330 } | 2337 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2453 "final A this.a", | 2460 "final A this.a", |
| 2454 AstFactory.fieldFormalParameter( | 2461 AstFactory.fieldFormalParameter( |
| 2455 Keyword.FINAL, AstFactory.typeName4("A"), "a")); | 2462 Keyword.FINAL, AstFactory.typeName4("A"), "a")); |
| 2456 } | 2463 } |
| 2457 | 2464 |
| 2458 void test_visitFieldFormalParameter_type() { | 2465 void test_visitFieldFormalParameter_type() { |
| 2459 _assertSource("A this.a", | 2466 _assertSource("A this.a", |
| 2460 AstFactory.fieldFormalParameter(null, AstFactory.typeName4("A"), "a")); | 2467 AstFactory.fieldFormalParameter(null, AstFactory.typeName4("A"), "a")); |
| 2461 } | 2468 } |
| 2462 | 2469 |
| 2470 void test_visitFieldFormalParameter_annotation() { |
| 2471 FieldFormalParameter parameter = AstFactory.fieldFormalParameter2('f'); |
| 2472 parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A"))); |
| 2473 _assertSource('@A this.f', parameter); |
| 2474 } |
| 2475 |
| 2463 void test_visitForEachStatement_declared() { | 2476 void test_visitForEachStatement_declared() { |
| 2464 _assertSource( | 2477 _assertSource( |
| 2465 "for (var a in b) {}", | 2478 "for (var a in b) {}", |
| 2466 AstFactory.forEachStatement(AstFactory.declaredIdentifier3("a"), | 2479 AstFactory.forEachStatement(AstFactory.declaredIdentifier3("a"), |
| 2467 AstFactory.identifier3("b"), AstFactory.block())); | 2480 AstFactory.identifier3("b"), AstFactory.block())); |
| 2468 } | 2481 } |
| 2469 | 2482 |
| 2470 void test_visitForEachStatement_variable() { | 2483 void test_visitForEachStatement_variable() { |
| 2471 _assertSource( | 2484 _assertSource( |
| 2472 "for (a in b) {}", | 2485 "for (a in b) {}", |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2891 AstFactory.typeName4("A"), "F", null, AstFactory.formalParameterList()); | 2904 AstFactory.typeName4("A"), "F", null, AstFactory.formalParameterList()); |
| 2892 declaration.metadata | 2905 declaration.metadata |
| 2893 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | 2906 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); |
| 2894 _assertSource("@deprecated typedef A F();", declaration); | 2907 _assertSource("@deprecated typedef A F();", declaration); |
| 2895 } | 2908 } |
| 2896 | 2909 |
| 2897 void test_visitFunctionTypedFormalParameter_noType() { | 2910 void test_visitFunctionTypedFormalParameter_noType() { |
| 2898 _assertSource("f()", AstFactory.functionTypedFormalParameter(null, "f")); | 2911 _assertSource("f()", AstFactory.functionTypedFormalParameter(null, "f")); |
| 2899 } | 2912 } |
| 2900 | 2913 |
| 2914 void test_visitFunctionTypedFormalParameter_annotation() { |
| 2915 FunctionTypedFormalParameter parameter = AstFactory.functionTypedFormalParam
eter(null, "f"); |
| 2916 parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A"))); |
| 2917 _assertSource('@A f()', parameter); |
| 2918 } |
| 2919 |
| 2901 void test_visitFunctionTypedFormalParameter_type() { | 2920 void test_visitFunctionTypedFormalParameter_type() { |
| 2902 _assertSource( | 2921 _assertSource( |
| 2903 "T f()", | 2922 "T f()", |
| 2904 AstFactory.functionTypedFormalParameter( | 2923 AstFactory.functionTypedFormalParameter( |
| 2905 AstFactory.typeName4("T"), "f")); | 2924 AstFactory.typeName4("T"), "f")); |
| 2906 } | 2925 } |
| 2907 | 2926 |
| 2908 void test_visitFunctionTypedFormalParameter_typeParameters() { | 2927 void test_visitFunctionTypedFormalParameter_typeParameters() { |
| 2909 _assertSource( | 2928 _assertSource( |
| 2910 "T f<E>()", | 2929 "T f<E>()", |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3514 "final A a", | 3533 "final A a", |
| 3515 AstFactory.simpleFormalParameter2( | 3534 AstFactory.simpleFormalParameter2( |
| 3516 Keyword.FINAL, AstFactory.typeName4("A"), "a")); | 3535 Keyword.FINAL, AstFactory.typeName4("A"), "a")); |
| 3517 } | 3536 } |
| 3518 | 3537 |
| 3519 void test_visitSimpleFormalParameter_type() { | 3538 void test_visitSimpleFormalParameter_type() { |
| 3520 _assertSource("A a", | 3539 _assertSource("A a", |
| 3521 AstFactory.simpleFormalParameter4(AstFactory.typeName4("A"), "a")); | 3540 AstFactory.simpleFormalParameter4(AstFactory.typeName4("A"), "a")); |
| 3522 } | 3541 } |
| 3523 | 3542 |
| 3543 void test_visitSimpleFormalParameter_annotation() { |
| 3544 SimpleFormalParameter parameter = AstFactory.simpleFormalParameter3('x'); |
| 3545 parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A"))); |
| 3546 _assertSource('@A x', parameter); |
| 3547 } |
| 3548 |
| 3524 void test_visitSimpleIdentifier() { | 3549 void test_visitSimpleIdentifier() { |
| 3525 _assertSource("a", AstFactory.identifier3("a")); | 3550 _assertSource("a", AstFactory.identifier3("a")); |
| 3526 } | 3551 } |
| 3527 | 3552 |
| 3528 void test_visitSimpleStringLiteral() { | 3553 void test_visitSimpleStringLiteral() { |
| 3529 _assertSource("'a'", AstFactory.string2("a")); | 3554 _assertSource("'a'", AstFactory.string2("a")); |
| 3530 } | 3555 } |
| 3531 | 3556 |
| 3532 void test_visitStringInterpolation() { | 3557 void test_visitStringInterpolation() { |
| 3533 _assertSource( | 3558 _assertSource( |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3894 static const List<WrapperKind> values = const [ | 3919 static const List<WrapperKind> values = const [ |
| 3895 PREFIXED_LEFT, | 3920 PREFIXED_LEFT, |
| 3896 PREFIXED_RIGHT, | 3921 PREFIXED_RIGHT, |
| 3897 PROPERTY_LEFT, | 3922 PROPERTY_LEFT, |
| 3898 PROPERTY_RIGHT, | 3923 PROPERTY_RIGHT, |
| 3899 NONE | 3924 NONE |
| 3900 ]; | 3925 ]; |
| 3901 | 3926 |
| 3902 const WrapperKind(String name, int ordinal) : super(name, ordinal); | 3927 const WrapperKind(String name, int ordinal) : super(name, ordinal); |
| 3903 } | 3928 } |
| OLD | NEW |