2 * Copyright (C) 2009, 2013 Apple Inc. All rights reserved.
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.
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.
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.
21 #ifndef NodeConstructors_h
22 #define NodeConstructors_h
30 inline void* ParserArenaFreeable::operator new(size_t size
, ParserArena
& parserArena
)
32 return parserArena
.allocateFreeable(size
);
35 inline void* ParserArenaDeletable::operator new(size_t size
, ParserArena
& parserArena
)
37 return parserArena
.allocateDeletable(size
);
40 inline ParserArenaRoot::ParserArenaRoot(ParserArena
& parserArena
)
42 m_arena
.swap(parserArena
);
45 inline Node::Node(const JSTokenLocation
& location
)
46 : m_position(location
.line
, location
.startOffset
, location
.lineStartOffset
)
49 ASSERT(location
.startOffset
>= location
.lineStartOffset
);
52 inline ExpressionNode::ExpressionNode(const JSTokenLocation
& location
, ResultType resultType
)
54 , m_resultType(resultType
)
58 inline StatementNode::StatementNode(const JSTokenLocation
& location
)
65 inline ConstantNode::ConstantNode(const JSTokenLocation
& location
, ResultType resultType
)
66 : ExpressionNode(location
, resultType
)
70 inline NullNode::NullNode(const JSTokenLocation
& location
)
71 : ConstantNode(location
, ResultType::nullType())
75 inline BooleanNode::BooleanNode(const JSTokenLocation
& location
, bool value
)
76 : ConstantNode(location
, ResultType::booleanType())
81 inline NumberNode::NumberNode(const JSTokenLocation
& location
, double value
)
82 : ConstantNode(location
, JSValue(value
).isInt32() ? ResultType::numberTypeIsInt32() : ResultType::numberType())
87 inline DoubleNode::DoubleNode(const JSTokenLocation
& location
, double value
)
88 : NumberNode(location
, value
)
92 inline IntegerNode::IntegerNode(const JSTokenLocation
& location
, double value
)
93 : DoubleNode(location
, value
)
97 inline StringNode::StringNode(const JSTokenLocation
& location
, const Identifier
& value
)
98 : ConstantNode(location
, ResultType::stringType())
103 #if ENABLE(ES6_TEMPLATE_LITERAL_SYNTAX)
104 inline TemplateExpressionListNode::TemplateExpressionListNode(ExpressionNode
* node
)
109 inline TemplateExpressionListNode::TemplateExpressionListNode(TemplateExpressionListNode
* previous
, ExpressionNode
* node
)
112 previous
->m_next
= this;
115 inline TemplateStringNode::TemplateStringNode(const JSTokenLocation
& location
, const Identifier
& cooked
, const Identifier
& raw
)
116 : ExpressionNode(location
)
122 inline TemplateStringListNode::TemplateStringListNode(TemplateStringNode
* node
)
127 inline TemplateStringListNode::TemplateStringListNode(TemplateStringListNode
* previous
, TemplateStringNode
* node
)
130 previous
->m_next
= this;
133 inline TemplateLiteralNode::TemplateLiteralNode(const JSTokenLocation
& location
, TemplateStringListNode
* templateStrings
)
134 : ExpressionNode(location
)
135 , m_templateStrings(templateStrings
)
136 , m_templateExpressions(nullptr)
140 inline TemplateLiteralNode::TemplateLiteralNode(const JSTokenLocation
& location
, TemplateStringListNode
* templateStrings
, TemplateExpressionListNode
* templateExpressions
)
141 : ExpressionNode(location
)
142 , m_templateStrings(templateStrings
)
143 , m_templateExpressions(templateExpressions
)
147 inline TaggedTemplateNode::TaggedTemplateNode(const JSTokenLocation
& location
, ExpressionNode
* tag
, TemplateLiteralNode
* templateLiteral
)
148 : ExpressionNode(location
)
150 , m_templateLiteral(templateLiteral
)
155 inline RegExpNode::RegExpNode(const JSTokenLocation
& location
, const Identifier
& pattern
, const Identifier
& flags
)
156 : ExpressionNode(location
)
162 inline ThisNode::ThisNode(const JSTokenLocation
& location
, ThisTDZMode thisTDZMode
)
163 : ExpressionNode(location
)
164 , m_shouldAlwaysEmitTDZCheck(thisTDZMode
== ThisTDZMode::AlwaysCheck
)
168 inline SuperNode::SuperNode(const JSTokenLocation
& location
)
169 : ExpressionNode(location
)
173 inline ResolveNode::ResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, const JSTextPosition
& start
)
174 : ExpressionNode(location
)
178 ASSERT(m_start
.offset
>= m_start
.lineStartOffset
);
181 inline ElementNode::ElementNode(int elision
, ExpressionNode
* node
)
188 inline ElementNode::ElementNode(ElementNode
* l
, int elision
, ExpressionNode
* node
)
196 inline ArrayNode::ArrayNode(const JSTokenLocation
& location
, int elision
)
197 : ExpressionNode(location
)
204 inline ArrayNode::ArrayNode(const JSTokenLocation
& location
, ElementNode
* element
)
205 : ExpressionNode(location
)
212 inline ArrayNode::ArrayNode(const JSTokenLocation
& location
, int elision
, ElementNode
* element
)
213 : ExpressionNode(location
)
220 inline PropertyNode::PropertyNode(const Identifier
& name
, ExpressionNode
* assign
, Type type
, PutType putType
, SuperBinding superBinding
= SuperBinding::NotNeeded
)
224 , m_needsSuperBinding(superBinding
== SuperBinding::Needed
)
229 inline PropertyNode::PropertyNode(ExpressionNode
* name
, ExpressionNode
* assign
, Type type
, PutType putType
)
234 , m_needsSuperBinding(false)
239 inline PropertyListNode::PropertyListNode(const JSTokenLocation
& location
, PropertyNode
* node
)
240 : ExpressionNode(location
)
246 inline PropertyListNode::PropertyListNode(const JSTokenLocation
& location
, PropertyNode
* node
, PropertyListNode
* list
)
247 : ExpressionNode(location
)
254 inline ObjectLiteralNode::ObjectLiteralNode(const JSTokenLocation
& location
)
255 : ExpressionNode(location
)
260 inline ObjectLiteralNode::ObjectLiteralNode(const JSTokenLocation
& location
, PropertyListNode
* list
)
261 : ExpressionNode(location
)
266 inline BracketAccessorNode::BracketAccessorNode(const JSTokenLocation
& location
, ExpressionNode
* base
, ExpressionNode
* subscript
, bool subscriptHasAssignments
)
267 : ExpressionNode(location
)
269 , m_subscript(subscript
)
270 , m_subscriptHasAssignments(subscriptHasAssignments
)
274 inline DotAccessorNode::DotAccessorNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
)
275 : ExpressionNode(location
)
282 inline SpreadExpressionNode::SpreadExpressionNode(const JSTokenLocation
& location
, ExpressionNode
* expression
)
283 : ExpressionNode(location
)
284 , m_expression(expression
)
288 inline ArgumentListNode::ArgumentListNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
289 : ExpressionNode(location
)
295 inline ArgumentListNode::ArgumentListNode(const JSTokenLocation
& location
, ArgumentListNode
* listNode
, ExpressionNode
* expr
)
296 : ExpressionNode(location
)
300 listNode
->m_next
= this;
303 inline ArgumentsNode::ArgumentsNode()
308 inline ArgumentsNode::ArgumentsNode(ArgumentListNode
* listNode
)
309 : m_listNode(listNode
)
313 inline NewExprNode::NewExprNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
314 : ExpressionNode(location
)
320 inline NewExprNode::NewExprNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, ArgumentsNode
* args
)
321 : ExpressionNode(location
)
327 inline EvalFunctionCallNode::EvalFunctionCallNode(const JSTokenLocation
& location
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
328 : ExpressionNode(location
)
329 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
334 inline FunctionCallValueNode::FunctionCallValueNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
335 : ExpressionNode(location
)
336 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
340 ASSERT(divot
.offset
>= divotStart
.offset
);
343 inline FunctionCallResolveNode::FunctionCallResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
344 : ExpressionNode(location
)
345 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
351 inline FunctionCallBracketNode::FunctionCallBracketNode(const JSTokenLocation
& location
, ExpressionNode
* base
, ExpressionNode
* subscript
, bool subscriptHasAssignments
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
352 : ExpressionNode(location
)
353 , ThrowableSubExpressionData(divot
, divotStart
, divotEnd
)
355 , m_subscript(subscript
)
357 , m_subscriptHasAssignments(subscriptHasAssignments
)
361 inline FunctionCallDotNode::FunctionCallDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
362 : ExpressionNode(location
)
363 , ThrowableSubExpressionData(divot
, divotStart
, divotEnd
)
370 inline BytecodeIntrinsicNode::BytecodeIntrinsicNode(const JSTokenLocation
& location
, EmitterType emitter
, const Identifier
& ident
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
371 : ExpressionNode(location
)
372 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
379 inline CallFunctionCallDotNode::CallFunctionCallDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
380 : FunctionCallDotNode(location
, base
, ident
, args
, divot
, divotStart
, divotEnd
)
384 inline ApplyFunctionCallDotNode::ApplyFunctionCallDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
385 : FunctionCallDotNode(location
, base
, ident
, args
, divot
, divotStart
, divotEnd
)
389 inline PostfixNode::PostfixNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, Operator oper
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
390 : PrefixNode(location
, expr
, oper
, divot
, divotStart
, divotEnd
)
394 inline DeleteResolveNode::DeleteResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
395 : ExpressionNode(location
)
396 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
401 inline DeleteBracketNode::DeleteBracketNode(const JSTokenLocation
& location
, ExpressionNode
* base
, ExpressionNode
* subscript
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
402 : ExpressionNode(location
)
403 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
405 , m_subscript(subscript
)
409 inline DeleteDotNode::DeleteDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
410 : ExpressionNode(location
)
411 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
417 inline DeleteValueNode::DeleteValueNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
418 : ExpressionNode(location
)
423 inline VoidNode::VoidNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
424 : ExpressionNode(location
)
429 inline TypeOfResolveNode::TypeOfResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
)
430 : ExpressionNode(location
, ResultType::stringType())
435 inline TypeOfValueNode::TypeOfValueNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
436 : ExpressionNode(location
, ResultType::stringType())
441 inline PrefixNode::PrefixNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, Operator oper
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
442 : ExpressionNode(location
)
443 , ThrowablePrefixedSubExpressionData(divot
, divotStart
, divotEnd
)
449 inline UnaryOpNode::UnaryOpNode(const JSTokenLocation
& location
, ResultType type
, ExpressionNode
* expr
, OpcodeID opcodeID
)
450 : ExpressionNode(location
, type
)
452 , m_opcodeID(opcodeID
)
456 inline UnaryPlusNode::UnaryPlusNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
457 : UnaryOpNode(location
, ResultType::numberType(), expr
, op_to_number
)
461 inline NegateNode::NegateNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
462 : UnaryOpNode(location
, ResultType::numberType(), expr
, op_negate
)
466 inline BitwiseNotNode::BitwiseNotNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
467 : ExpressionNode(location
, ResultType::forBitOp())
472 inline LogicalNotNode::LogicalNotNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
473 : UnaryOpNode(location
, ResultType::booleanType(), expr
, op_not
)
477 inline BinaryOpNode::BinaryOpNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
478 : ExpressionNode(location
)
481 , m_opcodeID(opcodeID
)
482 , m_rightHasAssignments(rightHasAssignments
)
486 inline BinaryOpNode::BinaryOpNode(const JSTokenLocation
& location
, ResultType type
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
487 : ExpressionNode(location
, type
)
490 , m_opcodeID(opcodeID
)
491 , m_rightHasAssignments(rightHasAssignments
)
495 inline MultNode::MultNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
496 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_mul
, rightHasAssignments
)
500 inline DivNode::DivNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
501 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_div
, rightHasAssignments
)
506 inline ModNode::ModNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
507 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_mod
, rightHasAssignments
)
511 inline AddNode::AddNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
512 : BinaryOpNode(location
, ResultType::forAdd(expr1
->resultDescriptor(), expr2
->resultDescriptor()), expr1
, expr2
, op_add
, rightHasAssignments
)
516 inline SubNode::SubNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
517 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_sub
, rightHasAssignments
)
521 inline LeftShiftNode::LeftShiftNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
522 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_lshift
, rightHasAssignments
)
526 inline RightShiftNode::RightShiftNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
527 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_rshift
, rightHasAssignments
)
531 inline UnsignedRightShiftNode::UnsignedRightShiftNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
532 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_urshift
, rightHasAssignments
)
536 inline LessNode::LessNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
537 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_less
, rightHasAssignments
)
541 inline GreaterNode::GreaterNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
542 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_greater
, rightHasAssignments
)
546 inline LessEqNode::LessEqNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
547 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_lesseq
, rightHasAssignments
)
551 inline GreaterEqNode::GreaterEqNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
552 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_greatereq
, rightHasAssignments
)
556 inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(const JSTokenLocation
& location
, ResultType type
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
557 : BinaryOpNode(location
, type
, expr1
, expr2
, opcodeID
, rightHasAssignments
)
561 inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
562 : BinaryOpNode(location
, expr1
, expr2
, opcodeID
, rightHasAssignments
)
566 inline InstanceOfNode::InstanceOfNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
567 : ThrowableBinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_instanceof
, rightHasAssignments
)
571 inline InNode::InNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
572 : ThrowableBinaryOpNode(location
, expr1
, expr2
, op_in
, rightHasAssignments
)
576 inline EqualNode::EqualNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
577 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_eq
, rightHasAssignments
)
581 inline NotEqualNode::NotEqualNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
582 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_neq
, rightHasAssignments
)
586 inline StrictEqualNode::StrictEqualNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
587 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_stricteq
, rightHasAssignments
)
591 inline NotStrictEqualNode::NotStrictEqualNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
592 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_nstricteq
, rightHasAssignments
)
596 inline BitAndNode::BitAndNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
597 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_bitand
, rightHasAssignments
)
601 inline BitOrNode::BitOrNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
602 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_bitor
, rightHasAssignments
)
606 inline BitXOrNode::BitXOrNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
607 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_bitxor
, rightHasAssignments
)
611 inline LogicalOpNode::LogicalOpNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, LogicalOperator oper
)
612 : ExpressionNode(location
, ResultType::forLogicalOp(expr1
->resultDescriptor(), expr2
->resultDescriptor()))
619 inline ConditionalNode::ConditionalNode(const JSTokenLocation
& location
, ExpressionNode
* logical
, ExpressionNode
* expr1
, ExpressionNode
* expr2
)
620 : ExpressionNode(location
)
627 inline ReadModifyResolveNode::ReadModifyResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, Operator oper
, ExpressionNode
* right
, bool rightHasAssignments
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
628 : ExpressionNode(location
)
629 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
633 , m_rightHasAssignments(rightHasAssignments
)
637 inline AssignResolveNode::AssignResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, ExpressionNode
* right
)
638 : ExpressionNode(location
)
645 inline ReadModifyBracketNode::ReadModifyBracketNode(const JSTokenLocation
& location
, ExpressionNode
* base
, ExpressionNode
* subscript
, Operator oper
, ExpressionNode
* right
, bool subscriptHasAssignments
, bool rightHasAssignments
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
646 : ExpressionNode(location
)
647 , ThrowableSubExpressionData(divot
, divotStart
, divotEnd
)
649 , m_subscript(subscript
)
652 , m_subscriptHasAssignments(subscriptHasAssignments
)
653 , m_rightHasAssignments(rightHasAssignments
)
657 inline AssignBracketNode::AssignBracketNode(const JSTokenLocation
& location
, ExpressionNode
* base
, ExpressionNode
* subscript
, ExpressionNode
* right
, bool subscriptHasAssignments
, bool rightHasAssignments
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
658 : ExpressionNode(location
)
659 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
661 , m_subscript(subscript
)
663 , m_subscriptHasAssignments(subscriptHasAssignments
)
664 , m_rightHasAssignments(rightHasAssignments
)
668 inline AssignDotNode::AssignDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, ExpressionNode
* right
, bool rightHasAssignments
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
669 : ExpressionNode(location
)
670 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
674 , m_rightHasAssignments(rightHasAssignments
)
678 inline ReadModifyDotNode::ReadModifyDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, Operator oper
, ExpressionNode
* right
, bool rightHasAssignments
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
679 : ExpressionNode(location
)
680 , ThrowableSubExpressionData(divot
, divotStart
, divotEnd
)
685 , m_rightHasAssignments(rightHasAssignments
)
689 inline AssignErrorNode::AssignErrorNode(const JSTokenLocation
& location
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
690 : ExpressionNode(location
)
691 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
695 inline CommaNode::CommaNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
696 : ExpressionNode(location
)
702 inline ConstStatementNode::ConstStatementNode(const JSTokenLocation
& location
, ConstDeclNode
* next
)
703 : StatementNode(location
)
708 inline SourceElements::SourceElements()
714 inline EmptyStatementNode::EmptyStatementNode(const JSTokenLocation
& location
)
715 : StatementNode(location
)
719 inline DebuggerStatementNode::DebuggerStatementNode(const JSTokenLocation
& location
)
720 : StatementNode(location
)
724 inline ExprStatementNode::ExprStatementNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
725 : StatementNode(location
)
730 inline VarStatementNode::VarStatementNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
731 : StatementNode(location
)
736 inline EmptyVarExpression::EmptyVarExpression(const JSTokenLocation
& location
, const Identifier
& ident
)
737 : ExpressionNode(location
)
742 inline IfElseNode::IfElseNode(const JSTokenLocation
& location
, ExpressionNode
* condition
, StatementNode
* ifBlock
, StatementNode
* elseBlock
)
743 : StatementNode(location
)
744 , m_condition(condition
)
746 , m_elseBlock(elseBlock
)
750 inline DoWhileNode::DoWhileNode(const JSTokenLocation
& location
, StatementNode
* statement
, ExpressionNode
* expr
)
751 : StatementNode(location
)
752 , m_statement(statement
)
757 inline WhileNode::WhileNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, StatementNode
* statement
)
758 : StatementNode(location
)
760 , m_statement(statement
)
764 inline ForNode::ForNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, ExpressionNode
* expr3
, StatementNode
* statement
)
765 : StatementNode(location
)
769 , m_statement(statement
)
774 inline ContinueNode::ContinueNode(const JSTokenLocation
& location
, const Identifier
& ident
)
775 : StatementNode(location
)
780 inline BreakNode::BreakNode(const JSTokenLocation
& location
, const Identifier
& ident
)
781 : StatementNode(location
)
786 inline ReturnNode::ReturnNode(const JSTokenLocation
& location
, ExpressionNode
* value
)
787 : StatementNode(location
)
792 inline WithNode::WithNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, StatementNode
* statement
, const JSTextPosition
& divot
, uint32_t expressionLength
)
793 : StatementNode(location
)
795 , m_statement(statement
)
797 , m_expressionLength(expressionLength
)
801 inline LabelNode::LabelNode(const JSTokenLocation
& location
, const Identifier
& name
, StatementNode
* statement
)
802 : StatementNode(location
)
804 , m_statement(statement
)
808 inline ThrowNode::ThrowNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
809 : StatementNode(location
)
814 inline TryNode::TryNode(const JSTokenLocation
& location
, StatementNode
* tryBlock
, const Identifier
& thrownValueIdent
, StatementNode
* catchBlock
, StatementNode
* finallyBlock
)
815 : StatementNode(location
)
816 , m_tryBlock(tryBlock
)
817 , m_thrownValueIdent(thrownValueIdent
)
818 , m_catchBlock(catchBlock
)
819 , m_finallyBlock(finallyBlock
)
823 inline ParameterNode::ParameterNode(PassRefPtr
<DestructuringPatternNode
> pattern
)
830 inline ParameterNode::ParameterNode(ParameterNode
* previous
, PassRefPtr
<DestructuringPatternNode
> pattern
)
834 previous
->m_next
= this;
836 ASSERT(previous
->m_pattern
);
839 inline FuncExprNode::FuncExprNode(const JSTokenLocation
& location
, const Identifier
& ident
, FunctionBodyNode
* body
, const SourceCode
& source
, ParameterNode
* parameter
)
840 : ExpressionNode(location
)
843 m_body
->finishParsing(source
, parameter
, ident
, FunctionExpression
);
846 inline FuncDeclNode::FuncDeclNode(const JSTokenLocation
& location
, const Identifier
& ident
, FunctionBodyNode
* body
, const SourceCode
& source
, ParameterNode
* parameter
)
847 : StatementNode(location
)
850 m_body
->finishParsing(source
, parameter
, ident
, FunctionDeclaration
);
853 #if ENABLE(ES6_CLASS_SYNTAX)
854 inline ClassDeclNode::ClassDeclNode(const JSTokenLocation
& location
, ExpressionNode
* classDeclaration
)
855 : StatementNode(location
)
856 , m_classDeclaration(classDeclaration
)
860 inline ClassExprNode::ClassExprNode(const JSTokenLocation
& location
, const Identifier
& name
, ExpressionNode
* constructorExpression
, ExpressionNode
* classHeritage
, PropertyListNode
* instanceMethods
, PropertyListNode
* staticMethods
)
861 : ExpressionNode(location
)
863 , m_constructorExpression(constructorExpression
)
864 , m_classHeritage(classHeritage
)
865 , m_instanceMethods(instanceMethods
)
866 , m_staticMethods(staticMethods
)
871 inline CaseClauseNode::CaseClauseNode(ExpressionNode
* expr
, SourceElements
* statements
)
873 , m_statements(statements
)
877 inline ClauseListNode::ClauseListNode(CaseClauseNode
* clause
)
883 inline ClauseListNode::ClauseListNode(ClauseListNode
* clauseList
, CaseClauseNode
* clause
)
887 clauseList
->m_next
= this;
890 inline CaseBlockNode::CaseBlockNode(ClauseListNode
* list1
, CaseClauseNode
* defaultClause
, ClauseListNode
* list2
)
892 , m_defaultClause(defaultClause
)
897 inline SwitchNode::SwitchNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, CaseBlockNode
* block
)
898 : StatementNode(location
)
904 inline ConstDeclNode::ConstDeclNode(const JSTokenLocation
& location
, const Identifier
& ident
, ExpressionNode
* init
)
905 : ExpressionNode(location
)
912 inline BlockNode::BlockNode(const JSTokenLocation
& location
, SourceElements
* statements
)
913 : StatementNode(location
)
914 , m_statements(statements
)
918 inline EnumerationNode::EnumerationNode(const JSTokenLocation
& location
, ExpressionNode
* l
, ExpressionNode
* expr
, StatementNode
* statement
)
919 : StatementNode(location
)
922 , m_statement(statement
)
927 inline ForInNode::ForInNode(const JSTokenLocation
& location
, ExpressionNode
* l
, ExpressionNode
* expr
, StatementNode
* statement
)
928 : EnumerationNode(location
, l
, expr
, statement
)
932 inline ForOfNode::ForOfNode(const JSTokenLocation
& location
, ExpressionNode
* l
, ExpressionNode
* expr
, StatementNode
* statement
)
933 : EnumerationNode(location
, l
, expr
, statement
)
937 inline DestructuringPatternNode::DestructuringPatternNode()
941 inline ArrayPatternNode::ArrayPatternNode()
942 : DestructuringPatternNode()
946 inline Ref
<ArrayPatternNode
> ArrayPatternNode::create()
948 return adoptRef(*new ArrayPatternNode
);
951 inline ObjectPatternNode::ObjectPatternNode()
952 : DestructuringPatternNode()
956 inline Ref
<ObjectPatternNode
> ObjectPatternNode::create()
958 return adoptRef(*new ObjectPatternNode
);
961 inline Ref
<BindingNode
> BindingNode::create(const Identifier
& boundProperty
, const JSTextPosition
& start
, const JSTextPosition
& end
)
963 return adoptRef(*new BindingNode(boundProperty
, start
, end
));
966 inline BindingNode::BindingNode(const Identifier
& boundProperty
, const JSTextPosition
& start
, const JSTextPosition
& end
)
967 : DestructuringPatternNode()
968 , m_divotStart(start
)
970 , m_boundProperty(boundProperty
)
974 inline DestructuringAssignmentNode::DestructuringAssignmentNode(const JSTokenLocation
& location
, PassRefPtr
<DestructuringPatternNode
> bindings
, ExpressionNode
* initializer
)
975 : ExpressionNode(location
)
976 , m_bindings(bindings
)
977 , m_initializer(initializer
)
983 #endif // NodeConstructors_h