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.
- Author:
- Ken Cavanaugh
-
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.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.booleanisEmpty()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, toStringMethods inherited from class org.glassfish.pfl.dynamic.codegen.impl.AttributedObjectBase
attributes, get, setMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.glassfish.pfl.dynamic.codegen.impl.AttributedObject
attributes, get, set
-
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
-
addSwitch
-
addWhile
-
addExpression
-
addAssign
-
addDefinition
-
accept
Description copied from interface:NodeAccept the visitor and allow it to perform actions on this Node.
-