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

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

Issue 109853003: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments. Created 7 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
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 adaec072ff4629b33abb3665f8b2eda6ce7a174f..9198404b05429715d9402c4627b0533496d99e8b 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
@@ -25,8 +25,6 @@ import com.google.dart.engine.ast.ClassDeclaration;
import com.google.dart.engine.ast.ClassMember;
import com.google.dart.engine.ast.CompilationUnit;
import com.google.dart.engine.ast.CompilationUnitMember;
-import com.google.dart.engine.ast.ConstructorDeclaration;
-import com.google.dart.engine.ast.ConstructorInitializer;
import com.google.dart.engine.ast.Expression;
import com.google.dart.engine.ast.ExpressionStatement;
import com.google.dart.engine.ast.FieldDeclaration;
@@ -35,7 +33,6 @@ import com.google.dart.engine.ast.InstanceCreationExpression;
import com.google.dart.engine.ast.ListLiteral;
import com.google.dart.engine.ast.MethodDeclaration;
import com.google.dart.engine.ast.MethodInvocation;
-import com.google.dart.engine.ast.NormalFormalParameter;
import com.google.dart.engine.ast.PrefixExpression;
import com.google.dart.engine.ast.PropertyAccess;
import com.google.dart.engine.ast.SimpleFormalParameter;
@@ -58,7 +55,6 @@ 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.constructorDeclaration;
import static com.google.dart.java2dart.util.ASTFactory.expressionFunctionBody;
import static com.google.dart.java2dart.util.ASTFactory.expressionStatement;
import static com.google.dart.java2dart.util.ASTFactory.fieldDeclaration;
@@ -69,11 +65,9 @@ import static com.google.dart.java2dart.util.ASTFactory.identifier;
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.namedFormalParameter;
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.redirectingConstructorInvocation;
import static com.google.dart.java2dart.util.ASTFactory.simpleFormalParameter;
import static com.google.dart.java2dart.util.ASTFactory.typeName;
import static com.google.dart.java2dart.util.ASTFactory.variableDeclaration;
@@ -131,62 +125,6 @@ public class EngineSemanticProcessor extends SemanticProcessor {
}
/**
- * Update {@link ASTNode} translated classes to add constructors with all named parameters and
- * rename "full" constructors with all required positional parameters.
- */
- public static void generateConstructorWithNamedParametersInAST(final Context context,
- CompilationUnit unit) {
- unit.accept(new RecursiveASTVisitor<Void>() {
- @Override
- public Void visitClassDeclaration(ClassDeclaration node) {
- ITypeBinding binding = context.getNodeTypeBinding(node);
- if (JavaUtils.isSubtype(binding, "com.google.dart.engine.ast.ASTNode")) {
- List<ClassMember> members = node.getMembers();
- for (int i = 0; i < members.size(); i++) {
- ClassMember member = members.get(i);
- if (member instanceof ConstructorDeclaration) {
- ConstructorDeclaration constructor = (ConstructorDeclaration) member;
- // prepare names, rename "full"
- String optionalName;
- String fullName;
- if (constructor.getName() == null) {
- fullName = "full";
- context.renameConstructor(constructor, fullName);
- optionalName = null;
- } else {
- optionalName = constructor.getName().getName();
- fullName = optionalName + "_full";
- context.renameConstructor(constructor, fullName);
- }
- // add constructor with optional names parameters
- List<FormalParameter> namedParameters = Lists.newArrayList();
- List<Expression> fullConstructorArguments = Lists.newArrayList();
- for (FormalParameter parameter : constructor.getParameters().getParameters()) {
- NormalFormalParameter normalParameter = (NormalFormalParameter) parameter;
- namedParameters.add(namedFormalParameter(normalParameter, null));
- fullConstructorArguments.add(normalParameter.getIdentifier());
- }
- ConstructorInitializer fullConstructorInvocation = redirectingConstructorInvocation(
- fullName,
- fullConstructorArguments);
- members.add(
- ++i,
- constructorDeclaration(
- constructor.getDocumentationComment(),
- constructor.getReturnType(),
- identifier(optionalName),
- formalParameterList(namedParameters),
- Lists.newArrayList(fullConstructorInvocation),
- null));
- }
- }
- }
- return null;
- }
- });
- }
-
- /**
* Generates "invokeParserMethodImpl" and supporting Dart code.
*/
public static void replaceReflectionMethods(final Context context, final PrintWriter pw,
@@ -441,7 +379,8 @@ public class EngineSemanticProcessor extends SemanticProcessor {
String accessorName = fieldName + accessorSuffix;
String privatePropertyName;
if ("elementResolver".equals(fieldName) || "thisType".equals(fieldName)
- || "typeAnalyzer".equals(fieldName)) {
+ || "typeAnalyzer".equals(fieldName) || "labelScope".equals(fieldName)
+ || "nameScope".equals(fieldName) || "enclosingClass".equals(fieldName)) {
privatePropertyName = "_" + fieldName;
} else {
privatePropertyName = fieldName;

Powered by Google App Engine
This is Rietveld 408576698