Examples of CompilerEnvirons


Examples of org.mozilla.javascript.CompilerEnvirons

    public void tearDown() {
        Context.exit();
    }

    private AstRoot parse(CharSequence cs) {
        CompilerEnvirons compilerEnv = new CompilerEnvirons();
        compilerEnv.initFromContext(cx);
        ErrorReporter compilationErrorReporter = compilerEnv.getErrorReporter();
        Parser p = new Parser(compilerEnv, compilationErrorReporter);
        return p.parse(cs.toString(), "<eval>", 1);
    }
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

    public void tearDown() {
        Context.exit();
    }

    private AstRoot parse(CharSequence cs) {
        CompilerEnvirons compilerEnv = new CompilerEnvirons();
        compilerEnv.initFromContext(cx);
        ErrorReporter compilationErrorReporter = compilerEnv.getErrorReporter();
        Parser p = new Parser(compilerEnv, compilationErrorReporter);
        return p.parse(cs.toString(), "<eval>", 1);
    }
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

    private CompilerEnvirons createEnvironment()
    {
        // Since this is only used in our own project, we hard-code these. A "real" plugin would
        // have them all configurable
        CompilerEnvirons env = new CompilerEnvirons();
        env.setLanguageVersion(Context.VERSION_1_8);
        env.setGenerateDebugInfo(debugInfo);
        env.setOptimizationLevel(optimizationLevel);
        env.setGeneratingSource(generateSource);
        env.setRecordingComments(false);
        env.setRecoverFromErrors(false);
        env.setGenerateObserverCount(generateObserverCount);
        return env;
    }
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

        throws MojoExecutionException, MojoFailureException
    {
        Log log = getLog();
        File baseDir = new File(directory);
        if (baseDir.exists() && baseDir.isDirectory()) {
            CompilerEnvirons env = createEnvironment();
            ClassCompiler compiler = new ClassCompiler(env);
            File targetDirFile = new File(targetPath);

            DirectoryScanner scanner = new DirectoryScanner();
            scanner.setBasedir(baseDir);
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

    private final Object lock0 = new Object();

    public CacheManager(CompilerEnvirons compilerEnv) {
        if (compilerEnv == null) {
            compilerEnv = new CompilerEnvirons();
            compilerEnv.setErrorReporter(new ToolErrorReporter(true));
        }
        this.compiler = new ClassCompiler(compilerEnv);
    }
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

  {
    Class<?> clazz = classCache.get(script);
    if (clazz == null)
    {
      String name = "script" + count++;
      CompilerEnvirons env = new CompilerEnvirons();
      env.setOptimizationLevel(0);
      ClassCompiler classCompiler = new ClassCompiler(env);
      Object[] ret = classCompiler.compileToClassFiles(script, name + ".js", 1, name);
      codeCache.put(name, (byte[])ret[1]);
      classCache.put(name, clazz = cl.loadClass(name));
    }
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

      /* initialize JavaScript context */
      Context cx = Context.enter();

      /* create a new parser */
      Parser rhinoParser = new Parser(new CompilerEnvirons(), cx.getErrorReporter());

      /* parse some script and save it in AST */
      ast = rhinoParser.parse(new String(input), scopename, 0);

      modifier.setScopeName(scopename);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.