org.erights.e.elang.evm
Class NounExpr

java.lang.Object
  |
  +--org.erights.e.elang.evm.ParseNode
        |
        +--org.erights.e.elang.evm.ENode
              |
              +--org.erights.e.elang.evm.EExpr
                    |
                    +--org.erights.e.elang.evm.AtomicExpr
                          |
                          +--org.erights.e.elang.evm.NounExpr
All Implemented Interfaces:
Cloneable, EPrintable, MatchMaker
Direct Known Subclasses:
FrameFinalNounExpr, FrameSlotNounExpr, LocalFinalNounExpr, LocalSlotNounExpr, SimpleNounExpr, TopNounExpr

public abstract class NounExpr
extends AtomicExpr

Untamed:


Field Summary
private  String myName
           
 
Fields inherited from class org.erights.e.elang.evm.ENode
 
Fields inherited from class org.erights.e.elang.evm.ParseNode
NUM_PR, PR_ASSIGN, PR_CALL, PR_COMP, PR_EEXPR, PR_LISTPATT, PR_ORDER, PR_PATTERN, PR_PRIM, PR_START
 
Constructor Summary
(package private) NounExpr(SourceSpan optSpan, String name)
           
 
Method Summary
 NounExpr asFieldAt(int index)
          Enabled: Return a noun that could access the representation of the receiver if it were at in a frame at the given index.
 NounExpr asNoun()
          Enabled:
 void assign(EvalContext ctx, Object value)
          Enabled: Default implementation of assign in terms of the slot.
protected  StaticScope computeStaticScope()
          When staticScope() is first requested on a given node, it calls computeStaticScope() to do the actual computation, which is then remembered.
 Object getIn(EvalContext ctx)
          Enabled: Get the value in the EvalContext.
 Object getRepresentation(EvalContext ctx)
          Enabled: Return the kind of object that should be stored in a frame, assuming an accessor of the same type as the receiver.
 Slot getSlot(EvalContext ctx)
          Enabled: Return a slot object from the EvalContext for the noun designated by the receiver.
 void initFinal(EvalContext ctx, Object value)
          Enabled: Initialize a final variable's value when it first comes into scope.
 void initSlot(EvalContext ctx, Slot slot)
          Enabled: Initialize a slot variable when it first comes into scope.
 boolean isOuter()
          Enabled:
 boolean matchBind(ConstList args, Object specimen, FlexList bindings)
          Enabled:
abstract  boolean mayBeAssignable()
          Enabled: 'false' only if it's known not to be assignable
 String name()
          Enabled:
protected  Object subEval(EvalContext ctx, boolean forValue)
          Default implementation of noun eval in terms of its slot.
 void subPrintOn(TextWriter out, int priority)
          Enabled:
 Object welcome(ETreeVisitor visitor)
          Enabled:
 
Methods inherited from class org.erights.e.elang.evm.EExpr
__printOn, appendAllTo, appendTo, eval, eval, evalBool, printAsBlockOn, substitute, transform
 
Methods inherited from class org.erights.e.elang.evm.ENode
cleanCopy, copy, getOptPatternMap, getOptScopeMap, getPatternMap, getScopeMap, qbuild, setPatternMap, setScopeMap, staticScope, synEnv
 
Methods inherited from class org.erights.e.elang.evm.ParseNode
asText, getOptSpan, lnPrintOn, lnPrintOn, matchBind, matchBind, matchBind, printListOn, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myName

private final String myName
Constructor Detail

NounExpr

NounExpr(SourceSpan optSpan,
         String name)
Method Detail

mayBeAssignable

public abstract boolean mayBeAssignable()
Enabled: 'false' only if it's known not to be assignable

Specified by:
mayBeAssignable in class AtomicExpr

asNoun

public NounExpr asNoun()
Enabled:

Specified by:
asNoun in class AtomicExpr

isOuter

public boolean isOuter()
Enabled:


welcome

public Object welcome(ETreeVisitor visitor)
Enabled:

Specified by:
welcome in class ENode

computeStaticScope

protected StaticScope computeStaticScope()
Description copied from class: ENode
When staticScope() is first requested on a given node, it calls computeStaticScope() to do the actual computation, which is then remembered.

Specified by:
computeStaticScope in class ENode

subEval

protected Object subEval(EvalContext ctx,
                         boolean forValue)
Default implementation of noun eval in terms of its slot.

Specified by:
subEval in class EExpr

getIn

public Object getIn(EvalContext ctx)
Enabled: Get the value in the EvalContext. TODO should this be public?


matchBind

public boolean matchBind(ConstList args,
                         Object specimen,
                         FlexList bindings)
Enabled:

Specified by:
matchBind in interface MatchMaker
Specified by:
matchBind in class ParseNode

name

public String name()
Enabled:


subPrintOn

public void subPrintOn(TextWriter out,
                       int priority)
                throws IOException
Enabled:

Specified by:
subPrintOn in class ParseNode
IOException

getRepresentation

public Object getRepresentation(EvalContext ctx)
Enabled: Return the kind of object that should be stored in a frame, assuming an accessor of the same type as the receiver. Default implementation of getRespresentation in terms of the slot. Used for transferring the contents of the slot into a frame field from an outer scope.


getSlot

public Slot getSlot(EvalContext ctx)
Enabled: Return a slot object from the EvalContext for the noun designated by the receiver.


asFieldAt

public NounExpr asFieldAt(int index)
Enabled: Return a noun that could access the representation of the receiver if it were at in a frame at the given index. This is used to maintain final/var distinctions as slots are copied into frames.


assign

public void assign(EvalContext ctx,
                   Object value)
Enabled: Default implementation of assign in terms of the slot. Note that this raises the correct exception if the slot is a final slot.


initFinal

public void initFinal(EvalContext ctx,
                      Object value)
Enabled: Initialize a final variable's value when it first comes into scope.


initSlot

public void initSlot(EvalContext ctx,
                     Slot slot)
Enabled: Initialize a slot variable when it first comes into scope.



comments?