-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathAFunctionExpression.java
More file actions
165 lines (136 loc) · 3.44 KB
/
AFunctionExpression.java
File metadata and controls
165 lines (136 loc) · 3.44 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
package com.semmle.js.ast;
import com.semmle.ts.ast.DecoratorList;
import com.semmle.ts.ast.ITypeExpression;
import com.semmle.ts.ast.TypeParameter;
import com.semmle.util.data.IntList;
import java.util.List;
/**
* A function expression, which may be either an {@link ArrowFunctionExpression} or a normal {@link
* FunctionExpression}.
*/
public abstract class AFunctionExpression extends Expression implements IFunction {
private final AFunction<? extends Node> fn;
private int symbol = -1;
private int declaredSignature = -1;
public AFunctionExpression(
String type,
SourceLocation loc,
Identifier id,
List<Expression> params,
Node body,
Boolean generator,
Boolean async,
List<TypeParameter> typeParameters,
List<ITypeExpression> parameterTypes,
List<DecoratorList> parameterDecorators,
ITypeExpression returnType,
ITypeExpression thisParameterType,
IntList optionalParameterIndices) {
super(type, loc);
this.fn =
new AFunction<Node>(
id,
params,
body,
Boolean.TRUE.equals(generator),
Boolean.TRUE.equals(async),
typeParameters,
parameterTypes,
parameterDecorators,
returnType,
thisParameterType,
optionalParameterIndices);
}
public AFunctionExpression(String type, SourceLocation loc, AFunction<? extends Node> fn) {
super(type, loc);
this.fn = fn;
}
@Override
public Identifier getId() {
return fn.getId();
}
@Override
public List<IPattern> getParams() {
return fn.getParams();
}
@Override
public boolean hasDefault(int i) {
return fn.hasDefault(i);
}
@Override
public Expression getDefault(int i) {
return fn.getDefault(i);
}
@Override
public IPattern getRest() {
return fn.getRest();
}
@Override
public Node getBody() {
return fn.getBody();
}
@Override
public boolean hasRest() {
return fn.hasRest();
}
public boolean hasId() {
return fn.hasId();
}
public boolean isGenerator() {
return fn.isGenerator();
}
public boolean isAsync() {
return fn.isAsync();
}
public List<IPattern> getAllParams() {
return fn.getAllParams();
}
@Override
public List<Expression> getRawParameters() {
return fn.getRawParams();
}
public ITypeExpression getReturnType() {
return fn.getReturnType();
}
public boolean hasParameterType(int i) {
return fn.hasParameterType(i);
}
public ITypeExpression getParameterType(int i) {
return fn.getParameterType(i);
}
public List<ITypeExpression> getParameterTypes() {
return fn.getParameterTypes();
}
public List<TypeParameter> getTypeParameters() {
return fn.getTypeParameters();
}
public ITypeExpression getThisParameterType() {
return fn.getThisParameterType();
}
public List<DecoratorList> getParameterDecorators() {
return fn.getParameterDecorators();
}
@Override
public boolean hasDeclareKeyword() {
return false;
}
@Override
public int getSymbol() {
return symbol;
}
@Override
public void setSymbol(int symbol) {
this.symbol = symbol;
}
@Override
public int getDeclaredSignatureId() {
return declaredSignature;
}
@Override
public void setDeclaredSignatureId(int id) {
declaredSignature = id;
}
public IntList getOptionalParameterIndices() {
return fn.getOptionalParmaeterIndices();
}
}