mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 08:48:55 +00:00
Extract method
This commit is contained in:
parent
69ffc7a3bd
commit
ec831a6772
1 changed files with 8 additions and 4 deletions
|
@ -230,7 +230,7 @@ public abstract class AbstractInternalContentAssistParser extends Parser impleme
|
|||
private void removeUnexpectedElements() {
|
||||
int dropParamAt = -1;
|
||||
if (!grammarElementsWithParams.isEmpty()) {
|
||||
dropParamAt = grammarElementsWithParams.get(grammarElementsWithParams.size() - 1);
|
||||
dropParamAt = getLast(grammarElementsWithParams);
|
||||
}
|
||||
while (stackSize < grammarElements.size()) {
|
||||
removeLast(grammarElements);
|
||||
|
@ -238,12 +238,16 @@ public abstract class AbstractInternalContentAssistParser extends Parser impleme
|
|||
removeLast(paramStack);
|
||||
removeLast(grammarElementsWithParams);
|
||||
if (!grammarElementsWithParams.isEmpty()) {
|
||||
dropParamAt = grammarElementsWithParams.get(grammarElementsWithParams.size() - 1);
|
||||
dropParamAt = getLast(grammarElementsWithParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private <T> T getLast(List<T> list) {
|
||||
return list.get(list.size() - 1);
|
||||
}
|
||||
|
||||
private <T> T removeLast(List<T> list) {
|
||||
return list.remove(list.size() - 1);
|
||||
}
|
||||
|
@ -516,7 +520,7 @@ public abstract class AbstractInternalContentAssistParser extends Parser impleme
|
|||
|
||||
protected AbstractElement getCurrentGrammarElement() {
|
||||
for (int i = grammarElements.size() - 1; i >= 0; i--) {
|
||||
EObject result = grammarElements.get(grammarElements.size() - 1);
|
||||
EObject result = grammarElements.get(i);
|
||||
if (result instanceof AbstractElement)
|
||||
return (AbstractElement) result;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue