1 // WARNING: This file is auto-generated by crates/ast/generate_ast.py.
2 
3 use crate::token::Token;
4 use ast::arena;
5 use ast::types::*;
6 use std::convert::Infallible;
7 
8 pub type AstError = String;
9 type AstResult<'alloc, T> = Result<arena::Box<'alloc, T>, AstError>;
10 
11 #[derive(Debug)]
12 pub enum StackValue<'alloc> {
13     Argument(arena::Box<'alloc, Argument<'alloc>>),
14     Arguments(arena::Box<'alloc, Arguments<'alloc>>),
15     ArrayAssignmentTarget(arena::Box<'alloc, ArrayAssignmentTarget<'alloc>>),
16     ArrayBinding(arena::Box<'alloc, ArrayBinding<'alloc>>),
17     ArrayExpression(arena::Box<'alloc, ArrayExpression<'alloc>>),
18     ArrayExpressionElement(arena::Box<'alloc, ArrayExpressionElement<'alloc>>),
19     ArrowExpressionBody(arena::Box<'alloc, ArrowExpressionBody<'alloc>>),
20     AssignmentTarget(arena::Box<'alloc, AssignmentTarget<'alloc>>),
21     AssignmentTargetIdentifier(arena::Box<'alloc, AssignmentTargetIdentifier>),
22     AssignmentTargetMaybeDefault(arena::Box<'alloc, AssignmentTargetMaybeDefault<'alloc>>),
23     AssignmentTargetPattern(arena::Box<'alloc, AssignmentTargetPattern<'alloc>>),
24     AssignmentTargetProperty(arena::Box<'alloc, AssignmentTargetProperty<'alloc>>),
25     AssignmentTargetPropertyIdentifier(arena::Box<'alloc, AssignmentTargetPropertyIdentifier<'alloc>>),
26     AssignmentTargetPropertyProperty(arena::Box<'alloc, AssignmentTargetPropertyProperty<'alloc>>),
27     AssignmentTargetWithDefault(arena::Box<'alloc, AssignmentTargetWithDefault<'alloc>>),
28     BinaryOperator(arena::Box<'alloc, BinaryOperator>),
29     Binding(arena::Box<'alloc, Binding<'alloc>>),
30     BindingIdentifier(arena::Box<'alloc, BindingIdentifier>),
31     BindingPattern(arena::Box<'alloc, BindingPattern<'alloc>>),
32     BindingProperty(arena::Box<'alloc, BindingProperty<'alloc>>),
33     BindingPropertyIdentifier(arena::Box<'alloc, BindingPropertyIdentifier<'alloc>>),
34     BindingPropertyProperty(arena::Box<'alloc, BindingPropertyProperty<'alloc>>),
35     BindingWithDefault(arena::Box<'alloc, BindingWithDefault<'alloc>>),
36     Block(arena::Box<'alloc, Block<'alloc>>),
37     CallExpression(arena::Box<'alloc, CallExpression<'alloc>>),
38     CatchClause(arena::Box<'alloc, CatchClause<'alloc>>),
39     ClassDeclaration(arena::Box<'alloc, ClassDeclaration<'alloc>>),
40     ClassElement(arena::Box<'alloc, ClassElement<'alloc>>),
41     ClassElementName(arena::Box<'alloc, ClassElementName<'alloc>>),
42     ClassExpression(arena::Box<'alloc, ClassExpression<'alloc>>),
43     CompoundAssignmentOperator(arena::Box<'alloc, CompoundAssignmentOperator>),
44     ComputedMemberAssignmentTarget(arena::Box<'alloc, ComputedMemberAssignmentTarget<'alloc>>),
45     ComputedMemberExpression(arena::Box<'alloc, ComputedMemberExpression<'alloc>>),
46     ComputedPropertyName(arena::Box<'alloc, ComputedPropertyName<'alloc>>),
47     CoverParenthesized(arena::Box<'alloc, CoverParenthesized<'alloc>>),
48     DataProperty(arena::Box<'alloc, DataProperty<'alloc>>),
49     Directive(arena::Box<'alloc, Directive>),
50     Export(arena::Box<'alloc, Export<'alloc>>),
51     ExportAllFrom(arena::Box<'alloc, ExportAllFrom>),
52     ExportDeclaration(arena::Box<'alloc, ExportDeclaration<'alloc>>),
53     ExportDefault(arena::Box<'alloc, ExportDefault<'alloc>>),
54     ExportFrom(arena::Box<'alloc, ExportFrom<'alloc>>),
55     ExportFromSpecifier(arena::Box<'alloc, ExportFromSpecifier>),
56     ExportLocalSpecifier(arena::Box<'alloc, ExportLocalSpecifier>),
57     ExportLocals(arena::Box<'alloc, ExportLocals<'alloc>>),
58     Expression(arena::Box<'alloc, Expression<'alloc>>),
59     ExpressionOrSuper(arena::Box<'alloc, ExpressionOrSuper<'alloc>>),
60     FormalParameters(arena::Box<'alloc, FormalParameters<'alloc>>),
61     Function(arena::Box<'alloc, Function<'alloc>>),
62     FunctionBody(arena::Box<'alloc, FunctionBody<'alloc>>),
63     Getter(arena::Box<'alloc, Getter<'alloc>>),
64     Identifier(arena::Box<'alloc, Identifier>),
65     IdentifierExpression(arena::Box<'alloc, IdentifierExpression>),
66     IdentifierName(arena::Box<'alloc, IdentifierName>),
67     IfStatement(arena::Box<'alloc, IfStatement<'alloc>>),
68     Import(arena::Box<'alloc, Import<'alloc>>),
69     ImportDeclaration(arena::Box<'alloc, ImportDeclaration<'alloc>>),
70     ImportNamespace(arena::Box<'alloc, ImportNamespace>),
71     ImportSpecifier(arena::Box<'alloc, ImportSpecifier>),
72     Label(arena::Box<'alloc, Label>),
73     MemberAssignmentTarget(arena::Box<'alloc, MemberAssignmentTarget<'alloc>>),
74     MemberExpression(arena::Box<'alloc, MemberExpression<'alloc>>),
75     Method(arena::Box<'alloc, Method<'alloc>>),
76     MethodDefinition(arena::Box<'alloc, MethodDefinition<'alloc>>),
77     Module(arena::Box<'alloc, Module<'alloc>>),
78     ModuleItems(arena::Box<'alloc, ModuleItems<'alloc>>),
79     NamedObjectProperty(arena::Box<'alloc, NamedObjectProperty<'alloc>>),
80     NumericLiteral(arena::Box<'alloc, NumericLiteral>),
81     ObjectAssignmentTarget(arena::Box<'alloc, ObjectAssignmentTarget<'alloc>>),
82     ObjectBinding(arena::Box<'alloc, ObjectBinding<'alloc>>),
83     ObjectExpression(arena::Box<'alloc, ObjectExpression<'alloc>>),
84     ObjectProperty(arena::Box<'alloc, ObjectProperty<'alloc>>),
85     OptionalChain(arena::Box<'alloc, OptionalChain<'alloc>>),
86     Parameter(arena::Box<'alloc, Parameter<'alloc>>),
87     PrivateFieldExpression(arena::Box<'alloc, PrivateFieldExpression<'alloc>>),
88     PrivateIdentifier(arena::Box<'alloc, PrivateIdentifier>),
89     Program(arena::Box<'alloc, Program<'alloc>>),
90     PropertyName(arena::Box<'alloc, PropertyName<'alloc>>),
91     Script(arena::Box<'alloc, Script<'alloc>>),
92     Setter(arena::Box<'alloc, Setter<'alloc>>),
93     ShorthandProperty(arena::Box<'alloc, ShorthandProperty>),
94     SimpleAssignmentTarget(arena::Box<'alloc, SimpleAssignmentTarget<'alloc>>),
95     Statement(arena::Box<'alloc, Statement<'alloc>>),
96     StaticMemberAssignmentTarget(arena::Box<'alloc, StaticMemberAssignmentTarget<'alloc>>),
97     StaticMemberExpression(arena::Box<'alloc, StaticMemberExpression<'alloc>>),
98     StaticPropertyName(arena::Box<'alloc, StaticPropertyName>),
99     SwitchCase(arena::Box<'alloc, SwitchCase<'alloc>>),
100     SwitchDefault(arena::Box<'alloc, SwitchDefault<'alloc>>),
101     TemplateElement(arena::Box<'alloc, TemplateElement>),
102     TemplateExpression(arena::Box<'alloc, TemplateExpression<'alloc>>),
103     TemplateExpressionElement(arena::Box<'alloc, TemplateExpressionElement<'alloc>>),
104     Token(arena::Box<'alloc, Token>),
105     UnaryOperator(arena::Box<'alloc, UnaryOperator>),
106     UpdateOperator(arena::Box<'alloc, UpdateOperator>),
107     VariableDeclaration(arena::Box<'alloc, VariableDeclaration<'alloc>>),
108     VariableDeclarationKind(arena::Box<'alloc, VariableDeclarationKind>),
109     VariableDeclarationOrAssignmentTarget(arena::Box<'alloc, VariableDeclarationOrAssignmentTarget<'alloc>>),
110     VariableDeclarationOrExpression(arena::Box<'alloc, VariableDeclarationOrExpression<'alloc>>),
111     VariableDeclarator(arena::Box<'alloc, VariableDeclarator<'alloc>>),
112     VariableReference(arena::Box<'alloc, VariableReference>),
113     VecArrayExpressionElement(arena::Box<'alloc, arena::Vec<'alloc, ArrayExpressionElement<'alloc>>>),
114     VecBindingProperty(arena::Box<'alloc, arena::Vec<'alloc, BindingProperty<'alloc>>>),
115     VecClassElement(arena::Box<'alloc, arena::Vec<'alloc, arena::Box<'alloc, ClassElement<'alloc>>>>),
116     VecOption(arena::Box<'alloc, arena::Vec<'alloc, Option<Parameter<'alloc>>>>),
117     VecStatement(arena::Box<'alloc, arena::Vec<'alloc, Statement<'alloc>>>),
118     VecSwitchCase(arena::Box<'alloc, arena::Vec<'alloc, SwitchCase<'alloc>>>),
119     VecVariableDeclarator(arena::Box<'alloc, arena::Vec<'alloc, VariableDeclarator<'alloc>>>),
120     Void(arena::Box<'alloc, Void>),
121 }
122 
123 impl<'alloc> StackValue<'alloc> {
to_ast<T: StackValueItem<'alloc>>(self) -> AstResult<'alloc, T>124     pub fn to_ast<T: StackValueItem<'alloc>>(self) -> AstResult<'alloc, T> {
125         T::to_ast(self)
126     }
127 }
128 
129 pub trait StackValueItem<'alloc>: Sized {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>130     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>;
131 }
132 
133 /// Values that can be converted to StackValues, fallibly.
134 pub trait TryIntoStack<'alloc> {
135     type Error;
try_into_stack(self) -> Result<StackValue<'alloc>, Self::Error>136     fn try_into_stack(self) -> Result<StackValue<'alloc>, Self::Error>;
137 }
138 impl<'alloc> StackValueItem<'alloc> for Argument<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>139     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
140         match sv {
141             StackValue::Argument(v) => Ok(v),
142             _ => Err(format!("StackValue expected Argument, got {:?}", sv)),
143         }
144     }
145 }
146 
147 impl<'alloc> StackValueItem<'alloc> for Arguments<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>148     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
149         match sv {
150             StackValue::Arguments(v) => Ok(v),
151             _ => Err(format!("StackValue expected Arguments, got {:?}", sv)),
152         }
153     }
154 }
155 
156 impl<'alloc> StackValueItem<'alloc> for ArrayAssignmentTarget<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>157     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
158         match sv {
159             StackValue::ArrayAssignmentTarget(v) => Ok(v),
160             _ => Err(format!("StackValue expected ArrayAssignmentTarget, got {:?}", sv)),
161         }
162     }
163 }
164 
165 impl<'alloc> StackValueItem<'alloc> for ArrayBinding<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>166     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
167         match sv {
168             StackValue::ArrayBinding(v) => Ok(v),
169             _ => Err(format!("StackValue expected ArrayBinding, got {:?}", sv)),
170         }
171     }
172 }
173 
174 impl<'alloc> StackValueItem<'alloc> for ArrayExpression<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>175     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
176         match sv {
177             StackValue::ArrayExpression(v) => Ok(v),
178             _ => Err(format!("StackValue expected ArrayExpression, got {:?}", sv)),
179         }
180     }
181 }
182 
183 impl<'alloc> StackValueItem<'alloc> for ArrayExpressionElement<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>184     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
185         match sv {
186             StackValue::ArrayExpressionElement(v) => Ok(v),
187             _ => Err(format!("StackValue expected ArrayExpressionElement, got {:?}", sv)),
188         }
189     }
190 }
191 
192 impl<'alloc> StackValueItem<'alloc> for ArrowExpressionBody<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>193     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
194         match sv {
195             StackValue::ArrowExpressionBody(v) => Ok(v),
196             _ => Err(format!("StackValue expected ArrowExpressionBody, got {:?}", sv)),
197         }
198     }
199 }
200 
201 impl<'alloc> StackValueItem<'alloc> for AssignmentTarget<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>202     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
203         match sv {
204             StackValue::AssignmentTarget(v) => Ok(v),
205             _ => Err(format!("StackValue expected AssignmentTarget, got {:?}", sv)),
206         }
207     }
208 }
209 
210 impl<'alloc> StackValueItem<'alloc> for AssignmentTargetIdentifier {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>211     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
212         match sv {
213             StackValue::AssignmentTargetIdentifier(v) => Ok(v),
214             _ => Err(format!("StackValue expected AssignmentTargetIdentifier, got {:?}", sv)),
215         }
216     }
217 }
218 
219 impl<'alloc> StackValueItem<'alloc> for AssignmentTargetMaybeDefault<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>220     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
221         match sv {
222             StackValue::AssignmentTargetMaybeDefault(v) => Ok(v),
223             _ => Err(format!("StackValue expected AssignmentTargetMaybeDefault, got {:?}", sv)),
224         }
225     }
226 }
227 
228 impl<'alloc> StackValueItem<'alloc> for AssignmentTargetPattern<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>229     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
230         match sv {
231             StackValue::AssignmentTargetPattern(v) => Ok(v),
232             _ => Err(format!("StackValue expected AssignmentTargetPattern, got {:?}", sv)),
233         }
234     }
235 }
236 
237 impl<'alloc> StackValueItem<'alloc> for AssignmentTargetProperty<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>238     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
239         match sv {
240             StackValue::AssignmentTargetProperty(v) => Ok(v),
241             _ => Err(format!("StackValue expected AssignmentTargetProperty, got {:?}", sv)),
242         }
243     }
244 }
245 
246 impl<'alloc> StackValueItem<'alloc> for AssignmentTargetPropertyIdentifier<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>247     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
248         match sv {
249             StackValue::AssignmentTargetPropertyIdentifier(v) => Ok(v),
250             _ => Err(format!("StackValue expected AssignmentTargetPropertyIdentifier, got {:?}", sv)),
251         }
252     }
253 }
254 
255 impl<'alloc> StackValueItem<'alloc> for AssignmentTargetPropertyProperty<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>256     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
257         match sv {
258             StackValue::AssignmentTargetPropertyProperty(v) => Ok(v),
259             _ => Err(format!("StackValue expected AssignmentTargetPropertyProperty, got {:?}", sv)),
260         }
261     }
262 }
263 
264 impl<'alloc> StackValueItem<'alloc> for AssignmentTargetWithDefault<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>265     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
266         match sv {
267             StackValue::AssignmentTargetWithDefault(v) => Ok(v),
268             _ => Err(format!("StackValue expected AssignmentTargetWithDefault, got {:?}", sv)),
269         }
270     }
271 }
272 
273 impl<'alloc> StackValueItem<'alloc> for BinaryOperator {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>274     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
275         match sv {
276             StackValue::BinaryOperator(v) => Ok(v),
277             _ => Err(format!("StackValue expected BinaryOperator, got {:?}", sv)),
278         }
279     }
280 }
281 
282 impl<'alloc> StackValueItem<'alloc> for Binding<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>283     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
284         match sv {
285             StackValue::Binding(v) => Ok(v),
286             _ => Err(format!("StackValue expected Binding, got {:?}", sv)),
287         }
288     }
289 }
290 
291 impl<'alloc> StackValueItem<'alloc> for BindingIdentifier {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>292     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
293         match sv {
294             StackValue::BindingIdentifier(v) => Ok(v),
295             _ => Err(format!("StackValue expected BindingIdentifier, got {:?}", sv)),
296         }
297     }
298 }
299 
300 impl<'alloc> StackValueItem<'alloc> for BindingPattern<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>301     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
302         match sv {
303             StackValue::BindingPattern(v) => Ok(v),
304             _ => Err(format!("StackValue expected BindingPattern, got {:?}", sv)),
305         }
306     }
307 }
308 
309 impl<'alloc> StackValueItem<'alloc> for BindingProperty<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>310     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
311         match sv {
312             StackValue::BindingProperty(v) => Ok(v),
313             _ => Err(format!("StackValue expected BindingProperty, got {:?}", sv)),
314         }
315     }
316 }
317 
318 impl<'alloc> StackValueItem<'alloc> for BindingPropertyIdentifier<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>319     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
320         match sv {
321             StackValue::BindingPropertyIdentifier(v) => Ok(v),
322             _ => Err(format!("StackValue expected BindingPropertyIdentifier, got {:?}", sv)),
323         }
324     }
325 }
326 
327 impl<'alloc> StackValueItem<'alloc> for BindingPropertyProperty<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>328     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
329         match sv {
330             StackValue::BindingPropertyProperty(v) => Ok(v),
331             _ => Err(format!("StackValue expected BindingPropertyProperty, got {:?}", sv)),
332         }
333     }
334 }
335 
336 impl<'alloc> StackValueItem<'alloc> for BindingWithDefault<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>337     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
338         match sv {
339             StackValue::BindingWithDefault(v) => Ok(v),
340             _ => Err(format!("StackValue expected BindingWithDefault, got {:?}", sv)),
341         }
342     }
343 }
344 
345 impl<'alloc> StackValueItem<'alloc> for Block<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>346     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
347         match sv {
348             StackValue::Block(v) => Ok(v),
349             _ => Err(format!("StackValue expected Block, got {:?}", sv)),
350         }
351     }
352 }
353 
354 impl<'alloc> StackValueItem<'alloc> for CallExpression<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>355     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
356         match sv {
357             StackValue::CallExpression(v) => Ok(v),
358             _ => Err(format!("StackValue expected CallExpression, got {:?}", sv)),
359         }
360     }
361 }
362 
363 impl<'alloc> StackValueItem<'alloc> for CatchClause<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>364     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
365         match sv {
366             StackValue::CatchClause(v) => Ok(v),
367             _ => Err(format!("StackValue expected CatchClause, got {:?}", sv)),
368         }
369     }
370 }
371 
372 impl<'alloc> StackValueItem<'alloc> for ClassDeclaration<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>373     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
374         match sv {
375             StackValue::ClassDeclaration(v) => Ok(v),
376             _ => Err(format!("StackValue expected ClassDeclaration, got {:?}", sv)),
377         }
378     }
379 }
380 
381 impl<'alloc> StackValueItem<'alloc> for ClassElement<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>382     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
383         match sv {
384             StackValue::ClassElement(v) => Ok(v),
385             _ => Err(format!("StackValue expected ClassElement, got {:?}", sv)),
386         }
387     }
388 }
389 
390 impl<'alloc> StackValueItem<'alloc> for ClassElementName<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>391     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
392         match sv {
393             StackValue::ClassElementName(v) => Ok(v),
394             _ => Err(format!("StackValue expected ClassElementName, got {:?}", sv)),
395         }
396     }
397 }
398 
399 impl<'alloc> StackValueItem<'alloc> for ClassExpression<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>400     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
401         match sv {
402             StackValue::ClassExpression(v) => Ok(v),
403             _ => Err(format!("StackValue expected ClassExpression, got {:?}", sv)),
404         }
405     }
406 }
407 
408 impl<'alloc> StackValueItem<'alloc> for CompoundAssignmentOperator {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>409     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
410         match sv {
411             StackValue::CompoundAssignmentOperator(v) => Ok(v),
412             _ => Err(format!("StackValue expected CompoundAssignmentOperator, got {:?}", sv)),
413         }
414     }
415 }
416 
417 impl<'alloc> StackValueItem<'alloc> for ComputedMemberAssignmentTarget<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>418     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
419         match sv {
420             StackValue::ComputedMemberAssignmentTarget(v) => Ok(v),
421             _ => Err(format!("StackValue expected ComputedMemberAssignmentTarget, got {:?}", sv)),
422         }
423     }
424 }
425 
426 impl<'alloc> StackValueItem<'alloc> for ComputedMemberExpression<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>427     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
428         match sv {
429             StackValue::ComputedMemberExpression(v) => Ok(v),
430             _ => Err(format!("StackValue expected ComputedMemberExpression, got {:?}", sv)),
431         }
432     }
433 }
434 
435 impl<'alloc> StackValueItem<'alloc> for ComputedPropertyName<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>436     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
437         match sv {
438             StackValue::ComputedPropertyName(v) => Ok(v),
439             _ => Err(format!("StackValue expected ComputedPropertyName, got {:?}", sv)),
440         }
441     }
442 }
443 
444 impl<'alloc> StackValueItem<'alloc> for CoverParenthesized<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>445     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
446         match sv {
447             StackValue::CoverParenthesized(v) => Ok(v),
448             _ => Err(format!("StackValue expected CoverParenthesized, got {:?}", sv)),
449         }
450     }
451 }
452 
453 impl<'alloc> StackValueItem<'alloc> for DataProperty<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>454     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
455         match sv {
456             StackValue::DataProperty(v) => Ok(v),
457             _ => Err(format!("StackValue expected DataProperty, got {:?}", sv)),
458         }
459     }
460 }
461 
462 impl<'alloc> StackValueItem<'alloc> for Directive {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>463     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
464         match sv {
465             StackValue::Directive(v) => Ok(v),
466             _ => Err(format!("StackValue expected Directive, got {:?}", sv)),
467         }
468     }
469 }
470 
471 impl<'alloc> StackValueItem<'alloc> for Export<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>472     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
473         match sv {
474             StackValue::Export(v) => Ok(v),
475             _ => Err(format!("StackValue expected Export, got {:?}", sv)),
476         }
477     }
478 }
479 
480 impl<'alloc> StackValueItem<'alloc> for ExportAllFrom {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>481     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
482         match sv {
483             StackValue::ExportAllFrom(v) => Ok(v),
484             _ => Err(format!("StackValue expected ExportAllFrom, got {:?}", sv)),
485         }
486     }
487 }
488 
489 impl<'alloc> StackValueItem<'alloc> for ExportDeclaration<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>490     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
491         match sv {
492             StackValue::ExportDeclaration(v) => Ok(v),
493             _ => Err(format!("StackValue expected ExportDeclaration, got {:?}", sv)),
494         }
495     }
496 }
497 
498 impl<'alloc> StackValueItem<'alloc> for ExportDefault<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>499     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
500         match sv {
501             StackValue::ExportDefault(v) => Ok(v),
502             _ => Err(format!("StackValue expected ExportDefault, got {:?}", sv)),
503         }
504     }
505 }
506 
507 impl<'alloc> StackValueItem<'alloc> for ExportFrom<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>508     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
509         match sv {
510             StackValue::ExportFrom(v) => Ok(v),
511             _ => Err(format!("StackValue expected ExportFrom, got {:?}", sv)),
512         }
513     }
514 }
515 
516 impl<'alloc> StackValueItem<'alloc> for ExportFromSpecifier {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>517     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
518         match sv {
519             StackValue::ExportFromSpecifier(v) => Ok(v),
520             _ => Err(format!("StackValue expected ExportFromSpecifier, got {:?}", sv)),
521         }
522     }
523 }
524 
525 impl<'alloc> StackValueItem<'alloc> for ExportLocalSpecifier {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>526     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
527         match sv {
528             StackValue::ExportLocalSpecifier(v) => Ok(v),
529             _ => Err(format!("StackValue expected ExportLocalSpecifier, got {:?}", sv)),
530         }
531     }
532 }
533 
534 impl<'alloc> StackValueItem<'alloc> for ExportLocals<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>535     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
536         match sv {
537             StackValue::ExportLocals(v) => Ok(v),
538             _ => Err(format!("StackValue expected ExportLocals, got {:?}", sv)),
539         }
540     }
541 }
542 
543 impl<'alloc> StackValueItem<'alloc> for Expression<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>544     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
545         match sv {
546             StackValue::Expression(v) => Ok(v),
547             _ => Err(format!("StackValue expected Expression, got {:?}", sv)),
548         }
549     }
550 }
551 
552 impl<'alloc> StackValueItem<'alloc> for ExpressionOrSuper<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>553     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
554         match sv {
555             StackValue::ExpressionOrSuper(v) => Ok(v),
556             _ => Err(format!("StackValue expected ExpressionOrSuper, got {:?}", sv)),
557         }
558     }
559 }
560 
561 impl<'alloc> StackValueItem<'alloc> for FormalParameters<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>562     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
563         match sv {
564             StackValue::FormalParameters(v) => Ok(v),
565             _ => Err(format!("StackValue expected FormalParameters, got {:?}", sv)),
566         }
567     }
568 }
569 
570 impl<'alloc> StackValueItem<'alloc> for Function<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>571     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
572         match sv {
573             StackValue::Function(v) => Ok(v),
574             _ => Err(format!("StackValue expected Function, got {:?}", sv)),
575         }
576     }
577 }
578 
579 impl<'alloc> StackValueItem<'alloc> for FunctionBody<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>580     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
581         match sv {
582             StackValue::FunctionBody(v) => Ok(v),
583             _ => Err(format!("StackValue expected FunctionBody, got {:?}", sv)),
584         }
585     }
586 }
587 
588 impl<'alloc> StackValueItem<'alloc> for Getter<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>589     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
590         match sv {
591             StackValue::Getter(v) => Ok(v),
592             _ => Err(format!("StackValue expected Getter, got {:?}", sv)),
593         }
594     }
595 }
596 
597 impl<'alloc> StackValueItem<'alloc> for Identifier {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>598     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
599         match sv {
600             StackValue::Identifier(v) => Ok(v),
601             _ => Err(format!("StackValue expected Identifier, got {:?}", sv)),
602         }
603     }
604 }
605 
606 impl<'alloc> StackValueItem<'alloc> for IdentifierExpression {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>607     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
608         match sv {
609             StackValue::IdentifierExpression(v) => Ok(v),
610             _ => Err(format!("StackValue expected IdentifierExpression, got {:?}", sv)),
611         }
612     }
613 }
614 
615 impl<'alloc> StackValueItem<'alloc> for IdentifierName {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>616     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
617         match sv {
618             StackValue::IdentifierName(v) => Ok(v),
619             _ => Err(format!("StackValue expected IdentifierName, got {:?}", sv)),
620         }
621     }
622 }
623 
624 impl<'alloc> StackValueItem<'alloc> for IfStatement<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>625     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
626         match sv {
627             StackValue::IfStatement(v) => Ok(v),
628             _ => Err(format!("StackValue expected IfStatement, got {:?}", sv)),
629         }
630     }
631 }
632 
633 impl<'alloc> StackValueItem<'alloc> for Import<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>634     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
635         match sv {
636             StackValue::Import(v) => Ok(v),
637             _ => Err(format!("StackValue expected Import, got {:?}", sv)),
638         }
639     }
640 }
641 
642 impl<'alloc> StackValueItem<'alloc> for ImportDeclaration<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>643     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
644         match sv {
645             StackValue::ImportDeclaration(v) => Ok(v),
646             _ => Err(format!("StackValue expected ImportDeclaration, got {:?}", sv)),
647         }
648     }
649 }
650 
651 impl<'alloc> StackValueItem<'alloc> for ImportNamespace {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>652     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
653         match sv {
654             StackValue::ImportNamespace(v) => Ok(v),
655             _ => Err(format!("StackValue expected ImportNamespace, got {:?}", sv)),
656         }
657     }
658 }
659 
660 impl<'alloc> StackValueItem<'alloc> for ImportSpecifier {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>661     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
662         match sv {
663             StackValue::ImportSpecifier(v) => Ok(v),
664             _ => Err(format!("StackValue expected ImportSpecifier, got {:?}", sv)),
665         }
666     }
667 }
668 
669 impl<'alloc> StackValueItem<'alloc> for Label {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>670     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
671         match sv {
672             StackValue::Label(v) => Ok(v),
673             _ => Err(format!("StackValue expected Label, got {:?}", sv)),
674         }
675     }
676 }
677 
678 impl<'alloc> StackValueItem<'alloc> for MemberAssignmentTarget<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>679     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
680         match sv {
681             StackValue::MemberAssignmentTarget(v) => Ok(v),
682             _ => Err(format!("StackValue expected MemberAssignmentTarget, got {:?}", sv)),
683         }
684     }
685 }
686 
687 impl<'alloc> StackValueItem<'alloc> for MemberExpression<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>688     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
689         match sv {
690             StackValue::MemberExpression(v) => Ok(v),
691             _ => Err(format!("StackValue expected MemberExpression, got {:?}", sv)),
692         }
693     }
694 }
695 
696 impl<'alloc> StackValueItem<'alloc> for Method<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>697     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
698         match sv {
699             StackValue::Method(v) => Ok(v),
700             _ => Err(format!("StackValue expected Method, got {:?}", sv)),
701         }
702     }
703 }
704 
705 impl<'alloc> StackValueItem<'alloc> for MethodDefinition<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>706     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
707         match sv {
708             StackValue::MethodDefinition(v) => Ok(v),
709             _ => Err(format!("StackValue expected MethodDefinition, got {:?}", sv)),
710         }
711     }
712 }
713 
714 impl<'alloc> StackValueItem<'alloc> for Module<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>715     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
716         match sv {
717             StackValue::Module(v) => Ok(v),
718             _ => Err(format!("StackValue expected Module, got {:?}", sv)),
719         }
720     }
721 }
722 
723 impl<'alloc> StackValueItem<'alloc> for ModuleItems<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>724     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
725         match sv {
726             StackValue::ModuleItems(v) => Ok(v),
727             _ => Err(format!("StackValue expected ModuleItems, got {:?}", sv)),
728         }
729     }
730 }
731 
732 impl<'alloc> StackValueItem<'alloc> for NamedObjectProperty<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>733     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
734         match sv {
735             StackValue::NamedObjectProperty(v) => Ok(v),
736             _ => Err(format!("StackValue expected NamedObjectProperty, got {:?}", sv)),
737         }
738     }
739 }
740 
741 impl<'alloc> StackValueItem<'alloc> for NumericLiteral {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>742     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
743         match sv {
744             StackValue::NumericLiteral(v) => Ok(v),
745             _ => Err(format!("StackValue expected NumericLiteral, got {:?}", sv)),
746         }
747     }
748 }
749 
750 impl<'alloc> StackValueItem<'alloc> for ObjectAssignmentTarget<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>751     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
752         match sv {
753             StackValue::ObjectAssignmentTarget(v) => Ok(v),
754             _ => Err(format!("StackValue expected ObjectAssignmentTarget, got {:?}", sv)),
755         }
756     }
757 }
758 
759 impl<'alloc> StackValueItem<'alloc> for ObjectBinding<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>760     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
761         match sv {
762             StackValue::ObjectBinding(v) => Ok(v),
763             _ => Err(format!("StackValue expected ObjectBinding, got {:?}", sv)),
764         }
765     }
766 }
767 
768 impl<'alloc> StackValueItem<'alloc> for ObjectExpression<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>769     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
770         match sv {
771             StackValue::ObjectExpression(v) => Ok(v),
772             _ => Err(format!("StackValue expected ObjectExpression, got {:?}", sv)),
773         }
774     }
775 }
776 
777 impl<'alloc> StackValueItem<'alloc> for ObjectProperty<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>778     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
779         match sv {
780             StackValue::ObjectProperty(v) => Ok(v),
781             _ => Err(format!("StackValue expected ObjectProperty, got {:?}", sv)),
782         }
783     }
784 }
785 
786 impl<'alloc> StackValueItem<'alloc> for OptionalChain<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>787     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
788         match sv {
789             StackValue::OptionalChain(v) => Ok(v),
790             _ => Err(format!("StackValue expected OptionalChain, got {:?}", sv)),
791         }
792     }
793 }
794 
795 impl<'alloc> StackValueItem<'alloc> for Parameter<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>796     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
797         match sv {
798             StackValue::Parameter(v) => Ok(v),
799             _ => Err(format!("StackValue expected Parameter, got {:?}", sv)),
800         }
801     }
802 }
803 
804 impl<'alloc> StackValueItem<'alloc> for PrivateFieldExpression<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>805     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
806         match sv {
807             StackValue::PrivateFieldExpression(v) => Ok(v),
808             _ => Err(format!("StackValue expected PrivateFieldExpression, got {:?}", sv)),
809         }
810     }
811 }
812 
813 impl<'alloc> StackValueItem<'alloc> for PrivateIdentifier {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>814     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
815         match sv {
816             StackValue::PrivateIdentifier(v) => Ok(v),
817             _ => Err(format!("StackValue expected PrivateIdentifier, got {:?}", sv)),
818         }
819     }
820 }
821 
822 impl<'alloc> StackValueItem<'alloc> for Program<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>823     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
824         match sv {
825             StackValue::Program(v) => Ok(v),
826             _ => Err(format!("StackValue expected Program, got {:?}", sv)),
827         }
828     }
829 }
830 
831 impl<'alloc> StackValueItem<'alloc> for PropertyName<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>832     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
833         match sv {
834             StackValue::PropertyName(v) => Ok(v),
835             _ => Err(format!("StackValue expected PropertyName, got {:?}", sv)),
836         }
837     }
838 }
839 
840 impl<'alloc> StackValueItem<'alloc> for Script<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>841     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
842         match sv {
843             StackValue::Script(v) => Ok(v),
844             _ => Err(format!("StackValue expected Script, got {:?}", sv)),
845         }
846     }
847 }
848 
849 impl<'alloc> StackValueItem<'alloc> for Setter<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>850     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
851         match sv {
852             StackValue::Setter(v) => Ok(v),
853             _ => Err(format!("StackValue expected Setter, got {:?}", sv)),
854         }
855     }
856 }
857 
858 impl<'alloc> StackValueItem<'alloc> for ShorthandProperty {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>859     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
860         match sv {
861             StackValue::ShorthandProperty(v) => Ok(v),
862             _ => Err(format!("StackValue expected ShorthandProperty, got {:?}", sv)),
863         }
864     }
865 }
866 
867 impl<'alloc> StackValueItem<'alloc> for SimpleAssignmentTarget<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>868     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
869         match sv {
870             StackValue::SimpleAssignmentTarget(v) => Ok(v),
871             _ => Err(format!("StackValue expected SimpleAssignmentTarget, got {:?}", sv)),
872         }
873     }
874 }
875 
876 impl<'alloc> StackValueItem<'alloc> for Statement<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>877     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
878         match sv {
879             StackValue::Statement(v) => Ok(v),
880             _ => Err(format!("StackValue expected Statement, got {:?}", sv)),
881         }
882     }
883 }
884 
885 impl<'alloc> StackValueItem<'alloc> for StaticMemberAssignmentTarget<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>886     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
887         match sv {
888             StackValue::StaticMemberAssignmentTarget(v) => Ok(v),
889             _ => Err(format!("StackValue expected StaticMemberAssignmentTarget, got {:?}", sv)),
890         }
891     }
892 }
893 
894 impl<'alloc> StackValueItem<'alloc> for StaticMemberExpression<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>895     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
896         match sv {
897             StackValue::StaticMemberExpression(v) => Ok(v),
898             _ => Err(format!("StackValue expected StaticMemberExpression, got {:?}", sv)),
899         }
900     }
901 }
902 
903 impl<'alloc> StackValueItem<'alloc> for StaticPropertyName {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>904     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
905         match sv {
906             StackValue::StaticPropertyName(v) => Ok(v),
907             _ => Err(format!("StackValue expected StaticPropertyName, got {:?}", sv)),
908         }
909     }
910 }
911 
912 impl<'alloc> StackValueItem<'alloc> for SwitchCase<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>913     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
914         match sv {
915             StackValue::SwitchCase(v) => Ok(v),
916             _ => Err(format!("StackValue expected SwitchCase, got {:?}", sv)),
917         }
918     }
919 }
920 
921 impl<'alloc> StackValueItem<'alloc> for SwitchDefault<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>922     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
923         match sv {
924             StackValue::SwitchDefault(v) => Ok(v),
925             _ => Err(format!("StackValue expected SwitchDefault, got {:?}", sv)),
926         }
927     }
928 }
929 
930 impl<'alloc> StackValueItem<'alloc> for TemplateElement {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>931     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
932         match sv {
933             StackValue::TemplateElement(v) => Ok(v),
934             _ => Err(format!("StackValue expected TemplateElement, got {:?}", sv)),
935         }
936     }
937 }
938 
939 impl<'alloc> StackValueItem<'alloc> for TemplateExpression<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>940     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
941         match sv {
942             StackValue::TemplateExpression(v) => Ok(v),
943             _ => Err(format!("StackValue expected TemplateExpression, got {:?}", sv)),
944         }
945     }
946 }
947 
948 impl<'alloc> StackValueItem<'alloc> for TemplateExpressionElement<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>949     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
950         match sv {
951             StackValue::TemplateExpressionElement(v) => Ok(v),
952             _ => Err(format!("StackValue expected TemplateExpressionElement, got {:?}", sv)),
953         }
954     }
955 }
956 
957 impl<'alloc> StackValueItem<'alloc> for Token {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>958     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
959         match sv {
960             StackValue::Token(v) => Ok(v),
961             _ => Err(format!("StackValue expected Token, got {:?}", sv)),
962         }
963     }
964 }
965 
966 impl<'alloc> StackValueItem<'alloc> for UnaryOperator {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>967     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
968         match sv {
969             StackValue::UnaryOperator(v) => Ok(v),
970             _ => Err(format!("StackValue expected UnaryOperator, got {:?}", sv)),
971         }
972     }
973 }
974 
975 impl<'alloc> StackValueItem<'alloc> for UpdateOperator {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>976     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
977         match sv {
978             StackValue::UpdateOperator(v) => Ok(v),
979             _ => Err(format!("StackValue expected UpdateOperator, got {:?}", sv)),
980         }
981     }
982 }
983 
984 impl<'alloc> StackValueItem<'alloc> for VariableDeclaration<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>985     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
986         match sv {
987             StackValue::VariableDeclaration(v) => Ok(v),
988             _ => Err(format!("StackValue expected VariableDeclaration, got {:?}", sv)),
989         }
990     }
991 }
992 
993 impl<'alloc> StackValueItem<'alloc> for VariableDeclarationKind {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>994     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
995         match sv {
996             StackValue::VariableDeclarationKind(v) => Ok(v),
997             _ => Err(format!("StackValue expected VariableDeclarationKind, got {:?}", sv)),
998         }
999     }
1000 }
1001 
1002 impl<'alloc> StackValueItem<'alloc> for VariableDeclarationOrAssignmentTarget<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>1003     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
1004         match sv {
1005             StackValue::VariableDeclarationOrAssignmentTarget(v) => Ok(v),
1006             _ => Err(format!("StackValue expected VariableDeclarationOrAssignmentTarget, got {:?}", sv)),
1007         }
1008     }
1009 }
1010 
1011 impl<'alloc> StackValueItem<'alloc> for VariableDeclarationOrExpression<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>1012     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
1013         match sv {
1014             StackValue::VariableDeclarationOrExpression(v) => Ok(v),
1015             _ => Err(format!("StackValue expected VariableDeclarationOrExpression, got {:?}", sv)),
1016         }
1017     }
1018 }
1019 
1020 impl<'alloc> StackValueItem<'alloc> for VariableDeclarator<'alloc> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>1021     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
1022         match sv {
1023             StackValue::VariableDeclarator(v) => Ok(v),
1024             _ => Err(format!("StackValue expected VariableDeclarator, got {:?}", sv)),
1025         }
1026     }
1027 }
1028 
1029 impl<'alloc> StackValueItem<'alloc> for VariableReference {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>1030     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
1031         match sv {
1032             StackValue::VariableReference(v) => Ok(v),
1033             _ => Err(format!("StackValue expected VariableReference, got {:?}", sv)),
1034         }
1035     }
1036 }
1037 
1038 impl<'alloc> StackValueItem<'alloc> for arena::Vec<'alloc, ArrayExpressionElement<'alloc>> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>1039     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
1040         match sv {
1041             StackValue::VecArrayExpressionElement(v) => Ok(v),
1042             _ => Err(format!("StackValue expected Vec<ArrayExpressionElement>, got {:?}", sv)),
1043         }
1044     }
1045 }
1046 
1047 impl<'alloc> StackValueItem<'alloc> for arena::Vec<'alloc, BindingProperty<'alloc>> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>1048     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
1049         match sv {
1050             StackValue::VecBindingProperty(v) => Ok(v),
1051             _ => Err(format!("StackValue expected Vec<BindingProperty>, got {:?}", sv)),
1052         }
1053     }
1054 }
1055 
1056 impl<'alloc> StackValueItem<'alloc> for arena::Vec<'alloc, arena::Box<'alloc, ClassElement<'alloc>>> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>1057     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
1058         match sv {
1059             StackValue::VecClassElement(v) => Ok(v),
1060             _ => Err(format!("StackValue expected Vec<Box<ClassElement>>, got {:?}", sv)),
1061         }
1062     }
1063 }
1064 
1065 impl<'alloc> StackValueItem<'alloc> for arena::Vec<'alloc, Option<Parameter<'alloc>>> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>1066     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
1067         match sv {
1068             StackValue::VecOption(v) => Ok(v),
1069             _ => Err(format!("StackValue expected Vec<Option<Parameter>>, got {:?}", sv)),
1070         }
1071     }
1072 }
1073 
1074 impl<'alloc> StackValueItem<'alloc> for arena::Vec<'alloc, Statement<'alloc>> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>1075     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
1076         match sv {
1077             StackValue::VecStatement(v) => Ok(v),
1078             _ => Err(format!("StackValue expected Vec<Statement>, got {:?}", sv)),
1079         }
1080     }
1081 }
1082 
1083 impl<'alloc> StackValueItem<'alloc> for arena::Vec<'alloc, SwitchCase<'alloc>> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>1084     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
1085         match sv {
1086             StackValue::VecSwitchCase(v) => Ok(v),
1087             _ => Err(format!("StackValue expected Vec<SwitchCase>, got {:?}", sv)),
1088         }
1089     }
1090 }
1091 
1092 impl<'alloc> StackValueItem<'alloc> for arena::Vec<'alloc, VariableDeclarator<'alloc>> {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>1093     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
1094         match sv {
1095             StackValue::VecVariableDeclarator(v) => Ok(v),
1096             _ => Err(format!("StackValue expected Vec<VariableDeclarator>, got {:?}", sv)),
1097         }
1098     }
1099 }
1100 
1101 impl<'alloc> StackValueItem<'alloc> for Void {
to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self>1102     fn to_ast(sv: StackValue<'alloc>) -> AstResult<'alloc, Self> {
1103         match sv {
1104             StackValue::Void(v) => Ok(v),
1105             _ => Err(format!("StackValue expected Void, got {:?}", sv)),
1106         }
1107     }
1108 }
1109 
1110 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Argument<'alloc>> {
1111     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1112     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1113         Ok(StackValue::Argument(self))
1114     }
1115 }
1116 
1117 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Arguments<'alloc>> {
1118     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1119     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1120         Ok(StackValue::Arguments(self))
1121     }
1122 }
1123 
1124 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ArrayAssignmentTarget<'alloc>> {
1125     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1126     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1127         Ok(StackValue::ArrayAssignmentTarget(self))
1128     }
1129 }
1130 
1131 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ArrayBinding<'alloc>> {
1132     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1133     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1134         Ok(StackValue::ArrayBinding(self))
1135     }
1136 }
1137 
1138 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ArrayExpression<'alloc>> {
1139     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1140     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1141         Ok(StackValue::ArrayExpression(self))
1142     }
1143 }
1144 
1145 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ArrayExpressionElement<'alloc>> {
1146     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1147     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1148         Ok(StackValue::ArrayExpressionElement(self))
1149     }
1150 }
1151 
1152 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ArrowExpressionBody<'alloc>> {
1153     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1154     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1155         Ok(StackValue::ArrowExpressionBody(self))
1156     }
1157 }
1158 
1159 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, AssignmentTarget<'alloc>> {
1160     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1161     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1162         Ok(StackValue::AssignmentTarget(self))
1163     }
1164 }
1165 
1166 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, AssignmentTargetIdentifier> {
1167     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1168     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1169         Ok(StackValue::AssignmentTargetIdentifier(self))
1170     }
1171 }
1172 
1173 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, AssignmentTargetMaybeDefault<'alloc>> {
1174     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1175     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1176         Ok(StackValue::AssignmentTargetMaybeDefault(self))
1177     }
1178 }
1179 
1180 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, AssignmentTargetPattern<'alloc>> {
1181     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1182     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1183         Ok(StackValue::AssignmentTargetPattern(self))
1184     }
1185 }
1186 
1187 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, AssignmentTargetProperty<'alloc>> {
1188     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1189     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1190         Ok(StackValue::AssignmentTargetProperty(self))
1191     }
1192 }
1193 
1194 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, AssignmentTargetPropertyIdentifier<'alloc>> {
1195     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1196     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1197         Ok(StackValue::AssignmentTargetPropertyIdentifier(self))
1198     }
1199 }
1200 
1201 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, AssignmentTargetPropertyProperty<'alloc>> {
1202     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1203     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1204         Ok(StackValue::AssignmentTargetPropertyProperty(self))
1205     }
1206 }
1207 
1208 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, AssignmentTargetWithDefault<'alloc>> {
1209     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1210     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1211         Ok(StackValue::AssignmentTargetWithDefault(self))
1212     }
1213 }
1214 
1215 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, BinaryOperator> {
1216     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1217     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1218         Ok(StackValue::BinaryOperator(self))
1219     }
1220 }
1221 
1222 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Binding<'alloc>> {
1223     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1224     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1225         Ok(StackValue::Binding(self))
1226     }
1227 }
1228 
1229 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, BindingIdentifier> {
1230     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1231     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1232         Ok(StackValue::BindingIdentifier(self))
1233     }
1234 }
1235 
1236 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, BindingPattern<'alloc>> {
1237     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1238     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1239         Ok(StackValue::BindingPattern(self))
1240     }
1241 }
1242 
1243 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, BindingProperty<'alloc>> {
1244     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1245     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1246         Ok(StackValue::BindingProperty(self))
1247     }
1248 }
1249 
1250 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, BindingPropertyIdentifier<'alloc>> {
1251     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1252     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1253         Ok(StackValue::BindingPropertyIdentifier(self))
1254     }
1255 }
1256 
1257 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, BindingPropertyProperty<'alloc>> {
1258     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1259     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1260         Ok(StackValue::BindingPropertyProperty(self))
1261     }
1262 }
1263 
1264 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, BindingWithDefault<'alloc>> {
1265     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1266     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1267         Ok(StackValue::BindingWithDefault(self))
1268     }
1269 }
1270 
1271 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Block<'alloc>> {
1272     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1273     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1274         Ok(StackValue::Block(self))
1275     }
1276 }
1277 
1278 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, CallExpression<'alloc>> {
1279     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1280     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1281         Ok(StackValue::CallExpression(self))
1282     }
1283 }
1284 
1285 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, CatchClause<'alloc>> {
1286     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1287     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1288         Ok(StackValue::CatchClause(self))
1289     }
1290 }
1291 
1292 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ClassDeclaration<'alloc>> {
1293     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1294     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1295         Ok(StackValue::ClassDeclaration(self))
1296     }
1297 }
1298 
1299 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ClassElement<'alloc>> {
1300     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1301     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1302         Ok(StackValue::ClassElement(self))
1303     }
1304 }
1305 
1306 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ClassElementName<'alloc>> {
1307     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1308     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1309         Ok(StackValue::ClassElementName(self))
1310     }
1311 }
1312 
1313 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ClassExpression<'alloc>> {
1314     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1315     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1316         Ok(StackValue::ClassExpression(self))
1317     }
1318 }
1319 
1320 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, CompoundAssignmentOperator> {
1321     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1322     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1323         Ok(StackValue::CompoundAssignmentOperator(self))
1324     }
1325 }
1326 
1327 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ComputedMemberAssignmentTarget<'alloc>> {
1328     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1329     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1330         Ok(StackValue::ComputedMemberAssignmentTarget(self))
1331     }
1332 }
1333 
1334 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ComputedMemberExpression<'alloc>> {
1335     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1336     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1337         Ok(StackValue::ComputedMemberExpression(self))
1338     }
1339 }
1340 
1341 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ComputedPropertyName<'alloc>> {
1342     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1343     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1344         Ok(StackValue::ComputedPropertyName(self))
1345     }
1346 }
1347 
1348 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, CoverParenthesized<'alloc>> {
1349     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1350     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1351         Ok(StackValue::CoverParenthesized(self))
1352     }
1353 }
1354 
1355 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, DataProperty<'alloc>> {
1356     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1357     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1358         Ok(StackValue::DataProperty(self))
1359     }
1360 }
1361 
1362 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Directive> {
1363     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1364     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1365         Ok(StackValue::Directive(self))
1366     }
1367 }
1368 
1369 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Export<'alloc>> {
1370     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1371     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1372         Ok(StackValue::Export(self))
1373     }
1374 }
1375 
1376 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ExportAllFrom> {
1377     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1378     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1379         Ok(StackValue::ExportAllFrom(self))
1380     }
1381 }
1382 
1383 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ExportDeclaration<'alloc>> {
1384     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1385     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1386         Ok(StackValue::ExportDeclaration(self))
1387     }
1388 }
1389 
1390 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ExportDefault<'alloc>> {
1391     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1392     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1393         Ok(StackValue::ExportDefault(self))
1394     }
1395 }
1396 
1397 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ExportFrom<'alloc>> {
1398     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1399     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1400         Ok(StackValue::ExportFrom(self))
1401     }
1402 }
1403 
1404 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ExportFromSpecifier> {
1405     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1406     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1407         Ok(StackValue::ExportFromSpecifier(self))
1408     }
1409 }
1410 
1411 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ExportLocalSpecifier> {
1412     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1413     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1414         Ok(StackValue::ExportLocalSpecifier(self))
1415     }
1416 }
1417 
1418 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ExportLocals<'alloc>> {
1419     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1420     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1421         Ok(StackValue::ExportLocals(self))
1422     }
1423 }
1424 
1425 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Expression<'alloc>> {
1426     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1427     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1428         Ok(StackValue::Expression(self))
1429     }
1430 }
1431 
1432 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ExpressionOrSuper<'alloc>> {
1433     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1434     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1435         Ok(StackValue::ExpressionOrSuper(self))
1436     }
1437 }
1438 
1439 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, FormalParameters<'alloc>> {
1440     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1441     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1442         Ok(StackValue::FormalParameters(self))
1443     }
1444 }
1445 
1446 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Function<'alloc>> {
1447     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1448     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1449         Ok(StackValue::Function(self))
1450     }
1451 }
1452 
1453 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, FunctionBody<'alloc>> {
1454     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1455     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1456         Ok(StackValue::FunctionBody(self))
1457     }
1458 }
1459 
1460 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Getter<'alloc>> {
1461     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1462     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1463         Ok(StackValue::Getter(self))
1464     }
1465 }
1466 
1467 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Identifier> {
1468     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1469     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1470         Ok(StackValue::Identifier(self))
1471     }
1472 }
1473 
1474 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, IdentifierExpression> {
1475     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1476     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1477         Ok(StackValue::IdentifierExpression(self))
1478     }
1479 }
1480 
1481 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, IdentifierName> {
1482     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1483     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1484         Ok(StackValue::IdentifierName(self))
1485     }
1486 }
1487 
1488 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, IfStatement<'alloc>> {
1489     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1490     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1491         Ok(StackValue::IfStatement(self))
1492     }
1493 }
1494 
1495 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Import<'alloc>> {
1496     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1497     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1498         Ok(StackValue::Import(self))
1499     }
1500 }
1501 
1502 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ImportDeclaration<'alloc>> {
1503     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1504     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1505         Ok(StackValue::ImportDeclaration(self))
1506     }
1507 }
1508 
1509 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ImportNamespace> {
1510     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1511     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1512         Ok(StackValue::ImportNamespace(self))
1513     }
1514 }
1515 
1516 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ImportSpecifier> {
1517     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1518     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1519         Ok(StackValue::ImportSpecifier(self))
1520     }
1521 }
1522 
1523 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Label> {
1524     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1525     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1526         Ok(StackValue::Label(self))
1527     }
1528 }
1529 
1530 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, MemberAssignmentTarget<'alloc>> {
1531     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1532     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1533         Ok(StackValue::MemberAssignmentTarget(self))
1534     }
1535 }
1536 
1537 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, MemberExpression<'alloc>> {
1538     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1539     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1540         Ok(StackValue::MemberExpression(self))
1541     }
1542 }
1543 
1544 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Method<'alloc>> {
1545     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1546     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1547         Ok(StackValue::Method(self))
1548     }
1549 }
1550 
1551 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, MethodDefinition<'alloc>> {
1552     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1553     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1554         Ok(StackValue::MethodDefinition(self))
1555     }
1556 }
1557 
1558 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Module<'alloc>> {
1559     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1560     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1561         Ok(StackValue::Module(self))
1562     }
1563 }
1564 
1565 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ModuleItems<'alloc>> {
1566     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1567     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1568         Ok(StackValue::ModuleItems(self))
1569     }
1570 }
1571 
1572 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, NamedObjectProperty<'alloc>> {
1573     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1574     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1575         Ok(StackValue::NamedObjectProperty(self))
1576     }
1577 }
1578 
1579 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, NumericLiteral> {
1580     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1581     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1582         Ok(StackValue::NumericLiteral(self))
1583     }
1584 }
1585 
1586 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ObjectAssignmentTarget<'alloc>> {
1587     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1588     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1589         Ok(StackValue::ObjectAssignmentTarget(self))
1590     }
1591 }
1592 
1593 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ObjectBinding<'alloc>> {
1594     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1595     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1596         Ok(StackValue::ObjectBinding(self))
1597     }
1598 }
1599 
1600 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ObjectExpression<'alloc>> {
1601     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1602     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1603         Ok(StackValue::ObjectExpression(self))
1604     }
1605 }
1606 
1607 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ObjectProperty<'alloc>> {
1608     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1609     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1610         Ok(StackValue::ObjectProperty(self))
1611     }
1612 }
1613 
1614 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, OptionalChain<'alloc>> {
1615     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1616     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1617         Ok(StackValue::OptionalChain(self))
1618     }
1619 }
1620 
1621 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Parameter<'alloc>> {
1622     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1623     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1624         Ok(StackValue::Parameter(self))
1625     }
1626 }
1627 
1628 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, PrivateFieldExpression<'alloc>> {
1629     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1630     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1631         Ok(StackValue::PrivateFieldExpression(self))
1632     }
1633 }
1634 
1635 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, PrivateIdentifier> {
1636     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1637     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1638         Ok(StackValue::PrivateIdentifier(self))
1639     }
1640 }
1641 
1642 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Program<'alloc>> {
1643     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1644     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1645         Ok(StackValue::Program(self))
1646     }
1647 }
1648 
1649 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, PropertyName<'alloc>> {
1650     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1651     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1652         Ok(StackValue::PropertyName(self))
1653     }
1654 }
1655 
1656 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Script<'alloc>> {
1657     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1658     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1659         Ok(StackValue::Script(self))
1660     }
1661 }
1662 
1663 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Setter<'alloc>> {
1664     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1665     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1666         Ok(StackValue::Setter(self))
1667     }
1668 }
1669 
1670 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, ShorthandProperty> {
1671     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1672     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1673         Ok(StackValue::ShorthandProperty(self))
1674     }
1675 }
1676 
1677 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, SimpleAssignmentTarget<'alloc>> {
1678     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1679     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1680         Ok(StackValue::SimpleAssignmentTarget(self))
1681     }
1682 }
1683 
1684 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Statement<'alloc>> {
1685     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1686     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1687         Ok(StackValue::Statement(self))
1688     }
1689 }
1690 
1691 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, StaticMemberAssignmentTarget<'alloc>> {
1692     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1693     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1694         Ok(StackValue::StaticMemberAssignmentTarget(self))
1695     }
1696 }
1697 
1698 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, StaticMemberExpression<'alloc>> {
1699     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1700     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1701         Ok(StackValue::StaticMemberExpression(self))
1702     }
1703 }
1704 
1705 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, StaticPropertyName> {
1706     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1707     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1708         Ok(StackValue::StaticPropertyName(self))
1709     }
1710 }
1711 
1712 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, SwitchCase<'alloc>> {
1713     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1714     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1715         Ok(StackValue::SwitchCase(self))
1716     }
1717 }
1718 
1719 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, SwitchDefault<'alloc>> {
1720     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1721     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1722         Ok(StackValue::SwitchDefault(self))
1723     }
1724 }
1725 
1726 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, TemplateElement> {
1727     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1728     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1729         Ok(StackValue::TemplateElement(self))
1730     }
1731 }
1732 
1733 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, TemplateExpression<'alloc>> {
1734     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1735     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1736         Ok(StackValue::TemplateExpression(self))
1737     }
1738 }
1739 
1740 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, TemplateExpressionElement<'alloc>> {
1741     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1742     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1743         Ok(StackValue::TemplateExpressionElement(self))
1744     }
1745 }
1746 
1747 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Token> {
1748     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1749     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1750         Ok(StackValue::Token(self))
1751     }
1752 }
1753 
1754 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, UnaryOperator> {
1755     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1756     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1757         Ok(StackValue::UnaryOperator(self))
1758     }
1759 }
1760 
1761 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, UpdateOperator> {
1762     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1763     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1764         Ok(StackValue::UpdateOperator(self))
1765     }
1766 }
1767 
1768 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, VariableDeclaration<'alloc>> {
1769     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1770     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1771         Ok(StackValue::VariableDeclaration(self))
1772     }
1773 }
1774 
1775 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, VariableDeclarationKind> {
1776     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1777     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1778         Ok(StackValue::VariableDeclarationKind(self))
1779     }
1780 }
1781 
1782 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, VariableDeclarationOrAssignmentTarget<'alloc>> {
1783     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1784     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1785         Ok(StackValue::VariableDeclarationOrAssignmentTarget(self))
1786     }
1787 }
1788 
1789 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, VariableDeclarationOrExpression<'alloc>> {
1790     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1791     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1792         Ok(StackValue::VariableDeclarationOrExpression(self))
1793     }
1794 }
1795 
1796 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, VariableDeclarator<'alloc>> {
1797     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1798     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1799         Ok(StackValue::VariableDeclarator(self))
1800     }
1801 }
1802 
1803 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, VariableReference> {
1804     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1805     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1806         Ok(StackValue::VariableReference(self))
1807     }
1808 }
1809 
1810 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, arena::Vec<'alloc, ArrayExpressionElement<'alloc>>> {
1811     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1812     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1813         Ok(StackValue::VecArrayExpressionElement(self))
1814     }
1815 }
1816 
1817 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, arena::Vec<'alloc, BindingProperty<'alloc>>> {
1818     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1819     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1820         Ok(StackValue::VecBindingProperty(self))
1821     }
1822 }
1823 
1824 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, arena::Vec<'alloc, arena::Box<'alloc, ClassElement<'alloc>>>> {
1825     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1826     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1827         Ok(StackValue::VecClassElement(self))
1828     }
1829 }
1830 
1831 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, arena::Vec<'alloc, Option<Parameter<'alloc>>>> {
1832     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1833     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1834         Ok(StackValue::VecOption(self))
1835     }
1836 }
1837 
1838 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, arena::Vec<'alloc, Statement<'alloc>>> {
1839     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1840     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1841         Ok(StackValue::VecStatement(self))
1842     }
1843 }
1844 
1845 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, arena::Vec<'alloc, SwitchCase<'alloc>>> {
1846     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1847     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1848         Ok(StackValue::VecSwitchCase(self))
1849     }
1850 }
1851 
1852 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, arena::Vec<'alloc, VariableDeclarator<'alloc>>> {
1853     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1854     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1855         Ok(StackValue::VecVariableDeclarator(self))
1856     }
1857 }
1858 
1859 impl<'alloc> TryIntoStack<'alloc> for arena::Box<'alloc, Void> {
1860     type Error = Infallible;
try_into_stack(self) -> Result<StackValue<'alloc>, Infallible>1861     fn try_into_stack(self) -> Result<StackValue<'alloc>, Infallible> {
1862         Ok(StackValue::Void(self))
1863     }
1864 }
1865 
1866 impl<'alloc, T, E> TryIntoStack<'alloc> for Result<T, E>
1867 where
1868     T: TryIntoStack<'alloc>,
1869     E: From<T::Error>,
1870 {
1871     type Error = E;
try_into_stack(self) -> Result<StackValue<'alloc>, E>1872     fn try_into_stack(self) -> Result<StackValue<'alloc>, E> {
1873         Ok(self?.try_into_stack()?)
1874     }
1875 }
1876