Skip to content

Commit 69ada6f

Browse files
committed
[WIP] fix lambda recovery in the completion parser
Signed-off-by: David Thompson <[email protected]>
1 parent 8a979cb commit 69ada6f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6326,6 +6326,12 @@ protected CompilationUnitDeclaration endParse(int act) {
63266326
}
63276327
element = element.parent;
63286328
}
6329+
} else if (method.statements != null) {
6330+
// "double" recovery; base parser recovered statements and assist parser recovered the assist node
6331+
Statement[] newStatements = new Statement[method.statements.length + 1];
6332+
System.arraycopy(method.statements, 0, newStatements, 0, method.statements.length);
6333+
newStatements[method.statements.length] = statement;
6334+
method.statements = newStatements;
63296335
}
63306336
}
63316337
}

org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,6 +2070,8 @@ public void parseBlockStatements(MethodDeclaration md, CompilationUnitDeclaratio
20702070
if ((md.modifiers & ExtraCompilerModifiers.AccSemicolonBody) != 0)
20712071
return;
20722072

2073+
boolean oldStateRecoveryActivated = this.statementRecoveryActivated;
2074+
this.statementRecoveryActivated = true;
20732075
initialize();
20742076
// set the lastModifiers to reflect the modifiers of the method whose
20752077
// block statements are being parsed
@@ -2090,6 +2092,7 @@ public void parseBlockStatements(MethodDeclaration md, CompilationUnitDeclaratio
20902092
this.lastAct = ERROR_ACTION;
20912093
} finally {
20922094
this.nestedMethod[this.nestedType]--;
2095+
this.statementRecoveryActivated = oldStateRecoveryActivated;
20932096
}
20942097

20952098
if (this.lastAct == ERROR_ACTION) {

0 commit comments

Comments
 (0)