• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (C) 2009 Apple Inc. All rights reserved.
3  *
4  *  This library is free software; you can redistribute it and/or
5  *  modify it under the terms of the GNU Library General Public
6  *  License as published by the Free Software Foundation; either
7  *  version 2 of the License, or (at your option) any later version.
8  *
9  *  This library is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  *  Library General Public License for more details.
13  *
14  *  You should have received a copy of the GNU Library General Public License
15  *  along with this library; see the file COPYING.LIB.  If not, write to
16  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  *  Boston, MA 02110-1301, USA.
18  *
19  */
20 
21 #ifndef NodeConstructors_h
22 #define NodeConstructors_h
23 
24 #include "Nodes.h"
25 #include "Lexer.h"
26 #include "Parser.h"
27 
28 namespace JSC {
29 
new(size_t size,JSGlobalData * globalData)30     inline void* ParserArenaFreeable::operator new(size_t size, JSGlobalData* globalData)
31     {
32         return globalData->parser->arena().allocateFreeable(size);
33     }
34 
new(size_t size,JSGlobalData * globalData)35     inline void* ParserArenaDeletable::operator new(size_t size, JSGlobalData* globalData)
36     {
37         return globalData->parser->arena().allocateDeletable(size);
38     }
39 
ParserArenaRefCounted(JSGlobalData * globalData)40     inline ParserArenaRefCounted::ParserArenaRefCounted(JSGlobalData* globalData)
41     {
42         globalData->parser->arena().derefWithArena(adoptRef(this));
43     }
44 
Node(JSGlobalData * globalData)45     inline Node::Node(JSGlobalData* globalData)
46         : m_line(globalData->lexer->lineNumber())
47     {
48     }
49 
ExpressionNode(JSGlobalData * globalData,ResultType resultType)50     inline ExpressionNode::ExpressionNode(JSGlobalData* globalData, ResultType resultType)
51         : Node(globalData)
52         , m_resultType(resultType)
53     {
54     }
55 
StatementNode(JSGlobalData * globalData)56     inline StatementNode::StatementNode(JSGlobalData* globalData)
57         : Node(globalData)
58         , m_lastLine(-1)
59     {
60     }
61 
NullNode(JSGlobalData * globalData)62     inline NullNode::NullNode(JSGlobalData* globalData)
63         : ExpressionNode(globalData, ResultType::nullType())
64     {
65     }
66 
BooleanNode(JSGlobalData * globalData,bool value)67     inline BooleanNode::BooleanNode(JSGlobalData* globalData, bool value)
68         : ExpressionNode(globalData, ResultType::booleanType())
69         , m_value(value)
70     {
71     }
72 
NumberNode(JSGlobalData * globalData,double value)73     inline NumberNode::NumberNode(JSGlobalData* globalData, double value)
74         : ExpressionNode(globalData, ResultType::numberType())
75         , m_value(value)
76     {
77     }
78 
StringNode(JSGlobalData * globalData,const Identifier & value)79     inline StringNode::StringNode(JSGlobalData* globalData, const Identifier& value)
80         : ExpressionNode(globalData, ResultType::stringType())
81         , m_value(value)
82     {
83     }
84 
RegExpNode(JSGlobalData * globalData,const Identifier & pattern,const Identifier & flags)85     inline RegExpNode::RegExpNode(JSGlobalData* globalData, const Identifier& pattern, const Identifier& flags)
86         : ExpressionNode(globalData)
87         , m_pattern(pattern)
88         , m_flags(flags)
89     {
90     }
91 
ThisNode(JSGlobalData * globalData)92     inline ThisNode::ThisNode(JSGlobalData* globalData)
93         : ExpressionNode(globalData)
94     {
95     }
96 
ResolveNode(JSGlobalData * globalData,const Identifier & ident,int startOffset)97     inline ResolveNode::ResolveNode(JSGlobalData* globalData, const Identifier& ident, int startOffset)
98         : ExpressionNode(globalData)
99         , m_ident(ident)
100         , m_startOffset(startOffset)
101     {
102     }
103 
ElementNode(JSGlobalData *,int elision,ExpressionNode * node)104     inline ElementNode::ElementNode(JSGlobalData*, int elision, ExpressionNode* node)
105         : m_next(0)
106         , m_elision(elision)
107         , m_node(node)
108     {
109     }
110 
ElementNode(JSGlobalData *,ElementNode * l,int elision,ExpressionNode * node)111     inline ElementNode::ElementNode(JSGlobalData*, ElementNode* l, int elision, ExpressionNode* node)
112         : m_next(0)
113         , m_elision(elision)
114         , m_node(node)
115     {
116         l->m_next = this;
117     }
118 
ArrayNode(JSGlobalData * globalData,int elision)119     inline ArrayNode::ArrayNode(JSGlobalData* globalData, int elision)
120         : ExpressionNode(globalData)
121         , m_element(0)
122         , m_elision(elision)
123         , m_optional(true)
124     {
125     }
126 
ArrayNode(JSGlobalData * globalData,ElementNode * element)127     inline ArrayNode::ArrayNode(JSGlobalData* globalData, ElementNode* element)
128         : ExpressionNode(globalData)
129         , m_element(element)
130         , m_elision(0)
131         , m_optional(false)
132     {
133     }
134 
ArrayNode(JSGlobalData * globalData,int elision,ElementNode * element)135     inline ArrayNode::ArrayNode(JSGlobalData* globalData, int elision, ElementNode* element)
136         : ExpressionNode(globalData)
137         , m_element(element)
138         , m_elision(elision)
139         , m_optional(true)
140     {
141     }
142 
PropertyNode(JSGlobalData *,const Identifier & name,ExpressionNode * assign,Type type)143     inline PropertyNode::PropertyNode(JSGlobalData*, const Identifier& name, ExpressionNode* assign, Type type)
144         : m_name(name)
145         , m_assign(assign)
146         , m_type(type)
147     {
148     }
149 
PropertyNode(JSGlobalData * globalData,double name,ExpressionNode * assign,Type type)150     inline PropertyNode::PropertyNode(JSGlobalData* globalData, double name, ExpressionNode* assign, Type type)
151         : m_name(globalData->parser->arena().identifierArena().makeNumericIdentifier(globalData, name))
152         , m_assign(assign)
153         , m_type(type)
154     {
155     }
156 
PropertyListNode(JSGlobalData * globalData,PropertyNode * node)157     inline PropertyListNode::PropertyListNode(JSGlobalData* globalData, PropertyNode* node)
158         : Node(globalData)
159         , m_node(node)
160         , m_next(0)
161     {
162     }
163 
PropertyListNode(JSGlobalData * globalData,PropertyNode * node,PropertyListNode * list)164     inline PropertyListNode::PropertyListNode(JSGlobalData* globalData, PropertyNode* node, PropertyListNode* list)
165         : Node(globalData)
166         , m_node(node)
167         , m_next(0)
168     {
169         list->m_next = this;
170     }
171 
ObjectLiteralNode(JSGlobalData * globalData)172     inline ObjectLiteralNode::ObjectLiteralNode(JSGlobalData* globalData)
173         : ExpressionNode(globalData)
174         , m_list(0)
175     {
176     }
177 
ObjectLiteralNode(JSGlobalData * globalData,PropertyListNode * list)178     inline ObjectLiteralNode::ObjectLiteralNode(JSGlobalData* globalData, PropertyListNode* list)
179         : ExpressionNode(globalData)
180         , m_list(list)
181     {
182     }
183 
BracketAccessorNode(JSGlobalData * globalData,ExpressionNode * base,ExpressionNode * subscript,bool subscriptHasAssignments)184     inline BracketAccessorNode::BracketAccessorNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, bool subscriptHasAssignments)
185         : ExpressionNode(globalData)
186         , m_base(base)
187         , m_subscript(subscript)
188         , m_subscriptHasAssignments(subscriptHasAssignments)
189     {
190     }
191 
DotAccessorNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident)192     inline DotAccessorNode::DotAccessorNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident)
193         : ExpressionNode(globalData)
194         , m_base(base)
195         , m_ident(ident)
196     {
197     }
198 
ArgumentListNode(JSGlobalData * globalData,ExpressionNode * expr)199     inline ArgumentListNode::ArgumentListNode(JSGlobalData* globalData, ExpressionNode* expr)
200         : Node(globalData)
201         , m_next(0)
202         , m_expr(expr)
203     {
204     }
205 
ArgumentListNode(JSGlobalData * globalData,ArgumentListNode * listNode,ExpressionNode * expr)206     inline ArgumentListNode::ArgumentListNode(JSGlobalData* globalData, ArgumentListNode* listNode, ExpressionNode* expr)
207         : Node(globalData)
208         , m_next(0)
209         , m_expr(expr)
210     {
211         listNode->m_next = this;
212     }
213 
ArgumentsNode(JSGlobalData *)214     inline ArgumentsNode::ArgumentsNode(JSGlobalData*)
215         : m_listNode(0)
216     {
217     }
218 
ArgumentsNode(JSGlobalData *,ArgumentListNode * listNode)219     inline ArgumentsNode::ArgumentsNode(JSGlobalData*, ArgumentListNode* listNode)
220         : m_listNode(listNode)
221     {
222     }
223 
NewExprNode(JSGlobalData * globalData,ExpressionNode * expr)224     inline NewExprNode::NewExprNode(JSGlobalData* globalData, ExpressionNode* expr)
225         : ExpressionNode(globalData)
226         , m_expr(expr)
227         , m_args(0)
228     {
229     }
230 
NewExprNode(JSGlobalData * globalData,ExpressionNode * expr,ArgumentsNode * args)231     inline NewExprNode::NewExprNode(JSGlobalData* globalData, ExpressionNode* expr, ArgumentsNode* args)
232         : ExpressionNode(globalData)
233         , m_expr(expr)
234         , m_args(args)
235     {
236     }
237 
EvalFunctionCallNode(JSGlobalData * globalData,ArgumentsNode * args,unsigned divot,unsigned startOffset,unsigned endOffset)238     inline EvalFunctionCallNode::EvalFunctionCallNode(JSGlobalData* globalData, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
239         : ExpressionNode(globalData)
240         , ThrowableExpressionData(divot, startOffset, endOffset)
241         , m_args(args)
242     {
243     }
244 
FunctionCallValueNode(JSGlobalData * globalData,ExpressionNode * expr,ArgumentsNode * args,unsigned divot,unsigned startOffset,unsigned endOffset)245     inline FunctionCallValueNode::FunctionCallValueNode(JSGlobalData* globalData, ExpressionNode* expr, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
246         : ExpressionNode(globalData)
247         , ThrowableExpressionData(divot, startOffset, endOffset)
248         , m_expr(expr)
249         , m_args(args)
250     {
251     }
252 
FunctionCallResolveNode(JSGlobalData * globalData,const Identifier & ident,ArgumentsNode * args,unsigned divot,unsigned startOffset,unsigned endOffset)253     inline FunctionCallResolveNode::FunctionCallResolveNode(JSGlobalData* globalData, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
254         : ExpressionNode(globalData)
255         , ThrowableExpressionData(divot, startOffset, endOffset)
256         , m_ident(ident)
257         , m_args(args)
258     {
259     }
260 
FunctionCallBracketNode(JSGlobalData * globalData,ExpressionNode * base,ExpressionNode * subscript,ArgumentsNode * args,unsigned divot,unsigned startOffset,unsigned endOffset)261     inline FunctionCallBracketNode::FunctionCallBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
262         : ExpressionNode(globalData)
263         , ThrowableSubExpressionData(divot, startOffset, endOffset)
264         , m_base(base)
265         , m_subscript(subscript)
266         , m_args(args)
267     {
268     }
269 
FunctionCallDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,ArgumentsNode * args,unsigned divot,unsigned startOffset,unsigned endOffset)270     inline FunctionCallDotNode::FunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
271         : ExpressionNode(globalData)
272         , ThrowableSubExpressionData(divot, startOffset, endOffset)
273         , m_base(base)
274         , m_ident(ident)
275         , m_args(args)
276     {
277     }
278 
CallFunctionCallDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,ArgumentsNode * args,unsigned divot,unsigned startOffset,unsigned endOffset)279     inline CallFunctionCallDotNode::CallFunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
280         : FunctionCallDotNode(globalData, base, ident, args, divot, startOffset, endOffset)
281     {
282     }
283 
ApplyFunctionCallDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,ArgumentsNode * args,unsigned divot,unsigned startOffset,unsigned endOffset)284     inline ApplyFunctionCallDotNode::ApplyFunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
285         : FunctionCallDotNode(globalData, base, ident, args, divot, startOffset, endOffset)
286     {
287     }
288 
PrePostResolveNode(JSGlobalData * globalData,const Identifier & ident,unsigned divot,unsigned startOffset,unsigned endOffset)289     inline PrePostResolveNode::PrePostResolveNode(JSGlobalData* globalData, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset)
290         : ExpressionNode(globalData, ResultType::numberType()) // could be reusable for pre?
291         , ThrowableExpressionData(divot, startOffset, endOffset)
292         , m_ident(ident)
293     {
294     }
295 
PostfixResolveNode(JSGlobalData * globalData,const Identifier & ident,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)296     inline PostfixResolveNode::PostfixResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
297         : PrePostResolveNode(globalData, ident, divot, startOffset, endOffset)
298         , m_operator(oper)
299     {
300     }
301 
PostfixBracketNode(JSGlobalData * globalData,ExpressionNode * base,ExpressionNode * subscript,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)302     inline PostfixBracketNode::PostfixBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
303         : ExpressionNode(globalData)
304         , ThrowableSubExpressionData(divot, startOffset, endOffset)
305         , m_base(base)
306         , m_subscript(subscript)
307         , m_operator(oper)
308     {
309     }
310 
PostfixDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)311     inline PostfixDotNode::PostfixDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
312         : ExpressionNode(globalData)
313         , ThrowableSubExpressionData(divot, startOffset, endOffset)
314         , m_base(base)
315         , m_ident(ident)
316         , m_operator(oper)
317     {
318     }
319 
PostfixErrorNode(JSGlobalData * globalData,ExpressionNode * expr,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)320     inline PostfixErrorNode::PostfixErrorNode(JSGlobalData* globalData, ExpressionNode* expr, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
321         : ExpressionNode(globalData)
322         , ThrowableSubExpressionData(divot, startOffset, endOffset)
323         , m_expr(expr)
324         , m_operator(oper)
325     {
326     }
327 
DeleteResolveNode(JSGlobalData * globalData,const Identifier & ident,unsigned divot,unsigned startOffset,unsigned endOffset)328     inline DeleteResolveNode::DeleteResolveNode(JSGlobalData* globalData, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset)
329         : ExpressionNode(globalData)
330         , ThrowableExpressionData(divot, startOffset, endOffset)
331         , m_ident(ident)
332     {
333     }
334 
DeleteBracketNode(JSGlobalData * globalData,ExpressionNode * base,ExpressionNode * subscript,unsigned divot,unsigned startOffset,unsigned endOffset)335     inline DeleteBracketNode::DeleteBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, unsigned divot, unsigned startOffset, unsigned endOffset)
336         : ExpressionNode(globalData)
337         , ThrowableExpressionData(divot, startOffset, endOffset)
338         , m_base(base)
339         , m_subscript(subscript)
340     {
341     }
342 
DeleteDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,unsigned divot,unsigned startOffset,unsigned endOffset)343     inline DeleteDotNode::DeleteDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset)
344         : ExpressionNode(globalData)
345         , ThrowableExpressionData(divot, startOffset, endOffset)
346         , m_base(base)
347         , m_ident(ident)
348     {
349     }
350 
DeleteValueNode(JSGlobalData * globalData,ExpressionNode * expr)351     inline DeleteValueNode::DeleteValueNode(JSGlobalData* globalData, ExpressionNode* expr)
352         : ExpressionNode(globalData)
353         , m_expr(expr)
354     {
355     }
356 
VoidNode(JSGlobalData * globalData,ExpressionNode * expr)357     inline VoidNode::VoidNode(JSGlobalData* globalData, ExpressionNode* expr)
358         : ExpressionNode(globalData)
359         , m_expr(expr)
360     {
361     }
362 
TypeOfResolveNode(JSGlobalData * globalData,const Identifier & ident)363     inline TypeOfResolveNode::TypeOfResolveNode(JSGlobalData* globalData, const Identifier& ident)
364         : ExpressionNode(globalData, ResultType::stringType())
365         , m_ident(ident)
366     {
367     }
368 
TypeOfValueNode(JSGlobalData * globalData,ExpressionNode * expr)369     inline TypeOfValueNode::TypeOfValueNode(JSGlobalData* globalData, ExpressionNode* expr)
370         : ExpressionNode(globalData, ResultType::stringType())
371         , m_expr(expr)
372     {
373     }
374 
PrefixResolveNode(JSGlobalData * globalData,const Identifier & ident,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)375     inline PrefixResolveNode::PrefixResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
376         : PrePostResolveNode(globalData, ident, divot, startOffset, endOffset)
377         , m_operator(oper)
378     {
379     }
380 
PrefixBracketNode(JSGlobalData * globalData,ExpressionNode * base,ExpressionNode * subscript,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)381     inline PrefixBracketNode::PrefixBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
382         : ExpressionNode(globalData)
383         , ThrowablePrefixedSubExpressionData(divot, startOffset, endOffset)
384         , m_base(base)
385         , m_subscript(subscript)
386         , m_operator(oper)
387     {
388     }
389 
PrefixDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)390     inline PrefixDotNode::PrefixDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
391         : ExpressionNode(globalData)
392         , ThrowablePrefixedSubExpressionData(divot, startOffset, endOffset)
393         , m_base(base)
394         , m_ident(ident)
395         , m_operator(oper)
396     {
397     }
398 
PrefixErrorNode(JSGlobalData * globalData,ExpressionNode * expr,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)399     inline PrefixErrorNode::PrefixErrorNode(JSGlobalData* globalData, ExpressionNode* expr, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
400         : ExpressionNode(globalData)
401         , ThrowableExpressionData(divot, startOffset, endOffset)
402         , m_expr(expr)
403         , m_operator(oper)
404     {
405     }
406 
UnaryOpNode(JSGlobalData * globalData,ResultType type,ExpressionNode * expr,OpcodeID opcodeID)407     inline UnaryOpNode::UnaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr, OpcodeID opcodeID)
408         : ExpressionNode(globalData, type)
409         , m_expr(expr)
410         , m_opcodeID(opcodeID)
411     {
412     }
413 
UnaryPlusNode(JSGlobalData * globalData,ExpressionNode * expr)414     inline UnaryPlusNode::UnaryPlusNode(JSGlobalData* globalData, ExpressionNode* expr)
415         : UnaryOpNode(globalData, ResultType::numberType(), expr, op_to_jsnumber)
416     {
417     }
418 
NegateNode(JSGlobalData * globalData,ExpressionNode * expr)419     inline NegateNode::NegateNode(JSGlobalData* globalData, ExpressionNode* expr)
420         : UnaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr, op_negate)
421     {
422     }
423 
BitwiseNotNode(JSGlobalData * globalData,ExpressionNode * expr)424     inline BitwiseNotNode::BitwiseNotNode(JSGlobalData* globalData, ExpressionNode* expr)
425         : UnaryOpNode(globalData, ResultType::forBitOp(), expr, op_bitnot)
426     {
427     }
428 
LogicalNotNode(JSGlobalData * globalData,ExpressionNode * expr)429     inline LogicalNotNode::LogicalNotNode(JSGlobalData* globalData, ExpressionNode* expr)
430         : UnaryOpNode(globalData, ResultType::booleanType(), expr, op_not)
431     {
432     }
433 
BinaryOpNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,OpcodeID opcodeID,bool rightHasAssignments)434     inline BinaryOpNode::BinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
435         : ExpressionNode(globalData)
436         , m_expr1(expr1)
437         , m_expr2(expr2)
438         , m_opcodeID(opcodeID)
439         , m_rightHasAssignments(rightHasAssignments)
440     {
441     }
442 
BinaryOpNode(JSGlobalData * globalData,ResultType type,ExpressionNode * expr1,ExpressionNode * expr2,OpcodeID opcodeID,bool rightHasAssignments)443     inline BinaryOpNode::BinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
444         : ExpressionNode(globalData, type)
445         , m_expr1(expr1)
446         , m_expr2(expr2)
447         , m_opcodeID(opcodeID)
448         , m_rightHasAssignments(rightHasAssignments)
449     {
450     }
451 
ReverseBinaryOpNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,OpcodeID opcodeID,bool rightHasAssignments)452     inline ReverseBinaryOpNode::ReverseBinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
453         : BinaryOpNode(globalData, expr1, expr2, opcodeID, rightHasAssignments)
454     {
455     }
456 
ReverseBinaryOpNode(JSGlobalData * globalData,ResultType type,ExpressionNode * expr1,ExpressionNode * expr2,OpcodeID opcodeID,bool rightHasAssignments)457     inline ReverseBinaryOpNode::ReverseBinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
458         : BinaryOpNode(globalData, type, expr1, expr2, opcodeID, rightHasAssignments)
459     {
460     }
461 
MultNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)462     inline MultNode::MultNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
463         : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_mul, rightHasAssignments)
464     {
465     }
466 
DivNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)467     inline DivNode::DivNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
468         : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_div, rightHasAssignments)
469     {
470     }
471 
472 
ModNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)473     inline ModNode::ModNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
474         : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_mod, rightHasAssignments)
475     {
476     }
477 
AddNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)478     inline AddNode::AddNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
479         : BinaryOpNode(globalData, ResultType::forAdd(expr1->resultDescriptor(), expr2->resultDescriptor()), expr1, expr2, op_add, rightHasAssignments)
480     {
481     }
482 
SubNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)483     inline SubNode::SubNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
484         : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_sub, rightHasAssignments)
485     {
486     }
487 
LeftShiftNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)488     inline LeftShiftNode::LeftShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
489         : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_lshift, rightHasAssignments)
490     {
491     }
492 
RightShiftNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)493     inline RightShiftNode::RightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
494         : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_rshift, rightHasAssignments)
495     {
496     }
497 
UnsignedRightShiftNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)498     inline UnsignedRightShiftNode::UnsignedRightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
499         : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_urshift, rightHasAssignments)
500     {
501     }
502 
LessNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)503     inline LessNode::LessNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
504         : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_less, rightHasAssignments)
505     {
506     }
507 
GreaterNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)508     inline GreaterNode::GreaterNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
509         : ReverseBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_less, rightHasAssignments)
510     {
511     }
512 
LessEqNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)513     inline LessEqNode::LessEqNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
514         : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_lesseq, rightHasAssignments)
515     {
516     }
517 
GreaterEqNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)518     inline GreaterEqNode::GreaterEqNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
519         : ReverseBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_lesseq, rightHasAssignments)
520     {
521     }
522 
ThrowableBinaryOpNode(JSGlobalData * globalData,ResultType type,ExpressionNode * expr1,ExpressionNode * expr2,OpcodeID opcodeID,bool rightHasAssignments)523     inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
524         : BinaryOpNode(globalData, type, expr1, expr2, opcodeID, rightHasAssignments)
525     {
526     }
527 
ThrowableBinaryOpNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,OpcodeID opcodeID,bool rightHasAssignments)528     inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
529         : BinaryOpNode(globalData, expr1, expr2, opcodeID, rightHasAssignments)
530     {
531     }
532 
InstanceOfNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)533     inline InstanceOfNode::InstanceOfNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
534         : ThrowableBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_instanceof, rightHasAssignments)
535     {
536     }
537 
InNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)538     inline InNode::InNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
539         : ThrowableBinaryOpNode(globalData, expr1, expr2, op_in, rightHasAssignments)
540     {
541     }
542 
EqualNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)543     inline EqualNode::EqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
544         : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_eq, rightHasAssignments)
545     {
546     }
547 
NotEqualNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)548     inline NotEqualNode::NotEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
549         : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_neq, rightHasAssignments)
550     {
551     }
552 
StrictEqualNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)553     inline StrictEqualNode::StrictEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
554         : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_stricteq, rightHasAssignments)
555     {
556     }
557 
NotStrictEqualNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)558     inline NotStrictEqualNode::NotStrictEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
559         : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_nstricteq, rightHasAssignments)
560     {
561     }
562 
BitAndNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)563     inline BitAndNode::BitAndNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
564         : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_bitand, rightHasAssignments)
565     {
566     }
567 
BitOrNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)568     inline BitOrNode::BitOrNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
569         : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_bitor, rightHasAssignments)
570     {
571     }
572 
BitXOrNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)573     inline BitXOrNode::BitXOrNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
574         : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_bitxor, rightHasAssignments)
575     {
576     }
577 
LogicalOpNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,LogicalOperator oper)578     inline LogicalOpNode::LogicalOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, LogicalOperator oper)
579         : ExpressionNode(globalData, ResultType::booleanType())
580         , m_expr1(expr1)
581         , m_expr2(expr2)
582         , m_operator(oper)
583     {
584     }
585 
ConditionalNode(JSGlobalData * globalData,ExpressionNode * logical,ExpressionNode * expr1,ExpressionNode * expr2)586     inline ConditionalNode::ConditionalNode(JSGlobalData* globalData, ExpressionNode* logical, ExpressionNode* expr1, ExpressionNode* expr2)
587         : ExpressionNode(globalData)
588         , m_logical(logical)
589         , m_expr1(expr1)
590         , m_expr2(expr2)
591     {
592     }
593 
ReadModifyResolveNode(JSGlobalData * globalData,const Identifier & ident,Operator oper,ExpressionNode * right,bool rightHasAssignments,unsigned divot,unsigned startOffset,unsigned endOffset)594     inline ReadModifyResolveNode::ReadModifyResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, ExpressionNode*  right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
595         : ExpressionNode(globalData)
596         , ThrowableExpressionData(divot, startOffset, endOffset)
597         , m_ident(ident)
598         , m_right(right)
599         , m_operator(oper)
600         , m_rightHasAssignments(rightHasAssignments)
601     {
602     }
603 
AssignResolveNode(JSGlobalData * globalData,const Identifier & ident,ExpressionNode * right,bool rightHasAssignments)604     inline AssignResolveNode::AssignResolveNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* right, bool rightHasAssignments)
605         : ExpressionNode(globalData)
606         , m_ident(ident)
607         , m_right(right)
608         , m_rightHasAssignments(rightHasAssignments)
609     {
610     }
611 
ReadModifyBracketNode(JSGlobalData * globalData,ExpressionNode * base,ExpressionNode * subscript,Operator oper,ExpressionNode * right,bool subscriptHasAssignments,bool rightHasAssignments,unsigned divot,unsigned startOffset,unsigned endOffset)612     inline ReadModifyBracketNode::ReadModifyBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
613         : ExpressionNode(globalData)
614         , ThrowableSubExpressionData(divot, startOffset, endOffset)
615         , m_base(base)
616         , m_subscript(subscript)
617         , m_right(right)
618         , m_operator(oper)
619         , m_subscriptHasAssignments(subscriptHasAssignments)
620         , m_rightHasAssignments(rightHasAssignments)
621     {
622     }
623 
AssignBracketNode(JSGlobalData * globalData,ExpressionNode * base,ExpressionNode * subscript,ExpressionNode * right,bool subscriptHasAssignments,bool rightHasAssignments,unsigned divot,unsigned startOffset,unsigned endOffset)624     inline AssignBracketNode::AssignBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
625         : ExpressionNode(globalData)
626         , ThrowableExpressionData(divot, startOffset, endOffset)
627         , m_base(base)
628         , m_subscript(subscript)
629         , m_right(right)
630         , m_subscriptHasAssignments(subscriptHasAssignments)
631         , m_rightHasAssignments(rightHasAssignments)
632     {
633     }
634 
AssignDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,ExpressionNode * right,bool rightHasAssignments,unsigned divot,unsigned startOffset,unsigned endOffset)635     inline AssignDotNode::AssignDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
636         : ExpressionNode(globalData)
637         , ThrowableExpressionData(divot, startOffset, endOffset)
638         , m_base(base)
639         , m_ident(ident)
640         , m_right(right)
641         , m_rightHasAssignments(rightHasAssignments)
642     {
643     }
644 
ReadModifyDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,Operator oper,ExpressionNode * right,bool rightHasAssignments,unsigned divot,unsigned startOffset,unsigned endOffset)645     inline ReadModifyDotNode::ReadModifyDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
646         : ExpressionNode(globalData)
647         , ThrowableSubExpressionData(divot, startOffset, endOffset)
648         , m_base(base)
649         , m_ident(ident)
650         , m_right(right)
651         , m_operator(oper)
652         , m_rightHasAssignments(rightHasAssignments)
653     {
654     }
655 
AssignErrorNode(JSGlobalData * globalData,ExpressionNode * left,Operator oper,ExpressionNode * right,unsigned divot,unsigned startOffset,unsigned endOffset)656     inline AssignErrorNode::AssignErrorNode(JSGlobalData* globalData, ExpressionNode* left, Operator oper, ExpressionNode* right, unsigned divot, unsigned startOffset, unsigned endOffset)
657         : ExpressionNode(globalData)
658         , ThrowableExpressionData(divot, startOffset, endOffset)
659         , m_left(left)
660         , m_operator(oper)
661         , m_right(right)
662     {
663     }
664 
CommaNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2)665     inline CommaNode::CommaNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2)
666         : ExpressionNode(globalData)
667     {
668         m_expressions.append(expr1);
669         m_expressions.append(expr2);
670     }
671 
ConstStatementNode(JSGlobalData * globalData,ConstDeclNode * next)672     inline ConstStatementNode::ConstStatementNode(JSGlobalData* globalData, ConstDeclNode* next)
673         : StatementNode(globalData)
674         , m_next(next)
675     {
676     }
677 
SourceElements(JSGlobalData *)678     inline SourceElements::SourceElements(JSGlobalData*)
679     {
680     }
681 
EmptyStatementNode(JSGlobalData * globalData)682     inline EmptyStatementNode::EmptyStatementNode(JSGlobalData* globalData)
683         : StatementNode(globalData)
684     {
685     }
686 
DebuggerStatementNode(JSGlobalData * globalData)687     inline DebuggerStatementNode::DebuggerStatementNode(JSGlobalData* globalData)
688         : StatementNode(globalData)
689     {
690     }
691 
ExprStatementNode(JSGlobalData * globalData,ExpressionNode * expr)692     inline ExprStatementNode::ExprStatementNode(JSGlobalData* globalData, ExpressionNode* expr)
693         : StatementNode(globalData)
694         , m_expr(expr)
695     {
696     }
697 
VarStatementNode(JSGlobalData * globalData,ExpressionNode * expr)698     inline VarStatementNode::VarStatementNode(JSGlobalData* globalData, ExpressionNode* expr)
699         : StatementNode(globalData)
700         , m_expr(expr)
701     {
702     }
703 
IfNode(JSGlobalData * globalData,ExpressionNode * condition,StatementNode * ifBlock)704     inline IfNode::IfNode(JSGlobalData* globalData, ExpressionNode* condition, StatementNode* ifBlock)
705         : StatementNode(globalData)
706         , m_condition(condition)
707         , m_ifBlock(ifBlock)
708     {
709     }
710 
IfElseNode(JSGlobalData * globalData,ExpressionNode * condition,StatementNode * ifBlock,StatementNode * elseBlock)711     inline IfElseNode::IfElseNode(JSGlobalData* globalData, ExpressionNode* condition, StatementNode* ifBlock, StatementNode* elseBlock)
712         : IfNode(globalData, condition, ifBlock)
713         , m_elseBlock(elseBlock)
714     {
715     }
716 
DoWhileNode(JSGlobalData * globalData,StatementNode * statement,ExpressionNode * expr)717     inline DoWhileNode::DoWhileNode(JSGlobalData* globalData, StatementNode* statement, ExpressionNode* expr)
718         : StatementNode(globalData)
719         , m_statement(statement)
720         , m_expr(expr)
721     {
722     }
723 
WhileNode(JSGlobalData * globalData,ExpressionNode * expr,StatementNode * statement)724     inline WhileNode::WhileNode(JSGlobalData* globalData, ExpressionNode* expr, StatementNode* statement)
725         : StatementNode(globalData)
726         , m_expr(expr)
727         , m_statement(statement)
728     {
729     }
730 
ForNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,ExpressionNode * expr3,StatementNode * statement,bool expr1WasVarDecl)731     inline ForNode::ForNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, ExpressionNode* expr3, StatementNode* statement, bool expr1WasVarDecl)
732         : StatementNode(globalData)
733         , m_expr1(expr1)
734         , m_expr2(expr2)
735         , m_expr3(expr3)
736         , m_statement(statement)
737         , m_expr1WasVarDecl(expr1 && expr1WasVarDecl)
738     {
739         ASSERT(statement);
740     }
741 
ContinueNode(JSGlobalData * globalData)742     inline ContinueNode::ContinueNode(JSGlobalData* globalData)
743         : StatementNode(globalData)
744         , m_ident(globalData->propertyNames->emptyIdentifier)
745     {
746     }
747 
ContinueNode(JSGlobalData * globalData,const Identifier & ident)748     inline ContinueNode::ContinueNode(JSGlobalData* globalData, const Identifier& ident)
749         : StatementNode(globalData)
750         , m_ident(ident)
751     {
752     }
753 
BreakNode(JSGlobalData * globalData)754     inline BreakNode::BreakNode(JSGlobalData* globalData)
755         : StatementNode(globalData)
756         , m_ident(globalData->propertyNames->emptyIdentifier)
757     {
758     }
759 
BreakNode(JSGlobalData * globalData,const Identifier & ident)760     inline BreakNode::BreakNode(JSGlobalData* globalData, const Identifier& ident)
761         : StatementNode(globalData)
762         , m_ident(ident)
763     {
764     }
765 
ReturnNode(JSGlobalData * globalData,ExpressionNode * value)766     inline ReturnNode::ReturnNode(JSGlobalData* globalData, ExpressionNode* value)
767         : StatementNode(globalData)
768         , m_value(value)
769     {
770     }
771 
WithNode(JSGlobalData * globalData,ExpressionNode * expr,StatementNode * statement,uint32_t divot,uint32_t expressionLength)772     inline WithNode::WithNode(JSGlobalData* globalData, ExpressionNode* expr, StatementNode* statement, uint32_t divot, uint32_t expressionLength)
773         : StatementNode(globalData)
774         , m_expr(expr)
775         , m_statement(statement)
776         , m_divot(divot)
777         , m_expressionLength(expressionLength)
778     {
779     }
780 
LabelNode(JSGlobalData * globalData,const Identifier & name,StatementNode * statement)781     inline LabelNode::LabelNode(JSGlobalData* globalData, const Identifier& name, StatementNode* statement)
782         : StatementNode(globalData)
783         , m_name(name)
784         , m_statement(statement)
785     {
786     }
787 
ThrowNode(JSGlobalData * globalData,ExpressionNode * expr)788     inline ThrowNode::ThrowNode(JSGlobalData* globalData, ExpressionNode* expr)
789         : StatementNode(globalData)
790         , m_expr(expr)
791     {
792     }
793 
TryNode(JSGlobalData * globalData,StatementNode * tryBlock,const Identifier & exceptionIdent,bool catchHasEval,StatementNode * catchBlock,StatementNode * finallyBlock)794     inline TryNode::TryNode(JSGlobalData* globalData, StatementNode* tryBlock, const Identifier& exceptionIdent, bool catchHasEval, StatementNode* catchBlock, StatementNode* finallyBlock)
795         : StatementNode(globalData)
796         , m_tryBlock(tryBlock)
797         , m_exceptionIdent(exceptionIdent)
798         , m_catchBlock(catchBlock)
799         , m_finallyBlock(finallyBlock)
800         , m_catchHasEval(catchHasEval)
801     {
802     }
803 
ParameterNode(JSGlobalData *,const Identifier & ident)804     inline ParameterNode::ParameterNode(JSGlobalData*, const Identifier& ident)
805         : m_ident(ident)
806         , m_next(0)
807     {
808     }
809 
ParameterNode(JSGlobalData *,ParameterNode * l,const Identifier & ident)810     inline ParameterNode::ParameterNode(JSGlobalData*, ParameterNode* l, const Identifier& ident)
811         : m_ident(ident)
812         , m_next(0)
813     {
814         l->m_next = this;
815     }
816 
FuncExprNode(JSGlobalData * globalData,const Identifier & ident,FunctionBodyNode * body,const SourceCode & source,ParameterNode * parameter)817     inline FuncExprNode::FuncExprNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
818         : ExpressionNode(globalData)
819         , m_body(body)
820     {
821         m_body->finishParsing(source, parameter, ident);
822     }
823 
FuncDeclNode(JSGlobalData * globalData,const Identifier & ident,FunctionBodyNode * body,const SourceCode & source,ParameterNode * parameter)824     inline FuncDeclNode::FuncDeclNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
825         : StatementNode(globalData)
826         , m_body(body)
827     {
828         m_body->finishParsing(source, parameter, ident);
829     }
830 
CaseClauseNode(JSGlobalData *,ExpressionNode * expr,SourceElements * statements)831     inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr, SourceElements* statements)
832         : m_expr(expr)
833         , m_statements(statements)
834     {
835     }
836 
ClauseListNode(JSGlobalData *,CaseClauseNode * clause)837     inline ClauseListNode::ClauseListNode(JSGlobalData*, CaseClauseNode* clause)
838         : m_clause(clause)
839         , m_next(0)
840     {
841     }
842 
ClauseListNode(JSGlobalData *,ClauseListNode * clauseList,CaseClauseNode * clause)843     inline ClauseListNode::ClauseListNode(JSGlobalData*, ClauseListNode* clauseList, CaseClauseNode* clause)
844         : m_clause(clause)
845         , m_next(0)
846     {
847         clauseList->m_next = this;
848     }
849 
CaseBlockNode(JSGlobalData *,ClauseListNode * list1,CaseClauseNode * defaultClause,ClauseListNode * list2)850     inline CaseBlockNode::CaseBlockNode(JSGlobalData*, ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2)
851         : m_list1(list1)
852         , m_defaultClause(defaultClause)
853         , m_list2(list2)
854     {
855     }
856 
SwitchNode(JSGlobalData * globalData,ExpressionNode * expr,CaseBlockNode * block)857     inline SwitchNode::SwitchNode(JSGlobalData* globalData, ExpressionNode* expr, CaseBlockNode* block)
858         : StatementNode(globalData)
859         , m_expr(expr)
860         , m_block(block)
861     {
862     }
863 
ConstDeclNode(JSGlobalData * globalData,const Identifier & ident,ExpressionNode * init)864     inline ConstDeclNode::ConstDeclNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* init)
865         : ExpressionNode(globalData)
866         , m_ident(ident)
867         , m_next(0)
868         , m_init(init)
869     {
870     }
871 
BlockNode(JSGlobalData * globalData,SourceElements * statements)872     inline BlockNode::BlockNode(JSGlobalData* globalData, SourceElements* statements)
873         : StatementNode(globalData)
874         , m_statements(statements)
875     {
876     }
877 
ForInNode(JSGlobalData * globalData,ExpressionNode * l,ExpressionNode * expr,StatementNode * statement)878     inline ForInNode::ForInNode(JSGlobalData* globalData, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement)
879         : StatementNode(globalData)
880         , m_ident(globalData->propertyNames->emptyIdentifier)
881         , m_init(0)
882         , m_lexpr(l)
883         , m_expr(expr)
884         , m_statement(statement)
885         , m_identIsVarDecl(false)
886     {
887     }
888 
ForInNode(JSGlobalData * globalData,const Identifier & ident,ExpressionNode * in,ExpressionNode * expr,StatementNode * statement,int divot,int startOffset,int endOffset)889     inline ForInNode::ForInNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* in, ExpressionNode* expr, StatementNode* statement, int divot, int startOffset, int endOffset)
890         : StatementNode(globalData)
891         , m_ident(ident)
892         , m_init(0)
893         , m_lexpr(new (globalData) ResolveNode(globalData, ident, divot - startOffset))
894         , m_expr(expr)
895         , m_statement(statement)
896         , m_identIsVarDecl(true)
897     {
898         if (in) {
899             AssignResolveNode* node = new (globalData) AssignResolveNode(globalData, ident, in, true);
900             node->setExceptionSourceCode(divot, divot - startOffset, endOffset - divot);
901             m_init = node;
902         }
903         // for( var foo = bar in baz )
904     }
905 
906 } // namespace JSC
907 
908 #endif // NodeConstructors_h
909