final TypeDefinition typeDefinition = type.getUserData(Keys.TYPE_DEFINITION); final boolean canMoveVariableIntoSubBlocks = findDeclarationPoint( typeDefinition, allowPassIntoLoops, final boolean canStillMoveIntoSubBlocks = findDeclarationPoint( typeDefinition, allowPassIntoLoops,
final TypeDefinition typeDefinition = type.getUserData(Keys.TYPE_DEFINITION); final boolean canMoveVariableIntoSubBlocks = findDeclarationPoint( typeDefinition, allowPassIntoLoops, final boolean canStillMoveIntoSubBlocks = findDeclarationPoint( typeDefinition, allowPassIntoLoops,
final TypeDefinition typeDefinition = type.getUserData(Keys.TYPE_DEFINITION); final boolean canMoveVariableIntoSubBlocks = findDeclarationPoint( typeDefinition, allowPassIntoLoops, final boolean canStillMoveIntoSubBlocks = findDeclarationPoint( typeDefinition, allowPassIntoLoops,
static boolean findDeclarationPoint( final TypeReference localType, final boolean allowPassIntoLoops, final BlockStatement block, final StrongBox<Statement> declarationPoint, final Statement skipUpThrough) { declarationPoint.set(null); Statement waitFor = skipUpThrough; for (final Statement statement : block.getStatements()) { if (waitFor != null) { if (statement == waitFor) { waitFor = null; } continue; } if (referencesType(statement, localType)) { if (declarationPoint.get() != null) { return false; } declarationPoint.set(statement); if (!canMoveLocalTypeIntoSubBlock(statement, localType, allowPassIntoLoops)) { // // If it's not possible to move the variable use into a nested block, // we need to declare it in this block.
static boolean findDeclarationPoint( final TypeReference localType, final boolean allowPassIntoLoops, final BlockStatement block, final StrongBox<Statement> declarationPoint, final Statement skipUpThrough) { declarationPoint.set(null); Statement waitFor = skipUpThrough; for (final Statement statement : block.getStatements()) { if (waitFor != null) { if (statement == waitFor) { waitFor = null; } continue; } if (referencesType(statement, localType)) { if (declarationPoint.get() != null) { return false; } declarationPoint.set(statement); if (!canMoveLocalTypeIntoSubBlock(statement, localType, allowPassIntoLoops)) { // // If it's not possible to move the variable use into a nested block, // we need to declare it in this block.
static boolean findDeclarationPoint( final TypeReference localType, final boolean allowPassIntoLoops, final BlockStatement block, final StrongBox<Statement> declarationPoint, final Statement skipUpThrough) { declarationPoint.set(null); Statement waitFor = skipUpThrough; for (final Statement statement : block.getStatements()) { if (waitFor != null) { if (statement == waitFor) { waitFor = null; } continue; } if (referencesType(statement, localType)) { if (declarationPoint.get() != null) { return false; } declarationPoint.set(statement); if (!canMoveLocalTypeIntoSubBlock(statement, localType, allowPassIntoLoops)) { // // If it's not possible to move the variable use into a nested block, // we need to declare it in this block.