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

Unified Diff: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineExceptionProcessor.java

Issue 355203009: Rewrite 'throw thrownException' with 'throw new AnalysisException(...)' (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineExceptionProcessor.java
diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineExceptionProcessor.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineExceptionProcessor.java
index 24dff7a5d649d3aaf0dbdb4622e9ade7b9eac22a..2c1286de0455ba6a1bb3baa3a55cd17b0b31bec6 100644
--- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineExceptionProcessor.java
+++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineExceptionProcessor.java
@@ -40,6 +40,7 @@ import com.google.dart.java2dart.util.JavaUtils;
import static com.google.dart.java2dart.util.AstFactory.identifier;
import static com.google.dart.java2dart.util.AstFactory.instanceCreationExpression;
import static com.google.dart.java2dart.util.AstFactory.nullLiteral;
+import static com.google.dart.java2dart.util.AstFactory.string;
import static com.google.dart.java2dart.util.AstFactory.typeName;
import org.eclipse.jdt.core.dom.ITypeBinding;
@@ -128,6 +129,22 @@ public class EngineExceptionProcessor extends SemanticProcessor {
}
@Override
+ public Void visitThrowExpression(ThrowExpression node) {
+ super.visitThrowExpression(node);
+ // "throw thrownException;" in AnalysisContextImpl -> "throw new AnalysisContext(thrownException)"
+ Expression expression = node.getExpression();
+ if (expression instanceof SimpleIdentifier
+ && ((SimpleIdentifier) expression).getName().equals("thrownException")) {
+ node.setExpression(instanceCreationExpression(
+ Keyword.NEW,
+ typeName("AnalysisException"),
+ string("<rethrow>"),
+ expression));
+ }
+ return null;
+ }
+
+ @Override
public Void visitTypeName(TypeName node) {
// AnalysisException -> CaughtException
AstNode parent = node.getParent();
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698