Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart |
index 930a113e1fb2f1e01d557ed72814146d03e864e7..2d91683267c728686b45620703b77b9fac6ef84c 100644 |
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart |
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart |
@@ -2443,6 +2443,12 @@ class ResolverVisitor extends CommonResolverVisitor<Element> { |
unimplemented(node, 'operator'); |
} |
+ visitRethrow(Rethrow node) { |
+ if (!inCatchBlock) { |
+ error(node, MessageKind.THROW_WITHOUT_EXPRESSION); |
+ } |
+ } |
+ |
visitReturn(Return node) { |
if (node.isRedirectingFactoryBody) { |
handleRedirectingFactoryBody(node); |
@@ -2495,12 +2501,9 @@ class ResolverVisitor extends CommonResolverVisitor<Element> { |
} |
visitThrow(Throw node) { |
- if (!inCatchBlock && node.expression == null) { |
- error(node, MessageKind.THROW_WITHOUT_EXPRESSION); |
- } |
- // We don't know ahead of time whether we will need the throw in a statement |
- // context or an expression context, so we register both here, even though |
- // we may not need ThrowExpression. |
+ // We don't know ahead of time whether we will need the throw in a |
+ // statement context or an expression context, so we register both |
+ // here, even though we may not need ThrowExpression. |
compiler.backend.registerWrapException(mapping); |
compiler.backend.registerThrowExpression(mapping); |
visit(node.expression); |