jif.visit
Class LabelChecker

java.lang.Object
  extended by jif.visit.LabelChecker
All Implemented Interfaces:
java.lang.Cloneable, polyglot.util.Copy

public class LabelChecker
extends java.lang.Object
implements polyglot.util.Copy

The LabelChecker class is used in the label checking of Jif. Primarily it provides the method labelCheck(Node) which invokes the labelCheck method on nodes, utility functions to help in the implementation of the labelCheck methods, as well as references to the appropriate Solver and JifContext.

LabelChecker is mostly imperative; however, the JifContext is treated functionally, and whenever a LabelChecker is given a new JifContext, a new LabelChecker is created.


Constructor Summary
LabelChecker(polyglot.frontend.Job job, polyglot.types.TypeSystem ts, polyglot.ast.NodeFactory nf, boolean solvePerClassBody, boolean solvePerMethod)
           
LabelChecker(polyglot.frontend.Job job, polyglot.types.TypeSystem ts, polyglot.ast.NodeFactory nf, boolean solvePerClassBody, boolean solvePerMethod, boolean doLabelSubst)
           
 
Method Summary
 void constrain(LabelConstraint c)
           
 JifContext context()
           
 LabelChecker context(JifContext c)
           
 java.lang.Object copy()
           
 void enteringClassBody(polyglot.types.ClassType ct)
          Called by JifClassDeclExt just before this label checker is used to check a class body.
 void enteringMethod(polyglot.types.MethodInstance mi)
          Called by JifMethodDeclExt just before this label checker is used to check a method body.
 polyglot.util.ErrorQueue errorQueue()
           
 polyglot.ast.Node finishedLabelCheckPass(polyglot.ast.Node n)
          This method should be called on the top level label checker once the label checking has finished.
 JifContext jifContext()
           
 JifTypeSystem jifTypeSystem()
           
 polyglot.frontend.Job job()
           
 polyglot.ast.Node labelCheck(polyglot.ast.Node n)
           
 JifClassDecl leavingClassBody(JifClassDecl n)
          Called by JifClassDeclExt just after this label checker has been used to check a class body.
 JifMethodDecl leavingMethod(JifMethodDecl n)
          Called by JifClassDeclExt just after this label checker has been used to check a class body.
 Label lowerBound(Label L1, Label L2)
          Returns a lower bound for L1 and L2
 polyglot.ast.NodeFactory nodeFactory()
           
 void reportSemanticException(polyglot.types.SemanticException e)
           
 Solver solver()
           
 JifTypeSystem typeSystem()
           
 Label upperBound(Label L1, Label L2)
          Returns an upper bound for L1 and L2
 Label upperBound(Label L1, Label L2, Label L3)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabelChecker

public LabelChecker(polyglot.frontend.Job job,
                    polyglot.types.TypeSystem ts,
                    polyglot.ast.NodeFactory nf,
                    boolean solvePerClassBody,
                    boolean solvePerMethod)

LabelChecker

public LabelChecker(polyglot.frontend.Job job,
                    polyglot.types.TypeSystem ts,
                    polyglot.ast.NodeFactory nf,
                    boolean solvePerClassBody,
                    boolean solvePerMethod,
                    boolean doLabelSubst)
Method Detail

copy

public java.lang.Object copy()
Specified by:
copy in interface polyglot.util.Copy

context

public JifContext context()

jifContext

public JifContext jifContext()

context

public LabelChecker context(JifContext c)

typeSystem

public JifTypeSystem typeSystem()

jifTypeSystem

public JifTypeSystem jifTypeSystem()

nodeFactory

public polyglot.ast.NodeFactory nodeFactory()

solver

public Solver solver()

job

public polyglot.frontend.Job job()

errorQueue

public polyglot.util.ErrorQueue errorQueue()

upperBound

public Label upperBound(Label L1,
                        Label L2)
Returns an upper bound for L1 and L2


upperBound

public Label upperBound(Label L1,
                        Label L2,
                        Label L3)

lowerBound

public Label lowerBound(Label L1,
                        Label L2)
Returns a lower bound for L1 and L2


labelCheck

public polyglot.ast.Node labelCheck(polyglot.ast.Node n)
                             throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

constrain

public void constrain(LabelConstraint c)
               throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

enteringClassBody

public void enteringClassBody(polyglot.types.ClassType ct)
Called by JifClassDeclExt just before this label checker is used to check a class body. This allows us to use a different solver if required.


enteringMethod

public void enteringMethod(polyglot.types.MethodInstance mi)
Called by JifMethodDeclExt just before this label checker is used to check a method body. This allows us to use a different solver if required.


leavingClassBody

public JifClassDecl leavingClassBody(JifClassDecl n)
Called by JifClassDeclExt just after this label checker has been used to check a class body. This allows us to use a different solver if required.


leavingMethod

public JifMethodDecl leavingMethod(JifMethodDecl n)
Called by JifClassDeclExt just after this label checker has been used to check a class body. This allows us to use a different solver if required.


finishedLabelCheckPass

public polyglot.ast.Node finishedLabelCheckPass(polyglot.ast.Node n)
This method should be called on the top level label checker once the label checking has finished. This will perform label substitution if required.


reportSemanticException

public void reportSemanticException(polyglot.types.SemanticException e)