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

Unified Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 1504403005: Add missing compile-time errors for async/await. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix after rebase Created 5 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/compiler/lib/src/parser/parser.dart ('k') | tests/compiler/dart2js/async_await_syntax_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/resolution/members.dart
diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart
index 460b34ef6da702008b527bc72c89685b85f82ab9..84260216ab087dab211310d3aa68fabd2a6659da 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -3687,8 +3687,14 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
}
ResolutionResult visitYield(Yield node) {
- coreClasses.streamClass.ensureResolved(resolution);
- coreClasses.iterableClass.ensureResolved(resolution);
+ if (!currentAsyncMarker.isYielding) {
+ reporter.reportErrorMessage(node, MessageKind.INVALID_YIELD);
+ }
+ if (currentAsyncMarker.isAsync) {
+ coreClasses.streamClass.ensureResolved(resolution);
+ } else {
+ coreClasses.iterableClass.ensureResolved(resolution);
+ }
visit(node.expression);
return const NoneResult();
}
@@ -3825,6 +3831,9 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
}
ResolutionResult visitAwait(Await node) {
+ if (!currentAsyncMarker.isAsync) {
+ reporter.reportErrorMessage(node, MessageKind.INVALID_AWAIT);
+ }
coreClasses.futureClass.ensureResolved(resolution);
visit(node.expression);
return const NoneResult();
@@ -4350,6 +4359,10 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
}
ResolutionResult visitAsyncForIn(AsyncForIn node) {
+ if (!currentAsyncMarker.isAsync) {
+ reporter.reportErrorMessage(
+ node.awaitToken, MessageKind.INVALID_AWAIT_FOR_IN);
+ }
registry.registerFeature(Feature.ASYNC_FOR_IN);
registry.registerDynamicUse(
new DynamicUse(Selectors.current, null));
« no previous file with comments | « pkg/compiler/lib/src/parser/parser.dart ('k') | tests/compiler/dart2js/async_await_syntax_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698