| 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 'package:analyzer_experimental/src/generated/java_core.dart'; | 4 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
| 5 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 5 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
| 6 import 'package:analyzer_experimental/src/generated/error.dart'; | 6 import 'package:analyzer_experimental/src/generated/error.dart'; |
| 7 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 7 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
| 8 import 'package:analyzer_experimental/src/generated/ast.dart'; | 8 import 'package:analyzer_experimental/src/generated/ast.dart'; |
| 9 import 'package:analyzer_experimental/src/generated/parser.dart'; | 9 import 'package:analyzer_experimental/src/generated/parser.dart'; |
| 10 import 'package:analyzer_experimental/src/generated/utilities_dart.dart'; | 10 import 'package:analyzer_experimental/src/generated/utilities_dart.dart'; |
| (...skipping 3770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3781 /** | 3781 /** |
| 3782 * Invoke the method [Parser#computeStringValue] with the given argument. | 3782 * Invoke the method [Parser#computeStringValue] with the given argument. |
| 3783 * | 3783 * |
| 3784 * @param lexeme the argument to the method | 3784 * @param lexeme the argument to the method |
| 3785 * @param first `true` if this is the first token in a string literal | 3785 * @param first `true` if this is the first token in a string literal |
| 3786 * @param last `true` if this is the last token in a string literal | 3786 * @param last `true` if this is the last token in a string literal |
| 3787 * @return the result of invoking the method | 3787 * @return the result of invoking the method |
| 3788 * @throws Exception if the method could not be invoked or throws an exception | 3788 * @throws Exception if the method could not be invoked or throws an exception |
| 3789 */ | 3789 */ |
| 3790 String computeStringValue(String lexeme, bool first, bool last) { | 3790 String computeStringValue(String lexeme, bool first, bool last) { |
| 3791 AnalysisErrorListener listener = new AnalysisErrorListener_23(); | 3791 AnalysisErrorListener listener = new AnalysisErrorListener_25(); |
| 3792 Parser parser = new Parser(null, listener); | 3792 Parser parser = new Parser(null, listener); |
| 3793 return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme
, first, last], null) as String; | 3793 return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme
, first, last], null) as String; |
| 3794 } | 3794 } |
| 3795 | 3795 |
| 3796 /** | 3796 /** |
| 3797 * Invoke the method [Parser#createSyntheticIdentifier] with the parser set to
the token | 3797 * Invoke the method [Parser#createSyntheticIdentifier] with the parser set to
the token |
| 3798 * stream produced by scanning the given source. | 3798 * stream produced by scanning the given source. |
| 3799 * | 3799 * |
| 3800 * @param source the source to be scanned to produce the token stream being te
sted | 3800 * @param source the source to be scanned to produce the token stream being te
sted |
| 3801 * @return the result of invoking the method | 3801 * @return the result of invoking the method |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3835 /** | 3835 /** |
| 3836 * Invoke the method [Parser#isFunctionExpression] with the parser set to the
token stream | 3836 * Invoke the method [Parser#isFunctionExpression] with the parser set to the
token stream |
| 3837 * produced by scanning the given source. | 3837 * produced by scanning the given source. |
| 3838 * | 3838 * |
| 3839 * @param source the source to be scanned to produce the token stream being te
sted | 3839 * @param source the source to be scanned to produce the token stream being te
sted |
| 3840 * @return the result of invoking the method | 3840 * @return the result of invoking the method |
| 3841 * @throws Exception if the method could not be invoked or throws an exception | 3841 * @throws Exception if the method could not be invoked or throws an exception |
| 3842 */ | 3842 */ |
| 3843 bool isFunctionExpression(String source) { | 3843 bool isFunctionExpression(String source) { |
| 3844 GatheringErrorListener listener = new GatheringErrorListener(); | 3844 GatheringErrorListener listener = new GatheringErrorListener(); |
| 3845 StringScanner scanner = new StringScanner(null, source, listener); | 3845 Scanner scanner = new Scanner(null, new CharSequenceReader(new CharSequence(
source)), listener); |
| 3846 Token tokenStream = scanner.tokenize(); | 3846 Token tokenStream = scanner.tokenize(); |
| 3847 Parser parser = new Parser(null, listener); | 3847 Parser parser = new Parser(null, listener); |
| 3848 return invokeParserMethodImpl(parser, "isFunctionExpression", <Object> [toke
nStream], tokenStream) as bool; | 3848 return invokeParserMethodImpl(parser, "isFunctionExpression", <Object> [toke
nStream], tokenStream) as bool; |
| 3849 } | 3849 } |
| 3850 | 3850 |
| 3851 /** | 3851 /** |
| 3852 * Invoke the method [Parser#isInitializedVariableDeclaration] with the parser
set to the | 3852 * Invoke the method [Parser#isInitializedVariableDeclaration] with the parser
set to the |
| 3853 * token stream produced by scanning the given source. | 3853 * token stream produced by scanning the given source. |
| 3854 * | 3854 * |
| 3855 * @param source the source to be scanned to produce the token stream being te
sted | 3855 * @param source the source to be scanned to produce the token stream being te
sted |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3879 * parameter and is given the first token in the scanned source. | 3879 * parameter and is given the first token in the scanned source. |
| 3880 * | 3880 * |
| 3881 * @param methodName the name of the method that should be invoked | 3881 * @param methodName the name of the method that should be invoked |
| 3882 * @param source the source to be processed by the method | 3882 * @param source the source to be processed by the method |
| 3883 * @return the result of invoking the method | 3883 * @return the result of invoking the method |
| 3884 * @throws Exception if the method could not be invoked or throws an exception | 3884 * @throws Exception if the method could not be invoked or throws an exception |
| 3885 * @throws AssertionFailedError if the result is `null` | 3885 * @throws AssertionFailedError if the result is `null` |
| 3886 */ | 3886 */ |
| 3887 Token skip(String methodName, String source) { | 3887 Token skip(String methodName, String source) { |
| 3888 GatheringErrorListener listener = new GatheringErrorListener(); | 3888 GatheringErrorListener listener = new GatheringErrorListener(); |
| 3889 StringScanner scanner = new StringScanner(null, source, listener); | 3889 Scanner scanner = new Scanner(null, new CharSequenceReader(new CharSequence(
source)), listener); |
| 3890 Token tokenStream = scanner.tokenize(); | 3890 Token tokenStream = scanner.tokenize(); |
| 3891 Parser parser = new Parser(null, listener); | 3891 Parser parser = new Parser(null, listener); |
| 3892 return invokeParserMethodImpl(parser, methodName, <Object> [tokenStream], to
kenStream) as Token; | 3892 return invokeParserMethodImpl(parser, methodName, <Object> [tokenStream], to
kenStream) as Token; |
| 3893 } | 3893 } |
| 3894 static dartSuite() { | 3894 static dartSuite() { |
| 3895 _ut.group('SimpleParserTest', () { | 3895 _ut.group('SimpleParserTest', () { |
| 3896 _ut.test('test_Parser', () { | 3896 _ut.test('test_Parser', () { |
| 3897 final __test = new SimpleParserTest(); | 3897 final __test = new SimpleParserTest(); |
| 3898 runJUnitTest(__test, __test.test_Parser); | 3898 runJUnitTest(__test, __test.test_Parser); |
| 3899 }); | 3899 }); |
| (...skipping 2113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6013 final __test = new SimpleParserTest(); | 6013 final __test = new SimpleParserTest(); |
| 6014 runJUnitTest(__test, __test.test_skipTypeName_parameterized); | 6014 runJUnitTest(__test, __test.test_skipTypeName_parameterized); |
| 6015 }); | 6015 }); |
| 6016 _ut.test('test_skipTypeName_simple', () { | 6016 _ut.test('test_skipTypeName_simple', () { |
| 6017 final __test = new SimpleParserTest(); | 6017 final __test = new SimpleParserTest(); |
| 6018 runJUnitTest(__test, __test.test_skipTypeName_simple); | 6018 runJUnitTest(__test, __test.test_skipTypeName_simple); |
| 6019 }); | 6019 }); |
| 6020 }); | 6020 }); |
| 6021 } | 6021 } |
| 6022 } | 6022 } |
| 6023 class AnalysisErrorListener_23 implements AnalysisErrorListener { | 6023 class AnalysisErrorListener_25 implements AnalysisErrorListener { |
| 6024 void onError(AnalysisError event) { | 6024 void onError(AnalysisError event) { |
| 6025 JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event.
offset}, ${event.length})"); | 6025 JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event.
offset}, ${event.length})"); |
| 6026 } | 6026 } |
| 6027 } | 6027 } |
| 6028 /** | 6028 /** |
| 6029 * The class `ComplexParserTest` defines parser tests that test the parsing of m
ore complex | 6029 * The class `ComplexParserTest` defines parser tests that test the parsing of m
ore complex |
| 6030 * code fragments or the interactions between multiple parsing methods. For exam
ple, tests to ensure | 6030 * code fragments or the interactions between multiple parsing methods. For exam
ple, tests to ensure |
| 6031 * that the precedence of operations is being handled correctly should be define
d in this class. | 6031 * that the precedence of operations is being handled correctly should be define
d in this class. |
| 6032 * | 6032 * |
| 6033 * Simpler tests should be defined in the class [SimpleParserTest]. | 6033 * Simpler tests should be defined in the class [SimpleParserTest]. |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6607 * Parse the given source as a compilation unit. | 6607 * Parse the given source as a compilation unit. |
| 6608 * | 6608 * |
| 6609 * @param source the source to be parsed | 6609 * @param source the source to be parsed |
| 6610 * @param errorCodes the error codes of the errors that are expected to be fou
nd | 6610 * @param errorCodes the error codes of the errors that are expected to be fou
nd |
| 6611 * @return the compilation unit that was parsed | 6611 * @return the compilation unit that was parsed |
| 6612 * @throws Exception if the source could not be parsed, if the compilation err
ors in the source do | 6612 * @throws Exception if the source could not be parsed, if the compilation err
ors in the source do |
| 6613 * not match those that are expected, or if the result would have be
en `null` | 6613 * not match those that are expected, or if the result would have be
en `null` |
| 6614 */ | 6614 */ |
| 6615 static CompilationUnit parseCompilationUnit(String source, List<ErrorCode> err
orCodes) { | 6615 static CompilationUnit parseCompilationUnit(String source, List<ErrorCode> err
orCodes) { |
| 6616 GatheringErrorListener listener = new GatheringErrorListener(); | 6616 GatheringErrorListener listener = new GatheringErrorListener(); |
| 6617 StringScanner scanner = new StringScanner(null, source, listener); | 6617 Scanner scanner = new Scanner(null, new CharSequenceReader(new CharSequence(
source)), listener); |
| 6618 listener.setLineInfo(new TestSource(), scanner.lineStarts); | 6618 listener.setLineInfo(new TestSource(), scanner.lineStarts); |
| 6619 Token token = scanner.tokenize(); | 6619 Token token = scanner.tokenize(); |
| 6620 Parser parser = new Parser(null, listener); | 6620 Parser parser = new Parser(null, listener); |
| 6621 CompilationUnit unit = parser.parseCompilationUnit(token); | 6621 CompilationUnit unit = parser.parseCompilationUnit(token); |
| 6622 JUnitTestCase.assertNotNull(unit); | 6622 JUnitTestCase.assertNotNull(unit); |
| 6623 listener.assertErrors2(errorCodes); | 6623 listener.assertErrors2(errorCodes); |
| 6624 return unit; | 6624 return unit; |
| 6625 } | 6625 } |
| 6626 | 6626 |
| 6627 /** | 6627 /** |
| 6628 * Parse the given source as an expression. | 6628 * Parse the given source as an expression. |
| 6629 * | 6629 * |
| 6630 * @param source the source to be parsed | 6630 * @param source the source to be parsed |
| 6631 * @param errorCodes the error codes of the errors that are expected to be fou
nd | 6631 * @param errorCodes the error codes of the errors that are expected to be fou
nd |
| 6632 * @return the expression that was parsed | 6632 * @return the expression that was parsed |
| 6633 * @throws Exception if the source could not be parsed, if the compilation err
ors in the source do | 6633 * @throws Exception if the source could not be parsed, if the compilation err
ors in the source do |
| 6634 * not match those that are expected, or if the result would have be
en `null` | 6634 * not match those that are expected, or if the result would have be
en `null` |
| 6635 */ | 6635 */ |
| 6636 static Expression parseExpression(String source, List<ErrorCode> errorCodes) { | 6636 static Expression parseExpression(String source, List<ErrorCode> errorCodes) { |
| 6637 GatheringErrorListener listener = new GatheringErrorListener(); | 6637 GatheringErrorListener listener = new GatheringErrorListener(); |
| 6638 StringScanner scanner = new StringScanner(null, source, listener); | 6638 Scanner scanner = new Scanner(null, new CharSequenceReader(new CharSequence(
source)), listener); |
| 6639 listener.setLineInfo(new TestSource(), scanner.lineStarts); | 6639 listener.setLineInfo(new TestSource(), scanner.lineStarts); |
| 6640 Token token = scanner.tokenize(); | 6640 Token token = scanner.tokenize(); |
| 6641 Parser parser = new Parser(null, listener); | 6641 Parser parser = new Parser(null, listener); |
| 6642 Expression expression = parser.parseExpression(token); | 6642 Expression expression = parser.parseExpression(token); |
| 6643 JUnitTestCase.assertNotNull(expression); | 6643 JUnitTestCase.assertNotNull(expression); |
| 6644 listener.assertErrors2(errorCodes); | 6644 listener.assertErrors2(errorCodes); |
| 6645 return expression as Expression; | 6645 return expression as Expression; |
| 6646 } | 6646 } |
| 6647 | 6647 |
| 6648 /** | 6648 /** |
| 6649 * Parse the given source as a statement. | 6649 * Parse the given source as a statement. |
| 6650 * | 6650 * |
| 6651 * @param source the source to be parsed | 6651 * @param source the source to be parsed |
| 6652 * @param errorCodes the error codes of the errors that are expected to be fou
nd | 6652 * @param errorCodes the error codes of the errors that are expected to be fou
nd |
| 6653 * @return the statement that was parsed | 6653 * @return the statement that was parsed |
| 6654 * @throws Exception if the source could not be parsed, if the compilation err
ors in the source do | 6654 * @throws Exception if the source could not be parsed, if the compilation err
ors in the source do |
| 6655 * not match those that are expected, or if the result would have be
en `null` | 6655 * not match those that are expected, or if the result would have be
en `null` |
| 6656 */ | 6656 */ |
| 6657 static Statement parseStatement(String source, List<ErrorCode> errorCodes) { | 6657 static Statement parseStatement(String source, List<ErrorCode> errorCodes) { |
| 6658 GatheringErrorListener listener = new GatheringErrorListener(); | 6658 GatheringErrorListener listener = new GatheringErrorListener(); |
| 6659 StringScanner scanner = new StringScanner(null, source, listener); | 6659 Scanner scanner = new Scanner(null, new CharSequenceReader(new CharSequence(
source)), listener); |
| 6660 listener.setLineInfo(new TestSource(), scanner.lineStarts); | 6660 listener.setLineInfo(new TestSource(), scanner.lineStarts); |
| 6661 Token token = scanner.tokenize(); | 6661 Token token = scanner.tokenize(); |
| 6662 Parser parser = new Parser(null, listener); | 6662 Parser parser = new Parser(null, listener); |
| 6663 Statement statement = parser.parseStatement(token); | 6663 Statement statement = parser.parseStatement(token); |
| 6664 JUnitTestCase.assertNotNull(statement); | 6664 JUnitTestCase.assertNotNull(statement); |
| 6665 listener.assertErrors2(errorCodes); | 6665 listener.assertErrors2(errorCodes); |
| 6666 return statement as Statement; | 6666 return statement as Statement; |
| 6667 } | 6667 } |
| 6668 | 6668 |
| 6669 /** | 6669 /** |
| 6670 * Parse the given source as a sequence of statements. | 6670 * Parse the given source as a sequence of statements. |
| 6671 * | 6671 * |
| 6672 * @param source the source to be parsed | 6672 * @param source the source to be parsed |
| 6673 * @param expectedCount the number of statements that are expected | 6673 * @param expectedCount the number of statements that are expected |
| 6674 * @param errorCodes the error codes of the errors that are expected to be fou
nd | 6674 * @param errorCodes the error codes of the errors that are expected to be fou
nd |
| 6675 * @return the statements that were parsed | 6675 * @return the statements that were parsed |
| 6676 * @throws Exception if the source could not be parsed, if the number of state
ments does not match | 6676 * @throws Exception if the source could not be parsed, if the number of state
ments does not match |
| 6677 * the expected count, if the compilation errors in the source do no
t match those that | 6677 * the expected count, if the compilation errors in the source do no
t match those that |
| 6678 * are expected, or if the result would have been `null` | 6678 * are expected, or if the result would have been `null` |
| 6679 */ | 6679 */ |
| 6680 static List<Statement> parseStatements(String source, int expectedCount, List<
ErrorCode> errorCodes) { | 6680 static List<Statement> parseStatements(String source, int expectedCount, List<
ErrorCode> errorCodes) { |
| 6681 GatheringErrorListener listener = new GatheringErrorListener(); | 6681 GatheringErrorListener listener = new GatheringErrorListener(); |
| 6682 StringScanner scanner = new StringScanner(null, source, listener); | 6682 Scanner scanner = new Scanner(null, new CharSequenceReader(new CharSequence(
source)), listener); |
| 6683 listener.setLineInfo(new TestSource(), scanner.lineStarts); | 6683 listener.setLineInfo(new TestSource(), scanner.lineStarts); |
| 6684 Token token = scanner.tokenize(); | 6684 Token token = scanner.tokenize(); |
| 6685 Parser parser = new Parser(null, listener); | 6685 Parser parser = new Parser(null, listener); |
| 6686 List<Statement> statements = parser.parseStatements(token); | 6686 List<Statement> statements = parser.parseStatements(token); |
| 6687 EngineTestCase.assertSize(expectedCount, statements); | 6687 EngineTestCase.assertSize(expectedCount, statements); |
| 6688 listener.assertErrors2(errorCodes); | 6688 listener.assertErrors2(errorCodes); |
| 6689 return statements; | 6689 return statements; |
| 6690 } | 6690 } |
| 6691 | 6691 |
| 6692 /** | 6692 /** |
| 6693 * Invoke a method in [Parser]. The method is assumed to have the given number
and type of | 6693 * Invoke a method in [Parser]. The method is assumed to have the given number
and type of |
| 6694 * parameters and will be invoked with the given arguments. | 6694 * parameters and will be invoked with the given arguments. |
| 6695 * | 6695 * |
| 6696 * The given source is scanned and the parser is initialized to start with the
first token in the | 6696 * The given source is scanned and the parser is initialized to start with the
first token in the |
| 6697 * source before the method is invoked. | 6697 * source before the method is invoked. |
| 6698 * | 6698 * |
| 6699 * @param methodName the name of the method that should be invoked | 6699 * @param methodName the name of the method that should be invoked |
| 6700 * @param objects the values of the arguments to the method | 6700 * @param objects the values of the arguments to the method |
| 6701 * @param source the source to be processed by the parse method | 6701 * @param source the source to be processed by the parse method |
| 6702 * @param listener the error listener that will be used for both scanning and
parsing | 6702 * @param listener the error listener that will be used for both scanning and
parsing |
| 6703 * @return the result of invoking the method | 6703 * @return the result of invoking the method |
| 6704 * @throws Exception if the method could not be invoked or throws an exception | 6704 * @throws Exception if the method could not be invoked or throws an exception |
| 6705 * @throws AssertionFailedError if the result is `null` or the errors produced
while | 6705 * @throws AssertionFailedError if the result is `null` or the errors produced
while |
| 6706 * scanning and parsing the source do not match the expected errors | 6706 * scanning and parsing the source do not match the expected errors |
| 6707 */ | 6707 */ |
| 6708 static Object invokeParserMethod(String methodName, List<Object> objects, Stri
ng source, GatheringErrorListener listener) { | 6708 static Object invokeParserMethod(String methodName, List<Object> objects, Stri
ng source, GatheringErrorListener listener) { |
| 6709 StringScanner scanner = new StringScanner(null, source, listener); | 6709 Scanner scanner = new Scanner(null, new CharSequenceReader(new CharSequence(
source)), listener); |
| 6710 Token tokenStream = scanner.tokenize(); | 6710 Token tokenStream = scanner.tokenize(); |
| 6711 listener.setLineInfo(new TestSource(), scanner.lineStarts); | 6711 listener.setLineInfo(new TestSource(), scanner.lineStarts); |
| 6712 Parser parser = new Parser(null, listener); | 6712 Parser parser = new Parser(null, listener); |
| 6713 Object result = invokeParserMethodImpl(parser, methodName, objects, tokenStr
eam); | 6713 Object result = invokeParserMethodImpl(parser, methodName, objects, tokenStr
eam); |
| 6714 if (!listener.hasErrors()) { | 6714 if (!listener.hasErrors()) { |
| 6715 JUnitTestCase.assertNotNull(result); | 6715 JUnitTestCase.assertNotNull(result); |
| 6716 } | 6716 } |
| 6717 return result as Object; | 6717 return result as Object; |
| 6718 } | 6718 } |
| 6719 | 6719 |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7592 runJUnitTest(__test, __test.test_typedef_eof); | 7592 runJUnitTest(__test, __test.test_typedef_eof); |
| 7593 }); | 7593 }); |
| 7594 }); | 7594 }); |
| 7595 } | 7595 } |
| 7596 } | 7596 } |
| 7597 /** | 7597 /** |
| 7598 * The class `ErrorParserTest` defines parser tests that test the parsing of cod
e to ensure | 7598 * The class `ErrorParserTest` defines parser tests that test the parsing of cod
e to ensure |
| 7599 * that errors are correctly reported, and in some cases, not reported. | 7599 * that errors are correctly reported, and in some cases, not reported. |
| 7600 */ | 7600 */ |
| 7601 class ErrorParserTest extends ParserTestCase { | 7601 class ErrorParserTest extends ParserTestCase { |
| 7602 void fail_deprecatedClassTypeAlias() { | |
| 7603 ParserTestCase.parseCompilationUnit("typedef C = abstract S with M;", [Parse
rErrorCode.DEPRECATED_CLASS_TYPE_ALIAS]); | |
| 7604 } | |
| 7605 void fail_deprecatedClassTypeAlias_withGeneric() { | |
| 7606 ParserTestCase.parseCompilationUnit("typedef C<T> = abstract S<T> with M;",
[ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS]); | |
| 7607 } | |
| 7608 void fail_expectedListOrMapLiteral() { | 7602 void fail_expectedListOrMapLiteral() { |
| 7609 TypedLiteral literal = ParserTestCase.parse4("parseListOrMapLiteral", <Objec
t> [null], "1", [ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL]); | 7603 TypedLiteral literal = ParserTestCase.parse4("parseListOrMapLiteral", <Objec
t> [null], "1", [ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL]); |
| 7610 JUnitTestCase.assertTrue(literal.isSynthetic); | 7604 JUnitTestCase.assertTrue(literal.isSynthetic); |
| 7611 } | 7605 } |
| 7612 void fail_illegalAssignmentToNonAssignable_superAssigned() { | 7606 void fail_illegalAssignmentToNonAssignable_superAssigned() { |
| 7613 ParserTestCase.parseExpression("super = x;", [ParserErrorCode.ILLEGAL_ASSIGN
MENT_TO_NON_ASSIGNABLE]); | 7607 ParserTestCase.parseExpression("super = x;", [ParserErrorCode.ILLEGAL_ASSIGN
MENT_TO_NON_ASSIGNABLE]); |
| 7614 } | 7608 } |
| 7615 void fail_invalidCommentReference__new_nonIdentifier() { | 7609 void fail_invalidCommentReference__new_nonIdentifier() { |
| 7616 ParserTestCase.parse4("parseCommentReference", <Object> ["new 42", 0], "", [
ParserErrorCode.INVALID_COMMENT_REFERENCE]); | 7610 ParserTestCase.parse4("parseCommentReference", <Object> ["new 42", 0], "", [
ParserErrorCode.INVALID_COMMENT_REFERENCE]); |
| 7617 } | 7611 } |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7759 } | 7753 } |
| 7760 void test_continueWithoutLabelInCase_error() { | 7754 void test_continueWithoutLabelInCase_error() { |
| 7761 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue;
}", [ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE]); | 7755 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue;
}", [ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE]); |
| 7762 } | 7756 } |
| 7763 void test_continueWithoutLabelInCase_noError() { | 7757 void test_continueWithoutLabelInCase_noError() { |
| 7764 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue
a;}", []); | 7758 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue
a;}", []); |
| 7765 } | 7759 } |
| 7766 void test_continueWithoutLabelInCase_noError_switchInLoop() { | 7760 void test_continueWithoutLabelInCase_noError_switchInLoop() { |
| 7767 ParserTestCase.parse5("parseWhileStatement", "while (a) { switch (b) {defaul
t: continue;}}", []); | 7761 ParserTestCase.parse5("parseWhileStatement", "while (a) { switch (b) {defaul
t: continue;}}", []); |
| 7768 } | 7762 } |
| 7763 void test_deprecatedClassTypeAlias() { |
| 7764 ParserTestCase.parseCompilationUnit("typedef C = abstract S with M;", [Parse
rErrorCode.DEPRECATED_CLASS_TYPE_ALIAS]); |
| 7765 } |
| 7766 void test_deprecatedClassTypeAlias_withGeneric() { |
| 7767 ParserTestCase.parseCompilationUnit("typedef C<T> = abstract S<T> with M;",
[ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS]); |
| 7768 } |
| 7769 void test_directiveAfterDeclaration_classBeforeDirective() { | 7769 void test_directiveAfterDeclaration_classBeforeDirective() { |
| 7770 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Foo{} libr
ary l;", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]); | 7770 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Foo{} libr
ary l;", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]); |
| 7771 JUnitTestCase.assertNotNull(unit); | 7771 JUnitTestCase.assertNotNull(unit); |
| 7772 } | 7772 } |
| 7773 void test_directiveAfterDeclaration_classBetweenDirectives() { | 7773 void test_directiveAfterDeclaration_classBetweenDirectives() { |
| 7774 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library l;\nclas
s Foo{}\npart 'a.dart';", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]); | 7774 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library l;\nclas
s Foo{}\npart 'a.dart';", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]); |
| 7775 JUnitTestCase.assertNotNull(unit); | 7775 JUnitTestCase.assertNotNull(unit); |
| 7776 } | 7776 } |
| 7777 void test_duplicatedModifier_const() { | 7777 void test_duplicatedModifier_const() { |
| 7778 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const const m;",
[ParserErrorCode.DUPLICATED_MODIFIER]); | 7778 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const const m;",
[ParserErrorCode.DUPLICATED_MODIFIER]); |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8542 runJUnitTest(__test, __test.test_continueWithoutLabelInCase_error); | 8542 runJUnitTest(__test, __test.test_continueWithoutLabelInCase_error); |
| 8543 }); | 8543 }); |
| 8544 _ut.test('test_continueWithoutLabelInCase_noError', () { | 8544 _ut.test('test_continueWithoutLabelInCase_noError', () { |
| 8545 final __test = new ErrorParserTest(); | 8545 final __test = new ErrorParserTest(); |
| 8546 runJUnitTest(__test, __test.test_continueWithoutLabelInCase_noError); | 8546 runJUnitTest(__test, __test.test_continueWithoutLabelInCase_noError); |
| 8547 }); | 8547 }); |
| 8548 _ut.test('test_continueWithoutLabelInCase_noError_switchInLoop', () { | 8548 _ut.test('test_continueWithoutLabelInCase_noError_switchInLoop', () { |
| 8549 final __test = new ErrorParserTest(); | 8549 final __test = new ErrorParserTest(); |
| 8550 runJUnitTest(__test, __test.test_continueWithoutLabelInCase_noError_swit
chInLoop); | 8550 runJUnitTest(__test, __test.test_continueWithoutLabelInCase_noError_swit
chInLoop); |
| 8551 }); | 8551 }); |
| 8552 _ut.test('test_deprecatedClassTypeAlias', () { |
| 8553 final __test = new ErrorParserTest(); |
| 8554 runJUnitTest(__test, __test.test_deprecatedClassTypeAlias); |
| 8555 }); |
| 8556 _ut.test('test_deprecatedClassTypeAlias_withGeneric', () { |
| 8557 final __test = new ErrorParserTest(); |
| 8558 runJUnitTest(__test, __test.test_deprecatedClassTypeAlias_withGeneric); |
| 8559 }); |
| 8552 _ut.test('test_directiveAfterDeclaration_classBeforeDirective', () { | 8560 _ut.test('test_directiveAfterDeclaration_classBeforeDirective', () { |
| 8553 final __test = new ErrorParserTest(); | 8561 final __test = new ErrorParserTest(); |
| 8554 runJUnitTest(__test, __test.test_directiveAfterDeclaration_classBeforeDi
rective); | 8562 runJUnitTest(__test, __test.test_directiveAfterDeclaration_classBeforeDi
rective); |
| 8555 }); | 8563 }); |
| 8556 _ut.test('test_directiveAfterDeclaration_classBetweenDirectives', () { | 8564 _ut.test('test_directiveAfterDeclaration_classBetweenDirectives', () { |
| 8557 final __test = new ErrorParserTest(); | 8565 final __test = new ErrorParserTest(); |
| 8558 runJUnitTest(__test, __test.test_directiveAfterDeclaration_classBetweenD
irectives); | 8566 runJUnitTest(__test, __test.test_directiveAfterDeclaration_classBetweenD
irectives); |
| 8559 }); | 8567 }); |
| 8560 _ut.test('test_duplicateLabelInSwitchStatement', () { | 8568 _ut.test('test_duplicateLabelInSwitchStatement', () { |
| 8561 final __test = new ErrorParserTest(); | 8569 final __test = new ErrorParserTest(); |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9516 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelFunction(arg0)), | 9524 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelFunction(arg0)), |
| 9517 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelVariable(arg0)), | 9525 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelVariable(arg0)), |
| 9518 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0)
=> target.validateModifiersForTypedef(arg0)),}; | 9526 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0)
=> target.validateModifiersForTypedef(arg0)),}; |
| 9519 | 9527 |
| 9520 | 9528 |
| 9521 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj
ects, Token tokenStream) { | 9529 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj
ects, Token tokenStream) { |
| 9522 parser.currentToken = tokenStream; | 9530 parser.currentToken = tokenStream; |
| 9523 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length}
']; | 9531 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length}
']; |
| 9524 return method.invoke(parser, objects); | 9532 return method.invoke(parser, objects); |
| 9525 } | 9533 } |
| OLD | NEW |