jltools.ext.jl.ast
Class Case_c
java.lang.Object
|
+--jltools.ext.jl.ast.Node_c
|
+--jltools.ext.jl.ast.Stmt_c
|
+--jltools.ext.jl.ast.Case_c
- All Implemented Interfaces:
- Case, java.lang.Cloneable, Copy, Node, java.io.Serializable, Stmt, SwitchElement
- public class Case_c
- extends Stmt_c
- implements Case
A Case
is a representation of a Java case
statement. It can only be contained in a Switch
.
- See Also:
- Serialized Form
Methods inherited from class jltools.ext.jl.ast.Node_c |
buildTypes_, buildTypes, buildTypesOverride_, buildTypesOverride, copy, disambiguate_, disambiguate, disambiguateOverride_, disambiguateOverride, disambiguateTypes_, disambiguateTypes, disambiguateTypesOverride_, disambiguateTypesOverride, dump, enterScope, exceptionCheck_, exceptionCheck, exceptionCheckOverride_, exceptionCheckOverride, ext, ext, foldConstants_, foldConstants, foldConstantsOverride_, foldConstantsOverride, leaveScope, position, position, reconstructTypes_, reconstructTypes, translate, translateBlock, translateSubstmt, typeCheck, typeCheckOverride_, typeCheckOverride, visit, visitList |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface jltools.ast.Node |
buildTypes_, buildTypesOverride_, copy, disambiguate_, disambiguateOverride_, disambiguateTypes_, disambiguateTypesOverride_, dump, enterScope, exceptionCheck_, exceptionCheckOverride_, ext, ext, foldConstants_, foldConstantsOverride_, leaveScope, position, position, reconstructTypes_, typeCheckOverride_, visit |
expr
protected Expr expr
value
protected long value
Case_c
public Case_c(Ext ext,
Position pos,
Expr expr)
isDefault
public boolean isDefault()
- Returns true iff this is the default case.
- Specified by:
isDefault
in interface Case
expr
public Expr expr()
- Get the case label. This must should a constant expression.
The case label is null for the
default
case.
- Specified by:
expr
in interface Case
expr
public Case expr(Expr expr)
- Set the case label. This must should a constant expression, or null.
- Specified by:
expr
in interface Case
value
public long value()
- Returns the value of the case label. This value is only valid
after type-checking.
- Specified by:
value
in interface Case
value
protected Case value(long value)
- Set the value of the case label.
reconstruct
protected Case_c reconstruct(Expr expr)
- Reconstruct the statement.
visitChildren
public Node visitChildren(NodeVisitor v)
- Visit the children of the statement.
- Specified by:
visitChildren
in interface Node
- Overrides:
visitChildren
in class Node_c
typeCheck_
public Node typeCheck_(TypeChecker tc)
throws SemanticException
- Type check the statement.
- Specified by:
typeCheck_
in interface Node
- Overrides:
typeCheck_
in class Node_c
toString
public java.lang.String toString()
- Overrides:
toString
in class Node_c
translate_
public void translate_(CodeWriter w,
Translator tr)
- Write the statement to an output file.
- Specified by:
translate_
in interface Node
- Overrides:
translate_
in class Node_c
- Following copied from interface:
jltools.ast.Node
- Parameters:
w
- The code writer to which to write.tr
- The translation pass. This is not a visitor.