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 TypeMethodDescriptionvoid
Accept the visitor and allow it to perform actions on this Node.void
addAssign
(Expression left, Expression right) void
addBreak()
Add a break statement to this BlockStatement.addDefinition
(Type type, String ident, Expression value) void
addExpression
(Expression expr) addIf
(Expression cond) void
Add an empty return to this BlockStatement.void
addReturn
(Expression expr) Add a return with an expression to this BlockStatement.addSwitch
(Expression value) void
addThrow
(Expression expr) addTry()
addWhile
(Expression expr) body()
Return the list of Statements in this BlockStatement.private void
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.Look up the ident to see if it has an associated Variable in this block.boolean
isEmpty()
Return true iff this BlockStatement contains no local variables or statements.Methods inherited from class org.glassfish.pfl.dynamic.codegen.impl.NodeBase
copy, copy, getAncestor, id, parent, parent, postCopy, preCopy, toString
Methods inherited from class org.glassfish.pfl.dynamic.codegen.impl.AttributedObjectBase
attributes, get, set
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.glassfish.pfl.dynamic.codegen.impl.AttributedObject
attributes, get, set
-
Field Details
-
body
-
efactory
-
definitions
-
-
Constructor Details
-
BlockStatement
BlockStatement(Node parent)
-
-
Method Details
-
getVar
Look up the ident to see if it has an associated Variable in this block. -
isEmpty
public boolean isEmpty()Return true iff this BlockStatement contains no local variables or statements. -
body
Return the list of Statements in this BlockStatement. -
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
Description copied from interface:Node
Accept the visitor and allow it to perform actions on this Node.
-