Utility method extracted
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package org.jetbrains.jet.lang.parsing;
|
package org.jetbrains.jet.lang.parsing;
|
||||||
|
|
||||||
import com.intellij.codeInspection.dataFlow.instructions.ReturnFromSubInstruction;
|
|
||||||
import com.intellij.lang.PsiBuilder;
|
import com.intellij.lang.PsiBuilder;
|
||||||
import com.intellij.psi.tree.IElementType;
|
import com.intellij.psi.tree.IElementType;
|
||||||
import com.intellij.psi.tree.TokenSet;
|
import com.intellij.psi.tree.TokenSet;
|
||||||
@@ -40,6 +39,15 @@ import static org.jetbrains.jet.lexer.JetTokens.*;
|
|||||||
this.myBuilder = builder;
|
this.myBuilder = builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected IElementType getLastToken() {
|
||||||
|
int i = 1;
|
||||||
|
int currentOffset = myBuilder.getCurrentOffset();
|
||||||
|
while (i <= currentOffset && WHITE_SPACE_OR_COMMENT_BIT_SET.contains(myBuilder.rawLookup(-i))) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return myBuilder.rawLookup(-i);
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean expect(JetToken expectation, String message) {
|
protected boolean expect(JetToken expectation, String message) {
|
||||||
return expect(expectation, message, null);
|
return expect(expectation, message, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -836,11 +836,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
parsePropertyGetterOrSetter();
|
parsePropertyGetterOrSetter();
|
||||||
}
|
}
|
||||||
if (!atSet(EOL_OR_SEMICOLON, RBRACE)) {
|
if (!atSet(EOL_OR_SEMICOLON, RBRACE)) {
|
||||||
int i = -1;
|
if (getLastToken() != SEMICOLON) {
|
||||||
while (-i < myBuilder.getCurrentOffset() && WHITE_SPACE_OR_COMMENT_BIT_SET.contains(myBuilder.rawLookup(i))) {
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
if (myBuilder.rawLookup(i) != SEMICOLON) {
|
|
||||||
errorUntil("Property getter or setter expected", TokenSet.create(EOL_OR_SEMICOLON));
|
errorUntil("Property getter or setter expected", TokenSet.create(EOL_OR_SEMICOLON));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user