jif.types
Class LabelSubstitution

java.lang.Object
  extended by jif.types.LabelSubstitution
Direct Known Subclasses:
JifFieldDeclExt_c.InvarianceLabelChecker, JifFieldDeclExt_c.StaticFieldLabelChecker, JifSubst_c.SubstLabelSubst, JifTypeNodeDel.StaticLabelChecker

public abstract class LabelSubstitution
extends java.lang.Object

The class is a simple Label visitor. It can be used to substitute and check labels and principals. All labels and principals implement a method subst(LabelSubstitution).

In addition, the LabelSubstitution keeps a stack of labels, to record which labels it is in the middle of processing. Labels that recurse on nested labels must push themselves onto the stack before the recursive call, and pop themselves off the stack after the recursive call. Prior to pushing themselves on the stack, labels should examine the stack to see if they already exist in the stack; if so, then the label should not make a recursive call, in order to avoid an infinite loop.

See Also:
Label.subst(LabelSubstitution)

Constructor Summary
LabelSubstitution()
           
 
Method Summary
 void popLabel(Label l)
           
 void pushLabel(Label l)
           
 boolean stackContains(Label l)
           
 Label substLabel(Label L)
           
 Principal substPrincipal(Principal p)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabelSubstitution

public LabelSubstitution()
Method Detail

substLabel

public Label substLabel(Label L)
                 throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

substPrincipal

public Principal substPrincipal(Principal p)
                         throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

pushLabel

public void pushLabel(Label l)

popLabel

public void popLabel(Label l)

stackContains

public boolean stackContains(Label l)