oxc_ast/generated/get_id.rs
1// Auto-generated code, DO NOT EDIT DIRECTLY!
2// To edit this generated file you have to edit `tasks/ast_tools/src/generators/get_id.rs`.
3
4use oxc_syntax::{reference::ReferenceId, scope::ScopeId, symbol::SymbolId};
5
6use crate::ast::*;
7
8impl Program<'_> {
9 /// Get [`ScopeId`] of [`Program`].
10 ///
11 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
12 ///
13 /// # Panics
14 /// Panics if `scope_id` is [`None`].
15 #[inline]
16 pub fn scope_id(&self) -> ScopeId {
17 self.scope_id.get().unwrap()
18 }
19
20 /// Set [`ScopeId`] of [`Program`].
21 #[inline]
22 pub fn set_scope_id(&self, scope_id: ScopeId) {
23 self.scope_id.set(Some(scope_id));
24 }
25}
26
27impl IdentifierReference<'_> {
28 /// Get [`ReferenceId`] of [`IdentifierReference`].
29 ///
30 /// Only use this method on a post-semantic AST where [`ReferenceId`]s are always defined.
31 ///
32 /// # Panics
33 /// Panics if `reference_id` is [`None`].
34 #[inline]
35 pub fn reference_id(&self) -> ReferenceId {
36 self.reference_id.get().unwrap()
37 }
38
39 /// Set [`ReferenceId`] of [`IdentifierReference`].
40 #[inline]
41 pub fn set_reference_id(&self, reference_id: ReferenceId) {
42 self.reference_id.set(Some(reference_id));
43 }
44}
45
46impl BindingIdentifier<'_> {
47 /// Get [`SymbolId`] of [`BindingIdentifier`].
48 ///
49 /// Only use this method on a post-semantic AST where [`SymbolId`]s are always defined.
50 ///
51 /// # Panics
52 /// Panics if `symbol_id` is [`None`].
53 #[inline]
54 pub fn symbol_id(&self) -> SymbolId {
55 self.symbol_id.get().unwrap()
56 }
57
58 /// Set [`SymbolId`] of [`BindingIdentifier`].
59 #[inline]
60 pub fn set_symbol_id(&self, symbol_id: SymbolId) {
61 self.symbol_id.set(Some(symbol_id));
62 }
63}
64
65impl BlockStatement<'_> {
66 /// Get [`ScopeId`] of [`BlockStatement`].
67 ///
68 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
69 ///
70 /// # Panics
71 /// Panics if `scope_id` is [`None`].
72 #[inline]
73 pub fn scope_id(&self) -> ScopeId {
74 self.scope_id.get().unwrap()
75 }
76
77 /// Set [`ScopeId`] of [`BlockStatement`].
78 #[inline]
79 pub fn set_scope_id(&self, scope_id: ScopeId) {
80 self.scope_id.set(Some(scope_id));
81 }
82}
83
84impl ForStatement<'_> {
85 /// Get [`ScopeId`] of [`ForStatement`].
86 ///
87 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
88 ///
89 /// # Panics
90 /// Panics if `scope_id` is [`None`].
91 #[inline]
92 pub fn scope_id(&self) -> ScopeId {
93 self.scope_id.get().unwrap()
94 }
95
96 /// Set [`ScopeId`] of [`ForStatement`].
97 #[inline]
98 pub fn set_scope_id(&self, scope_id: ScopeId) {
99 self.scope_id.set(Some(scope_id));
100 }
101}
102
103impl ForInStatement<'_> {
104 /// Get [`ScopeId`] of [`ForInStatement`].
105 ///
106 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
107 ///
108 /// # Panics
109 /// Panics if `scope_id` is [`None`].
110 #[inline]
111 pub fn scope_id(&self) -> ScopeId {
112 self.scope_id.get().unwrap()
113 }
114
115 /// Set [`ScopeId`] of [`ForInStatement`].
116 #[inline]
117 pub fn set_scope_id(&self, scope_id: ScopeId) {
118 self.scope_id.set(Some(scope_id));
119 }
120}
121
122impl ForOfStatement<'_> {
123 /// Get [`ScopeId`] of [`ForOfStatement`].
124 ///
125 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
126 ///
127 /// # Panics
128 /// Panics if `scope_id` is [`None`].
129 #[inline]
130 pub fn scope_id(&self) -> ScopeId {
131 self.scope_id.get().unwrap()
132 }
133
134 /// Set [`ScopeId`] of [`ForOfStatement`].
135 #[inline]
136 pub fn set_scope_id(&self, scope_id: ScopeId) {
137 self.scope_id.set(Some(scope_id));
138 }
139}
140
141impl WithStatement<'_> {
142 /// Get [`ScopeId`] of [`WithStatement`].
143 ///
144 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
145 ///
146 /// # Panics
147 /// Panics if `scope_id` is [`None`].
148 #[inline]
149 pub fn scope_id(&self) -> ScopeId {
150 self.scope_id.get().unwrap()
151 }
152
153 /// Set [`ScopeId`] of [`WithStatement`].
154 #[inline]
155 pub fn set_scope_id(&self, scope_id: ScopeId) {
156 self.scope_id.set(Some(scope_id));
157 }
158}
159
160impl SwitchStatement<'_> {
161 /// Get [`ScopeId`] of [`SwitchStatement`].
162 ///
163 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
164 ///
165 /// # Panics
166 /// Panics if `scope_id` is [`None`].
167 #[inline]
168 pub fn scope_id(&self) -> ScopeId {
169 self.scope_id.get().unwrap()
170 }
171
172 /// Set [`ScopeId`] of [`SwitchStatement`].
173 #[inline]
174 pub fn set_scope_id(&self, scope_id: ScopeId) {
175 self.scope_id.set(Some(scope_id));
176 }
177}
178
179impl CatchClause<'_> {
180 /// Get [`ScopeId`] of [`CatchClause`].
181 ///
182 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
183 ///
184 /// # Panics
185 /// Panics if `scope_id` is [`None`].
186 #[inline]
187 pub fn scope_id(&self) -> ScopeId {
188 self.scope_id.get().unwrap()
189 }
190
191 /// Set [`ScopeId`] of [`CatchClause`].
192 #[inline]
193 pub fn set_scope_id(&self, scope_id: ScopeId) {
194 self.scope_id.set(Some(scope_id));
195 }
196}
197
198impl Function<'_> {
199 /// Get [`ScopeId`] of [`Function`].
200 ///
201 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
202 ///
203 /// # Panics
204 /// Panics if `scope_id` is [`None`].
205 #[inline]
206 pub fn scope_id(&self) -> ScopeId {
207 self.scope_id.get().unwrap()
208 }
209
210 /// Set [`ScopeId`] of [`Function`].
211 #[inline]
212 pub fn set_scope_id(&self, scope_id: ScopeId) {
213 self.scope_id.set(Some(scope_id));
214 }
215}
216
217impl ArrowFunctionExpression<'_> {
218 /// Get [`ScopeId`] of [`ArrowFunctionExpression`].
219 ///
220 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
221 ///
222 /// # Panics
223 /// Panics if `scope_id` is [`None`].
224 #[inline]
225 pub fn scope_id(&self) -> ScopeId {
226 self.scope_id.get().unwrap()
227 }
228
229 /// Set [`ScopeId`] of [`ArrowFunctionExpression`].
230 #[inline]
231 pub fn set_scope_id(&self, scope_id: ScopeId) {
232 self.scope_id.set(Some(scope_id));
233 }
234}
235
236impl Class<'_> {
237 /// Get [`ScopeId`] of [`Class`].
238 ///
239 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
240 ///
241 /// # Panics
242 /// Panics if `scope_id` is [`None`].
243 #[inline]
244 pub fn scope_id(&self) -> ScopeId {
245 self.scope_id.get().unwrap()
246 }
247
248 /// Set [`ScopeId`] of [`Class`].
249 #[inline]
250 pub fn set_scope_id(&self, scope_id: ScopeId) {
251 self.scope_id.set(Some(scope_id));
252 }
253}
254
255impl StaticBlock<'_> {
256 /// Get [`ScopeId`] of [`StaticBlock`].
257 ///
258 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
259 ///
260 /// # Panics
261 /// Panics if `scope_id` is [`None`].
262 #[inline]
263 pub fn scope_id(&self) -> ScopeId {
264 self.scope_id.get().unwrap()
265 }
266
267 /// Set [`ScopeId`] of [`StaticBlock`].
268 #[inline]
269 pub fn set_scope_id(&self, scope_id: ScopeId) {
270 self.scope_id.set(Some(scope_id));
271 }
272}
273
274impl TSEnumDeclaration<'_> {
275 /// Get [`ScopeId`] of [`TSEnumDeclaration`].
276 ///
277 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
278 ///
279 /// # Panics
280 /// Panics if `scope_id` is [`None`].
281 #[inline]
282 pub fn scope_id(&self) -> ScopeId {
283 self.scope_id.get().unwrap()
284 }
285
286 /// Set [`ScopeId`] of [`TSEnumDeclaration`].
287 #[inline]
288 pub fn set_scope_id(&self, scope_id: ScopeId) {
289 self.scope_id.set(Some(scope_id));
290 }
291}
292
293impl TSConditionalType<'_> {
294 /// Get [`ScopeId`] of [`TSConditionalType`].
295 ///
296 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
297 ///
298 /// # Panics
299 /// Panics if `scope_id` is [`None`].
300 #[inline]
301 pub fn scope_id(&self) -> ScopeId {
302 self.scope_id.get().unwrap()
303 }
304
305 /// Set [`ScopeId`] of [`TSConditionalType`].
306 #[inline]
307 pub fn set_scope_id(&self, scope_id: ScopeId) {
308 self.scope_id.set(Some(scope_id));
309 }
310}
311
312impl TSTypeAliasDeclaration<'_> {
313 /// Get [`ScopeId`] of [`TSTypeAliasDeclaration`].
314 ///
315 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
316 ///
317 /// # Panics
318 /// Panics if `scope_id` is [`None`].
319 #[inline]
320 pub fn scope_id(&self) -> ScopeId {
321 self.scope_id.get().unwrap()
322 }
323
324 /// Set [`ScopeId`] of [`TSTypeAliasDeclaration`].
325 #[inline]
326 pub fn set_scope_id(&self, scope_id: ScopeId) {
327 self.scope_id.set(Some(scope_id));
328 }
329}
330
331impl TSInterfaceDeclaration<'_> {
332 /// Get [`ScopeId`] of [`TSInterfaceDeclaration`].
333 ///
334 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
335 ///
336 /// # Panics
337 /// Panics if `scope_id` is [`None`].
338 #[inline]
339 pub fn scope_id(&self) -> ScopeId {
340 self.scope_id.get().unwrap()
341 }
342
343 /// Set [`ScopeId`] of [`TSInterfaceDeclaration`].
344 #[inline]
345 pub fn set_scope_id(&self, scope_id: ScopeId) {
346 self.scope_id.set(Some(scope_id));
347 }
348}
349
350impl TSCallSignatureDeclaration<'_> {
351 /// Get [`ScopeId`] of [`TSCallSignatureDeclaration`].
352 ///
353 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
354 ///
355 /// # Panics
356 /// Panics if `scope_id` is [`None`].
357 #[inline]
358 pub fn scope_id(&self) -> ScopeId {
359 self.scope_id.get().unwrap()
360 }
361
362 /// Set [`ScopeId`] of [`TSCallSignatureDeclaration`].
363 #[inline]
364 pub fn set_scope_id(&self, scope_id: ScopeId) {
365 self.scope_id.set(Some(scope_id));
366 }
367}
368
369impl TSMethodSignature<'_> {
370 /// Get [`ScopeId`] of [`TSMethodSignature`].
371 ///
372 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
373 ///
374 /// # Panics
375 /// Panics if `scope_id` is [`None`].
376 #[inline]
377 pub fn scope_id(&self) -> ScopeId {
378 self.scope_id.get().unwrap()
379 }
380
381 /// Set [`ScopeId`] of [`TSMethodSignature`].
382 #[inline]
383 pub fn set_scope_id(&self, scope_id: ScopeId) {
384 self.scope_id.set(Some(scope_id));
385 }
386}
387
388impl TSConstructSignatureDeclaration<'_> {
389 /// Get [`ScopeId`] of [`TSConstructSignatureDeclaration`].
390 ///
391 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
392 ///
393 /// # Panics
394 /// Panics if `scope_id` is [`None`].
395 #[inline]
396 pub fn scope_id(&self) -> ScopeId {
397 self.scope_id.get().unwrap()
398 }
399
400 /// Set [`ScopeId`] of [`TSConstructSignatureDeclaration`].
401 #[inline]
402 pub fn set_scope_id(&self, scope_id: ScopeId) {
403 self.scope_id.set(Some(scope_id));
404 }
405}
406
407impl TSModuleDeclaration<'_> {
408 /// Get [`ScopeId`] of [`TSModuleDeclaration`].
409 ///
410 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
411 ///
412 /// # Panics
413 /// Panics if `scope_id` is [`None`].
414 #[inline]
415 pub fn scope_id(&self) -> ScopeId {
416 self.scope_id.get().unwrap()
417 }
418
419 /// Set [`ScopeId`] of [`TSModuleDeclaration`].
420 #[inline]
421 pub fn set_scope_id(&self, scope_id: ScopeId) {
422 self.scope_id.set(Some(scope_id));
423 }
424}
425
426impl TSGlobalDeclaration<'_> {
427 /// Get [`ScopeId`] of [`TSGlobalDeclaration`].
428 ///
429 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
430 ///
431 /// # Panics
432 /// Panics if `scope_id` is [`None`].
433 #[inline]
434 pub fn scope_id(&self) -> ScopeId {
435 self.scope_id.get().unwrap()
436 }
437
438 /// Set [`ScopeId`] of [`TSGlobalDeclaration`].
439 #[inline]
440 pub fn set_scope_id(&self, scope_id: ScopeId) {
441 self.scope_id.set(Some(scope_id));
442 }
443}
444
445impl TSFunctionType<'_> {
446 /// Get [`ScopeId`] of [`TSFunctionType`].
447 ///
448 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
449 ///
450 /// # Panics
451 /// Panics if `scope_id` is [`None`].
452 #[inline]
453 pub fn scope_id(&self) -> ScopeId {
454 self.scope_id.get().unwrap()
455 }
456
457 /// Set [`ScopeId`] of [`TSFunctionType`].
458 #[inline]
459 pub fn set_scope_id(&self, scope_id: ScopeId) {
460 self.scope_id.set(Some(scope_id));
461 }
462}
463
464impl TSConstructorType<'_> {
465 /// Get [`ScopeId`] of [`TSConstructorType`].
466 ///
467 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
468 ///
469 /// # Panics
470 /// Panics if `scope_id` is [`None`].
471 #[inline]
472 pub fn scope_id(&self) -> ScopeId {
473 self.scope_id.get().unwrap()
474 }
475
476 /// Set [`ScopeId`] of [`TSConstructorType`].
477 #[inline]
478 pub fn set_scope_id(&self, scope_id: ScopeId) {
479 self.scope_id.set(Some(scope_id));
480 }
481}
482
483impl TSMappedType<'_> {
484 /// Get [`ScopeId`] of [`TSMappedType`].
485 ///
486 /// Only use this method on a post-semantic AST where [`ScopeId`]s are always defined.
487 ///
488 /// # Panics
489 /// Panics if `scope_id` is [`None`].
490 #[inline]
491 pub fn scope_id(&self) -> ScopeId {
492 self.scope_id.get().unwrap()
493 }
494
495 /// Set [`ScopeId`] of [`TSMappedType`].
496 #[inline]
497 pub fn set_scope_id(&self, scope_id: ScopeId) {
498 self.scope_id.set(Some(scope_id));
499 }
500}