Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: pkg/analyzer_experimental/test/generated/parser_test.dart

Issue 17932005: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Disable resolver tests Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer_experimental/test/generated/parser_test.dart
diff --git a/pkg/analyzer_experimental/test/generated/parser_test.dart b/pkg/analyzer_experimental/test/generated/parser_test.dart
index 41f664624dd508d0d011d8e593ad424ad3779dee..fac917c7094f3b16c603fb30158e9e79297353ea 100644
--- a/pkg/analyzer_experimental/test/generated/parser_test.dart
+++ b/pkg/analyzer_experimental/test/generated/parser_test.dart
@@ -3669,12 +3669,13 @@ class SimpleParserTest extends ParserTestCase {
/**
* Invoke the method [Parser#computeStringValue] with the given argument.
+ *
* @param lexeme the argument to the method
* @return the result of invoking the method
* @throws Exception if the method could not be invoked or throws an exception
*/
String computeStringValue(String lexeme) {
- AnalysisErrorListener listener = new AnalysisErrorListener_19();
+ AnalysisErrorListener listener = new AnalysisErrorListener_20();
Parser parser = new Parser(null, listener);
return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme], null) as String;
}
@@ -3682,6 +3683,7 @@ class SimpleParserTest extends ParserTestCase {
/**
* Invoke the method [Parser#createSyntheticIdentifier] with the parser set to the token
* stream produced by scanning the given source.
+ *
* @param source the source to be scanned to produce the token stream being tested
* @return the result of invoking the method
* @throws Exception if the method could not be invoked or throws an exception
@@ -3694,6 +3696,7 @@ class SimpleParserTest extends ParserTestCase {
/**
* Invoke the method [Parser#createSyntheticIdentifier] with the parser set to the token
* stream produced by scanning the given source.
+ *
* @param source the source to be scanned to produce the token stream being tested
* @return the result of invoking the method
* @throws Exception if the method could not be invoked or throws an exception
@@ -3706,6 +3709,7 @@ class SimpleParserTest extends ParserTestCase {
/**
* Invoke the method [Parser#isFunctionDeclaration] with the parser set to the token
* stream produced by scanning the given source.
+ *
* @param source the source to be scanned to produce the token stream being tested
* @return the result of invoking the method
* @throws Exception if the method could not be invoked or throws an exception
@@ -3718,6 +3722,7 @@ class SimpleParserTest extends ParserTestCase {
/**
* Invoke the method [Parser#isFunctionExpression] with the parser set to the token stream
* produced by scanning the given source.
+ *
* @param source the source to be scanned to produce the token stream being tested
* @return the result of invoking the method
* @throws Exception if the method could not be invoked or throws an exception
@@ -3733,6 +3738,7 @@ class SimpleParserTest extends ParserTestCase {
/**
* Invoke the method [Parser#isInitializedVariableDeclaration] with the parser set to the
* token stream produced by scanning the given source.
+ *
* @param source the source to be scanned to produce the token stream being tested
* @return the result of invoking the method
* @throws Exception if the method could not be invoked or throws an exception
@@ -3745,6 +3751,7 @@ class SimpleParserTest extends ParserTestCase {
/**
* Invoke the method [Parser#isSwitchMember] with the parser set to the token stream
* produced by scanning the given source.
+ *
* @param source the source to be scanned to produce the token stream being tested
* @return the result of invoking the method
* @throws Exception if the method could not be invoked or throws an exception
@@ -3757,6 +3764,7 @@ class SimpleParserTest extends ParserTestCase {
/**
* Invoke a "skip" method in [Parser]. The method is assumed to take a token as it's
* parameter and is given the first token in the scanned source.
+ *
* @param methodName the name of the method that should be invoked
* @param source the source to be processed by the method
* @return the result of invoking the method
@@ -5847,7 +5855,7 @@ class SimpleParserTest extends ParserTestCase {
});
}
}
-class AnalysisErrorListener_19 implements AnalysisErrorListener {
+class AnalysisErrorListener_20 implements AnalysisErrorListener {
void onError(AnalysisError event) {
JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event.offset}, ${event.length})");
}
@@ -6295,6 +6303,7 @@ class ASTValidator extends GeneralizingASTVisitor<Object> {
/**
* Validate that the given AST node is correctly constructed.
+ *
* @param node the AST node being validated
*/
void validate(ASTNode node) {
@@ -6345,6 +6354,7 @@ class ParserTestCase extends EngineTestCase {
*
* The given source is scanned and the parser is initialized to start with the first token in the
* source before the parse method is invoked.
+ *
* @param methodName the name of the parse method that should be invoked to parse the source
* @param objects the values of the arguments to the method
* @param source the source to be parsed by the parse method
@@ -6360,6 +6370,7 @@ class ParserTestCase extends EngineTestCase {
*
* The given source is scanned and the parser is initialized to start with the first token in the
* source before the parse method is invoked.
+ *
* @param methodName the name of the parse method that should be invoked to parse the source
* @param objects the values of the arguments to the method
* @param source the source to be parsed by the parse method
@@ -6367,7 +6378,7 @@ class ParserTestCase extends EngineTestCase {
* @return the result of invoking the method
* @throws Exception if the method could not be invoked or throws an exception
* @throws AssertionFailedError if the result is `null` or the errors produced while
- * scanning and parsing the source do not match the expected errors
+ * scanning and parsing the source do not match the expected errors
*/
static Object parse3(String methodName, List<Object> objects, String source, List<AnalysisError> errors) {
GatheringErrorListener listener = new GatheringErrorListener();
@@ -6382,6 +6393,7 @@ class ParserTestCase extends EngineTestCase {
*
* The given source is scanned and the parser is initialized to start with the first token in the
* source before the parse method is invoked.
+ *
* @param methodName the name of the parse method that should be invoked to parse the source
* @param objects the values of the arguments to the method
* @param source the source to be parsed by the parse method
@@ -6389,7 +6401,7 @@ class ParserTestCase extends EngineTestCase {
* @return the result of invoking the method
* @throws Exception if the method could not be invoked or throws an exception
* @throws AssertionFailedError if the result is `null` or the errors produced while
- * scanning and parsing the source do not match the expected errors
+ * scanning and parsing the source do not match the expected errors
*/
static Object parse4(String methodName, List<Object> objects, String source, List<ErrorCode> errorCodes) {
GatheringErrorListener listener = new GatheringErrorListener();
@@ -6403,23 +6415,25 @@ class ParserTestCase extends EngineTestCase {
*
* The given source is scanned and the parser is initialized to start with the first token in the
* source before the parse method is invoked.
+ *
* @param methodName the name of the parse method that should be invoked to parse the source
* @param source the source to be parsed by the parse method
* @param errorCodes the error codes of the errors that should be generated
* @return the result of invoking the method
* @throws Exception if the method could not be invoked or throws an exception
* @throws AssertionFailedError if the result is `null` or the errors produced while
- * scanning and parsing the source do not match the expected errors
+ * scanning and parsing the source do not match the expected errors
*/
static Object parse5(String methodName, String source, List<ErrorCode> errorCodes) => parse4(methodName, _EMPTY_ARGUMENTS, source, errorCodes);
/**
* Parse the given source as a compilation unit.
+ *
* @param source the source to be parsed
* @param errorCodes the error codes of the errors that are expected to be found
* @return the compilation unit that was parsed
* @throws Exception if the source could not be parsed, if the compilation errors in the source do
- * not match those that are expected, or if the result would have been `null`
+ * not match those that are expected, or if the result would have been `null`
*/
static CompilationUnit parseCompilationUnit(String source, List<ErrorCode> errorCodes) {
GatheringErrorListener listener = new GatheringErrorListener();
@@ -6435,11 +6449,12 @@ class ParserTestCase extends EngineTestCase {
/**
* Parse the given source as an expression.
+ *
* @param source the source to be parsed
* @param errorCodes the error codes of the errors that are expected to be found
* @return the expression that was parsed
* @throws Exception if the source could not be parsed, if the compilation errors in the source do
- * not match those that are expected, or if the result would have been `null`
+ * not match those that are expected, or if the result would have been `null`
*/
static Expression parseExpression(String source, List<ErrorCode> errorCodes) {
GatheringErrorListener listener = new GatheringErrorListener();
@@ -6455,11 +6470,12 @@ class ParserTestCase extends EngineTestCase {
/**
* Parse the given source as a statement.
+ *
* @param source the source to be parsed
* @param errorCodes the error codes of the errors that are expected to be found
* @return the statement that was parsed
* @throws Exception if the source could not be parsed, if the compilation errors in the source do
- * not match those that are expected, or if the result would have been `null`
+ * not match those that are expected, or if the result would have been `null`
*/
static Statement parseStatement(String source, List<ErrorCode> errorCodes) {
GatheringErrorListener listener = new GatheringErrorListener();
@@ -6475,13 +6491,14 @@ class ParserTestCase extends EngineTestCase {
/**
* Parse the given source as a sequence of statements.
+ *
* @param source the source to be parsed
* @param expectedCount the number of statements that are expected
* @param errorCodes the error codes of the errors that are expected to be found
* @return the statements that were parsed
* @throws Exception if the source could not be parsed, if the number of statements does not match
- * the expected count, if the compilation errors in the source do not match those that
- * are expected, or if the result would have been `null`
+ * the expected count, if the compilation errors in the source do not match those that
+ * are expected, or if the result would have been `null`
*/
static List<Statement> parseStatements(String source, int expectedCount, List<ErrorCode> errorCodes) {
GatheringErrorListener listener = new GatheringErrorListener();
@@ -6501,6 +6518,7 @@ class ParserTestCase extends EngineTestCase {
*
* The given source is scanned and the parser is initialized to start with the first token in the
* source before the method is invoked.
+ *
* @param methodName the name of the method that should be invoked
* @param objects the values of the arguments to the method
* @param source the source to be processed by the parse method
@@ -6508,7 +6526,7 @@ class ParserTestCase extends EngineTestCase {
* @return the result of invoking the method
* @throws Exception if the method could not be invoked or throws an exception
* @throws AssertionFailedError if the result is `null` or the errors produced while
- * scanning and parsing the source do not match the expected errors
+ * scanning and parsing the source do not match the expected errors
*/
static Object invokeParserMethod(String methodName, List<Object> objects, String source, GatheringErrorListener listener) {
StringScanner scanner = new StringScanner(null, source, listener);
@@ -6527,18 +6545,20 @@ class ParserTestCase extends EngineTestCase {
*
* The given source is scanned and the parser is initialized to start with the first token in the
* source before the method is invoked.
+ *
* @param methodName the name of the method that should be invoked
* @param source the source to be processed by the parse method
* @param listener the error listener that will be used for both scanning and parsing
* @return the result of invoking the method
* @throws Exception if the method could not be invoked or throws an exception
* @throws AssertionFailedError if the result is `null` or the errors produced while
- * scanning and parsing the source do not match the expected errors
+ * scanning and parsing the source do not match the expected errors
*/
static Object invokeParserMethod2(String methodName, String source, GatheringErrorListener listener) => invokeParserMethod(methodName, _EMPTY_ARGUMENTS, source, listener);
/**
* Return a CommentAndMetadata object with the given values that can be used for testing.
+ *
* @param comment the comment to be wrapped in the object
* @param annotations the annotations to be wrapped in the object
* @return a CommentAndMetadata object that can be used for testing
@@ -6553,6 +6573,7 @@ class ParserTestCase extends EngineTestCase {
/**
* Return an empty CommentAndMetadata object that can be used for testing.
+ *
* @return an empty CommentAndMetadata object that can be used for testing
*/
CommentAndMetadata emptyCommentAndMetadata() => new CommentAndMetadata(null, new List<Annotation>());
@@ -7651,9 +7672,33 @@ class ErrorParserTest extends ParserTestCase {
CompilationUnit unit = ParserTestCase.parseCompilationUnit("part 'a.dart';\nlibrary l;", [ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST]);
JUnitTestCase.assertNotNull(unit);
}
+ void test_localFunctionDeclarationModifier_abstract() {
+ ParserTestCase.parseStatement("abstract f() {}", [ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER]);
+ }
+ void test_localFunctionDeclarationModifier_external() {
+ ParserTestCase.parseStatement("external f() {}", [ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER]);
+ }
+ void test_localFunctionDeclarationModifier_factory() {
+ ParserTestCase.parseStatement("factory f() {}", [ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER]);
+ }
+ void test_localFunctionDeclarationModifier_static() {
+ ParserTestCase.parseStatement("static f() {}", [ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER]);
+ }
void test_missingAssignableSelector_identifiersAssigned() {
ParserTestCase.parseExpression("x.y = y;", []);
}
+ void test_missingAssignableSelector_postfix_minusMinus_literal() {
+ ParserTestCase.parseExpression("0--", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
+ }
+ void test_missingAssignableSelector_postfix_plusPlus_literal() {
+ ParserTestCase.parseExpression("0++", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
+ }
+ void test_missingAssignableSelector_prefix_minusMinus_literal() {
+ ParserTestCase.parseExpression("--0", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
+ }
+ void test_missingAssignableSelector_prefix_plusPlus_literal() {
+ ParserTestCase.parseExpression("++0", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
+ }
void test_missingAssignableSelector_primarySelectorPostfix() {
ParserTestCase.parseExpression("x(y)(z)++", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
}
@@ -7796,6 +7841,12 @@ class ErrorParserTest extends ParserTestCase {
void test_nonUserDefinableOperator() {
ParserTestCase.parse4("parseClassMember", <Object> ["C"], "operator +=(int x) => x + 1;", [ParserErrorCode.NON_USER_DEFINABLE_OPERATOR]);
}
+ void test_optionalAfterNormalParameters_named() {
+ ParserTestCase.parseCompilationUnit("f({a}, b) {}", [ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS]);
+ }
+ void test_optionalAfterNormalParameters_positional() {
+ ParserTestCase.parseCompilationUnit("f([a], b) {}", [ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS]);
+ }
void test_positionalAfterNamedArgument() {
ParserTestCase.parse5("parseArgumentList", "(x: 1, 2)", [ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT]);
}
@@ -7829,6 +7880,9 @@ class ErrorParserTest extends ParserTestCase {
void test_staticTopLevelDeclaration_class() {
ParserTestCase.parseCompilationUnit("static class C {}", [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
}
+ void test_staticTopLevelDeclaration_function() {
+ ParserTestCase.parseCompilationUnit("static f() {}", [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
+ }
void test_staticTopLevelDeclaration_typedef() {
ParserTestCase.parseCompilationUnit("static typedef F();", [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
}
@@ -8338,10 +8392,42 @@ class ErrorParserTest extends ParserTestCase {
final __test = new ErrorParserTest();
runJUnitTest(__test, __test.test_libraryDirectiveNotFirst_afterPart);
});
+ _ut.test('test_localFunctionDeclarationModifier_abstract', () {
+ final __test = new ErrorParserTest();
+ runJUnitTest(__test, __test.test_localFunctionDeclarationModifier_abstract);
+ });
+ _ut.test('test_localFunctionDeclarationModifier_external', () {
+ final __test = new ErrorParserTest();
+ runJUnitTest(__test, __test.test_localFunctionDeclarationModifier_external);
+ });
+ _ut.test('test_localFunctionDeclarationModifier_factory', () {
+ final __test = new ErrorParserTest();
+ runJUnitTest(__test, __test.test_localFunctionDeclarationModifier_factory);
+ });
+ _ut.test('test_localFunctionDeclarationModifier_static', () {
+ final __test = new ErrorParserTest();
+ runJUnitTest(__test, __test.test_localFunctionDeclarationModifier_static);
+ });
_ut.test('test_missingAssignableSelector_identifiersAssigned', () {
final __test = new ErrorParserTest();
runJUnitTest(__test, __test.test_missingAssignableSelector_identifiersAssigned);
});
+ _ut.test('test_missingAssignableSelector_postfix_minusMinus_literal', () {
+ final __test = new ErrorParserTest();
+ runJUnitTest(__test, __test.test_missingAssignableSelector_postfix_minusMinus_literal);
+ });
+ _ut.test('test_missingAssignableSelector_postfix_plusPlus_literal', () {
+ final __test = new ErrorParserTest();
+ runJUnitTest(__test, __test.test_missingAssignableSelector_postfix_plusPlus_literal);
+ });
+ _ut.test('test_missingAssignableSelector_prefix_minusMinus_literal', () {
+ final __test = new ErrorParserTest();
+ runJUnitTest(__test, __test.test_missingAssignableSelector_prefix_minusMinus_literal);
+ });
+ _ut.test('test_missingAssignableSelector_prefix_plusPlus_literal', () {
+ final __test = new ErrorParserTest();
+ runJUnitTest(__test, __test.test_missingAssignableSelector_prefix_plusPlus_literal);
+ });
_ut.test('test_missingAssignableSelector_primarySelectorPostfix', () {
final __test = new ErrorParserTest();
runJUnitTest(__test, __test.test_missingAssignableSelector_primarySelectorPostfix);
@@ -8522,6 +8608,14 @@ class ErrorParserTest extends ParserTestCase {
final __test = new ErrorParserTest();
runJUnitTest(__test, __test.test_nonUserDefinableOperator);
});
+ _ut.test('test_optionalAfterNormalParameters_named', () {
+ final __test = new ErrorParserTest();
+ runJUnitTest(__test, __test.test_optionalAfterNormalParameters_named);
+ });
+ _ut.test('test_optionalAfterNormalParameters_positional', () {
+ final __test = new ErrorParserTest();
+ runJUnitTest(__test, __test.test_optionalAfterNormalParameters_positional);
+ });
_ut.test('test_positionalAfterNamedArgument', () {
final __test = new ErrorParserTest();
runJUnitTest(__test, __test.test_positionalAfterNamedArgument);
@@ -8566,6 +8660,10 @@ class ErrorParserTest extends ParserTestCase {
final __test = new ErrorParserTest();
runJUnitTest(__test, __test.test_staticTopLevelDeclaration_class);
});
+ _ut.test('test_staticTopLevelDeclaration_function', () {
+ final __test = new ErrorParserTest();
+ runJUnitTest(__test, __test.test_staticTopLevelDeclaration_function);
+ });
_ut.test('test_staticTopLevelDeclaration_typedef', () {
final __test = new ErrorParserTest();
runJUnitTest(__test, __test.test_staticTopLevelDeclaration_typedef);
@@ -8845,6 +8943,7 @@ Map<String, MethodTrampoline> _methodTable_Parser = <String, MethodTrampoline> {
'validateModifiersForClass_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForClass(arg0)),
'validateModifiersForConstructor_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForConstructor(arg0)),
'validateModifiersForField_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForField(arg0)),
+ 'validateModifiersForFunctionDeclarationStatement_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForFunctionDeclarationStatement(arg0)),
'validateModifiersForGetterOrSetterOrMethod_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForGetterOrSetterOrMethod(arg0)),
'validateModifiersForOperator_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForOperator(arg0)),
'validateModifiersForTopLevelDeclaration_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForTopLevelDeclaration(arg0)),

Powered by Google App Engine
This is Rietveld 408576698