-
Notifications
You must be signed in to change notification settings - Fork 698
/
CallStack.java
49 lines (39 loc) · 1.18 KB
/
CallStack.java
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
package org.python.indexer;
import org.python.indexer.ast.Node;
import org.python.indexer.types.Type;
import java.util.HashSet;
import java.util.Set;
public class CallStack {
// private Map<Node, Set<Type>> stack = new HashMap<Node, Set<Type>>();
private Set<Node> stack = new HashSet<Node>();
public void push(Node call, Type type) {
// Set<Type> inner = stack.get(call);
// if (inner != null) {
// inner.add(type);
// } else {
// inner = new HashSet<Type>();
// inner.add(type);
// stack.put(call, inner);
// }
stack.add(call);
}
public void pop(Node call, Type type) {
// Set<Type> inner = stack.get(call);
// if (inner != null) {
// inner.remove(type);
// if (inner.isEmpty()) {
// stack.remove(call);
// }
// }
stack.remove(call);
}
public boolean contains(Node call, Type type) {
// Set<Type> inner = stack.get(call);
// if (inner != null) {
// return inner.contains(type);
// } else {
// return false;
// }
return stack.contains(call);
}
}