diff -r 7b6295731c30 -r bf08bd96d408 rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java Thu May 22 10:48:09 2014 +0200 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java Thu May 22 19:06:44 2014 +0200 @@ -34,13 +34,18 @@ private final Bck2Brwsr.Resources resources; private final ExportedSymbols exportedSymbols; private final StringArray invokerMethods; + private final StringArray asBinary; - private VM(Appendable out, Bck2Brwsr.Resources resources, StringArray explicitlyExported) { + private VM( + Appendable out, Bck2Brwsr.Resources resources, + StringArray explicitlyExported, StringArray asBinary + ) { super(out); this.resources = resources; this.classDataCache = new ClassDataCache(resources); this.exportedSymbols = new ExportedSymbols(resources, explicitlyExported); this.invokerMethods = new StringArray(); + this.asBinary = asBinary; } static { @@ -70,17 +75,23 @@ VM vm; if (config.isExtension()) { fixedNames.add(VM.class.getName().replace('.', '/')); - vm = new Extension(out, config.getResources(), both, config.exported()); + vm = new Extension(out, + config.getResources(), both, config.exported(), + config.allResources() + ); } else { if (config.includeVM()) { fixedNames.add(VM.class.getName().replace('.', '/')); } - vm = new Standalone(out, config.getResources(), config.exported()); + vm = new Standalone(out, + config.getResources(), config.exported(), + config.allResources() + ); } - vm.doCompile(fixedNames.addAndNew(both), config.allResources()); + vm.doCompile(fixedNames.addAndNew(both)); } - private void doCompile(StringArray names, StringArray asBinary) throws IOException { + private void doCompile(StringArray names) throws IOException { generatePrologue(); append( "\n var invoker = {};"); @@ -229,6 +240,7 @@ throw new IOException("Can't find " + resource); } readResource(emul, this); + asBinary.remove(resource); } scripts = new StringArray(); @@ -441,8 +453,11 @@ } private static final class Standalone extends VM { - private Standalone(Appendable out, Bck2Brwsr.Resources resources, StringArray explicitlyExported) { - super(out, resources, explicitlyExported); + private Standalone(Appendable out, + Bck2Brwsr.Resources resources, + StringArray explicitlyExported, StringArray asBinary + ) { + super(out, resources, explicitlyExported, asBinary); } @Override @@ -578,8 +593,10 @@ private final StringArray extensionClasses; private Extension(Appendable out, Bck2Brwsr.Resources resources, - String[] extClassesArray, StringArray explicitlyExported) { - super(out, resources, explicitlyExported); + String[] extClassesArray, StringArray explicitlyExported, + StringArray asBinary + ) { + super(out, resources, explicitlyExported, asBinary); this.extensionClasses = StringArray.asList(extClassesArray); }