Constructor and Description |
---|
Codegen() |
Modifier and Type | Method and Description |
---|---|
void |
captureStackInfo(RhinoException ex)
Capture stack information from the given exception.
|
java.lang.Object |
compile(CompilerEnvirons compilerEnv,
ScriptNode tree,
java.lang.String encodedSource,
boolean returnFunction)
Compile the script or function from intermediate representation
tree into an executable form.
|
byte[] |
compileToClassFile(CompilerEnvirons compilerEnv,
java.lang.String mainClassName,
ScriptNode scriptOrFn,
java.lang.String encodedSource,
boolean returnFunction) |
Function |
createFunctionObject(Context cx,
Scriptable scope,
java.lang.Object bytecode,
java.lang.Object staticSecurityDomain)
Create a function object.
|
Script |
createScriptObject(java.lang.Object bytecode,
java.lang.Object staticSecurityDomain)
Create a script object.
|
java.lang.String |
getPatchedStack(RhinoException ex,
java.lang.String nativeStackTrace)
Given a native stack trace, patch it with script-specific source
and line information
|
java.util.List<java.lang.String> |
getScriptStack(RhinoException ex)
Get the script stack for the given exception
|
java.lang.String |
getSourcePositionFromStack(Context cx,
int[] linep)
Get the source position information by examining the stack.
|
void |
setEvalScriptFlag(Script script)
Mark the given script to indicate it was created by a call to
eval() or to a Function constructor.
|
void |
setMainMethodClass(java.lang.String className) |
public void captureStackInfo(RhinoException ex)
Evaluator
captureStackInfo
in interface Evaluator
ex
- an exception thrown during executionpublic java.lang.String getSourcePositionFromStack(Context cx, int[] linep)
Evaluator
getSourcePositionFromStack
in interface Evaluator
cx
- Contextlinep
- Array object of length >= 1; getSourcePositionFromStack
will assign the line number to linep[0].public java.lang.String getPatchedStack(RhinoException ex, java.lang.String nativeStackTrace)
Evaluator
getPatchedStack
in interface Evaluator
ex
- exceptionnativeStackTrace
- the native stack tracepublic java.util.List<java.lang.String> getScriptStack(RhinoException ex)
Evaluator
getScriptStack
in interface Evaluator
ex
- exception from executionpublic void setEvalScriptFlag(Script script)
Evaluator
setEvalScriptFlag
in interface Evaluator
script
- script to mark as from evalpublic java.lang.Object compile(CompilerEnvirons compilerEnv, ScriptNode tree, java.lang.String encodedSource, boolean returnFunction)
Evaluator
compile
in interface Evaluator
compilerEnv
- Compiler environmenttree
- parse treeencodedSource
- encoding of the source code for decompilationreturnFunction
- if true, compiling a functionpublic Script createScriptObject(java.lang.Object bytecode, java.lang.Object staticSecurityDomain)
Evaluator
createScriptObject
in interface Evaluator
bytecode
- opaque object returned by compilestaticSecurityDomain
- security domainpublic Function createFunctionObject(Context cx, Scriptable scope, java.lang.Object bytecode, java.lang.Object staticSecurityDomain)
Evaluator
createFunctionObject
in interface Evaluator
cx
- Current contextscope
- scope of the functionbytecode
- opaque object returned by compilestaticSecurityDomain
- security domainpublic byte[] compileToClassFile(CompilerEnvirons compilerEnv, java.lang.String mainClassName, ScriptNode scriptOrFn, java.lang.String encodedSource, boolean returnFunction)
public void setMainMethodClass(java.lang.String className)