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

Unified Diff: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java

Issue 10913197: Convert throw from a statement to an expression (issue 4872) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
===================================================================
--- compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java (revision 12211)
+++ compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java (working copy)
@@ -89,7 +89,7 @@
import com.google.dart.compiler.ast.DartSyntheticErrorIdentifier;
import com.google.dart.compiler.ast.DartSyntheticErrorStatement;
import com.google.dart.compiler.ast.DartThisExpression;
-import com.google.dart.compiler.ast.DartThrowStatement;
+import com.google.dart.compiler.ast.DartThrowExpression;
import com.google.dart.compiler.ast.DartTryStatement;
import com.google.dart.compiler.ast.DartTypeExpression;
import com.google.dart.compiler.ast.DartTypeNode;
@@ -814,7 +814,7 @@
return true;
}
// "throw" is exit if no enclosing "try"
- if (statement instanceof DartThrowStatement) {
+ if (statement instanceof DartExprStmt && (((DartExprStmt) statement).getExpression() instanceof DartThrowExpression)) {
for (DartNode p = statement; p != null && !(p instanceof DartFunction); p = p.getParent()) {
// TODO(scheglov) Can be enhanced:
// 1. check if there is "catch" block which can catch this exception;
@@ -2451,7 +2451,7 @@
}
@Override
- public Type visitThrowStatement(DartThrowStatement node) {
+ public Type visitThrowExpression(DartThrowExpression node) {
if (catchDepth == 0 && node.getException() == null) {
context.onError(new DartCompilationError(node,
ResolverErrorCode.RETHROW_NOT_IN_CATCH));

Powered by Google App Engine
This is Rietveld 408576698