rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java
branchclosure
changeset 1491 4a1398eff4fb
parent 1489 8d0fc428ff72
child 1493 234fea368401
     1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java	Sat Apr 26 19:13:56 2014 +0200
     1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java	Sat Apr 26 21:30:06 2014 +0200
     1.3 @@ -40,11 +40,11 @@
     1.4              VM.class
     1.5          };
     1.6  
     1.7 -    private VM(Appendable out, Bck2Brwsr.Resources resources) {
     1.8 +    private VM(Appendable out, Bck2Brwsr.Resources resources, StringArray explicitlyExported) {
     1.9          super(out);
    1.10          this.resources = resources;
    1.11          this.classDataCache = new ClassDataCache(resources);
    1.12 -        this.exportedSymbols = new ExportedSymbols(resources);
    1.13 +        this.exportedSymbols = new ExportedSymbols(resources, explicitlyExported);
    1.14          this.invokerMethods = new StringArray();
    1.15      }
    1.16  
    1.17 @@ -63,9 +63,16 @@
    1.18          return false;
    1.19      }
    1.20      
    1.21 -    static void compile(Appendable out, Bck2Brwsr.Resources l, StringArray names, boolean extension) throws IOException {
    1.22 -        VM vm = extension ? new Extension(out, l, names.toArray())
    1.23 -                          : new Standalone(out, l);
    1.24 +    static void compile(Appendable out, 
    1.25 +        Bck2Brwsr.Resources l, 
    1.26 +        StringArray rootNames, 
    1.27 +        StringArray names, 
    1.28 +        boolean extension
    1.29 +    ) throws IOException {
    1.30 +        StringArray both = names.addAndNew(rootNames.toArray());
    1.31 +        
    1.32 +        VM vm = extension ? new Extension(out, l, both.toArray(), rootNames)
    1.33 +                          : new Standalone(out, l, rootNames);
    1.34  
    1.35          final StringArray fixedNames = new StringArray();
    1.36  
    1.37 @@ -73,7 +80,7 @@
    1.38              fixedNames.add(fixedClass.getName().replace('.', '/'));
    1.39          }
    1.40  
    1.41 -        vm.doCompile(fixedNames.addAndNew(names.toArray()));
    1.42 +        vm.doCompile(fixedNames.addAndNew(both.toArray()));
    1.43      }
    1.44  
    1.45      private void doCompile(StringArray names) throws IOException {
    1.46 @@ -412,8 +419,8 @@
    1.47      }
    1.48  
    1.49      private static final class Standalone extends VM {
    1.50 -        private Standalone(Appendable out, Bck2Brwsr.Resources resources) {
    1.51 -            super(out, resources);
    1.52 +        private Standalone(Appendable out, Bck2Brwsr.Resources resources, StringArray explicitlyExported) {
    1.53 +            super(out, resources, explicitlyExported);
    1.54          }
    1.55  
    1.56          @Override
    1.57 @@ -488,8 +495,8 @@
    1.58          private final StringArray extensionClasses;
    1.59  
    1.60          private Extension(Appendable out, Bck2Brwsr.Resources resources,
    1.61 -                          String[] extClassesArray) {
    1.62 -            super(out, resources);
    1.63 +                          String[] extClassesArray, StringArray explicitlyExported) {
    1.64 +            super(out, resources, explicitlyExported);
    1.65              this.extensionClasses = StringArray.asList(extClassesArray);
    1.66          }
    1.67