Remove a bunch of unused SOYC infrastructure.
It turns out that there's a lot of infrastructure we built into SOYC that is essentially unused today. Most of what I'm removing has no impact on SOYC output.
There are slight changes that can be observed in detailedStories.xmls. I got rid of literal tracking except for String and Class, because the rest don't add to code size. I'm also recording more / corrected detail in some cases.
http://gwt-code-reviews.appspot.com/1345801/show
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9710 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/FunctionMember.java b/dev/core/src/com/google/gwt/core/ext/soyc/FunctionMember.java
deleted file mode 100644
index 574a292..0000000
--- a/dev/core/src/com/google/gwt/core/ext/soyc/FunctionMember.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-/**
- *
- */
-package com.google.gwt.core.ext.soyc;
-
-/**
- * Represents a JavaScript function in the compiled output. Due to compiler
- * optimizations, there may be arbitrary relationships between FunctionMembers
- * and MethodMembers.
- */
-public interface FunctionMember extends HasDependencies, Member {
-}
\ No newline at end of file
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/HasAliases.java b/dev/core/src/com/google/gwt/core/ext/soyc/HasAliases.java
deleted file mode 100644
index 354aff4..0000000
--- a/dev/core/src/com/google/gwt/core/ext/soyc/HasAliases.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.core.ext.soyc;
-
-import java.util.SortedSet;
-
-/**
- * A tag interface for Members to indicate that there may be additional,
- * possibly non-unique, names in the compiled output that refer to the member.
- */
-public interface HasAliases {
- /**
- * Returns any aliases used in the compiled output that refer to this
- * MethodMember. Note that especially in the case of
- * polymorphically-dispatched methods, there may be many MethodMembers with
- * overlapping aliases.
- */
- SortedSet<String> getJsAliases();
-}
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/Member.java b/dev/core/src/com/google/gwt/core/ext/soyc/Member.java
index a2ad370..e3fb16e 100644
--- a/dev/core/src/com/google/gwt/core/ext/soyc/Member.java
+++ b/dev/core/src/com/google/gwt/core/ext/soyc/Member.java
@@ -38,17 +38,6 @@
Comparator<Member> TYPE_AND_SOURCE_NAME_COMPARATOR = new TypeAndSourceNameComparator();
/**
- * Returns the (possibly obfuscated) identifier used in the output.
- */
- String getJsName();
-
- /**
- * Returns a description of where the source for the Member originated.
- * Usually, but not always, a URL.
- */
- String getSourceLocation();
-
- /**
* Returns the name of the Member in the original source code.
*/
String getSourceName();
@@ -64,11 +53,6 @@
FieldMember isField();
/**
- * Returns the Member if it is a FunctionMember or <code>null</code>.
- */
- FunctionMember isFunction();
-
- /**
* Returns the Member if it is a MethodMember or <code>null</code>.
*/
MethodMember isMethod();
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/MethodMember.java b/dev/core/src/com/google/gwt/core/ext/soyc/MethodMember.java
index 9966890..b797757 100644
--- a/dev/core/src/com/google/gwt/core/ext/soyc/MethodMember.java
+++ b/dev/core/src/com/google/gwt/core/ext/soyc/MethodMember.java
@@ -21,6 +21,6 @@
/**
* Represents compiled JS code derived from a Java method.
*/
-public interface MethodMember extends HasAliases, HasDependencies,
- HasEnclosing, HasOverrides<MethodMember>, Member {
+public interface MethodMember extends HasDependencies, HasEnclosing,
+ HasOverrides<MethodMember>, Member {
}
\ No newline at end of file
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/Story.java b/dev/core/src/com/google/gwt/core/ext/soyc/Story.java
index f1eac77..775f330 100644
--- a/dev/core/src/com/google/gwt/core/ext/soyc/Story.java
+++ b/dev/core/src/com/google/gwt/core/ext/soyc/Story.java
@@ -31,7 +31,6 @@
package com.google.gwt.core.ext.soyc;
import java.io.Serializable;
-import java.util.Set;
import java.util.SortedSet;
/**
@@ -39,32 +38,6 @@
* metadata is available.
*/
public interface Story extends Serializable {
- /*
- * Corresponds to a SourceInfo.
- */
-
- /**
- * Describes the physical or virtual source location from which a Story
- * originated.
- */
- public interface Origin extends Serializable {
- /*
- * Corresponds to a SourceOrigin.
- */
-
- /**
- * Returns the line number, or <code>0</code> if there is no physical
- * location.
- */
- int getLineNumber();
-
- /**
- * This is usually, but not always, a URL. If it is not a URL, it will
- * typically be a Java class name.
- */
- String getLocation();
- }
-
/**
* If the Story represents a literal value, this method will return a
* description of the type of literal. If the Story does not represent a
@@ -77,11 +50,4 @@
* Gets the Members of the compilation that the Story is about.
*/
SortedSet<Member> getMembers();
-
- /**
- * Returns the locations of the Story's source. Identical structures (such as
- * string literals) that appear in multiple locations in the source may be
- * merged by the compiler into a single Story.
- */
- Set<Origin> getSourceOrigin();
}
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/impl/AbstractMember.java b/dev/core/src/com/google/gwt/core/ext/soyc/impl/AbstractMember.java
index 136dc93..2b174a7 100644
--- a/dev/core/src/com/google/gwt/core/ext/soyc/impl/AbstractMember.java
+++ b/dev/core/src/com/google/gwt/core/ext/soyc/impl/AbstractMember.java
@@ -17,37 +17,13 @@
import com.google.gwt.core.ext.soyc.ClassMember;
import com.google.gwt.core.ext.soyc.FieldMember;
-import com.google.gwt.core.ext.soyc.FunctionMember;
import com.google.gwt.core.ext.soyc.Member;
import com.google.gwt.core.ext.soyc.MethodMember;
-import com.google.gwt.dev.jjs.Correlation;
-import com.google.gwt.dev.jjs.SourceInfo;
-import com.google.gwt.dev.jjs.Correlation.Axis;
/**
* Provides implementation of common Member functions.
*/
public abstract class AbstractMember implements Member {
- private final String jsName;
- private final String sourceLocation;
-
- public AbstractMember(SourceInfo info) {
- Correlation nameCorrelation = info.getPrimaryCorrelation(Axis.JS_NAME);
- if (nameCorrelation != null) {
- jsName = nameCorrelation.getName().getShortIdent();
- } else {
- jsName = null;
- }
- sourceLocation = info.getFileName();
- }
-
- public String getJsName() {
- return jsName;
- }
-
- public String getSourceLocation() {
- return sourceLocation;
- }
public abstract String getSourceName();
@@ -59,10 +35,6 @@
return this instanceof FieldMember ? (FieldMember) this : null;
}
- public FunctionMember isFunction() {
- return this instanceof FunctionMember ? (FunctionMember) this : null;
- }
-
public MethodMember isMethod() {
return this instanceof MethodMember ? (MethodMember) this : null;
}
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/impl/AbstractMemberWithDependencies.java b/dev/core/src/com/google/gwt/core/ext/soyc/impl/AbstractMemberWithDependencies.java
index 44fb5cf..7ce5c03 100644
--- a/dev/core/src/com/google/gwt/core/ext/soyc/impl/AbstractMemberWithDependencies.java
+++ b/dev/core/src/com/google/gwt/core/ext/soyc/impl/AbstractMemberWithDependencies.java
@@ -17,7 +17,6 @@
import com.google.gwt.core.ext.soyc.HasDependencies;
import com.google.gwt.core.ext.soyc.Member;
-import com.google.gwt.dev.jjs.SourceInfo;
import java.util.Collections;
import java.util.SortedSet;
@@ -32,10 +31,6 @@
Member.TYPE_AND_SOURCE_NAME_COMPARATOR);
private final SortedSet<Member> dependenciesView = Collections.unmodifiableSortedSet(dependencies);
- protected AbstractMemberWithDependencies(SourceInfo info) {
- super(info);
- }
-
/**
* Add a dependency.
*
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/impl/MemberFactory.java b/dev/core/src/com/google/gwt/core/ext/soyc/impl/MemberFactory.java
index d3e1620..541c096 100644
--- a/dev/core/src/com/google/gwt/core/ext/soyc/impl/MemberFactory.java
+++ b/dev/core/src/com/google/gwt/core/ext/soyc/impl/MemberFactory.java
@@ -19,7 +19,6 @@
import com.google.gwt.dev.jjs.ast.JDeclaredType;
import com.google.gwt.dev.jjs.ast.JField;
import com.google.gwt.dev.jjs.ast.JMethod;
-import com.google.gwt.dev.js.ast.JsFunction;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@@ -46,10 +45,6 @@
return getOrCreate(type, StandardClassMember.class, JDeclaredType.class);
}
- public StandardFunctionMember get(JsFunction function) {
- return getOrCreate(function, StandardFunctionMember.class, JsFunction.class);
- }
-
@SuppressWarnings("unchecked")
private <K, V extends Member> Map<K, V> getElementMap(Class<V> clazz) {
Map<K, V> elementMap = (Map<K, V>) map.get(clazz);
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/impl/OriginImpl.java b/dev/core/src/com/google/gwt/core/ext/soyc/impl/OriginImpl.java
deleted file mode 100644
index 405ada2..0000000
--- a/dev/core/src/com/google/gwt/core/ext/soyc/impl/OriginImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.core.ext.soyc.impl;
-
-import com.google.gwt.core.ext.soyc.Story.Origin;
-import com.google.gwt.dev.jjs.SourceOrigin;
-
-/**
- * An implementation of Origin, that initializes itself from a SourceOrigin.
- */
-public class OriginImpl implements Origin, Comparable<OriginImpl> {
-
- private final int lineNum;
- private final String location;
-
- public OriginImpl(SourceOrigin origin) {
- this.location = origin.getFileName();
- this.lineNum = origin.getStartLine();
- }
-
- public int compareTo(OriginImpl o) {
- int a = location.compareTo(o.location);
- if (a != 0) {
- return a;
- }
- return lineNum - o.lineNum;
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof OriginImpl)) {
- return false;
- }
- OriginImpl other = (OriginImpl) o;
- return location.equals(other.location) && lineNum == other.lineNum;
- }
-
- public int getLineNumber() {
- return lineNum;
- }
-
- public String getLocation() {
- return location;
- }
-
- @Override
- public int hashCode() {
- return location.hashCode() ^ lineNum;
- }
-
- @Override
- public String toString() {
- return location + " : " + lineNum;
- }
-}
\ No newline at end of file
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardClassMember.java b/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardClassMember.java
index 2bd1c17..7be5ba8 100644
--- a/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardClassMember.java
+++ b/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardClassMember.java
@@ -45,15 +45,14 @@
private final String packageName;
private final String sourceName;
private final JDeclaredType type;
-
+
/**
* Constructed by {@link MemberFactory#get(JReferenceType)}.
*/
public StandardClassMember(MemberFactory factory, JDeclaredType type) {
- super(type.getSourceInfo());
this.factory = factory;
this.type = type;
-
+
int index = type.getName().lastIndexOf('.');
if (index < 0) {
packageName = "";
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardFieldMember.java b/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardFieldMember.java
index e40185c..c955338 100644
--- a/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardFieldMember.java
+++ b/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardFieldMember.java
@@ -30,7 +30,6 @@
* Constructed by {@link MemberFactory#get(JFieldType)}.
*/
public StandardFieldMember(MemberFactory factory, JField field) {
- super(field.getSourceInfo());
this.enclosing = factory.get(field.getEnclosingType());
this.sourceName = field.getEnclosingType().getName() + "::"
+ field.getName();
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardFunctionMember.java b/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardFunctionMember.java
deleted file mode 100644
index 317565c..0000000
--- a/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardFunctionMember.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.core.ext.soyc.impl;
-
-import com.google.gwt.core.ext.soyc.FunctionMember;
-import com.google.gwt.dev.js.ast.JsFunction;
-
-/**
- * An implementation of FunctionMember.
- */
-public class StandardFunctionMember extends AbstractMemberWithDependencies
- implements FunctionMember {
-
- private final String sourceName;
-
- /**
- * Constructed by {@link MemberFactory#get(JsFunction)}.
- *
- * @param factory a MemberFactory instance
- */
- public StandardFunctionMember(MemberFactory factory, JsFunction function) {
- super(function.getSourceInfo());
- this.sourceName = function.getName().getIdent();
- }
-
- @Override
- public String getSourceName() {
- return sourceName;
- }
-
- /**
- * For debugging use only.
- */
- @Override
- public String toString() {
- return "FunctionMember " + sourceName;
- }
-}
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardMethodMember.java b/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardMethodMember.java
index e977e4f..c722c69 100644
--- a/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardMethodMember.java
+++ b/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardMethodMember.java
@@ -18,8 +18,6 @@
import com.google.gwt.core.ext.soyc.ClassMember;
import com.google.gwt.core.ext.soyc.Member;
import com.google.gwt.core.ext.soyc.MethodMember;
-import com.google.gwt.dev.jjs.Correlation;
-import com.google.gwt.dev.jjs.Correlation.Axis;
import com.google.gwt.dev.jjs.ast.JMethod;
import com.google.gwt.dev.jjs.ast.JType;
@@ -32,7 +30,6 @@
*/
public class StandardMethodMember extends AbstractMemberWithDependencies
implements MethodMember {
- private final SortedSet<String> aliasesView;
private final ClassMember enclosing;
private final String sourceName;
private final SortedSet<MethodMember> overridesView;
@@ -41,7 +38,6 @@
* Constructed by {@link MemberFactory#get(JMethod)}.
*/
public StandardMethodMember(MemberFactory factory, JMethod method) {
- super(method.getSourceInfo());
this.enclosing = factory.get(method.getEnclosingType());
StringBuilder sb = new StringBuilder();
@@ -54,13 +50,6 @@
sb.append(method.getOriginalReturnType().getJsniSignatureName());
this.sourceName = sb.toString();
- SortedSet<String> aliases = new TreeSet<String>();
- for (Correlation c : method.getSourceInfo().getAllCorrelations(
- Axis.JS_ALIAS)) {
- aliases.add(c.getName().getShortIdent());
- }
- aliasesView = Collections.unmodifiableSortedSet(aliases);
-
SortedSet<MethodMember> overrides = new TreeSet<MethodMember>(
Member.SOURCE_NAME_COMPARATOR);
for (JMethod override : method.getOverrides()) {
@@ -73,10 +62,6 @@
return enclosing;
}
- public SortedSet<String> getJsAliases() {
- return aliasesView;
- }
-
public SortedSet<MethodMember> getOverrides() {
return overridesView;
}
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/impl/StoryImpl.java b/dev/core/src/com/google/gwt/core/ext/soyc/impl/StoryImpl.java
index b99bcbb..04d317e 100644
--- a/dev/core/src/com/google/gwt/core/ext/soyc/impl/StoryImpl.java
+++ b/dev/core/src/com/google/gwt/core/ext/soyc/impl/StoryImpl.java
@@ -20,7 +20,6 @@
import java.io.Serializable;
import java.util.Comparator;
-import java.util.Set;
import java.util.SortedSet;
/**
@@ -43,17 +42,14 @@
private final int length;
private final String literalDescription;
private final SortedSet<Member> members;
- private final Set<Origin> origins;
/**
* Standard constructor. This constructor will create unmodifiable versions of
* the collections passed into it.
*/
- public StoryImpl(int id, SortedSet<Member> members,
- Set<Origin> origins, String literalDescription, int fragment,
- int length) {
+ public StoryImpl(int id, SortedSet<Member> members,
+ String literalDescription, int fragment, int length) {
assert members != null;
- assert origins != null;
assert fragment >= 0;
assert length > 0;
// literalDescription may be null
@@ -64,7 +60,6 @@
this.literalDescription = literalDescription == null ? null
: literalDescription.intern();
this.members = members;
- this.origins = origins;
}
/**
@@ -78,7 +73,6 @@
this.length = length;
this.literalDescription = other.literalDescription;
this.members = other.members;
- this.origins = other.origins;
}
/**
@@ -116,10 +110,6 @@
return members;
}
- public Set<Origin> getSourceOrigin() {
- return origins;
- }
-
/**
* Identity is based on the <code>id</code> field.
*/
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/impl/StoryRecorder.java b/dev/core/src/com/google/gwt/core/ext/soyc/impl/StoryRecorder.java
index f08d308..7ad6d56 100644
--- a/dev/core/src/com/google/gwt/core/ext/soyc/impl/StoryRecorder.java
+++ b/dev/core/src/com/google/gwt/core/ext/soyc/impl/StoryRecorder.java
@@ -17,18 +17,15 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.soyc.ClassMember;
-import com.google.gwt.core.ext.soyc.FunctionMember;
import com.google.gwt.core.ext.soyc.Member;
import com.google.gwt.core.ext.soyc.Range;
import com.google.gwt.core.ext.soyc.Story;
-import com.google.gwt.core.ext.soyc.Story.Origin;
import com.google.gwt.dev.jjs.Correlation;
-import com.google.gwt.dev.jjs.SourceInfo;
import com.google.gwt.dev.jjs.Correlation.Axis;
+import com.google.gwt.dev.jjs.SourceInfo;
import com.google.gwt.dev.jjs.ast.JDeclaredType;
import com.google.gwt.dev.jjs.ast.JField;
import com.google.gwt.dev.jjs.ast.JMethod;
-import com.google.gwt.dev.js.ast.JsFunction;
import com.google.gwt.dev.util.Util;
import com.google.gwt.util.tools.Utility;
@@ -125,8 +122,6 @@
// Record what we've seen so far
TreeSet<ClassMember> classesMutable = new TreeSet<ClassMember>(
Member.SOURCE_NAME_COMPARATOR);
- TreeSet<FunctionMember> functionsMutable = new TreeSet<FunctionMember>(
- Member.SOURCE_NAME_COMPARATOR);
Set<SourceInfo> sourceInfoSeen = new HashSet<SourceInfo>();
builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soyc>\n<stories>\n");
@@ -134,8 +129,8 @@
int fragment = 0;
for (Map<Range, SourceInfo> sourceInfoMap : sourceInfoMaps) {
lastEnd = 0;
- analyzeFragment(memberFactory, classesMutable, functionsMutable,
- sourceInfoMap, sourceInfoSeen, fragment++);
+ analyzeFragment(memberFactory, classesMutable, sourceInfoMap,
+ sourceInfoSeen, fragment++);
// Flush output to improve memory locality
flushOutput();
@@ -161,7 +156,6 @@
private void analyzeFragment(MemberFactory memberFactory,
TreeSet<ClassMember> classesMutable,
- TreeSet<FunctionMember> functionsMutable,
Map<Range, SourceInfo> sourceInfoMap, Set<SourceInfo> sourceInfoSeen,
int fragment) throws IOException {
/*
@@ -217,13 +211,6 @@
membersByCorrelation.put(c, member);
break;
}
- case FUNCTION: {
- JsFunction function = c.getFunction();
- StandardFunctionMember member = memberFactory.get(function);
- membersByCorrelation.put(c, member);
- functionsMutable.add(member);
- break;
- }
case METHOD: {
JMethod method = c.getMethod();
JDeclaredType type = c.getType();
@@ -270,21 +257,6 @@
}
builder.append("\">\n");
- Set<Origin> origins = story.getSourceOrigin();
- if (origins.size() > 0) {
- builder.append("<origins>\n");
- for (Origin origin : origins) {
- builder.append("<origin lineNumber=\"");
- builder.append(origin.getLineNumber());
- builder.append("\" location=\"");
- builder.append(origin.getLocation());
- builder.append("\"/>\n");
-
- flushOutput();
- }
- builder.append("</origins>\n");
- }
-
Set<Member> correlations = story.getMembers();
if (correlations.size() > 0) {
builder.append("<correlations>\n");
@@ -373,17 +345,11 @@
if (!storyCache.containsKey(info)) {
SortedSet<Member> members = new TreeSet<Member>(
Member.TYPE_AND_SOURCE_NAME_COMPARATOR);
- Set<Origin> origins = new HashSet<Origin>();
-
for (Correlation c : info.getAllCorrelations()) {
Member m = membersByCorrelation.get(c);
if (m != null) {
members.add(m);
}
-
- if (c.getAxis() == Axis.ORIGIN) {
- origins.add(new OriginImpl(c.getOrigin()));
- }
}
String literalType = null;
@@ -392,8 +358,8 @@
literalType = literalCorrelation.getLiteral().getDescription();
}
- theStory = new StoryImpl(storyCache.size(), members, origins,
- literalType, fragment, length);
+ theStory = new StoryImpl(storyCache.size(), members, literalType,
+ fragment, length);
storyCache.put(info, theStory);
} else {
// Use a copy-constructed instance
diff --git a/dev/core/src/com/google/gwt/dev/jjs/Correlation.java b/dev/core/src/com/google/gwt/dev/jjs/Correlation.java
index 9e94773..6ec5e64 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/Correlation.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/Correlation.java
@@ -18,8 +18,6 @@
import com.google.gwt.dev.jjs.ast.JDeclaredType;
import com.google.gwt.dev.jjs.ast.JField;
import com.google.gwt.dev.jjs.ast.JMethod;
-import com.google.gwt.dev.js.ast.JsFunction;
-import com.google.gwt.dev.js.ast.JsName;
import java.io.Serializable;
import java.util.Comparator;
@@ -51,106 +49,39 @@
/**
* A Java class or interface type.
*/
- CLASS(true, false),
+ CLASS,
/**
* A field defined within a Java type.
*/
- FIELD(true, false),
-
- /**
- * A JavaScript function derived from a class or method.
- */
- FUNCTION(false, true),
-
- /**
- * Objects with global names may be aliased (e.g. polymorphic method
- * dispatch).
- */
- JS_ALIAS(false, true),
-
- /**
- * The globally-unique identifier used to represent the Member in the
- * compiled output.
- */
- JS_NAME(false, true),
+ FIELD,
/**
* Indicates a literal value in the original source.
*/
- LITERAL(true, true),
+ LITERAL,
/**
* A Java method.
*/
- METHOD(true, false),
-
- /**
- * Represents a physical source file.
- */
- ORIGIN(true, true);
-
- private final boolean isJava;
- private final boolean isJs;
-
- /**
- * Arguments indicate which AST the axis is relevant to.
- */
- private Axis(boolean isJava, boolean isJs) {
- this.isJava = isJava;
- this.isJs = isJs;
- }
-
- public boolean isJava() {
- return isJava;
- }
-
- public boolean isJs() {
- return isJs;
- }
+ METHOD;
}
/**
* Specifies the type of literal value.
*/
public enum Literal {
- VOID("void"), NULL("null"), BYTE("byte"), SHORT("short"), INT("int"), LONG(
- "long"), FLOAT("float"), DOUBLE("double"), BOOLEAN("boolean"), CHAR(
- "char"), STRING("string"), CLASS("class"), JS_BOOLEAN("boolean", true), JS_NUMBER(
- "number", true), JS_NULL("null", true), JS_STRING("string", true),
- /**
- * undefined isn't actually a literal in JS, but we more-or-less treat it as
- * though it were.
- */
- JS_UNDEFINED("undefined", true);
+ STRING("string"), CLASS("class");
private final String description;
- private final boolean isJava;
- private final boolean isJs;
private Literal(String description) {
this.description = description;
- isJava = true;
- isJs = false;
- }
-
- private Literal(String description, boolean isJs) {
- this.description = description;
- isJava = !isJs;
- this.isJs = isJs;
}
public String getDescription() {
return description;
}
-
- public boolean isJava() {
- return isJava;
- }
-
- public boolean isJs() {
- return isJs;
- }
}
/**
@@ -222,14 +153,6 @@
}
}
- public JsFunction getFunction() {
- if (axis == Axis.FUNCTION) {
- return (JsFunction) astReference;
- } else {
- return null;
- }
- }
-
/**
* Returns a human-readable identifier that can be used to identify the
* Correlation within its axis.
@@ -254,22 +177,6 @@
}
}
- public JsName getName() {
- if (axis == Axis.JS_NAME || axis == Axis.JS_ALIAS) {
- return (JsName) astReference;
- } else {
- return null;
- }
- }
-
- public SourceOrigin getOrigin() {
- if (axis == Axis.ORIGIN) {
- return (SourceOrigin) astReference;
- } else {
- return null;
- }
- }
-
public JDeclaredType getType() {
if (axis == Axis.CLASS) {
return (JDeclaredType) astReference;
diff --git a/dev/core/src/com/google/gwt/dev/jjs/CorrelationFactory.java b/dev/core/src/com/google/gwt/dev/jjs/CorrelationFactory.java
index b280c37..e110f03 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/CorrelationFactory.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/CorrelationFactory.java
@@ -21,8 +21,6 @@
import com.google.gwt.dev.jjs.ast.JField;
import com.google.gwt.dev.jjs.ast.JMethod;
import com.google.gwt.dev.jjs.ast.JType;
-import com.google.gwt.dev.js.ast.JsFunction;
-import com.google.gwt.dev.js.ast.JsName;
import org.apache.commons.collections.map.ReferenceMap;
@@ -61,31 +59,11 @@
}
@Override
- public Correlation by(JsFunction function) {
- return null;
- }
-
- @Override
- public Correlation by(JsName name) {
- return null;
- }
-
- @Override
- public Correlation by(JsName name, boolean isAlias) {
- return null;
- }
-
- @Override
public Correlation by(Literal type) {
return null;
}
@Override
- public Correlation by(SourceOrigin origin) {
- return null;
- }
-
- @Override
public SourceInfo makeSourceInfo(SourceOrigin origin) {
return origin;
}
@@ -175,57 +153,12 @@
}
@Override
- public Correlation by(JsFunction function) {
- Correlation toReturn = canonicalMap.get(function);
- if (toReturn == null) {
- toReturn = new Correlation(Axis.FUNCTION,
- function.getName().getIdent(), function);
- canonicalMap.put(function, toReturn);
- }
- return toReturn;
- }
-
- /**
- * Creates a JS_NAME Correlation.
- */
- @Override
- public Correlation by(JsName name) {
- return by(name, false);
- }
-
- /**
- * Creates either a JS_NAME or JS_ALIAS correlation, based on the value of
- * <code>isAlias</code>.
- */
- @Override
- public Correlation by(JsName name, boolean isAlias) {
- Correlation toReturn = canonicalMap.get(name);
- if (toReturn == null) {
- toReturn = new Correlation(isAlias ? Axis.JS_ALIAS : Axis.JS_NAME,
- name.getIdent(), name);
- canonicalMap.put(name, toReturn);
- }
- return toReturn;
- }
-
- @Override
public Correlation by(Literal type) {
assert LITERAL_CORRELATIONS.containsKey(type);
return LITERAL_CORRELATIONS.get(type);
}
@Override
- public Correlation by(SourceOrigin origin) {
- Correlation toReturn = canonicalMap.get(origin);
- if (toReturn == null) {
- toReturn = new Correlation(Axis.ORIGIN, origin.getFileName() + ":"
- + origin.getStartLine(), origin);
- canonicalMap.put(origin, toReturn);
- }
- return toReturn;
- }
-
- @Override
public SourceInfo makeSourceInfo(SourceOrigin origin) {
return new SourceInfoCorrelation(origin);
}
@@ -237,15 +170,7 @@
public abstract Correlation by(JMethod method);
- public abstract Correlation by(JsFunction function);
-
- public abstract Correlation by(JsName name);
-
- public abstract Correlation by(JsName name, boolean isAlias);
-
public abstract Correlation by(Literal type);
- public abstract Correlation by(SourceOrigin origin);
-
public abstract SourceInfo makeSourceInfo(SourceOrigin origin);
}
\ No newline at end of file
diff --git a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
index 854899b..1b58ac7 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
@@ -565,8 +565,7 @@
jprogram.typeOracle.computeBeforeAST();
// (2) Create our own Java AST from the JDT AST.
- GenerateJavaAST.exec(allTypeDeclarations, typeMap, jprogram, jsProgram,
- options);
+ GenerateJavaAST.exec(allTypeDeclarations, typeMap, jprogram, options);
// GenerateJavaAST can uncover semantic JSNI errors; report & abort
checkForErrors(logger, goldenCuds, true);
@@ -938,9 +937,8 @@
+ originalMainClassName + "' must not be abstract", null);
throw new UnableToCompleteException();
}
- SourceInfo sourceInfo = entryClass.getSourceInfo().makeChild(
- JavaToJavaScriptCompiler.class, "Rebound entry point");
+ SourceInfo sourceInfo = entryClass.getSourceInfo();
JExpression qualifier = null;
if (!entryMethod.isStatic()) {
qualifier = JGwtCreate.createInstantiationExpression(sourceInfo,
@@ -963,8 +961,7 @@
RebindPermutationOracle rpo, String[] mainClassNames, JProgram program)
throws UnableToCompleteException {
Event findEntryPointsEvent = SpeedTracerLogger.start(CompilerEventType.FIND_ENTRY_POINTS);
- SourceInfo sourceInfo = program.createSourceInfoSynthetic(
- JavaToJavaScriptCompiler.class, "Bootstrap method");
+ SourceInfo sourceInfo = program.createSourceInfoSynthetic(JavaToJavaScriptCompiler.class);
JMethod bootStrapMethod = program.createMethod(sourceInfo, "init",
program.getIndexedType("EntryMethodHolder"), program.getTypeVoid(),
false, true, true, false, false);
@@ -1283,8 +1280,7 @@
*/
private static JStatement makeStatsCalls(JProgram program,
String mainClassName) {
- SourceInfo sourceInfo = program.createSourceInfoSynthetic(
- JavaToJavaScriptCompiler.class, "onModuleStart() stats call");
+ SourceInfo sourceInfo = program.createSourceInfoSynthetic(JavaToJavaScriptCompiler.class);
JMethod isStatsAvailableMethod = program.getIndexedMethod("Stats.isStatsAvailable");
JMethod onModuleStartMethod = program.getIndexedMethod("Stats.onModuleStart");
diff --git a/dev/core/src/com/google/gwt/dev/jjs/SourceInfo.java b/dev/core/src/com/google/gwt/dev/jjs/SourceInfo.java
index ccaf1c4..72aeb07 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/SourceInfo.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/SourceInfo.java
@@ -58,6 +58,8 @@
String getFileName();
+ SourceOrigin getOrigin();
+
/**
* Returns the first Correlation that had been set with a given Axis, or
* <code>null</code> if no Correlation has been set on the given axis.
@@ -82,20 +84,11 @@
int getStartPos();
/**
- * If data accumulation is enabled, create a derived SourceInfo object that
- * indicates that one or more AST nodes were merged to create a new node. The
- * derived node will inherit its Origin and Correlations from the SourceInfo
- * object on which the method is invoked.
+ * Create a child node of the same type and Origin as this node. If data
+ * accumulation is enabled, the derived node will inherit its Correlations
+ * from this node.
*/
- SourceInfo makeChild(Class<?> caller, String description);
-
- /**
- * If data accumulation is enabled, create a derived SourceInfo object that
- * indicates that one or more AST nodes were merged to create a new node. The
- * derived node will inherit its Origin and Correlations from the SourceInfo
- * object on which the method is invoked.
- */
- SourceInfo makeChild(Class<?> caller, String description, SourceInfo... merge);
+ SourceInfo makeChild();
/**
* Create a child node of the same type as this node, but with a new Origin.
diff --git a/dev/core/src/com/google/gwt/dev/jjs/SourceInfoCorrelation.java b/dev/core/src/com/google/gwt/dev/jjs/SourceInfoCorrelation.java
index 64f0a31..19d8d90 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/SourceInfoCorrelation.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/SourceInfoCorrelation.java
@@ -33,11 +33,6 @@
*/
public class SourceInfoCorrelation implements SourceInfo, Serializable {
- /**
- * Micro-opt for {@link #makeChild(Class, String)}.
- */
- private static final SourceInfo[] EMPTY_SOURCEINFO_ARRAY = new SourceInfo[0];
-
private static final int numCorrelationAxes = Axis.values().length;
private static int numCorrelationAxes() {
@@ -74,13 +69,6 @@
primaryCorrelations = parent.primaryCorrelations.clone();
}
- private SourceInfoCorrelation(SourceInfoCorrelation parent, String caller,
- SourceInfo... additionalAncestors) {
- this(parent, parent.origin);
- assert caller != null;
- merge(additionalAncestors);
- }
-
/**
* Add a Correlation to the SourceInfo.
*/
@@ -190,20 +178,8 @@
* derived node will inherit its Origin and Correlations from the SourceInfo
* object on which the method is invoked.
*/
- public SourceInfo makeChild(Class<?> caller, String description) {
- return makeChild(caller, description, EMPTY_SOURCEINFO_ARRAY);
- }
-
- /**
- * If data accumulation is enabled, create a derived SourceInfo object that
- * indicates that one or more AST nodes were merged to create a new node. The
- * derived node will inherit its Origin and Correlations from the SourceInfo
- * object on which the method is invoked.
- */
- public SourceInfoCorrelation makeChild(Class<?> caller, String description,
- SourceInfo... merge) {
- String callerName = caller == null ? "Unrecorded caller" : caller.getName();
- return new SourceInfoCorrelation(this, callerName, merge);
+ public SourceInfo makeChild() {
+ return new SourceInfoCorrelation(this, this.origin);
}
public SourceInfo makeChild(SourceOrigin origin) {
diff --git a/dev/core/src/com/google/gwt/dev/jjs/SourceOrigin.java b/dev/core/src/com/google/gwt/dev/jjs/SourceOrigin.java
index 28839cb..eaf3f8e 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/SourceOrigin.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/SourceOrigin.java
@@ -62,7 +62,7 @@
// so there is no need to implement them in this subclass
}
- public static final SourceInfo UNKNOWN = new SourceOrigin("Unknown", 0) {
+ public static final SourceOrigin UNKNOWN = new SourceOrigin("Unknown", 0) {
private Object readResolve() {
return UNKNOWN;
}
@@ -191,12 +191,7 @@
+ 31 * getEndPos();
}
- public SourceInfo makeChild(Class<?> caller, String description) {
- return this;
- }
-
- public SourceInfo makeChild(Class<?> caller, String description,
- SourceInfo... merge) {
+ public SourceInfo makeChild() {
return this;
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JArrayType.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JArrayType.java
index 278edfa..7652920 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JArrayType.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JArrayType.java
@@ -15,6 +15,8 @@
*/
package com.google.gwt.dev.jjs.ast;
+import com.google.gwt.dev.jjs.SourceOrigin;
+
/**
* Instances are shared.
*/
@@ -33,8 +35,8 @@
private JType leafType;
public JArrayType(JType elementType, JType leafType, int dims) {
- super(leafType.getSourceInfo().makeChild(JArrayType.class, "Array type"),
- calcName(leafType, dims));
+ super(leafType.getSourceInfo().makeChild(SourceOrigin.UNKNOWN), calcName(
+ leafType, dims));
this.elementType = elementType;
this.leafType = leafType;
this.dims = dims;
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java
index 020c6d6..4945840 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java
@@ -376,10 +376,6 @@
private final Map<JMethod, JMethod> staticToInstanceMap = new IdentityHashMap<JMethod, JMethod>();
- private final Map<String, JStringLiteral> stringLiteralMap = new HashMap<String, JStringLiteral>();
-
- private final SourceInfo stringPoolSourceInfo;
-
private JClassType typeClass;
private JInterfaceType typeJavaIoSerializable;
@@ -416,9 +412,6 @@
this.correlator = correlator;
intrinsic = createSourceInfo(0, getClass().getName());
-
- stringPoolSourceInfo = createLiteralSourceInfo("String pool",
- Literal.STRING);
}
public void addEntryMethod(JMethod entryPoint) {
@@ -590,9 +583,10 @@
* Create a SourceInfo object when the source is created by the compiler
* itself.
*/
- public SourceInfo createSourceInfoSynthetic(Class<?> caller,
- String description) {
- return createSourceInfo(0, caller.getName()).makeChild(caller, description);
+ public SourceInfo createSourceInfoSynthetic(Class<?> caller) {
+ // TODO: consider using Java stack frames to discover the caller's file
+ // and line number.
+ return createSourceInfo(0, caller.getName());
}
/**
@@ -805,8 +799,8 @@
JsonObject returnMap = castableTypeMaps.get(referenceType);
if (returnMap == null) {
// add a new empty map
- returnMap = new JsonObject(createSourceInfoSynthetic(JProgram.class,
- "empty map"), getJavaScriptObject());
+ returnMap = new JsonObject(createSourceInfoSynthetic(JProgram.class),
+ getJavaScriptObject());
castableTypeMaps.put(referenceType, returnMap);
}
return returnMap;
@@ -923,8 +917,7 @@
clinitBody.getBlock().addStmt(decl);
}
- SourceInfo literalInfo = createSourceInfoSynthetic(JProgram.class,
- "class literal for " + type.getName());
+ SourceInfo literalInfo = createSourceInfoSynthetic(JProgram.class);
literalInfo.addCorrelation(correlator.by(Literal.CLASS));
classLiteral = new JClassLiteral(literalInfo, type, field);
classLiterals.put(type, classLiteral);
@@ -966,30 +959,22 @@
}
public JStringLiteral getLiteralString(SourceInfo sourceInfo, String s) {
- JStringLiteral toReturn = stringLiteralMap.get(s);
- if (toReturn == null) {
- toReturn = new JStringLiteral(stringPoolSourceInfo.makeChild(
- JProgram.class, "String literal: " + s), s, typeString);
- stringLiteralMap.put(s, toReturn);
- }
- toReturn.getSourceInfo().merge(sourceInfo);
- return toReturn;
+ sourceInfo.addCorrelation(correlator.by(Literal.STRING));
+ return new JStringLiteral(sourceInfo, s, typeString);
}
public JField getNullField() {
if (nullField == null) {
- nullField = new JField(createSourceInfoSynthetic(JProgram.class,
- "Null field"), "nullField", null, JNullType.INSTANCE, false,
- Disposition.FINAL);
+ nullField = new JField(createSourceInfoSynthetic(JProgram.class),
+ "nullField", null, JNullType.INSTANCE, false, Disposition.FINAL);
}
return nullField;
}
public JMethod getNullMethod() {
if (nullMethod == null) {
- nullMethod = new JMethod(createSourceInfoSynthetic(JProgram.class,
- "Null method"), "nullMethod", null, JNullType.INSTANCE, false, false,
- true, false);
+ nullMethod = new JMethod(createSourceInfoSynthetic(JProgram.class),
+ "nullMethod", null, JNullType.INSTANCE, false, false, true, false);
nullMethod.setSynthetic();
}
return nullMethod;
@@ -1291,16 +1276,6 @@
return count;
}
- private SourceInfo createLiteralSourceInfo(String description) {
- return intrinsic.makeChild(getClass(), description);
- }
-
- private SourceInfo createLiteralSourceInfo(String description, Literal literal) {
- SourceInfo child = createLiteralSourceInfo(description);
- child.addCorrelation(correlator.by(literal));
- return child;
- }
-
/**
* See notes in {@link #writeObject(ObjectOutputStream)}.
*
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ArrayNormalizer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ArrayNormalizer.java
index 7457916..7504ea6 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ArrayNormalizer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ArrayNormalizer.java
@@ -136,8 +136,7 @@
private void processDims(JNewArray x, Context ctx, JArrayType arrayType,
int dims) {
// override the type of the called method with the array's type
- SourceInfo sourceInfo = x.getSourceInfo().makeChild(ArrayVisitor.class,
- "Creating dimensions");
+ SourceInfo sourceInfo = x.getSourceInfo();
JMethodCall call = new JMethodCall(sourceInfo, null, initDims, arrayType);
JsonArray classLitList = new JsonArray(sourceInfo,
program.getJavaScriptObject());
@@ -172,8 +171,7 @@
private void processInitializers(JNewArray x, Context ctx,
JArrayType arrayType) {
// override the type of the called method with the array's type
- SourceInfo sourceInfo = x.getSourceInfo().makeChild(ArrayVisitor.class,
- "Array initializer");
+ SourceInfo sourceInfo = x.getSourceInfo();
JMethodCall call = new JMethodCall(sourceInfo, null, initValues,
arrayType);
JLiteral classLit = x.getClassLiteral();
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/BuildTypeMap.java b/dev/core/src/com/google/gwt/dev/jjs/impl/BuildTypeMap.java
index 6e56652..26c1558 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/BuildTypeMap.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/BuildTypeMap.java
@@ -620,8 +620,7 @@
private JField createField(SyntheticArgumentBinding binding,
JDeclaredType enclosingType, Disposition disposition) {
JType type = getType(binding.type);
- SourceInfo info = enclosingType.getSourceInfo().makeChild(
- BuildDeclMapVisitor.class, "Field " + String.valueOf(binding.name));
+ SourceInfo info = enclosingType.getSourceInfo().makeChild();
JField field = program.createField(info, String.valueOf(binding.name),
enclosingType, type, false, disposition);
info.addCorrelation(program.getCorrelator().by(field));
@@ -666,8 +665,7 @@
String argName, JMethod enclosingMethod) {
JType type = getType(arg.type);
JParameter param = JProgram.createParameter(
- enclosingMethod.getSourceInfo().makeChild(BuildTypeMap.class,
- "Parameter " + argName), argName, type, true, false,
+ enclosingMethod.getSourceInfo(), argName, type, true, false,
enclosingMethod);
return param;
}
@@ -719,20 +717,20 @@
* more like output JavaScript. Clinit is always in slot 0, init (if it
* exists) is always in slot 1.
*/
- JMethod clinit = program.createMethod(
- info.makeChild(BuildTypeMapVisitor.class, "Class initializer"),
- "$clinit", newType, program.getTypeVoid(), false, true, true, true,
- false);
+ SourceInfo child = info.makeChild();
+ JMethod clinit = program.createMethod(child, "$clinit", newType,
+ program.getTypeVoid(), false, true, true, true, false);
clinit.freezeParamTypes();
clinit.setSynthetic();
+ child.addCorrelation(program.getCorrelator().by(clinit));
if (newType instanceof JClassType) {
- JMethod init = program.createMethod(
- info.makeChild(BuildTypeMapVisitor.class, "Instance initializer"),
- "$init", newType, program.getTypeVoid(), false, false, true, true,
- false);
+ child = info.makeChild();
+ JMethod init = program.createMethod(child, "$init", newType,
+ program.getTypeVoid(), false, false, true, true, false);
init.freezeParamTypes();
init.setSynthetic();
+ child.addCorrelation(program.getCorrelator().by(init));
}
newType.setExternal(linker.isExternalType(newType.getName()));
@@ -819,13 +817,14 @@
if (type instanceof JClassType
&& type != program.getTypeJavaLangObject()) {
+ SourceInfo info = type.getSourceInfo().makeChild();
JMethod getClassMethod = program.createMethod(
- type.getSourceInfo().makeChild(BuildDeclMapVisitor.class,
- "Synthetic getClass()"), "getClass", type,
+ info, "getClass", type,
program.getTypeJavaLangClass(), false, false, false, false, false);
assert (type.getMethods().get(2) == getClassMethod);
getClassMethod.freezeParamTypes();
getClassMethod.setSynthetic();
+ info.addCorrelation(program.getCorrelator().by(getClassMethod));
}
if (binding.isNestedType() && !binding.isStatic()
@@ -983,10 +982,8 @@
} else if (parameters.length == 1) {
assert newMethod.getName().equals("valueOf");
assert typeMap.get(parameters[0]) == program.getTypeJavaLangString();
- JProgram.createParameter(
- newMethod.getSourceInfo().makeChild(BuildDeclMapVisitor.class,
- "name parameter"), "name", program.getTypeJavaLangString(),
- true, false, newMethod);
+ JProgram.createParameter(newMethod.getSourceInfo(), "name",
+ program.getTypeJavaLangString(), true, false, newMethod);
} else {
assert false;
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/CastNormalizer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/CastNormalizer.java
index 420ec99..c0ee478 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/CastNormalizer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/CastNormalizer.java
@@ -245,8 +245,7 @@
}
// Create a sparse lookup object.
- SourceInfo sourceInfo = program.createSourceInfoSynthetic(
- AssignTypeCastabilityVisitor.class, "typeinfo lookup");
+ SourceInfo sourceInfo = program.createSourceInfoSynthetic(AssignTypeCastabilityVisitor.class);
JsonObject jsonObject = new JsonObject(sourceInfo,
program.getJavaScriptObject());
// Start at 1; 0 is Object and always true.
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/CodeSplitter.java b/dev/core/src/com/google/gwt/dev/jjs/impl/CodeSplitter.java
index 5ad75c9..ef4c02e 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/CodeSplitter.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/CodeSplitter.java
@@ -516,8 +516,7 @@
assert ((JReferenceType) constructorCall.getArgs().get(1).getType()).getUnderlyingType() instanceof JArrayType;
assert ((JArrayType) ((JReferenceType) constructorCall.getArgs().get(1).getType()).getUnderlyingType()).getElementType() == JPrimitiveType.INT;
- SourceInfo info = program.createSourceInfoSynthetic(ReplaceRunAsyncs.class,
- "array with initial load sequence");
+ SourceInfo info = program.createSourceInfoSynthetic(ReplaceRunAsyncs.class);
List<JExpression> intExprs = new ArrayList<JExpression>();
for (int sp : initialLoadSequence) {
intExprs.add(program.getLiteralInt(sp));
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/DeadCodeElimination.java b/dev/core/src/com/google/gwt/dev/jjs/impl/DeadCodeElimination.java
index 10af9bb..9b7acd3 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/DeadCodeElimination.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/DeadCodeElimination.java
@@ -172,7 +172,7 @@
simplifyAdd(lhs, rhs, ctx, x.getType());
break;
case CONCAT:
- evalConcat(lhs, rhs, ctx);
+ evalConcat(x.getSourceInfo(), lhs, rhs, ctx);
break;
case SUB:
simplifySub(lhs, rhs, ctx, x.getType());
@@ -713,14 +713,13 @@
return new JMethodCall(sourceInfo, null, clinit);
}
- private void evalConcat(JExpression lhs, JExpression rhs, Context ctx) {
+ private void evalConcat(SourceInfo info, JExpression lhs, JExpression rhs,
+ Context ctx) {
if (lhs instanceof JValueLiteral && rhs instanceof JValueLiteral) {
Object lhsObj = ((JValueLiteral) lhs).getValueObj();
Object rhsObj = ((JValueLiteral) rhs).getValueObj();
- ctx.replaceMe(program.getLiteralString(
- lhs.getSourceInfo().makeChild(DeadCodeVisitor.class,
- "String concatenation", rhs.getSourceInfo()),
- String.valueOf(lhsObj) + String.valueOf(rhsObj)));
+ ctx.replaceMe(program.getLiteralString(info, String.valueOf(lhsObj)
+ + String.valueOf(rhsObj)));
}
}
@@ -1632,8 +1631,8 @@
}
Object result = actual.invoke(instance, paramValues);
if (result instanceof String) {
- ctx.replaceMe(program.getLiteralString(x.getSourceInfo().makeChild(
- DeadCodeVisitor.class, "Optimized String call"), (String) result));
+ ctx.replaceMe(program.getLiteralString(x.getSourceInfo(),
+ (String) result));
} else if (result instanceof Boolean) {
ctx.replaceMe(program.getLiteralBoolean(((Boolean) result).booleanValue()));
} else if (result instanceof Character) {
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 502aa35..bcc62f0 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
@@ -223,8 +223,7 @@
for (JMethod entryMethod : jprogram.entryMethods.get(splitPoint)) {
JsName name = map.nameForMethod(entryMethod);
assert name != null;
- SourceInfo sourceInfo = jsprogram.getSourceInfo().makeChild(
- FragmentExtractor.class, "call to entry function " + splitPoint);
+ SourceInfo sourceInfo = jsprogram.getSourceInfo();
JsInvocation call = new JsInvocation(sourceInfo);
call.setQualifier(wrapWithEntry(name.makeRef(sourceInfo)));
callStats.add(call.makeStmt());
@@ -240,9 +239,7 @@
public List<JsStatement> createCallToLeftoversFragmentHasLoaded() {
JMethod loadedMethod = jprogram.getIndexedMethod("AsyncFragmentLoader.browserLoaderLeftoversFragmentHasLoaded");
JsName loadedMethodName = map.nameForMethod(loadedMethod);
- SourceInfo sourceInfo = jsprogram.getSourceInfo().makeChild(
- FragmentExtractor.class,
- "call to browserLoaderLeftoversFragmentHasLoaded ");
+ SourceInfo sourceInfo = jsprogram.getSourceInfo();
JsInvocation call = new JsInvocation(sourceInfo);
call.setQualifier(wrapWithEntry(loadedMethodName.makeRef(sourceInfo)));
List<JsStatement> newStats = Collections.<JsStatement> singletonList(call.makeStmt());
@@ -513,8 +510,7 @@
private JsStatement removeSomeVars(JsVars stat,
LivenessPredicate currentLivenessPredicate,
LivenessPredicate alreadyLoadedPredicate) {
- JsVars newVars = new JsVars(stat.getSourceInfo().makeChild(
- FragmentExtractor.class, "subsetting of interned values"));
+ JsVars newVars = new JsVars(stat.getSourceInfo());
for (JsVar var : stat) {
if (isLive(var, currentLivenessPredicate)
@@ -550,24 +546,21 @@
*/
private JsStatement vtableStatFor(JClassType vtableType) {
JsNameRef prototypeField = new JsNameRef(
- jsprogram.createSourceInfoSynthetic(FragmentExtractor.class,
- "prototype field"), "prototype");
+ jsprogram.createSourceInfoSynthetic(FragmentExtractor.class),
+ "prototype");
JsExpression constructorRef;
- SourceInfo sourceInfoVtableSetup = jsprogram.createSourceInfoSynthetic(
- FragmentExtractor.class, "vtable setup");
+ SourceInfo sourceInfoVtableSetup = jsprogram.createSourceInfoSynthetic(FragmentExtractor.class);
if (vtableType == jprogram.getTypeJavaLangString()) {
// The methods of java.lang.String are put onto JavaScript's String
// prototype
- SourceInfo sourceInfoConstructorRef = jsprogram.createSourceInfoSynthetic(
- FragmentExtractor.class, "String constructor");
+ SourceInfo sourceInfoConstructorRef = jsprogram.createSourceInfoSynthetic(FragmentExtractor.class);
constructorRef = new JsNameRef(sourceInfoConstructorRef, "String");
} else {
constructorRef = map.nameForType(vtableType).makeRef(
sourceInfoVtableSetup);
}
prototypeField.setQualifier(constructorRef);
- SourceInfo underlineSourceInfo = jsprogram.createSourceInfoSynthetic(
- FragmentExtractor.class, "global _ field");
+ SourceInfo underlineSourceInfo = jsprogram.createSourceInfoSynthetic(FragmentExtractor.class);
return (new JsBinaryOperation(sourceInfoVtableSetup, JsBinaryOperator.ASG,
jsprogram.getScope().declareName("_").makeRef(underlineSourceInfo),
prototypeField)).makeStmt();
@@ -634,8 +627,7 @@
* Wrap an expression with a call to $entry.
*/
private JsInvocation wrapWithEntry(JsExpression exp) {
- SourceInfo sourceInfo = exp.getSourceInfo().makeChild(
- FragmentExtractor.class, "wrapping with a call to $entry");
+ SourceInfo sourceInfo = exp.getSourceInfo();
JsInvocation call = new JsInvocation(sourceInfo);
JsName entryFunctionName = jsprogram.getScope().findExistingName("$entry");
call.setQualifier(entryFunctionName.makeRef(sourceInfo));
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 4c04e90..46c1653 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
@@ -101,7 +101,6 @@
import com.google.gwt.dev.js.ast.JsExpression;
import com.google.gwt.dev.js.ast.JsModVisitor;
import com.google.gwt.dev.js.ast.JsNameRef;
-import com.google.gwt.dev.js.ast.JsProgram;
import com.google.gwt.dev.util.JsniRef;
import com.google.gwt.dev.util.collect.Lists;
import com.google.gwt.dev.util.collect.Maps;
@@ -696,8 +695,7 @@
// May be processing an annotation
SourceInfo info = currentMethod == null ? currentClass.getSourceInfo()
: currentMethod.getSourceInfo();
- return program.getLiteralString(
- info.makeChild(JavaASTGenerationVisitor.class, "String literal"),
+ return program.getLiteralString(info.makeChild(),
x.stringValue().toCharArray());
}
@@ -2109,8 +2107,7 @@
*/
private void createBridgeMethod(JClassType clazz,
SyntheticMethodBinding jdtBridgeMethod, JMethod implmeth) {
- SourceInfo info = implmeth.getSourceInfo().makeChild(
- GenerateJavaAST.class, "bridge method");
+ SourceInfo info = implmeth.getSourceInfo().makeChild();
// create the method itself
JMethod bridgeMethod = program.createMethod(info,
String.valueOf(jdtBridgeMethod.selector), clazz,
@@ -2122,13 +2119,14 @@
for (TypeBinding jdtParamType : jdtBridgeMethod.parameters) {
JParameter param = implParams.get(paramIdx++);
JType paramType = (JType) typeMap.get(jdtParamType.erasure());
- JParameter newParam = new JParameter(param.getSourceInfo().makeChild(
- GenerateJavaAST.class, "bridge method"), param.getName(),
+ JParameter newParam = new JParameter(
+ info.makeChild(param.getSourceInfo().getOrigin()), param.getName(),
paramType, true, false, bridgeMethod);
bridgeMethod.addParam(newParam);
}
addThrownExceptions(jdtBridgeMethod, bridgeMethod);
bridgeMethod.freezeParamTypes();
+ info.addCorrelation(program.getCorrelator().by(bridgeMethod));
// create a call
JMethodCall call = new JMethodCall(info, new JThisRef(info, clazz),
@@ -2284,9 +2282,7 @@
"FieldRef referencing field in a different type.");
}
}
- return new JFieldRef(info.makeChild(JavaASTGenerationVisitor.class,
- "Reference", variable.getSourceInfo()), instance, field,
- currentClass);
+ return new JFieldRef(info, instance, field, currentClass);
}
throw new InternalCompilerException("Unknown JVariable subclass.");
}
@@ -2860,23 +2856,27 @@
*
* class Map { $MAP = Enum.createValueOfMap($VALUES); }
*/
- SourceInfo sourceInfo = type.getSourceInfo().makeChild(
- JavaASTGenerationVisitor.class, "Enum$Map");
- JClassType mapClass = program.createClass(sourceInfo, type.getName()
+ SourceInfo typeInfo = type.getSourceInfo().makeChild();
+ JClassType mapClass = program.createClass(typeInfo, type.getName()
+ "$Map", false, true);
+ typeInfo.addCorrelation(program.getCorrelator().by(mapClass));
mapClass.setSuperClass(program.getTypeJavaLangObject());
- mapField = program.createField(sourceInfo, "$MAP", mapClass,
+ SourceInfo fieldInfo = typeInfo.makeChild();
+ mapField = program.createField(fieldInfo, "$MAP", mapClass,
program.getJavaScriptObject(), true, Disposition.FINAL);
+ fieldInfo.addCorrelation(program.getCorrelator().by(mapField));
- JMethodCall call = new JMethodCall(sourceInfo, null,
+ SourceInfo methodInfo = typeInfo.makeChild();
+ JMethodCall call = new JMethodCall(methodInfo, null,
program.getIndexedMethod("Enum.createValueOfMap"));
- call.addArg(new JFieldRef(sourceInfo, null, valuesField, type));
- JFieldRef mapRef = new JFieldRef(sourceInfo, null, mapField, type);
- JDeclarationStatement declStmt = new JDeclarationStatement(sourceInfo,
+ call.addArg(new JFieldRef(methodInfo, null, valuesField, type));
+ JFieldRef mapRef = new JFieldRef(methodInfo, null, mapField, type);
+ JDeclarationStatement declStmt = new JDeclarationStatement(methodInfo,
mapRef, call);
- JMethod clinit = program.createMethod(sourceInfo, "$clinit", mapClass,
+ JMethod clinit = program.createMethod(methodInfo, "$clinit", mapClass,
program.getTypeVoid(), false, true, true, true, false);
clinit.freezeParamTypes();
+ methodInfo.addCorrelation(program.getCorrelator().by(clinit));
JBlock clinitBlock = ((JMethodBody) clinit.getBody()).getBlock();
clinitBlock.addStmt(declStmt);
mapField.setInitializer(declStmt);
@@ -2903,20 +2903,20 @@
JField valuesField;
{
// $VALUES = new E[]{A,B,B};
- SourceInfo sourceInfo = type.getSourceInfo().makeChild(
- JavaASTGenerationVisitor.class, "$VALUES");
+ SourceInfo fieldInfo = type.getSourceInfo().makeChild();
JArrayType enumArrayType = program.getTypeArray(type, 1);
- valuesField = program.createField(sourceInfo, "$VALUES", type,
+ valuesField = program.createField(fieldInfo, "$VALUES", type,
enumArrayType, true, Disposition.FINAL);
+ fieldInfo.addCorrelation(program.getCorrelator().by(valuesField));
List<JExpression> initializers = new ArrayList<JExpression>();
for (JEnumField field : type.getEnumList()) {
- JFieldRef fieldRef = new JFieldRef(sourceInfo, null, field, type);
+ JFieldRef fieldRef = new JFieldRef(fieldInfo, null, field, type);
initializers.add(fieldRef);
}
- JNewArray newExpr = JNewArray.createInitializers(program, sourceInfo,
+ JNewArray newExpr = JNewArray.createInitializers(program, fieldInfo,
enumArrayType, initializers);
- JFieldRef valuesRef = new JFieldRef(sourceInfo, null, valuesField, type);
- JDeclarationStatement declStmt = new JDeclarationStatement(sourceInfo,
+ JFieldRef valuesRef = new JFieldRef(fieldInfo, null, valuesField, type);
+ JDeclarationStatement declStmt = new JDeclarationStatement(fieldInfo,
valuesRef, newExpr);
JBlock clinitBlock = ((JMethodBody) type.getMethods().get(0).getBody()).getBlock();
@@ -3047,14 +3047,11 @@
private final Map<JsniMethodBody, AbstractMethodDeclaration> jsniMethodMap;
- private final JsProgram jsProgram;
-
private final JProgram program;
- public JsniRefGenerationVisitor(JProgram program, JsProgram jsProgram,
+ public JsniRefGenerationVisitor(JProgram program,
Map<JsniMethodBody, AbstractMethodDeclaration> jsniMethodMap) {
this.program = program;
- this.jsProgram = jsProgram;
this.jsniMethodMap = jsniMethodMap;
}
@@ -3085,7 +3082,7 @@
* a JProgram structure.
*/
public static void exec(TypeDeclaration[] types, TypeMap typeMap,
- JProgram jprogram, JsProgram jsProgram, JJSOptions options) {
+ JProgram jprogram, JJSOptions options) {
Event generateJavaAstEvent = SpeedTracerLogger.start(CompilerEventType.GENERATE_JAVA_AST);
// Construct the basic AST.
JavaASTGenerationVisitor v = new JavaASTGenerationVisitor(typeMap,
@@ -3100,7 +3097,7 @@
// Process JSNI.
Map<JsniMethodBody, AbstractMethodDeclaration> jsniMethodMap = v.getJsniMethodMap();
- new JsniRefGenerationVisitor(jprogram, jsProgram, jsniMethodMap).accept(jprogram);
+ new JsniRefGenerationVisitor(jprogram, jsniMethodMap).accept(jprogram);
generateJavaAstEvent.end();
}
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 84de28d..aec9b82 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
@@ -327,9 +327,6 @@
} else {
polyName = interfaceScope.declareName(mangleName, name);
}
- // Record this as an alias, not the primary name
- x.getSourceInfo().addCorrelation(
- program.getCorrelator().by(polyName, true));
polymorphicNames.put(x, polyName);
}
}
@@ -351,7 +348,6 @@
*/
if (!stripStack || !polymorphicNames.containsKey(x) || x.isNative()) {
globalName = topScope.declareName(mangleName, name);
- x.getSourceInfo().addCorrelation(program.getCorrelator().by(globalName));
names.put(x, globalName);
recordSymbol(x, globalName);
}
@@ -362,9 +358,6 @@
jsFunction = body.getFunc();
jsFunction.setName(globalName);
} else {
- // create a new peer JsFunction
- SourceInfo sourceInfo = x.getSourceInfo().makeChild(
- CreateNamesAndScopesVisitor.class, "Translated JS function");
/*
* It would be more correct here to check for an inline assignment, such
* as var foo = function blah() {} and introduce a separate scope for
@@ -374,16 +367,13 @@
* 1:1 mapping to obfuscated symbols. Leaving them in global scope
* causes no harm.
*/
- jsFunction = new JsFunction(sourceInfo, topScope, globalName, true);
+ jsFunction = new JsFunction(x.getSourceInfo(), topScope, globalName,
+ true);
}
if (polymorphicNames.containsKey(x)) {
polymorphicJsFunctions.add(jsFunction);
}
methodBodyMap.put(x.getBody(), jsFunction);
- if (globalName != null) {
- jsFunction.getSourceInfo().addCorrelation(
- program.getCorrelator().by(globalName));
- }
push(jsFunction.getScope());
if (program.getIndexedMethods().contains(x)) {
@@ -1182,19 +1172,15 @@
if (!nonInitialEntries.isEmpty()) {
JMethod loadedMethod = program.getIndexedMethod("AsyncFragmentLoader.browserLoaderLeftoversFragmentHasLoaded");
JsName loadedMethodName = names.get(loadedMethod);
- SourceInfo sourceInfo = jsProgram.getSourceInfo().makeChild(
- GenerateJavaScriptAST.class, "call to leftoversFragmentHasLoaded ");
- JsInvocation call = new JsInvocation(sourceInfo);
- call.setQualifier(loadedMethodName.makeRef(sourceInfo));
+ JsInvocation call = new JsInvocation(jsProgram.getSourceInfo());
+ call.setQualifier(loadedMethodName.makeRef(jsProgram.getSourceInfo().makeChild()));
globalStmts.add(call.makeStmt());
}
for (JsFunction func : nonInitialEntries) {
if (func != null) {
- SourceInfo sourceInfo = jsProgram.getSourceInfo().makeChild(
- GenerateJavaScriptAST.class,
- "call to entry non-initial entry function");
- JsInvocation call = new JsInvocation(sourceInfo);
- call.setQualifier(func.getName().makeRef(sourceInfo));
+ JsInvocation call = new JsInvocation(jsProgram.getSourceInfo());
+ call.setQualifier(func.getName().makeRef(
+ jsProgram.getSourceInfo().makeChild()));
globalStmts.add(call.makeStmt());
}
}
@@ -1513,8 +1499,7 @@
return;
}
- SourceInfo sourceInfo = jsProgram.createSourceInfoSynthetic(
- GenerateJavaScriptAST.class, "Castable type map");
+ SourceInfo sourceInfo = jsProgram.createSourceInfoSynthetic(GenerateJavaScriptAST.class);
accept(castableTypeMap);
JsExpression objExpr = pop();
@@ -1590,8 +1575,7 @@
* }
* </pre>
*/
- SourceInfo sourceInfo = program.createSourceInfoSynthetic(
- GenerateJavaScriptAST.class, "gwtOnLoad");
+ SourceInfo sourceInfo = program.createSourceInfoSynthetic(GenerateJavaScriptAST.class);
JsName entryName = topScope.declareName("$entry");
JsVar entryVar = new JsVar(sourceInfo, entryName);
@@ -1672,9 +1656,7 @@
for (Entry<Long, JsName> entry : longLits.entrySet()) {
JsName jsName = entry.getValue();
JsExpression longObjectAlloc = longObjects.get(jsName);
- JsVar var = new JsVar(vars.getSourceInfo().makeChild(
- GenerateJavaScriptVisitor.class, "Long literal " + entry.getKey()),
- jsName);
+ JsVar var = new JsVar(vars.getSourceInfo(), jsName);
var.setInitExpr(longObjectAlloc);
vars.add(var);
}
@@ -1682,8 +1664,7 @@
private void generateNullFunc(List<JsStatement> globalStatements) {
// handle null method
- SourceInfo sourceInfo = jsProgram.createSourceInfoSynthetic(
- GenerateJavaScriptAST.class, "Null function");
+ SourceInfo sourceInfo = jsProgram.createSourceInfoSynthetic(GenerateJavaScriptAST.class);
JsFunction nullFunc = new JsFunction(sourceInfo, topScope,
nullMethodName, true);
nullFunc.setBody(new JsBlock(sourceInfo));
@@ -1693,8 +1674,7 @@
private void generateSeedFuncAndPrototype(JClassType x,
List<JsStatement> globalStmts) {
- SourceInfo sourceInfo = x.getSourceInfo().makeChild(
- GenerateJavaScriptVisitor.class, "Seed and function prototype");
+ SourceInfo sourceInfo = x.getSourceInfo();
if (x != program.getTypeJavaLangString()) {
JsName seedFuncName = names.get(x);
@@ -1759,8 +1739,7 @@
List<JsStatement> globalStmts) {
JMethod toStringMeth = program.getIndexedMethod("Object.toString");
if (x.getMethods().contains(toStringMeth)) {
- SourceInfo sourceInfo = x.getSourceInfo().makeChild(
- GenerateJavaScriptVisitor.class, "_.toString");
+ SourceInfo sourceInfo = x.getSourceInfo();
// _.toString = function(){return this.java_lang_Object_toString();}
// lhs
@@ -1796,8 +1775,7 @@
// Was pruned; this compilation must have no JSO instanceof tests.
return;
}
- SourceInfo sourceInfo = jsProgram.createSourceInfoSynthetic(
- GenerateJavaScriptAST.class, "Type marker");
+ SourceInfo sourceInfo = jsProgram.createSourceInfoSynthetic(GenerateJavaScriptAST.class);
JsNameRef fieldRef = typeMarkerName.makeRef(sourceInfo);
fieldRef.setQualifier(globalTemp.makeRef(sourceInfo));
JsExpression asg = createAssignment(fieldRef,
@@ -1809,8 +1787,7 @@
private void generateVTables(JClassType x, List<JsStatement> globalStmts) {
for (JMethod method : x.getMethods()) {
- SourceInfo sourceInfo = method.getSourceInfo().makeChild(
- GenerateJavaScriptVisitor.class, "vtable assignment");
+ SourceInfo sourceInfo = method.getSourceInfo();
if (method.needsVtable() && !method.isAbstract()) {
JsNameRef lhs = polymorphicNames.get(method).makeRef(sourceInfo);
lhs.setQualifier(globalTemp.makeRef(sourceInfo));
@@ -1831,8 +1808,7 @@
clinitFunc.setExecuteOnce(true);
clinitFunc.setImpliedExecute(superClinit);
List<JsStatement> statements = clinitFunc.getBody().getStatements();
- SourceInfo sourceInfo = clinitFunc.getSourceInfo().makeChild(
- GenerateJavaScriptVisitor.class, "clinit reassignment");
+ SourceInfo sourceInfo = clinitFunc.getSourceInfo();
// self-assign to the null method immediately (to prevent reentrancy)
JsExpression asg = createAssignment(
clinitFunc.getName().makeRef(sourceInfo),
@@ -1853,8 +1829,7 @@
}
JMethod clinitMethod = targetType.getMethods().get(0);
- SourceInfo sourceInfo = x.getSourceInfo().makeChild(
- GenerateJavaScriptVisitor.class, "clinit invocation");
+ SourceInfo sourceInfo = x.getSourceInfo();
JsInvocation jsInvocation = new JsInvocation(sourceInfo);
jsInvocation.setQualifier(names.get(clinitMethod).makeRef(sourceInfo));
return jsInvocation;
@@ -1877,8 +1852,7 @@
}
JMethod clinitMethod = enclosingType.getClinitTarget().getMethods().get(0);
- SourceInfo sourceInfo = x.getSourceInfo().makeChild(
- GenerateJavaScriptVisitor.class, "clinit call");
+ SourceInfo sourceInfo = x.getSourceInfo();
JsInvocation jsInvocation = new JsInvocation(sourceInfo);
jsInvocation.setQualifier(names.get(clinitMethod).makeRef(sourceInfo));
return jsInvocation;
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 6e6765c..35e21c6 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
@@ -257,8 +257,7 @@
* references.
*/
private void defineJsLink() {
- SourceInfo info = jsProgram.createSourceInfoSynthetic(
- HandleCrossFragmentReferences.class, "defining jslink");
+ SourceInfo info = jsProgram.createSourceInfoSynthetic(HandleCrossFragmentReferences.class);
jslink = jsProgram.getScope().declareName("jslink");
JsVars vars = new JsVars(info);
JsVar var = new JsVar(info, jslink);
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/JavaScriptObjectNormalizer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/JavaScriptObjectNormalizer.java
index 8f47803..a137b88 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/JavaScriptObjectNormalizer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/JavaScriptObjectNormalizer.java
@@ -115,9 +115,7 @@
JDeclaredType targetClass = x.getTarget().getEnclosingType();
if (program.typeOracle.getSingleJsoImpl(targetClass) != null) {
- SourceInfo info = x.getSourceInfo().makeChild(
- JavaScriptObjectNormalizer.class,
- "Polymorphic invocation of SingleJsoImpl interface");
+ SourceInfo info = x.getSourceInfo();
// Find the method in the JSO type
JMethod jsoMethod = findJsoMethod(x.getTarget());
@@ -232,9 +230,7 @@
* variable if its evaluation would produce side-effects. The
* multi-expression is used for this purpose.
*/
- SourceInfo info = instance.getSourceInfo().makeChild(
- JavaScriptObjectNormalizer.class,
- "Temporary assignment for instance with side-effects");
+ SourceInfo info = instance.getSourceInfo();
JLocal local = JProgram.createLocal(info, "maybeJsoInvocation",
instance.getType(), true, currentMethodBody.peek());
multi.exprs.add(JProgram.createAssignmentStmt(info,
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/JsoDevirtualizer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/JsoDevirtualizer.java
index a9da281..062c1b1 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/JsoDevirtualizer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/JsoDevirtualizer.java
@@ -16,6 +16,7 @@
package com.google.gwt.dev.jjs.impl;
import com.google.gwt.dev.jjs.SourceInfo;
+import com.google.gwt.dev.jjs.SourceOrigin;
import com.google.gwt.dev.jjs.ast.Context;
import com.google.gwt.dev.jjs.ast.JClassType;
import com.google.gwt.dev.jjs.ast.JConditional;
@@ -126,12 +127,11 @@
*/
private JMethod createDevirtualMethod(JMethod objectMethod, JMethod jsoImpl) {
JClassType jsoType = program.getJavaScriptObject();
- SourceInfo sourceInfo = jsoType.getSourceInfo();
+ SourceInfo sourceInfo = jsoType.getSourceInfo().makeChild(SourceOrigin.UNKNOWN);
// Create the new method.
String name = objectMethod.getName() + "__devirtual$";
- JMethod newMethod = program.createMethod(sourceInfo.makeChild(
- JsoDevirtualizer.class, "Devirtualized method"), name, jsoType,
+ JMethod newMethod = program.createMethod(sourceInfo, name, jsoType,
objectMethod.getType(), false, true, true, false, false);
newMethod.setSynthetic();
@@ -144,6 +144,7 @@
}
newMethod.freezeParamTypes();
newMethod.addThrownExceptions(objectMethod.getThrownExceptions());
+ sourceInfo.addCorrelation(program.getCorrelator().by(newMethod));
// Build from bottom up.
JMethodCall condition = new JMethodCall(sourceInfo, null,
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 1841193..b9ce5aa 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
@@ -89,8 +89,7 @@
@Override
public void endVisit(JsThisRef x, JsContext ctx) {
- ctx.replaceMe(thisParam.makeRef(x.getSourceInfo().makeChild(
- RewriteJsniMethodBody.class, "Devirtualized instance")));
+ ctx.replaceMe(thisParam.makeRef(x.getSourceInfo()));
}
@Override
@@ -119,17 +118,13 @@
@Override
public void endVisit(JParameterRef x, Context ctx) {
JParameter param = varMap.get(x.getTarget());
- JParameterRef paramRef = new JParameterRef(x.getSourceInfo().makeChild(
- RewriteMethodBody.class, "Reference to devirtualized parameter"),
- param);
+ JParameterRef paramRef = new JParameterRef(x.getSourceInfo(), param);
ctx.replaceMe(paramRef);
}
@Override
public void endVisit(JThisRef x, Context ctx) {
- JParameterRef paramRef = new JParameterRef(x.getSourceInfo().makeChild(
- RewriteMethodBody.class, "Reference to devirtualized instance"),
- thisParam);
+ JParameterRef paramRef = new JParameterRef(x.getSourceInfo(), thisParam);
ctx.replaceMe(paramRef);
}
}
@@ -145,7 +140,7 @@
// Let's do it!
JClassType enclosingType = (JClassType) x.getEnclosingType();
JType returnType = x.getType();
- SourceInfo sourceInfo = x.getSourceInfo();
+ SourceInfo sourceInfo = x.getSourceInfo().makeChild();
int myIndexInClass = enclosingType.getMethods().indexOf(x);
assert (myIndexInClass > 0);
@@ -156,15 +151,13 @@
* Don't use the JProgram helper because it auto-adds the new method to
* its enclosing class.
*/
- JMethod newMethod = new JMethod(sourceInfo.makeChild(
- CreateStaticImplsVisitor.class, "Devirtualized function"), newName,
- enclosingType, returnType, false, true, true, x.isPrivate());
+ JMethod newMethod = new JMethod(sourceInfo, newName, enclosingType,
+ returnType, false, true, true, x.isPrivate());
newMethod.setSynthetic();
newMethod.addThrownExceptions(x.getThrownExceptions());
// Setup parameters; map from the old params to the new params
- JParameter thisParam = JParameter.create(sourceInfo.makeChild(
- CreateStaticImplsVisitor.class, "Instance parameter"), "this$static",
+ JParameter thisParam = JParameter.create(sourceInfo, "this$static",
enclosingType.getNonNull(), true, true, newMethod);
Map<JParameter, JParameter> varMap = new IdentityHashMap<JParameter, JParameter>();
for (int i = 0; i < x.getParams().size(); ++i) {
@@ -180,28 +173,25 @@
originalParamTypes.add(enclosingType.getNonNull());
originalParamTypes.addAll(x.getOriginalParamTypes());
newMethod.setOriginalTypes(x.getOriginalReturnType(), originalParamTypes);
+ sourceInfo.addCorrelation(program.getCorrelator().by(newMethod));
// Move the body of the instance method to the static method
JAbstractMethodBody movedBody = x.getBody();
newMethod.setBody(movedBody);
- // Create a new body for the instance method that delegates to the static
- SourceInfo delegateCallSourceInfo = sourceInfo.makeChild(
- CreateStaticImplsVisitor.class, "Degelgating to devirtualized method");
- JMethodBody newBody = new JMethodBody(delegateCallSourceInfo);
+ JMethodBody newBody = new JMethodBody(sourceInfo);
x.setBody(newBody);
- JMethodCall newCall = new JMethodCall(delegateCallSourceInfo, null,
- newMethod);
- newCall.addArg(new JThisRef(delegateCallSourceInfo, enclosingType));
+ JMethodCall newCall = new JMethodCall(sourceInfo, null, newMethod);
+ newCall.addArg(new JThisRef(sourceInfo, enclosingType));
for (int i = 0; i < x.getParams().size(); ++i) {
JParameter param = x.getParams().get(i);
- newCall.addArg(new JParameterRef(delegateCallSourceInfo, param));
+ newCall.addArg(new JParameterRef(sourceInfo, param));
}
JStatement statement;
if (returnType == program.getTypeVoid()) {
statement = newCall.makeStatement();
} else {
- statement = new JReturnStatement(delegateCallSourceInfo, newCall);
+ statement = new JReturnStatement(sourceInfo, newCall);
}
newBody.getBlock().addStmt(statement);
@@ -215,10 +205,7 @@
// 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, paramName));
RewriteJsniMethodBody rewriter = new RewriteJsniMethodBody(paramName);
// Accept the body to avoid the recursion blocker.
rewriter.accept(jsFunc.getBody());
@@ -359,8 +346,7 @@
static JExpression makeStaticCall(JMethodCall x, JMethod newMethod) {
// Update the call site
- JMethodCall newCall = new JMethodCall(x.getSourceInfo().makeChild(
- MakeCallsStatic.class, "Devirtualized function call"), null, newMethod);
+ JMethodCall newCall = new JMethodCall(x.getSourceInfo(), null, newMethod);
/*
* If the qualifier is a JMultiExpression, invoke on the last value. This
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ResolveRebinds.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ResolveRebinds.java
index a0a1b6c..6b82869 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ResolveRebinds.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ResolveRebinds.java
@@ -17,6 +17,7 @@
import com.google.gwt.dev.jjs.InternalCompilerException;
import com.google.gwt.dev.jjs.SourceInfo;
+import com.google.gwt.dev.jjs.SourceOrigin;
import com.google.gwt.dev.jjs.ast.Context;
import com.google.gwt.dev.jjs.ast.JBlock;
import com.google.gwt.dev.jjs.ast.JCaseStatement;
@@ -55,8 +56,8 @@
public void endVisit(JGwtCreate x, Context ctx) {
if (isSoftRebind(x.getSourceType())) {
- JMethod method = rebindMethod(x.getSourceInfo(), x.getSourceType(),
- x.getResultTypes(), x.getInstantiationExpressions());
+ JMethod method = rebindMethod(x.getSourceType(), x.getResultTypes(),
+ x.getInstantiationExpressions());
JMethodCall call = new JMethodCall(x.getSourceInfo(), null, method);
ctx.replaceMe(call);
return;
@@ -80,8 +81,8 @@
public void endVisit(JReboundEntryPoint x, Context ctx) {
if (isSoftRebind(x.getSourceType())) {
- JMethod method = rebindMethod(x.getSourceInfo(), x.getSourceType(),
- x.getResultTypes(), x.getEntryCalls());
+ JMethod method = rebindMethod(x.getSourceType(), x.getResultTypes(),
+ x.getEntryCalls());
JMethodCall call = new JMethodCall(x.getSourceInfo(), null, method);
ctx.replaceMe(call.makeStatement());
return;
@@ -171,7 +172,7 @@
return !hardRebindAnswers.containsKey(reqType);
}
- private JMethod rebindMethod(SourceInfo info, JReferenceType requestType,
+ private JMethod rebindMethod(JReferenceType requestType,
List<JClassType> resultTypes, List<JExpression> instantiationExpressions) {
assert resultTypes.size() == instantiationExpressions.size();
@@ -180,8 +181,8 @@
return toReturn;
}
- info = info.makeChild(ResolveRebinds.class, "Rebind factory for "
- + requestType.getName());
+ SourceInfo info = requestType.getSourceInfo().makeChild(
+ SourceOrigin.UNKNOWN);
// Maps the result types to the various virtual permutation ids
Map<JClassType, List<Integer>> resultsToPermutations = new LinkedHashMap<JClassType, List<Integer>>();
@@ -217,11 +218,12 @@
assert mostUsed != null;
// c_g_g_d_c_i_DOMImpl
- toReturn = program.createMethod(info, requestType.getName().replace("_",
- "_1").replace('.', '_'), holderType,
- program.getTypeJavaLangObject().getNonNull(), false, true,
- true, false, false);
+ toReturn = program.createMethod(info,
+ requestType.getName().replace("_", "_1").replace('.', '_'), holderType,
+ program.getTypeJavaLangObject().getNonNull(), false, true, true, false,
+ false);
toReturn.freezeParamTypes();
+ info.addCorrelation(program.getCorrelator().by(toReturn));
rebindMethods.put(requestType, toReturn);
// Used in the return statement at the end
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/TypeTightener.java b/dev/core/src/com/google/gwt/dev/jjs/impl/TypeTightener.java
index c1cff6b..a83b59a 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/TypeTightener.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/TypeTightener.java
@@ -260,9 +260,10 @@
// Fake an assignment-to-self on all args to prevent tightening
JMethod method = x.getTarget();
for (JParameter param : method.getParams()) {
- addAssignment(param, new JParameterRef(
- program.createSourceInfoSynthetic(RecordVisitor.class,
- "Fake assignment"), param));
+ addAssignment(
+ param,
+ new JParameterRef(
+ program.createSourceInfoSynthetic(RecordVisitor.class), param));
}
}
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 e7f97ad..e24b50d 100644
--- a/dev/core/src/com/google/gwt/dev/js/EvalFunctionsAtTopScope.java
+++ b/dev/core/src/com/google/gwt/dev/js/EvalFunctionsAtTopScope.java
@@ -131,9 +131,7 @@
itr.previous();
itr.add(x.makeStmt());
itr.next();
- ctx.replaceMe(x.getName().makeRef(
- x.getSourceInfo().makeChild(EvalFunctionsAtTopScope.class,
- "Shuffled evaluation order")));
+ ctx.replaceMe(x.getName().makeRef(x.getSourceInfo().makeChild()));
}
// Dive into the function itself.
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 938928b..82c6a68 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsBreakUpLargeVarStatements.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsBreakUpLargeVarStatements.java
@@ -98,8 +98,6 @@
* Make a new, empty {@link JsVars} that is a child of x.
*/
private JsVars makeNewChildVars(JsVars x) {
- return new JsVars(x.getSourceInfo().makeChild(
- JsBreakUpLargeVarStatements.class,
- "breaking up a large vars statement into smaller ones"));
+ return new JsVars(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 55226f7..2947a93 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsIEBlockSizeVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsIEBlockSizeVisitor.java
@@ -80,8 +80,7 @@
* necessary to prevent any given block from exceeding the maximum size.
*/
private void restructure(List<JsStatement> statements) {
- SourceInfo sourceInfo = program.createSourceInfoSynthetic(
- JsIEBlockSizeVisitor.class, "Restructured to reduce block size");
+ SourceInfo sourceInfo = program.createSourceInfoSynthetic(JsIEBlockSizeVisitor.class);
// This outer loop will collapse the newly-created block into super-blocks
while (statements.size() > MAX_BLOCK_SIZE) {
ListIterator<JsStatement> i = statements.listIterator();
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 aa97813..caf83ea 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsInliner.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsInliner.java
@@ -253,9 +253,8 @@
* Create a new comma expression with the original LHS and the LHS of the
* nested comma expression.
*/
- JsBinaryOperation newOp = new JsBinaryOperation(
- x.getSourceInfo().makeChild(CommaNormalizer.class,
- "Simplifying comma expression"), JsBinaryOperator.COMMA);
+ JsBinaryOperation newOp = new JsBinaryOperation(x.getSourceInfo(),
+ JsBinaryOperator.COMMA);
newOp.setArg1(x.getArg1());
newOp.setArg2(toUpdate.getArg1());
@@ -870,8 +869,7 @@
* single JsExprStmt with a JsBlock that contains all of the
* statements.
*/
- JsBlock b = new JsBlock(x.getSourceInfo().makeChild(
- InliningVisitor.class, "Block required for control function"));
+ JsBlock b = new JsBlock(x.getSourceInfo());
b.getStatements().addAll(statements);
ctx.replaceMe(b);
return;
@@ -1025,8 +1023,7 @@
assert !statements.isEmpty();
// Find or create the JsVars as the first statement
- SourceInfo sourceInfo = x.getSourceInfo().makeChild(
- InliningVisitor.class, "Synthetic locals");
+ SourceInfo sourceInfo = x.getSourceInfo();
JsVars vars;
if (statements.get(0) instanceof JsVars) {
vars = (JsVars) statements.get(0);
@@ -1128,8 +1125,7 @@
* ensures that this logic will function correctly in the case of a single
* expression.
*/
- SourceInfo sourceInfo = x.getSourceInfo().makeChild(
- InliningVisitor.class, "Inlined invocation");
+ SourceInfo sourceInfo = x.getSourceInfo();
ListIterator<JsExpression> i = hoisted.listIterator(hoisted.size());
JsExpression op = i.previous();
while (i.hasPrevious()) {
@@ -1308,9 +1304,8 @@
return;
}
- JsExpression replacement = tryGetReplacementExpression(
- x.getSourceInfo().makeChild(NameRefReplacerVisitor.class,
- "Inlined expression"), x.getName());
+ JsExpression replacement = tryGetReplacementExpression(x.getSourceInfo(),
+ x.getName());
if (replacement != null) {
ctx.replaceMe(replacement);
@@ -1792,8 +1787,7 @@
// Extract the initialization expression
JsExpression init = var.getInitExpr();
if (init != null) {
- SourceInfo sourceInfo = var.getSourceInfo().makeChild(
- JsInliner.class, "Hoisted initializer into inline site");
+ SourceInfo sourceInfo = var.getSourceInfo();
JsBinaryOperation assignment = new JsBinaryOperation(sourceInfo,
JsBinaryOperator.ASG);
assignment.setArg1(var.getName().makeRef(sourceInfo));
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 d3d81de..3e9c96c 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsParser.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsParser.java
@@ -252,7 +252,7 @@
case TokenStream.STRING: {
SourceInfo info = makeSourceInfoDistinct(node);
- info.addCorrelation(info.getCorrelationFactory().by(Literal.JS_STRING));
+ info.addCorrelation(info.getCorrelationFactory().by(Literal.STRING));
return new JsStringLiteral(info, node.getString());
}
@@ -912,12 +912,9 @@
case TokenStream.NULL:
return JsNullLiteral.INSTANCE;
- case TokenStream.UNDEFINED: {
- SourceInfo info = makeSourceInfoDistinct(node);
- info.addCorrelation(info.getCorrelationFactory().by(
- Literal.JS_UNDEFINED));
- return new JsNameRef(info, JsRootScope.INSTANCE.getUndefined());
- }
+ case TokenStream.UNDEFINED:
+ return new JsNameRef(makeSourceInfo(node),
+ JsRootScope.INSTANCE.getUndefined());
default:
throw createParserException("Unknown primary: " + node.getIntDatum(),
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 35633c3..82a6379 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsStackEmulator.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsStackEmulator.java
@@ -123,8 +123,7 @@
}
// $stackDepth = stackIndex
- SourceInfo info = x.getSourceInfo().makeChild(JsStackEmulator.class,
- "Resetting stack depth");
+ SourceInfo info = x.getSourceInfo();
JsBinaryOperation reset = new JsBinaryOperation(info,
JsBinaryOperator.ASG, stackDepth.makeRef(info),
eeVisitor.stackIndexRef(info));
@@ -303,8 +302,7 @@
} else {
if (x.getExpr() != null && x.getExpr().hasSideEffects()) {
// temp = expr; pop(); return temp;
- SourceInfo info = x.getSourceInfo().makeChild(JsStackEmulator.class,
- "Flow break with side-effect");
+ SourceInfo info = x.getSourceInfo();
JsBinaryOperation asg = new JsBinaryOperation(info,
JsBinaryOperator.ASG, returnTempRef(info), x.getExpr());
x.setExpr(returnTempRef(info));
@@ -416,8 +414,7 @@
}
// pop()
- SourceInfo info = x.getSourceInfo().makeChild(JsStackEmulator.class,
- "Stack exit");
+ SourceInfo info = x.getSourceInfo();
JsExpression op = pop(info);
if (checkEarlyExit) {
@@ -452,8 +449,7 @@
/*
* catch (e) { e = caught(e); throw e; }
*/
- SourceInfo info = x.getSourceInfo().makeChild(JsStackEmulator.class,
- "Synthetic catch block to fix stack depth");
+ SourceInfo info = x.getSourceInfo();
JsCatch c = new JsCatch(info, currentFunction.getScope(), "e");
JsName paramName = c.getParameter().getName();
@@ -485,8 +481,7 @@
*/
private void pop(JsStatement x, JsExpression expr, JsContext ctx) {
// $stackDepth = stackIndex - 1
- SourceInfo info = x.getSourceInfo().makeChild(JsStackEmulator.class,
- "Stack exit");
+ SourceInfo info = x.getSourceInfo();
JsExpression op = pop(info);
@@ -521,8 +516,7 @@
* Create the function-entry code.
*/
private JsStatement push(HasSourceInfo x) {
- SourceInfo info = x.getSourceInfo().makeChild(JsStackEmulator.class,
- "Stack entry code");
+ SourceInfo info = x.getSourceInfo();
JsNameRef stackRef = stack.makeRef(info);
JsNameRef stackDepthRef = stackDepth.makeRef(info);
@@ -737,8 +731,7 @@
return;
}
- SourceInfo info = x.getSourceInfo().makeChild(JsStackEmulator.class,
- "Synthetic location data");
+ SourceInfo info = x.getSourceInfo();
// ($locations[stackIndex] = fileName + lineNumber, x)
JsExpression location = new JsStringLiteral(info,
@@ -892,8 +885,7 @@
}
private void makeVars() {
- SourceInfo info = program.getSourceInfo().makeChild(JsStackEmulator.class,
- "Emulated stack data");
+ SourceInfo info = program.createSourceInfoSynthetic(getClass());
JsVar stackVar = new JsVar(info, stack);
stackVar.setInitExpr(new JsArrayLiteral(info));
JsVar stackDepthVar = new JsVar(info, stackDepth);
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 f44b733..4d6434c 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java
@@ -15,7 +15,6 @@
*/
package com.google.gwt.dev.js;
-import com.google.gwt.dev.jjs.HasSourceInfo;
import com.google.gwt.dev.jjs.SourceInfo;
import com.google.gwt.dev.jjs.impl.OptimizerStats;
import com.google.gwt.dev.js.ast.CanBooleanEval;
@@ -119,12 +118,10 @@
@Override
public void endVisit(JsVars x, JsContext ctx) {
- JsVars strippedVars = new JsVars(x.getSourceInfo().makeChild(
- MustExecVisitor.class, "Simplified execution"));
+ JsVars strippedVars = new JsVars(x.getSourceInfo());
boolean mustReplace = false;
for (JsVar var : x) {
- JsVar strippedVar = new JsVar(var.getSourceInfo().makeChild(
- MustExecVisitor.class, "Simplified execution"), var.getName());
+ JsVar strippedVar = new JsVar(var.getSourceInfo(), var.getName());
strippedVars.add(strippedVar);
if (var.getInitExpr() != null) {
mustReplace = true;
@@ -245,15 +242,13 @@
if (condExpr instanceof CanBooleanEval) {
CanBooleanEval condEval = (CanBooleanEval) condExpr;
if (condEval.isBooleanTrue()) {
- JsBinaryOperation binOp = new JsBinaryOperation(makeSourceInfo(x,
- "Simplified always-true condition"), JsBinaryOperator.AND,
- condExpr, thenExpr);
+ JsBinaryOperation binOp = new JsBinaryOperation(x.getSourceInfo(),
+ JsBinaryOperator.AND, condExpr, thenExpr);
ctx.replaceMe(accept(binOp));
} else if (condEval.isBooleanFalse()) {
// e.g. (false() ? then : else) -> false() || else
- JsBinaryOperation binOp = new JsBinaryOperation(makeSourceInfo(x,
- "Simplified always-false condition"), JsBinaryOperator.OR,
- condExpr, elseExpr);
+ JsBinaryOperation binOp = new JsBinaryOperation(x.getSourceInfo(),
+ JsBinaryOperator.OR, condExpr, elseExpr);
ctx.replaceMe(accept(binOp));
}
}
@@ -276,8 +271,7 @@
FindBreakContinueStatementsVisitor visitor = new FindBreakContinueStatementsVisitor();
visitor.accept(x.getBody());
if (!visitor.hasBreakContinueStatements()) {
- JsBlock block = new JsBlock(makeSourceInfo(x,
- "Simplified always-false condition"));
+ JsBlock block = new JsBlock(x.getSourceInfo());
block.getStatements().add(x.getBody());
block.getStatements().add(expr.makeStmt());
ctx.replaceMe(accept(block));
@@ -310,8 +304,7 @@
// If false, replace with initializers and condition.
if (cond.isBooleanFalse()) {
- JsBlock block = new JsBlock(makeSourceInfo(x,
- "Simplified always-false condition"));
+ JsBlock block = new JsBlock(x.getSourceInfo());
if (x.getInitExpr() != null) {
block.getStatements().add(x.getInitExpr().makeStmt());
}
@@ -354,35 +347,29 @@
ctx.replaceMe(condExpr.makeStmt());
} else if (thenExpr != null && elseExpr != null) {
// Convert "if (a()) {b()} else {c()}" => "a()?b():c()".
- JsConditional cond = new JsConditional(makeSourceInfo(x,
- "Replaced if statement with conditional"), x.getIfExpr(), thenExpr,
- elseExpr);
+ JsConditional cond = new JsConditional(x.getSourceInfo(),
+ x.getIfExpr(), thenExpr, elseExpr);
ctx.replaceMe(accept(cond.makeStmt()));
} else if (thenIsEmpty && elseExpr != null) {
// Convert "if (a()) {} else {b()}" => a()||b().
- JsBinaryOperation op = new JsBinaryOperation(makeSourceInfo(x,
- "Replaced if statement with ||"), JsBinaryOperator.OR,
- x.getIfExpr(), elseExpr);
+ JsBinaryOperation op = new JsBinaryOperation(x.getSourceInfo(),
+ JsBinaryOperator.OR, x.getIfExpr(), elseExpr);
ctx.replaceMe(accept(op.makeStmt()));
} else if (thenIsEmpty && !elseIsEmpty) {
// Convert "if (a()) {} else {stuff}" => "if (!a()) {stuff}".
JsUnaryOperation negatedOperation = new JsPrefixOperation(
- makeSourceInfo(x, "Simplified if with empty then statement"),
- JsUnaryOperator.NOT, x.getIfExpr());
- JsIf newIf = new JsIf(makeSourceInfo(x,
- "Simplified if with empty then statement"), negatedOperation,
- elseStmt, null);
+ x.getSourceInfo(), JsUnaryOperator.NOT, x.getIfExpr());
+ JsIf newIf = new JsIf(x.getSourceInfo(), negatedOperation, elseStmt,
+ null);
ctx.replaceMe(accept(newIf));
} else if (elseIsEmpty && thenExpr != null) {
// Convert "if (a()) {b()}" => "a()&&b()".
- JsBinaryOperation op = new JsBinaryOperation(makeSourceInfo(x,
- "Replaced if statement with &&"), JsBinaryOperator.AND,
- x.getIfExpr(), thenExpr);
+ JsBinaryOperation op = new JsBinaryOperation(x.getSourceInfo(),
+ JsBinaryOperator.AND, x.getIfExpr(), thenExpr);
ctx.replaceMe(accept(op.makeStmt()));
} else if (elseIsEmpty && elseStmt != null) {
// Convert "if (a()) {b()} else {}" => "if (a()) {b()}".
- JsIf newIf = new JsIf(makeSourceInfo(x, "Pruned empty else statement"),
- x.getIfExpr(), thenStmt, null);
+ JsIf newIf = new JsIf(x.getSourceInfo(), x.getIfExpr(), thenStmt, null);
ctx.replaceMe(accept(newIf));
}
}
@@ -421,8 +408,7 @@
// If false, replace with condition.
if (cond.isBooleanFalse()) {
- JsBlock block = new JsBlock(makeSourceInfo(x,
- "Simplified always-false condition"));
+ JsBlock block = new JsBlock(x.getSourceInfo());
block.getStatements().add(expr.makeStmt());
JsStatement decls = ensureDeclarations(x.getBody());
if (decls != null) {
@@ -557,8 +543,7 @@
} else if (stmts.size() == 1) {
return stmts.get(0);
} else {
- JsBlock jsBlock = new JsBlock(makeSourceInfo(stmt,
- "Ensuring declarations"));
+ JsBlock jsBlock = new JsBlock(stmt.getSourceInfo());
jsBlock.getStatements().addAll(stmts);
return jsBlock;
}
@@ -578,10 +563,6 @@
return num;
}
- private SourceInfo makeSourceInfo(HasSourceInfo x, String m) {
- return x.getSourceInfo().makeChild(StaticEvalVisitor.class, m);
- }
-
private JsExpression simplifyEq(JsExpression original, JsExpression arg1,
JsExpression arg2) {
assert (original != null);
@@ -791,8 +772,7 @@
JsStatement thenStmt = x.getThenStmt();
JsStatement elseStmt = x.getElseStmt();
if (cond.isBooleanTrue()) {
- JsBlock block = new JsBlock(makeSourceInfo(x,
- "Simplified always-true condition"));
+ JsBlock block = new JsBlock(x.getSourceInfo());
block.getStatements().add(x.getIfExpr().makeStmt());
if (thenStmt != null) {
block.getStatements().add(thenStmt);
@@ -804,8 +784,7 @@
ctx.replaceMe(accept(block));
return true;
} else if (cond.isBooleanFalse()) {
- JsBlock block = new JsBlock(makeSourceInfo(x,
- "Simplified always-false condition"));
+ JsBlock block = new JsBlock(x.getSourceInfo());
block.getStatements().add(x.getIfExpr().makeStmt());
if (elseStmt != null) {
block.getStatements().add(elseStmt);
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 1f423d4..4d19bb5 100644
--- a/dev/core/src/com/google/gwt/dev/js/JsStringInterner.java
+++ b/dev/core/src/com/google/gwt/dev/js/JsStringInterner.java
@@ -271,9 +271,7 @@
}
}
- ctx.replaceMe(name.makeRef(x.getSourceInfo().makeChild(
- JsStringInterner.class, "Interned reference")));
-
+ ctx.replaceMe(name.makeRef(x.getSourceInfo().makeChild()));
return false;
}
@@ -359,10 +357,8 @@
Collection<JsStringLiteral> toCreate, Map<JsStringLiteral, JsName> names) {
if (toCreate.size() > 0) {
// Create the pool of variable names.
- JsVars vars = new JsVars(program.createSourceInfoSynthetic(
- JsStringInterner.class, "Interned string pool"));
- SourceInfo sourceInfo = program.createSourceInfoSynthetic(
- JsStringInterner.class, "Interned string assignment");
+ SourceInfo sourceInfo = program.createSourceInfoSynthetic(JsStringInterner.class);
+ JsVars vars = new JsVars(sourceInfo);
for (JsStringLiteral literal : toCreate) {
JsVar var = new JsVar(sourceInfo, names.get(literal));
var.setInitExpr(literal);
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 4bde74d..c1e51c3 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
@@ -24,15 +24,13 @@
public final class JsNameRef extends JsExpression implements CanBooleanEval,
HasName {
- private boolean hasStaticRef;
private String ident;
private JsName name;
private JsExpression qualifier;
public JsNameRef(SourceInfo sourceInfo, JsName name) {
- super(sourceInfo.makeChild(JsNameRef.class, "Reference"));
+ super(sourceInfo);
this.name = name;
- maybeUpdateSourceInfo();
}
public JsNameRef(SourceInfo sourceInfo, String ident) {
@@ -57,11 +55,6 @@
}
@Override
- public SourceInfo getSourceInfo() {
- return maybeUpdateSourceInfo();
- }
-
- @Override
public boolean hasSideEffects() {
if (qualifier == null) {
return false;
@@ -122,22 +115,4 @@
}
v.endVisit(this, ctx);
}
-
- /**
- * This corrects the JsNameRef's SourceInfo derivation when the JsName is
- * created with a JsName that has not yet had its static reference set. This
- * is the case in GenerateJavaScriptAST after the names and scopes visitor has
- * been run, but before the AST is fully realized.
- */
- private SourceInfo maybeUpdateSourceInfo() {
- SourceInfo toReturn = super.getSourceInfo();
- if (!hasStaticRef && name != null) {
- JsNode staticRef = name.getStaticRef();
- if (staticRef != null) {
- toReturn.copyMissingCorrelationsFrom(name.getStaticRef().getSourceInfo());
- hasStaticRef = true;
- }
- }
- return toReturn;
- }
}
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 a05967b..db4358d 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
@@ -71,9 +71,8 @@
return correlator.makeSourceInfo(SourceOrigin.create(lineNumber, location));
}
- public SourceInfo createSourceInfoSynthetic(Class<?> caller,
- String description) {
- return createSourceInfo(0, caller.getName()).makeChild(caller, description);
+ public SourceInfo createSourceInfoSynthetic(Class<?> caller) {
+ return createSourceInfo(0, caller.getName());
}
public JsBlock getFragmentBlock(int fragment) {
@@ -113,8 +112,8 @@
public void setFragmentCount(int fragments) {
this.fragments = new JsProgramFragment[fragments];
for (int i = 0; i < fragments; i++) {
- this.fragments[i] = new JsProgramFragment(createSourceInfoSynthetic(
- JsProgram.class, "fragment " + i));
+ this.fragments[i] = new JsProgramFragment(
+ createSourceInfoSynthetic(JsProgram.class));
}
}
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 92aff71..703a5f0 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
@@ -25,8 +25,7 @@
public JsProgramFragment(SourceInfo sourceInfo) {
super(sourceInfo);
- this.globalBlock = new JsGlobalBlock(sourceInfo.makeChild(
- JsProgramFragment.class, "global block for a fragment"));
+ this.globalBlock = new JsGlobalBlock(sourceInfo.makeChild());
}
public JsBlock getGlobalBlock() {
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 5c2b519..c6650fc 100644
--- a/dev/core/src/com/google/gwt/dev/shell/Jsni.java
+++ b/dev/core/src/com/google/gwt/dev/shell/Jsni.java
@@ -139,18 +139,17 @@
// Use a clone instead of modifying the original JSNI
// __gwt_makeTearOff(obj, dispId, paramCount)
- SourceInfo newSourceInfo = x.getSourceInfo().makeChild(getClass(),
- "Replace JSNI ref for hosted mode");
- JsInvocation rewritten = new JsInvocation(newSourceInfo);
- rewritten.setQualifier(new JsNameRef(newSourceInfo, "__gwt_makeTearOff"));
+ SourceInfo info = x.getSourceInfo();
+ JsInvocation rewritten = new JsInvocation(info);
+ rewritten.setQualifier(new JsNameRef(info, "__gwt_makeTearOff"));
List<JsExpression> arguments = rewritten.getArguments();
if (q == null) {
q = JsNullLiteral.INSTANCE;
}
arguments.add(q);
- arguments.add(new JsNumberLiteral(newSourceInfo, dispId));
- arguments.add(new JsNumberLiteral(newSourceInfo, paramCount));
+ arguments.add(new JsNumberLiteral(info, dispId));
+ arguments.add(new JsNumberLiteral(info, paramCount));
accept(rewritten);
return false;
@@ -202,15 +201,12 @@
paramCount = ((Constructor<?>) member).getParameterTypes().length;
}
- SourceInfo newSourceInfo = x.getSourceInfo().makeChild(getClass(),
- "Replace JSNI ref for hosted mode");
- JsInvocation inner = new JsInvocation(newSourceInfo);
- inner.setQualifier(new JsNameRef(newSourceInfo,
- "__gwt_makeJavaInvoke"));
- inner.getArguments().add(
- new JsNumberLiteral(newSourceInfo, paramCount));
+ SourceInfo info = x.getSourceInfo();
+ JsInvocation inner = new JsInvocation(info);
+ inner.setQualifier(new JsNameRef(info, "__gwt_makeJavaInvoke"));
+ inner.getArguments().add(new JsNumberLiteral(info, paramCount));
- JsInvocation outer = new JsInvocation(newSourceInfo);
+ JsInvocation outer = new JsInvocation(info);
outer.setQualifier(inner);
JsExpression q = ref.getQualifier();
if (q == null) {
@@ -218,7 +214,7 @@
}
List<JsExpression> arguments = outer.getArguments();
arguments.add(q);
- arguments.add(new JsNumberLiteral(newSourceInfo, dispId));
+ arguments.add(new JsNumberLiteral(info, dispId));
arguments.addAll(x.getArguments());
accept(outer);
diff --git a/dev/core/test/com/google/gwt/dev/jjs/JavaAstConstructor.java b/dev/core/test/com/google/gwt/dev/jjs/JavaAstConstructor.java
index 6a015b0..ce8b05e 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/JavaAstConstructor.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/JavaAstConstructor.java
@@ -253,8 +253,7 @@
// (2) Create our own Java AST from the JDT AST.
JJSOptionsImpl options = new JJSOptionsImpl();
options.setEnableAssertions(true);
- GenerateJavaAST.exec(allTypeDeclarations, typeMap, jprogram, jsProgram,
- options);
+ GenerateJavaAST.exec(allTypeDeclarations, typeMap, jprogram, options);
// GenerateJavaAST can uncover semantic JSNI errors; report & abort
JavaToJavaScriptCompiler.checkForErrors(logger, goldenCuds, true);
diff --git a/dev/core/test/com/google/gwt/dev/jjs/JjsTypeTest.java b/dev/core/test/com/google/gwt/dev/jjs/JjsTypeTest.java
index 822697d..6d59a36 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/JjsTypeTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/JjsTypeTest.java
@@ -230,8 +230,7 @@
// Make the program itself
program = new JProgram();
typeOracle = program.typeOracle;
- synthSource = program.createSourceInfoSynthetic(JjsTypeTest.class,
- "synthetic node used for testing");
+ synthSource = program.createSourceInfoSynthetic(JjsTypeTest.class);
classObject = createClass("java.lang.Object", null, false, false);
classString = createClass("java.lang.String", classObject, false, true);