| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine.parser_test; | 3 library engine.parser_test; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 5 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
| 6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; | 6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
| 7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
| 8 import 'package:analyzer_experimental/src/generated/source.dart'; | 8 import 'package:analyzer_experimental/src/generated/source.dart'; |
| 9 import 'package:analyzer_experimental/src/generated/error.dart'; | 9 import 'package:analyzer_experimental/src/generated/error.dart'; |
| 10 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 10 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
| 11 import 'package:analyzer_experimental/src/generated/ast.dart'; | 11 import 'package:analyzer_experimental/src/generated/ast.dart'; |
| 12 import 'package:analyzer_experimental/src/generated/parser.dart'; | 12 import 'package:analyzer_experimental/src/generated/parser.dart'; |
| 13 import 'package:analyzer_experimental/src/generated/utilities_dart.dart'; | 13 import 'package:analyzer_experimental/src/generated/utilities_dart.dart'; |
| 14 import 'package:unittest/unittest.dart' as _ut; | 14 import 'package:unittest/unittest.dart' as _ut; |
| 15 import 'test_support.dart'; | 15 import 'test_support.dart'; |
| 16 import 'scanner_test.dart' show TokenFactory; | 16 import 'scanner_test.dart' show TokenFactory; |
| 17 import 'ast_test.dart' show ASTFactory; | 17 import 'ast_test.dart' show ASTFactory; |
| 18 /** | 18 /** |
| 19 * The class {@code SimpleParserTest} defines parser tests that test individual
parsing method. The | 19 * The class `SimpleParserTest` defines parser tests that test individual parsin
g method. The |
| 20 * code fragments should be as minimal as possible in order to test the method,
but should not test | 20 * code fragments should be as minimal as possible in order to test the method,
but should not test |
| 21 * the interactions between the method under test and other methods. | 21 * the interactions between the method under test and other methods. |
| 22 * <p> | 22 * |
| 23 * More complex tests should be defined in the class {@link ComplexParserTest}. | 23 * More complex tests should be defined in the class [ComplexParserTest]. |
| 24 */ | 24 */ |
| 25 class SimpleParserTest extends ParserTestCase { | 25 class SimpleParserTest extends ParserTestCase { |
| 26 void fail_parseCommentReference_this() { | 26 void fail_parseCommentReference_this() { |
| 27 CommentReference reference = ParserTestCase.parse("parseCommentReference", <
Object> ["this", 5], ""); | 27 CommentReference reference = ParserTestCase.parse("parseCommentReference", <
Object> ["this", 5], ""); |
| 28 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(SimpleIdentifi
er, reference.identifier); | 28 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(SimpleIdentifi
er, reference.identifier); |
| 29 JUnitTestCase.assertNotNull(identifier.token); | 29 JUnitTestCase.assertNotNull(identifier.token); |
| 30 JUnitTestCase.assertEquals("a", identifier.name); | 30 JUnitTestCase.assertEquals("a", identifier.name); |
| 31 JUnitTestCase.assertEquals(5, identifier.offset); | 31 JUnitTestCase.assertEquals(5, identifier.offset); |
| 32 } | 32 } |
| 33 void test_computeStringValue_emptyInterpolationPrefix() { | 33 void test_computeStringValue_emptyInterpolationPrefix() { |
| (...skipping 3627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3661 JUnitTestCase.assertNotNull(following); | 3661 JUnitTestCase.assertNotNull(following); |
| 3662 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); | 3662 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); |
| 3663 } | 3663 } |
| 3664 void test_skipTypeName_simple() { | 3664 void test_skipTypeName_simple() { |
| 3665 Token following = skip("skipTypeName", "C +"); | 3665 Token following = skip("skipTypeName", "C +"); |
| 3666 JUnitTestCase.assertNotNull(following); | 3666 JUnitTestCase.assertNotNull(following); |
| 3667 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); | 3667 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); |
| 3668 } | 3668 } |
| 3669 | 3669 |
| 3670 /** | 3670 /** |
| 3671 * Invoke the method {@link Parser#computeStringValue(String)} with the given
argument. | 3671 * Invoke the method [Parser#computeStringValue] with the given argument. |
| 3672 * @param lexeme the argument to the method | 3672 * @param lexeme the argument to the method |
| 3673 * @return the result of invoking the method | 3673 * @return the result of invoking the method |
| 3674 * @throws Exception if the method could not be invoked or throws an exception | 3674 * @throws Exception if the method could not be invoked or throws an exception |
| 3675 */ | 3675 */ |
| 3676 String computeStringValue(String lexeme) { | 3676 String computeStringValue(String lexeme) { |
| 3677 AnalysisErrorListener listener = new AnalysisErrorListener_19(); | 3677 AnalysisErrorListener listener = new AnalysisErrorListener_19(); |
| 3678 Parser parser = new Parser(null, listener); | 3678 Parser parser = new Parser(null, listener); |
| 3679 return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme
], null) as String; | 3679 return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme
], null) as String; |
| 3680 } | 3680 } |
| 3681 | 3681 |
| 3682 /** | 3682 /** |
| 3683 * Invoke the method {@link Parser#createSyntheticIdentifier()} with the parse
r set to the token | 3683 * Invoke the method [Parser#createSyntheticIdentifier] with the parser set to
the token |
| 3684 * stream produced by scanning the given source. | 3684 * stream produced by scanning the given source. |
| 3685 * @param source the source to be scanned to produce the token stream being te
sted | 3685 * @param source the source to be scanned to produce the token stream being te
sted |
| 3686 * @return the result of invoking the method | 3686 * @return the result of invoking the method |
| 3687 * @throws Exception if the method could not be invoked or throws an exception | 3687 * @throws Exception if the method could not be invoked or throws an exception |
| 3688 */ | 3688 */ |
| 3689 SimpleIdentifier createSyntheticIdentifier() { | 3689 SimpleIdentifier createSyntheticIdentifier() { |
| 3690 GatheringErrorListener listener = new GatheringErrorListener(); | 3690 GatheringErrorListener listener = new GatheringErrorListener(); |
| 3691 return ParserTestCase.invokeParserMethod2("createSyntheticIdentifier", "", l
istener); | 3691 return ParserTestCase.invokeParserMethod2("createSyntheticIdentifier", "", l
istener); |
| 3692 } | 3692 } |
| 3693 | 3693 |
| 3694 /** | 3694 /** |
| 3695 * Invoke the method {@link Parser#createSyntheticIdentifier()} with the parse
r set to the token | 3695 * Invoke the method [Parser#createSyntheticIdentifier] with the parser set to
the token |
| 3696 * stream produced by scanning the given source. | 3696 * stream produced by scanning the given source. |
| 3697 * @param source the source to be scanned to produce the token stream being te
sted | 3697 * @param source the source to be scanned to produce the token stream being te
sted |
| 3698 * @return the result of invoking the method | 3698 * @return the result of invoking the method |
| 3699 * @throws Exception if the method could not be invoked or throws an exception | 3699 * @throws Exception if the method could not be invoked or throws an exception |
| 3700 */ | 3700 */ |
| 3701 SimpleStringLiteral createSyntheticStringLiteral() { | 3701 SimpleStringLiteral createSyntheticStringLiteral() { |
| 3702 GatheringErrorListener listener = new GatheringErrorListener(); | 3702 GatheringErrorListener listener = new GatheringErrorListener(); |
| 3703 return ParserTestCase.invokeParserMethod2("createSyntheticStringLiteral", ""
, listener); | 3703 return ParserTestCase.invokeParserMethod2("createSyntheticStringLiteral", ""
, listener); |
| 3704 } | 3704 } |
| 3705 | 3705 |
| 3706 /** | 3706 /** |
| 3707 * Invoke the method {@link Parser#isFunctionDeclaration()} with the parser se
t to the token | 3707 * Invoke the method [Parser#isFunctionDeclaration] with the parser set to the
token |
| 3708 * stream produced by scanning the given source. | 3708 * stream produced by scanning the given source. |
| 3709 * @param source the source to be scanned to produce the token stream being te
sted | 3709 * @param source the source to be scanned to produce the token stream being te
sted |
| 3710 * @return the result of invoking the method | 3710 * @return the result of invoking the method |
| 3711 * @throws Exception if the method could not be invoked or throws an exception | 3711 * @throws Exception if the method could not be invoked or throws an exception |
| 3712 */ | 3712 */ |
| 3713 bool isFunctionDeclaration(String source) { | 3713 bool isFunctionDeclaration(String source) { |
| 3714 GatheringErrorListener listener = new GatheringErrorListener(); | 3714 GatheringErrorListener listener = new GatheringErrorListener(); |
| 3715 return ParserTestCase.invokeParserMethod2("isFunctionDeclaration", source, l
istener) as bool; | 3715 return ParserTestCase.invokeParserMethod2("isFunctionDeclaration", source, l
istener) as bool; |
| 3716 } | 3716 } |
| 3717 | 3717 |
| 3718 /** | 3718 /** |
| 3719 * Invoke the method {@link Parser#isFunctionExpression()} with the parser set
to the token stream | 3719 * Invoke the method [Parser#isFunctionExpression] with the parser set to the
token stream |
| 3720 * produced by scanning the given source. | 3720 * produced by scanning the given source. |
| 3721 * @param source the source to be scanned to produce the token stream being te
sted | 3721 * @param source the source to be scanned to produce the token stream being te
sted |
| 3722 * @return the result of invoking the method | 3722 * @return the result of invoking the method |
| 3723 * @throws Exception if the method could not be invoked or throws an exception | 3723 * @throws Exception if the method could not be invoked or throws an exception |
| 3724 */ | 3724 */ |
| 3725 bool isFunctionExpression(String source) { | 3725 bool isFunctionExpression(String source) { |
| 3726 GatheringErrorListener listener = new GatheringErrorListener(); | 3726 GatheringErrorListener listener = new GatheringErrorListener(); |
| 3727 StringScanner scanner = new StringScanner(null, source, listener); | 3727 StringScanner scanner = new StringScanner(null, source, listener); |
| 3728 Token tokenStream = scanner.tokenize(); | 3728 Token tokenStream = scanner.tokenize(); |
| 3729 Parser parser = new Parser(null, listener); | 3729 Parser parser = new Parser(null, listener); |
| 3730 return invokeParserMethodImpl(parser, "isFunctionExpression", <Object> [toke
nStream], tokenStream) as bool; | 3730 return invokeParserMethodImpl(parser, "isFunctionExpression", <Object> [toke
nStream], tokenStream) as bool; |
| 3731 } | 3731 } |
| 3732 | 3732 |
| 3733 /** | 3733 /** |
| 3734 * Invoke the method {@link Parser#isInitializedVariableDeclaration()} with th
e parser set to the | 3734 * Invoke the method [Parser#isInitializedVariableDeclaration] with the parser
set to the |
| 3735 * token stream produced by scanning the given source. | 3735 * token stream produced by scanning the given source. |
| 3736 * @param source the source to be scanned to produce the token stream being te
sted | 3736 * @param source the source to be scanned to produce the token stream being te
sted |
| 3737 * @return the result of invoking the method | 3737 * @return the result of invoking the method |
| 3738 * @throws Exception if the method could not be invoked or throws an exception | 3738 * @throws Exception if the method could not be invoked or throws an exception |
| 3739 */ | 3739 */ |
| 3740 bool isInitializedVariableDeclaration(String source) { | 3740 bool isInitializedVariableDeclaration(String source) { |
| 3741 GatheringErrorListener listener = new GatheringErrorListener(); | 3741 GatheringErrorListener listener = new GatheringErrorListener(); |
| 3742 return ParserTestCase.invokeParserMethod2("isInitializedVariableDeclaration"
, source, listener) as bool; | 3742 return ParserTestCase.invokeParserMethod2("isInitializedVariableDeclaration"
, source, listener) as bool; |
| 3743 } | 3743 } |
| 3744 | 3744 |
| 3745 /** | 3745 /** |
| 3746 * Invoke the method {@link Parser#isSwitchMember()} with the parser set to th
e token stream | 3746 * Invoke the method [Parser#isSwitchMember] with the parser set to the token
stream |
| 3747 * produced by scanning the given source. | 3747 * produced by scanning the given source. |
| 3748 * @param source the source to be scanned to produce the token stream being te
sted | 3748 * @param source the source to be scanned to produce the token stream being te
sted |
| 3749 * @return the result of invoking the method | 3749 * @return the result of invoking the method |
| 3750 * @throws Exception if the method could not be invoked or throws an exception | 3750 * @throws Exception if the method could not be invoked or throws an exception |
| 3751 */ | 3751 */ |
| 3752 bool isSwitchMember(String source) { | 3752 bool isSwitchMember(String source) { |
| 3753 GatheringErrorListener listener = new GatheringErrorListener(); | 3753 GatheringErrorListener listener = new GatheringErrorListener(); |
| 3754 return ParserTestCase.invokeParserMethod2("isSwitchMember", source, listener
) as bool; | 3754 return ParserTestCase.invokeParserMethod2("isSwitchMember", source, listener
) as bool; |
| 3755 } | 3755 } |
| 3756 | 3756 |
| 3757 /** | 3757 /** |
| 3758 * Invoke a "skip" method in {@link Parser}. The method is assumed to take a t
oken as it's | 3758 * Invoke a "skip" method in [Parser]. The method is assumed to take a token a
s it's |
| 3759 * parameter and is given the first token in the scanned source. | 3759 * parameter and is given the first token in the scanned source. |
| 3760 * @param methodName the name of the method that should be invoked | 3760 * @param methodName the name of the method that should be invoked |
| 3761 * @param source the source to be processed by the method | 3761 * @param source the source to be processed by the method |
| 3762 * @return the result of invoking the method | 3762 * @return the result of invoking the method |
| 3763 * @throws Exception if the method could not be invoked or throws an exception | 3763 * @throws Exception if the method could not be invoked or throws an exception |
| 3764 * @throws AssertionFailedError if the result is {@code null} | 3764 * @throws AssertionFailedError if the result is `null` |
| 3765 */ | 3765 */ |
| 3766 Token skip(String methodName, String source) { | 3766 Token skip(String methodName, String source) { |
| 3767 GatheringErrorListener listener = new GatheringErrorListener(); | 3767 GatheringErrorListener listener = new GatheringErrorListener(); |
| 3768 StringScanner scanner = new StringScanner(null, source, listener); | 3768 StringScanner scanner = new StringScanner(null, source, listener); |
| 3769 Token tokenStream = scanner.tokenize(); | 3769 Token tokenStream = scanner.tokenize(); |
| 3770 Parser parser = new Parser(null, listener); | 3770 Parser parser = new Parser(null, listener); |
| 3771 return invokeParserMethodImpl(parser, methodName, <Object> [tokenStream], to
kenStream) as Token; | 3771 return invokeParserMethodImpl(parser, methodName, <Object> [tokenStream], to
kenStream) as Token; |
| 3772 } | 3772 } |
| 3773 static dartSuite() { | 3773 static dartSuite() { |
| 3774 _ut.group('SimpleParserTest', () { | 3774 _ut.group('SimpleParserTest', () { |
| (...skipping 2071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5846 }); | 5846 }); |
| 5847 }); | 5847 }); |
| 5848 } | 5848 } |
| 5849 } | 5849 } |
| 5850 class AnalysisErrorListener_19 implements AnalysisErrorListener { | 5850 class AnalysisErrorListener_19 implements AnalysisErrorListener { |
| 5851 void onError(AnalysisError event) { | 5851 void onError(AnalysisError event) { |
| 5852 JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event.
offset}, ${event.length})"); | 5852 JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event.
offset}, ${event.length})"); |
| 5853 } | 5853 } |
| 5854 } | 5854 } |
| 5855 /** | 5855 /** |
| 5856 * The class {@code ComplexParserTest} defines parser tests that test the parsin
g of more complex | 5856 * The class `ComplexParserTest` defines parser tests that test the parsing of m
ore complex |
| 5857 * code fragments or the interactions between multiple parsing methods. For exam
ple, tests to ensure | 5857 * code fragments or the interactions between multiple parsing methods. For exam
ple, tests to ensure |
| 5858 * that the precedence of operations is being handled correctly should be define
d in this class. | 5858 * that the precedence of operations is being handled correctly should be define
d in this class. |
| 5859 * <p> | 5859 * |
| 5860 * Simpler tests should be defined in the class {@link SimpleParserTest}. | 5860 * Simpler tests should be defined in the class [SimpleParserTest]. |
| 5861 */ | 5861 */ |
| 5862 class ComplexParserTest extends ParserTestCase { | 5862 class ComplexParserTest extends ParserTestCase { |
| 5863 void test_additiveExpression_normal() { | 5863 void test_additiveExpression_normal() { |
| 5864 BinaryExpression expression = ParserTestCase.parseExpression("x + y - z", []
); | 5864 BinaryExpression expression = ParserTestCase.parseExpression("x + y - z", []
); |
| 5865 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); | 5865 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); |
| 5866 } | 5866 } |
| 5867 void test_additiveExpression_noSpaces() { | 5867 void test_additiveExpression_noSpaces() { |
| 5868 BinaryExpression expression = ParserTestCase.parseExpression("i+1", []); | 5868 BinaryExpression expression = ParserTestCase.parseExpression("i+1", []); |
| 5869 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); | 5869 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); |
| 5870 EngineTestCase.assertInstanceOf(IntegerLiteral, expression.rightOperand); | 5870 EngineTestCase.assertInstanceOf(IntegerLiteral, expression.rightOperand); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6256 runJUnitTest(__test, __test.test_shiftExpression_precedence_additive_rig
ht); | 6256 runJUnitTest(__test, __test.test_shiftExpression_precedence_additive_rig
ht); |
| 6257 }); | 6257 }); |
| 6258 _ut.test('test_shiftExpression_super', () { | 6258 _ut.test('test_shiftExpression_super', () { |
| 6259 final __test = new ComplexParserTest(); | 6259 final __test = new ComplexParserTest(); |
| 6260 runJUnitTest(__test, __test.test_shiftExpression_super); | 6260 runJUnitTest(__test, __test.test_shiftExpression_super); |
| 6261 }); | 6261 }); |
| 6262 }); | 6262 }); |
| 6263 } | 6263 } |
| 6264 } | 6264 } |
| 6265 /** | 6265 /** |
| 6266 * Instances of the class {@code ASTValidator} are used to validate the correct
construction of an | 6266 * Instances of the class `ASTValidator` are used to validate the correct constr
uction of an |
| 6267 * AST structure. | 6267 * AST structure. |
| 6268 */ | 6268 */ |
| 6269 class ASTValidator extends GeneralizingASTVisitor<Object> { | 6269 class ASTValidator extends GeneralizingASTVisitor<Object> { |
| 6270 | 6270 |
| 6271 /** | 6271 /** |
| 6272 * A list containing the errors found while traversing the AST structure. | 6272 * A list containing the errors found while traversing the AST structure. |
| 6273 */ | 6273 */ |
| 6274 List<String> _errors = new List<String>(); | 6274 List<String> _errors = new List<String>(); |
| 6275 | 6275 |
| 6276 /** | 6276 /** |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6333 } | 6333 } |
| 6334 } | 6334 } |
| 6335 class ParserTestCase extends EngineTestCase { | 6335 class ParserTestCase extends EngineTestCase { |
| 6336 | 6336 |
| 6337 /** | 6337 /** |
| 6338 * An empty array of objects used as arguments to zero-argument methods. | 6338 * An empty array of objects used as arguments to zero-argument methods. |
| 6339 */ | 6339 */ |
| 6340 static List<Object> _EMPTY_ARGUMENTS = new List<Object>(0); | 6340 static List<Object> _EMPTY_ARGUMENTS = new List<Object>(0); |
| 6341 | 6341 |
| 6342 /** | 6342 /** |
| 6343 * Invoke a parse method in {@link Parser}. The method is assumed to have the
given number and | 6343 * Invoke a parse method in [Parser]. The method is assumed to have the given
number and |
| 6344 * type of parameters and will be invoked with the given arguments. | 6344 * type of parameters and will be invoked with the given arguments. |
| 6345 * <p> | 6345 * |
| 6346 * The given source is scanned and the parser is initialized to start with the
first token in the | 6346 * The given source is scanned and the parser is initialized to start with the
first token in the |
| 6347 * source before the parse method is invoked. | 6347 * source before the parse method is invoked. |
| 6348 * @param methodName the name of the parse method that should be invoked to pa
rse the source | 6348 * @param methodName the name of the parse method that should be invoked to pa
rse the source |
| 6349 * @param objects the values of the arguments to the method | 6349 * @param objects the values of the arguments to the method |
| 6350 * @param source the source to be parsed by the parse method | 6350 * @param source the source to be parsed by the parse method |
| 6351 * @return the result of invoking the method | 6351 * @return the result of invoking the method |
| 6352 * @throws Exception if the method could not be invoked or throws an exception | 6352 * @throws Exception if the method could not be invoked or throws an exception |
| 6353 * @throws AssertionFailedError if the result is {@code null} or if any errors
are produced | 6353 * @throws AssertionFailedError if the result is `null` or if any errors are p
roduced |
| 6354 */ | 6354 */ |
| 6355 static Object parse(String methodName, List<Object> objects, String source) =>
parse3(methodName, objects, source, new List<AnalysisError>(0)); | 6355 static Object parse(String methodName, List<Object> objects, String source) =>
parse3(methodName, objects, source, new List<AnalysisError>(0)); |
| 6356 | 6356 |
| 6357 /** | 6357 /** |
| 6358 * Invoke a parse method in {@link Parser}. The method is assumed to have the
given number and | 6358 * Invoke a parse method in [Parser]. The method is assumed to have the given
number and |
| 6359 * type of parameters and will be invoked with the given arguments. | 6359 * type of parameters and will be invoked with the given arguments. |
| 6360 * <p> | 6360 * |
| 6361 * The given source is scanned and the parser is initialized to start with the
first token in the | 6361 * The given source is scanned and the parser is initialized to start with the
first token in the |
| 6362 * source before the parse method is invoked. | 6362 * source before the parse method is invoked. |
| 6363 * @param methodName the name of the parse method that should be invoked to pa
rse the source | 6363 * @param methodName the name of the parse method that should be invoked to pa
rse the source |
| 6364 * @param objects the values of the arguments to the method | 6364 * @param objects the values of the arguments to the method |
| 6365 * @param source the source to be parsed by the parse method | 6365 * @param source the source to be parsed by the parse method |
| 6366 * @param errorCodes the error codes of the errors that should be generated | 6366 * @param errorCodes the error codes of the errors that should be generated |
| 6367 * @return the result of invoking the method | 6367 * @return the result of invoking the method |
| 6368 * @throws Exception if the method could not be invoked or throws an exception | 6368 * @throws Exception if the method could not be invoked or throws an exception |
| 6369 * @throws AssertionFailedError if the result is {@code null} or the errors pr
oduced while | 6369 * @throws AssertionFailedError if the result is `null` or the errors produced
while |
| 6370 * scanning and parsing the source do not match the expected errors | 6370 * scanning and parsing the source do not match the expected errors |
| 6371 */ | 6371 */ |
| 6372 static Object parse3(String methodName, List<Object> objects, String source, L
ist<AnalysisError> errors) { | 6372 static Object parse3(String methodName, List<Object> objects, String source, L
ist<AnalysisError> errors) { |
| 6373 GatheringErrorListener listener = new GatheringErrorListener(); | 6373 GatheringErrorListener listener = new GatheringErrorListener(); |
| 6374 Object result = invokeParserMethod(methodName, objects, source, listener); | 6374 Object result = invokeParserMethod(methodName, objects, source, listener); |
| 6375 listener.assertErrors(errors); | 6375 listener.assertErrors(errors); |
| 6376 return result; | 6376 return result; |
| 6377 } | 6377 } |
| 6378 | 6378 |
| 6379 /** | 6379 /** |
| 6380 * Invoke a parse method in {@link Parser}. The method is assumed to have the
given number and | 6380 * Invoke a parse method in [Parser]. The method is assumed to have the given
number and |
| 6381 * type of parameters and will be invoked with the given arguments. | 6381 * type of parameters and will be invoked with the given arguments. |
| 6382 * <p> | 6382 * |
| 6383 * The given source is scanned and the parser is initialized to start with the
first token in the | 6383 * The given source is scanned and the parser is initialized to start with the
first token in the |
| 6384 * source before the parse method is invoked. | 6384 * source before the parse method is invoked. |
| 6385 * @param methodName the name of the parse method that should be invoked to pa
rse the source | 6385 * @param methodName the name of the parse method that should be invoked to pa
rse the source |
| 6386 * @param objects the values of the arguments to the method | 6386 * @param objects the values of the arguments to the method |
| 6387 * @param source the source to be parsed by the parse method | 6387 * @param source the source to be parsed by the parse method |
| 6388 * @param errorCodes the error codes of the errors that should be generated | 6388 * @param errorCodes the error codes of the errors that should be generated |
| 6389 * @return the result of invoking the method | 6389 * @return the result of invoking the method |
| 6390 * @throws Exception if the method could not be invoked or throws an exception | 6390 * @throws Exception if the method could not be invoked or throws an exception |
| 6391 * @throws AssertionFailedError if the result is {@code null} or the errors pr
oduced while | 6391 * @throws AssertionFailedError if the result is `null` or the errors produced
while |
| 6392 * scanning and parsing the source do not match the expected errors | 6392 * scanning and parsing the source do not match the expected errors |
| 6393 */ | 6393 */ |
| 6394 static Object parse4(String methodName, List<Object> objects, String source, L
ist<ErrorCode> errorCodes) { | 6394 static Object parse4(String methodName, List<Object> objects, String source, L
ist<ErrorCode> errorCodes) { |
| 6395 GatheringErrorListener listener = new GatheringErrorListener(); | 6395 GatheringErrorListener listener = new GatheringErrorListener(); |
| 6396 Object result = invokeParserMethod(methodName, objects, source, listener); | 6396 Object result = invokeParserMethod(methodName, objects, source, listener); |
| 6397 listener.assertErrors2(errorCodes); | 6397 listener.assertErrors2(errorCodes); |
| 6398 return result; | 6398 return result; |
| 6399 } | 6399 } |
| 6400 | 6400 |
| 6401 /** | 6401 /** |
| 6402 * Invoke a parse method in {@link Parser}. The method is assumed to have no a
rguments. | 6402 * Invoke a parse method in [Parser]. The method is assumed to have no argumen
ts. |
| 6403 * <p> | 6403 * |
| 6404 * The given source is scanned and the parser is initialized to start with the
first token in the | 6404 * The given source is scanned and the parser is initialized to start with the
first token in the |
| 6405 * source before the parse method is invoked. | 6405 * source before the parse method is invoked. |
| 6406 * @param methodName the name of the parse method that should be invoked to pa
rse the source | 6406 * @param methodName the name of the parse method that should be invoked to pa
rse the source |
| 6407 * @param source the source to be parsed by the parse method | 6407 * @param source the source to be parsed by the parse method |
| 6408 * @param errorCodes the error codes of the errors that should be generated | 6408 * @param errorCodes the error codes of the errors that should be generated |
| 6409 * @return the result of invoking the method | 6409 * @return the result of invoking the method |
| 6410 * @throws Exception if the method could not be invoked or throws an exception | 6410 * @throws Exception if the method could not be invoked or throws an exception |
| 6411 * @throws AssertionFailedError if the result is {@code null} or the errors pr
oduced while | 6411 * @throws AssertionFailedError if the result is `null` or the errors produced
while |
| 6412 * scanning and parsing the source do not match the expected errors | 6412 * scanning and parsing the source do not match the expected errors |
| 6413 */ | 6413 */ |
| 6414 static Object parse5(String methodName, String source, List<ErrorCode> errorCo
des) => parse4(methodName, _EMPTY_ARGUMENTS, source, errorCodes); | 6414 static Object parse5(String methodName, String source, List<ErrorCode> errorCo
des) => parse4(methodName, _EMPTY_ARGUMENTS, source, errorCodes); |
| 6415 | 6415 |
| 6416 /** | 6416 /** |
| 6417 * Parse the given source as a compilation unit. | 6417 * Parse the given source as a compilation unit. |
| 6418 * @param source the source to be parsed | 6418 * @param source the source to be parsed |
| 6419 * @param errorCodes the error codes of the errors that are expected to be fou
nd | 6419 * @param errorCodes the error codes of the errors that are expected to be fou
nd |
| 6420 * @return the compilation unit that was parsed | 6420 * @return the compilation unit that was parsed |
| 6421 * @throws Exception if the source could not be parsed, if the compilation err
ors in the source do | 6421 * @throws Exception if the source could not be parsed, if the compilation err
ors in the source do |
| 6422 * not match those that are expected, or if the result would have been {@code
null} | 6422 * not match those that are expected, or if the result would have been `null` |
| 6423 */ | 6423 */ |
| 6424 static CompilationUnit parseCompilationUnit(String source, List<ErrorCode> err
orCodes) { | 6424 static CompilationUnit parseCompilationUnit(String source, List<ErrorCode> err
orCodes) { |
| 6425 GatheringErrorListener listener = new GatheringErrorListener(); | 6425 GatheringErrorListener listener = new GatheringErrorListener(); |
| 6426 StringScanner scanner = new StringScanner(null, source, listener); | 6426 StringScanner scanner = new StringScanner(null, source, listener); |
| 6427 listener.setLineInfo(new TestSource(), scanner.lineStarts); | 6427 listener.setLineInfo(new TestSource(), scanner.lineStarts); |
| 6428 Token token = scanner.tokenize(); | 6428 Token token = scanner.tokenize(); |
| 6429 Parser parser = new Parser(null, listener); | 6429 Parser parser = new Parser(null, listener); |
| 6430 CompilationUnit unit = parser.parseCompilationUnit(token); | 6430 CompilationUnit unit = parser.parseCompilationUnit(token); |
| 6431 JUnitTestCase.assertNotNull(unit); | 6431 JUnitTestCase.assertNotNull(unit); |
| 6432 listener.assertErrors2(errorCodes); | 6432 listener.assertErrors2(errorCodes); |
| 6433 return unit; | 6433 return unit; |
| 6434 } | 6434 } |
| 6435 | 6435 |
| 6436 /** | 6436 /** |
| 6437 * Parse the given source as an expression. | 6437 * Parse the given source as an expression. |
| 6438 * @param source the source to be parsed | 6438 * @param source the source to be parsed |
| 6439 * @param errorCodes the error codes of the errors that are expected to be fou
nd | 6439 * @param errorCodes the error codes of the errors that are expected to be fou
nd |
| 6440 * @return the expression that was parsed | 6440 * @return the expression that was parsed |
| 6441 * @throws Exception if the source could not be parsed, if the compilation err
ors in the source do | 6441 * @throws Exception if the source could not be parsed, if the compilation err
ors in the source do |
| 6442 * not match those that are expected, or if the result would have been {@code
null} | 6442 * not match those that are expected, or if the result would have been `null` |
| 6443 */ | 6443 */ |
| 6444 static Expression parseExpression(String source, List<ErrorCode> errorCodes) { | 6444 static Expression parseExpression(String source, List<ErrorCode> errorCodes) { |
| 6445 GatheringErrorListener listener = new GatheringErrorListener(); | 6445 GatheringErrorListener listener = new GatheringErrorListener(); |
| 6446 StringScanner scanner = new StringScanner(null, source, listener); | 6446 StringScanner scanner = new StringScanner(null, source, listener); |
| 6447 listener.setLineInfo(new TestSource(), scanner.lineStarts); | 6447 listener.setLineInfo(new TestSource(), scanner.lineStarts); |
| 6448 Token token = scanner.tokenize(); | 6448 Token token = scanner.tokenize(); |
| 6449 Parser parser = new Parser(null, listener); | 6449 Parser parser = new Parser(null, listener); |
| 6450 Expression expression = parser.parseExpression(token); | 6450 Expression expression = parser.parseExpression(token); |
| 6451 JUnitTestCase.assertNotNull(expression); | 6451 JUnitTestCase.assertNotNull(expression); |
| 6452 listener.assertErrors2(errorCodes); | 6452 listener.assertErrors2(errorCodes); |
| 6453 return expression as Expression; | 6453 return expression as Expression; |
| 6454 } | 6454 } |
| 6455 | 6455 |
| 6456 /** | 6456 /** |
| 6457 * Parse the given source as a statement. | 6457 * Parse the given source as a statement. |
| 6458 * @param source the source to be parsed | 6458 * @param source the source to be parsed |
| 6459 * @param errorCodes the error codes of the errors that are expected to be fou
nd | 6459 * @param errorCodes the error codes of the errors that are expected to be fou
nd |
| 6460 * @return the statement that was parsed | 6460 * @return the statement that was parsed |
| 6461 * @throws Exception if the source could not be parsed, if the compilation err
ors in the source do | 6461 * @throws Exception if the source could not be parsed, if the compilation err
ors in the source do |
| 6462 * not match those that are expected, or if the result would have been {@code
null} | 6462 * not match those that are expected, or if the result would have been `null` |
| 6463 */ | 6463 */ |
| 6464 static Statement parseStatement(String source, List<ErrorCode> errorCodes) { | 6464 static Statement parseStatement(String source, List<ErrorCode> errorCodes) { |
| 6465 GatheringErrorListener listener = new GatheringErrorListener(); | 6465 GatheringErrorListener listener = new GatheringErrorListener(); |
| 6466 StringScanner scanner = new StringScanner(null, source, listener); | 6466 StringScanner scanner = new StringScanner(null, source, listener); |
| 6467 listener.setLineInfo(new TestSource(), scanner.lineStarts); | 6467 listener.setLineInfo(new TestSource(), scanner.lineStarts); |
| 6468 Token token = scanner.tokenize(); | 6468 Token token = scanner.tokenize(); |
| 6469 Parser parser = new Parser(null, listener); | 6469 Parser parser = new Parser(null, listener); |
| 6470 Statement statement = parser.parseStatement(token); | 6470 Statement statement = parser.parseStatement(token); |
| 6471 JUnitTestCase.assertNotNull(statement); | 6471 JUnitTestCase.assertNotNull(statement); |
| 6472 listener.assertErrors2(errorCodes); | 6472 listener.assertErrors2(errorCodes); |
| 6473 return statement as Statement; | 6473 return statement as Statement; |
| 6474 } | 6474 } |
| 6475 | 6475 |
| 6476 /** | 6476 /** |
| 6477 * Parse the given source as a sequence of statements. | 6477 * Parse the given source as a sequence of statements. |
| 6478 * @param source the source to be parsed | 6478 * @param source the source to be parsed |
| 6479 * @param expectedCount the number of statements that are expected | 6479 * @param expectedCount the number of statements that are expected |
| 6480 * @param errorCodes the error codes of the errors that are expected to be fou
nd | 6480 * @param errorCodes the error codes of the errors that are expected to be fou
nd |
| 6481 * @return the statements that were parsed | 6481 * @return the statements that were parsed |
| 6482 * @throws Exception if the source could not be parsed, if the number of state
ments does not match | 6482 * @throws Exception if the source could not be parsed, if the number of state
ments does not match |
| 6483 * the expected count, if the compilation errors in the source do not match th
ose that | 6483 * the expected count, if the compilation errors in the source do not match th
ose that |
| 6484 * are expected, or if the result would have been {@code null} | 6484 * are expected, or if the result would have been `null` |
| 6485 */ | 6485 */ |
| 6486 static List<Statement> parseStatements(String source, int expectedCount, List<
ErrorCode> errorCodes) { | 6486 static List<Statement> parseStatements(String source, int expectedCount, List<
ErrorCode> errorCodes) { |
| 6487 GatheringErrorListener listener = new GatheringErrorListener(); | 6487 GatheringErrorListener listener = new GatheringErrorListener(); |
| 6488 StringScanner scanner = new StringScanner(null, source, listener); | 6488 StringScanner scanner = new StringScanner(null, source, listener); |
| 6489 listener.setLineInfo(new TestSource(), scanner.lineStarts); | 6489 listener.setLineInfo(new TestSource(), scanner.lineStarts); |
| 6490 Token token = scanner.tokenize(); | 6490 Token token = scanner.tokenize(); |
| 6491 Parser parser = new Parser(null, listener); | 6491 Parser parser = new Parser(null, listener); |
| 6492 List<Statement> statements = parser.parseStatements(token); | 6492 List<Statement> statements = parser.parseStatements(token); |
| 6493 EngineTestCase.assertSize(expectedCount, statements); | 6493 EngineTestCase.assertSize(expectedCount, statements); |
| 6494 listener.assertErrors2(errorCodes); | 6494 listener.assertErrors2(errorCodes); |
| 6495 return statements; | 6495 return statements; |
| 6496 } | 6496 } |
| 6497 | 6497 |
| 6498 /** | 6498 /** |
| 6499 * Invoke a method in {@link Parser}. The method is assumed to have the given
number and type of | 6499 * Invoke a method in [Parser]. The method is assumed to have the given number
and type of |
| 6500 * parameters and will be invoked with the given arguments. | 6500 * parameters and will be invoked with the given arguments. |
| 6501 * <p> | 6501 * |
| 6502 * The given source is scanned and the parser is initialized to start with the
first token in the | 6502 * The given source is scanned and the parser is initialized to start with the
first token in the |
| 6503 * source before the method is invoked. | 6503 * source before the method is invoked. |
| 6504 * @param methodName the name of the method that should be invoked | 6504 * @param methodName the name of the method that should be invoked |
| 6505 * @param objects the values of the arguments to the method | 6505 * @param objects the values of the arguments to the method |
| 6506 * @param source the source to be processed by the parse method | 6506 * @param source the source to be processed by the parse method |
| 6507 * @param listener the error listener that will be used for both scanning and
parsing | 6507 * @param listener the error listener that will be used for both scanning and
parsing |
| 6508 * @return the result of invoking the method | 6508 * @return the result of invoking the method |
| 6509 * @throws Exception if the method could not be invoked or throws an exception | 6509 * @throws Exception if the method could not be invoked or throws an exception |
| 6510 * @throws AssertionFailedError if the result is {@code null} or the errors pr
oduced while | 6510 * @throws AssertionFailedError if the result is `null` or the errors produced
while |
| 6511 * scanning and parsing the source do not match the expected errors | 6511 * scanning and parsing the source do not match the expected errors |
| 6512 */ | 6512 */ |
| 6513 static Object invokeParserMethod(String methodName, List<Object> objects, Stri
ng source, GatheringErrorListener listener) { | 6513 static Object invokeParserMethod(String methodName, List<Object> objects, Stri
ng source, GatheringErrorListener listener) { |
| 6514 StringScanner scanner = new StringScanner(null, source, listener); | 6514 StringScanner scanner = new StringScanner(null, source, listener); |
| 6515 Token tokenStream = scanner.tokenize(); | 6515 Token tokenStream = scanner.tokenize(); |
| 6516 listener.setLineInfo(new TestSource(), scanner.lineStarts); | 6516 listener.setLineInfo(new TestSource(), scanner.lineStarts); |
| 6517 Parser parser = new Parser(null, listener); | 6517 Parser parser = new Parser(null, listener); |
| 6518 Object result = invokeParserMethodImpl(parser, methodName, objects, tokenStr
eam); | 6518 Object result = invokeParserMethodImpl(parser, methodName, objects, tokenStr
eam); |
| 6519 if (!listener.hasErrors()) { | 6519 if (!listener.hasErrors()) { |
| 6520 JUnitTestCase.assertNotNull(result); | 6520 JUnitTestCase.assertNotNull(result); |
| 6521 } | 6521 } |
| 6522 return result as Object; | 6522 return result as Object; |
| 6523 } | 6523 } |
| 6524 | 6524 |
| 6525 /** | 6525 /** |
| 6526 * Invoke a method in {@link Parser}. The method is assumed to have no argumen
ts. | 6526 * Invoke a method in [Parser]. The method is assumed to have no arguments. |
| 6527 * <p> | 6527 * |
| 6528 * The given source is scanned and the parser is initialized to start with the
first token in the | 6528 * The given source is scanned and the parser is initialized to start with the
first token in the |
| 6529 * source before the method is invoked. | 6529 * source before the method is invoked. |
| 6530 * @param methodName the name of the method that should be invoked | 6530 * @param methodName the name of the method that should be invoked |
| 6531 * @param source the source to be processed by the parse method | 6531 * @param source the source to be processed by the parse method |
| 6532 * @param listener the error listener that will be used for both scanning and
parsing | 6532 * @param listener the error listener that will be used for both scanning and
parsing |
| 6533 * @return the result of invoking the method | 6533 * @return the result of invoking the method |
| 6534 * @throws Exception if the method could not be invoked or throws an exception | 6534 * @throws Exception if the method could not be invoked or throws an exception |
| 6535 * @throws AssertionFailedError if the result is {@code null} or the errors pr
oduced while | 6535 * @throws AssertionFailedError if the result is `null` or the errors produced
while |
| 6536 * scanning and parsing the source do not match the expected errors | 6536 * scanning and parsing the source do not match the expected errors |
| 6537 */ | 6537 */ |
| 6538 static Object invokeParserMethod2(String methodName, String source, GatheringE
rrorListener listener) => invokeParserMethod(methodName, _EMPTY_ARGUMENTS, sourc
e, listener); | 6538 static Object invokeParserMethod2(String methodName, String source, GatheringE
rrorListener listener) => invokeParserMethod(methodName, _EMPTY_ARGUMENTS, sourc
e, listener); |
| 6539 | 6539 |
| 6540 /** | 6540 /** |
| 6541 * Return a CommentAndMetadata object with the given values that can be used f
or testing. | 6541 * Return a CommentAndMetadata object with the given values that can be used f
or testing. |
| 6542 * @param comment the comment to be wrapped in the object | 6542 * @param comment the comment to be wrapped in the object |
| 6543 * @param annotations the annotations to be wrapped in the object | 6543 * @param annotations the annotations to be wrapped in the object |
| 6544 * @return a CommentAndMetadata object that can be used for testing | 6544 * @return a CommentAndMetadata object that can be used for testing |
| 6545 */ | 6545 */ |
| 6546 CommentAndMetadata commentAndMetadata(Comment comment, List<Annotation> annota
tions) { | 6546 CommentAndMetadata commentAndMetadata(Comment comment, List<Annotation> annota
tions) { |
| 6547 List<Annotation> metadata = new List<Annotation>(); | 6547 List<Annotation> metadata = new List<Annotation>(); |
| 6548 for (Annotation annotation in annotations) { | 6548 for (Annotation annotation in annotations) { |
| 6549 metadata.add(annotation); | 6549 metadata.add(annotation); |
| 6550 } | 6550 } |
| 6551 return new CommentAndMetadata(comment, metadata); | 6551 return new CommentAndMetadata(comment, metadata); |
| 6552 } | 6552 } |
| 6553 | 6553 |
| 6554 /** | 6554 /** |
| 6555 * Return an empty CommentAndMetadata object that can be used for testing. | 6555 * Return an empty CommentAndMetadata object that can be used for testing. |
| 6556 * @return an empty CommentAndMetadata object that can be used for testing | 6556 * @return an empty CommentAndMetadata object that can be used for testing |
| 6557 */ | 6557 */ |
| 6558 CommentAndMetadata emptyCommentAndMetadata() => new CommentAndMetadata(null, n
ew List<Annotation>()); | 6558 CommentAndMetadata emptyCommentAndMetadata() => new CommentAndMetadata(null, n
ew List<Annotation>()); |
| 6559 static dartSuite() { | 6559 static dartSuite() { |
| 6560 _ut.group('ParserTestCase', () { | 6560 _ut.group('ParserTestCase', () { |
| 6561 }); | 6561 }); |
| 6562 } | 6562 } |
| 6563 } | 6563 } |
| 6564 /** | 6564 /** |
| 6565 * The class {@code RecoveryParserTest} defines parser tests that test the parsi
ng of invalid code | 6565 * The class `RecoveryParserTest` defines parser tests that test the parsing of
invalid code |
| 6566 * sequences to ensure that the correct recovery steps are taken in the parser. | 6566 * sequences to ensure that the correct recovery steps are taken in the parser. |
| 6567 */ | 6567 */ |
| 6568 class RecoveryParserTest extends ParserTestCase { | 6568 class RecoveryParserTest extends ParserTestCase { |
| 6569 void fail_incompleteReturnType() { | 6569 void fail_incompleteReturnType() { |
| 6570 ParserTestCase.parseCompilationUnit(EngineTestCase.createSource(["Map<Symbol
, convertStringToSymbolMap(Map<String, dynamic> map) {", " if (map == null) ret
urn null;", " Map<Symbol, dynamic> result = new Map<Symbol, dynamic>();", " ma
p.forEach((name, value) {", " result[new Symbol(name)] = value;", " });", "
return result;", "}"]), []); | 6570 ParserTestCase.parseCompilationUnit(EngineTestCase.createSource(["Map<Symbol
, convertStringToSymbolMap(Map<String, dynamic> map) {", " if (map == null) ret
urn null;", " Map<Symbol, dynamic> result = new Map<Symbol, dynamic>();", " ma
p.forEach((name, value) {", " result[new Symbol(name)] = value;", " });", "
return result;", "}"]), []); |
| 6571 } | 6571 } |
| 6572 void test_additiveExpression_missing_LHS() { | 6572 void test_additiveExpression_missing_LHS() { |
| 6573 BinaryExpression expression = ParserTestCase.parseExpression("+ y", [ParserE
rrorCode.MISSING_IDENTIFIER]); | 6573 BinaryExpression expression = ParserTestCase.parseExpression("+ y", [ParserE
rrorCode.MISSING_IDENTIFIER]); |
| 6574 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); | 6574 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); |
| 6575 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); | 6575 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7275 runJUnitTest(__test, __test.test_shiftExpression_super); | 7275 runJUnitTest(__test, __test.test_shiftExpression_super); |
| 7276 }); | 7276 }); |
| 7277 _ut.test('test_typedef_eof', () { | 7277 _ut.test('test_typedef_eof', () { |
| 7278 final __test = new RecoveryParserTest(); | 7278 final __test = new RecoveryParserTest(); |
| 7279 runJUnitTest(__test, __test.test_typedef_eof); | 7279 runJUnitTest(__test, __test.test_typedef_eof); |
| 7280 }); | 7280 }); |
| 7281 }); | 7281 }); |
| 7282 } | 7282 } |
| 7283 } | 7283 } |
| 7284 /** | 7284 /** |
| 7285 * The class {@code ErrorParserTest} defines parser tests that test the parsing
of code to ensure | 7285 * The class `ErrorParserTest` defines parser tests that test the parsing of cod
e to ensure |
| 7286 * that errors are correctly reported, and in some cases, not reported. | 7286 * that errors are correctly reported, and in some cases, not reported. |
| 7287 */ | 7287 */ |
| 7288 class ErrorParserTest extends ParserTestCase { | 7288 class ErrorParserTest extends ParserTestCase { |
| 7289 void fail_expectedListOrMapLiteral() { | 7289 void fail_expectedListOrMapLiteral() { |
| 7290 TypedLiteral literal = ParserTestCase.parse4("parseListOrMapLiteral", <Objec
t> [null], "1", [ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL]); | 7290 TypedLiteral literal = ParserTestCase.parse4("parseListOrMapLiteral", <Objec
t> [null], "1", [ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL]); |
| 7291 JUnitTestCase.assertTrue(literal.isSynthetic()); | 7291 JUnitTestCase.assertTrue(literal.isSynthetic()); |
| 7292 } | 7292 } |
| 7293 void fail_illegalAssignmentToNonAssignable_superAssigned() { | 7293 void fail_illegalAssignmentToNonAssignable_superAssigned() { |
| 7294 ParserTestCase.parseExpression("super = x;", [ParserErrorCode.ILLEGAL_ASSIGN
MENT_TO_NON_ASSIGNABLE]); | 7294 ParserTestCase.parseExpression("super = x;", [ParserErrorCode.ILLEGAL_ASSIGN
MENT_TO_NON_ASSIGNABLE]); |
| 7295 } | 7295 } |
| (...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8851 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelFunction(arg0)), | 8851 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelFunction(arg0)), |
| 8852 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelVariable(arg0)), | 8852 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelVariable(arg0)), |
| 8853 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0)
=> target.validateModifiersForTypedef(arg0)),}; | 8853 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0)
=> target.validateModifiersForTypedef(arg0)),}; |
| 8854 | 8854 |
| 8855 | 8855 |
| 8856 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj
ects, Token tokenStream) { | 8856 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj
ects, Token tokenStream) { |
| 8857 parser.currentToken = tokenStream; | 8857 parser.currentToken = tokenStream; |
| 8858 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length}
']; | 8858 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length}
']; |
| 8859 return method.invoke(parser, objects); | 8859 return method.invoke(parser, objects); |
| 8860 } | 8860 } |
| OLD | NEW |