-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand file tree
/
Copy pathAClass.java
More file actions
82 lines (67 loc) · 1.86 KB
/
AClass.java
File metadata and controls
82 lines (67 loc) · 1.86 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
79
80
81
82
package com.semmle.js.ast;
import com.semmle.ts.ast.INodeWithSymbol;
import com.semmle.ts.ast.ITypeExpression;
import com.semmle.ts.ast.TypeParameter;
import java.util.ArrayList;
import java.util.List;
/** Common backing class for {@linkplain ClassDeclaration} and {@linkplain ClassExpression}. */
public class AClass implements INodeWithSymbol {
private final Identifier id;
private final List<TypeParameter> typeParameters;
private final Expression superClass;
private final List<ITypeExpression> superInterfaces;
private final ClassBody body;
private final List<Decorator> decorators;
private int typeSymbol = -1;
public AClass(
Identifier id,
List<TypeParameter> typeParameters,
Expression superClass,
List<ITypeExpression> superInterfaces,
ClassBody body) {
this.id = id;
this.typeParameters = typeParameters;
this.superClass = superClass;
this.superInterfaces = superInterfaces;
this.body = body;
this.decorators = new ArrayList<Decorator>();
}
public Identifier getId() {
return id;
}
public boolean hasId() {
return id != null;
}
public List<TypeParameter> getTypeParameters() {
return typeParameters;
}
public boolean hasTypeParameters() {
return !typeParameters.isEmpty();
}
public Expression getSuperClass() {
return superClass;
}
public boolean hasSuperClass() {
return superClass != null;
}
public List<ITypeExpression> getSuperInterfaces() {
return superInterfaces;
}
public ClassBody getBody() {
return body;
}
public void addDecorators(List<Decorator> decorators) {
this.decorators.addAll(decorators);
}
public List<Decorator> getDecorators() {
return decorators;
}
@Override
public int getSymbol() {
return typeSymbol;
}
@Override
public void setSymbol(int symbol) {
this.typeSymbol = symbol;
}
}