This repository was archived by the owner on Dec 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathCtxInRefinement.hack
More file actions
388 lines (351 loc) · 8.95 KB
/
CtxInRefinement.hack
File metadata and controls
388 lines (351 loc) · 8.95 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
/**
* This file is generated. Do not modify it manually!
*
* @generated SignedSource<<971da060047eba588612a0499b1f9ff3>>
*/
namespace Facebook\HHAST;
use namespace Facebook\TypeAssert;
use namespace HH\Lib\Dict;
/* HHAST_IGNORE_ALL[5607] 5607 is ignored because of false positives when comparing a generic to a typed value */
/* HHAST_IGNORE_ALL[5624] HHAST_IGNORE_ALL[5639] 5624 and 5639 are ignored because they insist on using co(tra)variant generics. Could this break external consumers? */
<<__ConsistentConstruct>>
final class CtxInRefinement extends Node {
const string SYNTAX_KIND = 'ctx_in_refinement';
private ?Node $_keyword;
private ?Node $_name;
private ?Node $_type_parameters;
private ?Node $_constraints;
private ?Node $_equal;
private ?Node $_ctx_list;
public function __construct(
?Node $keyword,
?Node $name,
?Node $type_parameters,
?Node $constraints,
?Node $equal,
?Node $ctx_list,
?__Private\SourceRef $source_ref = null,
) {
$this->_keyword = $keyword;
$this->_name = $name;
$this->_type_parameters = $type_parameters;
$this->_constraints = $constraints;
$this->_equal = $equal;
$this->_ctx_list = $ctx_list;
parent::__construct($source_ref);
}
<<__Override>>
public static function fromJSON(
dict<arraykey, mixed> $json,
string $file,
int $initial_offset,
string $source,
string $_type_hint,
): this {
$offset = $initial_offset;
$keyword = Node::fromJSON(
($json['ctx_in_refinement_keyword'] ?? dict['kind' => 'missing'])
as dict<_, _>,
$file,
$offset,
$source,
'Node',
);
$offset += $keyword?->getWidth() ?? 0;
$name = Node::fromJSON(
($json['ctx_in_refinement_name'] ?? dict['kind' => 'missing'])
as dict<_, _>,
$file,
$offset,
$source,
'Node',
);
$offset += $name?->getWidth() ?? 0;
$type_parameters = Node::fromJSON(
($json['ctx_in_refinement_type_parameters'] ?? dict['kind' => 'missing'])
as dict<_, _>,
$file,
$offset,
$source,
'Node',
);
$offset += $type_parameters?->getWidth() ?? 0;
$constraints = Node::fromJSON(
($json['ctx_in_refinement_constraints'] ?? dict['kind' => 'missing'])
as dict<_, _>,
$file,
$offset,
$source,
'Node',
);
$offset += $constraints?->getWidth() ?? 0;
$equal = Node::fromJSON(
($json['ctx_in_refinement_equal'] ?? dict['kind' => 'missing'])
as dict<_, _>,
$file,
$offset,
$source,
'Node',
);
$offset += $equal?->getWidth() ?? 0;
$ctx_list = Node::fromJSON(
($json['ctx_in_refinement_ctx_list'] ?? dict['kind' => 'missing'])
as dict<_, _>,
$file,
$offset,
$source,
'Node',
);
$offset += $ctx_list?->getWidth() ?? 0;
$source_ref = shape(
'file' => $file,
'source' => $source,
'offset' => $initial_offset,
'width' => $offset - $initial_offset,
);
return new static(
/* HH_IGNORE_ERROR[4110] */ $keyword,
/* HH_IGNORE_ERROR[4110] */ $name,
/* HH_IGNORE_ERROR[4110] */ $type_parameters,
/* HH_IGNORE_ERROR[4110] */ $constraints,
/* HH_IGNORE_ERROR[4110] */ $equal,
/* HH_IGNORE_ERROR[4110] */ $ctx_list,
$source_ref,
);
}
<<__Override>>
public function getChildren(): dict<string, Node> {
return dict[
'keyword' => $this->_keyword,
'name' => $this->_name,
'type_parameters' => $this->_type_parameters,
'constraints' => $this->_constraints,
'equal' => $this->_equal,
'ctx_list' => $this->_ctx_list,
]
|> Dict\filter_nulls($$);
}
<<__Override>>
public function rewriteChildren<Tret as ?Node>(
(function(Node, vec<Node>): Tret) $rewriter,
vec<Node> $parents = vec[],
): this {
$parents[] = $this;
$keyword =
$this->_keyword === null ? null : $rewriter($this->_keyword, $parents);
$name = $this->_name === null ? null : $rewriter($this->_name, $parents);
$type_parameters = $this->_type_parameters === null
? null
: $rewriter($this->_type_parameters, $parents);
$constraints = $this->_constraints === null
? null
: $rewriter($this->_constraints, $parents);
$equal = $this->_equal === null ? null : $rewriter($this->_equal, $parents);
$ctx_list =
$this->_ctx_list === null ? null : $rewriter($this->_ctx_list, $parents);
if (
$keyword === $this->_keyword &&
$name === $this->_name &&
$type_parameters === $this->_type_parameters &&
$constraints === $this->_constraints &&
$equal === $this->_equal &&
$ctx_list === $this->_ctx_list
) {
return $this;
}
return new static(
$keyword as ?Node,
$name as ?Node,
$type_parameters as ?Node,
$constraints as ?Node,
$equal as ?Node,
$ctx_list as ?Node,
);
}
public function getKeywordUNTYPED(): ?Node {
return $this->_keyword;
}
public function withKeyword(?Node $value): this {
if ($value === $this->_keyword) {
return $this;
}
return new static(
$value,
$this->_name,
$this->_type_parameters,
$this->_constraints,
$this->_equal,
$this->_ctx_list,
);
}
public function hasKeyword(): bool {
return $this->_keyword !== null;
}
/**
* @return unknown
*/
public function getKeyword(): ?Node {
return $this->_keyword;
}
/**
* @return unknown
*/
public function getKeywordx(): Node {
return TypeAssert\not_null($this->getKeyword());
}
public function getNameUNTYPED(): ?Node {
return $this->_name;
}
public function withName(?Node $value): this {
if ($value === $this->_name) {
return $this;
}
return new static(
$this->_keyword,
$value,
$this->_type_parameters,
$this->_constraints,
$this->_equal,
$this->_ctx_list,
);
}
public function hasName(): bool {
return $this->_name !== null;
}
/**
* @return unknown
*/
public function getName(): ?Node {
return $this->_name;
}
/**
* @return unknown
*/
public function getNamex(): Node {
return TypeAssert\not_null($this->getName());
}
public function getTypeParametersUNTYPED(): ?Node {
return $this->_type_parameters;
}
public function withTypeParameters(?Node $value): this {
if ($value === $this->_type_parameters) {
return $this;
}
return new static(
$this->_keyword,
$this->_name,
$value,
$this->_constraints,
$this->_equal,
$this->_ctx_list,
);
}
public function hasTypeParameters(): bool {
return $this->_type_parameters !== null;
}
/**
* @return unknown
*/
public function getTypeParameters(): ?Node {
return $this->_type_parameters;
}
/**
* @return unknown
*/
public function getTypeParametersx(): Node {
return TypeAssert\not_null($this->getTypeParameters());
}
public function getConstraintsUNTYPED(): ?Node {
return $this->_constraints;
}
public function withConstraints(?Node $value): this {
if ($value === $this->_constraints) {
return $this;
}
return new static(
$this->_keyword,
$this->_name,
$this->_type_parameters,
$value,
$this->_equal,
$this->_ctx_list,
);
}
public function hasConstraints(): bool {
return $this->_constraints !== null;
}
/**
* @return unknown
*/
public function getConstraints(): ?Node {
return $this->_constraints;
}
/**
* @return unknown
*/
public function getConstraintsx(): Node {
return TypeAssert\not_null($this->getConstraints());
}
public function getEqualUNTYPED(): ?Node {
return $this->_equal;
}
public function withEqual(?Node $value): this {
if ($value === $this->_equal) {
return $this;
}
return new static(
$this->_keyword,
$this->_name,
$this->_type_parameters,
$this->_constraints,
$value,
$this->_ctx_list,
);
}
public function hasEqual(): bool {
return $this->_equal !== null;
}
/**
* @return unknown
*/
public function getEqual(): ?Node {
return $this->_equal;
}
/**
* @return unknown
*/
public function getEqualx(): Node {
return TypeAssert\not_null($this->getEqual());
}
public function getCtxListUNTYPED(): ?Node {
return $this->_ctx_list;
}
public function withCtxList(?Node $value): this {
if ($value === $this->_ctx_list) {
return $this;
}
return new static(
$this->_keyword,
$this->_name,
$this->_type_parameters,
$this->_constraints,
$this->_equal,
$value,
);
}
public function hasCtxList(): bool {
return $this->_ctx_list !== null;
}
/**
* @return unknown
*/
public function getCtxList(): ?Node {
return $this->_ctx_list;
}
/**
* @return unknown
*/
public function getCtxListx(): Node {
return TypeAssert\not_null($this->getCtxList());
}
}