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
, VM
* vm
)
32 return vm
->parserArena
->allocateFreeable(size
);
35 inline void* ParserArenaDeletable::operator new(size_t size
, VM
* vm
)
37 return vm
->parserArena
->allocateDeletable(size
);
40 inline ParserArenaRefCounted::ParserArenaRefCounted(VM
* vm
)
42 vm
->parserArena
->derefWithArena(adoptRef(this));
45 inline Node::Node(const JSTokenLocation
& location
)
46 : m_position(location
.line
, location
.startOffset
, location
.lineStartOffset
)
48 ASSERT(location
.startOffset
>= location
.lineStartOffset
);
51 inline ExpressionNode::ExpressionNode(const JSTokenLocation
& location
, ResultType resultType
)
53 , m_resultType(resultType
)
57 inline StatementNode::StatementNode(const JSTokenLocation
& location
)
63 inline ConstantNode::ConstantNode(const JSTokenLocation
& location
, ResultType resultType
)
64 : ExpressionNode(location
, resultType
)
68 inline NullNode::NullNode(const JSTokenLocation
& location
)
69 : ConstantNode(location
, ResultType::nullType())
73 inline BooleanNode::BooleanNode(const JSTokenLocation
& location
, bool value
)
74 : ConstantNode(location
, ResultType::booleanType())
79 inline NumberNode::NumberNode(const JSTokenLocation
& location
, double value
)
80 : ConstantNode(location
, JSValue(value
).isInt32() ? ResultType::numberTypeIsInt32() : ResultType::numberType())
85 inline StringNode::StringNode(const JSTokenLocation
& location
, const Identifier
& value
)
86 : ConstantNode(location
, ResultType::stringType())
91 inline RegExpNode::RegExpNode(const JSTokenLocation
& location
, const Identifier
& pattern
, const Identifier
& flags
)
92 : ExpressionNode(location
)
98 inline ThisNode::ThisNode(const JSTokenLocation
& location
)
99 : ExpressionNode(location
)
103 inline ResolveNode::ResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, const JSTextPosition
& start
)
104 : ExpressionNode(location
)
108 ASSERT(m_start
.offset
>= m_start
.lineStartOffset
);
111 inline ElementNode::ElementNode(int elision
, ExpressionNode
* node
)
118 inline ElementNode::ElementNode(ElementNode
* l
, int elision
, ExpressionNode
* node
)
126 inline ArrayNode::ArrayNode(const JSTokenLocation
& location
, int elision
)
127 : ExpressionNode(location
)
134 inline ArrayNode::ArrayNode(const JSTokenLocation
& location
, ElementNode
* element
)
135 : ExpressionNode(location
)
142 inline ArrayNode::ArrayNode(const JSTokenLocation
& location
, int elision
, ElementNode
* element
)
143 : ExpressionNode(location
)
150 inline PropertyNode::PropertyNode(VM
*, const Identifier
& name
, ExpressionNode
* assign
, Type type
)
157 inline PropertyNode::PropertyNode(VM
* vm
, double name
, ExpressionNode
* assign
, Type type
)
158 : m_name(&vm
->parserArena
->identifierArena().makeNumericIdentifier(vm
, name
))
164 inline PropertyNode::PropertyNode(VM
*, ExpressionNode
* name
, ExpressionNode
* assign
, Type type
)
172 inline PropertyListNode::PropertyListNode(const JSTokenLocation
& location
, PropertyNode
* node
)
173 : ExpressionNode(location
)
179 inline PropertyListNode::PropertyListNode(const JSTokenLocation
& location
, PropertyNode
* node
, PropertyListNode
* list
)
180 : ExpressionNode(location
)
187 inline ObjectLiteralNode::ObjectLiteralNode(const JSTokenLocation
& location
)
188 : ExpressionNode(location
)
193 inline ObjectLiteralNode::ObjectLiteralNode(const JSTokenLocation
& location
, PropertyListNode
* list
)
194 : ExpressionNode(location
)
199 inline BracketAccessorNode::BracketAccessorNode(const JSTokenLocation
& location
, ExpressionNode
* base
, ExpressionNode
* subscript
, bool subscriptHasAssignments
)
200 : ExpressionNode(location
)
202 , m_subscript(subscript
)
203 , m_subscriptHasAssignments(subscriptHasAssignments
)
207 inline DotAccessorNode::DotAccessorNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
)
208 : ExpressionNode(location
)
215 inline SpreadExpressionNode::SpreadExpressionNode(const JSTokenLocation
& location
, ExpressionNode
* expression
)
216 : ExpressionNode(location
)
217 , m_expression(expression
)
221 inline ArgumentListNode::ArgumentListNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
222 : ExpressionNode(location
)
228 inline ArgumentListNode::ArgumentListNode(const JSTokenLocation
& location
, ArgumentListNode
* listNode
, ExpressionNode
* expr
)
229 : ExpressionNode(location
)
233 listNode
->m_next
= this;
236 inline ArgumentsNode::ArgumentsNode()
241 inline ArgumentsNode::ArgumentsNode(ArgumentListNode
* listNode
)
242 : m_listNode(listNode
)
246 inline NewExprNode::NewExprNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
247 : ExpressionNode(location
)
253 inline NewExprNode::NewExprNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, ArgumentsNode
* args
)
254 : ExpressionNode(location
)
260 inline EvalFunctionCallNode::EvalFunctionCallNode(const JSTokenLocation
& location
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
261 : ExpressionNode(location
)
262 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
267 inline FunctionCallValueNode::FunctionCallValueNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
268 : ExpressionNode(location
)
269 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
273 ASSERT(divot
.offset
>= divotStart
.offset
);
276 inline FunctionCallResolveNode::FunctionCallResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
277 : ExpressionNode(location
)
278 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
284 inline FunctionCallBracketNode::FunctionCallBracketNode(const JSTokenLocation
& location
, ExpressionNode
* base
, ExpressionNode
* subscript
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
285 : ExpressionNode(location
)
286 , ThrowableSubExpressionData(divot
, divotStart
, divotEnd
)
288 , m_subscript(subscript
)
293 inline FunctionCallDotNode::FunctionCallDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
294 : ExpressionNode(location
)
295 , ThrowableSubExpressionData(divot
, divotStart
, divotEnd
)
302 inline CallFunctionCallDotNode::CallFunctionCallDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
303 : FunctionCallDotNode(location
, base
, ident
, args
, divot
, divotStart
, divotEnd
)
307 inline ApplyFunctionCallDotNode::ApplyFunctionCallDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, ArgumentsNode
* args
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
308 : FunctionCallDotNode(location
, base
, ident
, args
, divot
, divotStart
, divotEnd
)
312 inline PostfixNode::PostfixNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, Operator oper
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
313 : PrefixNode(location
, expr
, oper
, divot
, divotStart
, divotEnd
)
317 inline DeleteResolveNode::DeleteResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
318 : ExpressionNode(location
)
319 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
324 inline DeleteBracketNode::DeleteBracketNode(const JSTokenLocation
& location
, ExpressionNode
* base
, ExpressionNode
* subscript
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
325 : ExpressionNode(location
)
326 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
328 , m_subscript(subscript
)
332 inline DeleteDotNode::DeleteDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
333 : ExpressionNode(location
)
334 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
340 inline DeleteValueNode::DeleteValueNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
341 : ExpressionNode(location
)
346 inline VoidNode::VoidNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
347 : ExpressionNode(location
)
352 inline TypeOfResolveNode::TypeOfResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
)
353 : ExpressionNode(location
, ResultType::stringType())
358 inline TypeOfValueNode::TypeOfValueNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
359 : ExpressionNode(location
, ResultType::stringType())
364 inline PrefixNode::PrefixNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, Operator oper
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
365 : ExpressionNode(location
)
366 , ThrowablePrefixedSubExpressionData(divot
, divotStart
, divotEnd
)
372 inline UnaryOpNode::UnaryOpNode(const JSTokenLocation
& location
, ResultType type
, ExpressionNode
* expr
, OpcodeID opcodeID
)
373 : ExpressionNode(location
, type
)
375 , m_opcodeID(opcodeID
)
379 inline UnaryPlusNode::UnaryPlusNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
380 : UnaryOpNode(location
, ResultType::numberType(), expr
, op_to_number
)
384 inline NegateNode::NegateNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
385 : UnaryOpNode(location
, ResultType::numberType(), expr
, op_negate
)
389 inline BitwiseNotNode::BitwiseNotNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
390 : ExpressionNode(location
, ResultType::forBitOp())
395 inline LogicalNotNode::LogicalNotNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
396 : UnaryOpNode(location
, ResultType::booleanType(), expr
, op_not
)
400 inline BinaryOpNode::BinaryOpNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
401 : ExpressionNode(location
)
404 , m_opcodeID(opcodeID
)
405 , m_rightHasAssignments(rightHasAssignments
)
409 inline BinaryOpNode::BinaryOpNode(const JSTokenLocation
& location
, ResultType type
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
410 : ExpressionNode(location
, type
)
413 , m_opcodeID(opcodeID
)
414 , m_rightHasAssignments(rightHasAssignments
)
418 inline MultNode::MultNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
419 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_mul
, rightHasAssignments
)
423 inline DivNode::DivNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
424 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_div
, rightHasAssignments
)
429 inline ModNode::ModNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
430 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_mod
, rightHasAssignments
)
434 inline AddNode::AddNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
435 : BinaryOpNode(location
, ResultType::forAdd(expr1
->resultDescriptor(), expr2
->resultDescriptor()), expr1
, expr2
, op_add
, rightHasAssignments
)
439 inline SubNode::SubNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
440 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_sub
, rightHasAssignments
)
444 inline LeftShiftNode::LeftShiftNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
445 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_lshift
, rightHasAssignments
)
449 inline RightShiftNode::RightShiftNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
450 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_rshift
, rightHasAssignments
)
454 inline UnsignedRightShiftNode::UnsignedRightShiftNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
455 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_urshift
, rightHasAssignments
)
459 inline LessNode::LessNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
460 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_less
, rightHasAssignments
)
464 inline GreaterNode::GreaterNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
465 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_greater
, rightHasAssignments
)
469 inline LessEqNode::LessEqNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
470 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_lesseq
, rightHasAssignments
)
474 inline GreaterEqNode::GreaterEqNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
475 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_greatereq
, rightHasAssignments
)
479 inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(const JSTokenLocation
& location
, ResultType type
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
480 : BinaryOpNode(location
, type
, expr1
, expr2
, opcodeID
, rightHasAssignments
)
484 inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
485 : BinaryOpNode(location
, expr1
, expr2
, opcodeID
, rightHasAssignments
)
489 inline InstanceOfNode::InstanceOfNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
490 : ThrowableBinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_instanceof
, rightHasAssignments
)
494 inline InNode::InNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
495 : ThrowableBinaryOpNode(location
, expr1
, expr2
, op_in
, rightHasAssignments
)
499 inline EqualNode::EqualNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
500 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_eq
, rightHasAssignments
)
504 inline NotEqualNode::NotEqualNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
505 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_neq
, rightHasAssignments
)
509 inline StrictEqualNode::StrictEqualNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
510 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_stricteq
, rightHasAssignments
)
514 inline NotStrictEqualNode::NotStrictEqualNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
515 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_nstricteq
, rightHasAssignments
)
519 inline BitAndNode::BitAndNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
520 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_bitand
, rightHasAssignments
)
524 inline BitOrNode::BitOrNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
525 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_bitor
, rightHasAssignments
)
529 inline BitXOrNode::BitXOrNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
530 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_bitxor
, rightHasAssignments
)
534 inline LogicalOpNode::LogicalOpNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, LogicalOperator oper
)
535 : ExpressionNode(location
, ResultType::forLogicalOp(expr1
->resultDescriptor(), expr2
->resultDescriptor()))
542 inline ConditionalNode::ConditionalNode(const JSTokenLocation
& location
, ExpressionNode
* logical
, ExpressionNode
* expr1
, ExpressionNode
* expr2
)
543 : ExpressionNode(location
)
550 inline ReadModifyResolveNode::ReadModifyResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, Operator oper
, ExpressionNode
* right
, bool rightHasAssignments
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
551 : ExpressionNode(location
)
552 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
556 , m_rightHasAssignments(rightHasAssignments
)
560 inline AssignResolveNode::AssignResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, ExpressionNode
* right
)
561 : ExpressionNode(location
)
568 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
)
569 : ExpressionNode(location
)
570 , ThrowableSubExpressionData(divot
, divotStart
, divotEnd
)
572 , m_subscript(subscript
)
575 , m_subscriptHasAssignments(subscriptHasAssignments
)
576 , m_rightHasAssignments(rightHasAssignments
)
580 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
)
581 : ExpressionNode(location
)
582 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
584 , m_subscript(subscript
)
586 , m_subscriptHasAssignments(subscriptHasAssignments
)
587 , m_rightHasAssignments(rightHasAssignments
)
591 inline AssignDotNode::AssignDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, ExpressionNode
* right
, bool rightHasAssignments
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
592 : ExpressionNode(location
)
593 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
597 , m_rightHasAssignments(rightHasAssignments
)
601 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
)
602 : ExpressionNode(location
)
603 , ThrowableSubExpressionData(divot
, divotStart
, divotEnd
)
608 , m_rightHasAssignments(rightHasAssignments
)
612 inline AssignErrorNode::AssignErrorNode(const JSTokenLocation
& location
, const JSTextPosition
& divot
, const JSTextPosition
& divotStart
, const JSTextPosition
& divotEnd
)
613 : ExpressionNode(location
)
614 , ThrowableExpressionData(divot
, divotStart
, divotEnd
)
618 inline CommaNode::CommaNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
)
619 : ExpressionNode(location
)
623 m_expressions
.append(expr1
);
624 m_expressions
.append(expr2
);
627 inline ConstStatementNode::ConstStatementNode(const JSTokenLocation
& location
, ConstDeclNode
* next
)
628 : StatementNode(location
)
633 inline SourceElements::SourceElements()
637 inline EmptyStatementNode::EmptyStatementNode(const JSTokenLocation
& location
)
638 : StatementNode(location
)
642 inline DebuggerStatementNode::DebuggerStatementNode(const JSTokenLocation
& location
)
643 : StatementNode(location
)
647 inline ExprStatementNode::ExprStatementNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
648 : StatementNode(location
)
653 inline VarStatementNode::VarStatementNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
654 : StatementNode(location
)
659 inline IfElseNode::IfElseNode(const JSTokenLocation
& location
, ExpressionNode
* condition
, StatementNode
* ifBlock
, StatementNode
* elseBlock
)
660 : StatementNode(location
)
661 , m_condition(condition
)
663 , m_elseBlock(elseBlock
)
667 inline DoWhileNode::DoWhileNode(const JSTokenLocation
& location
, StatementNode
* statement
, ExpressionNode
* expr
)
668 : StatementNode(location
)
669 , m_statement(statement
)
674 inline WhileNode::WhileNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, StatementNode
* statement
)
675 : StatementNode(location
)
677 , m_statement(statement
)
681 inline ForNode::ForNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, ExpressionNode
* expr3
, StatementNode
* statement
)
682 : StatementNode(location
)
686 , m_statement(statement
)
691 inline ContinueNode::ContinueNode(VM
* vm
, const JSTokenLocation
& location
)
692 : StatementNode(location
)
693 , m_ident(vm
->propertyNames
->nullIdentifier
)
697 inline ContinueNode::ContinueNode(const JSTokenLocation
& location
, const Identifier
& ident
)
698 : StatementNode(location
)
703 inline BreakNode::BreakNode(VM
* vm
, const JSTokenLocation
& location
)
704 : StatementNode(location
)
705 , m_ident(vm
->propertyNames
->nullIdentifier
)
709 inline BreakNode::BreakNode(const JSTokenLocation
& location
, const Identifier
& ident
)
710 : StatementNode(location
)
715 inline ReturnNode::ReturnNode(const JSTokenLocation
& location
, ExpressionNode
* value
)
716 : StatementNode(location
)
721 inline WithNode::WithNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, StatementNode
* statement
, const JSTextPosition
& divot
, uint32_t expressionLength
)
722 : StatementNode(location
)
724 , m_statement(statement
)
726 , m_expressionLength(expressionLength
)
730 inline LabelNode::LabelNode(const JSTokenLocation
& location
, const Identifier
& name
, StatementNode
* statement
)
731 : StatementNode(location
)
733 , m_statement(statement
)
737 inline ThrowNode::ThrowNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
738 : StatementNode(location
)
743 inline TryNode::TryNode(const JSTokenLocation
& location
, StatementNode
* tryBlock
, const Identifier
& exceptionIdent
, StatementNode
* catchBlock
, StatementNode
* finallyBlock
)
744 : StatementNode(location
)
745 , m_tryBlock(tryBlock
)
746 , m_exceptionIdent(exceptionIdent
)
747 , m_catchBlock(catchBlock
)
748 , m_finallyBlock(finallyBlock
)
752 inline ParameterNode::ParameterNode(PassRefPtr
<DeconstructionPatternNode
> pattern
)
759 inline ParameterNode::ParameterNode(ParameterNode
* l
, PassRefPtr
<DeconstructionPatternNode
> pattern
)
765 ASSERT(l
->m_pattern
);
768 inline FuncExprNode::FuncExprNode(const JSTokenLocation
& location
, const Identifier
& ident
, FunctionBodyNode
* body
, const SourceCode
& source
, ParameterNode
* parameter
)
769 : ExpressionNode(location
)
772 m_body
->finishParsing(source
, parameter
, ident
, FunctionExpression
);
775 inline FuncDeclNode::FuncDeclNode(const JSTokenLocation
& location
, const Identifier
& ident
, FunctionBodyNode
* body
, const SourceCode
& source
, ParameterNode
* parameter
)
776 : StatementNode(location
)
779 m_body
->finishParsing(source
, parameter
, ident
, FunctionDeclaration
);
782 inline CaseClauseNode::CaseClauseNode(ExpressionNode
* expr
, SourceElements
* statements
)
784 , m_statements(statements
)
788 inline ClauseListNode::ClauseListNode(CaseClauseNode
* clause
)
794 inline ClauseListNode::ClauseListNode(ClauseListNode
* clauseList
, CaseClauseNode
* clause
)
798 clauseList
->m_next
= this;
801 inline CaseBlockNode::CaseBlockNode(ClauseListNode
* list1
, CaseClauseNode
* defaultClause
, ClauseListNode
* list2
)
803 , m_defaultClause(defaultClause
)
808 inline SwitchNode::SwitchNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, CaseBlockNode
* block
)
809 : StatementNode(location
)
815 inline ConstDeclNode::ConstDeclNode(const JSTokenLocation
& location
, const Identifier
& ident
, ExpressionNode
* init
)
816 : ExpressionNode(location
)
823 inline BlockNode::BlockNode(const JSTokenLocation
& location
, SourceElements
* statements
)
824 : StatementNode(location
)
825 , m_statements(statements
)
829 inline EnumerationNode::EnumerationNode(const JSTokenLocation
& location
, ExpressionNode
* l
, ExpressionNode
* expr
, StatementNode
* statement
)
830 : StatementNode(location
)
833 , m_statement(statement
)
838 inline EnumerationNode::EnumerationNode(VM
* vm
, const JSTokenLocation
& location
, DeconstructionPatternNode
* pattern
, ExpressionNode
* expr
, StatementNode
* statement
)
839 : StatementNode(location
)
840 , m_lexpr(new (vm
) DeconstructingAssignmentNode(location
, pattern
, 0))
842 , m_statement(statement
)
847 inline ForInNode::ForInNode(const JSTokenLocation
& location
, ExpressionNode
* l
, ExpressionNode
* expr
, StatementNode
* statement
)
848 : EnumerationNode(location
, l
, expr
, statement
)
852 inline ForInNode::ForInNode(VM
* vm
, const JSTokenLocation
& location
, DeconstructionPatternNode
* pattern
, ExpressionNode
* expr
, StatementNode
* statement
)
853 : EnumerationNode(vm
, location
, pattern
, expr
, statement
)
857 inline ForOfNode::ForOfNode(const JSTokenLocation
& location
, ExpressionNode
* l
, ExpressionNode
* expr
, StatementNode
* statement
)
858 : EnumerationNode(location
, l
, expr
, statement
)
862 inline ForOfNode::ForOfNode(VM
* vm
, const JSTokenLocation
& location
, DeconstructionPatternNode
* pattern
, ExpressionNode
* expr
, StatementNode
* statement
)
863 : EnumerationNode(vm
, location
, pattern
, expr
, statement
)
867 inline DeconstructionPatternNode::DeconstructionPatternNode(VM
*)
871 inline ArrayPatternNode::ArrayPatternNode(VM
* vm
)
872 : DeconstructionPatternNode(vm
)
876 inline PassRefPtr
<ArrayPatternNode
> ArrayPatternNode::create(VM
* vm
)
878 return adoptRef(new ArrayPatternNode(vm
));
881 inline ObjectPatternNode::ObjectPatternNode(VM
* vm
)
882 : DeconstructionPatternNode(vm
)
886 inline PassRefPtr
<ObjectPatternNode
> ObjectPatternNode::create(VM
* vm
)
888 return adoptRef(new ObjectPatternNode(vm
));
891 inline PassRefPtr
<BindingNode
> BindingNode::create(VM
* vm
, const Identifier
& boundProperty
, const JSTextPosition
& start
, const JSTextPosition
& end
)
893 return adoptRef(new BindingNode(vm
, boundProperty
, start
, end
));
896 inline BindingNode::BindingNode(VM
* vm
, const Identifier
& boundProperty
, const JSTextPosition
& start
, const JSTextPosition
& end
)
897 : DeconstructionPatternNode(vm
)
898 , m_divotStart(start
)
900 , m_boundProperty(boundProperty
)
904 inline DeconstructingAssignmentNode::DeconstructingAssignmentNode(const JSTokenLocation
& location
, PassRefPtr
<DeconstructionPatternNode
> bindings
, ExpressionNode
* initializer
)
905 : ExpressionNode(location
)
906 , m_bindings(bindings
)
907 , m_initializer(initializer
)
913 #endif // NodeConstructors_h