Package org.mozilla.javascript
Class Interpreter
java.lang.Object
org.mozilla.javascript.Interpreter
- All Implemented Interfaces:
Evaluator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NativeContinuationvoidCapture stack information from the given exception.compile(CompilerEnvirons compilerEnv, ScriptNode tree, String rawSource, boolean returnFunction) Compile the script or function from intermediate representation tree into an executable form.createFunctionObject(Context cx, Scriptable scope, Object bytecode, Object staticSecurityDomain) Create a function object.createScriptObject(Object bytecode, Object staticSecurityDomain) Create a script object.getPatchedStack(RhinoException ex, String nativeStackTrace) Given a native stack trace, patch it with script-specific source and line informationGet the script stack for the given exceptiongetSourcePositionFromStack(Context cx, int[] linep) Get the source position information by examining the stack.static ObjectrestartContinuation(NativeContinuation c, Context cx, Scriptable scope, Object[] args) static ObjectresumeGenerator(Context cx, Scriptable scope, int operation, Object savedState, Object value) voidsetEvalScriptFlag(Script script) Mark the given script to indicate it was created by a call to eval() or to a Function constructor.
-
Constructor Details
-
Interpreter
public Interpreter()
-
-
Method Details
-
compile
public Object compile(CompilerEnvirons compilerEnv, ScriptNode tree, String rawSource, boolean returnFunction) Description copied from interface:EvaluatorCompile the script or function from intermediate representation tree into an executable form.- Specified by:
compilein interfaceEvaluator- Parameters:
compilerEnv- Compiler environmenttree- parse treerawSource- the source codereturnFunction- if true, compiling a function- Returns:
- an opaque object that can be passed to either createFunctionObject or createScriptObject, depending on the value of returnFunction
-
createScriptObject
Description copied from interface:EvaluatorCreate a script object.- Specified by:
createScriptObjectin interfaceEvaluator- Parameters:
bytecode- opaque object returned by compilestaticSecurityDomain- security domain- Returns:
- Script object that can be evaluated
-
setEvalScriptFlag
Description copied from interface:EvaluatorMark the given script to indicate it was created by a call to eval() or to a Function constructor.- Specified by:
setEvalScriptFlagin interfaceEvaluator- Parameters:
script- script to mark as from eval
-
createFunctionObject
public Function createFunctionObject(Context cx, Scriptable scope, Object bytecode, Object staticSecurityDomain) Description copied from interface:EvaluatorCreate a function object.- Specified by:
createFunctionObjectin interfaceEvaluator- Parameters:
cx- Current contextscope- scope of the functionbytecode- opaque object returned by compilestaticSecurityDomain- security domain- Returns:
- Function object that can be called
-
captureStackInfo
Description copied from interface:EvaluatorCapture stack information from the given exception.- Specified by:
captureStackInfoin interfaceEvaluator- Parameters:
ex- an exception thrown during execution
-
getSourcePositionFromStack
Description copied from interface:EvaluatorGet the source position information by examining the stack.- Specified by:
getSourcePositionFromStackin interfaceEvaluator- Parameters:
cx- Contextlinep- Array object of length >= 1; getSourcePositionFromStack will assign the line number to linep[0].- Returns:
- the name of the file or other source container
-
getPatchedStack
Description copied from interface:EvaluatorGiven a native stack trace, patch it with script-specific source and line information- Specified by:
getPatchedStackin interfaceEvaluator- Parameters:
ex- exceptionnativeStackTrace- the native stack trace- Returns:
- patched stack trace
-
getScriptStack
Description copied from interface:EvaluatorGet the script stack for the given exception- Specified by:
getScriptStackin interfaceEvaluator- Parameters:
ex- exception from execution- Returns:
- list of strings for the stack trace
-
getScriptStackElements
-
resumeGenerator
public static Object resumeGenerator(Context cx, Scriptable scope, int operation, Object savedState, Object value) -
restartContinuation
public static Object restartContinuation(NativeContinuation c, Context cx, Scriptable scope, Object[] args) -
captureContinuation
-