-
Notifications
You must be signed in to change notification settings - Fork 228
Expand file tree
/
Copy pathNUnknownType.java
More file actions
42 lines (36 loc) · 964 Bytes
/
NUnknownType.java
File metadata and controls
42 lines (36 loc) · 964 Bytes
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
/**
* Copyright 2009, Google Inc. All rights reserved.
* Licensed to PSF under a Contributor Agreement.
*/
package org.python.indexer.types;
public class NUnknownType extends NType {
private NType pointer;
public NUnknownType() {
pointer = null;
}
public static void point(NType u, NType v) {
if (u.isUnknownType()) {
((NUnknownType)u).pointer = v;
}
}
public static NType follow(NType t) {
if (t instanceof NUnknownType) {
NUnknownType tv = (NUnknownType)t;
if (tv.pointer != null) {
return follow(tv.pointer);
} else {
return tv;
}
} else {
return t;
}
}
@Override
public void printKids(CyclicTypeRecorder ctr, StringBuilder sb) {
if (pointer == null) {
sb.append("null");
} else {
pointer.print(ctr, sb);
}
}
}