use of com.jetbrains.python.psi.stubs.PyClassStub in project intellij-community by JetBrains.
the class PyClassImpl method getClassAttributes.
public List<PyTargetExpression> getClassAttributes() {
PyClassStub stub = getStub();
if (stub != null) {
final PyTargetExpression[] children = stub.getChildrenByType(PyElementTypes.TARGET_EXPRESSION, PyTargetExpression.EMPTY_ARRAY);
return Arrays.asList(children);
}
List<PyTargetExpression> result = new ArrayList<>();
for (PsiElement psiElement : getStatementList().getChildren()) {
if (psiElement instanceof PyAssignmentStatement) {
final PyAssignmentStatement assignmentStatement = (PyAssignmentStatement) psiElement;
final PyExpression[] targets = assignmentStatement.getTargets();
for (PyExpression target : targets) {
if (target instanceof PyTargetExpression) {
result.add((PyTargetExpression) target);
}
}
}
}
return result;
}
Aggregations