-
Notifications
You must be signed in to change notification settings - Fork 228
Expand file tree
/
Copy pathNModuleType.java
More file actions
78 lines (64 loc) · 1.92 KB
/
NModuleType.java
File metadata and controls
78 lines (64 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* Copyright 2009, Google Inc. All rights reserved.
* Licensed to PSF under a Contributor Agreement.
*/
package org.python.indexer.types;
import org.python.indexer.Indexer;
import org.python.indexer.NBinding;
import org.python.indexer.Scope;
import org.python.indexer.Util;
import org.python.indexer.ast.NAssign;
import org.python.indexer.ast.NList;
import org.python.indexer.ast.NName;
import org.python.indexer.ast.NNode;
import org.python.indexer.ast.NStr;
import java.util.ArrayList;
import java.util.List;
public class NModuleType extends NType {
private String file;
private String name;
private String qname;
public NModuleType() {
}
public NModuleType(String name, String file, Scope parent) {
this.name = name;
this.file = file; // null for builtin modules
if (file != null) {
// This will return null iff specified file is not prefixed by
// any path in the module search path -- i.e., the caller asked
// the indexer to load a file not in the search path.
qname = Util.moduleQname(file);
}
if (qname == null) {
qname = name;
}
setTable(new Scope(parent, Scope.Type.MODULE));
getTable().setPath(qname);
// null during bootstrapping of built-in types
if (Indexer.idx.builtins != null) {
getTable().addSuper(Indexer.idx.builtins.BaseModule.getTable());
}
}
public void setFile(String file) {
this.file = file;
}
public String getFile() {
return file;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setQname(String qname) {
this.qname = qname;
}
public String getQname() {
return qname;
}
@Override
public void printKids(CyclicTypeRecorder ctr, StringBuilder sb) {
sb.append(qname);
}
}