Lines 80-85
Link Here
|
80 |
protected static final int K_CONTROL_STATEMENT_DELIMITER = COMPLETION_PARSER + 38; |
80 |
protected static final int K_CONTROL_STATEMENT_DELIMITER = COMPLETION_PARSER + 38; |
81 |
protected static final int K_INSIDE_ASSERT_EXCEPTION = COMPLETION_PARSER + 39; |
81 |
protected static final int K_INSIDE_ASSERT_EXCEPTION = COMPLETION_PARSER + 39; |
82 |
protected static final int K_INSIDE_FOR_CONDITIONAL = COMPLETION_PARSER + 40; |
82 |
protected static final int K_INSIDE_FOR_CONDITIONAL = COMPLETION_PARSER + 40; |
|
|
83 |
// added for https://bugs.eclipse.org/bugs/show_bug.cgi?id=261534 |
84 |
protected static final int K_BETWEEN_INSTANCEOF_AND_RPAREN = COMPLETION_PARSER + 41; |
83 |
|
85 |
|
84 |
public final static char[] FAKE_TYPE_NAME = new char[]{' '}; |
86 |
public final static char[] FAKE_TYPE_NAME = new char[]{' '}; |
85 |
public final static char[] FAKE_METHOD_NAME = new char[]{' '}; |
87 |
public final static char[] FAKE_METHOD_NAME = new char[]{' '}; |
Lines 562-568
Link Here
|
562 |
&& ((Assignment)expression).expression == this.assistNode |
564 |
&& ((Assignment)expression).expression == this.assistNode |
563 |
&& (this.expressionPtr > 0 && this.expressionStack[this.expressionPtr - 1] instanceof InstanceOfExpression)) |
565 |
&& (this.expressionPtr > 0 && this.expressionStack[this.expressionPtr - 1] instanceof InstanceOfExpression)) |
564 |
|| (expression instanceof AllocationExpression |
566 |
|| (expression instanceof AllocationExpression |
565 |
&& ((AllocationExpression)expression).type == this.assistNode)){ |
567 |
&& ((AllocationExpression)expression).type == this.assistNode) |
|
|
568 |
|| (expression instanceof BinaryExpression |
569 |
&& (this.elementPtr >= 0 && this.elementObjectInfoStack[this.elementPtr] instanceof InstanceOfExpression))){ |
566 |
buildMoreCompletionContext(expression); |
570 |
buildMoreCompletionContext(expression); |
567 |
if (this.assistNodeParent == null |
571 |
if (this.assistNodeParent == null |
568 |
&& expression instanceof Assignment) { |
572 |
&& expression instanceof Assignment) { |
Lines 1061-1068
Link Here
|
1061 |
|
1065 |
|
1062 |
int blockIndex = lastIndexOfElement(K_BLOCK_DELIMITER); |
1066 |
int blockIndex = lastIndexOfElement(K_BLOCK_DELIMITER); |
1063 |
int controlIndex = lastIndexOfElement(K_CONTROL_STATEMENT_DELIMITER); |
1067 |
int controlIndex = lastIndexOfElement(K_CONTROL_STATEMENT_DELIMITER); |
1064 |
int index = blockIndex != -1 && controlIndex < blockIndex ? blockIndex : controlIndex; |
1068 |
int index; |
1065 |
|
1069 |
if (controlIndex != -1) { |
|
|
1070 |
index = blockIndex != -1 && controlIndex < blockIndex ? blockIndex : controlIndex; |
1071 |
} |
1072 |
else { |
1073 |
// To handle the case when the completion is requested before enclosing R_PAREN |
1074 |
// and an instanceof expression is also present |
1075 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=261534 |
1076 |
int instanceOfIndex = lastIndexOfElement(K_BETWEEN_INSTANCEOF_AND_RPAREN); |
1077 |
index = blockIndex != -1 && instanceOfIndex < blockIndex ? blockIndex : instanceOfIndex; |
1078 |
} |
1066 |
if (index != -1 && this.elementInfoStack[index] == IF && this.elementObjectInfoStack[index] != null) { |
1079 |
if (index != -1 && this.elementInfoStack[index] == IF && this.elementObjectInfoStack[index] != null) { |
1067 |
Expression condition = (Expression)this.elementObjectInfoStack[index]; |
1080 |
Expression condition = (Expression)this.elementObjectInfoStack[index]; |
1068 |
|
1081 |
|
Lines 1085-1091
Link Here
|
1085 |
|
1098 |
|
1086 |
} |
1099 |
} |
1087 |
} |
1100 |
} |
1088 |
|
1101 |
if (statement instanceof BinaryExpression && this.assistNode instanceof Statement) { |
|
|
1102 |
statement = (Statement) this.assistNode; |
1103 |
} |
1089 |
IfStatement ifStatement = |
1104 |
IfStatement ifStatement = |
1090 |
new IfStatement( |
1105 |
new IfStatement( |
1091 |
condition, |
1106 |
condition, |
Lines 2605-2611
Link Here
|
2605 |
protected void consumeInstanceOfExpression() { |
2620 |
protected void consumeInstanceOfExpression() { |
2606 |
super.consumeInstanceOfExpression(); |
2621 |
super.consumeInstanceOfExpression(); |
2607 |
popElement(K_BINARY_OPERATOR); |
2622 |
popElement(K_BINARY_OPERATOR); |
2608 |
|
2623 |
// to handle https://bugs.eclipse.org/bugs/show_bug.cgi?id=261534 |
|
|
2624 |
if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BETWEEN_IF_AND_RIGHT_PAREN) { |
2625 |
pushOnElementStack(K_BETWEEN_INSTANCEOF_AND_RPAREN, IF, this.expressionStack[this.expressionPtr]); |
2626 |
} |
2609 |
InstanceOfExpression exp = (InstanceOfExpression) this.expressionStack[this.expressionPtr]; |
2627 |
InstanceOfExpression exp = (InstanceOfExpression) this.expressionStack[this.expressionPtr]; |
2610 |
if(this.assistNode != null && exp.type == this.assistNode) { |
2628 |
if(this.assistNode != null && exp.type == this.assistNode) { |
2611 |
this.assistNodeParent = exp; |
2629 |
this.assistNodeParent = exp; |
Lines 3443-3448
Link Here
|
3443 |
case K_BETWEEN_CATCH_AND_RIGHT_PAREN : |
3461 |
case K_BETWEEN_CATCH_AND_RIGHT_PAREN : |
3444 |
popElement(K_BETWEEN_CATCH_AND_RIGHT_PAREN); |
3462 |
popElement(K_BETWEEN_CATCH_AND_RIGHT_PAREN); |
3445 |
break; |
3463 |
break; |
|
|
3464 |
case K_BETWEEN_INSTANCEOF_AND_RPAREN : |
3465 |
popElement(K_BETWEEN_INSTANCEOF_AND_RPAREN); |
3466 |
//$FALL-THROUGH$ |
3446 |
case K_BETWEEN_IF_AND_RIGHT_PAREN : |
3467 |
case K_BETWEEN_IF_AND_RIGHT_PAREN : |
3447 |
if(topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER) == this.bracketDepth) { |
3468 |
if(topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER) == this.bracketDepth) { |
3448 |
popElement(K_BETWEEN_IF_AND_RIGHT_PAREN); |
3469 |
popElement(K_BETWEEN_IF_AND_RIGHT_PAREN); |