public Global(CompilerCommand args, boolean interpret) { assert Debug.initialize() || true; if (Global.instance != null)  Debug.abort("duplicate creation of Global"); Global.instance = this; this.args = args; this.reporter = args.reporter(); this.start(); this.noimports = args.noimports.value; this.nopredefs = args.nopredefs.value;  this.debug = args.debug.value; this.debuginfo = args.debuginfo.value; this.uniqid = args.uniqid.value; this.newMatch = args.Xnewmatch.value; this.xmlPreserveWS = args.XpreserveWS.value; this.runTimeTypes = args.XrunTimeTypes.value; this.explaintypes = args.explaintypes.value; this.printtypes = args.types.value; this.printtokens = args.print.tokens; this.classPath = args.classpath(); if (reporter.verbose) reporter.inform("classpath = " + classPath); this.outpath = args.outpath(); String encoding = args.encoding.value; Charset charset = null; try { charset = Charset.forName(encoding); } catch (IllegalCharsetNameException exception) { args.encoding.error("illegal charset name '" + encoding + "'"); } catch (UnsupportedCharsetException exception) { args.encoding.error("unsupported charset '" + encoding + "'"); } if (charset == null) { encoding = "ISO-8859-1"; charset = Charset.forName(encoding); } this.encoding = encoding; this.charset = charset; this.decoder = charset.newDecoder(); this.reader = new SourceReader(decoder); this.target = interpret ? TARGET_INT : args.target.value.intern(); this.separate = args.separate.value.equals("yes") || args.separate.value.equals("default") && !this.target.equals(TARGET_INT); String printFile = args.printfile.value; OutputStream stream; try { stream = "-".equals(printFile) ? System.out : new FileOutputStream(printFile); } catch (FileNotFoundException e) { error("unable to open file " + printFile + ". Printing on console"); stream = System.out; } this.writer = new PrintWriter(stream, debug); if (args.printer.value.equals(PRINTER_HTML)) { this.treePrinter = newHTMLTreePrinter(writer); } else if (args.printer.value.equals(PRINTER_SWING)) { this.treePrinter = newSwingTreePrinter(writer); } else { if (!args.printer.value.equals(PRINTER_TEXT)) error("unknown printer kind: " +  args.printer.value); this.treePrinter = newTextTreePrinter(writer); } this.make = new DefaultTreeFactory(); this.PHASE = args.phases; args.phases.WHOLEPROG.addSkipFlag();   if (!runTimeTypes) args.phases.TYPESASVALUES.addSkipFlag(); if (target != TARGET_JVMFROMICODE) args.phases.ICODE.addSkipFlag(); PHASE.freeze(); PhaseDescriptor[] descriptors = PHASE.phases(); for (int i = 0; i <= PHASE.ANALYZER.id(); i++) if (!descriptors[i].hasSkipFlag()) descriptors[i].create(this); this.treeGen = ((AnalyzerPhase)PHASE.ANALYZER.phase()).gen; this.primitives = new Primitives(this); assert !descriptors[0].hasSkipFlag(); for (int i = PHASE.ANALYZER.id() + 1; i < descriptors.length; i++) if (!descriptors[i].hasSkipFlag()) descriptors[i].create(this); this.currentPhase = PHASE.INITIAL.phase();
public Global(CompilerCommand args) { this(args, false);
    public Global(CompilerCommand args, boolean interpret) {        assert Debug.initialize() || true;        if (Global.instance != null) // jaco bug: can't use assert here            /* throw */ Debug.abort("duplicate creation of Global");        Global.instance = this;        this.args = args;        this.reporter = args.reporter();        this.start(); // timestamp to compute the total time        this.noimports = args.noimports.value;        this.nopredefs = args.nopredefs.value;        //this.optimize = args.optimize.optimize;        this.debug = args.debug.value;        this.debuginfo = args.debuginfo.value;        this.uniqid = args.uniqid.value;        this.newMatch = args.Xnewmatch.value;        this.xmlPreserveWS = args.XpreserveWS.value;        this.runTimeTypes = args.XrunTimeTypes.value;        this.explaintypes = args.explaintypes.value;        this.printtypes = args.types.value;        this.printtokens = args.print.tokens;        this.classPath = args.classpath();	if (reporter.verbose) reporter.inform("classpath = " + classPath);        this.outpath = args.outpath();        String encoding = args.encoding.value;        Charset charset = null;        try {            charset = Charset.forName(encoding);        } catch (IllegalCharsetNameException exception) {            args.encoding.error("illegal charset name '" + encoding + "'");        } catch (UnsupportedCharsetException exception) {            args.encoding.error("unsupported charset '" + encoding + "'");        }        if (charset == null) {            encoding = "ISO-8859-1"; // A mandatory charset            charset = Charset.forName(encoding);        }        this.encoding = encoding;        this.charset = charset;        this.decoder = charset.newDecoder();        this.reader = new SourceReader(decoder);        this.target = interpret ? TARGET_INT : args.target.value.intern();        this.separate = args.separate.value.equals("yes") ||            args.separate.value.equals("default") && !this.target.equals(TARGET_INT);        String printFile = args.printfile.value;        OutputStream stream;        try {            stream = "-".equals(printFile)                ? System.out                : new FileOutputStream(printFile);        } catch (FileNotFoundException e) {            error("unable to open file " + printFile + ". Printing on console");            stream = System.out;        }        this.writer = new PrintWriter(stream, debug);        if (args.printer.value.equals(PRINTER_HTML)) {            this.treePrinter = newHTMLTreePrinter(writer);	} else if (args.printer.value.equals(PRINTER_SWING)) {	    this.treePrinter = newSwingTreePrinter(writer);	} else {            if (!args.printer.value.equals(PRINTER_TEXT))                error("unknown printer kind: " +  args.printer.value);            this.treePrinter = newTextTreePrinter(writer);        }        this.make = new DefaultTreeFactory();        this.PHASE = args.phases;        args.phases.WHOLEPROG.addSkipFlag(); // !!!        // if (!optimize) PHASE.remove(args.phases.OPTIMIZE);        // TODO: Enable TailCall for other backends when they handle LabelDefs        if (!runTimeTypes) args.phases.TYPESASVALUES.addSkipFlag();	if (target != TARGET_JVMFROMICODE) args.phases.ICODE.addSkipFlag();        PHASE.freeze();        PhaseDescriptor[] descriptors = PHASE.phases();        for (int i = 0; i <= PHASE.ANALYZER.id(); i++)            if (!descriptors[i].hasSkipFlag()) descriptors[i].create(this);        this.treeGen = ((AnalyzerPhase)PHASE.ANALYZER.phase()).gen;        this.primitives = new Primitives(this);        assert !descriptors[0].hasSkipFlag();        for (int i = PHASE.ANALYZER.id() + 1; i < descriptors.length; i++)            if (!descriptors[i].hasSkipFlag()) descriptors[i].create(this);        this.currentPhase = PHASE.INITIAL.phase();    }