rt/vm/src/main/java/org/apidesign/vm4brwsr/Bck2Brwsr.java
branchclosure
changeset 1086 2ac4283ee209
parent 1029 b1fe994d4267
child 1094 36961c9a009f
     1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/Bck2Brwsr.java	Fri Apr 26 18:48:34 2013 +0200
     1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/Bck2Brwsr.java	Wed May 08 14:54:32 2013 +0200
     1.3 @@ -20,7 +20,6 @@
     1.4  import java.io.IOException;
     1.5  import java.io.InputStream;
     1.6  import java.net.URL;
     1.7 -import java.util.Enumeration;
     1.8  
     1.9  /** Build your own virtual machine! Use methods in this class to generate
    1.10   * a skeleton JVM in JavaScript that contains pre-compiled classes of your
    1.11 @@ -171,25 +170,21 @@
    1.12       */
    1.13      public void generate(Appendable out) throws IOException {
    1.14          Resources r = res != null ? res : new LdrRsrcs(Bck2Brwsr.class.getClassLoader());
    1.15 -//        if (level != ObfuscationLevel.NONE) {
    1.16 -//            try {
    1.17 -//                ClosureWrapper.produceTo(out, level, r, classes);
    1.18 -//                return;
    1.19 -//            } catch (IOException ex) {
    1.20 -//                throw ex;
    1.21 -//            } catch (Throwable ex) {
    1.22 -//                out.append("/* Failed to obfuscate: " + ex.getMessage()
    1.23 -//                               + " */\n");
    1.24 -//            }
    1.25 -//        }
    1.26 +        if (level != ObfuscationLevel.NONE) {
    1.27 +            try {
    1.28 +                ClosureWrapper.produceTo(out, level, r, classes, extension);
    1.29 +                return;
    1.30 +            } catch (IOException ex) {
    1.31 +                throw ex;
    1.32 +            } catch (Throwable ex) {
    1.33 +                out.append("/* Failed to obfuscate: " + ex.getMessage()
    1.34 +                               + " */\n");
    1.35 +            }
    1.36 +        }
    1.37  
    1.38 -        if (extension) {
    1.39 -            VM.compileExtension(r, out, classes);
    1.40 -        } else {
    1.41 -            VM.compileStandalone(r, out, classes);
    1.42 -        }
    1.43 +        VM.compile(out, r, classes, extension);
    1.44      }
    1.45 -    
    1.46 +
    1.47      /** Provider of resources (classes and other files). The 
    1.48       * {@link #generate(java.lang.Appendable, org.apidesign.vm4brwsr.Bck2Brwsr.Resources, java.lang.String[]) 
    1.49       * generator method} will call back here for all classes needed during