Search in sources :

Example 1 with ModuleType

use of org.yinwang.pysonar.types.ModuleType in project pysonar2 by yinwang0.

the class Binding method getFirstFile.

@NotNull
public String getFirstFile() {
    Type bt = type;
    if (bt instanceof ModuleType) {
        String file = bt.asModuleType().file;
        return file != null ? file : "<built-in module>";
    }
    String file = getFile();
    if (file != null) {
        return file;
    }
    return "<built-in binding>";
}
Also used : Type(org.yinwang.pysonar.types.Type) UnionType(org.yinwang.pysonar.types.UnionType) ModuleType(org.yinwang.pysonar.types.ModuleType) ModuleType(org.yinwang.pysonar.types.ModuleType) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with ModuleType

use of org.yinwang.pysonar.types.ModuleType in project pysonar2 by yinwang0.

the class TypeInferencer method visit.

@NotNull
@Override
public Type visit(Module node, State s) {
    ModuleType mt = new ModuleType(node.name, node.file, Analyzer.self.globaltable);
    s.insert($.moduleQname(node.file), node, mt, MODULE);
    if (node.body != null) {
        visit(node.body, mt.table);
    }
    return mt;
}
Also used : ModuleType(org.yinwang.pysonar.types.ModuleType) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

NotNull (org.jetbrains.annotations.NotNull)2 ModuleType (org.yinwang.pysonar.types.ModuleType)2 Type (org.yinwang.pysonar.types.Type)1 UnionType (org.yinwang.pysonar.types.UnionType)1