Remove useless templatization from JS AST.
The original intent was that JsContext would get parameterized with the "compatible" node type. So all JsExpression subclasses used a JsContext<JsExpression>, which means, essentially, "I can be replaced only with other expressions". There was a tiny amount of usefulness in being able to see this statically.
In practice though, it's too much crazy futzing with generics. You'll get a ClassCastException at runtime anyhow if you screw something up, and our test coverage is really good these days.
http://gwt-code-reviews.appspot.com/1310805/show
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9667 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java b/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java
index 220456a..ab9e5c4 100644
--- a/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java
+++ b/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java
@@ -24,9 +24,9 @@
import com.google.gwt.core.ext.linker.EmittedArtifact;
import com.google.gwt.core.ext.linker.EmittedArtifact.Visibility;
import com.google.gwt.core.ext.linker.LinkerOrder;
+import com.google.gwt.core.ext.linker.LinkerOrder.Order;
import com.google.gwt.core.ext.linker.PublicResource;
import com.google.gwt.core.ext.linker.SelectionProperty;
-import com.google.gwt.core.ext.linker.LinkerOrder.Order;
import com.google.gwt.dev.cfg.BindingProperty;
import com.google.gwt.dev.cfg.ModuleDef;
import com.google.gwt.dev.cfg.Property;
@@ -44,7 +44,6 @@
import com.google.gwt.dev.js.JsUnusedFunctionRemover;
import com.google.gwt.dev.js.JsVerboseNamer;
import com.google.gwt.dev.js.ast.JsContext;
-import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsFunction;
import com.google.gwt.dev.js.ast.JsModVisitor;
import com.google.gwt.dev.js.ast.JsName;
@@ -92,7 +91,7 @@
}
@Override
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
didChange |= JsStringInterner.exec(program, x.getBody(), x.getScope());
return false;
}
@@ -472,7 +471,8 @@
* @param out where to emit the artifact contents
*/
public void produceOutput(TreeLogger logger, ArtifactSet artifacts,
- Visibility visibility, OutputFileSet out) throws UnableToCompleteException {
+ Visibility visibility, OutputFileSet out)
+ throws UnableToCompleteException {
logger = logger.branch(TreeLogger.TRACE, "Linking " + visibility
+ " artifacts into " + out.getPathDescription(), null);
diff --git a/dev/core/src/com/google/gwt/dev/javac/JsniChecker.java b/dev/core/src/com/google/gwt/dev/javac/JsniChecker.java
index d637fc3..aae722a 100644
--- a/dev/core/src/com/google/gwt/dev/javac/JsniChecker.java
+++ b/dev/core/src/com/google/gwt/dev/javac/JsniChecker.java
@@ -21,7 +21,6 @@
import com.google.gwt.dev.jjs.InternalCompilerException;
import com.google.gwt.dev.jjs.SourceInfo;
import com.google.gwt.dev.js.ast.JsContext;
-import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsFunction;
import com.google.gwt.dev.js.ast.JsNameRef;
import com.google.gwt.dev.js.ast.JsVisitor;
@@ -188,7 +187,7 @@
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
this.errorInfo = x.getSourceInfo();
String ident = x.getIdent();
if (ident.charAt(0) == '@') {
diff --git a/dev/core/src/com/google/gwt/dev/jdt/FindJsniRefVisitor.java b/dev/core/src/com/google/gwt/dev/jdt/FindJsniRefVisitor.java
index 3e4e654..8d2cb36 100644
--- a/dev/core/src/com/google/gwt/dev/jdt/FindJsniRefVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/jdt/FindJsniRefVisitor.java
@@ -21,7 +21,6 @@
import com.google.gwt.dev.js.JsParser;
import com.google.gwt.dev.js.JsParserException;
import com.google.gwt.dev.js.ast.JsContext;
-import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsNameRef;
import com.google.gwt.dev.js.ast.JsProgram;
import com.google.gwt.dev.js.ast.JsStatement;
@@ -96,7 +95,7 @@
jsProgram.getScope(), sr);
new JsVisitor() {
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
String ident = x.getIdent();
if (ident.charAt(0) == '@') {
jsniRefs.add(ident.substring(1));
@@ -120,8 +119,10 @@
return null; // ignore the error
}
- startPos += JsniCollector.JSNI_BLOCK_START.length() - 1; // move up to open brace
- endPos += 1; // move past close brace
+ // move up to open brace
+ startPos += JsniCollector.JSNI_BLOCK_START.length() - 1;
+ // move past close brace
+ endPos += 1;
jsniCode = jsniCode.substring(startPos, endPos);
return jsniCode;
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniMethodBody.java b/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniMethodBody.java
index 698343b..c5d5f09 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniMethodBody.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniMethodBody.java
@@ -20,7 +20,6 @@
import com.google.gwt.dev.jjs.ast.JAbstractMethodBody;
import com.google.gwt.dev.jjs.ast.JVisitor;
import com.google.gwt.dev.js.ast.JsContext;
-import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsFunction;
import com.google.gwt.dev.js.ast.JsStringLiteral;
import com.google.gwt.dev.js.ast.JsVisitor;
@@ -95,7 +94,7 @@
final Set<String> result = new HashSet<String>();
class RecordStrings extends JsVisitor {
@Override
- public void endVisit(JsStringLiteral lit, JsContext<JsExpression> ctx) {
+ public void endVisit(JsStringLiteral lit, JsContext ctx) {
result.add(lit.getValue());
}
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
index 8f5a3b3..5dab288 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
@@ -51,7 +51,6 @@
import com.google.gwt.dev.jjs.ast.js.JsniMethodBody;
import com.google.gwt.dev.jjs.ast.js.JsniMethodRef;
import com.google.gwt.dev.js.ast.JsContext;
-import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsFunction;
import com.google.gwt.dev.js.ast.JsName;
import com.google.gwt.dev.js.ast.JsNameRef;
@@ -320,7 +319,7 @@
new JsVisitor() {
@Override
- public void endVisit(JsNameRef nameRef, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef nameRef, JsContext ctx) {
JsName ident = nameRef.getName();
if (ident != null) {
@@ -529,8 +528,8 @@
* time, this would happen naturally since the instance method
* delegates to the static. However, in cases where the static has
* been inlined into the instance method, future optimization could
- * tighten an instance call into a static call, reaching code that
- * was pruned.
+ * tighten an instance call into a static call, reaching code that was
+ * pruned.
*/
JMethod staticImpl = program.getStaticImpl(method);
if (staticImpl != null) {
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/FragmentExtractor.java b/dev/core/src/com/google/gwt/dev/jjs/impl/FragmentExtractor.java
index c1958e5..88c152e 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/FragmentExtractor.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/FragmentExtractor.java
@@ -385,7 +385,7 @@
final boolean[] anyLiveCode = new boolean[1];
Cloner c = new Cloner() {
@Override
- public void endVisit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsBinaryOperation x, JsContext ctx) {
JsExpression rhs = stack.pop();
JsNameRef lhs = (JsNameRef) stack.pop();
if (rhs instanceof JsNew || rhs instanceof JsObjectLiteral) {
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
index 2b5dba1..105d0f2 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
@@ -2958,7 +2958,7 @@
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
String ident = x.getIdent();
if (ident.charAt(0) == '@') {
processNameRef(x, ctx);
@@ -2985,7 +2985,7 @@
}
private void processField(JsNameRef nameRef, SourceInfo info,
- JField field, JsContext<JsExpression> ctx) {
+ JField field, JsContext ctx) {
/*
* We must replace any compile-time constants with the constant value of
* the field.
@@ -3012,14 +3012,14 @@
}
private void processMethod(JsNameRef nameRef, SourceInfo info,
- JMethod method, JsContext<JsExpression> ctx) {
+ JMethod method, JsContext ctx) {
assert !ctx.isLvalue();
JsniMethodRef methodRef = new JsniMethodRef(info, nameRef.getIdent(),
method, program.getJavaScriptObject());
nativeMethodBody.addJsniRef(methodRef);
}
- private void processNameRef(JsNameRef nameRef, JsContext<JsExpression> ctx) {
+ private void processNameRef(JsNameRef nameRef, JsContext ctx) {
SourceInfo info = nativeMethodBody.getSourceInfo();
// TODO: make this tighter when we have real source info
// JSourceInfo info = translateInfo(nameRef.getInfo());
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
index bc2288c..c878a3b 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
@@ -449,8 +449,9 @@
private void recordSymbol(JReferenceType x, JsName jsName) {
int queryId = program.getQueryId(x);
JsonObject castableTypeMapObj = program.getCastableTypeMap(x);
- CastableTypeMap castableTypeMap = new StandardCastableTypeMap(castableTypeMapObj.toString());
-
+ CastableTypeMap castableTypeMap = new StandardCastableTypeMap(
+ castableTypeMapObj.toString());
+
StandardSymbolData symbolData = StandardSymbolData.forClass(x.getName(),
x.getSourceInfo().getFileName(), x.getSourceInfo().getStartLine(),
queryId, castableTypeMap);
@@ -520,7 +521,7 @@
private Map<JMethod, Integer> entryMethodToIndex;
private final JsName arrayLength = objectScope.declareName("length");
-
+
private final JsName globalTemp = topScope.declareName("_");
private final JsName prototype = objectScope.declareName("prototype");
@@ -632,7 +633,6 @@
push(classLit.makeRef(x.getSourceInfo()));
}
- @SuppressWarnings("unchecked")
@Override
public void endVisit(JClassType x, Context ctx) {
if (alreadyRan.contains(x)) {
@@ -1146,8 +1146,9 @@
List<JsStatement> globalStmts = jsProgram.getGlobalBlock().getStatements();
// Generate entry methods
- generateGwtOnLoad(Arrays.asList(entryFunctions).subList(0,
- x.getEntryCount(0)), globalStmts);
+ generateGwtOnLoad(
+ Arrays.asList(entryFunctions).subList(0, x.getEntryCount(0)),
+ globalStmts);
generateNullFunc(globalStmts);
// Add a few things onto the beginning.
@@ -1348,7 +1349,7 @@
private JsNameRef dontReplaceCtor;
@Override
- public void endVisit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsInvocation x, JsContext ctx) {
// Replace invocation to ctor with a new op.
if (x.getQualifier() instanceof JsNameRef) {
JsNameRef ref = (JsNameRef) x.getQualifier();
@@ -1368,7 +1369,7 @@
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
String ident = x.getIdent();
if (isJsniIdent(ident)) {
HasEnclosingType node = program.jsniMap.get(ident);
@@ -1430,7 +1431,7 @@
}
@Override
- public boolean visit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsInvocation x, JsContext ctx) {
if (x.getQualifier() instanceof JsNameRef) {
dontReplaceCtor = (JsNameRef) x.getQualifier();
}
@@ -1500,8 +1501,9 @@
return new JsBinaryOperation(lhs.getSourceInfo(), JsBinaryOperator.COMMA,
lhs, rhs);
}
-
- private void generateCastableTypeMap(JClassType x, List<JsStatement> globalStmts) {
+
+ private void generateCastableTypeMap(JClassType x,
+ List<JsStatement> globalStmts) {
JsonObject castableTypeMap = program.getCastableTypeMap(x);
if (castableTypeMap != null) {
JField castableTypeMapField = program.getIndexedField("Object.castableTypeMap");
@@ -1510,25 +1512,25 @@
// Was pruned; this compilation must have no dynamic casts.
return;
}
-
+
SourceInfo sourceInfo = jsProgram.createSourceInfoSynthetic(
- GenerateJavaScriptAST.class, "Castable type map");
-
+ GenerateJavaScriptAST.class, "Castable type map");
+
accept(castableTypeMap);
JsExpression objExpr = pop();
-
+
// Generate castableTypeMap for each type prototype
// _.castableTypeMap$ = {2:1, 4:1, 12:1};
JsNameRef fieldRef = castableTypeMapName.makeRef(sourceInfo);
fieldRef.setQualifier(globalTemp.makeRef(sourceInfo));
JsExpression asg = createAssignment(fieldRef, objExpr);
-
+
JsExprStmt asgStmt = asg.makeStmt();
globalStmts.add(asgStmt);
typeForStatMap.put(asgStmt, x);
- }
+ }
}
-
+
private void generateClassLiteral(JDeclarationStatement decl, JsVars vars) {
JField field = (JField) decl.getVariableRef().getTarget();
JsName jsName = names.get(field);
@@ -1624,8 +1626,9 @@
topScope.findExistingUnobfuscatableName("$moduleName").makeRef(
sourceInfo), modName.makeRef(sourceInfo));
body.getStatements().add(asg.makeStmt());
- asg = createAssignment(topScope.findExistingUnobfuscatableName(
- "$moduleBase").makeRef(sourceInfo), modBase.makeRef(sourceInfo));
+ asg = createAssignment(
+ topScope.findExistingUnobfuscatableName("$moduleBase").makeRef(
+ sourceInfo), modBase.makeRef(sourceInfo));
body.getStatements().add(asg.makeStmt());
// Assignment to CollapsedPropertyHolder.permutationId only if it's used
@@ -1804,7 +1807,7 @@
globalStmts.add(stmt);
typeForStatMap.put(stmt, program.getTypeJavaLangObject());
}
-
+
private void generateVTables(JClassType x, List<JsStatement> globalStmts) {
for (JMethod method : x.getMethods()) {
SourceInfo sourceInfo = method.getSourceInfo().makeChild(
@@ -1832,8 +1835,9 @@
SourceInfo sourceInfo = clinitFunc.getSourceInfo().makeChild(
GenerateJavaScriptVisitor.class, "clinit reassignment");
// self-assign to the null method immediately (to prevent reentrancy)
- JsExpression asg = createAssignment(clinitFunc.getName().makeRef(
- sourceInfo), nullMethodName.makeRef(sourceInfo));
+ JsExpression asg = createAssignment(
+ clinitFunc.getName().makeRef(sourceInfo),
+ nullMethodName.makeRef(sourceInfo));
statements.add(0, asg.makeStmt());
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptLiterals.java b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptLiterals.java
index f848152..e9c55c2 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptLiterals.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptLiterals.java
@@ -45,7 +45,7 @@
public class GenerateJavaScriptLiterals extends JVisitor {
private final JsProgram program;
- private final Stack<JsVisitable<?>> nodeStack = new Stack<JsVisitable<?>>();
+ private final Stack<JsVisitable> nodeStack = new Stack<JsVisitable>();
public GenerateJavaScriptLiterals(JsProgram program) {
this.program = program;
@@ -114,7 +114,6 @@
return (T) nodeStack.pop();
}
- @SuppressWarnings("unchecked")
protected final <T extends JsVisitable> List<T> popList(int count) {
List<T> list = new ArrayList<T>();
while (count > 0) {
@@ -128,7 +127,6 @@
return list;
}
- @SuppressWarnings("unchecked")
protected final <T extends JsVisitable> void popList(List<T> collection,
int count) {
List<T> list = new ArrayList<T>();
@@ -143,7 +141,6 @@
collection.addAll(list);
}
- @SuppressWarnings("unchecked")
protected final <T extends JsVisitable> void push(T node) {
nodeStack.push(node);
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/HandleCrossFragmentReferences.java b/dev/core/src/com/google/gwt/dev/jjs/impl/HandleCrossFragmentReferences.java
index 31a9b49..6e6765c 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/HandleCrossFragmentReferences.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/HandleCrossFragmentReferences.java
@@ -22,25 +22,23 @@
import com.google.gwt.dev.js.ast.JsBinaryOperation;
import com.google.gwt.dev.js.ast.JsBinaryOperator;
import com.google.gwt.dev.js.ast.JsContext;
-import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsFunction;
import com.google.gwt.dev.js.ast.JsModVisitor;
import com.google.gwt.dev.js.ast.JsName;
import com.google.gwt.dev.js.ast.JsNameRef;
import com.google.gwt.dev.js.ast.JsObjectLiteral;
import com.google.gwt.dev.js.ast.JsProgram;
-import com.google.gwt.dev.js.ast.JsStatement;
import com.google.gwt.dev.js.ast.JsVars;
-import com.google.gwt.dev.js.ast.JsVisitor;
import com.google.gwt.dev.js.ast.JsVars.JsVar;
+import com.google.gwt.dev.js.ast.JsVisitor;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
+import java.util.Set;
/**
* Rewrite JavaScript to better handle references from one code fragment to
@@ -50,9 +48,9 @@
*/
public class HandleCrossFragmentReferences {
/**
- * Find out which islands define and use each named function or variable.
- * This visitor is not smart about which definitions and uses matter. It
- * blindly records all of them.
+ * Find out which islands define and use each named function or variable. This
+ * visitor is not smart about which definitions and uses matter. It blindly
+ * records all of them.
*/
private class FindNameReferences extends JsVisitor {
Map<JsName, Set<Integer>> islandsDefining = new LinkedHashMap<JsName, Set<Integer>>();
@@ -60,7 +58,7 @@
private int currentIsland;
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
JsName name = x.getName();
if (name != null) {
definitionSeen(name);
@@ -68,7 +66,7 @@
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
if (x.getQualifier() == null) {
JsName name = x.getName();
if (name != null) {
@@ -78,7 +76,7 @@
}
@Override
- public void endVisit(JsVars x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsVars x, JsContext ctx) {
for (JsVar var : x) {
JsName name = var.getName();
if (name != null) {
@@ -88,7 +86,7 @@
}
@Override
- public boolean visit(JsProgram x, JsContext<JsProgram> ctx) {
+ public boolean visit(JsProgram x, JsContext ctx) {
for (int i = 0; i < x.getFragmentCount(); i++) {
currentIsland = i;
accept(x.getFragmentBlock(i));
@@ -126,7 +124,7 @@
*/
private class RewriteDeclsAndRefs extends JsModVisitor {
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
if (namesToPredefine.contains(x.getName())) {
JsBinaryOperation asg = new JsBinaryOperation(x.getSourceInfo(),
JsBinaryOperator.ASG, makeRefViaJslink(x.getName(),
@@ -137,14 +135,14 @@
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
if (namesToPredefine.contains(x.getName())) {
ctx.replaceMe(makeRefViaJslink(x.getName(), x.getSourceInfo()));
}
}
@Override
- public void endVisit(JsVars x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsVars x, JsContext ctx) {
if (!ctx.canInsert()) {
return;
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/MakeCallsStatic.java b/dev/core/src/com/google/gwt/dev/jjs/impl/MakeCallsStatic.java
index 26cbffb..1841193 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/MakeCallsStatic.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/MakeCallsStatic.java
@@ -1,12 +1,12 @@
/*
* Copyright 2008 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -37,7 +37,6 @@
import com.google.gwt.dev.jjs.ast.js.JMultiExpression;
import com.google.gwt.dev.jjs.ast.js.JsniMethodBody;
import com.google.gwt.dev.js.ast.JsContext;
-import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsFunction;
import com.google.gwt.dev.js.ast.JsModVisitor;
import com.google.gwt.dev.js.ast.JsName;
@@ -89,13 +88,13 @@
}
@Override
- public void endVisit(JsThisRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsThisRef x, JsContext ctx) {
ctx.replaceMe(thisParam.makeRef(x.getSourceInfo().makeChild(
RewriteJsniMethodBody.class, "Devirtualized instance")));
}
@Override
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
// Don't recurse into nested functions!
return false;
}
@@ -111,7 +110,7 @@
private final JParameter thisParam;
private final Map<JParameter, JParameter> varMap;
- public RewriteMethodBody(JParameter thisParam,
+ public RewriteMethodBody(JParameter thisParam,
Map<JParameter, JParameter> varMap) {
this.thisParam = thisParam;
this.varMap = varMap;
@@ -191,7 +190,7 @@
CreateStaticImplsVisitor.class, "Degelgating to devirtualized method");
JMethodBody newBody = new JMethodBody(delegateCallSourceInfo);
x.setBody(newBody);
- JMethodCall newCall = new JMethodCall(delegateCallSourceInfo, null,
+ JMethodCall newCall = new JMethodCall(delegateCallSourceInfo, null,
newMethod);
newCall.addArg(new JThisRef(delegateCallSourceInfo, enclosingType));
for (int i = 0; i < x.getParams().size(); ++i) {
@@ -216,8 +215,10 @@
// TODO: Do we really need to do that in BuildTypeMap?
JsFunction jsFunc = ((JsniMethodBody) movedBody).getFunc();
JsName paramName = jsFunc.getScope().declareName("this$static");
- jsFunc.getParameters().add(0, new JsParameter(sourceInfo.makeChild(
- CreateStaticImplsVisitor.class, "Static accessor"), paramName));
+ jsFunc.getParameters().add(
+ 0,
+ new JsParameter(sourceInfo.makeChild(
+ CreateStaticImplsVisitor.class, "Static accessor"), paramName));
RewriteJsniMethodBody rewriter = new RewriteJsniMethodBody(paramName);
// Accept the body to avoid the recursion blocker.
rewriter.accept(jsFunc.getBody());
@@ -324,7 +325,7 @@
if (isRunCallbacksMethod(x.getTarget())) {
/*
* Don't devirtualize these calls created by FragmentLoaderCreator,
- * because it spoils code splitting.
+ * because it spoils code splitting.
*
* TODO(spoon) remove this once FragmentLoaderCreator is gone
*/
@@ -336,7 +337,8 @@
@Override
public boolean visit(JMethod x, Context ctx) {
- currentMethodIsInitiallyLive = initiallyLive.getLiveFieldsAndMethods().contains(x);
+ currentMethodIsInitiallyLive = initiallyLive.getLiveFieldsAndMethods().contains(
+ x);
return true;
}
@@ -348,8 +350,8 @@
}
public static OptimizerStats exec(JProgram program) {
- Event optimizeEvent = SpeedTracerLogger.start(
- CompilerEventType.OPTIMIZE, "optimizer", NAME);
+ Event optimizeEvent = SpeedTracerLogger.start(CompilerEventType.OPTIMIZE,
+ "optimizer", NAME);
OptimizerStats stats = new MakeCallsStatic(program).execImpl();
optimizeEvent.end("didChange", "" + stats.didChange());
return stats;
diff --git a/dev/core/src/com/google/gwt/dev/js/EvalFunctionsAtTopScope.java b/dev/core/src/com/google/gwt/dev/js/EvalFunctionsAtTopScope.java
index 39e76d7..e7f97ad 100644
--- a/dev/core/src/com/google/gwt/dev/js/EvalFunctionsAtTopScope.java
+++ b/dev/core/src/com/google/gwt/dev/js/EvalFunctionsAtTopScope.java
@@ -18,13 +18,12 @@
import com.google.gwt.dev.jjs.impl.JavaToJavaScriptMap;
import com.google.gwt.dev.js.ast.JsBlock;
import com.google.gwt.dev.js.ast.JsContext;
-import com.google.gwt.dev.js.ast.JsExpression;
+import com.google.gwt.dev.js.ast.JsExprStmt;
import com.google.gwt.dev.js.ast.JsFunction;
import com.google.gwt.dev.js.ast.JsModVisitor;
import com.google.gwt.dev.js.ast.JsProgram;
import com.google.gwt.dev.js.ast.JsProgramFragment;
import com.google.gwt.dev.js.ast.JsStatement;
-import com.google.gwt.dev.js.ast.JsExprStmt;
import java.util.HashSet;
import java.util.ListIterator;
@@ -46,41 +45,41 @@
}
private JsStatement currentStatement;
-
+
private final Set<JsFunction> dontMove = new HashSet<JsFunction>();
private final Stack<ListIterator<JsStatement>> itrStack = new Stack<ListIterator<JsStatement>>();
private JavaToJavaScriptMap java2jsMap;
-
+
private final Stack<JsBlock> scopeStack = new Stack<JsBlock>();
-
+
public EvalFunctionsAtTopScope(JavaToJavaScriptMap java2jsMap) {
this.java2jsMap = java2jsMap;
}
-
+
@Override
- public void endVisit(JsExprStmt x, JsContext<JsStatement> ctx) {
- currentStatement = null;
+ public void endVisit(JsExprStmt x, JsContext ctx) {
+ currentStatement = null;
}
-
+
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
scopeStack.pop();
}
@Override
- public void endVisit(JsProgram x, JsContext<JsProgram> ctx) {
+ public void endVisit(JsProgram x, JsContext ctx) {
scopeStack.pop();
}
@Override
- public void endVisit(JsProgramFragment x, JsContext<JsProgramFragment> ctx) {
+ public void endVisit(JsProgramFragment x, JsContext ctx) {
scopeStack.pop();
}
@Override
- public boolean visit(JsBlock x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsBlock x, JsContext ctx) {
if (x == scopeStack.peek()) {
ListIterator<JsStatement> itr = x.getStatements().listIterator();
itrStack.push(itr);
@@ -106,22 +105,22 @@
}
@Override
- public boolean visit(JsExprStmt x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsExprStmt x, JsContext ctx) {
currentStatement = x;
return true;
}
@Override
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
JsStaticEval.isFunctionDecl(currentStatement);
-
+
/*
- * We do this during visit() to preserve first-to-last evaluation order.
- * We check if this function is a vtable declaration and don't
- * move functions used in other expressions or are in vtable assignments.
+ * We do this during visit() to preserve first-to-last evaluation order. We
+ * check if this function is a vtable declaration and don't move functions
+ * used in other expressions or are in vtable assignments.
*/
- if (x.getName() != null && !dontMove.contains(x) &&
- !isVtableDeclaration(currentStatement)) {
+ if (x.getName() != null && !dontMove.contains(x)
+ && !isVtableDeclaration(currentStatement)) {
/*
* Reinsert this function into the statement immediately before the
* current statement. The current statement will have already been
@@ -143,17 +142,17 @@
}
@Override
- public boolean visit(JsProgram x, JsContext<JsProgram> ctx) {
+ public boolean visit(JsProgram x, JsContext ctx) {
scopeStack.push(x.getGlobalBlock());
return true;
}
@Override
- public boolean visit(JsProgramFragment x, JsContext<JsProgramFragment> ctx) {
+ public boolean visit(JsProgramFragment x, JsContext ctx) {
scopeStack.push(x.getGlobalBlock());
return true;
}
-
+
private boolean isVtableDeclaration(JsStatement currentStatement) {
return java2jsMap.vtableInitToMethod(currentStatement) != null;
}
diff --git a/dev/core/src/com/google/gwt/dev/js/JsAbstractSymbolResolver.java b/dev/core/src/com/google/gwt/dev/js/JsAbstractSymbolResolver.java
index b28cfcc..f063e6e 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsAbstractSymbolResolver.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsAbstractSymbolResolver.java
@@ -17,7 +17,6 @@
import com.google.gwt.dev.js.ast.JsCatch;
import com.google.gwt.dev.js.ast.JsContext;
-import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsFunction;
import com.google.gwt.dev.js.ast.JsNameRef;
import com.google.gwt.dev.js.ast.JsProgram;
@@ -34,17 +33,17 @@
private final Stack<JsScope> scopeStack = new Stack<JsScope>();
@Override
- public void endVisit(JsCatch x, JsContext<JsCatch> ctx) {
+ public void endVisit(JsCatch x, JsContext ctx) {
popScope();
}
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
popScope();
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
if (x.isResolved()) {
return;
}
@@ -53,24 +52,24 @@
}
@Override
- public void endVisit(JsProgram x, JsContext<JsProgram> ctx) {
+ public void endVisit(JsProgram x, JsContext ctx) {
popScope();
}
@Override
- public boolean visit(JsCatch x, JsContext<JsCatch> ctx) {
+ public boolean visit(JsCatch x, JsContext ctx) {
pushScope(x.getScope());
return true;
}
@Override
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
pushScope(x.getScope());
return true;
}
@Override
- public boolean visit(JsProgram x, JsContext<JsProgram> ctx) {
+ public boolean visit(JsProgram x, JsContext ctx) {
pushScope(x.getScope());
return true;
}
@@ -80,7 +79,7 @@
}
protected abstract void resolve(JsNameRef x);
-
+
private void popScope() {
scopeStack.pop();
}
diff --git a/dev/core/src/com/google/gwt/dev/js/JsBreakUpLargeVarStatements.java b/dev/core/src/com/google/gwt/dev/js/JsBreakUpLargeVarStatements.java
index 39b4132..938928b 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsBreakUpLargeVarStatements.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsBreakUpLargeVarStatements.java
@@ -22,7 +22,6 @@
import com.google.gwt.dev.js.ast.JsContext;
import com.google.gwt.dev.js.ast.JsModVisitor;
import com.google.gwt.dev.js.ast.JsProgram;
-import com.google.gwt.dev.js.ast.JsStatement;
import com.google.gwt.dev.js.ast.JsVars;
import com.google.gwt.dev.js.ast.JsVars.JsVar;
@@ -31,7 +30,7 @@
/**
* Divides large var statements into smaller ones. Very long var statements have
- * trouble on some browsers, including the initial Safari 4 beta. See Issue
+ * trouble on some browsers, including the initial Safari 4 beta. See Issue
* 3455.
*/
public class JsBreakUpLargeVarStatements extends JsModVisitor {
@@ -52,7 +51,7 @@
}
@Override
- public void endVisit(JsVars x, JsContext<JsStatement> context) {
+ public void endVisit(JsVars x, JsContext context) {
if (maxVarsPerStatement < 0) {
return;
}
diff --git a/dev/core/src/com/google/gwt/dev/js/JsCoerceIntShift.java b/dev/core/src/com/google/gwt/dev/js/JsCoerceIntShift.java
index 9ede191..631ff92 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsCoerceIntShift.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsCoerceIntShift.java
@@ -30,10 +30,10 @@
import com.google.gwt.dev.js.ast.JsUnaryOperator;
/**
- * Coerces lhs of right shift operations to int. Necessary for Safari 5 bug
+ * Coerces lhs of right shift operations to int. Necessary for Safari 5 bug
* https://bugs.webkit.org/show_bug.cgi?id=40367 fixed in
* http://trac.webkit.org/changeset/60990 -- this should be removed once that
- * fix has been pushed.
+ * fix has been pushed.
*/
public class JsCoerceIntShift {
// TODO(jat): remove this once Safari 5 has the update
@@ -44,18 +44,18 @@
private static class MyVisitor extends JsModVisitor {
@Override
- public void endVisit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsBinaryOperation x, JsContext ctx) {
JsBinaryOperator op = x.getOperator();
if (op != JsBinaryOperator.SHR && op != JsBinaryOperator.SHRU) {
return;
}
-
+
SourceInfo sourceInfo = x.getSourceInfo();
JsExpression lhs = x.getArg1();
JsExpression rhs = x.getArg2();
JsExpression newNode = new JsBinaryOperation(sourceInfo, op,
new JsPrefixOperation(sourceInfo, JsUnaryOperator.BIT_NOT,
- new JsPrefixOperation(sourceInfo, JsUnaryOperator.BIT_NOT, lhs)),
+ new JsPrefixOperation(sourceInfo, JsUnaryOperator.BIT_NOT, lhs)),
rhs);
ctx.replaceMe(newNode);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/JsConstructExpressionVisitor.java b/dev/core/src/com/google/gwt/dev/js/JsConstructExpressionVisitor.java
index 5cd7e73..6d133cc 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsConstructExpressionVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsConstructExpressionVisitor.java
@@ -51,7 +51,7 @@
* We only look at the array expression since the index has its own scope.
*/
@Override
- public boolean visit(JsArrayAccess x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsArrayAccess x, JsContext ctx) {
accept(x.getArrayExpr());
return false;
}
@@ -60,7 +60,7 @@
* Array literals have their own scoping.
*/
@Override
- public boolean visit(JsArrayLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsArrayLiteral x, JsContext ctx) {
return false;
}
@@ -68,18 +68,18 @@
* Functions have their own scoping.
*/
@Override
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsInvocation x, JsContext ctx) {
containsInvocation = true;
return false;
}
@Override
- public boolean visit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNameRef x, JsContext ctx) {
if (!x.isLeaf()) {
accept(x.getQualifier());
}
@@ -90,7 +90,7 @@
* New constructs bind to the nearest set of parentheses.
*/
@Override
- public boolean visit(JsNew x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNew x, JsContext ctx) {
return false;
}
@@ -98,7 +98,7 @@
* Object literals have their own scope.
*/
@Override
- public boolean visit(JsObjectLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsObjectLiteral x, JsContext ctx) {
return false;
}
@@ -106,8 +106,8 @@
* We only look at nodes that would not normally be surrounded by parentheses.
*/
@SuppressWarnings("cast")
- @Override
- protected <T extends JsVisitable<T>> T doAccept(T node) {
+ @Override
+ protected <T extends JsVisitable> T doAccept(T node) {
/*
* Extra casts to Object to prevent 'inconvertible types' compile errors due
* to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6548436
diff --git a/dev/core/src/com/google/gwt/dev/js/JsDuplicateCaseFolder.java b/dev/core/src/com/google/gwt/dev/js/JsDuplicateCaseFolder.java
index 397894d..bbe8fe7 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsDuplicateCaseFolder.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsDuplicateCaseFolder.java
@@ -32,9 +32,9 @@
* Combine case labels with identical bodies. Case bodies that may fall through
* to the following case label and case bodies following a possible fallthrough
* are left undisturbed.
- *
+ *
* For example, consider the following input:
- *
+ *
* <pre>
* switch (x) {
* case 0: y = 17; break;
@@ -46,9 +46,9 @@
* case 6: return 22;
* }
* </pre>
- *
+ *
* This will be transformed into:
- *
+ *
* <pre>
* switch (x) {
* case 0: y = 17; break;
@@ -57,7 +57,7 @@
* case 3: if (z == 0) { y = 18; break; } else { y = 19 }
* case 5: case 4: y = 17; break;
* }
- *
+ *
* <pre>
*
* Cases (2, 6) and (4, 5) have been coalesced. Note that case 0 has not been
@@ -76,7 +76,7 @@
}
@Override
- public boolean visit(JsSwitch x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsSwitch x, JsContext ctx) {
boolean modified = false;
// A map from case body source code to the original case label
diff --git a/dev/core/src/com/google/gwt/dev/js/JsDuplicateFunctionRemover.java b/dev/core/src/com/google/gwt/dev/js/JsDuplicateFunctionRemover.java
index 93c8972..845ba4f 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsDuplicateFunctionRemover.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsDuplicateFunctionRemover.java
@@ -17,7 +17,6 @@
import com.google.gwt.dev.js.ast.JsBlock;
import com.google.gwt.dev.js.ast.JsContext;
-import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsFunction;
import com.google.gwt.dev.js.ast.JsInvocation;
import com.google.gwt.dev.js.ast.JsModVisitor;
@@ -57,19 +56,19 @@
}
@Override
- public void endVisit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsInvocation x, JsContext ctx) {
if (x.getQualifier() instanceof JsNameRef) {
invocationQualifiers.pop();
}
}
@Override
- public void endVisit(JsNameOf x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameOf x, JsContext ctx) {
dontReplace.add(x.getName());
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
if (x != invocationQualifiers.peek()) {
if (x.getName() != null) {
dontReplace.add(x.getName());
@@ -86,7 +85,7 @@
}
@Override
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
/*
* Don't process anonymous functions.
*/
@@ -104,7 +103,7 @@
}
@Override
- public boolean visit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsInvocation x, JsContext ctx) {
if (x.getQualifier() instanceof JsNameRef) {
invocationQualifiers.push((JsNameRef) x.getQualifier());
}
@@ -125,7 +124,7 @@
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
JsName orig = duplicateMap.get(x.getName());
if (orig != null && x.getName() != null
&& x.getName().getEnclosing() == program.getScope()
diff --git a/dev/core/src/com/google/gwt/dev/js/JsFirstExpressionVisitor.java b/dev/core/src/com/google/gwt/dev/js/JsFirstExpressionVisitor.java
index 04e6860..ce86371 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsFirstExpressionVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsFirstExpressionVisitor.java
@@ -74,42 +74,42 @@
}
@Override
- public boolean visit(JsArrayAccess x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsArrayAccess x, JsContext ctx) {
accept(x.getArrayExpr());
return false;
}
@Override
- public boolean visit(JsArrayLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsArrayLiteral x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsBinaryOperation x, JsContext ctx) {
accept(x.getArg1());
return false;
}
@Override
- public boolean visit(JsConditional x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsConditional x, JsContext ctx) {
accept(x.getTestExpression());
return false;
}
@Override
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
needsParentheses = true;
return false;
}
@Override
- public boolean visit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsInvocation x, JsContext ctx) {
accept(x.getQualifier());
return false;
}
@Override
- public boolean visit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNameRef x, JsContext ctx) {
if (!x.isLeaf()) {
accept(x.getQualifier());
}
@@ -117,29 +117,29 @@
}
@Override
- public boolean visit(JsNew x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNew x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsObjectLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsObjectLiteral x, JsContext ctx) {
needsParentheses = true;
return false;
}
@Override
- public boolean visit(JsPostfixOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsPostfixOperation x, JsContext ctx) {
accept(x.getArg());
return false;
}
@Override
- public boolean visit(JsPrefixOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsPrefixOperation x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsRegExp x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsRegExp x, JsContext ctx) {
return false;
}
}
diff --git a/dev/core/src/com/google/gwt/dev/js/JsHoister.java b/dev/core/src/com/google/gwt/dev/js/JsHoister.java
index 28cefe8..2917644 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsHoister.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsHoister.java
@@ -61,7 +61,7 @@
private boolean successful = true;
@Override
- public void endVisit(JsArrayAccess x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsArrayAccess x, JsContext ctx) {
JsArrayAccess newExpression = new JsArrayAccess(x.getSourceInfo());
newExpression.setIndexExpr(stack.pop());
newExpression.setArrayExpr(stack.pop());
@@ -69,7 +69,7 @@
}
@Override
- public void endVisit(JsArrayLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsArrayLiteral x, JsContext ctx) {
JsArrayLiteral toReturn = new JsArrayLiteral(x.getSourceInfo());
List<JsExpression> expressions = toReturn.getExpressions();
int size = x.getExpressions().size();
@@ -80,7 +80,7 @@
}
@Override
- public void endVisit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsBinaryOperation x, JsContext ctx) {
JsBinaryOperation toReturn = new JsBinaryOperation(x.getSourceInfo(),
x.getOperator());
toReturn.setArg2(stack.pop());
@@ -89,12 +89,12 @@
}
@Override
- public void endVisit(JsBooleanLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsBooleanLiteral x, JsContext ctx) {
stack.push(x);
}
@Override
- public void endVisit(JsConditional x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsConditional x, JsContext ctx) {
JsConditional toReturn = new JsConditional(x.getSourceInfo());
toReturn.setElseExpression(stack.pop());
toReturn.setThenExpression(stack.pop());
@@ -107,7 +107,7 @@
* first-class objects.
*/
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
// Set a flag to indicate that we cannot continue, and push a null so
// we don't run out of elements on the stack.
successful = false;
@@ -119,7 +119,7 @@
* sites.
*/
@Override
- public void endVisit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsInvocation x, JsContext ctx) {
JsInvocation toReturn = new JsInvocation(x.getSourceInfo());
List<JsExpression> params = toReturn.getArguments();
int size = x.getArguments().size();
@@ -131,7 +131,7 @@
}
@Override
- public void endVisit(JsNameOf x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameOf x, JsContext ctx) {
JsNameOf toReturn = new JsNameOf(x.getSourceInfo(), x.getName());
stack.push(toReturn);
}
@@ -142,7 +142,7 @@
* re-writing an invocation.
*/
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
JsNameRef toReturn = new JsNameRef(x.getSourceInfo(), x.getName());
if (x.getQualifier() != null) {
@@ -152,7 +152,7 @@
}
@Override
- public void endVisit(JsNew x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNew x, JsContext ctx) {
int size = x.getArguments().size();
List<JsExpression> arguments = new ArrayList<JsExpression>(size);
while (size-- > 0) {
@@ -164,17 +164,17 @@
}
@Override
- public void endVisit(JsNullLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNullLiteral x, JsContext ctx) {
stack.push(x);
}
@Override
- public void endVisit(JsNumberLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNumberLiteral x, JsContext ctx) {
stack.push(x);
}
@Override
- public void endVisit(JsObjectLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsObjectLiteral x, JsContext ctx) {
JsObjectLiteral toReturn = new JsObjectLiteral(x.getSourceInfo());
List<JsPropertyInitializer> inits = toReturn.getPropertyInitializers();
@@ -197,7 +197,7 @@
}
@Override
- public void endVisit(JsPostfixOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsPostfixOperation x, JsContext ctx) {
JsPostfixOperation toReturn = new JsPostfixOperation(x.getSourceInfo(),
x.getOperator());
toReturn.setArg(stack.pop());
@@ -205,7 +205,7 @@
}
@Override
- public void endVisit(JsPrefixOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsPrefixOperation x, JsContext ctx) {
JsPrefixOperation toReturn = new JsPrefixOperation(x.getSourceInfo(),
x.getOperator());
toReturn.setArg(stack.pop());
@@ -213,17 +213,17 @@
}
@Override
- public void endVisit(JsRegExp x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsRegExp x, JsContext ctx) {
stack.push(x);
}
@Override
- public void endVisit(JsStringLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsStringLiteral x, JsContext ctx) {
stack.push(x);
}
@Override
- public void endVisit(JsThisRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsThisRef x, JsContext ctx) {
stack.push(new JsThisRef(x.getSourceInfo()));
}
diff --git a/dev/core/src/com/google/gwt/dev/js/JsIEBlockSizeVisitor.java b/dev/core/src/com/google/gwt/dev/js/JsIEBlockSizeVisitor.java
index 8ff10c1..55226f7 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsIEBlockSizeVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsIEBlockSizeVisitor.java
@@ -22,7 +22,6 @@
import com.google.gwt.dev.js.ast.JsDefault;
import com.google.gwt.dev.js.ast.JsProgram;
import com.google.gwt.dev.js.ast.JsStatement;
-import com.google.gwt.dev.js.ast.JsSwitchMember;
import com.google.gwt.dev.js.ast.JsVisitor;
import java.util.List;
@@ -33,7 +32,7 @@
* within a JsBlock. This visitor will restructure blocks and other block-like
* structures with too many statements in order to reduce the total number of
* statements that appear within any given block to fewer than
- * {@value #MAX_BLOCK_SIZE} statements by creating nested blocks:
+ * {@value #MAX_BLOCK_SIZE} statements by creating nested blocks:
*
* <pre>
* {
@@ -59,7 +58,7 @@
}
@Override
- public void endVisit(JsBlock x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsBlock x, JsContext ctx) {
// JsFunctionClusterer handles restructuring top-level statement blocks
if (!x.isGlobalBlock()) {
restructure(x.getStatements());
@@ -67,12 +66,12 @@
}
@Override
- public void endVisit(JsCase x, JsContext<JsSwitchMember> ctx) {
+ public void endVisit(JsCase x, JsContext ctx) {
restructure(x.getStmts());
}
@Override
- public void endVisit(JsDefault x, JsContext<JsSwitchMember> ctx) {
+ public void endVisit(JsDefault x, JsContext ctx) {
restructure(x.getStmts());
}
diff --git a/dev/core/src/com/google/gwt/dev/js/JsInliner.java b/dev/core/src/com/google/gwt/dev/js/JsInliner.java
index 2469762..55ab2fc 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsInliner.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsInliner.java
@@ -54,7 +54,6 @@
import com.google.gwt.dev.js.ast.JsScope;
import com.google.gwt.dev.js.ast.JsStatement;
import com.google.gwt.dev.js.ast.JsStringLiteral;
-import com.google.gwt.dev.js.ast.JsSwitchMember;
import com.google.gwt.dev.js.ast.JsThisRef;
import com.google.gwt.dev.js.ast.JsVars;
import com.google.gwt.dev.js.ast.JsVars.JsVar;
@@ -103,17 +102,17 @@
}
@Override
- public void endVisit(JsArrayLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsArrayLiteral x, JsContext ctx) {
affectedBySideEffects = true;
}
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
affectedBySideEffects = true;
}
@Override
- public void endVisit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsInvocation x, JsContext ctx) {
/*
* We could make this more accurate by analyzing the function that's being
* executed, but we'll bank on subsequent passes inlining simple function
@@ -123,7 +122,7 @@
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
if (x.getQualifier() == null && x.getName() != null) {
// Special case the undefined literal.
if (x.getName() == program.getUndefinedLiteral().getName()) {
@@ -143,7 +142,7 @@
}
@Override
- public void endVisit(JsObjectLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsObjectLiteral x, JsContext ctx) {
affectedBySideEffects = true;
}
}
@@ -183,7 +182,7 @@
}
@Override
- public void endVisit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsBinaryOperation x, JsContext ctx) {
if (isComma(x) == null) {
return;
}
@@ -280,87 +279,87 @@
private int complexity = 0;
@Override
- public void endVisit(JsArrayAccess x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsArrayAccess x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsArrayLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsArrayLiteral x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsBinaryOperation x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsBooleanLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsBooleanLiteral x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsConditional x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsConditional x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsInvocation x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsNew x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNew x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsNullLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNullLiteral x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsNumberLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNumberLiteral x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsObjectLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsObjectLiteral x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsPostfixOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsPostfixOperation x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsPrefixOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsPrefixOperation x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsRegExp x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsRegExp x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsStringLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsStringLiteral x, JsContext ctx) {
complexity++;
}
@Override
- public void endVisit(JsThisRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsThisRef x, JsContext ctx) {
complexity++;
}
@@ -406,7 +405,7 @@
* conditional-evaluation case of logical and/or operations.
*/
@Override
- public boolean visit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsBinaryOperation x, JsContext ctx) {
if (x.getOperator() == JsBinaryOperator.COMMA) {
boolean left = isDuplicateCall(x.getArg1());
@@ -458,20 +457,20 @@
* subtypes.
*/
@Override
- public boolean visit(JsBlock x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsBlock x, JsContext ctx) {
branch(x.getStatements());
return false;
}
@Override
- public boolean visit(JsCase x, JsContext<JsSwitchMember> ctx) {
+ public boolean visit(JsCase x, JsContext ctx) {
x.setCaseExpr(accept(x.getCaseExpr()));
branch(x.getStmts());
return false;
}
@Override
- public boolean visit(JsConditional x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsConditional x, JsContext ctx) {
x.setTestExpression(accept(x.getTestExpression()));
x.setThenExpression(branch(x.getThenExpression()));
x.setElseExpression(branch(x.getElseExpression()));
@@ -479,13 +478,13 @@
}
@Override
- public boolean visit(JsDefault x, JsContext<JsSwitchMember> ctx) {
+ public boolean visit(JsDefault x, JsContext ctx) {
branch(x.getStmts());
return false;
}
@Override
- public boolean visit(JsExprStmt x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsExprStmt x, JsContext ctx) {
if (isDuplicateCall(x.getExpression())) {
if (ctx.canRemove()) {
ctx.removeMe();
@@ -500,7 +499,7 @@
}
@Override
- public boolean visit(JsFor x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsFor x, JsContext ctx) {
// The JsFor may have an expression xor a variable declaration.
if (x.getInitExpr() != null) {
x.setInitExpr(accept(x.getInitExpr()));
@@ -524,7 +523,7 @@
}
@Override
- public boolean visit(JsForIn x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsForIn x, JsContext ctx) {
if (x.getIterExpr() != null) {
x.setIterExpr(accept(x.getIterExpr()));
}
@@ -537,7 +536,7 @@
}
@Override
- public boolean visit(JsIf x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsIf x, JsContext ctx) {
x.setIfExpr(accept(x.getIfExpr()));
x.setThenStmt(branch(x.getThenStmt()));
@@ -552,7 +551,7 @@
* Possibly record that we've seen a call in the current context.
*/
@Override
- public boolean visit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsInvocation x, JsContext ctx) {
JsFunction func = isExecuteOnce(x);
while (func != null) {
called.add(func);
@@ -562,7 +561,7 @@
}
@Override
- public boolean visit(JsWhile x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsWhile x, JsContext ctx) {
x.setCondition(accept(x.getCondition()));
// The body is not guaranteed to be a JsBlock
@@ -570,13 +569,13 @@
return false;
}
- private <T extends JsNode<T>> void branch(List<T> x) {
+ private <T extends JsNode> void branch(List<T> x) {
DuplicateXORemover dup = new DuplicateXORemover(program, called);
dup.acceptWithInsertRemove(x);
didChange |= dup.didChange();
}
- private <T extends JsNode<T>> T branch(T x) {
+ private <T extends JsNode> T branch(T x) {
DuplicateXORemover dup = new DuplicateXORemover(program, called);
T toReturn = dup.accept(x);
@@ -618,7 +617,7 @@
}
@Override
- public void endVisit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsBinaryOperation x, JsContext ctx) {
JsBinaryOperator op = x.getOperator();
/*
@@ -639,7 +638,7 @@
* don't allow inlining.
*/
@Override
- public void endVisit(JsConditional x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsConditional x, JsContext ctx) {
boolean thenStrict = refersToRequiredName(x.getThenExpression());
boolean elseStrict = refersToRequiredName(x.getElseExpression());
@@ -654,7 +653,7 @@
* just ignore them.
*/
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
maintainsOrder = false;
}
@@ -668,7 +667,7 @@
* nested invocation.
*/
@Override
- public void endVisit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsInvocation x, JsContext ctx) {
/*
* The check for isExecuteOnce() is potentially incorrect here, however
* the original Java semantics of the clinit would have made the code
@@ -678,23 +677,21 @@
maintainsOrder = false;
}
}
-
+
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
checkName(x.getName());
}
@Override
- public void endVisit(JsNew x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNew x, JsContext ctx) {
/*
- * Unless all arguments have already been evaluated, assume
- * that invoking the new expression might interfere with
- * the evaluation of the argument.
- *
- * It would be possible to allow this if the invoked function
- * either does nothing or does nothing that affects the
- * remaining arguments. However, currently there is no
- * analysis of the invoked function.
+ * Unless all arguments have already been evaluated, assume that invoking
+ * the new expression might interfere with the evaluation of the argument.
+ *
+ * It would be possible to allow this if the invoked function either does
+ * nothing or does nothing that affects the remaining arguments. However,
+ * currently there is no analysis of the invoked function.
*/
if (unevaluated.size() > 0) {
maintainsOrder = false;
@@ -702,7 +699,7 @@
}
@Override
- public void endVisit(JsThisRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsThisRef x, JsContext ctx) {
checkName(THIS_NAME);
}
@@ -743,7 +740,7 @@
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
boolean hasQualifier = x.getQualifier() != null;
if ((collectQualified && !hasQualifier)
@@ -811,7 +808,7 @@
* removes statements with no side-effects.
*/
@Override
- public void endVisit(JsExprStmt x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsExprStmt x, JsContext ctx) {
JsExpression e = x.getExpression();
// We will occasionally create JsExprStmts that have no side-effects.
@@ -889,7 +886,7 @@
}
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
if (!functionStack.pop().equals(x)) {
throw new InternalCompilerException("Unexpected function popped");
}
@@ -901,7 +898,7 @@
}
@Override
- public void endVisit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsInvocation x, JsContext ctx) {
if (functionStack.isEmpty()) {
return;
}
@@ -972,7 +969,7 @@
}
@Override
- public void endVisit(JsProgramFragment x, JsContext<JsProgramFragment> ctx) {
+ public void endVisit(JsProgramFragment x, JsContext ctx) {
if (!functionStack.pop().equals(programFunction)) {
throw new InternalCompilerException("Unexpected function popped");
}
@@ -984,7 +981,7 @@
}
@Override
- public boolean visit(JsExprStmt x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsExprStmt x, JsContext ctx) {
if (functionStack.peek() == programFunction) {
/* Don't inline top-level invocations. */
if (x.getExpression() instanceof JsInvocation) {
@@ -995,7 +992,7 @@
}
@Override
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
functionStack.push(x);
newLocalVariableStack.push(new ArrayList<JsName>());
return true;
@@ -1006,7 +1003,7 @@
* top-level of the program.
*/
@Override
- public boolean visit(JsProgramFragment x, JsContext<JsProgramFragment> ctx) {
+ public boolean visit(JsProgramFragment x, JsContext ctx) {
programFunction = new JsFunction(program.getSourceInfo(),
program.getScope());
programFunction.setBody(new JsBlock(x.getSourceInfo()));
@@ -1222,12 +1219,12 @@
private final Map<JsFunction, Integer> invocationCount = new IdentityHashMap<JsFunction, Integer>();
@Override
- public void endVisit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsInvocation x, JsContext ctx) {
checkFunctionCall(x.getQualifier());
}
@Override
- public void endVisit(JsNew x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNew x, JsContext ctx) {
checkFunctionCall(x.getConstructorExpression());
}
@@ -1306,7 +1303,7 @@
* into the function invocation.
*/
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
if (x.getQualifier() != null) {
return;
}
@@ -1321,7 +1318,7 @@
}
@Override
- public void endVisit(JsThisRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsThisRef x, JsContext ctx) {
assert thisExpr != null;
ctx.replaceMe(thisExpr);
}
@@ -1374,7 +1371,7 @@
}
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
containsNestedFunctions = true;
}
}
@@ -1396,14 +1393,14 @@
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
if (ctx.isLvalue() && isParameter(x)) {
violation = true;
}
}
@Override
- public void endVisit(JsThisRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsThisRef x, JsContext ctx) {
if (!hasThisExpr) {
violation = true;
}
@@ -1437,14 +1434,14 @@
private final Set<JsFunction> recursive = new HashSet<JsFunction>();
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
if (!functionStack.pop().equals(x)) {
throw new InternalCompilerException("Unexpected function popped");
}
}
@Override
- public void endVisit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsInvocation x, JsContext ctx) {
/*
* Because functions can encapsulate other functions, we look at the
* entire stack and not just the top element. This would prevent inlining
@@ -1464,7 +1461,7 @@
}
@Override
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
functionStack.push(x);
return true;
}
@@ -1484,7 +1481,7 @@
* Look for assignments to JsNames whose static references are JsFunctions.
*/
@Override
- public void endVisit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsBinaryOperation x, JsContext ctx) {
if (!x.getOperator().equals(JsBinaryOperator.ASG)) {
return;
@@ -1501,7 +1498,7 @@
* existing function.
*/
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
JsName name = x.getName();
if (name == null) {
@@ -1539,7 +1536,7 @@
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
JsName name = x.getName();
if (name == null) {
@@ -1577,7 +1574,7 @@
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
/*
* We can ignore qualified reference, since their scope is always that of
* the qualifier.
@@ -1627,8 +1624,8 @@
* Static entry point used by JavaToJavaScriptCompiler.
*/
public static OptimizerStats exec(JsProgram program) {
- Event optimizeJsEvent = SpeedTracerLogger.start(CompilerEventType.OPTIMIZE_JS,
- "optimizer", NAME);
+ Event optimizeJsEvent = SpeedTracerLogger.start(
+ CompilerEventType.OPTIMIZE_JS, "optimizer", NAME);
OptimizerStats stats = execImpl(program);
optimizeJsEvent.end("didChange", "" + stats.didChange());
return stats;
@@ -1658,7 +1655,7 @@
/**
* Generate an estimated measure of the syntactic complexity of a JsNode.
*/
- private static int complexity(JsNode<?> toEstimate) {
+ private static int complexity(JsNode toEstimate) {
ComplexityEstimator e = new ComplexityEstimator();
e.accept(toEstimate);
return e.getComplexity();
@@ -1708,7 +1705,7 @@
* that refer to function parameters.
*/
private static boolean hasCommonIdents(List<JsExpression> arguments,
- JsNode<?> toInline, Collection<String> parameterIdents) {
+ JsNode toInline, Collection<String> parameterIdents) {
// This is a fire-twice loop
boolean checkQualified = false;
@@ -1833,8 +1830,6 @@
* Given an expression, determine if it it is a JsNameRef that refers to a
* statically-defined JsFunction.
*/
- // Javac 1.6.0_01 barfs if staticRef is a JsNode<?>
- @SuppressWarnings("unchecked")
private static JsFunction isFunction(JsExpression e) {
if (e instanceof JsNameRef) {
JsNameRef ref = (JsNameRef) e;
@@ -1860,7 +1855,7 @@
*/
private static boolean isInlinable(JsProgram program, JsFunction caller,
JsFunction callee, JsExpression thisExpr, List<JsExpression> arguments,
- JsNode<?> toInline) {
+ JsNode toInline) {
/*
* This will happen with varargs-style JavaScript functions that rely on the
diff --git a/dev/core/src/com/google/gwt/dev/js/JsKeywords.java b/dev/core/src/com/google/gwt/dev/js/JsKeywords.java
index e830b0b..69afdcf 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsKeywords.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsKeywords.java
@@ -34,7 +34,7 @@
}
private static synchronized void initJavaScriptKeywords() {
- String[] keywords = new String[] {
+ String[] keywords = new String[]{
// These are current keywords
//
"break", "delete", "function", "return", "typeof", "case", "do", "if",
diff --git a/dev/core/src/com/google/gwt/dev/js/JsNormalizer.java b/dev/core/src/com/google/gwt/dev/js/JsNormalizer.java
index 32bfc94..f7999e2 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsNormalizer.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsNormalizer.java
@@ -30,9 +30,8 @@
* Fixes any semantic errors introduced by JS AST gen.
*
* <ul>
- * <li> Creating clinit calls can put comma expressions as lvalues; the
- * modifying operation must be moved inside the comma expression to the last
- * argument. </li>
+ * <li>Creating clinit calls can put comma expressions as lvalues; the modifying
+ * operation must be moved inside the comma expression to the last argument.</li>
* </ul>
*/
public class JsNormalizer {
@@ -43,17 +42,17 @@
private static class JsNormalizing extends JsModVisitor {
@Override
- public void endVisit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsBinaryOperation x, JsContext ctx) {
maybeShuffleModifyingBinary(x, ctx);
}
@Override
- public void endVisit(JsPostfixOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsPostfixOperation x, JsContext ctx) {
maybeShuffleModifyingUnary(x, ctx);
}
@Override
- public void endVisit(JsPrefixOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsPrefixOperation x, JsContext ctx) {
maybeShuffleModifyingUnary(x, ctx);
}
@@ -62,8 +61,7 @@
* operation as the argument to a modifying operation, which is illegal.
* Juggle things to put the operator inside of the comma expression.
*/
- private void maybeShuffleModifyingBinary(JsBinaryOperation x,
- JsContext<JsExpression> ctx) {
+ private void maybeShuffleModifyingBinary(JsBinaryOperation x, JsContext ctx) {
JsBinaryOperator myOp = x.getOperator();
JsExpression lhs = x.getArg1();
@@ -88,8 +86,7 @@
* operation as the argument to a modifying operation, which is illegal.
* Juggle things to put the operator inside of the comma expression.
*/
- private void maybeShuffleModifyingUnary(JsUnaryOperation x,
- JsContext<JsExpression> ctx) {
+ private void maybeShuffleModifyingUnary(JsUnaryOperation x, JsContext ctx) {
JsUnaryOperator myOp = x.getOperator();
JsExpression arg = x.getArg();
if (myOp.isModifying() && (arg instanceof JsBinaryOperation)) {
diff --git a/dev/core/src/com/google/gwt/dev/js/JsObfuscateNamer.java b/dev/core/src/com/google/gwt/dev/js/JsObfuscateNamer.java
index 7ff5f6b..90f125e 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsObfuscateNamer.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsObfuscateNamer.java
@@ -32,13 +32,13 @@
/**
* A lookup table of base-64 chars we use to encode idents.
*/
- private static final char[] sBase64Chars = new char[] {
+ private static final char[] sBase64Chars = new char[]{
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B',
'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '$', '_', '0', '1',
'2', '3', '4', '5', '6', '7', '8', '9'};
-
+
public static void exec(JsProgram program) {
new JsObfuscateNamer(program).execImpl();
}
diff --git a/dev/core/src/com/google/gwt/dev/js/JsParser.java b/dev/core/src/com/google/gwt/dev/js/JsParser.java
index 8e4eb19..f1bdb2d 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsParser.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsParser.java
@@ -160,7 +160,7 @@
return toReturn;
}
- private JsNode<?> map(Node node) throws JsParserException {
+ private JsNode map(Node node) throws JsParserException {
switch (node.getType()) {
case TokenStream.SCRIPT: {
@@ -237,8 +237,9 @@
return mapConditional(node);
case TokenStream.STRING:
- return program.getStringLiteral(sourceInfoStack.peek().makeChild(
- JsParser.class, "JS String literal"), node.getString());
+ return program.getStringLiteral(
+ sourceInfoStack.peek().makeChild(JsParser.class,
+ "JS String literal"), node.getString());
case TokenStream.NUMBER:
return mapNumber(node);
@@ -350,8 +351,6 @@
*/
private JsNameRef mapAsPropertyNameRef(Node nameRefNode)
throws JsParserException {
- // Javac 1.6.0_01 doesn't like the cast below if this is parameterized
- @SuppressWarnings("unchecked")
JsNode unknown = map(nameRefNode);
// This is weird, but for "a.b", the rhino AST calls "b" a string literal.
// However, since we know it's for a PROPGET, we can unstringliteralize it.
@@ -577,8 +576,6 @@
}
private JsExpression mapExpression(Node exprNode) throws JsParserException {
- // Javac 1.6.0_01 doesn't like the cast below if this is parameterized
- @SuppressWarnings("unchecked")
JsNode unknown = map(exprNode);
if (unknown instanceof JsExpression) {
return (JsExpression) unknown;
@@ -646,8 +643,6 @@
JsFor toFor = new JsFor(makeSourceInfo(forNode));
// The first item is either an expression or a JsVars.
- // Javac 1.6.0_01 doesn't like the cast below if this is parameterized
- @SuppressWarnings("unchecked")
JsNode initThingy = map(fromInit);
if (initThingy != null) {
if (initThingy instanceof JsVars) {
@@ -782,8 +777,8 @@
case TokenStream.POST:
return mapPostfixOperation(op, node);
default:
- throw createParserException("Unknown prefix/postfix variant: "
- + node.getIntDatum(), node);
+ throw createParserException(
+ "Unknown prefix/postfix variant: " + node.getIntDatum(), node);
}
}
@@ -861,8 +856,6 @@
private JsExpression mapOptionalExpression(Node exprNode)
throws JsParserException {
- // Javac 1.6.0_01 doesn't like the cast below if this is parameterized
- @SuppressWarnings("unchecked")
JsNode unknown = map(exprNode);
if (unknown != null) {
if (unknown instanceof JsExpression) {
@@ -911,7 +904,7 @@
}
}
- private JsNode<?> mapRegExp(Node regExpNode) {
+ private JsNode mapRegExp(Node regExpNode) {
JsRegExp toRegExp = new JsRegExp(makeSourceInfo(regExpNode));
Node fromPattern = regExpNode.getFirstChild();
@@ -1012,8 +1005,6 @@
}
private JsStatement mapStatement(Node nodeStmt) throws JsParserException {
- // Javac 1.6.0_01 doesn't like the cast below if this is parameterized
- @SuppressWarnings("unchecked")
JsNode unknown = map(nodeStmt);
if (unknown != null) {
if (unknown instanceof JsStatement) {
@@ -1201,8 +1192,8 @@
return mapPrefixOperation(JsUnaryOperator.VOID, unOp);
default:
- throw createParserException("Unknown unary operator variant: "
- + unOp.getIntDatum(), unOp);
+ throw createParserException(
+ "Unknown unary operator variant: " + unOp.getIntDatum(), unOp);
}
}
@@ -1234,7 +1225,7 @@
return toVars;
}
- private JsNode<?> mapWithStatement(Node withNode) throws JsParserException {
+ private JsNode mapWithStatement(Node withNode) throws JsParserException {
// The "with" statement is unsupported because it introduces ambiguity
// related to whether or not a name is obfuscatable that we cannot resolve
// statically. This is modified in our copy of the Rhino Parser to provide
diff --git a/dev/core/src/com/google/gwt/dev/js/JsPrecedenceVisitor.java b/dev/core/src/com/google/gwt/dev/js/JsPrecedenceVisitor.java
index 36b7b6d..49bf02b 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsPrecedenceVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsPrecedenceVisitor.java
@@ -51,17 +51,15 @@
import com.google.gwt.dev.js.ast.JsPropertyInitializer;
import com.google.gwt.dev.js.ast.JsRegExp;
import com.google.gwt.dev.js.ast.JsReturn;
-import com.google.gwt.dev.js.ast.JsStatement;
import com.google.gwt.dev.js.ast.JsStringLiteral;
import com.google.gwt.dev.js.ast.JsSwitch;
-import com.google.gwt.dev.js.ast.JsSwitchMember;
import com.google.gwt.dev.js.ast.JsThisRef;
import com.google.gwt.dev.js.ast.JsThrow;
import com.google.gwt.dev.js.ast.JsTry;
import com.google.gwt.dev.js.ast.JsVars;
+import com.google.gwt.dev.js.ast.JsVars.JsVar;
import com.google.gwt.dev.js.ast.JsVisitor;
import com.google.gwt.dev.js.ast.JsWhile;
-import com.google.gwt.dev.js.ast.JsVars.JsVar;
/**
* Precedence indices from "JavaScript - The Definitive Guide" 4th Edition (page
@@ -103,125 +101,125 @@
}
@Override
- public boolean visit(JsArrayAccess x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsArrayAccess x, JsContext ctx) {
answer = 16;
return false;
}
@Override
- public boolean visit(JsArrayLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsArrayLiteral x, JsContext ctx) {
answer = 17; // primary
return false;
}
@Override
- public boolean visit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsBinaryOperation x, JsContext ctx) {
answer = x.getOperator().getPrecedence();
return false;
}
@Override
- public boolean visit(JsBlock x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsBlock x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsBooleanLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsBooleanLiteral x, JsContext ctx) {
answer = 17; // primary
return false;
}
@Override
- public boolean visit(JsBreak x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsBreak x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsCase x, JsContext<JsSwitchMember> ctx) {
+ public boolean visit(JsCase x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsCatch x, JsContext<JsCatch> ctx) {
+ public boolean visit(JsCatch x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsConditional x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsConditional x, JsContext ctx) {
answer = 3;
return false;
}
@Override
- public boolean visit(JsContinue x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsContinue x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsDebugger x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsDebugger x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsDefault x, JsContext<JsSwitchMember> ctx) {
+ public boolean visit(JsDefault x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsDoWhile x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsDoWhile x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsEmpty x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsEmpty x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsExprStmt x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsExprStmt x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsFor x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsFor x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsForIn x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsForIn x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
answer = 17; // primary
return false;
}
@Override
- public boolean visit(JsIf x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsIf x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsInvocation x, JsContext ctx) {
answer = 16;
return false;
}
@Override
- public boolean visit(JsLabel x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsLabel x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsNameOf x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNameOf x, JsContext ctx) {
answer = 17; // Similar to string literal
return false;
}
@Override
- public boolean visit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNameRef x, JsContext ctx) {
if (x.isLeaf()) {
answer = 17; // primary
} else {
@@ -231,108 +229,107 @@
}
@Override
- public boolean visit(JsNew x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNew x, JsContext ctx) {
answer = PRECEDENCE_NEW;
return false;
}
@Override
- public boolean visit(JsNullLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNullLiteral x, JsContext ctx) {
answer = 17; // primary
return false;
}
@Override
- public boolean visit(JsNumberLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNumberLiteral x, JsContext ctx) {
answer = 17; // primary
return false;
}
@Override
- public boolean visit(JsObjectLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsObjectLiteral x, JsContext ctx) {
answer = 17; // primary
return false;
}
@Override
- public boolean visit(JsParameter x, JsContext<JsParameter> ctx) {
+ public boolean visit(JsParameter x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsPostfixOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsPostfixOperation x, JsContext ctx) {
answer = x.getOperator().getPrecedence();
return false;
}
@Override
- public boolean visit(JsPrefixOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsPrefixOperation x, JsContext ctx) {
answer = x.getOperator().getPrecedence();
return false;
}
@Override
- public boolean visit(JsProgram x, JsContext<JsProgram> ctx) {
+ public boolean visit(JsProgram x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsPropertyInitializer x,
- JsContext<JsPropertyInitializer> ctx) {
+ public boolean visit(JsPropertyInitializer x, JsContext ctx) {
answer = 17; // primary
return false;
}
@Override
- public boolean visit(JsRegExp x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsRegExp x, JsContext ctx) {
answer = 17; // primary
return false;
}
@Override
- public boolean visit(JsReturn x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsReturn x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsStringLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsStringLiteral x, JsContext ctx) {
answer = 17; // primary
return false;
}
@Override
- public boolean visit(JsSwitch x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsSwitch x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsThisRef x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsThisRef x, JsContext ctx) {
answer = 17; // primary
return false;
}
@Override
- public boolean visit(JsThrow x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsThrow x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsTry x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsTry x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsVar x, JsContext<JsVar> ctx) {
+ public boolean visit(JsVar x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsVars x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsVars x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
@Override
- public boolean visit(JsWhile x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsWhile x, JsContext ctx) {
throw new RuntimeException("Only expressions have precedence.");
}
diff --git a/dev/core/src/com/google/gwt/dev/js/JsPrettyNamer.java b/dev/core/src/com/google/gwt/dev/js/JsPrettyNamer.java
index db47892..4019943 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsPrettyNamer.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsPrettyNamer.java
@@ -42,13 +42,12 @@
private Set<String> childIdents = null;
private final JsProgram program;
-
+
/**
- * A map containing the next integer to try as an identifier suffix for
- * a given JsScope.
+ * A map containing the next integer to try as an identifier suffix for a
+ * given JsScope.
*/
- private IdentityHashMap<JsScope,HashMap<String,Integer>> startIdentForScope =
- new IdentityHashMap<JsScope, HashMap<String,Integer>>();
+ private IdentityHashMap<JsScope, HashMap<String, Integer>> startIdentForScope = new IdentityHashMap<JsScope, HashMap<String, Integer>>();
public JsPrettyNamer(JsProgram program) {
this.program = program;
@@ -58,7 +57,8 @@
visit(program.getRootScope());
}
- private boolean isLegal(JsScope scope, Set<String> childIdents, String newIdent) {
+ private boolean isLegal(JsScope scope, Set<String> childIdents,
+ String newIdent) {
if (JsKeywords.isKeyword(newIdent)) {
return false;
}
@@ -75,12 +75,12 @@
}
private void visit(JsScope scope) {
- HashMap<String,Integer> startIdent = startIdentForScope.get(scope);
+ HashMap<String, Integer> startIdent = startIdentForScope.get(scope);
if (startIdent == null) {
- startIdent = new HashMap<String,Integer>();
+ startIdent = new HashMap<String, Integer>();
startIdentForScope.put(scope, startIdent);
}
-
+
// Save off the childIdents which is currently being computed for my parent.
Set<String> myChildIdents = childIdents;
@@ -111,7 +111,7 @@
String newIdent = name.getShortIdent();
if (!isLegal(scope, childIdents, newIdent)) {
String checkIdent;
-
+
// Start searching using a suffix hint stored in the scope.
// We still do a search in case there is a collision with
// a user-provided identifier
diff --git a/dev/core/src/com/google/gwt/dev/js/JsReportGenerationVisitor.java b/dev/core/src/com/google/gwt/dev/js/JsReportGenerationVisitor.java
index acfda17..8577578 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsReportGenerationVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsReportGenerationVisitor.java
@@ -31,7 +31,8 @@
* A variation on the standard source generation visitor that records the
* locations of SourceInfo objects in the output.
*/
-public class JsReportGenerationVisitor extends JsSourceGenerationVisitorWithSizeBreakdown {
+public class JsReportGenerationVisitor extends
+ JsSourceGenerationVisitorWithSizeBreakdown {
private final Map<Range, SourceInfo> sourceInfoMap = new HashMap<Range, SourceInfo>();
private final TextOutput out;
@@ -45,7 +46,7 @@
}
@Override
- protected <T extends JsVisitable<T>> T doAccept(T node) {
+ protected <T extends JsVisitable> T doAccept(T node) {
boolean addEntry = node instanceof HasSourceInfo;
int start = addEntry ? out.getPosition() : 0;
T toReturn = super.doAccept(node);
@@ -57,14 +58,14 @@
}
@Override
- protected <T extends JsVisitable<T>> void doAcceptList(List<T> collection) {
+ protected <T extends JsVisitable> void doAcceptList(List<T> collection) {
for (T t : collection) {
doAccept(t);
}
}
@Override
- protected <T extends JsVisitable<T>> void doAcceptWithInsertRemove(
+ protected <T extends JsVisitable> void doAcceptWithInsertRemove(
List<T> collection) {
for (T t : collection) {
doAccept(t);
diff --git a/dev/core/src/com/google/gwt/dev/js/JsRequiresSemiVisitor.java b/dev/core/src/com/google/gwt/dev/js/JsRequiresSemiVisitor.java
index 4db0c3c..e6f8d0c 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsRequiresSemiVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsRequiresSemiVisitor.java
@@ -64,37 +64,37 @@
}
@Override
- public boolean visit(JsBlock x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsBlock x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsBreak x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsBreak x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsDebugger x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsDebugger x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsDoWhile x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsDoWhile x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsEmpty x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsEmpty x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsExprStmt x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsExprStmt x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsFor x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsFor x, JsContext ctx) {
if (x.getBody() instanceof JsEmpty) {
needsSemicolon = true;
}
@@ -102,7 +102,7 @@
}
@Override
- public boolean visit(JsForIn x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsForIn x, JsContext ctx) {
if (x.getBody() instanceof JsEmpty) {
needsSemicolon = true;
}
@@ -110,7 +110,7 @@
}
@Override
- public boolean visit(JsIf x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsIf x, JsContext ctx) {
JsStatement thenStmt = x.getThenStmt();
JsStatement elseStmt = x.getElseStmt();
JsStatement toCheck = thenStmt;
@@ -127,7 +127,7 @@
}
@Override
- public boolean visit(JsLabel x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsLabel x, JsContext ctx) {
if (x.getStmt() instanceof JsEmpty) {
needsSemicolon = true;
}
@@ -135,32 +135,32 @@
}
@Override
- public boolean visit(JsReturn x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsReturn x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsSwitch x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsSwitch x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsThrow x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsThrow x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsTry x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsTry x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsVars x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsVars x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsWhile x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsWhile x, JsContext ctx) {
if (x.getBody() instanceof JsEmpty) {
needsSemicolon = true;
}
diff --git a/dev/core/src/com/google/gwt/dev/js/JsSourceGenerationVisitor.java b/dev/core/src/com/google/gwt/dev/js/JsSourceGenerationVisitor.java
index 5eea334..23f482f 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsSourceGenerationVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsSourceGenerationVisitor.java
@@ -19,7 +19,6 @@
import com.google.gwt.dev.js.ast.JsContext;
import com.google.gwt.dev.js.ast.JsProgram;
import com.google.gwt.dev.js.ast.JsProgramFragment;
-import com.google.gwt.dev.js.ast.JsStatement;
import com.google.gwt.dev.util.TextOutput;
/**
@@ -33,10 +32,10 @@
public JsSourceGenerationVisitor(TextOutput out) {
super(out);
}
-
+
/**
* Generate the output source code using short or long identifiers.
- *
+ *
* @param useLongIdents if true, emit all identifiers in long form
*/
public JsSourceGenerationVisitor(TextOutput out, boolean useLongIdents) {
@@ -44,19 +43,19 @@
}
@Override
- public boolean visit(JsProgram x, JsContext<JsProgram> ctx) {
+ public boolean visit(JsProgram x, JsContext ctx) {
// Descend naturally.
return true;
}
@Override
- public boolean visit(JsProgramFragment x, JsContext<JsProgramFragment> ctx) {
+ public boolean visit(JsProgramFragment x, JsContext ctx) {
// Descend naturally.
return true;
}
@Override
- public boolean visit(JsBlock x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsBlock x, JsContext ctx) {
printJsBlock(x, false, true);
return false;
}
diff --git a/dev/core/src/com/google/gwt/dev/js/JsSourceGenerationVisitorWithSizeBreakdown.java b/dev/core/src/com/google/gwt/dev/js/JsSourceGenerationVisitorWithSizeBreakdown.java
index 1f4bed4..5e1a3a6 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsSourceGenerationVisitorWithSizeBreakdown.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsSourceGenerationVisitorWithSizeBreakdown.java
@@ -57,25 +57,25 @@
}
@Override
- public boolean visit(JsBlock x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsBlock x, JsContext ctx) {
printJsBlock(x, false, true);
return false;
}
@Override
- public boolean visit(JsProgram x, JsContext<JsProgram> ctx) {
+ public boolean visit(JsProgram x, JsContext ctx) {
// Descend naturally.
return true;
}
@Override
- public boolean visit(JsProgramFragment x, JsContext<JsProgramFragment> ctx) {
+ public boolean visit(JsProgramFragment x, JsContext ctx) {
// Descend naturally.
return true;
}
@Override
- protected <T extends JsVisitable<T>> T doAccept(T node) {
+ protected <T extends JsVisitable> T doAccept(T node) {
JsName newName = nameToBillTo(node);
if (newName == null) {
return super.doAccept(node);
@@ -91,14 +91,14 @@
}
@Override
- protected <T extends JsVisitable<T>> void doAcceptList(List<T> collection) {
+ protected <T extends JsVisitable> void doAcceptList(List<T> collection) {
for (T t : collection) {
doAccept(t);
}
}
@Override
- protected <T extends JsVisitable<T>> void doAcceptWithInsertRemove(
+ protected <T extends JsVisitable> void doAcceptWithInsertRemove(
List<T> collection) {
for (T t : collection) {
doAccept(t);
@@ -114,10 +114,9 @@
}
/**
- * If parameter is JsVisitable<?>, javac version sun jdk1.6.0 complains about
+ * If parameter is JsVisitable, javac version sun jdk1.6.0 complains about
* incompatible types.
*/
- @SuppressWarnings("unchecked")
private JsName nameToBillTo(JsVisitable node) {
if (node instanceof JsStatement) {
JsStatement stat = (JsStatement) node;
diff --git a/dev/core/src/com/google/gwt/dev/js/JsStackEmulator.java b/dev/core/src/com/google/gwt/dev/js/JsStackEmulator.java
index e47f597..26bcfbc 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsStackEmulator.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsStackEmulator.java
@@ -89,7 +89,7 @@
}
@Override
- public void endVisit(JsExprStmt x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsExprStmt x, JsContext ctx) {
// Looking for e = caught(e);
JsExpression expr = x.getExpression();
@@ -246,7 +246,7 @@
* local variables and the final stack-pop instructions.
*/
@Override
- public void endVisit(JsBlock x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsBlock x, JsContext ctx) {
if (x == currentFunction.getBody()) {
// Add the entry code
@@ -273,7 +273,7 @@
}
@Override
- public void endVisit(JsReturn x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsReturn x, JsContext ctx) {
if (outerFinallyBlock != null) {
// There is a finally block, so we need to set the early-exit flag
JsBinaryOperation asg = new JsBinaryOperation(x.getSourceInfo(),
@@ -317,20 +317,20 @@
* <code>visit<code> and not a <code>endVisit</code>.
*/
@Override
- public boolean visit(JsCatch x, JsContext<JsCatch> ctx) {
+ public boolean visit(JsCatch x, JsContext ctx) {
// Reset the stack depth to the local index
new CatchStackReset(this).accept(x);
return true;
}
@Override
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
// Will be taken care of by the Bootstrap visitor
return false;
}
@Override
- public boolean visit(JsTry x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsTry x, JsContext ctx) {
/*
* Only the outermost finally block needs special treatment; try/finally
@@ -479,8 +479,7 @@
* @param x the statement that will cause the pop
* @param ctx the visitor context
*/
- private void pop(JsStatement x, JsExpression expr,
- JsContext<JsStatement> ctx) {
+ private void pop(JsStatement x, JsExpression expr, JsContext ctx) {
// $stackDepth = stackIndex - 1
SourceInfo info = x.getSourceInfo().makeChild(JsStackEmulator.class,
"Stack exit");
@@ -566,7 +565,7 @@
*/
private class InstrumentAllFunctions extends JsVisitor {
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
if (!x.getBody().getStatements().isEmpty()) {
if (recordLineNumbers) {
(new LocationVisitor(x)).accept(x.getBody());
@@ -602,7 +601,7 @@
* reference. These are tracked because it wouldn't be safe to rewrite
* <code>delete foo.bar</code> to <code>delete (line='123',foo).bar</code>.
*/
- private final Set<JsNode<?>> nodesInRefContext = new HashSet<JsNode<?>>();
+ private final Set<JsNode> nodesInRefContext = new HashSet<JsNode>();
public LocationVisitor(JsFunction function) {
super(function);
@@ -610,40 +609,40 @@
}
@Override
- public void endVisit(JsArrayAccess x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsArrayAccess x, JsContext ctx) {
record(x, ctx);
}
@Override
- public void endVisit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsBinaryOperation x, JsContext ctx) {
if (x.getOperator().isAssignment()) {
record(x, ctx);
}
}
@Override
- public void endVisit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsInvocation x, JsContext ctx) {
nodesInRefContext.remove(x.getQualifier());
record(x, ctx);
}
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
record(x, ctx);
}
@Override
- public void endVisit(JsNew x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNew x, JsContext ctx) {
record(x, ctx);
}
@Override
- public void endVisit(JsPostfixOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsPostfixOperation x, JsContext ctx) {
record(x, ctx);
}
@Override
- public void endVisit(JsPrefixOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsPrefixOperation x, JsContext ctx) {
record(x, ctx);
nodesInRefContext.remove(x.getArg());
}
@@ -655,7 +654,7 @@
* so that location data will be recorded correctly.
*/
@Override
- public boolean visit(JsFor x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsFor x, JsContext ctx) {
if (x.getInitExpr() != null) {
x.setInitExpr(accept(x.getInitExpr()));
} else if (x.getInitVars() != null) {
@@ -677,13 +676,13 @@
}
@Override
- public boolean visit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsInvocation x, JsContext ctx) {
nodesInRefContext.add(x.getQualifier());
return true;
}
@Override
- public boolean visit(JsPrefixOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsPrefixOperation x, JsContext ctx) {
if (x.getOperator() == JsUnaryOperator.DELETE
|| x.getOperator() == JsUnaryOperator.TYPEOF) {
nodesInRefContext.add(x.getArg());
@@ -696,7 +695,7 @@
* evaluating the condition.
*/
@Override
- public boolean visit(JsWhile x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsWhile x, JsContext ctx) {
resetPosition();
x.setCondition(accept(x.getCondition()));
accept(x.getBody());
@@ -720,7 +719,7 @@
}
}
- private void record(JsExpression x, JsContext<JsExpression> ctx) {
+ private void record(JsExpression x, JsContext ctx) {
if (ctx.isLvalue()) {
// Assignments to comma expressions aren't legal
return;
@@ -780,7 +779,7 @@
"$stackDepth");
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
JsName name = x.getName();
JsNameRef newRef = null;
@@ -808,7 +807,7 @@
public enum StackMode {
STRIP, NATIVE, EMULATED;
}
-
+
public static void exec(JsProgram program, PropertyOracle[] propertyOracles) {
if (getStackMode(propertyOracles) == StackMode.EMULATED) {
(new JsStackEmulator(program, propertyOracles)).execImpl();
@@ -836,10 +835,9 @@
property = propertyOracles[i].getSelectionProperty(TreeLogger.NULL,
PROPERTY_NAME);
} catch (BadPropertyValueException e) {
- // OK!
+ // OK!
}
- assert value.equals(property.getCurrentValue()) :
- "compiler.stackMode property has multiple values.";
+ assert value.equals(property.getCurrentValue()) : "compiler.stackMode property has multiple values.";
}
}
return stackMode;
diff --git a/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java b/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java
index 7ee24e7..aaa9db5 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java
@@ -76,12 +76,12 @@
private boolean hasBreakContinueStatements = false;
@Override
- public void endVisit(JsBreak x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsBreak x, JsContext ctx) {
hasBreakContinueStatements = true;
}
@Override
- public void endVisit(JsContinue x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsContinue x, JsContext ctx) {
hasBreakContinueStatements = true;
}
@@ -109,7 +109,7 @@
}
@Override
- public void endVisit(JsExprStmt x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsExprStmt x, JsContext ctx) {
JsFunction func = isFunctionDecl(x);
if (func != null) {
mustExec.add(x);
@@ -117,7 +117,7 @@
}
@Override
- public void endVisit(JsVars x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsVars x, JsContext ctx) {
JsVars strippedVars = new JsVars(x.getSourceInfo().makeChild(
MustExecVisitor.class, "Simplified execution"));
boolean mustReplace = false;
@@ -141,7 +141,7 @@
}
@Override
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
// Don't dive into nested functions.
return false;
}
@@ -164,7 +164,7 @@
private Map<JsExpression, Boolean> coercesToStringMap = new IdentityHashMap<JsExpression, Boolean>();
@Override
- public void endVisit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsBinaryOperation x, JsContext ctx) {
JsBinaryOperator op = x.getOperator();
JsExpression arg1 = x.getArg1();
JsExpression arg2 = x.getArg2();
@@ -191,7 +191,7 @@
* Prune dead statements and empty blocks.
*/
@Override
- public void endVisit(JsBlock x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsBlock x, JsContext ctx) {
/*
* Remove any dead statements after an abrupt change in code flow and
* promote safe statements within nested blocks to this block.
@@ -235,7 +235,7 @@
}
@Override
- public void endVisit(JsConditional x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsConditional x, JsContext ctx) {
evalBooleanContext.remove(x.getTestExpression());
JsExpression condExpr = x.getTestExpression();
@@ -262,7 +262,7 @@
* Convert do { } while (false); into a block.
*/
@Override
- public void endVisit(JsDoWhile x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsDoWhile x, JsContext ctx) {
evalBooleanContext.remove(x.getCondition());
JsExpression expr = x.getCondition();
@@ -286,7 +286,7 @@
}
@Override
- public void endVisit(JsExprStmt x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsExprStmt x, JsContext ctx) {
if (!x.getExpression().hasSideEffects()) {
if (ctx.canRemove()) {
ctx.removeMe();
@@ -300,7 +300,7 @@
* Prune for (X; false(); Y) statements, make sure X and false() are run.
*/
@Override
- public void endVisit(JsFor x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsFor x, JsContext ctx) {
evalBooleanContext.remove(x.getCondition());
JsExpression expr = x.getCondition();
@@ -331,7 +331,7 @@
* Simplify if statements.
*/
@Override
- public void endVisit(JsIf x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsIf x, JsContext ctx) {
evalBooleanContext.remove(x.getIfExpr());
JsExpression condExpr = x.getIfExpr();
@@ -390,7 +390,7 @@
* Change !!x to x in a boolean context.
*/
@Override
- public void endVisit(JsPrefixOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsPrefixOperation x, JsContext ctx) {
if (x.getOperator() == JsUnaryOperator.NOT) {
evalBooleanContext.remove(x.getArg());
}
@@ -411,7 +411,7 @@
* Prune while (false) statements.
*/
@Override
- public void endVisit(JsWhile x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsWhile x, JsContext ctx) {
evalBooleanContext.remove(x.getCondition());
JsExpression expr = x.getCondition();
@@ -433,31 +433,31 @@
}
@Override
- public boolean visit(JsConditional x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsConditional x, JsContext ctx) {
evalBooleanContext.add(x.getTestExpression());
return true;
}
@Override
- public boolean visit(JsDoWhile x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsDoWhile x, JsContext ctx) {
evalBooleanContext.add(x.getCondition());
return true;
}
@Override
- public boolean visit(JsFor x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsFor x, JsContext ctx) {
evalBooleanContext.add(x.getCondition());
return true;
}
@Override
- public boolean visit(JsIf x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsIf x, JsContext ctx) {
evalBooleanContext.add(x.getIfExpr());
return true;
}
@Override
- public boolean visit(JsPrefixOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsPrefixOperation x, JsContext ctx) {
if (x.getOperator() == JsUnaryOperator.NOT) {
evalBooleanContext.add(x.getArg());
}
@@ -465,7 +465,7 @@
}
@Override
- public boolean visit(JsWhile x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsWhile x, JsContext ctx) {
evalBooleanContext.add(x.getCondition());
return true;
}
@@ -651,7 +651,7 @@
* Simplify a + b.
*/
private void trySimplifyAdd(JsExpression original, JsExpression arg1,
- JsExpression arg2, JsContext<JsExpression> ctx) {
+ JsExpression arg2, JsContext ctx) {
if (arg1 instanceof JsValueLiteral && arg2 instanceof JsValueLiteral) {
// case: number + number
if (arg1 instanceof JsNumberLiteral && arg2 instanceof JsNumberLiteral) {
@@ -676,7 +676,7 @@
* expressions as left-normal as possible.
*/
private boolean trySimplifyAssociativeExpression(JsBinaryOperation x,
- JsContext<JsExpression> ctx) {
+ JsContext ctx) {
boolean toReturn = false;
JsBinaryOperator op = x.getOperator();
JsExpression arg1 = x.getArg1();
@@ -770,7 +770,7 @@
}
private void trySimplifyEq(JsExpression original, JsExpression arg1,
- JsExpression arg2, JsContext<JsExpression> ctx) {
+ JsExpression arg2, JsContext ctx) {
JsExpression updated = simplifyEq(original, arg1, arg2);
if (updated != original) {
ctx.replaceMe(updated);
@@ -778,15 +778,14 @@
}
private void trySimplifyNe(JsExpression original, JsExpression arg1,
- JsExpression arg2, JsContext<JsExpression> ctx) {
+ JsExpression arg2, JsContext ctx) {
JsExpression updated = simplifyNe(original, arg1, arg2);
if (updated != original) {
ctx.replaceMe(updated);
}
}
- private boolean tryStaticEvalIf(JsIf x, CanBooleanEval cond,
- JsContext<JsStatement> ctx) {
+ private boolean tryStaticEvalIf(JsIf x, CanBooleanEval cond, JsContext ctx) {
JsStatement thenStmt = x.getThenStmt();
JsStatement elseStmt = x.getElseStmt();
if (cond.isBooleanTrue()) {
@@ -831,18 +830,17 @@
JsBinaryOperator.BIT_OR, JsBinaryOperator.BIT_XOR,
JsBinaryOperator.COMMA, JsBinaryOperator.MUL, JsBinaryOperator.OR);
- @SuppressWarnings("unchecked")
public static <T extends JsVisitable> T exec(JsProgram program, T node) {
- Event optimizeJsEvent = SpeedTracerLogger.start(CompilerEventType.OPTIMIZE_JS,
- "optimizer", NAME);
+ Event optimizeJsEvent = SpeedTracerLogger.start(
+ CompilerEventType.OPTIMIZE_JS, "optimizer", NAME);
T result = new JsStaticEval(program).execImpl(node);
optimizeJsEvent.end();
return result;
}
public static OptimizerStats exec(JsProgram program) {
- Event optimizeJsEvent = SpeedTracerLogger.start(CompilerEventType.OPTIMIZE_JS,
- "optimizer", NAME);
+ Event optimizeJsEvent = SpeedTracerLogger.start(
+ CompilerEventType.OPTIMIZE_JS, "optimizer", NAME);
OptimizerStats stats = new JsStaticEval(program).execImpl();
optimizeJsEvent.end("didChange", "" + stats.didChange());
return stats;
@@ -902,7 +900,7 @@
* </pre>
*/
protected static void shortCircuitAnd(JsExpression arg1, JsExpression arg2,
- JsContext<JsExpression> ctx) {
+ JsContext ctx) {
if (arg1 instanceof CanBooleanEval) {
CanBooleanEval eval1 = (CanBooleanEval) arg1;
if (eval1.isBooleanTrue() && !arg1.hasSideEffects()) {
@@ -922,7 +920,7 @@
* </pre>
*/
protected static void shortCircuitOr(JsExpression arg1, JsExpression arg2,
- JsContext<JsExpression> ctx) {
+ JsContext ctx) {
if (arg1 instanceof CanBooleanEval) {
CanBooleanEval eval1 = (CanBooleanEval) arg1;
if (eval1.isBooleanTrue()) {
@@ -934,7 +932,7 @@
}
protected static void trySimplifyComma(JsExpression arg1, JsExpression arg2,
- JsContext<JsExpression> ctx) {
+ JsContext ctx) {
if (!arg1.hasSideEffects()) {
ctx.replaceMe(arg2);
}
@@ -946,7 +944,6 @@
this.program = program;
}
- @SuppressWarnings("unchecked")
public <T extends JsVisitable> T execImpl(T node) {
return new StaticEvalVisitor().accept(node);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/JsStringInterner.java b/dev/core/src/com/google/gwt/dev/js/JsStringInterner.java
index 126bd52..f85bf7e 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsStringInterner.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsStringInterner.java
@@ -20,7 +20,6 @@
import com.google.gwt.dev.js.ast.JsBinaryOperation;
import com.google.gwt.dev.js.ast.JsBlock;
import com.google.gwt.dev.js.ast.JsContext;
-import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsModVisitor;
import com.google.gwt.dev.js.ast.JsName;
import com.google.gwt.dev.js.ast.JsPostfixOperation;
@@ -38,11 +37,11 @@
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
-import java.util.Map.Entry;
/**
* Interns all String literals in a JsProgram. Each unique String will be
@@ -106,7 +105,7 @@
}
@Override
- public void endVisit(JsProgramFragment x, JsContext<JsProgramFragment> ctx) {
+ public void endVisit(JsProgramFragment x, JsContext ctx) {
currentFragment++;
}
@@ -114,7 +113,7 @@
* Prevents 'fixing' an otherwise illegal operation.
*/
@Override
- public boolean visit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsBinaryOperation x, JsContext ctx) {
return !x.getOperator().isAssignment()
|| !(x.getArg1() instanceof JsStringLiteral);
}
@@ -123,7 +122,7 @@
* Prevents 'fixing' an otherwise illegal operation.
*/
@Override
- public boolean visit(JsPostfixOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsPostfixOperation x, JsContext ctx) {
return !(x.getArg() instanceof JsStringLiteral);
}
@@ -131,7 +130,7 @@
* Prevents 'fixing' an otherwise illegal operation.
*/
@Override
- public boolean visit(JsPrefixOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsPrefixOperation x, JsContext ctx) {
return !(x.getArg() instanceof JsStringLiteral);
}
@@ -141,8 +140,7 @@
* and never evaluated as an expression.
*/
@Override
- public boolean visit(JsPropertyInitializer x,
- JsContext<JsPropertyInitializer> ctx) {
+ public boolean visit(JsPropertyInitializer x, JsContext ctx) {
x.setValueExpr(accept(x.getValueExpr()));
return false;
}
@@ -151,7 +149,7 @@
* Replace JsStringLiteral instances with JsNameRefs.
*/
@Override
- public boolean visit(JsStringLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsStringLiteral x, JsContext ctx) {
JsName name = toCreate.get(x);
if (name == null) {
String ident = PREFIX + lastId++;
@@ -188,7 +186,7 @@
* declarations that look like they were created by the interner.
*/
@Override
- public boolean visit(JsVar x, JsContext<JsVar> ctx) {
+ public boolean visit(JsVar x, JsContext ctx) {
return !(x.getName().getIdent().startsWith(PREFIX));
}
}
diff --git a/dev/core/src/com/google/gwt/dev/js/JsToStringGenerationVisitor.java b/dev/core/src/com/google/gwt/dev/js/JsToStringGenerationVisitor.java
index a8d1e1e..93588fa 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsToStringGenerationVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsToStringGenerationVisitor.java
@@ -61,22 +61,21 @@
import com.google.gwt.dev.js.ast.JsStatement;
import com.google.gwt.dev.js.ast.JsStringLiteral;
import com.google.gwt.dev.js.ast.JsSwitch;
-import com.google.gwt.dev.js.ast.JsSwitchMember;
import com.google.gwt.dev.js.ast.JsThisRef;
import com.google.gwt.dev.js.ast.JsThrow;
import com.google.gwt.dev.js.ast.JsTry;
import com.google.gwt.dev.js.ast.JsUnaryOperator;
import com.google.gwt.dev.js.ast.JsVars;
+import com.google.gwt.dev.js.ast.JsVars.JsVar;
import com.google.gwt.dev.js.ast.JsVisitor;
import com.google.gwt.dev.js.ast.JsWhile;
-import com.google.gwt.dev.js.ast.JsVars.JsVar;
import com.google.gwt.dev.util.TextOutput;
import com.google.gwt.dev.util.collect.HashSet;
import java.util.ArrayList;
import java.util.Iterator;
-import java.util.Set;
import java.util.List;
+import java.util.Set;
import java.util.regex.Pattern;
/**
@@ -275,10 +274,10 @@
public JsToStringGenerationVisitor(TextOutput out) {
this(out, false);
}
-
+
/**
* Generate the output string using short or long identifiers.
- *
+ *
* @param useLongIdents if true, emit all identifiers in long form
*/
JsToStringGenerationVisitor(TextOutput out, boolean useLongIdents) {
@@ -291,7 +290,7 @@
}
@Override
- public boolean visit(JsArrayAccess x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsArrayAccess x, JsContext ctx) {
JsExpression arrayExpr = x.getArrayExpr();
_parenPush(x, arrayExpr, false);
accept(arrayExpr);
@@ -303,7 +302,7 @@
}
@Override
- public boolean visit(JsArrayLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsArrayLiteral x, JsContext ctx) {
_lsquare();
boolean sep = false;
for (Object element : x.getExpressions()) {
@@ -318,7 +317,7 @@
}
@Override
- public boolean visit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsBinaryOperation x, JsContext ctx) {
JsBinaryOperator op = x.getOperator();
JsExpression arg1 = x.getArg1();
_parenPush(x, arg1, !op.isLeftAssociative());
@@ -343,13 +342,13 @@
}
@Override
- public boolean visit(JsBlock x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsBlock x, JsContext ctx) {
printJsBlock(x, true, true);
return false;
}
@Override
- public boolean visit(JsBooleanLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsBooleanLiteral x, JsContext ctx) {
if (x.getValue()) {
_true();
} else {
@@ -359,7 +358,7 @@
}
@Override
- public boolean visit(JsBreak x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsBreak x, JsContext ctx) {
_break();
JsNameRef label = x.getLabel();
@@ -372,7 +371,7 @@
}
@Override
- public boolean visit(JsCase x, JsContext<JsSwitchMember> ctx) {
+ public boolean visit(JsCase x, JsContext ctx) {
_case();
_space();
accept(x.getCaseExpr());
@@ -395,7 +394,7 @@
}
@Override
- public boolean visit(JsCatch x, JsContext<JsCatch> ctx) {
+ public boolean visit(JsCatch x, JsContext ctx) {
_spaceOpt();
_catch();
_spaceOpt();
@@ -420,7 +419,7 @@
}
@Override
- public boolean visit(JsConditional x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsConditional x, JsContext ctx) {
// Associativity: for the then and else branches, it is safe to insert
// another
// ternary expression, but if the test expression is a ternary, it should
@@ -449,7 +448,7 @@
}
@Override
- public boolean visit(JsContinue x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsContinue x, JsContext ctx) {
_continue();
JsNameRef label = x.getLabel();
@@ -462,13 +461,13 @@
}
@Override
- public boolean visit(JsDebugger x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsDebugger x, JsContext ctx) {
_debugger();
return false;
}
@Override
- public boolean visit(JsDefault x, JsContext<JsSwitchMember> ctx) {
+ public boolean visit(JsDefault x, JsContext ctx) {
_default();
_colon();
@@ -488,7 +487,7 @@
}
@Override
- public boolean visit(JsDoWhile x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsDoWhile x, JsContext ctx) {
_do();
_nestedPush(x.getBody(), true);
accept(x.getBody());
@@ -509,12 +508,12 @@
}
@Override
- public boolean visit(JsEmpty x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsEmpty x, JsContext ctx) {
return false;
}
@Override
- public boolean visit(JsExprStmt x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsExprStmt x, JsContext ctx) {
boolean surroundWithParentheses = JsFirstExpressionVisitor.exec(x);
if (surroundWithParentheses) {
_lparen();
@@ -528,7 +527,7 @@
}
@Override
- public boolean visit(JsFor x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsFor x, JsContext ctx) {
_for();
_spaceOpt();
_lparen();
@@ -567,7 +566,7 @@
}
@Override
- public boolean visit(JsForIn x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsForIn x, JsContext ctx) {
_for();
_spaceOpt();
_lparen();
@@ -606,7 +605,7 @@
// }
//
@Override
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
_function();
// Functions can be anonymous.
@@ -631,7 +630,7 @@
}
@Override
- public boolean visit(JsIf x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsIf x, JsContext ctx) {
_if();
_spaceOpt();
_lparen();
@@ -666,7 +665,7 @@
}
@Override
- public boolean visit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsInvocation x, JsContext ctx) {
JsExpression qualifier = x.getQualifier();
_parenPush(x, qualifier, false);
accept(qualifier);
@@ -686,7 +685,7 @@
}
@Override
- public boolean visit(JsLabel x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsLabel x, JsContext ctx) {
_nameOf(x);
_colon();
_spaceOpt();
@@ -695,18 +694,18 @@
}
@Override
- public boolean visit(JsNameOf x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNameOf x, JsContext ctx) {
if (useLongIdents) {
printStringLiteral(x.getName().getIdent());
} else {
printStringLiteral(x.getName().getShortIdent());
}
-
+
return false;
}
@Override
- public boolean visit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNameRef x, JsContext ctx) {
JsExpression q = x.getQualifier();
if (q != null) {
_parenPush(x, q, false);
@@ -725,7 +724,7 @@
}
@Override
- public boolean visit(JsNew x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNew x, JsContext ctx) {
_new();
_space();
@@ -760,13 +759,13 @@
}
@Override
- public boolean visit(JsNullLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNullLiteral x, JsContext ctx) {
_null();
return false;
}
@Override
- public boolean visit(JsNumberLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNumberLiteral x, JsContext ctx) {
double dvalue = x.getValue();
long lvalue = (long) dvalue;
if (lvalue == dvalue) {
@@ -778,7 +777,7 @@
}
@Override
- public boolean visit(JsObjectLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsObjectLiteral x, JsContext ctx) {
_lbrace();
boolean sep = false;
for (Object element : x.getPropertyInitializers()) {
@@ -808,13 +807,13 @@
}
@Override
- public boolean visit(JsParameter x, JsContext<JsParameter> ctx) {
+ public boolean visit(JsParameter x, JsContext ctx) {
_nameOf(x);
return false;
}
@Override
- public boolean visit(JsPostfixOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsPostfixOperation x, JsContext ctx) {
JsUnaryOperator op = x.getOperator();
JsExpression arg = x.getArg();
// unary operators always associate correctly (I think)
@@ -826,7 +825,7 @@
}
@Override
- public boolean visit(JsPrefixOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsPrefixOperation x, JsContext ctx) {
JsUnaryOperator op = x.getOperator();
p.print(op.getSymbol());
JsExpression arg = x.getArg();
@@ -841,20 +840,19 @@
}
@Override
- public boolean visit(JsProgram x, JsContext<JsProgram> ctx) {
+ public boolean visit(JsProgram x, JsContext ctx) {
p.print("<JsProgram>");
return false;
}
@Override
- public boolean visit(JsProgramFragment x, JsContext<JsProgramFragment> ctx) {
+ public boolean visit(JsProgramFragment x, JsContext ctx) {
p.print("<JsProgramFragment>");
return false;
}
@Override
- public boolean visit(JsPropertyInitializer x,
- JsContext<JsPropertyInitializer> ctx) {
+ public boolean visit(JsPropertyInitializer x, JsContext ctx) {
// Since there are separators, we actually print the property init
// in visit(JsObjectLiteral).
//
@@ -862,7 +860,7 @@
}
@Override
- public boolean visit(JsRegExp x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsRegExp x, JsContext ctx) {
_slash();
p.print(x.getPattern());
_slash();
@@ -874,7 +872,7 @@
}
@Override
- public boolean visit(JsReturn x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsReturn x, JsContext ctx) {
_return();
JsExpression expr = x.getExpr();
if (expr != null) {
@@ -885,13 +883,13 @@
}
@Override
- public boolean visit(JsStringLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsStringLiteral x, JsContext ctx) {
printStringLiteral(x.getValue());
return false;
}
@Override
- public boolean visit(JsSwitch x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsSwitch x, JsContext ctx) {
_switch();
_spaceOpt();
_lparen();
@@ -905,13 +903,13 @@
}
@Override
- public boolean visit(JsThisRef x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsThisRef x, JsContext ctx) {
_this();
return false;
}
@Override
- public boolean visit(JsThrow x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsThrow x, JsContext ctx) {
_throw();
_space();
accept(x.getExpr());
@@ -919,7 +917,7 @@
}
@Override
- public boolean visit(JsTry x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsTry x, JsContext ctx) {
_try();
_spaceOpt();
accept(x.getTryBlock());
@@ -938,7 +936,7 @@
}
@Override
- public boolean visit(JsVar x, JsContext<JsVar> ctx) {
+ public boolean visit(JsVar x, JsContext ctx) {
_nameOf(x);
JsExpression initExpr = x.getInitExpr();
if (initExpr != null) {
@@ -953,7 +951,7 @@
}
@Override
- public boolean visit(JsVars x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsVars x, JsContext ctx) {
_var();
_space();
boolean sep = false;
@@ -965,7 +963,7 @@
}
@Override
- public boolean visit(JsWhile x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsWhile x, JsContext ctx) {
_while();
_spaceOpt();
_lparen();
diff --git a/dev/core/src/com/google/gwt/dev/js/JsUnusedFunctionRemover.java b/dev/core/src/com/google/gwt/dev/js/JsUnusedFunctionRemover.java
index c99a3b4..b51a5e3 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsUnusedFunctionRemover.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsUnusedFunctionRemover.java
@@ -19,13 +19,11 @@
import com.google.gwt.dev.jjs.impl.OptimizerStats;
import com.google.gwt.dev.js.ast.JsContext;
import com.google.gwt.dev.js.ast.JsExprStmt;
-import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsFunction;
import com.google.gwt.dev.js.ast.JsModVisitor;
import com.google.gwt.dev.js.ast.JsName;
import com.google.gwt.dev.js.ast.JsNameRef;
import com.google.gwt.dev.js.ast.JsProgram;
-import com.google.gwt.dev.js.ast.JsStatement;
import com.google.gwt.dev.js.ast.JsVisitor;
import com.google.gwt.dev.util.log.speedtracer.CompilerEventType;
import com.google.gwt.dev.util.log.speedtracer.SpeedTracerLogger;
@@ -46,7 +44,7 @@
private class JsFunctionVisitor extends JsVisitor {
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
// Anonymous function, ignore it
if (x.getName() != null && !x.isArtificiallyRescued()) {
toRemove.put(x.getName(), x);
@@ -60,7 +58,7 @@
private class JsNameRefVisitor extends JsVisitor {
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
toRemove.remove(x.getName());
}
}
@@ -68,7 +66,7 @@
private class RemovalVisitor extends JsModVisitor {
@Override
- public void endVisit(JsExprStmt x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsExprStmt x, JsContext ctx) {
if (!(x.getExpression() instanceof JsFunction)) {
return;
}
@@ -96,8 +94,8 @@
}
public static OptimizerStats exec(JsProgram program) {
- Event optimizeJsEvent = SpeedTracerLogger.start(CompilerEventType.OPTIMIZE_JS,
- "optimizer", NAME);
+ Event optimizeJsEvent = SpeedTracerLogger.start(
+ CompilerEventType.OPTIMIZE_JS, "optimizer", NAME);
OptimizerStats stats = new JsUnusedFunctionRemover(program).execImpl();
optimizeJsEvent.end("didChange", "" + stats.didChange());
return stats;
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/HasArguments.java b/dev/core/src/com/google/gwt/dev/js/ast/HasArguments.java
index 65561b1..8e4122f 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/HasArguments.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/HasArguments.java
@@ -23,5 +23,5 @@
public interface HasArguments {
List<JsExpression> getArguments();
-
+
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/HasCondition.java b/dev/core/src/com/google/gwt/dev/js/ast/HasCondition.java
index 2b70bd5..fd21feb 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/HasCondition.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/HasCondition.java
@@ -20,5 +20,6 @@
*/
public interface HasCondition {
JsExpression getCondition();
+
void setCondition(JsExpression condition);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsArrayAccess.java b/dev/core/src/com/google/gwt/dev/js/ast/JsArrayAccess.java
index 77f6604..5ab9e27 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsArrayAccess.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsArrayAccess.java
@@ -68,7 +68,7 @@
this.indexExpr = indexExpr;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
arrayExpr = v.accept(arrayExpr);
indexExpr = v.accept(indexExpr);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsArrayLiteral.java b/dev/core/src/com/google/gwt/dev/js/ast/JsArrayLiteral.java
index 6e32762..8c83b23 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsArrayLiteral.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsArrayLiteral.java
@@ -63,7 +63,7 @@
return false;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
v.acceptWithInsertRemove(exprs);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsBinaryOperation.java b/dev/core/src/com/google/gwt/dev/js/ast/JsBinaryOperation.java
index 12a8767..6018e3a 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsBinaryOperation.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsBinaryOperation.java
@@ -104,7 +104,7 @@
this.arg2 = arg2;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
if (op.isAssignment()) {
arg1 = v.acceptLvalue(arg1);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsBlock.java b/dev/core/src/com/google/gwt/dev/js/ast/JsBlock.java
index 0cbf91c..e7de0ed 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsBlock.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsBlock.java
@@ -39,7 +39,7 @@
return false;
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
v.acceptWithInsertRemove(stmts);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsBooleanLiteral.java b/dev/core/src/com/google/gwt/dev/js/ast/JsBooleanLiteral.java
index 51a613d..e254270 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsBooleanLiteral.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsBooleanLiteral.java
@@ -52,7 +52,7 @@
return false;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
v.visit(this, ctx);
v.endVisit(this, ctx);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsBreak.java b/dev/core/src/com/google/gwt/dev/js/ast/JsBreak.java
index 5c63bde..17e7d1b 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsBreak.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsBreak.java
@@ -37,7 +37,7 @@
return label;
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
if (label != null) {
v.accept(label);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsCase.java b/dev/core/src/com/google/gwt/dev/js/ast/JsCase.java
index a1c7006..b7e267e 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsCase.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsCase.java
@@ -36,7 +36,7 @@
this.caseExpr = caseExpr;
}
- public void traverse(JsVisitor v, JsContext<JsSwitchMember> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
caseExpr = v.accept(caseExpr);
v.acceptWithInsertRemove(stmts);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsCatch.java b/dev/core/src/com/google/gwt/dev/js/ast/JsCatch.java
index e1d1cd8..5a932cd 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsCatch.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsCatch.java
@@ -20,7 +20,7 @@
/**
* Represents a JavaScript catch clause.
*/
-public class JsCatch extends JsNode<JsCatch> implements HasCondition {
+public class JsCatch extends JsNode implements HasCondition {
protected final JsCatchScope scope;
@@ -61,7 +61,7 @@
this.condition = condition;
}
- public void traverse(JsVisitor v, JsContext<JsCatch> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
param = v.accept(param);
if (condition != null) {
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsConditional.java b/dev/core/src/com/google/gwt/dev/js/ast/JsConditional.java
index 74c2967..2d2c213 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsConditional.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsConditional.java
@@ -80,7 +80,7 @@
this.thenExpr = thenExpr;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
testExpr = v.accept(testExpr);
thenExpr = v.accept(thenExpr);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsContext.java b/dev/core/src/com/google/gwt/dev/js/ast/JsContext.java
index 4d63cd1..503538d 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsContext.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsContext.java
@@ -19,22 +19,20 @@
* The context in which a JsNode visitation occurs. This represents the set of
* possible operations a JsVisitor subclass can perform on the currently visited
* node.
- *
- * @param <T>
*/
-public interface JsContext<T extends JsVisitable<T>> {
+public interface JsContext {
boolean canInsert();
boolean canRemove();
- void insertAfter(T node);
+ void insertAfter(JsVisitable node);
- void insertBefore(T node);
+ void insertBefore(JsVisitable node);
boolean isLvalue();
void removeMe();
- void replaceMe(T node);
+ void replaceMe(JsVisitable node);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsContinue.java b/dev/core/src/com/google/gwt/dev/js/ast/JsContinue.java
index a88b60d..2e7490f 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsContinue.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsContinue.java
@@ -37,7 +37,7 @@
return label;
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
if (label != null) {
v.accept(label);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsDebugger.java b/dev/core/src/com/google/gwt/dev/js/ast/JsDebugger.java
index 5f0186c..1cef5a7 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsDebugger.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsDebugger.java
@@ -26,7 +26,7 @@
super(sourceInfo);
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
v.visit(this, ctx);
v.endVisit(this, ctx);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsDefault.java b/dev/core/src/com/google/gwt/dev/js/ast/JsDefault.java
index 9ff557f..f81ddf4 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsDefault.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsDefault.java
@@ -26,7 +26,7 @@
super(sourceInfo);
}
- public void traverse(JsVisitor v, JsContext<JsSwitchMember> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
v.acceptWithInsertRemove(stmts);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsDoWhile.java b/dev/core/src/com/google/gwt/dev/js/ast/JsDoWhile.java
index 4ce7128..3c75fdb 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsDoWhile.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsDoWhile.java
@@ -53,7 +53,7 @@
this.condition = condition;
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
body = v.accept(body);
condition = v.accept(condition);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsEmpty.java b/dev/core/src/com/google/gwt/dev/js/ast/JsEmpty.java
index 097e31e..00a5b6f 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsEmpty.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsEmpty.java
@@ -27,7 +27,7 @@
super(sourceInfo);
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
v.visit(this, ctx);
v.endVisit(this, ctx);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsExprStmt.java b/dev/core/src/com/google/gwt/dev/js/ast/JsExprStmt.java
index b4ddcf0..9bdd74d 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsExprStmt.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsExprStmt.java
@@ -33,7 +33,7 @@
return expr;
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
expr = v.accept(expr);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsExpression.java b/dev/core/src/com/google/gwt/dev/js/ast/JsExpression.java
index 13cf5c4..83d5cda 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsExpression.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsExpression.java
@@ -20,8 +20,8 @@
/**
* An abstract base class for all JavaScript expressions.
*/
-public abstract class JsExpression extends JsNode<JsExpression> {
-
+public abstract class JsExpression extends JsNode {
+
protected JsExpression(SourceInfo sourceInfo) {
super(sourceInfo);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsFor.java b/dev/core/src/com/google/gwt/dev/js/ast/JsFor.java
index c2f002b..2703d0f 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsFor.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsFor.java
@@ -84,7 +84,7 @@
this.initVars = initVars;
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
assert (!(initExpr != null && initVars != null));
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsForIn.java b/dev/core/src/com/google/gwt/dev/js/ast/JsForIn.java
index a5f750b..c73a56e 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsForIn.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsForIn.java
@@ -68,7 +68,7 @@
this.objExpr = objExpr;
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
if (iterExpr != null) {
iterExpr = v.acceptLvalue(iterExpr);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsFunction.java b/dev/core/src/com/google/gwt/dev/js/ast/JsFunction.java
index 3aa90e0..959470c 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsFunction.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsFunction.java
@@ -165,7 +165,7 @@
this.trace = true;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
String before = null;
if (trace && v instanceof JsModVisitor) {
before = this.toSource();
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsIf.java b/dev/core/src/com/google/gwt/dev/js/ast/JsIf.java
index b1b9d3d..7f4bdfd 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsIf.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsIf.java
@@ -64,7 +64,7 @@
this.thenStmt = thenStmt;
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
ifExpr = v.accept(ifExpr);
thenStmt = v.accept(thenStmt);
@@ -78,9 +78,9 @@
@Override
public boolean unconditionalControlBreak() {
boolean thenBreaks = thenStmt != null
- && thenStmt.unconditionalControlBreak();
+ && thenStmt.unconditionalControlBreak();
boolean elseBreaks = elseStmt != null
- && elseStmt.unconditionalControlBreak();
+ && elseStmt.unconditionalControlBreak();
if (thenBreaks && elseBreaks) {
// both branches have an unconditional break
return true;
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsInvocation.java b/dev/core/src/com/google/gwt/dev/js/ast/JsInvocation.java
index ac7fdac..2a7bd56 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsInvocation.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsInvocation.java
@@ -60,7 +60,7 @@
this.qualifier = qualifier;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
qualifier = v.accept(qualifier);
v.acceptList(args);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsLabel.java b/dev/core/src/com/google/gwt/dev/js/ast/JsLabel.java
index c733b6e..85a8fb7 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsLabel.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsLabel.java
@@ -42,7 +42,8 @@
public void setStmt(JsStatement stmt) {
this.stmt = stmt;
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
stmt = v.accept(stmt);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsModVisitor.java b/dev/core/src/com/google/gwt/dev/js/ast/JsModVisitor.java
index bcb2dbc..4577c96 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsModVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsModVisitor.java
@@ -24,7 +24,8 @@
*/
public class JsModVisitor extends JsVisitor {
- private class ListContext<T extends JsVisitable<T>> implements JsContext<T> {
+ @SuppressWarnings("unchecked")
+ private class ListContext<T extends JsVisitable> implements JsContext {
private List<T> collection;
private int index;
private boolean removed;
@@ -38,15 +39,15 @@
return true;
}
- public void insertAfter(T node) {
+ public void insertAfter(JsVisitable node) {
checkRemoved();
- collection.add(index + 1, node);
+ collection.add(index + 1, (T) node);
didChange = true;
}
- public void insertBefore(T node) {
+ public void insertBefore(JsVisitable node) {
checkRemoved();
- collection.add(index++, node);
+ collection.add(index++, (T) node);
didChange = true;
}
@@ -60,10 +61,10 @@
didChange = removed = true;
}
- public void replaceMe(T node) {
+ public void replaceMe(JsVisitable node) {
checkState();
checkReplacement(collection.get(index), node);
- collection.set(index, node);
+ collection.set(index, (T) node);
didChange = replaced = true;
}
@@ -96,7 +97,8 @@
}
}
- private class NodeContext<T extends JsVisitable<T>> implements JsContext<T> {
+ @SuppressWarnings("unchecked")
+ private class NodeContext<T extends JsVisitable> implements JsContext {
private T node;
private boolean replaced;
@@ -108,11 +110,11 @@
return false;
}
- public void insertAfter(T node) {
+ public void insertAfter(JsVisitable node) {
throw new UnsupportedOperationException();
}
- public void insertBefore(T node) {
+ public void insertBefore(JsVisitable node) {
throw new UnsupportedOperationException();
}
@@ -124,12 +126,12 @@
throw new UnsupportedOperationException();
}
- public void replaceMe(T node) {
+ public void replaceMe(JsVisitable node) {
if (replaced) {
throw new InternalCompilerException("Node was already replaced");
}
checkReplacement(this.node, node);
- this.node = node;
+ this.node = (T) node;
didChange = replaced = true;
}
@@ -141,8 +143,8 @@
}
}
- protected static <T extends JsVisitable<T>> void checkReplacement(T origNode,
- T newNode) {
+ protected static void checkReplacement(JsVisitable origNode,
+ JsVisitable newNode) {
if (newNode == null) {
throw new InternalCompilerException("Cannot replace with null");
}
@@ -160,12 +162,12 @@
}
@Override
- protected <T extends JsVisitable<T>> T doAccept(T node) {
+ protected <T extends JsVisitable> T doAccept(T node) {
return new NodeContext<T>().traverse(node);
}
@Override
- protected <T extends JsVisitable<T>> void doAcceptList(List<T> collection) {
+ protected <T extends JsVisitable> void doAcceptList(List<T> collection) {
NodeContext<T> ctx = new NodeContext<T>();
for (int i = 0, c = collection.size(); i < c; ++i) {
ctx.traverse(collection.get(i));
@@ -181,7 +183,7 @@
}
@Override
- protected <T extends JsVisitable<T>> void doAcceptWithInsertRemove(
+ protected <T extends JsVisitable> void doAcceptWithInsertRemove(
List<T> collection) {
new ListContext<T>().traverse(collection);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsName.java b/dev/core/src/com/google/gwt/dev/js/ast/JsName.java
index 0cb1461..2c224d4 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsName.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsName.java
@@ -32,7 +32,6 @@
/**
* A back-reference to the JsNode that the JsName refers to.
*/
- @SuppressWarnings("unchecked")
private JsNode staticRef;
/**
@@ -57,7 +56,6 @@
return shortIdent;
}
- @SuppressWarnings("unchecked")
public JsNode getStaticRef() {
return staticRef;
}
@@ -81,7 +79,6 @@
/**
* Should never be called except on immutable stuff.
*/
- @SuppressWarnings("unchecked")
public void setStaticRef(JsNode node) {
this.staticRef = node;
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsNameOf.java b/dev/core/src/com/google/gwt/dev/js/ast/JsNameOf.java
index 7fc79a0..27d7e67 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsNameOf.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsNameOf.java
@@ -52,7 +52,7 @@
return false;
}
- public void traverse(JsVisitor visitor, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor visitor, JsContext ctx) {
if (visitor.visit(this, ctx)) {
}
visitor.endVisit(this, ctx);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsNameRef.java b/dev/core/src/com/google/gwt/dev/js/ast/JsNameRef.java
index e967138..58a7a8c 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsNameRef.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsNameRef.java
@@ -117,7 +117,7 @@
this.qualifier = qualifier;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
if (qualifier != null) {
qualifier = v.accept(qualifier);
@@ -135,7 +135,7 @@
private SourceInfo maybeUpdateSourceInfo() {
SourceInfo toReturn = super.getSourceInfo();
if (!hasStaticRef && name != null) {
- JsNode<?> staticRef = name.getStaticRef();
+ JsNode staticRef = name.getStaticRef();
if (staticRef != null) {
toReturn.copyMissingCorrelationsFrom(name.getStaticRef().getSourceInfo());
hasStaticRef = true;
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsNew.java b/dev/core/src/com/google/gwt/dev/js/ast/JsNew.java
index 159a6a4..6bed072 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsNew.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsNew.java
@@ -59,7 +59,7 @@
return false;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
ctorExpr = v.accept(ctorExpr);
v.acceptList(args);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsNode.java b/dev/core/src/com/google/gwt/dev/js/ast/JsNode.java
index 1f4add6..4baa0d4 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsNode.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsNode.java
@@ -25,14 +25,12 @@
/**
* Base class for all JS AST elements.
- *
- * @param <T>
*/
-public abstract class JsNode<T extends JsVisitable<T>> implements
- JsVisitable<T>, HasSourceInfo, Serializable {
-
+public abstract class JsNode implements JsVisitable, HasSourceInfo,
+ Serializable {
+
private final SourceInfo sourceInfo;
-
+
protected JsNode(SourceInfo sourceInfo) {
assert sourceInfo != null : "SourceInfo must be provided for JsNodes";
this.sourceInfo = sourceInfo;
@@ -45,11 +43,10 @@
/**
* Returns a source code representation of the node using short identifiers.
*/
- // Causes source generation to delegate to the one visitor
public final String toSource() {
return toSource(false);
}
-
+
/**
* Returns a source code representation of the node using short or long
* identifiers.
@@ -58,12 +55,15 @@
*/
public final String toSource(boolean useLongIdents) {
DefaultTextOutput out = new DefaultTextOutput(false);
- JsSourceGenerationVisitor v = new JsSourceGenerationVisitor(out, useLongIdents);
+ JsSourceGenerationVisitor v = new JsSourceGenerationVisitor(out,
+ useLongIdents);
v.accept(this);
return out.toString();
}
- // Causes source generation to delegate to the one visitor
+ /**
+ * Causes source generation to delegate to the one visitor.
+ */
@Override
public final String toString() {
DefaultTextOutput out = new DefaultTextOutput(false);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsNullLiteral.java b/dev/core/src/com/google/gwt/dev/js/ast/JsNullLiteral.java
index bc2a9e0..dba3966 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsNullLiteral.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsNullLiteral.java
@@ -45,7 +45,7 @@
return true;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
v.visit(this, ctx);
v.endVisit(this, ctx);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsNumberLiteral.java b/dev/core/src/com/google/gwt/dev/js/ast/JsNumberLiteral.java
index f91969d..90026ac 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsNumberLiteral.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsNumberLiteral.java
@@ -52,7 +52,7 @@
return false;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
v.visit(this, ctx);
v.endVisit(this, ctx);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsObjectLiteral.java b/dev/core/src/com/google/gwt/dev/js/ast/JsObjectLiteral.java
index 2e94511..3b3fcfc 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsObjectLiteral.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsObjectLiteral.java
@@ -63,7 +63,7 @@
return false;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
v.acceptWithInsertRemove(props);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsParameter.java b/dev/core/src/com/google/gwt/dev/js/ast/JsParameter.java
index b934353..603b3e4 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsParameter.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsParameter.java
@@ -20,7 +20,7 @@
/**
* A JavaScript parameter.
*/
-public final class JsParameter extends JsNode<JsParameter> implements HasName {
+public final class JsParameter extends JsNode implements HasName {
private final JsName name;
@@ -34,7 +34,7 @@
return name;
}
- public void traverse(JsVisitor v, JsContext<JsParameter> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
v.visit(this, ctx);
v.endVisit(this, ctx);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsPostfixOperation.java b/dev/core/src/com/google/gwt/dev/js/ast/JsPostfixOperation.java
index b4ec4bf..648bf15 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsPostfixOperation.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsPostfixOperation.java
@@ -42,7 +42,7 @@
}
@Override
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
super.traverse(v, ctx);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsPrefixOperation.java b/dev/core/src/com/google/gwt/dev/js/ast/JsPrefixOperation.java
index ff41d04..bc813db 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsPrefixOperation.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsPrefixOperation.java
@@ -70,7 +70,7 @@
}
@Override
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
super.traverse(v, ctx);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsProgram.java b/dev/core/src/com/google/gwt/dev/js/ast/JsProgram.java
index eaca54f..9ab9e27 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsProgram.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsProgram.java
@@ -27,7 +27,7 @@
/**
* A JavaScript program.
*/
-public final class JsProgram extends JsNode<JsProgram> {
+public final class JsProgram extends JsNode {
private final CorrelationFactory correlator;
@@ -252,7 +252,7 @@
this.indexedFunctions.putAll(indexedFunctions);
}
- public void traverse(JsVisitor v, JsContext<JsProgram> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
for (JsProgramFragment fragment : fragments) {
v.accept(fragment);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsProgramFragment.java b/dev/core/src/com/google/gwt/dev/js/ast/JsProgramFragment.java
index 2b685aa..92aff71 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsProgramFragment.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsProgramFragment.java
@@ -20,7 +20,7 @@
/**
* One independently loadable fragment of a {@link JsProgram}.
*/
-public class JsProgramFragment extends JsNode<JsProgramFragment> {
+public class JsProgramFragment extends JsNode {
private final JsGlobalBlock globalBlock;
public JsProgramFragment(SourceInfo sourceInfo) {
@@ -33,7 +33,7 @@
return globalBlock;
}
- public void traverse(JsVisitor v, JsContext<JsProgramFragment> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
v.accept(globalBlock);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsPropertyInitializer.java b/dev/core/src/com/google/gwt/dev/js/ast/JsPropertyInitializer.java
index de18cca..23033a6 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsPropertyInitializer.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsPropertyInitializer.java
@@ -20,7 +20,7 @@
/**
* Used in object literals to specify property values by name.
*/
-public class JsPropertyInitializer extends JsNode<JsPropertyInitializer> {
+public class JsPropertyInitializer extends JsNode {
private JsExpression labelExpr;
@@ -30,7 +30,8 @@
super(sourceInfo);
}
- public JsPropertyInitializer(SourceInfo sourceInfo, JsExpression labelExpr, JsExpression valueExpr) {
+ public JsPropertyInitializer(SourceInfo sourceInfo, JsExpression labelExpr,
+ JsExpression valueExpr) {
super(sourceInfo);
this.labelExpr = labelExpr;
this.valueExpr = valueExpr;
@@ -56,7 +57,7 @@
this.valueExpr = valueExpr;
}
- public void traverse(JsVisitor v, JsContext<JsPropertyInitializer> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
labelExpr = v.accept(labelExpr);
valueExpr = v.accept(valueExpr);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsRegExp.java b/dev/core/src/com/google/gwt/dev/js/ast/JsRegExp.java
index 1c5c376..49579a3 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsRegExp.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsRegExp.java
@@ -64,7 +64,7 @@
this.pattern = re;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
v.visit(this, ctx);
v.endVisit(this, ctx);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsReturn.java b/dev/core/src/com/google/gwt/dev/js/ast/JsReturn.java
index 615178c..9571619 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsReturn.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsReturn.java
@@ -41,7 +41,7 @@
this.expr = expr;
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
if (expr != null) {
expr = v.accept(expr);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java b/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java
index 2687ede..325f62e 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java
@@ -44,26 +44,41 @@
private void ctorAddKnownGlobalSymbols() {
// Section references are from Ecma-262
// (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf)
- String[] commonBuiltins = new String[] {
+ String[] commonBuiltins = new String[]{
// 15.1.1 Value Properties of the Global Object
"NaN",
"Infinity",
"undefined",
// 15.1.2 Function Properties of the Global Object
- "eval", "parseInt", "parseFloat",
+ "eval",
+ "parseInt",
+ "parseFloat",
"isNan",
"isFinite",
// 15.1.3 URI Handling Function Properties
- "decodeURI", "decodeURIComponent",
+ "decodeURI",
+ "decodeURIComponent",
"encodeURI",
"encodeURIComponent",
// 15.1.4 Constructor Properties of the Global Object
- "Object", "Function", "Array", "String", "Boolean", "Number", "Date",
- "RegExp", "Error", "EvalError", "RangeError", "ReferenceError",
- "SyntaxError", "TypeError", "URIError",
+ "Object",
+ "Function",
+ "Array",
+ "String",
+ "Boolean",
+ "Number",
+ "Date",
+ "RegExp",
+ "Error",
+ "EvalError",
+ "RangeError",
+ "ReferenceError",
+ "SyntaxError",
+ "TypeError",
+ "URIError",
// 15.1.5 Other Properties of the Global Object
"Math",
@@ -72,83 +87,231 @@
"arguments",
// B.2 Additional Properties (non-normative)
- "escape", "unescape",
+ "escape",
+ "unescape",
// Window props (https://developer.mozilla.org/en/DOM/window)
- "applicationCache", "closed", "Components", "content", "controllers",
- "crypto", "defaultStatus", "dialogArguments", "directories",
- "document", "frameElement", "frames", "fullScreen", "globalStorage",
- "history", "innerHeight", "innerWidth", "length",
- "location", "locationbar", "localStorage", "menubar",
- "mozInnerScreenX", "mozInnerScreenY", "mozScreenPixelsPerCssPixel",
- "name", "navigator", "opener", "outerHeight", "outerWidth",
- "pageXOffset", "pageYOffset", "parent", "personalbar", "pkcs11",
- "returnValue", "screen", "scrollbars", "scrollMaxX", "scrollMaxY",
- "self", "sessionStorage", "sidebar", "status", "statusbar", "toolbar",
- "top", "window",
+ "applicationCache",
+ "closed",
+ "Components",
+ "content",
+ "controllers",
+ "crypto",
+ "defaultStatus",
+ "dialogArguments",
+ "directories",
+ "document",
+ "frameElement",
+ "frames",
+ "fullScreen",
+ "globalStorage",
+ "history",
+ "innerHeight",
+ "innerWidth",
+ "length",
+ "location",
+ "locationbar",
+ "localStorage",
+ "menubar",
+ "mozInnerScreenX",
+ "mozInnerScreenY",
+ "mozScreenPixelsPerCssPixel",
+ "name",
+ "navigator",
+ "opener",
+ "outerHeight",
+ "outerWidth",
+ "pageXOffset",
+ "pageYOffset",
+ "parent",
+ "personalbar",
+ "pkcs11",
+ "returnValue",
+ "screen",
+ "scrollbars",
+ "scrollMaxX",
+ "scrollMaxY",
+ "self",
+ "sessionStorage",
+ "sidebar",
+ "status",
+ "statusbar",
+ "toolbar",
+ "top",
+ "window",
// Window methods (https://developer.mozilla.org/en/DOM/window)
- "alert", "addEventListener", "atob", "back", "blur", "btoa",
- "captureEvents", "clearInterval", "clearTimeout", "close", "confirm",
- "disableExternalCapture", "dispatchEvent", "dump",
- "enableExternalCapture", "escape", "find", "focus", "forward",
- "GeckoActiveXObject", "getAttention", "getAttentionWithCycleCount",
- "getComputedStyle", "getSelection", "home", "maximize", "minimize",
- "moveBy", "moveTo", "open", "openDialog", "postMessage", "print",
- "prompt", "QueryInterface", "releaseEvents", "removeEventListener",
- "resizeBy", "resizeTo", "restore", "routeEvent", "scroll", "scrollBy",
- "scrollByLines", "scrollByPages", "scrollTo", "setInterval",
- "setResizeable", "setTimeout", "showModalDialog", "sizeToContent",
- "stop", "uuescape", "updateCommands", "XPCNativeWrapper",
+ "alert",
+ "addEventListener",
+ "atob",
+ "back",
+ "blur",
+ "btoa",
+ "captureEvents",
+ "clearInterval",
+ "clearTimeout",
+ "close",
+ "confirm",
+ "disableExternalCapture",
+ "dispatchEvent",
+ "dump",
+ "enableExternalCapture",
+ "escape",
+ "find",
+ "focus",
+ "forward",
+ "GeckoActiveXObject",
+ "getAttention",
+ "getAttentionWithCycleCount",
+ "getComputedStyle",
+ "getSelection",
+ "home",
+ "maximize",
+ "minimize",
+ "moveBy",
+ "moveTo",
+ "open",
+ "openDialog",
+ "postMessage",
+ "print",
+ "prompt",
+ "QueryInterface",
+ "releaseEvents",
+ "removeEventListener",
+ "resizeBy",
+ "resizeTo",
+ "restore",
+ "routeEvent",
+ "scroll",
+ "scrollBy",
+ "scrollByLines",
+ "scrollByPages",
+ "scrollTo",
+ "setInterval",
+ "setResizeable",
+ "setTimeout",
+ "showModalDialog",
+ "sizeToContent",
+ "stop",
+ "uuescape",
+ "updateCommands",
+ "XPCNativeWrapper",
"XPCSafeJSOjbectWrapper",
// Mozilla Window event handlers, same cite
- "onabort", "onbeforeunload", "onchange", "onclick", "onclose",
- "oncontextmenu", "ondragdrop", "onerror", "onfocus", "onhashchange",
- "onkeydown", "onkeypress", "onkeyup", "onload", "onmousedown",
- "onmousemove", "onmouseout", "onmouseover", "onmouseup",
- "onmozorientation", "onpaint", "onreset", "onresize", "onscroll",
- "onselect", "onsubmit", "onunload",
-
+ "onabort",
+ "onbeforeunload",
+ "onchange",
+ "onclick",
+ "onclose",
+ "oncontextmenu",
+ "ondragdrop",
+ "onerror",
+ "onfocus",
+ "onhashchange",
+ "onkeydown",
+ "onkeypress",
+ "onkeyup",
+ "onload",
+ "onmousedown",
+ "onmousemove",
+ "onmouseout",
+ "onmouseover",
+ "onmouseup",
+ "onmozorientation",
+ "onpaint",
+ "onreset",
+ "onresize",
+ "onscroll",
+ "onselect",
+ "onsubmit",
+ "onunload",
+
// Safari Web Content Guide
// http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/SafariWebContent.pdf
// WebKit Window member data, from WebKit DOM Reference
// (http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/WebKitDOMRef/DOMWindow_idl/Classes/DOMWindow/index.html)
// TODO(fredsa) Many, many more functions and member data to add
- "ontouchcancel", "ontouchend", "ontouchmove", "ontouchstart",
- "ongesturestart", "ongesturechange", "ongestureend",
-
+ "ontouchcancel",
+ "ontouchend",
+ "ontouchmove",
+ "ontouchstart",
+ "ongesturestart",
+ "ongesturechange",
+ "ongestureend",
+
// extra window methods
"uneval",
-
+
// keywords https://developer.mozilla.org/en/New_in_JavaScript_1.7,
// https://developer.mozilla.org/en/New_in_JavaScript_1.8.1
- "getPrototypeOf", "let",
-
+ "getPrototypeOf",
+ "let",
+
// "future reserved words"
- "abstract", "int", "short", "boolean", "interface", "static", "byte",
- "long", "char", "final", "native", "synchronized", "float", "package",
- "throws", "goto", "private", "transient", "implements", "protected",
- "volatile", "double", "public",
-
+ "abstract",
+ "int",
+ "short",
+ "boolean",
+ "interface",
+ "static",
+ "byte",
+ "long",
+ "char",
+ "final",
+ "native",
+ "synchronized",
+ "float",
+ "package",
+ "throws",
+ "goto",
+ "private",
+ "transient",
+ "implements",
+ "protected",
+ "volatile",
+ "double",
+ "public",
+
// IE methods
// (http://msdn.microsoft.com/en-us/library/ms535873(VS.85).aspx#)
- "attachEvent", "clientInformation", "clipboardData", "createPopup",
- "dialogHeight", "dialogLeft", "dialogTop", "dialogWidth",
- "onafterprint", "onbeforedeactivate", "onbeforeprint",
- "oncontrolselect", "ondeactivate", "onhelp", "onresizeend",
+ "attachEvent",
+ "clientInformation",
+ "clipboardData",
+ "createPopup",
+ "dialogHeight",
+ "dialogLeft",
+ "dialogTop",
+ "dialogWidth",
+ "onafterprint",
+ "onbeforedeactivate",
+ "onbeforeprint",
+ "oncontrolselect",
+ "ondeactivate",
+ "onhelp",
+ "onresizeend",
// Common browser-defined identifiers not defined in ECMAScript
- "event", "external", "Debug", "Enumerator", "Global", "Image",
- "ActiveXObject", "VBArray", "Components",
+ "event",
+ "external",
+ "Debug",
+ "Enumerator",
+ "Global",
+ "Image",
+ "ActiveXObject",
+ "VBArray",
+ "Components",
// Functions commonly defined on Object
- "toString", "getClass", "constructor", "prototype",
+ "toString",
+ "getClass",
+ "constructor",
+ "prototype",
// Client-side JavaScript identifiers, which are needed for linkers
// that don't ensure GWT's window != $wnd, document != $doc, etc.
// Taken from the Rhino book, pg 715
- "Anchor", "Applet", "Attr", "Canvas", "CanvasGradient",
+ "Anchor", "Applet", "Attr", "Canvas", "CanvasGradient",
"CanvasPattern", "CanvasRenderingContext2D", "CDATASection",
"CharacterData", "Comment", "CSS2Properties", "CSSRule",
"CSSStyleSheet", "Document", "DocumentFragment", "DocumentType",
@@ -161,7 +324,7 @@
"Table", "TableCell", "TableRow", "TableSelection", "Text", "TextArea",
"UIEvent", "Window", "XMLHttpRequest", "XMLSerializer",
"XPathException", "XPathResult", "XSLTProcessor",
-
+
/*
* These keywords trigger the loading of the java-plugin. For the
* next-generation plugin, this results in starting a new Java process.
@@ -170,7 +333,8 @@
"JavaArray", "JavaMember",
// GWT-defined identifiers
- "$wnd", "$doc", "$entry", "$moduleName", "$moduleBase", "$gwt_version", "$sessionId",
+ "$wnd", "$doc", "$entry", "$moduleName", "$moduleBase", "$gwt_version",
+ "$sessionId",
// Identifiers used by JsStackEmulator; later set to obfuscatable
"$stack", "$stackDepth", "$location",
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsScope.java b/dev/core/src/com/google/gwt/dev/js/ast/JsScope.java
index b317f38..5dc5ed9 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsScope.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsScope.java
@@ -28,17 +28,17 @@
/**
* A scope is a factory for creating and allocating
- * {@link com.google.gwt.dev.js.ast.JsName}s. A JavaScript AST is built in
- * terms of abstract name objects without worrying about obfuscation,
+ * {@link com.google.gwt.dev.js.ast.JsName}s. A JavaScript AST is built in terms
+ * of abstract name objects without worrying about obfuscation,
* keyword/identifier blacklisting, and so on.
*
* <p>
*
- * Scopes are associated with {@link com.google.gwt.dev.js.ast.JsFunction}s,
- * but the two are not equivalent. Functions <i>have</i> scopes, but a scope
- * does not necessarily have an associated Function. Examples of this include
- * the {@link com.google.gwt.dev.js.ast.JsRootScope} and synthetic scopes that
- * might be created by a client.
+ * Scopes are associated with {@link com.google.gwt.dev.js.ast.JsFunction}s, but
+ * the two are not equivalent. Functions <i>have</i> scopes, but a scope does
+ * not necessarily have an associated Function. Examples of this include the
+ * {@link com.google.gwt.dev.js.ast.JsRootScope} and synthetic scopes that might
+ * be created by a client.
*
* <p>
*
@@ -46,9 +46,9 @@
* identifiers for names. Specifically, names in child scopes are chosen such
* that they do not conflict with names in their parent scopes. The ultimate
* parent is usually the global scope (see
- * {@link com.google.gwt.dev.js.ast.JsProgram#getGlobalScope()}), but
- * parentless scopes are useful for managing names that are always accessed with
- * a qualifier and could therefore never be confused with the global scope
+ * {@link com.google.gwt.dev.js.ast.JsProgram#getGlobalScope()}), but parentless
+ * scopes are useful for managing names that are always accessed with a
+ * qualifier and could therefore never be confused with the global scope
* hierarchy.
*/
public class JsScope implements Serializable {
@@ -162,7 +162,7 @@
* Returns an iterator for all the names defined by this scope.
*/
public Iterator<JsName> getAllNames() {
- return names.values().iterator();
+ return names.values().iterator();
}
/**
@@ -173,8 +173,8 @@
}
/**
- * Returns the parent scope of this scope, or <code>null</code> if this is
- * the root scope.
+ * Returns the parent scope of this scope, or <code>null</code> if this is the
+ * root scope.
*/
public final JsScope getParent() {
return parent;
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsStatement.java b/dev/core/src/com/google/gwt/dev/js/ast/JsStatement.java
index 3043cc1..6691c76 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsStatement.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsStatement.java
@@ -20,7 +20,7 @@
/**
* Abstract base class for JavaScript statement objects.
*/
-public abstract class JsStatement extends JsNode<JsStatement> {
+public abstract class JsStatement extends JsNode {
protected JsStatement(SourceInfo sourceInfo) {
super(sourceInfo);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsStringLiteral.java b/dev/core/src/com/google/gwt/dev/js/ast/JsStringLiteral.java
index f6fd8cc..6691d80 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsStringLiteral.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsStringLiteral.java
@@ -53,7 +53,7 @@
return false;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
v.visit(this, ctx);
v.endVisit(this, ctx);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsSwitch.java b/dev/core/src/com/google/gwt/dev/js/ast/JsSwitch.java
index 6e4d038..16341ab 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsSwitch.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsSwitch.java
@@ -45,7 +45,7 @@
this.expr = expr;
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
expr = v.accept(expr);
v.acceptWithInsertRemove(cases);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsSwitchMember.java b/dev/core/src/com/google/gwt/dev/js/ast/JsSwitchMember.java
index 26bee44..113901d 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsSwitchMember.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsSwitchMember.java
@@ -23,7 +23,7 @@
/**
* A member/case in a JavaScript switch object.
*/
-public abstract class JsSwitchMember extends JsNode<JsSwitchMember> {
+public abstract class JsSwitchMember extends JsNode {
protected final List<JsStatement> stmts = new ArrayList<JsStatement>();
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsThisRef.java b/dev/core/src/com/google/gwt/dev/js/ast/JsThisRef.java
index 356bec3..3f4ed82 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsThisRef.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsThisRef.java
@@ -49,7 +49,7 @@
return false;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
v.visit(this, ctx);
v.endVisit(this, ctx);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsThrow.java b/dev/core/src/com/google/gwt/dev/js/ast/JsThrow.java
index 17f98ce..6b45f97 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsThrow.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsThrow.java
@@ -41,7 +41,7 @@
this.expr = expr;
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
expr = v.accept(expr);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsTry.java b/dev/core/src/com/google/gwt/dev/js/ast/JsTry.java
index ae7ec34..35ca695 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsTry.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsTry.java
@@ -55,7 +55,7 @@
tryBlock = block;
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
tryBlock = v.accept(tryBlock);
v.acceptWithInsertRemove(catches);
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsUnaryOperation.java b/dev/core/src/com/google/gwt/dev/js/ast/JsUnaryOperation.java
index 4feadb6..bf323ce 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsUnaryOperation.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsUnaryOperation.java
@@ -54,7 +54,7 @@
this.arg = arg;
}
- public void traverse(JsVisitor v, JsContext<JsExpression> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (op.isModifying()) {
/*
* The delete operator is practically like an assignment of undefined, so
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsUnaryOperator.java b/dev/core/src/com/google/gwt/dev/js/ast/JsUnaryOperator.java
index 66abc96..454a1df 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsUnaryOperator.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsUnaryOperator.java
@@ -25,9 +25,9 @@
*/
BIT_NOT("~", 14, PREFIX), DEC("--", 14, POSTFIX | PREFIX), DELETE("delete",
- 14, PREFIX), INC("++", 14, POSTFIX | PREFIX), NEG("-", 14, PREFIX),
- POS("+", 14, PREFIX), NOT("!", 14, PREFIX),
- TYPEOF("typeof", 14, PREFIX), VOID("void", 14, PREFIX);
+ 14, PREFIX), INC("++", 14, POSTFIX | PREFIX), NEG("-", 14, PREFIX), POS(
+ "+", 14, PREFIX), NOT("!", 14, PREFIX), TYPEOF("typeof", 14, PREFIX), VOID(
+ "void", 14, PREFIX);
private final int mask;
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsVars.java b/dev/core/src/com/google/gwt/dev/js/ast/JsVars.java
index 5b37e06..2e55e33 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsVars.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsVars.java
@@ -29,7 +29,7 @@
/**
* A var declared using the JavaScript <code>var</code> statement.
*/
- public static class JsVar extends JsNode<JsVar> implements HasName {
+ public static class JsVar extends JsNode implements HasName {
private JsExpression initExpr;
@@ -52,7 +52,7 @@
this.initExpr = initExpr;
}
- public void traverse(JsVisitor v, JsContext<JsVar> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
if (initExpr != null) {
initExpr = v.accept(initExpr);
@@ -85,7 +85,7 @@
return vars.iterator();
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
v.acceptWithInsertRemove(vars);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsVisitable.java b/dev/core/src/com/google/gwt/dev/js/ast/JsVisitable.java
index 2a111f7..cd37d2f 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsVisitable.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsVisitable.java
@@ -17,10 +17,8 @@
/**
* Abstracts the idea that a class can be traversed.
- *
- * @param <T>
*/
-public interface JsVisitable<T extends JsVisitable<T>> {
+public interface JsVisitable {
/**
* Causes this object to have the visitor visit itself and its children.
@@ -28,5 +26,5 @@
* @param visitor the visitor that should traverse this node
* @param ctx the context of an existing traversal
*/
- void traverse(JsVisitor visitor, JsContext<T> ctx);
+ void traverse(JsVisitor visitor, JsContext ctx);
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsVisitor.java b/dev/core/src/com/google/gwt/dev/js/ast/JsVisitor.java
index 3292713..e64799f 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsVisitor.java
@@ -28,7 +28,7 @@
@SuppressWarnings("unused")
public class JsVisitor {
- protected static final JsContext<JsExpression> LVALUE_CONTEXT = new JsContext<JsExpression>() {
+ protected static final JsContext LVALUE_CONTEXT = new JsContext() {
public boolean canInsert() {
return false;
@@ -38,11 +38,11 @@
return false;
}
- public void insertAfter(JsExpression node) {
+ public void insertAfter(JsVisitable node) {
throw new UnsupportedOperationException();
}
- public void insertBefore(JsExpression node) {
+ public void insertBefore(JsVisitable node) {
throw new UnsupportedOperationException();
}
@@ -54,12 +54,11 @@
throw new UnsupportedOperationException();
}
- public void replaceMe(JsExpression node) {
+ public void replaceMe(JsVisitable node) {
throw new UnsupportedOperationException();
}
};
- @SuppressWarnings("unchecked")
protected static final JsContext UNMODIFIABLE_CONTEXT = new JsContext() {
public boolean canInsert() {
@@ -91,14 +90,14 @@
}
};
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("cast")
public final <T extends JsVisitable> T accept(T node) {
// The following cast to T is needed for javac 1.5.0_13
// as shipped on OS X
return (T) doAccept(node);
}
- public final <T extends JsVisitable<T>> void acceptList(List<T> collection) {
+ public final <T extends JsVisitable> void acceptList(List<T> collection) {
doAcceptList(collection);
}
@@ -106,7 +105,7 @@
return doAcceptLvalue(expr);
}
- public final <T extends JsVisitable<T>> void acceptWithInsertRemove(
+ public final <T extends JsVisitable> void acceptWithInsertRemove(
List<T> collection) {
doAcceptWithInsertRemove(collection);
}
@@ -115,319 +114,315 @@
throw new UnsupportedOperationException();
}
- public void endVisit(JsArrayAccess x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsArrayAccess x, JsContext ctx) {
}
- public void endVisit(JsArrayLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsArrayLiteral x, JsContext ctx) {
}
- public void endVisit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsBinaryOperation x, JsContext ctx) {
}
- public void endVisit(JsBlock x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsBlock x, JsContext ctx) {
}
- public void endVisit(JsBooleanLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsBooleanLiteral x, JsContext ctx) {
}
- public void endVisit(JsBreak x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsBreak x, JsContext ctx) {
}
- public void endVisit(JsCase x, JsContext<JsSwitchMember> ctx) {
+ public void endVisit(JsCase x, JsContext ctx) {
}
- public void endVisit(JsCatch x, JsContext<JsCatch> ctx) {
+ public void endVisit(JsCatch x, JsContext ctx) {
}
- public void endVisit(JsConditional x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsConditional x, JsContext ctx) {
}
- public void endVisit(JsContinue x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsContinue x, JsContext ctx) {
}
- public void endVisit(JsDebugger x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsDebugger x, JsContext ctx) {
}
- public void endVisit(JsDefault x, JsContext<JsSwitchMember> ctx) {
+ public void endVisit(JsDefault x, JsContext ctx) {
}
- public void endVisit(JsDoWhile x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsDoWhile x, JsContext ctx) {
}
- public void endVisit(JsEmpty x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsEmpty x, JsContext ctx) {
}
- public void endVisit(JsExprStmt x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsExprStmt x, JsContext ctx) {
}
- public void endVisit(JsFor x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsFor x, JsContext ctx) {
}
- public void endVisit(JsForIn x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsForIn x, JsContext ctx) {
}
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
}
- public void endVisit(JsIf x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsIf x, JsContext ctx) {
}
- public void endVisit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsInvocation x, JsContext ctx) {
}
- public void endVisit(JsLabel x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsLabel x, JsContext ctx) {
}
- public void endVisit(JsNameOf x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameOf x, JsContext ctx) {
}
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
}
- public void endVisit(JsNew x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNew x, JsContext ctx) {
}
- public void endVisit(JsNullLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNullLiteral x, JsContext ctx) {
}
- public void endVisit(JsNumberLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNumberLiteral x, JsContext ctx) {
}
- public void endVisit(JsObjectLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsObjectLiteral x, JsContext ctx) {
}
- public void endVisit(JsParameter x, JsContext<JsParameter> ctx) {
+ public void endVisit(JsParameter x, JsContext ctx) {
}
- public void endVisit(JsPostfixOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsPostfixOperation x, JsContext ctx) {
}
- public void endVisit(JsPrefixOperation x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsPrefixOperation x, JsContext ctx) {
}
- public void endVisit(JsProgram x, JsContext<JsProgram> ctx) {
+ public void endVisit(JsProgram x, JsContext ctx) {
}
- public void endVisit(JsProgramFragment x, JsContext<JsProgramFragment> ctx) {
+ public void endVisit(JsProgramFragment x, JsContext ctx) {
}
- public void endVisit(JsPropertyInitializer x,
- JsContext<JsPropertyInitializer> ctx) {
+ public void endVisit(JsPropertyInitializer x, JsContext ctx) {
}
- public void endVisit(JsRegExp x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsRegExp x, JsContext ctx) {
}
- public void endVisit(JsReturn x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsReturn x, JsContext ctx) {
}
- public void endVisit(JsStringLiteral x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsStringLiteral x, JsContext ctx) {
}
- public void endVisit(JsSwitch x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsSwitch x, JsContext ctx) {
}
- public void endVisit(JsThisRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsThisRef x, JsContext ctx) {
}
- public void endVisit(JsThrow x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsThrow x, JsContext ctx) {
}
- public void endVisit(JsTry x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsTry x, JsContext ctx) {
}
- public void endVisit(JsVar x, JsContext<JsVar> ctx) {
+ public void endVisit(JsVar x, JsContext ctx) {
}
- public void endVisit(JsVars x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsVars x, JsContext ctx) {
}
- public void endVisit(JsWhile x, JsContext<JsStatement> ctx) {
+ public void endVisit(JsWhile x, JsContext ctx) {
}
- public boolean visit(JsArrayAccess x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsArrayAccess x, JsContext ctx) {
return true;
}
- public boolean visit(JsArrayLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsArrayLiteral x, JsContext ctx) {
return true;
}
- public boolean visit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsBinaryOperation x, JsContext ctx) {
return true;
}
- public boolean visit(JsBlock x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsBlock x, JsContext ctx) {
return true;
}
- public boolean visit(JsBooleanLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsBooleanLiteral x, JsContext ctx) {
return true;
}
- public boolean visit(JsBreak x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsBreak x, JsContext ctx) {
return true;
}
- public boolean visit(JsCase x, JsContext<JsSwitchMember> ctx) {
+ public boolean visit(JsCase x, JsContext ctx) {
return true;
}
- public boolean visit(JsCatch x, JsContext<JsCatch> ctx) {
+ public boolean visit(JsCatch x, JsContext ctx) {
return true;
}
- public boolean visit(JsConditional x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsConditional x, JsContext ctx) {
return true;
}
- public boolean visit(JsContinue x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsContinue x, JsContext ctx) {
return true;
}
- public boolean visit(JsDebugger x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsDebugger x, JsContext ctx) {
return true;
}
- public boolean visit(JsDefault x, JsContext<JsSwitchMember> ctx) {
+ public boolean visit(JsDefault x, JsContext ctx) {
return true;
}
- public boolean visit(JsDoWhile x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsDoWhile x, JsContext ctx) {
return true;
}
- public boolean visit(JsEmpty x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsEmpty x, JsContext ctx) {
return true;
}
- public boolean visit(JsExprStmt x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsExprStmt x, JsContext ctx) {
return true;
}
- public boolean visit(JsFor x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsFor x, JsContext ctx) {
return true;
}
- public boolean visit(JsForIn x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsForIn x, JsContext ctx) {
return true;
}
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
return true;
}
- public boolean visit(JsIf x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsIf x, JsContext ctx) {
return true;
}
- public boolean visit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsInvocation x, JsContext ctx) {
return true;
}
- public boolean visit(JsLabel x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsLabel x, JsContext ctx) {
return true;
}
- public boolean visit(JsNameOf x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNameOf x, JsContext ctx) {
return true;
}
- public boolean visit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNameRef x, JsContext ctx) {
return true;
}
- public boolean visit(JsNew x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNew x, JsContext ctx) {
return true;
}
- public boolean visit(JsNullLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNullLiteral x, JsContext ctx) {
return true;
}
- public boolean visit(JsNumberLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNumberLiteral x, JsContext ctx) {
return true;
}
- public boolean visit(JsObjectLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsObjectLiteral x, JsContext ctx) {
return true;
}
- public boolean visit(JsParameter x, JsContext<JsParameter> ctx) {
+ public boolean visit(JsParameter x, JsContext ctx) {
return true;
}
- public boolean visit(JsPostfixOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsPostfixOperation x, JsContext ctx) {
return true;
}
- public boolean visit(JsPrefixOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsPrefixOperation x, JsContext ctx) {
return true;
}
- public boolean visit(JsProgram x, JsContext<JsProgram> ctx) {
+ public boolean visit(JsProgram x, JsContext ctx) {
return true;
}
- public boolean visit(JsProgramFragment x, JsContext<JsProgramFragment> ctx) {
+ public boolean visit(JsProgramFragment x, JsContext ctx) {
return true;
}
- public boolean visit(JsPropertyInitializer x,
- JsContext<JsPropertyInitializer> ctx) {
+ public boolean visit(JsPropertyInitializer x, JsContext ctx) {
return true;
}
- public boolean visit(JsRegExp x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsRegExp x, JsContext ctx) {
return true;
}
- public boolean visit(JsReturn x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsReturn x, JsContext ctx) {
return true;
}
- public boolean visit(JsStringLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsStringLiteral x, JsContext ctx) {
return true;
}
- public boolean visit(JsSwitch x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsSwitch x, JsContext ctx) {
return true;
}
- public boolean visit(JsThisRef x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsThisRef x, JsContext ctx) {
return true;
}
- public boolean visit(JsThrow x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsThrow x, JsContext ctx) {
return true;
}
- public boolean visit(JsTry x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsTry x, JsContext ctx) {
return true;
}
- public boolean visit(JsVar x, JsContext<JsVar> ctx) {
+ public boolean visit(JsVar x, JsContext ctx) {
return true;
}
- public boolean visit(JsVars x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsVars x, JsContext ctx) {
return true;
}
- public boolean visit(JsWhile x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsWhile x, JsContext ctx) {
return true;
}
- @SuppressWarnings({"unchecked", "cast"})
- protected <T extends JsVisitable<T>> T doAccept(T node) {
- doTraverse(node, (JsContext<T>) UNMODIFIABLE_CONTEXT);
+ protected <T extends JsVisitable> T doAccept(T node) {
+ doTraverse(node, UNMODIFIABLE_CONTEXT);
return node;
}
- @SuppressWarnings({"unchecked", "cast"})
- protected <T extends JsVisitable<T>> void doAcceptList(List<T> collection) {
+ protected <T extends JsVisitable> void doAcceptList(List<T> collection) {
for (Iterator<T> it = collection.iterator(); it.hasNext();) {
- doTraverse(it.next(), (JsContext<T>) UNMODIFIABLE_CONTEXT);
+ doTraverse(it.next(), UNMODIFIABLE_CONTEXT);
}
}
@@ -436,16 +431,14 @@
return expr;
}
- @SuppressWarnings({"unchecked", "cast"})
- protected <T extends JsVisitable<T>> void doAcceptWithInsertRemove(
+ protected <T extends JsVisitable> void doAcceptWithInsertRemove(
List<T> collection) {
for (Iterator<T> it = collection.iterator(); it.hasNext();) {
- doTraverse(it.next(), (JsContext<T>) UNMODIFIABLE_CONTEXT);
+ doTraverse(it.next(), UNMODIFIABLE_CONTEXT);
}
}
- protected final <T extends JsVisitable<T>> void doTraverse(T node,
- JsContext<T> ctx) {
+ protected final <T extends JsVisitable> void doTraverse(T node, JsContext ctx) {
try {
node.traverse(this, ctx);
} catch (Throwable e) {
@@ -453,8 +446,8 @@
}
}
- private <T extends JsVisitable<T>> InternalCompilerException translateException(
- T node, Throwable e) {
+ private InternalCompilerException translateException(JsVisitable node,
+ Throwable e) {
if (e instanceof VirtualMachineError) {
// Always rethrow VM errors (an attempt to wrap may fail).
throw (VirtualMachineError) e;
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsWhile.java b/dev/core/src/com/google/gwt/dev/js/ast/JsWhile.java
index 5bed233..af2b9d0 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsWhile.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsWhile.java
@@ -52,7 +52,7 @@
this.condition = condition;
}
- public void traverse(JsVisitor v, JsContext<JsStatement> ctx) {
+ public void traverse(JsVisitor v, JsContext ctx) {
if (v.visit(this, ctx)) {
condition = v.accept(condition);
body = v.accept(body);
diff --git a/dev/core/src/com/google/gwt/dev/shell/Jsni.java b/dev/core/src/com/google/gwt/dev/shell/Jsni.java
index 19bd33d..a5a2d45 100644
--- a/dev/core/src/com/google/gwt/dev/shell/Jsni.java
+++ b/dev/core/src/com/google/gwt/dev/shell/Jsni.java
@@ -43,7 +43,8 @@
/**
* Generate source code, fixing up any JSNI references for hosted mode.
*
- * <p/><table>
+ * <p/>
+ * <table>
* <tr>
* <td>Original</td>
* <td>Becomes</td>
@@ -98,7 +99,7 @@
* This will handle references to fields or tear-offs of Java methods.
*/
@Override
- public boolean visit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNameRef x, JsContext ctx) {
String ident = x.getIdent();
JsExpression q = x.getQualifier();
if (ident.startsWith("@")) {
@@ -110,15 +111,14 @@
} else {
member = dispatchInfo.getClassInfoByDispId(dispId).getMember(dispId);
}
-
+
if (member == null) {
throw new HostedModeException(
"JSNI rewriter found reference to non-existent field in a field reference or java method tear-off: "
+ ident + " at " + x.getSourceInfo());
}
- if (member instanceof Field
- || member instanceof SyntheticClassMember) {
+ if (member instanceof Field || member instanceof SyntheticClassMember) {
if (q != null) {
accept(q);
out.print("[");
@@ -167,7 +167,7 @@
* correctly on some browsers.
*/
@Override
- public boolean visit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsInvocation x, JsContext ctx) {
if (x.getQualifier() instanceof JsNameRef) {
JsNameRef ref = (JsNameRef) x.getQualifier();
String ident = ref.getIdent();
@@ -186,14 +186,13 @@
"JSNI rewriter found reference to non-existent field in a method invocation: "
+ ref.getIdent() + " at " + ref.getSourceInfo());
}
-
+
/*
* Make sure the ident is a reference to a method or constructor and
* not a reference to a field whose contents (e.g. a Function) we
* intend to immediately invoke.
*
* p.C::method()(); versus p.C::field();
- *
*/
if (member instanceof Method || member instanceof Constructor<?>) {
@@ -256,7 +255,7 @@
* JSNI idents have been replaced with legal JavaScript for hosted mode.
*/
private static String generateJavaScriptForHostedMode(
- DispatchIdOracle dispatchInfo, JsProgram program, JsNode<?> node) {
+ DispatchIdOracle dispatchInfo, JsProgram program, JsNode node) {
DefaultTextOutput out = new DefaultTextOutput(false);
JsSourceGenWithJsniIdentFixup vi = new JsSourceGenWithJsniIdentFixup(out,
dispatchInfo, program);
diff --git a/dev/core/test/com/google/gwt/dev/javac/JsniCollectorTest.java b/dev/core/test/com/google/gwt/dev/javac/JsniCollectorTest.java
index 33d8d61..afe4107 100644
--- a/dev/core/test/com/google/gwt/dev/javac/JsniCollectorTest.java
+++ b/dev/core/test/com/google/gwt/dev/javac/JsniCollectorTest.java
@@ -18,7 +18,6 @@
import com.google.gwt.dev.javac.impl.StaticJavaResource;
import com.google.gwt.dev.jjs.SourceInfo;
import com.google.gwt.dev.js.ast.JsContext;
-import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsNameRef;
import com.google.gwt.dev.js.ast.JsVisitor;
@@ -125,7 +124,7 @@
final List<JsNameRef> foundRefs = new ArrayList<JsNameRef>();
new JsVisitor() {
@Override
- public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsNameRef x, JsContext ctx) {
if (x.getIdent().startsWith("@")) {
foundRefs.add(x);
}
diff --git a/dev/core/test/com/google/gwt/dev/js/ComparingVisitor.java b/dev/core/test/com/google/gwt/dev/js/ComparingVisitor.java
index 76dae3d..a7c91d0 100644
--- a/dev/core/test/com/google/gwt/dev/js/ComparingVisitor.java
+++ b/dev/core/test/com/google/gwt/dev/js/ComparingVisitor.java
@@ -28,12 +28,10 @@
import com.google.gwt.dev.js.ast.JsContext;
import com.google.gwt.dev.js.ast.JsContinue;
import com.google.gwt.dev.js.ast.JsDebugger;
-import com.google.gwt.dev.js.ast.JsNumberLiteral;
import com.google.gwt.dev.js.ast.JsDefault;
import com.google.gwt.dev.js.ast.JsDoWhile;
import com.google.gwt.dev.js.ast.JsEmpty;
import com.google.gwt.dev.js.ast.JsExprStmt;
-import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsFor;
import com.google.gwt.dev.js.ast.JsForIn;
import com.google.gwt.dev.js.ast.JsFunction;
@@ -44,6 +42,7 @@
import com.google.gwt.dev.js.ast.JsNameRef;
import com.google.gwt.dev.js.ast.JsNew;
import com.google.gwt.dev.js.ast.JsNullLiteral;
+import com.google.gwt.dev.js.ast.JsNumberLiteral;
import com.google.gwt.dev.js.ast.JsObjectLiteral;
import com.google.gwt.dev.js.ast.JsParameter;
import com.google.gwt.dev.js.ast.JsPostfixOperation;
@@ -55,15 +54,14 @@
import com.google.gwt.dev.js.ast.JsStatement;
import com.google.gwt.dev.js.ast.JsStringLiteral;
import com.google.gwt.dev.js.ast.JsSwitch;
-import com.google.gwt.dev.js.ast.JsSwitchMember;
import com.google.gwt.dev.js.ast.JsThisRef;
import com.google.gwt.dev.js.ast.JsThrow;
import com.google.gwt.dev.js.ast.JsTry;
import com.google.gwt.dev.js.ast.JsVars;
+import com.google.gwt.dev.js.ast.JsVars.JsVar;
import com.google.gwt.dev.js.ast.JsVisitable;
import com.google.gwt.dev.js.ast.JsVisitor;
import com.google.gwt.dev.js.ast.JsWhile;
-import com.google.gwt.dev.js.ast.JsVars.JsVar;
import junit.framework.Assert;
import junit.framework.TestCase;
@@ -78,7 +76,7 @@
compare(expectedTree, actualTree);
}
- private static void compare(JsVisitable<?> expected, JsVisitable<?> actual) {
+ private static void compare(JsVisitable expected, JsVisitable actual) {
if (expected == actual) {
return;
}
@@ -104,24 +102,24 @@
*/
private final JsVisitable other;
- private ComparingVisitor(JsVisitable<?> other) {
+ private ComparingVisitor(JsVisitable other) {
this.other = other;
}
@Override
- public boolean visit(JsArrayAccess x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsArrayAccess x, JsContext ctx) {
Assert.assertTrue(other instanceof JsArrayAccess);
return false;
}
@Override
- public boolean visit(JsArrayLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsArrayLiteral x, JsContext ctx) {
Assert.assertTrue(other instanceof JsArrayLiteral);
return false;
}
@Override
- public boolean visit(JsBinaryOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsBinaryOperation x, JsContext ctx) {
Assert.assertTrue(other instanceof JsBinaryOperation);
Assert.assertEquals(((JsBinaryOperation) other).getOperator().getSymbol(),
x.getOperator().getSymbol());
@@ -129,21 +127,21 @@
}
@Override
- public boolean visit(JsBlock x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsBlock x, JsContext ctx) {
Assert.assertTrue(other instanceof JsBlock);
Assert.assertEquals(((JsBlock) other).isGlobalBlock(), x.isGlobalBlock());
return false;
}
@Override
- public boolean visit(JsBooleanLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsBooleanLiteral x, JsContext ctx) {
Assert.assertTrue(other instanceof JsBooleanLiteral);
Assert.assertEquals(((JsBooleanLiteral) other).getValue(), x.getValue());
return false;
}
@Override
- public boolean visit(JsBreak x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsBreak x, JsContext ctx) {
Assert.assertTrue(other instanceof JsBreak);
Assert.assertEquals(((JsBreak) other).getLabel().getIdent(),
x.getLabel().getIdent());
@@ -151,13 +149,13 @@
}
@Override
- public boolean visit(JsCase x, JsContext<JsSwitchMember> ctx) {
+ public boolean visit(JsCase x, JsContext ctx) {
Assert.assertTrue(other instanceof JsCase);
return false;
}
@Override
- public boolean visit(JsCatch x, JsContext<JsCatch> ctx) {
+ public boolean visit(JsCatch x, JsContext ctx) {
Assert.assertTrue(other instanceof JsCatch);
Assert.assertEquals(((JsCatch) other).getParameter().getName().getIdent(),
x.getParameter().getName().getIdent());
@@ -165,13 +163,13 @@
}
@Override
- public boolean visit(JsConditional x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsConditional x, JsContext ctx) {
Assert.assertTrue(other instanceof JsConditional);
return false;
}
@Override
- public boolean visit(JsContinue x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsContinue x, JsContext ctx) {
Assert.assertTrue(other instanceof JsContinue);
Assert.assertEquals(((JsContinue) other).getLabel().getIdent(),
x.getLabel().getIdent());
@@ -179,49 +177,49 @@
}
@Override
- public boolean visit(JsDebugger x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsDebugger x, JsContext ctx) {
Assert.assertTrue(other instanceof JsDebugger);
return false;
}
@Override
- public boolean visit(JsDefault x, JsContext<JsSwitchMember> ctx) {
+ public boolean visit(JsDefault x, JsContext ctx) {
Assert.assertTrue(other instanceof JsDefault);
return false;
}
@Override
- public boolean visit(JsDoWhile x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsDoWhile x, JsContext ctx) {
Assert.assertTrue(other instanceof JsDoWhile);
return false;
}
@Override
- public boolean visit(JsEmpty x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsEmpty x, JsContext ctx) {
Assert.assertTrue(other instanceof JsEmpty);
return false;
}
@Override
- public boolean visit(JsExprStmt x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsExprStmt x, JsContext ctx) {
Assert.assertTrue(other instanceof JsExprStmt);
return false;
}
@Override
- public boolean visit(JsFor x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsFor x, JsContext ctx) {
Assert.assertTrue(other instanceof JsFor);
return false;
}
@Override
- public boolean visit(JsForIn x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsForIn x, JsContext ctx) {
Assert.assertTrue(other instanceof JsForIn);
return false;
}
@Override
- public boolean visit(JsFunction x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsFunction x, JsContext ctx) {
Assert.assertTrue(other instanceof JsFunction);
JsFunction otherFunc = (JsFunction) other;
JsName otherName = otherFunc.getName();
@@ -233,19 +231,19 @@
}
@Override
- public boolean visit(JsIf x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsIf x, JsContext ctx) {
Assert.assertTrue(other instanceof JsIf);
return false;
}
@Override
- public boolean visit(JsInvocation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsInvocation x, JsContext ctx) {
Assert.assertTrue(other instanceof JsInvocation);
return false;
}
@Override
- public boolean visit(JsLabel x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsLabel x, JsContext ctx) {
Assert.assertTrue(other instanceof JsLabel);
Assert.assertEquals(((JsLabel) other).getName().getIdent(),
x.getName().getIdent());
@@ -253,39 +251,39 @@
}
@Override
- public boolean visit(JsNameRef x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNameRef x, JsContext ctx) {
Assert.assertTrue(other instanceof JsNameRef);
Assert.assertEquals(((JsNameRef) other).getIdent(), x.getIdent());
return false;
}
@Override
- public boolean visit(JsNew x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNew x, JsContext ctx) {
Assert.assertTrue(other instanceof JsNew);
return false;
}
@Override
- public boolean visit(JsNullLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNullLiteral x, JsContext ctx) {
Assert.assertTrue(other instanceof JsNullLiteral);
return false;
}
@Override
- public boolean visit(JsNumberLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsNumberLiteral x, JsContext ctx) {
Assert.assertTrue(other instanceof JsNumberLiteral);
Assert.assertEquals(((JsNumberLiteral) other).getValue(), x.getValue());
return false;
}
@Override
- public boolean visit(JsObjectLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsObjectLiteral x, JsContext ctx) {
Assert.assertTrue(other instanceof JsObjectLiteral);
return false;
}
@Override
- public boolean visit(JsParameter x, JsContext<JsParameter> ctx) {
+ public boolean visit(JsParameter x, JsContext ctx) {
Assert.assertTrue(other instanceof JsParameter);
Assert.assertEquals(((JsParameter) other).getName().getIdent(),
x.getName().getIdent());
@@ -293,7 +291,7 @@
}
@Override
- public boolean visit(JsPostfixOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsPostfixOperation x, JsContext ctx) {
Assert.assertTrue(other instanceof JsPostfixOperation);
Assert.assertEquals(((JsPostfixOperation) other).getOperator().getSymbol(),
x.getOperator().getSymbol());
@@ -301,7 +299,7 @@
}
@Override
- public boolean visit(JsPrefixOperation x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsPrefixOperation x, JsContext ctx) {
Assert.assertTrue(other instanceof JsPrefixOperation);
Assert.assertEquals(((JsPrefixOperation) other).getOperator().getSymbol(),
x.getOperator().getSymbol());
@@ -309,20 +307,19 @@
}
@Override
- public boolean visit(JsProgram x, JsContext<JsProgram> ctx) {
+ public boolean visit(JsProgram x, JsContext ctx) {
Assert.assertTrue(other instanceof JsProgram);
return false;
}
@Override
- public boolean visit(JsPropertyInitializer x,
- JsContext<JsPropertyInitializer> ctx) {
+ public boolean visit(JsPropertyInitializer x, JsContext ctx) {
Assert.assertTrue(other instanceof JsPropertyInitializer);
return false;
}
@Override
- public boolean visit(JsRegExp x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsRegExp x, JsContext ctx) {
Assert.assertTrue(other instanceof JsRegExp);
Assert.assertEquals(((JsRegExp) other).getFlags(), x.getFlags());
Assert.assertEquals(((JsRegExp) other).getPattern(), x.getPattern());
@@ -330,56 +327,56 @@
}
@Override
- public boolean visit(JsReturn x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsReturn x, JsContext ctx) {
Assert.assertTrue(other instanceof JsReturn);
return false;
}
@Override
- public boolean visit(JsStringLiteral x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsStringLiteral x, JsContext ctx) {
Assert.assertTrue(other instanceof JsStringLiteral);
Assert.assertEquals(((JsStringLiteral) other).getValue(), x.getValue());
return false;
}
@Override
- public boolean visit(JsSwitch x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsSwitch x, JsContext ctx) {
Assert.assertTrue(other instanceof JsSwitch);
return false;
}
@Override
- public boolean visit(JsThisRef x, JsContext<JsExpression> ctx) {
+ public boolean visit(JsThisRef x, JsContext ctx) {
Assert.assertTrue(other instanceof JsThisRef);
return false;
}
@Override
- public boolean visit(JsThrow x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsThrow x, JsContext ctx) {
Assert.assertTrue(other instanceof JsThrow);
return false;
}
@Override
- public boolean visit(JsTry x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsTry x, JsContext ctx) {
Assert.assertTrue(other instanceof JsTry);
return false;
}
@Override
- public boolean visit(JsVar x, JsContext<JsVar> ctx) {
+ public boolean visit(JsVar x, JsContext ctx) {
TestCase.assertTrue(other instanceof JsVar);
TestCase.assertEquals(((JsVar) other).getName().getIdent(),
x.getName().getIdent());
return false;
}
- public boolean visit(JsVars x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsVars x, JsContext ctx) {
TestCase.assertTrue(other instanceof JsVars);
return false;
}
- public boolean visit(JsWhile x, JsContext<JsStatement> ctx) {
+ public boolean visit(JsWhile x, JsContext ctx) {
TestCase.assertTrue(other instanceof JsWhile);
return false;
}
diff --git a/dev/core/test/com/google/gwt/dev/js/FlatteningVisitor.java b/dev/core/test/com/google/gwt/dev/js/FlatteningVisitor.java
index 1dc0dbf..b7b99ec 100644
--- a/dev/core/test/com/google/gwt/dev/js/FlatteningVisitor.java
+++ b/dev/core/test/com/google/gwt/dev/js/FlatteningVisitor.java
@@ -32,10 +32,10 @@
}
public static class TreeNode {
- public final JsVisitable<?> node;
+ public final JsVisitable node;
public final List<TreeNode> children = new ArrayList<TreeNode>();
- public TreeNode(JsVisitable<?> node) {
+ public TreeNode(JsVisitable node) {
this.node = node;
}
}
@@ -46,7 +46,7 @@
root = new TreeNode(null);
}
- protected <T extends JsVisitable<T>> T doAccept(T node) {
+ protected <T extends JsVisitable> T doAccept(T node) {
TreeNode oldRoot = root;
root = new TreeNode(node);
oldRoot.children.add(root);
@@ -55,7 +55,7 @@
return node;
}
- protected <T extends JsVisitable<T>> void doAcceptList(List<T> collection) {
+ protected <T extends JsVisitable> void doAcceptList(List<T> collection) {
for (Iterator<T> it = collection.iterator(); it.hasNext();) {
doAccept(it.next());
}
diff --git a/dev/core/test/com/google/gwt/dev/js/JsInlinerTest.java b/dev/core/test/com/google/gwt/dev/js/JsInlinerTest.java
index cb1f37b..fdecc01 100644
--- a/dev/core/test/com/google/gwt/dev/js/JsInlinerTest.java
+++ b/dev/core/test/com/google/gwt/dev/js/JsInlinerTest.java
@@ -16,7 +16,6 @@
package com.google.gwt.dev.js;
import com.google.gwt.dev.js.ast.JsContext;
-import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsFunction;
import com.google.gwt.dev.js.ast.JsModVisitor;
import com.google.gwt.dev.js.ast.JsName;
@@ -29,14 +28,18 @@
private static class FixStaticRefsVisitor extends JsModVisitor {
+ /**
+ * Called reflectively.
+ */
+ @SuppressWarnings("unused")
public static void exec(JsProgram program) {
(new FixStaticRefsVisitor()).accept(program);
}
@Override
- public void endVisit(JsFunction x, JsContext<JsExpression> ctx) {
+ public void endVisit(JsFunction x, JsContext ctx) {
JsName name = x.getName();
- if (name != null) {
+ if (name != null) {
name.setStaticRef(x);
}
}
@@ -56,15 +59,16 @@
+ "function b1() { var x=a1(function blah(){}, 10); } b1();";
compare(input2, input2);
}
-
+
public void testInlineObjectLiterals() throws Exception {
String input = "function a1(arg, x) { arg.x = x; return arg; }"
+ "function b1() { var x=a1({}, 10); } b1();";
compare(input, input);
}
+
/**
* A test for mutually-recursive functions. Setup:
- *
+ *
* <pre>
* a -> b, c
* b -> a, c
diff --git a/dev/core/test/com/google/gwt/dev/js/JsToStringGenerationVisitorAccuracyTest.java b/dev/core/test/com/google/gwt/dev/js/JsToStringGenerationVisitorAccuracyTest.java
index b1a2002..590ffe4 100644
--- a/dev/core/test/com/google/gwt/dev/js/JsToStringGenerationVisitorAccuracyTest.java
+++ b/dev/core/test/com/google/gwt/dev/js/JsToStringGenerationVisitorAccuracyTest.java
@@ -16,10 +16,8 @@
package com.google.gwt.dev.js;
import com.google.gwt.dev.jjs.SourceOrigin;
-import com.google.gwt.dev.jjs.ast.JStringLiteral;
import com.google.gwt.dev.js.ast.JsProgram;
import com.google.gwt.dev.js.ast.JsStatement;
-import com.google.gwt.dev.js.ast.JsStringLiteral;
import com.google.gwt.dev.js.ast.JsVisitor;
import com.google.gwt.dev.util.DefaultTextOutput;
import com.google.gwt.dev.util.TextOutput;
@@ -105,7 +103,7 @@
public void testNumberLiteralNameRef() throws Exception {
doTest("(42).nameRef");
}
-
+
public void testObjectDeclarationArrayAccess() throws Exception {
doTest("({ a : 'b'})['a']");
}
@@ -140,10 +138,10 @@
// + prefix not stripped when operand is not literal number
doTest("var x = +y", "var x = +y");
// + prefix stripped when operand is literal number
- doTest("var x = +42","var x = 42");
+ doTest("var x = +42", "var x = 42");
}
-
- public void testEscapes() throws Exception {
+
+ public void testEscapes() {
// Use short octal escapes at the end of the string or when the next
// character is a non-digit
doTestEscapes("\u0000", "'\\0'");
@@ -161,16 +159,16 @@
"'\\0\\1\\2\\3\\4\\5\\6\\7'");
doTestEscapes("\u0008\u0009\n\u000b\u000c\r\u000e\u000f",
"'\\b\\t\\n\\13\\f\\r\\16\\17'");
-
+
// Use two-digit octal escapes for characters from 16 to 31
doTestEscapes("\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017",
"'\\20\\21\\22\\23\\24\\25\\26\\27'");
doTestEscapes("\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f",
"'\\30\\31\\32\\33\\34\\35\\36\\37'");
-
+
// Use two-digit hex escapes for characters up to 0xff
doTestEscapes("\u007f\u00ab", "'\\x7F\\xAB'");
-
+
// Use four-digit unicode escapes for characters from 0x100 up
doTestEscapes("\u0100\u117f\u2345", "'\\u0100\\u117F\\u2345'");
}
@@ -192,10 +190,10 @@
new JsProgram().getScope(), new StringReader(expectedJs));
ComparingVisitor.exec(expected, actual);
}
-
- private void doTestEscapes(String value, String expected) throws Exception {
- String actual =
- new JsProgram().getStringLiteral(SourceOrigin.UNKNOWN, value).toString();
+
+ private void doTestEscapes(String value, String expected) {
+ String actual = new JsProgram().getStringLiteral(SourceOrigin.UNKNOWN,
+ value).toString();
assertEquals(expected, actual);
}