rt/vm/src/main/java/org/apidesign/vm4brwsr/ClosureWrapper.java
branchclosure
changeset 1493 234fea368401
parent 1491 4a1398eff4fb
child 1513 ba912ef24b27
     1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/ClosureWrapper.java	Sat Apr 26 21:30:06 2014 +0200
     1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/ClosureWrapper.java	Sun Apr 27 22:40:17 2014 +0200
     1.3 @@ -35,28 +35,18 @@
     1.4  final class ClosureWrapper extends CommandLineRunner {
     1.5      private static final String[] ARGS = { "--compilation_level", "SIMPLE_OPTIMIZATIONS", "--js", "bck2brwsr-raw.js" /*, "--debug", "--formatting", "PRETTY_PRINT" */ };
     1.6  
     1.7 -    private final Bck2Brwsr.Resources res;
     1.8 -    private final StringArray classes;
     1.9 -    private final boolean extension;
    1.10 -    private final StringArray rootClasses;
    1.11 +    private final Bck2Brwsr config;
    1.12  
    1.13      private String compiledCode;
    1.14      private String externsCode;
    1.15  
    1.16 -    private ClosureWrapper(Appendable out, 
    1.17 -                           String compilationLevel,
    1.18 -                           Bck2Brwsr.Resources res,
    1.19 -                           StringArray rootClasses,
    1.20 -                           StringArray classes,
    1.21 -                           boolean extension) {
    1.22 +    private ClosureWrapper(Appendable out,
    1.23 +                           String compilationLevel, Bck2Brwsr config) {
    1.24          super(
    1.25              generateArguments(compilationLevel),
    1.26              new PrintStream(new APS(out)), System.err
    1.27          );
    1.28 -        this.res = res;
    1.29 -        this.rootClasses = rootClasses;
    1.30 -        this.classes = classes;
    1.31 -        this.extension = extension;
    1.32 +        this.config = config;
    1.33      }
    1.34  
    1.35      @Override
    1.36 @@ -99,7 +89,7 @@
    1.37          if (compiledCode == null) {
    1.38              StringBuilder sb = new StringBuilder();
    1.39              try {
    1.40 -                VM.compile(sb, res, rootClasses, classes, extension);
    1.41 +                VM.compile(sb, config);
    1.42                  compiledCode = sb.toString();
    1.43              } catch (IOException ex) {
    1.44                  compiledCode = ex.getMessage();
    1.45 @@ -142,17 +132,15 @@
    1.46      }
    1.47  
    1.48      static int produceTo(Appendable output,
    1.49 -                         ObfuscationLevel obfuscationLevel,
    1.50 -                         Bck2Brwsr.Resources resources,
    1.51 -                         StringArray rootArr,
    1.52 -                         StringArray arr,
    1.53 -                         boolean extension) throws IOException {
    1.54 +        ObfuscationLevel obfuscationLevel,
    1.55 +        Bck2Brwsr config
    1.56 +    ) throws IOException {
    1.57          final ClosureWrapper cw =
    1.58                  new ClosureWrapper(output,
    1.59                                     (obfuscationLevel == ObfuscationLevel.FULL)
    1.60                                             ? "ADVANCED_OPTIMIZATIONS"
    1.61                                             : "SIMPLE_OPTIMIZATIONS",
    1.62 -                                   resources, rootArr, arr, extension);
    1.63 +                                   config);
    1.64          try {
    1.65              return cw.doRun();
    1.66          } catch (FlagUsageException ex) {