Revision: 7724
Author: [email protected]
Date: Fri Mar 12 14:12:44 2010
Log: Disentangles CompilationResult from Permutation.
http://gwt-code-reviews.appspot.com/194801
Review by: bobv
http://code.google.com/p/google-web-toolkit/source/detail?r=7724
Modified:
/trunk/dev/core/src/com/google/gwt/core/ext/linker/CompilationResult.java
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationResult.java
=======================================
---
/trunk/dev/core/src/com/google/gwt/core/ext/linker/CompilationResult.java
Wed Mar 3 09:01:30 2010
+++
/trunk/dev/core/src/com/google/gwt/core/ext/linker/CompilationResult.java
Fri Mar 12 14:12:44 2010
@@ -16,7 +16,6 @@
package com.google.gwt.core.ext.linker;
import com.google.gwt.core.ext.Linker;
-import com.google.gwt.dev.Permutation;
import java.util.Map;
import java.util.SortedMap;
@@ -27,12 +26,9 @@
* result in identical JavaScript.
*/
public abstract class CompilationResult extends
Artifact<CompilationResult> {
- private final Permutation permutation;
-
- protected CompilationResult(Class<? extends Linker> linkerType,
- Permutation permutation) {
+
+ protected CompilationResult(Class<? extends Linker> linkerType) {
super(linkerType);
- this.permutation = permutation;
}
/**
@@ -46,20 +42,11 @@
* runAsync.
*/
public abstract String[] getJavaScript();
-
- /**
- * Return the permutation that compiled to this result.
- */
- public Permutation getPermutation() {
- return permutation;
- }
/**
* Returns the permutation ID.
*/
- public int getPermutationId() {
- return getPermutation().getId();
- }
+ public abstract int getPermutationId();
/**
* Provides values for {...@link SelectionProperty} instances that are not
=======================================
---
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java
Wed Mar 3 09:01:30 2010
+++
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java
Fri Mar 12 14:12:44 2010
@@ -26,8 +26,6 @@
import com.google.gwt.core.ext.linker.ScriptReference;
import com.google.gwt.core.ext.linker.SelectionProperty;
import com.google.gwt.core.ext.linker.StylesheetReference;
-import com.google.gwt.dev.cfg.BindingProperty;
-import com.google.gwt.dev.cfg.StaticPropertyOracle;
import com.google.gwt.dev.util.Util;
import com.google.gwt.dev.util.collect.HashSet;
import com.google.gwt.dev.util.collect.Lists;
@@ -163,8 +161,7 @@
+ result.getStrongName() + File.separator + i +
FRAGMENT_EXTENSION));
}
-
toReturn.addAll(emitSelectionInformation(result.getPermutation().getId(),
- result.getStrongName(),
result.getPermutation().getPropertyOracles()));
+ toReturn.addAll(emitSelectionInformation(result.getStrongName(),
result));
return toReturn;
}
@@ -434,18 +431,14 @@
}
}
- private List<Artifact<?>> emitSelectionInformation(int id, String
strongName,
- StaticPropertyOracle[] staticPropertyOracles) {
+ private List<Artifact<?>> emitSelectionInformation(String strongName,
+ CompilationResult result) {
List<Artifact<?>> emitted = new ArrayList<Artifact<?>>();
- for (int propOracleId = 0; propOracleId <
staticPropertyOracles.length; propOracleId++) {
- StaticPropertyOracle propOracle =
staticPropertyOracles[propOracleId];
+ for (SortedMap<SelectionProperty, String> propertyMap :
result.getPropertyMap()) {
TreeMap<String, String> propMap = new TreeMap<String, String>();
-
- BindingProperty[] orderedProps = propOracle.getOrderedProps();
- String[] orderedPropValues = propOracle.getOrderedPropValues();
- for (int i = 0; i < orderedProps.length; i++) {
- propMap.put(orderedProps[i].getName(), orderedPropValues[i]);
+ for (Map.Entry<SelectionProperty, String> entry :
propertyMap.entrySet()) {
+ propMap.put(entry.getKey().getName(), entry.getValue());
}
emitted.add(new SelectionInformation(strongName, propMap));
}
=======================================
---
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationResult.java
Wed Mar 3 09:01:30 2010
+++
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationResult.java
Fri Mar 12 14:12:44 2010
@@ -19,7 +19,6 @@
import com.google.gwt.core.ext.linker.SelectionProperty;
import com.google.gwt.core.ext.linker.StatementRanges;
import com.google.gwt.core.ext.linker.SymbolData;
-import com.google.gwt.dev.Permutation;
import com.google.gwt.dev.jjs.PermutationResult;
import com.google.gwt.dev.util.DiskCache;
import com.google.gwt.dev.util.Util;
@@ -84,18 +83,20 @@
private final long symbolToken;
+ private final int permutationId;
+
public StandardCompilationResult(PermutationResult permutationResult) {
- super(StandardLinkerContext.class, permutationResult.getPermutation());
+ super(StandardLinkerContext.class);
byte[][] js = permutationResult.getJs();
- strongName = Util.computeStrongName(js);
+ this.strongName = Util.computeStrongName(js);
byte[] serializedSymbolMap =
permutationResult.getSerializedSymbolMap();
- statementRanges = permutationResult.getStatementRanges();
- Permutation permutation = permutationResult.getPermutation();
- jsToken = new long[js.length];
+ this.statementRanges = permutationResult.getStatementRanges();
+ this.permutationId = permutationResult.getPermutation().getId();
+ this.jsToken = new long[js.length];
for (int i = 0; i < jsToken.length; ++i) {
jsToken[i] = diskCache.writeByteArray(js[i]);
}
- symbolToken = diskCache.writeByteArray(serializedSymbolMap);
+ this.symbolToken = diskCache.writeByteArray(serializedSymbolMap);
}
/**
@@ -117,6 +118,11 @@
}
return js;
}
+
+ @Override
+ public int getPermutationId() {
+ return permutationId;
+ }
@Override
public SortedSet<SortedMap<SelectionProperty, String>> getPropertyMap() {
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors