1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/ClosureWrapper.java Tue Mar 12 13:54:26 2013 +0100
1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/ClosureWrapper.java Wed Mar 13 16:17:47 2013 +0100
1.3 @@ -37,9 +37,10 @@
1.4 private String code;
1.5 private final Bck2Brwsr.Resources res;
1.6 private final StringArray classes;
1.7 - private ClosureWrapper(Appendable out, Bck2Brwsr.Resources res, StringArray classes) {
1.8 + private ClosureWrapper(Appendable out, ObfuscationLevel obfuscationLevel,
1.9 + Bck2Brwsr.Resources res, StringArray classes) {
1.10 super(
1.11 - ARGS,
1.12 + generateArguments(obfuscationLevel),
1.13 new PrintStream(new APS(out)), System.err
1.14 );
1.15 this.res = res;
1.16 @@ -67,7 +68,7 @@
1.17 }
1.18 return code;
1.19 }
1.20 -
1.21 +
1.22 private static final class APS extends OutputStream {
1.23 private final Appendable out;
1.24
1.25 @@ -79,8 +80,18 @@
1.26 out.append((char)b);
1.27 }
1.28 }
1.29 - static int produceTo(Appendable w, Bck2Brwsr.Resources resources, StringArray arr) throws IOException {
1.30 - ClosureWrapper cw = new ClosureWrapper(w, resources, arr);
1.31 +
1.32 + private static String[] generateArguments(
1.33 + ObfuscationLevel obfuscationLevel) {
1.34 + String[] finalArgs = ARGS.clone();
1.35 + finalArgs[1] = obfuscationLevel.toString();
1.36 +
1.37 + return finalArgs;
1.38 + }
1.39 +
1.40 + static int produceTo(Appendable w, ObfuscationLevel obfuscationLevel, Bck2Brwsr.Resources resources, StringArray arr) throws IOException {
1.41 + ClosureWrapper cw = new ClosureWrapper(w, obfuscationLevel, resources,
1.42 + arr);
1.43 try {
1.44 return cw.doRun();
1.45 } catch (FlagUsageException ex) {