oscript.compiler
Class CompiledInnerNodeEvaluator

java.lang.Object
  extended byoscript.NodeEvaluator
      extended byoscript.compiler.CompiledInnerNodeEvaluator

public class CompiledInnerNodeEvaluator
extends NodeEvaluator

In an effort to generate fewer classes, and improve startup performance, functions within the file/function node that is passed to the compiler generate additional evalNodeX methods within the same class that is generated for the parent. But since we still need individual NodeEvaluators for each function, this class acts as a lightweight wrapper object which forwards the evalNode(oscript.util.StackFrame, oscript.data.Scope) method to the appropriate CompiledNodeEvaluator.evalInnerNode(int, oscript.util.StackFrame, oscript.data.Scope)

Version:
1
Author:
Rob Clark (rob@ti.com)

Field Summary
 
Fields inherited from class oscript.NodeEvaluator
ALL, PRIVATE, PUBPROT, SMIT_PERMS
 
Constructor Summary
CompiledInnerNodeEvaluator(int id, int idx, CompiledNodeEvaluator cne)
          Class Constructor.
 
Method Summary
 java.lang.Object evalNode(StackFrame sf, Scope scope)
          Evaluate, in the specified scope.
 AbstractFile getFile()
          Get the file that this node was parsed from.
 int getId()
          Get the function symbol (name), if this node evaluator is a function, otherwise return -1.
 SymbolTable getSharedMemberIndexTable(int perm)
          Get the SMIT for the scope(s) created when invoking this node evaluator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompiledInnerNodeEvaluator

public CompiledInnerNodeEvaluator(int id,
                                  int idx,
                                  CompiledNodeEvaluator cne)
Class Constructor.

Parameters:
id - the function name symbol id
idx - the index to pass back to CompiledNodeEvaluator.evalInnerNode(int, oscript.util.StackFrame, oscript.data.Scope)
cne - the compiled node which contains the compiled code
Method Detail

getFile

public AbstractFile getFile()
Get the file that this node was parsed from.

Specified by:
getFile in class NodeEvaluator
Returns:
the file

getId

public int getId()
Get the function symbol (name), if this node evaluator is a function, otherwise return -1.

Specified by:
getId in class NodeEvaluator
Returns:
the symbol, or -1

evalNode

public java.lang.Object evalNode(StackFrame sf,
                                 Scope scope)
                          throws PackagedScriptObjectException
Evaluate, in the specified scope. If this is a function, the Arguments to the function, etc., are defined in the scope that the function is evaluated in.

Specified by:
evalNode in class NodeEvaluator
Parameters:
sf - the stack frame to evaluate the node in
scope - the scope to evaluate the function in
Returns:
the result of evaluating the function
Throws:
PackagedScriptObjectException

getSharedMemberIndexTable

public SymbolTable getSharedMemberIndexTable(int perm)
Get the SMIT for the scope(s) created when invoking this node evaluator.

Specified by:
getSharedMemberIndexTable in class NodeEvaluator
Parameters:
perm - PRIVATE, PUBPROT, ALL