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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library engine.ast_test; | 8 library engine.ast_test; |
9 | 9 |
10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
(...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2125 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | 2125 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); |
2126 _assertSource("@deprecated var a;", declaration); | 2126 _assertSource("@deprecated var a;", declaration); |
2127 } | 2127 } |
2128 | 2128 |
2129 void test_visitFieldFormalParameter_functionTyped() { | 2129 void test_visitFieldFormalParameter_functionTyped() { |
2130 _assertSource("A this.a(b)", AstFactory.fieldFormalParameter(null, | 2130 _assertSource("A this.a(b)", AstFactory.fieldFormalParameter(null, |
2131 AstFactory.typeName4("A"), "a", AstFactory | 2131 AstFactory.typeName4("A"), "a", AstFactory |
2132 .formalParameterList([AstFactory.simpleFormalParameter3("b")]))); | 2132 .formalParameterList([AstFactory.simpleFormalParameter3("b")]))); |
2133 } | 2133 } |
2134 | 2134 |
| 2135 void test_visitFieldFormalParameter_functionTyped_typeParameters() { |
| 2136 _assertSource("A this.a<E, F>(b)", new FieldFormalParameter(null, null, |
| 2137 null, AstFactory.typeName4('A'), |
| 2138 TokenFactory.tokenFromKeyword(Keyword.THIS), |
| 2139 TokenFactory.tokenFromType(TokenType.PERIOD), |
| 2140 AstFactory.identifier3('a'), AstFactory.typeParameterList(['E', 'F']), |
| 2141 AstFactory |
| 2142 .formalParameterList([AstFactory.simpleFormalParameter3("b")]))); |
| 2143 } |
| 2144 |
2135 void test_visitFieldFormalParameter_keyword() { | 2145 void test_visitFieldFormalParameter_keyword() { |
2136 _assertSource( | 2146 _assertSource( |
2137 "var this.a", AstFactory.fieldFormalParameter(Keyword.VAR, null, "a")); | 2147 "var this.a", AstFactory.fieldFormalParameter(Keyword.VAR, null, "a")); |
2138 } | 2148 } |
2139 | 2149 |
2140 void test_visitFieldFormalParameter_keywordAndType() { | 2150 void test_visitFieldFormalParameter_keywordAndType() { |
2141 _assertSource("final A this.a", AstFactory.fieldFormalParameter( | 2151 _assertSource("final A this.a", AstFactory.fieldFormalParameter( |
2142 Keyword.FINAL, AstFactory.typeName4("A"), "a")); | 2152 Keyword.FINAL, AstFactory.typeName4("A"), "a")); |
2143 } | 2153 } |
2144 | 2154 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2399 void test_visitFunctionDeclaration_normal() { | 2409 void test_visitFunctionDeclaration_normal() { |
2400 _assertSource("f() {}", AstFactory.functionDeclaration( | 2410 _assertSource("f() {}", AstFactory.functionDeclaration( |
2401 null, null, "f", AstFactory.functionExpression())); | 2411 null, null, "f", AstFactory.functionExpression())); |
2402 } | 2412 } |
2403 | 2413 |
2404 void test_visitFunctionDeclaration_setter() { | 2414 void test_visitFunctionDeclaration_setter() { |
2405 _assertSource("set f() {}", AstFactory.functionDeclaration( | 2415 _assertSource("set f() {}", AstFactory.functionDeclaration( |
2406 null, Keyword.SET, "f", AstFactory.functionExpression())); | 2416 null, Keyword.SET, "f", AstFactory.functionExpression())); |
2407 } | 2417 } |
2408 | 2418 |
| 2419 void test_visitFunctionDeclaration_typeParameters() { |
| 2420 _assertSource("f<E>() {}", AstFactory.functionDeclaration(null, null, "f", |
| 2421 AstFactory.functionExpression3(AstFactory.typeParameterList(['E']), |
| 2422 AstFactory.formalParameterList(), |
| 2423 AstFactory.blockFunctionBody2()))); |
| 2424 } |
| 2425 |
2409 void test_visitFunctionDeclaration_withMetadata() { | 2426 void test_visitFunctionDeclaration_withMetadata() { |
2410 FunctionDeclaration declaration = AstFactory.functionDeclaration( | 2427 FunctionDeclaration declaration = AstFactory.functionDeclaration( |
2411 null, null, "f", AstFactory.functionExpression()); | 2428 null, null, "f", AstFactory.functionExpression()); |
2412 declaration.metadata | 2429 declaration.metadata |
2413 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | 2430 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); |
2414 _assertSource("@deprecated f() {}", declaration); | 2431 _assertSource("@deprecated f() {}", declaration); |
2415 } | 2432 } |
2416 | 2433 |
2417 void test_visitFunctionDeclarationStatement() { | 2434 void test_visitFunctionDeclarationStatement() { |
2418 _assertSource("f() {}", AstFactory.functionDeclarationStatement( | 2435 _assertSource("f() {}", AstFactory.functionDeclarationStatement( |
2419 null, null, "f", AstFactory.functionExpression())); | 2436 null, null, "f", AstFactory.functionExpression())); |
2420 } | 2437 } |
2421 | 2438 |
2422 void test_visitFunctionExpression() { | 2439 void test_visitFunctionExpression() { |
2423 _assertSource("() {}", AstFactory.functionExpression()); | 2440 _assertSource("() {}", AstFactory.functionExpression()); |
2424 } | 2441 } |
2425 | 2442 |
2426 void test_visitFunctionExpressionInvocation() { | 2443 void test_visitFunctionExpression_typeParameters() { |
| 2444 _assertSource("<E>() {}", AstFactory.functionExpression3( |
| 2445 AstFactory.typeParameterList(['E']), AstFactory.formalParameterList(), |
| 2446 AstFactory.blockFunctionBody2())); |
| 2447 } |
| 2448 |
| 2449 void test_visitFunctionExpressionInvocation_minimal() { |
2427 _assertSource("f()", | 2450 _assertSource("f()", |
2428 AstFactory.functionExpressionInvocation(AstFactory.identifier3("f"))); | 2451 AstFactory.functionExpressionInvocation(AstFactory.identifier3("f"))); |
2429 } | 2452 } |
2430 | 2453 |
| 2454 void test_visitFunctionExpressionInvocation_typeArguments() { |
| 2455 _assertSource("f<A>()", AstFactory.functionExpressionInvocation2( |
| 2456 AstFactory.identifier3("f"), |
| 2457 AstFactory.typeArgumentList([AstFactory.typeName4('A')]))); |
| 2458 } |
| 2459 |
2431 void test_visitFunctionTypeAlias_generic() { | 2460 void test_visitFunctionTypeAlias_generic() { |
2432 _assertSource("typedef A F<B>();", AstFactory.typeAlias( | 2461 _assertSource("typedef A F<B>();", AstFactory.typeAlias( |
2433 AstFactory.typeName4("A"), "F", AstFactory.typeParameterList(["B"]), | 2462 AstFactory.typeName4("A"), "F", AstFactory.typeParameterList(["B"]), |
2434 AstFactory.formalParameterList())); | 2463 AstFactory.formalParameterList())); |
2435 } | 2464 } |
2436 | 2465 |
2437 void test_visitFunctionTypeAlias_nonGeneric() { | 2466 void test_visitFunctionTypeAlias_nonGeneric() { |
2438 _assertSource("typedef A F();", AstFactory.typeAlias( | 2467 _assertSource("typedef A F();", AstFactory.typeAlias( |
2439 AstFactory.typeName4("A"), "F", null, | 2468 AstFactory.typeName4("A"), "F", null, |
2440 AstFactory.formalParameterList())); | 2469 AstFactory.formalParameterList())); |
2441 } | 2470 } |
2442 | 2471 |
2443 void test_visitFunctionTypeAlias_withMetadata() { | 2472 void test_visitFunctionTypeAlias_withMetadata() { |
2444 FunctionTypeAlias declaration = AstFactory.typeAlias( | 2473 FunctionTypeAlias declaration = AstFactory.typeAlias( |
2445 AstFactory.typeName4("A"), "F", null, AstFactory.formalParameterList()); | 2474 AstFactory.typeName4("A"), "F", null, AstFactory.formalParameterList()); |
2446 declaration.metadata | 2475 declaration.metadata |
2447 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | 2476 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); |
2448 _assertSource("@deprecated typedef A F();", declaration); | 2477 _assertSource("@deprecated typedef A F();", declaration); |
2449 } | 2478 } |
2450 | 2479 |
2451 void test_visitFunctionTypedFormalParameter_noType() { | 2480 void test_visitFunctionTypedFormalParameter_noType() { |
2452 _assertSource("f()", AstFactory.functionTypedFormalParameter(null, "f")); | 2481 _assertSource("f()", AstFactory.functionTypedFormalParameter(null, "f")); |
2453 } | 2482 } |
2454 | 2483 |
2455 void test_visitFunctionTypedFormalParameter_type() { | 2484 void test_visitFunctionTypedFormalParameter_type() { |
2456 _assertSource("T f()", AstFactory.functionTypedFormalParameter( | 2485 _assertSource("T f()", AstFactory.functionTypedFormalParameter( |
2457 AstFactory.typeName4("T"), "f")); | 2486 AstFactory.typeName4("T"), "f")); |
2458 } | 2487 } |
2459 | 2488 |
| 2489 void test_visitFunctionTypedFormalParameter_typeParameters() { |
| 2490 _assertSource("T f<E>()", new FunctionTypedFormalParameter(null, null, |
| 2491 AstFactory.typeName4("T"), AstFactory.identifier3('f'), |
| 2492 AstFactory.typeParameterList(['E']), |
| 2493 AstFactory.formalParameterList([]))); |
| 2494 } |
| 2495 |
2460 void test_visitIfStatement_withElse() { | 2496 void test_visitIfStatement_withElse() { |
2461 _assertSource("if (c) {} else {}", AstFactory.ifStatement2( | 2497 _assertSource("if (c) {} else {}", AstFactory.ifStatement2( |
2462 AstFactory.identifier3("c"), AstFactory.block(), AstFactory.block())); | 2498 AstFactory.identifier3("c"), AstFactory.block(), AstFactory.block())); |
2463 } | 2499 } |
2464 | 2500 |
2465 void test_visitIfStatement_withoutElse() { | 2501 void test_visitIfStatement_withoutElse() { |
2466 _assertSource("if (c) {}", AstFactory.ifStatement( | 2502 _assertSource("if (c) {}", AstFactory.ifStatement( |
2467 AstFactory.identifier3("c"), AstFactory.block())); | 2503 AstFactory.identifier3("c"), AstFactory.block())); |
2468 } | 2504 } |
2469 | 2505 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2751 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); | 2787 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); |
2752 } | 2788 } |
2753 | 2789 |
2754 void test_visitMethodDeclaration_static_returnType() { | 2790 void test_visitMethodDeclaration_static_returnType() { |
2755 _assertSource("static T m() {}", AstFactory.methodDeclaration2( | 2791 _assertSource("static T m() {}", AstFactory.methodDeclaration2( |
2756 Keyword.STATIC, AstFactory.typeName4("T"), null, null, | 2792 Keyword.STATIC, AstFactory.typeName4("T"), null, null, |
2757 AstFactory.identifier3("m"), AstFactory.formalParameterList(), | 2793 AstFactory.identifier3("m"), AstFactory.formalParameterList(), |
2758 AstFactory.blockFunctionBody2())); | 2794 AstFactory.blockFunctionBody2())); |
2759 } | 2795 } |
2760 | 2796 |
| 2797 void test_visitMethodDeclaration_typeParameters() { |
| 2798 _assertSource("m<E>() {}", AstFactory.methodDeclaration3(null, null, null, |
| 2799 null, AstFactory.identifier3("m"), AstFactory.typeParameterList(['E']), |
| 2800 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); |
| 2801 } |
| 2802 |
2761 void test_visitMethodDeclaration_withMetadata() { | 2803 void test_visitMethodDeclaration_withMetadata() { |
2762 MethodDeclaration declaration = AstFactory.methodDeclaration2(null, null, | 2804 MethodDeclaration declaration = AstFactory.methodDeclaration2(null, null, |
2763 null, null, AstFactory.identifier3("m"), | 2805 null, null, AstFactory.identifier3("m"), |
2764 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()); | 2806 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()); |
2765 declaration.metadata | 2807 declaration.metadata |
2766 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | 2808 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); |
2767 _assertSource("@deprecated m() {}", declaration); | 2809 _assertSource("@deprecated m() {}", declaration); |
2768 } | 2810 } |
2769 | 2811 |
2770 void test_visitMethodInvocation_conditional() { | 2812 void test_visitMethodInvocation_conditional() { |
2771 _assertSource("t?.m()", AstFactory.methodInvocation( | 2813 _assertSource("t?.m()", AstFactory.methodInvocation( |
2772 AstFactory.identifier3("t"), "m", null, TokenType.QUESTION_PERIOD)); | 2814 AstFactory.identifier3("t"), "m", null, TokenType.QUESTION_PERIOD)); |
2773 } | 2815 } |
2774 | 2816 |
2775 void test_visitMethodInvocation_noTarget() { | 2817 void test_visitMethodInvocation_noTarget() { |
2776 _assertSource("m()", AstFactory.methodInvocation2("m")); | 2818 _assertSource("m()", AstFactory.methodInvocation2("m")); |
2777 } | 2819 } |
2778 | 2820 |
2779 void test_visitMethodInvocation_target() { | 2821 void test_visitMethodInvocation_target() { |
2780 _assertSource( | 2822 _assertSource( |
2781 "t.m()", AstFactory.methodInvocation(AstFactory.identifier3("t"), "m")); | 2823 "t.m()", AstFactory.methodInvocation(AstFactory.identifier3("t"), "m")); |
2782 } | 2824 } |
2783 | 2825 |
| 2826 void test_visitMethodInvocation_typeArguments() { |
| 2827 _assertSource("m<A>()", AstFactory.methodInvocation3( |
| 2828 null, "m", AstFactory.typeArgumentList([AstFactory.typeName4('A')]))); |
| 2829 } |
| 2830 |
2784 void test_visitNamedExpression() { | 2831 void test_visitNamedExpression() { |
2785 _assertSource( | 2832 _assertSource( |
2786 "a: b", AstFactory.namedExpression2("a", AstFactory.identifier3("b"))); | 2833 "a: b", AstFactory.namedExpression2("a", AstFactory.identifier3("b"))); |
2787 } | 2834 } |
2788 | 2835 |
2789 void test_visitNamedFormalParameter() { | 2836 void test_visitNamedFormalParameter() { |
2790 _assertSource("var a : 0", AstFactory.namedFormalParameter( | 2837 _assertSource("var a : 0", AstFactory.namedFormalParameter( |
2791 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), | 2838 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), |
2792 AstFactory.integer(0))); | 2839 AstFactory.integer(0))); |
2793 } | 2840 } |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3237 static const List<WrapperKind> values = const [ | 3284 static const List<WrapperKind> values = const [ |
3238 PREFIXED_LEFT, | 3285 PREFIXED_LEFT, |
3239 PREFIXED_RIGHT, | 3286 PREFIXED_RIGHT, |
3240 PROPERTY_LEFT, | 3287 PROPERTY_LEFT, |
3241 PROPERTY_RIGHT, | 3288 PROPERTY_RIGHT, |
3242 NONE | 3289 NONE |
3243 ]; | 3290 ]; |
3244 | 3291 |
3245 const WrapperKind(String name, int ordinal) : super(name, ordinal); | 3292 const WrapperKind(String name, int ordinal) : super(name, ordinal); |
3246 } | 3293 } |
OLD | NEW |