Search in sources :

Example 1 with PyFileStub

use of com.jetbrains.python.psi.stubs.PyFileStub in project intellij-community by JetBrains.

the class PyFileImpl method getDunderAll.

@Override
public List<String> getDunderAll() {
    final StubElement stubElement = getStub();
    if (stubElement instanceof PyFileStub) {
        return ((PyFileStub) stubElement).getDunderAll();
    }
    if (!myDunderAllCalculated) {
        final List<String> dunderAll = calculateDunderAll();
        myDunderAll = dunderAll == null ? null : Collections.unmodifiableList(dunderAll);
        myDunderAllCalculated = true;
    }
    return myDunderAll;
}
Also used : StubElement(com.intellij.psi.stubs.StubElement) PyFileStub(com.jetbrains.python.psi.stubs.PyFileStub)

Example 2 with PyFileStub

use of com.jetbrains.python.psi.stubs.PyFileStub in project intellij-community by JetBrains.

the class PyFileImpl method hasImportFromFuture.

@Override
public boolean hasImportFromFuture(FutureFeature feature) {
    final StubElement stub = getStub();
    if (stub instanceof PyFileStub) {
        return ((PyFileStub) stub).getFutureFeatures().get(feature.ordinal());
    }
    Boolean enabled = myFutureFeatures.get(feature);
    if (enabled == null) {
        enabled = calculateImportFromFuture(feature);
        myFutureFeatures.put(feature, enabled);
    // NOTE: ^^^ not synchronized. if two threads will try to modify this, both can only be expected to set the same value.
    }
    return enabled;
}
Also used : StubElement(com.intellij.psi.stubs.StubElement) PyFileStub(com.jetbrains.python.psi.stubs.PyFileStub)

Aggregations

StubElement (com.intellij.psi.stubs.StubElement)2 PyFileStub (com.jetbrains.python.psi.stubs.PyFileStub)2