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

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

Issue 1584823003: assert isAsynchronous and isGenerator false if parseAsync is false (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/test/generated/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 5d304c70e61c4ea5fda64245c93b2b921b85c821..e31ba6aa6c230f84cc769362039b5fbac4b53a5d 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -939,14 +939,35 @@ class ErrorParserTest extends ParserTestCase {
void test_enableAsync_false_1() {
parseAsync = false;
- parse4("parseFunctionDeclarationStatement",
- "foo() async {}", [ParserErrorCode.ASYNC_NOT_SUPPORTED]);
+ FunctionDeclarationStatement stmt = parse4(
+ "parseFunctionDeclarationStatement",
+ "foo() async {}",
+ [ParserErrorCode.ASYNC_NOT_SUPPORTED]);
+ FunctionExpression expr = stmt.functionDeclaration.functionExpression;
+ expect(expr.body.isAsynchronous, isFalse);
+ expect(expr.body.isGenerator, isFalse);
}
void test_enableAsync_false_2() {
parseAsync = false;
- parse4("parseFunctionDeclarationStatement",
- "foo() sync* {}", [ParserErrorCode.ASYNC_NOT_SUPPORTED]);
+ FunctionDeclarationStatement stmt = parse4(
+ "parseFunctionDeclarationStatement",
+ "foo() async => 0;",
+ [ParserErrorCode.ASYNC_NOT_SUPPORTED]);
+ FunctionExpression expr = stmt.functionDeclaration.functionExpression;
+ expect(expr.body.isAsynchronous, isFalse);
+ expect(expr.body.isGenerator, isFalse);
+ }
+
+ void test_enableAsync_false_3() {
+ parseAsync = false;
+ FunctionDeclarationStatement stmt = parse4(
+ "parseFunctionDeclarationStatement",
+ "foo() sync* {}",
+ [ParserErrorCode.ASYNC_NOT_SUPPORTED]);
+ FunctionExpression expr = stmt.functionDeclaration.functionExpression;
+ expect(expr.body.isAsynchronous, isFalse);
+ expect(expr.body.isGenerator, isFalse);
}
void test_emptyEnumBody() {
« pkg/analyzer/lib/src/generated/parser.dart ('K') | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698