Lines 1024-1053
Link Here
|
1024 |
|
1024 |
|
1025 |
int blockIndex = this.lastIndexOfElement(K_BLOCK_DELIMITER); |
1025 |
int blockIndex = this.lastIndexOfElement(K_BLOCK_DELIMITER); |
1026 |
int controlIndex = this.lastIndexOfElement(K_CONTROL_STATEMENT_DELIMITER); |
1026 |
int controlIndex = this.lastIndexOfElement(K_CONTROL_STATEMENT_DELIMITER); |
1027 |
if (blockIndex != -1 && controlIndex < blockIndex) { |
1027 |
int index = blockIndex != -1 && controlIndex < blockIndex ? blockIndex : controlIndex; |
1028 |
if (this.elementInfoStack[blockIndex] == IF && this.elementObjectInfoStack[blockIndex] != null) { |
1028 |
|
1029 |
Expression condition = (Expression)this.elementObjectInfoStack[blockIndex]; |
1029 |
if (index != -1 && this.elementInfoStack[index] == IF && this.elementObjectInfoStack[index] != null) { |
1030 |
IfStatement ifStatement = |
1030 |
Expression condition = (Expression)this.elementObjectInfoStack[index]; |
1031 |
new IfStatement( |
1031 |
|
1032 |
condition, |
1032 |
// If currentElement is a RecoveredLocalVariable then it can be contained in the if statement |
1033 |
statement, |
1033 |
if (this.currentElement instanceof RecoveredLocalVariable && |
1034 |
condition.sourceStart, |
1034 |
this.currentElement.parent instanceof RecoveredBlock) { |
1035 |
statement.sourceEnd); |
1035 |
RecoveredLocalVariable recoveredLocalVariable = (RecoveredLocalVariable) this.currentElement; |
1036 |
this.enclosingNode = ifStatement; |
1036 |
if (recoveredLocalVariable.localDeclaration.initialization == null && |
1037 |
return ifStatement; |
1037 |
statement instanceof Expression && |
|
|
1038 |
condition.sourceStart < recoveredLocalVariable.localDeclaration.sourceStart) { |
1039 |
this.currentElement.add(statement, 0); |
1040 |
|
1041 |
statement = recoveredLocalVariable.updatedStatement(); |
1042 |
|
1043 |
// RecoveredLocalVariable must be removed from his parent because the IfStatement will be added instead |
1044 |
RecoveredBlock recoveredBlock = (RecoveredBlock) recoveredLocalVariable.parent; |
1045 |
recoveredBlock.statements[--recoveredBlock.statementCount] = null; |
1046 |
|
1047 |
this.currentElement = recoveredBlock; |
1048 |
|
1049 |
} |
1038 |
} |
1050 |
} |
1039 |
} else if (controlIndex != -1) { |
1051 |
|
1040 |
if (this.elementInfoStack[controlIndex] == IF && this.elementObjectInfoStack[controlIndex] != null) { |
1052 |
IfStatement ifStatement = |
1041 |
Expression condition = (Expression)this.elementObjectInfoStack[controlIndex]; |
1053 |
new IfStatement( |
1042 |
IfStatement ifStatement = |
|
|
1043 |
new IfStatement( |
1044 |
condition, |
1054 |
condition, |
1045 |
statement, |
1055 |
statement, |
1046 |
condition.sourceStart, |
1056 |
condition.sourceStart, |
1047 |
statement.sourceEnd); |
1057 |
statement.sourceEnd); |
1048 |
this.enclosingNode = ifStatement; |
1058 |
this.enclosingNode = ifStatement; |
1049 |
return ifStatement; |
1059 |
return ifStatement; |
1050 |
} |
|
|
1051 |
} |
1060 |
} |
1052 |
|
1061 |
|
1053 |
return statement; |
1062 |
return statement; |