mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixed missing name declaration for Cython functions (PY-8806)
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
package com.jetbrains.python.parsing;
|
||||
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.jetbrains.python.PyElementTypes;
|
||||
import com.jetbrains.python.PyTokenTypes;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import static com.jetbrains.python.PyBundle.message;
|
||||
|
||||
@@ -13,9 +11,7 @@ import static com.jetbrains.python.PyBundle.message;
|
||||
* @author yole
|
||||
*/
|
||||
public class FunctionParsing extends Parsing {
|
||||
private static final Logger LOG = Logger.getInstance("#com.jetbrains.python.parsing.FunctionParsing");
|
||||
private static final IElementType FUNCTION_TYPE = PyElementTypes.FUNCTION_DECLARATION;
|
||||
private static final IElementType PARAMETER_LIST_TYPE = PyElementTypes.PARAMETER_LIST;
|
||||
|
||||
public FunctionParsing(ParsingContext context) {
|
||||
super(context);
|
||||
@@ -31,31 +27,16 @@ public class FunctionParsing extends Parsing {
|
||||
return FUNCTION_TYPE;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected IElementType getNameType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void parseFunctionInnards(PsiBuilder.Marker functionMarker) {
|
||||
myBuilder.advanceLexer();
|
||||
final IElementType elementType = getNameType();
|
||||
final PsiBuilder.Marker mark = myBuilder.mark();
|
||||
boolean nameFound = false;
|
||||
if (myBuilder.getTokenType() == PyTokenTypes.IDENTIFIER) {
|
||||
myBuilder.advanceLexer();
|
||||
nameFound = true;
|
||||
}
|
||||
else {
|
||||
myBuilder.error(message("PARSE.expected.func.name"));
|
||||
}
|
||||
parseParameterList();
|
||||
parseReturnTypeAnnotation();
|
||||
if (elementType != null && nameFound) {
|
||||
mark.done(elementType);
|
||||
}
|
||||
else {
|
||||
mark.drop();
|
||||
}
|
||||
checkMatches(PyTokenTypes.COLON, message("PARSE.expected.colon"));
|
||||
getStatementParser().parseSuite(functionMarker, getFunctionType(), myContext.emptyParsingScope().withFunction(true));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user