1 // WARNING: This file is auto-generated by crates/ast/generate_ast.py.
2
3 #![allow(unused_variables)]
4
5 use crate::arena;
6 use crate::source_atom_set::{SourceAtomSet, SourceAtomSetIndex};
7 use crate::source_slice_list::{SourceSliceList, SourceSliceIndex};
8 use crate::types::*;
9 use std::ops::Deref;
10 use std::io;
11
newline<W>(out: &mut W, depth: usize) where W: io::Write,12 fn newline<W>(out: &mut W, depth: usize)
13 where
14 W: io::Write,
15 {
16 writeln!(out, "").expect("failed to dump");
17 for i in 0..depth {
18 write!(out, " ").expect("failed to dump");
19 }
20 }
21
22 pub trait ASTDump {
dump_with_atoms<W>( &self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList ) where W: io::Write,23 fn dump_with_atoms<W>(
24 &self,
25 out: &mut W,
26 atoms: &SourceAtomSet,
27 slices: &SourceSliceList
28 )
29 where
30 W: io::Write,
31 {
32 self.dump_with_atoms_at(out, atoms, slices, 0);
33 writeln!(out, "").expect("failed to dump");
34 }
35
dump_with_atoms_at<W>( &self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize, ) where W: io::Write36 fn dump_with_atoms_at<W>(
37 &self,
38 out: &mut W,
39 atoms: &SourceAtomSet,
40 slices: &SourceSliceList,
41 depth: usize,
42 )
43 where W: io::Write;
44 }
45 impl<'alloc> ASTDump for Argument<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write46 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
47 where W: io::Write
48 {
49 match self {
50 Argument::SpreadElement(ast) => {
51 ast.dump_with_atoms_at(out, atoms, slices, depth);
52 }
53 Argument::Expression(ast) => {
54 ast.dump_with_atoms_at(out, atoms, slices, depth);
55 }
56 }
57 }
58 }
59
60 impl<'alloc> ASTDump for Arguments<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write61 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
62 where W: io::Write
63 {
64 write!(out, "(Arguments").expect("failed to dump");
65 write!(out, " ").expect("failed to dump");
66 write!(out, "args=").expect("failed to dump");
67 self.args.dump_with_atoms_at(out, atoms, slices, depth + 1);
68 write!(out, ")").expect("failed to dump");
69 }
70 }
71
72 impl<'alloc> ASTDump for Identifier {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write73 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
74 where W: io::Write
75 {
76 write!(out, "(Identifier").expect("failed to dump");
77 write!(out, " ").expect("failed to dump");
78 write!(out, "value=").expect("failed to dump");
79 self.value.dump_with_atoms_at(out, atoms, slices, depth + 1);
80 write!(out, ")").expect("failed to dump");
81 }
82 }
83
84 impl<'alloc> ASTDump for IdentifierName {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write85 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
86 where W: io::Write
87 {
88 write!(out, "(IdentifierName").expect("failed to dump");
89 write!(out, " ").expect("failed to dump");
90 write!(out, "value=").expect("failed to dump");
91 self.value.dump_with_atoms_at(out, atoms, slices, depth + 1);
92 write!(out, ")").expect("failed to dump");
93 }
94 }
95
96 impl<'alloc> ASTDump for PrivateIdentifier {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write97 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
98 where W: io::Write
99 {
100 write!(out, "(PrivateIdentifier").expect("failed to dump");
101 write!(out, " ").expect("failed to dump");
102 write!(out, "value=").expect("failed to dump");
103 self.value.dump_with_atoms_at(out, atoms, slices, depth + 1);
104 write!(out, ")").expect("failed to dump");
105 }
106 }
107
108 impl<'alloc> ASTDump for Label {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write109 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
110 where W: io::Write
111 {
112 write!(out, "(Label").expect("failed to dump");
113 write!(out, " ").expect("failed to dump");
114 write!(out, "value=").expect("failed to dump");
115 self.value.dump_with_atoms_at(out, atoms, slices, depth + 1);
116 write!(out, ")").expect("failed to dump");
117 }
118 }
119
120 impl<'alloc> ASTDump for VariableDeclarationKind {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write121 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
122 where W: io::Write
123 {
124 match self {
125 VariableDeclarationKind::Var { .. } => {
126 write!(out, "Var").expect("failed to dump");
127 }
128 VariableDeclarationKind::Let { .. } => {
129 write!(out, "Let").expect("failed to dump");
130 }
131 VariableDeclarationKind::Const { .. } => {
132 write!(out, "Const").expect("failed to dump");
133 }
134 }
135 }
136 }
137
138 impl<'alloc> ASTDump for CompoundAssignmentOperator {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write139 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
140 where W: io::Write
141 {
142 match self {
143 CompoundAssignmentOperator::LogicalOr { .. } => {
144 write!(out, "LogicalOr").expect("failed to dump");
145 }
146 CompoundAssignmentOperator::LogicalAnd { .. } => {
147 write!(out, "LogicalAnd").expect("failed to dump");
148 }
149 CompoundAssignmentOperator::Coalesce { .. } => {
150 write!(out, "Coalesce").expect("failed to dump");
151 }
152 CompoundAssignmentOperator::Add { .. } => {
153 write!(out, "Add").expect("failed to dump");
154 }
155 CompoundAssignmentOperator::Sub { .. } => {
156 write!(out, "Sub").expect("failed to dump");
157 }
158 CompoundAssignmentOperator::Mul { .. } => {
159 write!(out, "Mul").expect("failed to dump");
160 }
161 CompoundAssignmentOperator::Div { .. } => {
162 write!(out, "Div").expect("failed to dump");
163 }
164 CompoundAssignmentOperator::Mod { .. } => {
165 write!(out, "Mod").expect("failed to dump");
166 }
167 CompoundAssignmentOperator::Pow { .. } => {
168 write!(out, "Pow").expect("failed to dump");
169 }
170 CompoundAssignmentOperator::LeftShift { .. } => {
171 write!(out, "LeftShift").expect("failed to dump");
172 }
173 CompoundAssignmentOperator::RightShift { .. } => {
174 write!(out, "RightShift").expect("failed to dump");
175 }
176 CompoundAssignmentOperator::RightShiftExt { .. } => {
177 write!(out, "RightShiftExt").expect("failed to dump");
178 }
179 CompoundAssignmentOperator::Or { .. } => {
180 write!(out, "Or").expect("failed to dump");
181 }
182 CompoundAssignmentOperator::Xor { .. } => {
183 write!(out, "Xor").expect("failed to dump");
184 }
185 CompoundAssignmentOperator::And { .. } => {
186 write!(out, "And").expect("failed to dump");
187 }
188 }
189 }
190 }
191
192 impl<'alloc> ASTDump for BinaryOperator {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write193 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
194 where W: io::Write
195 {
196 match self {
197 BinaryOperator::Equals { .. } => {
198 write!(out, "Equals").expect("failed to dump");
199 }
200 BinaryOperator::NotEquals { .. } => {
201 write!(out, "NotEquals").expect("failed to dump");
202 }
203 BinaryOperator::StrictEquals { .. } => {
204 write!(out, "StrictEquals").expect("failed to dump");
205 }
206 BinaryOperator::StrictNotEquals { .. } => {
207 write!(out, "StrictNotEquals").expect("failed to dump");
208 }
209 BinaryOperator::LessThan { .. } => {
210 write!(out, "LessThan").expect("failed to dump");
211 }
212 BinaryOperator::LessThanOrEqual { .. } => {
213 write!(out, "LessThanOrEqual").expect("failed to dump");
214 }
215 BinaryOperator::GreaterThan { .. } => {
216 write!(out, "GreaterThan").expect("failed to dump");
217 }
218 BinaryOperator::GreaterThanOrEqual { .. } => {
219 write!(out, "GreaterThanOrEqual").expect("failed to dump");
220 }
221 BinaryOperator::In { .. } => {
222 write!(out, "In").expect("failed to dump");
223 }
224 BinaryOperator::Instanceof { .. } => {
225 write!(out, "Instanceof").expect("failed to dump");
226 }
227 BinaryOperator::LeftShift { .. } => {
228 write!(out, "LeftShift").expect("failed to dump");
229 }
230 BinaryOperator::RightShift { .. } => {
231 write!(out, "RightShift").expect("failed to dump");
232 }
233 BinaryOperator::RightShiftExt { .. } => {
234 write!(out, "RightShiftExt").expect("failed to dump");
235 }
236 BinaryOperator::Add { .. } => {
237 write!(out, "Add").expect("failed to dump");
238 }
239 BinaryOperator::Sub { .. } => {
240 write!(out, "Sub").expect("failed to dump");
241 }
242 BinaryOperator::Mul { .. } => {
243 write!(out, "Mul").expect("failed to dump");
244 }
245 BinaryOperator::Div { .. } => {
246 write!(out, "Div").expect("failed to dump");
247 }
248 BinaryOperator::Mod { .. } => {
249 write!(out, "Mod").expect("failed to dump");
250 }
251 BinaryOperator::Pow { .. } => {
252 write!(out, "Pow").expect("failed to dump");
253 }
254 BinaryOperator::Comma { .. } => {
255 write!(out, "Comma").expect("failed to dump");
256 }
257 BinaryOperator::Coalesce { .. } => {
258 write!(out, "Coalesce").expect("failed to dump");
259 }
260 BinaryOperator::LogicalOr { .. } => {
261 write!(out, "LogicalOr").expect("failed to dump");
262 }
263 BinaryOperator::LogicalAnd { .. } => {
264 write!(out, "LogicalAnd").expect("failed to dump");
265 }
266 BinaryOperator::BitwiseOr { .. } => {
267 write!(out, "BitwiseOr").expect("failed to dump");
268 }
269 BinaryOperator::BitwiseXor { .. } => {
270 write!(out, "BitwiseXor").expect("failed to dump");
271 }
272 BinaryOperator::BitwiseAnd { .. } => {
273 write!(out, "BitwiseAnd").expect("failed to dump");
274 }
275 }
276 }
277 }
278
279 impl<'alloc> ASTDump for UnaryOperator {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write280 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
281 where W: io::Write
282 {
283 match self {
284 UnaryOperator::Plus { .. } => {
285 write!(out, "Plus").expect("failed to dump");
286 }
287 UnaryOperator::Minus { .. } => {
288 write!(out, "Minus").expect("failed to dump");
289 }
290 UnaryOperator::LogicalNot { .. } => {
291 write!(out, "LogicalNot").expect("failed to dump");
292 }
293 UnaryOperator::BitwiseNot { .. } => {
294 write!(out, "BitwiseNot").expect("failed to dump");
295 }
296 UnaryOperator::Typeof { .. } => {
297 write!(out, "Typeof").expect("failed to dump");
298 }
299 UnaryOperator::Void { .. } => {
300 write!(out, "Void").expect("failed to dump");
301 }
302 UnaryOperator::Delete { .. } => {
303 write!(out, "Delete").expect("failed to dump");
304 }
305 }
306 }
307 }
308
309 impl<'alloc> ASTDump for UpdateOperator {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write310 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
311 where W: io::Write
312 {
313 match self {
314 UpdateOperator::Increment { .. } => {
315 write!(out, "Increment").expect("failed to dump");
316 }
317 UpdateOperator::Decrement { .. } => {
318 write!(out, "Decrement").expect("failed to dump");
319 }
320 }
321 }
322 }
323
324 impl<'alloc> ASTDump for Function<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write325 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
326 where W: io::Write
327 {
328 write!(out, "(Function").expect("failed to dump");
329 newline(out, depth + 1);
330 write!(out, "name=").expect("failed to dump");
331 self.name.dump_with_atoms_at(out, atoms, slices, depth + 1);
332 newline(out, depth + 1);
333 write!(out, "is_async=").expect("failed to dump");
334 self.is_async.dump_with_atoms_at(out, atoms, slices, depth + 1);
335 newline(out, depth + 1);
336 write!(out, "is_generator=").expect("failed to dump");
337 self.is_generator.dump_with_atoms_at(out, atoms, slices, depth + 1);
338 newline(out, depth + 1);
339 write!(out, "params=").expect("failed to dump");
340 self.params.dump_with_atoms_at(out, atoms, slices, depth + 1);
341 newline(out, depth + 1);
342 write!(out, "body=").expect("failed to dump");
343 self.body.dump_with_atoms_at(out, atoms, slices, depth + 1);
344 write!(out, ")").expect("failed to dump");
345 }
346 }
347
348 impl<'alloc> ASTDump for Program<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write349 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
350 where W: io::Write
351 {
352 match self {
353 Program::Module(ast) => {
354 ast.dump_with_atoms_at(out, atoms, slices, depth);
355 }
356 Program::Script(ast) => {
357 ast.dump_with_atoms_at(out, atoms, slices, depth);
358 }
359 }
360 }
361 }
362
363 impl<'alloc> ASTDump for IfStatement<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write364 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
365 where W: io::Write
366 {
367 write!(out, "(IfStatement").expect("failed to dump");
368 newline(out, depth + 1);
369 write!(out, "test=").expect("failed to dump");
370 self.test.dump_with_atoms_at(out, atoms, slices, depth + 1);
371 newline(out, depth + 1);
372 write!(out, "consequent=").expect("failed to dump");
373 self.consequent.dump_with_atoms_at(out, atoms, slices, depth + 1);
374 newline(out, depth + 1);
375 write!(out, "alternate=").expect("failed to dump");
376 self.alternate.dump_with_atoms_at(out, atoms, slices, depth + 1);
377 write!(out, ")").expect("failed to dump");
378 }
379 }
380
381 impl<'alloc> ASTDump for Statement<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write382 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
383 where W: io::Write
384 {
385 match self {
386 Statement::BlockStatement { block, .. } => {
387 write!(out, "(BlockStatement").expect("failed to dump");
388 write!(out, " ").expect("failed to dump");
389 write!(out, "block=").expect("failed to dump");
390 block.dump_with_atoms_at(out, atoms, slices, depth + 1);
391 write!(out, ")").expect("failed to dump");
392 }
393 Statement::BreakStatement { label, .. } => {
394 write!(out, "(BreakStatement").expect("failed to dump");
395 write!(out, " ").expect("failed to dump");
396 write!(out, "label=").expect("failed to dump");
397 label.dump_with_atoms_at(out, atoms, slices, depth + 1);
398 write!(out, ")").expect("failed to dump");
399 }
400 Statement::ContinueStatement { label, .. } => {
401 write!(out, "(ContinueStatement").expect("failed to dump");
402 write!(out, " ").expect("failed to dump");
403 write!(out, "label=").expect("failed to dump");
404 label.dump_with_atoms_at(out, atoms, slices, depth + 1);
405 write!(out, ")").expect("failed to dump");
406 }
407 Statement::DebuggerStatement { .. } => {
408 write!(out, "DebuggerStatement").expect("failed to dump");
409 }
410 Statement::DoWhileStatement { block, test, .. } => {
411 write!(out, "(DoWhileStatement").expect("failed to dump");
412 newline(out, depth + 1);
413 write!(out, "block=").expect("failed to dump");
414 block.dump_with_atoms_at(out, atoms, slices, depth + 1);
415 newline(out, depth + 1);
416 write!(out, "test=").expect("failed to dump");
417 test.dump_with_atoms_at(out, atoms, slices, depth + 1);
418 write!(out, ")").expect("failed to dump");
419 }
420 Statement::EmptyStatement { .. } => {
421 write!(out, "EmptyStatement").expect("failed to dump");
422 }
423 Statement::ExpressionStatement(ast) => {
424 ast.dump_with_atoms_at(out, atoms, slices, depth);
425 }
426 Statement::ForInStatement { left, right, block, .. } => {
427 write!(out, "(ForInStatement").expect("failed to dump");
428 newline(out, depth + 1);
429 write!(out, "left=").expect("failed to dump");
430 left.dump_with_atoms_at(out, atoms, slices, depth + 1);
431 newline(out, depth + 1);
432 write!(out, "right=").expect("failed to dump");
433 right.dump_with_atoms_at(out, atoms, slices, depth + 1);
434 newline(out, depth + 1);
435 write!(out, "block=").expect("failed to dump");
436 block.dump_with_atoms_at(out, atoms, slices, depth + 1);
437 write!(out, ")").expect("failed to dump");
438 }
439 Statement::ForOfStatement { left, right, block, .. } => {
440 write!(out, "(ForOfStatement").expect("failed to dump");
441 newline(out, depth + 1);
442 write!(out, "left=").expect("failed to dump");
443 left.dump_with_atoms_at(out, atoms, slices, depth + 1);
444 newline(out, depth + 1);
445 write!(out, "right=").expect("failed to dump");
446 right.dump_with_atoms_at(out, atoms, slices, depth + 1);
447 newline(out, depth + 1);
448 write!(out, "block=").expect("failed to dump");
449 block.dump_with_atoms_at(out, atoms, slices, depth + 1);
450 write!(out, ")").expect("failed to dump");
451 }
452 Statement::ForStatement { init, test, update, block, .. } => {
453 write!(out, "(ForStatement").expect("failed to dump");
454 newline(out, depth + 1);
455 write!(out, "init=").expect("failed to dump");
456 init.dump_with_atoms_at(out, atoms, slices, depth + 1);
457 newline(out, depth + 1);
458 write!(out, "test=").expect("failed to dump");
459 test.dump_with_atoms_at(out, atoms, slices, depth + 1);
460 newline(out, depth + 1);
461 write!(out, "update=").expect("failed to dump");
462 update.dump_with_atoms_at(out, atoms, slices, depth + 1);
463 newline(out, depth + 1);
464 write!(out, "block=").expect("failed to dump");
465 block.dump_with_atoms_at(out, atoms, slices, depth + 1);
466 write!(out, ")").expect("failed to dump");
467 }
468 Statement::IfStatement(ast) => {
469 ast.dump_with_atoms_at(out, atoms, slices, depth);
470 }
471 Statement::LabelledStatement { label, body, .. } => {
472 write!(out, "(LabelledStatement").expect("failed to dump");
473 newline(out, depth + 1);
474 write!(out, "label=").expect("failed to dump");
475 label.dump_with_atoms_at(out, atoms, slices, depth + 1);
476 newline(out, depth + 1);
477 write!(out, "body=").expect("failed to dump");
478 body.dump_with_atoms_at(out, atoms, slices, depth + 1);
479 write!(out, ")").expect("failed to dump");
480 }
481 Statement::ReturnStatement { expression, .. } => {
482 write!(out, "(ReturnStatement").expect("failed to dump");
483 write!(out, " ").expect("failed to dump");
484 write!(out, "expression=").expect("failed to dump");
485 expression.dump_with_atoms_at(out, atoms, slices, depth + 1);
486 write!(out, ")").expect("failed to dump");
487 }
488 Statement::SwitchStatement { discriminant, cases, .. } => {
489 write!(out, "(SwitchStatement").expect("failed to dump");
490 newline(out, depth + 1);
491 write!(out, "discriminant=").expect("failed to dump");
492 discriminant.dump_with_atoms_at(out, atoms, slices, depth + 1);
493 newline(out, depth + 1);
494 write!(out, "cases=").expect("failed to dump");
495 cases.dump_with_atoms_at(out, atoms, slices, depth + 1);
496 write!(out, ")").expect("failed to dump");
497 }
498 Statement::SwitchStatementWithDefault { discriminant, pre_default_cases, default_case, post_default_cases, .. } => {
499 write!(out, "(SwitchStatementWithDefault").expect("failed to dump");
500 newline(out, depth + 1);
501 write!(out, "discriminant=").expect("failed to dump");
502 discriminant.dump_with_atoms_at(out, atoms, slices, depth + 1);
503 newline(out, depth + 1);
504 write!(out, "pre_default_cases=").expect("failed to dump");
505 pre_default_cases.dump_with_atoms_at(out, atoms, slices, depth + 1);
506 newline(out, depth + 1);
507 write!(out, "default_case=").expect("failed to dump");
508 default_case.dump_with_atoms_at(out, atoms, slices, depth + 1);
509 newline(out, depth + 1);
510 write!(out, "post_default_cases=").expect("failed to dump");
511 post_default_cases.dump_with_atoms_at(out, atoms, slices, depth + 1);
512 write!(out, ")").expect("failed to dump");
513 }
514 Statement::ThrowStatement { expression, .. } => {
515 write!(out, "(ThrowStatement").expect("failed to dump");
516 write!(out, " ").expect("failed to dump");
517 write!(out, "expression=").expect("failed to dump");
518 expression.dump_with_atoms_at(out, atoms, slices, depth + 1);
519 write!(out, ")").expect("failed to dump");
520 }
521 Statement::TryCatchStatement { body, catch_clause, .. } => {
522 write!(out, "(TryCatchStatement").expect("failed to dump");
523 newline(out, depth + 1);
524 write!(out, "body=").expect("failed to dump");
525 body.dump_with_atoms_at(out, atoms, slices, depth + 1);
526 newline(out, depth + 1);
527 write!(out, "catch_clause=").expect("failed to dump");
528 catch_clause.dump_with_atoms_at(out, atoms, slices, depth + 1);
529 write!(out, ")").expect("failed to dump");
530 }
531 Statement::TryFinallyStatement { body, catch_clause, finalizer, .. } => {
532 write!(out, "(TryFinallyStatement").expect("failed to dump");
533 newline(out, depth + 1);
534 write!(out, "body=").expect("failed to dump");
535 body.dump_with_atoms_at(out, atoms, slices, depth + 1);
536 newline(out, depth + 1);
537 write!(out, "catch_clause=").expect("failed to dump");
538 catch_clause.dump_with_atoms_at(out, atoms, slices, depth + 1);
539 newline(out, depth + 1);
540 write!(out, "finalizer=").expect("failed to dump");
541 finalizer.dump_with_atoms_at(out, atoms, slices, depth + 1);
542 write!(out, ")").expect("failed to dump");
543 }
544 Statement::WhileStatement { test, block, .. } => {
545 write!(out, "(WhileStatement").expect("failed to dump");
546 newline(out, depth + 1);
547 write!(out, "test=").expect("failed to dump");
548 test.dump_with_atoms_at(out, atoms, slices, depth + 1);
549 newline(out, depth + 1);
550 write!(out, "block=").expect("failed to dump");
551 block.dump_with_atoms_at(out, atoms, slices, depth + 1);
552 write!(out, ")").expect("failed to dump");
553 }
554 Statement::WithStatement { object, body, .. } => {
555 write!(out, "(WithStatement").expect("failed to dump");
556 newline(out, depth + 1);
557 write!(out, "object=").expect("failed to dump");
558 object.dump_with_atoms_at(out, atoms, slices, depth + 1);
559 newline(out, depth + 1);
560 write!(out, "body=").expect("failed to dump");
561 body.dump_with_atoms_at(out, atoms, slices, depth + 1);
562 write!(out, ")").expect("failed to dump");
563 }
564 Statement::VariableDeclarationStatement(ast) => {
565 ast.dump_with_atoms_at(out, atoms, slices, depth);
566 }
567 Statement::FunctionDeclaration(ast) => {
568 ast.dump_with_atoms_at(out, atoms, slices, depth);
569 }
570 Statement::ClassDeclaration(ast) => {
571 ast.dump_with_atoms_at(out, atoms, slices, depth);
572 }
573 }
574 }
575 }
576
577 impl<'alloc> ASTDump for Expression<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write578 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
579 where W: io::Write
580 {
581 match self {
582 Expression::MemberExpression(ast) => {
583 ast.dump_with_atoms_at(out, atoms, slices, depth);
584 }
585 Expression::ClassExpression(ast) => {
586 ast.dump_with_atoms_at(out, atoms, slices, depth);
587 }
588 Expression::LiteralBooleanExpression { value, .. } => {
589 write!(out, "(LiteralBooleanExpression").expect("failed to dump");
590 write!(out, " ").expect("failed to dump");
591 write!(out, "value=").expect("failed to dump");
592 value.dump_with_atoms_at(out, atoms, slices, depth + 1);
593 write!(out, ")").expect("failed to dump");
594 }
595 Expression::LiteralInfinityExpression { .. } => {
596 write!(out, "LiteralInfinityExpression").expect("failed to dump");
597 }
598 Expression::LiteralNullExpression { .. } => {
599 write!(out, "LiteralNullExpression").expect("failed to dump");
600 }
601 Expression::LiteralNumericExpression(ast) => {
602 ast.dump_with_atoms_at(out, atoms, slices, depth);
603 }
604 Expression::LiteralRegExpExpression { pattern, global, ignore_case, multi_line, dot_all, sticky, unicode, .. } => {
605 write!(out, "(LiteralRegExpExpression").expect("failed to dump");
606 newline(out, depth + 1);
607 write!(out, "pattern=").expect("failed to dump");
608 pattern.dump_with_atoms_at(out, atoms, slices, depth + 1);
609 newline(out, depth + 1);
610 write!(out, "global=").expect("failed to dump");
611 global.dump_with_atoms_at(out, atoms, slices, depth + 1);
612 newline(out, depth + 1);
613 write!(out, "ignore_case=").expect("failed to dump");
614 ignore_case.dump_with_atoms_at(out, atoms, slices, depth + 1);
615 newline(out, depth + 1);
616 write!(out, "multi_line=").expect("failed to dump");
617 multi_line.dump_with_atoms_at(out, atoms, slices, depth + 1);
618 newline(out, depth + 1);
619 write!(out, "dot_all=").expect("failed to dump");
620 dot_all.dump_with_atoms_at(out, atoms, slices, depth + 1);
621 newline(out, depth + 1);
622 write!(out, "sticky=").expect("failed to dump");
623 sticky.dump_with_atoms_at(out, atoms, slices, depth + 1);
624 newline(out, depth + 1);
625 write!(out, "unicode=").expect("failed to dump");
626 unicode.dump_with_atoms_at(out, atoms, slices, depth + 1);
627 write!(out, ")").expect("failed to dump");
628 }
629 Expression::LiteralStringExpression { value, .. } => {
630 write!(out, "(LiteralStringExpression").expect("failed to dump");
631 write!(out, " ").expect("failed to dump");
632 write!(out, "value=").expect("failed to dump");
633 value.dump_with_atoms_at(out, atoms, slices, depth + 1);
634 write!(out, ")").expect("failed to dump");
635 }
636 Expression::ArrayExpression(ast) => {
637 ast.dump_with_atoms_at(out, atoms, slices, depth);
638 }
639 Expression::ArrowExpression { is_async, params, body, .. } => {
640 write!(out, "(ArrowExpression").expect("failed to dump");
641 newline(out, depth + 1);
642 write!(out, "is_async=").expect("failed to dump");
643 is_async.dump_with_atoms_at(out, atoms, slices, depth + 1);
644 newline(out, depth + 1);
645 write!(out, "params=").expect("failed to dump");
646 params.dump_with_atoms_at(out, atoms, slices, depth + 1);
647 newline(out, depth + 1);
648 write!(out, "body=").expect("failed to dump");
649 body.dump_with_atoms_at(out, atoms, slices, depth + 1);
650 write!(out, ")").expect("failed to dump");
651 }
652 Expression::AssignmentExpression { binding, expression, .. } => {
653 write!(out, "(AssignmentExpression").expect("failed to dump");
654 newline(out, depth + 1);
655 write!(out, "binding=").expect("failed to dump");
656 binding.dump_with_atoms_at(out, atoms, slices, depth + 1);
657 newline(out, depth + 1);
658 write!(out, "expression=").expect("failed to dump");
659 expression.dump_with_atoms_at(out, atoms, slices, depth + 1);
660 write!(out, ")").expect("failed to dump");
661 }
662 Expression::BinaryExpression { operator, left, right, .. } => {
663 write!(out, "(BinaryExpression").expect("failed to dump");
664 newline(out, depth + 1);
665 write!(out, "operator=").expect("failed to dump");
666 operator.dump_with_atoms_at(out, atoms, slices, depth + 1);
667 newline(out, depth + 1);
668 write!(out, "left=").expect("failed to dump");
669 left.dump_with_atoms_at(out, atoms, slices, depth + 1);
670 newline(out, depth + 1);
671 write!(out, "right=").expect("failed to dump");
672 right.dump_with_atoms_at(out, atoms, slices, depth + 1);
673 write!(out, ")").expect("failed to dump");
674 }
675 Expression::CallExpression(ast) => {
676 ast.dump_with_atoms_at(out, atoms, slices, depth);
677 }
678 Expression::CompoundAssignmentExpression { operator, binding, expression, .. } => {
679 write!(out, "(CompoundAssignmentExpression").expect("failed to dump");
680 newline(out, depth + 1);
681 write!(out, "operator=").expect("failed to dump");
682 operator.dump_with_atoms_at(out, atoms, slices, depth + 1);
683 newline(out, depth + 1);
684 write!(out, "binding=").expect("failed to dump");
685 binding.dump_with_atoms_at(out, atoms, slices, depth + 1);
686 newline(out, depth + 1);
687 write!(out, "expression=").expect("failed to dump");
688 expression.dump_with_atoms_at(out, atoms, slices, depth + 1);
689 write!(out, ")").expect("failed to dump");
690 }
691 Expression::ConditionalExpression { test, consequent, alternate, .. } => {
692 write!(out, "(ConditionalExpression").expect("failed to dump");
693 newline(out, depth + 1);
694 write!(out, "test=").expect("failed to dump");
695 test.dump_with_atoms_at(out, atoms, slices, depth + 1);
696 newline(out, depth + 1);
697 write!(out, "consequent=").expect("failed to dump");
698 consequent.dump_with_atoms_at(out, atoms, slices, depth + 1);
699 newline(out, depth + 1);
700 write!(out, "alternate=").expect("failed to dump");
701 alternate.dump_with_atoms_at(out, atoms, slices, depth + 1);
702 write!(out, ")").expect("failed to dump");
703 }
704 Expression::FunctionExpression(ast) => {
705 ast.dump_with_atoms_at(out, atoms, slices, depth);
706 }
707 Expression::IdentifierExpression(ast) => {
708 ast.dump_with_atoms_at(out, atoms, slices, depth);
709 }
710 Expression::NewExpression { callee, arguments, .. } => {
711 write!(out, "(NewExpression").expect("failed to dump");
712 newline(out, depth + 1);
713 write!(out, "callee=").expect("failed to dump");
714 callee.dump_with_atoms_at(out, atoms, slices, depth + 1);
715 newline(out, depth + 1);
716 write!(out, "arguments=").expect("failed to dump");
717 arguments.dump_with_atoms_at(out, atoms, slices, depth + 1);
718 write!(out, ")").expect("failed to dump");
719 }
720 Expression::NewTargetExpression { .. } => {
721 write!(out, "NewTargetExpression").expect("failed to dump");
722 }
723 Expression::ObjectExpression(ast) => {
724 ast.dump_with_atoms_at(out, atoms, slices, depth);
725 }
726 Expression::OptionalExpression { object, tail, .. } => {
727 write!(out, "(OptionalExpression").expect("failed to dump");
728 newline(out, depth + 1);
729 write!(out, "object=").expect("failed to dump");
730 object.dump_with_atoms_at(out, atoms, slices, depth + 1);
731 newline(out, depth + 1);
732 write!(out, "tail=").expect("failed to dump");
733 tail.dump_with_atoms_at(out, atoms, slices, depth + 1);
734 write!(out, ")").expect("failed to dump");
735 }
736 Expression::OptionalChain(ast) => {
737 ast.dump_with_atoms_at(out, atoms, slices, depth);
738 }
739 Expression::UnaryExpression { operator, operand, .. } => {
740 write!(out, "(UnaryExpression").expect("failed to dump");
741 newline(out, depth + 1);
742 write!(out, "operator=").expect("failed to dump");
743 operator.dump_with_atoms_at(out, atoms, slices, depth + 1);
744 newline(out, depth + 1);
745 write!(out, "operand=").expect("failed to dump");
746 operand.dump_with_atoms_at(out, atoms, slices, depth + 1);
747 write!(out, ")").expect("failed to dump");
748 }
749 Expression::TemplateExpression(ast) => {
750 ast.dump_with_atoms_at(out, atoms, slices, depth);
751 }
752 Expression::ThisExpression { .. } => {
753 write!(out, "ThisExpression").expect("failed to dump");
754 }
755 Expression::UpdateExpression { is_prefix, operator, operand, .. } => {
756 write!(out, "(UpdateExpression").expect("failed to dump");
757 newline(out, depth + 1);
758 write!(out, "is_prefix=").expect("failed to dump");
759 is_prefix.dump_with_atoms_at(out, atoms, slices, depth + 1);
760 newline(out, depth + 1);
761 write!(out, "operator=").expect("failed to dump");
762 operator.dump_with_atoms_at(out, atoms, slices, depth + 1);
763 newline(out, depth + 1);
764 write!(out, "operand=").expect("failed to dump");
765 operand.dump_with_atoms_at(out, atoms, slices, depth + 1);
766 write!(out, ")").expect("failed to dump");
767 }
768 Expression::YieldExpression { expression, .. } => {
769 write!(out, "(YieldExpression").expect("failed to dump");
770 write!(out, " ").expect("failed to dump");
771 write!(out, "expression=").expect("failed to dump");
772 expression.dump_with_atoms_at(out, atoms, slices, depth + 1);
773 write!(out, ")").expect("failed to dump");
774 }
775 Expression::YieldGeneratorExpression { expression, .. } => {
776 write!(out, "(YieldGeneratorExpression").expect("failed to dump");
777 write!(out, " ").expect("failed to dump");
778 write!(out, "expression=").expect("failed to dump");
779 expression.dump_with_atoms_at(out, atoms, slices, depth + 1);
780 write!(out, ")").expect("failed to dump");
781 }
782 Expression::AwaitExpression { expression, .. } => {
783 write!(out, "(AwaitExpression").expect("failed to dump");
784 write!(out, " ").expect("failed to dump");
785 write!(out, "expression=").expect("failed to dump");
786 expression.dump_with_atoms_at(out, atoms, slices, depth + 1);
787 write!(out, ")").expect("failed to dump");
788 }
789 Expression::ImportCallExpression { argument, .. } => {
790 write!(out, "(ImportCallExpression").expect("failed to dump");
791 write!(out, " ").expect("failed to dump");
792 write!(out, "argument=").expect("failed to dump");
793 argument.dump_with_atoms_at(out, atoms, slices, depth + 1);
794 write!(out, ")").expect("failed to dump");
795 }
796 }
797 }
798 }
799
800 impl<'alloc> ASTDump for MemberExpression<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write801 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
802 where W: io::Write
803 {
804 match self {
805 MemberExpression::ComputedMemberExpression(ast) => {
806 ast.dump_with_atoms_at(out, atoms, slices, depth);
807 }
808 MemberExpression::StaticMemberExpression(ast) => {
809 ast.dump_with_atoms_at(out, atoms, slices, depth);
810 }
811 MemberExpression::PrivateFieldExpression(ast) => {
812 ast.dump_with_atoms_at(out, atoms, slices, depth);
813 }
814 }
815 }
816 }
817
818 impl<'alloc> ASTDump for OptionalChain<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write819 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
820 where W: io::Write
821 {
822 match self {
823 OptionalChain::ComputedMemberExpressionTail { expression, .. } => {
824 write!(out, "(ComputedMemberExpressionTail").expect("failed to dump");
825 write!(out, " ").expect("failed to dump");
826 write!(out, "expression=").expect("failed to dump");
827 expression.dump_with_atoms_at(out, atoms, slices, depth + 1);
828 write!(out, ")").expect("failed to dump");
829 }
830 OptionalChain::StaticMemberExpressionTail { property, .. } => {
831 write!(out, "(StaticMemberExpressionTail").expect("failed to dump");
832 write!(out, " ").expect("failed to dump");
833 write!(out, "property=").expect("failed to dump");
834 property.dump_with_atoms_at(out, atoms, slices, depth + 1);
835 write!(out, ")").expect("failed to dump");
836 }
837 OptionalChain::PrivateFieldExpressionTail { field, .. } => {
838 write!(out, "(PrivateFieldExpressionTail").expect("failed to dump");
839 write!(out, " ").expect("failed to dump");
840 write!(out, "field=").expect("failed to dump");
841 field.dump_with_atoms_at(out, atoms, slices, depth + 1);
842 write!(out, ")").expect("failed to dump");
843 }
844 OptionalChain::CallExpressionTail { arguments, .. } => {
845 write!(out, "(CallExpressionTail").expect("failed to dump");
846 write!(out, " ").expect("failed to dump");
847 write!(out, "arguments=").expect("failed to dump");
848 arguments.dump_with_atoms_at(out, atoms, slices, depth + 1);
849 write!(out, ")").expect("failed to dump");
850 }
851 OptionalChain::ComputedMemberExpression(ast) => {
852 ast.dump_with_atoms_at(out, atoms, slices, depth);
853 }
854 OptionalChain::StaticMemberExpression(ast) => {
855 ast.dump_with_atoms_at(out, atoms, slices, depth);
856 }
857 OptionalChain::PrivateFieldExpression(ast) => {
858 ast.dump_with_atoms_at(out, atoms, slices, depth);
859 }
860 OptionalChain::CallExpression(ast) => {
861 ast.dump_with_atoms_at(out, atoms, slices, depth);
862 }
863 }
864 }
865 }
866
867 impl<'alloc> ASTDump for PropertyName<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write868 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
869 where W: io::Write
870 {
871 match self {
872 PropertyName::ComputedPropertyName(ast) => {
873 ast.dump_with_atoms_at(out, atoms, slices, depth);
874 }
875 PropertyName::StaticPropertyName(ast) => {
876 ast.dump_with_atoms_at(out, atoms, slices, depth);
877 }
878 PropertyName::StaticNumericPropertyName(ast) => {
879 ast.dump_with_atoms_at(out, atoms, slices, depth);
880 }
881 }
882 }
883 }
884
885 impl<'alloc> ASTDump for CallExpression<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write886 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
887 where W: io::Write
888 {
889 write!(out, "(CallExpression").expect("failed to dump");
890 newline(out, depth + 1);
891 write!(out, "callee=").expect("failed to dump");
892 self.callee.dump_with_atoms_at(out, atoms, slices, depth + 1);
893 newline(out, depth + 1);
894 write!(out, "arguments=").expect("failed to dump");
895 self.arguments.dump_with_atoms_at(out, atoms, slices, depth + 1);
896 write!(out, ")").expect("failed to dump");
897 }
898 }
899
900 impl<'alloc> ASTDump for ClassElementName<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write901 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
902 where W: io::Write
903 {
904 match self {
905 ClassElementName::ComputedPropertyName(ast) => {
906 ast.dump_with_atoms_at(out, atoms, slices, depth);
907 }
908 ClassElementName::StaticPropertyName(ast) => {
909 ast.dump_with_atoms_at(out, atoms, slices, depth);
910 }
911 ClassElementName::StaticNumericPropertyName(ast) => {
912 ast.dump_with_atoms_at(out, atoms, slices, depth);
913 }
914 ClassElementName::PrivateFieldName(ast) => {
915 ast.dump_with_atoms_at(out, atoms, slices, depth);
916 }
917 }
918 }
919 }
920
921 impl<'alloc> ASTDump for ObjectProperty<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write922 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
923 where W: io::Write
924 {
925 match self {
926 ObjectProperty::NamedObjectProperty(ast) => {
927 ast.dump_with_atoms_at(out, atoms, slices, depth);
928 }
929 ObjectProperty::ShorthandProperty(ast) => {
930 ast.dump_with_atoms_at(out, atoms, slices, depth);
931 }
932 ObjectProperty::SpreadProperty(ast) => {
933 ast.dump_with_atoms_at(out, atoms, slices, depth);
934 }
935 }
936 }
937 }
938
939 impl<'alloc> ASTDump for NamedObjectProperty<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write940 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
941 where W: io::Write
942 {
943 match self {
944 NamedObjectProperty::MethodDefinition(ast) => {
945 ast.dump_with_atoms_at(out, atoms, slices, depth);
946 }
947 NamedObjectProperty::DataProperty(ast) => {
948 ast.dump_with_atoms_at(out, atoms, slices, depth);
949 }
950 }
951 }
952 }
953
954 impl<'alloc> ASTDump for MethodDefinition<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write955 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
956 where W: io::Write
957 {
958 match self {
959 MethodDefinition::Method(ast) => {
960 ast.dump_with_atoms_at(out, atoms, slices, depth);
961 }
962 MethodDefinition::Getter(ast) => {
963 ast.dump_with_atoms_at(out, atoms, slices, depth);
964 }
965 MethodDefinition::Setter(ast) => {
966 ast.dump_with_atoms_at(out, atoms, slices, depth);
967 }
968 }
969 }
970 }
971
972 impl<'alloc> ASTDump for ImportDeclaration<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write973 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
974 where W: io::Write
975 {
976 match self {
977 ImportDeclaration::Import(ast) => {
978 ast.dump_with_atoms_at(out, atoms, slices, depth);
979 }
980 ImportDeclaration::ImportNamespace(ast) => {
981 ast.dump_with_atoms_at(out, atoms, slices, depth);
982 }
983 }
984 }
985 }
986
987 impl<'alloc> ASTDump for ExportDeclaration<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write988 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
989 where W: io::Write
990 {
991 match self {
992 ExportDeclaration::ExportAllFrom(ast) => {
993 ast.dump_with_atoms_at(out, atoms, slices, depth);
994 }
995 ExportDeclaration::ExportFrom(ast) => {
996 ast.dump_with_atoms_at(out, atoms, slices, depth);
997 }
998 ExportDeclaration::ExportLocals(ast) => {
999 ast.dump_with_atoms_at(out, atoms, slices, depth);
1000 }
1001 ExportDeclaration::Export(ast) => {
1002 ast.dump_with_atoms_at(out, atoms, slices, depth);
1003 }
1004 ExportDeclaration::ExportDefault(ast) => {
1005 ast.dump_with_atoms_at(out, atoms, slices, depth);
1006 }
1007 }
1008 }
1009 }
1010
1011 impl<'alloc> ASTDump for VariableReference {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1012 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1013 where W: io::Write
1014 {
1015 match self {
1016 VariableReference::BindingIdentifier(ast) => {
1017 ast.dump_with_atoms_at(out, atoms, slices, depth);
1018 }
1019 VariableReference::AssignmentTargetIdentifier(ast) => {
1020 ast.dump_with_atoms_at(out, atoms, slices, depth);
1021 }
1022 }
1023 }
1024 }
1025
1026 impl<'alloc> ASTDump for BindingPattern<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1027 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1028 where W: io::Write
1029 {
1030 match self {
1031 BindingPattern::ObjectBinding(ast) => {
1032 ast.dump_with_atoms_at(out, atoms, slices, depth);
1033 }
1034 BindingPattern::ArrayBinding(ast) => {
1035 ast.dump_with_atoms_at(out, atoms, slices, depth);
1036 }
1037 }
1038 }
1039 }
1040
1041 impl<'alloc> ASTDump for Binding<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1042 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1043 where W: io::Write
1044 {
1045 match self {
1046 Binding::BindingPattern(ast) => {
1047 ast.dump_with_atoms_at(out, atoms, slices, depth);
1048 }
1049 Binding::BindingIdentifier(ast) => {
1050 ast.dump_with_atoms_at(out, atoms, slices, depth);
1051 }
1052 }
1053 }
1054 }
1055
1056 impl<'alloc> ASTDump for SimpleAssignmentTarget<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1057 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1058 where W: io::Write
1059 {
1060 match self {
1061 SimpleAssignmentTarget::AssignmentTargetIdentifier(ast) => {
1062 ast.dump_with_atoms_at(out, atoms, slices, depth);
1063 }
1064 SimpleAssignmentTarget::MemberAssignmentTarget(ast) => {
1065 ast.dump_with_atoms_at(out, atoms, slices, depth);
1066 }
1067 }
1068 }
1069 }
1070
1071 impl<'alloc> ASTDump for AssignmentTargetPattern<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1072 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1073 where W: io::Write
1074 {
1075 match self {
1076 AssignmentTargetPattern::ArrayAssignmentTarget(ast) => {
1077 ast.dump_with_atoms_at(out, atoms, slices, depth);
1078 }
1079 AssignmentTargetPattern::ObjectAssignmentTarget(ast) => {
1080 ast.dump_with_atoms_at(out, atoms, slices, depth);
1081 }
1082 }
1083 }
1084 }
1085
1086 impl<'alloc> ASTDump for AssignmentTarget<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1087 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1088 where W: io::Write
1089 {
1090 match self {
1091 AssignmentTarget::AssignmentTargetPattern(ast) => {
1092 ast.dump_with_atoms_at(out, atoms, slices, depth);
1093 }
1094 AssignmentTarget::SimpleAssignmentTarget(ast) => {
1095 ast.dump_with_atoms_at(out, atoms, slices, depth);
1096 }
1097 }
1098 }
1099 }
1100
1101 impl<'alloc> ASTDump for Parameter<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1102 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1103 where W: io::Write
1104 {
1105 match self {
1106 Parameter::Binding(ast) => {
1107 ast.dump_with_atoms_at(out, atoms, slices, depth);
1108 }
1109 Parameter::BindingWithDefault(ast) => {
1110 ast.dump_with_atoms_at(out, atoms, slices, depth);
1111 }
1112 }
1113 }
1114 }
1115
1116 impl<'alloc> ASTDump for BindingWithDefault<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1117 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1118 where W: io::Write
1119 {
1120 write!(out, "(BindingWithDefault").expect("failed to dump");
1121 newline(out, depth + 1);
1122 write!(out, "binding=").expect("failed to dump");
1123 self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1);
1124 newline(out, depth + 1);
1125 write!(out, "init=").expect("failed to dump");
1126 self.init.dump_with_atoms_at(out, atoms, slices, depth + 1);
1127 write!(out, ")").expect("failed to dump");
1128 }
1129 }
1130
1131 impl<'alloc> ASTDump for BindingIdentifier {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1132 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1133 where W: io::Write
1134 {
1135 write!(out, "(BindingIdentifier").expect("failed to dump");
1136 write!(out, " ").expect("failed to dump");
1137 write!(out, "name=").expect("failed to dump");
1138 self.name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1139 write!(out, ")").expect("failed to dump");
1140 }
1141 }
1142
1143 impl<'alloc> ASTDump for AssignmentTargetIdentifier {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1144 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1145 where W: io::Write
1146 {
1147 write!(out, "(AssignmentTargetIdentifier").expect("failed to dump");
1148 write!(out, " ").expect("failed to dump");
1149 write!(out, "name=").expect("failed to dump");
1150 self.name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1151 write!(out, ")").expect("failed to dump");
1152 }
1153 }
1154
1155 impl<'alloc> ASTDump for ExpressionOrSuper<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1156 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1157 where W: io::Write
1158 {
1159 match self {
1160 ExpressionOrSuper::Expression(ast) => {
1161 ast.dump_with_atoms_at(out, atoms, slices, depth);
1162 }
1163 ExpressionOrSuper::Super { .. } => {
1164 write!(out, "Super").expect("failed to dump");
1165 }
1166 }
1167 }
1168 }
1169
1170 impl<'alloc> ASTDump for MemberAssignmentTarget<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1171 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1172 where W: io::Write
1173 {
1174 match self {
1175 MemberAssignmentTarget::ComputedMemberAssignmentTarget(ast) => {
1176 ast.dump_with_atoms_at(out, atoms, slices, depth);
1177 }
1178 MemberAssignmentTarget::PrivateFieldAssignmentTarget(ast) => {
1179 ast.dump_with_atoms_at(out, atoms, slices, depth);
1180 }
1181 MemberAssignmentTarget::StaticMemberAssignmentTarget(ast) => {
1182 ast.dump_with_atoms_at(out, atoms, slices, depth);
1183 }
1184 }
1185 }
1186 }
1187
1188 impl<'alloc> ASTDump for ComputedMemberAssignmentTarget<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1189 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1190 where W: io::Write
1191 {
1192 write!(out, "(ComputedMemberAssignmentTarget").expect("failed to dump");
1193 newline(out, depth + 1);
1194 write!(out, "object=").expect("failed to dump");
1195 self.object.dump_with_atoms_at(out, atoms, slices, depth + 1);
1196 newline(out, depth + 1);
1197 write!(out, "expression=").expect("failed to dump");
1198 self.expression.dump_with_atoms_at(out, atoms, slices, depth + 1);
1199 write!(out, ")").expect("failed to dump");
1200 }
1201 }
1202
1203 impl<'alloc> ASTDump for PrivateFieldAssignmentTarget<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1204 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1205 where W: io::Write
1206 {
1207 write!(out, "(PrivateFieldAssignmentTarget").expect("failed to dump");
1208 newline(out, depth + 1);
1209 write!(out, "object=").expect("failed to dump");
1210 self.object.dump_with_atoms_at(out, atoms, slices, depth + 1);
1211 newline(out, depth + 1);
1212 write!(out, "field=").expect("failed to dump");
1213 self.field.dump_with_atoms_at(out, atoms, slices, depth + 1);
1214 write!(out, ")").expect("failed to dump");
1215 }
1216 }
1217
1218 impl<'alloc> ASTDump for StaticMemberAssignmentTarget<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1219 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1220 where W: io::Write
1221 {
1222 write!(out, "(StaticMemberAssignmentTarget").expect("failed to dump");
1223 newline(out, depth + 1);
1224 write!(out, "object=").expect("failed to dump");
1225 self.object.dump_with_atoms_at(out, atoms, slices, depth + 1);
1226 newline(out, depth + 1);
1227 write!(out, "property=").expect("failed to dump");
1228 self.property.dump_with_atoms_at(out, atoms, slices, depth + 1);
1229 write!(out, ")").expect("failed to dump");
1230 }
1231 }
1232
1233 impl<'alloc> ASTDump for ArrayBinding<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1234 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1235 where W: io::Write
1236 {
1237 write!(out, "(ArrayBinding").expect("failed to dump");
1238 newline(out, depth + 1);
1239 write!(out, "elements=").expect("failed to dump");
1240 self.elements.dump_with_atoms_at(out, atoms, slices, depth + 1);
1241 newline(out, depth + 1);
1242 write!(out, "rest=").expect("failed to dump");
1243 self.rest.dump_with_atoms_at(out, atoms, slices, depth + 1);
1244 write!(out, ")").expect("failed to dump");
1245 }
1246 }
1247
1248 impl<'alloc> ASTDump for ObjectBinding<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1249 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1250 where W: io::Write
1251 {
1252 write!(out, "(ObjectBinding").expect("failed to dump");
1253 newline(out, depth + 1);
1254 write!(out, "properties=").expect("failed to dump");
1255 self.properties.dump_with_atoms_at(out, atoms, slices, depth + 1);
1256 newline(out, depth + 1);
1257 write!(out, "rest=").expect("failed to dump");
1258 self.rest.dump_with_atoms_at(out, atoms, slices, depth + 1);
1259 write!(out, ")").expect("failed to dump");
1260 }
1261 }
1262
1263 impl<'alloc> ASTDump for BindingProperty<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1264 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1265 where W: io::Write
1266 {
1267 match self {
1268 BindingProperty::BindingPropertyIdentifier(ast) => {
1269 ast.dump_with_atoms_at(out, atoms, slices, depth);
1270 }
1271 BindingProperty::BindingPropertyProperty(ast) => {
1272 ast.dump_with_atoms_at(out, atoms, slices, depth);
1273 }
1274 }
1275 }
1276 }
1277
1278 impl<'alloc> ASTDump for BindingPropertyIdentifier<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1279 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1280 where W: io::Write
1281 {
1282 write!(out, "(BindingPropertyIdentifier").expect("failed to dump");
1283 newline(out, depth + 1);
1284 write!(out, "binding=").expect("failed to dump");
1285 self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1);
1286 newline(out, depth + 1);
1287 write!(out, "init=").expect("failed to dump");
1288 self.init.dump_with_atoms_at(out, atoms, slices, depth + 1);
1289 write!(out, ")").expect("failed to dump");
1290 }
1291 }
1292
1293 impl<'alloc> ASTDump for BindingPropertyProperty<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1294 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1295 where W: io::Write
1296 {
1297 write!(out, "(BindingPropertyProperty").expect("failed to dump");
1298 newline(out, depth + 1);
1299 write!(out, "name=").expect("failed to dump");
1300 self.name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1301 newline(out, depth + 1);
1302 write!(out, "binding=").expect("failed to dump");
1303 self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1);
1304 write!(out, ")").expect("failed to dump");
1305 }
1306 }
1307
1308 impl<'alloc> ASTDump for AssignmentTargetWithDefault<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1309 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1310 where W: io::Write
1311 {
1312 write!(out, "(AssignmentTargetWithDefault").expect("failed to dump");
1313 newline(out, depth + 1);
1314 write!(out, "binding=").expect("failed to dump");
1315 self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1);
1316 newline(out, depth + 1);
1317 write!(out, "init=").expect("failed to dump");
1318 self.init.dump_with_atoms_at(out, atoms, slices, depth + 1);
1319 write!(out, ")").expect("failed to dump");
1320 }
1321 }
1322
1323 impl<'alloc> ASTDump for AssignmentTargetMaybeDefault<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1324 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1325 where W: io::Write
1326 {
1327 match self {
1328 AssignmentTargetMaybeDefault::AssignmentTarget(ast) => {
1329 ast.dump_with_atoms_at(out, atoms, slices, depth);
1330 }
1331 AssignmentTargetMaybeDefault::AssignmentTargetWithDefault(ast) => {
1332 ast.dump_with_atoms_at(out, atoms, slices, depth);
1333 }
1334 }
1335 }
1336 }
1337
1338 impl<'alloc> ASTDump for ArrayAssignmentTarget<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1339 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1340 where W: io::Write
1341 {
1342 write!(out, "(ArrayAssignmentTarget").expect("failed to dump");
1343 newline(out, depth + 1);
1344 write!(out, "elements=").expect("failed to dump");
1345 self.elements.dump_with_atoms_at(out, atoms, slices, depth + 1);
1346 newline(out, depth + 1);
1347 write!(out, "rest=").expect("failed to dump");
1348 self.rest.dump_with_atoms_at(out, atoms, slices, depth + 1);
1349 write!(out, ")").expect("failed to dump");
1350 }
1351 }
1352
1353 impl<'alloc> ASTDump for ObjectAssignmentTarget<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1354 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1355 where W: io::Write
1356 {
1357 write!(out, "(ObjectAssignmentTarget").expect("failed to dump");
1358 newline(out, depth + 1);
1359 write!(out, "properties=").expect("failed to dump");
1360 self.properties.dump_with_atoms_at(out, atoms, slices, depth + 1);
1361 newline(out, depth + 1);
1362 write!(out, "rest=").expect("failed to dump");
1363 self.rest.dump_with_atoms_at(out, atoms, slices, depth + 1);
1364 write!(out, ")").expect("failed to dump");
1365 }
1366 }
1367
1368 impl<'alloc> ASTDump for AssignmentTargetProperty<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1369 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1370 where W: io::Write
1371 {
1372 match self {
1373 AssignmentTargetProperty::AssignmentTargetPropertyIdentifier(ast) => {
1374 ast.dump_with_atoms_at(out, atoms, slices, depth);
1375 }
1376 AssignmentTargetProperty::AssignmentTargetPropertyProperty(ast) => {
1377 ast.dump_with_atoms_at(out, atoms, slices, depth);
1378 }
1379 }
1380 }
1381 }
1382
1383 impl<'alloc> ASTDump for AssignmentTargetPropertyIdentifier<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1384 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1385 where W: io::Write
1386 {
1387 write!(out, "(AssignmentTargetPropertyIdentifier").expect("failed to dump");
1388 newline(out, depth + 1);
1389 write!(out, "binding=").expect("failed to dump");
1390 self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1);
1391 newline(out, depth + 1);
1392 write!(out, "init=").expect("failed to dump");
1393 self.init.dump_with_atoms_at(out, atoms, slices, depth + 1);
1394 write!(out, ")").expect("failed to dump");
1395 }
1396 }
1397
1398 impl<'alloc> ASTDump for AssignmentTargetPropertyProperty<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1399 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1400 where W: io::Write
1401 {
1402 write!(out, "(AssignmentTargetPropertyProperty").expect("failed to dump");
1403 newline(out, depth + 1);
1404 write!(out, "name=").expect("failed to dump");
1405 self.name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1406 newline(out, depth + 1);
1407 write!(out, "binding=").expect("failed to dump");
1408 self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1);
1409 write!(out, ")").expect("failed to dump");
1410 }
1411 }
1412
1413 impl<'alloc> ASTDump for ClassExpression<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1414 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1415 where W: io::Write
1416 {
1417 write!(out, "(ClassExpression").expect("failed to dump");
1418 newline(out, depth + 1);
1419 write!(out, "name=").expect("failed to dump");
1420 self.name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1421 newline(out, depth + 1);
1422 write!(out, "super_=").expect("failed to dump");
1423 self.super_.dump_with_atoms_at(out, atoms, slices, depth + 1);
1424 newline(out, depth + 1);
1425 write!(out, "elements=").expect("failed to dump");
1426 self.elements.dump_with_atoms_at(out, atoms, slices, depth + 1);
1427 write!(out, ")").expect("failed to dump");
1428 }
1429 }
1430
1431 impl<'alloc> ASTDump for ClassDeclaration<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1432 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1433 where W: io::Write
1434 {
1435 write!(out, "(ClassDeclaration").expect("failed to dump");
1436 newline(out, depth + 1);
1437 write!(out, "name=").expect("failed to dump");
1438 self.name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1439 newline(out, depth + 1);
1440 write!(out, "super_=").expect("failed to dump");
1441 self.super_.dump_with_atoms_at(out, atoms, slices, depth + 1);
1442 newline(out, depth + 1);
1443 write!(out, "elements=").expect("failed to dump");
1444 self.elements.dump_with_atoms_at(out, atoms, slices, depth + 1);
1445 write!(out, ")").expect("failed to dump");
1446 }
1447 }
1448
1449 impl<'alloc> ASTDump for ClassElement<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1450 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1451 where W: io::Write
1452 {
1453 match self {
1454 ClassElement::MethodDefinition { is_static, method, .. } => {
1455 write!(out, "(MethodDefinition").expect("failed to dump");
1456 newline(out, depth + 1);
1457 write!(out, "is_static=").expect("failed to dump");
1458 is_static.dump_with_atoms_at(out, atoms, slices, depth + 1);
1459 newline(out, depth + 1);
1460 write!(out, "method=").expect("failed to dump");
1461 method.dump_with_atoms_at(out, atoms, slices, depth + 1);
1462 write!(out, ")").expect("failed to dump");
1463 }
1464 ClassElement::FieldDefinition { name, init, .. } => {
1465 write!(out, "(FieldDefinition").expect("failed to dump");
1466 newline(out, depth + 1);
1467 write!(out, "name=").expect("failed to dump");
1468 name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1469 newline(out, depth + 1);
1470 write!(out, "init=").expect("failed to dump");
1471 init.dump_with_atoms_at(out, atoms, slices, depth + 1);
1472 write!(out, ")").expect("failed to dump");
1473 }
1474 }
1475 }
1476 }
1477
1478 impl<'alloc> ASTDump for ModuleItems<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1479 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1480 where W: io::Write
1481 {
1482 match self {
1483 ModuleItems::ImportDeclaration(ast) => {
1484 ast.dump_with_atoms_at(out, atoms, slices, depth);
1485 }
1486 ModuleItems::ExportDeclaration(ast) => {
1487 ast.dump_with_atoms_at(out, atoms, slices, depth);
1488 }
1489 ModuleItems::Statement(ast) => {
1490 ast.dump_with_atoms_at(out, atoms, slices, depth);
1491 }
1492 }
1493 }
1494 }
1495
1496 impl<'alloc> ASTDump for Module<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1497 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1498 where W: io::Write
1499 {
1500 write!(out, "(Module").expect("failed to dump");
1501 newline(out, depth + 1);
1502 write!(out, "directives=").expect("failed to dump");
1503 self.directives.dump_with_atoms_at(out, atoms, slices, depth + 1);
1504 newline(out, depth + 1);
1505 write!(out, "items=").expect("failed to dump");
1506 self.items.dump_with_atoms_at(out, atoms, slices, depth + 1);
1507 write!(out, ")").expect("failed to dump");
1508 }
1509 }
1510
1511 impl<'alloc> ASTDump for Import<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1512 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1513 where W: io::Write
1514 {
1515 write!(out, "(Import").expect("failed to dump");
1516 newline(out, depth + 1);
1517 write!(out, "module_specifier=").expect("failed to dump");
1518 self.module_specifier.dump_with_atoms_at(out, atoms, slices, depth + 1);
1519 newline(out, depth + 1);
1520 write!(out, "default_binding=").expect("failed to dump");
1521 self.default_binding.dump_with_atoms_at(out, atoms, slices, depth + 1);
1522 newline(out, depth + 1);
1523 write!(out, "named_imports=").expect("failed to dump");
1524 self.named_imports.dump_with_atoms_at(out, atoms, slices, depth + 1);
1525 write!(out, ")").expect("failed to dump");
1526 }
1527 }
1528
1529 impl<'alloc> ASTDump for ImportNamespace {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1530 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1531 where W: io::Write
1532 {
1533 write!(out, "(ImportNamespace").expect("failed to dump");
1534 newline(out, depth + 1);
1535 write!(out, "module_specifier=").expect("failed to dump");
1536 self.module_specifier.dump_with_atoms_at(out, atoms, slices, depth + 1);
1537 newline(out, depth + 1);
1538 write!(out, "default_binding=").expect("failed to dump");
1539 self.default_binding.dump_with_atoms_at(out, atoms, slices, depth + 1);
1540 newline(out, depth + 1);
1541 write!(out, "namespace_binding=").expect("failed to dump");
1542 self.namespace_binding.dump_with_atoms_at(out, atoms, slices, depth + 1);
1543 write!(out, ")").expect("failed to dump");
1544 }
1545 }
1546
1547 impl<'alloc> ASTDump for ImportSpecifier {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1548 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1549 where W: io::Write
1550 {
1551 write!(out, "(ImportSpecifier").expect("failed to dump");
1552 newline(out, depth + 1);
1553 write!(out, "name=").expect("failed to dump");
1554 self.name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1555 newline(out, depth + 1);
1556 write!(out, "binding=").expect("failed to dump");
1557 self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1);
1558 write!(out, ")").expect("failed to dump");
1559 }
1560 }
1561
1562 impl<'alloc> ASTDump for ExportAllFrom {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1563 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1564 where W: io::Write
1565 {
1566 write!(out, "(ExportAllFrom").expect("failed to dump");
1567 write!(out, " ").expect("failed to dump");
1568 write!(out, "module_specifier=").expect("failed to dump");
1569 self.module_specifier.dump_with_atoms_at(out, atoms, slices, depth + 1);
1570 write!(out, ")").expect("failed to dump");
1571 }
1572 }
1573
1574 impl<'alloc> ASTDump for ExportFrom<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1575 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1576 where W: io::Write
1577 {
1578 write!(out, "(ExportFrom").expect("failed to dump");
1579 newline(out, depth + 1);
1580 write!(out, "named_exports=").expect("failed to dump");
1581 self.named_exports.dump_with_atoms_at(out, atoms, slices, depth + 1);
1582 newline(out, depth + 1);
1583 write!(out, "module_specifier=").expect("failed to dump");
1584 self.module_specifier.dump_with_atoms_at(out, atoms, slices, depth + 1);
1585 write!(out, ")").expect("failed to dump");
1586 }
1587 }
1588
1589 impl<'alloc> ASTDump for ExportLocals<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1590 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1591 where W: io::Write
1592 {
1593 write!(out, "(ExportLocals").expect("failed to dump");
1594 write!(out, " ").expect("failed to dump");
1595 write!(out, "named_exports=").expect("failed to dump");
1596 self.named_exports.dump_with_atoms_at(out, atoms, slices, depth + 1);
1597 write!(out, ")").expect("failed to dump");
1598 }
1599 }
1600
1601 impl<'alloc> ASTDump for Export<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1602 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1603 where W: io::Write
1604 {
1605 match self {
1606 Export::FunctionDeclaration(ast) => {
1607 ast.dump_with_atoms_at(out, atoms, slices, depth);
1608 }
1609 Export::ClassDeclaration(ast) => {
1610 ast.dump_with_atoms_at(out, atoms, slices, depth);
1611 }
1612 Export::VariableDeclaration(ast) => {
1613 ast.dump_with_atoms_at(out, atoms, slices, depth);
1614 }
1615 }
1616 }
1617 }
1618
1619 impl<'alloc> ASTDump for ExportDefault<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1620 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1621 where W: io::Write
1622 {
1623 match self {
1624 ExportDefault::FunctionDeclaration(ast) => {
1625 ast.dump_with_atoms_at(out, atoms, slices, depth);
1626 }
1627 ExportDefault::ClassDeclaration(ast) => {
1628 ast.dump_with_atoms_at(out, atoms, slices, depth);
1629 }
1630 ExportDefault::Expression(ast) => {
1631 ast.dump_with_atoms_at(out, atoms, slices, depth);
1632 }
1633 }
1634 }
1635 }
1636
1637 impl<'alloc> ASTDump for ExportFromSpecifier {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1638 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1639 where W: io::Write
1640 {
1641 write!(out, "(ExportFromSpecifier").expect("failed to dump");
1642 newline(out, depth + 1);
1643 write!(out, "name=").expect("failed to dump");
1644 self.name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1645 newline(out, depth + 1);
1646 write!(out, "exported_name=").expect("failed to dump");
1647 self.exported_name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1648 write!(out, ")").expect("failed to dump");
1649 }
1650 }
1651
1652 impl<'alloc> ASTDump for ExportLocalSpecifier {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1653 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1654 where W: io::Write
1655 {
1656 write!(out, "(ExportLocalSpecifier").expect("failed to dump");
1657 newline(out, depth + 1);
1658 write!(out, "name=").expect("failed to dump");
1659 self.name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1660 newline(out, depth + 1);
1661 write!(out, "exported_name=").expect("failed to dump");
1662 self.exported_name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1663 write!(out, ")").expect("failed to dump");
1664 }
1665 }
1666
1667 impl<'alloc> ASTDump for Method<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1668 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1669 where W: io::Write
1670 {
1671 write!(out, "(Method").expect("failed to dump");
1672 newline(out, depth + 1);
1673 write!(out, "name=").expect("failed to dump");
1674 self.name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1675 newline(out, depth + 1);
1676 write!(out, "is_async=").expect("failed to dump");
1677 self.is_async.dump_with_atoms_at(out, atoms, slices, depth + 1);
1678 newline(out, depth + 1);
1679 write!(out, "is_generator=").expect("failed to dump");
1680 self.is_generator.dump_with_atoms_at(out, atoms, slices, depth + 1);
1681 newline(out, depth + 1);
1682 write!(out, "params=").expect("failed to dump");
1683 self.params.dump_with_atoms_at(out, atoms, slices, depth + 1);
1684 newline(out, depth + 1);
1685 write!(out, "body=").expect("failed to dump");
1686 self.body.dump_with_atoms_at(out, atoms, slices, depth + 1);
1687 write!(out, ")").expect("failed to dump");
1688 }
1689 }
1690
1691 impl<'alloc> ASTDump for Getter<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1692 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1693 where W: io::Write
1694 {
1695 write!(out, "(Getter").expect("failed to dump");
1696 newline(out, depth + 1);
1697 write!(out, "property_name=").expect("failed to dump");
1698 self.property_name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1699 newline(out, depth + 1);
1700 write!(out, "body=").expect("failed to dump");
1701 self.body.dump_with_atoms_at(out, atoms, slices, depth + 1);
1702 write!(out, ")").expect("failed to dump");
1703 }
1704 }
1705
1706 impl<'alloc> ASTDump for Setter<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1707 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1708 where W: io::Write
1709 {
1710 write!(out, "(Setter").expect("failed to dump");
1711 newline(out, depth + 1);
1712 write!(out, "property_name=").expect("failed to dump");
1713 self.property_name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1714 newline(out, depth + 1);
1715 write!(out, "param=").expect("failed to dump");
1716 self.param.dump_with_atoms_at(out, atoms, slices, depth + 1);
1717 newline(out, depth + 1);
1718 write!(out, "body=").expect("failed to dump");
1719 self.body.dump_with_atoms_at(out, atoms, slices, depth + 1);
1720 write!(out, ")").expect("failed to dump");
1721 }
1722 }
1723
1724 impl<'alloc> ASTDump for DataProperty<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1725 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1726 where W: io::Write
1727 {
1728 write!(out, "(DataProperty").expect("failed to dump");
1729 newline(out, depth + 1);
1730 write!(out, "property_name=").expect("failed to dump");
1731 self.property_name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1732 newline(out, depth + 1);
1733 write!(out, "expression=").expect("failed to dump");
1734 self.expression.dump_with_atoms_at(out, atoms, slices, depth + 1);
1735 write!(out, ")").expect("failed to dump");
1736 }
1737 }
1738
1739 impl<'alloc> ASTDump for ShorthandProperty {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1740 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1741 where W: io::Write
1742 {
1743 write!(out, "(ShorthandProperty").expect("failed to dump");
1744 write!(out, " ").expect("failed to dump");
1745 write!(out, "name=").expect("failed to dump");
1746 self.name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1747 write!(out, ")").expect("failed to dump");
1748 }
1749 }
1750
1751 impl<'alloc> ASTDump for ComputedPropertyName<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1752 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1753 where W: io::Write
1754 {
1755 write!(out, "(ComputedPropertyName").expect("failed to dump");
1756 write!(out, " ").expect("failed to dump");
1757 write!(out, "expression=").expect("failed to dump");
1758 self.expression.dump_with_atoms_at(out, atoms, slices, depth + 1);
1759 write!(out, ")").expect("failed to dump");
1760 }
1761 }
1762
1763 impl<'alloc> ASTDump for StaticPropertyName {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1764 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1765 where W: io::Write
1766 {
1767 write!(out, "(StaticPropertyName").expect("failed to dump");
1768 write!(out, " ").expect("failed to dump");
1769 write!(out, "value=").expect("failed to dump");
1770 self.value.dump_with_atoms_at(out, atoms, slices, depth + 1);
1771 write!(out, ")").expect("failed to dump");
1772 }
1773 }
1774
1775 impl<'alloc> ASTDump for NumericLiteral {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1776 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1777 where W: io::Write
1778 {
1779 write!(out, "(NumericLiteral").expect("failed to dump");
1780 write!(out, " ").expect("failed to dump");
1781 write!(out, "value=").expect("failed to dump");
1782 self.value.dump_with_atoms_at(out, atoms, slices, depth + 1);
1783 write!(out, ")").expect("failed to dump");
1784 }
1785 }
1786
1787 impl<'alloc> ASTDump for ArrayExpressionElement<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1788 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1789 where W: io::Write
1790 {
1791 match self {
1792 ArrayExpressionElement::SpreadElement(ast) => {
1793 ast.dump_with_atoms_at(out, atoms, slices, depth);
1794 }
1795 ArrayExpressionElement::Expression(ast) => {
1796 ast.dump_with_atoms_at(out, atoms, slices, depth);
1797 }
1798 ArrayExpressionElement::Elision { .. } => {
1799 write!(out, "Elision").expect("failed to dump");
1800 }
1801 }
1802 }
1803 }
1804
1805 impl<'alloc> ASTDump for ArrayExpression<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1806 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1807 where W: io::Write
1808 {
1809 write!(out, "(ArrayExpression").expect("failed to dump");
1810 write!(out, " ").expect("failed to dump");
1811 write!(out, "elements=").expect("failed to dump");
1812 self.elements.dump_with_atoms_at(out, atoms, slices, depth + 1);
1813 write!(out, ")").expect("failed to dump");
1814 }
1815 }
1816
1817 impl<'alloc> ASTDump for ArrowExpressionBody<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1818 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1819 where W: io::Write
1820 {
1821 match self {
1822 ArrowExpressionBody::FunctionBody(ast) => {
1823 ast.dump_with_atoms_at(out, atoms, slices, depth);
1824 }
1825 ArrowExpressionBody::Expression(ast) => {
1826 ast.dump_with_atoms_at(out, atoms, slices, depth);
1827 }
1828 }
1829 }
1830 }
1831
1832 impl<'alloc> ASTDump for ComputedMemberExpression<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1833 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1834 where W: io::Write
1835 {
1836 write!(out, "(ComputedMemberExpression").expect("failed to dump");
1837 newline(out, depth + 1);
1838 write!(out, "object=").expect("failed to dump");
1839 self.object.dump_with_atoms_at(out, atoms, slices, depth + 1);
1840 newline(out, depth + 1);
1841 write!(out, "expression=").expect("failed to dump");
1842 self.expression.dump_with_atoms_at(out, atoms, slices, depth + 1);
1843 write!(out, ")").expect("failed to dump");
1844 }
1845 }
1846
1847 impl<'alloc> ASTDump for IdentifierExpression {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1848 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1849 where W: io::Write
1850 {
1851 write!(out, "(IdentifierExpression").expect("failed to dump");
1852 write!(out, " ").expect("failed to dump");
1853 write!(out, "name=").expect("failed to dump");
1854 self.name.dump_with_atoms_at(out, atoms, slices, depth + 1);
1855 write!(out, ")").expect("failed to dump");
1856 }
1857 }
1858
1859 impl<'alloc> ASTDump for ObjectExpression<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1860 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1861 where W: io::Write
1862 {
1863 write!(out, "(ObjectExpression").expect("failed to dump");
1864 write!(out, " ").expect("failed to dump");
1865 write!(out, "properties=").expect("failed to dump");
1866 self.properties.dump_with_atoms_at(out, atoms, slices, depth + 1);
1867 write!(out, ")").expect("failed to dump");
1868 }
1869 }
1870
1871 impl<'alloc> ASTDump for StaticMemberExpression<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1872 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1873 where W: io::Write
1874 {
1875 write!(out, "(StaticMemberExpression").expect("failed to dump");
1876 newline(out, depth + 1);
1877 write!(out, "object=").expect("failed to dump");
1878 self.object.dump_with_atoms_at(out, atoms, slices, depth + 1);
1879 newline(out, depth + 1);
1880 write!(out, "property=").expect("failed to dump");
1881 self.property.dump_with_atoms_at(out, atoms, slices, depth + 1);
1882 write!(out, ")").expect("failed to dump");
1883 }
1884 }
1885
1886 impl<'alloc> ASTDump for PrivateFieldExpression<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1887 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1888 where W: io::Write
1889 {
1890 write!(out, "(PrivateFieldExpression").expect("failed to dump");
1891 newline(out, depth + 1);
1892 write!(out, "object=").expect("failed to dump");
1893 self.object.dump_with_atoms_at(out, atoms, slices, depth + 1);
1894 newline(out, depth + 1);
1895 write!(out, "field=").expect("failed to dump");
1896 self.field.dump_with_atoms_at(out, atoms, slices, depth + 1);
1897 write!(out, ")").expect("failed to dump");
1898 }
1899 }
1900
1901 impl<'alloc> ASTDump for TemplateExpressionElement<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1902 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1903 where W: io::Write
1904 {
1905 match self {
1906 TemplateExpressionElement::Expression(ast) => {
1907 ast.dump_with_atoms_at(out, atoms, slices, depth);
1908 }
1909 TemplateExpressionElement::TemplateElement(ast) => {
1910 ast.dump_with_atoms_at(out, atoms, slices, depth);
1911 }
1912 }
1913 }
1914 }
1915
1916 impl<'alloc> ASTDump for TemplateExpression<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1917 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1918 where W: io::Write
1919 {
1920 write!(out, "(TemplateExpression").expect("failed to dump");
1921 newline(out, depth + 1);
1922 write!(out, "tag=").expect("failed to dump");
1923 self.tag.dump_with_atoms_at(out, atoms, slices, depth + 1);
1924 newline(out, depth + 1);
1925 write!(out, "elements=").expect("failed to dump");
1926 self.elements.dump_with_atoms_at(out, atoms, slices, depth + 1);
1927 write!(out, ")").expect("failed to dump");
1928 }
1929 }
1930
1931 impl<'alloc> ASTDump for VariableDeclarationOrAssignmentTarget<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1932 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1933 where W: io::Write
1934 {
1935 match self {
1936 VariableDeclarationOrAssignmentTarget::VariableDeclaration(ast) => {
1937 ast.dump_with_atoms_at(out, atoms, slices, depth);
1938 }
1939 VariableDeclarationOrAssignmentTarget::AssignmentTarget(ast) => {
1940 ast.dump_with_atoms_at(out, atoms, slices, depth);
1941 }
1942 }
1943 }
1944 }
1945
1946 impl<'alloc> ASTDump for VariableDeclarationOrExpression<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1947 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1948 where W: io::Write
1949 {
1950 match self {
1951 VariableDeclarationOrExpression::VariableDeclaration(ast) => {
1952 ast.dump_with_atoms_at(out, atoms, slices, depth);
1953 }
1954 VariableDeclarationOrExpression::Expression(ast) => {
1955 ast.dump_with_atoms_at(out, atoms, slices, depth);
1956 }
1957 }
1958 }
1959 }
1960
1961 impl<'alloc> ASTDump for Block<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1962 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1963 where W: io::Write
1964 {
1965 write!(out, "(Block").expect("failed to dump");
1966 newline(out, depth + 1);
1967 write!(out, "statements=").expect("failed to dump");
1968 self.statements.dump_with_atoms_at(out, atoms, slices, depth + 1);
1969 newline(out, depth + 1);
1970 write!(out, "declarations=").expect("failed to dump");
1971 self.declarations.dump_with_atoms_at(out, atoms, slices, depth + 1);
1972 write!(out, ")").expect("failed to dump");
1973 }
1974 }
1975
1976 impl<'alloc> ASTDump for CatchClause<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1977 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1978 where W: io::Write
1979 {
1980 write!(out, "(CatchClause").expect("failed to dump");
1981 newline(out, depth + 1);
1982 write!(out, "binding=").expect("failed to dump");
1983 self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1);
1984 newline(out, depth + 1);
1985 write!(out, "body=").expect("failed to dump");
1986 self.body.dump_with_atoms_at(out, atoms, slices, depth + 1);
1987 write!(out, ")").expect("failed to dump");
1988 }
1989 }
1990
1991 impl<'alloc> ASTDump for Directive {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write1992 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
1993 where W: io::Write
1994 {
1995 write!(out, "(Directive").expect("failed to dump");
1996 write!(out, " ").expect("failed to dump");
1997 write!(out, "raw_value=").expect("failed to dump");
1998 self.raw_value.dump_with_atoms_at(out, atoms, slices, depth + 1);
1999 write!(out, ")").expect("failed to dump");
2000 }
2001 }
2002
2003 impl<'alloc> ASTDump for FormalParameters<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write2004 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
2005 where W: io::Write
2006 {
2007 write!(out, "(FormalParameters").expect("failed to dump");
2008 newline(out, depth + 1);
2009 write!(out, "items=").expect("failed to dump");
2010 self.items.dump_with_atoms_at(out, atoms, slices, depth + 1);
2011 newline(out, depth + 1);
2012 write!(out, "rest=").expect("failed to dump");
2013 self.rest.dump_with_atoms_at(out, atoms, slices, depth + 1);
2014 write!(out, ")").expect("failed to dump");
2015 }
2016 }
2017
2018 impl<'alloc> ASTDump for FunctionBody<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write2019 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
2020 where W: io::Write
2021 {
2022 write!(out, "(FunctionBody").expect("failed to dump");
2023 newline(out, depth + 1);
2024 write!(out, "directives=").expect("failed to dump");
2025 self.directives.dump_with_atoms_at(out, atoms, slices, depth + 1);
2026 newline(out, depth + 1);
2027 write!(out, "statements=").expect("failed to dump");
2028 self.statements.dump_with_atoms_at(out, atoms, slices, depth + 1);
2029 write!(out, ")").expect("failed to dump");
2030 }
2031 }
2032
2033 impl<'alloc> ASTDump for Script<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write2034 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
2035 where W: io::Write
2036 {
2037 write!(out, "(Script").expect("failed to dump");
2038 newline(out, depth + 1);
2039 write!(out, "directives=").expect("failed to dump");
2040 self.directives.dump_with_atoms_at(out, atoms, slices, depth + 1);
2041 newline(out, depth + 1);
2042 write!(out, "statements=").expect("failed to dump");
2043 self.statements.dump_with_atoms_at(out, atoms, slices, depth + 1);
2044 write!(out, ")").expect("failed to dump");
2045 }
2046 }
2047
2048 impl<'alloc> ASTDump for SwitchCase<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write2049 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
2050 where W: io::Write
2051 {
2052 write!(out, "(SwitchCase").expect("failed to dump");
2053 newline(out, depth + 1);
2054 write!(out, "test=").expect("failed to dump");
2055 self.test.dump_with_atoms_at(out, atoms, slices, depth + 1);
2056 newline(out, depth + 1);
2057 write!(out, "consequent=").expect("failed to dump");
2058 self.consequent.dump_with_atoms_at(out, atoms, slices, depth + 1);
2059 write!(out, ")").expect("failed to dump");
2060 }
2061 }
2062
2063 impl<'alloc> ASTDump for SwitchDefault<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write2064 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
2065 where W: io::Write
2066 {
2067 write!(out, "(SwitchDefault").expect("failed to dump");
2068 write!(out, " ").expect("failed to dump");
2069 write!(out, "consequent=").expect("failed to dump");
2070 self.consequent.dump_with_atoms_at(out, atoms, slices, depth + 1);
2071 write!(out, ")").expect("failed to dump");
2072 }
2073 }
2074
2075 impl<'alloc> ASTDump for TemplateElement {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write2076 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
2077 where W: io::Write
2078 {
2079 write!(out, "(TemplateElement").expect("failed to dump");
2080 write!(out, " ").expect("failed to dump");
2081 write!(out, "raw_value=").expect("failed to dump");
2082 self.raw_value.dump_with_atoms_at(out, atoms, slices, depth + 1);
2083 write!(out, ")").expect("failed to dump");
2084 }
2085 }
2086
2087 impl<'alloc> ASTDump for VariableDeclaration<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write2088 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
2089 where W: io::Write
2090 {
2091 write!(out, "(VariableDeclaration").expect("failed to dump");
2092 newline(out, depth + 1);
2093 write!(out, "kind=").expect("failed to dump");
2094 self.kind.dump_with_atoms_at(out, atoms, slices, depth + 1);
2095 newline(out, depth + 1);
2096 write!(out, "declarators=").expect("failed to dump");
2097 self.declarators.dump_with_atoms_at(out, atoms, slices, depth + 1);
2098 write!(out, ")").expect("failed to dump");
2099 }
2100 }
2101
2102 impl<'alloc> ASTDump for VariableDeclarator<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write2103 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
2104 where W: io::Write
2105 {
2106 write!(out, "(VariableDeclarator").expect("failed to dump");
2107 newline(out, depth + 1);
2108 write!(out, "binding=").expect("failed to dump");
2109 self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1);
2110 newline(out, depth + 1);
2111 write!(out, "init=").expect("failed to dump");
2112 self.init.dump_with_atoms_at(out, atoms, slices, depth + 1);
2113 write!(out, ")").expect("failed to dump");
2114 }
2115 }
2116
2117 impl<'alloc> ASTDump for CoverParenthesized<'alloc> {
dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) where W: io::Write2118 fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize)
2119 where W: io::Write
2120 {
2121 match self {
2122 CoverParenthesized::Expression { expression, .. } => {
2123 write!(out, "(Expression").expect("failed to dump");
2124 write!(out, " ").expect("failed to dump");
2125 write!(out, "expression=").expect("failed to dump");
2126 expression.dump_with_atoms_at(out, atoms, slices, depth + 1);
2127 write!(out, ")").expect("failed to dump");
2128 }
2129 CoverParenthesized::Parameters(ast) => {
2130 ast.dump_with_atoms_at(out, atoms, slices, depth);
2131 }
2132 }
2133 }
2134 }
2135
2136 impl<'alloc, T> ASTDump for arena::Vec<'alloc, T>
2137 where
2138 T: ASTDump,
2139 {
dump_with_atoms_at<W>( &self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize, ) where W: io::Write,2140 fn dump_with_atoms_at<W>(
2141 &self,
2142 out: &mut W,
2143 atoms: &SourceAtomSet,
2144 slices: &SourceSliceList,
2145 depth: usize,
2146 )
2147 where
2148 W: io::Write,
2149 {
2150 write!(out, "[").expect("failed to dump");
2151 if self.len() > 0 {
2152 for item in self {
2153 newline(out, depth + 1);
2154 item.dump_with_atoms_at(out, atoms, slices, depth + 1);
2155 }
2156 newline(out, depth);
2157 }
2158 write!(out, "]").expect("failed to dump");
2159 }
2160 }
2161
2162 impl<T> ASTDump for Option<T>
2163 where
2164 T: ASTDump,
2165 {
dump_with_atoms_at<W>( &self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize, ) where W: io::Write,2166 fn dump_with_atoms_at<W>(
2167 &self,
2168 out: &mut W,
2169 atoms: &SourceAtomSet,
2170 slices: &SourceSliceList,
2171 depth: usize,
2172 )
2173 where
2174 W: io::Write,
2175 {
2176 match self {
2177 Some(v) => {
2178 v.dump_with_atoms_at(out, atoms, slices, depth);
2179 }
2180 None => {
2181 write!(out, "None").expect("failed to dump");
2182 }
2183 }
2184 }
2185 }
2186
2187 impl<'alloc, T> ASTDump for arena::Box<'alloc, T>
2188 where
2189 T: ASTDump,
2190 {
dump_with_atoms_at<W>( &self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize, ) where W: io::Write,2191 fn dump_with_atoms_at<W>(
2192 &self,
2193 out: &mut W,
2194 atoms: &SourceAtomSet,
2195 slices: &SourceSliceList,
2196 depth: usize,
2197 )
2198 where
2199 W: io::Write,
2200 {
2201 self.deref().dump_with_atoms_at(out, atoms, slices, depth);
2202 }
2203 }
2204
2205 impl ASTDump for bool {
dump_with_atoms_at<W>( &self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize, ) where W: io::Write,2206 fn dump_with_atoms_at<W>(
2207 &self,
2208 out: &mut W,
2209 atoms: &SourceAtomSet,
2210 slices: &SourceSliceList,
2211 depth: usize,
2212 )
2213 where
2214 W: io::Write,
2215 {
2216 if *self {
2217 write!(out, "true").expect("failed to dump");
2218 } else {
2219 write!(out, "false").expect("failed to dump");
2220 }
2221 }
2222 }
2223
2224 impl ASTDump for SourceAtomSetIndex {
dump_with_atoms_at<W>( &self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize, ) where W: io::Write,2225 fn dump_with_atoms_at<W>(
2226 &self,
2227 out: &mut W,
2228 atoms: &SourceAtomSet,
2229 slices: &SourceSliceList,
2230 depth: usize,
2231 )
2232 where
2233 W: io::Write,
2234 {
2235 write!(out, "{:?}", atoms.get(self.clone()))
2236 .expect("failed to dump");
2237 }
2238 }
2239
2240 impl ASTDump for SourceSliceIndex {
dump_with_atoms_at<W>( &self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize, ) where W: io::Write,2241 fn dump_with_atoms_at<W>(
2242 &self,
2243 out: &mut W,
2244 atoms: &SourceAtomSet,
2245 slices: &SourceSliceList,
2246 depth: usize,
2247 )
2248 where
2249 W: io::Write,
2250 {
2251 write!(out, "{:?}", slices.get(self.clone()))
2252 .expect("failed to dump");
2253 }
2254 }
2255
2256 impl ASTDump for f64 {
dump_with_atoms_at<W>( &self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize, ) where W: io::Write,2257 fn dump_with_atoms_at<W>(
2258 &self,
2259 out: &mut W,
2260 atoms: &SourceAtomSet,
2261 slices: &SourceSliceList,
2262 depth: usize,
2263 )
2264 where
2265 W: io::Write,
2266 {
2267 write!(out, "{}", self).expect("failed to dump");
2268 }
2269 }
2270