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

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

Issue 107833002: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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
« no previous file with comments | « pkg/analyzer/pubspec.yaml ('k') | pkg/analyzer/test/generated/scanner_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 38a08d5b105a40df819acf897c0e0f5d7cc45dfc..337212a273b91db155145a04213c0064d8cb744d 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -1494,6 +1494,13 @@ class SimpleParserTest extends ParserTestCase {
EngineTestCase.assertSize(0, unit.declarations);
}
+ void test_parseCompilationUnit_skipFunctionBody_withInterpolation() {
+ ParserTestCase._parseFunctionBodies = false;
+ CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "f() { '\${n}'; }", []);
+ JUnitTestCase.assertNull(unit.scriptTag);
+ EngineTestCase.assertSize(1, unit.declarations);
+ }
+
void test_parseCompilationUnit_topLevelDeclaration() {
CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "class A {}", []);
JUnitTestCase.assertNull(unit.scriptTag);
@@ -2511,6 +2518,24 @@ class SimpleParserTest extends ParserTestCase {
JUnitTestCase.assertNotNull(functionBody.semicolon);
}
+ void test_parseFunctionBody_skip_block() {
+ ParserTestCase._parseFunctionBodies = false;
+ FunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "{}");
+ EngineTestCase.assertInstanceOf(EmptyFunctionBody, functionBody);
+ }
+
+ void test_parseFunctionBody_skip_blocks() {
+ ParserTestCase._parseFunctionBodies = false;
+ FunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "{ {} }");
+ EngineTestCase.assertInstanceOf(EmptyFunctionBody, functionBody);
+ }
+
+ void test_parseFunctionBody_skip_expression() {
+ ParserTestCase._parseFunctionBodies = false;
+ FunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "=> y;");
+ EngineTestCase.assertInstanceOf(EmptyFunctionBody, functionBody);
+ }
+
void test_parseFunctionDeclaration_function() {
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), null);
@@ -5329,6 +5354,10 @@ class SimpleParserTest extends ParserTestCase {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseCompilationUnit_script);
});
+ _ut.test('test_parseCompilationUnit_skipFunctionBody_withInterpolation', () {
+ final __test = new SimpleParserTest();
+ runJUnitTest(__test, __test.test_parseCompilationUnit_skipFunctionBody_withInterpolation);
+ });
_ut.test('test_parseCompilationUnit_topLevelDeclaration', () {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseCompilationUnit_topLevelDeclaration);
@@ -5689,6 +5718,18 @@ class SimpleParserTest extends ParserTestCase {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseFunctionBody_nativeFunctionBody);
});
+ _ut.test('test_parseFunctionBody_skip_block', () {
+ final __test = new SimpleParserTest();
+ runJUnitTest(__test, __test.test_parseFunctionBody_skip_block);
+ });
+ _ut.test('test_parseFunctionBody_skip_blocks', () {
+ final __test = new SimpleParserTest();
+ runJUnitTest(__test, __test.test_parseFunctionBody_skip_blocks);
+ });
+ _ut.test('test_parseFunctionBody_skip_expression', () {
+ final __test = new SimpleParserTest();
+ runJUnitTest(__test, __test.test_parseFunctionBody_skip_expression);
+ });
_ut.test('test_parseFunctionDeclarationStatement', () {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseFunctionDeclarationStatement);
@@ -7203,6 +7244,11 @@ class ParserTestCase extends EngineTestCase {
static List<Object> _EMPTY_ARGUMENTS = new List<Object>(0);
/**
+ * A flag indicating whether parser is to parse function bodies.
+ */
+ static bool _parseFunctionBodies = true;
+
+ /**
* Invoke a parse method in [Parser]. The method is assumed to have the given number and
* type of parameters and will be invoked with the given arguments.
*
@@ -7387,6 +7433,7 @@ class ParserTestCase extends EngineTestCase {
Token tokenStream = scanner.tokenize();
listener.setLineInfo(new TestSource(), scanner.lineStarts);
Parser parser = new Parser(null, listener);
+ parser.parseFunctionBodies = _parseFunctionBodies;
Object result = invokeParserMethodImpl(parser, methodName, objects, tokenStream);
if (!listener.hasErrors()) {
JUnitTestCase.assertNotNull(result);
@@ -7432,6 +7479,11 @@ class ParserTestCase extends EngineTestCase {
*/
CommentAndMetadata emptyCommentAndMetadata() => new CommentAndMetadata(null, new List<Annotation>());
+ void setUp() {
+ super.setUp();
+ _parseFunctionBodies = true;
+ }
+
static dartSuite() {
_ut.group('ParserTestCase', () {
});
@@ -11433,6 +11485,7 @@ Map<String, MethodTrampoline> _methodTable_Parser = <String, MethodTrampoline> {
'isSwitchMember_0': new MethodTrampoline(0, (Parser target) => target.isSwitchMember()),
'isTypedIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => target.isTypedIdentifier(arg0)),
'lexicallyFirst_1': new MethodTrampoline(1, (Parser target, arg0) => target.lexicallyFirst(arg0)),
+ 'lockErrorListener_0': new MethodTrampoline(0, (Parser target) => target.lockErrorListener()),
'matches_1': new MethodTrampoline(1, (Parser target, arg0) => target.matches(arg0)),
'matches_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.matches3(arg0, arg1)),
'matchesAny_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.matchesAny(arg0, arg1)),
@@ -11523,8 +11576,10 @@ Map<String, MethodTrampoline> _methodTable_Parser = <String, MethodTrampoline> {
'parseWhileStatement_0': new MethodTrampoline(0, (Parser target) => target.parseWhileStatement()),
'peek_0': new MethodTrampoline(0, (Parser target) => target.peek()),
'peek_1': new MethodTrampoline(1, (Parser target, arg0) => target.peek2(arg0)),
- 'reportError_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) => target.reportError(arg0, arg1, arg2)),
- 'reportError_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.reportError9(arg0, arg1)),
+ 'reportError_1': new MethodTrampoline(1, (Parser target, arg0) => target.reportError(arg0)),
+ 'reportError_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) => target.reportError9(arg0, arg1, arg2)),
+ 'reportError_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.reportError10(arg0, arg1)),
+ 'skipBlock_0': new MethodTrampoline(0, (Parser target) => target.skipBlock()),
'skipFinalConstVarOrType_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipFinalConstVarOrType(arg0)),
'skipFormalParameterList_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipFormalParameterList(arg0)),
'skipPastMatchingToken_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipPastMatchingToken(arg0)),
@@ -11537,6 +11592,7 @@ Map<String, MethodTrampoline> _methodTable_Parser = <String, MethodTrampoline> {
'skipTypeName_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipTypeName(arg0)),
'skipTypeParameterList_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipTypeParameterList(arg0)),
'translateCharacter_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) => target.translateCharacter(arg0, arg1, arg2)),
+ 'unlockErrorListener_0': new MethodTrampoline(0, (Parser target) => target.unlockErrorListener()),
'validateFormalParameterList_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateFormalParameterList(arg0)),
'validateModifiersForClass_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForClass(arg0)),
'validateModifiersForConstructor_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForConstructor(arg0)),
« no previous file with comments | « pkg/analyzer/pubspec.yaml ('k') | pkg/analyzer/test/generated/scanner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698