@@ -1648,21 +1648,6 @@ class ExpressionParserTest_Fasta extends FastaParserTestCase
1648
1648
1649
1649
@reflectiveTest
1650
1650
class ExtensionMethodsParserTest_Fasta extends FastaParserTestCase {
1651
- @override
1652
- CompilationUnit parseCompilationUnit (String content,
1653
- {List <ErrorCode > codes,
1654
- List <ExpectedError > errors,
1655
- FeatureSet featureSet}) {
1656
- return super .parseCompilationUnit (content,
1657
- codes: codes,
1658
- errors: errors,
1659
- featureSet: featureSet ??
1660
- FeatureSet .forTesting (
1661
- sdkVersion: '2.3.0' ,
1662
- additionalFeatures: [Feature .extension_methods],
1663
- ));
1664
- }
1665
-
1666
1651
void test_complex_extends () {
1667
1652
var unit = parseCompilationUnit (
1668
1653
'extension E extends A with B, C implements D { }' ,
@@ -2723,28 +2708,6 @@ main() {
2723
2708
parseCompilationUnit ('D? foo(X? x) { X? x1; X? x2 = x; }' );
2724
2709
}
2725
2710
2726
- void test_bangQuestionIndex () {
2727
- // http://dartbug.com/41177
2728
- CompilationUnit unit = parseCompilationUnit ('f(dynamic a) { a!?[0]; }' );
2729
- FunctionDeclaration funct = unit.declarations[0 ];
2730
- BlockFunctionBody body = funct.functionExpression.body;
2731
-
2732
- ExpressionStatement statement = body.block.statements[0 ];
2733
- IndexExpression expression = statement.expression;
2734
-
2735
- IntegerLiteral index = expression.index;
2736
- expect (index.value, 0 );
2737
-
2738
- Token question = expression.question;
2739
- expect (question, isNotNull);
2740
- expect (question.lexeme, "?" );
2741
-
2742
- PostfixExpression target = expression.target;
2743
- SimpleIdentifier identifier = target.operand;
2744
- expect (identifier.name, 'a' );
2745
- expect (target.operator .lexeme, '!' );
2746
- }
2747
-
2748
2711
void test_bangBeforeFuctionCall1 () {
2749
2712
// https://github.com/dart-lang/sdk/issues/39776
2750
2713
var unit = parseCompilationUnit ('f() { Function? f1; f1!(42); }' );
@@ -2797,6 +2760,28 @@ main() {
2797
2760
expect (argument.value, 42 );
2798
2761
}
2799
2762
2763
+ void test_bangQuestionIndex () {
2764
+ // http://dartbug.com/41177
2765
+ CompilationUnit unit = parseCompilationUnit ('f(dynamic a) { a!?[0]; }' );
2766
+ FunctionDeclaration funct = unit.declarations[0 ];
2767
+ BlockFunctionBody body = funct.functionExpression.body;
2768
+
2769
+ ExpressionStatement statement = body.block.statements[0 ];
2770
+ IndexExpression expression = statement.expression;
2771
+
2772
+ IntegerLiteral index = expression.index;
2773
+ expect (index.value, 0 );
2774
+
2775
+ Token question = expression.question;
2776
+ expect (question, isNotNull);
2777
+ expect (question.lexeme, "?" );
2778
+
2779
+ PostfixExpression target = expression.target;
2780
+ SimpleIdentifier identifier = target.operand;
2781
+ expect (identifier.name, 'a' );
2782
+ expect (target.operator .lexeme, '!' );
2783
+ }
2784
+
2800
2785
void test_binary_expression_statement () {
2801
2786
final unit = parseCompilationUnit ('D? foo(X? x) { X ?? x2; }' );
2802
2787
FunctionDeclaration funct = unit.declarations[0 ];
0 commit comments