Top Description Fields Constructors Methods
org.glassfish.pfl.dynamic.codegen.impl

public Class BlockStatement

extends StatementBase
Class Inheritance
Known Direct Subclasses
org.glassfish.pfl.dynamic.codegen.impl.CaseBranch
Imports
java.util.ArrayList, .HashMap, .List, .Map, org.glassfish.pfl.dynamic.codegen.spi.Expression, .Type, .Variable

Main factory for creating statements. Represents a block of statements which also defines a scope for local variable declarations.
Author
Ken Cavanaugh

Field Summary

Modifier and TypeField and Description
private List<Statement>
private Map<String, DefinitionStatement>
private ExpressionFactory

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
accept(Visitor visitor)

Overrides org.glassfish.pfl.dynamic.codegen.impl.NodeBase.accept.

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.accept.

Accept the visitor and allow it to perform actions on this Node.

public void
public void
addBreak()

Add a break statement to this BlockStatement.

public Expression
addDefinition(Type type, String ident, Expression value)

public void
public IfStatement
public void
addReturn()

Add an empty return to this BlockStatement.

public void
addReturn(Expression expr)

Add a return with an expression to this BlockStatement.

public SwitchStatement
public void
public TryStatement
public WhileStatement
public List<Statement>
body()

Return the list of Statements in this BlockStatement.

private void
public ExpressionFactory
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.

public Variable
getVar(String ident)

Look up the ident to see if it has an associated Variable in this block.

public boolean
isEmpty()

Return true iff this BlockStatement contains no local variables or statements.

Field Detail

bodyback to summary
private List<Statement> body
definitionsback to summary
private Map<String, DefinitionStatement> definitions
efactoryback to summary
private ExpressionFactory efactory

Constructor Detail

BlockStatementback to summary
pack-priv BlockStatement(Node parent)

Method Detail

acceptback to summary
public void accept(Visitor visitor)

Overrides org.glassfish.pfl.dynamic.codegen.impl.NodeBase.accept.

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.accept.

Doc from org.glassfish.pfl.dynamic.codegen.impl.Node.accept.

Accept the visitor and allow it to perform actions on this Node.

Annotations
@Override
addAssignback to summary
public void addAssign(Expression left, Expression right)
addBreakback to summary
public void addBreak()

Add a break statement to this BlockStatement.

addDefinitionback to summary
public Expression addDefinition(Type type, String ident, Expression value)
addExpressionback to summary
public void addExpression(Expression expr)
addIfback to summary
public IfStatement addIf(Expression cond)
addReturnback to summary
public void addReturn()

Add an empty return to this BlockStatement. The enclosing MethodGenerator must have a void return type.

addReturnback to summary
public void addReturn(Expression expr)

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.

addSwitchback to summary
public SwitchStatement addSwitch(Expression value)
addThrowback to summary
public void addThrow(Expression expr)
addTryback to summary
public TryStatement addTry()
addWhileback to summary
public WhileStatement addWhile(Expression expr)
bodyback to summary
public List<Statement> body()

Return the list of Statements in this BlockStatement.

checkSwitchExpressionTypeback to summary
private void checkSwitchExpressionType(Type type)
exprFactoryback to summary
public ExpressionFactory 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.

getVarback to summary
public Variable getVar(String ident)

Look up the ident to see if it has an associated Variable in this block.

isEmptyback to summary
public boolean isEmpty()

Return true iff this BlockStatement contains no local variables or statements.