public static final class AuxiliaryContractBuilders.ValidityProgramConstructor
extends java.lang.Object
block' from block (see Wacker 2012, 3.3).construct()| Modifier and Type | Field and Description |
|---|---|
private AuxiliaryContract.Variables |
alreadyDeclared
The subset of variables that have already been declared.
|
private StatementBlock |
block |
private ProgramVariable |
exceptionParameter
The exception variable.
|
private java.lang.Iterable<Label> |
labels |
private Services |
services
Services.
|
private java.util.List<Statement> |
statements
Statements in the program.
|
private AuxiliaryContract.Variables |
variables |
| Constructor and Description |
|---|
ValidityProgramConstructor(java.lang.Iterable<Label> labels,
StatementBlock block,
AuxiliaryContract.Variables variables,
ProgramVariable exceptionParameter,
Services services) |
ValidityProgramConstructor(java.lang.Iterable<Label> labels,
StatementBlock block,
AuxiliaryContract.Variables variables,
ProgramVariable exceptionParameter,
Services services,
AuxiliaryContract.Variables alreadyDeclared) |
| Modifier and Type | Method and Description |
|---|---|
StatementBlock |
construct() |
private void |
declareExceptionNull()
Adds a statement that declares the exception variable if necessary and set its value to
null. |
private void |
declareFlagsFalse()
Adds statements to declare all flags that have not yet been declared and set their values
to false.
|
private void |
declareResultDefault()
Adds a statement that declares the result variable if necessary and set its value to the
default for its type.
|
private void |
executeBlockSafely()
Makes sure that the block never terminates abruptly.
|
private Statement |
label(StatementBlock block,
java.lang.Iterable<Label> labels) |
private boolean |
occursReturnAndIsReturnTypeNotVoid() |
private StatementBlock |
replaceOuterBreaksContinuesAndReturns(StatementBlock block,
Label breakOutLabel) |
private Statement |
wrapInTryCatch(Statement labeledBlock,
ProgramVariable exceptionParameter) |
private final java.lang.Iterable<Label> labels
AuxiliaryContract.getLabels()private final StatementBlock block
AuxiliaryContract.getBlock()private final AuxiliaryContract.Variables variables
AuxiliaryContract.getVariables()private final AuxiliaryContract.Variables alreadyDeclared
private final Services services
private final java.util.List<Statement> statements
private final ProgramVariable exceptionParameter
public ValidityProgramConstructor(java.lang.Iterable<Label> labels, StatementBlock block, AuxiliaryContract.Variables variables, ProgramVariable exceptionParameter, Services services)
labels - all labels belonging to the block.block - the block.variables - the variables.exceptionParameter - the exception variable.services - services.public ValidityProgramConstructor(java.lang.Iterable<Label> labels, StatementBlock block, AuxiliaryContract.Variables variables, ProgramVariable exceptionParameter, Services services, AuxiliaryContract.Variables alreadyDeclared)
labels - all labels belonging to the block.block - the block.variables - the variables.exceptionParameter - the exception variable.services - services.alreadyDeclared - the subset of variables that have already been declared.public StatementBlock construct()
private void declareFlagsFalse()
private void declareResultDefault()
private boolean occursReturnAndIsReturnTypeNotVoid()
true iff there is a result.private void declareExceptionNull()
null.private void executeBlockSafely()
private Statement label(StatementBlock block, java.lang.Iterable<Label> labels)
block - a block.labels - labels that should be added to the block.private StatementBlock replaceOuterBreaksContinuesAndReturns(StatementBlock block, Label breakOutLabel)
block - a block.breakOutLabel - a label belonging to the block.OuterBreakContinueAndReturnReplacerprivate Statement wrapInTryCatch(Statement labeledBlock, ProgramVariable exceptionParameter)
labeledBlock - the labeled block.exceptionParameter - the exception variable.