| 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 analyzer.test.generated.parser_test; | 5 library analyzer.test.generated.parser_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/dart/element/type.dart'; | 8 import 'package:analyzer/dart/element/type.dart'; |
| 9 import 'package:analyzer/src/dart/element/element.dart'; | 9 import 'package:analyzer/src/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 7316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7327 | 7327 |
| 7328 void test_parseConstExpression_listLiteral_typed() { | 7328 void test_parseConstExpression_listLiteral_typed() { |
| 7329 ListLiteral literal = parse4("parseConstExpression", "const <A> []"); | 7329 ListLiteral literal = parse4("parseConstExpression", "const <A> []"); |
| 7330 expect(literal.constKeyword, isNotNull); | 7330 expect(literal.constKeyword, isNotNull); |
| 7331 expect(literal.typeArguments, isNotNull); | 7331 expect(literal.typeArguments, isNotNull); |
| 7332 expect(literal.leftBracket, isNotNull); | 7332 expect(literal.leftBracket, isNotNull); |
| 7333 expect(literal.elements, hasLength(0)); | 7333 expect(literal.elements, hasLength(0)); |
| 7334 expect(literal.rightBracket, isNotNull); | 7334 expect(literal.rightBracket, isNotNull); |
| 7335 } | 7335 } |
| 7336 | 7336 |
| 7337 void test_parseConstExpression_listLiteral_typed_genericComment() { |
| 7338 enableGenericMethodComments = true; |
| 7339 ListLiteral literal = parse4("parseConstExpression", "const /*<A>*/ []"); |
| 7340 expect(literal.constKeyword, isNotNull); |
| 7341 expect(literal.typeArguments, isNotNull); |
| 7342 expect(literal.leftBracket, isNotNull); |
| 7343 expect(literal.elements, hasLength(0)); |
| 7344 expect(literal.rightBracket, isNotNull); |
| 7345 } |
| 7346 |
| 7337 void test_parseConstExpression_listLiteral_untyped() { | 7347 void test_parseConstExpression_listLiteral_untyped() { |
| 7338 ListLiteral literal = parse4("parseConstExpression", "const []"); | 7348 ListLiteral literal = parse4("parseConstExpression", "const []"); |
| 7339 expect(literal.constKeyword, isNotNull); | 7349 expect(literal.constKeyword, isNotNull); |
| 7340 expect(literal.typeArguments, isNull); | 7350 expect(literal.typeArguments, isNull); |
| 7341 expect(literal.leftBracket, isNotNull); | 7351 expect(literal.leftBracket, isNotNull); |
| 7342 expect(literal.elements, hasLength(0)); | 7352 expect(literal.elements, hasLength(0)); |
| 7343 expect(literal.rightBracket, isNotNull); | 7353 expect(literal.rightBracket, isNotNull); |
| 7344 } | 7354 } |
| 7345 | 7355 |
| 7346 void test_parseConstExpression_mapLiteral_typed() { | 7356 void test_parseConstExpression_mapLiteral_typed() { |
| 7347 MapLiteral literal = parse4("parseConstExpression", "const <A, B> {}"); | 7357 MapLiteral literal = parse4("parseConstExpression", "const <A, B> {}"); |
| 7348 expect(literal.leftBracket, isNotNull); | 7358 expect(literal.leftBracket, isNotNull); |
| 7349 expect(literal.entries, hasLength(0)); | 7359 expect(literal.entries, hasLength(0)); |
| 7350 expect(literal.rightBracket, isNotNull); | 7360 expect(literal.rightBracket, isNotNull); |
| 7351 expect(literal.typeArguments, isNotNull); | 7361 expect(literal.typeArguments, isNotNull); |
| 7352 } | 7362 } |
| 7353 | 7363 |
| 7364 void test_parseConstExpression_mapLiteral_typed_genericComment() { |
| 7365 enableGenericMethodComments = true; |
| 7366 MapLiteral literal = parse4("parseConstExpression", "const /*<A, B>*/ {}"); |
| 7367 expect(literal.leftBracket, isNotNull); |
| 7368 expect(literal.entries, hasLength(0)); |
| 7369 expect(literal.rightBracket, isNotNull); |
| 7370 expect(literal.typeArguments, isNotNull); |
| 7371 } |
| 7372 |
| 7354 void test_parseConstExpression_mapLiteral_untyped() { | 7373 void test_parseConstExpression_mapLiteral_untyped() { |
| 7355 MapLiteral literal = parse4("parseConstExpression", "const {}"); | 7374 MapLiteral literal = parse4("parseConstExpression", "const {}"); |
| 7356 expect(literal.leftBracket, isNotNull); | 7375 expect(literal.leftBracket, isNotNull); |
| 7357 expect(literal.entries, hasLength(0)); | 7376 expect(literal.entries, hasLength(0)); |
| 7358 expect(literal.rightBracket, isNotNull); | 7377 expect(literal.rightBracket, isNotNull); |
| 7359 expect(literal.typeArguments, isNull); | 7378 expect(literal.typeArguments, isNull); |
| 7360 } | 7379 } |
| 7361 | 7380 |
| 7362 void test_parseConstructor() { | 7381 void test_parseConstructor() { |
| 7363 // TODO(brianwilkerson) Implement tests for this method. | 7382 // TODO(brianwilkerson) Implement tests for this method. |
| (...skipping 2485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9849 ListLiteral literal = parse4("parsePrimaryExpression", "[]"); | 9868 ListLiteral literal = parse4("parsePrimaryExpression", "[]"); |
| 9850 expect(literal, isNotNull); | 9869 expect(literal, isNotNull); |
| 9851 } | 9870 } |
| 9852 | 9871 |
| 9853 void test_parsePrimaryExpression_listLiteral_typed() { | 9872 void test_parsePrimaryExpression_listLiteral_typed() { |
| 9854 ListLiteral literal = parse4("parsePrimaryExpression", "<A>[ ]"); | 9873 ListLiteral literal = parse4("parsePrimaryExpression", "<A>[ ]"); |
| 9855 expect(literal.typeArguments, isNotNull); | 9874 expect(literal.typeArguments, isNotNull); |
| 9856 expect(literal.typeArguments.arguments, hasLength(1)); | 9875 expect(literal.typeArguments.arguments, hasLength(1)); |
| 9857 } | 9876 } |
| 9858 | 9877 |
| 9878 void test_parsePrimaryExpression_listLiteral_typed_genericComment() { |
| 9879 enableGenericMethodComments = true; |
| 9880 ListLiteral literal = parse4("parsePrimaryExpression", "/*<A>*/[ ]"); |
| 9881 expect(literal.typeArguments, isNotNull); |
| 9882 expect(literal.typeArguments.arguments, hasLength(1)); |
| 9883 } |
| 9884 |
| 9859 void test_parsePrimaryExpression_mapLiteral() { | 9885 void test_parsePrimaryExpression_mapLiteral() { |
| 9860 MapLiteral literal = parse4("parsePrimaryExpression", "{}"); | 9886 MapLiteral literal = parse4("parsePrimaryExpression", "{}"); |
| 9861 expect(literal, isNotNull); | 9887 expect(literal, isNotNull); |
| 9862 } | 9888 } |
| 9863 | 9889 |
| 9864 void test_parsePrimaryExpression_mapLiteral_typed() { | 9890 void test_parsePrimaryExpression_mapLiteral_typed() { |
| 9865 MapLiteral literal = parse4("parsePrimaryExpression", "<A, B>{}"); | 9891 MapLiteral literal = parse4("parsePrimaryExpression", "<A, B>{}"); |
| 9866 expect(literal.typeArguments, isNotNull); | 9892 expect(literal.typeArguments, isNotNull); |
| 9867 expect(literal.typeArguments.arguments, hasLength(2)); | 9893 expect(literal.typeArguments.arguments, hasLength(2)); |
| 9868 } | 9894 } |
| 9869 | 9895 |
| 9896 void test_parsePrimaryExpression_mapLiteral_typed_genericComment() { |
| 9897 enableGenericMethodComments = true; |
| 9898 MapLiteral literal = parse4("parsePrimaryExpression", "/*<A, B>*/{}"); |
| 9899 expect(literal.typeArguments, isNotNull); |
| 9900 expect(literal.typeArguments.arguments, hasLength(2)); |
| 9901 } |
| 9902 |
| 9870 void test_parsePrimaryExpression_new() { | 9903 void test_parsePrimaryExpression_new() { |
| 9871 InstanceCreationExpression expression = | 9904 InstanceCreationExpression expression = |
| 9872 parse4("parsePrimaryExpression", "new A()"); | 9905 parse4("parsePrimaryExpression", "new A()"); |
| 9873 expect(expression, isNotNull); | 9906 expect(expression, isNotNull); |
| 9874 } | 9907 } |
| 9875 | 9908 |
| 9876 void test_parsePrimaryExpression_null() { | 9909 void test_parsePrimaryExpression_null() { |
| 9877 NullLiteral literal = parse4("parsePrimaryExpression", "null"); | 9910 NullLiteral literal = parse4("parsePrimaryExpression", "null"); |
| 9878 expect(literal.literal, isNotNull); | 9911 expect(literal.literal, isNotNull); |
| 9879 } | 9912 } |
| (...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11388 new Scanner(null, new CharSequenceReader(source), listener); | 11421 new Scanner(null, new CharSequenceReader(source), listener); |
| 11389 Token tokenStream = scanner.tokenize(); | 11422 Token tokenStream = scanner.tokenize(); |
| 11390 // | 11423 // |
| 11391 // Parse the source. | 11424 // Parse the source. |
| 11392 // | 11425 // |
| 11393 Parser parser = new Parser(null, listener); | 11426 Parser parser = new Parser(null, listener); |
| 11394 return invokeParserMethodImpl( | 11427 return invokeParserMethodImpl( |
| 11395 parser, methodName, <Object>[tokenStream], tokenStream) as Token; | 11428 parser, methodName, <Object>[tokenStream], tokenStream) as Token; |
| 11396 } | 11429 } |
| 11397 } | 11430 } |
| OLD | NEW |