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

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

Issue 184893003: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineSemanticProcessor.java
diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineSemanticProcessor.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineSemanticProcessor.java
index f46c04051839d4a2a6e53b94d928545c78257095..e906b6246dcc7ca3718ac425d14f7102c462d35d 100644
--- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineSemanticProcessor.java
+++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineSemanticProcessor.java
@@ -54,7 +54,6 @@ import com.google.dart.java2dart.util.JavaUtils;
import static com.google.dart.java2dart.util.ASTFactory.assignmentExpression;
import static com.google.dart.java2dart.util.ASTFactory.binaryExpression;
-import static com.google.dart.java2dart.util.ASTFactory.block;
import static com.google.dart.java2dart.util.ASTFactory.blockFunctionBody;
import static com.google.dart.java2dart.util.ASTFactory.expressionFunctionBody;
import static com.google.dart.java2dart.util.ASTFactory.expressionStatement;
@@ -63,13 +62,16 @@ import static com.google.dart.java2dart.util.ASTFactory.formalParameterList;
import static com.google.dart.java2dart.util.ASTFactory.functionDeclaration;
import static com.google.dart.java2dart.util.ASTFactory.functionExpression;
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.integer;
import static com.google.dart.java2dart.util.ASTFactory.methodDeclaration;
import static com.google.dart.java2dart.util.ASTFactory.methodInvocation;
import static com.google.dart.java2dart.util.ASTFactory.parenthesizedExpression;
import static com.google.dart.java2dart.util.ASTFactory.prefixExpression;
import static com.google.dart.java2dart.util.ASTFactory.propertyAccess;
+import static com.google.dart.java2dart.util.ASTFactory.returnStatement;
import static com.google.dart.java2dart.util.ASTFactory.simpleFormalParameter;
+import static com.google.dart.java2dart.util.ASTFactory.throwExpression;
import static com.google.dart.java2dart.util.ASTFactory.typeName;
import static com.google.dart.java2dart.util.ASTFactory.variableDeclaration;
@@ -540,13 +542,13 @@ public class EngineSemanticProcessor extends SemanticProcessor {
@Override
public Void visitFieldDeclaration(FieldDeclaration node) {
super.visitFieldDeclaration(node);
- ClassDeclaration parentClass = (ClassDeclaration) node.getParent();
- if (parentClass.getName().getName().equals("FileBasedSource")) {
- for (VariableDeclaration field : node.getFields().getVariables()) {
- if (field.getName().getName().equals("_UTF_8_CHARSET")) {
- parentClass.getMembers().remove(node);
- }
- }
+ if (hasField(node, "FileBasedSource", "_UTF_8_CHARSET")) {
+ removeNode(node);
+ return null;
+ }
+ if (hasField(node, "InstrumentedAnalysisContextImpl", "_uiThread")) {
+ removeNode(node);
+ return null;
}
return null;
}
@@ -587,16 +589,36 @@ public class EngineSemanticProcessor extends SemanticProcessor {
}
if (isMethodInClass(
binding,
+ "setUIThread",
+ "com.google.dart.engine.internal.context.InstrumentedAnalysisContextImpl")
+ || isMethodInClass(
+ binding,
+ "checkThread",
+ "com.google.dart.engine.internal.context.InstrumentedAnalysisContextImpl")) {
+ removeNode(node);
+ return null;
+ }
+ // XXX
Brian Wilkerson 2014/02/28 22:30:38 Remove?
+ if (isMethodInClass(
+ binding,
"getContentsFromFile",
+ "com.google.dart.engine.source.FileBasedSource") && parameters.size() == 0) {
+ Statement statement = returnStatement(instanceCreationExpression(
+ Keyword.NEW,
+ typeName("TimestampedData", typeName("String")),
+ methodInvocation(identifier("_file"), identifier("lastModified")),
+ methodInvocation(identifier("_file"), identifier("readAsStringSync"))));
+ node.setBody(blockFunctionBody(statement));
+ return null;
+ }
+ if (isMethodInClass(
+ binding,
+ "getContentsFromFileToReceiver",
"com.google.dart.engine.source.FileBasedSource") && parameters.size() == 1) {
- SimpleIdentifier receiverIdent = parameters.get(0).getIdentifier();
- Block tryCacheBlock = block();
- ExpressionStatement statement = expressionStatement(methodInvocation(
- receiverIdent,
- "accept",
- methodInvocation(identifier("file"), "readAsStringSync"),
- methodInvocation(identifier("file"), "lastModified")));
- node.setBody(blockFunctionBody(tryCacheBlock, statement));
+ Statement statement = expressionStatement(throwExpression(instanceCreationExpression(
+ Keyword.NEW,
+ typeName("UnsupportedOperationException"))));
+ node.setBody(blockFunctionBody(statement));
return null;
}
return null;
@@ -606,6 +628,14 @@ public class EngineSemanticProcessor extends SemanticProcessor {
public Void visitMethodInvocation(MethodInvocation node) {
ASTNode parent = node.getParent();
List<Expression> args = node.getArgumentList().getArguments();
+ if (isMethodInClass(
+ node,
+ "checkThread",
+ "com.google.dart.engine.internal.context.InstrumentedAnalysisContextImpl")) {
+ Statement statement = node.getAncestor(Statement.class);
+ removeNode(statement);
+ return null;
+ }
if (isMethodInClass(node, "toArray", "com.google.dart.engine.utilities.collection.IntList")) {
replaceNode(node, node.getTarget());
return null;
@@ -668,6 +698,18 @@ public class EngineSemanticProcessor extends SemanticProcessor {
}
return node.getParameters().getParameters();
}
+
+ private boolean hasField(FieldDeclaration node, String className, String fieldName) {
+ ClassDeclaration parentClass = (ClassDeclaration) node.getParent();
+ if (parentClass.getName().getName().equals(className)) {
+ for (VariableDeclaration field : node.getFields().getVariables()) {
+ if (field.getName().getName().equals(fieldName)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
});
}
}

Powered by Google App Engine
This is Rietveld 408576698