Class BlockStatement
java.lang.Object
org.glassfish.pfl.dynamic.codegen.impl.AttributedObjectBase
org.glassfish.pfl.dynamic.codegen.impl.NodeBase
org.glassfish.pfl.dynamic.codegen.impl.StatementBase
org.glassfish.pfl.dynamic.codegen.impl.BlockStatement
- All Implemented Interfaces:
AttributedObject, Node, Statement, CopyInterceptor
- Direct Known Subclasses:
CaseBranch
Main factory for creating statements. Represents a block
of statements which also defines a scope for local variable
declarations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Map<String, DefinitionStatement> private ExpressionFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAccept the visitor and allow it to perform actions on this Node.voidaddAssign(Expression left, Expression right) voidaddBreak()Add a break statement to this BlockStatement.addDefinition(Type type, String ident, Expression value) voidaddExpression(Expression expr) addIf(Expression cond) voidAdd an empty return to this BlockStatement.voidaddReturn(Expression expr) Add a return with an expression to this BlockStatement.addSwitch(Expression value) voidaddThrow(Expression expr) addTry()addWhile(Expression expr) body()Return the list of Statements in this BlockStatement.private voidReturn the ExpressionFactory that must be used to create any expressions occuring either in expressions added to the body, or in other statements immediately contained in this BlockStatement.Look up the ident to see if it has an associated Variable in this block.booleanisEmpty()Return true iff this BlockStatement contains no local variables or statements.Methods inherited from class NodeBase
copy, copy, getAncestor, id, parent, parent, postCopy, preCopy, toStringMethods inherited from class AttributedObjectBase
attributes, get, setMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface AttributedObject
attributes, get, set
-
Field Details
-
body
-
efactory
-
definitions
-
-
Constructor Details
-
BlockStatement
BlockStatement(Node parent)
-
-
Method Details
-
getVar
-
isEmpty
public boolean isEmpty()Return true iff this BlockStatement contains no local variables or statements. -
body
-
exprFactory
Return the ExpressionFactory that must be used to create any expressions occuring either in expressions added to the body, or in other statements immediately contained in this BlockStatement. -
addBreak
public void addBreak()Add a break statement to this BlockStatement. -
addReturn
public void addReturn()Add an empty return to this BlockStatement. The enclosing MethodGenerator must have a void return type. -
addReturn
Add a return with an expression to this BlockStatement. The enclosing MethodGenerator must have a return type that is assignment compatible with the type of expr. -
addIf
-
addTry
-
addThrow
-
checkSwitchExpressionType
-
addSwitch
-
addWhile
-
addExpression
-
addAssign
-
addDefinition
-
accept
-