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