Search in sources :

Example 1 with CodeSizeException

use of com.github.anba.es6draft.compiler.analyzer.CodeSizeException in project es6draft by anba.

the class Compiler method compile.

private CompiledFunction compile(FunctionNode function, String className) {
    Script script = functionScript(function);
    if (!isEnabled(Compiler.Option.NoByteCodeSizeValidation)) {
        try {
            CodeSize.analyze(function);
        } catch (CodeSizeException e) {
            throw new CompilationException(e.getMessage());
        }
    }
    Code code = new Code(Modifier.PUBLIC | Modifier.FINAL, className, ClassSignature.NONE, Types.CompiledFunction, Collections.<Type>emptyList(), NodeSourceInfo.create(function, compilerOptions));
    CodeGenerator codegen = new CodeGenerator(code, script, executor, compilerOptions);
    codegen.compileFunction(function);
    return defineAndLoad(code, className);
}
Also used : Script(com.github.anba.es6draft.ast.Script) CodeSizeException(com.github.anba.es6draft.compiler.analyzer.CodeSizeException) ClassCode(com.github.anba.es6draft.compiler.assembler.Code.ClassCode) Code(com.github.anba.es6draft.compiler.assembler.Code)

Aggregations

Script (com.github.anba.es6draft.ast.Script)1 CodeSizeException (com.github.anba.es6draft.compiler.analyzer.CodeSizeException)1 Code (com.github.anba.es6draft.compiler.assembler.Code)1 ClassCode (com.github.anba.es6draft.compiler.assembler.Code.ClassCode)1